import type { Agent, Scope, Thinking } from "../catalog/agents.js"; import type { AgentRunDetails } from "../runtime/types.js"; export interface SpawnUpdate { text: string; details: AgentRunDetails; } export interface SpawnResult { id: string; runId?: string; parentNodeId?: string; depth: number; agent: string; text: string; exitCode: number; usage: AgentRunDetails["usage"]; model?: string; details: AgentRunDetails; } export interface SpawnHandle { id: string; runId?: string; parentNodeId?: string; depth: number; status: "running" | "completed" | "stopped"; updates: AsyncIterable; wait(): Promise; abort(): Promise; capabilities?: { steer: boolean; resume: boolean; transcript: boolean; }; } export interface SpawnRequest { agent: Agent; task: string; cwd: string; scope: Scope; discoveryDiagnostics: string[]; runId?: string; parentNodeId?: string; depth?: number; env?: Record; defaultModel?: string; defaultThinking?: Thinking; } export interface SpawnEngine { spawn(spec: SpawnRequest): SpawnHandle; }