cli-jaw 2.2.3 → 2.2.4-preview.20260703203439
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/README.ja.md +1 -4
- package/README.ko.md +1 -4
- package/README.md +4 -7
- package/README.zh-CN.md +1 -4
- package/dist/bin/commands/bgtask.js +3 -1
- package/dist/bin/commands/bgtask.js.map +1 -1
- package/dist/bin/commands/chat.js +2 -2
- package/dist/bin/commands/chat.js.map +1 -1
- package/dist/bin/commands/dispatch.js +10 -3
- package/dist/bin/commands/dispatch.js.map +1 -1
- package/dist/bin/commands/tui/fullscreen-mode.js +44 -11
- package/dist/bin/commands/tui/fullscreen-mode.js.map +1 -1
- package/dist/bin/commands/tui/ws-handler.js +15 -1
- package/dist/bin/commands/tui/ws-handler.js.map +1 -1
- package/dist/scripts/fresh-install-smoke.js +1 -1
- package/dist/scripts/fresh-install-smoke.js.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/src/agent/agy-bootstrap.js +104 -17
- package/dist/src/agent/agy-bootstrap.js.map +1 -1
- package/dist/src/agent/agy-runtime.js +104 -0
- package/dist/src/agent/agy-runtime.js.map +1 -1
- package/dist/src/agent/agy-transcript-watcher.js +14 -0
- package/dist/src/agent/agy-transcript-watcher.js.map +1 -1
- package/dist/src/agent/args.js +16 -83
- package/dist/src/agent/args.js.map +1 -1
- package/dist/src/agent/error-classifier.js +1 -3
- package/dist/src/agent/error-classifier.js.map +1 -1
- package/dist/src/agent/events/claude.js +60 -3
- package/dist/src/agent/events/claude.js.map +1 -1
- package/dist/src/agent/events/helpers.js +1 -1
- package/dist/src/agent/events/helpers.js.map +1 -1
- package/dist/src/agent/events/index.js +27 -27
- package/dist/src/agent/events/index.js.map +1 -1
- package/dist/src/agent/events/summary.js +0 -21
- package/dist/src/agent/events/summary.js.map +1 -1
- package/dist/src/agent/events/tool-labels.js +0 -28
- package/dist/src/agent/events/tool-labels.js.map +1 -1
- package/dist/src/agent/jwc-event-mapper.js +3 -3
- package/dist/src/agent/jwc-event-mapper.js.map +1 -1
- package/dist/src/agent/jwc-runtime.js +5 -1
- package/dist/src/agent/jwc-runtime.js.map +1 -1
- package/dist/src/agent/kiro-runtime.js +40 -14
- package/dist/src/agent/kiro-runtime.js.map +1 -1
- package/dist/src/agent/lifecycle-handler.js +2 -77
- package/dist/src/agent/lifecycle-handler.js.map +1 -1
- package/dist/src/agent/prompt-context.js +38 -0
- package/dist/src/agent/prompt-context.js.map +1 -0
- package/dist/src/agent/resume-classifier.js +0 -4
- package/dist/src/agent/resume-classifier.js.map +1 -1
- package/dist/src/agent/spawn/resume.js +0 -18
- package/dist/src/agent/spawn/resume.js.map +1 -1
- package/dist/src/agent/spawn-env.js +0 -28
- package/dist/src/agent/spawn-env.js.map +1 -1
- package/dist/src/agent/spawn.js +81 -76
- package/dist/src/agent/spawn.js.map +1 -1
- package/dist/src/bgtask/presets.js +13 -1
- package/dist/src/bgtask/presets.js.map +1 -1
- package/dist/src/cli/employee-handler.js +10 -10
- package/dist/src/cli/employee-handler.js.map +1 -1
- package/dist/src/cli/handlers-completions.js +29 -10
- package/dist/src/cli/handlers-completions.js.map +1 -1
- package/dist/src/cli/handlers-runtime.js +3 -2
- package/dist/src/cli/handlers-runtime.js.map +1 -1
- package/dist/src/cli/opencodex-models.js +118 -0
- package/dist/src/cli/opencodex-models.js.map +1 -0
- package/dist/src/cli/readiness.js +2 -8
- package/dist/src/cli/readiness.js.map +1 -1
- package/dist/src/cli/registry-live.js +21 -1
- package/dist/src/cli/registry-live.js.map +1 -1
- package/dist/src/cli/registry.js +10 -21
- package/dist/src/cli/registry.js.map +1 -1
- package/dist/src/cli/tui/jawcode-bridge.js +15 -13
- package/dist/src/cli/tui/jawcode-bridge.js.map +1 -1
- package/dist/src/cli/tui/jawcode-render.js +26 -0
- package/dist/src/cli/tui/jawcode-render.js.map +1 -1
- package/dist/src/cli/tui/render/frame.js +158 -16
- package/dist/src/cli/tui/render/frame.js.map +1 -1
- package/dist/src/cli/tui/transcript.js +79 -3
- package/dist/src/cli/tui/transcript.js.map +1 -1
- package/dist/src/core/cli-detect.js +1 -1
- package/dist/src/core/cli-detect.js.map +1 -1
- package/dist/src/core/employees.js +12 -7
- package/dist/src/core/employees.js.map +1 -1
- package/dist/src/core/event-bus.js +13 -0
- package/dist/src/core/event-bus.js.map +1 -1
- package/dist/src/goal/heartbeat.js +8 -0
- package/dist/src/goal/heartbeat.js.map +1 -1
- package/dist/src/manager/load-timing.js +29 -0
- package/dist/src/manager/load-timing.js.map +1 -0
- package/dist/src/manager/observability.js.map +1 -1
- package/dist/src/manager/server.js +67 -6
- package/dist/src/manager/server.js.map +1 -1
- package/dist/src/memory/bootstrap.js +43 -1
- package/dist/src/memory/bootstrap.js.map +1 -1
- package/dist/src/orchestrator/distribute.js +5 -1
- package/dist/src/orchestrator/distribute.js.map +1 -1
- package/dist/src/orchestrator/state-machine.js +20 -0
- package/dist/src/orchestrator/state-machine.js.map +1 -1
- package/dist/src/orchestrator/worker-registry.js +2 -1
- package/dist/src/orchestrator/worker-registry.js.map +1 -1
- package/dist/src/prompt/templates/a1-system.md +61 -11
- package/dist/src/prompt/templates/employee.md +13 -0
- package/dist/src/prompt/templates/orchestration.md +14 -0
- package/dist/src/prompt/templates/worker-context.md +4 -4
- package/dist/src/routes/employees.js +8 -8
- package/dist/src/routes/employees.js.map +1 -1
- package/dist/src/routes/events.js +57 -19
- package/dist/src/routes/events.js.map +1 -1
- package/dist/src/routes/orchestrate.js +42 -17
- package/dist/src/routes/orchestrate.js.map +1 -1
- package/dist/src/routes/quota-agy-reverse.js +0 -24
- package/dist/src/routes/quota-agy-reverse.js.map +1 -1
- package/dist/src/routes/quota.js +0 -145
- package/dist/src/routes/quota.js.map +1 -1
- package/dist/src/routes/settings.js +2 -7
- package/dist/src/routes/settings.js.map +1 -1
- package/dist/src/shared/tool-log-sanitize.js +6 -0
- package/dist/src/shared/tool-log-sanitize.js.map +1 -1
- package/dist/src/telegram/forwarder.js +53 -5
- package/dist/src/telegram/forwarder.js.map +1 -1
- package/dist/src/trace/store.js +82 -0
- package/dist/src/trace/store.js.map +1 -1
- package/dist/src/types/cli-engine.js +0 -1
- package/dist/src/types/cli-engine.js.map +1 -1
- package/dist/src/types/cli-events.js +1 -1
- package/dist/src/types/cli-events.js.map +1 -1
- package/package.json +2 -2
- package/public/dist/assets/Agent-CHCXjXSN.js +1 -0
- package/public/dist/assets/CodeCanvas-BzhNLZVF.js +3 -0
- package/public/dist/assets/DocPanel-6Z_RELzd.js +1 -0
- package/public/dist/assets/{DocPanel-D3FYBhMp.css → DocPanel-DZKPTOm8.css} +1 -1
- package/public/dist/assets/FolderPanel-DdlzWAuK.js +3 -0
- package/public/dist/assets/{Heartbeat-D-Rfp094.js → Heartbeat-BblY8Z4a.js} +1 -1
- package/public/dist/assets/MarkdownRenderer-BivJ4hJm.js +1 -0
- package/public/dist/assets/MarkdownRenderer-Cl0oEICj.js +15 -0
- package/public/dist/assets/{Memory-VH4ZJCMW.js → Memory-BWcfxzCz.js} +1 -1
- package/public/dist/assets/ModelProvider-D4LBX7K2.js +1 -0
- package/public/dist/assets/agent-meta-FyI15KAa.js +1 -0
- package/public/dist/assets/{app-DaORcAyD.js → app-DszWzakT.js} +4 -4
- package/public/dist/assets/bgtask-badge-DZEQ5fMl.js +1 -0
- package/public/dist/assets/{bgtask-badge-BtUXEe1T.js → bgtask-badge-b7pj_Dbh.js} +1 -1
- package/public/dist/assets/constants-EMUBd5RQ.js +1 -0
- package/public/dist/assets/{employees-CZSyvJbx.js → employees-DbgFV33i.js} +1 -1
- package/public/dist/assets/{manager-DB5qTw1A.js → manager-CdNOlCyS.js} +4 -4
- package/public/dist/assets/{manager-D3waO_XX.css → manager-rHNwUB4e.css} +1 -1
- package/public/dist/assets/memory-BT-rs3ag.js +1 -0
- package/public/dist/assets/{memory-cWI_Htbn.js → memory-QobGT0Kv.js} +1 -1
- package/public/dist/assets/message-history-BY1UNJAO.js +1 -0
- package/public/dist/assets/message-history-BmP5JKio.js +142 -0
- package/public/dist/assets/{render-Bp8eyqCf.js → render-C3r-9_-J.js} +2 -2
- package/public/dist/assets/settings-CJm8ZSJs.js +1 -0
- package/public/dist/assets/{settings-DLkP7qRV.js → settings-D70uFh8l.js} +1 -1
- package/public/dist/assets/{settings-core-B5XRRNcX.js → settings-core-B2lw2bgO.js} +1 -1
- package/public/dist/assets/settings-core-gdS0lo1b.js +1 -0
- package/public/dist/assets/{sidebar-CsogFOse.js → sidebar-BqWm2XWP.js} +3 -3
- package/public/dist/assets/{skills-Dmf4v9rj.js → skills-CdNOfXlk.js} +1 -1
- package/public/dist/assets/skills-DG_CbTEf.js +1 -0
- package/public/dist/assets/{slash-commands-vcf7FuPD.js → slash-commands-4Ntm5N7h.js} +1 -1
- package/public/dist/assets/slash-commands-B9kOEhJ_.js +1 -0
- package/public/dist/assets/{trace-drawer-DuQQ0SNq.js → trace-drawer-DqAwwHHQ.js} +1 -1
- package/public/dist/assets/ui-Anw2S64o.js +1 -0
- package/public/dist/assets/ui-DsK6r0Xv.js +2 -0
- package/public/dist/index.html +1 -1
- package/public/dist/manager/index.html +2 -2
- package/public/js/constants.ts +7 -7
- package/public/js/features/employees.ts +0 -3
- package/public/js/features/process-block-dom.ts +6 -1
- package/public/js/features/process-block.ts +59 -3
- package/public/js/render/file-links.ts +1 -1
- package/public/js/ui.ts +9 -1
- package/public/js/virtual-scroll.ts +23 -0
- package/public/js/ws.ts +7 -2
- package/public/manager/src/SidebarRailRouter.tsx +15 -10
- package/public/manager/src/code/CodeCanvas.tsx +3 -1
- package/public/manager/src/code/CodeTranscript.tsx +5 -4
- package/public/manager/src/code/CodeWorkbench.tsx +2 -1
- package/public/manager/src/doc-panel/DocPanel.tsx +52 -5
- package/public/manager/src/doc-panel/doc-panel.css +10 -0
- package/public/manager/src/folder-panel/FolderPanel.tsx +14 -16
- package/public/manager/src/folder-panel/use-folder-git-status.ts +15 -0
- package/public/manager/src/folder-panel/use-folder-preview-sync.ts +37 -0
- package/public/manager/src/folder-panel/use-folder-visible-refresh.ts +19 -6
- package/public/manager/src/manager-notes.css +23 -0
- package/public/manager/src/notes/rendering/MarkdownRenderer.tsx +80 -2
- package/public/manager/src/settings/pages/Agent.tsx +30 -8
- package/public/manager/src/settings/pages/ModelProvider.tsx +22 -4
- package/public/manager/src/settings/pages/components/agent/AgentEmployeesSection.tsx +5 -1
- package/public/manager/src/settings/pages/components/agent/FlushAgentSection.tsx +5 -3
- package/public/manager/src/settings/pages/components/agent/RuntimeEmployeeRow.tsx +6 -4
- package/public/manager/src/settings/pages/components/agent/RuntimeHeader.tsx +4 -2
- package/public/manager/src/settings/pages/components/agent/agent-meta.ts +45 -9
- package/public/manager/src/settings/pages/components/agent/runtime-employees-helpers.ts +7 -2
- package/scripts/capture-agy-quota-fixture.mjs +138 -0
- package/scripts/fresh-install-smoke.ts +1 -1
- package/dist/src/agent/events/gemini.js +0 -100
- package/dist/src/agent/events/gemini.js.map +0 -1
- package/public/dist/assets/Agent-Ci12HWhE.js +0 -1
- package/public/dist/assets/CodeCanvas-d1gh0-lY.js +0 -3
- package/public/dist/assets/DocPanel-C6XQ7W6A.js +0 -1
- package/public/dist/assets/FolderPanel-DIFAqajZ.js +0 -3
- package/public/dist/assets/MarkdownRenderer-DXKUEE2a.js +0 -1
- package/public/dist/assets/MarkdownRenderer-DcIxpNcX.js +0 -15
- package/public/dist/assets/ModelProvider-_tUCghOF.js +0 -1
- package/public/dist/assets/agent-meta-DqBTGRRQ.js +0 -1
- package/public/dist/assets/bgtask-badge-B3HLOZae.js +0 -1
- package/public/dist/assets/constants-DkJ3E63Y.js +0 -1
- package/public/dist/assets/memory-BEruUlfu.js +0 -1
- package/public/dist/assets/message-history-DU1V9ZAW.js +0 -142
- package/public/dist/assets/message-history-tjkyOp_K.js +0 -1
- package/public/dist/assets/settings-B-GgyJZI.js +0 -1
- package/public/dist/assets/settings-core-Cw1av-Ox.js +0 -1
- package/public/dist/assets/skills-CLcoop6W.js +0 -1
- package/public/dist/assets/slash-commands-DY6-hzq6.js +0 -1
- package/public/dist/assets/ui-BKYuBdZE.js +0 -2
- package/public/dist/assets/ui-CqlGwgUo.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resume.js","sourceRoot":"","sources":["../../../../src/agent/spawn/resume.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,wDAAwD;AACxD,kDAAkD;AAClD,iEAAiE;AACjE,yDAAyD;AACzD,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAEzC,MAAM,UAAU,mBAAmB,CAC/B,aAAqB,EACrB,aAAsB,EACtB,SAAiB,yBAAyB,EAC1C,MAAc,IAAI,CAAC,GAAG,EAAE;IAExB,IAAI,aAAa;QAAE,OAAO,KAAK,CAAC;IAChC,OAAO,CAAC,GAAG,GAAG,aAAa,CAAC,GAAG,MAAM,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,yBAAyB,CACrC,GAAW,EACX,cAAsB,EACtB,WAAsC,EACtC,kBAAkC,EAClC,eAA+B,EAC/B,eAAwC,EACxC,QAAgB,IAAI,CAAC,GAAG,EAAE,EAC1B,iBAAiC;IAEjC,IAAI,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"resume.js","sourceRoot":"","sources":["../../../../src/agent/spawn/resume.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,wDAAwD;AACxD,kDAAkD;AAClD,iEAAiE;AACjE,yDAAyD;AACzD,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAEzC,MAAM,UAAU,mBAAmB,CAC/B,aAAqB,EACrB,aAAsB,EACtB,SAAiB,yBAAyB,EAC1C,MAAc,IAAI,CAAC,GAAG,EAAE;IAExB,IAAI,aAAa;QAAE,OAAO,KAAK,CAAC;IAChC,OAAO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'GEMINI_CLI_SYSTEM_SETTINGS_PATH';
|
|
27
|
-
const GEMINI_SYSTEM_SETTINGS = {
|
|
28
|
-
general: {
|
|
29
|
-
maxAttempts: 3,
|
|
30
|
-
retryFetchErrors: true,
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
let _geminiSystemSettingsPath = null;
|
|
34
|
-
function getGeminiSystemSettingsPath() {
|
|
35
|
-
if (_geminiSystemSettingsPath && fs.existsSync(_geminiSystemSettingsPath)) {
|
|
36
|
-
return _geminiSystemSettingsPath;
|
|
37
|
-
}
|
|
38
|
-
const tmpPath = join(os.tmpdir(), 'jaw-gemini-system-settings.json');
|
|
39
|
-
fs.writeFileSync(tmpPath, JSON.stringify(GEMINI_SYSTEM_SETTINGS, null, 2) + '\n');
|
|
40
|
-
_geminiSystemSettingsPath = tmpPath;
|
|
41
|
-
return tmpPath;
|
|
42
|
-
}
|
|
43
25
|
function prependPathDir(extraEnv, inheritedEnv, dir) {
|
|
44
26
|
const currentPath = extraEnv["PATH"] ?? inheritedEnv["PATH"] ?? '';
|
|
45
27
|
const parts = currentPath.split(':').filter(Boolean).filter(part => part !== dir);
|
|
@@ -52,16 +34,6 @@ export function getOpencodePreferredBinDir() {
|
|
|
52
34
|
return join(os.homedir(), '.bun', 'bin');
|
|
53
35
|
}
|
|
54
36
|
export function applyCliEnvDefaults(cli, extraEnv = {}, inheritedEnv = process.env) {
|
|
55
|
-
if (cli === 'gemini') {
|
|
56
|
-
const merged = { ...extraEnv };
|
|
57
|
-
if (!merged[GEMINI_TRUST_WORKSPACE_ENV] && !inheritedEnv[GEMINI_TRUST_WORKSPACE_ENV]) {
|
|
58
|
-
merged[GEMINI_TRUST_WORKSPACE_ENV] = 'true';
|
|
59
|
-
}
|
|
60
|
-
if (!merged[GEMINI_SYSTEM_SETTINGS_ENV]) {
|
|
61
|
-
merged[GEMINI_SYSTEM_SETTINGS_ENV] = getGeminiSystemSettingsPath();
|
|
62
|
-
}
|
|
63
|
-
return merged;
|
|
64
|
-
}
|
|
65
37
|
if (cli === 'agy' || cli === 'kiro-code' || cli === 'grok') {
|
|
66
38
|
return {
|
|
67
39
|
...extraEnv,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn-env.js","sourceRoot":"","sources":["../../../src/agent/spawn-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAErC,MAAM,sBAAsB,GAAG,iCAAiC,CAAC;AACjE,MAAM,0BAA0B,GAAG;IAC/B,GAAG;IACH,MAAM;IACN,YAAY;IACZ,WAAW;IACX,MAAM;IACN,oBAAoB;IACpB,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,UAAU;IACV,MAAM;IACN,OAAO;IACP,MAAM;IACN,UAAU;IACV,WAAW;IACX,UAAU;IACV,WAAW;CACL,CAAC;
|
|
1
|
+
{"version":3,"file":"spawn-env.js","sourceRoot":"","sources":["../../../src/agent/spawn-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAErC,MAAM,sBAAsB,GAAG,iCAAiC,CAAC;AACjE,MAAM,0BAA0B,GAAG;IAC/B,GAAG;IACH,MAAM;IACN,YAAY;IACZ,WAAW;IACX,MAAM;IACN,oBAAoB;IACpB,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,UAAU;IACV,MAAM;IACN,OAAO;IACP,MAAM;IACN,UAAU;IACV,WAAW;IACX,UAAU;IACV,WAAW;CACL,CAAC;AAEX,SAAS,cAAc,CACnB,QAAgC,EAChC,YAA+B,EAC/B,GAAW;IAEX,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,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EvE,IAAI,CAAC;QACD,IAAI,OAAO,GAAY,EAAE,CAAC;QAC1B,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC5B,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;YACvD,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,CAAC;QAED,MAAM,IAAI,GAAG,kCAAkC,CAAC,OAAO,CAAC,CAAC;QACzD,MAAM,UAAU,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;QACxD,MAAM,iBAAiB,GAAG,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;YAC/C,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC;YACrC,CAAC,CAAC,EAAE,CAAC;QACT,IAAI,iBAAiB,KAAK,UAAU;YAAE,OAAO;QAE7C,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACvD,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC7C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,wCAAwC,EAAG,KAAe,CAAC,OAAO,CAAC,CAAC;IACrF,CAAC;AACL,CAAC"}
|
package/dist/src/agent/spawn.js
CHANGED
|
@@ -31,17 +31,18 @@ import { stripInterviewTracker } from '../orchestrator/sanitize.js';
|
|
|
31
31
|
import { beginLiveRun, appendLiveRunText, setLiveRunTraceId, clearLiveRun, replaceLiveRunTools, appendLiveRunTool, getLiveRun } from './live-run-state.js';
|
|
32
32
|
import { setSpawnRef as setMemorySpawnRef, } from './memory-flush-controller.js';
|
|
33
33
|
import { applyCliEnvDefaults, buildSessionResumeKey, ensureOpencodeAlwaysAllowPermissions } from './spawn-env.js';
|
|
34
|
+
import { buildPromptForArgs, withHistoryPrompt } from './prompt-context.js';
|
|
34
35
|
import { attachWatchdog, DEFAULT_WATCHDOG_ABSOLUTE_HARD_CAP_MS } from './watchdog.js';
|
|
35
36
|
import { buildOpencodeRuntimeSnapshot, buildOpencodeSpawnAudit, pushOpencodeRawEvent, resolveOpencodeBinary, } from './opencode-diagnostics.js';
|
|
36
37
|
import { asCliEventRecord, discriminate, fieldString } from '../types/cli-events.js';
|
|
37
38
|
import { isJawRuntimeEvent, handleJawRuntimeEvent } from './claude-e-runtime.js';
|
|
38
39
|
import { jawRuntime } from './jwc-runtime.js';
|
|
39
40
|
import { appendTraceEvent, stampTraceTool, startTraceRun } from '../trace/store.js';
|
|
40
|
-
import { AGY_COMPLETE_KILL_REASON, extractAgyConversationId, resolveAgyEmptyCloseError, formatAgyTimeoutMessage, getAgyQuietCompletionDelayMs, isAgyStaleSessionOutput, normalizeAgyCloseText, stripAgyPromptEchoPrefix, stripAgyResumeReplayPrefix, stripAgyResumeReplayPrefixes, } from './agy-runtime.js';
|
|
41
|
+
import { AGY_COMPLETE_KILL_REASON, appendAgyFullText, classifyAgyTranscriptMode, describeAgyFinalSource, extractAgyConversationId, finalizeAgyFallbackText, formatAgyWatchdogContext, resolveAgyEmptyCloseError, formatAgyTimeoutMessage, getAgyQuietCompletionDelayMs, isAgyStaleSessionOutput, normalizeAgyCloseText, shouldFreezeAgyLiveDisplay, stripAgyPromptEchoPrefix, stripAgyResumeReplayPrefix, stripAgyResumeReplayPrefixes, } from './agy-runtime.js';
|
|
41
42
|
import { detectAgyCapabilities } from './agy-capabilities.js';
|
|
42
|
-
import { buildAgyBootstrapEnvelope } from './agy-bootstrap.js';
|
|
43
|
+
import { buildAgyBootstrapEnvelope, resolveAgyPromptOrder, } from './agy-bootstrap.js';
|
|
43
44
|
import { startAgyTranscriptWatcher } from './agy-transcript-watcher.js';
|
|
44
|
-
import { appendAssistantTextSegment, normalizeAssistantDisplayText, pushTrace } from './events/helpers.js';
|
|
45
|
+
import { appendAssistantTextSegment, emitAgentTool, normalizeAssistantDisplayText, pushTrace } from './events/helpers.js';
|
|
45
46
|
import { listKiroConversationIdsForCwd } from './kiro-auth.js';
|
|
46
47
|
import { captureKiroSessionIdAfterExit, finalizeKiroFullText, flushKiroStdoutContext, isKiroPlainTextCli, isKiroStaleSessionOutput, parseAiESessionIdFromStderr, processKiroStdoutChunk, } from './kiro-runtime.js';
|
|
47
48
|
import { resolveCursorModelVariant } from './cursor-runtime.js';
|
|
@@ -155,7 +156,7 @@ function emitKiroStreamEvents(events, ctx, agentLabel, cli, empTag, traceAudienc
|
|
|
155
156
|
if (ctx.liveScope)
|
|
156
157
|
replaceLiveRunTools(ctx.liveScope, ctx.toolLog);
|
|
157
158
|
appendParentLiveRunTool(ctx, tool);
|
|
158
|
-
|
|
159
|
+
emitAgentTool(ctx, agentLabel, tool, empTag);
|
|
159
160
|
}
|
|
160
161
|
}
|
|
161
162
|
export function killAgentById(agentId) {
|
|
@@ -430,7 +431,6 @@ export async function steerAgent(newPrompt, source) {
|
|
|
430
431
|
function makeCleanEnv(extraEnv = {}) {
|
|
431
432
|
const env = { ...process.env };
|
|
432
433
|
delete env["CLAUDE_CODE_SSE_PORT"];
|
|
433
|
-
delete env["GEMINI_SYSTEM_MD"];
|
|
434
434
|
// Phase 8: strip boss-only dispatch token from employee spawns so employees
|
|
435
435
|
// cannot authenticate against /api/orchestrate/dispatch even via localhost.
|
|
436
436
|
// Detect employee spawn by the explicit JAW_EMPLOYEE_MODE flag; main spawns
|
|
@@ -518,17 +518,6 @@ function isStaleWorklogHistoryArtifact(text) {
|
|
|
518
518
|
'正在从上一个 worklog 继续。',
|
|
519
519
|
].some(marker => value.includes(marker));
|
|
520
520
|
}
|
|
521
|
-
const HISTORY_BOUNDARY_INSTRUCTION = [
|
|
522
|
-
'[History Boundary]',
|
|
523
|
-
'Recent Context is read-only background. The Current Message below is the only task to execute now.',
|
|
524
|
-
'Do not continue prior plans, audits, commands, questions, or goals unless the Current Message explicitly asks to resume or continue them.',
|
|
525
|
-
].join('\n');
|
|
526
|
-
function withHistoryPrompt(prompt, historyBlock) {
|
|
527
|
-
const body = String(prompt || '');
|
|
528
|
-
if (!historyBlock)
|
|
529
|
-
return body;
|
|
530
|
-
return `${historyBlock}\n\n${HISTORY_BOUNDARY_INSTRUCTION}\n\n---\n[Current Message]\n${body}`;
|
|
531
|
-
}
|
|
532
521
|
function getLatestAssistantContentForAgyResume(workingDir) {
|
|
533
522
|
const rows = getRecentMessages.all(workingDir || null, getActiveChatSession(), 12);
|
|
534
523
|
const row = rows.find((msg) => msg.role === 'assistant' && typeof msg.content === 'string' && msg.content.trim().length > 0);
|
|
@@ -550,11 +539,9 @@ export { buildMediaPrompt, buildMediaPromptMany };
|
|
|
550
539
|
import { AcpClient } from '../cli/acp-client.js';
|
|
551
540
|
import { CodexAppClient } from './codex-app-client.js';
|
|
552
541
|
import { extractFromCodexAppEvent } from './codex-app-events.js';
|
|
553
|
-
import { shouldEmitHeartbeat, shouldResumeBucketSession
|
|
554
|
-
export { shouldEmitHeartbeat, shouldResumeBucketSession
|
|
542
|
+
import { shouldEmitHeartbeat, shouldResumeBucketSession } from './spawn/resume.js';
|
|
543
|
+
export { shouldEmitHeartbeat, shouldResumeBucketSession };
|
|
555
544
|
import { createQueueController, FALLBACK_MAX_RETRIES } from './spawn/queue.js';
|
|
556
|
-
const GEMINI_HISTORY_MAX_SESSIONS = 4;
|
|
557
|
-
const GEMINI_HISTORY_MAX_CHARS = 8000;
|
|
558
545
|
function cleanupEmployeeTmpDir(cwd, workingDir, label) {
|
|
559
546
|
if (cwd !== workingDir) {
|
|
560
547
|
try {
|
|
@@ -788,10 +775,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
788
775
|
catch (e) {
|
|
789
776
|
console.warn('[jaw:resume] stale bucket clear failed:', e.message);
|
|
790
777
|
}
|
|
791
|
-
if (cli === '
|
|
792
|
-
console.log(`[jaw:resume] ${cli} stale bucket rejected for model ${bucketModel ?? 'none'} → ${model}; starting fresh session`);
|
|
793
|
-
}
|
|
794
|
-
else if (cli === 'opencode' && resumeKey !== (bucketResumeKey ?? null)) {
|
|
778
|
+
if (cli === 'opencode' && resumeKey !== (bucketResumeKey ?? null)) {
|
|
795
779
|
console.log(`[jaw:resume] ${cli} resume key changed ${bucketResumeKey ?? 'none'} → ${resumeKey}; starting fresh session`);
|
|
796
780
|
}
|
|
797
781
|
else {
|
|
@@ -849,15 +833,17 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
849
833
|
const resumeSessionId = empSid || (isResume ? bucketSessionId : null);
|
|
850
834
|
const needsHistory = !opts._skipHistory && (!isResume || cli === 'pi');
|
|
851
835
|
const historyBlock = needsHistory
|
|
852
|
-
? buildHistoryBlock(prompt, settings["workingDir"],
|
|
836
|
+
? buildHistoryBlock(prompt, settings["workingDir"], 10, 8000)
|
|
853
837
|
: '';
|
|
854
838
|
let agyBootstrap = null;
|
|
855
|
-
let promptForArgs = (
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
839
|
+
let promptForArgs = buildPromptForArgs({
|
|
840
|
+
cli,
|
|
841
|
+
effectiveProvider,
|
|
842
|
+
prompt,
|
|
843
|
+
historyBlock,
|
|
844
|
+
sysPrompt,
|
|
845
|
+
isResume,
|
|
846
|
+
});
|
|
861
847
|
const agyResumeReplayPrefix = cli === 'agy' && isResume
|
|
862
848
|
? getLatestAssistantContentForAgyResume(settings["workingDir"])
|
|
863
849
|
: null;
|
|
@@ -949,6 +935,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
949
935
|
historyBlock,
|
|
950
936
|
workingDir: spawnCwd,
|
|
951
937
|
sessionId: resumeSessionId,
|
|
938
|
+
order: resolveAgyPromptOrder(cfg.promptOrder),
|
|
952
939
|
...(sysPrompt ? { operationalContext: sysPrompt } : {}),
|
|
953
940
|
});
|
|
954
941
|
promptForArgs = agyBootstrap.prompt;
|
|
@@ -983,11 +970,6 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
983
970
|
if (cli === 'claude-e')
|
|
984
971
|
console.log(`[jaw:${agentLabel}:args] ${JSON.stringify(args)}`);
|
|
985
972
|
}
|
|
986
|
-
if (cli === 'gemini' && sysPrompt) {
|
|
987
|
-
const tmpSysFile = join(os.tmpdir(), `jaw-gemini-sys-${agentLabel}.md`);
|
|
988
|
-
fs.writeFileSync(tmpSysFile, sysPrompt);
|
|
989
|
-
spawnEnv["GEMINI_SYSTEM_MD"] = tmpSysFile;
|
|
990
|
-
}
|
|
991
973
|
// ─── Copilot ACP branch ──────────────────────
|
|
992
974
|
if (cli === 'copilot') {
|
|
993
975
|
// Write model + reasoning_effort to ~/.copilot/config.json (CLI flags unsupported)
|
|
@@ -1066,6 +1048,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1066
1048
|
hasClaudeStreamEvents: false, sessionId: null, cost: null,
|
|
1067
1049
|
turns: null, duration: null, tokens: null, stderrBuf: '',
|
|
1068
1050
|
thinkingBuf: '',
|
|
1051
|
+
runStartedAt: Date.now(),
|
|
1069
1052
|
liveScope: effectiveLiveScope,
|
|
1070
1053
|
parentLiveScope: parentLiveScopeForChild,
|
|
1071
1054
|
traceRunId,
|
|
@@ -1086,7 +1069,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1086
1069
|
if (ctx.liveScope)
|
|
1087
1070
|
replaceLiveRunTools(ctx.liveScope, ctx.toolLog);
|
|
1088
1071
|
appendParentLiveRunTool(ctx, tool);
|
|
1089
|
-
|
|
1072
|
+
emitAgentTool(ctx, agentLabel, tool, empTag);
|
|
1090
1073
|
}
|
|
1091
1074
|
ctx.thinkingBuf = '';
|
|
1092
1075
|
}
|
|
@@ -1120,7 +1103,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1120
1103
|
if (ctx.liveScope)
|
|
1121
1104
|
replaceLiveRunTools(ctx.liveScope, ctx.toolLog);
|
|
1122
1105
|
appendParentLiveRunTool(ctx, parsedTool);
|
|
1123
|
-
|
|
1106
|
+
emitAgentTool(ctx, agentLabel, parsedTool, empTag);
|
|
1124
1107
|
// Reset heartbeat gate on actually visible broadcast (not 💭)
|
|
1125
1108
|
lastVisibleBroadcastTs = Date.now();
|
|
1126
1109
|
heartbeatSent = false;
|
|
@@ -1149,7 +1132,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1149
1132
|
if (ctx.liveScope)
|
|
1150
1133
|
replaceLiveRunTools(ctx.liveScope, ctx.toolLog);
|
|
1151
1134
|
appendParentLiveRunTool(ctx, parsed.tool);
|
|
1152
|
-
|
|
1135
|
+
emitAgentTool(ctx, agentLabel, parsed.tool, empTag);
|
|
1153
1136
|
}
|
|
1154
1137
|
});
|
|
1155
1138
|
// [P2-3.15] session/request_permission → audit record in toolLog
|
|
@@ -1164,7 +1147,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1164
1147
|
if (ctx.liveScope)
|
|
1165
1148
|
replaceLiveRunTools(ctx.liveScope, ctx.toolLog);
|
|
1166
1149
|
appendParentLiveRunTool(ctx, parsed.tool);
|
|
1167
|
-
|
|
1150
|
+
emitAgentTool(ctx, agentLabel, parsed.tool, empTag);
|
|
1168
1151
|
}
|
|
1169
1152
|
});
|
|
1170
1153
|
// stderr_activity → stderrBuf accumulation + conditional heartbeat
|
|
@@ -1180,12 +1163,10 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1180
1163
|
heartbeatSent = true;
|
|
1181
1164
|
const elapsed = Math.round((Date.now() - lastVisibleBroadcastTs) / 1000);
|
|
1182
1165
|
console.log(` ⏳ agent active (no visible event for ${elapsed}s)`);
|
|
1183
|
-
|
|
1184
|
-
agentId: agentLabel,
|
|
1166
|
+
emitAgentTool(ctx, agentLabel, {
|
|
1185
1167
|
icon: '⏳',
|
|
1186
1168
|
label: 'working... (no visible progress)',
|
|
1187
|
-
|
|
1188
|
-
}, traceAudience);
|
|
1169
|
+
}, empTag);
|
|
1189
1170
|
}
|
|
1190
1171
|
});
|
|
1191
1172
|
// Run ACP flow
|
|
@@ -1322,6 +1303,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1322
1303
|
toolLog: [],
|
|
1323
1304
|
seenToolKeys: new Set(),
|
|
1324
1305
|
hasClaudeStreamEvents: false,
|
|
1306
|
+
runStartedAt: Date.now(),
|
|
1325
1307
|
sessionId: null,
|
|
1326
1308
|
cost: null,
|
|
1327
1309
|
turns: null,
|
|
@@ -1352,7 +1334,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1352
1334
|
if (ctx.liveScope)
|
|
1353
1335
|
replaceLiveRunTools(ctx.liveScope, ctx.toolLog);
|
|
1354
1336
|
appendParentLiveRunTool(ctx, tool);
|
|
1355
|
-
|
|
1337
|
+
emitAgentTool(ctx, agentLabel, tool, empTag);
|
|
1356
1338
|
}
|
|
1357
1339
|
ctx.thinkingBuf = '';
|
|
1358
1340
|
}
|
|
@@ -1397,7 +1379,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1397
1379
|
if (ctx.liveScope)
|
|
1398
1380
|
replaceLiveRunTools(ctx.liveScope, ctx.toolLog);
|
|
1399
1381
|
appendParentLiveRunTool(ctx, tool);
|
|
1400
|
-
|
|
1382
|
+
emitAgentTool(ctx, agentLabel, tool, empTag);
|
|
1401
1383
|
return;
|
|
1402
1384
|
}
|
|
1403
1385
|
if (event.kind === 'session') {
|
|
@@ -1543,6 +1525,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1543
1525
|
hasClaudeStreamEvents: false, sessionId: null, cost: null,
|
|
1544
1526
|
turns: null, duration: null, tokens: null, stderrBuf: '',
|
|
1545
1527
|
thinkingBuf: '',
|
|
1528
|
+
runStartedAt: Date.now(),
|
|
1546
1529
|
liveScope: effectiveLiveScope,
|
|
1547
1530
|
parentLiveScope: parentLiveScopeForChild,
|
|
1548
1531
|
traceRunId,
|
|
@@ -1562,7 +1545,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1562
1545
|
if (ctx.liveScope)
|
|
1563
1546
|
replaceLiveRunTools(ctx.liveScope, ctx.toolLog);
|
|
1564
1547
|
appendParentLiveRunTool(ctx, tool);
|
|
1565
|
-
|
|
1548
|
+
emitAgentTool(ctx, agentLabel, tool, empTag);
|
|
1566
1549
|
}
|
|
1567
1550
|
ctx.thinkingBuf = '';
|
|
1568
1551
|
}
|
|
@@ -1594,7 +1577,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1594
1577
|
if (ctx.liveScope)
|
|
1595
1578
|
replaceLiveRunTools(ctx.liveScope, ctx.toolLog);
|
|
1596
1579
|
appendParentLiveRunTool(ctx, parsedTool);
|
|
1597
|
-
|
|
1580
|
+
emitAgentTool(ctx, agentLabel, parsedTool, empTag);
|
|
1598
1581
|
lastVisibleBroadcastTs = Date.now();
|
|
1599
1582
|
heartbeatSent = false;
|
|
1600
1583
|
}
|
|
@@ -1630,12 +1613,10 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1630
1613
|
heartbeatSent = true;
|
|
1631
1614
|
const elapsed = Math.round((Date.now() - lastVisibleBroadcastTs) / 1000);
|
|
1632
1615
|
console.log(` ⏳ agent active (no visible event for ${elapsed}s)`);
|
|
1633
|
-
|
|
1634
|
-
agentId: agentLabel,
|
|
1616
|
+
emitAgentTool(ctx, agentLabel, {
|
|
1635
1617
|
icon: '⏳',
|
|
1636
1618
|
label: 'working... (no visible progress)',
|
|
1637
|
-
|
|
1638
|
-
}, traceAudience);
|
|
1619
|
+
}, empTag);
|
|
1639
1620
|
}
|
|
1640
1621
|
});
|
|
1641
1622
|
let turnCompleted = false;
|
|
@@ -1760,7 +1741,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1760
1741
|
});
|
|
1761
1742
|
return { child, promise: resultPromise };
|
|
1762
1743
|
}
|
|
1763
|
-
// ─── Standard CLI branch (claude/codex/
|
|
1744
|
+
// ─── Standard CLI branch (claude/codex/opencode) ──────
|
|
1764
1745
|
// DIFF-B: Windows needs shell:true only when falling back to .cmd shims.
|
|
1765
1746
|
const spawnCommand = cli === 'opencode' && process.platform !== 'win32'
|
|
1766
1747
|
? (resolvedOpencodeBinary || detected.path || cli)
|
|
@@ -1863,6 +1844,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1863
1844
|
toolLog: [],
|
|
1864
1845
|
seenToolKeys: new Set(),
|
|
1865
1846
|
hasClaudeStreamEvents: false,
|
|
1847
|
+
runStartedAt: Date.now(),
|
|
1866
1848
|
sessionId: (kiroPlainText && isResume && resumeSessionId) ? resumeSessionId : null,
|
|
1867
1849
|
cost: null,
|
|
1868
1850
|
turns: null,
|
|
@@ -1877,13 +1859,15 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1877
1859
|
parentLiveScope: parentLiveScopeForChild,
|
|
1878
1860
|
traceRunId,
|
|
1879
1861
|
traceAudience,
|
|
1880
|
-
geminiResultSeen: false,
|
|
1881
1862
|
...(opencodeSpawnAudit ? { opencodeSpawnAudit: opencodeSpawnAudit } : {}),
|
|
1882
1863
|
...(agyResumeOffset > 0 ? { agyResumeOffset, agyBytesReceived: 0 } : {}),
|
|
1883
1864
|
...(cli === 'agy' ? {
|
|
1865
|
+
agyTranscriptMode: 'not-started',
|
|
1866
|
+
agyLastActivitySource: 'none',
|
|
1884
1867
|
...(agyBootstrap ? {
|
|
1885
1868
|
agyBootstrapSentinel: agyBootstrap.sentinel,
|
|
1886
1869
|
agyBootstrapHash: agyBootstrap.hash,
|
|
1870
|
+
metadata: { agyPromptSpill: agyBootstrap.spill },
|
|
1887
1871
|
} : {}),
|
|
1888
1872
|
agyBootstrapAccepted: false,
|
|
1889
1873
|
agyBootstrapAcceptanceMode: agyBootstrap ? 'pending' : 'not-applicable',
|
|
@@ -1891,7 +1875,6 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1891
1875
|
...(kiroPlainText || cli === 'agy' || cli === 'pi' ? { liveOutputText: '' } : {}),
|
|
1892
1876
|
...(kiroPlainText ? { kiroLastVisibleAt: Date.now(), kiroHeartbeatSent: false } : {}),
|
|
1893
1877
|
};
|
|
1894
|
-
let geminiWatchdog = null;
|
|
1895
1878
|
let agyClosing = false;
|
|
1896
1879
|
const scheduleAgyQuietCompletion = () => {
|
|
1897
1880
|
if (cli !== 'agy')
|
|
@@ -1942,6 +1925,12 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1942
1925
|
const stallWatchdog = attachWatchdog(child, agentLabel, (reason) => {
|
|
1943
1926
|
console.log(`[jaw:watchdog] killing ${agentLabel} — ${reason}`);
|
|
1944
1927
|
ctx.stallReason = reason;
|
|
1928
|
+
if (cli === 'agy') {
|
|
1929
|
+
ctx.agyTranscriptMode = classifyAgyTranscriptMode(ctx);
|
|
1930
|
+
const agyWatchdogContext = formatAgyWatchdogContext(ctx);
|
|
1931
|
+
ctx.stderrBuf = ctx.stderrBuf ? `${ctx.stderrBuf}\n${agyWatchdogContext}` : agyWatchdogContext;
|
|
1932
|
+
pushTrace(ctx, agyWatchdogContext);
|
|
1933
|
+
}
|
|
1945
1934
|
if (child.pid) {
|
|
1946
1935
|
killProcessTree(child.pid, 'SIGTERM');
|
|
1947
1936
|
setTimeout(() => {
|
|
@@ -1964,12 +1953,12 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
1964
1953
|
cli,
|
|
1965
1954
|
empTag,
|
|
1966
1955
|
traceAudience,
|
|
1967
|
-
onEmit: (emitCtx, tool, label, _cliName, tag,
|
|
1956
|
+
onEmit: (emitCtx, tool, label, _cliName, tag, _audience) => {
|
|
1968
1957
|
stampTraceTool(tool, emitCtx, tool.toolType || 'tool');
|
|
1969
1958
|
if (emitCtx.liveScope)
|
|
1970
1959
|
replaceLiveRunTools(emitCtx.liveScope, emitCtx.toolLog);
|
|
1971
1960
|
appendParentLiveRunTool(emitCtx, tool);
|
|
1972
|
-
|
|
1961
|
+
emitAgentTool(emitCtx, label, tool, tag);
|
|
1973
1962
|
scheduleAgyQuietCompletion();
|
|
1974
1963
|
},
|
|
1975
1964
|
onActivity: () => {
|
|
@@ -2001,6 +1990,9 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2001
1990
|
eventType: fieldString(asCliEventRecord(raw).type, '<no-type>'),
|
|
2002
1991
|
raw,
|
|
2003
1992
|
});
|
|
1993
|
+
if (cli === 'grok' || (cli === 'ai-e' && ctx.effectiveProvider === 'grok')) {
|
|
1994
|
+
ctx.stallWatchdog?.markProgress();
|
|
1995
|
+
}
|
|
2004
1996
|
// claude-e / ai-e Claude: intercept jaw_runtime events BEFORE discriminator
|
|
2005
1997
|
if ((cli === 'claude-e' || cli === 'ai-e') && isJawRuntimeEvent(raw)) {
|
|
2006
1998
|
const rtEvt = raw;
|
|
@@ -2036,16 +2028,6 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2036
2028
|
if (!ctx.sessionId)
|
|
2037
2029
|
ctx.sessionId = extractSessionId(dispatchCli, event);
|
|
2038
2030
|
extractFromEvent(dispatchCli, event, ctx, agentLabel, empTag);
|
|
2039
|
-
// Gemini watchdog: AFTER extractFromEvent sets geminiResultSeen
|
|
2040
|
-
if (dispatchCli === 'gemini' && ctx.geminiResultSeen && !geminiWatchdog) {
|
|
2041
|
-
geminiWatchdog = setTimeout(() => {
|
|
2042
|
-
console.warn(`[jaw:gemini-watchdog] ${agentLabel} — result seen but close not received after 10s, killing`);
|
|
2043
|
-
try {
|
|
2044
|
-
child.kill('SIGTERM');
|
|
2045
|
-
}
|
|
2046
|
-
catch { /* already dead */ }
|
|
2047
|
-
}, 10000);
|
|
2048
|
-
}
|
|
2049
2031
|
// Sub-agent wait: keep stall timer alive
|
|
2050
2032
|
if (ctx.hasActiveSubAgent) {
|
|
2051
2033
|
opts.lifecycle?.onActivity?.('heartbeat');
|
|
@@ -2072,15 +2054,14 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2072
2054
|
opts.lifecycle?.onActivity?.('stdout');
|
|
2073
2055
|
lastOpencodeIoAt = Date.now();
|
|
2074
2056
|
if (cli === 'agy') {
|
|
2057
|
+
ctx.agyLastActivitySource = 'stdout';
|
|
2075
2058
|
const rawText = agyUtf8.write(chunk);
|
|
2076
2059
|
if (!rawText)
|
|
2077
2060
|
return;
|
|
2061
|
+
ctx.stallWatchdog?.markProgress();
|
|
2078
2062
|
// Defensive ANSI strip (belt-and-suspenders with NO_COLOR=1)
|
|
2079
2063
|
const text = rawText.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, '');
|
|
2080
|
-
|
|
2081
|
-
ctx.fullText += text;
|
|
2082
|
-
else if (ctx.fullText.length < 102_500)
|
|
2083
|
-
ctx.fullText += text.slice(0, 102_400 - ctx.fullText.length);
|
|
2064
|
+
appendAgyFullText(ctx, text);
|
|
2084
2065
|
if (!ctx.sessionId)
|
|
2085
2066
|
ctx.sessionId = extractAgyConversationId(ctx.fullText);
|
|
2086
2067
|
if (ctx.agyResumeOffset && ctx.agyResumeOffset > 0) {
|
|
@@ -2100,6 +2081,12 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2100
2081
|
scheduleAgyQuietCompletion();
|
|
2101
2082
|
return;
|
|
2102
2083
|
}
|
|
2084
|
+
if (shouldFreezeAgyLiveDisplay(ctx)) {
|
|
2085
|
+
// Display frozen past AGY_LIVE_DISPLAY_MAX_CHARS; the close path
|
|
2086
|
+
// promotes the full text into the live candidate (finalizeAgyFallbackText).
|
|
2087
|
+
scheduleAgyQuietCompletion();
|
|
2088
|
+
return;
|
|
2089
|
+
}
|
|
2103
2090
|
const visibleFullText = isResume
|
|
2104
2091
|
? stripAgyResumeReplayPrefixes(ctx.fullText, agyResumeReplayPrefixes).text
|
|
2105
2092
|
: ctx.fullText;
|
|
@@ -2126,6 +2113,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2126
2113
|
const text = kiroUtf8.write(chunk);
|
|
2127
2114
|
if (!text)
|
|
2128
2115
|
return;
|
|
2116
|
+
ctx.stallWatchdog?.markProgress();
|
|
2129
2117
|
appendTraceEvent({ runId: ctx.traceRunId, source: 'cli_raw', eventType: 'plain_text', raw: text });
|
|
2130
2118
|
const events = processKiroStdoutChunk(ctx, text);
|
|
2131
2119
|
if (events.length) {
|
|
@@ -2147,6 +2135,10 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2147
2135
|
clearAgyQuietCompletionTimer();
|
|
2148
2136
|
lastOpencodeIoAt = Date.now();
|
|
2149
2137
|
const text = chunk.toString().trim();
|
|
2138
|
+
if (cli === 'agy')
|
|
2139
|
+
ctx.agyLastActivitySource = 'stderr';
|
|
2140
|
+
if ((kiroPlainText || cli === 'agy') && text)
|
|
2141
|
+
ctx.stallWatchdog?.markProgress();
|
|
2150
2142
|
appendTraceEvent({ runId: ctx.traceRunId, source: 'stderr', eventType: 'stderr', raw: text });
|
|
2151
2143
|
console.error(`[jaw:stderr:${agentLabel}] ${text}`);
|
|
2152
2144
|
if (ctx.stderrBuf.length < 4000)
|
|
@@ -2157,10 +2149,6 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2157
2149
|
clearOpencodeIdleTimer();
|
|
2158
2150
|
clearAgyQuietCompletionTimer();
|
|
2159
2151
|
stallWatchdog.stop();
|
|
2160
|
-
if (geminiWatchdog) {
|
|
2161
|
-
clearTimeout(geminiWatchdog);
|
|
2162
|
-
geminiWatchdog = null;
|
|
2163
|
-
}
|
|
2164
2152
|
if (stdSettled)
|
|
2165
2153
|
return; // error handler already resolved
|
|
2166
2154
|
// [I1] Flush residual NDJSON buffer — last event may lack trailing newline
|
|
@@ -2174,7 +2162,7 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2174
2162
|
if (agyUtf8) {
|
|
2175
2163
|
const remaining = agyUtf8.end();
|
|
2176
2164
|
if (remaining)
|
|
2177
|
-
ctx
|
|
2165
|
+
appendAgyFullText(ctx, remaining);
|
|
2178
2166
|
}
|
|
2179
2167
|
if (kiroUtf8) {
|
|
2180
2168
|
const remaining = kiroUtf8.end();
|
|
@@ -2215,6 +2203,9 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2215
2203
|
}
|
|
2216
2204
|
agyClosing = true;
|
|
2217
2205
|
agyTranscriptWatcher?.stop();
|
|
2206
|
+
if (cli === 'agy') {
|
|
2207
|
+
ctx.agyTranscriptMode = classifyAgyTranscriptMode(ctx);
|
|
2208
|
+
}
|
|
2218
2209
|
if (cli === 'agy' && isResume && isAgyStaleSessionOutput(ctx.fullText)) {
|
|
2219
2210
|
console.log(`[jaw:agy] stale session detected (Warning: conversation not found) — clearing bucket`);
|
|
2220
2211
|
try {
|
|
@@ -2321,6 +2312,20 @@ export function spawnAgent(prompt, opts = {}) {
|
|
|
2321
2312
|
const agyTranscriptErrorMessage = cli === 'agy' && !agyTimedOut
|
|
2322
2313
|
? resolveAgyEmptyCloseError(ctx)
|
|
2323
2314
|
: null;
|
|
2315
|
+
if (cli === 'agy' && !agyTimedOut && !agyTranscriptErrorMessage) {
|
|
2316
|
+
// Mirror the per-chunk display derivation ORDER (replay → echo → tracker →
|
|
2317
|
+
// normalize). The close-path strips above run echo-before-replay and can
|
|
2318
|
+
// leave a prompt echo in resumed output; every strip is a prefix-stripper
|
|
2319
|
+
// that no-ops when the prefix is already gone, so re-running them in
|
|
2320
|
+
// per-chunk order is idempotent and safe.
|
|
2321
|
+
const promotedBase = isResume
|
|
2322
|
+
? stripAgyResumeReplayPrefixes(ctx.fullText, agyResumeReplayPrefixes).text
|
|
2323
|
+
: ctx.fullText;
|
|
2324
|
+
const promotedEcho = stripAgyPromptEchoPrefix(promotedBase, promptForArgs).text;
|
|
2325
|
+
finalizeAgyFallbackText(ctx, normalizeAssistantDisplayText(stripInterviewTracker(promotedEcho)));
|
|
2326
|
+
}
|
|
2327
|
+
if (cli === 'agy')
|
|
2328
|
+
pushTrace(ctx, describeAgyFinalSource(ctx));
|
|
2324
2329
|
const effectiveExitCode = agyCompletedByQuietOutput && !agyTranscriptErrorMessage
|
|
2325
2330
|
? 0
|
|
2326
2331
|
: agyTranscriptErrorMessage
|