pub async fn build(
resolved: &ResolvedModel,
args: &Args,
cwd: &Path,
) -> Result<(AgentHarness, Receiver<AgentEvent>), BuildError>Expand description
Build the AgentHarness from the resolved model + parsed args + cwd.
This is the v1 equivalent of TS createAgentSession. It:
- Builds the
OsExecutionEnvrooted atcwd. - Constructs the built-in tools (optionally filtered by
--tools/--exclude-tools/--no-tools/--no-builtin-tools). - Resolves the session storage (ephemeral vs fresh JSONL vs restore-error).
- Assembles
AgentHarnessOptionsand callsAgentHarness::create.
Returns the harness plus a broadcast::Receiver<AgentEvent> carrying the
live AgentEvent stream from every run (backed by a BroadcastEmitter
installed on the harness). Interactive mode drains this to render streaming
responses; the non-interactive modes simply drop it.