@wrongstack/core 0.284.1 → 0.285.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-status-tracker.d.ts +74 -0
- package/dist/agent-status-tracker.d.ts.map +1 -0
- package/dist/autophase/auto-phase-planner.d.ts +79 -0
- package/dist/autophase/auto-phase-planner.d.ts.map +1 -0
- package/dist/autophase/auto-phase-runner.d.ts +79 -0
- package/dist/autophase/auto-phase-runner.d.ts.map +1 -0
- package/dist/autophase/checkpoint.d.ts +49 -0
- package/dist/autophase/checkpoint.d.ts.map +1 -0
- package/dist/autophase/index.d.ts +9 -0
- package/dist/autophase/index.d.ts.map +1 -0
- package/dist/autophase/phase-graph-builder.d.ts +46 -0
- package/dist/autophase/phase-graph-builder.d.ts.map +1 -0
- package/dist/autophase/phase-orchestrator.d.ts +150 -0
- package/dist/autophase/phase-orchestrator.d.ts.map +1 -0
- package/dist/autophase/phase-store.d.ts +29 -0
- package/dist/autophase/phase-store.d.ts.map +1 -0
- package/dist/autophase/types.d.ts +329 -0
- package/dist/autophase/types.d.ts.map +1 -0
- package/dist/boot.d.ts +73 -0
- package/dist/boot.d.ts.map +1 -0
- package/dist/coordination/adaptive-concurrency.d.ts +63 -0
- package/dist/coordination/adaptive-concurrency.d.ts.map +1 -0
- package/dist/coordination/agent-bridge.d.ts +24 -0
- package/dist/coordination/agent-bridge.d.ts.map +1 -0
- package/dist/coordination/agent-monitor.d.ts +100 -0
- package/dist/coordination/agent-monitor.d.ts.map +1 -0
- package/dist/coordination/agent-subagent-runner.d.ts +74 -0
- package/dist/coordination/agent-subagent-runner.d.ts.map +1 -0
- package/dist/coordination/agents/agent-prompts.d.ts +2 -0
- package/dist/coordination/agents/agent-prompts.d.ts.map +1 -0
- package/dist/coordination/agents/index.d.ts +35 -0
- package/dist/coordination/agents/index.d.ts.map +1 -0
- package/dist/coordination/agents/phase1-discovery.d.ts +4 -0
- package/dist/coordination/agents/phase1-discovery.d.ts.map +1 -0
- package/dist/coordination/agents/phase2-planning.d.ts +4 -0
- package/dist/coordination/agents/phase2-planning.d.ts.map +1 -0
- package/dist/coordination/agents/phase3-build.d.ts +4 -0
- package/dist/coordination/agents/phase3-build.d.ts.map +1 -0
- package/dist/coordination/agents/phase3-techstack.d.ts +13 -0
- package/dist/coordination/agents/phase3-techstack.d.ts.map +1 -0
- package/dist/coordination/agents/phase4-verify.d.ts +4 -0
- package/dist/coordination/agents/phase4-verify.d.ts.map +1 -0
- package/dist/coordination/agents/phase5-review.d.ts +4 -0
- package/dist/coordination/agents/phase5-review.d.ts.map +1 -0
- package/dist/coordination/agents/phase6-domain.d.ts +4 -0
- package/dist/coordination/agents/phase6-domain.d.ts.map +1 -0
- package/dist/coordination/agents/phase7-knowledge.d.ts +4 -0
- package/dist/coordination/agents/phase7-knowledge.d.ts.map +1 -0
- package/dist/coordination/agents/phase8-delivery.d.ts +4 -0
- package/dist/coordination/agents/phase8-delivery.d.ts.map +1 -0
- package/dist/coordination/agents/phase9-meta.d.ts +4 -0
- package/dist/coordination/agents/phase9-meta.d.ts.map +1 -0
- package/dist/coordination/agents/types.d.ts +79 -0
- package/dist/coordination/agents/types.d.ts.map +1 -0
- package/dist/coordination/agents.d.ts +8 -0
- package/dist/coordination/agents.d.ts.map +1 -0
- package/dist/coordination/auto-extend.d.ts +46 -0
- package/dist/coordination/auto-extend.d.ts.map +1 -0
- package/dist/coordination/autonomous-brain.d.ts +154 -0
- package/dist/coordination/autonomous-brain.d.ts.map +1 -0
- package/dist/coordination/autonomous-coordinator.d.ts +239 -0
- package/dist/coordination/autonomous-coordinator.d.ts.map +1 -0
- package/dist/coordination/brain-monitor.d.ts +74 -0
- package/dist/coordination/brain-monitor.d.ts.map +1 -0
- package/dist/coordination/brain.d.ts +104 -0
- package/dist/coordination/brain.d.ts.map +1 -0
- package/dist/coordination/change-manager.d.ts +151 -0
- package/dist/coordination/change-manager.d.ts.map +1 -0
- package/dist/coordination/checkpoint-wiring.d.ts +61 -0
- package/dist/coordination/checkpoint-wiring.d.ts.map +1 -0
- package/dist/coordination/collab-bus.d.ts +132 -0
- package/dist/coordination/collab-bus.d.ts.map +1 -0
- package/dist/coordination/collab-debug.d.ts +302 -0
- package/dist/coordination/collab-debug.d.ts.map +1 -0
- package/dist/coordination/commit-safety.d.ts +72 -0
- package/dist/coordination/commit-safety.d.ts.map +1 -0
- package/dist/coordination/consensus-protocol.d.ts +106 -0
- package/dist/coordination/consensus-protocol.d.ts.map +1 -0
- package/dist/coordination/coordinator/error-classifier.d.ts +15 -0
- package/dist/coordination/coordinator/error-classifier.d.ts.map +1 -0
- package/dist/coordination/delegate-tool.d.ts +101 -0
- package/dist/coordination/delegate-tool.d.ts.map +1 -0
- package/dist/coordination/dep-watcher-bridge.d.ts +47 -0
- package/dist/coordination/dep-watcher-bridge.d.ts.map +1 -0
- package/dist/coordination/dep-watcher.d.ts +74 -0
- package/dist/coordination/dep-watcher.d.ts.map +1 -0
- package/dist/coordination/director/director-errors.d.ts +29 -0
- package/dist/coordination/director/director-errors.d.ts.map +1 -0
- package/dist/coordination/director-construction.d.ts +90 -0
- package/dist/coordination/director-construction.d.ts.map +1 -0
- package/dist/coordination/director-prompts.d.ts +119 -0
- package/dist/coordination/director-prompts.d.ts.map +1 -0
- package/dist/coordination/director-session.d.ts +68 -0
- package/dist/coordination/director-session.d.ts.map +1 -0
- package/dist/coordination/director-tools.d.ts +65 -0
- package/dist/coordination/director-tools.d.ts.map +1 -0
- package/dist/coordination/director.d.ts +802 -0
- package/dist/coordination/director.d.ts.map +1 -0
- package/dist/coordination/dispatcher.d.ts +82 -0
- package/dist/coordination/dispatcher.d.ts.map +1 -0
- package/dist/coordination/file-author-tracker.d.ts +76 -0
- package/dist/coordination/file-author-tracker.d.ts.map +1 -0
- package/dist/coordination/fleet-bus.d.ts +122 -0
- package/dist/coordination/fleet-bus.d.ts.map +1 -0
- package/dist/coordination/fleet-event-validation.d.ts +10 -0
- package/dist/coordination/fleet-event-validation.d.ts.map +1 -0
- package/dist/coordination/fleet-manager.d.ts +234 -0
- package/dist/coordination/fleet-manager.d.ts.map +1 -0
- package/dist/coordination/fleet-spawn.d.ts +102 -0
- package/dist/coordination/fleet-spawn.d.ts.map +1 -0
- package/dist/coordination/fleet-status-tool.d.ts +36 -0
- package/dist/coordination/fleet-status-tool.d.ts.map +1 -0
- package/dist/coordination/fleet-supervisor.d.ts +157 -0
- package/dist/coordination/fleet-supervisor.d.ts.map +1 -0
- package/dist/coordination/fleet.d.ts +96 -0
- package/dist/coordination/fleet.d.ts.map +1 -0
- package/dist/coordination/global-mailbox.d.ts +234 -0
- package/dist/coordination/global-mailbox.d.ts.map +1 -0
- package/dist/coordination/icoordinator.d.ts +97 -0
- package/dist/coordination/icoordinator.d.ts.map +1 -0
- package/dist/coordination/ifleet-manager.d.ts +177 -0
- package/dist/coordination/ifleet-manager.d.ts.map +1 -0
- package/dist/coordination/in-memory-transport.d.ts +12 -0
- package/dist/coordination/in-memory-transport.d.ts.map +1 -0
- package/dist/coordination/index.d.ts +78 -2587
- package/dist/coordination/index.d.ts.map +1 -0
- package/dist/coordination/index.js +739 -254
- package/dist/coordination/index.js.map +7 -1
- package/dist/coordination/knowledge-graph.d.ts +217 -0
- package/dist/coordination/knowledge-graph.d.ts.map +1 -0
- package/dist/coordination/large-answer-store.d.ts +61 -0
- package/dist/coordination/large-answer-store.d.ts.map +1 -0
- package/dist/coordination/mail-tools.d.ts +34 -0
- package/dist/coordination/mail-tools.d.ts.map +1 -0
- package/dist/coordination/mailbox-actions.d.ts +68 -0
- package/dist/coordination/mailbox-actions.d.ts.map +1 -0
- package/dist/coordination/mailbox-health.d.ts +131 -0
- package/dist/coordination/mailbox-health.d.ts.map +1 -0
- package/dist/coordination/mailbox-hooks.d.ts +55 -0
- package/dist/coordination/mailbox-hooks.d.ts.map +1 -0
- package/dist/coordination/mailbox-tool.d.ts +75 -0
- package/dist/coordination/mailbox-tool.d.ts.map +1 -0
- package/dist/{mailbox-types-BGZWrYTJ.d.ts → coordination/mailbox-types.d.ts} +37 -22
- package/dist/coordination/mailbox-types.d.ts.map +1 -0
- package/dist/coordination/mailbox.d.ts +69 -0
- package/dist/coordination/mailbox.d.ts.map +1 -0
- package/dist/coordination/model-matrix.d.ts +98 -0
- package/dist/coordination/model-matrix.d.ts.map +1 -0
- package/dist/coordination/multi-agent-coordinator.d.ts +202 -0
- package/dist/coordination/multi-agent-coordinator.d.ts.map +1 -0
- package/dist/coordination/null-fleet-bus.d.ts +10 -0
- package/dist/coordination/null-fleet-bus.d.ts.map +1 -0
- package/dist/coordination/package-author-tracker.d.ts +87 -0
- package/dist/coordination/package-author-tracker.d.ts.map +1 -0
- package/dist/coordination/package-outdated-watcher.d.ts +83 -0
- package/dist/coordination/package-outdated-watcher.d.ts.map +1 -0
- package/dist/coordination/single-instance-mailbox.d.ts +154 -0
- package/dist/coordination/single-instance-mailbox.d.ts.map +1 -0
- package/dist/coordination/spawn-budget.d.ts +6 -0
- package/dist/coordination/spawn-budget.d.ts.map +1 -0
- package/dist/coordination/subagent-budget.d.ts +323 -0
- package/dist/coordination/subagent-budget.d.ts.map +1 -0
- package/dist/coordination/subagent-nicknames.d.ts +42 -0
- package/dist/coordination/subagent-nicknames.d.ts.map +1 -0
- package/dist/coordination/subagent-result-tool.d.ts +20 -0
- package/dist/coordination/subagent-result-tool.d.ts.map +1 -0
- package/dist/coordination/task-auctioneer.d.ts +143 -0
- package/dist/coordination/task-auctioneer.d.ts.map +1 -0
- package/dist/coordination/task-dag.d.ts +147 -0
- package/dist/coordination/task-dag.d.ts.map +1 -0
- package/dist/coordination/techstack-mailbox-consumer.d.ts +50 -0
- package/dist/coordination/techstack-mailbox-consumer.d.ts.map +1 -0
- package/dist/coordination/transport.d.ts +2 -0
- package/dist/coordination/transport.d.ts.map +1 -0
- package/dist/coordination/worktree-task-runner.d.ts +45 -0
- package/dist/coordination/worktree-task-runner.d.ts.map +1 -0
- package/dist/core/agent-internals.d.ts +41 -0
- package/dist/core/agent-internals.d.ts.map +1 -0
- package/dist/core/agent-loop.d.ts +18 -0
- package/dist/core/agent-loop.d.ts.map +1 -0
- package/dist/core/agent-response.d.ts +21 -0
- package/dist/core/agent-response.d.ts.map +1 -0
- package/dist/core/agent-tools.d.ts +21 -0
- package/dist/core/agent-tools.d.ts.map +1 -0
- package/dist/core/agent-types.d.ts +95 -0
- package/dist/core/agent-types.d.ts.map +1 -0
- package/dist/core/agent.d.ts +54 -0
- package/dist/core/agent.d.ts.map +1 -0
- package/dist/core/btw.d.ts +40 -0
- package/dist/core/btw.d.ts.map +1 -0
- package/dist/core/context.d.ts +269 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/continue-intent.d.ts +92 -0
- package/dist/core/continue-intent.d.ts.map +1 -0
- package/dist/core/continue-to-next-iteration.d.ts +96 -0
- package/dist/core/continue-to-next-iteration.d.ts.map +1 -0
- package/dist/core/conversation-state.d.ts +96 -0
- package/dist/core/conversation-state.d.ts.map +1 -0
- package/dist/core/fallback-model.d.ts +94 -0
- package/dist/core/fallback-model.d.ts.map +1 -0
- package/dist/core/fleet-pulse.d.ts +42 -0
- package/dist/core/fleet-pulse.d.ts.map +1 -0
- package/dist/core/input-builder.d.ts +95 -0
- package/dist/core/input-builder.d.ts.map +1 -0
- package/dist/core/instruction-bundle.d.ts +22 -0
- package/dist/core/instruction-bundle.d.ts.map +1 -0
- package/dist/core/iteration-limit.d.ts +35 -0
- package/dist/core/iteration-limit.d.ts.map +1 -0
- package/dist/core/mailbox-loop.d.ts +63 -0
- package/dist/core/mailbox-loop.d.ts.map +1 -0
- package/dist/core/modes/brief.d.ts +2 -0
- package/dist/core/modes/brief.d.ts.map +1 -0
- package/dist/core/modes/default.d.ts +8 -0
- package/dist/core/modes/default.d.ts.map +1 -0
- package/dist/core/modes/teach.d.ts +2 -0
- package/dist/core/modes/teach.d.ts.map +1 -0
- package/dist/core/provider-runner.d.ts +24 -0
- package/dist/core/provider-runner.d.ts.map +1 -0
- package/dist/core/queued-messages.d.ts +55 -0
- package/dist/core/queued-messages.d.ts.map +1 -0
- package/dist/core/run-env.d.ts +49 -0
- package/dist/core/run-env.d.ts.map +1 -0
- package/dist/core/streaming-response-builder.d.ts +78 -0
- package/dist/core/streaming-response-builder.d.ts.map +1 -0
- package/dist/core/system-prompt-builder.d.ts +213 -0
- package/dist/core/system-prompt-builder.d.ts.map +1 -0
- package/dist/defaults/index.d.ts +68 -158
- package/dist/defaults/index.d.ts.map +1 -0
- package/dist/defaults/index.js +1257 -819
- package/dist/defaults/index.js.map +7 -1
- package/dist/execution/auto-compaction-middleware.d.ts +123 -0
- package/dist/execution/auto-compaction-middleware.d.ts.map +1 -0
- package/dist/execution/autonomous-runner.d.ts +55 -0
- package/dist/execution/autonomous-runner.d.ts.map +1 -0
- package/dist/execution/autonomy-brain.d.ts +90 -0
- package/dist/execution/autonomy-brain.d.ts.map +1 -0
- package/dist/execution/autonomy-prompt-contributor.d.ts +39 -0
- package/dist/execution/autonomy-prompt-contributor.d.ts.map +1 -0
- package/dist/execution/compaction-core.d.ts +103 -0
- package/dist/execution/compaction-core.d.ts.map +1 -0
- package/dist/execution/compactor.d.ts +56 -0
- package/dist/execution/compactor.d.ts.map +1 -0
- package/dist/execution/design-color.d.ts +31 -0
- package/dist/execution/design-color.d.ts.map +1 -0
- package/dist/execution/design-detect.d.ts +96 -0
- package/dist/execution/design-detect.d.ts.map +1 -0
- package/dist/execution/design-kit-loader.d.ts +53 -0
- package/dist/execution/design-kit-loader.d.ts.map +1 -0
- package/dist/execution/design-materialize.d.ts +32 -0
- package/dist/execution/design-materialize.d.ts.map +1 -0
- package/dist/execution/design-project-store.d.ts +57 -0
- package/dist/execution/design-project-store.d.ts.map +1 -0
- package/dist/execution/design-verify.d.ts +44 -0
- package/dist/execution/design-verify.d.ts.map +1 -0
- package/dist/execution/error-handler.d.ts +34 -0
- package/dist/execution/error-handler.d.ts.map +1 -0
- package/dist/{parallel-eternal-engine-HUrtePLd.d.ts → execution/eternal-autonomy.d.ts} +10 -225
- package/dist/execution/eternal-autonomy.d.ts.map +1 -0
- package/dist/execution/goal-preamble.d.ts +2 -0
- package/dist/execution/goal-preamble.d.ts.map +1 -0
- package/dist/execution/index.d.ts +21 -180
- package/dist/execution/index.d.ts.map +1 -0
- package/dist/execution/index.js +465 -180
- package/dist/execution/index.js.map +7 -1
- package/dist/execution/intelligent-compactor.d.ts +85 -0
- package/dist/execution/intelligent-compactor.d.ts.map +1 -0
- package/dist/execution/model-runtime.d.ts +75 -0
- package/dist/execution/model-runtime.d.ts.map +1 -0
- package/dist/execution/parallel-eternal-engine.d.ts +130 -0
- package/dist/execution/parallel-eternal-engine.d.ts.map +1 -0
- package/dist/execution/prompt-enhancer.d.ts +12 -13
- package/dist/execution/prompt-enhancer.d.ts.map +1 -0
- package/dist/execution/prompt-enhancer.js +13 -7
- package/dist/execution/prompt-enhancer.js.map +7 -1
- package/dist/execution/prompt-loader.d.ts +52 -0
- package/dist/execution/prompt-loader.d.ts.map +1 -0
- package/dist/execution/provider-runner-impl.d.ts +14 -0
- package/dist/execution/provider-runner-impl.d.ts.map +1 -0
- package/dist/execution/regex-patterns.d.ts +7 -0
- package/dist/execution/regex-patterns.d.ts.map +1 -0
- package/dist/execution/retry-policy.d.ts +35 -0
- package/dist/execution/retry-policy.d.ts.map +1 -0
- package/dist/execution/selective-compactor.d.ts +94 -0
- package/dist/execution/selective-compactor.d.ts.map +1 -0
- package/dist/execution/skill-loader.d.ts +43 -0
- package/dist/execution/skill-loader.d.ts.map +1 -0
- package/dist/execution/strategy-compactor.d.ts +43 -0
- package/dist/execution/strategy-compactor.d.ts.map +1 -0
- package/dist/execution/tool-executor.d.ts +112 -0
- package/dist/execution/tool-executor.d.ts.map +1 -0
- package/dist/extension/extension-points.d.ts +121 -0
- package/dist/extension/extension-points.d.ts.map +1 -0
- package/dist/extension/index.d.ts +3 -10
- package/dist/extension/index.d.ts.map +1 -0
- package/dist/extension/index.js +59 -5
- package/dist/extension/index.js.map +7 -1
- package/dist/extension/registry.d.ts +86 -0
- package/dist/extension/registry.d.ts.map +1 -0
- package/dist/fleet-notifier.d.ts +28 -0
- package/dist/fleet-notifier.d.ts.map +1 -0
- package/dist/hooks/http-executor.d.ts +11 -0
- package/dist/hooks/http-executor.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/registry.d.ts +71 -0
- package/dist/hooks/registry.d.ts.map +1 -0
- package/dist/hooks/runner.d.ts +65 -0
- package/dist/hooks/runner.d.ts.map +1 -0
- package/dist/hooks/shell-executor.d.ts +33 -0
- package/dist/hooks/shell-executor.d.ts.map +1 -0
- package/dist/hooks/shell-hooks-equal.d.ts +15 -0
- package/dist/hooks/shell-hooks-equal.d.ts.map +1 -0
- package/dist/hq/agent-bridge.d.ts +27 -0
- package/dist/hq/agent-bridge.d.ts.map +1 -0
- package/dist/hq/alerts.d.ts +67 -0
- package/dist/hq/alerts.d.ts.map +1 -0
- package/dist/hq/auth-store.d.ts +161 -0
- package/dist/hq/auth-store.d.ts.map +1 -0
- package/dist/hq/brain-bridge.d.ts +37 -0
- package/dist/hq/brain-bridge.d.ts.map +1 -0
- package/dist/hq/commands.d.ts +122 -0
- package/dist/hq/commands.d.ts.map +1 -0
- package/dist/hq/cost-bridge.d.ts +36 -0
- package/dist/hq/cost-bridge.d.ts.map +1 -0
- package/dist/hq/factory.d.ts +66 -0
- package/dist/hq/factory.d.ts.map +1 -0
- package/dist/hq/fleet-bridge.d.ts +39 -0
- package/dist/hq/fleet-bridge.d.ts.map +1 -0
- package/dist/hq/index.d.ts +18 -816
- package/dist/hq/index.d.ts.map +1 -0
- package/dist/hq/index.js +417 -122
- package/dist/hq/index.js.map +7 -1
- package/dist/hq/mailbox-mapper.d.ts +27 -0
- package/dist/hq/mailbox-mapper.d.ts.map +1 -0
- package/dist/hq/persistence.d.ts +121 -0
- package/dist/hq/persistence.d.ts.map +1 -0
- package/dist/hq/protocol.d.ts +560 -0
- package/dist/hq/protocol.d.ts.map +1 -0
- package/dist/hq/publisher.d.ts +177 -0
- package/dist/hq/publisher.d.ts.map +1 -0
- package/dist/hq/redaction.d.ts +30 -0
- package/dist/hq/redaction.d.ts.map +1 -0
- package/dist/hq/session-bridge.d.ts +29 -0
- package/dist/hq/session-bridge.d.ts.map +1 -0
- package/dist/hq/tool-bridge.d.ts +41 -0
- package/dist/hq/tool-bridge.d.ts.map +1 -0
- package/dist/hq/transcript-mapper.d.ts +36 -0
- package/dist/hq/transcript-mapper.d.ts.map +1 -0
- package/dist/hq/worktree-bridge.d.ts +34 -0
- package/dist/hq/worktree-bridge.d.ts.map +1 -0
- package/dist/index.d.ts +108 -2872
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2724 -1344
- package/dist/index.js.map +7 -1
- package/dist/infrastructure/context-manager.d.ts +92 -0
- package/dist/infrastructure/context-manager.d.ts.map +1 -0
- package/dist/infrastructure/index.d.ts +6 -64
- package/dist/infrastructure/index.d.ts.map +1 -0
- package/dist/infrastructure/index.js +39 -12
- package/dist/infrastructure/index.js.map +7 -1
- package/dist/infrastructure/logger.d.ts +99 -0
- package/dist/infrastructure/logger.d.ts.map +1 -0
- package/dist/infrastructure/mcp-servers.d.ts +83 -0
- package/dist/infrastructure/mcp-servers.d.ts.map +1 -0
- package/dist/{path-resolver-CMS5307d.d.ts → infrastructure/path-resolver.d.ts} +3 -5
- package/dist/infrastructure/path-resolver.d.ts.map +1 -0
- package/dist/infrastructure/token-counter.d.ts +57 -0
- package/dist/infrastructure/token-counter.d.ts.map +1 -0
- package/dist/kernel/container.d.ts +84 -0
- package/dist/kernel/container.d.ts.map +1 -0
- package/dist/{events-Bgnh43r9.d.ts → kernel/events.d.ts} +112 -206
- package/dist/kernel/events.d.ts.map +1 -0
- package/dist/kernel/index.d.ts +6 -107
- package/dist/kernel/index.d.ts.map +1 -0
- package/dist/kernel/index.js +56 -4
- package/dist/kernel/index.js.map +7 -1
- package/dist/kernel/pipeline.d.ts +105 -0
- package/dist/kernel/pipeline.d.ts.map +1 -0
- package/dist/kernel/run-controller.d.ts +55 -0
- package/dist/kernel/run-controller.d.ts.map +1 -0
- package/dist/kernel/tokens.d.ts +53 -0
- package/dist/kernel/tokens.d.ts.map +1 -0
- package/dist/mailbox-attach.d.ts +27 -0
- package/dist/mailbox-attach.d.ts.map +1 -0
- package/dist/middleware/collab-pause.d.ts +73 -0
- package/dist/middleware/collab-pause.d.ts.map +1 -0
- package/dist/models/codex-catalog.d.ts +41 -0
- package/dist/models/codex-catalog.d.ts.map +1 -0
- package/dist/models/index.d.ts +8 -163
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +150 -51
- package/dist/models/index.js.map +7 -1
- package/dist/models/llm-selector.d.ts +47 -0
- package/dist/models/llm-selector.d.ts.map +1 -0
- package/dist/models/mode-store.d.ts +22 -0
- package/dist/models/mode-store.d.ts.map +1 -0
- package/dist/models/model-intelligence.d.ts +56 -0
- package/dist/models/model-intelligence.d.ts.map +1 -0
- package/dist/models/model-router.d.ts +100 -0
- package/dist/models/model-router.d.ts.map +1 -0
- package/dist/models/models-registry.d.ts +106 -0
- package/dist/models/models-registry.d.ts.map +1 -0
- package/dist/models/provider-model-resolve.d.ts +69 -0
- package/dist/models/provider-model-resolve.d.ts.map +1 -0
- package/dist/observability/event-bridge.d.ts +10 -0
- package/dist/observability/event-bridge.d.ts.map +1 -0
- package/dist/observability/health.d.ts +18 -0
- package/dist/observability/health.d.ts.map +1 -0
- package/dist/observability/index.d.ts +9 -354
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +21 -8
- package/dist/observability/index.js.map +7 -1
- package/dist/observability/metrics.d.ts +26 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/otel-tracer.d.ts +41 -0
- package/dist/observability/otel-tracer.d.ts.map +1 -0
- package/dist/observability/otlp-metrics.d.ts +111 -0
- package/dist/observability/otlp-metrics.d.ts.map +1 -0
- package/dist/observability/otlp-traces.d.ts +95 -0
- package/dist/observability/otlp-traces.d.ts.map +1 -0
- package/dist/observability/prometheus.d.ts +49 -0
- package/dist/observability/prometheus.d.ts.map +1 -0
- package/dist/observability/tracer.d.ts +9 -0
- package/dist/observability/tracer.d.ts.map +1 -0
- package/dist/plugin/api.d.ts +226 -0
- package/dist/plugin/api.d.ts.map +1 -0
- package/dist/plugin/loader.d.ts +73 -0
- package/dist/plugin/loader.d.ts.map +1 -0
- package/dist/plugins/chimera-plugin.d.ts +37 -0
- package/dist/plugins/chimera-plugin.d.ts.map +1 -0
- package/dist/plugins/git-plugin.d.ts +15 -0
- package/dist/plugins/git-plugin.d.ts.map +1 -0
- package/dist/plugins/observability-plugin.d.ts +19 -0
- package/dist/plugins/observability-plugin.d.ts.map +1 -0
- package/dist/plugins/plan-plugin.d.ts +16 -0
- package/dist/plugins/plan-plugin.d.ts.map +1 -0
- package/dist/plugins/prompts-plugin.d.ts +26 -0
- package/dist/plugins/prompts-plugin.d.ts.map +1 -0
- package/dist/plugins/security-plugin.d.ts +19 -0
- package/dist/plugins/security-plugin.d.ts.map +1 -0
- package/dist/plugins/skills-plugin.d.ts +42 -0
- package/dist/plugins/skills-plugin.d.ts.map +1 -0
- package/dist/plugins/sync-plugin.d.ts +22 -0
- package/dist/plugins/sync-plugin.d.ts.map +1 -0
- package/dist/prompts/index.d.ts +3 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/prompt-installer.d.ts +50 -0
- package/dist/prompts/prompt-installer.d.ts.map +1 -0
- package/dist/prompts/prompt-manifest-store.d.ts +18 -0
- package/dist/prompts/prompt-manifest-store.d.ts.map +1 -0
- package/dist/registry/provider-registry.d.ts +51 -0
- package/dist/registry/provider-registry.d.ts.map +1 -0
- package/dist/registry/slash-command-registry.d.ts +61 -0
- package/dist/registry/slash-command-registry.d.ts.map +1 -0
- package/dist/registry/tool-registry.d.ts +154 -0
- package/dist/registry/tool-registry.d.ts.map +1 -0
- package/dist/replay/hash.d.ts +31 -0
- package/dist/replay/hash.d.ts.map +1 -0
- package/dist/replay/replay-provider-runner.d.ts +53 -0
- package/dist/replay/replay-provider-runner.d.ts.map +1 -0
- package/dist/{index-CbyuOE5y.d.ts → security/capabilities.d.ts} +31 -34
- package/dist/security/capabilities.d.ts.map +1 -0
- package/dist/security/config-secrets.d.ts +25 -0
- package/dist/security/config-secrets.d.ts.map +1 -0
- package/dist/security/index.d.ts +6 -8
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +102 -381
- package/dist/security/index.js.map +7 -1
- package/dist/security/permission-policy.d.ts +153 -0
- package/dist/security/permission-policy.d.ts.map +1 -0
- package/dist/security/secret-scrubber.d.ts +14 -0
- package/dist/security/secret-scrubber.d.ts.map +1 -0
- package/dist/security/secret-vault.d.ts +87 -0
- package/dist/security/secret-vault.d.ts.map +1 -0
- package/dist/security/yolo-risk.d.ts +11 -0
- package/dist/security/yolo-risk.d.ts.map +1 -0
- package/dist/{session-registry-Dvg7i_IA.d.ts → session-registry.d.ts} +8 -9
- package/dist/session-registry.d.ts.map +1 -0
- package/dist/skills/foreign-sources.d.ts +59 -0
- package/dist/skills/foreign-sources.d.ts.map +1 -0
- package/dist/skills/frontmatter.d.ts +44 -0
- package/dist/skills/frontmatter.d.ts.map +1 -0
- package/dist/skills/github-fetcher.d.ts +38 -0
- package/dist/skills/github-fetcher.d.ts.map +1 -0
- package/dist/skills/index.d.ts +11 -582
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +81 -43
- package/dist/skills/index.js.map +7 -1
- package/dist/skills/limits.d.ts +92 -0
- package/dist/skills/limits.d.ts.map +1 -0
- package/dist/skills/manifest-store.d.ts +42 -0
- package/dist/skills/manifest-store.d.ts.map +1 -0
- package/dist/skills/registry/github-direct-adapter.d.ts +17 -0
- package/dist/skills/registry/github-direct-adapter.d.ts.map +1 -0
- package/dist/skills/registry/registry-adapter.d.ts +84 -0
- package/dist/skills/registry/registry-adapter.d.ts.map +1 -0
- package/dist/skills/registry/skills-sh-adapter.d.ts +13 -0
- package/dist/skills/registry/skills-sh-adapter.d.ts.map +1 -0
- package/dist/skills/skill-generator.d.ts +82 -0
- package/dist/skills/skill-generator.d.ts.map +1 -0
- package/dist/skills/skill-installer.d.ts +124 -0
- package/dist/skills/skill-installer.d.ts.map +1 -0
- package/dist/storage/annotations-store.d.ts +118 -0
- package/dist/storage/annotations-store.d.ts.map +1 -0
- package/dist/storage/attachment-store.d.ts +31 -0
- package/dist/storage/attachment-store.d.ts.map +1 -0
- package/dist/storage/cloud-sync.d.ts +44 -0
- package/dist/storage/cloud-sync.d.ts.map +1 -0
- package/dist/storage/completed-work-checkpoint.d.ts +11 -0
- package/dist/storage/completed-work-checkpoint.d.ts.map +1 -0
- package/dist/storage/config-loader.d.ts +104 -0
- package/dist/storage/config-loader.d.ts.map +1 -0
- package/dist/storage/config-migration.d.ts +87 -0
- package/dist/storage/config-migration.d.ts.map +1 -0
- package/dist/storage/config-store.d.ts +22 -0
- package/dist/storage/config-store.d.ts.map +1 -0
- package/dist/{director-state-CMS_bMs4.d.ts → storage/director-state.d.ts} +28 -8
- package/dist/storage/director-state.d.ts.map +1 -0
- package/dist/storage/file-session-writer.d.ts +169 -0
- package/dist/storage/file-session-writer.d.ts.map +1 -0
- package/dist/{goal-store-Datpp-ar.d.ts → storage/goal-store.d.ts} +26 -19
- package/dist/storage/goal-store.d.ts.map +1 -0
- package/dist/storage/index.d.ts +39 -1031
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +655 -300
- package/dist/storage/index.js.map +7 -1
- package/dist/storage/input-history-store.d.ts +56 -0
- package/dist/storage/input-history-store.d.ts.map +1 -0
- package/dist/storage/memory-backend.d.ts +66 -0
- package/dist/storage/memory-backend.d.ts.map +1 -0
- package/dist/storage/memory-consolidator.d.ts +50 -0
- package/dist/storage/memory-consolidator.d.ts.map +1 -0
- package/dist/storage/memory-graph-backend.d.ts +117 -0
- package/dist/storage/memory-graph-backend.d.ts.map +1 -0
- package/dist/storage/memory-store.d.ts +119 -0
- package/dist/storage/memory-store.d.ts.map +1 -0
- package/dist/storage/plan-store.d.ts +78 -0
- package/dist/storage/plan-store.d.ts.map +1 -0
- package/dist/storage/plan-templates.d.ts +21 -0
- package/dist/storage/plan-templates.d.ts.map +1 -0
- package/dist/storage/prompt-store.d.ts +37 -0
- package/dist/storage/prompt-store.d.ts.map +1 -0
- package/dist/storage/prompt-usage-store.d.ts +29 -0
- package/dist/storage/prompt-usage-store.d.ts.map +1 -0
- package/dist/storage/provider-config-watcher.d.ts +34 -0
- package/dist/storage/provider-config-watcher.d.ts.map +1 -0
- package/dist/storage/queue-store.d.ts +37 -0
- package/dist/storage/queue-store.d.ts.map +1 -0
- package/dist/storage/recovery-lock.d.ts +79 -0
- package/dist/storage/recovery-lock.d.ts.map +1 -0
- package/dist/storage/replay-log-store.d.ts +97 -0
- package/dist/storage/replay-log-store.d.ts.map +1 -0
- package/dist/storage/session-analyzer.d.ts +48 -0
- package/dist/storage/session-analyzer.d.ts.map +1 -0
- package/dist/storage/session-checkpoint-cas.d.ts +37 -0
- package/dist/storage/session-checkpoint-cas.d.ts.map +1 -0
- package/dist/{session-event-bridge-D_z_mBwk.d.ts → storage/session-event-bridge.d.ts} +14 -15
- package/dist/storage/session-event-bridge.d.ts.map +1 -0
- package/dist/storage/session-helpers.d.ts +9 -0
- package/dist/storage/session-helpers.d.ts.map +1 -0
- package/dist/storage/session-id.d.ts +18 -0
- package/dist/storage/session-id.d.ts.map +1 -0
- package/dist/storage/session-reader.d.ts +21 -0
- package/dist/storage/session-reader.d.ts.map +1 -0
- package/dist/storage/session-recovery.d.ts +93 -0
- package/dist/storage/session-recovery.d.ts.map +1 -0
- package/dist/storage/session-resume-validation.d.ts +6 -0
- package/dist/storage/session-resume-validation.d.ts.map +1 -0
- package/dist/storage/session-rewinder.d.ts +21 -0
- package/dist/storage/session-rewinder.d.ts.map +1 -0
- package/dist/storage/session-store.d.ts +210 -0
- package/dist/storage/session-store.d.ts.map +1 -0
- package/dist/storage/session-summary.d.ts +12 -0
- package/dist/storage/session-summary.d.ts.map +1 -0
- package/dist/storage/session-tool-call-ends.d.ts +5 -0
- package/dist/storage/session-tool-call-ends.d.ts.map +1 -0
- package/dist/storage/storage-concurrency.d.ts +2 -0
- package/dist/storage/storage-concurrency.d.ts.map +1 -0
- package/dist/storage/task-store.d.ts +33 -0
- package/dist/storage/task-store.d.ts.map +1 -0
- package/dist/storage/todos-checkpoint.d.ts +39 -0
- package/dist/storage/todos-checkpoint.d.ts.map +1 -0
- package/dist/storage/tool-audit-log.d.ts +141 -0
- package/dist/storage/tool-audit-log.d.ts.map +1 -0
- package/dist/tasking/index.d.ts +3 -124
- package/dist/tasking/index.d.ts.map +1 -0
- package/dist/tasking/index.js +57 -4
- package/dist/tasking/index.js.map +7 -1
- package/dist/tasking/task-store.d.ts +22 -0
- package/dist/tasking/task-store.d.ts.map +1 -0
- package/dist/tasking/task-tracker.d.ts +102 -0
- package/dist/tasking/task-tracker.d.ts.map +1 -0
- package/dist/tools/index.d.ts +2 -59
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +93 -14
- package/dist/tools/index.js.map +7 -1
- package/dist/tools/mcp-control.d.ts +53 -0
- package/dist/tools/mcp-control.d.ts.map +1 -0
- package/dist/tools/mcp-use.d.ts +24 -0
- package/dist/tools/mcp-use.d.ts.map +1 -0
- package/dist/types/agent-bridge.d.ts +42 -0
- package/dist/types/agent-bridge.d.ts.map +1 -0
- package/dist/types/attachment.d.ts +54 -0
- package/dist/types/attachment.d.ts.map +1 -0
- package/dist/types/autonomy.d.ts +5 -0
- package/dist/types/autonomy.d.ts.map +1 -0
- package/dist/types/blocks.d.ts +76 -0
- package/dist/types/blocks.d.ts.map +1 -0
- package/dist/{compactor-DQLL4HTo.d.ts → types/compactor.d.ts} +5 -7
- package/dist/types/compactor.d.ts.map +1 -0
- package/dist/{config-MRqn1V-u.d.ts → types/config.d.ts} +135 -354
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/context-evidence.d.ts +68 -0
- package/dist/types/context-evidence.d.ts.map +1 -0
- package/dist/types/context-window.d.ts +35 -0
- package/dist/types/context-window.d.ts.map +1 -0
- package/dist/{default-config-B79_gJYv.d.ts → types/default-config.d.ts} +10 -11
- package/dist/types/default-config.d.ts.map +1 -0
- package/dist/types/design-kit.d.ts +91 -0
- package/dist/types/design-kit.d.ts.map +1 -0
- package/dist/{retry-policy-CQ7KwXJa.d.ts → types/error-handler.d.ts} +5 -12
- package/dist/types/error-handler.d.ts.map +1 -0
- package/dist/types/errors.d.ts +277 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/hooks.d.ts +167 -0
- package/dist/types/hooks.d.ts.map +1 -0
- package/dist/types/index.d.ts +40 -244
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +90 -12
- package/dist/types/index.js.map +7 -1
- package/dist/{input-reader-E-ffP2ee.d.ts → types/input-reader.d.ts} +3 -4
- package/dist/types/input-reader.d.ts.map +1 -0
- package/dist/{logger-B63L5bTg.d.ts → types/logger.d.ts} +3 -4
- package/dist/types/logger.d.ts.map +1 -0
- package/dist/types/memory.d.ts +89 -0
- package/dist/types/memory.d.ts.map +1 -0
- package/dist/types/messages.d.ts +24 -0
- package/dist/types/messages.d.ts.map +1 -0
- package/dist/types/mode-prompts.d.ts +2 -0
- package/dist/types/mode-prompts.d.ts.map +1 -0
- package/dist/{mode-CZlO9iU1.d.ts → types/mode.d.ts} +6 -7
- package/dist/types/mode.d.ts.map +1 -0
- package/dist/types/models-registry.d.ts +105 -0
- package/dist/types/models-registry.d.ts.map +1 -0
- package/dist/types/multi-agent.d.ts +435 -0
- package/dist/types/multi-agent.d.ts.map +1 -0
- package/dist/{observability-D-HZN_mF.d.ts → types/observability.d.ts} +12 -13
- package/dist/types/observability.d.ts.map +1 -0
- package/dist/{path-resolver-CPRj4bFY.d.ts → types/path-resolver.d.ts} +2 -3
- package/dist/types/path-resolver.d.ts.map +1 -0
- package/dist/{permission-ByDKXEcG.d.ts → types/permission.d.ts} +8 -9
- package/dist/types/permission.d.ts.map +1 -0
- package/dist/types/plugin.d.ts +385 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/prompt-registry.d.ts +81 -0
- package/dist/types/prompt-registry.d.ts.map +1 -0
- package/dist/{prompt-DLd35n4Q.d.ts → types/prompt.d.ts} +14 -15
- package/dist/types/prompt.d.ts.map +1 -0
- package/dist/{provider-runner-ChL-kVg6.d.ts → types/provider-runner.d.ts} +9 -10
- package/dist/types/provider-runner.d.ts.map +1 -0
- package/dist/types/provider.d.ts +387 -0
- package/dist/types/provider.d.ts.map +1 -0
- package/dist/types/renderer.d.ts +23 -0
- package/dist/types/renderer.d.ts.map +1 -0
- package/dist/types/retry-policy.d.ts +7 -0
- package/dist/types/retry-policy.d.ts.map +1 -0
- package/dist/types/secret-scrubber.d.ts +5 -0
- package/dist/types/secret-scrubber.d.ts.map +1 -0
- package/dist/{secret-vault-BAKpgFw_.d.ts → types/secret-vault.d.ts} +13 -7
- package/dist/types/secret-vault.d.ts.map +1 -0
- package/dist/{selector-D8O6B_Rm.d.ts → types/selector.d.ts} +4 -6
- package/dist/types/selector.d.ts.map +1 -0
- package/dist/types/session-reader.d.ts +81 -0
- package/dist/types/session-reader.d.ts.map +1 -0
- package/dist/{session-rewinder-C9HnMkhP.d.ts → types/session-rewinder.d.ts} +5 -6
- package/dist/types/session-rewinder.d.ts.map +1 -0
- package/dist/types/session.d.ts +650 -0
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/side-effect.d.ts +34 -0
- package/dist/types/side-effect.d.ts.map +1 -0
- package/dist/{skill-DHniprNl.d.ts → types/skill.d.ts} +4 -5
- package/dist/types/skill.d.ts.map +1 -0
- package/dist/types/slash-command.d.ts +59 -0
- package/dist/types/slash-command.d.ts.map +1 -0
- package/dist/types/spec.d.ts +77 -0
- package/dist/types/spec.d.ts.map +1 -0
- package/dist/types/system-prompt-contributor.d.ts +20 -0
- package/dist/types/system-prompt-contributor.d.ts.map +1 -0
- package/dist/types/system-prompt.d.ts +51 -0
- package/dist/types/system-prompt.d.ts.map +1 -0
- package/dist/{task-graph-CH3acNQ7.d.ts → types/task-graph.d.ts} +21 -22
- package/dist/types/task-graph.d.ts.map +1 -0
- package/dist/types/token-counter.d.ts +42 -0
- package/dist/types/token-counter.d.ts.map +1 -0
- package/dist/types/tool-executor.d.ts +133 -0
- package/dist/types/tool-executor.d.ts.map +1 -0
- package/dist/types/tool-markers.d.ts +23 -0
- package/dist/types/tool-markers.d.ts.map +1 -0
- package/dist/types/tool.d.ts +245 -0
- package/dist/types/tool.d.ts.map +1 -0
- package/dist/types/utility-types.d.ts +31 -0
- package/dist/types/utility-types.d.ts.map +1 -0
- package/dist/utils/assert-never.d.ts +14 -0
- package/dist/utils/assert-never.d.ts.map +1 -0
- package/dist/utils/atomic-write.d.ts +12 -0
- package/dist/utils/atomic-write.d.ts.map +1 -0
- package/dist/utils/child-env.d.ts +67 -0
- package/dist/utils/child-env.d.ts.map +1 -0
- package/dist/utils/color.d.ts +20 -0
- package/dist/utils/color.d.ts.map +1 -0
- package/dist/utils/config-json.d.ts +14 -0
- package/dist/utils/config-json.d.ts.map +1 -0
- package/dist/utils/context-evidence.d.ts +47 -0
- package/dist/utils/context-evidence.d.ts.map +1 -0
- package/dist/utils/deep-merge.d.ts +64 -0
- package/dist/utils/deep-merge.d.ts.map +1 -0
- package/dist/utils/diff.d.ts +11 -0
- package/dist/utils/diff.d.ts.map +1 -0
- package/dist/utils/error.d.ts +2 -3
- package/dist/utils/error.d.ts.map +1 -0
- package/dist/utils/error.js +3 -3
- package/dist/utils/error.js.map +7 -1
- package/dist/utils/expect-defined.d.ts +2 -3
- package/dist/utils/expect-defined.d.ts.map +1 -0
- package/dist/utils/expect-defined.js +3 -3
- package/dist/utils/expect-defined.js.map +7 -1
- package/dist/utils/glob-expand.d.ts +10 -0
- package/dist/utils/glob-expand.d.ts.map +1 -0
- package/dist/utils/glob-match.d.ts +4 -0
- package/dist/utils/glob-match.d.ts.map +1 -0
- package/dist/utils/index.d.ts +37 -920
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +242 -33
- package/dist/utils/index.js.map +7 -1
- package/dist/utils/instruction-file.d.ts +3 -0
- package/dist/utils/instruction-file.d.ts.map +1 -0
- package/dist/utils/ip-guard.d.ts +34 -0
- package/dist/utils/ip-guard.d.ts.map +1 -0
- package/dist/utils/json-repair.d.ts +23 -0
- package/dist/utils/json-repair.d.ts.map +1 -0
- package/dist/utils/json-schema-validate.d.ts +42 -0
- package/dist/utils/json-schema-validate.d.ts.map +1 -0
- package/dist/utils/lru-cache.d.ts +29 -0
- package/dist/utils/lru-cache.d.ts.map +1 -0
- package/dist/utils/merge-custom-models.d.ts +12 -0
- package/dist/utils/merge-custom-models.d.ts.map +1 -0
- package/dist/utils/merge-models-payload.d.ts +20 -0
- package/dist/utils/merge-models-payload.d.ts.map +1 -0
- package/dist/utils/message-invariants.d.ts +22 -0
- package/dist/utils/message-invariants.d.ts.map +1 -0
- package/dist/utils/newline-normalize.d.ts +5 -0
- package/dist/utils/newline-normalize.d.ts.map +1 -0
- package/dist/utils/regex-guard.d.ts +21 -0
- package/dist/utils/regex-guard.d.ts.map +1 -0
- package/dist/utils/safe-json.d.ts +31 -0
- package/dist/utils/safe-json.d.ts.map +1 -0
- package/dist/utils/session-scoped-path.d.ts +13 -0
- package/dist/utils/session-scoped-path.d.ts.map +1 -0
- package/dist/utils/sleep.d.ts +5 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils/slug.d.ts +13 -0
- package/dist/utils/slug.d.ts.map +1 -0
- package/dist/utils/string.d.ts +9 -0
- package/dist/utils/string.d.ts.map +1 -0
- package/dist/utils/task-format.d.ts +22 -0
- package/dist/utils/task-format.d.ts.map +1 -0
- package/dist/utils/term.d.ts +133 -0
- package/dist/utils/term.d.ts.map +1 -0
- package/dist/utils/todos-format.d.ts +30 -0
- package/dist/utils/todos-format.d.ts.map +1 -0
- package/dist/utils/token-estimate.d.ts +112 -0
- package/dist/utils/token-estimate.d.ts.map +1 -0
- package/dist/utils/tool-description-mode.d.ts +28 -0
- package/dist/utils/tool-description-mode.d.ts.map +1 -0
- package/dist/utils/tool-output-serializer.d.ts +40 -0
- package/dist/utils/tool-output-serializer.d.ts.map +1 -0
- package/dist/utils/tool-result-render-mode.d.ts +55 -0
- package/dist/utils/tool-result-render-mode.d.ts.map +1 -0
- package/dist/utils/tool-subject.d.ts +5 -0
- package/dist/utils/tool-subject.d.ts.map +1 -0
- package/dist/utils/tool-wire-compact.d.ts +28 -0
- package/dist/utils/tool-wire-compact.d.ts.map +1 -0
- package/dist/utils/ulid.d.ts +11 -0
- package/dist/utils/ulid.d.ts.map +1 -0
- package/dist/{wstack-paths-C3K40Qst.d.ts → utils/wstack-paths.d.ts} +7 -8
- package/dist/utils/wstack-paths.d.ts.map +1 -0
- package/dist/worktree/index.d.ts +2 -0
- package/dist/worktree/index.d.ts.map +1 -0
- package/dist/{worktree-manager-DzwxKE35.d.ts → worktree/worktree-manager.d.ts} +19 -13
- package/dist/worktree/worktree-manager.d.ts.map +1 -0
- package/instructions/autonomy/active-mission.md +2 -4
- package/instructions/sections/tool/delegation-full.md +1 -1
- package/package.json +4 -5
- package/skills/node-modern/SKILL.md +2 -2
- package/skills/plugin-author/SKILL.md +9 -16
- package/dist/dispatcher-types.d-BBeXBQgS.d.ts +0 -66
- package/dist/global-mailbox-sZwyI6CS.d.ts +0 -959
- package/dist/index--Gm41aBJ.d.ts +0 -671
- package/dist/mcp-servers-DEV4s6Ks.d.ts +0 -259
- package/dist/multi-agent-coordinator-4RCRZKjN.d.ts +0 -1770
- package/dist/null-fleet-bus-CFoNVQEK.d.ts +0 -2127
- package/dist/pipeline-DGDyIohT.d.ts +0 -331
- package/dist/provider-model-resolve-o2hHLs79.d.ts +0 -263
- package/dist/secret-scrubber-3MHDDAtm.d.ts +0 -6
- package/dist/secret-vault-DxohkUBc.d.ts +0 -272
- package/dist/session-reader-7Esxrkpw.d.ts +0 -155
- package/dist/task-format-GX0B1mMC.d.ts +0 -23
- package/dist/todos-checkpoint-FY7PjmMx.d.ts +0 -850
- package/dist/tool-BNlnIJvo.d.ts +0 -2190
- package/dist/tool-executor-CckSCM5E.d.ts +0 -906
|
@@ -1,2127 +0,0 @@
|
|
|
1
|
-
import { B as BridgeTransport, d as BridgeMessage, e as AgentBridge, f as AgentBridgeConfig, g as AgentPhase, h as AgentDefinition, S as SubagentRunner, T as TaskSpec, i as SubagentConfig, F as FleetBus, j as FleetUsage, k as FleetUsageAggregator, b as DefaultMultiAgentCoordinator, l as TaskResult, C as CoordinatorStatus, D as DispatchClassifier, M as MultiAgentConfig, m as AwaitAnyResult } from './multi-agent-coordinator-4RCRZKjN.js';
|
|
2
|
-
import { E as EventBus, B as BrainArbiter } from './events-Bgnh43r9.js';
|
|
3
|
-
import { b as SessionWriter, g as Tool, k as SessionStore } from './tool-BNlnIJvo.js';
|
|
4
|
-
import { EventEmitter } from 'node:events';
|
|
5
|
-
import { D as DirectorStateSnapshot } from './director-state-CMS_bMs4.js';
|
|
6
|
-
import { F as FleetConfig, a as ModelMatrixEntry } from './config-MRqn1V-u.js';
|
|
7
|
-
import { L as Logger } from './logger-B63L5bTg.js';
|
|
8
|
-
import { W as WorktreeManager } from './worktree-manager-DzwxKE35.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* In-memory pub/sub transport for agent-to-agent messaging.
|
|
12
|
-
* Subscribers register by agentId and receive messages via callback.
|
|
13
|
-
*/
|
|
14
|
-
declare class InMemoryBridgeTransport implements BridgeTransport {
|
|
15
|
-
private readonly subs;
|
|
16
|
-
send(msg: BridgeMessage, to: string): Promise<void>;
|
|
17
|
-
subscribe(agentId: string, handler: (msg: BridgeMessage) => void): () => void;
|
|
18
|
-
close(agentId: string): Promise<void>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
declare class InMemoryAgentBridge implements AgentBridge {
|
|
22
|
-
readonly agentId: string;
|
|
23
|
-
readonly coordinatorId: string;
|
|
24
|
-
private readonly transport;
|
|
25
|
-
private readonly subscriptions;
|
|
26
|
-
private readonly pendingRequests;
|
|
27
|
-
private stopped;
|
|
28
|
-
private timeoutMs;
|
|
29
|
-
/** Guards request() so concurrent calls on the same id can't silently overwrite. */
|
|
30
|
-
private readonly inflightGuards;
|
|
31
|
-
/** Stores the transport unsubscribe function so it can be called on stop(). */
|
|
32
|
-
private _transportUnsubscribe?;
|
|
33
|
-
constructor(config: AgentBridgeConfig, transport: BridgeTransport);
|
|
34
|
-
send(msg: BridgeMessage): Promise<void>;
|
|
35
|
-
broadcast(msg: BridgeMessage): Promise<void>;
|
|
36
|
-
subscribe(handler: (msg: BridgeMessage) => void | Promise<void>): () => void;
|
|
37
|
-
request<T>(msg: BridgeMessage, timeoutMs?: number): Promise<BridgeMessage<T>>;
|
|
38
|
-
stop(): Promise<void>;
|
|
39
|
-
}
|
|
40
|
-
declare function createMessage<T = unknown>(type: BridgeMessage['type'], from: string, payload: T, to?: string | undefined): BridgeMessage<T>;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Agent catalog aggregator.
|
|
44
|
-
*
|
|
45
|
-
* Collects every phase's `AgentDefinition[]` into:
|
|
46
|
-
* - `ALL_AGENT_DEFINITIONS` — flat list, catalog order (phase 1 → 9)
|
|
47
|
-
* - `AGENT_CATALOG` — keyed by role for O(1) lookup
|
|
48
|
-
* - `AGENTS_BY_PHASE` — grouped for statusline / dispatcher tie-breaks
|
|
49
|
-
*
|
|
50
|
-
* `fleet.ts` derives `FLEET_ROSTER` + `FLEET_ROSTER_BUDGETS` from this, and the
|
|
51
|
-
* dispatcher routes free-form tasks against `capability` metadata here.
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
/** Every catalog agent, in phase order. */
|
|
55
|
-
declare const ALL_AGENT_DEFINITIONS: AgentDefinition[];
|
|
56
|
-
/** Phase → its agents, for grouped display and dispatcher fallbacks. */
|
|
57
|
-
declare const AGENTS_BY_PHASE: Record<AgentPhase, AgentDefinition[]>;
|
|
58
|
-
/**
|
|
59
|
-
* Role → definition. Built once at module load. Throws on a duplicate role so
|
|
60
|
-
* a copy-paste collision fails loudly at startup instead of silently shadowing.
|
|
61
|
-
*/
|
|
62
|
-
declare const AGENT_CATALOG: Record<string, AgentDefinition>;
|
|
63
|
-
/** Role lookup helper. Returns undefined for unknown roles. */
|
|
64
|
-
declare function getAgentDefinition(role: string): AgentDefinition | undefined;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Default auto-extend policy for subagent budgets.
|
|
68
|
-
*
|
|
69
|
-
* The budget's soft-limit path (`SubagentBudget` → `budget.threshold_reached`)
|
|
70
|
-
* only negotiates an extension when SOMETHING listens on the EventBus. Under a
|
|
71
|
-
* `Director`, that listener is the director's own auto-extend handler. On the
|
|
72
|
-
* plain coordinator path (e.g. a bare `/spawn` with no director) nothing
|
|
73
|
-
* listens, so the budget falls back to a hard stop and the subagent dies the
|
|
74
|
-
* moment it crosses a soft limit.
|
|
75
|
-
*
|
|
76
|
-
* `attachAutoExtend` is the additive fix: wire it to a subagent's EventBus and
|
|
77
|
-
* budget overruns are auto-granted headroom instead of killing the run. It is
|
|
78
|
-
* heartbeat-aware for the timeout kind — wall-clock time always advances, so a
|
|
79
|
-
* naive "extend timeout forever" would let a wedged agent run indefinitely.
|
|
80
|
-
* Instead, a timeout extension is granted only when the agent has executed a
|
|
81
|
-
* new tool call or started a new iteration since the last timeout extension.
|
|
82
|
-
* No progress since last time ⇒ the agent is genuinely stuck ⇒ deny and let it
|
|
83
|
-
* fail. The non-timeout kinds (iterations/tool_calls/tokens/cost) extend up to
|
|
84
|
-
* a per-kind cap, then deny — those ceilings are the real runaway guard.
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
|
-
interface AutoExtendCeiling {
|
|
88
|
-
maxIterations?: number | undefined;
|
|
89
|
-
maxToolCalls?: number | undefined;
|
|
90
|
-
maxTokens?: number | undefined;
|
|
91
|
-
maxCostUsd?: number | undefined;
|
|
92
|
-
timeoutMs?: number | undefined;
|
|
93
|
-
}
|
|
94
|
-
interface AutoExtendPolicy {
|
|
95
|
-
/** Multiplier applied to the tripped limit when extending. Default 0.5 (+50%). */
|
|
96
|
-
factor?: number | undefined;
|
|
97
|
-
/**
|
|
98
|
-
* Max extensions per NON-timeout kind before denying. Timeout is governed by
|
|
99
|
-
* the heartbeat check, not this cap, so it can extend indefinitely while the
|
|
100
|
-
* agent makes progress. Default 8.
|
|
101
|
-
*/
|
|
102
|
-
maxExtensionsPerKind?: number | undefined;
|
|
103
|
-
/** Absolute ceilings — an extension never pushes a limit past these. */
|
|
104
|
-
ceiling?: AutoExtendCeiling | undefined;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Attach an auto-extend policy to a subagent's EventBus. Returns an unsubscribe
|
|
108
|
-
* function that detaches all listeners — call it when the subagent task ends.
|
|
109
|
-
*/
|
|
110
|
-
declare function attachAutoExtend(events: EventBus, policy?: AutoExtendPolicy): () => void;
|
|
111
|
-
|
|
112
|
-
type FleetWorktreePolicy = NonNullable<FleetConfig['worktrees']>;
|
|
113
|
-
type WorktreeIsolationDecision = 'off' | 'optional' | 'required';
|
|
114
|
-
interface WorktreeTaskStateUpdate {
|
|
115
|
-
taskId: string;
|
|
116
|
-
subagentId: string;
|
|
117
|
-
handleId: string;
|
|
118
|
-
dir: string;
|
|
119
|
-
branch: string;
|
|
120
|
-
baseBranch: string;
|
|
121
|
-
status: 'allocated' | 'fallback' | 'committed' | 'merged' | 'kept' | 'released' | 'conflict' | 'failed';
|
|
122
|
-
commitSha?: string | undefined;
|
|
123
|
-
conflictFiles?: string[] | undefined;
|
|
124
|
-
error?: string | undefined;
|
|
125
|
-
}
|
|
126
|
-
interface WorktreeTaskRunnerOptions {
|
|
127
|
-
runner: SubagentRunner;
|
|
128
|
-
worktrees?: WorktreeManager | undefined;
|
|
129
|
-
policy?: FleetWorktreePolicy | undefined;
|
|
130
|
-
conflictResolver?: ((info: {
|
|
131
|
-
task: TaskSpec;
|
|
132
|
-
config: SubagentConfig;
|
|
133
|
-
conflictFiles: string[];
|
|
134
|
-
cwd: string;
|
|
135
|
-
}) => Promise<boolean>) | undefined;
|
|
136
|
-
onUpdate?: ((update: WorktreeTaskStateUpdate) => void) | undefined;
|
|
137
|
-
}
|
|
138
|
-
declare class WorktreeIntegrationError extends Error {
|
|
139
|
-
readonly taskId: string;
|
|
140
|
-
readonly subagentId: string;
|
|
141
|
-
readonly branch?: string | undefined;
|
|
142
|
-
readonly conflictFiles?: string[] | undefined;
|
|
143
|
-
constructor(message: string, opts: {
|
|
144
|
-
taskId: string;
|
|
145
|
-
subagentId: string;
|
|
146
|
-
branch?: string | undefined;
|
|
147
|
-
conflictFiles?: string[] | undefined;
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
declare function subagentNeedsWorktree(config: SubagentConfig): boolean;
|
|
151
|
-
declare function resolveSubagentWorktreeDecision(config: SubagentConfig, policy?: FleetWorktreePolicy | undefined): WorktreeIsolationDecision;
|
|
152
|
-
declare function wrapSubagentRunnerWithWorktrees(opts: WorktreeTaskRunnerOptions): SubagentRunner;
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Interface for fleet-level lifecycle and policy. Covers:
|
|
156
|
-
* - Spawn lifecycle hooks (canSpawn check, recordSpawn after-effects)
|
|
157
|
-
* - Budget enforcement (fleet-wide cost cap, spawn count/depth caps)
|
|
158
|
-
* - Fleet manifest assembly and writing
|
|
159
|
-
* - Subagent metadata and usage tracking
|
|
160
|
-
*
|
|
161
|
-
* `FleetBus` is pure event fan-out and implements no policy.
|
|
162
|
-
* `FleetManager` encapsulates all fleet-level policy decisions.
|
|
163
|
-
* `Director` currently owns all of this — this interface lets us
|
|
164
|
-
* extract it into a swappable component in Phase 5.
|
|
165
|
-
*/
|
|
166
|
-
interface IFleetManager {
|
|
167
|
-
/** The FleetBus this manager publishes lifecycle events to. */
|
|
168
|
-
readonly fleetBus: FleetBus;
|
|
169
|
-
/**
|
|
170
|
-
* Snapshot of fleet-wide token usage and cost rollup.
|
|
171
|
-
* Safe to call from a tool's execute() body.
|
|
172
|
-
*/
|
|
173
|
-
snapshot(): FleetUsage;
|
|
174
|
-
/**
|
|
175
|
-
* Per-subagent metadata captured at spawn time (provider/model/name).
|
|
176
|
-
* Returns undefined if the subagent is not known to this manager.
|
|
177
|
-
*/
|
|
178
|
-
getSubagentMeta(id: string): {
|
|
179
|
-
provider?: string | undefined;
|
|
180
|
-
model?: string | undefined;
|
|
181
|
-
name?: string | undefined;
|
|
182
|
-
} | undefined;
|
|
183
|
-
/**
|
|
184
|
-
* Called before a spawn is recorded. Returns a reason string if the
|
|
185
|
-
* spawn should be rejected (budget cap, depth limit, cost cap, context
|
|
186
|
-
* overload, etc.), or null to proceed. Director.spawn() calls this
|
|
187
|
-
* internally.
|
|
188
|
-
*/
|
|
189
|
-
canSpawn(config: SubagentConfig): {
|
|
190
|
-
kind: 'max_spawns' | 'max_spawn_depth' | 'max_cost_usd' | 'max_tokens' | 'max_context_load';
|
|
191
|
-
limit: number;
|
|
192
|
-
observed: number;
|
|
193
|
-
} | null;
|
|
194
|
-
/** Current fleet-wide token/cost ceiling and remaining headroom. */
|
|
195
|
-
budgetSnapshot?: (() => {
|
|
196
|
-
maxSpawns: number;
|
|
197
|
-
usedSpawns: number;
|
|
198
|
-
remainingSpawns: number;
|
|
199
|
-
maxTokens: number;
|
|
200
|
-
usedTokens: number;
|
|
201
|
-
remainingTokens: number;
|
|
202
|
-
maxCostUsd: number;
|
|
203
|
-
usedCostUsd: number;
|
|
204
|
-
remainingCostUsd: number;
|
|
205
|
-
}) | undefined;
|
|
206
|
-
/**
|
|
207
|
-
* Update the leader agent's current context pressure (tokens used in the
|
|
208
|
-
* full API request: messages + systemPrompt + toolDefs). The fleet manager
|
|
209
|
-
* checks this before allowing a new spawn to prevent the leader from
|
|
210
|
-
* overflowing its context window while orchestrating subagents.
|
|
211
|
-
*/
|
|
212
|
-
setLeaderContextPressure(tokens: number): void;
|
|
213
|
-
/**
|
|
214
|
-
* Assign a memorable nickname (e.g. "Einstein (Bug Hunter)") and mark it
|
|
215
|
-
* as used so it is never reused. The nickname is written back to `config.name`
|
|
216
|
-
* so the coordinator and manifest both see the human-readable name.
|
|
217
|
-
*
|
|
218
|
-
* NOTE: This only assigns the nickname. The caller MUST call `recordSpawn`
|
|
219
|
-
* after `coordinator.spawn()` returns with the real subagentId.
|
|
220
|
-
*
|
|
221
|
-
* Returns the assigned nickname string.
|
|
222
|
-
*/
|
|
223
|
-
assignNicknameAndRecord(config: SubagentConfig): string;
|
|
224
|
-
/**
|
|
225
|
-
* Readonly view of already-assigned nickname keys. Used by `Director.spawn()`
|
|
226
|
-
* to avoid assigning the same nickname twice across the fleet.
|
|
227
|
-
*/
|
|
228
|
-
readonly usedNicknames: ReadonlySet<string>;
|
|
229
|
-
/**
|
|
230
|
-
* Called after a spawn succeeds. Records metadata for the usage
|
|
231
|
-
* aggregator and manifest.
|
|
232
|
-
*
|
|
233
|
-
* @param priceLookup Per-token rate lookup for cost calculation.
|
|
234
|
-
* When omitted the cost column in usage snapshots stays at 0.
|
|
235
|
-
*/
|
|
236
|
-
recordSpawn(subagentId: string, config: SubagentConfig, priceLookup?: Record<string, number>): void;
|
|
237
|
-
/**
|
|
238
|
-
* Write the fleet manifest to disk. Returns the path written
|
|
239
|
-
* or null when no manifest path is configured.
|
|
240
|
-
*/
|
|
241
|
-
writeManifest(): Promise<string | null>;
|
|
242
|
-
/**
|
|
243
|
-
* Bypass the debounce timer and write the manifest immediately.
|
|
244
|
-
* Clears any pending debounce timer before writing.
|
|
245
|
-
*/
|
|
246
|
-
flushManifest(): Promise<void>;
|
|
247
|
-
/**
|
|
248
|
-
* Aggregate fleet-wide status: pending tasks with descriptions and
|
|
249
|
-
* live subagent snapshot from the coordinator. Used by
|
|
250
|
-
* `MultiAgentHost.status()` to eliminate host-side state duplication.
|
|
251
|
-
*/
|
|
252
|
-
getFleetStatus(): {
|
|
253
|
-
pending: {
|
|
254
|
-
taskId: string;
|
|
255
|
-
description: string;
|
|
256
|
-
subagentId: string;
|
|
257
|
-
}[];
|
|
258
|
-
live: {
|
|
259
|
-
subagentId: string;
|
|
260
|
-
status: string;
|
|
261
|
-
task?: string | undefined;
|
|
262
|
-
}[];
|
|
263
|
-
};
|
|
264
|
-
/**
|
|
265
|
-
* Register a pending task with its description. Called by
|
|
266
|
-
* `MultiAgentHost.spawn()` after `_spawnAndAssign()` returns so
|
|
267
|
-
* the description is available in `status()` without host-side storage.
|
|
268
|
-
*/
|
|
269
|
-
addPendingTask(taskId: string, subagentId: string, description: string): void;
|
|
270
|
-
/** Record the latest git-worktree lifecycle state for a task. */
|
|
271
|
-
recordTaskWorktree(update: WorktreeTaskStateUpdate): void;
|
|
272
|
-
/**
|
|
273
|
-
* Remove a pending task. Called when the task completes so the
|
|
274
|
-
* pending list stays accurate.
|
|
275
|
-
*/
|
|
276
|
-
removePendingTask(taskId: string): void;
|
|
277
|
-
/**
|
|
278
|
-
* Wire the coordinator so `getFleetStats()` can delegate to it.
|
|
279
|
-
* Called by `Director` after constructing the coordinator so
|
|
280
|
-
* FleetManager's stats reflect live subagent data.
|
|
281
|
-
*/
|
|
282
|
-
setCoordinator(coordinator: {
|
|
283
|
-
getStats(): {
|
|
284
|
-
total: number;
|
|
285
|
-
running: number;
|
|
286
|
-
idle: number;
|
|
287
|
-
stopped: number;
|
|
288
|
-
inFlight: number;
|
|
289
|
-
pending: number;
|
|
290
|
-
completed: number;
|
|
291
|
-
};
|
|
292
|
-
}): void;
|
|
293
|
-
/**
|
|
294
|
-
* Coordinator stats snapshot for the TUI and monitoring tools.
|
|
295
|
-
* Returns actionable counts (total/running/idle/stopped/inFlight/
|
|
296
|
-
* pending/completed) plus per-subagent status details.
|
|
297
|
-
* Delegates to the coordinator when available; returns zeros
|
|
298
|
-
* if the coordinator has not yet been set.
|
|
299
|
-
*/
|
|
300
|
-
getFleetStats(): {
|
|
301
|
-
total: number;
|
|
302
|
-
running: number;
|
|
303
|
-
idle: number;
|
|
304
|
-
stopped: number;
|
|
305
|
-
inFlight: number;
|
|
306
|
-
pending: number;
|
|
307
|
-
completed: number;
|
|
308
|
-
subagentStatuses: {
|
|
309
|
-
subagentId: string;
|
|
310
|
-
taskId: string;
|
|
311
|
-
status: string;
|
|
312
|
-
assigned: boolean;
|
|
313
|
-
}[];
|
|
314
|
-
};
|
|
315
|
-
/**
|
|
316
|
-
* Called when a subagent is removed so the fleet manager can clean up
|
|
317
|
-
* associated state (nickname slots, pending tasks, etc.).
|
|
318
|
-
*/
|
|
319
|
-
removeSubagent(subagentId: string): void;
|
|
320
|
-
/**
|
|
321
|
-
* Release all resources held by the fleet manager.
|
|
322
|
-
* Clears any pending manifest debounce timer and disposes the usage aggregator.
|
|
323
|
-
* Call this when the fleet manager is no longer needed (e.g. process shutdown).
|
|
324
|
-
*/
|
|
325
|
-
dispose(): void;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
/** Options for constructing a FleetManager. */
|
|
329
|
-
interface FleetManagerOptions {
|
|
330
|
-
manifestPath?: string | undefined;
|
|
331
|
-
sessionsRoot?: string | undefined;
|
|
332
|
-
directorRunId?: string | undefined;
|
|
333
|
-
maxSpawns?: number | undefined;
|
|
334
|
-
maxSpawnDepth?: number | undefined;
|
|
335
|
-
spawnDepth?: number | undefined;
|
|
336
|
-
stateCheckpointPath?: string | undefined;
|
|
337
|
-
sessionWriter?: SessionWriter | undefined;
|
|
338
|
-
manifestDebounceMs?: number | undefined;
|
|
339
|
-
checkpointDebounceMs?: number | undefined;
|
|
340
|
-
directorBudget?: {
|
|
341
|
-
maxCostUsd?: number | undefined;
|
|
342
|
-
maxTokens?: number | undefined;
|
|
343
|
-
} | undefined;
|
|
344
|
-
/**
|
|
345
|
-
* Maximum context load (as a fraction of maxContext) the leader agent
|
|
346
|
-
* is allowed to reach before a new spawn is rejected. Default: 0.85.
|
|
347
|
-
* When the leader's context pressure exceeds this threshold, spawning
|
|
348
|
-
* a new subagent is refused — the leader must compact first.
|
|
349
|
-
* Set to 1.0 to disable this check.
|
|
350
|
-
*/
|
|
351
|
-
maxLeaderContextLoad?: number | undefined;
|
|
352
|
-
/**
|
|
353
|
-
* Provider's max context window in tokens. Used with `maxLeaderContextLoad`
|
|
354
|
-
* to compute the absolute token threshold. Default: 128_000.
|
|
355
|
-
*
|
|
356
|
-
* A function may be supplied when the leader can switch models at runtime;
|
|
357
|
-
* canSpawn() reads it lazily so the spawn threshold follows the active model.
|
|
358
|
-
*/
|
|
359
|
-
maxContext?: number | (() => number | undefined) | undefined;
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* Fleet-level policy container extracted from `Director`. Owns:
|
|
363
|
-
* - FleetBus + FleetUsageAggregator
|
|
364
|
-
* - Spawn caps and counters
|
|
365
|
-
* - Manifest entries and debounced writing
|
|
366
|
-
* - State checkpointing
|
|
367
|
-
*
|
|
368
|
-
* This lets the `Director` focus on orchestration (spawn/assign/await/ask)
|
|
369
|
-
* while fleet-level decisions live in one place. The class implements
|
|
370
|
-
* `IFleetManager` so it remains swappable in future.
|
|
371
|
-
*
|
|
372
|
-
* @example
|
|
373
|
-
* ```typescript
|
|
374
|
-
* const fm = new FleetManager({ manifestPath: '/tmp/fleet.json' });
|
|
375
|
-
* const err = fm.canSpawn({ name: 'worker' });
|
|
376
|
-
* if (!err) fm.recordSpawn('sub-1', { name: 'worker' });
|
|
377
|
-
* await fm.writeManifest();
|
|
378
|
-
* ```
|
|
379
|
-
*/
|
|
380
|
-
declare class FleetManager implements IFleetManager {
|
|
381
|
-
/** The fleet-wide event bus. */
|
|
382
|
-
readonly fleet: FleetBus;
|
|
383
|
-
/** Usage rollup across all subagents. */
|
|
384
|
-
readonly usage: FleetUsageAggregator;
|
|
385
|
-
private readonly manifestPath?;
|
|
386
|
-
private readonly directorRunId;
|
|
387
|
-
/** Spawn cap (lifetime total). Infinity means unlimited. */
|
|
388
|
-
readonly maxSpawns: number;
|
|
389
|
-
/** Nesting cap. */
|
|
390
|
-
readonly maxSpawnDepth: number;
|
|
391
|
-
/** This director's depth in a director chain. Root = 0. */
|
|
392
|
-
readonly spawnDepth: number;
|
|
393
|
-
/** Live spawn counter. */
|
|
394
|
-
private spawnCount;
|
|
395
|
-
private readonly stateCheckpoint;
|
|
396
|
-
private readonly sessionWriter;
|
|
397
|
-
private manifestTimer;
|
|
398
|
-
private manifestWriteChain;
|
|
399
|
-
private disposed;
|
|
400
|
-
private readonly manifestDebounceMs;
|
|
401
|
-
/** Fleet-wide cost cap. Infinity = no cap. Distinct from SubagentBudget limits,
|
|
402
|
-
* which track per-subagent spend — this field caps the entire fleet total. */
|
|
403
|
-
private readonly maxFleetCostUsd;
|
|
404
|
-
/** Fleet-wide input+output token ceiling. Infinity = no cap. */
|
|
405
|
-
private readonly maxFleetTokens;
|
|
406
|
-
private readonly manifestEntries;
|
|
407
|
-
/** Pending tasks with their descriptions — populated by `addPendingTask`
|
|
408
|
-
* and cleared by `removePendingTask`. Replaces the host-side `pending`
|
|
409
|
-
* Map so task descriptions live in one place (FleetManager). */
|
|
410
|
-
private readonly pendingTasks;
|
|
411
|
-
private readonly subagentMeta;
|
|
412
|
-
private readonly priceLookups;
|
|
413
|
-
/** Tracks which nickname keys are already assigned — prevents collisions. */
|
|
414
|
-
private readonly _usedNicknames;
|
|
415
|
-
/** The coordinator (wired via setCoordinator by Director after construction). */
|
|
416
|
-
private coordinator;
|
|
417
|
-
/** Leader agent's current context pressure (full request tokens). */
|
|
418
|
-
private leaderContextPressure;
|
|
419
|
-
/** Maximum context load fraction before spawn is refused. */
|
|
420
|
-
private readonly maxLeaderContextLoad;
|
|
421
|
-
/** Provider's max context window in tokens, or a live resolver for runtime model switches. */
|
|
422
|
-
private readonly maxContext;
|
|
423
|
-
constructor(opts?: FleetManagerOptions);
|
|
424
|
-
get fleetBus(): FleetBus;
|
|
425
|
-
/**
|
|
426
|
-
* Wire the coordinator after Director construction. The coordinator
|
|
427
|
-
* is not available when FleetManager is constructed standalone.
|
|
428
|
-
* Once set, `getFleetStats()` delegates to `coordinator.getStats()`.
|
|
429
|
-
*/
|
|
430
|
-
setCoordinator(coordinator: DefaultMultiAgentCoordinator): void;
|
|
431
|
-
snapshot(): FleetUsage;
|
|
432
|
-
getSubagentMeta(id: string): {
|
|
433
|
-
provider?: string | undefined;
|
|
434
|
-
model?: string | undefined;
|
|
435
|
-
name?: string | undefined;
|
|
436
|
-
} | undefined;
|
|
437
|
-
/**
|
|
438
|
-
* Returns null if the spawn is allowed, or an object describing
|
|
439
|
-
* which cap was exceeded. Does NOT throw — the caller decides
|
|
440
|
-
* how to surface the rejection.
|
|
441
|
-
*/
|
|
442
|
-
canSpawn(_config: SubagentConfig): {
|
|
443
|
-
kind: 'max_spawns' | 'max_spawn_depth' | 'max_cost_usd' | 'max_tokens' | 'max_context_load';
|
|
444
|
-
limit: number;
|
|
445
|
-
observed: number;
|
|
446
|
-
} | null;
|
|
447
|
-
budgetSnapshot(): {
|
|
448
|
-
maxSpawns: number;
|
|
449
|
-
usedSpawns: number;
|
|
450
|
-
remainingSpawns: number;
|
|
451
|
-
maxTokens: number;
|
|
452
|
-
usedTokens: number;
|
|
453
|
-
remainingTokens: number;
|
|
454
|
-
maxCostUsd: number;
|
|
455
|
-
usedCostUsd: number;
|
|
456
|
-
remainingCostUsd: number;
|
|
457
|
-
};
|
|
458
|
-
setLeaderContextPressure(tokens: number): void;
|
|
459
|
-
private resolveMaxContext;
|
|
460
|
-
/**
|
|
461
|
-
* Assign a memorable nickname (e.g. "Einstein (Bug Hunter)") to the config,
|
|
462
|
-
* record it so the same name is never reused, then record the spawn.
|
|
463
|
-
*
|
|
464
|
-
* Call this INSTEAD of `recordSpawn` when you want automatic nicknames.
|
|
465
|
-
* The nickname is written back to `config.name` BEFORE the coordinator
|
|
466
|
-
* sees the config, so the manifest, logs, and fleet UI all show it.
|
|
467
|
-
*
|
|
468
|
-
* NOTE: This method ONLY assigns the nickname and marks it used.
|
|
469
|
-
* The caller MUST call `recordSpawn(subagentId, config, priceLookup)` AFTER
|
|
470
|
-
* `coordinator.spawn()` returns with the real subagentId. This is because
|
|
471
|
-
* the subagentId is not known until after the coordinator creates the subagent.
|
|
472
|
-
*/
|
|
473
|
-
assignNicknameAndRecord(config: SubagentConfig): string;
|
|
474
|
-
/**
|
|
475
|
-
* Returns the set of already-assigned nickname keys — useful for debugging
|
|
476
|
-
* and testing.
|
|
477
|
-
*/
|
|
478
|
-
get usedNicknames(): ReadonlySet<string>;
|
|
479
|
-
/**
|
|
480
|
-
* Records a spawn: increments counter, stores metadata, updates state checkpoint,
|
|
481
|
-
* and schedules a debounced manifest write. Call AFTER the coordinator
|
|
482
|
-
* has successfully spawned the subagent.
|
|
483
|
-
*
|
|
484
|
-
* @param subagentId The subagent's id (from coordinator.spawn result)
|
|
485
|
-
* @param config The SubagentConfig that was used
|
|
486
|
-
* @param priceLookup Optional per-subagent pricing data
|
|
487
|
-
*/
|
|
488
|
-
recordSpawn(subagentId: string, config: SubagentConfig, priceLookup?: {
|
|
489
|
-
input?: number | undefined;
|
|
490
|
-
output?: number | undefined;
|
|
491
|
-
cacheRead?: number | undefined;
|
|
492
|
-
cacheWrite?: number | undefined;
|
|
493
|
-
}): void;
|
|
494
|
-
writeManifest(): Promise<string | null>;
|
|
495
|
-
private writeManifestNow;
|
|
496
|
-
/**
|
|
497
|
-
* Attach task ids to an already-spawned subagent. Called by
|
|
498
|
-
* `Director.assign()` after the coordinator assigns a task.
|
|
499
|
-
*/
|
|
500
|
-
addTaskToSubagent(subagentId: string, taskId: string): void;
|
|
501
|
-
recordTaskWorktree(update: WorktreeTaskStateUpdate): void;
|
|
502
|
-
/**
|
|
503
|
-
* Debounced manifest write. Call after any state mutation
|
|
504
|
-
* (spawn, assign, complete) so a burst collapses into one write.
|
|
505
|
-
* When `manifestDebounceMs` is 0, writes are synchronous (no debounce).
|
|
506
|
-
*/
|
|
507
|
-
scheduleManifest(): void;
|
|
508
|
-
/**
|
|
509
|
-
* Bypass the debounce timer and write the manifest immediately.
|
|
510
|
-
* Clears any pending debounce timer before writing.
|
|
511
|
-
*/
|
|
512
|
-
flushManifest(): Promise<void>;
|
|
513
|
-
private clearManifestTimer;
|
|
514
|
-
/** Best-effort session event writer. Swallows failures. */
|
|
515
|
-
private appendSessionEvent;
|
|
516
|
-
addPendingTask(taskId: string, subagentId: string, description: string): void;
|
|
517
|
-
removePendingTask(taskId: string): void;
|
|
518
|
-
getFleetStats(): {
|
|
519
|
-
total: number;
|
|
520
|
-
running: number;
|
|
521
|
-
idle: number;
|
|
522
|
-
stopped: number;
|
|
523
|
-
inFlight: number;
|
|
524
|
-
pending: number;
|
|
525
|
-
completed: number;
|
|
526
|
-
subagentStatuses: {
|
|
527
|
-
subagentId: string;
|
|
528
|
-
taskId: string;
|
|
529
|
-
status: string;
|
|
530
|
-
assigned: boolean;
|
|
531
|
-
}[];
|
|
532
|
-
};
|
|
533
|
-
getFleetStatus(): {
|
|
534
|
-
pending: {
|
|
535
|
-
taskId: string;
|
|
536
|
-
description: string;
|
|
537
|
-
subagentId: string;
|
|
538
|
-
}[];
|
|
539
|
-
live: {
|
|
540
|
-
subagentId: string;
|
|
541
|
-
status: string;
|
|
542
|
-
task?: string | undefined;
|
|
543
|
-
}[];
|
|
544
|
-
};
|
|
545
|
-
/**
|
|
546
|
-
* Clean up all fleet-manager state associated with a removed subagent:
|
|
547
|
-
* - Frees the nickname slot so the same name can be reused
|
|
548
|
-
* - Removes any pending tasks for this subagent
|
|
549
|
-
*/
|
|
550
|
-
removeSubagent(subagentId: string): void;
|
|
551
|
-
/** Release all resources: clear the manifest debounce timer and dispose the usage aggregator. */
|
|
552
|
-
dispose(): void;
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
/**
|
|
556
|
-
* Interface for a fleet coordinator. Implemented by both `Director`
|
|
557
|
-
* (full LLM-driven orchestration with fleet policy) and
|
|
558
|
-
* `DefaultMultiAgentCoordinator` (direct API-driven, no fleet policy).
|
|
559
|
-
*
|
|
560
|
-
* External callers — CLI slash commands, tests, the delegate tool —
|
|
561
|
-
* use this to stay agnostic to the orchestration mode.
|
|
562
|
-
*
|
|
563
|
-
* The interface captures the **orchestration contract**: spawn, assign,
|
|
564
|
-
* terminate, await, and query. Fleet-level policy (cost caps, manifest
|
|
565
|
-
* writing, checkpointing) lives behind this surface and is optional
|
|
566
|
-
* from the caller's perspective.
|
|
567
|
-
*
|
|
568
|
-
* @example
|
|
569
|
-
* ```typescript
|
|
570
|
-
* let coordinator: ICoordinator = isDirectorMode
|
|
571
|
-
* ? new Director({ config, ... })
|
|
572
|
-
* : new DefaultMultiAgentCoordinator(config);
|
|
573
|
-
* const id = await coordinator.spawn({ name: 'worker', role: 'researcher' });
|
|
574
|
-
* await coordinator.assign({ id: 't-1', description: 'research X', subagentId: id });
|
|
575
|
-
* const results = await coordinator.awaitTasks(['t-1']);
|
|
576
|
-
* ```
|
|
577
|
-
*/
|
|
578
|
-
interface ICoordinator {
|
|
579
|
-
/** Stable identifier for this coordinator instance. */
|
|
580
|
-
readonly coordinatorId: string;
|
|
581
|
-
/**
|
|
582
|
-
* Spawn a new subagent and return its id. In director mode this
|
|
583
|
-
* enforces fleet-wide spawn caps and cost limits; in raw coordinator
|
|
584
|
-
* mode it is a direct pass-through.
|
|
585
|
-
*/
|
|
586
|
-
spawn(config: SubagentConfig): Promise<string>;
|
|
587
|
-
/**
|
|
588
|
-
* Assign a task to a subagent (or to the fleet for auto-routing).
|
|
589
|
-
* Returns the assigned task id.
|
|
590
|
-
*/
|
|
591
|
-
assign(task: {
|
|
592
|
-
id: string;
|
|
593
|
-
description: string;
|
|
594
|
-
subagentId?: string | undefined;
|
|
595
|
-
}): Promise<string>;
|
|
596
|
-
/**
|
|
597
|
-
* Synchronously ask a subagent something via the in-memory bridge.
|
|
598
|
-
* The subagent must have been spawned and must handle `bridge.subscribe()`
|
|
599
|
-
* in its task loop. Returns the reply payload or throws on timeout.
|
|
600
|
-
*
|
|
601
|
-
* Only available in director mode — raw coordinator has no bridge.
|
|
602
|
-
*/
|
|
603
|
-
ask<T = unknown>(subagentId: string, payload: unknown, timeoutMs?: number): Promise<T> | undefined;
|
|
604
|
-
/**
|
|
605
|
-
* Wait for one or more tasks to complete and return their results.
|
|
606
|
-
* If a task is already done when called, returns immediately.
|
|
607
|
-
* Resolves to an array in the same order as `taskIds`.
|
|
608
|
-
*/
|
|
609
|
-
awaitTasks(taskIds: string[]): Promise<TaskResult[]>;
|
|
610
|
-
/**
|
|
611
|
-
* Gracefully stop a single subagent. The subagent finishes its current
|
|
612
|
-
* in-flight work and exits cleanly — it does not hard-kill.
|
|
613
|
-
*/
|
|
614
|
-
terminate(subagentId: string): Promise<void>;
|
|
615
|
-
/**
|
|
616
|
-
* Stop all subagents. In-flight tasks are allowed to complete;
|
|
617
|
-
* no new tasks are dispatched.
|
|
618
|
-
*/
|
|
619
|
-
terminateAll(): Promise<void>;
|
|
620
|
-
/**
|
|
621
|
-
* Stop a subagent and remove it from the coordinator. Releases all
|
|
622
|
-
* associated resources (AbortController, budget state). The subagent
|
|
623
|
-
* entry is deleted so the id can be reused in a future spawn.
|
|
624
|
-
*/
|
|
625
|
-
remove(subagentId: string): Promise<void>;
|
|
626
|
-
/**
|
|
627
|
-
* Live coordinator status — subagent list, pending task count,
|
|
628
|
-
* completed task count, iteration totals.
|
|
629
|
-
*/
|
|
630
|
-
status(): CoordinatorStatus;
|
|
631
|
-
/**
|
|
632
|
-
* Snapshot of completed task results. In director mode this returns
|
|
633
|
-
* every `TaskResult` from the fleet; in raw coordinator mode this
|
|
634
|
-
* may return an empty array if the coordinator doesn't cache results.
|
|
635
|
-
*/
|
|
636
|
-
completedResults(): TaskResult[];
|
|
637
|
-
/**
|
|
638
|
-
* Subscribe to coordinator lifecycle events. Currently supports
|
|
639
|
-
* `task.completed` — the payload carries the task spec and result.
|
|
640
|
-
*
|
|
641
|
-
* Returns a disposer function; call it to unsubscribe.
|
|
642
|
-
*/
|
|
643
|
-
on(event: 'task.completed', handler: (payload: {
|
|
644
|
-
task: TaskSpec;
|
|
645
|
-
result: TaskResult;
|
|
646
|
-
}) => void): () => void;
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
declare class LargeAnswerStore {
|
|
650
|
-
/**
|
|
651
|
-
* Responses above this size (in characters) are stored out-of-context.
|
|
652
|
-
* Below this, the full answer is returned inline (no overhead).
|
|
653
|
-
* Default: 2000 chars ≈ 400-600 tokens.
|
|
654
|
-
*/
|
|
655
|
-
readonly sizeThreshold: number;
|
|
656
|
-
private readonly store;
|
|
657
|
-
constructor(sizeThreshold?: number);
|
|
658
|
-
/**
|
|
659
|
-
* Store a value, returning a summary + key for inline use.
|
|
660
|
-
* If the value is below sizeThreshold, returns it as-is (no store entry).
|
|
661
|
-
*/
|
|
662
|
-
storeAnswer(value: unknown): {
|
|
663
|
-
key?: string | undefined;
|
|
664
|
-
summary: string;
|
|
665
|
-
inline: boolean;
|
|
666
|
-
};
|
|
667
|
-
/**
|
|
668
|
-
* Retrieve a previously stored answer by its key.
|
|
669
|
-
* Returns undefined if the key is unknown or the store was cleared.
|
|
670
|
-
*/
|
|
671
|
-
retrieveAnswer(key: string): unknown | undefined;
|
|
672
|
-
/**
|
|
673
|
-
* Check if a key exists in the store.
|
|
674
|
-
*/
|
|
675
|
-
hasAnswer(key: string): boolean;
|
|
676
|
-
/** Number of stored entries. */
|
|
677
|
-
get size(): number;
|
|
678
|
-
/** Total characters stored. */
|
|
679
|
-
get totalChars(): number;
|
|
680
|
-
/** Clear all stored entries. Call at the end of a director run. */
|
|
681
|
-
clear(): void;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
/**
|
|
685
|
-
* Director-specific error types. Extracted to keep the Director class
|
|
686
|
-
* focused on orchestration logic.
|
|
687
|
-
*/
|
|
688
|
-
declare class FleetSpawnBudgetError extends Error {
|
|
689
|
-
readonly kind: 'max_spawns' | 'max_spawn_depth';
|
|
690
|
-
readonly limit: number;
|
|
691
|
-
readonly observed: number;
|
|
692
|
-
constructor(kind: 'max_spawns' | 'max_spawn_depth', limit: number, observed: number, message?: string | undefined);
|
|
693
|
-
}
|
|
694
|
-
declare class FleetCostCapError extends Error {
|
|
695
|
-
readonly kind: 'max_cost_usd';
|
|
696
|
-
readonly limit: number;
|
|
697
|
-
readonly observed: number;
|
|
698
|
-
constructor(limit: number, observed: number);
|
|
699
|
-
}
|
|
700
|
-
declare class FleetTokenCapError extends Error {
|
|
701
|
-
readonly kind: 'max_tokens';
|
|
702
|
-
readonly limit: number;
|
|
703
|
-
readonly observed: number;
|
|
704
|
-
constructor(limit: number, observed: number);
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
/**
|
|
708
|
-
* Director — high-level orchestrator that owns a `MultiAgentCoordinator`,
|
|
709
|
-
* a `FleetBus`, and a `FleetUsageAggregator`. Exposes a small imperative
|
|
710
|
-
* API (`spawn`, `assign`, `awaitTasks`, `terminate`, `status`, `usage`)
|
|
711
|
-
* that's easy to test, and a `tools()` factory that wraps the same API
|
|
712
|
-
* as agent-callable `Tool`s so an LLM can drive the orchestration.
|
|
713
|
-
*
|
|
714
|
-
* This class is intentionally *not* an `Agent`. It's a coordinator +
|
|
715
|
-
* observability surface. To make it LLM-driven, construct an Agent
|
|
716
|
-
* with `director.tools()` registered. That keeps the construction
|
|
717
|
-
* symmetric with how other agents are built and avoids smuggling a
|
|
718
|
-
* heavy LLM dependency into core just for the director path.
|
|
719
|
-
*/
|
|
720
|
-
/**
|
|
721
|
-
* Payload handed to {@link DirectorOptions.taskResultNotifier} when a
|
|
722
|
-
* fire-and-forget task completes (no `awaitTasks` waiter was pending).
|
|
723
|
-
*/
|
|
724
|
-
interface TaskResultNotification {
|
|
725
|
-
taskId: string;
|
|
726
|
-
/** Task description (or task id when no description was recorded). */
|
|
727
|
-
title: string;
|
|
728
|
-
status: TaskResult['status'];
|
|
729
|
-
subagentId: string;
|
|
730
|
-
/** Human-readable subagent name from the fleet manifest, when known. */
|
|
731
|
-
subagentName?: string | undefined;
|
|
732
|
-
/** The subagent's textual result (stringified when structured). */
|
|
733
|
-
resultText?: string | undefined;
|
|
734
|
-
/** Flattened `kind: message` error string for non-success statuses. */
|
|
735
|
-
errorText?: string | undefined;
|
|
736
|
-
/** Bounded incomplete text recovered before a non-successful exit. */
|
|
737
|
-
partialText?: string | undefined;
|
|
738
|
-
/** Machine-readable result submitted through submit_result. */
|
|
739
|
-
report?: TaskResult['report'] | undefined;
|
|
740
|
-
iterations: number;
|
|
741
|
-
toolCalls: number;
|
|
742
|
-
durationMs: number;
|
|
743
|
-
}
|
|
744
|
-
interface DirectorOptions {
|
|
745
|
-
config: MultiAgentConfig;
|
|
746
|
-
runner?: SubagentRunner | undefined;
|
|
747
|
-
/** Optional Brain arbiter above the director for policy/decision escalation. */
|
|
748
|
-
brain?: BrainArbiter | undefined;
|
|
749
|
-
/**
|
|
750
|
-
* Called when a task completes with NO pending `awaitTasks` waiter —
|
|
751
|
-
* i.e. a fire-and-forget `assign_task`. Wire this to the project
|
|
752
|
-
* mailbox so the result reaches the leader's conversation automatically
|
|
753
|
-
* instead of waiting for a poll. Synchronous `delegate` calls attach a
|
|
754
|
-
* waiter up front, so they never double-report through this hook.
|
|
755
|
-
* Internal tasks (shadow passes) are excluded. Errors are swallowed.
|
|
756
|
-
*/
|
|
757
|
-
taskResultNotifier?: ((n: TaskResultNotification) => void | Promise<void>) | undefined;
|
|
758
|
-
/** Optional logger for structured debug/error logging. Falls back to console if omitted. */
|
|
759
|
-
logger?: Logger | undefined;
|
|
760
|
-
/**
|
|
761
|
-
* When set, the director writes a `fleet.json` manifest to this path
|
|
762
|
-
* recording every spawned subagent (id, provider, model, role, task
|
|
763
|
-
* ids). Used by `wstack replay <runId>` to rehydrate a fleet. Pass an
|
|
764
|
-
* absolute file path — the directory must already exist (the
|
|
765
|
-
* director-session factory creates it when used together).
|
|
766
|
-
*/
|
|
767
|
-
manifestPath?: string | undefined;
|
|
768
|
-
/**
|
|
769
|
-
* Optional roster used by `leaderSystemPrompt()` to render a roles
|
|
770
|
-
* summary into the leader's preamble. Same shape as the roster passed
|
|
771
|
-
* to `tools()` — typically the same value.
|
|
772
|
-
*/
|
|
773
|
-
roster?: Record<string, SubagentConfig>;
|
|
774
|
-
/**
|
|
775
|
-
* Override the built-in fleet preamble (see `DEFAULT_DIRECTOR_PREAMBLE`).
|
|
776
|
-
* Pass an empty string to suppress the preamble entirely.
|
|
777
|
-
*/
|
|
778
|
-
directorPreamble?: string | undefined;
|
|
779
|
-
/**
|
|
780
|
-
* Override the built-in subagent baseline (see
|
|
781
|
-
* `DEFAULT_SUBAGENT_BASELINE`). Pass an empty string to suppress.
|
|
782
|
-
*/
|
|
783
|
-
subagentBaseline?: string | undefined;
|
|
784
|
-
/**
|
|
785
|
-
* Absolute path to a directory the fleet can use as a shared scratchpad
|
|
786
|
-
* (read + write by every subagent). When set, the director creates it on
|
|
787
|
-
* construction and `subagentSystemPrompt()` automatically injects a
|
|
788
|
-
* "Shared notes" block telling subagents where to drop their findings.
|
|
789
|
-
* This is the cheap fleet-coordination channel — agents don't need each
|
|
790
|
-
* other's transcripts, just each other's conclusions.
|
|
791
|
-
*
|
|
792
|
-
* Convention: under a fleet run rooted at `<sessionsRoot>/<runId>/`,
|
|
793
|
-
* pass `<sessionsRoot>/<runId>/shared/` here.
|
|
794
|
-
*/
|
|
795
|
-
sharedScratchpadPath?: string | undefined;
|
|
796
|
-
/**
|
|
797
|
-
* Maximum number of spawns this director can perform across its
|
|
798
|
-
* lifetime. Default: unlimited. Acts as a hard fleet-wide cost cap —
|
|
799
|
-
* a runaway leader that keeps spawning workers gets cut off cleanly
|
|
800
|
-
* instead of burning provider tokens until the user kills the
|
|
801
|
-
* process. The N+1-th spawn call rejects with a `FleetSpawnBudgetError`.
|
|
802
|
-
*/
|
|
803
|
-
maxSpawns?: number | undefined;
|
|
804
|
-
/**
|
|
805
|
-
* Maximum nesting depth for spawns. The director constructed by the
|
|
806
|
-
* user is at depth `spawnDepth` (default 0); any subagent that itself
|
|
807
|
-
* acts as a director would construct its own `Director` with
|
|
808
|
-
* `spawnDepth: parent.spawnDepth + 1`. When `spawnDepth >= maxSpawnDepth`,
|
|
809
|
-
* `spawn()` rejects. The process-wide hard ceiling is 2; configuration can
|
|
810
|
-
* narrow it but cannot widen it. Default: 2 (root director can spawn workers; a
|
|
811
|
-
* worker that becomes a sub-director cannot itself spawn further).
|
|
812
|
-
* This stops infinite recursive director chains from a hostile or
|
|
813
|
-
* confused prompt.
|
|
814
|
-
*/
|
|
815
|
-
maxSpawnDepth?: number | undefined;
|
|
816
|
-
/**
|
|
817
|
-
* Current spawn-chain depth for this director instance. Defaults to 0.
|
|
818
|
-
* A nested director should pass `parent.spawnDepth + 1`. Together with
|
|
819
|
-
* `maxSpawnDepth` this bounds the chain.
|
|
820
|
-
*/
|
|
821
|
-
spawnDepth?: number | undefined;
|
|
822
|
-
/**
|
|
823
|
-
* Absolute path to a director-state checkpoint file. When set, the
|
|
824
|
-
* director writes an incremental snapshot of pending/running/completed
|
|
825
|
-
* tasks + spawned subagents on every state mutation. Distinct from
|
|
826
|
-
* `manifestPath`: the manifest is a final record written on shutdown,
|
|
827
|
-
* the checkpoint is a live mirror useful for crash recovery and the
|
|
828
|
-
* `wstack resume` "you had N tasks in flight" banner.
|
|
829
|
-
*/
|
|
830
|
-
stateCheckpointPath?: string | undefined;
|
|
831
|
-
/**
|
|
832
|
-
* Session writer the director should forward task lifecycle events to
|
|
833
|
-
* (`agent_spawned`, `task_created`, `task_completed`, `task_failed`).
|
|
834
|
-
* When omitted these events stay in-memory only — useful for tests but
|
|
835
|
-
* lossy in production. Production callers (the CLI) pass the same
|
|
836
|
-
* writer the host Agent uses so all events land in a single JSONL.
|
|
837
|
-
*/
|
|
838
|
-
sessionWriter?: SessionWriter | undefined;
|
|
839
|
-
/**
|
|
840
|
-
* Session id for live fleet/coordinator events. Defaults to
|
|
841
|
-
* `sessionWriter.id` when a writer is available; accepts a getter so
|
|
842
|
-
* embedding surfaces can follow session swaps.
|
|
843
|
-
*/
|
|
844
|
-
sessionId?: string | (() => string | undefined) | undefined;
|
|
845
|
-
/**
|
|
846
|
-
* Debounce window for periodic manifest writes triggered by spawn/
|
|
847
|
-
* assign/complete events. Default: 2000ms. Pass 0 to disable periodic
|
|
848
|
-
* writes (the manifest will then only be written on `shutdown()`).
|
|
849
|
-
*/
|
|
850
|
-
manifestDebounceMs?: number | undefined;
|
|
851
|
-
/**
|
|
852
|
-
* Fleet-wide cost ceiling. When set, `spawn()` refuses any new subagent
|
|
853
|
-
* that would push the fleet's total cost above this limit. The cap
|
|
854
|
-
* is checked BEFORE the spawn is recorded — a refused spawn must not
|
|
855
|
-
* leak partial state into the manifest or fleet bus. Let in-flight
|
|
856
|
-
* tasks complete; refuse new spawns only. When omitted or Infinity,
|
|
857
|
-
* no cost cap applies.
|
|
858
|
-
*
|
|
859
|
-
* Distinct from SubagentBudget.maxCostUsd (per-subagent spend) — this
|
|
860
|
-
* field caps the *entire fleet* total.
|
|
861
|
-
*/
|
|
862
|
-
directorBudget?: {
|
|
863
|
-
/**
|
|
864
|
-
* Maximum total USD the fleet may spend across all subagents.
|
|
865
|
-
* Default: Infinity (no cap).
|
|
866
|
-
*/
|
|
867
|
-
maxCostUsd?: number | undefined;
|
|
868
|
-
/** Maximum cumulative input+output tokens across the fleet. */
|
|
869
|
-
maxTokens?: number | undefined;
|
|
870
|
-
} | undefined;
|
|
871
|
-
/**
|
|
872
|
-
* Maximum auto-extensions per subagent per budget kind before the
|
|
873
|
-
* director denies further extensions. A subagent hitting the same
|
|
874
|
-
* soft limit repeatedly (e.g. 3× budget.threshold_reached for
|
|
875
|
-
* tool_calls) is likely looping on a prompt/config issue, not
|
|
876
|
-
* making legitimate progress. Default: 5. Set to Infinity to
|
|
877
|
-
* disable the cap (use with caution — a misconfigured subagent
|
|
878
|
-
* could burn unlimited budget).
|
|
879
|
-
*/
|
|
880
|
-
maxBudgetExtensions?: number | undefined;
|
|
881
|
-
/**
|
|
882
|
-
* Debounce window for state-checkpoint writes. Default: 250ms.
|
|
883
|
-
* Bursts of spawn/assign/complete events collapse into one disk
|
|
884
|
-
* hit. Higher values reduce write amplification on fast machines;
|
|
885
|
-
* lower values improve crash-recovery fidelity (less state lost
|
|
886
|
-
* on sudden process exit).
|
|
887
|
-
*/
|
|
888
|
-
checkpointDebounceMs?: number | undefined;
|
|
889
|
-
/**
|
|
890
|
-
* Sessions root directory for per-subagent JSONL transcripts.
|
|
891
|
-
* When set, the director can read subagent transcripts directly for
|
|
892
|
-
* `fleet` tool (action: session) — no bridge round-trip needed. Path convention:
|
|
893
|
-
* `<sessionsRoot>/<directorRunId>/<subagentId>.jsonl`.
|
|
894
|
-
*/
|
|
895
|
-
sessionsRoot?: string | undefined;
|
|
896
|
-
/**
|
|
897
|
-
* Director run id — namespaced under `sessionsRoot` to locate per-subagent
|
|
898
|
-
* JSONLs. Defaults to the director's own `id` when omitted.
|
|
899
|
-
*/
|
|
900
|
-
directorRunId?: string | undefined;
|
|
901
|
-
/**
|
|
902
|
-
* Pre-built fleet manager. When provided the Director delegates all
|
|
903
|
-
* fleet-level policy (spawn budgets, manifest assembly, checkpointing)
|
|
904
|
-
* to this instance and takes ownership of the coordinator + bridge
|
|
905
|
-
* layer only. This enables unit-testing fleet policy in isolation
|
|
906
|
-
* and swapping implementations without changing the Director surface.
|
|
907
|
-
*
|
|
908
|
-
* When omitted the Director creates its own fleet infrastructure
|
|
909
|
-
* (same behavior as before this field was added).
|
|
910
|
-
*/
|
|
911
|
-
fleetManager?: FleetManager | undefined;
|
|
912
|
-
/**
|
|
913
|
-
* Optional LLM classifier for the smart dispatcher. When set, the
|
|
914
|
-
* `spawn_subagent` tool can accept a free-form `description` field
|
|
915
|
-
* and the director will automatically route to the best-matching
|
|
916
|
-
* catalog agent using `dispatchAgent()`. When omitted, routing is
|
|
917
|
-
* pure heuristic (no provider call) — sufficient for most tasks.
|
|
918
|
-
*
|
|
919
|
-
* Build from a `complete(prompt) => string` function using
|
|
920
|
-
* `makeLLMClassifier(complete)` from the dispatcher module.
|
|
921
|
-
*/
|
|
922
|
-
dispatchClassifier?: DispatchClassifier | undefined;
|
|
923
|
-
/**
|
|
924
|
-
* Maximum context load (as a fraction of maxContext) the leader agent
|
|
925
|
-
* is allowed to reach before a new spawn is rejected. Default: 0.85.
|
|
926
|
-
* When the leader's context pressure exceeds this threshold, spawning
|
|
927
|
-
* a new subagent is refused — the leader must compact first.
|
|
928
|
-
* Only used when no `fleetManager` is provided (inline mode).
|
|
929
|
-
* Set to 1.0 to disable this check.
|
|
930
|
-
*/
|
|
931
|
-
maxLeaderContextLoad?: number | undefined;
|
|
932
|
-
/**
|
|
933
|
-
* Provider's max context window in tokens. Used with `maxLeaderContextLoad`
|
|
934
|
-
* to compute the absolute token threshold. Default: 128_000.
|
|
935
|
-
* Only used when no `fleetManager` is provided (inline mode).
|
|
936
|
-
*
|
|
937
|
-
* A function may be supplied when the leader can switch models at runtime;
|
|
938
|
-
* spawn() reads it lazily so the threshold follows the active model.
|
|
939
|
-
*/
|
|
940
|
-
maxContext?: number | (() => number | undefined) | undefined;
|
|
941
|
-
/**
|
|
942
|
-
* Per-task model matrix (Config.modelMatrix). When set, a spawn whose
|
|
943
|
-
* config has no explicit `model` is resolved against this matrix by role
|
|
944
|
-
* (→ phase → `*`) before the subagent is built — so the spawned event,
|
|
945
|
-
* manifest, and the agent itself all run the matched model. Explicit
|
|
946
|
-
* per-spawn `model` overrides always win.
|
|
947
|
-
*
|
|
948
|
-
* Pass a **function** (not a snapshot) when the matrix can change at
|
|
949
|
-
* runtime (the CLI passes `() => configStore.get().modelMatrix`) so a
|
|
950
|
-
* mid-session `/setmodel` takes effect on the next spawn. A static record
|
|
951
|
-
* is also accepted for tests and one-shot runs.
|
|
952
|
-
*/
|
|
953
|
-
modelMatrix?: ModelMatrixSource | undefined;
|
|
954
|
-
/**
|
|
955
|
-
* Optional git-worktree manager for Director fleet isolation. When supplied,
|
|
956
|
-
* task runners can execute side-effectful subagents in per-task worktrees and
|
|
957
|
-
* squash-merge successful branches back into the base checkout.
|
|
958
|
-
*/
|
|
959
|
-
worktrees?: WorktreeManager | undefined;
|
|
960
|
-
/** Worktree policy. Defaults to `auto` when `worktrees` is provided. */
|
|
961
|
-
worktreePolicy?: FleetWorktreePolicy | undefined;
|
|
962
|
-
/**
|
|
963
|
-
* Optional guarded merge-conflict resolver invoked by WorktreeManager when a
|
|
964
|
-
* successful task branch cannot squash-merge cleanly.
|
|
965
|
-
*/
|
|
966
|
-
worktreeConflictResolver?: ((info: {
|
|
967
|
-
task: TaskSpec;
|
|
968
|
-
config: SubagentConfig;
|
|
969
|
-
conflictFiles: string[];
|
|
970
|
-
cwd: string;
|
|
971
|
-
}) => Promise<boolean>) | undefined;
|
|
972
|
-
}
|
|
973
|
-
/** Either a static matrix or a live getter (re-read on every spawn). */
|
|
974
|
-
type ModelMatrixSource = Record<string, ModelMatrixEntry> | (() => Record<string, ModelMatrixEntry> | undefined);
|
|
975
|
-
|
|
976
|
-
declare class Director implements ICoordinator {
|
|
977
|
-
/** Alias for the ICoordinator contract. `id` is retained for backward compatibility. */
|
|
978
|
-
get coordinatorId(): string;
|
|
979
|
-
readonly id: string;
|
|
980
|
-
/**
|
|
981
|
-
* The fleet event bus. Backed by `fleetManager?.fleet` when a FleetManager
|
|
982
|
-
* is injected; otherwise own FleetBus instance (preserves existing behavior).
|
|
983
|
-
*/
|
|
984
|
-
readonly fleet: FleetBus;
|
|
985
|
-
/**
|
|
986
|
-
* Usage rollup. Backed by `fleetManager?.usage` when a FleetManager is
|
|
987
|
-
* injected; otherwise own FleetUsageAggregator.
|
|
988
|
-
*/
|
|
989
|
-
readonly usage: FleetUsageAggregator;
|
|
990
|
-
/**
|
|
991
|
-
* Update the leader agent's current context pressure (full request tokens:
|
|
992
|
-
* messages + systemPrompt + toolDefs). The director checks this before every
|
|
993
|
-
* spawn — if the pressure exceeds `maxLeaderContextLoad * maxContext`,
|
|
994
|
-
* spawning is refused with a `FleetContextOverflowError`.
|
|
995
|
-
*
|
|
996
|
-
* Call this after each leader agent iteration to keep the pressure current.
|
|
997
|
-
* The compactor's `CompactReport.fullRequestTokensAfter` is a natural source.
|
|
998
|
-
*/
|
|
999
|
-
setLeaderContextPressure(tokens: number): void;
|
|
1000
|
-
/**
|
|
1001
|
-
* Read the leader agent's current context pressure.
|
|
1002
|
-
*/
|
|
1003
|
-
getLeaderContextPressure(): number;
|
|
1004
|
-
/**
|
|
1005
|
-
* Remaining USD budget for the entire fleet (when a cap is configured).
|
|
1006
|
-
* Returns `undefined` when no cap was set (Infinity).
|
|
1007
|
-
*/
|
|
1008
|
-
getRemainingBudgetUsd(): number | undefined;
|
|
1009
|
-
private resolveMaxContext;
|
|
1010
|
-
private currentSessionId;
|
|
1011
|
-
/** Optional Brain arbiter for director-level policy decisions. */
|
|
1012
|
-
private readonly brain?;
|
|
1013
|
-
/**
|
|
1014
|
-
* Optional fleet-level policy container. When provided the Director
|
|
1015
|
-
* delegates spawn budgeting, manifest entries, and checkpointing to it
|
|
1016
|
-
* instead of managing those internally. All other behavior is unchanged.
|
|
1017
|
-
*/
|
|
1018
|
-
readonly fleetManager: FleetManager | undefined;
|
|
1019
|
-
/**
|
|
1020
|
-
* Director-side bridge endpoint. Subagents are wired to the same
|
|
1021
|
-
* in-memory transport so the director can `ask()` them synchronously
|
|
1022
|
-
* and they can `send()` progress back. Exposed so external code (e.g.
|
|
1023
|
-
* the TUI) can subscribe to inbound messages.
|
|
1024
|
-
*/
|
|
1025
|
-
readonly bridge: InMemoryAgentBridge;
|
|
1026
|
-
private readonly transport;
|
|
1027
|
-
private readonly coordinator;
|
|
1028
|
-
/** Resolves with the matching `TaskResult` the first time the
|
|
1029
|
-
* coordinator emits `task.completed` for a given task id. Each entry
|
|
1030
|
-
* is created lazily on first poll/await and cleared once consumed. */
|
|
1031
|
-
private readonly taskWaiters;
|
|
1032
|
-
/** First-completion waiters registered by `awaitTasksAny`. Kept separate
|
|
1033
|
-
* from `taskWaiters` on purpose: a `taskWaiters` entry marks a result as
|
|
1034
|
-
* "will be delivered in-band" and suppresses the fire-and-forget
|
|
1035
|
-
* report-back — but an any-await only consumes ONE of its ids, so the
|
|
1036
|
-
* losers must stay eligible for the mailbox notifier. Entries carry an
|
|
1037
|
-
* optional timeout timer so `shutdown()` can clear them. */
|
|
1038
|
-
private readonly anyWaiters;
|
|
1039
|
-
/** Cache of completed results in case the consumer asks AFTER the
|
|
1040
|
-
* coordinator already fired the event — `awaitTasks(['t-1'])` after
|
|
1041
|
-
* t-1 finished should resolve immediately, not hang. */
|
|
1042
|
-
private readonly completed;
|
|
1043
|
-
/** Prevents the completed Map from growing unbounded in long-running directors. */
|
|
1044
|
-
private static readonly MAX_COMPLETED;
|
|
1045
|
-
/** Per-subagent provider/model metadata, captured at spawn time so the
|
|
1046
|
-
* FleetUsageAggregator's metaLookup can surface readable rows. */
|
|
1047
|
-
private readonly subagentMeta;
|
|
1048
|
-
private readonly priceLookups;
|
|
1049
|
-
/** Bridge endpoints we created per subagent (so we can `stop()` them
|
|
1050
|
-
* on shutdown and free transport subscriptions). */
|
|
1051
|
-
private readonly subagentBridges;
|
|
1052
|
-
/** Tracks per-spawn config + assigned task ids for manifest writing. */
|
|
1053
|
-
private readonly manifestEntries;
|
|
1054
|
-
/** Tracks assigned nicknames so the same name is never reused in one fleet. */
|
|
1055
|
-
private readonly _usedNicknames;
|
|
1056
|
-
private readonly manifestPath?;
|
|
1057
|
-
private readonly roster?;
|
|
1058
|
-
private readonly directorPreamble;
|
|
1059
|
-
private readonly subagentBaseline;
|
|
1060
|
-
/** See {@link DirectorOptions.taskResultNotifier}. */
|
|
1061
|
-
private readonly taskResultNotifier?;
|
|
1062
|
-
/** Absolute path to the fleet's shared scratchpad directory, or null
|
|
1063
|
-
* when none was configured. Exposed as a readonly getter for callers
|
|
1064
|
-
* that need to surface the path to the user (e.g. the CLI logging
|
|
1065
|
-
* the location after `--director` boots). */
|
|
1066
|
-
readonly sharedScratchpadPath: string | null;
|
|
1067
|
-
/** Spawn cap (lifetime total). Infinity means unlimited. */
|
|
1068
|
-
readonly maxSpawns: number;
|
|
1069
|
-
/** Nesting cap. The N-th director in a chain has `spawnDepth = N-1`. */
|
|
1070
|
-
readonly maxSpawnDepth: number;
|
|
1071
|
-
/** This director's position in a director chain. Root director = 0. */
|
|
1072
|
-
readonly spawnDepth: number;
|
|
1073
|
-
/** Live spawn counter for `maxSpawns` enforcement. */
|
|
1074
|
-
private spawnCount;
|
|
1075
|
-
/** Optional checkpoint mirror — writes the live task graph + roster to disk. */
|
|
1076
|
-
private readonly stateCheckpoint;
|
|
1077
|
-
/** Optional session writer for emitting task_* / agent_* lifecycle events. */
|
|
1078
|
-
private readonly sessionWriter;
|
|
1079
|
-
private readonly sessionIdSource;
|
|
1080
|
-
/** Debounce timer for periodic manifest writes. */
|
|
1081
|
-
private manifestTimer;
|
|
1082
|
-
private manifestWriteChain;
|
|
1083
|
-
private readonly manifestDebounceMs;
|
|
1084
|
-
/** Fleet-wide cost cap (entire fleet total, distinct from SubagentBudget limits). Infinity means no cap. */
|
|
1085
|
-
private readonly maxFleetCostUsd;
|
|
1086
|
-
/** Fleet-wide input+output token cap. Infinity means no cap. */
|
|
1087
|
-
private readonly maxFleetTokens;
|
|
1088
|
-
/** Max auto-extensions per subagent per budget kind before denying. */
|
|
1089
|
-
private readonly maxBudgetExtensions;
|
|
1090
|
-
/** Sessions root for direct subagent JSONL reads (fleet tool, action: session). */
|
|
1091
|
-
private readonly sessionsRoot?;
|
|
1092
|
-
/** Director run id for JSONL path resolution. */
|
|
1093
|
-
private readonly directorRunId;
|
|
1094
|
-
/** Optional logger for structured logging. Falls back to noop when omitted. */
|
|
1095
|
-
private readonly logger;
|
|
1096
|
-
/** Resolves task descriptions back from `assign()` so completion events
|
|
1097
|
-
* can also carry a human-readable title. */
|
|
1098
|
-
private readonly taskDescriptions;
|
|
1099
|
-
/** Latest worktree state per task id (allocated/committed/merged/conflict/etc.). */
|
|
1100
|
-
private readonly taskWorktrees;
|
|
1101
|
-
/** Snapshot of which subagent owns each task — drives state-checkpoint
|
|
1102
|
-
* status updates without re-walking the manifest. */
|
|
1103
|
-
private readonly taskOwners;
|
|
1104
|
-
/** Infrastructure-owned task ids that should not appear in user-visible
|
|
1105
|
-
* manifest/session/checkpoint/rollup state. */
|
|
1106
|
-
private readonly internalTaskIds;
|
|
1107
|
-
/** Cumulative auto-extension grants per subagent (all budget kinds). Lets
|
|
1108
|
-
* /fleet render "⚡ extended ×N" without replaying the event stream. */
|
|
1109
|
-
private readonly extendTotals;
|
|
1110
|
-
/**
|
|
1111
|
-
* Handle to the coordinator-side `task.completed` listener so we can
|
|
1112
|
-
* unsubscribe in `shutdown()`. Without this, repeated Director
|
|
1113
|
-
* construction (e.g. tests, hot reloads) accumulates listeners on a
|
|
1114
|
-
* cached coordinator and slowly drifts the EventEmitter past its
|
|
1115
|
-
* default cap.
|
|
1116
|
-
*/
|
|
1117
|
-
private taskCompletedListener;
|
|
1118
|
-
/**
|
|
1119
|
-
* Unsub handles for the two `FleetBus.filter()` calls installed in the
|
|
1120
|
-
* constructor for timeout-heartbeat tracking. Without capturing these
|
|
1121
|
-
* and calling them in `shutdown()`, repeated Director construction
|
|
1122
|
-
* (tests, hot reloads, `--director` restarts) accumulates 2 dangling
|
|
1123
|
-
* listeners per Director on the FleetBus, slowly drifting the
|
|
1124
|
-
* EventEmitter past its default cap. Mirrors the rationale on
|
|
1125
|
-
* `taskCompletedListener` above.
|
|
1126
|
-
*/
|
|
1127
|
-
private toolExecFilter;
|
|
1128
|
-
private budgetFilter;
|
|
1129
|
-
/** Optional LLM classifier for smart dispatch. Passed from options. */
|
|
1130
|
-
readonly dispatchClassifier?: DispatchClassifier | undefined;
|
|
1131
|
-
/** Leader agent's current context pressure (full request tokens). */
|
|
1132
|
-
private leaderContextPressure;
|
|
1133
|
-
/** Maximum context load fraction before spawn is refused. */
|
|
1134
|
-
private readonly maxLeaderContextLoad;
|
|
1135
|
-
/** Provider's max context window in tokens, or a live resolver for runtime model switches. */
|
|
1136
|
-
private readonly maxContext;
|
|
1137
|
-
/** Per-task model matrix (static record or live getter); resolved
|
|
1138
|
-
* per-spawn when no explicit model is set. */
|
|
1139
|
-
private readonly modelMatrix?;
|
|
1140
|
-
/**
|
|
1141
|
-
* When set by `workComplete()`, the director stops dispatching new tasks
|
|
1142
|
-
* and terminates all running subagents. Used when the director's LLM decides
|
|
1143
|
-
* the goal is satisfied and no further spawns are needed — prevents the
|
|
1144
|
-
* coordinator from keeping workers alive for tasks that will never arrive.
|
|
1145
|
-
*/
|
|
1146
|
-
private workCompleteFlag;
|
|
1147
|
-
/** Pending /btw notes stashed by the leader agent (see setLeaderBtwNote). */
|
|
1148
|
-
private _leaderBtwNotes;
|
|
1149
|
-
/** Active collab sessions tracked by sessionId (see spawnCollab).
|
|
1150
|
-
* The tuple holds the session and its Director-registered listener unsubs.
|
|
1151
|
-
* Calling the unsubs on cancel/premature-cleanup prevents listener accumulation
|
|
1152
|
-
* on CollabSession (EventEmitter) across many spawnCollab() calls. */
|
|
1153
|
-
private readonly _activeCollabSessions;
|
|
1154
|
-
/** Prevents large `ask_subagent` answers from bloating the leader's context window. */
|
|
1155
|
-
readonly largeAnswerStore: LargeAnswerStore;
|
|
1156
|
-
constructor(opts: DirectorOptions);
|
|
1157
|
-
/**
|
|
1158
|
-
* Record a granted budget extension and broadcast it on the FleetBus so
|
|
1159
|
-
* the host can re-emit `subagent.budget_extended` for live UI badges.
|
|
1160
|
-
* Called from both the timeout heartbeat path and the per-kind grant path.
|
|
1161
|
-
*/
|
|
1162
|
-
private recordExtension;
|
|
1163
|
-
/** Cumulative auto-extension count for one subagent (0 when never extended). */
|
|
1164
|
-
extensionsFor(subagentId: string): number;
|
|
1165
|
-
/**
|
|
1166
|
-
* Signal that the director's work is done. Once called:
|
|
1167
|
-
* - `spawn()` throws `FleetSpawnBudgetError('max_spawns', …)` — no new
|
|
1168
|
-
* subagents can be created
|
|
1169
|
-
* - Running subagents are NOT forcibly stopped — they finish naturally,
|
|
1170
|
-
* but no new tasks are dispatched to them
|
|
1171
|
-
*
|
|
1172
|
-
* This lets the director LLM say "I'm satisfied with the results, stop
|
|
1173
|
-
* spawning and wind down" — without killing in-flight work mid-execution.
|
|
1174
|
-
* Call `terminateAll()` separately if you need immediate teardown.
|
|
1175
|
-
*
|
|
1176
|
-
* Idempotent — calling twice is a no-op.
|
|
1177
|
-
*/
|
|
1178
|
-
workComplete(): void;
|
|
1179
|
-
/** Returns true if `workComplete()` has been called on this director. */
|
|
1180
|
-
isWorkComplete(): boolean;
|
|
1181
|
-
/**
|
|
1182
|
-
* Stashes a /btw note on the leader agent's context. The leader's agent loop
|
|
1183
|
-
* calls `consumeBtwNotes()` at each iteration boundary and folds pending notes
|
|
1184
|
-
* into the conversation as a visible block — no abort, no restart, just a
|
|
1185
|
-
* "by the way" nudge the model picks up on its next turn.
|
|
1186
|
-
*
|
|
1187
|
-
* This is the entry point for the host (CLI, TUI) to inject /btw notes
|
|
1188
|
-
* programmatically without going through the slash-command path.
|
|
1189
|
-
*/
|
|
1190
|
-
setLeaderBtwNote(note: string): number;
|
|
1191
|
-
/**
|
|
1192
|
-
* Read and clear all pending /btw notes the leader has stashed.
|
|
1193
|
-
* Returns them in FIFO order (empty array when none).
|
|
1194
|
-
*
|
|
1195
|
-
* Called by CollabSession when a budget threshold event fires so the
|
|
1196
|
-
* Director can inspect accumulated /btw notes before deciding whether
|
|
1197
|
-
* to cancel the collab session or let it continue.
|
|
1198
|
-
*/
|
|
1199
|
-
getLeaderBtwNotes(): string[];
|
|
1200
|
-
/**
|
|
1201
|
-
* Peek at pending /btw notes without consuming them.
|
|
1202
|
-
* Useful for UI to show "N pending notes" without clearing them.
|
|
1203
|
-
*/
|
|
1204
|
-
peekLeaderBtwNotes(): string[];
|
|
1205
|
-
/**
|
|
1206
|
-
* Drain (read + clear) all /btw notes in one call.
|
|
1207
|
-
* Alias for getLeaderBtwNotes() — kept for symmetry with consumeBtwNotes()
|
|
1208
|
-
* in the agent's btw.ts. The Director calls this at the point where it
|
|
1209
|
-
* makes a cancellation decision, not on every budget event.
|
|
1210
|
-
*/
|
|
1211
|
-
drainLeaderBtwNotes(): string[];
|
|
1212
|
-
/**
|
|
1213
|
-
* Cancel an active collab session by its id.
|
|
1214
|
-
* Emits `director.cancel_collab` on the FleetBus so the session's agents
|
|
1215
|
-
* finish early with a 'cancelled' disposition.
|
|
1216
|
-
*
|
|
1217
|
-
* Returns silently if the session id is not tracked or already settled.
|
|
1218
|
-
* The CollabDebugReport will reflect 'cancelled' disposition when awaited.
|
|
1219
|
-
*/
|
|
1220
|
-
cancelCollabSession(sessionId: string, reason?: string): void;
|
|
1221
|
-
/**
|
|
1222
|
-
* Subscribe a callback to be notified whenever a collab session raises
|
|
1223
|
-
* an alert (warning level). The callback receives the full DirectorAlert
|
|
1224
|
-
* payload so the host (CLI, TUI) can display it to the user.
|
|
1225
|
-
* Returns an unsubscribe function.
|
|
1226
|
-
*/
|
|
1227
|
-
onCollabAlert(handler: (alert: DirectorAlert) => void): () => void;
|
|
1228
|
-
/**
|
|
1229
|
-
* Returns all active (not yet settled) collab session ids.
|
|
1230
|
-
* Useful for the TUI to render a "N active sessions" badge and for
|
|
1231
|
-
* the host to know what can be cancelled.
|
|
1232
|
-
*/
|
|
1233
|
-
activeCollabSessions(): string[];
|
|
1234
|
-
/** Best-effort session-writer append. Swallows failures — the director
|
|
1235
|
-
* must not break a fleet run because the session JSONL handle closed. */
|
|
1236
|
-
private appendSessionEvent;
|
|
1237
|
-
/** Debounced manifest writer. A burst of spawn/assign/complete events
|
|
1238
|
-
* collapses into one write. Set `manifestDebounceMs` to 0 to write
|
|
1239
|
-
* synchronously (no debounce); set to negative to disable entirely. */
|
|
1240
|
-
private scheduleManifest;
|
|
1241
|
-
private clearManifestTimer;
|
|
1242
|
-
private recordWorktreeTaskUpdate;
|
|
1243
|
-
/**
|
|
1244
|
-
* Spawn a subagent. Identical to the coordinator's `spawn()` but
|
|
1245
|
-
* captures provider/model metadata for the usage aggregator and
|
|
1246
|
-
* lets the FleetBus attach to the runner's EventBus when the task
|
|
1247
|
-
* actually runs (see `attachSubagentBus`).
|
|
1248
|
-
*
|
|
1249
|
-
* Caller-supplied `priceLookup` is optional but recommended — without
|
|
1250
|
-
* it the `cost` column in `usage.snapshot()` stays at 0.
|
|
1251
|
-
*/
|
|
1252
|
-
spawn(callerConfig: SubagentConfig, priceLookup?: {
|
|
1253
|
-
input?: number | undefined;
|
|
1254
|
-
output?: number | undefined;
|
|
1255
|
-
cacheRead?: number | undefined;
|
|
1256
|
-
cacheWrite?: number | undefined;
|
|
1257
|
-
}): Promise<string>;
|
|
1258
|
-
/**
|
|
1259
|
-
* Synchronously ask a subagent something via the bridge. Sends a
|
|
1260
|
-
* `task` message addressed to the subagent and awaits a matching
|
|
1261
|
-
* reply (matched by message id). Subagent runners that handle these
|
|
1262
|
-
* requests subscribe to `ctx.bridge` and reply with a message whose
|
|
1263
|
-
* `id` equals the incoming request's id (see `InMemoryAgentBridge`'s
|
|
1264
|
-
* `request<T>` implementation).
|
|
1265
|
-
*
|
|
1266
|
-
* Returns the response payload directly (the bridge wrapper is
|
|
1267
|
-
* unwrapped for ergonomics). Times out after `timeoutMs` (default
|
|
1268
|
-
* matches the bridge's own default of 30s) — surface those rejections
|
|
1269
|
-
* to the caller as actionable errors instead of letting tools hang.
|
|
1270
|
-
*/
|
|
1271
|
-
ask<T = unknown>(subagentId: string, payload: unknown, timeoutMs?: number): Promise<T>;
|
|
1272
|
-
/**
|
|
1273
|
-
* Read completed task results and format them as a structured text
|
|
1274
|
-
* block the director's LLM can paste into its own context. The
|
|
1275
|
-
* Director keeps every completed `TaskResult` in `completed` so this
|
|
1276
|
-
* is a pure read — no bridge round-trip, cheap to call.
|
|
1277
|
-
*
|
|
1278
|
-
* The returned string is intentionally markdown-flavored: headers per
|
|
1279
|
-
* subagent, a one-line meta row (iter / tools / ms), and the task's
|
|
1280
|
-
* result text. Pass `style: 'json'` for a programmatic shape instead
|
|
1281
|
-
* (useful when the director model is doing structured-output work).
|
|
1282
|
-
*/
|
|
1283
|
-
rollUp(taskIds: string[], style?: 'markdown' | 'json'): string;
|
|
1284
|
-
/**
|
|
1285
|
-
* Write the fleet manifest to `manifestPath`. Returns the path written
|
|
1286
|
-
* or null when no path was configured. Captures every spawn + its
|
|
1287
|
-
* assigned tasks — paired with per-subagent JSONLs, this is enough to
|
|
1288
|
-
* replay an entire director run.
|
|
1289
|
-
*/
|
|
1290
|
-
writeManifest(): Promise<string | null>;
|
|
1291
|
-
private writeManifestNow;
|
|
1292
|
-
/**
|
|
1293
|
-
* Tear down the director: stop every subagent, close every bridge
|
|
1294
|
-
* endpoint, and (when configured) write the final manifest. Idempotent
|
|
1295
|
-
* — calling shutdown twice is a no-op on the second invocation.
|
|
1296
|
-
*/
|
|
1297
|
-
shutdown(): Promise<void>;
|
|
1298
|
-
/**
|
|
1299
|
-
* Funnel for shutdown-phase errors. We can't throw — `shutdown()` is
|
|
1300
|
-
* called from process-exit paths where an uncaught throw would lose
|
|
1301
|
-
* the manifest write that comes after. But we MUST NOT silently
|
|
1302
|
-
* swallow either — a persistent bridge-close failure would otherwise
|
|
1303
|
-
* mask a real bug. `process.emitWarning` is the right tier:
|
|
1304
|
-
* surfaces on stderr by default, lets the host plug a warning
|
|
1305
|
-
* listener for structured collection, and never affects exit code.
|
|
1306
|
-
*/
|
|
1307
|
-
private logShutdownError;
|
|
1308
|
-
/**
|
|
1309
|
-
* Hand a task to the coordinator. Returns the assigned task id so
|
|
1310
|
-
* callers can wait on it via `awaitTasks([id])`. The coordinator's
|
|
1311
|
-
* concurrency limit applies — the task may queue before running.
|
|
1312
|
-
*/
|
|
1313
|
-
assign(task: TaskSpec): Promise<string>;
|
|
1314
|
-
/**
|
|
1315
|
-
* Assign infrastructure-owned work directly to the coordinator without
|
|
1316
|
-
* manifest/session/checkpoint bookkeeping. The task still uses the normal
|
|
1317
|
-
* subagent runner, budget, and completion events, but it is excluded from
|
|
1318
|
-
* rollups and persisted fleet task history.
|
|
1319
|
-
*/
|
|
1320
|
-
assignInternal(task: TaskSpec): Promise<string>;
|
|
1321
|
-
/**
|
|
1322
|
-
* Block until every task id resolves. Returns results in the same
|
|
1323
|
-
* order as the input. If any task hasn't completed by the time this
|
|
1324
|
-
* is called, the promise hangs until it does — pair with a timeout
|
|
1325
|
-
* at the caller if that's a concern. Resolves immediately for ids
|
|
1326
|
-
* whose results were already cached.
|
|
1327
|
-
*/
|
|
1328
|
-
awaitTasks(taskIds: string[]): Promise<TaskResult[]>;
|
|
1329
|
-
/**
|
|
1330
|
-
* Wait until AT LEAST ONE of the named tasks completes, then return every
|
|
1331
|
-
* requested result already cached plus the still-pending ids. This is the
|
|
1332
|
-
* leader's "handle whichever finishes next" primitive — unlike
|
|
1333
|
-
* `awaitTasks` it never blocks on the slowest sibling, and the siblings
|
|
1334
|
-
* that complete later still reach the leader through the fire-and-forget
|
|
1335
|
-
* report-back (see the consumed-in-band rule in `taskCompletedListener`).
|
|
1336
|
-
*
|
|
1337
|
-
* Deliberately does NOT register `taskWaiters` entries for the pending
|
|
1338
|
-
* ids: a `taskWaiters` entry would mark those results as in-band-consumed
|
|
1339
|
-
* and silence the mailbox notifier for results this caller never receives.
|
|
1340
|
-
*
|
|
1341
|
-
* With `timeoutMs`, resolves (never rejects) `{timedOut: true}` and zero
|
|
1342
|
-
* completions when the window elapses first.
|
|
1343
|
-
*/
|
|
1344
|
-
awaitTasksAny(taskIds: string[], opts?: {
|
|
1345
|
-
timeoutMs?: number;
|
|
1346
|
-
}): Promise<AwaitAnyResult>;
|
|
1347
|
-
/** Defensive snapshot of tasks still queued (not yet dispatched). */
|
|
1348
|
-
listPendingTasks(): readonly TaskSpec[];
|
|
1349
|
-
/**
|
|
1350
|
-
* Re-pin a still-pending task to a different subagent (`undefined` =
|
|
1351
|
-
* unpin) — the rebalancing primitive used by the FleetSupervisor and
|
|
1352
|
-
* available to hosts. Only queued tasks can move; a dispatched task
|
|
1353
|
-
* returns `false` (steer or terminate its worker instead). Keeps
|
|
1354
|
-
* ownership bookkeeping (taskOwners, checkpoint, fleet manifest) in
|
|
1355
|
-
* sync with the coordinator's queue.
|
|
1356
|
-
*/
|
|
1357
|
-
retargetPendingTask(taskId: string, subagentId: string | undefined): boolean;
|
|
1358
|
-
terminate(subagentId: string): Promise<void>;
|
|
1359
|
-
terminateAll(): Promise<void>;
|
|
1360
|
-
remove(subagentId: string): Promise<void>;
|
|
1361
|
-
status(): CoordinatorStatus;
|
|
1362
|
-
/**
|
|
1363
|
-
* Subscribe to coordinator events. Currently only `task.completed` is
|
|
1364
|
-
* exposed (the others are internal lifecycle). Returns an unsubscribe
|
|
1365
|
-
* function. External callers (e.g. the CLI's `MultiAgentHost`) use this
|
|
1366
|
-
* to drive their own pending/results tracking without poking the
|
|
1367
|
-
* coordinator directly.
|
|
1368
|
-
*/
|
|
1369
|
-
on(event: 'task.completed', handler: (payload: {
|
|
1370
|
-
task: TaskSpec;
|
|
1371
|
-
result: TaskResult;
|
|
1372
|
-
}) => void): () => void;
|
|
1373
|
-
/**
|
|
1374
|
-
* Snapshot of every task that has resolved (success, failed, timeout,
|
|
1375
|
-
* stopped) since the director started. Returned in completion order
|
|
1376
|
-
* via the internal map's iteration order. Used by `/fleet status` to
|
|
1377
|
-
* paint the completed table without reaching into private state.
|
|
1378
|
-
*/
|
|
1379
|
-
completedResults(): TaskResult[];
|
|
1380
|
-
/**
|
|
1381
|
-
* Inject a previously-saved checkpoint snapshot. Call this right after
|
|
1382
|
-
* constructing a Director during a `--resume` run so the in-memory state
|
|
1383
|
-
* (subagents, tasks, waiters) reflects the pre-crash reality instead of
|
|
1384
|
-
* starting from a blank slate. The director then resumes from there —
|
|
1385
|
-
* completing any in-flight tasks and ignoring tasks that already reached
|
|
1386
|
-
* a terminal state in the prior run.
|
|
1387
|
-
*/
|
|
1388
|
-
setCheckpointState(snapshot: DirectorStateSnapshot): void;
|
|
1389
|
-
/**
|
|
1390
|
-
* Read a subagent's JSONL transcript directly from disk (no bridge
|
|
1391
|
-
* round-trip needed). Returns the last assistant text, stop reason,
|
|
1392
|
-
* tool-use count, and line count — or null if the file is unavailable.
|
|
1393
|
-
* Requires `sessionsRoot` to be set on construction.
|
|
1394
|
-
*/
|
|
1395
|
-
readSession(subagentId: string, tail?: number | undefined): Promise<{
|
|
1396
|
-
lastAssistantText?: string | undefined;
|
|
1397
|
-
lastStopReason?: string | undefined;
|
|
1398
|
-
toolUsesObserved: number;
|
|
1399
|
-
events: number;
|
|
1400
|
-
path?: string | undefined;
|
|
1401
|
-
} | null>;
|
|
1402
|
-
snapshot(): FleetUsage;
|
|
1403
|
-
/**
|
|
1404
|
-
* Look up provider/model metadata for a spawned subagent. Returns
|
|
1405
|
-
* undefined when the subagent id is unknown (not yet spawned, or
|
|
1406
|
-
* already torn down). Callers — notably the TUI fleet panel — use
|
|
1407
|
-
* this to render human-readable provider/model tags next to each
|
|
1408
|
-
* subagent row without reaching into private state.
|
|
1409
|
-
*/
|
|
1410
|
-
getSubagentMeta(id: string): {
|
|
1411
|
-
provider?: string | undefined;
|
|
1412
|
-
model?: string | undefined;
|
|
1413
|
-
name?: string | undefined;
|
|
1414
|
-
} | undefined;
|
|
1415
|
-
/**
|
|
1416
|
-
* Compose the leader/director-agent system prompt: fleet preamble +
|
|
1417
|
-
* (optional) roster summary + user base prompt. Pass the result to your
|
|
1418
|
-
* leader Agent's `ctx.systemPrompt` when constructing it.
|
|
1419
|
-
*
|
|
1420
|
-
* `basePrompt` defaults to `config.leaderSystemPrompt` so callers can
|
|
1421
|
-
* use the no-arg form when the multi-agent config already carries it.
|
|
1422
|
-
*/
|
|
1423
|
-
leaderSystemPrompt(basePrompt?: string): string;
|
|
1424
|
-
/**
|
|
1425
|
-
* Compose a subagent's system prompt for a given `SubagentConfig`:
|
|
1426
|
-
* baseline + role + task + per-spawn override. Returned by value — does
|
|
1427
|
-
* not mutate the config. Factories (the user-supplied `AgentFactory`)
|
|
1428
|
-
* should call this when building each subagent's Agent so the bridge
|
|
1429
|
-
* contract, role context, and override are all surfaced.
|
|
1430
|
-
*
|
|
1431
|
-
* When `taskBrief` is omitted the Task section is dropped. Pass the
|
|
1432
|
-
* actual task description here to reinforce it in the system prompt
|
|
1433
|
-
* (the runner already passes it as user input — duplicating in the
|
|
1434
|
-
* system prompt is optional but improves anchoring on small models).
|
|
1435
|
-
*/
|
|
1436
|
-
subagentSystemPrompt(config: SubagentConfig, taskBrief?: string): string;
|
|
1437
|
-
/**
|
|
1438
|
-
* Build the tool set the LLM-driven director uses to orchestrate.
|
|
1439
|
-
* Returns an array of `Tool` definitions; register these on the
|
|
1440
|
-
* director's `Agent` to expose `spawn_subagent`, `assign_task`, etc.
|
|
1441
|
-
* Each tool's `execute()` delegates straight to the matching method
|
|
1442
|
-
* above.
|
|
1443
|
-
*
|
|
1444
|
-
* Tools all carry `permission: 'auto'` — the *user* has already
|
|
1445
|
-
* approved running the director when they kicked off the run, so
|
|
1446
|
-
* gating individual orchestration calls behind a confirm prompt
|
|
1447
|
-
* would just be noise. The actual subagent tools they spawn are
|
|
1448
|
-
* still permission-checked normally.
|
|
1449
|
-
*/
|
|
1450
|
-
tools(roster?: Record<string, SubagentConfig>): Tool[];
|
|
1451
|
-
/**
|
|
1452
|
-
* Attempt to acquire the checkpoint lock. Must be called before
|
|
1453
|
-
* resuming — if another director process is alive, this returns
|
|
1454
|
-
* false and the caller should not proceed with the resume.
|
|
1455
|
-
*/
|
|
1456
|
-
acquireCheckpointLock(): Promise<boolean>;
|
|
1457
|
-
/**
|
|
1458
|
-
* Start a collaborative debugging session: BugHunter, RefactorPlanner,
|
|
1459
|
-
* and Critic run in parallel on the same target files, with findings
|
|
1460
|
-
* flowing through the FleetBus (bug.found → refactor.plan →
|
|
1461
|
-
* critic.evaluation). Returns a structured CollabDebugReport when all
|
|
1462
|
-
* three agents complete or the session times out.
|
|
1463
|
-
*/
|
|
1464
|
-
spawnCollab(options: CollabSessionOptions): Promise<CollabDebugReport>;
|
|
1465
|
-
/**
|
|
1466
|
-
* Resume from a prior checkpoint snapshot (loaded via
|
|
1467
|
-
* `loadDirectorState()`). Re-attach to the fleet mid-flight so
|
|
1468
|
-
* subsequent spawn/assign calls update the checkpoint normally.
|
|
1469
|
-
*/
|
|
1470
|
-
resumeFromCheckpoint(snapshot: DirectorStateSnapshot): void;
|
|
1471
|
-
}
|
|
1472
|
-
|
|
1473
|
-
/**
|
|
1474
|
-
* Alert levels the Director can emit when a collab session needs attention.
|
|
1475
|
-
* These flow through the FleetBus so the host can display them in the UI.
|
|
1476
|
-
*/
|
|
1477
|
-
declare enum DirectorAlertLevel {
|
|
1478
|
-
/** The agent is still making progress but has hit a soft budget limit. */
|
|
1479
|
-
WARNING = "warning",
|
|
1480
|
-
/** The agent has hit a hard limit and the session cannot continue. */
|
|
1481
|
-
CRITICAL = "critical",
|
|
1482
|
-
/** The Director has decided to cancel the session (user request or policy). */
|
|
1483
|
-
CANCELLED = "cancelled"
|
|
1484
|
-
}
|
|
1485
|
-
interface DirectorAlert {
|
|
1486
|
-
sessionId: string;
|
|
1487
|
-
subagentId: string;
|
|
1488
|
-
role: string;
|
|
1489
|
-
level: DirectorAlertLevel;
|
|
1490
|
-
/** Human-readable message for UI/logs */
|
|
1491
|
-
message: string;
|
|
1492
|
-
/** Budget kind that triggered this alert, if any */
|
|
1493
|
-
budgetKind?: 'timeout' | 'idle_timeout' | 'iterations' | 'tool_calls' | 'tokens' | 'cost' | undefined;
|
|
1494
|
-
/** Elapsed ms at time of alert */
|
|
1495
|
-
elapsedMs?: number | undefined;
|
|
1496
|
-
/** Limit that was hit */
|
|
1497
|
-
limit?: number | undefined;
|
|
1498
|
-
/** /btw notes the director has collected (may be empty) */
|
|
1499
|
-
btwNotes?: string[] | undefined;
|
|
1500
|
-
}
|
|
1501
|
-
/**
|
|
1502
|
-
* Immutable snapshot of target files at the start of a collab session.
|
|
1503
|
-
* All agents in the session read from this snapshot — they see the same baseline.
|
|
1504
|
-
*/
|
|
1505
|
-
interface SharedFileSnapshot {
|
|
1506
|
-
id: string;
|
|
1507
|
-
createdAt: string;
|
|
1508
|
-
files: SharedFileEntry[];
|
|
1509
|
-
}
|
|
1510
|
-
interface SharedFileEntry {
|
|
1511
|
-
path: string;
|
|
1512
|
-
content: string;
|
|
1513
|
-
language?: string | undefined;
|
|
1514
|
-
snapshotMtimeMs?: number | undefined;
|
|
1515
|
-
snapshotSizeBytes?: number | undefined;
|
|
1516
|
-
}
|
|
1517
|
-
/**
|
|
1518
|
-
* Bug finding emitted by BugHunter and consumed by RefactorPlanner + Critic.
|
|
1519
|
-
*/
|
|
1520
|
-
interface BugFinding {
|
|
1521
|
-
id: string;
|
|
1522
|
-
type: string;
|
|
1523
|
-
severity: 'critical' | 'high' | 'medium' | 'low';
|
|
1524
|
-
location: {
|
|
1525
|
-
file: string;
|
|
1526
|
-
line: number;
|
|
1527
|
-
};
|
|
1528
|
-
description: string;
|
|
1529
|
-
suggestedFix?: string | undefined;
|
|
1530
|
-
}
|
|
1531
|
-
/**
|
|
1532
|
-
* Refactoring plan emitted by RefactorPlanner, consuming BugFinding(s).
|
|
1533
|
-
*/
|
|
1534
|
-
interface RefactorPlan {
|
|
1535
|
-
id: string;
|
|
1536
|
-
basedOnBugIds: string[];
|
|
1537
|
-
phases: RefactorPhase[];
|
|
1538
|
-
riskScore: 'low' | 'medium' | 'high';
|
|
1539
|
-
estimatedChangeCount: number;
|
|
1540
|
-
rollbackStrategy: string;
|
|
1541
|
-
}
|
|
1542
|
-
/** One phase within a refactor plan. */
|
|
1543
|
-
interface RefactorPhase {
|
|
1544
|
-
number: number;
|
|
1545
|
-
title: string;
|
|
1546
|
-
tasks: string[];
|
|
1547
|
-
risk: 'low' | 'medium' | 'high';
|
|
1548
|
-
}
|
|
1549
|
-
/**
|
|
1550
|
-
* Critic evaluation of a bug finding or refactor plan.
|
|
1551
|
-
*/
|
|
1552
|
-
interface CriticEvaluation {
|
|
1553
|
-
id: string;
|
|
1554
|
-
subjectType: 'bug_finding' | 'refactor_plan';
|
|
1555
|
-
subjectId: string;
|
|
1556
|
-
score: number;
|
|
1557
|
-
verdict: 'approve' | 'needs_revision' | 'reject';
|
|
1558
|
-
strengths: string[];
|
|
1559
|
-
weaknesses: string[];
|
|
1560
|
-
concerns: CriticConcern[];
|
|
1561
|
-
}
|
|
1562
|
-
interface CriticConcern {
|
|
1563
|
-
description: string;
|
|
1564
|
-
location?: {
|
|
1565
|
-
file: string | undefined;
|
|
1566
|
-
line: number;
|
|
1567
|
-
};
|
|
1568
|
-
severity: 'blocking' | 'advisory';
|
|
1569
|
-
}
|
|
1570
|
-
/**
|
|
1571
|
-
* Full structured report produced when a CollabSession resolves.
|
|
1572
|
-
*/
|
|
1573
|
-
interface CollabDebugReport {
|
|
1574
|
-
sessionId: string;
|
|
1575
|
-
startedAt: string;
|
|
1576
|
-
completedAt: string;
|
|
1577
|
-
targetPaths: string[];
|
|
1578
|
-
/** How the session ended. 'completed' = all agents finished normally.
|
|
1579
|
-
* 'cancelled' = Director called cancelCollabSession().
|
|
1580
|
-
* 'timeout' = session-level timeout elapsed before all agents finished.
|
|
1581
|
-
* 'critical_alert' = Director escalated a warning to a cancel decision.
|
|
1582
|
-
*/
|
|
1583
|
-
disposition: 'completed' | 'cancelled' | 'timeout' | 'critical_alert';
|
|
1584
|
-
bugs: BugFinding[];
|
|
1585
|
-
refactorPlans: RefactorPlan[];
|
|
1586
|
-
evaluations: CriticEvaluation[];
|
|
1587
|
-
/** Alerts that were raised during the session (may be empty). */
|
|
1588
|
-
alerts: DirectorAlert[];
|
|
1589
|
-
/** Files modified after the initial static snapshot was captured. */
|
|
1590
|
-
snapshotWarnings?: string[] | undefined;
|
|
1591
|
-
/** Overall verdict from the Critic across all evaluated subjects. */
|
|
1592
|
-
overallVerdict: 'approve' | 'needs_revision' | 'reject';
|
|
1593
|
-
/** Markdown-formatted summary for the director's context window. */
|
|
1594
|
-
summary: string;
|
|
1595
|
-
}
|
|
1596
|
-
/**
|
|
1597
|
-
* Per-agent budget configuration for collab sessions.
|
|
1598
|
-
* Allows the caller (Director) to control the exact limits instead of
|
|
1599
|
-
* using hard-coded defaults that may not match the director's policy.
|
|
1600
|
-
*/
|
|
1601
|
-
interface CollabBudgetConfig {
|
|
1602
|
-
maxIterations: number;
|
|
1603
|
-
maxToolCalls: number;
|
|
1604
|
-
timeoutMs: number;
|
|
1605
|
-
}
|
|
1606
|
-
/**
|
|
1607
|
-
* Budget overrides for specific roles in a collab session.
|
|
1608
|
-
* When a role is not present in the map, the default budget is used.
|
|
1609
|
-
*/
|
|
1610
|
-
type CollabBudgetOverrides = Partial<Record<string, CollabBudgetConfig>>;
|
|
1611
|
-
/**
|
|
1612
|
-
* Emitted by a collab agent when it hits a soft budget limit.
|
|
1613
|
-
* The Director's fleet handler receives this and calls collabAlert().
|
|
1614
|
-
*/
|
|
1615
|
-
interface CollabBudgetWarningPayload {
|
|
1616
|
-
sessionId: string;
|
|
1617
|
-
role: string;
|
|
1618
|
-
kind: 'timeout' | 'idle_timeout' | 'iterations' | 'tool_calls' | 'tokens' | 'cost';
|
|
1619
|
-
used: number;
|
|
1620
|
-
limit: number;
|
|
1621
|
-
timeoutMs?: number | undefined;
|
|
1622
|
-
elapsedMs: number;
|
|
1623
|
-
}
|
|
1624
|
-
/**
|
|
1625
|
-
* Emitted by the Director to cancel all agents in a collab session.
|
|
1626
|
-
* CollabSession listens for this and causes its agent pool to finish early.
|
|
1627
|
-
*/
|
|
1628
|
-
interface DirectorCancelCollabPayload {
|
|
1629
|
-
sessionId: string;
|
|
1630
|
-
reason: string;
|
|
1631
|
-
cancelledAt: string;
|
|
1632
|
-
}
|
|
1633
|
-
interface CollabSessionOptions {
|
|
1634
|
-
/** Paths to scan — used to build the SharedFileSnapshot. */
|
|
1635
|
-
targetPaths: string[];
|
|
1636
|
-
/** Files already read and snapshot. When provided, snapshot is skipped. */
|
|
1637
|
-
prebuiltSnapshot?: SharedFileSnapshot | undefined;
|
|
1638
|
-
/** Max time to wait for the session to resolve (ms). Default: 10 min. */
|
|
1639
|
-
timeoutMs?: number | undefined;
|
|
1640
|
-
/**
|
|
1641
|
-
* Maximum number of files to include in the snapshot.
|
|
1642
|
-
* - If set explicitly: use this value (hard override).
|
|
1643
|
-
* - If `contextWindow` is set: calculate dynamically from estimated token budget.
|
|
1644
|
-
* - If neither: use `DEFAULT_MAX_TARGET_FILES` (30).
|
|
1645
|
-
*/
|
|
1646
|
-
maxTargetFiles?: number | undefined;
|
|
1647
|
-
/**
|
|
1648
|
-
* Context window size (in tokens) of the model running the subagents.
|
|
1649
|
-
* When provided and `maxTargetFiles` is not set, the limit is computed
|
|
1650
|
-
* dynamically: `floor((contextWindow * 0.4) / AVG_TOKENS_PER_FILE)`.
|
|
1651
|
-
* If not provided, `DEFAULT_MAX_TARGET_FILES` is used as the fallback.
|
|
1652
|
-
*/
|
|
1653
|
-
contextWindow?: number | undefined;
|
|
1654
|
-
/**
|
|
1655
|
-
* Budget overrides per role. When provided, these override the hard-coded
|
|
1656
|
-
* defaults so the Director can enforce fleet-wide budget policy.
|
|
1657
|
-
* Keys must match role names: 'bug-hunter', 'refactor-planner', 'critic'.
|
|
1658
|
-
*/
|
|
1659
|
-
budgetOverrides?: CollabBudgetOverrides | undefined;
|
|
1660
|
-
/**
|
|
1661
|
-
* Called by the Director when a collab agent hits a soft budget limit.
|
|
1662
|
-
* The Director uses this to decide whether to cancel the session or extend.
|
|
1663
|
-
* Return 'cancel' to stop the session immediately; 'extend' to continue
|
|
1664
|
-
* with the agent's proposed new limits; 'ignore' to let the default
|
|
1665
|
-
* auto-extend logic handle it.
|
|
1666
|
-
*/
|
|
1667
|
-
onBudgetWarning?: ((alert: DirectorAlert) => 'cancel' | 'extend' | 'ignore') | undefined;
|
|
1668
|
-
}
|
|
1669
|
-
declare class CollabSession extends EventEmitter {
|
|
1670
|
-
readonly sessionId: string;
|
|
1671
|
-
readonly options: CollabSessionOptions;
|
|
1672
|
-
readonly snapshot: SharedFileSnapshot;
|
|
1673
|
-
private readonly director;
|
|
1674
|
-
private readonly fleetBus;
|
|
1675
|
-
private readonly subagentIds;
|
|
1676
|
-
private readonly bugs;
|
|
1677
|
-
private readonly plans;
|
|
1678
|
-
private readonly evaluations;
|
|
1679
|
-
private readonly disposers;
|
|
1680
|
-
private settled;
|
|
1681
|
-
private readonly timeoutMs;
|
|
1682
|
-
private cancelled;
|
|
1683
|
-
private _raceResolved;
|
|
1684
|
-
private readonly alerts;
|
|
1685
|
-
private snapshotWarnings;
|
|
1686
|
-
/** Tracks tool call counts per subagent for progress-based timeout decisions. */
|
|
1687
|
-
private readonly progressBySubagent;
|
|
1688
|
-
/** Last tool call count when a timeout warning was handled. */
|
|
1689
|
-
private readonly lastTimeoutProgress;
|
|
1690
|
-
/** Session-level timeout timer handle (cleared on cancel or natural completion). */
|
|
1691
|
-
private _timeoutTimer?;
|
|
1692
|
-
constructor(director: Director, fleetBus: FleetBus, options: CollabSessionOptions);
|
|
1693
|
-
get id(): string;
|
|
1694
|
-
getSessionAlerts(): DirectorAlert[];
|
|
1695
|
-
isCancelled(): boolean;
|
|
1696
|
-
/**
|
|
1697
|
-
* Snapshot of role → subagentId map. The Director calls coordinator.stop()
|
|
1698
|
-
* for each agent when cancelling the session, using this map to enumerate
|
|
1699
|
-
* all three collab agents.
|
|
1700
|
-
*/
|
|
1701
|
-
getSubagentIds(): ReadonlyMap<string, string>;
|
|
1702
|
-
/**
|
|
1703
|
-
* Returns the effective file limit for this session.
|
|
1704
|
-
* Priority: explicit `maxTargetFiles` > dynamic from `contextWindow` > `DEFAULT_MAX_TARGET_FILES`.
|
|
1705
|
-
*/
|
|
1706
|
-
effectiveFileLimit(): number;
|
|
1707
|
-
buildSnapshot(): Promise<SharedFileSnapshot>;
|
|
1708
|
-
/**
|
|
1709
|
-
* Cancel the session. Emits director.cancel_collab on the FleetBus so all
|
|
1710
|
-
* collab agents finish early. The session-level timeout timer is also cleared.
|
|
1711
|
-
* Safe to call multiple times (idempotent after first call).
|
|
1712
|
-
*/
|
|
1713
|
-
cancel(reason?: string): void;
|
|
1714
|
-
start(): Promise<CollabDebugReport>;
|
|
1715
|
-
private parseAndEmit;
|
|
1716
|
-
private extractJsonObjects;
|
|
1717
|
-
private budgetForRole;
|
|
1718
|
-
private spawnAgent;
|
|
1719
|
-
private buildBugHunterTask;
|
|
1720
|
-
private buildRefactorPlannerTask;
|
|
1721
|
-
private buildCriticTask;
|
|
1722
|
-
private wireFleetBus;
|
|
1723
|
-
private roleFromSubagentId;
|
|
1724
|
-
private assembleReport;
|
|
1725
|
-
private checkSnapshotFreshness;
|
|
1726
|
-
private buildMarkdownSummary;
|
|
1727
|
-
private cleanup;
|
|
1728
|
-
}
|
|
1729
|
-
|
|
1730
|
-
/**
|
|
1731
|
-
* Opaque host interface so this factory doesn't have to depend on the
|
|
1732
|
-
* CLI's `MultiAgentHost`. Any caller that exposes the same three
|
|
1733
|
-
* methods can wire `delegate` — including test doubles.
|
|
1734
|
-
*/
|
|
1735
|
-
interface DelegateHost {
|
|
1736
|
-
/** True if a Director is already attached and running. */
|
|
1737
|
-
isDirectorMode(): boolean;
|
|
1738
|
-
/** Build (or return the cached) Director when director mode is on. */
|
|
1739
|
-
ensureDirector(): Promise<Director | null>;
|
|
1740
|
-
/**
|
|
1741
|
-
* Force-promote a non-director session into director mode at runtime.
|
|
1742
|
-
* Returns the Director, or null when promotion is impossible (e.g. a
|
|
1743
|
-
* non-director coordinator has already spawned subagents in the
|
|
1744
|
-
* legacy code path).
|
|
1745
|
-
*/
|
|
1746
|
-
promoteToDirector(): Promise<Director | null>;
|
|
1747
|
-
/**
|
|
1748
|
-
* Optional: when promotion fails, return the human-readable reason.
|
|
1749
|
-
* Used to render an actionable error to the calling model instead of
|
|
1750
|
-
* the prior opaque "Director could not be activated" message.
|
|
1751
|
-
* Implementations may return null when they don't track the reason.
|
|
1752
|
-
*/
|
|
1753
|
-
getPromotionBlockReason?(): string | null;
|
|
1754
|
-
}
|
|
1755
|
-
interface CreateDelegateToolOptions {
|
|
1756
|
-
host: DelegateHost;
|
|
1757
|
-
/**
|
|
1758
|
-
* Roster used to resolve `role` strings into full `SubagentConfig`s.
|
|
1759
|
-
* Typically `FLEET_ROSTER`. When omitted, `delegate({ role })` calls
|
|
1760
|
-
* fail and only the explicit `name + provider + model` path works.
|
|
1761
|
-
*/
|
|
1762
|
-
roster?: Record<string, SubagentConfig>;
|
|
1763
|
-
/**
|
|
1764
|
-
* Default await timeout in milliseconds. `delegate` blocks until the
|
|
1765
|
-
* subagent's task resolves; without a cap, a stuck worker would hang
|
|
1766
|
-
* the host indefinitely. Set generously (default: 4 hours) so the
|
|
1767
|
-
* orchestrator can run multi-step refactors / monorepo audits
|
|
1768
|
-
* without being killed for being slow — the orchestrator must
|
|
1769
|
-
* decide per-call when a task needs to be cut short.
|
|
1770
|
-
*/
|
|
1771
|
-
defaultTimeoutMs?: number | undefined;
|
|
1772
|
-
/**
|
|
1773
|
-
* Absolute directory under which per-subagent JSONL transcripts live —
|
|
1774
|
-
* matches `MultiAgentHostOptions.sessionsRoot`. When set, the delegate
|
|
1775
|
-
* tool reads the subagent's transcript on timeout / budget-exhaustion
|
|
1776
|
-
* to extract partial output, so the host LLM gets *something* useful
|
|
1777
|
-
* back instead of just an error.
|
|
1778
|
-
*/
|
|
1779
|
-
sessionsRoot?: string | undefined;
|
|
1780
|
-
/**
|
|
1781
|
-
* The directorRunId used to namespace transcripts (typically the host
|
|
1782
|
-
* session id). Combined with `sessionsRoot` to locate per-subagent
|
|
1783
|
-
* JSONLs at `<sessionsRoot>/<runId>/<subagentId>.jsonl`.
|
|
1784
|
-
*/
|
|
1785
|
-
directorRunId?: string | undefined;
|
|
1786
|
-
/**
|
|
1787
|
-
* Buffer subtracted from the caller's `timeoutMs` before passing it
|
|
1788
|
-
* to the subagent. Gives the host a window to detect a subagent that
|
|
1789
|
-
* has gone silent and surface a partial result rather than a generic
|
|
1790
|
-
* timeout. Default: 60_000 ms (raised from 30s to give subagents
|
|
1791
|
-
* more headroom before the host kills them).
|
|
1792
|
-
*/
|
|
1793
|
-
subagentTimeoutBufferMs?: number | undefined;
|
|
1794
|
-
/**
|
|
1795
|
-
* Host EventBus. When supplied, `delegate` emits `delegate.started`
|
|
1796
|
-
* (before it blocks on the subagent) and `delegate.completed` (once the
|
|
1797
|
-
* subagent settles) so UIs / the Telegram bridge can render readable
|
|
1798
|
-
* start/finish lines instead of inferring them from the truncated
|
|
1799
|
-
* `tool.executed` JSON preview. Optional — emits are best-effort and a
|
|
1800
|
-
* missing bus never affects delegation behaviour.
|
|
1801
|
-
*/
|
|
1802
|
-
events?: EventBus | undefined;
|
|
1803
|
-
}
|
|
1804
|
-
/**
|
|
1805
|
-
* `delegate` — the only multi-agent tool a regular (non-director) agent
|
|
1806
|
-
* ever needs. It bundles spawn + assign + await into a single call and
|
|
1807
|
-
* transparently auto-promotes the host into director mode on first use.
|
|
1808
|
-
*
|
|
1809
|
-
* The model never has to ask "are we in director mode?" — it just calls
|
|
1810
|
-
* `delegate({ role, task })` and gets back a `TaskResult`. The cost of
|
|
1811
|
-
* that ergonomic packaging is that `delegate` cannot be used for
|
|
1812
|
-
* parallel work as-is; the model must fire multiple `delegate` calls in
|
|
1813
|
-
* parallel through the provider's parallel-tool-call surface, or escalate
|
|
1814
|
-
* to the explicit `spawn_subagent` + `assign_task` + `await_tasks` flow
|
|
1815
|
-
* when it wants fan-out it controls itself.
|
|
1816
|
-
*/
|
|
1817
|
-
declare function createDelegateTool(opts: CreateDelegateToolOptions): Tool;
|
|
1818
|
-
|
|
1819
|
-
/**
|
|
1820
|
-
* System-prompt composition helpers for the Director ecosystem.
|
|
1821
|
-
*
|
|
1822
|
-
* Two callers need composed prompts:
|
|
1823
|
-
*
|
|
1824
|
-
* 1. The **leader** (the director's own Agent) — needs a preamble that
|
|
1825
|
-
* explains the fleet protocol: when to spawn, when to await, how to
|
|
1826
|
-
* roll up, and the eight orchestration tools it owns.
|
|
1827
|
-
*
|
|
1828
|
-
* 2. Each **subagent** — needs a baseline that explains it has a parent
|
|
1829
|
-
* it can call via the bridge, a role-specific block, the task brief,
|
|
1830
|
-
* and finally any per-spawn `systemPromptOverride` from `SubagentConfig`.
|
|
1831
|
-
*
|
|
1832
|
-
* Both composers are pure functions: feed them parts, they return a string.
|
|
1833
|
-
* No I/O, no side effects, no implicit defaults beyond the ones exported
|
|
1834
|
-
* here. Callers (CLI multi-agent factory, Director itself) decide which
|
|
1835
|
-
* parts to fill in — that keeps the composition seam visible and testable.
|
|
1836
|
-
*/
|
|
1837
|
-
/**
|
|
1838
|
-
* Default fleet-protocol preamble injected at the **front** of the
|
|
1839
|
-
* director-agent's system prompt.
|
|
1840
|
-
*/
|
|
1841
|
-
declare const DEFAULT_DIRECTOR_PREAMBLE: string;
|
|
1842
|
-
/**
|
|
1843
|
-
* Default baseline prepended to every subagent's system prompt.
|
|
1844
|
-
*/
|
|
1845
|
-
declare const DEFAULT_SUBAGENT_BASELINE: string;
|
|
1846
|
-
/** Parts the leader-prompt composer accepts. All optional. */
|
|
1847
|
-
interface DirectorPromptParts {
|
|
1848
|
-
/** The user's existing leader system prompt — typically what was passed
|
|
1849
|
-
* via `MultiAgentConfig.leaderSystemPrompt`. */
|
|
1850
|
-
basePrompt?: string | undefined;
|
|
1851
|
-
/** Override the built-in fleet preamble. Pass empty string to suppress. */
|
|
1852
|
-
directorPreamble?: string | undefined;
|
|
1853
|
-
/** Optional roster summary block — a short list of pre-configured roles
|
|
1854
|
-
* the director can spawn (e.g. "researcher, coder, reviewer"). Helps
|
|
1855
|
-
* small models discover the available shapes without scanning tools. */
|
|
1856
|
-
rosterSummary?: string | undefined;
|
|
1857
|
-
}
|
|
1858
|
-
/**
|
|
1859
|
-
* Compose the leader/director's system prompt. Order:
|
|
1860
|
-
* 1. Director preamble (fleet protocol)
|
|
1861
|
-
* 2. Roster summary (optional, when provided)
|
|
1862
|
-
* 3. User base prompt (the per-project leader prompt)
|
|
1863
|
-
*
|
|
1864
|
-
* Sections are separated by a blank line. Empty parts are skipped so the
|
|
1865
|
-
* output never contains stray blank-line runs.
|
|
1866
|
-
*/
|
|
1867
|
-
declare function composeDirectorPrompt(parts?: DirectorPromptParts): string;
|
|
1868
|
-
/** Parts the subagent-prompt composer accepts. Layered from generic to
|
|
1869
|
-
* specific; later layers override earlier ones when they conflict. */
|
|
1870
|
-
interface SubagentPromptParts {
|
|
1871
|
-
/** Base persona/identity for *every* subagent. Defaults to the bridge
|
|
1872
|
-
* contract baseline. Pass empty string to suppress. */
|
|
1873
|
-
baseline?: string | undefined;
|
|
1874
|
-
/** Role-specific block, e.g. "You are a code reviewer. Focus on…". */
|
|
1875
|
-
role?: string | undefined;
|
|
1876
|
-
/** Task brief — usually the same string the runner passes as user input,
|
|
1877
|
-
* but exposed here in case the factory wants it duplicated in the
|
|
1878
|
-
* system prompt for reinforcement. */
|
|
1879
|
-
task?: string | undefined;
|
|
1880
|
-
/**
|
|
1881
|
-
* Absolute path to a shared scratchpad directory the whole fleet can
|
|
1882
|
-
* read/write. When set, the composer adds a "Shared notes" block that
|
|
1883
|
-
* tells the subagent where to drop findings and where to look for
|
|
1884
|
-
* sibling output. This is the cheap fleet-coordination channel —
|
|
1885
|
-
* agents don't need each other's transcripts, just each other's
|
|
1886
|
-
* conclusions. Falls between `task` and `override` so the override
|
|
1887
|
-
* can still narrow or replace it.
|
|
1888
|
-
*/
|
|
1889
|
-
sharedScratchpad?: string | undefined;
|
|
1890
|
-
/**
|
|
1891
|
-
* Optional skill body content injected into the subagent's system prompt.
|
|
1892
|
-
* Use this to provide domain-specific knowledge (SKILL.md bodies) to
|
|
1893
|
-
* subagents that need it. Placed after `sharedScratchpad` and before
|
|
1894
|
-
* `override` so the override can still narrow or replace it.
|
|
1895
|
-
*/
|
|
1896
|
-
skills?: string | undefined;
|
|
1897
|
-
/** Final per-spawn override from `SubagentConfig.systemPromptOverride`.
|
|
1898
|
-
* Added last so it wins on conflict — that's by design: the spawn site
|
|
1899
|
-
* knows the most about what this specific subagent should do. */
|
|
1900
|
-
override?: string | undefined;
|
|
1901
|
-
}
|
|
1902
|
-
/**
|
|
1903
|
-
* Compose a subagent's system prompt. Order:
|
|
1904
|
-
* 1. Baseline (bridge contract)
|
|
1905
|
-
* 2. Role
|
|
1906
|
-
* 3. Task brief
|
|
1907
|
-
* 4. Shared scratchpad
|
|
1908
|
-
* 5. Skills (domain knowledge from SKILL.md)
|
|
1909
|
-
* 6. Per-spawn override
|
|
1910
|
-
*
|
|
1911
|
-
* Same blank-line-separated joining as the director composer.
|
|
1912
|
-
*
|
|
1913
|
-
* Layering rationale: the baseline never needs to change between
|
|
1914
|
-
* subagents; the role is the "what kind of worker is this"; the task is
|
|
1915
|
-
* the "what should you do *now*"; skills provide reusable domain knowledge
|
|
1916
|
-
* (e.g. bug-hunting patterns, security scanning rules); the override is
|
|
1917
|
-
* the spawn-site escape hatch ("…and respond only in JSON"). Putting
|
|
1918
|
-
* override last means it never gets squashed by something earlier in the chain.
|
|
1919
|
-
*/
|
|
1920
|
-
declare function composeSubagentPrompt(parts?: SubagentPromptParts): string;
|
|
1921
|
-
/**
|
|
1922
|
-
* Render a short bullet list summarising a roster — useful for stuffing
|
|
1923
|
-
* into `composeDirectorPrompt({ rosterSummary })` so the director model
|
|
1924
|
-
* can see available roles without scanning tool descriptions.
|
|
1925
|
-
*
|
|
1926
|
-
* Each entry: `- <role-id>: <name>[ (provider/model)] — <prompt-headline>`
|
|
1927
|
-
* The prompt headline is the first non-empty line of `config.prompt`,
|
|
1928
|
-
* truncated to 80 chars. Skipped entirely when the role has no prompt.
|
|
1929
|
-
*/
|
|
1930
|
-
declare function rosterSummaryFromConfigs(roster: Record<string, {
|
|
1931
|
-
name: string;
|
|
1932
|
-
provider?: string | undefined;
|
|
1933
|
-
model?: string | undefined;
|
|
1934
|
-
prompt?: string | undefined;
|
|
1935
|
-
role?: string | undefined;
|
|
1936
|
-
}>): string;
|
|
1937
|
-
|
|
1938
|
-
/**
|
|
1939
|
-
* Per-subagent session factory.
|
|
1940
|
-
*
|
|
1941
|
-
* Director runs produce many parallel transcripts — one per spawned
|
|
1942
|
-
* subagent — and we want them all rooted under the same director-run
|
|
1943
|
-
* directory so a future `wstack replay <runId>` can rehydrate the whole
|
|
1944
|
-
* fleet from a single tree.
|
|
1945
|
-
*
|
|
1946
|
-
* The factory builds (or accepts) a `SessionStore` whose `dir` points at
|
|
1947
|
-
* `<sessionsRoot>/<directorRunId>/`, and returns a small `create()`
|
|
1948
|
-
* function that the orchestration layer calls per-spawn. Each call
|
|
1949
|
-
* yields a fresh `SessionWriter` whose JSONL file lives in that
|
|
1950
|
-
* directory, named by either the caller-supplied `subagentId` (preferred,
|
|
1951
|
-
* so the file name is human-readable) or a derived id.
|
|
1952
|
-
*
|
|
1953
|
-
* **Why a thin factory instead of plumbing options through every spawn
|
|
1954
|
-
* site?** Because the director is the only caller that needs this
|
|
1955
|
-
* isolation pattern, and shoving `sessionStore` options into
|
|
1956
|
-
* `SubagentConfig` would leak storage details into a config shape that
|
|
1957
|
-
* agents and the coordinator have no business knowing about.
|
|
1958
|
-
*/
|
|
1959
|
-
interface DirectorSessionFactoryOptions {
|
|
1960
|
-
/**
|
|
1961
|
-
* Either a parent directory where `<directorRunId>/` will be created,
|
|
1962
|
-
* or a pre-built `SessionStore` whose `dir` already points at the
|
|
1963
|
-
* director run directory. Tests pass an in-memory store for isolation;
|
|
1964
|
-
* production code passes the path under `~/.wrongstack/sessions/`.
|
|
1965
|
-
*/
|
|
1966
|
-
store?: SessionStore | undefined;
|
|
1967
|
-
sessionsRoot?: string | undefined;
|
|
1968
|
-
/**
|
|
1969
|
-
* Director run id — namespaces all subagent JSONLs under one folder.
|
|
1970
|
-
* Defaults to a timestamped id; supplied explicitly when resuming a
|
|
1971
|
-
* prior fleet manifest.
|
|
1972
|
-
*/
|
|
1973
|
-
directorRunId?: string | undefined;
|
|
1974
|
-
/**
|
|
1975
|
-
* Session-level trace ID for correlating subagent storage events with
|
|
1976
|
-
* the parent session's trace in observability pipelines.
|
|
1977
|
-
*/
|
|
1978
|
-
traceId?: string | undefined;
|
|
1979
|
-
}
|
|
1980
|
-
interface DirectorSessionFactory {
|
|
1981
|
-
/** Absolute directory where this director run's transcripts live. */
|
|
1982
|
-
readonly dir: string;
|
|
1983
|
-
/** The director run id used to namespace the directory. */
|
|
1984
|
-
readonly directorRunId: string;
|
|
1985
|
-
/**
|
|
1986
|
-
* Create a fresh `SessionWriter` for the named subagent. Each
|
|
1987
|
-
* subagent gets its own JSONL file. The writer's `id` matches the
|
|
1988
|
-
* supplied `subagentId` so disk paths line up with in-memory ids.
|
|
1989
|
-
*/
|
|
1990
|
-
createSubagentSession(args: {
|
|
1991
|
-
subagentId: string;
|
|
1992
|
-
provider?: string | undefined;
|
|
1993
|
-
model?: string | undefined;
|
|
1994
|
-
title?: string | undefined;
|
|
1995
|
-
}): Promise<SessionWriter>;
|
|
1996
|
-
}
|
|
1997
|
-
/**
|
|
1998
|
-
* Build a `DirectorSessionFactory`. Pass either a pre-configured
|
|
1999
|
-
* `SessionStore` (tests) or a `sessionsRoot` path (production). When
|
|
2000
|
-
* neither is supplied the factory throws — there's no sane default for
|
|
2001
|
-
* "where do these JSONLs live".
|
|
2002
|
-
*/
|
|
2003
|
-
declare function makeDirectorSessionFactory(opts: DirectorSessionFactoryOptions): DirectorSessionFactory;
|
|
2004
|
-
|
|
2005
|
-
declare function makeSpawnTool(director: Director, roster?: Record<string, SubagentConfig>): Tool;
|
|
2006
|
-
declare function makeQualityGateTool(director: Director, roster?: Record<string, SubagentConfig>): Tool;
|
|
2007
|
-
declare function makeAssignTool(director: Director): Tool;
|
|
2008
|
-
declare function makeKanbanQueueTool(director: Director, roster?: Record<string, SubagentConfig>): Tool;
|
|
2009
|
-
declare function makeAwaitTasksTool(director: Director): Tool;
|
|
2010
|
-
declare function makeAskTool(director: Director): Tool;
|
|
2011
|
-
/**
|
|
2012
|
-
* Retrieve a previously stored `ask_subagent` answer by its store key.
|
|
2013
|
-
* The key was returned as `_answerKey` in the ask_subagent response.
|
|
2014
|
-
* Use this only for large responses that were stored out-of-context.
|
|
2015
|
-
*/
|
|
2016
|
-
declare function makeAskResultTool(director: Director): Tool;
|
|
2017
|
-
declare function makeRollUpTool(director: Director): Tool;
|
|
2018
|
-
declare function makeTerminateTool(director: Director): Tool;
|
|
2019
|
-
declare function makeTerminateAllTool(director: Director): Tool;
|
|
2020
|
-
/**
|
|
2021
|
-
* Unified fleet observation tool — consolidates the former fleet_status,
|
|
2022
|
-
* fleet_usage, fleet_session, and fleet_health tools under a single `action`
|
|
2023
|
-
* parameter (status, usage, health, session).
|
|
2024
|
-
*
|
|
2025
|
-
* These four are all read-only fleet queries; merging them into one tool
|
|
2026
|
-
* reduces tool-schema token overhead (4 × ~150 tokens → 1 × ~250 tokens)
|
|
2027
|
-
* and eliminates model confusion when choosing between similar tools.
|
|
2028
|
-
*/
|
|
2029
|
-
declare function makeFleetTool(director: Director): Tool;
|
|
2030
|
-
/**
|
|
2031
|
-
* Collaborative debugging session: BugHunter, RefactorPlanner, and Critic
|
|
2032
|
-
* run in parallel on the same target files, with findings flowing through
|
|
2033
|
-
* the FleetBus (bug.found → refactor.plan → critic.evaluation).
|
|
2034
|
-
*
|
|
2035
|
-
* Returns a structured CollabDebugReport containing all bug findings,
|
|
2036
|
-
* refactor plans, critic evaluations, and an overall verdict.
|
|
2037
|
-
*/
|
|
2038
|
-
declare function makeCollabDebugTool(director: Director): Tool;
|
|
2039
|
-
/**
|
|
2040
|
-
* Tool for subagents to emit structured events on the FleetBus.
|
|
2041
|
-
* Custom event types are extensible; known collab events are schema-validated
|
|
2042
|
-
* and restricted to their owning role before the Director routes them.
|
|
2043
|
-
* Common event types in collaborative sessions:
|
|
2044
|
-
* bug.found — BugHunter emits per-finding
|
|
2045
|
-
* refactor.plan — RefactorPlanner emits per-plan
|
|
2046
|
-
* critic.evaluation — Critic emits per-evaluation
|
|
2047
|
-
*
|
|
2048
|
-
* The payload structure is event-type-specific. Use null for empty payloads.
|
|
2049
|
-
*/
|
|
2050
|
-
declare function makeFleetEmitTool(director: Director): Tool;
|
|
2051
|
-
/**
|
|
2052
|
-
* Signal that the director's work is satisfied and the fleet should wind down.
|
|
2053
|
-
*
|
|
2054
|
-
* Once called:
|
|
2055
|
-
* - `spawn_subagent` throws — no new subagents can be created
|
|
2056
|
-
* - `assign_task` synthesizes an immediate `aborted_by_parent` completion
|
|
2057
|
-
* for any queued task (callers awaiting those tasks unblock immediately)
|
|
2058
|
-
* - Running subagents are NOT killed — they finish naturally; no new
|
|
2059
|
-
* tasks are dispatched to them
|
|
2060
|
-
*
|
|
2061
|
-
* Use this when you are satisfied with the results and want the fleet to
|
|
2062
|
-
* stop spawning without forcibly stopping in-flight work. Call
|
|
2063
|
-
* `terminate_subagent` separately for any subagent you need to stop immediately.
|
|
2064
|
-
*/
|
|
2065
|
-
declare function makeWorkCompleteTool(director: Director): Tool;
|
|
2066
|
-
|
|
2067
|
-
/**
|
|
2068
|
-
* Pre-built subagent role configurations for the WrongStack fleet.
|
|
2069
|
-
* These can be passed to `MultiAgentHost.spawn()` or used as templates
|
|
2070
|
-
* for the director's roster.
|
|
2071
|
-
*/
|
|
2072
|
-
|
|
2073
|
-
/**
|
|
2074
|
-
* Audit Log Agent — analyzes session logs, event streams, and traces.
|
|
2075
|
-
* Use for: post-mortems, trend analysis, operational insights.
|
|
2076
|
-
*/
|
|
2077
|
-
declare const AUDIT_LOG_AGENT: SubagentConfig;
|
|
2078
|
-
/**
|
|
2079
|
-
* Bug Hunter Agent — systematic bug and code smell detection.
|
|
2080
|
-
* Use for: pre-refactoring health checks, code review, regression prevention.
|
|
2081
|
-
*/
|
|
2082
|
-
declare const BUG_HUNTER_AGENT: SubagentConfig;
|
|
2083
|
-
/**
|
|
2084
|
-
* Refactor Planner Agent — structured refactoring planning.
|
|
2085
|
-
* Use for: large rewrites, technical debt reduction, architecture improvements.
|
|
2086
|
-
*/
|
|
2087
|
-
declare const REFACTOR_PLANNER_AGENT: SubagentConfig;
|
|
2088
|
-
/**
|
|
2089
|
-
* Security Scanner Agent — vulnerability and secret detection.
|
|
2090
|
-
* Use for: CI checks, pre-release audits, dependency vulnerability scanning.
|
|
2091
|
-
*/
|
|
2092
|
-
declare const SECURITY_SCANNER_AGENT: SubagentConfig;
|
|
2093
|
-
/**
|
|
2094
|
-
* All agents in a map for easy lookup by role. The four legacy pre-built
|
|
2095
|
-
* agents plus the phase 1-9 catalog (`ALL_AGENT_DEFINITIONS`). Catalog roles
|
|
2096
|
-
* are guaranteed collision-free by the catalog builder; none overlap the
|
|
2097
|
-
* legacy four.
|
|
2098
|
-
*/
|
|
2099
|
-
declare const FLEET_ROSTER: Record<string, SubagentConfig>;
|
|
2100
|
-
interface FleetRosterBudget {
|
|
2101
|
-
timeoutMs?: number | undefined;
|
|
2102
|
-
/** Idle reap window (ms). Resets on activity — see `applyRosterBudget`. */
|
|
2103
|
-
idleTimeoutMs?: number | undefined;
|
|
2104
|
-
maxIterations?: number | undefined;
|
|
2105
|
-
maxToolCalls?: number | undefined;
|
|
2106
|
-
maxTokens?: number | undefined;
|
|
2107
|
-
maxCostUsd?: number | undefined;
|
|
2108
|
-
}
|
|
2109
|
-
declare const FLEET_ROSTER_BUDGETS: Record<string, FleetRosterBudget>;
|
|
2110
|
-
declare function applyRosterBudget(cfg: SubagentConfig): SubagentConfig;
|
|
2111
|
-
/** Quick-access list for spawning all at once. */
|
|
2112
|
-
declare const ALL_FLEET_AGENTS: SubagentConfig[];
|
|
2113
|
-
/** All ACP external agents. */
|
|
2114
|
-
declare const ACP_AGENTS: SubagentConfig[];
|
|
2115
|
-
/** Extended roster including ACP agents. */
|
|
2116
|
-
declare const FLEET_ROSTER_WITHACP: Record<string, SubagentConfig>;
|
|
2117
|
-
|
|
2118
|
-
/**
|
|
2119
|
-
* A no-op FleetBus that discards all events. Used when no real fleet
|
|
2120
|
-
* bus is available (non-director mode) so the runner's `fleetBus`
|
|
2121
|
-
* field is always valid and the `attach()` call is always safe.
|
|
2122
|
-
*
|
|
2123
|
-
* One singleton instance is sufficient — it has no state to reset.
|
|
2124
|
-
*/
|
|
2125
|
-
declare const NULL_FLEET_BUS: FleetBus;
|
|
2126
|
-
|
|
2127
|
-
export { WorktreeIntegrationError as $, ACP_AGENTS as A, BUG_HUNTER_AGENT as B, type CollabBudgetConfig as C, DEFAULT_DIRECTOR_PREAMBLE as D, FLEET_ROSTER_WITHACP as E, FLEET_ROSTER as F, FleetCostCapError as G, FleetManager as H, type FleetManagerOptions as I, type FleetRosterBudget as J, FleetSpawnBudgetError as K, FleetTokenCapError as L, type FleetWorktreePolicy as M, type ICoordinator as N, type IFleetManager as O, InMemoryAgentBridge as P, InMemoryBridgeTransport as Q, LargeAnswerStore as R, NULL_FLEET_BUS as S, REFACTOR_PLANNER_AGENT as T, type RefactorPhase as U, type RefactorPlan as V, SECURITY_SCANNER_AGENT as W, type SharedFileEntry as X, type SharedFileSnapshot as Y, type SubagentPromptParts as Z, type TaskResultNotification as _, AGENTS_BY_PHASE as a, type WorktreeIsolationDecision as a0, type WorktreeTaskRunnerOptions as a1, type WorktreeTaskStateUpdate as a2, applyRosterBudget as a3, attachAutoExtend as a4, composeDirectorPrompt as a5, composeSubagentPrompt as a6, createDelegateTool as a7, createMessage as a8, getAgentDefinition as a9, makeAskResultTool as aa, makeAskTool as ab, makeAssignTool as ac, makeAwaitTasksTool as ad, makeCollabDebugTool as ae, makeDirectorSessionFactory as af, makeFleetEmitTool as ag, makeFleetTool as ah, makeKanbanQueueTool as ai, makeQualityGateTool as aj, makeRollUpTool as ak, makeSpawnTool as al, makeTerminateAllTool as am, makeTerminateTool as an, makeWorkCompleteTool as ao, resolveSubagentWorktreeDecision as ap, rosterSummaryFromConfigs as aq, subagentNeedsWorktree as ar, wrapSubagentRunnerWithWorktrees as as, AGENT_CATALOG as b, ALL_AGENT_DEFINITIONS as c, ALL_FLEET_AGENTS as d, AUDIT_LOG_AGENT as e, type AutoExtendCeiling as f, type AutoExtendPolicy as g, type BugFinding as h, type CollabBudgetOverrides as i, type CollabBudgetWarningPayload as j, type CollabDebugReport as k, CollabSession as l, type CollabSessionOptions as m, type CreateDelegateToolOptions as n, type CriticConcern as o, type CriticEvaluation as p, DEFAULT_SUBAGENT_BASELINE as q, type DelegateHost as r, Director as s, type DirectorAlert as t, DirectorAlertLevel as u, type DirectorCancelCollabPayload as v, type DirectorPromptParts as w, type DirectorSessionFactory as x, type DirectorSessionFactoryOptions as y, FLEET_ROSTER_BUDGETS as z };
|