import { StreamContract } from "../contracts/stream/stream.contract.mjs"; import { OrchestratorEvent } from "../contracts/orchestrator/orchestrator-event.type.mjs"; //#region ../ai/src/orchestrator/orchestrator-stream.d.ts /** * Internal async-queue controller driving `orchestrator.stream()`. * Mirrors {@link import("../supervisor/supervisor-stream").createSupervisorStream}'s * controller — same producer/consumer pipe, parameterized by the * orchestrator event union and the terminal result type. * * The turn pushes events as it advances through the lifecycle phases, * then settles with `end(result)` (the same `OrchestratorResult` that * `execute()` resolves) or `fail(error)` on an authoring/drift throw. */ type OrchestratorStreamController = { push(event: OrchestratorEvent): void; end(result: TResult): void; fail(error: Error): void; }; /** * Factory mirroring `createSupervisorStream`. Returns a paired * `{ controller, stream }` — the turn pushes events into the controller * while the caller iterates (or awaits `.result`) on the stream side. * * The `result` promise resolves to the same `OrchestratorResult` value * `execute()` produces; it rejects only when the turn throws before * producing a result (drift / config misuse) — runtime failures ride on * `result.error` and still settle via `end()`. * * Child `supervisor.*` / `agent.*` events bubble through this same pipe * unmodified (the turn forwards them as it observes them on the * delegated run); they share the `{ type, ...payload }` shape with the * orchestrator's own events so iteration narrows uniformly on * `event.type`. */ declare function createOrchestratorStream(): { controller: OrchestratorStreamController; stream: StreamContract; }; //#endregion export { OrchestratorStreamController, createOrchestratorStream }; //# sourceMappingURL=orchestrator-stream.d.mts.map