@draht/coding-agent 2026.10.31 → 2026.11.5-1
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/CHANGELOG.md +131 -0
- package/dist/bundle/chunks/anthropic-messages-UJZ4SGHU.js +6 -0
- package/dist/bundle/chunks/azure-openai-responses-NCMJPZVJ.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +27 -24
- package/dist/bundle/chunks/chunk-2JZLKNZ4.js +3 -0
- package/dist/bundle/chunks/chunk-3BJ462DN.js +132 -0
- package/dist/bundle/chunks/chunk-5OXIAQP5.js +2 -0
- package/dist/bundle/chunks/chunk-6M3D4XVD.js +2 -0
- package/dist/bundle/chunks/{chunk-KVH4HR57.js → chunk-6WESOD4H.js} +1 -1
- package/dist/bundle/chunks/chunk-AOCWORXE.js +2 -0
- package/dist/bundle/chunks/chunk-BK5LXGIH.js +2 -0
- package/dist/bundle/chunks/chunk-CA23BDNK.js +2 -0
- package/dist/bundle/chunks/chunk-DWOGGNWY.js +18 -0
- package/dist/bundle/chunks/{chunk-RMLEJL4F.js → chunk-EOXOMUKR.js} +1 -1
- package/dist/bundle/chunks/chunk-F5TDVH26.js +159 -0
- package/dist/bundle/chunks/chunk-GBFVS2SF.js +12 -0
- package/dist/bundle/chunks/{chunk-ITP6IDBA.js → chunk-GQXRTK54.js} +2 -2
- package/dist/bundle/chunks/chunk-HJ3PS7QP.js +4 -0
- package/dist/bundle/chunks/chunk-ITKDPD4D.js +12 -0
- package/dist/bundle/chunks/chunk-KFREX3FS.js +10 -0
- package/dist/bundle/chunks/chunk-LO6CVU2L.js +6 -0
- package/dist/bundle/chunks/{chunk-AACPRSR2.js → chunk-P7O36UDU.js} +2 -2
- package/dist/bundle/chunks/chunk-PMINB7UH.js +1401 -0
- package/dist/bundle/chunks/chunk-PZKD35UB.js +2 -0
- package/dist/bundle/chunks/{chunk-JQF3BGRS.js → chunk-Q2QKCYPU.js} +1 -1
- package/dist/bundle/chunks/chunk-QBUTRTYN.js +2 -0
- package/dist/bundle/chunks/chunk-SUVMF4W5.js +2 -0
- package/dist/bundle/chunks/chunk-UFACUBF2.js +16 -0
- package/dist/bundle/chunks/chunk-VXO6B72D.js +9 -0
- package/dist/bundle/chunks/{chunk-NUUJKLOX.js → chunk-WXASQQBZ.js} +9 -9
- package/dist/bundle/chunks/chunk-Y3NLUJYO.js +2 -0
- package/dist/bundle/chunks/chunk-Y7QE2R34.js +2 -0
- package/dist/bundle/chunks/chunk-YD5VPPI4.js +30 -0
- package/dist/bundle/chunks/chunk-YWRWN7ZB.js +82 -0
- package/dist/bundle/chunks/{cli-LGOE6EXL.js → cli-4SUT6MJ6.js} +10 -10
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-BJVMNETD.js +2 -0
- package/dist/bundle/chunks/{execute-ZVQ7ITER.js → execute-ZI7T2SUH.js} +1 -1
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/{google-generative-ai-IHELIMAC.js → google-generative-ai-N5IPPKQY.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-3QCFWSNG.js → google-vertex-A4BKUE4H.js} +1 -1
- package/dist/bundle/chunks/https-proxy-agent-WQIRL24U.js +13 -0
- package/dist/bundle/chunks/image-resize-worker.js +1 -1
- package/dist/bundle/chunks/kimi-coding.js +1 -1
- package/dist/bundle/chunks/lib-ULKZYRGD.js +9 -0
- package/dist/bundle/chunks/{llama-cpp-classify-6J5XKC7Q.js → llama-cpp-classify-L4URPZ4F.js} +1 -1
- package/dist/bundle/chunks/meta.js +1 -1
- package/dist/bundle/chunks/mistral-conversations-CK2BS74V.js +5 -0
- package/dist/bundle/chunks/{multipart-parser-AZP5BX2W.js → multipart-parser-HMCXZ4BD.js} +1 -1
- package/dist/bundle/chunks/{node-BZAVEWJ3.js → node-DXZFQBEO.js} +1 -1
- package/dist/bundle/chunks/{node-C2JGH2OB.js → node-LBZLUIBE.js} +1 -1
- package/dist/bundle/chunks/openai-codex-responses-XGVNKP4D.js +10 -0
- package/dist/bundle/chunks/openai-completions-72XZO4Q3.js +7 -0
- package/dist/bundle/chunks/{openai-decisions-NDYRKL2E.js → openai-decisions-P5OCXLLD.js} +1 -1
- package/dist/bundle/chunks/openai-responses-RGLZ4E3Q.js +4 -0
- package/dist/bundle/chunks/{openrouter-images-ZIDF5HXA.js → openrouter-images-LSBWMZDK.js} +1 -1
- package/dist/bundle/chunks/pi-messages-CL4MEVNS.js +8 -0
- package/dist/bundle/chunks/radius.js +1 -1
- package/dist/bundle/chunks/{runtime-MZVF4MP6.js → runtime-F4362CZF.js} +1 -1
- package/dist/bundle/chunks/{runtime-7BIFTREJ.js → runtime-FJYRBK3O.js} +1 -1
- package/dist/bundle/chunks/settings-manager-T6G6KKY3.js +2 -0
- package/dist/bundle/chunks/src-KDGO7EGF.js +4 -0
- package/dist/bundle/chunks/typesafe-system-one-BFYS6AEA.js +2 -0
- package/dist/bundle/chunks/virtual-modules-BPZIVXNK.js +2 -0
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +8 -7
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +3 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/config.d.ts +10 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +24 -5
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +4 -3
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +16 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +104 -30
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/ai-schemas.d.ts +166 -0
- package/dist/core/ai-schemas.d.ts.map +1 -0
- package/dist/core/ai-schemas.js +21 -0
- package/dist/core/ai-schemas.js.map +1 -0
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +3 -2
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +3 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/bug-report.d.ts +4 -4
- package/dist/core/cache-warmer.d.ts.map +1 -1
- package/dist/core/cache-warmer.js +2 -0
- package/dist/core/cache-warmer.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +4 -2
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +16 -4
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/exec.d.ts +9 -1
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +104 -60
- package/dist/core/exec.js.map +1 -1
- package/dist/core/export-html/template.css +9 -0
- package/dist/core/export-html/template.js +165 -45
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +3 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/ai-extension-view.d.ts +19 -0
- package/dist/core/extensions/ai-extension-view.d.ts.map +1 -0
- package/dist/core/extensions/ai-extension-view.js +22 -0
- package/dist/core/extensions/ai-extension-view.js.map +1 -0
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +15 -9
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +1 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +9 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +55 -11
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/virtual-modules.js +6 -5
- package/dist/core/extensions/virtual-modules.js.map +1 -1
- package/dist/core/keybindings.d.ts +2 -2
- package/dist/core/keybindings.js +1 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/mcp-servers.d.ts +21 -38
- package/dist/core/mcp-servers.d.ts.map +1 -1
- package/dist/core/mcp-servers.js +58 -134
- package/dist/core/mcp-servers.js.map +1 -1
- package/dist/core/model-config.d.ts +1717 -1990
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +2 -3
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +16 -9
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +4 -4
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/package-manager.d.ts +24 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +215 -52
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/pi-manifest.d.ts +1 -0
- package/dist/core/pi-manifest.d.ts.map +1 -1
- package/dist/core/pi-manifest.js +3 -0
- package/dist/core/pi-manifest.js.map +1 -1
- package/dist/core/project-trust.js +1 -1
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/provider-composer.d.ts +2 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +8 -4
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/resource-loader.d.ts +4 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +38 -23
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +3 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +7 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +32 -13
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +2 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +11 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +4 -2
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +8 -1
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +6 -15
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.js +2 -2
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/source-info.d.ts +9 -0
- package/dist/core/source-info.d.ts.map +1 -1
- package/dist/core/source-info.js +14 -0
- package/dist/core/source-info.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +5 -6
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +2 -2
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts +3 -3
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +2 -4
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts +2 -2
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +41 -25
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +4 -5
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +73 -70
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts +2 -2
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +2 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts +2 -2
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +2 -7
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/renderers/write.d.ts.map +1 -1
- package/dist/core/tools/renderers/write.js +19 -19
- package/dist/core/tools/renderers/write.js.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts +11 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/truncate.d.ts +0 -14
- package/dist/core/tools/truncate.d.ts.map +1 -1
- package/dist/core/tools/truncate.js +0 -29
- package/dist/core/tools/truncate.js.map +1 -1
- package/dist/core/tools/write.d.ts +2 -2
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +15 -8
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/core/usage-totals.d.ts.map +1 -1
- package/dist/core/usage-totals.js +2 -0
- package/dist/core/usage-totals.js.map +1 -1
- package/dist/extensions/codemode/renderer.d.ts.map +1 -1
- package/dist/extensions/codemode/renderer.js +6 -2
- package/dist/extensions/codemode/renderer.js.map +1 -1
- package/dist/extensions/codemode/tool.d.ts +2 -1
- package/dist/extensions/codemode/tool.d.ts.map +1 -1
- package/dist/extensions/codemode/tool.js +33 -8
- package/dist/extensions/codemode/tool.js.map +1 -1
- package/dist/extensions/llama/client.d.ts +2 -0
- package/dist/extensions/llama/client.d.ts.map +1 -1
- package/dist/extensions/llama/client.js +23 -2
- package/dist/extensions/llama/client.js.map +1 -1
- package/dist/extensions/llama/ui.d.ts.map +1 -1
- package/dist/extensions/llama/ui.js +16 -4
- package/dist/extensions/llama/ui.js.map +1 -1
- package/dist/extensions/mcp/cli.d.ts +2 -0
- package/dist/extensions/mcp/cli.d.ts.map +1 -1
- package/dist/extensions/mcp/cli.js +72 -15
- package/dist/extensions/mcp/cli.js.map +1 -1
- package/dist/extensions/mcp/config.d.ts.map +1 -1
- package/dist/extensions/mcp/config.js +4 -7
- package/dist/extensions/mcp/config.js.map +1 -1
- package/dist/extensions/mcp/index.d.ts.map +1 -1
- package/dist/extensions/mcp/index.js +2 -2
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/oauth.d.ts +13 -50
- package/dist/extensions/mcp/oauth.d.ts.map +1 -1
- package/dist/extensions/mcp/oauth.js +53 -319
- package/dist/extensions/mcp/oauth.js.map +1 -1
- package/dist/extensions/mcp/resources.d.ts +1 -1
- package/dist/extensions/mcp/resources.d.ts.map +1 -1
- package/dist/extensions/mcp/resources.js +4 -3
- package/dist/extensions/mcp/resources.js.map +1 -1
- package/dist/extensions/mcp/runtime.d.ts +4 -3
- package/dist/extensions/mcp/runtime.d.ts.map +1 -1
- package/dist/extensions/mcp/runtime.js +4 -3
- package/dist/extensions/mcp/runtime.js.map +1 -1
- package/dist/extensions/mcp/tools.d.ts +2 -23
- package/dist/extensions/mcp/tools.d.ts.map +1 -1
- package/dist/extensions/mcp/tools.js +6 -58
- package/dist/extensions/mcp/tools.js.map +1 -1
- package/dist/extensions/mcp/ui.d.ts +1 -0
- package/dist/extensions/mcp/ui.d.ts.map +1 -1
- package/dist/extensions/mcp/ui.js +33 -24
- package/dist/extensions/mcp/ui.js.map +1 -1
- package/dist/extensions/tool-search/tool.d.ts +21 -6
- package/dist/extensions/tool-search/tool.d.ts.map +1 -1
- package/dist/extensions/tool-search/tool.js +104 -36
- package/dist/extensions/tool-search/tool.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +16 -8
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +4 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +44 -20
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +5 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +12 -4
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +5 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +12 -4
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +4 -18
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +7 -0
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-entry.js +2 -1
- package/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +5 -2
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +12 -4
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/diff.d.ts.map +1 -1
- package/dist/modes/interactive/components/diff.js +11 -5
- package/dist/modes/interactive/components/diff.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +2 -0
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +4 -0
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +9 -1
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +5 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +104 -10
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/markdown-transform.d.ts +2 -1
- package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -1
- package/dist/modes/interactive/components/markdown-transform.js +3 -2
- package/dist/modes/interactive/components/markdown-transform.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts +2 -1
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
- package/dist/modes/interactive/components/mermaid.js +25 -20
- package/dist/modes/interactive/components/mermaid.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +17 -6
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +13 -4
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +14 -3
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts +4 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.js +86 -22
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +2 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +20 -27
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.js +2 -0
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +5 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +12 -4
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +6 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +14 -2
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +2 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +24 -16
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +9 -1
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +3 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +6 -2
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts +1 -0
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +16 -4
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +7 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +179 -53
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/model-search.d.ts +10 -0
- package/dist/modes/interactive/model-search.d.ts.map +1 -1
- package/dist/modes/interactive/model-search.js +21 -0
- package/dist/modes/interactive/model-search.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +10 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +35 -23
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +19 -10
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +53 -23
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +78 -9
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/ansi.d.ts.map +1 -1
- package/dist/utils/ansi.js +5 -2
- package/dist/utils/ansi.js.map +1 -1
- package/dist/utils/changelog.d.ts +2 -2
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +15 -2
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/clipboard-command.d.ts.map +1 -1
- package/dist/utils/clipboard-command.js +4 -0
- package/dist/utils/clipboard-command.js.map +1 -1
- package/dist/utils/git.d.ts +1 -1
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/image-resize-core.d.ts.map +1 -1
- package/dist/utils/image-resize-core.js +5 -3
- package/dist/utils/image-resize-core.js.map +1 -1
- package/dist/utils/open-browser.d.ts.map +1 -1
- package/dist/utils/open-browser.js +4 -1
- package/dist/utils/open-browser.js.map +1 -1
- package/dist/utils/paths.d.ts +17 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +42 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +14 -0
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts +5 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +7 -0
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +30 -35
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/cli.md +22 -10
- package/docs/custom-provider.md +2 -0
- package/docs/environment-variables.md +2 -0
- package/docs/extensions.md +3201 -233
- package/docs/keybindings.md +2 -2
- package/docs/llama-cpp.md +23 -15
- package/docs/message-types.md +1 -1
- package/docs/models-configuration.md +17 -4
- package/docs/models.md +9 -4
- package/docs/packages.md +24 -0
- package/docs/providers.md +1 -1
- package/docs/rpc.md +3 -1
- package/docs/sessions.md +11 -3
- package/docs/settings.md +5 -4
- package/docs/slash-commands.md +3 -2
- package/docs/terminal-setup.md +3 -1
- package/docs/tmux.md +6 -0
- package/docs/tui.md +2 -0
- package/docs/windows.md +27 -0
- package/eval/drahtbank/isolated-tools.ts +0 -1
- package/examples/extensions/antigravity-image-gen.ts +1 -1
- package/examples/extensions/custom-provider-anthropic/index.ts +27 -31
- package/examples/extensions/debug-provider.ts +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/plan-mode/index.ts +23 -13
- package/examples/extensions/plan-mode/utils.ts +42 -16
- package/examples/extensions/preset.ts +2 -0
- package/examples/extensions/reload-runtime.ts +17 -5
- package/examples/extensions/sandbox/package-lock.json +15 -41
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/subagent/index.ts +388 -171
- package/examples/extensions/todo.ts +7 -0
- package/examples/extensions/tools.ts +2 -0
- package/examples/tsconfig.json +188 -0
- package/package.json +15 -16
- package/schemas/models.schema.json +85 -39
- package/schemas/settings.schema.json +17 -0
- package/dist/bundle/chunks/anthropic-messages-OR5LCIS6.js +0 -6
- package/dist/bundle/chunks/azure-openai-responses-D6DVM232.js +0 -2
- package/dist/bundle/chunks/chunk-2MJ6J5N2.js +0 -6
- package/dist/bundle/chunks/chunk-2RI4GIFP.js +0 -166
- package/dist/bundle/chunks/chunk-57PET6SW.js +0 -82
- package/dist/bundle/chunks/chunk-6MSE6LZ3.js +0 -6
- package/dist/bundle/chunks/chunk-736QBNUZ.js +0 -12
- package/dist/bundle/chunks/chunk-76YNMQ57.js +0 -2
- package/dist/bundle/chunks/chunk-7JJWQ53O.js +0 -1428
- package/dist/bundle/chunks/chunk-AEG546ID.js +0 -16
- package/dist/bundle/chunks/chunk-CKPJSVRD.js +0 -2
- package/dist/bundle/chunks/chunk-CMKX4CSI.js +0 -6
- package/dist/bundle/chunks/chunk-DLEJ4D4T.js +0 -2
- package/dist/bundle/chunks/chunk-FXCTQRNN.js +0 -2
- package/dist/bundle/chunks/chunk-KINQOWAP.js +0 -4
- package/dist/bundle/chunks/chunk-LK54N67E.js +0 -7
- package/dist/bundle/chunks/chunk-QJADVGUY.js +0 -2
- package/dist/bundle/chunks/chunk-QMN7OD6G.js +0 -2
- package/dist/bundle/chunks/chunk-SYRVFGYE.js +0 -2
- package/dist/bundle/chunks/chunk-TIA2T6EO.js +0 -3
- package/dist/bundle/chunks/chunk-X4UBYFTC.js +0 -11
- package/dist/bundle/chunks/chunk-XB4F3WGD.js +0 -132
- package/dist/bundle/chunks/chunk-XOGEYN4Q.js +0 -2
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-YVG4FYXV.js +0 -2
- package/dist/bundle/chunks/https-proxy-agent-O2PVUIOI.js +0 -13
- package/dist/bundle/chunks/lib-XOG5PI3Y.js +0 -9
- package/dist/bundle/chunks/mistral-conversations-D3JRG6BL.js +0 -5
- package/dist/bundle/chunks/openai-codex-responses-CBOPSGUQ.js +0 -10
- package/dist/bundle/chunks/openai-completions-LDMDMEF2.js +0 -7
- package/dist/bundle/chunks/openai-responses-EZWJOXWT.js +0 -4
- package/dist/bundle/chunks/pi-messages-R75QWB4G.js +0 -8
- package/dist/bundle/chunks/settings-manager-QF6DRH5C.js +0 -2
- package/dist/bundle/chunks/src-TIBHS42X.js +0 -4
- package/dist/bundle/chunks/typesafe-system-one-YUNLPYVG.js +0 -2
- package/dist/bundle/chunks/virtual-modules-4DJB4LTP.js +0 -2
- /package/dist/bundle/chunks/{chunk-UQSONZLL.js → chunk-DN7SM3LX.js} +0 -0
- /package/dist/bundle/chunks/{chunk-ZZD35WKM.js → chunk-MOOADNVS.js} +0 -0
|
@@ -21,10 +21,14 @@ import type { Message } from "@draht/ai";
|
|
|
21
21
|
import { StringEnum } from "@draht/ai";
|
|
22
22
|
import {
|
|
23
23
|
CONFIG_DIR_NAME,
|
|
24
|
+
DEFAULT_MAX_BYTES,
|
|
25
|
+
DEFAULT_MAX_LINES,
|
|
24
26
|
type ExtensionAPI,
|
|
25
27
|
formatReadLineRange,
|
|
26
28
|
getAgentDir,
|
|
27
29
|
getMarkdownTheme,
|
|
30
|
+
type JsonAgentSessionEvent,
|
|
31
|
+
truncateHead,
|
|
28
32
|
withFileMutationQueue,
|
|
29
33
|
} from "@draht/coding-agent";
|
|
30
34
|
import { Container, Markdown, Spacer, Text } from "@draht/tui";
|
|
@@ -35,6 +39,7 @@ const MAX_PARALLEL_TASKS = 8;
|
|
|
35
39
|
const MAX_CONCURRENCY = 4;
|
|
36
40
|
const COLLAPSED_ITEM_COUNT = 10;
|
|
37
41
|
const PER_TASK_OUTPUT_CAP = 50 * 1024;
|
|
42
|
+
const TRUNCATION_NOTICE_RESERVE = 256;
|
|
38
43
|
|
|
39
44
|
function formatTokens(count: number): string {
|
|
40
45
|
if (count < 1000) return count.toString();
|
|
@@ -144,25 +149,28 @@ interface UsageStats {
|
|
|
144
149
|
turns: number;
|
|
145
150
|
}
|
|
146
151
|
|
|
152
|
+
type ChildStatus = "pending" | "running" | "completed" | "failed" | "aborted";
|
|
153
|
+
|
|
147
154
|
interface SingleResult {
|
|
148
155
|
agent: string;
|
|
149
156
|
agentSource: "user" | "project" | "unknown";
|
|
150
157
|
task: string;
|
|
151
|
-
|
|
158
|
+
status: ChildStatus;
|
|
159
|
+
exitCode: number | null;
|
|
152
160
|
messages: Message[];
|
|
153
161
|
stderr: string;
|
|
154
162
|
usage: UsageStats;
|
|
155
163
|
model?: string;
|
|
156
164
|
stopReason?: string;
|
|
157
165
|
errorMessage?: string;
|
|
166
|
+
terminationSignal?: NodeJS.Signals;
|
|
158
167
|
step?: number;
|
|
159
168
|
}
|
|
160
169
|
|
|
161
170
|
interface SubagentDetails {
|
|
162
171
|
mode: "single" | "parallel" | "chain";
|
|
163
|
-
agentScope: AgentScope;
|
|
164
|
-
projectAgentsDir: string | null;
|
|
165
172
|
results: SingleResult[];
|
|
173
|
+
isError: boolean;
|
|
166
174
|
}
|
|
167
175
|
|
|
168
176
|
function getFinalOutput(messages: Message[]): string {
|
|
@@ -178,14 +186,38 @@ function getFinalOutput(messages: Message[]): string {
|
|
|
178
186
|
}
|
|
179
187
|
|
|
180
188
|
function isFailedResult(result: SingleResult): boolean {
|
|
181
|
-
return result.
|
|
189
|
+
return result.status === "failed" || result.status === "aborted";
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function getFailureEvidence(result: SingleResult): string {
|
|
193
|
+
const evidence: string[] = [];
|
|
194
|
+
const seen = new Set<string>();
|
|
195
|
+
const add = (label: string, value: string | undefined) => {
|
|
196
|
+
const text = value?.trim();
|
|
197
|
+
if (!text || seen.has(text)) return;
|
|
198
|
+
seen.add(text);
|
|
199
|
+
evidence.push(`${label}: ${text}`);
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
add("Error", result.errorMessage);
|
|
203
|
+
add("Signal", result.terminationSignal);
|
|
204
|
+
add("stderr", result.stderr);
|
|
205
|
+
add("Assistant output", getFinalOutput(result.messages));
|
|
206
|
+
return evidence.join("\n\n") || "(no output)";
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function getFailureSummary(result: SingleResult): string {
|
|
210
|
+
return (
|
|
211
|
+
result.errorMessage?.trim() ||
|
|
212
|
+
(result.terminationSignal ? `Terminated by signal ${result.terminationSignal}` : "") ||
|
|
213
|
+
result.stderr.trim() ||
|
|
214
|
+
getFinalOutput(result.messages) ||
|
|
215
|
+
"(no output)"
|
|
216
|
+
);
|
|
182
217
|
}
|
|
183
218
|
|
|
184
219
|
function getResultOutput(result: SingleResult): string {
|
|
185
|
-
|
|
186
|
-
return result.errorMessage || result.stderr || getFinalOutput(result.messages) || "(no output)";
|
|
187
|
-
}
|
|
188
|
-
return getFinalOutput(result.messages) || "(no output)";
|
|
220
|
+
return isFailedResult(result) ? getFailureEvidence(result) : getFinalOutput(result.messages) || "(no output)";
|
|
189
221
|
}
|
|
190
222
|
|
|
191
223
|
function truncateParallelOutput(output: string): string {
|
|
@@ -199,6 +231,19 @@ function truncateParallelOutput(output: string): string {
|
|
|
199
231
|
return `${truncated}\n\n[Output truncated: ${byteLength - Buffer.byteLength(truncated, "utf8")} bytes omitted. Full output preserved in tool details.]`;
|
|
200
232
|
}
|
|
201
233
|
|
|
234
|
+
function truncateModelOutput(output: string): string {
|
|
235
|
+
const initial = truncateHead(output);
|
|
236
|
+
if (!initial.truncated) return output;
|
|
237
|
+
|
|
238
|
+
const body = truncateHead(output, {
|
|
239
|
+
maxLines: DEFAULT_MAX_LINES - 2,
|
|
240
|
+
maxBytes: DEFAULT_MAX_BYTES - TRUNCATION_NOTICE_RESERVE,
|
|
241
|
+
});
|
|
242
|
+
const omittedBytes = initial.totalBytes - body.outputBytes;
|
|
243
|
+
const notice = `[Output truncated: ${omittedBytes} bytes omitted. Full output preserved in tool details.]`;
|
|
244
|
+
return body.content ? `${body.content}\n\n${notice}` : notice;
|
|
245
|
+
}
|
|
246
|
+
|
|
202
247
|
type DisplayItem = { type: "text"; text: string } | { type: "toolCall"; name: string; args: Record<string, any> };
|
|
203
248
|
|
|
204
249
|
function getDisplayItems(messages: Message[]): DisplayItem[] {
|
|
@@ -257,7 +302,7 @@ function getPiInvocation(args: string[]): { command: string; args: string[] } {
|
|
|
257
302
|
return { command: process.execPath, args };
|
|
258
303
|
}
|
|
259
304
|
|
|
260
|
-
return { command: "
|
|
305
|
+
return { command: "draht", args };
|
|
261
306
|
}
|
|
262
307
|
|
|
263
308
|
type OnUpdateCallback = (partial: AgentToolResult<SubagentDetails>) => void;
|
|
@@ -267,32 +312,74 @@ interface DispatchDefaults {
|
|
|
267
312
|
thinkingLevel?: ThinkingLevel;
|
|
268
313
|
}
|
|
269
314
|
|
|
315
|
+
interface ProcessOutcome {
|
|
316
|
+
code: number | null;
|
|
317
|
+
signal: NodeJS.Signals | null;
|
|
318
|
+
spawnError?: Error;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
interface ResolvedAgent {
|
|
322
|
+
agent?: AgentConfig;
|
|
323
|
+
available: AgentConfig[];
|
|
324
|
+
cwd: string;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function resolveAgent(defaultCwd: string, scope: AgentScope, name: string, cwd?: string): ResolvedAgent {
|
|
328
|
+
const effectiveCwd = path.resolve(defaultCwd, cwd ?? ".");
|
|
329
|
+
const discovery = discoverAgents(effectiveCwd, scope);
|
|
330
|
+
return {
|
|
331
|
+
agent: discovery.agents.find((candidate) => candidate.name === name),
|
|
332
|
+
available: discovery.agents,
|
|
333
|
+
cwd: effectiveCwd,
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function createUnstartedResult(
|
|
338
|
+
agent: string,
|
|
339
|
+
task: string,
|
|
340
|
+
step: number | undefined,
|
|
341
|
+
status: "aborted" | "failed",
|
|
342
|
+
errorMessage?: string,
|
|
343
|
+
): SingleResult {
|
|
344
|
+
return {
|
|
345
|
+
agent,
|
|
346
|
+
agentSource: "unknown",
|
|
347
|
+
task,
|
|
348
|
+
status,
|
|
349
|
+
exitCode: null,
|
|
350
|
+
messages: [],
|
|
351
|
+
stderr: "",
|
|
352
|
+
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, contextTokens: 0, turns: 0 },
|
|
353
|
+
errorMessage,
|
|
354
|
+
step,
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
|
|
270
358
|
async function runSingleAgent(
|
|
271
|
-
defaultCwd: string,
|
|
272
359
|
dispatchDefaults: DispatchDefaults,
|
|
273
|
-
|
|
360
|
+
resolvedAgent: ResolvedAgent,
|
|
274
361
|
agentName: string,
|
|
275
362
|
task: string,
|
|
276
|
-
cwd: string | undefined,
|
|
277
363
|
step: number | undefined,
|
|
278
364
|
signal: AbortSignal | undefined,
|
|
279
365
|
onUpdate: OnUpdateCallback | undefined,
|
|
280
366
|
makeDetails: (results: SingleResult[]) => SubagentDetails,
|
|
281
367
|
): Promise<SingleResult> {
|
|
282
|
-
|
|
368
|
+
if (signal?.aborted) {
|
|
369
|
+
return createUnstartedResult(agentName, task, step, "aborted", "Subagent was aborted before starting");
|
|
370
|
+
}
|
|
283
371
|
|
|
372
|
+
const effectiveCwd = resolvedAgent.cwd;
|
|
373
|
+
const agent = resolvedAgent.agent;
|
|
284
374
|
if (!agent) {
|
|
285
|
-
const available =
|
|
286
|
-
return
|
|
287
|
-
|
|
288
|
-
agentSource: "unknown",
|
|
375
|
+
const available = resolvedAgent.available.map((candidate) => `"${candidate.name}"`).join(", ") || "none";
|
|
376
|
+
return createUnstartedResult(
|
|
377
|
+
agentName,
|
|
289
378
|
task,
|
|
290
|
-
exitCode: 1,
|
|
291
|
-
messages: [],
|
|
292
|
-
stderr: `Unknown agent: "${agentName}". Available agents: ${available}.`,
|
|
293
|
-
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, contextTokens: 0, turns: 0 },
|
|
294
379
|
step,
|
|
295
|
-
|
|
380
|
+
"failed",
|
|
381
|
+
`Unknown agent: "${agentName}". Available agents: ${available}.`,
|
|
382
|
+
);
|
|
296
383
|
}
|
|
297
384
|
|
|
298
385
|
const args: string[] = ["--mode", "json", "-p", "--no-session"];
|
|
@@ -306,12 +393,12 @@ async function runSingleAgent(
|
|
|
306
393
|
|
|
307
394
|
let tmpPromptDir: string | null = null;
|
|
308
395
|
let tmpPromptPath: string | null = null;
|
|
309
|
-
|
|
310
396
|
const currentResult: SingleResult = {
|
|
311
397
|
agent: agentName,
|
|
312
398
|
agentSource: agent.source,
|
|
313
399
|
task,
|
|
314
|
-
|
|
400
|
+
status: "running",
|
|
401
|
+
exitCode: null,
|
|
315
402
|
messages: [],
|
|
316
403
|
stderr: "",
|
|
317
404
|
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, contextTokens: 0, turns: 0 },
|
|
@@ -320,12 +407,10 @@ async function runSingleAgent(
|
|
|
320
407
|
};
|
|
321
408
|
|
|
322
409
|
const emitUpdate = () => {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
});
|
|
328
|
-
}
|
|
410
|
+
onUpdate?.({
|
|
411
|
+
content: [{ type: "text", text: getFinalOutput(currentResult.messages) || "(running...)" }],
|
|
412
|
+
details: makeDetails([currentResult]),
|
|
413
|
+
});
|
|
329
414
|
};
|
|
330
415
|
|
|
331
416
|
try {
|
|
@@ -336,104 +421,154 @@ async function runSingleAgent(
|
|
|
336
421
|
args.push("--append-system-prompt", tmpPromptPath);
|
|
337
422
|
}
|
|
338
423
|
|
|
424
|
+
if (signal?.aborted) {
|
|
425
|
+
currentResult.status = "aborted";
|
|
426
|
+
currentResult.errorMessage = "Subagent was aborted before starting";
|
|
427
|
+
return currentResult;
|
|
428
|
+
}
|
|
429
|
+
|
|
339
430
|
args.push(`Task: ${task}`);
|
|
431
|
+
emitUpdate();
|
|
340
432
|
let wasAborted = false;
|
|
341
|
-
|
|
342
|
-
const exitCode = await new Promise<number>((resolve) => {
|
|
433
|
+
const outcome = await new Promise<ProcessOutcome>((resolve) => {
|
|
343
434
|
const invocation = getPiInvocation(args);
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
});
|
|
435
|
+
let settled = false;
|
|
436
|
+
let exited = false;
|
|
437
|
+
let closed = false;
|
|
438
|
+
let killTimer: ReturnType<typeof setTimeout> | undefined;
|
|
349
439
|
let buffer = "";
|
|
350
440
|
|
|
351
441
|
const processLine = (line: string) => {
|
|
352
442
|
if (!line.trim()) return;
|
|
353
|
-
let event:
|
|
443
|
+
let event: JsonAgentSessionEvent;
|
|
354
444
|
try {
|
|
355
|
-
event = JSON.parse(line);
|
|
445
|
+
event = JSON.parse(line) as JsonAgentSessionEvent;
|
|
356
446
|
} catch {
|
|
357
447
|
return;
|
|
358
448
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
if (usage) {
|
|
368
|
-
currentResult.usage.input += usage.input || 0;
|
|
369
|
-
currentResult.usage.output += usage.output || 0;
|
|
370
|
-
currentResult.usage.cacheRead += usage.cacheRead || 0;
|
|
371
|
-
currentResult.usage.cacheWrite += usage.cacheWrite || 0;
|
|
372
|
-
currentResult.usage.cost += usage.cost?.total || 0;
|
|
373
|
-
currentResult.usage.contextTokens = usage.totalTokens || 0;
|
|
374
|
-
}
|
|
375
|
-
if (!currentResult.model && msg.model) currentResult.model = msg.model;
|
|
376
|
-
if (msg.stopReason) currentResult.stopReason = msg.stopReason;
|
|
377
|
-
if (msg.errorMessage) currentResult.errorMessage = msg.errorMessage;
|
|
378
|
-
}
|
|
379
|
-
emitUpdate();
|
|
449
|
+
if (event.type !== "message_end") return;
|
|
450
|
+
const eventMessage = event.message;
|
|
451
|
+
if (
|
|
452
|
+
eventMessage.role !== "user" &&
|
|
453
|
+
eventMessage.role !== "assistant" &&
|
|
454
|
+
eventMessage.role !== "toolResult"
|
|
455
|
+
) {
|
|
456
|
+
return;
|
|
380
457
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
458
|
+
const message = eventMessage as Message;
|
|
459
|
+
currentResult.messages.push(message);
|
|
460
|
+
if (message.role === "assistant") {
|
|
461
|
+
currentResult.usage.turns++;
|
|
462
|
+
currentResult.usage.input += message.usage.input;
|
|
463
|
+
currentResult.usage.output += message.usage.output;
|
|
464
|
+
currentResult.usage.cacheRead += message.usage.cacheRead;
|
|
465
|
+
currentResult.usage.cacheWrite += message.usage.cacheWrite;
|
|
466
|
+
currentResult.usage.cost += message.usage.cost.total;
|
|
467
|
+
currentResult.usage.contextTokens = message.usage.totalTokens;
|
|
468
|
+
if (!currentResult.model) currentResult.model = message.model;
|
|
469
|
+
currentResult.stopReason = message.stopReason;
|
|
470
|
+
currentResult.errorMessage = message.errorMessage;
|
|
385
471
|
}
|
|
472
|
+
emitUpdate();
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
let proc: ReturnType<typeof spawn>;
|
|
476
|
+
const finish = (result: ProcessOutcome) => {
|
|
477
|
+
if (settled) return;
|
|
478
|
+
settled = true;
|
|
479
|
+
closed = true;
|
|
480
|
+
if (killTimer) clearTimeout(killTimer);
|
|
481
|
+
if (signal) signal.removeEventListener("abort", abortProcess);
|
|
482
|
+
resolve(result);
|
|
386
483
|
};
|
|
484
|
+
const abortProcess = () => {
|
|
485
|
+
if (closed || exited || proc.exitCode !== null || proc.signalCode !== null) return;
|
|
486
|
+
if (!proc.kill("SIGTERM")) return;
|
|
487
|
+
wasAborted = true;
|
|
488
|
+
killTimer = setTimeout(() => {
|
|
489
|
+
if (!closed && !exited) proc.kill("SIGKILL");
|
|
490
|
+
}, 5000);
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
try {
|
|
494
|
+
proc = spawn(invocation.command, invocation.args, {
|
|
495
|
+
cwd: effectiveCwd,
|
|
496
|
+
shell: false,
|
|
497
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
498
|
+
});
|
|
499
|
+
} catch (error) {
|
|
500
|
+
finish({
|
|
501
|
+
code: null,
|
|
502
|
+
signal: null,
|
|
503
|
+
spawnError: error instanceof Error ? error : new Error(String(error)),
|
|
504
|
+
});
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
387
507
|
|
|
388
|
-
proc.stdout
|
|
508
|
+
proc.stdout?.on("data", (data) => {
|
|
389
509
|
buffer += data.toString();
|
|
390
510
|
const lines = buffer.split("\n");
|
|
391
511
|
buffer = lines.pop() || "";
|
|
392
512
|
for (const line of lines) processLine(line);
|
|
393
513
|
});
|
|
394
|
-
|
|
395
|
-
proc.stderr.on("data", (data) => {
|
|
514
|
+
proc.stderr?.on("data", (data) => {
|
|
396
515
|
currentResult.stderr += data.toString();
|
|
397
516
|
});
|
|
398
|
-
|
|
399
|
-
|
|
517
|
+
proc.on("exit", () => {
|
|
518
|
+
exited = true;
|
|
519
|
+
});
|
|
520
|
+
proc.on("close", (code, terminationSignal) => {
|
|
400
521
|
if (buffer.trim()) processLine(buffer);
|
|
401
|
-
|
|
522
|
+
finish({ code, signal: terminationSignal });
|
|
402
523
|
});
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
resolve(1);
|
|
524
|
+
proc.on("error", (error) => {
|
|
525
|
+
finish({ code: null, signal: null, spawnError: error });
|
|
406
526
|
});
|
|
407
527
|
|
|
408
528
|
if (signal) {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
proc.kill("SIGTERM");
|
|
412
|
-
setTimeout(() => {
|
|
413
|
-
if (!proc.killed) proc.kill("SIGKILL");
|
|
414
|
-
}, 5000);
|
|
415
|
-
};
|
|
416
|
-
if (signal.aborted) killProc();
|
|
417
|
-
else signal.addEventListener("abort", killProc, { once: true });
|
|
529
|
+
if (signal.aborted) abortProcess();
|
|
530
|
+
else signal.addEventListener("abort", abortProcess, { once: true });
|
|
418
531
|
}
|
|
419
532
|
});
|
|
420
533
|
|
|
421
|
-
currentResult.exitCode =
|
|
422
|
-
|
|
534
|
+
currentResult.exitCode = outcome.code;
|
|
535
|
+
currentResult.terminationSignal = outcome.signal ?? undefined;
|
|
536
|
+
|
|
537
|
+
if (wasAborted) {
|
|
538
|
+
currentResult.status = "aborted";
|
|
539
|
+
currentResult.errorMessage ||= "Subagent was aborted";
|
|
540
|
+
} else if (outcome.spawnError) {
|
|
541
|
+
currentResult.status = "failed";
|
|
542
|
+
currentResult.errorMessage = `Failed to spawn subagent: ${outcome.spawnError.message}`;
|
|
543
|
+
} else if (outcome.signal) {
|
|
544
|
+
currentResult.status = "failed";
|
|
545
|
+
currentResult.errorMessage ||= `Subagent terminated by signal ${outcome.signal}`;
|
|
546
|
+
} else if (outcome.code !== 0) {
|
|
547
|
+
currentResult.status = "failed";
|
|
548
|
+
currentResult.errorMessage ||= `Subagent exited with code ${outcome.code}`;
|
|
549
|
+
} else if (currentResult.stopReason === "aborted") {
|
|
550
|
+
currentResult.status = "aborted";
|
|
551
|
+
} else if (currentResult.stopReason === "error") {
|
|
552
|
+
currentResult.status = "failed";
|
|
553
|
+
} else {
|
|
554
|
+
currentResult.status = "completed";
|
|
555
|
+
}
|
|
423
556
|
return currentResult;
|
|
424
557
|
} finally {
|
|
425
|
-
if (tmpPromptPath)
|
|
558
|
+
if (tmpPromptPath) {
|
|
426
559
|
try {
|
|
427
560
|
fs.unlinkSync(tmpPromptPath);
|
|
428
561
|
} catch {
|
|
429
562
|
/* ignore */
|
|
430
563
|
}
|
|
431
|
-
|
|
564
|
+
}
|
|
565
|
+
if (tmpPromptDir) {
|
|
432
566
|
try {
|
|
433
567
|
fs.rmdirSync(tmpPromptDir);
|
|
434
568
|
} catch {
|
|
435
569
|
/* ignore */
|
|
436
570
|
}
|
|
571
|
+
}
|
|
437
572
|
}
|
|
438
573
|
}
|
|
439
574
|
|
|
@@ -467,6 +602,13 @@ const SubagentParams = Type.Object({
|
|
|
467
602
|
});
|
|
468
603
|
|
|
469
604
|
export default function (pi: ExtensionAPI) {
|
|
605
|
+
// Tool execute results cannot set runtime error state directly, so patch it through the result hook.
|
|
606
|
+
pi.on("tool_result", (event) => {
|
|
607
|
+
if (event.toolName !== "subagent") return;
|
|
608
|
+
const details = event.details as SubagentDetails | undefined;
|
|
609
|
+
if (details?.isError) return { isError: true };
|
|
610
|
+
});
|
|
611
|
+
|
|
470
612
|
pi.registerTool({
|
|
471
613
|
name: "subagent",
|
|
472
614
|
label: "Subagent",
|
|
@@ -494,12 +636,11 @@ export default function (pi: ExtensionAPI) {
|
|
|
494
636
|
const modeCount = Number(hasChain) + Number(hasTasks) + Number(hasSingle);
|
|
495
637
|
|
|
496
638
|
const makeDetails =
|
|
497
|
-
(mode: "single" | "parallel" | "chain") =>
|
|
639
|
+
(mode: "single" | "parallel" | "chain", forceError = false) =>
|
|
498
640
|
(results: SingleResult[]): SubagentDetails => ({
|
|
499
641
|
mode,
|
|
500
|
-
agentScope,
|
|
501
|
-
projectAgentsDir: discovery.projectAgentsDir,
|
|
502
642
|
results,
|
|
643
|
+
isError: forceError || results.some(isFailedResult),
|
|
503
644
|
});
|
|
504
645
|
|
|
505
646
|
if (modeCount !== 1) {
|
|
@@ -511,37 +652,50 @@ export default function (pi: ExtensionAPI) {
|
|
|
511
652
|
text: `Invalid parameters. Provide exactly one mode.\nAvailable agents: ${available}`,
|
|
512
653
|
},
|
|
513
654
|
],
|
|
514
|
-
details: makeDetails("single")([]),
|
|
655
|
+
details: makeDetails("single", true)([]),
|
|
515
656
|
};
|
|
516
657
|
}
|
|
517
658
|
|
|
518
|
-
|
|
519
|
-
(
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
)
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
659
|
+
const resolvedChain = (params.chain ?? []).map((step) =>
|
|
660
|
+
resolveAgent(ctx.cwd, agentScope, step.agent, step.cwd),
|
|
661
|
+
);
|
|
662
|
+
const resolvedTasks = (params.tasks ?? []).map((task) =>
|
|
663
|
+
resolveAgent(ctx.cwd, agentScope, task.agent, task.cwd),
|
|
664
|
+
);
|
|
665
|
+
const resolvedSingle = params.agent ? resolveAgent(ctx.cwd, agentScope, params.agent, params.cwd) : undefined;
|
|
666
|
+
|
|
667
|
+
if ((agentScope === "project" || agentScope === "both") && confirmProjectAgents && ctx.hasUI) {
|
|
668
|
+
let selectedAgents: ResolvedAgent[] = [];
|
|
669
|
+
if (hasChain) selectedAgents = resolvedChain;
|
|
670
|
+
else if (hasTasks) selectedAgents = resolvedTasks;
|
|
671
|
+
else if (resolvedSingle) selectedAgents = [resolvedSingle];
|
|
672
|
+
const projectAgentsByPath = new Map<string, AgentConfig>();
|
|
673
|
+
for (const resolved of selectedAgents) {
|
|
674
|
+
if (resolved.agent?.source === "project") {
|
|
675
|
+
projectAgentsByPath.set(resolved.agent.filePath, resolved.agent);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
532
678
|
|
|
679
|
+
const trustedProjectAgentsDir =
|
|
680
|
+
ctx.isProjectTrusted() && discovery.projectAgentsDir
|
|
681
|
+
? fs.realpathSync(discovery.projectAgentsDir)
|
|
682
|
+
: undefined;
|
|
683
|
+
const projectAgentsRequested = Array.from(projectAgentsByPath.values()).filter(
|
|
684
|
+
(agent) =>
|
|
685
|
+
!trustedProjectAgentsDir || fs.realpathSync(path.dirname(agent.filePath)) !== trustedProjectAgentsDir,
|
|
686
|
+
);
|
|
533
687
|
if (projectAgentsRequested.length > 0) {
|
|
534
|
-
const
|
|
535
|
-
const dir = discovery.projectAgentsDir ?? "(unknown)";
|
|
688
|
+
const sources = projectAgentsRequested.map((agent) => `- ${agent.name}: ${agent.filePath}`).join("\n");
|
|
536
689
|
const ok = await ctx.ui.confirm(
|
|
537
690
|
"Run project-local agents?",
|
|
538
|
-
`
|
|
691
|
+
`Sources:\n${sources}\n\nProject agents are repo-controlled. Only continue for trusted repositories.`,
|
|
539
692
|
);
|
|
540
|
-
if (!ok)
|
|
693
|
+
if (!ok) {
|
|
541
694
|
return {
|
|
542
695
|
content: [{ type: "text", text: "Canceled: project-local agents not approved." }],
|
|
543
696
|
details: makeDetails(hasChain ? "chain" : hasTasks ? "parallel" : "single")([]),
|
|
544
697
|
};
|
|
698
|
+
}
|
|
545
699
|
}
|
|
546
700
|
}
|
|
547
701
|
|
|
@@ -569,12 +723,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
569
723
|
: undefined;
|
|
570
724
|
|
|
571
725
|
const result = await runSingleAgent(
|
|
572
|
-
ctx.cwd,
|
|
573
726
|
dispatchDefaults,
|
|
574
|
-
|
|
727
|
+
resolvedChain[i],
|
|
575
728
|
step.agent,
|
|
576
729
|
taskWithContext,
|
|
577
|
-
step.cwd,
|
|
578
730
|
i + 1,
|
|
579
731
|
signal,
|
|
580
732
|
chainUpdate,
|
|
@@ -586,15 +738,24 @@ export default function (pi: ExtensionAPI) {
|
|
|
586
738
|
if (isError) {
|
|
587
739
|
const errorMsg = getResultOutput(result);
|
|
588
740
|
return {
|
|
589
|
-
content: [
|
|
741
|
+
content: [
|
|
742
|
+
{
|
|
743
|
+
type: "text",
|
|
744
|
+
text: truncateModelOutput(`Chain stopped at step ${i + 1} (${step.agent}): ${errorMsg}`),
|
|
745
|
+
},
|
|
746
|
+
],
|
|
590
747
|
details: makeDetails("chain")(results),
|
|
591
|
-
isError: true,
|
|
592
748
|
};
|
|
593
749
|
}
|
|
594
750
|
previousOutput = getFinalOutput(result.messages);
|
|
595
751
|
}
|
|
596
752
|
return {
|
|
597
|
-
content: [
|
|
753
|
+
content: [
|
|
754
|
+
{
|
|
755
|
+
type: "text",
|
|
756
|
+
text: truncateModelOutput(getFinalOutput(results[results.length - 1].messages) || "(no output)"),
|
|
757
|
+
},
|
|
758
|
+
],
|
|
598
759
|
details: makeDetails("chain")(results),
|
|
599
760
|
};
|
|
600
761
|
}
|
|
@@ -608,7 +769,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
608
769
|
text: `Too many parallel tasks (${params.tasks.length}). Max is ${MAX_PARALLEL_TASKS}.`,
|
|
609
770
|
},
|
|
610
771
|
],
|
|
611
|
-
details: makeDetails("parallel")([]),
|
|
772
|
+
details: makeDetails("parallel", true)([]),
|
|
612
773
|
};
|
|
613
774
|
|
|
614
775
|
// Track all results for streaming updates
|
|
@@ -620,7 +781,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
620
781
|
agent: params.tasks[i].agent,
|
|
621
782
|
agentSource: "unknown",
|
|
622
783
|
task: params.tasks[i].task,
|
|
623
|
-
|
|
784
|
+
status: "pending",
|
|
785
|
+
exitCode: null,
|
|
624
786
|
messages: [],
|
|
625
787
|
stderr: "",
|
|
626
788
|
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, contextTokens: 0, turns: 0 },
|
|
@@ -629,11 +791,15 @@ export default function (pi: ExtensionAPI) {
|
|
|
629
791
|
|
|
630
792
|
const emitParallelUpdate = () => {
|
|
631
793
|
if (onUpdate) {
|
|
632
|
-
const running = allResults.filter((
|
|
633
|
-
const
|
|
794
|
+
const running = allResults.filter((result) => result.status === "running").length;
|
|
795
|
+
const pending = allResults.filter((result) => result.status === "pending").length;
|
|
796
|
+
const done = allResults.length - running - pending;
|
|
634
797
|
onUpdate({
|
|
635
798
|
content: [
|
|
636
|
-
{
|
|
799
|
+
{
|
|
800
|
+
type: "text",
|
|
801
|
+
text: `Parallel: ${done}/${allResults.length} done, ${running} running, ${pending} pending...`,
|
|
802
|
+
},
|
|
637
803
|
],
|
|
638
804
|
details: makeDetails("parallel")([...allResults]),
|
|
639
805
|
});
|
|
@@ -642,12 +808,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
642
808
|
|
|
643
809
|
const results = await mapWithConcurrencyLimit(params.tasks, MAX_CONCURRENCY, async (t, index) => {
|
|
644
810
|
const result = await runSingleAgent(
|
|
645
|
-
ctx.cwd,
|
|
646
811
|
dispatchDefaults,
|
|
647
|
-
|
|
812
|
+
resolvedTasks[index],
|
|
648
813
|
t.agent,
|
|
649
814
|
t.task,
|
|
650
|
-
t.cwd,
|
|
651
815
|
undefined,
|
|
652
816
|
signal,
|
|
653
817
|
// Per-task update callback
|
|
@@ -667,9 +831,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
667
831
|
const successCount = results.filter((r) => !isFailedResult(r)).length;
|
|
668
832
|
const summaries = results.map((r) => {
|
|
669
833
|
const output = truncateParallelOutput(getResultOutput(r));
|
|
670
|
-
const status =
|
|
671
|
-
|
|
672
|
-
|
|
834
|
+
const status =
|
|
835
|
+
isFailedResult(r) && r.stopReason && r.stopReason !== "end"
|
|
836
|
+
? `${r.status} (${r.stopReason})`
|
|
837
|
+
: r.status;
|
|
673
838
|
return `### [${r.agent}] ${status}\n\n${output}`;
|
|
674
839
|
});
|
|
675
840
|
return {
|
|
@@ -683,14 +848,12 @@ export default function (pi: ExtensionAPI) {
|
|
|
683
848
|
};
|
|
684
849
|
}
|
|
685
850
|
|
|
686
|
-
if (params.agent && params.task) {
|
|
851
|
+
if (params.agent && params.task && resolvedSingle) {
|
|
687
852
|
const result = await runSingleAgent(
|
|
688
|
-
ctx.cwd,
|
|
689
853
|
dispatchDefaults,
|
|
690
|
-
|
|
854
|
+
resolvedSingle,
|
|
691
855
|
params.agent,
|
|
692
856
|
params.task,
|
|
693
|
-
params.cwd,
|
|
694
857
|
undefined,
|
|
695
858
|
signal,
|
|
696
859
|
onUpdate,
|
|
@@ -700,13 +863,22 @@ export default function (pi: ExtensionAPI) {
|
|
|
700
863
|
if (isError) {
|
|
701
864
|
const errorMsg = getResultOutput(result);
|
|
702
865
|
return {
|
|
703
|
-
content: [
|
|
866
|
+
content: [
|
|
867
|
+
{
|
|
868
|
+
type: "text",
|
|
869
|
+
text: truncateModelOutput(`Agent ${result.stopReason || result.status}: ${errorMsg}`),
|
|
870
|
+
},
|
|
871
|
+
],
|
|
704
872
|
details: makeDetails("single")([result]),
|
|
705
|
-
isError: true,
|
|
706
873
|
};
|
|
707
874
|
}
|
|
708
875
|
return {
|
|
709
|
-
content: [
|
|
876
|
+
content: [
|
|
877
|
+
{
|
|
878
|
+
type: "text",
|
|
879
|
+
text: truncateModelOutput(getFinalOutput(result.messages) || "(no output)"),
|
|
880
|
+
},
|
|
881
|
+
],
|
|
710
882
|
details: makeDetails("single")([result]),
|
|
711
883
|
};
|
|
712
884
|
}
|
|
@@ -714,7 +886,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
714
886
|
const available = agents.map((a) => `${a.name} (${a.source})`).join(", ") || "none";
|
|
715
887
|
return {
|
|
716
888
|
content: [{ type: "text", text: `Invalid parameters. Available agents: ${available}` }],
|
|
717
|
-
details: makeDetails("single")([]),
|
|
889
|
+
details: makeDetails("single", true)([]),
|
|
718
890
|
};
|
|
719
891
|
},
|
|
720
892
|
|
|
@@ -787,20 +959,33 @@ export default function (pi: ExtensionAPI) {
|
|
|
787
959
|
return text.trimEnd();
|
|
788
960
|
};
|
|
789
961
|
|
|
962
|
+
const resultIcon = (child: SingleResult): string => {
|
|
963
|
+
if (child.status === "pending" || child.status === "running") {
|
|
964
|
+
return theme.fg("warning", "⏳");
|
|
965
|
+
}
|
|
966
|
+
if (isFailedResult(child)) return theme.fg("error", "✗");
|
|
967
|
+
return theme.fg("success", "✓");
|
|
968
|
+
};
|
|
969
|
+
|
|
790
970
|
if (details.mode === "single" && details.results.length === 1) {
|
|
791
971
|
const r = details.results[0];
|
|
792
972
|
const isError = isFailedResult(r);
|
|
793
|
-
const
|
|
973
|
+
const isRunning = r.status === "pending" || r.status === "running";
|
|
974
|
+
const icon = resultIcon(r);
|
|
794
975
|
const displayItems = getDisplayItems(r.messages);
|
|
795
976
|
const finalOutput = getFinalOutput(r.messages);
|
|
796
977
|
|
|
797
978
|
if (expanded) {
|
|
798
979
|
const container = new Container();
|
|
799
980
|
let header = `${icon} ${theme.fg("toolTitle", theme.bold(r.agent))}${theme.fg("muted", ` (${r.agentSource})`)}`;
|
|
800
|
-
if (
|
|
981
|
+
if (isRunning) header += ` ${theme.fg("warning", `[${r.status}]`)}`;
|
|
982
|
+
else if (isError) header += ` ${theme.fg("error", `[${r.stopReason ?? r.status}]`)}`;
|
|
801
983
|
container.addChild(new Text(header, 0, 0));
|
|
802
984
|
if (isError && r.errorMessage)
|
|
803
985
|
container.addChild(new Text(theme.fg("error", `Error: ${r.errorMessage}`), 0, 0));
|
|
986
|
+
if (r.terminationSignal)
|
|
987
|
+
container.addChild(new Text(theme.fg("error", `Signal: ${r.terminationSignal}`), 0, 0));
|
|
988
|
+
if (r.stderr.trim()) container.addChild(new Text(theme.fg("error", `stderr: ${r.stderr.trim()}`), 0, 0));
|
|
804
989
|
container.addChild(new Spacer(1));
|
|
805
990
|
container.addChild(new Text(theme.fg("muted", "─── Task ───"), 0, 0));
|
|
806
991
|
container.addChild(new Text(theme.fg("dim", r.task), 0, 0));
|
|
@@ -833,7 +1018,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
833
1018
|
}
|
|
834
1019
|
|
|
835
1020
|
let text = `${icon} ${theme.fg("toolTitle", theme.bold(r.agent))}${theme.fg("muted", ` (${r.agentSource})`)}`;
|
|
836
|
-
if (
|
|
1021
|
+
if (isRunning) text += ` ${theme.fg("warning", `[${r.status}]`)}`;
|
|
1022
|
+
else if (isError) text += ` ${theme.fg("error", `[${r.stopReason ?? r.status}]`)}`;
|
|
837
1023
|
if (isError && r.errorMessage) text += `\n${theme.fg("error", `Error: ${r.errorMessage}`)}`;
|
|
838
1024
|
else if (displayItems.length === 0) text += `\n${theme.fg("muted", "(no output)")}`;
|
|
839
1025
|
else {
|
|
@@ -845,22 +1031,35 @@ export default function (pi: ExtensionAPI) {
|
|
|
845
1031
|
return new Text(text, 0, 0);
|
|
846
1032
|
}
|
|
847
1033
|
|
|
848
|
-
const aggregateUsage = (results: SingleResult[]) => {
|
|
849
|
-
const total = {
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
1034
|
+
const aggregateUsage = (results: SingleResult[]): UsageStats => {
|
|
1035
|
+
const total: UsageStats = {
|
|
1036
|
+
input: 0,
|
|
1037
|
+
output: 0,
|
|
1038
|
+
cacheRead: 0,
|
|
1039
|
+
cacheWrite: 0,
|
|
1040
|
+
cost: 0,
|
|
1041
|
+
contextTokens: 0,
|
|
1042
|
+
turns: 0,
|
|
1043
|
+
};
|
|
1044
|
+
for (const result of results) {
|
|
1045
|
+
total.input += result.usage.input;
|
|
1046
|
+
total.output += result.usage.output;
|
|
1047
|
+
total.cacheRead += result.usage.cacheRead;
|
|
1048
|
+
total.cacheWrite += result.usage.cacheWrite;
|
|
1049
|
+
total.cost += result.usage.cost;
|
|
1050
|
+
total.turns += result.usage.turns;
|
|
857
1051
|
}
|
|
858
1052
|
return total;
|
|
859
1053
|
};
|
|
860
1054
|
|
|
861
1055
|
if (details.mode === "chain") {
|
|
862
|
-
const successCount = details.results.filter((
|
|
863
|
-
const
|
|
1056
|
+
const successCount = details.results.filter((result) => result.status === "completed").length;
|
|
1057
|
+
const hasActive = details.results.some(
|
|
1058
|
+
(result) => result.status === "pending" || result.status === "running",
|
|
1059
|
+
);
|
|
1060
|
+
let icon = theme.fg("error", "✗");
|
|
1061
|
+
if (hasActive) icon = theme.fg("warning", "⏳");
|
|
1062
|
+
else if (successCount === details.results.length) icon = theme.fg("success", "✓");
|
|
864
1063
|
|
|
865
1064
|
if (expanded) {
|
|
866
1065
|
const container = new Container();
|
|
@@ -876,7 +1075,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
876
1075
|
);
|
|
877
1076
|
|
|
878
1077
|
for (const r of details.results) {
|
|
879
|
-
const rIcon = r
|
|
1078
|
+
const rIcon = resultIcon(r);
|
|
880
1079
|
const displayItems = getDisplayItems(r.messages);
|
|
881
1080
|
const finalOutput = getFinalOutput(r.messages);
|
|
882
1081
|
|
|
@@ -889,6 +1088,12 @@ export default function (pi: ExtensionAPI) {
|
|
|
889
1088
|
),
|
|
890
1089
|
);
|
|
891
1090
|
container.addChild(new Text(theme.fg("muted", "Task: ") + theme.fg("dim", r.task), 0, 0));
|
|
1091
|
+
if (isFailedResult(r) && r.errorMessage)
|
|
1092
|
+
container.addChild(new Text(theme.fg("error", `Error: ${r.errorMessage}`), 0, 0));
|
|
1093
|
+
if (r.terminationSignal)
|
|
1094
|
+
container.addChild(new Text(theme.fg("error", `Signal: ${r.terminationSignal}`), 0, 0));
|
|
1095
|
+
if (r.stderr.trim())
|
|
1096
|
+
container.addChild(new Text(theme.fg("error", `stderr: ${r.stderr.trim()}`), 0, 0));
|
|
892
1097
|
|
|
893
1098
|
// Show tool calls
|
|
894
1099
|
for (const item of displayItems) {
|
|
@@ -928,11 +1133,16 @@ export default function (pi: ExtensionAPI) {
|
|
|
928
1133
|
theme.fg("toolTitle", theme.bold("chain ")) +
|
|
929
1134
|
theme.fg("accent", `${successCount}/${details.results.length} steps`);
|
|
930
1135
|
for (const r of details.results) {
|
|
931
|
-
const rIcon = r
|
|
1136
|
+
const rIcon = resultIcon(r);
|
|
932
1137
|
const displayItems = getDisplayItems(r.messages);
|
|
933
1138
|
text += `\n\n${theme.fg("muted", `─── Step ${r.step}: `)}${theme.fg("accent", r.agent)} ${rIcon}`;
|
|
934
|
-
if (displayItems.length === 0)
|
|
935
|
-
|
|
1139
|
+
if (displayItems.length === 0) {
|
|
1140
|
+
const failed = isFailedResult(r);
|
|
1141
|
+
const summary = failed ? getFailureSummary(r) : "(no output)";
|
|
1142
|
+
text += `\n${theme.fg(failed ? "error" : "muted", summary)}`;
|
|
1143
|
+
} else {
|
|
1144
|
+
text += `\n${renderDisplayItems(displayItems, 5)}`;
|
|
1145
|
+
}
|
|
936
1146
|
}
|
|
937
1147
|
const usageStr = formatUsageStats(aggregateUsage(details.results));
|
|
938
1148
|
if (usageStr) text += `\n\n${theme.fg("dim", `Total: ${usageStr}`)}`;
|
|
@@ -941,17 +1151,16 @@ export default function (pi: ExtensionAPI) {
|
|
|
941
1151
|
}
|
|
942
1152
|
|
|
943
1153
|
if (details.mode === "parallel") {
|
|
944
|
-
const running = details.results.filter((
|
|
945
|
-
const
|
|
946
|
-
const
|
|
947
|
-
const
|
|
948
|
-
const
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
: theme.fg("success", "✓");
|
|
1154
|
+
const running = details.results.filter((result) => result.status === "running").length;
|
|
1155
|
+
const pending = details.results.filter((result) => result.status === "pending").length;
|
|
1156
|
+
const successCount = details.results.filter((result) => result.status === "completed").length;
|
|
1157
|
+
const failCount = details.results.filter(isFailedResult).length;
|
|
1158
|
+
const isRunning = running > 0 || pending > 0;
|
|
1159
|
+
let icon = theme.fg("success", "✓");
|
|
1160
|
+
if (isRunning) icon = theme.fg("warning", "⏳");
|
|
1161
|
+
else if (failCount > 0) icon = theme.fg("warning", "◐");
|
|
953
1162
|
const status = isRunning
|
|
954
|
-
? `${successCount + failCount}/${details.results.length} done, ${running} running`
|
|
1163
|
+
? `${successCount + failCount}/${details.results.length} done, ${running} running, ${pending} pending`
|
|
955
1164
|
: `${successCount}/${details.results.length} tasks`;
|
|
956
1165
|
|
|
957
1166
|
if (expanded && !isRunning) {
|
|
@@ -965,7 +1174,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
965
1174
|
);
|
|
966
1175
|
|
|
967
1176
|
for (const r of details.results) {
|
|
968
|
-
const rIcon =
|
|
1177
|
+
const rIcon = resultIcon(r);
|
|
969
1178
|
const displayItems = getDisplayItems(r.messages);
|
|
970
1179
|
const finalOutput = getFinalOutput(r.messages);
|
|
971
1180
|
|
|
@@ -974,6 +1183,12 @@ export default function (pi: ExtensionAPI) {
|
|
|
974
1183
|
new Text(`${theme.fg("muted", "─── ") + theme.fg("accent", r.agent)} ${rIcon}`, 0, 0),
|
|
975
1184
|
);
|
|
976
1185
|
container.addChild(new Text(theme.fg("muted", "Task: ") + theme.fg("dim", r.task), 0, 0));
|
|
1186
|
+
if (isFailedResult(r) && r.errorMessage)
|
|
1187
|
+
container.addChild(new Text(theme.fg("error", `Error: ${r.errorMessage}`), 0, 0));
|
|
1188
|
+
if (r.terminationSignal)
|
|
1189
|
+
container.addChild(new Text(theme.fg("error", `Signal: ${r.terminationSignal}`), 0, 0));
|
|
1190
|
+
if (r.stderr.trim())
|
|
1191
|
+
container.addChild(new Text(theme.fg("error", `stderr: ${r.stderr.trim()}`), 0, 0));
|
|
977
1192
|
|
|
978
1193
|
// Show tool calls
|
|
979
1194
|
for (const item of displayItems) {
|
|
@@ -1009,17 +1224,19 @@ export default function (pi: ExtensionAPI) {
|
|
|
1009
1224
|
// Collapsed view (or still running)
|
|
1010
1225
|
let text = `${icon} ${theme.fg("toolTitle", theme.bold("parallel "))}${theme.fg("accent", status)}`;
|
|
1011
1226
|
for (const r of details.results) {
|
|
1012
|
-
const rIcon =
|
|
1013
|
-
r.exitCode === -1
|
|
1014
|
-
? theme.fg("warning", "⏳")
|
|
1015
|
-
: isFailedResult(r)
|
|
1016
|
-
? theme.fg("error", "✗")
|
|
1017
|
-
: theme.fg("success", "✓");
|
|
1227
|
+
const rIcon = resultIcon(r);
|
|
1018
1228
|
const displayItems = getDisplayItems(r.messages);
|
|
1019
1229
|
text += `\n\n${theme.fg("muted", "─── ")}${theme.fg("accent", r.agent)} ${rIcon}`;
|
|
1020
|
-
if (displayItems.length === 0)
|
|
1021
|
-
|
|
1022
|
-
|
|
1230
|
+
if (displayItems.length === 0) {
|
|
1231
|
+
const failed = isFailedResult(r);
|
|
1232
|
+
let summary = "(no output)";
|
|
1233
|
+
if (r.status === "pending") summary = "(pending...)";
|
|
1234
|
+
else if (r.status === "running") summary = "(running...)";
|
|
1235
|
+
else if (failed) summary = getFailureSummary(r);
|
|
1236
|
+
text += `\n${theme.fg(failed ? "error" : "muted", summary)}`;
|
|
1237
|
+
} else {
|
|
1238
|
+
text += `\n${renderDisplayItems(displayItems, 5)}`;
|
|
1239
|
+
}
|
|
1023
1240
|
}
|
|
1024
1241
|
if (!isRunning) {
|
|
1025
1242
|
const usageStr = formatUsageStats(aggregateUsage(details.results));
|