import type { AgentInput, AgentMetadata, AgentTaskResult, SupervisorAgentConfig, SupervisorAgentResult } from '../types/agent/index.js'; import type { TaskHandle } from '../types/agent/scheduler.js'; import type { SessionId, TurnId } from '../types/ids/index.js'; import type { SessionEventListener } from '../types/session/events.js'; import type { Logger } from '../utils/logger.js'; import { AbstractAgent } from './AbstractAgent.js'; /** * Build the authoritative per-task ledger from the gateway's task handles. * * A handle carries a `result` only when its worker actually produced one. A * handle with NO result never produced a verifiable outcome, so it MUST NOT be * synthesized as a success: the synthesized status is always the terminal * `'failed'`, regardless of the handle's reported `state` (which may itself be * `'completed'`). * * The earlier implementation cast `handle.state` onto the synthesized result's * status, letting a worker that ended without a result count toward * `completedTasks`. That produced fabricated "done" workers with empty outputs * (observed in a live supervised session): the supervisor reported "3 workers done, 40KB * reports" when the workers never started. Real workers (those with a present * `result`) are unaffected — their `result` is preserved verbatim. */ export declare function synthesizeTaskResults(taskHandles: readonly TaskHandle[], turn: { readonly sessionId: SessionId; readonly turnId: TurnId; }, now?: number): AgentTaskResult[]; /** Count only the task results that genuinely completed. */ export declare function countCompletedTasks(taskResults: readonly AgentTaskResult[]): number; export declare class SupervisorAgent extends AbstractAgent { readonly type: "supervisor"; constructor(metadata: Omit, log?: Logger); /** * One turn at a time per instance. * * `abortController` and `currentSessionId` are instance state, so two * overlapping turns share one abort controller — cancelling either kills * both — and the second clobbers the first's session, so a later * `cancel()` cancels the wrong children. Neither failure announces itself. * A host that wants parallelism constructs a second instance. */ run(input: AgentInput, config: SupervisorAgentConfig, listener?: SessionEventListener): Promise; private runExclusive; } //# sourceMappingURL=SupervisorAgent.d.ts.map