@wrongstack/core 0.313.1 → 0.316.2
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/chronicle/index.js +31 -31
- package/dist/chronicle/legacy-journal-import.d.ts +0 -6
- package/dist/chronicle/metrics-ingest.d.ts +14 -0
- package/dist/chronicle/metrics-schema.d.ts +10 -1
- package/dist/chronicle/metrics-store.d.ts +20 -2
- package/dist/chronicle/project-server.js +39 -31
- package/dist/chronicle/sink.d.ts +13 -0
- package/dist/chronicle/sqlite-journal.d.ts +20 -2
- package/dist/{chunk-WOEZV3Q4.js → chunk-25LSLC3G.js} +2 -1
- package/dist/{chunk-AI4LLQ2U.js → chunk-27QIURLN.js} +229 -12
- package/dist/{chunk-I45KAW2N.js → chunk-3AGWVSS7.js} +38 -450
- package/dist/chunk-3BDV7RL3.js +211 -0
- package/dist/{chunk-NFAYHPRH.js → chunk-3ECENVHL.js} +10 -8
- package/dist/{chunk-FW5LDDMJ.js → chunk-45WI72ZB.js} +1576 -1156
- package/dist/{chunk-AT4V4XGI.js → chunk-4BMVPOHO.js} +539 -313
- package/dist/{chunk-YBUJCZ57.js → chunk-4I7HGVVA.js} +17 -5
- package/dist/{chunk-JVGPR3TS.js → chunk-4LCZVJVF.js} +7 -55
- package/dist/{chunk-4ZHTKJHM.js → chunk-4SJNS7OB.js} +36 -2
- package/dist/{chunk-AD7ZFZCS.js → chunk-5BMIE7QG.js} +3 -3
- package/dist/{chunk-IQ35HMQL.js → chunk-5YPSXQXM.js} +71 -24
- package/dist/chunk-6FHWXLPT.js +10 -0
- package/dist/{chunk-FIV4IJL7.js → chunk-6H5GEOET.js} +163 -20
- package/dist/{chunk-VB3H5WWB.js → chunk-6NWEVFEL.js} +2 -2
- package/dist/{chunk-E6I5RXVK.js → chunk-AYW5YINX.js} +2 -2
- package/dist/{chunk-DEIQMBD2.js → chunk-B7F4WVP4.js} +2 -2
- package/dist/{chunk-XQ2XGIBF.js → chunk-BPBKKBUK.js} +6 -7
- package/dist/{chunk-K4YUNKU7.js → chunk-BYD345OX.js} +2 -2
- package/dist/{chunk-LZDDLNCZ.js → chunk-C27KDLOX.js} +4 -4
- package/dist/{chunk-6AKOTGLM.js → chunk-CU546ESW.js} +7 -7
- package/dist/{chunk-ZZ4V3WIZ.js → chunk-DLHHXUAM.js} +10 -1
- package/dist/{chunk-BAKVJLEV.js → chunk-DOTHQSJ2.js} +28 -16
- package/dist/{chunk-KBZGE6LN.js → chunk-DYLPMV4Q.js} +4 -3
- package/dist/{chunk-52RTVH4M.js → chunk-F3JWNST7.js} +2 -2
- package/dist/{chunk-WEBMSQP2.js → chunk-FC2ZGRF3.js} +21 -4
- package/dist/{chunk-FHAMQS7Q.js → chunk-FCBTO76Z.js} +76 -146
- package/dist/{chunk-4LJJYBAU.js → chunk-FHZVFYSL.js} +9 -1
- package/dist/{chunk-W4A6QA3D.js → chunk-FWNLEZYG.js} +4 -3
- package/dist/{chunk-OJZEX73F.js → chunk-GDQ7CZRQ.js} +5 -1
- package/dist/{chunk-QVOVMXJR.js → chunk-GJJGJB2R.js} +32 -9
- package/dist/{chunk-4XV6IR37.js → chunk-HI3JGZR2.js} +7 -6
- package/dist/{chunk-FSWCWSTS.js → chunk-HMLIGAU7.js} +26 -26
- package/dist/{chunk-PFXFQQRT.js → chunk-HXKZ7OBQ.js} +7 -43
- package/dist/{chunk-2FQL4PDC.js → chunk-I7DALG7J.js} +5 -5
- package/dist/{chunk-GM54GJBU.js → chunk-IRUTEHCE.js} +3 -3
- package/dist/{chunk-TYW2GI5I.js → chunk-J2WRWR37.js} +40 -13
- package/dist/{chunk-ZEHUCJHY.js → chunk-JFPJ6LLQ.js} +2 -2
- package/dist/chunk-JMULFFLN.js +9 -0
- package/dist/{chunk-RD6DEE36.js → chunk-JO4MGB6Z.js} +94 -8
- package/dist/{chunk-5DSMEVA4.js → chunk-K6BXGITA.js} +7 -7
- package/dist/{chunk-O74MJHXU.js → chunk-KZMSZV32.js} +2 -2
- package/dist/{chunk-GFJOMSHG.js → chunk-LA7CLDRW.js} +6 -2
- package/dist/{chunk-M2WF6AXG.js → chunk-LSMMOS2Z.js} +7 -3
- package/dist/{chunk-ASX6AW36.js → chunk-LXWCMQNJ.js} +3 -3
- package/dist/{chunk-WZO23AWO.js → chunk-M27LIEKV.js} +72 -22
- package/dist/{chunk-JTHKOYWU.js → chunk-MJPHJRAL.js} +15 -15
- package/dist/{chunk-G5AAKEEZ.js → chunk-MTL4O5YR.js} +5 -5
- package/dist/chunk-NHJ75HXY.js +1 -0
- package/dist/{chunk-ZYU2YOJ6.js → chunk-NIOAGFPB.js} +29 -15
- package/dist/{chunk-Y2GE5TSI.js → chunk-NS52ISWS.js} +2 -2
- package/dist/{chunk-UIWONWVG.js → chunk-NSOFPKGT.js} +541 -148
- package/dist/{chunk-RCQYT2I4.js → chunk-NVIZG63R.js} +2 -2
- package/dist/{chunk-EPC3GZD4.js → chunk-OOYZPOXM.js} +2 -2
- package/dist/{chunk-7ZHZE5EO.js → chunk-OSGLYW5J.js} +2 -2
- package/dist/{chunk-CE4ZOCOI.js → chunk-PFCMSSUF.js} +9 -9
- package/dist/{chunk-GFXZTHNI.js → chunk-PGRVXIMY.js} +5 -5
- package/dist/{chunk-JJPMWPB6.js → chunk-PISBFBJN.js} +6 -6
- package/dist/chunk-POOOIWE5.js +9 -0
- package/dist/{chunk-5RP3QTRL.js → chunk-PQNS3U7Z.js} +20 -3
- package/dist/{chunk-3E244UDA.js → chunk-QSTSJOCK.js} +52 -6
- package/dist/{chunk-YUPMXOGP.js → chunk-RFQMOKWK.js} +3 -3
- package/dist/chunk-RTOTNK3P.js +484 -0
- package/dist/{chunk-SN2DQRL6.js → chunk-RXKSDUAU.js} +7 -7
- package/dist/{chunk-T3KGZBU5.js → chunk-S45JPKQN.js} +189 -43
- package/dist/{chunk-YNCVSFGF.js → chunk-SAFHACFA.js} +4 -1
- package/dist/{chunk-KI4L2DUL.js → chunk-TCCHINEF.js} +114 -19
- package/dist/{chunk-AWNQ6ED6.js → chunk-THEGTRAG.js} +7 -2
- package/dist/{chunk-2KKODIQU.js → chunk-TR4LQE7L.js} +15 -15
- package/dist/{chunk-GPQ3NJPR.js → chunk-TWJMGXCI.js} +3 -3
- package/dist/{chunk-H72H4XDU.js → chunk-U45AXT5D.js} +9 -9
- package/dist/{chunk-62V2AFVG.js → chunk-U4FWBSO3.js} +160 -73
- package/dist/{chunk-A455ATZB.js → chunk-UBGDX6FI.js} +8 -1
- package/dist/chunk-UJILKYES.js +75 -0
- package/dist/{chunk-KSJ5UTP7.js → chunk-ULMAQV3T.js} +84 -4
- package/dist/{chunk-CB2HFKTP.js → chunk-VVBP6KGT.js} +1 -1
- package/dist/{chunk-RPOA7IAE.js → chunk-W5VITDM2.js} +43 -25
- package/dist/{chunk-QRTG4XTI.js → chunk-WAHQVNWT.js} +7 -1
- package/dist/{chunk-SQP64RCS.js → chunk-WGGYRBXH.js} +3019 -2976
- package/dist/{chunk-K3G6JBUC.js → chunk-WLYKU45P.js} +679 -141
- package/dist/chunk-WP7BVANJ.js +53 -0
- package/dist/{chunk-GAZEWQEZ.js → chunk-XF4VUMKW.js} +2 -2
- package/dist/{chunk-PAAWLLZX.js → chunk-Y5YXDM7D.js} +2 -2
- package/dist/{chunk-65RDIOR2.js → chunk-YOPAUVU4.js} +162 -44
- package/dist/{chunk-FFSX2QDQ.js → chunk-YPT4A46F.js} +3 -3
- package/dist/chunk-YWXT3JNM.js +425 -0
- package/dist/{chunk-EFEHDQGY.js → chunk-ZHZ2Y2DH.js} +64 -10
- package/dist/{chunk-CQQL4ZOQ.js → chunk-ZT7JNIGX.js} +4 -3
- package/dist/coordination/agent-monitor.d.ts +9 -1
- package/dist/coordination/agent-subagent-runner.d.ts +1 -1
- package/dist/coordination/agents/agent-prompts.d.ts +8 -0
- package/dist/coordination/agents/index.d.ts +33 -1
- package/dist/coordination/agents/index.js +52 -22
- package/dist/coordination/agents/phase3-wave1-platform.d.ts +1 -3
- package/dist/coordination/agents/phase3-wave2-meta.d.ts +1 -3
- package/dist/coordination/agents/phase8-wave3-products.d.ts +1 -3
- package/dist/coordination/agents/phase9-wave4-platform-meta.d.ts +1 -3
- package/dist/coordination/agents/project-agent-identity.d.ts +11 -11
- package/dist/coordination/agents/types.d.ts +13 -2
- package/dist/coordination/brain-monitor.d.ts +30 -7
- package/dist/coordination/collab-debug.d.ts +1 -1
- package/dist/coordination/collab-pause.d.ts +1 -1
- package/dist/coordination/delegate-tool.d.ts +7 -5
- package/dist/coordination/director-kanban-queue-helpers.d.ts +1 -0
- package/dist/coordination/director-options.d.ts +7 -0
- package/dist/coordination/director-spawn-model.d.ts +17 -0
- package/dist/coordination/director-tools.d.ts +2 -2
- package/dist/coordination/director.d.ts +12 -0
- package/dist/coordination/dispatcher.d.ts +8 -0
- package/dist/coordination/fleet-bus.d.ts +35 -4
- package/dist/coordination/fleet-supervisor.d.ts +10 -2
- package/dist/coordination/fleet.d.ts +16 -7
- package/dist/coordination/index.d.ts +4 -0
- package/dist/coordination/index.js +86 -49
- package/dist/coordination/kanban-dispatch-port.d.ts +2 -2
- package/dist/coordination/mailbox-http-router.d.ts +4 -3
- package/dist/coordination/mailbox-http-validation.d.ts +1 -1
- package/dist/coordination/mailbox-project-server.js +15 -15
- package/dist/coordination/mailbox-types.d.ts +24 -6
- package/dist/coordination/model-tier-leader.d.ts +122 -0
- package/dist/coordination/model-tier.d.ts +122 -0
- package/dist/coordination/multi-agent-coordinator.d.ts +24 -0
- package/dist/coordination/origin-session.d.ts +16 -0
- package/dist/coordination/provider-status-tracker.d.ts +37 -5
- package/dist/coordination/session-note-hub.d.ts +44 -0
- package/dist/coordination/session-note-tool.d.ts +10 -0
- package/dist/core/agent.d.ts +1 -1
- package/dist/core/context.d.ts +22 -3
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +130 -38
- package/dist/core/request-conversation-binding.d.ts +37 -0
- package/dist/core/session-notes.d.ts +25 -0
- package/dist/core/system-prompt-builder.d.ts +11 -2
- package/dist/core/system-prompt-variants.d.ts +78 -0
- package/dist/design/index.js +3 -3
- package/dist/execution/auto-compaction-middleware.d.ts +11 -0
- package/dist/execution/autonomy-brain.d.ts +2 -1
- package/dist/execution/autonomy-prompt-contributor.d.ts +7 -2
- package/dist/execution/compaction-core.d.ts +4 -4
- package/dist/execution/eternal-autonomy.d.ts +1 -1
- package/dist/execution/index.js +138 -129
- package/dist/execution/model-runtime.d.ts +0 -7
- package/dist/execution/parallel-eternal-engine.d.ts +7 -7
- package/dist/extension/index.js +3 -3
- package/dist/goal/index.js +6 -6
- package/dist/hooks/index.js +3 -3
- package/dist/hq/index.js +14 -12
- package/dist/hq/persistence/event-log.d.ts +0 -1
- package/dist/hq/persistence.d.ts +4 -4
- package/dist/hq/publisher.d.ts +2 -0
- package/dist/index.d.ts +14 -11
- package/dist/index.js +728 -635
- package/dist/infrastructure/index.d.ts +4 -4
- package/dist/infrastructure/index.js +281 -260
- package/dist/infrastructure/token-counter.d.ts +9 -0
- package/dist/kernel/events/agent-events.d.ts +77 -3
- package/dist/kernel/events/brain-events.d.ts +12 -0
- package/dist/kernel/events/provider-events.d.ts +7 -1
- package/dist/kernel/events/session-events.d.ts +14 -0
- package/dist/kernel/events/tool-events.d.ts +13 -0
- package/dist/kernel/index.js +4 -4
- package/dist/mailbox-attach.d.ts +1 -1
- package/dist/models/index.js +10 -9
- package/dist/observability/event-bridge.d.ts +25 -5
- package/dist/observability/index.d.ts +9 -8
- package/dist/observability/index.js +459 -351
- package/dist/observability/tool-usage-source.d.ts +65 -0
- package/dist/plugin/index.d.ts +5 -0
- package/dist/plugin/index.js +66 -50
- package/dist/plugins/auto-review-plugin.d.ts +3 -2
- package/dist/plugins/review-finding-commands.d.ts +0 -8
- package/dist/{review-finding-store-DKAV3AS6.js → plugins/review-finding-store.js} +7 -6
- package/dist/plugins/review-finding-types.js +19 -0
- package/dist/plugins/review-report-integration.js +21 -0
- package/dist/{review-report-store-OWY3EC3N.js → plugins/review-report-store.js} +7 -6
- package/dist/plugins/review-report-types.js +13 -0
- package/dist/prompts/index.js +5 -5
- package/dist/registry/index.js +3 -3
- package/dist/registry/tool-registry.d.ts +59 -9
- package/dist/{registry-R23UBE7H.js → registry-7N4O3E7W.js} +5 -5
- package/dist/security/capabilities.d.ts +6 -0
- package/dist/security/file-permissions.d.ts +1 -1
- package/dist/security/index.js +47 -33
- package/dist/security/permission-policy.d.ts +12 -1
- package/dist/security/secret-scrubber.d.ts +15 -0
- package/dist/session-catalog/index.d.ts +1 -0
- package/dist/session-catalog/index.js +19 -14
- package/dist/session-catalog/project-server.js +30 -13
- package/dist/session-catalog/protocol.d.ts +32 -1
- package/dist/session-catalog/registry.d.ts +17 -1
- package/dist/session-catalog/session-agents.d.ts +56 -0
- package/dist/session-catalog/store-rebuild.d.ts +14 -0
- package/dist/session-catalog/store-schema.d.ts +26 -0
- package/dist/session-catalog/store.d.ts +27 -1
- package/dist/session-note-attach.d.ts +9 -0
- package/dist/skills/index.js +5 -5
- package/dist/statusline/index.d.ts +43 -0
- package/dist/statusline/index.js +102 -0
- package/dist/storage/board-store-port.d.ts +2 -2
- package/dist/storage/config-loader/in-project-policy.d.ts +29 -0
- package/dist/storage/config-loader.d.ts +3 -2
- package/dist/storage/file-session-writer.d.ts +4 -2
- package/dist/storage/goal-coordination.d.ts +6 -1
- package/dist/storage/goal-kanban.d.ts +4 -1
- package/dist/storage/index.d.ts +12 -4
- package/dist/storage/index.js +76 -61
- package/dist/storage/input-history-store.d.ts +2 -4
- package/dist/storage/memory-curator.d.ts +133 -0
- package/dist/storage/session-agent-attribution.d.ts +39 -0
- package/dist/storage/session-doctor.d.ts +109 -0
- package/dist/storage/session-event-bridge.d.ts +5 -7
- package/dist/storage/session-outcome.d.ts +42 -0
- package/dist/storage/session-recovery.d.ts +55 -0
- package/dist/storage/session-store/load-session-data.d.ts +11 -0
- package/dist/storage/session-store/prune-helpers.d.ts +1 -1
- package/dist/storage/session-store/resume-session.d.ts +0 -2
- package/dist/storage/session-store/types.d.ts +8 -0
- package/dist/storage/session-store.d.ts +3 -3
- package/dist/storage/session-summary-tracker.d.ts +8 -1
- package/dist/storage/session-write-buffer.d.ts +18 -0
- package/dist/storage/session-writer-truncate.d.ts +2 -0
- package/dist/tasking/index.js +2 -2
- package/dist/tools/fallback-manage-tools.d.ts +6 -4
- package/dist/tools/index.js +21 -21
- package/dist/tools/model-tier-set-tool.d.ts +66 -0
- package/dist/types/agent-bridge.d.ts +2 -1
- package/dist/types/config/mcp-features.d.ts +7 -0
- package/dist/types/config/model-tiers.d.ts +148 -0
- package/dist/types/config/root.d.ts +9 -0
- package/dist/types/config/tools.d.ts +73 -0
- package/dist/types/config.d.ts +1 -0
- package/dist/types/context.d.ts +2 -0
- package/dist/types/default-config.d.ts +6 -0
- package/dist/types/errors.d.ts +2 -1
- package/dist/types/index.d.ts +11 -9
- package/dist/types/index.js +25 -15
- package/dist/types/multi-agent.d.ts +43 -0
- package/dist/types/plugin.d.ts +1 -1
- package/dist/types/provider.d.ts +15 -0
- package/dist/types/runtime-capability-manifest.d.ts +1 -1
- package/dist/types/secret-scrubber.d.ts +15 -0
- package/dist/types/session-markers.d.ts +37 -10
- package/dist/types/session-markers.js +1 -1
- package/dist/types/session-timeline.d.ts +197 -0
- package/dist/types/session-timeline.js +12 -0
- package/dist/types/session.d.ts +172 -11
- package/dist/types/system-prompt.d.ts +27 -0
- package/dist/utils/config-backup.d.ts +9 -1
- package/dist/utils/heap-watchdog.js +2 -2
- package/dist/utils/index.js +50 -48
- package/dist/utils/message-invariants.d.ts +4 -1
- package/dist/utils/regex-guard.d.ts +1 -1
- package/dist/utils/socket-path.d.ts +1 -1
- package/dist/utils/token-estimate.d.ts +6 -2
- package/dist/utils/wstack-paths.d.ts +2 -0
- package/dist/wiring/proxy-rewrite.d.ts +28 -0
- package/dist/wiring/proxy-rewrite.js +7 -1
- package/dist/worktree/index.js +2 -2
- package/instructions/agents/explore-companion.md +45 -18
- package/instructions/agents/memory-curator.md +34 -22
- package/instructions/coordination/director-preamble.md +12 -7
- package/instructions/coordination/subagent-baseline.md +26 -5
- package/instructions/leader-after-task.md +4 -1
- package/instructions/llm/chimera-review.md +30 -9
- package/instructions/llm/memory-curator.md +31 -0
- package/instructions/sections/tool/delegation-compact.md +2 -0
- package/instructions/sections/tool/delegation-full.md +5 -1
- package/instructions/sections/tool/mailbox-compact.md +5 -1
- package/instructions/sections/tool/mailbox-full.md +3 -0
- package/instructions/sections/tool/session-note-compact.md +3 -0
- package/instructions/sections/tool/session-note-full.md +15 -0
- package/instructions/system-lite.md +9 -4
- package/instructions/system-pro.md +66 -143
- package/instructions/system.md +73 -175
- package/package.json +33 -5
- package/dist/chunk-2BUUIMQB.js +0 -225
- package/dist/chunk-FAYRX2AD.js +0 -13
- package/dist/chunk-H5E77KUJ.js +0 -15
- package/dist/chunk-M7BS2K6U.js +0 -1
- package/dist/coordination/agents.d.ts +0 -8
- package/dist/coordination/transport.d.ts +0 -2
- package/dist/storage/session-writer/session-writer-summary-tracker.d.ts +0 -28
|
@@ -5,30 +5,30 @@ import {
|
|
|
5
5
|
SHADOW_AGENT_SKILLS,
|
|
6
6
|
TOOLS,
|
|
7
7
|
agentPrompt
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-FCBTO76Z.js";
|
|
9
|
+
import {
|
|
10
|
+
safeParse
|
|
11
|
+
} from "./chunk-W5VITDM2.js";
|
|
12
|
+
import {
|
|
13
|
+
readBundledInstructionText,
|
|
14
|
+
renderInstructionTemplate
|
|
15
|
+
} from "./chunk-5S437PRC.js";
|
|
9
16
|
import {
|
|
10
17
|
setBtwNote
|
|
11
18
|
} from "./chunk-SQJVFEBV.js";
|
|
12
|
-
import {
|
|
13
|
-
ToolCapabilities
|
|
14
|
-
} from "./chunk-A455ATZB.js";
|
|
15
19
|
import {
|
|
16
20
|
SECRET_FILE_MODE
|
|
17
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-6FHWXLPT.js";
|
|
18
22
|
import {
|
|
19
|
-
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import {
|
|
22
|
-
safeParse
|
|
23
|
-
} from "./chunk-RPOA7IAE.js";
|
|
23
|
+
ToolCapabilities
|
|
24
|
+
} from "./chunk-UBGDX6FI.js";
|
|
24
25
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} from "./chunk-5S437PRC.js";
|
|
26
|
+
ProviderError
|
|
27
|
+
} from "./chunk-3ECENVHL.js";
|
|
28
28
|
import {
|
|
29
29
|
AgentError,
|
|
30
30
|
ERROR_CODES
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-25LSLC3G.js";
|
|
32
32
|
import {
|
|
33
33
|
toErrorMessage
|
|
34
34
|
} from "./chunk-TBRL2RCC.js";
|
|
@@ -754,6 +754,7 @@ function makeAgentSubagentRunner(opts) {
|
|
|
754
754
|
const telemetryRunId = typeof taskContext["telemetryRunId"] === "string" ? taskContext["telemetryRunId"] : void 0;
|
|
755
755
|
const telemetryBoardId = typeof taskContext["telemetryBoardId"] === "string" ? taskContext["telemetryBoardId"] : void 0;
|
|
756
756
|
const agentContext = agent.ctx;
|
|
757
|
+
const owningSessionId = () => ctx.sessionId ?? agentContext?.activeRunSessionId ?? agentContext?.session?.id ?? taskContext["sessionId"];
|
|
757
758
|
if (agentContext?.meta) {
|
|
758
759
|
agentContext.meta["subagentTaskId"] = task.id;
|
|
759
760
|
const kanbanContext = taskContext["kanban"];
|
|
@@ -787,11 +788,7 @@ function makeAgentSubagentRunner(opts) {
|
|
|
787
788
|
return;
|
|
788
789
|
}
|
|
789
790
|
aborter.abort();
|
|
790
|
-
budgetError = err instanceof BudgetExceededError ? err : new BudgetExceededError(
|
|
791
|
-
"tool_calls",
|
|
792
|
-
0,
|
|
793
|
-
0
|
|
794
|
-
);
|
|
791
|
+
budgetError = err instanceof BudgetExceededError ? err : new BudgetExceededError("tool_calls", 0, 0);
|
|
795
792
|
if (budgetError !== err && err instanceof Error) {
|
|
796
793
|
budgetError.message += ` (caused by: ${err.message})`;
|
|
797
794
|
}
|
|
@@ -860,7 +857,9 @@ function makeAgentSubagentRunner(opts) {
|
|
|
860
857
|
const since = u.iterations - lastSummaryAtIteration;
|
|
861
858
|
if (since >= SUMMARY_INTERVAL) {
|
|
862
859
|
lastSummaryAtIteration = u.iterations;
|
|
860
|
+
const subagentSessionId = owningSessionId();
|
|
863
861
|
events.emit("subagent.iteration_summary", {
|
|
862
|
+
...subagentSessionId ? { sessionId: subagentSessionId } : {},
|
|
864
863
|
subagentId: ctx.subagentId,
|
|
865
864
|
iteration: u.iterations,
|
|
866
865
|
toolCalls: u.toolCalls,
|
|
@@ -919,6 +918,30 @@ function makeAgentSubagentRunner(opts) {
|
|
|
919
918
|
})
|
|
920
919
|
);
|
|
921
920
|
}
|
|
921
|
+
let reviewerToolCalls = 0;
|
|
922
|
+
let reviewerPacingTier = 0;
|
|
923
|
+
const isReviewer = ctx.config.role === "reviewer" || ctx.config.name?.includes("review") || ctx.config.name?.includes("chimera");
|
|
924
|
+
if (isReviewer) {
|
|
925
|
+
unsub.push(
|
|
926
|
+
events.on("tool.completed", () => {
|
|
927
|
+
reviewerToolCalls++;
|
|
928
|
+
const elapsedSec = Math.max(1, Math.round((Date.now() - taskStartedAt) / 1e3));
|
|
929
|
+
if (reviewerPacingTier === 0 && (reviewerToolCalls >= 2 || elapsedSec >= 25)) {
|
|
930
|
+
reviewerPacingTier = 1;
|
|
931
|
+
setBtwNote(
|
|
932
|
+
agent.ctx,
|
|
933
|
+
`[REVIEW PACE & FOCUS] ${reviewerToolCalls} tool call(s) executed (${elapsedSec}s elapsed). Stay focused strictly on verifying the changed diffs for real bugs. Do not wander into unchanged legacy code or stylistic debt. Wrap up your findings and conclude your report promptly.`
|
|
934
|
+
);
|
|
935
|
+
} else if (reviewerPacingTier === 1 && (reviewerToolCalls >= 5 || elapsedSec >= 50)) {
|
|
936
|
+
reviewerPacingTier = 2;
|
|
937
|
+
setBtwNote(
|
|
938
|
+
agent.ctx,
|
|
939
|
+
`[URGENT: FINISH REVIEW] Review is running long (${elapsedSec}s elapsed, ${reviewerToolCalls} tool calls). Conclude your evaluation of the changed diffs NOW and produce your final severity-ranked report or all-clear block in this turn. No further exploratory tool calls.`
|
|
940
|
+
);
|
|
941
|
+
}
|
|
942
|
+
})
|
|
943
|
+
);
|
|
944
|
+
}
|
|
922
945
|
let result;
|
|
923
946
|
try {
|
|
924
947
|
result = await agent.run(format(task, ctx.config), { signal: aborter.signal });
|
|
@@ -926,7 +949,9 @@ function makeAgentSubagentRunner(opts) {
|
|
|
926
949
|
if (finalText2) {
|
|
927
950
|
ctx.reportProgress?.({ text: finalText2, source: "run_result", capturedAt: Date.now() });
|
|
928
951
|
}
|
|
952
|
+
const subagentSessionId = owningSessionId();
|
|
929
953
|
events.emit("subagent.task_completed", {
|
|
954
|
+
...subagentSessionId ? { sessionId: subagentSessionId } : {},
|
|
930
955
|
subagentId: ctx.subagentId,
|
|
931
956
|
taskId: task.id,
|
|
932
957
|
status: result.status === "done" ? "success" : "failed",
|
|
@@ -1741,7 +1766,8 @@ async function dispatchAgent(task, opts = {}) {
|
|
|
1741
1766
|
const pool = (candidates.length > 0 ? candidates.slice(0, maxCandidates).map((c) => catalog[c.role] ?? FALLBACK_DEFINITION) : Object.values(catalog)).map((d) => ({
|
|
1742
1767
|
role: d.config.role,
|
|
1743
1768
|
name: d.config.name,
|
|
1744
|
-
summary: d.capability.summary
|
|
1769
|
+
summary: d.capability.summary,
|
|
1770
|
+
...d.capability.rationale ? { differentiatesFrom: d.capability.rationale.differentiatesFrom } : {}
|
|
1745
1771
|
}));
|
|
1746
1772
|
try {
|
|
1747
1773
|
const choice = await opts.classifier(task, pool);
|
|
@@ -1780,7 +1806,11 @@ async function dispatchAgent(task, opts = {}) {
|
|
|
1780
1806
|
}
|
|
1781
1807
|
function makeLLMClassifier(complete) {
|
|
1782
1808
|
return async (task, candidates) => {
|
|
1783
|
-
const list = candidates.map((c, i) =>
|
|
1809
|
+
const list = candidates.map((c, i) => {
|
|
1810
|
+
const line = `${i + 1}. ${c.role} \u2014 ${c.summary}`;
|
|
1811
|
+
return c.differentiatesFrom ? `${line}
|
|
1812
|
+
vs. siblings: ${c.differentiatesFrom}` : line;
|
|
1813
|
+
}).join("\n");
|
|
1784
1814
|
const prompt = renderInstructionTemplate(readBundledInstructionText("llm/agent-router.md"), {
|
|
1785
1815
|
task,
|
|
1786
1816
|
agents: list
|
|
@@ -1934,9 +1964,17 @@ var SHADOW_AGENT = {
|
|
|
1934
1964
|
...defineAgent("shadow-agent", "Shadow"),
|
|
1935
1965
|
skillNames: [...SHADOW_AGENT_SKILLS]
|
|
1936
1966
|
};
|
|
1967
|
+
var EXPLORE_COMPANION_TOOLS = [
|
|
1968
|
+
...TOOLS.index,
|
|
1969
|
+
"codebase-impact-analysis",
|
|
1970
|
+
"read",
|
|
1971
|
+
"grep",
|
|
1972
|
+
"glob",
|
|
1973
|
+
"tree"
|
|
1974
|
+
];
|
|
1937
1975
|
var EXPLORE_COMPANION_AGENT = {
|
|
1938
1976
|
...defineAgent("explore-companion", "Explore Companion"),
|
|
1939
|
-
tools: [...
|
|
1977
|
+
tools: [...EXPLORE_COMPANION_TOOLS],
|
|
1940
1978
|
// Read-only, triple-enforced: allowlist has no write/bash, and the
|
|
1941
1979
|
// disabled list blocks the escape hatches explicitly.
|
|
1942
1980
|
disabledTools: [
|
|
@@ -1948,11 +1986,22 @@ var EXPLORE_COMPANION_AGENT = {
|
|
|
1948
1986
|
"exec",
|
|
1949
1987
|
"delegate",
|
|
1950
1988
|
"spawn_subagent",
|
|
1951
|
-
"assign_task"
|
|
1989
|
+
"assign_task",
|
|
1990
|
+
"search",
|
|
1991
|
+
"codebase-index",
|
|
1992
|
+
"codebase-ast-replace",
|
|
1993
|
+
"codebase-invariant-check",
|
|
1994
|
+
"codebase-targeted-test"
|
|
1995
|
+
],
|
|
1996
|
+
allowedCapabilities: [
|
|
1997
|
+
ToolCapabilities.FS_READ,
|
|
1998
|
+
ToolCapabilities.COORDINATION_RESULT_SUBMIT,
|
|
1999
|
+
ToolCapabilities.SESSION_NOTE
|
|
1952
2000
|
],
|
|
1953
2001
|
skillNames: [...ROLE_SKILL_SETS["explore-companion"]],
|
|
1954
2002
|
spawnBudgetExempt: true,
|
|
1955
|
-
// Findings travel via
|
|
2003
|
+
// Findings travel via submit_result; the host posts a session.note
|
|
2004
|
+
// to the leader. Not the leader's stream.
|
|
1956
2005
|
textStream: "silent",
|
|
1957
2006
|
toolStream: "silent"
|
|
1958
2007
|
};
|
|
@@ -2089,6 +2138,7 @@ var FLEET_ROSTER_WITHACP = {
|
|
|
2089
2138
|
// src/coordination/multi-agent-coordinator.ts
|
|
2090
2139
|
import { randomUUID } from "node:crypto";
|
|
2091
2140
|
import { EventEmitter } from "node:events";
|
|
2141
|
+
import { requireSessionId } from "@wrongstack/primitives";
|
|
2092
2142
|
|
|
2093
2143
|
// src/coordination/coordinator/error-classifier.ts
|
|
2094
2144
|
function classifySubagentError(err, hints = {}) {
|
|
@@ -2188,6 +2238,7 @@ async function executeSubagentWithTimeout({
|
|
|
2188
2238
|
}
|
|
2189
2239
|
const start = Date.now();
|
|
2190
2240
|
let timer = null;
|
|
2241
|
+
let settled = false;
|
|
2191
2242
|
let PreemptState;
|
|
2192
2243
|
((PreemptState2) => {
|
|
2193
2244
|
PreemptState2["ACTIVE"] = "active";
|
|
@@ -2208,6 +2259,7 @@ async function executeSubagentWithTimeout({
|
|
|
2208
2259
|
timer = setTimeout(onTick, Math.max(0, ms));
|
|
2209
2260
|
};
|
|
2210
2261
|
const scheduleNext = () => {
|
|
2262
|
+
if (settled) return;
|
|
2211
2263
|
const wallLimit = budget.limits.timeoutMs ?? initialTimeoutMs;
|
|
2212
2264
|
const wallRemaining = initialTimeoutMs === void 0 ? Number.POSITIVE_INFINITY : wallLimit - (Date.now() - start);
|
|
2213
2265
|
const idleRemaining = idleLimitMs === void 0 || gracefulFinish !== void 0 && initialTimeoutMs !== void 0 ? Number.POSITIVE_INFINITY : (budget.limits.idleTimeoutMs ?? idleLimitMs) - budget.idleMs();
|
|
@@ -2234,10 +2286,10 @@ async function executeSubagentWithTimeout({
|
|
|
2234
2286
|
return Promise.resolve("stop");
|
|
2235
2287
|
}
|
|
2236
2288
|
return new Promise((resolveDecision) => {
|
|
2237
|
-
let
|
|
2289
|
+
let settled2 = false;
|
|
2238
2290
|
const resolve = (d) => {
|
|
2239
|
-
if (
|
|
2240
|
-
|
|
2291
|
+
if (settled2) return;
|
|
2292
|
+
settled2 = true;
|
|
2241
2293
|
resolveDecision(d);
|
|
2242
2294
|
};
|
|
2243
2295
|
const fallback = setTimeout(() => resolve("stop"), DECISION_TIMEOUT_MS);
|
|
@@ -2263,6 +2315,7 @@ async function executeSubagentWithTimeout({
|
|
|
2263
2315
|
return typeof result === "string" ? result : await result;
|
|
2264
2316
|
};
|
|
2265
2317
|
const onTick = async () => {
|
|
2318
|
+
if (settled) return;
|
|
2266
2319
|
const elapsed = Date.now() - start;
|
|
2267
2320
|
const wallLimit = initialTimeoutMs === void 0 ? void 0 : budget.limits.timeoutMs ?? initialTimeoutMs;
|
|
2268
2321
|
const idleLimit = idleLimitMs === void 0 ? void 0 : budget.limits.idleTimeoutMs ?? idleLimitMs;
|
|
@@ -2300,6 +2353,7 @@ async function executeSubagentWithTimeout({
|
|
|
2300
2353
|
budget.setWatchdogNegotiation(wallLimit);
|
|
2301
2354
|
try {
|
|
2302
2355
|
const decision = await negotiateTimeout(elapsed, wallLimit);
|
|
2356
|
+
if (settled) return;
|
|
2303
2357
|
if (typeof decision !== "string" && decision.extend.timeoutMs !== void 0) {
|
|
2304
2358
|
budget.patchLimits({ timeoutMs: decision.extend.timeoutMs });
|
|
2305
2359
|
lastGrantActivityTs = Date.now() - budget.idleMs();
|
|
@@ -2347,6 +2401,7 @@ async function executeSubagentWithTimeout({
|
|
|
2347
2401
|
budget.setWatchdogNegotiation(limit);
|
|
2348
2402
|
try {
|
|
2349
2403
|
const decision = await negotiateTimeout(elapsed, limit);
|
|
2404
|
+
if (settled) return;
|
|
2350
2405
|
if (decision === "throw") {
|
|
2351
2406
|
terminate("timeout", limit, elapsed);
|
|
2352
2407
|
return;
|
|
@@ -2372,6 +2427,7 @@ async function executeSubagentWithTimeout({
|
|
|
2372
2427
|
terminate("timeout", limit, elapsed);
|
|
2373
2428
|
return;
|
|
2374
2429
|
} catch (err) {
|
|
2430
|
+
if (settled) return;
|
|
2375
2431
|
abortSubagent(ctx.subagentId);
|
|
2376
2432
|
reject(
|
|
2377
2433
|
err instanceof BudgetExceededError ? err : new BudgetExceededError("timeout", limit, elapsed)
|
|
@@ -2386,11 +2442,13 @@ async function executeSubagentWithTimeout({
|
|
|
2386
2442
|
try {
|
|
2387
2443
|
return await Promise.race([runner(task, ctx), timeoutPromise]);
|
|
2388
2444
|
} finally {
|
|
2445
|
+
settled = true;
|
|
2389
2446
|
if (timer) clearTimeout(timer);
|
|
2390
2447
|
}
|
|
2391
2448
|
}
|
|
2392
2449
|
|
|
2393
2450
|
// src/coordination/multi-agent-coordinator.ts
|
|
2451
|
+
var MAX_COORDINATOR_LISTENERS = 512;
|
|
2394
2452
|
var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends EventEmitter {
|
|
2395
2453
|
coordinatorId;
|
|
2396
2454
|
config;
|
|
@@ -2428,7 +2486,7 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
2428
2486
|
terminating = /* @__PURE__ */ new Set();
|
|
2429
2487
|
constructor(config, options = {}) {
|
|
2430
2488
|
super();
|
|
2431
|
-
this.setMaxListeners(
|
|
2489
|
+
this.setMaxListeners(MAX_COORDINATOR_LISTENERS);
|
|
2432
2490
|
this.coordinatorId = config.coordinatorId;
|
|
2433
2491
|
this.config = config;
|
|
2434
2492
|
this.runner = options.runner;
|
|
@@ -2436,7 +2494,59 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
2436
2494
|
}
|
|
2437
2495
|
currentSessionId() {
|
|
2438
2496
|
const value = typeof this.sessionId === "function" ? this.sessionId() : this.sessionId;
|
|
2439
|
-
return
|
|
2497
|
+
return requireSessionId(value, "subagent operation");
|
|
2498
|
+
}
|
|
2499
|
+
/**
|
|
2500
|
+
* The session that owns a subagent — its spawn-time stamp.
|
|
2501
|
+
*
|
|
2502
|
+
* Every per-subagent emission routes through here instead of
|
|
2503
|
+
* `currentSessionId()`. The fallback covers ids the coordinator never
|
|
2504
|
+
* spawned (a caller reporting `completeTask` for an unknown worker); a
|
|
2505
|
+
* subagent this coordinator created always has its own stamp.
|
|
2506
|
+
*/
|
|
2507
|
+
sessionOf(subagentId) {
|
|
2508
|
+
const entry = this.subagents.get(subagentId);
|
|
2509
|
+
if (entry) return entry.sessionId;
|
|
2510
|
+
return this.currentSessionId();
|
|
2511
|
+
}
|
|
2512
|
+
/** Every subagent this coordinator holds for one session. */
|
|
2513
|
+
subagentIdsForSession(sessionId) {
|
|
2514
|
+
if (!sessionId) return [];
|
|
2515
|
+
const ids = [];
|
|
2516
|
+
for (const [id, entry] of this.subagents) {
|
|
2517
|
+
if (entry.sessionId === sessionId) ids.push(id);
|
|
2518
|
+
}
|
|
2519
|
+
return ids;
|
|
2520
|
+
}
|
|
2521
|
+
/**
|
|
2522
|
+
* Stop every subagent belonging to ONE session, and drop that session's
|
|
2523
|
+
* still-queued tasks.
|
|
2524
|
+
*
|
|
2525
|
+
* This is what a tab's Stop button needs. `stopAll()` is the wrong tool with
|
|
2526
|
+
* four tabs live — it would kill three other tabs' work — and until subagents
|
|
2527
|
+
* carried a session stamp there was no way to express the narrower intent, so
|
|
2528
|
+
* stopping a run left its workers grinding on in the background.
|
|
2529
|
+
*
|
|
2530
|
+
* Pending tasks pinned to those subagents are drained as aborted so anything
|
|
2531
|
+
* awaiting them (the delegate tool, report-back) resolves instead of hanging.
|
|
2532
|
+
*/
|
|
2533
|
+
async stopSession(sessionId) {
|
|
2534
|
+
if (!sessionId) return;
|
|
2535
|
+
const ids = new Set(this.subagentIdsForSession(sessionId));
|
|
2536
|
+
if (ids.size === 0) return;
|
|
2537
|
+
const orphaned = this.pendingTasks.filter(
|
|
2538
|
+
(t) => t.subagentId !== void 0 && ids.has(t.subagentId)
|
|
2539
|
+
);
|
|
2540
|
+
this.pendingTasks = this.pendingTasks.filter(
|
|
2541
|
+
(t) => t.subagentId === void 0 || !ids.has(t.subagentId)
|
|
2542
|
+
);
|
|
2543
|
+
for (const t of orphaned) {
|
|
2544
|
+
this.emitPendingAborted(
|
|
2545
|
+
t,
|
|
2546
|
+
`Session "${sessionId}" was stopped while task "${t.id}" was pending`
|
|
2547
|
+
);
|
|
2548
|
+
}
|
|
2549
|
+
await Promise.allSettled([...ids].map((id) => this.stop(id)));
|
|
2440
2550
|
}
|
|
2441
2551
|
/**
|
|
2442
2552
|
* Replace the runner after construction. Used when the runner depends
|
|
@@ -2501,18 +2611,24 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
2501
2611
|
doneCondition: this.config.doneCondition,
|
|
2502
2612
|
maxConcurrent: this.config.maxConcurrent ?? 16
|
|
2503
2613
|
};
|
|
2614
|
+
const sessionId = cfg.originSessionId ?? this.currentSessionId();
|
|
2504
2615
|
this.subagents.set(id, {
|
|
2505
2616
|
config: { ...cfg, id },
|
|
2506
2617
|
context,
|
|
2507
2618
|
status: "idle",
|
|
2508
|
-
abortController: new AbortController()
|
|
2619
|
+
abortController: new AbortController(),
|
|
2620
|
+
sessionId
|
|
2621
|
+
});
|
|
2622
|
+
this.emit("subagent.started", {
|
|
2623
|
+
subagent: { ...cfg, id },
|
|
2624
|
+
sessionId
|
|
2509
2625
|
});
|
|
2510
|
-
this.emit("subagent.started", { subagent: { ...cfg, id } });
|
|
2511
2626
|
this.fleetBus?.emit({
|
|
2512
2627
|
subagentId: id,
|
|
2513
2628
|
ts: Date.now(),
|
|
2514
2629
|
type: "subagent.assigned",
|
|
2515
2630
|
payload: {
|
|
2631
|
+
sessionId,
|
|
2516
2632
|
subagentId: id,
|
|
2517
2633
|
name: subagent.name,
|
|
2518
2634
|
provider: subagent.provider,
|
|
@@ -2552,11 +2668,16 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
2552
2668
|
subagent.currentTask = void 0;
|
|
2553
2669
|
subagent.context.parentBridge = null;
|
|
2554
2670
|
this.emit("subagent.stopped", { subagentId, reason: "stopped by coordinator" });
|
|
2671
|
+
const sessionId = subagent.sessionId;
|
|
2555
2672
|
this.fleetBus?.emit({
|
|
2556
2673
|
subagentId,
|
|
2557
2674
|
ts: Date.now(),
|
|
2558
2675
|
type: "subagent.stopped",
|
|
2559
|
-
payload: {
|
|
2676
|
+
payload: {
|
|
2677
|
+
sessionId,
|
|
2678
|
+
subagentId,
|
|
2679
|
+
reason: "stopped by coordinator"
|
|
2680
|
+
}
|
|
2560
2681
|
});
|
|
2561
2682
|
this.emitCoordinatorStats();
|
|
2562
2683
|
}
|
|
@@ -2593,7 +2714,10 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
2593
2714
|
subagentId: id,
|
|
2594
2715
|
taskId: s.currentTask ?? "",
|
|
2595
2716
|
status: s.status,
|
|
2596
|
-
assigned: s.context.parentBridge !== null
|
|
2717
|
+
assigned: s.context.parentBridge !== null,
|
|
2718
|
+
// Each worker's OWN session, so a consumer can split one coordinator's
|
|
2719
|
+
// roster across the tabs that spawned it.
|
|
2720
|
+
sessionId: s.sessionId
|
|
2597
2721
|
}));
|
|
2598
2722
|
const sessionId = this.currentSessionId();
|
|
2599
2723
|
this.fleetBus?.emit({
|
|
@@ -2601,7 +2725,7 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
2601
2725
|
ts: Date.now(),
|
|
2602
2726
|
type: "coordinator.stats",
|
|
2603
2727
|
payload: {
|
|
2604
|
-
|
|
2728
|
+
sessionId,
|
|
2605
2729
|
...stats,
|
|
2606
2730
|
subagentStatuses
|
|
2607
2731
|
}
|
|
@@ -2755,9 +2879,7 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
2755
2879
|
const dispatchable = this.takeNextDispatchableTask();
|
|
2756
2880
|
if (!dispatchable) {
|
|
2757
2881
|
if (this.pendingTasks.length > 0 && !this.hasLiveSubagent()) {
|
|
2758
|
-
this.drainPendingAsAborted(
|
|
2759
|
-
"No live subagent available \u2014 all stopped or mid-termination"
|
|
2760
|
-
);
|
|
2882
|
+
this.drainPendingAsAborted("No live subagent available \u2014 all stopped or mid-termination");
|
|
2761
2883
|
}
|
|
2762
2884
|
return;
|
|
2763
2885
|
}
|
|
@@ -2887,6 +3009,9 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
2887
3009
|
subagent.status = "running";
|
|
2888
3010
|
subagent.currentTask = task.id;
|
|
2889
3011
|
task.subagentId = subagentId;
|
|
3012
|
+
if (subagent.sessionId) {
|
|
3013
|
+
task.context = { sessionId: subagent.sessionId, ...task.context ?? {} };
|
|
3014
|
+
}
|
|
2890
3015
|
subagent.context.tasks.push(task);
|
|
2891
3016
|
if (subagent.context.tasks.length > _DefaultMultiAgentCoordinator.MAX_SUBAGENT_TASK_HISTORY) {
|
|
2892
3017
|
subagent.context.tasks.splice(
|
|
@@ -2894,12 +3019,17 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
2894
3019
|
subagent.context.tasks.length - _DefaultMultiAgentCoordinator.MAX_SUBAGENT_TASK_HISTORY
|
|
2895
3020
|
);
|
|
2896
3021
|
}
|
|
3022
|
+
const sessionId = subagent.sessionId;
|
|
2897
3023
|
this.fleetBus?.emit({
|
|
2898
3024
|
subagentId,
|
|
2899
3025
|
taskId: task.id,
|
|
2900
3026
|
ts: Date.now(),
|
|
2901
3027
|
type: "subagent.running",
|
|
2902
|
-
payload: {
|
|
3028
|
+
payload: {
|
|
3029
|
+
sessionId,
|
|
3030
|
+
subagentId,
|
|
3031
|
+
taskId: task.id
|
|
3032
|
+
}
|
|
2903
3033
|
});
|
|
2904
3034
|
this.emit("task.assigned", { task, subagentId });
|
|
2905
3035
|
this.emitCoordinatorStats();
|
|
@@ -2923,7 +3053,9 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
2923
3053
|
},
|
|
2924
3054
|
"auto",
|
|
2925
3055
|
{
|
|
2926
|
-
|
|
3056
|
+
// The spawning session, not "whichever tab is in front now": this
|
|
3057
|
+
// worker's token and cost accrual belongs to the tab that started it.
|
|
3058
|
+
sessionId: () => this.sessionOf(subagentId),
|
|
2927
3059
|
subagentId,
|
|
2928
3060
|
// Graceful-finish runs own wall-clock enforcement to the watchdog so
|
|
2929
3061
|
// the notify-then-bound lifecycle cannot be raced by tool.progress
|
|
@@ -2943,6 +3075,10 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
2943
3075
|
config: subagent.config,
|
|
2944
3076
|
budget,
|
|
2945
3077
|
signal: subagent.abortController.signal,
|
|
3078
|
+
// The spawning session travels with the run, so the runner stamps its
|
|
3079
|
+
// own events with the tab that owns this worker rather than re-deriving
|
|
3080
|
+
// "the host's current session" when the event happens to fire.
|
|
3081
|
+
sessionId: subagent.sessionId,
|
|
2946
3082
|
bridge: subagent.context.parentBridge || null,
|
|
2947
3083
|
reportProgress: (partial) => {
|
|
2948
3084
|
const text = partial.text.trim();
|
|
@@ -3002,7 +3138,7 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
3002
3138
|
preemptFraction,
|
|
3003
3139
|
gracefulFinish,
|
|
3004
3140
|
abortSubagent: (subagentId) => this.subagents.get(subagentId)?.abortController.abort(),
|
|
3005
|
-
currentSessionId: () => this.
|
|
3141
|
+
currentSessionId: () => this.sessionOf(ctx.subagentId)
|
|
3006
3142
|
});
|
|
3007
3143
|
}
|
|
3008
3144
|
recordCompletion(result) {
|
|
@@ -3028,11 +3164,15 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
3028
3164
|
if (subagent.abortController.signal.aborted) {
|
|
3029
3165
|
subagent.abortController = new AbortController();
|
|
3030
3166
|
}
|
|
3167
|
+
const sessionId = subagent.sessionId;
|
|
3031
3168
|
this.fleetBus?.emit({
|
|
3032
3169
|
subagentId: result.subagentId,
|
|
3033
3170
|
ts: Date.now(),
|
|
3034
3171
|
type: "subagent.idle",
|
|
3035
|
-
payload: {
|
|
3172
|
+
payload: {
|
|
3173
|
+
sessionId,
|
|
3174
|
+
subagentId: result.subagentId
|
|
3175
|
+
}
|
|
3036
3176
|
});
|
|
3037
3177
|
}
|
|
3038
3178
|
this.terminating.delete(result.subagentId);
|
|
@@ -3040,12 +3180,14 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
3040
3180
|
task: subagent?.context.tasks.find((t) => t.id === result.taskId) ?? { id: result.taskId },
|
|
3041
3181
|
result
|
|
3042
3182
|
});
|
|
3183
|
+
const completedSessionId = this.sessionOf(result.subagentId);
|
|
3043
3184
|
this.fleetBus?.emit({
|
|
3044
3185
|
subagentId: result.subagentId,
|
|
3045
3186
|
taskId: result.taskId,
|
|
3046
3187
|
ts: Date.now(),
|
|
3047
3188
|
type: "subagent.completed",
|
|
3048
3189
|
payload: {
|
|
3190
|
+
sessionId: completedSessionId,
|
|
3049
3191
|
subagentId: result.subagentId,
|
|
3050
3192
|
taskId: result.taskId,
|
|
3051
3193
|
status: result.status,
|
|
@@ -3074,6 +3216,7 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
3074
3216
|
async remove(subagentId) {
|
|
3075
3217
|
const subagent = this.subagents.get(subagentId);
|
|
3076
3218
|
if (!subagent) return;
|
|
3219
|
+
const removedSessionId = subagent.sessionId;
|
|
3077
3220
|
if (subagent.status === "running" || subagent.status === "idle") {
|
|
3078
3221
|
this.terminating.add(subagentId);
|
|
3079
3222
|
subagent.abortController.abort();
|
|
@@ -3098,7 +3241,10 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
3098
3241
|
subagentId,
|
|
3099
3242
|
ts: Date.now(),
|
|
3100
3243
|
type: "subagent.removed",
|
|
3101
|
-
payload: {
|
|
3244
|
+
payload: {
|
|
3245
|
+
sessionId: removedSessionId,
|
|
3246
|
+
subagentId
|
|
3247
|
+
}
|
|
3102
3248
|
});
|
|
3103
3249
|
this.emitCoordinatorStats();
|
|
3104
3250
|
}
|
|
@@ -3168,4 +3314,4 @@ export {
|
|
|
3168
3314
|
FLEET_ROSTER_WITHACP,
|
|
3169
3315
|
DefaultMultiAgentCoordinator
|
|
3170
3316
|
};
|
|
3171
|
-
//# sourceMappingURL=chunk-
|
|
3317
|
+
//# sourceMappingURL=chunk-S45JPKQN.js.map
|
|
@@ -84,6 +84,9 @@ function resolveWstackPaths(opts) {
|
|
|
84
84
|
profileProviderStatus: (name) => {
|
|
85
85
|
return path.join(globalRoot, "profiles", safeProfileName(name), "provider-status.json");
|
|
86
86
|
},
|
|
87
|
+
profileProviderAudit: (name) => {
|
|
88
|
+
return path.join(globalRoot, "profiles", safeProfileName(name), "provider-status-audit.jsonl");
|
|
89
|
+
},
|
|
87
90
|
profileUpdateCache: (name) => {
|
|
88
91
|
return path.join(globalRoot, "profiles", safeProfileName(name), "update-cache.json");
|
|
89
92
|
},
|
|
@@ -146,4 +149,4 @@ export {
|
|
|
146
149
|
wstackGlobalRoot,
|
|
147
150
|
resolveWstackPaths
|
|
148
151
|
};
|
|
149
|
-
//# sourceMappingURL=chunk-
|
|
152
|
+
//# sourceMappingURL=chunk-SAFHACFA.js.map
|