@wrongstack/core 0.285.0 → 0.287.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/autophase/phase-orchestrator.d.ts.map +1 -1
- package/dist/boot.d.ts.map +1 -1
- package/dist/coordination/agent-monitor.d.ts +29 -0
- package/dist/coordination/agent-monitor.d.ts.map +1 -1
- package/dist/coordination/autonomous-brain.d.ts +0 -2
- package/dist/coordination/autonomous-brain.d.ts.map +1 -1
- package/dist/coordination/autonomous-coordinator.d.ts +4 -0
- package/dist/coordination/autonomous-coordinator.d.ts.map +1 -1
- package/dist/coordination/brain-ledger.d.ts +142 -0
- package/dist/coordination/brain-ledger.d.ts.map +1 -0
- package/dist/coordination/brain-monitor.d.ts +46 -2
- package/dist/coordination/brain-monitor.d.ts.map +1 -1
- package/dist/coordination/brain.d.ts +43 -0
- package/dist/coordination/brain.d.ts.map +1 -1
- package/dist/coordination/delegate-tool.d.ts +8 -14
- package/dist/coordination/delegate-tool.d.ts.map +1 -1
- package/dist/coordination/director/director-btw-notes.d.ts +20 -0
- package/dist/coordination/director/director-btw-notes.d.ts.map +1 -0
- package/dist/coordination/director/director-collab.d.ts +40 -0
- package/dist/coordination/director/director-collab.d.ts.map +1 -0
- package/dist/coordination/director.d.ts +28 -9
- package/dist/coordination/director.d.ts.map +1 -1
- package/dist/coordination/fleet-manager.d.ts +21 -0
- package/dist/coordination/fleet-manager.d.ts.map +1 -1
- package/dist/coordination/fleet.d.ts +6 -7
- package/dist/coordination/fleet.d.ts.map +1 -1
- package/dist/coordination/global-mailbox.d.ts +96 -21
- package/dist/coordination/global-mailbox.d.ts.map +1 -1
- package/dist/coordination/icoordinator.d.ts +1 -3
- package/dist/coordination/icoordinator.d.ts.map +1 -1
- package/dist/coordination/index.d.ts +2 -1
- package/dist/coordination/index.d.ts.map +1 -1
- package/dist/coordination/index.js +2176 -806
- package/dist/coordination/index.js.map +4 -4
- package/dist/coordination/knowledge-graph.d.ts +13 -1
- package/dist/coordination/knowledge-graph.d.ts.map +1 -1
- package/dist/coordination/mail-tools.d.ts.map +1 -1
- package/dist/coordination/mailbox-actions.d.ts +12 -13
- package/dist/coordination/mailbox-actions.d.ts.map +1 -1
- package/dist/coordination/mailbox-constants.d.ts +64 -0
- package/dist/coordination/mailbox-constants.d.ts.map +1 -0
- package/dist/coordination/mailbox-events.d.ts +32 -0
- package/dist/coordination/mailbox-events.d.ts.map +1 -0
- package/dist/coordination/mailbox-message-codec.d.ts +28 -0
- package/dist/coordination/mailbox-message-codec.d.ts.map +1 -0
- package/dist/coordination/mailbox-types.d.ts +130 -5
- package/dist/coordination/mailbox-types.d.ts.map +1 -1
- package/dist/coordination/mailbox.d.ts +21 -2
- package/dist/coordination/mailbox.d.ts.map +1 -1
- package/dist/coordination/package-author-tracker.d.ts.map +1 -1
- package/dist/coordination/subagent-result-tool.d.ts.map +1 -1
- package/dist/core/agent-loop.d.ts.map +1 -1
- package/dist/core/agent-response.d.ts +10 -1
- package/dist/core/agent-response.d.ts.map +1 -1
- package/dist/core/agent-tools.d.ts.map +1 -1
- package/dist/core/agent.d.ts +8 -0
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/context.d.ts +25 -0
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/conversation-state.d.ts +6 -0
- package/dist/core/conversation-state.d.ts.map +1 -1
- package/dist/core/fallback-model.d.ts.map +1 -1
- package/dist/core/mailbox-loop.d.ts +12 -5
- package/dist/core/mailbox-loop.d.ts.map +1 -1
- package/dist/core/system-prompt-builder.d.ts +14 -6
- package/dist/core/system-prompt-builder.d.ts.map +1 -1
- package/dist/defaults/index.d.ts +0 -1
- package/dist/defaults/index.d.ts.map +1 -1
- package/dist/defaults/index.js +1690 -1998
- package/dist/defaults/index.js.map +4 -4
- package/dist/execution/auto-compaction-middleware.d.ts +8 -1
- package/dist/execution/auto-compaction-middleware.d.ts.map +1 -1
- package/dist/execution/autonomous-runner.d.ts +7 -1
- package/dist/execution/autonomous-runner.d.ts.map +1 -1
- package/dist/execution/autonomy-brain.d.ts +72 -11
- package/dist/execution/autonomy-brain.d.ts.map +1 -1
- package/dist/execution/brain-chain.d.ts +53 -0
- package/dist/execution/brain-chain.d.ts.map +1 -0
- package/dist/execution/brain-evaluation.d.ts +66 -0
- package/dist/execution/brain-evaluation.d.ts.map +1 -0
- package/dist/execution/brain-runtime.d.ts +171 -0
- package/dist/execution/brain-runtime.d.ts.map +1 -0
- package/dist/execution/compaction-core.d.ts.map +1 -1
- package/dist/execution/council-brain.d.ts +79 -0
- package/dist/execution/council-brain.d.ts.map +1 -0
- package/dist/execution/council-orchestrator.d.ts +32 -0
- package/dist/execution/council-orchestrator.d.ts.map +1 -0
- package/dist/execution/council-personas.d.ts +19 -0
- package/dist/execution/council-personas.d.ts.map +1 -0
- package/dist/execution/council-profiles.d.ts +34 -0
- package/dist/execution/council-profiles.d.ts.map +1 -0
- package/dist/execution/council-prompts.d.ts +21 -0
- package/dist/execution/council-prompts.d.ts.map +1 -0
- package/dist/execution/council-resolution.d.ts +57 -0
- package/dist/execution/council-resolution.d.ts.map +1 -0
- package/dist/execution/design-kit-loader.d.ts.map +1 -1
- package/dist/execution/enhance-recovery.d.ts +35 -0
- package/dist/execution/enhance-recovery.d.ts.map +1 -0
- package/dist/execution/error-handler.d.ts.map +1 -1
- package/dist/execution/eternal-autonomy.d.ts +12 -0
- package/dist/execution/eternal-autonomy.d.ts.map +1 -1
- package/dist/execution/index.d.ts +11 -1
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +3076 -526
- package/dist/execution/index.js.map +4 -4
- package/dist/execution/intelligent-compactor.d.ts +18 -7
- package/dist/execution/intelligent-compactor.d.ts.map +1 -1
- package/dist/execution/one-shot-llm.d.ts +52 -0
- package/dist/execution/one-shot-llm.d.ts.map +1 -0
- package/dist/execution/parallel-eternal-engine.d.ts +12 -0
- package/dist/execution/parallel-eternal-engine.d.ts.map +1 -1
- package/dist/execution/prompt-enhancer.d.ts +23 -4
- package/dist/execution/prompt-enhancer.d.ts.map +1 -1
- package/dist/execution/prompt-enhancer.js +24 -6
- package/dist/execution/prompt-enhancer.js.map +2 -2
- package/dist/execution/selective-compactor.d.ts +4 -4
- package/dist/execution/strategy-compactor.d.ts +7 -0
- package/dist/execution/strategy-compactor.d.ts.map +1 -1
- package/dist/execution/tool-executor.d.ts +19 -5
- package/dist/execution/tool-executor.d.ts.map +1 -1
- package/dist/hooks/registry.d.ts.map +1 -1
- package/dist/hooks/runner.d.ts.map +1 -1
- package/dist/hooks/shell-executor.d.ts.map +1 -1
- package/dist/hq/alerts.d.ts +5 -0
- package/dist/hq/alerts.d.ts.map +1 -1
- package/dist/hq/auth-store.d.ts +38 -10
- package/dist/hq/auth-store.d.ts.map +1 -1
- package/dist/hq/commands.d.ts +8 -4
- package/dist/hq/commands.d.ts.map +1 -1
- package/dist/hq/cost-bridge.d.ts +5 -3
- package/dist/hq/cost-bridge.d.ts.map +1 -1
- package/dist/hq/factory.d.ts +3 -0
- package/dist/hq/factory.d.ts.map +1 -1
- package/dist/hq/fleet-bridge.d.ts.map +1 -1
- package/dist/hq/index.d.ts +0 -1
- package/dist/hq/index.d.ts.map +1 -1
- package/dist/hq/index.js +1016 -283
- package/dist/hq/index.js.map +4 -4
- package/dist/hq/persistence.d.ts +42 -0
- package/dist/hq/persistence.d.ts.map +1 -1
- package/dist/hq/protocol/brain.d.ts +24 -0
- package/dist/hq/protocol/brain.d.ts.map +1 -0
- package/dist/hq/protocol/browser.d.ts +12 -0
- package/dist/hq/protocol/browser.d.ts.map +1 -0
- package/dist/hq/protocol/client.d.ts +69 -0
- package/dist/hq/protocol/client.d.ts.map +1 -0
- package/dist/hq/protocol/core.d.ts +130 -0
- package/dist/hq/protocol/core.d.ts.map +1 -0
- package/dist/hq/protocol/fleet.d.ts +73 -0
- package/dist/hq/protocol/fleet.d.ts.map +1 -0
- package/dist/hq/protocol/mailbox.d.ts +76 -0
- package/dist/hq/protocol/mailbox.d.ts.map +1 -0
- package/dist/hq/protocol/mcp.d.ts +51 -0
- package/dist/hq/protocol/mcp.d.ts.map +1 -0
- package/dist/hq/protocol/project.d.ts +26 -0
- package/dist/hq/protocol/project.d.ts.map +1 -0
- package/dist/hq/protocol/session.d.ts +153 -0
- package/dist/hq/protocol/session.d.ts.map +1 -0
- package/dist/hq/protocol/tool.d.ts +31 -0
- package/dist/hq/protocol/tool.d.ts.map +1 -0
- package/dist/hq/protocol.d.ts +10 -559
- package/dist/hq/protocol.d.ts.map +1 -1
- package/dist/hq/publisher.d.ts +4 -0
- package/dist/hq/publisher.d.ts.map +1 -1
- package/dist/index.d.ts +24 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7676 -3432
- package/dist/index.js.map +4 -4
- package/dist/infrastructure/index.js +13 -11
- package/dist/infrastructure/index.js.map +2 -2
- package/dist/infrastructure/token-counter.d.ts.map +1 -1
- package/dist/kernel/events/agent-events.d.ts +283 -0
- package/dist/kernel/events/agent-events.d.ts.map +1 -0
- package/dist/kernel/events/brain-events.d.ts +176 -0
- package/dist/kernel/events/brain-events.d.ts.map +1 -0
- package/dist/kernel/events/fleet-events.d.ts +39 -0
- package/dist/kernel/events/fleet-events.d.ts.map +1 -0
- package/dist/kernel/events/memory-events.d.ts +165 -0
- package/dist/kernel/events/memory-events.d.ts.map +1 -0
- package/dist/kernel/events/provider-events.d.ts +98 -0
- package/dist/kernel/events/provider-events.d.ts.map +1 -0
- package/dist/kernel/events/sdd-events.d.ts +118 -0
- package/dist/kernel/events/sdd-events.d.ts.map +1 -0
- package/dist/kernel/events/session-events.d.ts +227 -0
- package/dist/kernel/events/session-events.d.ts.map +1 -0
- package/dist/kernel/events/tool-events.d.ts +185 -0
- package/dist/kernel/events/tool-events.d.ts.map +1 -0
- package/dist/kernel/events/worktree-events.d.ts +58 -0
- package/dist/kernel/events/worktree-events.d.ts.map +1 -0
- package/dist/kernel/events.d.ts +12 -1282
- package/dist/kernel/events.d.ts.map +1 -1
- package/dist/kernel/index.js +22 -2
- package/dist/kernel/index.js.map +2 -2
- package/dist/kernel/run-controller.d.ts +15 -0
- package/dist/kernel/run-controller.d.ts.map +1 -1
- package/dist/mailbox-attach.d.ts.map +1 -1
- package/dist/models/index.js +19 -6
- package/dist/models/index.js.map +2 -2
- package/dist/models/llm-selector.d.ts +7 -0
- package/dist/models/llm-selector.d.ts.map +1 -1
- package/dist/observability/index.js +16 -15
- package/dist/observability/index.js.map +2 -2
- package/dist/plugins/auto-review-plugin.d.ts +36 -0
- package/dist/plugins/auto-review-plugin.d.ts.map +1 -0
- package/dist/plugins/chimera-plugin.d.ts +8 -0
- package/dist/plugins/chimera-plugin.d.ts.map +1 -1
- package/dist/security/index.d.ts +1 -0
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +260 -23
- package/dist/security/index.js.map +4 -4
- package/dist/security/permission-policy-schema.d.ts +77 -0
- package/dist/security/permission-policy-schema.d.ts.map +1 -0
- package/dist/security/permission-policy.d.ts +5 -0
- package/dist/security/permission-policy.d.ts.map +1 -1
- package/dist/security/secret-scrubber.d.ts.map +1 -1
- package/dist/security/secret-vault.d.ts +9 -0
- package/dist/security/secret-vault.d.ts.map +1 -1
- package/dist/session-registry.d.ts.map +1 -1
- package/dist/skills/index.js.map +2 -2
- package/dist/storage/config-loader.d.ts +10 -0
- package/dist/storage/config-loader.d.ts.map +1 -1
- package/dist/storage/goal-kanban.d.ts +69 -0
- package/dist/storage/goal-kanban.d.ts.map +1 -0
- package/dist/storage/goal-store.d.ts +1 -1
- package/dist/storage/goal-store.d.ts.map +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +572 -879
- package/dist/storage/index.js.map +4 -4
- package/dist/storage/memory-consolidator.d.ts +9 -1
- package/dist/storage/memory-consolidator.d.ts.map +1 -1
- package/dist/storage/plan-store.d.ts +1 -1
- package/dist/storage/plan-store.d.ts.map +1 -1
- package/dist/storage/queue-store.d.ts +4 -0
- package/dist/storage/queue-store.d.ts.map +1 -1
- package/dist/storage/session-store.d.ts +9 -0
- package/dist/storage/session-store.d.ts.map +1 -1
- package/dist/storage/task-store.d.ts +1 -1
- package/dist/storage/task-store.d.ts.map +1 -1
- package/dist/storage/todos-checkpoint.d.ts +2 -2
- package/dist/storage/todos-checkpoint.d.ts.map +1 -1
- package/dist/tools/council-tool.d.ts +25 -0
- package/dist/tools/council-tool.d.ts.map +1 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1884 -12
- package/dist/tools/index.js.map +4 -4
- package/dist/tools/one-shot-llm-tool.d.ts +51 -0
- package/dist/tools/one-shot-llm-tool.d.ts.map +1 -0
- package/dist/types/config.d.ts +236 -4
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/context-window.d.ts.map +1 -1
- package/dist/types/council.d.ts +134 -0
- package/dist/types/council.d.ts.map +1 -0
- package/dist/types/default-config.d.ts +3 -3
- package/dist/types/hooks.d.ts +14 -0
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +40 -8
- package/dist/types/index.js.map +3 -3
- package/dist/types/multi-agent.d.ts +8 -0
- package/dist/types/multi-agent.d.ts.map +1 -1
- package/dist/types/observability.d.ts +5 -0
- package/dist/types/observability.d.ts.map +1 -1
- package/dist/types/one-shot-llm.d.ts +128 -0
- package/dist/types/one-shot-llm.d.ts.map +1 -0
- package/dist/types/plugin.d.ts +6 -0
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/provider.d.ts +17 -0
- package/dist/types/provider.d.ts.map +1 -1
- package/dist/types/system-prompt.d.ts +2 -1
- package/dist/types/system-prompt.d.ts.map +1 -1
- package/dist/types/tool-executor.d.ts +10 -0
- package/dist/types/tool-executor.d.ts.map +1 -1
- package/dist/types/tool.d.ts +7 -0
- package/dist/types/tool.d.ts.map +1 -1
- package/dist/utils/atomic-write.d.ts.map +1 -1
- package/dist/utils/glob-expand.d.ts.map +1 -1
- package/dist/utils/incoming-images.d.ts +39 -0
- package/dist/utils/incoming-images.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +156 -11
- package/dist/utils/index.js.map +4 -4
- package/dist/utils/tool-wire-compact.d.ts +1 -0
- package/dist/utils/tool-wire-compact.d.ts.map +1 -1
- package/dist/utils/wstack-paths.d.ts +20 -4
- package/dist/utils/wstack-paths.d.ts.map +1 -1
- package/dist/worktree/worktree-manager.d.ts +13 -4
- package/dist/worktree/worktree-manager.d.ts.map +1 -1
- package/instructions/agents/browser.md +25 -16
- package/instructions/cli/next-task-predictor.md +5 -3
- package/instructions/coordination/subagent-baseline.md +17 -2
- package/instructions/leader-after-task.md +19 -8
- package/instructions/llm/council-judge.md +19 -0
- package/instructions/llm/council-voter.md +22 -0
- package/instructions/modes/architect.md +14 -9
- package/instructions/modes/audit-lite.md +9 -7
- package/instructions/modes/brief-system.md +12 -12
- package/instructions/modes/brief.md +7 -5
- package/instructions/modes/code-auditor.md +13 -8
- package/instructions/modes/code-reviewer.md +13 -8
- package/instructions/modes/debug-lite.md +7 -6
- package/instructions/modes/debugger.md +13 -9
- package/instructions/modes/devops.md +13 -9
- package/instructions/modes/plan-lite.md +7 -6
- package/instructions/modes/refactor-lite.md +7 -6
- package/instructions/modes/refactorer.md +14 -9
- package/instructions/modes/research-lite.md +8 -6
- package/instructions/modes/research-web.md +18 -55
- package/instructions/modes/review-lite.md +7 -6
- package/instructions/modes/teach-system.md +15 -15
- package/instructions/modes/teach.md +13 -12
- package/instructions/modes/test-lite.md +6 -5
- package/instructions/modes/tester.md +13 -9
- package/instructions/modes/ui-design.md +14 -8
- package/instructions/sections/tool/commit-hygiene.md +1 -7
- package/instructions/sections/tool/common-patterns.md +7 -1
- package/instructions/sections/tool/delegation-full.md +3 -31
- package/instructions/sections/tool/mailbox-compact.md +1 -1
- package/instructions/sections/tool/mailbox-full.md +6 -22
- package/instructions/system.md +294 -8
- package/package.json +2 -2
- package/skills/docker-deploy/SKILL.md +1 -1
- package/skills/mailbox-bridge/SKILL.md +16 -7
- package/skills/output-standards/SKILL.md +16 -16
- package/skills/wrongstack-mailbox/SKILL.md +57 -12
- package/dist/coordination/director-construction.d.ts +0 -90
- package/dist/coordination/director-construction.d.ts.map +0 -1
- package/dist/hq/agent-bridge.d.ts +0 -27
- package/dist/hq/agent-bridge.d.ts.map +0 -1
- package/dist/plugins/git-plugin.d.ts +0 -15
- package/dist/plugins/git-plugin.d.ts.map +0 -1
- package/dist/plugins/observability-plugin.d.ts +0 -19
- package/dist/plugins/observability-plugin.d.ts.map +0 -1
- package/dist/plugins/plan-plugin.d.ts +0 -16
- package/dist/plugins/plan-plugin.d.ts.map +0 -1
- package/dist/storage/memory-store.d.ts +0 -119
- package/dist/storage/memory-store.d.ts.map +0 -1
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import type { Context } from '../../core/context.js';
|
|
2
|
+
export interface AgentEventMap {
|
|
3
|
+
/**
|
|
4
|
+
* Fired around a single Agent.run() call. Status trackers use these to
|
|
5
|
+
* measure active-run elapsed time instead of inferring it from iterations.
|
|
6
|
+
*/
|
|
7
|
+
'agent.run.started': {
|
|
8
|
+
sessionId?: string | undefined;
|
|
9
|
+
ctx: Context;
|
|
10
|
+
model: string;
|
|
11
|
+
at: string;
|
|
12
|
+
};
|
|
13
|
+
'agent.run.completed': {
|
|
14
|
+
sessionId?: string | undefined;
|
|
15
|
+
ctx: Context;
|
|
16
|
+
status: 'done' | 'failed' | 'max_iterations' | 'aborted';
|
|
17
|
+
iterations: number;
|
|
18
|
+
at: string;
|
|
19
|
+
durationMs: number;
|
|
20
|
+
};
|
|
21
|
+
'agent.run.error': {
|
|
22
|
+
sessionId?: string | undefined;
|
|
23
|
+
ctx: Context;
|
|
24
|
+
err: Error;
|
|
25
|
+
at: string;
|
|
26
|
+
durationMs: number;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Fired by the `delegate` tool right before it hands work to a subagent
|
|
30
|
+
* and blocks on the result. Lets UIs render a "started delegating" line
|
|
31
|
+
* immediately instead of looking idle for the (often minutes-long) life
|
|
32
|
+
* of the subagent. Paired with `delegate.completed`.
|
|
33
|
+
*/
|
|
34
|
+
'delegate.started': {
|
|
35
|
+
/** Parent/host session id for the delegation lifecycle. */
|
|
36
|
+
sessionId?: string | undefined;
|
|
37
|
+
/** Resolved roster role or free-form subagent name. */
|
|
38
|
+
target: string;
|
|
39
|
+
/** The task instruction handed to the subagent (untruncated — UIs trim). */
|
|
40
|
+
task: string;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Fired by the `delegate` tool once the subagent settles (success,
|
|
44
|
+
* timeout, budget exhaustion, error). Carries human-friendly, untruncated
|
|
45
|
+
* fields so UIs / the Telegram bridge can render a readable summary
|
|
46
|
+
* instead of the JSON-stringified, ~400-char-truncated `tool.executed`
|
|
47
|
+
* preview.
|
|
48
|
+
*/
|
|
49
|
+
'delegate.completed': {
|
|
50
|
+
/** Parent/host session id for the delegation lifecycle. */
|
|
51
|
+
sessionId?: string | undefined;
|
|
52
|
+
/** Resolved roster role or free-form subagent name. */
|
|
53
|
+
target: string;
|
|
54
|
+
/** The task instruction handed to the subagent. */
|
|
55
|
+
task: string;
|
|
56
|
+
/** True only when the subagent finished its task cleanly. */
|
|
57
|
+
ok: boolean;
|
|
58
|
+
/** Task status — 'success' | 'timeout' | 'host_timeout' | 'stopped' | ... */
|
|
59
|
+
status?: string | undefined;
|
|
60
|
+
/** One-line human summary (from `buildDelegateSummary`), untruncated. */
|
|
61
|
+
summary: string;
|
|
62
|
+
durationMs: number;
|
|
63
|
+
iterations: number;
|
|
64
|
+
toolCalls: number;
|
|
65
|
+
/** Estimated subagent cost in USD, from the director usage snapshot when known. */
|
|
66
|
+
costUsd?: number | undefined;
|
|
67
|
+
subagentId?: string | undefined;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Fired when a subagent produces an assistant text block that should
|
|
71
|
+
* appear in the main chat timeline (when agent streaming is enabled).
|
|
72
|
+
* The payload carries the subagent's identity, the message content,
|
|
73
|
+
* and the iteration index so UIs can render a threaded timeline.
|
|
74
|
+
*/
|
|
75
|
+
'agent.timeline.message': {
|
|
76
|
+
/** Parent/host session id this subagent timeline belongs to. */
|
|
77
|
+
sessionId?: string | undefined;
|
|
78
|
+
/** Subagent id (e.g. "bug-hunter@abc123"). */
|
|
79
|
+
subagentId: string;
|
|
80
|
+
/** Human-readable name or role label. */
|
|
81
|
+
agentName: string;
|
|
82
|
+
/** The assistant text block content, or a tool-call summary. */
|
|
83
|
+
content: string;
|
|
84
|
+
/** Timeline entry kind. */
|
|
85
|
+
kind: 'text' | 'thinking' | 'tool_use' | 'tool_result' | 'error' | 'status' | 'system';
|
|
86
|
+
/** Iteration index within the subagent's own run. */
|
|
87
|
+
iteration: number;
|
|
88
|
+
/** ISO 8601 timestamp. */
|
|
89
|
+
ts: string;
|
|
90
|
+
/** When kind='tool_use', the tool name. */
|
|
91
|
+
toolName?: string | undefined;
|
|
92
|
+
/** Running cost estimate for this subagent so far. */
|
|
93
|
+
costUsd?: number | undefined;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Fired when a subagent's status changes (started, completed, failed,
|
|
97
|
+
* timed out, stopped). UIs use this to update agent status indicators
|
|
98
|
+
* and add status-change entries to the timeline.
|
|
99
|
+
*/
|
|
100
|
+
'agent.status_changed': {
|
|
101
|
+
/** Parent/host session id this subagent status belongs to. */
|
|
102
|
+
sessionId?: string | undefined;
|
|
103
|
+
subagentId: string;
|
|
104
|
+
agentName: string;
|
|
105
|
+
status: 'spawned' | 'running' | 'completed' | 'failed' | 'timeout' | 'stopped' | 'budget_exhausted';
|
|
106
|
+
/** ISO 8601 timestamp. */
|
|
107
|
+
ts: string;
|
|
108
|
+
/** Human-readable summary or error message. */
|
|
109
|
+
summary?: string | undefined;
|
|
110
|
+
/** Task description when available. */
|
|
111
|
+
task?: string | undefined;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Subagent lifecycle events. Emitted by `MultiAgentHost` so the TUI can
|
|
115
|
+
* surface what's happening in the fleet without needing director-mode
|
|
116
|
+
* (which renders the live FleetPanel). These complement the FleetBus
|
|
117
|
+
* (director-only) by giving the TUI a uniform feed for both `/spawn`
|
|
118
|
+
* and director-orchestrated work.
|
|
119
|
+
*/
|
|
120
|
+
'subagent.spawned': {
|
|
121
|
+
/** Parent/host session id. Subagents remain children of this session. */
|
|
122
|
+
sessionId?: string | undefined;
|
|
123
|
+
subagentId: string;
|
|
124
|
+
taskId: string;
|
|
125
|
+
name?: string | undefined;
|
|
126
|
+
provider?: string | undefined;
|
|
127
|
+
model?: string | undefined;
|
|
128
|
+
description?: string | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Absolute path to the per-subagent JSONL transcript on disk, when
|
|
131
|
+
* one was created. Undefined when the subagent shares the parent
|
|
132
|
+
* session writer (in-memory or single-file configurations).
|
|
133
|
+
* Surfaced so the TUI (FleetPanel) and `/fleet log` can show the
|
|
134
|
+
* user *where* to look without computing it from the run id.
|
|
135
|
+
*/
|
|
136
|
+
transcriptPath?: string | undefined;
|
|
137
|
+
};
|
|
138
|
+
'subagent.task_started': {
|
|
139
|
+
/** Parent/host session id. */
|
|
140
|
+
sessionId?: string | undefined;
|
|
141
|
+
subagentId: string;
|
|
142
|
+
taskId: string;
|
|
143
|
+
description?: string | undefined;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Fired by `MultiAgentHost` when a subagent hits a soft budget limit
|
|
147
|
+
* and the coordinator is auto-extending. TUI renders this as a
|
|
148
|
+
* status-line notice: "⚡ agent#name hitting kind limit (used/limit) — extending".
|
|
149
|
+
* After the auto-extend the task either continues or the coordinator
|
|
150
|
+
* denies the extension and the task ends with 'budget_exhausted'.
|
|
151
|
+
*/
|
|
152
|
+
'subagent.budget_warning': {
|
|
153
|
+
/** Parent/host session id. */
|
|
154
|
+
sessionId?: string | undefined;
|
|
155
|
+
subagentId: string;
|
|
156
|
+
kind: string;
|
|
157
|
+
used: number;
|
|
158
|
+
limit: number;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Emitted when the coordinator/director actually GRANTS a budget
|
|
162
|
+
* extension to a subagent (the resolution of a `budget.threshold_reached`
|
|
163
|
+
* negotiation). Distinct from `subagent.budget_warning`, which fires when
|
|
164
|
+
* a limit is merely *hit*. UIs use this to render a persistent "⚡ extended
|
|
165
|
+
* ×N" badge so users can see how often an agent self-extended to stay
|
|
166
|
+
* alive. `totalExtensions` is the cumulative count for this subagent across
|
|
167
|
+
* all kinds; `newLimit` is the patched value for `kind`.
|
|
168
|
+
*/
|
|
169
|
+
'subagent.budget_extended': {
|
|
170
|
+
/** Parent/host session id. */
|
|
171
|
+
sessionId?: string | undefined;
|
|
172
|
+
subagentId: string;
|
|
173
|
+
kind: string;
|
|
174
|
+
newLimit: number;
|
|
175
|
+
totalExtensions: number;
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Per-tool-call event re-emitted from a subagent's own EventBus
|
|
179
|
+
* onto the host EventBus, so the TUI / non-director surfaces can
|
|
180
|
+
* render "AGENT#1 ● bash 250ms" without having to subscribe to
|
|
181
|
+
* the director-only FleetBus. Fired AFTER the tool completes
|
|
182
|
+
* (paired with `tool.executed`). Includes the subagent id so
|
|
183
|
+
* multiple parallel subagents are distinguishable.
|
|
184
|
+
*/
|
|
185
|
+
'subagent.tool_executed': {
|
|
186
|
+
/** Parent/host session id. */
|
|
187
|
+
sessionId?: string | undefined;
|
|
188
|
+
subagentId: string;
|
|
189
|
+
taskId?: string | undefined;
|
|
190
|
+
name: string;
|
|
191
|
+
durationMs: number;
|
|
192
|
+
ok: boolean;
|
|
193
|
+
input?: unknown | undefined;
|
|
194
|
+
outputBytes?: number | undefined;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* Periodic progress snapshot emitted by the subagent runner every ~25
|
|
198
|
+
* iterations so the user can track what a subagent is doing without
|
|
199
|
+
* looking at the FleetPanel. The leader's TUI surfaces this as a
|
|
200
|
+
* chat history entry: "AGENT#2 💬 L25 · 47 tools · $0.023 · doing grep..."
|
|
201
|
+
* Fired on a best-effort basis — slow subagents may skip emissions if
|
|
202
|
+
* the 25-iteration window passes while the agent is between tool calls.
|
|
203
|
+
*/
|
|
204
|
+
'subagent.iteration_summary': {
|
|
205
|
+
/** Parent/host session id. */
|
|
206
|
+
sessionId?: string | undefined;
|
|
207
|
+
subagentId: string;
|
|
208
|
+
iteration: number;
|
|
209
|
+
toolCalls: number;
|
|
210
|
+
costUsd: number;
|
|
211
|
+
currentTool?: string | undefined;
|
|
212
|
+
partialText?: string | undefined;
|
|
213
|
+
};
|
|
214
|
+
'subagent.task_completed': {
|
|
215
|
+
/** Parent/host session id. */
|
|
216
|
+
sessionId?: string | undefined;
|
|
217
|
+
subagentId: string;
|
|
218
|
+
taskId: string;
|
|
219
|
+
status: 'success' | 'failed' | 'timeout' | 'stopped';
|
|
220
|
+
iterations: number;
|
|
221
|
+
toolCalls: number;
|
|
222
|
+
durationMs: number;
|
|
223
|
+
/**
|
|
224
|
+
* Structured failure envelope when `status !== 'success'`. Carries
|
|
225
|
+
* `kind` (one of `SubagentErrorKind`), `message`, `retryable`, and
|
|
226
|
+
* optional `backoffMs`. UIs branch on `kind` to render the right
|
|
227
|
+
* chip (rate_limit vs auth vs tool_failed). The type is imported
|
|
228
|
+
* lazily as a structural object to avoid a coordination → kernel
|
|
229
|
+
* cycle in the dependency graph.
|
|
230
|
+
*/
|
|
231
|
+
error?: {
|
|
232
|
+
kind: string;
|
|
233
|
+
message: string;
|
|
234
|
+
retryable: boolean;
|
|
235
|
+
backoffMs?: number | undefined;
|
|
236
|
+
cause?: {
|
|
237
|
+
name: string | undefined;
|
|
238
|
+
message: string;
|
|
239
|
+
stack?: string | undefined;
|
|
240
|
+
} | undefined;
|
|
241
|
+
} | undefined;
|
|
242
|
+
/** Final assistant text from the subagent's last turn. */
|
|
243
|
+
finalText?: string | undefined;
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* Fired after a subagent has been removed from the live coordinator and its
|
|
247
|
+
* resources released. Surfaces must delete the agent instead of retaining a
|
|
248
|
+
* terminal/idle card indefinitely.
|
|
249
|
+
*/
|
|
250
|
+
'subagent.removed': {
|
|
251
|
+
sessionId?: string | undefined;
|
|
252
|
+
subagentId: string;
|
|
253
|
+
reason?: string | undefined;
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* Fired by the delegate tool when a subagent finishes. The agent's run
|
|
257
|
+
* loop listens for this to collect `delegateSummaries` for the RunResult,
|
|
258
|
+
* so the CLI/TUI can render flashy completion banners.
|
|
259
|
+
*/
|
|
260
|
+
'subagent.done': {
|
|
261
|
+
sessionId?: string | undefined;
|
|
262
|
+
summary: string;
|
|
263
|
+
ok: boolean;
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
* Fired by MultiAgentHost when a subagent's context window load changes.
|
|
267
|
+
* The leader agent's ctx.pct is emitted directly on the host EventBus;
|
|
268
|
+
* subagent ctx.pct events are forwarded here with subagentId attribution.
|
|
269
|
+
* TUI uses this to render live context fill bars per agent.
|
|
270
|
+
*/
|
|
271
|
+
'subagent.ctx_pct': {
|
|
272
|
+
/** Parent/host session id. */
|
|
273
|
+
sessionId?: string | undefined;
|
|
274
|
+
subagentId: string;
|
|
275
|
+
/** Fraction of maxContext currently in use, clamped to 0..1 for display. */
|
|
276
|
+
load: number;
|
|
277
|
+
/** Unclamped fraction when available. Can exceed 1 when over budget. */
|
|
278
|
+
rawLoad?: number | undefined;
|
|
279
|
+
tokens: number;
|
|
280
|
+
maxContext: number;
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=agent-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent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SAAS,CAAC;gBAAC,OAAO,EAAE,MAAM,CAAC;gBAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;aAAE,GACzE,SAAS,CAAC;SACf,GACD,SAAS,CAAC;QACd,0DAA0D;QAC1D,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAChC,CAAC;IACF;;;;OAIG;IACH,kBAAkB,EAAE;QAClB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC/B,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC7B,CAAC;IACF;;;;OAIG;IACH,eAAe,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,OAAO,CAAA;KAAE,CAAC;IAClF;;;;;OAKG;IACH,kBAAkB,EAAE;QAClB,8BAA8B;QAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC/B,UAAU,EAAE,MAAM,CAAC;QACnB,4EAA4E;QAC5E,IAAI,EAAE,MAAM,CAAC;QACb,wEAAwE;QACxE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC7B,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import type { BrainDecision, BrainDecisionRequest } from '../../coordination/brain.js';
|
|
2
|
+
import type { Usage } from '../../types/provider.js';
|
|
3
|
+
import type { BrainInterventionKind } from '../events.js';
|
|
4
|
+
export interface BrainEventMap {
|
|
5
|
+
'brain.decision_requested': {
|
|
6
|
+
sessionId?: string | undefined;
|
|
7
|
+
request: BrainDecisionRequest;
|
|
8
|
+
at: number;
|
|
9
|
+
};
|
|
10
|
+
'brain.decision_answered': {
|
|
11
|
+
sessionId?: string | undefined;
|
|
12
|
+
request: BrainDecisionRequest;
|
|
13
|
+
decision: BrainDecision;
|
|
14
|
+
at: number;
|
|
15
|
+
};
|
|
16
|
+
'brain.decision_ask_human': {
|
|
17
|
+
sessionId?: string | undefined;
|
|
18
|
+
request: BrainDecisionRequest;
|
|
19
|
+
decision: BrainDecision;
|
|
20
|
+
at: number;
|
|
21
|
+
};
|
|
22
|
+
'brain.human_answered': {
|
|
23
|
+
sessionId?: string | undefined;
|
|
24
|
+
id: string;
|
|
25
|
+
optionId?: string | undefined;
|
|
26
|
+
deny?: boolean | undefined;
|
|
27
|
+
text?: string | undefined;
|
|
28
|
+
at: number;
|
|
29
|
+
};
|
|
30
|
+
'brain.decision_denied': {
|
|
31
|
+
sessionId?: string | undefined;
|
|
32
|
+
request: BrainDecisionRequest;
|
|
33
|
+
decision: BrainDecision;
|
|
34
|
+
at: number;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Fired by the BrainMonitor when it PROACTIVELY engaged (self-activation):
|
|
38
|
+
* a watched signal (tool-failure streak, error storm, agent stall,
|
|
39
|
+
* file-churn oscillation) crossed its threshold, the Brain was consulted,
|
|
40
|
+
* and — when the decision called for it — a corrective steer was
|
|
41
|
+
* delivered to the working agent.
|
|
42
|
+
*/
|
|
43
|
+
'brain.intervention': {
|
|
44
|
+
sessionId?: string | undefined;
|
|
45
|
+
kind: BrainInterventionKind;
|
|
46
|
+
request: BrainDecisionRequest;
|
|
47
|
+
decision: BrainDecision;
|
|
48
|
+
/** True when a steer was actually delivered to the agent. */
|
|
49
|
+
intervened: boolean;
|
|
50
|
+
at: number;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Fired by the BrainDecisionLedger when the real-world outcome of an
|
|
54
|
+
* earlier Brain decision becomes observable (e.g. a budget-extended
|
|
55
|
+
* subagent's task later completed or failed, or a steered signal
|
|
56
|
+
* re-triggered). Closes the decide → observe → learn loop: outcome stats
|
|
57
|
+
* are fed back into the LLM/council decision prompts.
|
|
58
|
+
*/
|
|
59
|
+
'brain.outcome': {
|
|
60
|
+
sessionId?: string | undefined;
|
|
61
|
+
/** The `BrainDecisionRequest.id` of the decision this outcome belongs to. */
|
|
62
|
+
requestId: string;
|
|
63
|
+
outcome: 'success' | 'failure';
|
|
64
|
+
detail?: string | undefined;
|
|
65
|
+
at: number;
|
|
66
|
+
};
|
|
67
|
+
'token.threshold': {
|
|
68
|
+
sessionId?: string | undefined;
|
|
69
|
+
used: number;
|
|
70
|
+
limit: number;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Fired by `DefaultTokenCounter` after each call to `account()` /
|
|
74
|
+
* `accountWithModel()` updates its internal state. The payload carries
|
|
75
|
+
* the live snapshot so subscribers (notably the TUI's `StatusBar`) can
|
|
76
|
+
* re-render fresh token/cost/cache data immediately instead of waiting
|
|
77
|
+
* for a slow polling interval. Cost fields may be zero when the model
|
|
78
|
+
* is unknown to the ModelsRegistry — that is already signalled separately
|
|
79
|
+
* by `token.cost_estimate_unavailable`.
|
|
80
|
+
*/
|
|
81
|
+
'token.accounted': {
|
|
82
|
+
sessionId?: string | undefined;
|
|
83
|
+
usage: Usage;
|
|
84
|
+
cost: {
|
|
85
|
+
input: number;
|
|
86
|
+
output: number;
|
|
87
|
+
total: number;
|
|
88
|
+
};
|
|
89
|
+
/** Provider id that produced this usage (e.g. 'anthropic'), when known. */
|
|
90
|
+
provider?: string | undefined;
|
|
91
|
+
/** Model id the cost was priced against, when known. */
|
|
92
|
+
model?: string | undefined;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Fired when the subagent budget hits a soft limit and the coordinator
|
|
96
|
+
* is being asked for an extension. The coordinator should call `extend()`
|
|
97
|
+
* to grant more budget, or the promise auto-resolves to `deny` after
|
|
98
|
+
* `timeoutMs` (default 30s), treating it as a hard stop.
|
|
99
|
+
*
|
|
100
|
+
* This event lets the CLI/TUI observe budget pressure in real time,
|
|
101
|
+
* surface extension requests to users, and give the coordinator a
|
|
102
|
+
* hook to implement custom extension policy without coupling to the
|
|
103
|
+
* runner/budget classes.
|
|
104
|
+
*/
|
|
105
|
+
'budget.threshold_reached': {
|
|
106
|
+
sessionId?: string | undefined;
|
|
107
|
+
kind: 'iterations' | 'tool_calls' | 'tokens' | 'cost' | 'timeout' | 'idle_timeout';
|
|
108
|
+
used: number;
|
|
109
|
+
limit: number;
|
|
110
|
+
/**
|
|
111
|
+
* Call to grant more of the same budget type. `timeoutMs` extends the
|
|
112
|
+
* wall-clock budget; the coordinator's watchdog observes the patched
|
|
113
|
+
* limit and re-arms its timer for the new remainder.
|
|
114
|
+
*/
|
|
115
|
+
extend: (extra: Partial<{
|
|
116
|
+
maxIterations: number;
|
|
117
|
+
maxToolCalls: number;
|
|
118
|
+
maxTokens: number;
|
|
119
|
+
maxCostUsd: number;
|
|
120
|
+
timeoutMs: number;
|
|
121
|
+
}>) => void;
|
|
122
|
+
/** Call to deny the extension — subagent will stop. */
|
|
123
|
+
deny: () => void;
|
|
124
|
+
/** Auto-resolves to deny after timeout. */
|
|
125
|
+
timeoutMs: number;
|
|
126
|
+
};
|
|
127
|
+
'token.cost_estimate_unavailable': {
|
|
128
|
+
sessionId?: string | undefined;
|
|
129
|
+
model: string;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Fired by the multi-agent coordinator on FleetBus whenever subagent
|
|
133
|
+
* counts change (spawn/stop/complete). The TUI subscribes to render
|
|
134
|
+
* live fleet counters without polling.
|
|
135
|
+
*/
|
|
136
|
+
'coordinator.stats': {
|
|
137
|
+
sessionId?: string | undefined;
|
|
138
|
+
total: number;
|
|
139
|
+
running: number;
|
|
140
|
+
idle: number;
|
|
141
|
+
stopped: number;
|
|
142
|
+
inFlight: number;
|
|
143
|
+
pending: number;
|
|
144
|
+
completed: number;
|
|
145
|
+
/** Optional fleet-wide cost total (USD) — set by the host bridge when known. */
|
|
146
|
+
totalCostUsd?: number | undefined;
|
|
147
|
+
subagentStatuses: {
|
|
148
|
+
subagentId: string;
|
|
149
|
+
taskId: string;
|
|
150
|
+
status: string;
|
|
151
|
+
assigned: boolean;
|
|
152
|
+
/** Human label / role, when the host bridge joins Director usage data. */
|
|
153
|
+
name?: string | undefined;
|
|
154
|
+
role?: string | undefined;
|
|
155
|
+
model?: string | undefined;
|
|
156
|
+
/** Cumulative spend on this subagent (USD), when known. */
|
|
157
|
+
costUsd?: number | undefined;
|
|
158
|
+
/** Wall-clock runtime so far, in ms. */
|
|
159
|
+
runtimeMs?: number | undefined;
|
|
160
|
+
/** ISO timestamp of the most recent activity, when known. */
|
|
161
|
+
lastActivityAt?: string | undefined;
|
|
162
|
+
iterations?: number | undefined;
|
|
163
|
+
toolCalls?: number | undefined;
|
|
164
|
+
}[];
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* The coordinator's max-concurrent subagent ceiling was changed at runtime
|
|
168
|
+
* (e.g. via `/fleet concurrency <n>`). `n` is the new ceiling. Lets the
|
|
169
|
+
* TUI/WebUI reflect the updated limit without polling the host.
|
|
170
|
+
*/
|
|
171
|
+
'concurrency.changed': {
|
|
172
|
+
sessionId?: string | undefined;
|
|
173
|
+
n: number;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=brain-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brain-events.d.ts","sourceRoot":"","sources":["../../../src/kernel/events/brain-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,MAAM,WAAW,aAAa;IAC5B,0BAA0B,EAAE;QAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC/B,OAAO,EAAE,oBAAoB,CAAC;QAC9B,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;IAC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@
|
|
|
1
|
+
export interface FleetEventMap {
|
|
2
|
+
/**
|
|
3
|
+
* A supervision rule detected a condition worth engaging on (starvation,
|
|
4
|
+
* overload, backlog, stuck agent, failure streak). Fires even when the
|
|
5
|
+
* subsequent decision is "do nothing" — the signal trail is the audit log.
|
|
6
|
+
*/
|
|
7
|
+
'fleet.supervisor.signal': {
|
|
8
|
+
sessionId?: string | undefined;
|
|
9
|
+
/** Rule kind, e.g. 'pinned_starvation' | 'overloaded_worker' | 'backlog' | 'stuck_agent' | 'failure_streak' | 'idle_with_work'. */
|
|
10
|
+
kind: string;
|
|
11
|
+
subagentId?: string | undefined;
|
|
12
|
+
taskId?: string | undefined;
|
|
13
|
+
detail: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The supervisor consulted its decision path for a signal. `via:'rule'`
|
|
17
|
+
* means the deterministic policy answered without an LLM; `via:'brain'`
|
|
18
|
+
* means the tiered BrainArbiter was engaged. `outcome:'escalated'` =
|
|
19
|
+
* unresolved ask_human, no action taken.
|
|
20
|
+
*/
|
|
21
|
+
'fleet.supervisor.decision': {
|
|
22
|
+
sessionId?: string | undefined;
|
|
23
|
+
kind: string;
|
|
24
|
+
proposedAction: string;
|
|
25
|
+
via: 'rule' | 'brain';
|
|
26
|
+
outcome: 'approved' | 'denied' | 'escalated' | 'skipped';
|
|
27
|
+
rationale?: string | undefined;
|
|
28
|
+
};
|
|
29
|
+
/** The supervisor executed (or failed to execute) an approved action. */
|
|
30
|
+
'fleet.supervisor.action': {
|
|
31
|
+
sessionId?: string | undefined;
|
|
32
|
+
action: 'retarget' | 'spawn_helper' | 'steer' | 'notify_leader' | 'terminate';
|
|
33
|
+
subagentId?: string | undefined;
|
|
34
|
+
taskId?: string | undefined;
|
|
35
|
+
ok: boolean;
|
|
36
|
+
detail?: string | undefined;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=fleet-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fleet-events.d.ts","sourceRoot":"","sources":["../../../src/kernel/events/fleet-events.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAM5B;;;;OAIG;IACH,yBAAyB,EAAE;QACzB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC/B,mIAAmI;QACnI,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAChC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC5B,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF;;;;;OAKG;IACH,2BAA2B,EAAE;QAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC/B,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,EAAE,MAAM,CAAC;QACvB,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QACtB,OAAO,EAAE,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;QACzD,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAChC,CAAC;IACF,yEAAyE;IACzE,yBAAyB,EAAE;QACzB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC/B,MAAM,EAAE,UAAU,GAAG,cAAc,GAAG,OAAO,GAAG,eAAe,GAAG,WAAW,CAAC;QAC9E,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAChC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC5B,EAAE,EAAE,OAAO,CAAC;QACZ,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC7B,CAAC;CACH"}
|