/** * [WHO]: InProcessSubAgentBackend class - in-process SubAgent backend * [FROM]: Depends on core/runtime/sdk, ./sub-agent-types * [TO]: Consumed by ./sub-agent-runtime, ./index.ts * [HERE]: core/sub-agent/sub-agent-backend.ts - in-process SubAgent implementation */ import type { CreateAgentSessionOptions } from "../runtime/sdk.js"; import type { AgentSession } from "../runtime/agent-session.js"; import type { SubAgentBackend, SubAgentHandle, SubAgentSpec } from "./sub-agent-types.js"; /** * Factory function type for creating an AgentSession. * Injected by the caller (agent-session.ts) to avoid a circular dependency * between core/sub-agent/ and core/runtime/sdk.ts. */ export type CreateSessionFn = (options: CreateAgentSessionOptions) => Promise<{ session: AgentSession; }>; /** * In-process SubAgent backend. * Wraps createAgentSession() to run SubAgent in the same process. */ export declare class InProcessSubAgentBackend implements SubAgentBackend { private createSession; /** Running sessions indexed by agentId (for SendMessage routing, CC §XI) */ private sessions; constructor(createSession: CreateSessionFn); spawn(spec: SubAgentSpec): Promise; /** * Get a running agent's session by agent ID (for SendMessage routing, CC §XI). * Returns undefined if the agent is not running or has completed. */ getSession(agentId: string): { session: AgentSession; abort: () => void; } | undefined; }