import { OrchestratorCommands } from "../contracts/orchestrator/orchestrator-commands.type.mjs"; //#region ../ai/src/orchestrator/commands.d.ts /** * Per-command handler bag — one async runner per key of * {@link OrchestratorCommands}. The orchestrator factory supplies the * `compact` runner (which delegates to the shared compaction code path, * §11) so this module owns command ROUTING only, never the compaction * logic itself. * * Typed against the same discriminated map the public `command` * method uses, so a registered handler's `args` / result line up with * the contract with no casting at the call site. */ type OrchestratorCommandHandlers = { [K in keyof OrchestratorCommands]: (args: OrchestratorCommands[K]["args"]) => Promise }; /** * Build the typed `command(name, args)` dispatcher backing * {@link import("../contracts/orchestrator/orchestrator.contract").OrchestratorContract.command} * (design §11). Looks the command up in the supplied handler bag and * forwards `args`, preserving the discriminated `OrchestratorCommands` * typing end to end. * * v1 ships exactly one built-in command, `compact`. v2 user commands * attach via module augmentation of `OrchestratorCommands`; the * dispatcher widens with the map automatically, and an unregistered * command throws {@link SupervisorFailedError} rather than silently * resolving `undefined`. * * @example * const command = createCommandDispatcher({ * compact: (args) => runCompaction(args), * }); * const result = await command("compact", { sessionId, history }); */ declare function createCommandDispatcher(handlers: OrchestratorCommandHandlers): (name: K, args: OrchestratorCommands[K]["args"]) => Promise; //#endregion export { OrchestratorCommandHandlers, createCommandDispatcher }; //# sourceMappingURL=commands.d.mts.map