Expand description
ForgeSdkBridge - in-process driver around a forge_sdk::Client.
Drives a forge_sdk::Client directly - no Node.js subprocess,
no NDJSON, no command queue. The bridge holds the spawned
Arc<Client> and dispatches each method as a direct call
(or a tokio::spawnβd async task when the method is
fire-and-forget). Synthesized events (Connected, PermissionRequest,
McpSnapshot, β¦) flow back through an mpsc::UnboundedSender<AgentEvent>
the bridge owns; consumers grab the matching receiver once via
ForgeSdkBridge::take_events.
view ForgeSdkBridge forge_sdk::Client
| trait method | |
|------------------------>| client.method().await |
| |----------------------------------->|
| | |
| AgentEvent | reader_loop / callbacks |
|<------ event_tx --------+<-----------------------------------|Re-exportsΒ§
use std::collections::HashMap;πuse std::path::Path;πuse std::path::PathBuf;πuse std::sync::Arc;πuse std::time::Instant;πuse forge_sdk::Client;πuse parking_lot::Mutex;πuse serde_json::Value;πuse tokio::sync::mpsc;πuse tokio::sync::oneshot;πuse tracing::Instrument;πuse crate::client::AgentEvent;πuse crate::client::SessionLaunchSettings;πuse crate::client::SpawnFailureKind;πuse crate::forge_sdk_worker;πuse crate::forge_sdk_worker::SessionId;πuse forge_primitives::PermissionMode;πuse forge_primitives::PermissionOutcome;πuse forge_primitives::QuestionOutcome;π
StructsΒ§
- Bridge
Inner π - Forge
SdkBridge - In-process bridge wrapping a single
forge_sdk::Client. - Probe
InFlight π - Holds a seatβs probe mark while its probe is out, and releases it however the probe ends: an answer, an error, a timeout, or a dispatch that never reached a client at all.
ConstantsΒ§
- TESTING_
STUB_ πCONFIG_ DIR - Sentinel
config_dirforForgeSdkBridgetest stubs that never exercise the path. Production code constructs the bridge with a real accountconfig_dir; tests that donβt drive a session use this path so the typed field stays non-optional.
FunctionsΒ§
- spawn_
failure_ πkind - Name the class of a spawn failure from the SDK error itself, so a consumer never has to infer it from the rendered message.
- turn_
error π - The turn-error event for a failure forge hit itself, classified where the message is built: a reader branching on the class gets it without searching the prose.
Type AliasesΒ§
- Pending
Questions π - Pending question outcomes keyed by
tool_use_id. TheAskUserQuestiondriver in thecan_use_toolcallback parks a fresh oneshot per question, emits aQuestionRequest, and awaits the matchingquestion_response. - Pending
Responses π - Pending permission responses keyed by
tool_use_id. Thecan_use_toolcallback parks a oneshot here when the CLI asks; dispatch drains it when the matchingpermission_responsearrives from a view.