@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,1770 +0,0 @@
|
|
|
1
|
-
import { T as ToolCallPipelinePayload, a as ToolWrapper, E as ExtensionRegistry, S as SystemPromptContributor, b as ToolRegistry, P as ProviderRegistry, A as AgentPipelines, c as ToolExecutorLike, R as ResolvedLoopDetectionConfig, d as AgentInit, e as AgentInput, f as RunResult } from './index--Gm41aBJ.js';
|
|
2
|
-
import { C as Container, R as ReadonlyPipeline, a as Renderer } from './pipeline-DGDyIohT.js';
|
|
3
|
-
import { E as EventBus, a as EventName, L as Listener } from './events-Bgnh43r9.js';
|
|
4
|
-
import { R as RetryPolicy, E as ErrorHandler } from './retry-policy-CQ7KwXJa.js';
|
|
5
|
-
import { L as Logger } from './logger-B63L5bTg.js';
|
|
6
|
-
import { T as Tracer } from './observability-D-HZN_mF.js';
|
|
7
|
-
import { P as PermissionPolicy } from './permission-ByDKXEcG.js';
|
|
8
|
-
import { d as Context, J as JSONSchema, c as Request, e as Response, i as ContentBlock, s as TextBlock, g as Tool, P as Provider, t as RunOptions, U as Usage } from './tool-BNlnIJvo.js';
|
|
9
|
-
import { b as Mailbox } from './mailbox-types-BGZWrYTJ.js';
|
|
10
|
-
import { W as WireFamily, H as HookEvent, f as HookMatcher, I as InProcessHook, g as HookRegistrationOptions, j as Config, M as ModelsRegistry, k as ModelRuntimeConfig } from './config-MRqn1V-u.js';
|
|
11
|
-
import { EventEmitter } from 'node:events';
|
|
12
|
-
|
|
13
|
-
type BridgeMessageType = 'task' | 'result' | 'progress' | 'error' | 'heartbeat' | 'stop' | 'delegate' | 'budget_threshold';
|
|
14
|
-
interface BridgeMessage<T = unknown> {
|
|
15
|
-
id: string;
|
|
16
|
-
type: BridgeMessageType;
|
|
17
|
-
from: string;
|
|
18
|
-
to?: string | undefined;
|
|
19
|
-
payload: T;
|
|
20
|
-
timestamp: number;
|
|
21
|
-
priority?: 'low' | 'normal' | 'high' | 'critical' | undefined;
|
|
22
|
-
}
|
|
23
|
-
interface AgentBridgeConfig {
|
|
24
|
-
agentId: string;
|
|
25
|
-
coordinatorId: string;
|
|
26
|
-
timeoutMs?: number | undefined;
|
|
27
|
-
bufferSize?: number | undefined;
|
|
28
|
-
}
|
|
29
|
-
interface AgentBridge {
|
|
30
|
-
readonly agentId: string;
|
|
31
|
-
readonly coordinatorId: string;
|
|
32
|
-
send(msg: BridgeMessage): Promise<void>;
|
|
33
|
-
broadcast(msg: BridgeMessage): Promise<void>;
|
|
34
|
-
subscribe(handler: (msg: BridgeMessage) => void | Promise<void>): () => void;
|
|
35
|
-
request<T>(msg: BridgeMessage, timeoutMs?: number): Promise<BridgeMessage<T>> | undefined;
|
|
36
|
-
stop(): Promise<void>;
|
|
37
|
-
}
|
|
38
|
-
interface BridgeTransport {
|
|
39
|
-
send(msg: BridgeMessage, to: string): Promise<void>;
|
|
40
|
-
subscribe(agentId: string, handler: (msg: BridgeMessage) => void | Promise<void>): () => void;
|
|
41
|
-
close(agentId: string): Promise<void>;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* A slash command registered with the CLI or available to plugins.
|
|
46
|
-
* Plugins receive a view of the registry via PluginAPI.slashCommands.
|
|
47
|
-
*
|
|
48
|
-
* Commands registered by plugins use a namespaced name: `pluginName:commandName`.
|
|
49
|
-
* This prevents collisions with built-in commands and other plugins.
|
|
50
|
-
*/
|
|
51
|
-
interface SlashCommand {
|
|
52
|
-
/** Unique command name. For plugins: `pluginName:commandName`. */
|
|
53
|
-
name: string;
|
|
54
|
-
/** Short aliases — also prefixed automatically: `pluginName:alias`. */
|
|
55
|
-
aliases?: string[] | undefined;
|
|
56
|
-
description: string;
|
|
57
|
-
/**
|
|
58
|
-
* Category used to group commands in the slash picker. Defaults to 'App'
|
|
59
|
-
* when omitted.
|
|
60
|
-
*/
|
|
61
|
-
category?: 'Run' | 'Session' | 'Inspect' | 'Agent' | 'Config' | 'App' | undefined;
|
|
62
|
-
/**
|
|
63
|
-
* Optional compact argument hint for interactive menus. This is not parsed
|
|
64
|
-
* by the registry; it only helps TUI/REPL surfaces show the expected shape,
|
|
65
|
-
* for example `[list|install <alias>|disable <name>]`.
|
|
66
|
-
*/
|
|
67
|
-
argsHint?: string | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* Optional detailed help shown by `/help <name>`. Use this for usage,
|
|
70
|
-
* arguments, examples, side-effects — anything that doesn't fit in
|
|
71
|
-
* `description`. Renders verbatim, so format with line breaks.
|
|
72
|
-
* If absent, `/help <name>` falls back to `description`.
|
|
73
|
-
*/
|
|
74
|
-
help?: string | undefined;
|
|
75
|
-
/**
|
|
76
|
-
* When true, this command does not appear in the slash-picker list
|
|
77
|
-
* triggered by typing `/` alone. It is still dispatchable and
|
|
78
|
-
* searchable when the user types a matching prefix (e.g. `/f`).
|
|
79
|
-
* Defaults to false.
|
|
80
|
-
*/
|
|
81
|
-
hidden?: boolean | undefined;
|
|
82
|
-
/**
|
|
83
|
-
* Execute the command.
|
|
84
|
-
* @param args Everything after the command name (trimmed by dispatch).
|
|
85
|
-
* @param ctx The current agent context.
|
|
86
|
-
* @returns `{ exit: true }` to quit the REPL. `{ message }` to print and
|
|
87
|
-
* continue. `{ runText }` to send a follow-up user-role message to the
|
|
88
|
-
* model immediately (e.g. `/steer <text>` builds a STEERING preamble
|
|
89
|
-
* here and asks the TUI to run it as the next turn). The TUI prints
|
|
90
|
-
* `message` first (if any) so the user sees the slash result before
|
|
91
|
-
* the model's response starts streaming. `{ metadata }` carries
|
|
92
|
-
* structured data for the REPL/TUI to act on (e.g. SDD session state).
|
|
93
|
-
*/
|
|
94
|
-
run(args: string, ctx?: Context | undefined): Promise<{
|
|
95
|
-
exit?: boolean | undefined;
|
|
96
|
-
message?: string | undefined;
|
|
97
|
-
runText?: string | undefined;
|
|
98
|
-
metadata?: Record<string, unknown>;
|
|
99
|
-
} | void>;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
interface ToolRegistryView {
|
|
103
|
-
register(t: Tool): void;
|
|
104
|
-
unregister(name: string): void;
|
|
105
|
-
/** Wrap (decorate) an existing tool. The wrapper gets the current tool and returns the decorated version. */
|
|
106
|
-
wrap(name: string, wrapper: ToolWrapper): void;
|
|
107
|
-
get(name: string): Tool | undefined;
|
|
108
|
-
list(): Tool[];
|
|
109
|
-
}
|
|
110
|
-
interface ProviderFactory {
|
|
111
|
-
type: string;
|
|
112
|
-
family: WireFamily;
|
|
113
|
-
create(cfg: unknown): Provider;
|
|
114
|
-
}
|
|
115
|
-
interface ProviderRegistryView {
|
|
116
|
-
register(f: ProviderFactory): void;
|
|
117
|
-
unregister(type: string): boolean;
|
|
118
|
-
create(cfg: {
|
|
119
|
-
type: string;
|
|
120
|
-
} & Record<string, unknown>): Provider;
|
|
121
|
-
list(): string[];
|
|
122
|
-
}
|
|
123
|
-
interface MCPRegistryView {
|
|
124
|
-
start(cfg: unknown): Promise<void>;
|
|
125
|
-
stop(name: string): Promise<void>;
|
|
126
|
-
restart(name: string): Promise<void>;
|
|
127
|
-
list(): {
|
|
128
|
-
name: string;
|
|
129
|
-
state: string;
|
|
130
|
-
toolCount: number;
|
|
131
|
-
}[];
|
|
132
|
-
}
|
|
133
|
-
interface SlashCommandRegistryView {
|
|
134
|
-
register(cmd: SlashCommand): void;
|
|
135
|
-
unregister(name: string): boolean;
|
|
136
|
-
get(name: string): SlashCommand | undefined;
|
|
137
|
-
list(): SlashCommand[];
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Read-only view of the session writer. Plugins can append custom events
|
|
141
|
-
* to the JSONL session log and read the transcript path.
|
|
142
|
-
*
|
|
143
|
-
* The `append` method accepts any JSON-serializable payload — custom
|
|
144
|
-
* event types are persisted verbatim next to the built-in events.
|
|
145
|
-
*/
|
|
146
|
-
interface SessionWriterView {
|
|
147
|
-
readonly transcriptPath?: string | undefined;
|
|
148
|
-
append(event: Record<string, unknown> & {
|
|
149
|
-
type: string;
|
|
150
|
-
ts: string;
|
|
151
|
-
}): Promise<void>;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Metrics sink scoped to a plugin. The host auto-prefixes metric names
|
|
155
|
-
* with `plugin.<pluginName>.` so plugins don't need to namespace
|
|
156
|
-
* manually. Plugins call counter/histogram/gauge directly; the values
|
|
157
|
-
* flow to the host's MetricsSink (Prometheus, OTLP, or noop).
|
|
158
|
-
*/
|
|
159
|
-
interface MetricsSinkView {
|
|
160
|
-
counter(name: string, value?: number | undefined, labels?: Record<string, string>): void;
|
|
161
|
-
histogram(name: string, value: number, labels?: Record<string, string>): void;
|
|
162
|
-
gauge(name: string, value: number, labels?: Record<string, string>): void;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Options for a single `api.llm.complete()` call. Everything is
|
|
166
|
-
* optional — omitted fields fall back first to the plugin's own
|
|
167
|
-
* configured defaults (`config.extensions[<name>].llm`), then to the
|
|
168
|
-
* host session's provider/model.
|
|
169
|
-
*/
|
|
170
|
-
interface PluginLLMOptions {
|
|
171
|
-
/** System prompt for this call. */
|
|
172
|
-
system?: string | undefined;
|
|
173
|
-
/** Model override (e.g. `claude-haiku-4-5`). */
|
|
174
|
-
model?: string | undefined;
|
|
175
|
-
/**
|
|
176
|
-
* Provider override by configured provider name (a key of
|
|
177
|
-
* `config.providers`, e.g. `anthropic`, `openai`, `omniroute`).
|
|
178
|
-
* When omitted the host session's provider is used.
|
|
179
|
-
*/
|
|
180
|
-
provider?: string | undefined;
|
|
181
|
-
/** Output-token cap. Default 2048, hard-capped by the host. */
|
|
182
|
-
maxTokens?: number | undefined;
|
|
183
|
-
temperature?: number | undefined;
|
|
184
|
-
/** `'json'` asks the provider for a JSON object response. */
|
|
185
|
-
responseFormat?: 'text' | 'json' | undefined;
|
|
186
|
-
/** Abort signal — plugins should pass one for cancellable work. */
|
|
187
|
-
signal?: AbortSignal | undefined;
|
|
188
|
-
}
|
|
189
|
-
interface PluginLLMResult {
|
|
190
|
-
/** Concatenated text blocks of the response. */
|
|
191
|
-
text: string;
|
|
192
|
-
/** The model that actually served the call. */
|
|
193
|
-
model: string;
|
|
194
|
-
/** The provider name the call was routed through. */
|
|
195
|
-
provider: string;
|
|
196
|
-
usage: {
|
|
197
|
-
input: number;
|
|
198
|
-
output: number;
|
|
199
|
-
};
|
|
200
|
-
stopReason: string;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* LLM access for plugins, routed through the host's provider layer —
|
|
204
|
-
* plugins never handle API keys themselves. Resolution order for
|
|
205
|
-
* provider/model on each call:
|
|
206
|
-
*
|
|
207
|
-
* 1. `PluginLLMOptions.provider` / `.model` (per call)
|
|
208
|
-
* 2. `config.extensions[<plugin>].llm.provider` / `.model` (per plugin)
|
|
209
|
-
* 3. the host session's active provider/model (default)
|
|
210
|
-
*
|
|
211
|
-
* Exposed as `api.llm` — `undefined` on minimal hosts (tests, the LSP
|
|
212
|
-
* server) that have no provider wired. Always guard:
|
|
213
|
-
* `if (!api.llm) return;`
|
|
214
|
-
*/
|
|
215
|
-
interface PluginLLM {
|
|
216
|
-
/** The effective defaults for this plugin (after config resolution). */
|
|
217
|
-
defaults(): {
|
|
218
|
-
provider: string;
|
|
219
|
-
model: string;
|
|
220
|
-
};
|
|
221
|
-
/** One-shot completion. Throws on provider errors. */
|
|
222
|
-
complete(prompt: string, opts?: PluginLLMOptions): Promise<PluginLLMResult>;
|
|
223
|
-
}
|
|
224
|
-
interface PluginPipelines {
|
|
225
|
-
request: ReadonlyPipeline<Request>;
|
|
226
|
-
response: ReadonlyPipeline<Response>;
|
|
227
|
-
toolCall: ReadonlyPipeline<ToolCallPipelinePayload>;
|
|
228
|
-
userInput: ReadonlyPipeline<{
|
|
229
|
-
content: ContentBlock[];
|
|
230
|
-
text: string;
|
|
231
|
-
ctx: Context;
|
|
232
|
-
}>;
|
|
233
|
-
assistantOutput: ReadonlyPipeline<TextBlock>;
|
|
234
|
-
contextWindow: ReadonlyPipeline<Context>;
|
|
235
|
-
[k: string]: ReadonlyPipeline<any>;
|
|
236
|
-
}
|
|
237
|
-
interface PluginAPI {
|
|
238
|
-
container: Container;
|
|
239
|
-
pipelines: PluginPipelines;
|
|
240
|
-
events: EventBus;
|
|
241
|
-
tools: ToolRegistryView;
|
|
242
|
-
providers: ProviderRegistryView;
|
|
243
|
-
mcp: MCPRegistryView;
|
|
244
|
-
slashCommands: SlashCommandRegistryView;
|
|
245
|
-
/** Live session writer — plugins can append custom events here. */
|
|
246
|
-
session: SessionWriterView;
|
|
247
|
-
/** Scoped metrics sink — counters/histograms/gauges auto-namespaced under `plugin.<name>.` */
|
|
248
|
-
metrics: MetricsSinkView;
|
|
249
|
-
/** Registry for agent lifecycle extensions — hooks like beforeRun, beforeIteration, onError, etc. */
|
|
250
|
-
extensions: ExtensionRegistry;
|
|
251
|
-
/**
|
|
252
|
-
* Register a system prompt contributor. Plugins call this to inject
|
|
253
|
-
* ephemeral TextBlocks into the system prompt on every build.
|
|
254
|
-
* Returns an unregister function.
|
|
255
|
-
*/
|
|
256
|
-
registerSystemPromptContributor(c: SystemPromptContributor): () => void;
|
|
257
|
-
/**
|
|
258
|
-
* Register an in-process lifecycle hook. `matcher` is a tool-name filter for
|
|
259
|
-
* `PreToolUse`/`PostToolUse` (`"Bash"`, `"edit|write"`, `"*"`) and ignored
|
|
260
|
-
* for other events. The hook can block, rewrite tool input, or inject extra
|
|
261
|
-
* context — see `HookOutcome`. Automatically removed when the plugin is
|
|
262
|
-
* uninstalled. Returns an unregister function.
|
|
263
|
-
*/
|
|
264
|
-
registerHook(event: HookEvent, matcher: HookMatcher | undefined, hook: InProcessHook, options?: HookRegistrationOptions | undefined): () => void;
|
|
265
|
-
config: Config;
|
|
266
|
-
log: Logger;
|
|
267
|
-
/**
|
|
268
|
-
* Register a one-time event listener. The handler is automatically removed
|
|
269
|
-
* after the first emission, or when the plugin is uninstalled — whichever
|
|
270
|
-
* comes first.
|
|
271
|
-
*/
|
|
272
|
-
onEvent<K extends EventName>(event: K, handler: Listener<K>): () => void;
|
|
273
|
-
/**
|
|
274
|
-
* Subscribe to all events matching a glob-style pattern.
|
|
275
|
-
* `'tool.*'` matches all tool events. `'*'` matches everything.
|
|
276
|
-
* Returns an unsubscribe function.
|
|
277
|
-
*/
|
|
278
|
-
onPattern(pattern: string, handler: (event: string, payload: unknown) => void): () => void;
|
|
279
|
-
/**
|
|
280
|
-
* Emit a custom event on the agent's EventBus. Use for inter-plugin
|
|
281
|
-
* communication or to surface plugin-specific state to the host.
|
|
282
|
-
*
|
|
283
|
-
* Custom events use a `pluginName:eventName` convention to avoid
|
|
284
|
-
* collisions with built-in events (e.g. `my-plugin:cache_hit`).
|
|
285
|
-
* The payload is passed through to all subscribers.
|
|
286
|
-
*/
|
|
287
|
-
emitCustom(event: string, payload: unknown): void;
|
|
288
|
-
/**
|
|
289
|
-
* Register a callback that fires when the configuration changes at
|
|
290
|
-
* runtime (e.g. via `/config` slash command or programmatic update).
|
|
291
|
-
* The handler receives the new and previous config snapshots.
|
|
292
|
-
* Returns an unsubscribe function.
|
|
293
|
-
*/
|
|
294
|
-
onConfigChange(handler: (next: Readonly<Config>, prev: Readonly<Config>) => void): () => void;
|
|
295
|
-
/**
|
|
296
|
-
* The models registry (models.dev-backed catalog of providers, models,
|
|
297
|
-
* and per-token pricing). Optional — some hosts may not construct one
|
|
298
|
-
* (e.g. minimal CLI invocations, tests). Plugins that need pricing
|
|
299
|
-
* data (cost-tracker, billing reports) should treat this as the
|
|
300
|
-
* preferred source when present and fall back to a bundled table
|
|
301
|
-
* otherwise.
|
|
302
|
-
*/
|
|
303
|
-
modelsRegistry?: ModelsRegistry | undefined;
|
|
304
|
-
/**
|
|
305
|
-
* The host's project-level mailbox. Optional — minimal hosts (tests,
|
|
306
|
-
* standalone CLI invocations, the LSP server) may not construct one.
|
|
307
|
-
* Plugins that publish status to other agents (todo-listener,
|
|
308
|
-
* session-recap) should treat this as the preferred source when present
|
|
309
|
-
* and gracefully no-op otherwise.
|
|
310
|
-
*/
|
|
311
|
-
mailbox?: Mailbox | undefined;
|
|
312
|
-
/**
|
|
313
|
-
* LLM access routed through the host's provider layer. Optional —
|
|
314
|
-
* minimal hosts without a wired provider omit it; plugins must guard
|
|
315
|
-
* (`if (!api.llm) …`). Per-plugin provider/model defaults come from
|
|
316
|
-
* `config.extensions[<name>].llm = { provider, model }`.
|
|
317
|
-
*/
|
|
318
|
-
llm?: PluginLLM | undefined;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Capability declaration — informs the host which subsystems a plugin
|
|
322
|
-
* intends to touch. Used for diagnostics and per-plugin enable/disable UX
|
|
323
|
-
* (e.g. "this plugin registers tools — disable to remove them"). Not
|
|
324
|
-
* enforced at runtime: a plugin that declares `tools: false` can still
|
|
325
|
-
* call `api.tools.register()`, but the host can flag the discrepancy.
|
|
326
|
-
*/
|
|
327
|
-
interface PluginCapabilities {
|
|
328
|
-
/** Will register tools via `api.tools.register()`. */
|
|
329
|
-
tools?: boolean | undefined;
|
|
330
|
-
/** Will register provider factories via `api.providers.register()`. */
|
|
331
|
-
providers?: boolean | undefined;
|
|
332
|
-
/**
|
|
333
|
-
* Pipelines the plugin hooks into. Use the standard names
|
|
334
|
-
* (`request | response | toolCall | userInput | assistantOutput | contextWindow`)
|
|
335
|
-
* or custom pipeline names exposed by other plugins.
|
|
336
|
-
*/
|
|
337
|
-
pipelines?: string[] | undefined;
|
|
338
|
-
/** Will register slash commands via `api.slashCommands.register()`. */
|
|
339
|
-
slashCommands?: boolean | undefined;
|
|
340
|
-
/** Will start MCP servers via `api.mcp.start()`. */
|
|
341
|
-
mcp?: boolean | undefined;
|
|
342
|
-
/**
|
|
343
|
-
* Capabilities required to mutate (wrap, unregister, override) tools
|
|
344
|
-
* the plugin does not own. If empty or omitted, the plugin may only
|
|
345
|
-
* mutate its own tools. Official plugins bypass this check.
|
|
346
|
-
*
|
|
347
|
-
* Example: `['fs.read', 'net.outbound']` allows the plugin to wrap
|
|
348
|
-
* read-only tools, but not `fs.write` or `shell.arbitrary` tools.
|
|
349
|
-
*/
|
|
350
|
-
toolMutateCapabilities?: string[] | undefined;
|
|
351
|
-
/**
|
|
352
|
-
* Will register in-process lifecycle hooks via `api.registerHook()`. When
|
|
353
|
-
* false (or omitted by a non-official plugin), the loader either logs a
|
|
354
|
-
* warning or throws — see `LoadPluginsOptions.enforceCapabilities`.
|
|
355
|
-
* Official plugins are not gated.
|
|
356
|
-
*/
|
|
357
|
-
hooks?: boolean | undefined;
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Structured dependency declaration. The string form (`dependsOn: ['foo']`)
|
|
361
|
-
* is shorthand for `[{ name: 'foo' }]` — both work. Use the structured form
|
|
362
|
-
* when you need a version constraint:
|
|
363
|
-
*
|
|
364
|
-
* dependsOn: [{ name: 'wstack-auth', version: '^1.2.0' }]
|
|
365
|
-
*/
|
|
366
|
-
interface PluginDependency {
|
|
367
|
-
name: string;
|
|
368
|
-
/** npm-style semver range. Supports `^`, `~`, exact, and unprefixed. */
|
|
369
|
-
version?: string | undefined;
|
|
370
|
-
}
|
|
371
|
-
interface Plugin {
|
|
372
|
-
name: string;
|
|
373
|
-
version?: string | undefined;
|
|
374
|
-
/** One-line summary for `wstack plugins list` and error messages. */
|
|
375
|
-
description?: string | undefined;
|
|
376
|
-
/** Semver range against the kernel API version (KERNEL_API_VERSION). */
|
|
377
|
-
apiVersion: string;
|
|
378
|
-
/**
|
|
379
|
-
* Capability hints — what subsystems the plugin will register against.
|
|
380
|
-
* Optional; provided for diagnostics and UX. The loader does not enforce
|
|
381
|
-
* these, but mismatch is surfaced via logger at warn level.
|
|
382
|
-
*/
|
|
383
|
-
capabilities?: PluginCapabilities | undefined;
|
|
384
|
-
/**
|
|
385
|
-
* JSON Schema for the options under `Config.plugins[<name>].options`.
|
|
386
|
-
* When present, the loader validates that section before calling `setup`
|
|
387
|
-
* and rejects the plugin with a clear error path on failure.
|
|
388
|
-
*/
|
|
389
|
-
configSchema?: JSONSchema | undefined;
|
|
390
|
-
/**
|
|
391
|
-
* Mandatory plugin dependencies — loading fails if any are absent or
|
|
392
|
-
* version-incompatible. Accepts both the legacy string-array form and
|
|
393
|
-
* the structured form with version constraints.
|
|
394
|
-
*/
|
|
395
|
-
dependsOn?: (string | PluginDependency)[] | undefined;
|
|
396
|
-
/** Optional plugin dependencies — silently skipped if absent. */
|
|
397
|
-
optionalDeps?: (string | PluginDependency)[] | undefined;
|
|
398
|
-
conflictsWith?: string[] | undefined;
|
|
399
|
-
/**
|
|
400
|
-
* Default configuration values, deep-merged under the plugin's options
|
|
401
|
-
* key before `configSchema` validation. User-provided values take
|
|
402
|
-
* precedence over defaults — this is a fallback, not an override.
|
|
403
|
-
*
|
|
404
|
-
* @example
|
|
405
|
-
* defaultConfig: { ttl: 3600, maxSize: 100 }
|
|
406
|
-
*/
|
|
407
|
-
defaultConfig?: Record<string, unknown>;
|
|
408
|
-
/**
|
|
409
|
-
* Called by the host to activate the plugin. Receives the `PluginAPI`
|
|
410
|
-
* and an optional `AbortSignal` the plugin should respect for
|
|
411
|
-
* cancellation and timeout. `setup` must complete before the plugin is
|
|
412
|
-
* considered loaded; if it times out the plugin is rejected.
|
|
413
|
-
*/
|
|
414
|
-
setup(api: PluginAPI, opts?: {
|
|
415
|
-
signal?: AbortSignal | undefined;
|
|
416
|
-
}): void | Promise<void>;
|
|
417
|
-
/**
|
|
418
|
-
* Called by the host during unload. Receives the same `PluginAPI` instance
|
|
419
|
-
* the plugin saw during `setup` and an optional `AbortSignal`. Teardown
|
|
420
|
-
* is best-effort — a timeout does not prevent other plugins from unloading.
|
|
421
|
-
*/
|
|
422
|
-
teardown?(api: PluginAPI, opts?: {
|
|
423
|
-
signal?: AbortSignal | undefined;
|
|
424
|
-
}): void | Promise<void>;
|
|
425
|
-
/**
|
|
426
|
-
* Optional health check. Called by the host (e.g. `/diag plugins` slash
|
|
427
|
-
* command or health endpoint) to surface plugin status. Return
|
|
428
|
-
* `{ ok: false, message: '...' }` when the plugin is degraded.
|
|
429
|
-
*/
|
|
430
|
-
health?(): Promise<{
|
|
431
|
-
ok: boolean;
|
|
432
|
-
message?: string | undefined;
|
|
433
|
-
}>;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
declare class Agent {
|
|
437
|
-
readonly container: Container;
|
|
438
|
-
readonly tools: ToolRegistry;
|
|
439
|
-
readonly providers: ProviderRegistry;
|
|
440
|
-
readonly events: EventBus;
|
|
441
|
-
readonly pipelines: AgentPipelines;
|
|
442
|
-
readonly ctx: Context;
|
|
443
|
-
/** Max agent-loop iterations per run. Mutable so the TUI `/settings` picker
|
|
444
|
-
* can apply a new value to the live session (takes effect next run). */
|
|
445
|
-
maxIterations: number;
|
|
446
|
-
readonly executionStrategy: 'parallel' | 'sequential' | 'smart';
|
|
447
|
-
readonly perIterationOutputCapBytes: number;
|
|
448
|
-
private readonly plugins;
|
|
449
|
-
readonly toolExecutor: ToolExecutorLike;
|
|
450
|
-
readonly autoExtendLimit: boolean;
|
|
451
|
-
/** Resolved loop-detector settings (see `tools.loopDetection`). */
|
|
452
|
-
readonly loopDetection: ResolvedLoopDetectionConfig;
|
|
453
|
-
private readonly autonomousContinue;
|
|
454
|
-
readonly tracer: Tracer | undefined;
|
|
455
|
-
readonly extensions: ExtensionRegistry;
|
|
456
|
-
private readonly _toolHandler;
|
|
457
|
-
private readonly _responseHandler;
|
|
458
|
-
private readonly _loopHandler;
|
|
459
|
-
private readonly _logger;
|
|
460
|
-
constructor(init: AgentInit);
|
|
461
|
-
get logger(): Logger;
|
|
462
|
-
get retry(): RetryPolicy;
|
|
463
|
-
get errorHandler(): ErrorHandler;
|
|
464
|
-
get permission(): PermissionPolicy;
|
|
465
|
-
get renderer(): Renderer | undefined;
|
|
466
|
-
disableInteractiveConfirmation(): void;
|
|
467
|
-
register(tool: Tool): void;
|
|
468
|
-
use(plugin: Plugin, api: PluginAPI): Promise<void>;
|
|
469
|
-
teardown(): Promise<void>;
|
|
470
|
-
run(userInput: AgentInput, opts?: RunOptions): Promise<RunResult>;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
type BudgetKind = 'tool_calls' | 'iterations' | 'tokens' | 'timeout' | 'idle_timeout' | 'cost';
|
|
474
|
-
/**
|
|
475
|
-
* Fraction of the wall-clock `timeoutMs` window at which a PROACTIVE extension
|
|
476
|
-
* is negotiated — BEFORE the deadline is actually crossed. The coordinator
|
|
477
|
-
* watchdog (`executeWithTimeout`) arms at `timeoutMs * TIMEOUT_PREEMPT_FRACTION`
|
|
478
|
-
* so a still-progressing subagent gets its ceiling raised while it is below the
|
|
479
|
-
* limit, and never enters a "timed out" state. Reactive enforcement at the real
|
|
480
|
-
* deadline still stands for the no-progress / denied case. Shared so the asking
|
|
481
|
-
* side and any future caller agree on the same lead point.
|
|
482
|
-
*/
|
|
483
|
-
declare const TIMEOUT_PREEMPT_FRACTION = 0.85;
|
|
484
|
-
/**
|
|
485
|
-
* Hard safety net for budget negotiation decisions. If no listener responds to
|
|
486
|
-
* `budget.threshold_reached` within this window the negotiation defaults to
|
|
487
|
-
* `'stop'`. Exported so the coordinator's watchdog can reuse the same ceiling
|
|
488
|
-
* without hardcoding a second copy.
|
|
489
|
-
*/
|
|
490
|
-
declare const DECISION_TIMEOUT_MS = 60000;
|
|
491
|
-
declare class BudgetExceededError extends Error {
|
|
492
|
-
readonly kind: BudgetKind;
|
|
493
|
-
readonly limit: number;
|
|
494
|
-
readonly observed: number;
|
|
495
|
-
constructor(kind: BudgetKind, limit: number, observed: number);
|
|
496
|
-
}
|
|
497
|
-
interface BudgetLimits {
|
|
498
|
-
maxIterations?: number | undefined;
|
|
499
|
-
maxToolCalls?: number | undefined;
|
|
500
|
-
maxTokens?: number | undefined;
|
|
501
|
-
/** Estimated USD cost ceiling. */
|
|
502
|
-
maxCostUsd?: number | undefined;
|
|
503
|
-
/**
|
|
504
|
-
* Hard wall-clock timeout measured from `start()`. Off by default — set it
|
|
505
|
-
* explicitly only when a task must finish within an absolute window. For
|
|
506
|
-
* the everyday "don't kill an agent that's still working" guard, prefer
|
|
507
|
-
* `idleTimeoutMs`, which resets on activity.
|
|
508
|
-
*/
|
|
509
|
-
timeoutMs?: number | undefined;
|
|
510
|
-
/**
|
|
511
|
-
* Idle timeout: the maximum gap (ms) between activity signals (iterations,
|
|
512
|
-
* tool calls, token usage, streamed progress) before the subagent is
|
|
513
|
-
* considered hung and reaped. Unlike `timeoutMs`, an actively-working
|
|
514
|
-
* agent continuously resets this clock via `markActivity()`, so it never
|
|
515
|
-
* trips on a long-but-productive run — only on a genuine stall.
|
|
516
|
-
*/
|
|
517
|
-
idleTimeoutMs?: number | undefined;
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* Controls how the budget behaves when `onThreshold` is set and a limit is hit.
|
|
521
|
-
*
|
|
522
|
-
* `'auto'` — emit `budget.threshold_reached` on the EventBus and wait for a
|
|
523
|
-
* coordinator response (extend/stop). If no listener responds within
|
|
524
|
-
* `DECISION_TIMEOUT_MS` the decision defaults to `'stop'`.
|
|
525
|
-
* `'sync'` — do not emit any event; treat the threshold as a hard stop and
|
|
526
|
-
* throw `BudgetExceededError` synchronously. Useful for fire-and-forget
|
|
527
|
-
* subagents that have an `onThreshold` handler for logging/metrics but are
|
|
528
|
-
* not wired into a coordinator.
|
|
529
|
-
*
|
|
530
|
-
* @default 'auto'
|
|
531
|
-
*/
|
|
532
|
-
type BudgetNegotiationMode = 'auto' | 'sync';
|
|
533
|
-
type BudgetSessionIdSource = string | (() => string | undefined);
|
|
534
|
-
interface SubagentBudgetOptions {
|
|
535
|
-
sessionId?: BudgetSessionIdSource | undefined;
|
|
536
|
-
}
|
|
537
|
-
interface BudgetUsage {
|
|
538
|
-
iterations: number;
|
|
539
|
-
toolCalls: number;
|
|
540
|
-
tokens: {
|
|
541
|
-
input: number;
|
|
542
|
-
output: number;
|
|
543
|
-
total: number;
|
|
544
|
-
};
|
|
545
|
-
costUsd: number;
|
|
546
|
-
elapsedMs: number;
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* Thrown by `SubagentBudget.record*` when a soft limit is hit and
|
|
550
|
-
* an `onThreshold` handler is configured that wants to ask the
|
|
551
|
-
* coordinator (via `budget.threshold_reached` event). The runner
|
|
552
|
-
* catches this and awaits the embedded `decision` promise to get
|
|
553
|
-
* the coordinator's extend/stop decision.
|
|
554
|
-
*
|
|
555
|
-
* Distinct from `BudgetExceededError` which is a hard stop.
|
|
556
|
-
*/
|
|
557
|
-
declare class BudgetThresholdSignal extends Error {
|
|
558
|
-
readonly kind: BudgetKind;
|
|
559
|
-
readonly limit: number;
|
|
560
|
-
readonly used: number;
|
|
561
|
-
/** Resolves to 'extend' (with optional new limits) or 'stop' */
|
|
562
|
-
readonly decision: Promise<BudgetThresholdDecision>;
|
|
563
|
-
constructor(kind: BudgetKind, limit: number, used: number, decision: Promise<BudgetThresholdDecision>);
|
|
564
|
-
}
|
|
565
|
-
type BudgetThresholdDecision = 'stop' | {
|
|
566
|
-
extend: Partial<BudgetLimits>;
|
|
567
|
-
};
|
|
568
|
-
/**
|
|
569
|
-
* Callback invoked when a budget limit is about to be exceeded.
|
|
570
|
-
* Return 'throw' for hard stop (default — throws BudgetExceededError).
|
|
571
|
-
* Return 'continue' to allow one more unit and re-check next time.
|
|
572
|
-
* Return a Promise to ask the coordinator via `budget.threshold_reached`
|
|
573
|
-
* event (uses the same grant/deny pattern as `iteration.limit_reached`).
|
|
574
|
-
*/
|
|
575
|
-
type BudgetThresholdHandler = (info: {
|
|
576
|
-
kind: BudgetKind;
|
|
577
|
-
used: number;
|
|
578
|
-
limit: number;
|
|
579
|
-
requestDecision: () => Promise<BudgetThresholdDecision>;
|
|
580
|
-
/**
|
|
581
|
-
* Direct grant/deny hooks for SYNCHRONOUS policy or recording handlers that
|
|
582
|
-
* decide in-process without a wired `budget.threshold_reached` listener
|
|
583
|
-
* (e.g. the coordinator watchdog). `extend` patches the limits in place;
|
|
584
|
-
* `deny` records the intent to stop. Production listener-driven handlers use
|
|
585
|
-
* `requestDecision()` instead and can ignore these.
|
|
586
|
-
*/
|
|
587
|
-
extend?: (extra: Partial<BudgetLimits>) => void;
|
|
588
|
-
deny?: () => void;
|
|
589
|
-
}) => 'throw' | 'continue' | 'stop' | {
|
|
590
|
-
extend: Partial<BudgetLimits>;
|
|
591
|
-
} | Promise<BudgetThresholdDecision>;
|
|
592
|
-
/**
|
|
593
|
-
* Per-subagent budget enforcement. Each subagent gets its own instance so a
|
|
594
|
-
* runaway agent can't drain the cost ceiling of its siblings. All record/check
|
|
595
|
-
* methods are O(1) and safe to call from hot paths.
|
|
596
|
-
*
|
|
597
|
-
* Behavior without `onThreshold`: hard stops synchronously on every limit hit.
|
|
598
|
-
*
|
|
599
|
-
* Behavior with `onThreshold` and `_mode === 'auto'`: emits `budget.threshold_reached`
|
|
600
|
-
* on the EventBus and throws `BudgetThresholdSignal`. The coordinator's verdict
|
|
601
|
-
* (extend/stop) resolves the embedded promise. If no listener responds within
|
|
602
|
-
* `DECISION_TIMEOUT_MS` the decision defaults to `'stop'`.
|
|
603
|
-
*
|
|
604
|
-
* Behavior with `onThreshold` and `_mode === 'sync'`: throws `BudgetExceededError`
|
|
605
|
-
* synchronously regardless of EventBus state or listener presence. This is useful
|
|
606
|
-
* for fire-and-forget subagents that have an `onThreshold` handler for logging/metrics
|
|
607
|
-
* but are not wired into a coordinator — the `'sync'` mode makes the hard-stop
|
|
608
|
-
* behavior explicit and means tests can use `expect().toThrow()` even without
|
|
609
|
-
* a fully-wired EventBus.
|
|
610
|
-
*/
|
|
611
|
-
declare class SubagentBudget {
|
|
612
|
-
readonly limits: Readonly<BudgetLimits>;
|
|
613
|
-
/** Patch one or more budget limits in-place after construction.
|
|
614
|
-
* Used by the coordinator watchdog when granting an extension.
|
|
615
|
-
* All fields are optional — only provided fields are updated.
|
|
616
|
-
* This is the single write path for limit mutations so that future
|
|
617
|
-
* validation or side-effects live in one place (M1). */
|
|
618
|
-
patchLimits(ext: Partial<BudgetLimits>): void;
|
|
619
|
-
private iterations;
|
|
620
|
-
private toolCalls;
|
|
621
|
-
private tokenInput;
|
|
622
|
-
private tokenOutput;
|
|
623
|
-
private costUsd;
|
|
624
|
-
private startTime;
|
|
625
|
-
/**
|
|
626
|
-
* Timestamp of the most recent activity (iteration / tool call / token
|
|
627
|
-
* usage / streamed progress). Drives the idle timeout — reset by
|
|
628
|
-
* `markActivity()`. Initialised to `start()` time so a never-active agent
|
|
629
|
-
* still eventually trips its idle window.
|
|
630
|
-
*/
|
|
631
|
-
private lastActivityTime;
|
|
632
|
-
private _onThreshold;
|
|
633
|
-
private readonly _sessionId;
|
|
634
|
-
/**
|
|
635
|
-
* Hard cap on how long `_negotiateExtension` waits for the coordinator to
|
|
636
|
-
* respond before defaulting to 'stop'. Without this fallback an absent
|
|
637
|
-
* or hung listener (Director not built / event filter detached mid-run)
|
|
638
|
-
* leaves the budget over-limit and never enforces anything.
|
|
639
|
-
*/
|
|
640
|
-
private static readonly DECISION_TIMEOUT_MS;
|
|
641
|
-
/**
|
|
642
|
-
* Injected by the runner when wiring the budget to its EventBus.
|
|
643
|
-
* Used to emit `budget.threshold_reached` events in `'auto'` mode.
|
|
644
|
-
*/
|
|
645
|
-
_events?: EventBus | undefined;
|
|
646
|
-
/**
|
|
647
|
-
* Guard against dual-path races between the coordinator watchdog
|
|
648
|
-
* (`executeWithTimeout`) and the budget's own `checkTimeout()`.
|
|
649
|
-
* Both paths detect `elapsed >= timeoutMs` and can emit
|
|
650
|
-
* `budget.threshold_reached` for kind `'timeout'` simultaneously.
|
|
651
|
-
* Set to the current `timeoutMs` ceiling by the coordinator BEFORE
|
|
652
|
-
* calling `onThreshold`, and cleared after the negotiation resolves.
|
|
653
|
-
* `checkTimeout()` skips its wall-clock check while this is set so
|
|
654
|
-
* the coordinator's watchdog is the sole source of wall-clock timeout
|
|
655
|
-
* events — `checkTimeout()` focuses exclusively on `idle_timeout`.
|
|
656
|
-
*/
|
|
657
|
-
private _watchdogActive;
|
|
658
|
-
/** Returns the timeout ceiling currently being negotiated by the watchdog,
|
|
659
|
-
* or `undefined` when no wall-clock negotiation is in flight.
|
|
660
|
-
* Used by `executeWithTimeout` to detect a stale lock (M3). */
|
|
661
|
-
get watchdogActive(): number | undefined;
|
|
662
|
-
/** Called by the coordinator watchdog BEFORE calling `onThreshold` so that
|
|
663
|
-
* `checkTimeout()` skips its wall-clock check for this ceiling. Prevents
|
|
664
|
-
* the budget's own `checkTimeout()` from emitting a second
|
|
665
|
-
* `budget.threshold_reached` event while the watchdog is already
|
|
666
|
-
* negotiating the same wall-clock deadline (C1). */
|
|
667
|
-
setWatchdogNegotiation(timeoutMs: number): void;
|
|
668
|
-
/** Clears the watchdog guard after negotiation resolves. Called in the
|
|
669
|
-
* `finally` block of both the pre-empt and deadline branches so it fires
|
|
670
|
-
* on every exit path: grant, deny, throw, or error. */
|
|
671
|
-
clearWatchdogNegotiation(): void;
|
|
672
|
-
/**
|
|
673
|
-
* Negotiation mode — controls whether a threshold hit tries to emit
|
|
674
|
-
* `budget.threshold_reached` and wait for a coordinator decision, or
|
|
675
|
-
* falls straight through to a synchronous hard stop.
|
|
676
|
-
*
|
|
677
|
-
* `'auto'` (default) — emit on the EventBus and wait; times out to 'stop'.
|
|
678
|
-
* `'sync'` — throw `BudgetExceededError` immediately regardless of listeners.
|
|
679
|
-
*/
|
|
680
|
-
private _mode;
|
|
681
|
-
/**
|
|
682
|
-
* Optional callback for soft-limit handling. When set, the budget will
|
|
683
|
-
* invoke it rather than throw immediately. The handler decides whether to
|
|
684
|
-
* throw synchronously, continue, or ask the coordinator for an extension.
|
|
685
|
-
*/
|
|
686
|
-
get onThreshold(): BudgetThresholdHandler | undefined;
|
|
687
|
-
set onThreshold(fn: BudgetThresholdHandler | undefined);
|
|
688
|
-
/** Returns the current negotiation mode. */
|
|
689
|
-
get mode(): BudgetNegotiationMode;
|
|
690
|
-
constructor(limits?: BudgetLimits, mode?: BudgetNegotiationMode, options?: SubagentBudgetOptions);
|
|
691
|
-
private currentSessionId;
|
|
692
|
-
start(): void;
|
|
693
|
-
/**
|
|
694
|
-
* Reset the idle clock. Called on any sign of forward progress —
|
|
695
|
-
* iterations, tool calls, token usage, and streamed tool/text progress —
|
|
696
|
-
* so a long-but-productive subagent never trips its `idleTimeoutMs`.
|
|
697
|
-
*/
|
|
698
|
-
markActivity(): void;
|
|
699
|
-
/**
|
|
700
|
-
* Milliseconds since the last activity signal. Returns 0 before `start()`
|
|
701
|
-
* (nothing to measure yet). Used by the coordinator watchdog to decide
|
|
702
|
-
* whether to re-arm (still active) or reap (genuinely idle).
|
|
703
|
-
*/
|
|
704
|
-
idleMs(): number;
|
|
705
|
-
/** Returns true if we're within 10% of any limit — useful for pre-flight checks. */
|
|
706
|
-
isNearLimit(): boolean;
|
|
707
|
-
/**
|
|
708
|
-
* Synchronous budget check. Always throws synchronously so callers (especially
|
|
709
|
-
* test event handlers using `expect().toThrow()`) get an unhandled rejection
|
|
710
|
-
* when the budget is exceeded without a handler.
|
|
711
|
-
*
|
|
712
|
-
* Decision table:
|
|
713
|
-
* - no `onThreshold` handler → throw `BudgetExceededError` (hard stop, always)
|
|
714
|
-
* - `mode === 'sync'` → throw `BudgetExceededError` (hard stop, always)
|
|
715
|
-
* - `mode === 'auto'` + no listener → throw `BudgetExceededError` (hard stop; no one to ask)
|
|
716
|
-
* - `mode === 'auto'` + listener → throw `BudgetThresholdSignal` with async decision promise
|
|
717
|
-
*/
|
|
718
|
-
/**
|
|
719
|
-
* Collects all exceeded budget kinds into a single NOOP-free negotiation.
|
|
720
|
-
* Called by recordIteration / recordToolCall / recordUsage — each may call
|
|
721
|
-
* this for its own kind. The first call starts the negotiation and stores
|
|
722
|
-
* the Promise in _pendingNegotiation. Subsequent calls for DIFFERENT
|
|
723
|
-
* kinds (while a negotiation is in flight) are NOOPs — they don't start
|
|
724
|
-
* new conversations with the coordinator. This prevents an EventBus flood
|
|
725
|
-
* when multiple budget kinds are exceeded simultaneously in one iteration.
|
|
726
|
-
*
|
|
727
|
-
* Returns the kinds that were found to be exceeded (for logging/debugging).
|
|
728
|
-
*/
|
|
729
|
-
private checkLimits;
|
|
730
|
-
/**
|
|
731
|
-
* Invoke `onThreshold` once for `entry` on the NO-LISTENER path and report
|
|
732
|
-
* whether it decided synchronously. Returns `true` when the handler returned
|
|
733
|
-
* a synchronous decision (already honored — an `extend` patched the limits),
|
|
734
|
-
* or `false` when it returned a Promise (async; the caller hard-stops, since
|
|
735
|
-
* there is no listener to resolve the negotiation). The handler is given the
|
|
736
|
-
* full info shape (`requestDecision` plus direct `extend`/`deny`) so both
|
|
737
|
-
* recording handlers and policy handlers work without a wired listener.
|
|
738
|
-
*/
|
|
739
|
-
private _invokeHandlerSync;
|
|
740
|
-
/**
|
|
741
|
-
* Emit `budget.threshold_reached` and resolve to the listener's verdict.
|
|
742
|
-
* Resolves to `'stop'` immediately when there is no listener (or no bus) so
|
|
743
|
-
* no negotiation can hang and no fallback timer leaks. Mirrors the
|
|
744
|
-
* coordinator watchdog's own request path so both agree on the no-listener
|
|
745
|
-
* default.
|
|
746
|
-
*/
|
|
747
|
-
private _busRequestDecision;
|
|
748
|
-
/**
|
|
749
|
-
* Per-kind in-flight negotiation Promises. Each budget kind can have its
|
|
750
|
-
* own concurrent negotiation — e.g. iterations and timeout can both
|
|
751
|
-
* be exceeded simultaneously without blocking each other. The same kind
|
|
752
|
-
* cannot start two concurrent negotiations (dedup guard).
|
|
753
|
-
* Cleared in `_negotiateExtension`'s `finally` block.
|
|
754
|
-
*/
|
|
755
|
-
private _pendingNegotiations;
|
|
756
|
-
/**
|
|
757
|
-
* Drive the threshold handler to a decision. Resolves with `'stop'`
|
|
758
|
-
* (signal the runner to abort) or `{ extend: ... }` (limits already
|
|
759
|
-
* patched in-place; the runner should not abort). Clears the
|
|
760
|
-
* per-kind slot in `_pendingNegotiations` in `finally`.
|
|
761
|
-
*
|
|
762
|
-
* The 'continue' return from a sync handler is treated as
|
|
763
|
-
* `{ extend: {} }` — keep going without patching; next overrun fires
|
|
764
|
-
* a fresh signal.
|
|
765
|
-
*/
|
|
766
|
-
private _negotiateExtension;
|
|
767
|
-
recordIteration(): void;
|
|
768
|
-
recordToolCall(): void;
|
|
769
|
-
recordUsage(usage: Usage, costUsd?: number): void;
|
|
770
|
-
/**
|
|
771
|
-
* Wall-clock / idle budget check. Delegates to `checkLimits(elapsed)`, so
|
|
772
|
-
* `timeout` and `idle_timeout` follow the SAME negotiation path as the other
|
|
773
|
-
* kinds — they are NOT a special-cased hard stop. This is deliberate: a
|
|
774
|
-
* heartbeat-aware policy (see `attachAutoExtend` and `CollabSession`) grants
|
|
775
|
-
* a timeout extension only while the agent is making progress and denies it
|
|
776
|
-
* once the agent is genuinely stuck, which is safer than an unconditional
|
|
777
|
-
* hard kill of a long-but-working agent. The runner translates the resulting
|
|
778
|
-
* `BudgetThresholdSignal` decision (`extend` → patch limits in place,
|
|
779
|
-
* `stop` → abort) just like every other kind.
|
|
780
|
-
*
|
|
781
|
-
* Decision table (same as `checkLimits`):
|
|
782
|
-
* - no `onThreshold` handler → throw `BudgetExceededError` (hard stop)
|
|
783
|
-
* - `mode === 'sync'` → throw `BudgetExceededError` (hard stop)
|
|
784
|
-
* - `mode === 'auto'` + no listener → throw `BudgetExceededError` (no one to ask)
|
|
785
|
-
* - `mode === 'auto'` + listener → throw `BudgetThresholdSignal` (negotiated;
|
|
786
|
-
* a heartbeat-aware policy may extend the timeout)
|
|
787
|
-
*/
|
|
788
|
-
checkTimeout(): void;
|
|
789
|
-
/** Returns true if a wall-clock or idle timeout has occurred without throwing. */
|
|
790
|
-
isTimedOut(): boolean;
|
|
791
|
-
usage(): BudgetUsage;
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
/** Internal, non-user-authored budget/depth inheritance for nested directors. */
|
|
795
|
-
interface SubagentSpawnLineage {
|
|
796
|
-
parentDirectorId: string;
|
|
797
|
-
/** Depth of the spawned child; root Director is depth 0. */
|
|
798
|
-
spawnDepth: number;
|
|
799
|
-
/** Hard ceiling inherited by descendants. */
|
|
800
|
-
maxSpawnDepth: number;
|
|
801
|
-
fleetBudget: {
|
|
802
|
-
maxSpawns?: number | undefined;
|
|
803
|
-
remainingSpawns?: number | undefined;
|
|
804
|
-
maxTokens?: number | undefined;
|
|
805
|
-
remainingTokens?: number | undefined;
|
|
806
|
-
maxCostUsd?: number | undefined;
|
|
807
|
-
remainingCostUsd?: number | undefined;
|
|
808
|
-
};
|
|
809
|
-
}
|
|
810
|
-
interface SubagentConfig {
|
|
811
|
-
id?: string | undefined;
|
|
812
|
-
name: string;
|
|
813
|
-
role?: string | undefined;
|
|
814
|
-
prompt?: string | undefined;
|
|
815
|
-
maxIterations?: number | undefined;
|
|
816
|
-
maxToolCalls?: number | undefined;
|
|
817
|
-
maxTokens?: number | undefined;
|
|
818
|
-
maxCostUsd?: number | undefined;
|
|
819
|
-
/** Hard wall-clock cap (ms) from start. Opt-in; prefer `idleTimeoutMs`. */
|
|
820
|
-
timeoutMs?: number | undefined;
|
|
821
|
-
/**
|
|
822
|
-
* Idle timeout (ms): reap the subagent only after this long with no
|
|
823
|
-
* activity. Resets on every iteration / tool call / streamed progress, so
|
|
824
|
-
* an actively-working agent runs until its task naturally ends. This is the
|
|
825
|
-
* default reaper for delegated subagents (see `applyRosterBudget`).
|
|
826
|
-
*/
|
|
827
|
-
idleTimeoutMs?: number | undefined;
|
|
828
|
-
/**
|
|
829
|
-
* Fraction of `timeoutMs` at which the proactive pre-empt fires (0.0–1.0).
|
|
830
|
-
* At this point the watchdog negotiates a ceiling extension while the
|
|
831
|
-
* agent is still under its limit, so a progressing agent gets its
|
|
832
|
-
* ceiling raised before ever entering a timed-out state.
|
|
833
|
-
* Defaults to `TIMEOUT_PREEMPT_FRACTION` (0.85). Lower values fire earlier;
|
|
834
|
-
* higher values fire closer to the deadline. Ignored when `timeoutMs` is unset.
|
|
835
|
-
*/
|
|
836
|
-
preemptFraction?: number | undefined;
|
|
837
|
-
tools?: string[] | undefined;
|
|
838
|
-
/**
|
|
839
|
-
* Tools to explicitly disable for this subagent. These tools will be
|
|
840
|
-
* removed from the subagent's tool list even if they are normally available.
|
|
841
|
-
* Use this to enforce constraints that the baseline prompt alone cannot
|
|
842
|
-
* fully enforce (e.g., preventing delegation by removing the delegate tool).
|
|
843
|
-
*/
|
|
844
|
-
disabledTools?: string[] | undefined;
|
|
845
|
-
/**
|
|
846
|
-
* Capability allowlist for this subagent's `AutoApprovePermissionPolicy`.
|
|
847
|
-
* Subagents run non-interactively, so the policy auto-approves only tools
|
|
848
|
-
* whose declared capabilities intersect this list; everything else is
|
|
849
|
-
* denied by the subagent guard. Defaults (when omitted) to the read-only
|
|
850
|
-
* safe set `['fs.read', 'net.outbound']`. Widen it per-spawn when a task
|
|
851
|
-
* legitimately needs more — e.g. `/techstack` adds `'fs.write'` so the
|
|
852
|
-
* subagent can write its report. Never grant `shell.*` unless the task
|
|
853
|
-
* truly requires arbitrary command execution.
|
|
854
|
-
*/
|
|
855
|
-
allowedCapabilities?: readonly string[] | undefined;
|
|
856
|
-
model?: string | undefined;
|
|
857
|
-
priority?: number | undefined;
|
|
858
|
-
/**
|
|
859
|
-
* Director-authored recursion/budget inheritance. Director.spawn overwrites
|
|
860
|
-
* caller input so a model cannot forge a shallower depth or larger budget.
|
|
861
|
-
*/
|
|
862
|
-
spawnLineage?: SubagentSpawnLineage | undefined;
|
|
863
|
-
/**
|
|
864
|
-
* Working directory for this subagent's tools. Defaults to the factory's
|
|
865
|
-
* cwd. AutoPhase sets this to a per-phase git worktree so parallel phases
|
|
866
|
-
* edit isolated checkouts instead of clobbering one shared working tree.
|
|
867
|
-
* `projectRoot` is intentionally left unchanged — tools resolve the
|
|
868
|
-
* worktree's `.git` gitlink from `cwd` while staying bounded to the repo.
|
|
869
|
-
*/
|
|
870
|
-
cwd?: string | undefined;
|
|
871
|
-
/**
|
|
872
|
-
* Git-worktree isolation override for this subagent.
|
|
873
|
-
*
|
|
874
|
-
* - `undefined` / `'auto'`: follow the fleet policy. Mutating/build-capable
|
|
875
|
-
* agents get isolated worktrees; read-only review agents can stay on the
|
|
876
|
-
* shared checkout.
|
|
877
|
-
* - `true` / `'required'`: require an isolated worktree. If allocation fails,
|
|
878
|
-
* the task fails instead of falling back to the shared cwd.
|
|
879
|
-
* - `false` / `'off'`: never allocate a worktree for this subagent.
|
|
880
|
-
*/
|
|
881
|
-
worktree?: boolean | 'auto' | 'required' | 'off' | undefined;
|
|
882
|
-
/**
|
|
883
|
-
* Provider registry id (e.g. `'anthropic'`, `'openai'`, `'google'`).
|
|
884
|
-
* Allows a director to mix providers across siblings — for example, one
|
|
885
|
-
* subagent on a planner model and another on a verifier model. Falls back to the
|
|
886
|
-
* factory's default provider when omitted, which is the legacy
|
|
887
|
-
* single-provider behavior.
|
|
888
|
-
*/
|
|
889
|
-
provider?: string | undefined;
|
|
890
|
-
/**
|
|
891
|
-
* Ordered fallback model chain for THIS subagent (entries: `model` or
|
|
892
|
-
* `provider/model`). When the subagent's primary model 429s or stream-hangs,
|
|
893
|
-
* the factory's fallback extension rotates to the next entry. Empty/undefined
|
|
894
|
-
* → the factory's own default fallback behavior (usually the leader's config).
|
|
895
|
-
*/
|
|
896
|
-
fallbackModels?: string[] | undefined;
|
|
897
|
-
/**
|
|
898
|
-
* Runtime request overrides for THIS subagent. When present, these are merged
|
|
899
|
-
* over the leader's `Config.modelRuntime` before the subagent request pipeline
|
|
900
|
-
* maps reasoning/cache/parameters onto provider requests. Used by the model
|
|
901
|
-
* matrix to give roles their own reasoning effort without changing the leader.
|
|
902
|
-
*/
|
|
903
|
-
modelRuntime?: ModelRuntimeConfig | undefined;
|
|
904
|
-
/**
|
|
905
|
-
* Per-subagent session JSONL path. When omitted the orchestrator-
|
|
906
|
-
* supplied factory derives a path under `<sessionRoot>/<runId>/`.
|
|
907
|
-
* Override to redirect the transcript elsewhere (long-term storage,
|
|
908
|
-
* a different filesystem, etc.).
|
|
909
|
-
*/
|
|
910
|
-
sessionPath?: string | undefined;
|
|
911
|
-
/**
|
|
912
|
-
* Additional text appended to the role's base system prompt. Does not
|
|
913
|
-
* replace it. Useful for last-mile guidance like "you may only call
|
|
914
|
-
* read tools, never write" or "respond in JSON only".
|
|
915
|
-
*/
|
|
916
|
-
systemPromptOverride?: string | undefined;
|
|
917
|
-
/**
|
|
918
|
-
* Domain-specific knowledge injected into the subagent's system prompt
|
|
919
|
-
* between the shared scratchpad and the override. Typically populated
|
|
920
|
-
* from SKILL.md body content matching the subagent's role (e.g. the
|
|
921
|
-
* bug-hunter skill body for a bug-hunter subagent). Keeps subagents
|
|
922
|
-
* informed of same domain patterns the host agent knows.
|
|
923
|
-
*/
|
|
924
|
-
skillContent?: string | undefined;
|
|
925
|
-
/**
|
|
926
|
-
* Routing for streaming output. `'director'` (default) forwards
|
|
927
|
-
* text/tool events to the parent's FleetBus so the director can read
|
|
928
|
-
* the subagent's stream. `'silent'` keeps everything subagent-local;
|
|
929
|
-
* the director only sees the final task result. `'user'` forwards
|
|
930
|
-
* direct to the user-facing renderer (gate this behind an explicit
|
|
931
|
-
* config flag — it can confuse the chat surface).
|
|
932
|
-
*/
|
|
933
|
-
textStream?: 'director' | 'silent' | 'user' | undefined;
|
|
934
|
-
toolStream?: 'director' | 'silent' | 'user' | undefined;
|
|
935
|
-
}
|
|
936
|
-
/**
|
|
937
|
-
* Discriminator for every distinct failure mode a subagent can hit. The
|
|
938
|
-
* coordinator's classifier (`classifySubagentError` in
|
|
939
|
-
* coordination/multi-agent-coordinator.ts) maps raw exceptions to one of
|
|
940
|
-
* these — callers (delegate tool, /agents UI, retry policies) can then
|
|
941
|
-
* branch on `kind` instead of grepping `error.message`. Each kind
|
|
942
|
-
* documents its retryability so an orchestrator can act on it without
|
|
943
|
-
* extra knowledge.
|
|
944
|
-
*/
|
|
945
|
-
type SubagentErrorKind =
|
|
946
|
-
/** Provider returned 5xx. Transient server-side issue — safe to retry with backoff. */
|
|
947
|
-
'provider_5xx'
|
|
948
|
-
/** Provider returned 429. Rate-limited — retry with `backoffMs` delay. */
|
|
949
|
-
| 'provider_rate_limit'
|
|
950
|
-
/** Provider call timed out at the network layer (TCP / TLS / read). Retry safe. */
|
|
951
|
-
| 'provider_timeout'
|
|
952
|
-
/** Provider rejected the credentials (401/403). NOT retryable — config fix required. */
|
|
953
|
-
| 'provider_auth'
|
|
954
|
-
/** Model returned a "context length exceeded" error. Retrying without trimming will fail again. */
|
|
955
|
-
| 'context_overflow'
|
|
956
|
-
/** A tool's `execute()` returned `ok:false`. Logical task failure, not a crash. */
|
|
957
|
-
| 'tool_failed'
|
|
958
|
-
/** A tool's `execute()` threw an exception. Often retryable but cause-dependent. */
|
|
959
|
-
| 'tool_threw'
|
|
960
|
-
/** Hit the per-subagent `maxIterations` budget. Either raise budget or narrow task. */
|
|
961
|
-
| 'budget_iterations'
|
|
962
|
-
/** Hit the per-subagent `maxToolCalls` budget. Either raise budget or narrow task. */
|
|
963
|
-
| 'budget_tool_calls'
|
|
964
|
-
/** Hit the per-subagent `maxTokens` budget. */
|
|
965
|
-
| 'budget_tokens'
|
|
966
|
-
/** Hit the per-subagent `maxCostUsd` budget. */
|
|
967
|
-
| 'budget_cost'
|
|
968
|
-
/** Hit the per-subagent `timeoutMs` wall-clock budget. */
|
|
969
|
-
| 'budget_timeout'
|
|
970
|
-
/** Parent agent's AbortController fired (user Ctrl+C, parent unwound, sibling failure cascade). */
|
|
971
|
-
| 'aborted_by_parent'
|
|
972
|
-
/** LLM returned end_turn with no textual content. Often a prompt issue. */
|
|
973
|
-
| 'empty_response'
|
|
974
|
-
/** Parent-child bridge transport failed (rare — IPC / writer crash). */
|
|
975
|
-
| 'bridge_failed'
|
|
976
|
-
/** Everything else. Classifier fallback — should narrow over time as new modes appear. */
|
|
977
|
-
| 'unknown';
|
|
978
|
-
/**
|
|
979
|
-
* Structured failure envelope. Replaces the prior `error?: string` so
|
|
980
|
-
* callers can switch on `kind`, respect `retryable`, and apply
|
|
981
|
-
* provider-suggested `backoffMs` instead of guessing from substring
|
|
982
|
-
* matches on the message.
|
|
983
|
-
*/
|
|
984
|
-
interface SubagentError {
|
|
985
|
-
/** Discriminator — see SubagentErrorKind doc strings for semantics. */
|
|
986
|
-
kind: SubagentErrorKind;
|
|
987
|
-
/** Human-readable summary, suitable for direct UI display. Always populated. */
|
|
988
|
-
message: string;
|
|
989
|
-
/** True if the operation can be retried as-is (possibly with backoff). */
|
|
990
|
-
retryable: boolean;
|
|
991
|
-
/** Suggested backoff before retry, in ms. Set for `provider_rate_limit` and `provider_5xx`. */
|
|
992
|
-
backoffMs?: number | undefined;
|
|
993
|
-
/** Original cause snapshot for diagnostics — never used for control flow. */
|
|
994
|
-
cause?: {
|
|
995
|
-
name: string;
|
|
996
|
-
message: string;
|
|
997
|
-
stack?: string | undefined;
|
|
998
|
-
} | undefined;
|
|
999
|
-
}
|
|
1000
|
-
/**
|
|
1001
|
-
* Bounded, best-effort work recovered before a non-successful task ended.
|
|
1002
|
-
* This is deliberately separate from `result`: callers must not mistake an
|
|
1003
|
-
* incomplete stream tail for a completed deliverable.
|
|
1004
|
-
*/
|
|
1005
|
-
interface SubagentPartialResult {
|
|
1006
|
-
/** Last useful assistant text observed, capped by the coordinator. */
|
|
1007
|
-
text: string;
|
|
1008
|
-
/** Where the snapshot came from. */
|
|
1009
|
-
source: 'stream' | 'run_result' | 'runner';
|
|
1010
|
-
capturedAt: number;
|
|
1011
|
-
}
|
|
1012
|
-
/**
|
|
1013
|
-
* Compact machine-readable result submitted independently from the agent's
|
|
1014
|
-
* human-facing final text. Additive and optional for legacy/custom runners.
|
|
1015
|
-
*/
|
|
1016
|
-
interface SubagentStructuredReport {
|
|
1017
|
-
summary: string;
|
|
1018
|
-
findings: string[];
|
|
1019
|
-
files_examined: string[];
|
|
1020
|
-
/** 0.0 (uncertain) through 1.0 (fully verified). */
|
|
1021
|
-
confidence: number;
|
|
1022
|
-
suggested_next_steps: string[];
|
|
1023
|
-
}
|
|
1024
|
-
interface TaskResult<T = unknown> {
|
|
1025
|
-
subagentId: string;
|
|
1026
|
-
taskId: string;
|
|
1027
|
-
status: 'success' | 'failed' | 'timeout' | 'stopped';
|
|
1028
|
-
result?: T | undefined;
|
|
1029
|
-
/**
|
|
1030
|
-
* Structured failure envelope. Populated whenever `status !== 'success'`.
|
|
1031
|
-
* Prefer reading `error.kind` over substring-matching `error.message`.
|
|
1032
|
-
*/
|
|
1033
|
-
error?: SubagentError | undefined;
|
|
1034
|
-
/** Verified control-plane report, when the subagent called submit_result. */
|
|
1035
|
-
report?: SubagentStructuredReport | undefined;
|
|
1036
|
-
/** Useful incomplete work captured before timeout/abort/failure. */
|
|
1037
|
-
partial?: SubagentPartialResult | undefined;
|
|
1038
|
-
iterations: number;
|
|
1039
|
-
toolCalls: number;
|
|
1040
|
-
durationMs: number;
|
|
1041
|
-
}
|
|
1042
|
-
interface TaskSpec {
|
|
1043
|
-
id: string;
|
|
1044
|
-
description: string;
|
|
1045
|
-
subagentId?: string | undefined;
|
|
1046
|
-
priority?: number | undefined;
|
|
1047
|
-
maxToolCalls?: number | undefined;
|
|
1048
|
-
timeoutMs?: number | undefined;
|
|
1049
|
-
context?: Record<string, unknown>;
|
|
1050
|
-
}
|
|
1051
|
-
interface DoneCondition {
|
|
1052
|
-
type: 'iterations' | 'tool_calls' | 'output_match' | 'custom' | 'all_tasks_done' | 'directive';
|
|
1053
|
-
maxIterations?: number | undefined;
|
|
1054
|
-
maxToolCalls?: number | undefined;
|
|
1055
|
-
pattern?: string | undefined;
|
|
1056
|
-
predicate?: string | undefined;
|
|
1057
|
-
/**
|
|
1058
|
-
* For `directive` type — stop when model emits [done] and keep going
|
|
1059
|
-
* on [continue]/[next step]/[proceed] WITHOUT returning to the outer runner.
|
|
1060
|
-
* When false (default), the runner behaves normally (one agent.run per loop).
|
|
1061
|
-
* When true, the runner passes `autonomousContinue: true` to the agent and
|
|
1062
|
-
* re-runs internally when the model signals continue.
|
|
1063
|
-
*/
|
|
1064
|
-
autonomous?: boolean | undefined;
|
|
1065
|
-
}
|
|
1066
|
-
interface MultiAgentConfig {
|
|
1067
|
-
coordinatorId: string;
|
|
1068
|
-
leaderSystemPrompt?: string | undefined;
|
|
1069
|
-
subagents?: SubagentConfig[] | undefined;
|
|
1070
|
-
maxConcurrent?: number | undefined;
|
|
1071
|
-
doneCondition: DoneCondition;
|
|
1072
|
-
timeoutMs?: number | undefined;
|
|
1073
|
-
/**
|
|
1074
|
-
* Optional default budget applied to every spawned subagent. Per-subagent
|
|
1075
|
-
* fields in `SubagentConfig` override these. Coordinator enforces them by
|
|
1076
|
-
* constructing a `SubagentBudget` per spawn — see `SubagentRunContext.budget`.
|
|
1077
|
-
*/
|
|
1078
|
-
defaultBudget?: {
|
|
1079
|
-
maxIterations?: number | undefined;
|
|
1080
|
-
maxToolCalls?: number | undefined;
|
|
1081
|
-
maxTokens?: number | undefined;
|
|
1082
|
-
maxCostUsd?: number | undefined;
|
|
1083
|
-
timeoutMs?: number | undefined;
|
|
1084
|
-
idleTimeoutMs?: number | undefined;
|
|
1085
|
-
};
|
|
1086
|
-
}
|
|
1087
|
-
interface SpawnResult {
|
|
1088
|
-
subagentId: string;
|
|
1089
|
-
agentId: string;
|
|
1090
|
-
}
|
|
1091
|
-
interface TaskDelegation {
|
|
1092
|
-
task: TaskSpec;
|
|
1093
|
-
subagentId: string;
|
|
1094
|
-
}
|
|
1095
|
-
interface CoordinatorEvents {
|
|
1096
|
-
'task.assigned': {
|
|
1097
|
-
task: TaskSpec;
|
|
1098
|
-
subagentId: string;
|
|
1099
|
-
};
|
|
1100
|
-
'task.completed': {
|
|
1101
|
-
task: TaskSpec;
|
|
1102
|
-
result: TaskResult;
|
|
1103
|
-
};
|
|
1104
|
-
'subagent.started': {
|
|
1105
|
-
subagent: SubagentConfig;
|
|
1106
|
-
};
|
|
1107
|
-
'subagent.stopped': {
|
|
1108
|
-
subagentId: string;
|
|
1109
|
-
reason: string;
|
|
1110
|
-
};
|
|
1111
|
-
done: {
|
|
1112
|
-
results: TaskResult[];
|
|
1113
|
-
totalIterations: number;
|
|
1114
|
-
};
|
|
1115
|
-
}
|
|
1116
|
-
/**
|
|
1117
|
-
* Result of {@link MultiAgentCoordinator.awaitTasksAny} — a partial drain of a
|
|
1118
|
-
* task-id batch. `completed` holds every requested id that has already
|
|
1119
|
-
* settled (at least one, unless `timedOut`); `pending` holds the rest, so the
|
|
1120
|
-
* caller can loop "handle finishers, re-await the remainder".
|
|
1121
|
-
*/
|
|
1122
|
-
interface AwaitAnyResult {
|
|
1123
|
-
completed: TaskResult[];
|
|
1124
|
-
pending: string[];
|
|
1125
|
-
/** Set when `timeoutMs` elapsed with zero completions among the requested ids. */
|
|
1126
|
-
timedOut?: boolean;
|
|
1127
|
-
}
|
|
1128
|
-
interface MultiAgentCoordinator {
|
|
1129
|
-
readonly coordinatorId: string;
|
|
1130
|
-
readonly config: MultiAgentConfig;
|
|
1131
|
-
spawn(subagent: SubagentConfig): Promise<SpawnResult>;
|
|
1132
|
-
assign(task: TaskSpec): Promise<void>;
|
|
1133
|
-
delegate(to: string, msg: BridgeMessage): Promise<void>;
|
|
1134
|
-
stop(subagentId: string): Promise<void>;
|
|
1135
|
-
stopAll(): Promise<void>;
|
|
1136
|
-
/**
|
|
1137
|
-
* Stop a subagent and remove it from the coordinator. Releases all
|
|
1138
|
-
* associated resources. The subagent id can be reused in a future spawn.
|
|
1139
|
-
*/
|
|
1140
|
-
remove(subagentId: string): Promise<void>;
|
|
1141
|
-
getStatus(): CoordinatorStatus;
|
|
1142
|
-
/**
|
|
1143
|
-
* Wait for one or more tasks to complete and return their results.
|
|
1144
|
-
* If a task is already done when called, returns immediately.
|
|
1145
|
-
* Resolves to an array in the same order as `taskIds`.
|
|
1146
|
-
*/
|
|
1147
|
-
awaitTasks(taskIds: string[]): Promise<TaskResult[]>;
|
|
1148
|
-
/**
|
|
1149
|
-
* Wait until AT LEAST ONE of the named tasks completes, then return every
|
|
1150
|
-
* requested result available at that moment plus the still-pending ids.
|
|
1151
|
-
* Ids that already completed resolve immediately (drain-what's-done). With
|
|
1152
|
-
* `timeoutMs`, resolves (never rejects) with `timedOut: true` and zero
|
|
1153
|
-
* completions when the window elapses first.
|
|
1154
|
-
*/
|
|
1155
|
-
awaitTasksAny(taskIds: string[], opts?: {
|
|
1156
|
-
timeoutMs?: number;
|
|
1157
|
-
}): Promise<AwaitAnyResult>;
|
|
1158
|
-
/** Snapshot of completed task results. */
|
|
1159
|
-
results(): readonly TaskResult[];
|
|
1160
|
-
/** Defensive snapshot of the still-queued (not yet dispatched) tasks. */
|
|
1161
|
-
listPendingTasks(): readonly TaskSpec[];
|
|
1162
|
-
/**
|
|
1163
|
-
* Re-pin a still-pending task to a different subagent (`undefined` =
|
|
1164
|
-
* unpin) and try to dispatch. Returns `false` when the task is no longer
|
|
1165
|
-
* pending (dispatched/completed/unknown) or the target subagent does not
|
|
1166
|
-
* exist. Running tasks can never be pulled — steer or terminate instead.
|
|
1167
|
-
*/
|
|
1168
|
-
retargetPendingTask(taskId: string, subagentId: string | undefined): boolean;
|
|
1169
|
-
}
|
|
1170
|
-
/**
|
|
1171
|
-
* Caller-supplied runner that actually executes a task. The coordinator
|
|
1172
|
-
* provides isolated state (own budget, own AbortSignal, own bridge handle)
|
|
1173
|
-
* and enforces concurrency limits — the runner just runs the task and reports
|
|
1174
|
-
* the outcome. This is the injection seam that decouples the coordinator
|
|
1175
|
-
* from `Agent` so it can be tested with mocks and reused for non-Agent
|
|
1176
|
-
* subagents (workers, MCP-driven subagents, etc.).
|
|
1177
|
-
*/
|
|
1178
|
-
type SubagentRunner = (task: TaskSpec, ctx: SubagentRunContext) => Promise<SubagentRunOutcome>;
|
|
1179
|
-
interface SubagentRunContext {
|
|
1180
|
-
subagentId: string;
|
|
1181
|
-
config: SubagentConfig;
|
|
1182
|
-
budget: SubagentBudget;
|
|
1183
|
-
signal: AbortSignal;
|
|
1184
|
-
/** Null until `setSubagentBridge` is called for this subagent. */
|
|
1185
|
-
bridge: AgentBridge | null;
|
|
1186
|
-
/** Publish a bounded in-memory snapshot that survives timeout races. */
|
|
1187
|
-
reportProgress?: ((partial: SubagentPartialResult) => void) | undefined;
|
|
1188
|
-
}
|
|
1189
|
-
interface SubagentRunOutcome {
|
|
1190
|
-
result?: unknown | undefined;
|
|
1191
|
-
report?: SubagentStructuredReport | undefined;
|
|
1192
|
-
iterations: number;
|
|
1193
|
-
toolCalls: number;
|
|
1194
|
-
}
|
|
1195
|
-
interface CoordinatorStatus {
|
|
1196
|
-
coordinatorId: string;
|
|
1197
|
-
subagents: {
|
|
1198
|
-
id: string;
|
|
1199
|
-
name: string;
|
|
1200
|
-
status: 'running' | 'idle' | 'stopped' | 'error';
|
|
1201
|
-
currentTask?: string | undefined;
|
|
1202
|
-
/** Cumulative budget auto-extensions granted to this subagent, when the
|
|
1203
|
-
* status is produced by a Director that tracks them. */
|
|
1204
|
-
extensions?: number | undefined;
|
|
1205
|
-
}[];
|
|
1206
|
-
pendingTasks: number;
|
|
1207
|
-
completedTasks: number;
|
|
1208
|
-
totalIterations: number;
|
|
1209
|
-
done: boolean;
|
|
1210
|
-
}
|
|
1211
|
-
interface SubagentContext {
|
|
1212
|
-
subagentId: string;
|
|
1213
|
-
tasks: TaskSpec[];
|
|
1214
|
-
/**
|
|
1215
|
-
* Two-phase initialization: `spawn()` creates the subagent before the
|
|
1216
|
-
* bridge is wired (`setSubagentBridge()`), so `parentBridge` is nullable
|
|
1217
|
-
* by design. Readers must `hasParentBridge()`-guard or null-check before
|
|
1218
|
-
* use; the prior `null as never as AgentBridge` cast was a type lie
|
|
1219
|
-
* that hid this from the compiler.
|
|
1220
|
-
*/
|
|
1221
|
-
parentBridge: AgentBridge | null;
|
|
1222
|
-
doneCondition: DoneCondition;
|
|
1223
|
-
maxConcurrent: number;
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
/**
|
|
1227
|
-
* Single fleet-wide event with subagent attribution. Whatever a child
|
|
1228
|
-
* agent emits on its own EventBus gets re-published here, prefixed with
|
|
1229
|
-
* `subagentId` so a single subscriber can multiplex across the fleet.
|
|
1230
|
-
*
|
|
1231
|
-
* The director uses `FleetBus.filter('tool.executed', …)` to see every
|
|
1232
|
-
* tool call across the fleet; the TUI uses
|
|
1233
|
-
* `FleetBus.subscribe(id, handler)` to render a per-subagent panel.
|
|
1234
|
-
*/
|
|
1235
|
-
interface FleetEvent {
|
|
1236
|
-
subagentId: string;
|
|
1237
|
-
taskId?: string | undefined;
|
|
1238
|
-
ts: number;
|
|
1239
|
-
type: string;
|
|
1240
|
-
payload: unknown;
|
|
1241
|
-
}
|
|
1242
|
-
type FleetHandler = (event: FleetEvent) => void;
|
|
1243
|
-
/**
|
|
1244
|
-
* Fan-in for per-subagent EventBuses. Each subagent's bus is plugged in
|
|
1245
|
-
* via `attach()`; the FleetBus re-emits every event with subagent
|
|
1246
|
-
* attribution. Detachment is automatic via the returned disposer — call
|
|
1247
|
-
* it when a subagent terminates so we don't leak listeners.
|
|
1248
|
-
*
|
|
1249
|
-
* The bus exposes two subscription modes: by `subagentId` (everything
|
|
1250
|
-
* from one child) and by `type` (one event-type across the fleet). They
|
|
1251
|
-
* compose — if you need a per-subagent + per-type slice, subscribe by
|
|
1252
|
-
* type and filter on `event.subagentId` in your handler.
|
|
1253
|
-
*/
|
|
1254
|
-
declare class FleetBus {
|
|
1255
|
-
private readonly byId;
|
|
1256
|
-
private readonly byType;
|
|
1257
|
-
private readonly any;
|
|
1258
|
-
/**
|
|
1259
|
-
* Hook a subagent's EventBus into the fleet. Uses `onAny()` (an alias for
|
|
1260
|
-
* `onPattern('*')`) to forward all events with subagent attribution, so
|
|
1261
|
-
* new kernel event types are automatically forwarded without any manual
|
|
1262
|
-
* registration. `subagent.*` events are excluded because they originate
|
|
1263
|
-
* from MultiAgentHost on the parent bus, not the subagent's own bus.
|
|
1264
|
-
*
|
|
1265
|
-
* Returns a disposer that detaches every subscription; call on
|
|
1266
|
-
* subagent teardown so the listeners don't outlive the run.
|
|
1267
|
-
*/
|
|
1268
|
-
attach(subagentId: string, bus: EventBus, taskId?: string): () => void;
|
|
1269
|
-
/** Subscribe to every event from one subagent. */
|
|
1270
|
-
subscribe(subagentId: string, handler: FleetHandler): () => void;
|
|
1271
|
-
/** Subscribe to one event type across all subagents. */
|
|
1272
|
-
filter(type: string, handler: FleetHandler): () => void;
|
|
1273
|
-
/** Subscribe to literally everything. The fleet roll-up uses this. */
|
|
1274
|
-
onAny(handler: FleetHandler): () => void;
|
|
1275
|
-
emit(event: FleetEvent): void;
|
|
1276
|
-
clear(): void;
|
|
1277
|
-
}
|
|
1278
|
-
/**
|
|
1279
|
-
* Roll-up of token usage + cost across an entire director run. The
|
|
1280
|
-
* director's `fleet` tool returns this so the model can reason
|
|
1281
|
-
* about budget in its next turn ("the researcher already burned $0.40,
|
|
1282
|
-
* lean on summaries for the next task").
|
|
1283
|
-
*/
|
|
1284
|
-
interface FleetUsage {
|
|
1285
|
-
total: {
|
|
1286
|
-
input: number;
|
|
1287
|
-
output: number;
|
|
1288
|
-
cacheRead: number;
|
|
1289
|
-
cacheWrite: number;
|
|
1290
|
-
cost: number;
|
|
1291
|
-
};
|
|
1292
|
-
perSubagent: Record<string, SubagentUsageSnapshot>;
|
|
1293
|
-
}
|
|
1294
|
-
interface SubagentUsageSnapshot {
|
|
1295
|
-
subagentId: string;
|
|
1296
|
-
provider?: string | undefined;
|
|
1297
|
-
model?: string | undefined;
|
|
1298
|
-
input: number;
|
|
1299
|
-
output: number;
|
|
1300
|
-
cacheRead: number;
|
|
1301
|
-
cacheWrite: number;
|
|
1302
|
-
cost: number;
|
|
1303
|
-
toolCalls: number;
|
|
1304
|
-
iterations: number;
|
|
1305
|
-
startedAt: number;
|
|
1306
|
-
lastEventAt: number;
|
|
1307
|
-
}
|
|
1308
|
-
/**
|
|
1309
|
-
* Aggregates provider.response + tool.executed events from the FleetBus
|
|
1310
|
-
* into a live `FleetUsage` snapshot. Costs are computed by the caller
|
|
1311
|
-
* via a `priceLookup(subagentId)` so we don't bake provider-pricing
|
|
1312
|
-
* coupling into core; the CLI/tests supply a function that resolves
|
|
1313
|
-
* each subagent's per-token rates from the models registry.
|
|
1314
|
-
*/
|
|
1315
|
-
declare class FleetUsageAggregator {
|
|
1316
|
-
private readonly priceLookup?;
|
|
1317
|
-
private readonly metaLookup?;
|
|
1318
|
-
private readonly perSubagent;
|
|
1319
|
-
private readonly total;
|
|
1320
|
-
private readonly unsub;
|
|
1321
|
-
constructor(bus: FleetBus, priceLookup?: ((subagentId: string, provider?: string | undefined, model?: string | undefined) => {
|
|
1322
|
-
input?: number | undefined;
|
|
1323
|
-
output?: number | undefined;
|
|
1324
|
-
cacheRead?: number | undefined;
|
|
1325
|
-
cacheWrite?: number | undefined;
|
|
1326
|
-
} | undefined) | undefined, metaLookup?: ((subagentId: string) => {
|
|
1327
|
-
provider?: string | undefined;
|
|
1328
|
-
model?: string | undefined;
|
|
1329
|
-
} | undefined) | undefined);
|
|
1330
|
-
/**
|
|
1331
|
-
* Remove a terminated subagent's data from the aggregator and subtract its
|
|
1332
|
-
* contribution from the running totals. Call this when a subagent is removed
|
|
1333
|
-
* from the fleet so the aggregator doesn't accumulate unbounded data for
|
|
1334
|
-
* entities that will never emit events again.
|
|
1335
|
-
*/
|
|
1336
|
-
removeSubagent(subagentId: string): void;
|
|
1337
|
-
/** Disposes all fleet-bus subscriptions. Call when the aggregator is no longer needed. */
|
|
1338
|
-
dispose(): void;
|
|
1339
|
-
/** Live snapshot — safe to call from a tool's execute() body. */
|
|
1340
|
-
snapshot(): FleetUsage;
|
|
1341
|
-
private ensure;
|
|
1342
|
-
private onProviderResponse;
|
|
1343
|
-
private onToolExecuted;
|
|
1344
|
-
private onIterationStarted;
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
|
-
/**
|
|
1348
|
-
* Caller-supplied factory that builds an isolated `Agent` for a subagent.
|
|
1349
|
-
* The factory MUST construct a fresh `Context` per call — sharing context
|
|
1350
|
-
* between subagents defeats isolation. Each Agent should also use either
|
|
1351
|
-
* its own `EventBus` or a forwarded view, so per-subagent metrics can be
|
|
1352
|
-
* attributed correctly.
|
|
1353
|
-
*/
|
|
1354
|
-
type AgentFactory = (config: SubagentConfig) => Promise<AgentFactoryResult>;
|
|
1355
|
-
/**
|
|
1356
|
-
* Wrap a factory to automatically filter out disabled tools from subagent
|
|
1357
|
-
* configurations. This provides mechanical enforcement of tool restrictions
|
|
1358
|
-
* (e.g., preventing delegation) in addition to the baseline prompt constraint.
|
|
1359
|
-
*
|
|
1360
|
-
* The wrapper reads `config.disabledTools` and removes those tools from the
|
|
1361
|
-
* agent's tool registry before returning.
|
|
1362
|
-
*
|
|
1363
|
-
* Usage:
|
|
1364
|
-
* const filteredFactory = withDisabledToolFiltering(originalFactory);
|
|
1365
|
-
* const runner = makeAgentSubagentRunner({ factory: filteredFactory });
|
|
1366
|
-
*/
|
|
1367
|
-
declare function withDisabledToolFiltering(factory: AgentFactory): AgentFactory;
|
|
1368
|
-
interface AgentFactoryResult {
|
|
1369
|
-
agent: Agent;
|
|
1370
|
-
/** Event bus the factory wired to this agent — required for budget hookup. */
|
|
1371
|
-
events: EventBus;
|
|
1372
|
-
/**
|
|
1373
|
-
* Optional cleanup hook invoked in the runner's `finally` block once
|
|
1374
|
-
* the task ends (success, failure, abort — same exit path). Factories
|
|
1375
|
-
* that own resources scoped to a single task (per-subagent JSONL
|
|
1376
|
-
* writers, transient providers, throwaway containers) implement this
|
|
1377
|
-
* to close them deterministically instead of relying on GC. Errors
|
|
1378
|
-
* thrown here are swallowed so a flaky cleanup can't mask the task's
|
|
1379
|
-
* real result.
|
|
1380
|
-
*/
|
|
1381
|
-
dispose?: ((() => Promise<void> | void)) | undefined;
|
|
1382
|
-
}
|
|
1383
|
-
interface AgentRunnerOptions {
|
|
1384
|
-
factory: AgentFactory;
|
|
1385
|
-
/**
|
|
1386
|
-
* Format a TaskSpec into the user input the agent will receive. Defaults
|
|
1387
|
-
* to `task.description ?? ''`. Override when subagents expect structured
|
|
1388
|
-
* input (e.g. JSON contracts, role-prefixed prompts).
|
|
1389
|
-
*/
|
|
1390
|
-
formatTaskInput?: (task: TaskSpec, config: SubagentConfig) => AgentInput;
|
|
1391
|
-
/**
|
|
1392
|
-
* When set, the runner attaches the subagent's EventBus to this FleetBus
|
|
1393
|
-
* on task start and detaches it when the task finishes. This is the
|
|
1394
|
-
* injection seam that lets the TUI fleet panel observe subagent activity
|
|
1395
|
-
* live — without it, FleetBus stays empty.
|
|
1396
|
-
*/
|
|
1397
|
-
fleetBus?: FleetBus | undefined;
|
|
1398
|
-
}
|
|
1399
|
-
/**
|
|
1400
|
-
* Builds a `SubagentRunner` that drives a real `Agent` per task while honoring
|
|
1401
|
-
* the coordinator's budget and abort signal. This is the production adapter —
|
|
1402
|
-
* the coordinator's `runner` option in CLI/TUI assemblies points here.
|
|
1403
|
-
*
|
|
1404
|
-
* Lifecycle per task:
|
|
1405
|
-
* 1. factory(config) → fresh Agent + EventBus.
|
|
1406
|
-
* 2. Subscribe to events to feed the budget (tool calls, token usage).
|
|
1407
|
-
* 3. Call agent.run(input, { signal }) — the coordinator's signal cancels.
|
|
1408
|
-
* 4. Map RunResult.status onto a `SubagentRunOutcome` or throw on failure.
|
|
1409
|
-
* 5. Unsubscribe and let the factory's resources be GC'd.
|
|
1410
|
-
*
|
|
1411
|
-
* The budget is checked synchronously from event handlers — a runaway agent
|
|
1412
|
-
* that crosses its tool-call limit triggers `BudgetExceededError`, which the
|
|
1413
|
-
* coordinator surfaces as `status: 'failed'` on the task result.
|
|
1414
|
-
*/
|
|
1415
|
-
declare function makeAgentSubagentRunner(opts: AgentRunnerOptions): SubagentRunner;
|
|
1416
|
-
|
|
1417
|
-
/**
|
|
1418
|
-
* Catalog types for the WrongStack agent fleet.
|
|
1419
|
-
*
|
|
1420
|
-
* An `AgentDefinition` bundles the runtime `SubagentConfig` (id/name/role/
|
|
1421
|
-
* prompt/tools) with two things the bare config lacks:
|
|
1422
|
-
* - a per-role `budget` tier (consumed by FLEET_ROSTER_BUDGETS), and
|
|
1423
|
-
* - dispatcher `capability` metadata (keywords + summary + phase) used by
|
|
1424
|
-
* the smart dispatcher to route a free-form task to the best agent.
|
|
1425
|
-
*
|
|
1426
|
-
* Phase files (`phase1-discovery.ts` … `phase9-meta.ts`) each export an
|
|
1427
|
-
* `AgentDefinition[]`; `index.ts` aggregates them into `AGENT_CATALOG`.
|
|
1428
|
-
* `fleet.ts` derives `FLEET_ROSTER` + `FLEET_ROSTER_BUDGETS` from the catalog.
|
|
1429
|
-
*/
|
|
1430
|
-
|
|
1431
|
-
/** Lifecycle phase grouping. Drives statusline labels + dispatcher tie-breaks. */
|
|
1432
|
-
type AgentPhase = 'discovery' | 'planning' | 'build' | 'verify' | 'review' | 'domain' | 'knowledge' | 'delivery' | 'meta';
|
|
1433
|
-
/** Per-role budget tier. Same shape as fleet.ts `FleetRosterBudget`. */
|
|
1434
|
-
interface AgentBudgetTier {
|
|
1435
|
-
timeoutMs?: number | undefined;
|
|
1436
|
-
maxIterations?: number | undefined;
|
|
1437
|
-
maxToolCalls?: number | undefined;
|
|
1438
|
-
maxTokens?: number | undefined;
|
|
1439
|
-
maxCostUsd?: number | undefined;
|
|
1440
|
-
}
|
|
1441
|
-
/** Dispatcher routing metadata. */
|
|
1442
|
-
interface AgentCapability {
|
|
1443
|
-
phase: AgentPhase;
|
|
1444
|
-
/**
|
|
1445
|
-
* One-line capability summary. Fed to the LLM dispatcher classifier as the
|
|
1446
|
-
* candidate's description, and shown to the user when explaining a routing
|
|
1447
|
-
* decision. Keep it concrete and distinct from sibling agents.
|
|
1448
|
-
*/
|
|
1449
|
-
summary: string;
|
|
1450
|
-
/**
|
|
1451
|
-
* Lowercased signal words/phrases for the heuristic dispatcher. A task whose
|
|
1452
|
-
* description contains these scores toward this agent. Order doesn't matter;
|
|
1453
|
-
* prefer specific terms ("graphql", "wcag") over generic ones ("code").
|
|
1454
|
-
*/
|
|
1455
|
-
keywords: string[];
|
|
1456
|
-
}
|
|
1457
|
-
/** A single catalog entry: runtime config + budget tier + routing metadata. */
|
|
1458
|
-
interface AgentDefinition {
|
|
1459
|
-
config: SubagentConfig;
|
|
1460
|
-
budget: AgentBudgetTier;
|
|
1461
|
-
capability: AgentCapability;
|
|
1462
|
-
}
|
|
1463
|
-
/**
|
|
1464
|
-
* Budget tiers by workload weight. Deliberately generous — the project's
|
|
1465
|
-
* existing roster uses multi-hour ceilings to avoid spurious timeouts on
|
|
1466
|
-
* monorepo-scale work, and the auto-extend handshake raises them further when
|
|
1467
|
-
* a subagent is still making progress.
|
|
1468
|
-
*/
|
|
1469
|
-
declare const LIGHT_BUDGET: AgentBudgetTier;
|
|
1470
|
-
declare const MEDIUM_BUDGET: AgentBudgetTier;
|
|
1471
|
-
declare const HEAVY_BUDGET: AgentBudgetTier;
|
|
1472
|
-
/**
|
|
1473
|
-
* Tool allowlist presets. Agents pass the smallest set that covers their job —
|
|
1474
|
-
* a planning agent should not hold `write`/`bash`, a reviewer should be
|
|
1475
|
-
* read-only. Spread + extend per-agent where a role needs one extra tool.
|
|
1476
|
-
*/
|
|
1477
|
-
declare const TOOLS: {
|
|
1478
|
-
/** Pure read/inspect — safe for analysis and review agents. */
|
|
1479
|
-
readonly read: readonly ["read", "grep", "glob", "search", "tree", "mailbox"];
|
|
1480
|
-
/** Read + structured inspection (logs, diffs, json, dependency audit). */
|
|
1481
|
-
readonly inspect: readonly ["read", "grep", "glob", "search", "tree", "json", "diff", "logs", "audit", "mailbox"];
|
|
1482
|
-
/** Read + edit (no shell). For agents that write code/docs but don't run it. */
|
|
1483
|
-
readonly write: readonly ["read", "grep", "glob", "search", "tree", "write", "edit", "replace", "patch", "mailbox"];
|
|
1484
|
-
/** Full build loop: edit + run (lint/format/typecheck/test/bash). */
|
|
1485
|
-
readonly build: readonly ["read", "grep", "glob", "search", "tree", "write", "edit", "replace", "patch", "bash", "exec", "lint", "format", "typecheck", "test", "mailbox"];
|
|
1486
|
-
/** Version control. */
|
|
1487
|
-
readonly vcs: readonly ["read", "grep", "glob", "git", "diff"];
|
|
1488
|
-
/** Dependency management + CVE audit. */
|
|
1489
|
-
readonly deps: readonly ["read", "grep", "glob", "install", "outdated", "audit", "json", "mailbox"];
|
|
1490
|
-
/** Documentation authoring. */
|
|
1491
|
-
readonly docs: readonly ["read", "grep", "glob", "search", "tree", "write", "edit", "document", "mailbox"];
|
|
1492
|
-
/** Web research. */
|
|
1493
|
-
readonly research: readonly ["read", "grep", "glob", "search", "fetch", "mailbox"];
|
|
1494
|
-
};
|
|
1495
|
-
|
|
1496
|
-
/**
|
|
1497
|
-
* Smart agent dispatcher.
|
|
1498
|
-
*
|
|
1499
|
-
* Routes a free-form task description to the best agent in the catalog using a
|
|
1500
|
-
* two-stage strategy:
|
|
1501
|
-
*
|
|
1502
|
-
* 1. Heuristic — keyword/phrase scoring against each agent's `capability`
|
|
1503
|
-
* metadata. Deterministic, instant, no provider call. Multi-word phrases
|
|
1504
|
-
* score higher than single words (they're more specific signals).
|
|
1505
|
-
*
|
|
1506
|
-
* 2. LLM fallback — when the heuristic is ambiguous (confidence below the
|
|
1507
|
-
* threshold, or no keyword hit at all) an injected `classifier` resolves
|
|
1508
|
-
* the tie. The classifier is provider-agnostic: callers wire it to any
|
|
1509
|
-
* `complete(prompt) => text` function via `makeLLMClassifier`, so core
|
|
1510
|
-
* stays free of provider dependencies and the path is unit-testable.
|
|
1511
|
-
*
|
|
1512
|
-
* If neither stage yields a confident pick, the dispatcher falls back to the
|
|
1513
|
-
* `executor` generalist rather than failing.
|
|
1514
|
-
*/
|
|
1515
|
-
|
|
1516
|
-
/** Default agent used when nothing else matches — the generalist builder. */
|
|
1517
|
-
declare const DEFAULT_DISPATCH_ROLE = "executor";
|
|
1518
|
-
interface DispatchCandidate {
|
|
1519
|
-
role: string;
|
|
1520
|
-
name: string;
|
|
1521
|
-
score: number;
|
|
1522
|
-
/** Capability keywords that matched the task text. */
|
|
1523
|
-
matched: string[];
|
|
1524
|
-
}
|
|
1525
|
-
type DispatchMethod = 'heuristic' | 'llm' | 'fallback';
|
|
1526
|
-
interface DispatchResult {
|
|
1527
|
-
role: string;
|
|
1528
|
-
definition: AgentDefinition;
|
|
1529
|
-
/** 0..1 — heuristic margin, or 1 when an LLM made a definite choice. */
|
|
1530
|
-
confidence: number;
|
|
1531
|
-
method: DispatchMethod;
|
|
1532
|
-
/** Human-readable explanation of why this agent was chosen. */
|
|
1533
|
-
reason: string;
|
|
1534
|
-
/** Runner-up candidates (top heuristic scorers), best-first. */
|
|
1535
|
-
alternatives: DispatchCandidate[];
|
|
1536
|
-
}
|
|
1537
|
-
/**
|
|
1538
|
-
* Provider-agnostic classifier seam. Given the task and the candidate agents
|
|
1539
|
-
* (role + summary), return the chosen role (and optional reason), or null to
|
|
1540
|
-
* decline. Wire via `makeLLMClassifier`.
|
|
1541
|
-
*/
|
|
1542
|
-
type DispatchClassifier = (task: string, candidates: {
|
|
1543
|
-
role: string;
|
|
1544
|
-
name: string;
|
|
1545
|
-
summary: string;
|
|
1546
|
-
}[]) => Promise<{
|
|
1547
|
-
role: string;
|
|
1548
|
-
reason?: string | undefined;
|
|
1549
|
-
} | null>;
|
|
1550
|
-
interface DispatchOptions {
|
|
1551
|
-
/** Optional LLM fallback for ambiguous tasks. */
|
|
1552
|
-
classifier?: DispatchClassifier | undefined;
|
|
1553
|
-
/** Heuristic confidence below this triggers the classifier. Default 0.4. */
|
|
1554
|
-
confidenceThreshold?: number | undefined;
|
|
1555
|
-
/** How many top candidates to offer the classifier. Default 6. */
|
|
1556
|
-
maxCandidates?: number | undefined;
|
|
1557
|
-
/** Override the catalog (testing). Defaults to the full `AGENT_CATALOG`. */
|
|
1558
|
-
catalog?: Record<string, AgentDefinition> | undefined;
|
|
1559
|
-
}
|
|
1560
|
-
/**
|
|
1561
|
-
* Score every agent against the task. A keyword hit adds 1 point; a multi-word
|
|
1562
|
-
* keyword phrase adds points equal to its word count (more specific = stronger
|
|
1563
|
-
* signal). Returns candidates sorted best-first, zero-score agents dropped.
|
|
1564
|
-
*/
|
|
1565
|
-
declare function scoreAgents(task: string, catalog?: Record<string, AgentDefinition>): DispatchCandidate[];
|
|
1566
|
-
/**
|
|
1567
|
-
* Route a task to the best agent. Async because the LLM fallback may run; the
|
|
1568
|
-
* pure-heuristic path resolves without awaiting anything.
|
|
1569
|
-
*/
|
|
1570
|
-
declare function dispatchAgent(task: string, opts?: DispatchOptions): Promise<DispatchResult>;
|
|
1571
|
-
/**
|
|
1572
|
-
* Build a `DispatchClassifier` from a minimal `complete(prompt) => text`
|
|
1573
|
-
* function. The caller supplies the provider call; this owns the prompt and
|
|
1574
|
-
* the parsing. Keeps `dispatcher` free of any provider import.
|
|
1575
|
-
*/
|
|
1576
|
-
declare function makeLLMClassifier(complete: (prompt: string) => Promise<string>): DispatchClassifier;
|
|
1577
|
-
|
|
1578
|
-
interface MultiAgentCoordinatorOptions {
|
|
1579
|
-
/**
|
|
1580
|
-
* Callback that executes a task on behalf of a subagent. Required for
|
|
1581
|
-
* `assign()` to actually run anything — without it, tasks queue forever.
|
|
1582
|
-
* The coordinator provides per-subagent isolation (own budget, own signal,
|
|
1583
|
-
* own bridge) and enforces timeout + concurrency.
|
|
1584
|
-
*/
|
|
1585
|
-
runner?: SubagentRunner | undefined;
|
|
1586
|
-
/**
|
|
1587
|
-
* Session id for EventBus/FleetBus emissions produced by this coordinator.
|
|
1588
|
-
* Accepts a getter so a long-lived coordinator follows session resume/new.
|
|
1589
|
-
*/
|
|
1590
|
-
sessionId?: BudgetSessionIdSource | undefined;
|
|
1591
|
-
}
|
|
1592
|
-
declare class DefaultMultiAgentCoordinator extends EventEmitter implements MultiAgentCoordinator {
|
|
1593
|
-
readonly coordinatorId: string;
|
|
1594
|
-
readonly config: MultiAgentConfig;
|
|
1595
|
-
private runner?;
|
|
1596
|
-
private readonly sessionId;
|
|
1597
|
-
private fleetBus?;
|
|
1598
|
-
private readonly subagents;
|
|
1599
|
-
/**
|
|
1600
|
-
* Base nickname keys already handed out this run (e.g. `einstein`, `tesla`).
|
|
1601
|
-
* Prevents two workers sharing a name. Direct `coordinator.spawn()` callers
|
|
1602
|
-
* (parallel/eternal engine, SDD parallel run) don't go through
|
|
1603
|
-
* `Director.spawn()` where nicknames are normally assigned, so the
|
|
1604
|
-
* coordinator upgrades placeholder names ("Executor", "slot-ab12cd", role
|
|
1605
|
-
* names) to memorable ones here — that's what surfaces in the fleet monitor.
|
|
1606
|
-
*/
|
|
1607
|
-
private readonly usedNicknames;
|
|
1608
|
-
/** Maps subagentId → nickname key (e.g. 'einstein'). Used to free the slot on remove(). */
|
|
1609
|
-
private readonly subagentNicknames;
|
|
1610
|
-
private pendingTasks;
|
|
1611
|
-
private completedResults;
|
|
1612
|
-
/** Prevents completedResults from growing unbounded in long-running coordinators. */
|
|
1613
|
-
private static readonly MAX_COMPLETED_RESULTS;
|
|
1614
|
-
private totalIterations;
|
|
1615
|
-
private inFlight;
|
|
1616
|
-
/**
|
|
1617
|
-
* Subagents currently being stopped. Set on entry to `stop()`, cleared
|
|
1618
|
-
* once `recordCompletion` lands the terminal TaskResult. Used by
|
|
1619
|
-
* `runDispatched` and `findIdleSubagent` to refuse mid-flight dispatch
|
|
1620
|
-
* to a subagent the caller has already asked to terminate — closes the
|
|
1621
|
-
* assign+terminate race where a fresh task could land on a worker that
|
|
1622
|
-
* was about to be killed.
|
|
1623
|
-
*/
|
|
1624
|
-
private readonly terminating;
|
|
1625
|
-
constructor(config: MultiAgentConfig, options?: MultiAgentCoordinatorOptions);
|
|
1626
|
-
private currentSessionId;
|
|
1627
|
-
/**
|
|
1628
|
-
* Replace the runner after construction. Used when the runner depends
|
|
1629
|
-
* on infrastructure (e.g. FleetBus) that isn't available until after
|
|
1630
|
-
* the coordinator's owning Director is built.
|
|
1631
|
-
*/
|
|
1632
|
-
setRunner(runner: SubagentRunner): void;
|
|
1633
|
-
/**
|
|
1634
|
-
* Wire a FleetBus for director-mode event emission. Call after the
|
|
1635
|
-
* FleetManager is constructed so the coordinator can emit lifecycle
|
|
1636
|
-
* events the TUI and monitoring tools subscribe to.
|
|
1637
|
-
*/
|
|
1638
|
-
setFleetBus(fleet: FleetBus): void;
|
|
1639
|
-
/**
|
|
1640
|
-
* Change the in-flight dispatch ceiling at runtime. Lowering does NOT
|
|
1641
|
-
* preempt running tasks — already-dispatched subagents finish their
|
|
1642
|
-
* current task; only future dispatches respect the new cap. Raising
|
|
1643
|
-
* immediately tries to fill the freed slots from the pending queue.
|
|
1644
|
-
*/
|
|
1645
|
-
setMaxConcurrent(n: number): void;
|
|
1646
|
-
/**
|
|
1647
|
-
* Upgrade a placeholder/role-derived name to a memorable scientist nickname
|
|
1648
|
-
* (e.g. "Einstein (Executor)"). A name is treated as a placeholder when it is
|
|
1649
|
-
* empty, equals the role (case-insensitive), is a generic default
|
|
1650
|
-
* ("subagent"/"adhoc"/"generic"), or is an auto-generated `slot-…` id.
|
|
1651
|
-
* Explicit, human-chosen names — including nicknames already assigned by
|
|
1652
|
-
* `Director.spawn()` — are left untouched, so this never double-assigns.
|
|
1653
|
-
*/
|
|
1654
|
-
private withNickname;
|
|
1655
|
-
spawn(subagent: SubagentConfig): Promise<SpawnResult>;
|
|
1656
|
-
assign(task: TaskSpec): Promise<void>;
|
|
1657
|
-
delegate(to: string, msg: BridgeMessage): Promise<void>;
|
|
1658
|
-
/**
|
|
1659
|
-
* Wire up the communication bridge for a subagent. Call after spawn() once
|
|
1660
|
-
* the caller has created the bidirectional connection.
|
|
1661
|
-
*/
|
|
1662
|
-
setSubagentBridge(subagentId: string, bridge: AgentBridge): void;
|
|
1663
|
-
stop(subagentId: string): Promise<void>;
|
|
1664
|
-
stopAll(): Promise<void>;
|
|
1665
|
-
/**
|
|
1666
|
-
* Get current coordinator stats for monitoring/debugging.
|
|
1667
|
-
*/
|
|
1668
|
-
getStats(): {
|
|
1669
|
-
total: number;
|
|
1670
|
-
running: number;
|
|
1671
|
-
idle: number;
|
|
1672
|
-
stopped: number;
|
|
1673
|
-
inFlight: number;
|
|
1674
|
-
pending: number;
|
|
1675
|
-
completed: number;
|
|
1676
|
-
};
|
|
1677
|
-
/** Emit a reactive coordinator.stats event on FleetBus so the TUI can subscribe. */
|
|
1678
|
-
private emitCoordinatorStats;
|
|
1679
|
-
getStatus(): CoordinatorStatus;
|
|
1680
|
-
/** Expose snapshot of completed results — useful for callers awaiting all done. */
|
|
1681
|
-
results(): readonly TaskResult[];
|
|
1682
|
-
/** Defensive snapshot of the still-queued (not yet dispatched) tasks. */
|
|
1683
|
-
listPendingTasks(): readonly TaskSpec[];
|
|
1684
|
-
/**
|
|
1685
|
-
* Re-pin a still-PENDING task to a different subagent (`undefined` =
|
|
1686
|
-
* unpin, any idle worker may take it), then try to dispatch. Returns
|
|
1687
|
-
* `false` when the task is not in the pending queue — already
|
|
1688
|
-
* dispatched, completed, or unknown. Running tasks can never be pulled;
|
|
1689
|
-
* they can only be steered or terminated. The mutation is synchronous
|
|
1690
|
-
* (same tick as the check), so it cannot race a concurrent dispatch:
|
|
1691
|
-
* `tryDispatchNext` runs on this same call stack or a later one.
|
|
1692
|
-
*
|
|
1693
|
-
* The task keeps its id, so waiters, the report-back notifier, and
|
|
1694
|
-
* checkpoint bookkeeping resolve unchanged when it eventually completes.
|
|
1695
|
-
*/
|
|
1696
|
-
retargetPendingTask(taskId: string, subagentId: string | undefined): boolean;
|
|
1697
|
-
/**
|
|
1698
|
-
* Wait for one or more tasks to complete and return their results.
|
|
1699
|
-
* If a task is already done when called, returns immediately.
|
|
1700
|
-
* Resolves to an array in the same order as `taskIds`.
|
|
1701
|
-
*/
|
|
1702
|
-
awaitTasks(taskIds: string[]): Promise<TaskResult[]>;
|
|
1703
|
-
/**
|
|
1704
|
-
* Wait until AT LEAST ONE of the named tasks completes. Returns every
|
|
1705
|
-
* requested result already available at that moment (drain-what's-done)
|
|
1706
|
-
* plus the ids still outstanding, so callers can loop "handle finishers,
|
|
1707
|
-
* re-await the remainder" instead of blocking on the whole batch.
|
|
1708
|
-
*
|
|
1709
|
-
* Unlike `awaitTasks`, this never rejects and deliberately does NOT
|
|
1710
|
-
* inherit `config.timeoutMs` — a "return whatever is done" call has no
|
|
1711
|
-
* business timing out unless the caller asks for a window explicitly.
|
|
1712
|
-
*/
|
|
1713
|
-
awaitTasksAny(taskIds: string[], opts?: {
|
|
1714
|
-
timeoutMs?: number;
|
|
1715
|
-
}): Promise<AwaitAnyResult>;
|
|
1716
|
-
/**
|
|
1717
|
-
* Manual completion — for callers that drive subagents without a runner
|
|
1718
|
-
* (e.g. external orchestrators). When a runner is configured the coordinator
|
|
1719
|
-
* calls this itself.
|
|
1720
|
-
*/
|
|
1721
|
-
completeTask(result: TaskResult): void;
|
|
1722
|
-
private tryDispatchNext;
|
|
1723
|
-
private canDispatch;
|
|
1724
|
-
private takeNextDispatchableTask;
|
|
1725
|
-
private findIdleSubagent;
|
|
1726
|
-
private isIdleSubagent;
|
|
1727
|
-
/**
|
|
1728
|
-
* Returns true iff at least one spawned subagent could still
|
|
1729
|
-
* process a task. A "live" subagent is one that is not stopped
|
|
1730
|
-
* AND not mid-termination — `running` workers count because they
|
|
1731
|
-
* will eventually finish and become idle.
|
|
1732
|
-
*
|
|
1733
|
-
* When no subagent has ever been spawned, returns `true` so a
|
|
1734
|
-
* pre-spawn `assign()` simply queues (legacy behaviour). The
|
|
1735
|
-
* dead-end detection only fires after `stop()` has retired every
|
|
1736
|
-
* spawned worker.
|
|
1737
|
-
*
|
|
1738
|
-
* Used by `tryDispatchNext` to detect a dead-end pending queue.
|
|
1739
|
-
*/
|
|
1740
|
-
private hasLiveSubagent;
|
|
1741
|
-
/**
|
|
1742
|
-
* Drain every pending task with a synthetic `aborted_by_parent`
|
|
1743
|
-
* completion event. Same shape as the `stopAll()` drain — we go
|
|
1744
|
-
* around `recordCompletion` because pending tasks were never
|
|
1745
|
-
* counted in `inFlight` and routing them through would trip the
|
|
1746
|
-
* underflow guard on every task after the first.
|
|
1747
|
-
*/
|
|
1748
|
-
private drainPendingAsAborted;
|
|
1749
|
-
/**
|
|
1750
|
-
* Emit a synthetic `stopped`/`aborted_by_parent` completion for a single
|
|
1751
|
-
* PENDING task — one that was never counted in `inFlight`. This MUST bypass
|
|
1752
|
-
* `recordCompletion`: that path does `inFlight--`, which for a pending task
|
|
1753
|
-
* steals a decrement from a genuinely in-flight task and trips the underflow
|
|
1754
|
-
* guard — suppressing that real task's `task.completed` and hanging its
|
|
1755
|
-
* `awaitTasks()` caller. Pushes the result and fires the event directly.
|
|
1756
|
-
*/
|
|
1757
|
-
private emitPendingAborted;
|
|
1758
|
-
private runDispatched;
|
|
1759
|
-
private executeWithTimeout;
|
|
1760
|
-
private recordCompletion;
|
|
1761
|
-
/**
|
|
1762
|
-
* Stop a subagent and remove it from the coordinator. Releases all
|
|
1763
|
-
* associated resources (AbortController, context, budget state).
|
|
1764
|
-
* The subagent entry is deleted so the id can be reused in a future spawn.
|
|
1765
|
-
*/
|
|
1766
|
-
remove(subagentId: string): Promise<void>;
|
|
1767
|
-
private isDone;
|
|
1768
|
-
}
|
|
1769
|
-
|
|
1770
|
-
export { type DispatchResult as $, Agent as A, type BridgeTransport as B, type CoordinatorStatus as C, type DispatchClassifier as D, type AgentBudgetTier as E, FleetBus as F, type AgentCapability as G, type AgentFactoryResult as H, type AgentRunnerOptions as I, BudgetExceededError as J, type BudgetKind as K, type BudgetLimits as L, type MultiAgentConfig as M, type BudgetNegotiationMode as N, type BudgetThresholdDecision as O, type PluginAPI as P, type BudgetThresholdHandler as Q, BudgetThresholdSignal as R, type SubagentRunner as S, type TaskSpec as T, type BudgetUsage as U, type CoordinatorEvents as V, DECISION_TIMEOUT_MS as W, DEFAULT_DISPATCH_ROLE as X, type DispatchCandidate as Y, type DispatchMethod as Z, type DispatchOptions as _, type AgentFactory as a, type FleetEvent as a0, type FleetHandler as a1, HEAVY_BUDGET as a2, LIGHT_BUDGET as a3, MEDIUM_BUDGET as a4, type MultiAgentCoordinator as a5, type MultiAgentCoordinatorOptions as a6, type PluginLLMOptions as a7, type PluginLLMResult as a8, type SpawnResult as a9, SubagentBudget as aa, type SubagentContext as ab, type SubagentError as ac, type SubagentErrorKind as ad, type SubagentPartialResult as ae, type SubagentRunContext as af, type SubagentRunOutcome as ag, type SubagentSpawnLineage as ah, type SubagentStructuredReport as ai, type SubagentUsageSnapshot as aj, TIMEOUT_PREEMPT_FRACTION as ak, type TaskDelegation as al, dispatchAgent as am, makeAgentSubagentRunner as an, makeLLMClassifier as ao, scoreAgents as ap, withDisabledToolFiltering as aq, type ProviderFactory as ar, DefaultMultiAgentCoordinator as b, type DoneCondition as c, type BridgeMessage as d, type AgentBridge as e, type AgentBridgeConfig as f, type AgentPhase as g, type AgentDefinition as h, type SubagentConfig as i, type FleetUsage as j, FleetUsageAggregator as k, type TaskResult as l, type AwaitAnyResult as m, type SlashCommand as n, type PluginPipelines as o, type ToolRegistryView as p, type ProviderRegistryView as q, type MCPRegistryView as r, type SlashCommandRegistryView as s, type SessionWriterView as t, type MetricsSinkView as u, type PluginLLM as v, type PluginCapabilities as w, type PluginDependency as x, type Plugin as y, TOOLS as z };
|