Skip to main content

spawn_session

Function spawn_session 

Source
pub(crate) async fn spawn_session(
    bridge: &ForgeSdkBridge,
    cwd: &str,
    id: SessionId<'_>,
    launch_settings: &SessionLaunchSettings,
) -> Result<()>
Expand description

Spawn a fresh Client for bridge and start the reader subtask. Builds Options from launch_settings (mode, model, effort, can_use_tool callback). id says which session the child runs under; a Resume also backfills past turns into the Connected event’s history_updates.

On success the bridge’s client slot is populated and a AgentEvent::Connected is emitted. On failure the caller is expected to surface a AgentEvent::ConnectionFailed from the returned error.