@diffra-ai/cli 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/LICENSE +22 -0
- package/README.md +61 -2
- package/dist/bun/cli.d.ts +5 -0
- package/dist/bun/cli.d.ts.map +1 -0
- package/dist/bun/cli.js +5 -0
- package/dist/bun/cli.js.map +1 -0
- package/dist/bun/restore-sandbox-env.d.ts +17 -0
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
- package/dist/bun/restore-sandbox-env.js +36 -0
- package/dist/bun/restore-sandbox-env.js.map +1 -0
- package/dist/bun/runtime-setup.d.ts +2 -0
- package/dist/bun/runtime-setup.d.ts.map +1 -0
- package/dist/bun/runtime-setup.js +12 -0
- package/dist/bun/runtime-setup.js.map +1 -0
- package/dist/bun/sandbox-env-setup.d.ts +2 -0
- package/dist/bun/sandbox-env-setup.d.ts.map +1 -0
- package/dist/bun/sandbox-env-setup.js +4 -0
- package/dist/bun/sandbox-env-setup.js.map +1 -0
- package/dist/bundle/chunks/anthropic-messages-RDYSW7WM.js +6 -0
- package/dist/bundle/chunks/anthropic.js +75 -0
- package/dist/bundle/chunks/azure-openai-responses-HB77OIU4.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +89 -0
- package/dist/bundle/chunks/chunk-4KBADZRL.js +8 -0
- package/dist/bundle/chunks/chunk-5AGIVGSV.js +6 -0
- package/dist/bundle/chunks/chunk-6QGV3IWD.js +6 -0
- package/dist/bundle/chunks/chunk-6S2AQWGR.js +55 -0
- package/dist/bundle/chunks/chunk-762GZFUO.js +9 -0
- package/dist/bundle/chunks/chunk-7CBJINYJ.js +20 -0
- package/dist/bundle/chunks/chunk-7DDKXS2Q.js +2 -0
- package/dist/bundle/chunks/chunk-7ZC4UXSL.js +2 -0
- package/dist/bundle/chunks/chunk-B3FUE2LF.js +2 -0
- package/dist/bundle/chunks/chunk-B4DODQSC.js +2 -0
- package/dist/bundle/chunks/chunk-DWKLYVGO.js +2 -0
- package/dist/bundle/chunks/chunk-EIL6ZC3J.js +1240 -0
- package/dist/bundle/chunks/chunk-FFMDRXC4.js +10 -0
- package/dist/bundle/chunks/chunk-GCKVPVMH.js +2 -0
- package/dist/bundle/chunks/chunk-IEBK4HQA.js +2 -0
- package/dist/bundle/chunks/chunk-INODY4DR.js +2 -0
- package/dist/bundle/chunks/chunk-INTHKDF2.js +20 -0
- package/dist/bundle/chunks/chunk-JJOJ6QJX.js +16 -0
- package/dist/bundle/chunks/chunk-JXWJOIH4.js +2 -0
- package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
- package/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
- package/dist/bundle/chunks/chunk-LVVZS2NO.js +12 -0
- package/dist/bundle/chunks/chunk-LWG2CUTI.js +31 -0
- package/dist/bundle/chunks/chunk-OYSUJGUM.js +2 -0
- package/dist/bundle/chunks/chunk-P7FPUEYA.js +2 -0
- package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
- package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
- package/dist/bundle/chunks/chunk-PMRZO46Y.js +2 -0
- package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
- package/dist/bundle/chunks/chunk-QRII7KJY.js +4 -0
- package/dist/bundle/chunks/chunk-RDZVAGPR.js +2 -0
- package/dist/bundle/chunks/chunk-RJRIMI6M.js +13 -0
- package/dist/bundle/chunks/chunk-TMTOQ7H7.js +2 -0
- package/dist/bundle/chunks/chunk-UTB4DTYQ.js +2 -0
- package/dist/bundle/chunks/chunk-V5GJW5IX.js +2 -0
- package/dist/bundle/chunks/chunk-VJQ6ZYW4.js +130 -0
- package/dist/bundle/chunks/chunk-VSFRR6IC.js +82 -0
- package/dist/bundle/chunks/chunk-Z36XYVPO.js +30 -0
- package/dist/bundle/chunks/chunk-Z72M6UD7.js +44 -0
- package/dist/bundle/chunks/chunk-ZG74NES2.js +2 -0
- package/dist/bundle/chunks/chunk-ZVEA4XD4.js +2 -0
- package/dist/bundle/chunks/cli-SYWCWCZU.js +53 -0
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-AASXI4DD.js +2 -0
- package/dist/bundle/chunks/codemode-worker.js +480 -0
- package/dist/bundle/chunks/easter-egg-3d-QN5RJMZR.js +2 -0
- package/dist/bundle/chunks/execute-3J63CQJG.js +507 -0
- package/dist/bundle/chunks/github-copilot.js +2 -0
- package/dist/bundle/chunks/google-generative-ai-6HC6JYFU.js +2 -0
- package/dist/bundle/chunks/google-vertex-UJFQATKN.js +2 -0
- package/dist/bundle/chunks/https-proxy-agent-LVOO5TPL.js +13 -0
- package/dist/bundle/chunks/image-resize-worker.js +2 -0
- package/dist/bundle/chunks/jiti-loader-GL4HJFAD.js +21 -0
- package/dist/bundle/chunks/jiti-static-loader-2RCDI6B4.js +2 -0
- package/dist/bundle/chunks/kimi-coding.js +2 -0
- package/dist/bundle/chunks/lib-4AVRLBHM.js +9 -0
- package/dist/bundle/chunks/llama-cpp-classify-GCDAR6VP.js +22 -0
- package/dist/bundle/chunks/meta.js +2 -0
- package/dist/bundle/chunks/mistral-conversations-CF3OZSLK.js +5 -0
- package/dist/bundle/chunks/multipart-parser-FMGQ7342.js +3 -0
- package/dist/bundle/chunks/node-AUOGOBCN.js +2 -0
- package/dist/bundle/chunks/node-KCMANYC2.js +16 -0
- package/dist/bundle/chunks/openai-chatgpt.js +75 -0
- package/dist/bundle/chunks/openai-codex-responses-L3IPEYDP.js +10 -0
- package/dist/bundle/chunks/openai-codex.js +75 -0
- package/dist/bundle/chunks/openai-completions-UXPSYQS7.js +7 -0
- package/dist/bundle/chunks/openai-decisions-DML6VHFQ.js +5 -0
- package/dist/bundle/chunks/openai-responses-46Z64FIE.js +4 -0
- package/dist/bundle/chunks/openrouter-images-EI7VO7CT.js +2 -0
- package/dist/bundle/chunks/openrouter.js +75 -0
- package/dist/bundle/chunks/pi-messages-4MV3SCQE.js +8 -0
- package/dist/bundle/chunks/radius.js +75 -0
- package/dist/bundle/chunks/runtime-KEVIZBAR.js +2 -0
- package/dist/bundle/chunks/src-QKGKDFSU.js +4 -0
- package/dist/bundle/chunks/typesafe-system-one-FZU6TH2G.js +2 -0
- package/dist/bundle/chunks/virtual-modules-RGWFZDWP.js +2 -0
- package/dist/bundle/chunks/xai.js +2 -0
- package/dist/bundle/cli-runtime.js +3 -0
- package/dist/bundle/cli.js +5 -0
- package/dist/bundle/index.js +2 -0
- package/dist/bundle/rpc-entry.js +3 -0
- package/dist/cli/args.d.ts +62 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +476 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/auth-check.d.ts +19 -0
- package/dist/cli/auth-check.d.ts.map +1 -0
- package/dist/cli/auth-check.js +50 -0
- package/dist/cli/auth-check.js.map +1 -0
- package/dist/cli/auth-command.d.ts +24 -0
- package/dist/cli/auth-command.d.ts.map +1 -0
- package/dist/cli/auth-command.js +127 -0
- package/dist/cli/auth-command.js.map +1 -0
- package/dist/cli/auth-login.d.ts +15 -0
- package/dist/cli/auth-login.d.ts.map +1 -0
- package/dist/cli/auth-login.js +232 -0
- package/dist/cli/auth-login.js.map +1 -0
- package/dist/cli/auth-logout.d.ts +14 -0
- package/dist/cli/auth-logout.d.ts.map +1 -0
- package/dist/cli/auth-logout.js +57 -0
- package/dist/cli/auth-logout.js.map +1 -0
- package/dist/cli/auth-terminal.d.ts +17 -0
- package/dist/cli/auth-terminal.d.ts.map +1 -0
- package/dist/cli/auth-terminal.js +63 -0
- package/dist/cli/auth-terminal.js.map +1 -0
- package/dist/cli/config-selector.d.ts +16 -0
- package/dist/cli/config-selector.d.ts.map +1 -0
- package/dist/cli/config-selector.js +37 -0
- package/dist/cli/config-selector.js.map +1 -0
- package/dist/cli/credential-print.d.ts +13 -0
- package/dist/cli/credential-print.d.ts.map +1 -0
- package/dist/cli/credential-print.js +76 -0
- package/dist/cli/credential-print.js.map +1 -0
- package/dist/cli/file-processor.d.ts +15 -0
- package/dist/cli/file-processor.d.ts.map +1 -0
- package/dist/cli/file-processor.js +71 -0
- package/dist/cli/file-processor.js.map +1 -0
- package/dist/cli/initial-message.d.ts +18 -0
- package/dist/cli/initial-message.d.ts.map +1 -0
- package/dist/cli/initial-message.js +22 -0
- package/dist/cli/initial-message.js.map +1 -0
- package/dist/cli/list-models.d.ts +9 -0
- package/dist/cli/list-models.d.ts.map +1 -0
- package/dist/cli/list-models.js +98 -0
- package/dist/cli/list-models.js.map +1 -0
- package/dist/cli/project-trust.d.ts +10 -0
- package/dist/cli/project-trust.d.ts.map +1 -0
- package/dist/cli/project-trust.js +48 -0
- package/dist/cli/project-trust.js.map +1 -0
- package/dist/cli/session-picker.d.ts +10 -0
- package/dist/cli/session-picker.d.ts.map +1 -0
- package/dist/cli/session-picker.js +39 -0
- package/dist/cli/session-picker.js.map +1 -0
- package/dist/cli/setup.d.ts +2 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +12 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli/startup-ui.d.ts +20 -0
- package/dist/cli/startup-ui.d.ts.map +1 -0
- package/dist/cli/startup-ui.js +197 -0
- package/dist/cli/startup-ui.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +6 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +136 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +553 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-session-runtime.d.ts +135 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -0
- package/dist/core/agent-session-runtime.js +351 -0
- package/dist/core/agent-session-runtime.js.map +1 -0
- package/dist/core/agent-session-services.d.ts +86 -0
- package/dist/core/agent-session-services.d.ts.map +1 -0
- package/dist/core/agent-session-services.js +147 -0
- package/dist/core/agent-session-services.js.map +1 -0
- package/dist/core/agent-session.d.ts +962 -0
- package/dist/core/agent-session.d.ts.map +1 -0
- package/dist/core/agent-session.js +3751 -0
- package/dist/core/agent-session.js.map +1 -0
- package/dist/core/auth-guidance.d.ts +5 -0
- package/dist/core/auth-guidance.d.ts.map +1 -0
- package/dist/core/auth-guidance.js +21 -0
- package/dist/core/auth-guidance.js.map +1 -0
- package/dist/core/auth-storage.d.ts +72 -0
- package/dist/core/auth-storage.d.ts.map +1 -0
- package/dist/core/auth-storage.js +434 -0
- package/dist/core/auth-storage.js.map +1 -0
- package/dist/core/bash-executor.d.ts +32 -0
- package/dist/core/bash-executor.d.ts.map +1 -0
- package/dist/core/bash-executor.js +103 -0
- package/dist/core/bash-executor.js.map +1 -0
- package/dist/core/bug-report-upload.d.ts +12 -0
- package/dist/core/bug-report-upload.d.ts.map +1 -0
- package/dist/core/bug-report-upload.js +22 -0
- package/dist/core/bug-report-upload.js.map +1 -0
- package/dist/core/bug-report.d.ts +184 -0
- package/dist/core/bug-report.d.ts.map +1 -0
- package/dist/core/bug-report.js +292 -0
- package/dist/core/bug-report.js.map +1 -0
- package/dist/core/cache-stats.d.ts +49 -0
- package/dist/core/cache-stats.d.ts.map +1 -0
- package/dist/core/cache-stats.js +112 -0
- package/dist/core/cache-stats.js.map +1 -0
- package/dist/core/cache-warmer.d.ts +70 -0
- package/dist/core/cache-warmer.d.ts.map +1 -0
- package/dist/core/cache-warmer.js +278 -0
- package/dist/core/cache-warmer.js.map +1 -0
- package/dist/core/client-identity.d.ts +8 -0
- package/dist/core/client-identity.d.ts.map +1 -0
- package/dist/core/client-identity.js +15 -0
- package/dist/core/client-identity.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +100 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/core/compaction/branch-summarization.js +262 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +145 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -0
- package/dist/core/compaction/compaction.js +749 -0
- package/dist/core/compaction/compaction.js.map +1 -0
- package/dist/core/compaction/index.d.ts +7 -0
- package/dist/core/compaction/index.d.ts.map +1 -0
- package/dist/core/compaction/index.js +7 -0
- package/dist/core/compaction/index.js.map +1 -0
- package/dist/core/compaction/utils.d.ts +45 -0
- package/dist/core/compaction/utils.d.ts.map +1 -0
- package/dist/core/compaction/utils.js +149 -0
- package/dist/core/compaction/utils.js.map +1 -0
- package/dist/core/crash-log.d.ts +27 -0
- package/dist/core/crash-log.d.ts.map +1 -0
- package/dist/core/crash-log.js +140 -0
- package/dist/core/crash-log.js.map +1 -0
- package/dist/core/defaults.d.ts +4 -0
- package/dist/core/defaults.d.ts.map +1 -0
- package/dist/core/defaults.js +11 -0
- package/dist/core/defaults.js.map +1 -0
- package/dist/core/diagnostics.d.ts +15 -0
- package/dist/core/diagnostics.d.ts.map +1 -0
- package/dist/core/diagnostics.js +2 -0
- package/dist/core/diagnostics.js.map +1 -0
- package/dist/core/diffra-ai-schemas.d.ts +167 -0
- package/dist/core/diffra-ai-schemas.d.ts.map +1 -0
- package/dist/core/diffra-ai-schemas.js +21 -0
- package/dist/core/diffra-ai-schemas.js.map +1 -0
- package/dist/core/diffra-manifest.d.ts +9 -0
- package/dist/core/diffra-manifest.d.ts.map +1 -0
- package/dist/core/diffra-manifest.js +30 -0
- package/dist/core/diffra-manifest.js.map +1 -0
- package/dist/core/event-bus.d.ts +9 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/event-bus.js +25 -0
- package/dist/core/event-bus.js.map +1 -0
- package/dist/core/exec.d.ts +38 -0
- package/dist/core/exec.d.ts.map +1 -0
- package/dist/core/exec.js +122 -0
- package/dist/core/exec.js.map +1 -0
- package/dist/core/experimental.d.ts +2 -0
- package/dist/core/experimental.d.ts.map +1 -0
- package/dist/core/experimental.js +4 -0
- package/dist/core/experimental.js.map +1 -0
- package/dist/core/export-html/ansi-to-html.d.ts +27 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/core/export-html/ansi-to-html.js +286 -0
- package/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/dist/core/export-html/index.d.ts +37 -0
- package/dist/core/export-html/index.d.ts.map +1 -0
- package/dist/core/export-html/index.js +228 -0
- package/dist/core/export-html/index.js.map +1 -0
- package/dist/core/export-html/template.css +1085 -0
- package/dist/core/export-html/template.html +56 -0
- package/dist/core/export-html/template.js +2044 -0
- package/dist/core/export-html/tool-renderer.d.ts +34 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/core/export-html/tool-renderer.js +112 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
- package/dist/core/export-html/vendor/marked.min.js +79 -0
- package/dist/core/extensions/diffra-ai-extension-view.d.ts +19 -0
- package/dist/core/extensions/diffra-ai-extension-view.d.ts.map +1 -0
- package/dist/core/extensions/diffra-ai-extension-view.js +22 -0
- package/dist/core/extensions/diffra-ai-extension-view.js.map +1 -0
- package/dist/core/extensions/index.d.ts +12 -0
- package/dist/core/extensions/index.d.ts.map +1 -0
- package/dist/core/extensions/index.js +9 -0
- package/dist/core/extensions/index.js.map +1 -0
- package/dist/core/extensions/jiti-loader.d.ts +2 -0
- package/dist/core/extensions/jiti-loader.d.ts.map +1 -0
- package/dist/core/extensions/jiti-loader.js +4 -0
- package/dist/core/extensions/jiti-loader.js.map +1 -0
- package/dist/core/extensions/jiti-static-loader.d.ts +2 -0
- package/dist/core/extensions/jiti-static-loader.d.ts.map +1 -0
- package/dist/core/extensions/jiti-static-loader.js +4 -0
- package/dist/core/extensions/jiti-static-loader.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +23 -0
- package/dist/core/extensions/loader.d.ts.map +1 -0
- package/dist/core/extensions/loader.js +719 -0
- package/dist/core/extensions/loader.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +216 -0
- package/dist/core/extensions/runner.d.ts.map +1 -0
- package/dist/core/extensions/runner.js +1251 -0
- package/dist/core/extensions/runner.js.map +1 -0
- package/dist/core/extensions/types.d.ts +1807 -0
- package/dist/core/extensions/types.d.ts.map +1 -0
- package/dist/core/extensions/types.js +48 -0
- package/dist/core/extensions/types.js.map +1 -0
- package/dist/core/extensions/virtual-modules.d.ts +3 -0
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -0
- package/dist/core/extensions/virtual-modules.js +34 -0
- package/dist/core/extensions/virtual-modules.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts +20 -0
- package/dist/core/extensions/wrapper.d.ts.map +1 -0
- package/dist/core/extensions/wrapper.js +22 -0
- package/dist/core/extensions/wrapper.js.map +1 -0
- package/dist/core/footer-data-provider.d.ts +64 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -0
- package/dist/core/footer-data-provider.js +338 -0
- package/dist/core/footer-data-provider.js.map +1 -0
- package/dist/core/http-dispatcher.d.ts +22 -0
- package/dist/core/http-dispatcher.d.ts.map +1 -0
- package/dist/core/http-dispatcher.js +98 -0
- package/dist/core/http-dispatcher.js.map +1 -0
- package/dist/core/index.d.ts +14 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +13 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/key-id-schema.d.ts +6 -0
- package/dist/core/key-id-schema.d.ts.map +1 -0
- package/dist/core/key-id-schema.js +16 -0
- package/dist/core/key-id-schema.js.map +1 -0
- package/dist/core/keybindings-schema.d.ts +4 -0
- package/dist/core/keybindings-schema.d.ts.map +1 -0
- package/dist/core/keybindings-schema.js +16 -0
- package/dist/core/keybindings-schema.js.map +1 -0
- package/dist/core/keybindings.d.ts +560 -0
- package/dist/core/keybindings.d.ts.map +1 -0
- package/dist/core/keybindings.js +324 -0
- package/dist/core/keybindings.js.map +1 -0
- package/dist/core/mcp-servers.d.ts +121 -0
- package/dist/core/mcp-servers.d.ts.map +1 -0
- package/dist/core/mcp-servers.js +163 -0
- package/dist/core/mcp-servers.js.map +1 -0
- package/dist/core/messages.d.ts +77 -0
- package/dist/core/messages.d.ts.map +1 -0
- package/dist/core/messages.js +124 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/model-config.d.ts +2013 -0
- package/dist/core/model-config.d.ts.map +1 -0
- package/dist/core/model-config.js +167 -0
- package/dist/core/model-config.js.map +1 -0
- package/dist/core/model-registry.d.ts +63 -0
- package/dist/core/model-registry.d.ts.map +1 -0
- package/dist/core/model-registry.js +144 -0
- package/dist/core/model-registry.js.map +1 -0
- package/dist/core/model-resolver.d.ts +129 -0
- package/dist/core/model-resolver.d.ts.map +1 -0
- package/dist/core/model-resolver.js +428 -0
- package/dist/core/model-resolver.js.map +1 -0
- package/dist/core/model-runtime.d.ts +150 -0
- package/dist/core/model-runtime.d.ts.map +1 -0
- package/dist/core/model-runtime.js +774 -0
- package/dist/core/model-runtime.js.map +1 -0
- package/dist/core/models-store.d.ts +22 -0
- package/dist/core/models-store.d.ts.map +1 -0
- package/dist/core/models-store.js +115 -0
- package/dist/core/models-store.js.map +1 -0
- package/dist/core/nested-tool-calls.d.ts +103 -0
- package/dist/core/nested-tool-calls.d.ts.map +1 -0
- package/dist/core/nested-tool-calls.js +179 -0
- package/dist/core/nested-tool-calls.js.map +1 -0
- package/dist/core/output-guard.d.ts +7 -0
- package/dist/core/output-guard.d.ts.map +1 -0
- package/dist/core/output-guard.js +89 -0
- package/dist/core/output-guard.js.map +1 -0
- package/dist/core/package-manager.d.ts +256 -0
- package/dist/core/package-manager.d.ts.map +1 -0
- package/dist/core/package-manager.js +2426 -0
- package/dist/core/package-manager.js.map +1 -0
- package/dist/core/preferred-providers.d.ts +17 -0
- package/dist/core/preferred-providers.d.ts.map +1 -0
- package/dist/core/preferred-providers.js +24 -0
- package/dist/core/preferred-providers.js.map +1 -0
- package/dist/core/project-trust.d.ts +15 -0
- package/dist/core/project-trust.d.ts.map +1 -0
- package/dist/core/project-trust.js +60 -0
- package/dist/core/project-trust.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +59 -0
- package/dist/core/prompt-templates.d.ts.map +1 -0
- package/dist/core/prompt-templates.js +283 -0
- package/dist/core/prompt-templates.js.map +1 -0
- package/dist/core/provider-composer.d.ts +81 -0
- package/dist/core/provider-composer.d.ts.map +1 -0
- package/dist/core/provider-composer.js +494 -0
- package/dist/core/provider-composer.js.map +1 -0
- package/dist/core/provider-matching.d.ts +6 -0
- package/dist/core/provider-matching.d.ts.map +1 -0
- package/dist/core/provider-matching.js +8 -0
- package/dist/core/provider-matching.js.map +1 -0
- package/dist/core/radius-mcp.d.ts +13 -0
- package/dist/core/radius-mcp.d.ts.map +1 -0
- package/dist/core/radius-mcp.js +29 -0
- package/dist/core/radius-mcp.js.map +1 -0
- package/dist/core/radius.d.ts +7 -0
- package/dist/core/radius.d.ts.map +1 -0
- package/dist/core/radius.js +10 -0
- package/dist/core/radius.js.map +1 -0
- package/dist/core/remote-catalog-provider.d.ts +23 -0
- package/dist/core/remote-catalog-provider.d.ts.map +1 -0
- package/dist/core/remote-catalog-provider.js +199 -0
- package/dist/core/remote-catalog-provider.js.map +1 -0
- package/dist/core/resolve-config-value.d.ts +30 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -0
- package/dist/core/resolve-config-value.js +247 -0
- package/dist/core/resolve-config-value.js.map +1 -0
- package/dist/core/resource-loader.d.ts +237 -0
- package/dist/core/resource-loader.d.ts.map +1 -0
- package/dist/core/resource-loader.js +1023 -0
- package/dist/core/resource-loader.js.map +1 -0
- package/dist/core/runtime-credentials.d.ts +23 -0
- package/dist/core/runtime-credentials.d.ts.map +1 -0
- package/dist/core/runtime-credentials.js +53 -0
- package/dist/core/runtime-credentials.js.map +1 -0
- package/dist/core/sdk.d.ts +117 -0
- package/dist/core/sdk.d.ts.map +1 -0
- package/dist/core/sdk.js +329 -0
- package/dist/core/sdk.js.map +1 -0
- package/dist/core/session-cwd.d.ts +26 -0
- package/dist/core/session-cwd.d.ts.map +1 -0
- package/dist/core/session-cwd.js +46 -0
- package/dist/core/session-cwd.js.map +1 -0
- package/dist/core/session-export.d.ts +8 -0
- package/dist/core/session-export.d.ts.map +1 -0
- package/dist/core/session-export.js +33 -0
- package/dist/core/session-export.js.map +1 -0
- package/dist/core/session-manager.d.ts +423 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js +1553 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/settings-defaults.d.ts +66 -0
- package/dist/core/settings-defaults.d.ts.map +1 -0
- package/dist/core/settings-defaults.js +67 -0
- package/dist/core/settings-defaults.js.map +1 -0
- package/dist/core/settings-diagnostics.d.ts +9 -0
- package/dist/core/settings-diagnostics.d.ts.map +1 -0
- package/dist/core/settings-diagnostics.js +21 -0
- package/dist/core/settings-diagnostics.js.map +1 -0
- package/dist/core/settings-manager.d.ts +253 -0
- package/dist/core/settings-manager.d.ts.map +1 -0
- package/dist/core/settings-manager.js +1154 -0
- package/dist/core/settings-manager.js.map +1 -0
- package/dist/core/settings-schema.d.ts +232 -0
- package/dist/core/settings-schema.d.ts.map +1 -0
- package/dist/core/settings-schema.js +298 -0
- package/dist/core/settings-schema.js.map +1 -0
- package/dist/core/skills.d.ts +63 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +404 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/slash-commands.d.ts +15 -0
- package/dist/core/slash-commands.d.ts.map +1 -0
- package/dist/core/slash-commands.js +28 -0
- package/dist/core/slash-commands.js.map +1 -0
- package/dist/core/source-info.d.ts +35 -0
- package/dist/core/source-info.d.ts.map +1 -0
- package/dist/core/source-info.js +48 -0
- package/dist/core/source-info.js.map +1 -0
- package/dist/core/system-prompt.d.ts +77 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/system-prompt.js +151 -0
- package/dist/core/system-prompt.js.map +1 -0
- package/dist/core/telemetry.d.ts +3 -0
- package/dist/core/telemetry.d.ts.map +1 -0
- package/dist/core/telemetry.js +9 -0
- package/dist/core/telemetry.js.map +1 -0
- package/dist/core/timings.d.ts +10 -0
- package/dist/core/timings.d.ts.map +1 -0
- package/dist/core/timings.js +41 -0
- package/dist/core/timings.js.map +1 -0
- package/dist/core/tools/bash.d.ts +100 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +363 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +110 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/core/tools/edit-diff.js +562 -0
- package/dist/core/tools/edit-diff.js.map +1 -0
- package/dist/core/tools/edit.d.ts +44 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +146 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/file-mutation-queue.d.ts +6 -0
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
- package/dist/core/tools/file-mutation-queue.js +52 -0
- package/dist/core/tools/file-mutation-queue.js.map +1 -0
- package/dist/core/tools/find.d.ts +42 -0
- package/dist/core/tools/find.d.ts.map +1 -0
- package/dist/core/tools/find.js +308 -0
- package/dist/core/tools/find.js.map +1 -0
- package/dist/core/tools/grep.d.ts +43 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +266 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/index.d.ts +43 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/index.js +129 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/ls.d.ts +41 -0
- package/dist/core/tools/ls.d.ts.map +1 -0
- package/dist/core/tools/ls.js +127 -0
- package/dist/core/tools/ls.js.map +1 -0
- package/dist/core/tools/output-accumulator.d.ts +63 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -0
- package/dist/core/tools/output-accumulator.js +218 -0
- package/dist/core/tools/output-accumulator.js.map +1 -0
- package/dist/core/tools/path-utils.d.ts +10 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -0
- package/dist/core/tools/path-utils.js +99 -0
- package/dist/core/tools/path-utils.js.map +1 -0
- package/dist/core/tools/powershell.d.ts +16 -0
- package/dist/core/tools/powershell.d.ts.map +1 -0
- package/dist/core/tools/powershell.js +52 -0
- package/dist/core/tools/powershell.js.map +1 -0
- package/dist/core/tools/read.d.ts +68 -0
- package/dist/core/tools/read.d.ts.map +1 -0
- package/dist/core/tools/read.js +297 -0
- package/dist/core/tools/read.js.map +1 -0
- package/dist/core/tools/render-utils.d.ts +50 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -0
- package/dist/core/tools/render-utils.js +153 -0
- package/dist/core/tools/render-utils.js.map +1 -0
- package/dist/core/tools/renderers/bash.d.ts +12 -0
- package/dist/core/tools/renderers/bash.d.ts.map +1 -0
- package/dist/core/tools/renderers/bash.js +89 -0
- package/dist/core/tools/renderers/bash.js.map +1 -0
- package/dist/core/tools/renderers/edit.d.ts +23 -0
- package/dist/core/tools/renderers/edit.d.ts.map +1 -0
- package/dist/core/tools/renderers/edit.js +168 -0
- package/dist/core/tools/renderers/edit.js.map +1 -0
- package/dist/core/tools/renderers/find.d.ts +10 -0
- package/dist/core/tools/renderers/find.d.ts.map +1 -0
- package/dist/core/tools/renderers/find.js +64 -0
- package/dist/core/tools/renderers/find.js.map +1 -0
- package/dist/core/tools/renderers/grep.d.ts +10 -0
- package/dist/core/tools/renderers/grep.d.ts.map +1 -0
- package/dist/core/tools/renderers/grep.js +69 -0
- package/dist/core/tools/renderers/grep.js.map +1 -0
- package/dist/core/tools/renderers/index.d.ts +28 -0
- package/dist/core/tools/renderers/index.d.ts.map +1 -0
- package/dist/core/tools/renderers/index.js +47 -0
- package/dist/core/tools/renderers/index.js.map +1 -0
- package/dist/core/tools/renderers/ls.d.ts +10 -0
- package/dist/core/tools/renderers/ls.d.ts.map +1 -0
- package/dist/core/tools/renderers/ls.js +58 -0
- package/dist/core/tools/renderers/ls.js.map +1 -0
- package/dist/core/tools/renderers/read.d.ts +11 -0
- package/dist/core/tools/renderers/read.d.ts.map +1 -0
- package/dist/core/tools/renderers/read.js +130 -0
- package/dist/core/tools/renderers/read.js.map +1 -0
- package/dist/core/tools/renderers/write.d.ts +10 -0
- package/dist/core/tools/renderers/write.d.ts.map +1 -0
- package/dist/core/tools/renderers/write.js +153 -0
- package/dist/core/tools/renderers/write.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +26 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.js +38 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
- package/dist/core/tools/truncate.d.ts +74 -0
- package/dist/core/tools/truncate.d.ts.map +1 -0
- package/dist/core/tools/truncate.js +244 -0
- package/dist/core/tools/truncate.js.map +1 -0
- package/dist/core/tools/write.d.ts +30 -0
- package/dist/core/tools/write.d.ts.map +1 -0
- package/dist/core/tools/write.js +61 -0
- package/dist/core/tools/write.js.map +1 -0
- package/dist/core/trust-manager.d.ts +36 -0
- package/dist/core/trust-manager.d.ts.map +1 -0
- package/dist/core/trust-manager.js +210 -0
- package/dist/core/trust-manager.js.map +1 -0
- package/dist/core/usage-totals.d.ts +21 -0
- package/dist/core/usage-totals.d.ts.map +1 -0
- package/dist/core/usage-totals.js +81 -0
- package/dist/core/usage-totals.js.map +1 -0
- package/dist/core/virtual-models.d.ts +117 -0
- package/dist/core/virtual-models.d.ts.map +1 -0
- package/dist/core/virtual-models.js +124 -0
- package/dist/core/virtual-models.js.map +1 -0
- package/dist/extensions/codemode/execute.d.ts +16 -0
- package/dist/extensions/codemode/execute.d.ts.map +1 -0
- package/dist/extensions/codemode/execute.js +740 -0
- package/dist/extensions/codemode/execute.js.map +1 -0
- package/dist/extensions/codemode/execute.lazy.d.ts +3 -0
- package/dist/extensions/codemode/execute.lazy.d.ts.map +1 -0
- package/dist/extensions/codemode/execute.lazy.js +3 -0
- package/dist/extensions/codemode/execute.lazy.js.map +1 -0
- package/dist/extensions/codemode/index.d.ts +21 -0
- package/dist/extensions/codemode/index.d.ts.map +1 -0
- package/dist/extensions/codemode/index.js +33 -0
- package/dist/extensions/codemode/index.js.map +1 -0
- package/dist/extensions/codemode/renderer.d.ts +12 -0
- package/dist/extensions/codemode/renderer.d.ts.map +1 -0
- package/dist/extensions/codemode/renderer.js +147 -0
- package/dist/extensions/codemode/renderer.js.map +1 -0
- package/dist/extensions/codemode/tool.d.ts +125 -0
- package/dist/extensions/codemode/tool.d.ts.map +1 -0
- package/dist/extensions/codemode/tool.js +335 -0
- package/dist/extensions/codemode/tool.js.map +1 -0
- package/dist/extensions/codemode/worker.d.ts +7 -0
- package/dist/extensions/codemode/worker.d.ts.map +1 -0
- package/dist/extensions/codemode/worker.js +7 -0
- package/dist/extensions/codemode/worker.js.map +1 -0
- package/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +13 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/extensions/llama/client.d.ts +71 -0
- package/dist/extensions/llama/client.d.ts.map +1 -0
- package/dist/extensions/llama/client.js +334 -0
- package/dist/extensions/llama/client.js.map +1 -0
- package/dist/extensions/llama/huggingface.d.ts +23 -0
- package/dist/extensions/llama/huggingface.d.ts.map +1 -0
- package/dist/extensions/llama/huggingface.js +141 -0
- package/dist/extensions/llama/huggingface.js.map +1 -0
- package/dist/extensions/llama/index.d.ts +3 -0
- package/dist/extensions/llama/index.d.ts.map +1 -0
- package/dist/extensions/llama/index.js +219 -0
- package/dist/extensions/llama/index.js.map +1 -0
- package/dist/extensions/llama/provider.d.ts +12 -0
- package/dist/extensions/llama/provider.d.ts.map +1 -0
- package/dist/extensions/llama/provider.js +238 -0
- package/dist/extensions/llama/provider.js.map +1 -0
- package/dist/extensions/llama/ui.d.ts +42 -0
- package/dist/extensions/llama/ui.d.ts.map +1 -0
- package/dist/extensions/llama/ui.js +440 -0
- package/dist/extensions/llama/ui.js.map +1 -0
- package/dist/extensions/mcp/cli.d.ts +23 -0
- package/dist/extensions/mcp/cli.d.ts.map +1 -0
- package/dist/extensions/mcp/cli.js +555 -0
- package/dist/extensions/mcp/cli.js.map +1 -0
- package/dist/extensions/mcp/cli.lazy.d.ts +3 -0
- package/dist/extensions/mcp/cli.lazy.d.ts.map +1 -0
- package/dist/extensions/mcp/cli.lazy.js +3 -0
- package/dist/extensions/mcp/cli.lazy.js.map +1 -0
- package/dist/extensions/mcp/config.d.ts +84 -0
- package/dist/extensions/mcp/config.d.ts.map +1 -0
- package/dist/extensions/mcp/config.js +192 -0
- package/dist/extensions/mcp/config.js.map +1 -0
- package/dist/extensions/mcp/index.d.ts +79 -0
- package/dist/extensions/mcp/index.d.ts.map +1 -0
- package/dist/extensions/mcp/index.js +1203 -0
- package/dist/extensions/mcp/index.js.map +1 -0
- package/dist/extensions/mcp/log.d.ts +16 -0
- package/dist/extensions/mcp/log.d.ts.map +1 -0
- package/dist/extensions/mcp/log.js +66 -0
- package/dist/extensions/mcp/log.js.map +1 -0
- package/dist/extensions/mcp/oauth.d.ts +64 -0
- package/dist/extensions/mcp/oauth.d.ts.map +1 -0
- package/dist/extensions/mcp/oauth.js +188 -0
- package/dist/extensions/mcp/oauth.js.map +1 -0
- package/dist/extensions/mcp/resources.d.ts +36 -0
- package/dist/extensions/mcp/resources.d.ts.map +1 -0
- package/dist/extensions/mcp/resources.js +262 -0
- package/dist/extensions/mcp/resources.js.map +1 -0
- package/dist/extensions/mcp/runtime.d.ts +99 -0
- package/dist/extensions/mcp/runtime.d.ts.map +1 -0
- package/dist/extensions/mcp/runtime.js +380 -0
- package/dist/extensions/mcp/runtime.js.map +1 -0
- package/dist/extensions/mcp/runtime.lazy.d.ts +3 -0
- package/dist/extensions/mcp/runtime.lazy.d.ts.map +1 -0
- package/dist/extensions/mcp/runtime.lazy.js +3 -0
- package/dist/extensions/mcp/runtime.lazy.js.map +1 -0
- package/dist/extensions/mcp/tools.d.ts +57 -0
- package/dist/extensions/mcp/tools.d.ts.map +1 -0
- package/dist/extensions/mcp/tools.js +141 -0
- package/dist/extensions/mcp/tools.js.map +1 -0
- package/dist/extensions/mcp/ui.d.ts +61 -0
- package/dist/extensions/mcp/ui.d.ts.map +1 -0
- package/dist/extensions/mcp/ui.js +195 -0
- package/dist/extensions/mcp/ui.js.map +1 -0
- package/dist/extensions/tool-search/index.d.ts +12 -0
- package/dist/extensions/tool-search/index.d.ts.map +1 -0
- package/dist/extensions/tool-search/index.js +15 -0
- package/dist/extensions/tool-search/index.js.map +1 -0
- package/dist/extensions/tool-search/tool.d.ts +86 -0
- package/dist/extensions/tool-search/tool.d.ts.map +1 -0
- package/dist/extensions/tool-search/tool.js +267 -0
- package/dist/extensions/tool-search/tool.js.map +1 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +16 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +904 -0
- package/dist/main.js.map +1 -0
- package/dist/migrations.d.ts +33 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +282 -0
- package/dist/migrations.js.map +1 -0
- package/dist/modes/diagnostics-stderr.d.ts +4 -0
- package/dist/modes/diagnostics-stderr.d.ts.map +1 -0
- package/dist/modes/diagnostics-stderr.js +11 -0
- package/dist/modes/diagnostics-stderr.js.map +1 -0
- package/dist/modes/index.d.ts +10 -0
- package/dist/modes/index.d.ts.map +1 -0
- package/dist/modes/index.js +8 -0
- package/dist/modes/index.js.map +1 -0
- package/dist/modes/interactive/assets/clankolas.png +0 -0
- package/dist/modes/interactive/bug-report.d.ts +16 -0
- package/dist/modes/interactive/bug-report.d.ts.map +1 -0
- package/dist/modes/interactive/bug-report.js +210 -0
- package/dist/modes/interactive/bug-report.js.map +1 -0
- package/dist/modes/interactive/chat-viewport.d.ts +20 -0
- package/dist/modes/interactive/chat-viewport.d.ts.map +1 -0
- package/dist/modes/interactive/chat-viewport.js +28 -0
- package/dist/modes/interactive/chat-viewport.js.map +1 -0
- package/dist/modes/interactive/components/armin.d.ts +37 -0
- package/dist/modes/interactive/components/armin.d.ts.map +1 -0
- package/dist/modes/interactive/components/armin.js +335 -0
- package/dist/modes/interactive/components/armin.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +30 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-message.js +188 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -0
- package/dist/modes/interactive/components/auth-url.d.ts +14 -0
- package/dist/modes/interactive/components/auth-url.d.ts.map +1 -0
- package/dist/modes/interactive/components/auth-url.js +37 -0
- package/dist/modes/interactive/components/auth-url.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +38 -0
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/bash-execution.js +178 -0
- package/dist/modes/interactive/components/bash-execution.js.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.js +54 -0
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +21 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.js +62 -0
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +21 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +63 -0
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/config-selector.d.ts +102 -0
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/config-selector.js +761 -0
- package/dist/modes/interactive/components/config-selector.js.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.js +33 -0
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +30 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-editor.js +122 -0
- package/dist/modes/interactive/components/custom-editor.js.map +1 -0
- package/dist/modes/interactive/components/custom-entry.d.ts +21 -0
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-entry.js +59 -0
- package/dist/modes/interactive/components/custom-entry.js.map +1 -0
- package/dist/modes/interactive/components/custom-message.d.ts +25 -0
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-message.js +96 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -0
- package/dist/modes/interactive/components/diff.d.ts +12 -0
- package/dist/modes/interactive/components/diff.d.ts.map +1 -0
- package/dist/modes/interactive/components/diff.js +139 -0
- package/dist/modes/interactive/components/diff.js.map +1 -0
- package/dist/modes/interactive/components/diffra-logo.d.ts +28 -0
- package/dist/modes/interactive/components/diffra-logo.d.ts.map +1 -0
- package/dist/modes/interactive/components/diffra-logo.js +110 -0
- package/dist/modes/interactive/components/diffra-logo.js.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.js +21 -0
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
- package/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -0
- package/dist/modes/interactive/components/earendil-announcement.js +40 -0
- package/dist/modes/interactive/components/earendil-announcement.js.map +1 -0
- package/dist/modes/interactive/components/easter-egg-3d.d.ts +104 -0
- package/dist/modes/interactive/components/easter-egg-3d.d.ts.map +1 -0
- package/dist/modes/interactive/components/easter-egg-3d.js +1145 -0
- package/dist/modes/interactive/components/easter-egg-3d.js.map +1 -0
- package/dist/modes/interactive/components/easter-egg-3d.lazy.d.ts +6 -0
- package/dist/modes/interactive/components/easter-egg-3d.lazy.d.ts.map +1 -0
- package/dist/modes/interactive/components/easter-egg-3d.lazy.js +23 -0
- package/dist/modes/interactive/components/easter-egg-3d.lazy.js.map +1 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +26 -0
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-editor.js +107 -0
- package/dist/modes/interactive/components/extension-editor.js.map +1 -0
- package/dist/modes/interactive/components/extension-input.d.ts +25 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-input.js +67 -0
- package/dist/modes/interactive/components/extension-input.js.map +1 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +27 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-selector.js +95 -0
- package/dist/modes/interactive/components/extension-selector.js.map +1 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -0
- package/dist/modes/interactive/components/first-time-setup.js +109 -0
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +39 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/dist/modes/interactive/components/footer.js +265 -0
- package/dist/modes/interactive/components/footer.js.map +1 -0
- package/dist/modes/interactive/components/index.d.ts +33 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -0
- package/dist/modes/interactive/components/index.js +34 -0
- package/dist/modes/interactive/components/index.js.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.js +36 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +59 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
- package/dist/modes/interactive/components/login-dialog.js +272 -0
- package/dist/modes/interactive/components/login-dialog.js.map +1 -0
- package/dist/modes/interactive/components/markdown-transform.d.ts +4 -0
- package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
- package/dist/modes/interactive/components/markdown-transform.js +20 -0
- package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
- package/dist/modes/interactive/components/mermaid.d.ts +12 -0
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -0
- package/dist/modes/interactive/components/mermaid.js +80 -0
- package/dist/modes/interactive/components/mermaid.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +61 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector.js +383 -0
- package/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +47 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.js +206 -0
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
- package/dist/modes/interactive/components/provider-brand.d.ts +14 -0
- package/dist/modes/interactive/components/provider-brand.d.ts.map +1 -0
- package/dist/modes/interactive/components/provider-brand.js +66 -0
- package/dist/modes/interactive/components/provider-brand.js.map +1 -0
- package/dist/modes/interactive/components/radius-login-selector.d.ts +14 -0
- package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/radius-login-selector.js +55 -0
- package/dist/modes/interactive/components/radius-login-selector.js.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +47 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +345 -0
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +27 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.js +219 -0
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +103 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector.js +917 -0
- package/dist/modes/interactive/components/session-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +98 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector.js +753 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-submenu.d.ts +72 -0
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-submenu.js +171 -0
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.js +39 -0
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +22 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +65 -0
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
- package/dist/modes/interactive/components/status-indicator.d.ts +30 -0
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -0
- package/dist/modes/interactive/components/status-indicator.js +67 -0
- package/dist/modes/interactive/components/status-indicator.js.map +1 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/theme-selector.js +50 -0
- package/dist/modes/interactive/components/theme-selector.js.map +1 -0
- package/dist/modes/interactive/components/themed-text.d.ts +17 -0
- package/dist/modes/interactive/components/themed-text.d.ts.map +1 -0
- package/dist/modes/interactive/components/themed-text.js +29 -0
- package/dist/modes/interactive/components/themed-text.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +23 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.js +113 -0
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +79 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-execution.js +338 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +96 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector.js +1255 -0
- package/dist/modes/interactive/components/tree-selector.js.map +1 -0
- package/dist/modes/interactive/components/trust-selector.d.ts +23 -0
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/trust-selector.js +91 -0
- package/dist/modes/interactive/components/trust-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +31 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.js +122 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message.d.ts +19 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message.js +60 -0
- package/dist/modes/interactive/components/user-message.js.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +48 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.js +66 -0
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
- package/dist/modes/interactive/external-editor.d.ts +13 -0
- package/dist/modes/interactive/external-editor.d.ts.map +1 -0
- package/dist/modes/interactive/external-editor.js +50 -0
- package/dist/modes/interactive/external-editor.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +542 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +6193 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -0
- package/dist/modes/interactive/model-catalog-refresh.d.ts +7 -0
- package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -0
- package/dist/modes/interactive/model-catalog-refresh.js +34 -0
- package/dist/modes/interactive/model-catalog-refresh.js.map +1 -0
- package/dist/modes/interactive/model-search.d.ts +22 -0
- package/dist/modes/interactive/model-search.d.ts.map +1 -0
- package/dist/modes/interactive/model-search.js +36 -0
- package/dist/modes/interactive/model-search.js.map +1 -0
- package/dist/modes/interactive/program-status-reporter.d.ts +34 -0
- package/dist/modes/interactive/program-status-reporter.d.ts.map +1 -0
- package/dist/modes/interactive/program-status-reporter.js +110 -0
- package/dist/modes/interactive/program-status-reporter.js.map +1 -0
- package/dist/modes/interactive/session-share.d.ts +18 -0
- package/dist/modes/interactive/session-share.d.ts.map +1 -0
- package/dist/modes/interactive/session-share.js +197 -0
- package/dist/modes/interactive/session-share.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +78 -0
- package/dist/modes/interactive/theme/light.json +78 -0
- package/dist/modes/interactive/theme/system-theme.d.ts +55 -0
- package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/system-theme.js +546 -0
- package/dist/modes/interactive/theme/system-theme.js.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +81 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.js +210 -0
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts +28 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.js +105 -0
- package/dist/modes/interactive/theme/theme-schema.js.map +1 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts +257 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-tokens.js +94 -0
- package/dist/modes/interactive/theme/theme-tokens.js.map +1 -0
- package/dist/modes/interactive/theme/theme.d.ts +167 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +920 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -0
- package/dist/modes/interactive/tui-renderer.d.ts +22 -0
- package/dist/modes/interactive/tui-renderer.d.ts.map +1 -0
- package/dist/modes/interactive/tui-renderer.js +67 -0
- package/dist/modes/interactive/tui-renderer.js.map +1 -0
- package/dist/modes/json-event.d.ts +34 -0
- package/dist/modes/json-event.d.ts.map +1 -0
- package/dist/modes/json-event.js +29 -0
- package/dist/modes/json-event.js.map +1 -0
- package/dist/modes/print-mode.d.ts +28 -0
- package/dist/modes/print-mode.d.ts.map +1 -0
- package/dist/modes/print-mode.js +155 -0
- package/dist/modes/print-mode.js.map +1 -0
- package/dist/modes/rpc/jsonl.d.ts +17 -0
- package/dist/modes/rpc/jsonl.d.ts.map +1 -0
- package/dist/modes/rpc/jsonl.js +49 -0
- package/dist/modes/rpc/jsonl.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +254 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client.js +499 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts +20 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-mode.js +677 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +478 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-types.js +8 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -0
- package/dist/package-manager-cli.d.ts +8 -0
- package/dist/package-manager-cli.d.ts.map +1 -0
- package/dist/package-manager-cli.js +812 -0
- package/dist/package-manager-cli.js.map +1 -0
- package/dist/rpc-entry.d.ts +3 -0
- package/dist/rpc-entry.d.ts.map +1 -0
- package/dist/rpc-entry.js +11 -0
- package/dist/rpc-entry.js.map +1 -0
- package/dist/utils/abort.d.ts +5 -0
- package/dist/utils/abort.d.ts.map +1 -0
- package/dist/utils/abort.js +48 -0
- package/dist/utils/abort.js.map +1 -0
- package/dist/utils/ansi.d.ts +10 -0
- package/dist/utils/ansi.d.ts.map +1 -0
- package/dist/utils/ansi.js +74 -0
- package/dist/utils/ansi.js.map +1 -0
- package/dist/utils/changelog.d.ts +22 -0
- package/dist/utils/changelog.d.ts.map +1 -0
- package/dist/utils/changelog.js +174 -0
- package/dist/utils/changelog.js.map +1 -0
- package/dist/utils/child-process.d.ts +18 -0
- package/dist/utils/child-process.d.ts.map +1 -0
- package/dist/utils/child-process.js +106 -0
- package/dist/utils/child-process.js.map +1 -0
- package/dist/utils/clipboard-command.d.ts +7 -0
- package/dist/utils/clipboard-command.d.ts.map +1 -0
- package/dist/utils/clipboard-command.js +52 -0
- package/dist/utils/clipboard-command.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts +11 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -0
- package/dist/utils/clipboard-image.js +214 -0
- package/dist/utils/clipboard-image.js.map +1 -0
- package/dist/utils/clipboard.d.ts +6 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +162 -0
- package/dist/utils/clipboard.js.map +1 -0
- package/dist/utils/diffra-user-agent.d.ts +3 -0
- package/dist/utils/diffra-user-agent.d.ts.map +1 -0
- package/dist/utils/diffra-user-agent.js +6 -0
- package/dist/utils/diffra-user-agent.js.map +1 -0
- package/dist/utils/exif-orientation.d.ts +5 -0
- package/dist/utils/exif-orientation.d.ts.map +1 -0
- package/dist/utils/exif-orientation.js +157 -0
- package/dist/utils/exif-orientation.js.map +1 -0
- package/dist/utils/flush-stdout.d.ts +8 -0
- package/dist/utils/flush-stdout.d.ts.map +1 -0
- package/dist/utils/flush-stdout.js +23 -0
- package/dist/utils/flush-stdout.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +8 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +27 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/fs-watch.d.ts +5 -0
- package/dist/utils/fs-watch.d.ts.map +1 -0
- package/dist/utils/fs-watch.js +25 -0
- package/dist/utils/fs-watch.js.map +1 -0
- package/dist/utils/git.d.ts +26 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +195 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/html.d.ts +7 -0
- package/dist/utils/html.d.ts.map +1 -0
- package/dist/utils/html.js +40 -0
- package/dist/utils/html.js.map +1 -0
- package/dist/utils/image-convert.d.ts +22 -0
- package/dist/utils/image-convert.d.ts.map +1 -0
- package/dist/utils/image-convert.js +84 -0
- package/dist/utils/image-convert.js.map +1 -0
- package/dist/utils/image-process.d.ts +18 -0
- package/dist/utils/image-process.d.ts.map +1 -0
- package/dist/utils/image-process.js +83 -0
- package/dist/utils/image-process.js.map +1 -0
- package/dist/utils/image-resize-core.d.ts +42 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -0
- package/dist/utils/image-resize-core.js +131 -0
- package/dist/utils/image-resize-core.js.map +1 -0
- package/dist/utils/image-resize-worker.d.ts +2 -0
- package/dist/utils/image-resize-worker.d.ts.map +1 -0
- package/dist/utils/image-resize-worker.js +32 -0
- package/dist/utils/image-resize-worker.js.map +1 -0
- package/dist/utils/image-resize.d.ts +16 -0
- package/dist/utils/image-resize.d.ts.map +1 -0
- package/dist/utils/image-resize.js +98 -0
- package/dist/utils/image-resize.js.map +1 -0
- package/dist/utils/json.d.ts +3 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +7 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/management-http.d.ts +25 -0
- package/dist/utils/management-http.d.ts.map +1 -0
- package/dist/utils/management-http.js +54 -0
- package/dist/utils/management-http.js.map +1 -0
- package/dist/utils/mime.d.ts +3 -0
- package/dist/utils/mime.d.ts.map +1 -0
- package/dist/utils/mime.js +110 -0
- package/dist/utils/mime.js.map +1 -0
- package/dist/utils/open-browser.d.ts +9 -0
- package/dist/utils/open-browser.d.ts.map +1 -0
- package/dist/utils/open-browser.js +25 -0
- package/dist/utils/open-browser.js.map +1 -0
- package/dist/utils/output-files.d.ts +15 -0
- package/dist/utils/output-files.d.ts.map +1 -0
- package/dist/utils/output-files.js +30 -0
- package/dist/utils/output-files.js.map +1 -0
- package/dist/utils/paths.d.ts +51 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +156 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/photon.d.ts +21 -0
- package/dist/utils/photon.d.ts.map +1 -0
- package/dist/utils/photon.js +121 -0
- package/dist/utils/photon.js.map +1 -0
- package/dist/utils/shell.d.ts +33 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +254 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/sleep.d.ts +5 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils/sleep.js +17 -0
- package/dist/utils/sleep.js.map +1 -0
- package/dist/utils/syntax-highlight.d.ts +18 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -0
- package/dist/utils/syntax-highlight.js +191 -0
- package/dist/utils/syntax-highlight.js.map +1 -0
- package/dist/utils/terminal-question.d.ts +8 -0
- package/dist/utils/terminal-question.d.ts.map +1 -0
- package/dist/utils/terminal-question.js +24 -0
- package/dist/utils/terminal-question.js.map +1 -0
- package/dist/utils/text.d.ts +8 -0
- package/dist/utils/text.d.ts.map +1 -0
- package/dist/utils/text.js +9 -0
- package/dist/utils/text.js.map +1 -0
- package/dist/utils/tool-result-images.d.ts +21 -0
- package/dist/utils/tool-result-images.d.ts.map +1 -0
- package/dist/utils/tool-result-images.js +48 -0
- package/dist/utils/tool-result-images.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +13 -0
- package/dist/utils/tools-manager.d.ts.map +1 -0
- package/dist/utils/tools-manager.js +339 -0
- package/dist/utils/tools-manager.js.map +1 -0
- package/dist/utils/version-check.d.ts +17 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +75 -0
- package/dist/utils/version-check.js.map +1 -0
- package/dist/utils/web-url.d.ts +12 -0
- package/dist/utils/web-url.d.ts.map +1 -0
- package/dist/utils/web-url.js +20 -0
- package/dist/utils/web-url.js.map +1 -0
- package/dist/utils/windows-self-update.d.ts +3 -0
- package/dist/utils/windows-self-update.d.ts.map +1 -0
- package/dist/utils/windows-self-update.js +77 -0
- package/dist/utils/windows-self-update.js.map +1 -0
- package/dist/utils/wsl.d.ts +3 -0
- package/dist/utils/wsl.d.ts.map +1 -0
- package/dist/utils/wsl.js +15 -0
- package/dist/utils/wsl.js.map +1 -0
- package/dist/utils/zip.d.ts +7 -0
- package/dist/utils/zip.d.ts.map +1 -0
- package/dist/utils/zip.js +60 -0
- package/dist/utils/zip.js.map +1 -0
- package/docs/cli-integration.md +106 -0
- package/docs/cli.md +356 -0
- package/docs/codemode.md +230 -0
- package/docs/compaction.md +463 -0
- package/docs/configuration.md +47 -0
- package/docs/containerization.md +183 -0
- package/docs/custom-provider.md +227 -0
- package/docs/docs.json +220 -0
- package/docs/environment-variables.md +103 -0
- package/docs/extensions.md +3367 -0
- package/docs/how-diffra-works.md +49 -0
- package/docs/images/doom-extension.png +0 -0
- package/docs/images/exy.png +0 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/index.md +39 -0
- package/docs/json.md +226 -0
- package/docs/keybindings.md +195 -0
- package/docs/llama-cpp.md +129 -0
- package/docs/mcp.md +274 -0
- package/docs/message-types.md +279 -0
- package/docs/models-configuration.md +210 -0
- package/docs/models.md +226 -0
- package/docs/nvidia-rtx-llama-cpp.md +96 -0
- package/docs/packages.md +153 -0
- package/docs/prompt-templates.md +59 -0
- package/docs/providers.md +249 -0
- package/docs/quickstart.md +112 -0
- package/docs/rpc-commands.md +860 -0
- package/docs/rpc-extension-ui.md +200 -0
- package/docs/rpc.md +195 -0
- package/docs/sdk.md +147 -0
- package/docs/security.md +99 -0
- package/docs/session-format.md +293 -0
- package/docs/sessions.md +80 -0
- package/docs/settings.md +173 -0
- package/docs/shell-aliases.md +93 -0
- package/docs/skills.md +93 -0
- package/docs/slash-commands.md +61 -0
- package/docs/terminal-setup.md +235 -0
- package/docs/termux.md +117 -0
- package/docs/themes.md +138 -0
- package/docs/tmux.md +61 -0
- package/docs/tui.md +199 -0
- package/docs/usage.md +94 -0
- package/docs/virtual-models.md +114 -0
- package/docs/windows.md +108 -0
- package/examples/README.md +36 -0
- package/examples/extensions/README.md +215 -0
- package/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/examples/extensions/bash-spawn-hook.ts +30 -0
- package/examples/extensions/bookmark.ts +50 -0
- package/examples/extensions/border-status-editor.ts +145 -0
- package/examples/extensions/built-in-tool-renderer.ts +225 -0
- package/examples/extensions/claude-rules.ts +86 -0
- package/examples/extensions/commands.ts +72 -0
- package/examples/extensions/confirm-destructive.ts +59 -0
- package/examples/extensions/custom-compaction.ts +117 -0
- package/examples/extensions/custom-footer.ts +64 -0
- package/examples/extensions/custom-header.ts +73 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +613 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +405 -0
- package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
- package/examples/extensions/debug-provider.ts +90 -0
- package/examples/extensions/dirty-repo-guard.ts +56 -0
- package/examples/extensions/doom-overlay/README.md +46 -0
- package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/examples/extensions/doom-overlay/doom-component.ts +132 -0
- package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/examples/extensions/doom-overlay/index.ts +74 -0
- package/examples/extensions/doom-overlay/wad-finder.ts +55 -0
- package/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/examples/extensions/dynamic-resources/dynamic.json +81 -0
- package/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/examples/extensions/dynamic-resources/index.ts +15 -0
- package/examples/extensions/dynamic-tools.ts +74 -0
- package/examples/extensions/entry-renderer.ts +41 -0
- package/examples/extensions/event-bus.ts +43 -0
- package/examples/extensions/file-trigger.ts +41 -0
- package/examples/extensions/git-checkpoint.ts +53 -0
- package/examples/extensions/git-merge-and-resolve.ts +115 -0
- package/examples/extensions/github-issue-autocomplete.ts +185 -0
- package/examples/extensions/gondolin/index.ts +528 -0
- package/examples/extensions/gondolin/package-lock.json +175 -0
- package/examples/extensions/gondolin/package.json +19 -0
- package/examples/extensions/handoff.ts +190 -0
- package/examples/extensions/hello.ts +26 -0
- package/examples/extensions/hidden-thinking-label.ts +53 -0
- package/examples/extensions/inline-bash.ts +94 -0
- package/examples/extensions/input-transform-streaming.ts +39 -0
- package/examples/extensions/input-transform.ts +43 -0
- package/examples/extensions/interactive-shell.ts +196 -0
- package/examples/extensions/jev-router.ts +113 -0
- package/examples/extensions/mac-system-theme.ts +47 -0
- package/examples/extensions/message-renderer.ts +59 -0
- package/examples/extensions/minimal-mode.ts +353 -0
- package/examples/extensions/modal-editor.ts +85 -0
- package/examples/extensions/model-status.ts +31 -0
- package/examples/extensions/notify.ts +57 -0
- package/examples/extensions/overlay-qa-tests.ts +1450 -0
- package/examples/extensions/overlay-test.ts +153 -0
- package/examples/extensions/permission-gate.ts +34 -0
- package/examples/extensions/pirate.ts +47 -0
- package/examples/extensions/plan-mode/README.md +66 -0
- package/examples/extensions/plan-mode/index.ts +404 -0
- package/examples/extensions/plan-mode/utils.ts +194 -0
- package/examples/extensions/preset.ts +438 -0
- package/examples/extensions/project-trust.ts +64 -0
- package/examples/extensions/prompt-customizer.ts +49 -0
- package/examples/extensions/protected-paths.ts +30 -0
- package/examples/extensions/provider-payload.ts +18 -0
- package/examples/extensions/qna.ts +118 -0
- package/examples/extensions/question.ts +278 -0
- package/examples/extensions/questionnaire.ts +440 -0
- package/examples/extensions/rainbow-editor.ts +88 -0
- package/examples/extensions/reload-runtime.ts +49 -0
- package/examples/extensions/rpc-demo.ts +118 -0
- package/examples/extensions/send-user-message.ts +97 -0
- package/examples/extensions/session-name.ts +27 -0
- package/examples/extensions/shutdown-command.ts +63 -0
- package/examples/extensions/snake.ts +343 -0
- package/examples/extensions/space-invaders.ts +560 -0
- package/examples/extensions/ssh.ts +220 -0
- package/examples/extensions/status-line.ts +32 -0
- package/examples/extensions/structured-output.ts +65 -0
- package/examples/extensions/subagent/README.md +180 -0
- package/examples/extensions/subagent/agents/planner.md +37 -0
- package/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/examples/extensions/subagent/agents/scout.md +50 -0
- package/examples/extensions/subagent/agents/worker.md +24 -0
- package/examples/extensions/subagent/agents.ts +157 -0
- package/examples/extensions/subagent/index.ts +1257 -0
- package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/examples/extensions/subagent/prompts/implement.md +10 -0
- package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/examples/extensions/summarize.ts +199 -0
- package/examples/extensions/system-prompt-header.ts +17 -0
- package/examples/extensions/tic-tac-toe.ts +1008 -0
- package/examples/extensions/timed-confirm.ts +70 -0
- package/examples/extensions/titlebar-spinner.ts +58 -0
- package/examples/extensions/todo.ts +304 -0
- package/examples/extensions/tool-override.ts +144 -0
- package/examples/extensions/tools.ts +148 -0
- package/examples/extensions/trigger-compact.ts +50 -0
- package/examples/extensions/truncated-tool.ts +195 -0
- package/examples/extensions/widget-placement.ts +9 -0
- package/examples/extensions/with-deps/index.ts +32 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +22 -0
- package/examples/extensions/working-indicator.ts +123 -0
- package/examples/extensions/working-message-test.ts +25 -0
- package/examples/rpc-client.ts +35 -0
- package/examples/rpc-extension-ui.ts +661 -0
- package/examples/sdk/01-minimal.ts +26 -0
- package/examples/sdk/02-custom-model.ts +49 -0
- package/examples/sdk/03-custom-prompt.ts +70 -0
- package/examples/sdk/04-skills.ts +55 -0
- package/examples/sdk/05-tools.ts +48 -0
- package/examples/sdk/06-extensions.ts +94 -0
- package/examples/sdk/07-context-files.ts +42 -0
- package/examples/sdk/08-prompt-templates.ts +51 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +34 -0
- package/examples/sdk/10-settings.ts +53 -0
- package/examples/sdk/11-sessions.ts +52 -0
- package/examples/sdk/12-full-control.ts +74 -0
- package/examples/sdk/13-session-runtime.ts +67 -0
- package/examples/sdk/14-codemode-mcp.ts +61 -0
- package/examples/sdk/README.md +141 -0
- package/examples/tsconfig.json +205 -0
- package/package.json +96 -5
- package/schemas/keybindings.schema.json +393 -0
- package/schemas/models.schema.json +1240 -0
- package/schemas/settings.schema.json +800 -0
- package/schemas/theme.schema.json +365 -0
|
@@ -0,0 +1,1257 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subagent Tool - Delegate tasks to specialized agents
|
|
3
|
+
*
|
|
4
|
+
* Spawns a separate `diffra` process for each subagent invocation,
|
|
5
|
+
* giving it an isolated context window.
|
|
6
|
+
*
|
|
7
|
+
* Supports three modes:
|
|
8
|
+
* - Single: { agent: "name", task: "..." }
|
|
9
|
+
* - Parallel: { tasks: [{ agent: "name", task: "..." }, ...] }
|
|
10
|
+
* - Chain: { chain: [{ agent: "name", task: "... {previous} ..." }, ...] }
|
|
11
|
+
*
|
|
12
|
+
* Uses JSON mode to capture structured output from subagents.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { spawn } from "node:child_process";
|
|
16
|
+
import * as fs from "node:fs";
|
|
17
|
+
import * as os from "node:os";
|
|
18
|
+
import * as path from "node:path";
|
|
19
|
+
import type { AgentToolResult, ThinkingLevel } from "@diffra-ai/agent-core";
|
|
20
|
+
import type { Message } from "@diffra-ai/ai";
|
|
21
|
+
import { StringEnum } from "@diffra-ai/ai";
|
|
22
|
+
import {
|
|
23
|
+
CONFIG_DIR_NAME,
|
|
24
|
+
DEFAULT_MAX_BYTES,
|
|
25
|
+
DEFAULT_MAX_LINES,
|
|
26
|
+
type ExtensionAPI,
|
|
27
|
+
formatReadLineRange,
|
|
28
|
+
getAgentDir,
|
|
29
|
+
getMarkdownTheme,
|
|
30
|
+
type JsonAgentSessionEvent,
|
|
31
|
+
truncateHead,
|
|
32
|
+
withFileMutationQueue,
|
|
33
|
+
} from "@diffra-ai/cli";
|
|
34
|
+
import { Container, Markdown, Spacer, Text } from "@diffra-ai/tui";
|
|
35
|
+
import { Type } from "typebox";
|
|
36
|
+
import { type AgentConfig, type AgentScope, discoverAgents } from "./agents.ts";
|
|
37
|
+
|
|
38
|
+
const MAX_PARALLEL_TASKS = 8;
|
|
39
|
+
const MAX_CONCURRENCY = 4;
|
|
40
|
+
const COLLAPSED_ITEM_COUNT = 10;
|
|
41
|
+
const PER_TASK_OUTPUT_CAP = 50 * 1024;
|
|
42
|
+
const TRUNCATION_NOTICE_RESERVE = 256;
|
|
43
|
+
|
|
44
|
+
function formatTokens(count: number): string {
|
|
45
|
+
if (count < 1000) return count.toString();
|
|
46
|
+
if (count < 10000) return `${(count / 1000).toFixed(1)}k`;
|
|
47
|
+
if (count < 1000000) return `${Math.round(count / 1000)}k`;
|
|
48
|
+
return `${(count / 1000000).toFixed(1)}M`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function formatUsageStats(
|
|
52
|
+
usage: {
|
|
53
|
+
input: number;
|
|
54
|
+
output: number;
|
|
55
|
+
cacheRead: number;
|
|
56
|
+
cacheWrite: number;
|
|
57
|
+
cost: number;
|
|
58
|
+
contextTokens?: number;
|
|
59
|
+
turns?: number;
|
|
60
|
+
},
|
|
61
|
+
model?: string,
|
|
62
|
+
): string {
|
|
63
|
+
const parts: string[] = [];
|
|
64
|
+
if (usage.turns) parts.push(`${usage.turns} turn${usage.turns > 1 ? "s" : ""}`);
|
|
65
|
+
if (usage.input) parts.push(`↑${formatTokens(usage.input)}`);
|
|
66
|
+
if (usage.output) parts.push(`↓${formatTokens(usage.output)}`);
|
|
67
|
+
if (usage.cacheRead) parts.push(`R${formatTokens(usage.cacheRead)}`);
|
|
68
|
+
if (usage.cacheWrite) parts.push(`W${formatTokens(usage.cacheWrite)}`);
|
|
69
|
+
if (usage.cost) parts.push(`$${usage.cost.toFixed(4)}`);
|
|
70
|
+
if (usage.contextTokens && usage.contextTokens > 0) {
|
|
71
|
+
parts.push(`ctx:${formatTokens(usage.contextTokens)}`);
|
|
72
|
+
}
|
|
73
|
+
if (model) parts.push(model);
|
|
74
|
+
return parts.join(" ");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function formatToolCall(
|
|
78
|
+
toolName: string,
|
|
79
|
+
args: Record<string, unknown>,
|
|
80
|
+
themeFg: (color: any, text: string) => string,
|
|
81
|
+
): string {
|
|
82
|
+
const shortenPath = (p: string) => {
|
|
83
|
+
const home = os.homedir();
|
|
84
|
+
return p.startsWith(home) ? `~${p.slice(home.length)}` : p;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
switch (toolName) {
|
|
88
|
+
case "bash": {
|
|
89
|
+
const command = (args.command as string) || "...";
|
|
90
|
+
const preview = command.length > 60 ? `${command.slice(0, 60)}...` : command;
|
|
91
|
+
return themeFg("muted", "$ ") + themeFg("toolOutput", preview);
|
|
92
|
+
}
|
|
93
|
+
case "read": {
|
|
94
|
+
const rawPath = (args.file_path || args.path || "...") as string;
|
|
95
|
+
const filePath = shortenPath(rawPath);
|
|
96
|
+
const lineRange = formatReadLineRange(args.offset, args.limit);
|
|
97
|
+
let text = themeFg("accent", filePath);
|
|
98
|
+
if (lineRange) {
|
|
99
|
+
text += themeFg("warning", lineRange);
|
|
100
|
+
}
|
|
101
|
+
return themeFg("muted", "read ") + text;
|
|
102
|
+
}
|
|
103
|
+
case "write": {
|
|
104
|
+
const rawPath = (args.file_path || args.path || "...") as string;
|
|
105
|
+
const filePath = shortenPath(rawPath);
|
|
106
|
+
const content = (args.content || "") as string;
|
|
107
|
+
const lines = content.split("\n").length;
|
|
108
|
+
let text = themeFg("muted", "write ") + themeFg("accent", filePath);
|
|
109
|
+
if (lines > 1) text += themeFg("dim", ` (${lines} lines)`);
|
|
110
|
+
return text;
|
|
111
|
+
}
|
|
112
|
+
case "edit": {
|
|
113
|
+
const rawPath = (args.file_path || args.path || "...") as string;
|
|
114
|
+
return themeFg("muted", "edit ") + themeFg("accent", shortenPath(rawPath));
|
|
115
|
+
}
|
|
116
|
+
case "ls": {
|
|
117
|
+
const rawPath = (args.path || ".") as string;
|
|
118
|
+
return themeFg("muted", "ls ") + themeFg("accent", shortenPath(rawPath));
|
|
119
|
+
}
|
|
120
|
+
case "find": {
|
|
121
|
+
const pattern = (args.pattern || "*") as string;
|
|
122
|
+
const rawPath = (args.path || ".") as string;
|
|
123
|
+
return themeFg("muted", "find ") + themeFg("accent", pattern) + themeFg("dim", ` in ${shortenPath(rawPath)}`);
|
|
124
|
+
}
|
|
125
|
+
case "grep": {
|
|
126
|
+
const pattern = (args.pattern || "") as string;
|
|
127
|
+
const rawPath = (args.path || ".") as string;
|
|
128
|
+
return (
|
|
129
|
+
themeFg("muted", "grep ") +
|
|
130
|
+
themeFg("accent", `/${pattern}/`) +
|
|
131
|
+
themeFg("dim", ` in ${shortenPath(rawPath)}`)
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
default: {
|
|
135
|
+
const argsStr = JSON.stringify(args);
|
|
136
|
+
const preview = argsStr.length > 50 ? `${argsStr.slice(0, 50)}...` : argsStr;
|
|
137
|
+
return themeFg("accent", toolName) + themeFg("dim", ` ${preview}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
interface UsageStats {
|
|
143
|
+
input: number;
|
|
144
|
+
output: number;
|
|
145
|
+
cacheRead: number;
|
|
146
|
+
cacheWrite: number;
|
|
147
|
+
cost: number;
|
|
148
|
+
contextTokens: number;
|
|
149
|
+
turns: number;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
type ChildStatus = "pending" | "running" | "completed" | "failed" | "aborted";
|
|
153
|
+
|
|
154
|
+
interface SingleResult {
|
|
155
|
+
agent: string;
|
|
156
|
+
agentSource: "user" | "project" | "unknown";
|
|
157
|
+
task: string;
|
|
158
|
+
status: ChildStatus;
|
|
159
|
+
exitCode: number | null;
|
|
160
|
+
messages: Message[];
|
|
161
|
+
stderr: string;
|
|
162
|
+
usage: UsageStats;
|
|
163
|
+
model?: string;
|
|
164
|
+
stopReason?: string;
|
|
165
|
+
errorMessage?: string;
|
|
166
|
+
terminationSignal?: NodeJS.Signals;
|
|
167
|
+
step?: number;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
interface SubagentDetails {
|
|
171
|
+
mode: "single" | "parallel" | "chain";
|
|
172
|
+
results: SingleResult[];
|
|
173
|
+
isError: boolean;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function getFinalOutput(messages: Message[]): string {
|
|
177
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
178
|
+
const msg = messages[i];
|
|
179
|
+
if (msg.role === "assistant") {
|
|
180
|
+
for (const part of msg.content) {
|
|
181
|
+
if (part.type === "text") return part.text;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return "";
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function isFailedResult(result: SingleResult): boolean {
|
|
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
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function getResultOutput(result: SingleResult): string {
|
|
220
|
+
return isFailedResult(result) ? getFailureEvidence(result) : getFinalOutput(result.messages) || "(no output)";
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function truncateParallelOutput(output: string): string {
|
|
224
|
+
const byteLength = Buffer.byteLength(output, "utf8");
|
|
225
|
+
if (byteLength <= PER_TASK_OUTPUT_CAP) return output;
|
|
226
|
+
|
|
227
|
+
let truncated = output.slice(0, PER_TASK_OUTPUT_CAP);
|
|
228
|
+
while (Buffer.byteLength(truncated, "utf8") > PER_TASK_OUTPUT_CAP) {
|
|
229
|
+
truncated = truncated.slice(0, -1);
|
|
230
|
+
}
|
|
231
|
+
return `${truncated}\n\n[Output truncated: ${byteLength - Buffer.byteLength(truncated, "utf8")} bytes omitted. Full output preserved in tool details.]`;
|
|
232
|
+
}
|
|
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
|
+
|
|
247
|
+
type DisplayItem = { type: "text"; text: string } | { type: "toolCall"; name: string; args: Record<string, any> };
|
|
248
|
+
|
|
249
|
+
function getDisplayItems(messages: Message[]): DisplayItem[] {
|
|
250
|
+
const items: DisplayItem[] = [];
|
|
251
|
+
for (const msg of messages) {
|
|
252
|
+
if (msg.role === "assistant") {
|
|
253
|
+
for (const part of msg.content) {
|
|
254
|
+
if (part.type === "text") items.push({ type: "text", text: part.text });
|
|
255
|
+
else if (part.type === "toolCall") items.push({ type: "toolCall", name: part.name, args: part.arguments });
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return items;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
async function mapWithConcurrencyLimit<TIn, TOut>(
|
|
263
|
+
items: TIn[],
|
|
264
|
+
concurrency: number,
|
|
265
|
+
fn: (item: TIn, index: number) => Promise<TOut>,
|
|
266
|
+
): Promise<TOut[]> {
|
|
267
|
+
if (items.length === 0) return [];
|
|
268
|
+
const limit = Math.max(1, Math.min(concurrency, items.length));
|
|
269
|
+
const results: TOut[] = new Array(items.length);
|
|
270
|
+
let nextIndex = 0;
|
|
271
|
+
const workers = new Array(limit).fill(null).map(async () => {
|
|
272
|
+
while (true) {
|
|
273
|
+
const current = nextIndex++;
|
|
274
|
+
if (current >= items.length) return;
|
|
275
|
+
results[current] = await fn(items[current], current);
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
await Promise.all(workers);
|
|
279
|
+
return results;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
async function writePromptToTempFile(agentName: string, prompt: string): Promise<{ dir: string; filePath: string }> {
|
|
283
|
+
const tmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "diffra-subagent-"));
|
|
284
|
+
const safeName = agentName.replace(/[^\w.-]+/g, "_");
|
|
285
|
+
const filePath = path.join(tmpDir, `prompt-${safeName}.md`);
|
|
286
|
+
await withFileMutationQueue(filePath, async () => {
|
|
287
|
+
await fs.promises.writeFile(filePath, prompt, { encoding: "utf-8", mode: 0o600 });
|
|
288
|
+
});
|
|
289
|
+
return { dir: tmpDir, filePath };
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function getDiffraInvocation(args: string[]): { command: string; args: string[] } {
|
|
293
|
+
const currentScript = process.argv[1];
|
|
294
|
+
// Bun-compiled binaries report their embedded entry as argv[1]: "/$bunfs/root/..." on
|
|
295
|
+
// POSIX and "B:/~BUN/root/..." on Windows. fs.existsSync() resolves these inside Bun.
|
|
296
|
+
const isBunVirtualScript =
|
|
297
|
+
currentScript !== undefined &&
|
|
298
|
+
(currentScript.startsWith("/$bunfs/root/") || /^[A-Za-z]:[\\/]~BUN[\\/]root[\\/]/.test(currentScript));
|
|
299
|
+
if (currentScript && !isBunVirtualScript && fs.existsSync(currentScript)) {
|
|
300
|
+
return { command: process.execPath, args: [currentScript, ...args] };
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
const execName = path.basename(process.execPath).toLowerCase();
|
|
304
|
+
const isGenericRuntime = /^(node|bun)(\.exe)?$/.test(execName);
|
|
305
|
+
if (!isGenericRuntime) {
|
|
306
|
+
return { command: process.execPath, args };
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return { command: "diffra", args };
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
type OnUpdateCallback = (partial: AgentToolResult<SubagentDetails>) => void;
|
|
313
|
+
|
|
314
|
+
interface DispatchDefaults {
|
|
315
|
+
model?: string;
|
|
316
|
+
thinkingLevel?: ThinkingLevel;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
interface ProcessOutcome {
|
|
320
|
+
code: number | null;
|
|
321
|
+
signal: NodeJS.Signals | null;
|
|
322
|
+
spawnError?: Error;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
interface ResolvedAgent {
|
|
326
|
+
agent?: AgentConfig;
|
|
327
|
+
available: AgentConfig[];
|
|
328
|
+
cwd: string;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
function resolveAgent(defaultCwd: string, scope: AgentScope, name: string, cwd?: string): ResolvedAgent {
|
|
332
|
+
const effectiveCwd = path.resolve(defaultCwd, cwd ?? ".");
|
|
333
|
+
const discovery = discoverAgents(effectiveCwd, scope);
|
|
334
|
+
return {
|
|
335
|
+
agent: discovery.agents.find((candidate) => candidate.name === name),
|
|
336
|
+
available: discovery.agents,
|
|
337
|
+
cwd: effectiveCwd,
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function createUnstartedResult(
|
|
342
|
+
agent: string,
|
|
343
|
+
task: string,
|
|
344
|
+
step: number | undefined,
|
|
345
|
+
status: "aborted" | "failed",
|
|
346
|
+
errorMessage?: string,
|
|
347
|
+
): SingleResult {
|
|
348
|
+
return {
|
|
349
|
+
agent,
|
|
350
|
+
agentSource: "unknown",
|
|
351
|
+
task,
|
|
352
|
+
status,
|
|
353
|
+
exitCode: null,
|
|
354
|
+
messages: [],
|
|
355
|
+
stderr: "",
|
|
356
|
+
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, contextTokens: 0, turns: 0 },
|
|
357
|
+
errorMessage,
|
|
358
|
+
step,
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
async function runSingleAgent(
|
|
363
|
+
dispatchDefaults: DispatchDefaults,
|
|
364
|
+
resolvedAgent: ResolvedAgent,
|
|
365
|
+
agentName: string,
|
|
366
|
+
task: string,
|
|
367
|
+
step: number | undefined,
|
|
368
|
+
signal: AbortSignal | undefined,
|
|
369
|
+
onUpdate: OnUpdateCallback | undefined,
|
|
370
|
+
makeDetails: (results: SingleResult[]) => SubagentDetails,
|
|
371
|
+
): Promise<SingleResult> {
|
|
372
|
+
if (signal?.aborted) {
|
|
373
|
+
return createUnstartedResult(agentName, task, step, "aborted", "Subagent was aborted before starting");
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const effectiveCwd = resolvedAgent.cwd;
|
|
377
|
+
const agent = resolvedAgent.agent;
|
|
378
|
+
if (!agent) {
|
|
379
|
+
const available = resolvedAgent.available.map((candidate) => `"${candidate.name}"`).join(", ") || "none";
|
|
380
|
+
return createUnstartedResult(
|
|
381
|
+
agentName,
|
|
382
|
+
task,
|
|
383
|
+
step,
|
|
384
|
+
"failed",
|
|
385
|
+
`Unknown agent: "${agentName}". Available agents: ${available}.`,
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const args: string[] = ["--mode", "json", "-p", "--no-session"];
|
|
390
|
+
const inheritsDispatchConfig = !agent.model;
|
|
391
|
+
const model = agent.model ?? dispatchDefaults.model;
|
|
392
|
+
if (model) args.push("--model", model);
|
|
393
|
+
if (inheritsDispatchConfig && dispatchDefaults.thinkingLevel) {
|
|
394
|
+
args.push("--thinking", dispatchDefaults.thinkingLevel);
|
|
395
|
+
}
|
|
396
|
+
if (agent.tools && agent.tools.length > 0) args.push("--tools", agent.tools.join(","));
|
|
397
|
+
|
|
398
|
+
let tmpPromptDir: string | null = null;
|
|
399
|
+
let tmpPromptPath: string | null = null;
|
|
400
|
+
const currentResult: SingleResult = {
|
|
401
|
+
agent: agentName,
|
|
402
|
+
agentSource: agent.source,
|
|
403
|
+
task,
|
|
404
|
+
status: "running",
|
|
405
|
+
exitCode: null,
|
|
406
|
+
messages: [],
|
|
407
|
+
stderr: "",
|
|
408
|
+
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, contextTokens: 0, turns: 0 },
|
|
409
|
+
model,
|
|
410
|
+
step,
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
const emitUpdate = () => {
|
|
414
|
+
onUpdate?.({
|
|
415
|
+
content: [{ type: "text", text: getFinalOutput(currentResult.messages) || "(running...)" }],
|
|
416
|
+
details: makeDetails([currentResult]),
|
|
417
|
+
});
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
try {
|
|
421
|
+
if (agent.systemPrompt.trim()) {
|
|
422
|
+
const tmp = await writePromptToTempFile(agent.name, agent.systemPrompt);
|
|
423
|
+
tmpPromptDir = tmp.dir;
|
|
424
|
+
tmpPromptPath = tmp.filePath;
|
|
425
|
+
args.push("--append-system-prompt", tmpPromptPath);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
if (signal?.aborted) {
|
|
429
|
+
currentResult.status = "aborted";
|
|
430
|
+
currentResult.errorMessage = "Subagent was aborted before starting";
|
|
431
|
+
return currentResult;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
args.push(`Task: ${task}`);
|
|
435
|
+
emitUpdate();
|
|
436
|
+
let wasAborted = false;
|
|
437
|
+
const outcome = await new Promise<ProcessOutcome>((resolve) => {
|
|
438
|
+
const invocation = getDiffraInvocation(args);
|
|
439
|
+
let settled = false;
|
|
440
|
+
let exited = false;
|
|
441
|
+
let closed = false;
|
|
442
|
+
let killTimer: ReturnType<typeof setTimeout> | undefined;
|
|
443
|
+
let buffer = "";
|
|
444
|
+
|
|
445
|
+
const processLine = (line: string) => {
|
|
446
|
+
if (!line.trim()) return;
|
|
447
|
+
let event: JsonAgentSessionEvent;
|
|
448
|
+
try {
|
|
449
|
+
event = JSON.parse(line) as JsonAgentSessionEvent;
|
|
450
|
+
} catch {
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
if (event.type !== "message_end") return;
|
|
454
|
+
const eventMessage = event.message;
|
|
455
|
+
if (
|
|
456
|
+
eventMessage.role !== "user" &&
|
|
457
|
+
eventMessage.role !== "assistant" &&
|
|
458
|
+
eventMessage.role !== "toolResult"
|
|
459
|
+
) {
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
const message = eventMessage as Message;
|
|
463
|
+
currentResult.messages.push(message);
|
|
464
|
+
if (message.role === "assistant") {
|
|
465
|
+
currentResult.usage.turns++;
|
|
466
|
+
currentResult.usage.input += message.usage.input;
|
|
467
|
+
currentResult.usage.output += message.usage.output;
|
|
468
|
+
currentResult.usage.cacheRead += message.usage.cacheRead;
|
|
469
|
+
currentResult.usage.cacheWrite += message.usage.cacheWrite;
|
|
470
|
+
currentResult.usage.cost += message.usage.cost.total;
|
|
471
|
+
currentResult.usage.contextTokens = message.usage.totalTokens;
|
|
472
|
+
if (!currentResult.model) currentResult.model = message.model;
|
|
473
|
+
currentResult.stopReason = message.stopReason;
|
|
474
|
+
currentResult.errorMessage = message.errorMessage;
|
|
475
|
+
}
|
|
476
|
+
emitUpdate();
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
let proc: ReturnType<typeof spawn>;
|
|
480
|
+
const finish = (result: ProcessOutcome) => {
|
|
481
|
+
if (settled) return;
|
|
482
|
+
settled = true;
|
|
483
|
+
closed = true;
|
|
484
|
+
if (killTimer) clearTimeout(killTimer);
|
|
485
|
+
if (signal) signal.removeEventListener("abort", abortProcess);
|
|
486
|
+
resolve(result);
|
|
487
|
+
};
|
|
488
|
+
const abortProcess = () => {
|
|
489
|
+
if (closed || exited || proc.exitCode !== null || proc.signalCode !== null) return;
|
|
490
|
+
if (!proc.kill("SIGTERM")) return;
|
|
491
|
+
wasAborted = true;
|
|
492
|
+
killTimer = setTimeout(() => {
|
|
493
|
+
if (!closed && !exited) proc.kill("SIGKILL");
|
|
494
|
+
}, 5000);
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
try {
|
|
498
|
+
proc = spawn(invocation.command, invocation.args, {
|
|
499
|
+
cwd: effectiveCwd,
|
|
500
|
+
shell: false,
|
|
501
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
502
|
+
});
|
|
503
|
+
} catch (error) {
|
|
504
|
+
finish({
|
|
505
|
+
code: null,
|
|
506
|
+
signal: null,
|
|
507
|
+
spawnError: error instanceof Error ? error : new Error(String(error)),
|
|
508
|
+
});
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
proc.stdout?.on("data", (data) => {
|
|
513
|
+
buffer += data.toString();
|
|
514
|
+
const lines = buffer.split("\n");
|
|
515
|
+
buffer = lines.pop() || "";
|
|
516
|
+
for (const line of lines) processLine(line);
|
|
517
|
+
});
|
|
518
|
+
proc.stderr?.on("data", (data) => {
|
|
519
|
+
currentResult.stderr += data.toString();
|
|
520
|
+
});
|
|
521
|
+
proc.on("exit", () => {
|
|
522
|
+
exited = true;
|
|
523
|
+
});
|
|
524
|
+
proc.on("close", (code, terminationSignal) => {
|
|
525
|
+
if (buffer.trim()) processLine(buffer);
|
|
526
|
+
finish({ code, signal: terminationSignal });
|
|
527
|
+
});
|
|
528
|
+
proc.on("error", (error) => {
|
|
529
|
+
finish({ code: null, signal: null, spawnError: error });
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
if (signal) {
|
|
533
|
+
if (signal.aborted) abortProcess();
|
|
534
|
+
else signal.addEventListener("abort", abortProcess, { once: true });
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
currentResult.exitCode = outcome.code;
|
|
539
|
+
currentResult.terminationSignal = outcome.signal ?? undefined;
|
|
540
|
+
|
|
541
|
+
if (wasAborted) {
|
|
542
|
+
currentResult.status = "aborted";
|
|
543
|
+
currentResult.errorMessage ||= "Subagent was aborted";
|
|
544
|
+
} else if (outcome.spawnError) {
|
|
545
|
+
currentResult.status = "failed";
|
|
546
|
+
currentResult.errorMessage = `Failed to spawn subagent: ${outcome.spawnError.message}`;
|
|
547
|
+
} else if (outcome.signal) {
|
|
548
|
+
currentResult.status = "failed";
|
|
549
|
+
currentResult.errorMessage ||= `Subagent terminated by signal ${outcome.signal}`;
|
|
550
|
+
} else if (outcome.code !== 0) {
|
|
551
|
+
currentResult.status = "failed";
|
|
552
|
+
currentResult.errorMessage ||= `Subagent exited with code ${outcome.code}`;
|
|
553
|
+
} else if (currentResult.stopReason === "aborted") {
|
|
554
|
+
currentResult.status = "aborted";
|
|
555
|
+
} else if (currentResult.stopReason === "error") {
|
|
556
|
+
currentResult.status = "failed";
|
|
557
|
+
} else {
|
|
558
|
+
currentResult.status = "completed";
|
|
559
|
+
}
|
|
560
|
+
return currentResult;
|
|
561
|
+
} finally {
|
|
562
|
+
if (tmpPromptPath) {
|
|
563
|
+
try {
|
|
564
|
+
fs.unlinkSync(tmpPromptPath);
|
|
565
|
+
} catch {
|
|
566
|
+
/* ignore */
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
if (tmpPromptDir) {
|
|
570
|
+
try {
|
|
571
|
+
fs.rmdirSync(tmpPromptDir);
|
|
572
|
+
} catch {
|
|
573
|
+
/* ignore */
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
const TaskItem = Type.Object({
|
|
580
|
+
agent: Type.String({ description: "Name of the agent to invoke" }),
|
|
581
|
+
task: Type.String({ description: "Task to delegate to the agent" }),
|
|
582
|
+
cwd: Type.Optional(Type.String({ description: "Working directory for the agent process" })),
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
const ChainItem = Type.Object({
|
|
586
|
+
agent: Type.String({ description: "Name of the agent to invoke" }),
|
|
587
|
+
task: Type.String({ description: "Task with optional {previous} placeholder for prior output" }),
|
|
588
|
+
cwd: Type.Optional(Type.String({ description: "Working directory for the agent process" })),
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
const AgentScopeSchema = StringEnum(["user", "project", "both"] as const, {
|
|
592
|
+
description: 'Which agent directories to use. Default: "user". Use "both" to include project-local agents.',
|
|
593
|
+
default: "user",
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
const SubagentParams = Type.Object({
|
|
597
|
+
agent: Type.Optional(Type.String({ description: "Name of the agent to invoke (for single mode)" })),
|
|
598
|
+
task: Type.Optional(Type.String({ description: "Task to delegate (for single mode)" })),
|
|
599
|
+
tasks: Type.Optional(Type.Array(TaskItem, { description: "Array of {agent, task} for parallel execution" })),
|
|
600
|
+
chain: Type.Optional(Type.Array(ChainItem, { description: "Array of {agent, task} for sequential execution" })),
|
|
601
|
+
agentScope: Type.Optional(AgentScopeSchema),
|
|
602
|
+
confirmProjectAgents: Type.Optional(
|
|
603
|
+
Type.Boolean({ description: "Prompt before running project-local agents. Default: true.", default: true }),
|
|
604
|
+
),
|
|
605
|
+
cwd: Type.Optional(Type.String({ description: "Working directory for the agent process (single mode)" })),
|
|
606
|
+
});
|
|
607
|
+
|
|
608
|
+
export default function (diffra: ExtensionAPI) {
|
|
609
|
+
// Tool execute results cannot set runtime error state directly, so patch it through the result hook.
|
|
610
|
+
diffra.on("tool_result", (event) => {
|
|
611
|
+
if (event.toolName !== "subagent") return;
|
|
612
|
+
const details = event.details as SubagentDetails | undefined;
|
|
613
|
+
if (details?.isError) return { isError: true };
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
diffra.registerTool({
|
|
617
|
+
name: "subagent",
|
|
618
|
+
label: "Subagent",
|
|
619
|
+
description: [
|
|
620
|
+
"Delegate tasks to specialized subagents with isolated context.",
|
|
621
|
+
"Modes: single (agent + task), parallel (tasks array), chain (sequential with {previous} placeholder).",
|
|
622
|
+
`Default agent scope is "user" (from ${path.join(getAgentDir(), "agents")}).`,
|
|
623
|
+
`To enable project-local agents in ${CONFIG_DIR_NAME}/agents, set agentScope: "both" (or "project").`,
|
|
624
|
+
].join(" "),
|
|
625
|
+
parameters: SubagentParams,
|
|
626
|
+
|
|
627
|
+
async execute(_toolCallId, params, signal, onUpdate, ctx) {
|
|
628
|
+
const agentScope: AgentScope = params.agentScope ?? "user";
|
|
629
|
+
const dispatchDefaults: DispatchDefaults = {
|
|
630
|
+
model: ctx.model ? `${ctx.model.provider}/${ctx.model.id}` : undefined,
|
|
631
|
+
thinkingLevel: ctx.thinkingLevel,
|
|
632
|
+
};
|
|
633
|
+
const discovery = discoverAgents(ctx.cwd, agentScope);
|
|
634
|
+
const agents = discovery.agents;
|
|
635
|
+
const confirmProjectAgents = params.confirmProjectAgents ?? true;
|
|
636
|
+
|
|
637
|
+
const hasChain = (params.chain?.length ?? 0) > 0;
|
|
638
|
+
const hasTasks = (params.tasks?.length ?? 0) > 0;
|
|
639
|
+
const hasSingle = Boolean(params.agent && params.task);
|
|
640
|
+
const modeCount = Number(hasChain) + Number(hasTasks) + Number(hasSingle);
|
|
641
|
+
|
|
642
|
+
const makeDetails =
|
|
643
|
+
(mode: "single" | "parallel" | "chain", forceError = false) =>
|
|
644
|
+
(results: SingleResult[]): SubagentDetails => ({
|
|
645
|
+
mode,
|
|
646
|
+
results,
|
|
647
|
+
isError: forceError || results.some(isFailedResult),
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
if (modeCount !== 1) {
|
|
651
|
+
const available = agents.map((a) => `${a.name} (${a.source})`).join(", ") || "none";
|
|
652
|
+
return {
|
|
653
|
+
content: [
|
|
654
|
+
{
|
|
655
|
+
type: "text",
|
|
656
|
+
text: `Invalid parameters. Provide exactly one mode.\nAvailable agents: ${available}`,
|
|
657
|
+
},
|
|
658
|
+
],
|
|
659
|
+
details: makeDetails("single", true)([]),
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
const resolvedChain = (params.chain ?? []).map((step) =>
|
|
664
|
+
resolveAgent(ctx.cwd, agentScope, step.agent, step.cwd),
|
|
665
|
+
);
|
|
666
|
+
const resolvedTasks = (params.tasks ?? []).map((task) =>
|
|
667
|
+
resolveAgent(ctx.cwd, agentScope, task.agent, task.cwd),
|
|
668
|
+
);
|
|
669
|
+
const resolvedSingle = params.agent ? resolveAgent(ctx.cwd, agentScope, params.agent, params.cwd) : undefined;
|
|
670
|
+
|
|
671
|
+
if ((agentScope === "project" || agentScope === "both") && confirmProjectAgents && ctx.hasUI) {
|
|
672
|
+
let selectedAgents: ResolvedAgent[] = [];
|
|
673
|
+
if (hasChain) selectedAgents = resolvedChain;
|
|
674
|
+
else if (hasTasks) selectedAgents = resolvedTasks;
|
|
675
|
+
else if (resolvedSingle) selectedAgents = [resolvedSingle];
|
|
676
|
+
const projectAgentsByPath = new Map<string, AgentConfig>();
|
|
677
|
+
for (const resolved of selectedAgents) {
|
|
678
|
+
if (resolved.agent?.source === "project") {
|
|
679
|
+
projectAgentsByPath.set(resolved.agent.filePath, resolved.agent);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
const trustedProjectAgentsDir =
|
|
684
|
+
ctx.isProjectTrusted() && discovery.projectAgentsDir
|
|
685
|
+
? fs.realpathSync(discovery.projectAgentsDir)
|
|
686
|
+
: undefined;
|
|
687
|
+
const projectAgentsRequested = Array.from(projectAgentsByPath.values()).filter(
|
|
688
|
+
(agent) =>
|
|
689
|
+
!trustedProjectAgentsDir || fs.realpathSync(path.dirname(agent.filePath)) !== trustedProjectAgentsDir,
|
|
690
|
+
);
|
|
691
|
+
if (projectAgentsRequested.length > 0) {
|
|
692
|
+
const sources = projectAgentsRequested.map((agent) => `- ${agent.name}: ${agent.filePath}`).join("\n");
|
|
693
|
+
const ok = await ctx.ui.confirm(
|
|
694
|
+
"Run project-local agents?",
|
|
695
|
+
`Sources:\n${sources}\n\nProject agents are repo-controlled. Only continue for trusted repositories.`,
|
|
696
|
+
);
|
|
697
|
+
if (!ok) {
|
|
698
|
+
return {
|
|
699
|
+
content: [{ type: "text", text: "Canceled: project-local agents not approved." }],
|
|
700
|
+
details: makeDetails(hasChain ? "chain" : hasTasks ? "parallel" : "single")([]),
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
if (params.chain && params.chain.length > 0) {
|
|
707
|
+
const results: SingleResult[] = [];
|
|
708
|
+
let previousOutput = "";
|
|
709
|
+
|
|
710
|
+
for (let i = 0; i < params.chain.length; i++) {
|
|
711
|
+
const step = params.chain[i];
|
|
712
|
+
const taskWithContext = step.task.replace(/\{previous\}/g, previousOutput);
|
|
713
|
+
|
|
714
|
+
// Create update callback that includes all previous results
|
|
715
|
+
const chainUpdate: OnUpdateCallback | undefined = onUpdate
|
|
716
|
+
? (partial) => {
|
|
717
|
+
// Combine completed results with current streaming result
|
|
718
|
+
const currentResult = partial.details?.results[0];
|
|
719
|
+
if (currentResult) {
|
|
720
|
+
const allResults = [...results, currentResult];
|
|
721
|
+
onUpdate({
|
|
722
|
+
content: partial.content,
|
|
723
|
+
details: makeDetails("chain")(allResults),
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
: undefined;
|
|
728
|
+
|
|
729
|
+
const result = await runSingleAgent(
|
|
730
|
+
dispatchDefaults,
|
|
731
|
+
resolvedChain[i],
|
|
732
|
+
step.agent,
|
|
733
|
+
taskWithContext,
|
|
734
|
+
i + 1,
|
|
735
|
+
signal,
|
|
736
|
+
chainUpdate,
|
|
737
|
+
makeDetails("chain"),
|
|
738
|
+
);
|
|
739
|
+
results.push(result);
|
|
740
|
+
|
|
741
|
+
const isError = isFailedResult(result);
|
|
742
|
+
if (isError) {
|
|
743
|
+
const errorMsg = getResultOutput(result);
|
|
744
|
+
return {
|
|
745
|
+
content: [
|
|
746
|
+
{
|
|
747
|
+
type: "text",
|
|
748
|
+
text: truncateModelOutput(`Chain stopped at step ${i + 1} (${step.agent}): ${errorMsg}`),
|
|
749
|
+
},
|
|
750
|
+
],
|
|
751
|
+
details: makeDetails("chain")(results),
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
previousOutput = getFinalOutput(result.messages);
|
|
755
|
+
}
|
|
756
|
+
return {
|
|
757
|
+
content: [
|
|
758
|
+
{
|
|
759
|
+
type: "text",
|
|
760
|
+
text: truncateModelOutput(getFinalOutput(results[results.length - 1].messages) || "(no output)"),
|
|
761
|
+
},
|
|
762
|
+
],
|
|
763
|
+
details: makeDetails("chain")(results),
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
if (params.tasks && params.tasks.length > 0) {
|
|
768
|
+
if (params.tasks.length > MAX_PARALLEL_TASKS)
|
|
769
|
+
return {
|
|
770
|
+
content: [
|
|
771
|
+
{
|
|
772
|
+
type: "text",
|
|
773
|
+
text: `Too many parallel tasks (${params.tasks.length}). Max is ${MAX_PARALLEL_TASKS}.`,
|
|
774
|
+
},
|
|
775
|
+
],
|
|
776
|
+
details: makeDetails("parallel", true)([]),
|
|
777
|
+
};
|
|
778
|
+
|
|
779
|
+
// Track all results for streaming updates
|
|
780
|
+
const allResults: SingleResult[] = new Array(params.tasks.length);
|
|
781
|
+
|
|
782
|
+
// Initialize placeholder results
|
|
783
|
+
for (let i = 0; i < params.tasks.length; i++) {
|
|
784
|
+
allResults[i] = {
|
|
785
|
+
agent: params.tasks[i].agent,
|
|
786
|
+
agentSource: "unknown",
|
|
787
|
+
task: params.tasks[i].task,
|
|
788
|
+
status: "pending",
|
|
789
|
+
exitCode: null,
|
|
790
|
+
messages: [],
|
|
791
|
+
stderr: "",
|
|
792
|
+
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, contextTokens: 0, turns: 0 },
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
const emitParallelUpdate = () => {
|
|
797
|
+
if (onUpdate) {
|
|
798
|
+
const running = allResults.filter((result) => result.status === "running").length;
|
|
799
|
+
const pending = allResults.filter((result) => result.status === "pending").length;
|
|
800
|
+
const done = allResults.length - running - pending;
|
|
801
|
+
onUpdate({
|
|
802
|
+
content: [
|
|
803
|
+
{
|
|
804
|
+
type: "text",
|
|
805
|
+
text: `Parallel: ${done}/${allResults.length} done, ${running} running, ${pending} pending...`,
|
|
806
|
+
},
|
|
807
|
+
],
|
|
808
|
+
details: makeDetails("parallel")([...allResults]),
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
};
|
|
812
|
+
|
|
813
|
+
const results = await mapWithConcurrencyLimit(params.tasks, MAX_CONCURRENCY, async (t, index) => {
|
|
814
|
+
const result = await runSingleAgent(
|
|
815
|
+
dispatchDefaults,
|
|
816
|
+
resolvedTasks[index],
|
|
817
|
+
t.agent,
|
|
818
|
+
t.task,
|
|
819
|
+
undefined,
|
|
820
|
+
signal,
|
|
821
|
+
// Per-task update callback
|
|
822
|
+
(partial) => {
|
|
823
|
+
if (partial.details?.results[0]) {
|
|
824
|
+
allResults[index] = partial.details.results[0];
|
|
825
|
+
emitParallelUpdate();
|
|
826
|
+
}
|
|
827
|
+
},
|
|
828
|
+
makeDetails("parallel"),
|
|
829
|
+
);
|
|
830
|
+
allResults[index] = result;
|
|
831
|
+
emitParallelUpdate();
|
|
832
|
+
return result;
|
|
833
|
+
});
|
|
834
|
+
|
|
835
|
+
const successCount = results.filter((r) => !isFailedResult(r)).length;
|
|
836
|
+
const summaries = results.map((r) => {
|
|
837
|
+
const output = truncateParallelOutput(getResultOutput(r));
|
|
838
|
+
const status =
|
|
839
|
+
isFailedResult(r) && r.stopReason && r.stopReason !== "end"
|
|
840
|
+
? `${r.status} (${r.stopReason})`
|
|
841
|
+
: r.status;
|
|
842
|
+
return `### [${r.agent}] ${status}\n\n${output}`;
|
|
843
|
+
});
|
|
844
|
+
return {
|
|
845
|
+
content: [
|
|
846
|
+
{
|
|
847
|
+
type: "text",
|
|
848
|
+
text: `Parallel: ${successCount}/${results.length} succeeded\n\n${summaries.join("\n\n---\n\n")}`,
|
|
849
|
+
},
|
|
850
|
+
],
|
|
851
|
+
details: makeDetails("parallel")(results),
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
if (params.agent && params.task && resolvedSingle) {
|
|
856
|
+
const result = await runSingleAgent(
|
|
857
|
+
dispatchDefaults,
|
|
858
|
+
resolvedSingle,
|
|
859
|
+
params.agent,
|
|
860
|
+
params.task,
|
|
861
|
+
undefined,
|
|
862
|
+
signal,
|
|
863
|
+
onUpdate,
|
|
864
|
+
makeDetails("single"),
|
|
865
|
+
);
|
|
866
|
+
const isError = isFailedResult(result);
|
|
867
|
+
if (isError) {
|
|
868
|
+
const errorMsg = getResultOutput(result);
|
|
869
|
+
return {
|
|
870
|
+
content: [
|
|
871
|
+
{
|
|
872
|
+
type: "text",
|
|
873
|
+
text: truncateModelOutput(`Agent ${result.stopReason || result.status}: ${errorMsg}`),
|
|
874
|
+
},
|
|
875
|
+
],
|
|
876
|
+
details: makeDetails("single")([result]),
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
return {
|
|
880
|
+
content: [
|
|
881
|
+
{
|
|
882
|
+
type: "text",
|
|
883
|
+
text: truncateModelOutput(getFinalOutput(result.messages) || "(no output)"),
|
|
884
|
+
},
|
|
885
|
+
],
|
|
886
|
+
details: makeDetails("single")([result]),
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
const available = agents.map((a) => `${a.name} (${a.source})`).join(", ") || "none";
|
|
891
|
+
return {
|
|
892
|
+
content: [{ type: "text", text: `Invalid parameters. Available agents: ${available}` }],
|
|
893
|
+
details: makeDetails("single", true)([]),
|
|
894
|
+
};
|
|
895
|
+
},
|
|
896
|
+
|
|
897
|
+
renderCall(args, theme, _context) {
|
|
898
|
+
const scope: AgentScope = args.agentScope ?? "user";
|
|
899
|
+
if (args.chain && args.chain.length > 0) {
|
|
900
|
+
let text =
|
|
901
|
+
theme.fg("toolTitle", theme.bold("subagent ")) +
|
|
902
|
+
theme.fg("accent", `chain (${args.chain.length} steps)`) +
|
|
903
|
+
theme.fg("muted", ` [${scope}]`);
|
|
904
|
+
for (let i = 0; i < Math.min(args.chain.length, 3); i++) {
|
|
905
|
+
const step = args.chain[i];
|
|
906
|
+
// Clean up {previous} placeholder for display
|
|
907
|
+
const cleanTask = step.task.replace(/\{previous\}/g, "").trim();
|
|
908
|
+
const preview = cleanTask.length > 40 ? `${cleanTask.slice(0, 40)}...` : cleanTask;
|
|
909
|
+
text +=
|
|
910
|
+
"\n " +
|
|
911
|
+
theme.fg("muted", `${i + 1}.`) +
|
|
912
|
+
" " +
|
|
913
|
+
theme.fg("accent", step.agent) +
|
|
914
|
+
theme.fg("dim", ` ${preview}`);
|
|
915
|
+
}
|
|
916
|
+
if (args.chain.length > 3) text += `\n ${theme.fg("muted", `... +${args.chain.length - 3} more`)}`;
|
|
917
|
+
return new Text(text, 0, 0);
|
|
918
|
+
}
|
|
919
|
+
if (args.tasks && args.tasks.length > 0) {
|
|
920
|
+
let text =
|
|
921
|
+
theme.fg("toolTitle", theme.bold("subagent ")) +
|
|
922
|
+
theme.fg("accent", `parallel (${args.tasks.length} tasks)`) +
|
|
923
|
+
theme.fg("muted", ` [${scope}]`);
|
|
924
|
+
for (const t of args.tasks.slice(0, 3)) {
|
|
925
|
+
const preview = t.task.length > 40 ? `${t.task.slice(0, 40)}...` : t.task;
|
|
926
|
+
text += `\n ${theme.fg("accent", t.agent)}${theme.fg("dim", ` ${preview}`)}`;
|
|
927
|
+
}
|
|
928
|
+
if (args.tasks.length > 3) text += `\n ${theme.fg("muted", `... +${args.tasks.length - 3} more`)}`;
|
|
929
|
+
return new Text(text, 0, 0);
|
|
930
|
+
}
|
|
931
|
+
const agentName = args.agent || "...";
|
|
932
|
+
const preview = args.task ? (args.task.length > 60 ? `${args.task.slice(0, 60)}...` : args.task) : "...";
|
|
933
|
+
let text =
|
|
934
|
+
theme.fg("toolTitle", theme.bold("subagent ")) +
|
|
935
|
+
theme.fg("accent", agentName) +
|
|
936
|
+
theme.fg("muted", ` [${scope}]`);
|
|
937
|
+
text += `\n ${theme.fg("dim", preview)}`;
|
|
938
|
+
return new Text(text, 0, 0);
|
|
939
|
+
},
|
|
940
|
+
|
|
941
|
+
renderResult(result, { expanded }, theme, _context) {
|
|
942
|
+
const details = result.details as SubagentDetails | undefined;
|
|
943
|
+
if (!details || details.results.length === 0) {
|
|
944
|
+
const text = result.content[0];
|
|
945
|
+
return new Text(text?.type === "text" ? text.text : "(no output)", 0, 0);
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
const mdTheme = getMarkdownTheme();
|
|
949
|
+
|
|
950
|
+
const renderDisplayItems = (items: DisplayItem[], limit?: number) => {
|
|
951
|
+
const toShow = limit ? items.slice(-limit) : items;
|
|
952
|
+
const skipped = limit && items.length > limit ? items.length - limit : 0;
|
|
953
|
+
let text = "";
|
|
954
|
+
if (skipped > 0) text += theme.fg("muted", `... ${skipped} earlier items\n`);
|
|
955
|
+
for (const item of toShow) {
|
|
956
|
+
if (item.type === "text") {
|
|
957
|
+
const preview = expanded ? item.text : item.text.split("\n").slice(0, 3).join("\n");
|
|
958
|
+
text += `${theme.fg("toolOutput", preview)}\n`;
|
|
959
|
+
} else {
|
|
960
|
+
text += `${theme.fg("muted", "→ ") + formatToolCall(item.name, item.args, theme.fg.bind(theme))}\n`;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
return text.trimEnd();
|
|
964
|
+
};
|
|
965
|
+
|
|
966
|
+
const resultIcon = (child: SingleResult): string => {
|
|
967
|
+
if (child.status === "pending" || child.status === "running") {
|
|
968
|
+
return theme.fg("warning", "⏳");
|
|
969
|
+
}
|
|
970
|
+
if (isFailedResult(child)) return theme.fg("error", "✗");
|
|
971
|
+
return theme.fg("success", "✓");
|
|
972
|
+
};
|
|
973
|
+
|
|
974
|
+
if (details.mode === "single" && details.results.length === 1) {
|
|
975
|
+
const r = details.results[0];
|
|
976
|
+
const isError = isFailedResult(r);
|
|
977
|
+
const isRunning = r.status === "pending" || r.status === "running";
|
|
978
|
+
const icon = resultIcon(r);
|
|
979
|
+
const displayItems = getDisplayItems(r.messages);
|
|
980
|
+
const finalOutput = getFinalOutput(r.messages);
|
|
981
|
+
|
|
982
|
+
if (expanded) {
|
|
983
|
+
const container = new Container();
|
|
984
|
+
let header = `${icon} ${theme.fg("toolTitle", theme.bold(r.agent))}${theme.fg("muted", ` (${r.agentSource})`)}`;
|
|
985
|
+
if (isRunning) header += ` ${theme.fg("warning", `[${r.status}]`)}`;
|
|
986
|
+
else if (isError) header += ` ${theme.fg("error", `[${r.stopReason ?? r.status}]`)}`;
|
|
987
|
+
container.addChild(new Text(header, 0, 0));
|
|
988
|
+
if (isError && r.errorMessage)
|
|
989
|
+
container.addChild(new Text(theme.fg("error", `Error: ${r.errorMessage}`), 0, 0));
|
|
990
|
+
if (r.terminationSignal)
|
|
991
|
+
container.addChild(new Text(theme.fg("error", `Signal: ${r.terminationSignal}`), 0, 0));
|
|
992
|
+
if (r.stderr.trim()) container.addChild(new Text(theme.fg("error", `stderr: ${r.stderr.trim()}`), 0, 0));
|
|
993
|
+
container.addChild(new Spacer(1));
|
|
994
|
+
container.addChild(new Text(theme.fg("muted", "─── Task ───"), 0, 0));
|
|
995
|
+
container.addChild(new Text(theme.fg("dim", r.task), 0, 0));
|
|
996
|
+
container.addChild(new Spacer(1));
|
|
997
|
+
container.addChild(new Text(theme.fg("muted", "─── Output ───"), 0, 0));
|
|
998
|
+
if (displayItems.length === 0 && !finalOutput) {
|
|
999
|
+
container.addChild(new Text(theme.fg("muted", "(no output)"), 0, 0));
|
|
1000
|
+
} else {
|
|
1001
|
+
for (const item of displayItems) {
|
|
1002
|
+
if (item.type === "toolCall")
|
|
1003
|
+
container.addChild(
|
|
1004
|
+
new Text(
|
|
1005
|
+
theme.fg("muted", "→ ") + formatToolCall(item.name, item.args, theme.fg.bind(theme)),
|
|
1006
|
+
0,
|
|
1007
|
+
0,
|
|
1008
|
+
),
|
|
1009
|
+
);
|
|
1010
|
+
}
|
|
1011
|
+
if (finalOutput) {
|
|
1012
|
+
container.addChild(new Spacer(1));
|
|
1013
|
+
container.addChild(new Markdown(finalOutput.trim(), 0, 0, mdTheme));
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
const usageStr = formatUsageStats(r.usage, r.model);
|
|
1017
|
+
if (usageStr) {
|
|
1018
|
+
container.addChild(new Spacer(1));
|
|
1019
|
+
container.addChild(new Text(theme.fg("dim", usageStr), 0, 0));
|
|
1020
|
+
}
|
|
1021
|
+
return container;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
let text = `${icon} ${theme.fg("toolTitle", theme.bold(r.agent))}${theme.fg("muted", ` (${r.agentSource})`)}`;
|
|
1025
|
+
if (isRunning) text += ` ${theme.fg("warning", `[${r.status}]`)}`;
|
|
1026
|
+
else if (isError) text += ` ${theme.fg("error", `[${r.stopReason ?? r.status}]`)}`;
|
|
1027
|
+
if (isError && r.errorMessage) text += `\n${theme.fg("error", `Error: ${r.errorMessage}`)}`;
|
|
1028
|
+
else if (displayItems.length === 0) text += `\n${theme.fg("muted", "(no output)")}`;
|
|
1029
|
+
else {
|
|
1030
|
+
text += `\n${renderDisplayItems(displayItems, COLLAPSED_ITEM_COUNT)}`;
|
|
1031
|
+
if (displayItems.length > COLLAPSED_ITEM_COUNT) text += `\n${theme.fg("muted", "(Ctrl+O to expand)")}`;
|
|
1032
|
+
}
|
|
1033
|
+
const usageStr = formatUsageStats(r.usage, r.model);
|
|
1034
|
+
if (usageStr) text += `\n${theme.fg("dim", usageStr)}`;
|
|
1035
|
+
return new Text(text, 0, 0);
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
const aggregateUsage = (results: SingleResult[]): UsageStats => {
|
|
1039
|
+
const total: UsageStats = {
|
|
1040
|
+
input: 0,
|
|
1041
|
+
output: 0,
|
|
1042
|
+
cacheRead: 0,
|
|
1043
|
+
cacheWrite: 0,
|
|
1044
|
+
cost: 0,
|
|
1045
|
+
contextTokens: 0,
|
|
1046
|
+
turns: 0,
|
|
1047
|
+
};
|
|
1048
|
+
for (const result of results) {
|
|
1049
|
+
total.input += result.usage.input;
|
|
1050
|
+
total.output += result.usage.output;
|
|
1051
|
+
total.cacheRead += result.usage.cacheRead;
|
|
1052
|
+
total.cacheWrite += result.usage.cacheWrite;
|
|
1053
|
+
total.cost += result.usage.cost;
|
|
1054
|
+
total.turns += result.usage.turns;
|
|
1055
|
+
}
|
|
1056
|
+
return total;
|
|
1057
|
+
};
|
|
1058
|
+
|
|
1059
|
+
if (details.mode === "chain") {
|
|
1060
|
+
const successCount = details.results.filter((result) => result.status === "completed").length;
|
|
1061
|
+
const hasActive = details.results.some(
|
|
1062
|
+
(result) => result.status === "pending" || result.status === "running",
|
|
1063
|
+
);
|
|
1064
|
+
let icon = theme.fg("error", "✗");
|
|
1065
|
+
if (hasActive) icon = theme.fg("warning", "⏳");
|
|
1066
|
+
else if (successCount === details.results.length) icon = theme.fg("success", "✓");
|
|
1067
|
+
|
|
1068
|
+
if (expanded) {
|
|
1069
|
+
const container = new Container();
|
|
1070
|
+
container.addChild(
|
|
1071
|
+
new Text(
|
|
1072
|
+
icon +
|
|
1073
|
+
" " +
|
|
1074
|
+
theme.fg("toolTitle", theme.bold("chain ")) +
|
|
1075
|
+
theme.fg("accent", `${successCount}/${details.results.length} steps`),
|
|
1076
|
+
0,
|
|
1077
|
+
0,
|
|
1078
|
+
),
|
|
1079
|
+
);
|
|
1080
|
+
|
|
1081
|
+
for (const r of details.results) {
|
|
1082
|
+
const rIcon = resultIcon(r);
|
|
1083
|
+
const displayItems = getDisplayItems(r.messages);
|
|
1084
|
+
const finalOutput = getFinalOutput(r.messages);
|
|
1085
|
+
|
|
1086
|
+
container.addChild(new Spacer(1));
|
|
1087
|
+
container.addChild(
|
|
1088
|
+
new Text(
|
|
1089
|
+
`${theme.fg("muted", `─── Step ${r.step}: `) + theme.fg("accent", r.agent)} ${rIcon}`,
|
|
1090
|
+
0,
|
|
1091
|
+
0,
|
|
1092
|
+
),
|
|
1093
|
+
);
|
|
1094
|
+
container.addChild(new Text(theme.fg("muted", "Task: ") + theme.fg("dim", r.task), 0, 0));
|
|
1095
|
+
if (isFailedResult(r) && r.errorMessage)
|
|
1096
|
+
container.addChild(new Text(theme.fg("error", `Error: ${r.errorMessage}`), 0, 0));
|
|
1097
|
+
if (r.terminationSignal)
|
|
1098
|
+
container.addChild(new Text(theme.fg("error", `Signal: ${r.terminationSignal}`), 0, 0));
|
|
1099
|
+
if (r.stderr.trim())
|
|
1100
|
+
container.addChild(new Text(theme.fg("error", `stderr: ${r.stderr.trim()}`), 0, 0));
|
|
1101
|
+
|
|
1102
|
+
// Show tool calls
|
|
1103
|
+
for (const item of displayItems) {
|
|
1104
|
+
if (item.type === "toolCall") {
|
|
1105
|
+
container.addChild(
|
|
1106
|
+
new Text(
|
|
1107
|
+
theme.fg("muted", "→ ") + formatToolCall(item.name, item.args, theme.fg.bind(theme)),
|
|
1108
|
+
0,
|
|
1109
|
+
0,
|
|
1110
|
+
),
|
|
1111
|
+
);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
// Show final output as markdown
|
|
1116
|
+
if (finalOutput) {
|
|
1117
|
+
container.addChild(new Spacer(1));
|
|
1118
|
+
container.addChild(new Markdown(finalOutput.trim(), 0, 0, mdTheme));
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
const stepUsage = formatUsageStats(r.usage, r.model);
|
|
1122
|
+
if (stepUsage) container.addChild(new Text(theme.fg("dim", stepUsage), 0, 0));
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
const usageStr = formatUsageStats(aggregateUsage(details.results));
|
|
1126
|
+
if (usageStr) {
|
|
1127
|
+
container.addChild(new Spacer(1));
|
|
1128
|
+
container.addChild(new Text(theme.fg("dim", `Total: ${usageStr}`), 0, 0));
|
|
1129
|
+
}
|
|
1130
|
+
return container;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
// Collapsed view
|
|
1134
|
+
let text =
|
|
1135
|
+
icon +
|
|
1136
|
+
" " +
|
|
1137
|
+
theme.fg("toolTitle", theme.bold("chain ")) +
|
|
1138
|
+
theme.fg("accent", `${successCount}/${details.results.length} steps`);
|
|
1139
|
+
for (const r of details.results) {
|
|
1140
|
+
const rIcon = resultIcon(r);
|
|
1141
|
+
const displayItems = getDisplayItems(r.messages);
|
|
1142
|
+
text += `\n\n${theme.fg("muted", `─── Step ${r.step}: `)}${theme.fg("accent", r.agent)} ${rIcon}`;
|
|
1143
|
+
if (displayItems.length === 0) {
|
|
1144
|
+
const failed = isFailedResult(r);
|
|
1145
|
+
const summary = failed ? getFailureSummary(r) : "(no output)";
|
|
1146
|
+
text += `\n${theme.fg(failed ? "error" : "muted", summary)}`;
|
|
1147
|
+
} else {
|
|
1148
|
+
text += `\n${renderDisplayItems(displayItems, 5)}`;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
const usageStr = formatUsageStats(aggregateUsage(details.results));
|
|
1152
|
+
if (usageStr) text += `\n\n${theme.fg("dim", `Total: ${usageStr}`)}`;
|
|
1153
|
+
text += `\n${theme.fg("muted", "(Ctrl+O to expand)")}`;
|
|
1154
|
+
return new Text(text, 0, 0);
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
if (details.mode === "parallel") {
|
|
1158
|
+
const running = details.results.filter((result) => result.status === "running").length;
|
|
1159
|
+
const pending = details.results.filter((result) => result.status === "pending").length;
|
|
1160
|
+
const successCount = details.results.filter((result) => result.status === "completed").length;
|
|
1161
|
+
const failCount = details.results.filter(isFailedResult).length;
|
|
1162
|
+
const isRunning = running > 0 || pending > 0;
|
|
1163
|
+
let icon = theme.fg("success", "✓");
|
|
1164
|
+
if (isRunning) icon = theme.fg("warning", "⏳");
|
|
1165
|
+
else if (failCount > 0) icon = theme.fg("warning", "◐");
|
|
1166
|
+
const status = isRunning
|
|
1167
|
+
? `${successCount + failCount}/${details.results.length} done, ${running} running, ${pending} pending`
|
|
1168
|
+
: `${successCount}/${details.results.length} tasks`;
|
|
1169
|
+
|
|
1170
|
+
if (expanded && !isRunning) {
|
|
1171
|
+
const container = new Container();
|
|
1172
|
+
container.addChild(
|
|
1173
|
+
new Text(
|
|
1174
|
+
`${icon} ${theme.fg("toolTitle", theme.bold("parallel "))}${theme.fg("accent", status)}`,
|
|
1175
|
+
0,
|
|
1176
|
+
0,
|
|
1177
|
+
),
|
|
1178
|
+
);
|
|
1179
|
+
|
|
1180
|
+
for (const r of details.results) {
|
|
1181
|
+
const rIcon = resultIcon(r);
|
|
1182
|
+
const displayItems = getDisplayItems(r.messages);
|
|
1183
|
+
const finalOutput = getFinalOutput(r.messages);
|
|
1184
|
+
|
|
1185
|
+
container.addChild(new Spacer(1));
|
|
1186
|
+
container.addChild(
|
|
1187
|
+
new Text(`${theme.fg("muted", "─── ") + theme.fg("accent", r.agent)} ${rIcon}`, 0, 0),
|
|
1188
|
+
);
|
|
1189
|
+
container.addChild(new Text(theme.fg("muted", "Task: ") + theme.fg("dim", r.task), 0, 0));
|
|
1190
|
+
if (isFailedResult(r) && r.errorMessage)
|
|
1191
|
+
container.addChild(new Text(theme.fg("error", `Error: ${r.errorMessage}`), 0, 0));
|
|
1192
|
+
if (r.terminationSignal)
|
|
1193
|
+
container.addChild(new Text(theme.fg("error", `Signal: ${r.terminationSignal}`), 0, 0));
|
|
1194
|
+
if (r.stderr.trim())
|
|
1195
|
+
container.addChild(new Text(theme.fg("error", `stderr: ${r.stderr.trim()}`), 0, 0));
|
|
1196
|
+
|
|
1197
|
+
// Show tool calls
|
|
1198
|
+
for (const item of displayItems) {
|
|
1199
|
+
if (item.type === "toolCall") {
|
|
1200
|
+
container.addChild(
|
|
1201
|
+
new Text(
|
|
1202
|
+
theme.fg("muted", "→ ") + formatToolCall(item.name, item.args, theme.fg.bind(theme)),
|
|
1203
|
+
0,
|
|
1204
|
+
0,
|
|
1205
|
+
),
|
|
1206
|
+
);
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
// Show final output as markdown
|
|
1211
|
+
if (finalOutput) {
|
|
1212
|
+
container.addChild(new Spacer(1));
|
|
1213
|
+
container.addChild(new Markdown(finalOutput.trim(), 0, 0, mdTheme));
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
const taskUsage = formatUsageStats(r.usage, r.model);
|
|
1217
|
+
if (taskUsage) container.addChild(new Text(theme.fg("dim", taskUsage), 0, 0));
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
const usageStr = formatUsageStats(aggregateUsage(details.results));
|
|
1221
|
+
if (usageStr) {
|
|
1222
|
+
container.addChild(new Spacer(1));
|
|
1223
|
+
container.addChild(new Text(theme.fg("dim", `Total: ${usageStr}`), 0, 0));
|
|
1224
|
+
}
|
|
1225
|
+
return container;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
// Collapsed view (or still running)
|
|
1229
|
+
let text = `${icon} ${theme.fg("toolTitle", theme.bold("parallel "))}${theme.fg("accent", status)}`;
|
|
1230
|
+
for (const r of details.results) {
|
|
1231
|
+
const rIcon = resultIcon(r);
|
|
1232
|
+
const displayItems = getDisplayItems(r.messages);
|
|
1233
|
+
text += `\n\n${theme.fg("muted", "─── ")}${theme.fg("accent", r.agent)} ${rIcon}`;
|
|
1234
|
+
if (displayItems.length === 0) {
|
|
1235
|
+
const failed = isFailedResult(r);
|
|
1236
|
+
let summary = "(no output)";
|
|
1237
|
+
if (r.status === "pending") summary = "(pending...)";
|
|
1238
|
+
else if (r.status === "running") summary = "(running...)";
|
|
1239
|
+
else if (failed) summary = getFailureSummary(r);
|
|
1240
|
+
text += `\n${theme.fg(failed ? "error" : "muted", summary)}`;
|
|
1241
|
+
} else {
|
|
1242
|
+
text += `\n${renderDisplayItems(displayItems, 5)}`;
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
if (!isRunning) {
|
|
1246
|
+
const usageStr = formatUsageStats(aggregateUsage(details.results));
|
|
1247
|
+
if (usageStr) text += `\n\n${theme.fg("dim", `Total: ${usageStr}`)}`;
|
|
1248
|
+
}
|
|
1249
|
+
if (!expanded) text += `\n${theme.fg("muted", "(Ctrl+O to expand)")}`;
|
|
1250
|
+
return new Text(text, 0, 0);
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
const text = result.content[0];
|
|
1254
|
+
return new Text(text?.type === "text" ? text.text : "(no output)", 0, 0);
|
|
1255
|
+
},
|
|
1256
|
+
});
|
|
1257
|
+
}
|