@humain/humain-code 0.5.4 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +170 -0
- package/dist/bundle/agent-monitor.js +1 -1
- package/dist/bundle/chunks/anthropic-messages-FGFIMZUF.js +66 -0
- package/dist/bundle/chunks/azure-openai-responses-6JNTC7KO.js +15 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +261 -237
- package/dist/bundle/chunks/chunk-2H3LUS62.js +1966 -0
- package/dist/bundle/chunks/{chunk-GEISZXXH.js → chunk-4ZBGTJJM.js} +1 -1
- package/dist/bundle/chunks/{chunk-QWXPGBAG.js → chunk-5JSLXC2A.js} +1 -1
- package/dist/bundle/chunks/{chunk-L2VKM23Q.js → chunk-6DE7LJKV.js} +21 -21
- package/dist/bundle/chunks/{chunk-V62QBESW.js → chunk-6E6RHNOU.js} +11 -10
- package/dist/bundle/chunks/chunk-7RZ5BS7U.js +2 -0
- package/dist/bundle/chunks/chunk-AHSNQWZU.js +24 -0
- package/dist/bundle/chunks/{chunk-UJLCKIMZ.js → chunk-AOH2O5CP.js} +3469 -3133
- package/dist/bundle/chunks/{chunk-ODJUBJK2.js → chunk-B7NJMF7B.js} +11 -11
- package/dist/bundle/chunks/chunk-BQ3TMEWD.js +7 -0
- package/dist/bundle/chunks/{chunk-KKCMWB63.js → chunk-C6VERWRZ.js} +1 -1
- package/dist/bundle/chunks/{chunk-CN3Q5UNB.js → chunk-CFHOPLW5.js} +658 -574
- package/dist/bundle/chunks/chunk-CVC2GV26.js +1986 -0
- package/dist/bundle/chunks/{chunk-DU6POZ7E.js → chunk-DHW3REC5.js} +1 -1
- package/dist/bundle/chunks/{chunk-UTNHGOFS.js → chunk-EDONIPUJ.js} +38 -38
- package/dist/bundle/chunks/{chunk-FO2NYB6O.js → chunk-FDGW5ZTG.js} +1147 -1110
- package/dist/bundle/chunks/{chunk-XQX7S3GM.js → chunk-GICL5V54.js} +1 -1
- package/dist/bundle/chunks/chunk-H7Y4QY7K.js +11 -0
- package/dist/bundle/chunks/chunk-HW6HMUXS.js +188 -0
- package/dist/bundle/chunks/chunk-I6AQOITY.js +53 -0
- package/dist/bundle/chunks/{chunk-ZI7TK7HM.js → chunk-IADQJFNH.js} +21 -17
- package/dist/bundle/chunks/chunk-J7AP2BUJ.js +3 -0
- package/dist/bundle/chunks/chunk-JFE52VSN.js +120 -0
- package/dist/bundle/chunks/{chunk-MIJHJNNQ.js → chunk-LDGCU6PD.js} +127 -3
- package/dist/bundle/chunks/{chunk-PS7DGA7B.js → chunk-M4CHQBAI.js} +1 -1
- package/dist/bundle/chunks/{chunk-YDBNMIA3.js → chunk-NN53K2QQ.js} +19 -1
- package/dist/bundle/chunks/{chunk-RTXDU3AA.js → chunk-ONR6Q3II.js} +255 -195
- package/dist/bundle/chunks/{chunk-Y3OPKKDR.js → chunk-P4P7OZ7R.js} +34 -32
- package/dist/bundle/chunks/{chunk-OZNC2W4B.js → chunk-PCTLFSQG.js} +444 -411
- package/dist/bundle/chunks/{chunk-YFBDR4IW.js → chunk-PNGNZXOI.js} +3 -3
- package/dist/bundle/chunks/{chunk-UDB6NI4G.js → chunk-RGUZULEE.js} +593 -481
- package/dist/bundle/chunks/chunk-RO5YPAJH.js +23 -0
- package/dist/bundle/chunks/{chunk-A6B2QMA7.js → chunk-RU7ADKA7.js} +176 -162
- package/dist/bundle/chunks/{chunk-JCXXRCP6.js → chunk-T3KDZFM4.js} +16 -16
- package/dist/bundle/chunks/{chunk-HT5YN3LX.js → chunk-TEOMXMW6.js} +3 -3
- package/dist/bundle/chunks/{chunk-HIZWUSPN.js → chunk-VEGJT52D.js} +77 -77
- package/dist/bundle/chunks/{chunk-IDU5BNNI.js → chunk-XMZGB3H4.js} +12 -3
- package/dist/bundle/chunks/chunk-YEPHPMQC.js +647 -0
- package/dist/bundle/chunks/{chunk-XA7CJAYH.js → chunk-YRUIJ5AH.js} +48 -42
- package/dist/bundle/chunks/{cli-ENEFJH2B.js → cli-BNCWK54K.js} +21 -17
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-T7TPP7SQ.js → cloudflare-workers-ai-system-one-KI6W3USX.js} +1 -1
- package/dist/bundle/chunks/codemode-worker.js +81 -75
- package/dist/bundle/chunks/compat-I5VPOXFT.js +13 -0
- package/dist/bundle/chunks/dist-J5IUPLMH.js +37 -0
- package/dist/bundle/chunks/{dist-RKNCFFGM.js → dist-SKBR3C7C.js} +720 -696
- package/dist/bundle/chunks/dist-TVRQXUY6.js +8 -0
- package/dist/bundle/chunks/{dist-cjs-HTASUQXQ.js → dist-cjs-2SKN226B.js} +77 -77
- package/dist/bundle/chunks/{easter-egg-3d-YOPLCOVW.js → easter-egg-3d-673VRP6Y.js} +1 -1
- package/dist/bundle/chunks/{esm-R6HJ4QEG.js → esm-WPALMLUO.js} +3 -3
- package/dist/bundle/chunks/{event-streams-BR2IL6C5.js → event-streams-7YGFEPBZ.js} +1 -1
- package/dist/bundle/chunks/{execute-2JXEKQ2X.js → execute-PIUR5MUV.js} +23 -23
- package/dist/bundle/chunks/{extract-OTCGZGTL.js → extract-4O5Z5725.js} +74 -71
- package/dist/bundle/chunks/github-copilot.js +50 -51
- package/dist/bundle/chunks/google-generative-ai-635YZEHN.js +22 -0
- package/dist/bundle/chunks/google-vertex-I3ZJ3SB2.js +26 -0
- package/dist/bundle/chunks/host-OQOEIWHK.js +2 -0
- package/dist/bundle/chunks/image-resize-worker.js +3 -2
- package/dist/bundle/chunks/kimi-coding.js +13 -14
- package/dist/bundle/chunks/{llama-cpp-classify-B3G57LVR.js → llama-cpp-classify-PP63BYDF.js} +1 -1
- package/dist/bundle/chunks/meta.js +10 -10
- package/dist/bundle/chunks/mistral-conversations-OKG5GKXR.js +42 -0
- package/dist/bundle/chunks/{node-VSA4ZN7D.js → node-UGQUSQE6.js} +1 -1
- package/dist/bundle/chunks/{node-SJPZTR4K.js → node-UNHECG4X.js} +168 -157
- package/dist/bundle/chunks/openai-codex-responses-6JYZIFT4.js +100 -0
- package/dist/bundle/chunks/openai-completions-YBNI6CAP.js +82 -0
- package/dist/bundle/chunks/{openai-decisions-WOWUC65P.js → openai-decisions-5G5YBFRQ.js} +1 -1
- package/dist/bundle/chunks/openai-responses-C3APJ6MK.js +27 -0
- package/dist/bundle/chunks/{openrouter-images-5K47HDAT.js → openrouter-images-FCJT7C7I.js} +2 -2
- package/dist/bundle/chunks/{pdfjs-EK6K7CXX.js → pdfjs-AKD6EBKN.js} +196 -175
- package/dist/bundle/chunks/pdfjs-decoders-OFXX4HDZ.js +2 -0
- package/dist/bundle/chunks/pdfjs-jbig2-TXR26KRI.js +278 -0
- package/dist/bundle/chunks/pdfjs-jbig2_nowasm_fallback-FH3KJM4H.js +326 -0
- package/dist/bundle/chunks/pdfjs-openjpeg-SKR7C34X.js +671 -0
- package/dist/bundle/chunks/pdfjs-openjpeg_nowasm_fallback-VUBL7UEE.js +974 -0
- package/dist/bundle/chunks/pi-messages-UHYZYEOC.js +25 -0
- package/dist/bundle/chunks/radius.js +8 -8
- package/dist/bundle/chunks/{runtime-K3F2QDQP.js → runtime-KE3HDSRT.js} +1 -1
- package/dist/bundle/chunks/{turndown.cjs-U7XOXH4O.js → turndown.cjs-WKGZX7NZ.js} +1 -1
- package/dist/bundle/chunks/{typesafe-system-one-43OCHGKP.js → typesafe-system-one-VYVAMWQV.js} +1 -1
- package/dist/bundle/chunks/{undici-EK3EUI2E.js → undici-C6S56CGI.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-KDUZIB3W.js +23 -0
- package/dist/bundle/cli-runtime.js +3 -3
- package/dist/bundle/flow/package.json +5 -5
- package/dist/bundle/index.js +10 -10
- package/dist/bundle/rpc-entry.js +3 -3
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +9 -8
- package/dist/cli/args.js.map +1 -1
- package/dist/config.d.ts +12 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +29 -5
- package/dist/config.js.map +1 -1
- package/dist/coordination/adapter/tool.d.ts +8 -5
- package/dist/coordination/adapter/tool.d.ts.map +1 -1
- package/dist/coordination/adapter/tool.js +32 -6
- package/dist/coordination/adapter/tool.js.map +1 -1
- package/dist/coordination/client/client.d.ts.map +1 -1
- package/dist/coordination/client/client.js +19 -1
- package/dist/coordination/client/client.js.map +1 -1
- package/dist/core/agent-session-runtime.js +3 -3
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +23 -3
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +142 -39
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/anthropic-subscription-usage.d.ts +4 -0
- package/dist/core/anthropic-subscription-usage.d.ts.map +1 -1
- package/dist/core/anthropic-subscription-usage.js +71 -1
- package/dist/core/anthropic-subscription-usage.js.map +1 -1
- package/dist/core/bug-report.d.ts +4 -4
- package/dist/core/codex-reset.d.ts +45 -0
- package/dist/core/codex-reset.d.ts.map +1 -0
- package/dist/core/codex-reset.js +190 -0
- package/dist/core/codex-reset.js.map +1 -0
- package/dist/core/codex-usage.d.ts +4 -2
- package/dist/core/codex-usage.d.ts.map +1 -1
- package/dist/core/codex-usage.js +9 -4
- package/dist/core/codex-usage.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +3 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +25 -10
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +37 -3
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +274 -65
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +19 -6
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +49 -11
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/exec.d.ts +9 -1
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +105 -61
- package/dist/core/exec.js.map +1 -1
- package/dist/core/export-html/template.css +9 -0
- package/dist/core/export-html/template.html +2 -0
- package/dist/core/export-html/template.js +200 -62
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +3 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +7 -6
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/pi-ai-extension-view.d.ts +19 -0
- package/dist/core/extensions/pi-ai-extension-view.d.ts.map +1 -0
- package/dist/core/extensions/pi-ai-extension-view.js +22 -0
- package/dist/core/extensions/pi-ai-extension-view.js.map +1 -0
- package/dist/core/extensions/types.d.ts +27 -4
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/virtual-modules.js +8 -7
- package/dist/core/extensions/virtual-modules.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts +7 -0
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +107 -0
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/keybindings.d.ts +56 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +14 -2
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/mcp-servers.d.ts +9 -4
- package/dist/core/mcp-servers.d.ts.map +1 -1
- package/dist/core/mcp-servers.js +15 -5
- package/dist/core/mcp-servers.js.map +1 -1
- package/dist/core/model-config.d.ts +1691 -2042
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +2 -3
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-registry.d.ts +35 -4
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +70 -8
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +16 -10
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +21 -17
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/package-manager.d.ts +29 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +311 -60
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/pi-ai-schemas.d.ts +164 -0
- package/dist/core/pi-ai-schemas.d.ts.map +1 -0
- package/dist/core/pi-ai-schemas.js +21 -0
- package/dist/core/pi-ai-schemas.js.map +1 -0
- package/dist/core/pi-manifest.d.ts +1 -0
- package/dist/core/pi-manifest.d.ts.map +1 -1
- package/dist/core/pi-manifest.js +4 -0
- package/dist/core/pi-manifest.js.map +1 -1
- package/dist/core/project-trust.js +1 -1
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/resource-loader.d.ts +4 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +38 -23
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +4 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +7 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +66 -26
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +2 -0
- package/dist/core/settings-defaults.d.ts.map +1 -1
- package/dist/core/settings-defaults.js +2 -0
- package/dist/core/settings-defaults.js.map +1 -1
- package/dist/core/settings-manager.d.ts +19 -8
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +70 -16
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +15 -2
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +37 -3
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +6 -14
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.js +2 -2
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/source-info.d.ts +9 -0
- package/dist/core/source-info.d.ts.map +1 -1
- package/dist/core/source-info.js +13 -0
- package/dist/core/source-info.js.map +1 -1
- package/dist/core/subscription-credits.d.ts +14 -0
- package/dist/core/subscription-credits.d.ts.map +1 -0
- package/dist/core/subscription-credits.js +10 -0
- package/dist/core/subscription-credits.js.map +1 -0
- package/dist/core/subscription-reset-status.d.ts +10 -0
- package/dist/core/subscription-reset-status.d.ts.map +1 -0
- package/dist/core/subscription-reset-status.js +2 -0
- package/dist/core/subscription-reset-status.js.map +1 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +5 -6
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +2 -2
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts +3 -3
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +2 -4
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts +2 -2
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +2 -2
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +7 -3
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts +2 -2
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts +2 -2
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +4 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +42 -12
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/renderers/edit.d.ts.map +1 -1
- package/dist/core/tools/renderers/edit.js +3 -3
- package/dist/core/tools/renderers/edit.js.map +1 -1
- package/dist/core/tools/renderers/write.d.ts.map +1 -1
- package/dist/core/tools/renderers/write.js +37 -29
- package/dist/core/tools/renderers/write.js.map +1 -1
- package/dist/core/tools/subagent.d.ts +9 -8
- package/dist/core/tools/subagent.d.ts.map +1 -1
- package/dist/core/tools/subagent.js +8 -5
- package/dist/core/tools/subagent.js.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts +11 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/write.d.ts +2 -2
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +14 -8
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/core/usage-totals.d.ts.map +1 -1
- package/dist/core/usage-totals.js +2 -0
- package/dist/core/usage-totals.js.map +1 -1
- package/dist/extensions/codemode/renderer.d.ts.map +1 -1
- package/dist/extensions/codemode/renderer.js +17 -9
- package/dist/extensions/codemode/renderer.js.map +1 -1
- package/dist/extensions/codemode/tool.d.ts +2 -1
- package/dist/extensions/codemode/tool.d.ts.map +1 -1
- package/dist/extensions/codemode/tool.js +33 -8
- package/dist/extensions/codemode/tool.js.map +1 -1
- package/dist/extensions/llama/ui.d.ts.map +1 -1
- package/dist/extensions/llama/ui.js +16 -4
- package/dist/extensions/llama/ui.js.map +1 -1
- package/dist/extensions/mcp/cli.d.ts.map +1 -1
- package/dist/extensions/mcp/cli.js +34 -8
- package/dist/extensions/mcp/cli.js.map +1 -1
- package/dist/extensions/mcp/index.js +4 -3
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/oauth.d.ts +1 -1
- package/dist/extensions/mcp/oauth.d.ts.map +1 -1
- package/dist/extensions/mcp/oauth.js +7 -3
- package/dist/extensions/mcp/oauth.js.map +1 -1
- package/dist/extensions/mcp/ui.d.ts +1 -0
- package/dist/extensions/mcp/ui.d.ts.map +1 -1
- package/dist/extensions/mcp/ui.js +56 -28
- package/dist/extensions/mcp/ui.js.map +1 -1
- package/dist/extensions/tool-search/tool.d.ts +21 -6
- package/dist/extensions/tool-search/tool.d.ts.map +1 -1
- package/dist/extensions/tool-search/tool.js +104 -36
- package/dist/extensions/tool-search/tool.js.map +1 -1
- package/dist/extensions/usage/confirmation.d.ts +40 -0
- package/dist/extensions/usage/confirmation.d.ts.map +1 -0
- package/dist/extensions/usage/confirmation.js +198 -0
- package/dist/extensions/usage/confirmation.js.map +1 -0
- package/dist/extensions/usage/index.d.ts +4 -4
- package/dist/extensions/usage/index.d.ts.map +1 -1
- package/dist/extensions/usage/index.js +352 -33
- package/dist/extensions/usage/index.js.map +1 -1
- package/dist/extensions/usage/overview.d.ts +8 -1
- package/dist/extensions/usage/overview.d.ts.map +1 -1
- package/dist/extensions/usage/overview.js +54 -11
- package/dist/extensions/usage/overview.js.map +1 -1
- package/dist/extensions/usage/popup.d.ts +37 -6
- package/dist/extensions/usage/popup.d.ts.map +1 -1
- package/dist/extensions/usage/popup.js +396 -45
- package/dist/extensions/usage/popup.js.map +1 -1
- package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +564 -130
- package/dist/humain/node-provider.d.ts.map +1 -1
- package/dist/humain/node-provider.js +1 -0
- package/dist/humain/node-provider.js.map +1 -1
- package/dist/humain/web-access/host.d.ts +2 -1
- package/dist/humain/web-access/host.d.ts.map +1 -1
- package/dist/humain/web-access/host.js +1 -1
- package/dist/humain/web-access/host.js.map +1 -1
- package/dist/humain/web-access/vendor/brave-rate-limit.d.ts +2 -0
- package/dist/humain/web-access/vendor/brave-rate-limit.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/brave-rate-limit.js +2 -2
- package/dist/humain/web-access/vendor/brave-rate-limit.js.map +1 -1
- package/dist/humain/web-access/vendor/cloudflare-search.d.ts +5 -0
- package/dist/humain/web-access/vendor/cloudflare-search.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/cloudflare-search.js +230 -0
- package/dist/humain/web-access/vendor/cloudflare-search.js.map +1 -0
- package/dist/humain/web-access/vendor/curator-page.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/curator-page.js +18 -1
- package/dist/humain/web-access/vendor/curator-page.js.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.js +12 -0
- package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
- package/dist/humain/web-access/vendor/duckduckgo-rate-limit.d.ts +33 -0
- package/dist/humain/web-access/vendor/duckduckgo-rate-limit.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/duckduckgo-rate-limit.js +84 -0
- package/dist/humain/web-access/vendor/duckduckgo-rate-limit.js.map +1 -0
- package/dist/humain/web-access/vendor/duckduckgo.d.ts +3 -0
- package/dist/humain/web-access/vendor/duckduckgo.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/duckduckgo.js +54 -49
- package/dist/humain/web-access/vendor/duckduckgo.js.map +1 -1
- package/dist/humain/web-access/vendor/exa.d.ts +8 -3
- package/dist/humain/web-access/vendor/exa.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/exa.js +129 -14
- package/dist/humain/web-access/vendor/exa.js.map +1 -1
- package/dist/humain/web-access/vendor/extract.d.ts +1 -1
- package/dist/humain/web-access/vendor/extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/extract.js +68 -10
- package/dist/humain/web-access/vendor/extract.js.map +1 -1
- package/dist/humain/web-access/vendor/fetch-params.d.ts +2 -1
- package/dist/humain/web-access/vendor/fetch-params.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/fetch-params.js +2 -2
- package/dist/humain/web-access/vendor/fetch-params.js.map +1 -1
- package/dist/humain/web-access/vendor/field-extract.d.ts +38 -0
- package/dist/humain/web-access/vendor/field-extract.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/field-extract.js +350 -0
- package/dist/humain/web-access/vendor/field-extract.js.map +1 -0
- package/dist/humain/web-access/vendor/gemini-search.d.ts +15 -4
- package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.js +198 -16
- package/dist/humain/web-access/vendor/gemini-search.js.map +1 -1
- package/dist/humain/web-access/vendor/github-api.js +1 -1
- package/dist/humain/web-access/vendor/github-api.js.map +1 -1
- package/dist/humain/web-access/vendor/github-extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/github-extract.js +3 -2
- package/dist/humain/web-access/vendor/github-extract.js.map +1 -1
- package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/index.js +137 -118
- package/dist/humain/web-access/vendor/index.js.map +1 -1
- package/dist/humain/web-access/vendor/mistral-search.js +1 -1
- package/dist/humain/web-access/vendor/mistral-search.js.map +1 -1
- package/dist/humain/web-access/vendor/ninerouter.d.ts +4 -0
- package/dist/humain/web-access/vendor/ninerouter.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/ninerouter.js +110 -0
- package/dist/humain/web-access/vendor/ninerouter.js.map +1 -0
- package/dist/humain/web-access/vendor/offtopic-judge.d.ts +27 -0
- package/dist/humain/web-access/vendor/offtopic-judge.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/offtopic-judge.js +61 -0
- package/dist/humain/web-access/vendor/offtopic-judge.js.map +1 -0
- package/dist/humain/web-access/vendor/openai-search.d.ts +1 -1
- package/dist/humain/web-access/vendor/openai-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/openai-search.js +39 -13
- package/dist/humain/web-access/vendor/openai-search.js.map +1 -1
- package/dist/humain/web-access/vendor/outcrawl.d.ts +4 -0
- package/dist/humain/web-access/vendor/outcrawl.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/outcrawl.js +196 -0
- package/dist/humain/web-access/vendor/outcrawl.js.map +1 -0
- package/dist/humain/web-access/vendor/page-query.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/page-query.js +13 -3
- package/dist/humain/web-access/vendor/page-query.js.map +1 -1
- package/dist/humain/web-access/vendor/pdf-extract.d.ts +1 -3
- package/dist/humain/web-access/vendor/pdf-extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/pdf-extract.js +0 -2
- package/dist/humain/web-access/vendor/pdf-extract.js.map +1 -1
- package/dist/humain/web-access/vendor/perplexity.d.ts +3 -0
- package/dist/humain/web-access/vendor/perplexity.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/perplexity.js.map +1 -1
- package/dist/humain/web-access/vendor/query-rewrite.d.ts +2 -2
- package/dist/humain/web-access/vendor/query-rewrite.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/query-rewrite.js +39 -13
- package/dist/humain/web-access/vendor/query-rewrite.js.map +1 -1
- package/dist/humain/web-access/vendor/searchapi.d.ts +4 -0
- package/dist/humain/web-access/vendor/searchapi.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/searchapi.js +195 -0
- package/dist/humain/web-access/vendor/searchapi.js.map +1 -0
- package/dist/humain/web-access/vendor/sofya.d.ts +4 -0
- package/dist/humain/web-access/vendor/sofya.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/sofya.js +193 -0
- package/dist/humain/web-access/vendor/sofya.js.map +1 -0
- package/dist/humain/web-access/vendor/source-check.d.ts +5 -1
- package/dist/humain/web-access/vendor/source-check.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/source-check.js +34 -16
- package/dist/humain/web-access/vendor/source-check.js.map +1 -1
- package/dist/humain/web-access/vendor/ssrf-protection.d.ts +7 -0
- package/dist/humain/web-access/vendor/ssrf-protection.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/ssrf-protection.js +24 -1
- package/dist/humain/web-access/vendor/ssrf-protection.js.map +1 -1
- package/dist/humain/web-access/vendor/summary-model-scope.d.ts +8 -3
- package/dist/humain/web-access/vendor/summary-model-scope.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/summary-model-scope.js +15 -1
- package/dist/humain/web-access/vendor/summary-model-scope.js.map +1 -1
- package/dist/humain/web-access/vendor/summary-review.d.ts +7 -2
- package/dist/humain/web-access/vendor/summary-review.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/summary-review.js +32 -28
- package/dist/humain/web-access/vendor/summary-review.js.map +1 -1
- package/dist/humain/web-access/vendor/tabstack.d.ts +6 -0
- package/dist/humain/web-access/vendor/tabstack.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/tabstack.js +236 -0
- package/dist/humain/web-access/vendor/tabstack.js.map +1 -0
- package/dist/humain/web-access/vendor/tool-arguments.js +1 -1
- package/dist/humain/web-access/vendor/tool-arguments.js.map +1 -1
- package/dist/humain/web-access/vendor/upgrade-notice.d.ts +8 -0
- package/dist/humain/web-access/vendor/upgrade-notice.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/upgrade-notice.js +46 -0
- package/dist/humain/web-access/vendor/upgrade-notice.js.map +1 -0
- package/dist/humain/web-access/vendor/utils.d.ts +9 -0
- package/dist/humain/web-access/vendor/utils.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/utils.js +113 -27
- package/dist/humain/web-access/vendor/utils.js.map +1 -1
- package/dist/humain/web-access/vendor/web-tool-contract.d.ts +4 -0
- package/dist/humain/web-access/vendor/web-tool-contract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/web-tool-contract.js.map +1 -1
- package/dist/humain/web-access/vendor/web-tool-core.d.ts +17 -1
- package/dist/humain/web-access/vendor/web-tool-core.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/web-tool-core.js +99 -22
- package/dist/humain/web-access/vendor/web-tool-core.js.map +1 -1
- package/dist/humain/web-access/vendor/xai-search.d.ts +1 -1
- package/dist/humain/web-access/vendor/xai-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/xai-search.js +6 -5
- package/dist/humain/web-access/vendor/xai-search.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +20 -9
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-code-block.d.ts +34 -0
- package/dist/modes/interactive/components/assistant-code-block.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-code-block.js +160 -0
- package/dist/modes/interactive/components/assistant-code-block.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +31 -10
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +276 -73
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +2 -1
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +4 -17
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +7 -0
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-entry.js +2 -1
- package/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +2 -1
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/diff.d.ts.map +1 -1
- package/dist/modes/interactive/components/diff.js +3 -1
- package/dist/modes/interactive/components/diff.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +2 -0
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +4 -0
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +4 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +6 -5
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +5 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +107 -11
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/markdown-transform.d.ts +2 -1
- package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -1
- package/dist/modes/interactive/components/markdown-transform.js +3 -2
- package/dist/modes/interactive/components/markdown-transform.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
- package/dist/modes/interactive/components/mermaid.js +18 -6
- package/dist/modes/interactive/components/mermaid.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +17 -6
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +13 -4
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +14 -3
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts +4 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.js +86 -22
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +2 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +16 -24
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.js +2 -0
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +2 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +15 -5
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +5 -6
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +9 -1
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +4 -3
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +20 -18
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts +1 -0
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +16 -4
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +6 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +259 -83
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/model-search.d.ts +10 -0
- package/dist/modes/interactive/model-search.d.ts.map +1 -1
- package/dist/modes/interactive/model-search.js +21 -0
- package/dist/modes/interactive/model-search.js.map +1 -1
- package/dist/modes/interactive/oauth-account-format.d.ts +10 -1
- package/dist/modes/interactive/oauth-account-format.d.ts.map +1 -1
- package/dist/modes/interactive/oauth-account-format.js +42 -0
- package/dist/modes/interactive/oauth-account-format.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +10 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +28 -24
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +3 -2
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +55 -4
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/ansi.d.ts.map +1 -1
- package/dist/utils/ansi.js +5 -2
- package/dist/utils/ansi.js.map +1 -1
- package/dist/utils/clipboard-command.d.ts.map +1 -1
- package/dist/utils/clipboard-command.js +4 -0
- package/dist/utils/clipboard-command.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts +8 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +31 -1
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/git.d.ts +1 -1
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/image-resize-core.d.ts.map +1 -1
- package/dist/utils/image-resize-core.js +5 -3
- package/dist/utils/image-resize-core.js.map +1 -1
- package/dist/utils/open-browser.d.ts.map +1 -1
- package/dist/utils/open-browser.js +96 -6
- package/dist/utils/open-browser.js.map +1 -1
- package/dist/utils/paths.d.ts +17 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +42 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/shell.d.ts +2 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +12 -2
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts +5 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +156 -11
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +30 -35
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/cli.md +22 -12
- package/docs/compaction.md +32 -8
- package/docs/coordination.md +2 -0
- package/docs/custom-provider.md +4 -2
- package/docs/environment-variables.md +2 -0
- package/docs/extensions.md +3169 -229
- package/docs/flow.md +2 -0
- package/docs/keybindings.md +24 -2
- package/docs/llama-cpp.md +30 -19
- package/docs/mcp.md +4 -2
- package/docs/message-types.md +7 -7
- package/docs/packages.md +27 -1
- package/docs/sessions.md +11 -3
- package/docs/settings.md +21 -9
- package/docs/slash-commands.md +51 -11
- package/docs/terminal-setup.md +3 -1
- package/docs/tmux.md +6 -0
- package/docs/tui.md +3 -1
- package/docs/windows.md +27 -0
- package/examples/extensions/README.md +2 -1
- package/examples/extensions/custom-provider-anthropic/index.ts +27 -31
- package/examples/extensions/custom-provider-anthropic/package-lock.json +7 -7
- package/examples/extensions/custom-provider-anthropic/package.json +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/debug-provider.ts +2 -2
- package/examples/extensions/gondolin/package-lock.json +14 -24
- package/examples/extensions/gondolin/package.json +2 -2
- package/examples/extensions/preset.ts +2 -0
- package/examples/extensions/reload-runtime.ts +17 -5
- package/examples/extensions/todo.ts +7 -0
- package/examples/extensions/tools.ts +2 -0
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/tsconfig.json +252 -0
- package/npm-shrinkwrap.json +289 -277
- package/package.json +29 -29
- package/schemas/keybindings.schema.json +28 -0
- package/schemas/models.schema.json +36 -36
- package/schemas/settings.schema.json +49 -0
- package/src/humain/ponytail/UPSTREAM.md +16 -2
- package/src/humain/ponytail/upstream.json +4 -4
- package/src/humain/web-access/UPSTREAM.md +48 -1
- package/src/humain/web-access/upstream.json +9 -6
- package/src/humain/web-access/vendor/CHANGELOG.md +1223 -0
- package/dist/bundle/chunks/anthropic-messages-ZP5KUK52.js +0 -67
- package/dist/bundle/chunks/azure-openai-responses-QJFYQ3DF.js +0 -15
- package/dist/bundle/chunks/chunk-2GCMACT4.js +0 -1956
- package/dist/bundle/chunks/chunk-AO6FF5JL.js +0 -21
- package/dist/bundle/chunks/chunk-EY3LZOUP.js +0 -1963
- package/dist/bundle/chunks/chunk-M74U5X4S.js +0 -119
- package/dist/bundle/chunks/chunk-N7CQ3UV3.js +0 -80
- package/dist/bundle/chunks/chunk-OR25QDSS.js +0 -365
- package/dist/bundle/chunks/chunk-PH7UP57J.js +0 -6
- package/dist/bundle/chunks/chunk-QW6PTCAB.js +0 -10
- package/dist/bundle/chunks/chunk-ROZV2IYD.js +0 -125
- package/dist/bundle/chunks/chunk-YFOLLX5D.js +0 -23
- package/dist/bundle/chunks/chunk-ZR4GF4WU.js +0 -54
- package/dist/bundle/chunks/compat-CJBWWYHE.js +0 -13
- package/dist/bundle/chunks/dist-IBUWEKEE.js +0 -24
- package/dist/bundle/chunks/dist-YFMJEHPH.js +0 -8
- package/dist/bundle/chunks/google-generative-ai-HVPCGIZ6.js +0 -21
- package/dist/bundle/chunks/google-vertex-UM5MAALA.js +0 -25
- package/dist/bundle/chunks/host-ZHEL5XQW.js +0 -2
- package/dist/bundle/chunks/mistral-conversations-AH72RLXK.js +0 -44
- package/dist/bundle/chunks/openai-codex-responses-L366637C.js +0 -98
- package/dist/bundle/chunks/openai-completions-ZP62QXJX.js +0 -83
- package/dist/bundle/chunks/openai-responses-DXUGSUTN.js +0 -26
- package/dist/bundle/chunks/pi-messages-MOQQDZBK.js +0 -23
- package/dist/bundle/chunks/virtual-modules-5D6QIJPN.js +0 -5
- package/examples/extensions/sandbox/index.ts +0 -321
- package/examples/extensions/sandbox/package-lock.json +0 -66
- package/examples/extensions/sandbox/package.json +0 -19
|
@@ -6,13 +6,18 @@
|
|
|
6
6
|
* load the execution path or its typebox parameter schema. `write.ts` spreads these into its
|
|
7
7
|
* definition, so the tool's public shape is unchanged.
|
|
8
8
|
*/
|
|
9
|
-
import { Container, Text } from "@earendil-works/pi-tui";
|
|
9
|
+
import { Container, sanitizeTerminalText, Text } from "@earendil-works/pi-tui";
|
|
10
10
|
import { keyHint } from "../../../modes/interactive/components/keybinding-hints.js";
|
|
11
|
-
import { getLanguageFromPath, highlightCode } from "../../../modes/interactive/theme/theme.js";
|
|
11
|
+
import { CodeHighlighter, getLanguageFromPath, highlightCode, } from "../../../modes/interactive/theme/theme.js";
|
|
12
12
|
import { normalizeDisplayText, renderToolPath, replaceTabs, str } from "../render-utils.js";
|
|
13
13
|
import { declarePathHighlightingRenderers } from "./highlighting.js";
|
|
14
14
|
class WriteCallRenderComponent extends Text {
|
|
15
|
+
// Line by line highlighting of a call whose content is still streaming.
|
|
15
16
|
cache;
|
|
17
|
+
// A streamed call highlights its first lines on every delta, which stop changing once the file is longer, and a
|
|
18
|
+
// complete call highlights the whole file on every update and expand toggle. Either way the row reuses the last
|
|
19
|
+
// highlighting; it also holds the only copy of a complete call's displayed source.
|
|
20
|
+
highlighter = new CodeHighlighter();
|
|
16
21
|
constructor() {
|
|
17
22
|
super("", 0, 0);
|
|
18
23
|
}
|
|
@@ -29,7 +34,7 @@ function highlightSingleLine(line, lang) {
|
|
|
29
34
|
const highlighted = highlightCode(line, lang);
|
|
30
35
|
return highlighted[0] ?? "";
|
|
31
36
|
}
|
|
32
|
-
function refreshWriteHighlightPrefix(cache) {
|
|
37
|
+
function refreshWriteHighlightPrefix(cache, highlighter) {
|
|
33
38
|
const prefixCount = Math.min(WRITE_PARTIAL_FULL_HIGHLIGHT_LINES, cache.normalizedLines.length);
|
|
34
39
|
if (prefixCount === 0)
|
|
35
40
|
return;
|
|
@@ -37,13 +42,13 @@ function refreshWriteHighlightPrefix(cache) {
|
|
|
37
42
|
if (cache.prefixSource === prefixSource)
|
|
38
43
|
return;
|
|
39
44
|
cache.prefixSource = prefixSource;
|
|
40
|
-
const prefixHighlighted =
|
|
45
|
+
const prefixHighlighted = highlighter.highlight(prefixSource, cache.lang);
|
|
41
46
|
for (let i = 0; i < prefixCount; i++) {
|
|
42
47
|
cache.highlightedLines[i] =
|
|
43
48
|
prefixHighlighted[i] ?? highlightSingleLine(cache.normalizedLines[i] ?? "", cache.lang);
|
|
44
49
|
}
|
|
45
50
|
}
|
|
46
|
-
function rebuildWriteHighlightCacheFull(rawPath, fileContent) {
|
|
51
|
+
function rebuildWriteHighlightCacheFull(rawPath, fileContent, highlighter) {
|
|
47
52
|
const lang = rawPath ? getLanguageFromPath(rawPath) : undefined;
|
|
48
53
|
if (!lang)
|
|
49
54
|
return undefined;
|
|
@@ -54,12 +59,13 @@ function rebuildWriteHighlightCacheFull(rawPath, fileContent) {
|
|
|
54
59
|
lang,
|
|
55
60
|
rawContent: fileContent,
|
|
56
61
|
normalizedLines: normalized.split("\n"),
|
|
57
|
-
highlightedLines:
|
|
62
|
+
highlightedLines: [...highlighter.highlight(normalized, lang)],
|
|
58
63
|
all: true,
|
|
64
|
+
complete: true,
|
|
59
65
|
};
|
|
60
66
|
}
|
|
61
67
|
/** The cache for a call shown collapsed: the first lines highlighted, as they are while the file streams in. */
|
|
62
|
-
function rebuildWriteHighlightCacheCollapsed(rawPath, fileContent) {
|
|
68
|
+
function rebuildWriteHighlightCacheCollapsed(rawPath, fileContent, highlighter) {
|
|
63
69
|
const lang = rawPath ? getLanguageFromPath(rawPath) : undefined;
|
|
64
70
|
if (!lang)
|
|
65
71
|
return undefined;
|
|
@@ -71,7 +77,7 @@ function rebuildWriteHighlightCacheCollapsed(rawPath, fileContent) {
|
|
|
71
77
|
highlightedLines: [],
|
|
72
78
|
all: false,
|
|
73
79
|
};
|
|
74
|
-
refreshWriteHighlightPrefix(cache);
|
|
80
|
+
refreshWriteHighlightPrefix(cache, highlighter);
|
|
75
81
|
cache.all = cache.normalizedLines.length <= WRITE_PARTIAL_FULL_HIGHLIGHT_LINES;
|
|
76
82
|
return cache;
|
|
77
83
|
}
|
|
@@ -84,37 +90,36 @@ function highlightRemainingLines(cache) {
|
|
|
84
90
|
}
|
|
85
91
|
cache.all = true;
|
|
86
92
|
}
|
|
87
|
-
function updateWriteHighlightCacheIncremental(cache, rawPath, fileContent, expanded) {
|
|
93
|
+
function updateWriteHighlightCacheIncremental(cache, rawPath, fileContent, expanded, highlighter) {
|
|
88
94
|
const lang = rawPath ? getLanguageFromPath(rawPath) : undefined;
|
|
89
95
|
if (!lang)
|
|
90
96
|
return undefined;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return rebuild(rawPath, fileContent);
|
|
97
|
+
if (!cache ||
|
|
98
|
+
cache.lang !== lang ||
|
|
99
|
+
cache.rawPath !== rawPath ||
|
|
100
|
+
!fileContent.startsWith(cache.rawContent) ||
|
|
101
|
+
(cache.lineCount !== undefined && (expanded || fileContent.length !== cache.rawContent.length))) {
|
|
102
|
+
return expanded
|
|
103
|
+
? rebuildWriteHighlightCacheFull(rawPath, fileContent, highlighter)
|
|
104
|
+
: rebuildWriteHighlightCacheCollapsed(rawPath, fileContent, highlighter);
|
|
100
105
|
}
|
|
101
106
|
if (expanded)
|
|
102
107
|
highlightRemainingLines(cache);
|
|
103
108
|
if (fileContent.length === cache.rawContent.length)
|
|
104
109
|
return cache;
|
|
110
|
+
cache.complete = false;
|
|
105
111
|
if (!expanded) {
|
|
106
112
|
// Collapsed: the lines are kept, and the first of them highlighted.
|
|
107
113
|
const added = replaceTabs(normalizeDisplayText(fileContent.slice(cache.rawContent.length))).split("\n");
|
|
108
114
|
cache.rawContent = fileContent;
|
|
109
115
|
cache.all = false;
|
|
110
|
-
cache.complete = false;
|
|
111
116
|
if (cache.normalizedLines.length === 0)
|
|
112
117
|
cache.normalizedLines.push("");
|
|
113
118
|
const lastLine = cache.normalizedLines.length - 1;
|
|
114
119
|
cache.normalizedLines[lastLine] += added[0];
|
|
115
120
|
for (let i = 1; i < added.length; i++)
|
|
116
121
|
cache.normalizedLines.push(added[i]);
|
|
117
|
-
refreshWriteHighlightPrefix(cache);
|
|
122
|
+
refreshWriteHighlightPrefix(cache, highlighter);
|
|
118
123
|
// (While the first lines are all the lines, every line is highlighted.)
|
|
119
124
|
cache.all = cache.normalizedLines.length <= WRITE_PARTIAL_FULL_HIGHLIGHT_LINES;
|
|
120
125
|
return cache;
|
|
@@ -135,7 +140,7 @@ function updateWriteHighlightCacheIncremental(cache, rawPath, fileContent, expan
|
|
|
135
140
|
cache.normalizedLines.push(segments[i]);
|
|
136
141
|
cache.highlightedLines.push(highlightSingleLine(segments[i], cache.lang));
|
|
137
142
|
}
|
|
138
|
-
refreshWriteHighlightPrefix(cache);
|
|
143
|
+
refreshWriteHighlightPrefix(cache, highlighter);
|
|
139
144
|
return cache;
|
|
140
145
|
}
|
|
141
146
|
/** The lines of a collapsed cache that are counted: without the empty lines at the end, as formatWriteCall() counts them. */
|
|
@@ -158,7 +163,7 @@ function trimTrailingEmptyLines(lines) {
|
|
|
158
163
|
}
|
|
159
164
|
return lines.slice(0, end);
|
|
160
165
|
}
|
|
161
|
-
function formatWriteCall(args, options, theme, cache, cwd) {
|
|
166
|
+
function formatWriteCall(args, options, theme, cache, highlighter, cwd) {
|
|
162
167
|
const rawPath = str(args?.file_path ?? args?.path);
|
|
163
168
|
const fileContent = str(args?.content);
|
|
164
169
|
const pathDisplay = renderToolPath(rawPath, theme, cwd);
|
|
@@ -178,7 +183,7 @@ function formatWriteCall(args, options, theme, cache, cwd) {
|
|
|
178
183
|
}
|
|
179
184
|
else {
|
|
180
185
|
const renderedLines = lang
|
|
181
|
-
? (cache?.highlightedLines ??
|
|
186
|
+
? (cache?.highlightedLines ?? highlighter.highlight(replaceTabs(normalizeDisplayText(fileContent)), lang))
|
|
182
187
|
: normalizeDisplayText(fileContent).split("\n");
|
|
183
188
|
const lines = trimTrailingEmptyLines(renderedLines);
|
|
184
189
|
totalLines = lines.length;
|
|
@@ -204,7 +209,7 @@ function formatWriteResult(result, theme) {
|
|
|
204
209
|
if (!output) {
|
|
205
210
|
return undefined;
|
|
206
211
|
}
|
|
207
|
-
return `\n${theme.fg("error", output)}`;
|
|
212
|
+
return `\n${theme.fg("error", sanitizeTerminalText(output))}`;
|
|
208
213
|
}
|
|
209
214
|
export const writeRenderers = {
|
|
210
215
|
renderCall(args, theme, context) {
|
|
@@ -216,18 +221,21 @@ export const writeRenderers = {
|
|
|
216
221
|
// Expanded, the whole file is highlighted once it is complete. Collapsed, the first lines are, as they were
|
|
217
222
|
// while it streamed in.
|
|
218
223
|
if (!context.argsComplete) {
|
|
219
|
-
component.cache = updateWriteHighlightCacheIncremental(component.cache, rawPath, fileContent, context.expanded);
|
|
224
|
+
component.cache = updateWriteHighlightCacheIncremental(component.cache, rawPath, fileContent, context.expanded, component.highlighter);
|
|
220
225
|
}
|
|
221
226
|
else if (context.expanded) {
|
|
222
|
-
|
|
227
|
+
const cache = component.cache;
|
|
228
|
+
if (!cache?.complete || !cache.all || cache.rawPath !== rawPath || cache.rawContent !== fileContent) {
|
|
229
|
+
component.cache = rebuildWriteHighlightCacheFull(rawPath, fileContent, component.highlighter);
|
|
230
|
+
}
|
|
223
231
|
}
|
|
224
232
|
else {
|
|
225
233
|
const cache = component.cache;
|
|
226
234
|
if (cache?.complete && !cache.all && cache.rawPath === rawPath && cache.rawContent === fileContent) {
|
|
227
|
-
refreshWriteHighlightPrefix(cache);
|
|
235
|
+
refreshWriteHighlightPrefix(cache, component.highlighter);
|
|
228
236
|
}
|
|
229
237
|
else {
|
|
230
|
-
component.cache = rebuildWriteHighlightCacheCollapsed(rawPath, fileContent);
|
|
238
|
+
component.cache = rebuildWriteHighlightCacheCollapsed(rawPath, fileContent, component.highlighter);
|
|
231
239
|
if (component.cache)
|
|
232
240
|
component.cache.complete = true;
|
|
233
241
|
}
|
|
@@ -241,7 +249,7 @@ export const writeRenderers = {
|
|
|
241
249
|
cache.lineCount = countCollapsedLines(cache);
|
|
242
250
|
cache.normalizedLines = cache.normalizedLines.slice(0, WRITE_PARTIAL_FULL_HIGHLIGHT_LINES);
|
|
243
251
|
}
|
|
244
|
-
component.setText(formatWriteCall(renderArgs, { expanded: context.expanded, isPartial: context.isPartial }, theme, component.cache, context.cwd));
|
|
252
|
+
component.setText(formatWriteCall(renderArgs, { expanded: context.expanded, isPartial: context.isPartial }, theme, component.cache, component.highlighter, context.cwd));
|
|
245
253
|
return component;
|
|
246
254
|
},
|
|
247
255
|
renderResult(result, _options, theme, context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../../../src/core/tools/renderers/write.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,2DAA2D,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAc,MAAM,2CAA2C,CAAC;AAE3G,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAwBrE,MAAM,wBAAyB,SAAQ,IAAI;IAC1C,KAAK,CAAuB;IAE5B;QACC,KAAK,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACjB,CAAC;IAEQ,UAAU;QAClB,KAAK,CAAC,UAAU,EAAE,CAAC;QACnB,gFAAgF;QAChF,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IACxB,CAAC;CACD;AACD,MAAM,kCAAkC,GAAG,EAAE,CAAC;AAC9C,oDAAoD;AACpD,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,SAAS,mBAAmB,CAAC,IAAY,EAAE,IAAY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5D,KAAK,EACL,SAAS,CAAC,KAAK,EACf,OAAO,CAAC,GAAG,CACX,CACD,CAAC;QACF,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO;QAC5C,MAAM,MAAM,GAAG,iBAAiB,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;QACjF,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,MAAM,SAAS,GAAI,OAAO,CAAC,aAAuC,IAAI,IAAI,SAAS,EAAE,CAAC;YACtF,SAAS,CAAC,KAAK,EAAE,CAAC;YAClB,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,MAAM,IAAI,GAAI,OAAO,CAAC,aAAkC,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAC;AAEF,gCAAgC,CAAC,cAAc,CAAC,CAAC","sourcesContent":["// Derived from Pi-Bolt (MIT, Copyright (c) 2026 OpenSec (Pi-Bolt)), commit b93895d2; modified for HUMAIN Code CLI.\n/**\n * Presentation for the write tool.\n *\n * Renderers live apart from the implementation so a process that only displays tool output does not\n * load the execution path or its typebox parameter schema. `write.ts` spreads these into its\n * definition, so the tool's public shape is unchanged.\n */\n\nimport { Container, Text } from \"@earendil-works/pi-tui\";\nimport { keyHint } from \"../../../modes/interactive/components/keybinding-hints.ts\";\nimport { getLanguageFromPath, highlightCode, type Theme } from \"../../../modes/interactive/theme/theme.ts\";\nimport type { ToolRenderers, ToolRenderResultOptions } from \"../../extensions/types.ts\";\nimport { normalizeDisplayText, renderToolPath, replaceTabs, str } from \"../render-utils.ts\";\nimport { declarePathHighlightingRenderers } from \"./highlighting.ts\";\n\ntype WriteHighlightCache = {\n\trawPath: string | null;\n\tlang: string;\n\trawContent: string;\n\tnormalizedLines: string[];\n\t/**\n\t * The lines highlighted. When the call is shown collapsed, only the first lines are: the lines after the ones that can\n\t * be shown are highlighted when the call is expanded (`all`), not as each one arrives and again when the file is\n\t * complete, which for a large file stops everything for as long as highlighting all of it takes.\n\t */\n\thighlightedLines: string[];\n\tall: boolean;\n\t/** Made from the complete file, not from the pieces it arrived in. */\n\tcomplete?: boolean;\n\t/**\n\t * Set once the call has its result and is shown collapsed: the count of lines shown when expanded, with\n\t * normalizedLines cut to the first lines. A collapsed call needs no more of them, and every write of a session stays in\n\t * the chat: keeping each file split into lines again holds more memory than the files themselves.\n\t */\n\tlineCount?: number;\n\tprefixSource?: string;\n};\nclass WriteCallRenderComponent extends Text {\n\tcache?: WriteHighlightCache;\n\n\tconstructor() {\n\t\tsuper(\"\", 0, 0);\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\t// Theme changes invalidate the highlighted prefix as well as the rendered text.\n\t\tthis.cache = undefined;\n\t}\n}\nconst WRITE_PARTIAL_FULL_HIGHLIGHT_LINES = 50;\n/** The lines of a collapsed call that are shown. */\nconst WRITE_COLLAPSED_LINES = 10;\nfunction highlightSingleLine(line: string, lang: string): string {\n\tconst highlighted = highlightCode(line, lang);\n\treturn highlighted[0] ?? \"\";\n}\nfunction refreshWriteHighlightPrefix(cache: WriteHighlightCache): void {\n\tconst prefixCount = Math.min(WRITE_PARTIAL_FULL_HIGHLIGHT_LINES, cache.normalizedLines.length);\n\tif (prefixCount === 0) return;\n\tconst prefixSource = cache.normalizedLines.slice(0, prefixCount).join(\"\\n\");\n\tif (cache.prefixSource === prefixSource) return;\n\tcache.prefixSource = prefixSource;\n\tconst prefixHighlighted = highlightCode(prefixSource, cache.lang);\n\tfor (let i = 0; i < prefixCount; i++) {\n\t\tcache.highlightedLines[i] =\n\t\t\tprefixHighlighted[i] ?? highlightSingleLine(cache.normalizedLines[i] ?? \"\", cache.lang);\n\t}\n}\nfunction rebuildWriteHighlightCacheFull(rawPath: string | null, fileContent: string): WriteHighlightCache | undefined {\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tif (!lang) return undefined;\n\tconst displayContent = normalizeDisplayText(fileContent);\n\tconst normalized = replaceTabs(displayContent);\n\treturn {\n\t\trawPath,\n\t\tlang,\n\t\trawContent: fileContent,\n\t\tnormalizedLines: normalized.split(\"\\n\"),\n\t\thighlightedLines: highlightCode(normalized, lang),\n\t\tall: true,\n\t};\n}\n/** The cache for a call shown collapsed: the first lines highlighted, as they are while the file streams in. */\nfunction rebuildWriteHighlightCacheCollapsed(\n\trawPath: string | null,\n\tfileContent: string,\n): WriteHighlightCache | undefined {\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tif (!lang) return undefined;\n\tconst cache: WriteHighlightCache = {\n\t\trawPath,\n\t\tlang,\n\t\trawContent: fileContent,\n\t\tnormalizedLines: replaceTabs(normalizeDisplayText(fileContent)).split(\"\\n\"),\n\t\thighlightedLines: [],\n\t\tall: false,\n\t};\n\trefreshWriteHighlightPrefix(cache);\n\tcache.all = cache.normalizedLines.length <= WRITE_PARTIAL_FULL_HIGHLIGHT_LINES;\n\treturn cache;\n}\n/** Highlights, each on its own, the lines after the first ones that a collapsed call left unhighlighted. */\nfunction highlightRemainingLines(cache: WriteHighlightCache): void {\n\tif (cache.all) return;\n\tfor (\n\t\tlet i = Math.min(WRITE_PARTIAL_FULL_HIGHLIGHT_LINES, cache.normalizedLines.length);\n\t\ti < cache.normalizedLines.length;\n\t\ti++\n\t) {\n\t\tcache.highlightedLines[i] = highlightSingleLine(cache.normalizedLines[i], cache.lang);\n\t}\n\tcache.all = true;\n}\nfunction updateWriteHighlightCacheIncremental(\n\tcache: WriteHighlightCache | undefined,\n\trawPath: string | null,\n\tfileContent: string,\n\texpanded: boolean,\n): WriteHighlightCache | undefined {\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tif (!lang) return undefined;\n\tconst rebuild = expanded ? rebuildWriteHighlightCacheFull : rebuildWriteHighlightCacheCollapsed;\n\tif (!cache) return rebuild(rawPath, fileContent);\n\tif (cache.lang !== lang || cache.rawPath !== rawPath) return rebuild(rawPath, fileContent);\n\tif (!fileContent.startsWith(cache.rawContent)) return rebuild(rawPath, fileContent);\n\tif (cache.lineCount !== undefined && (expanded || fileContent.length !== cache.rawContent.length)) {\n\t\treturn rebuild(rawPath, fileContent);\n\t}\n\tif (expanded) highlightRemainingLines(cache);\n\tif (fileContent.length === cache.rawContent.length) return cache;\n\tif (!expanded) {\n\t\t// Collapsed: the lines are kept, and the first of them highlighted.\n\t\tconst added = replaceTabs(normalizeDisplayText(fileContent.slice(cache.rawContent.length))).split(\"\\n\");\n\t\tcache.rawContent = fileContent;\n\t\tcache.all = false;\n\t\tcache.complete = false;\n\t\tif (cache.normalizedLines.length === 0) cache.normalizedLines.push(\"\");\n\t\tconst lastLine = cache.normalizedLines.length - 1;\n\t\tcache.normalizedLines[lastLine] += added[0];\n\t\tfor (let i = 1; i < added.length; i++) cache.normalizedLines.push(added[i]);\n\t\trefreshWriteHighlightPrefix(cache);\n\t\t// (While the first lines are all the lines, every line is highlighted.)\n\t\tcache.all = cache.normalizedLines.length <= WRITE_PARTIAL_FULL_HIGHLIGHT_LINES;\n\t\treturn cache;\n\t}\n\n\tconst deltaRaw = fileContent.slice(cache.rawContent.length);\n\tconst deltaDisplay = normalizeDisplayText(deltaRaw);\n\tconst deltaNormalized = replaceTabs(deltaDisplay);\n\tcache.rawContent = fileContent;\n\tif (cache.normalizedLines.length === 0) {\n\t\tcache.normalizedLines.push(\"\");\n\t\tcache.highlightedLines.push(\"\");\n\t}\n\n\tconst segments = deltaNormalized.split(\"\\n\");\n\tconst lastIndex = cache.normalizedLines.length - 1;\n\tcache.normalizedLines[lastIndex] += segments[0];\n\tcache.highlightedLines[lastIndex] = highlightSingleLine(cache.normalizedLines[lastIndex], cache.lang);\n\tfor (let i = 1; i < segments.length; i++) {\n\t\tcache.normalizedLines.push(segments[i]);\n\t\tcache.highlightedLines.push(highlightSingleLine(segments[i], cache.lang));\n\t}\n\trefreshWriteHighlightPrefix(cache);\n\treturn cache;\n}\n/** The lines of a collapsed cache that are counted: without the empty lines at the end, as formatWriteCall() counts them. */\nfunction countCollapsedLines(cache: WriteHighlightCache): number {\n\tif (cache.lineCount !== undefined) return cache.lineCount;\n\tlet totalLines = cache.normalizedLines.length;\n\t// Without the empty lines at the end, unless an empty line is not empty once highlighted (in a language without a\n\t// highlighter, every line is colored).\n\tif (highlightSingleLine(\"\", cache.lang) === \"\") {\n\t\twhile (totalLines > 0 && cache.normalizedLines[totalLines - 1] === \"\") totalLines--;\n\t}\n\treturn totalLines;\n}\nfunction trimTrailingEmptyLines(lines: string[]): string[] {\n\tlet end = lines.length;\n\twhile (end > 0 && lines[end - 1] === \"\") {\n\t\tend--;\n\t}\n\treturn lines.slice(0, end);\n}\nfunction formatWriteCall(\n\targs: { path?: string; file_path?: string; content?: string } | undefined,\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n\tcache: WriteHighlightCache | undefined,\n\tcwd: string,\n): string {\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tconst fileContent = str(args?.content);\n\tconst pathDisplay = renderToolPath(rawPath, theme, cwd);\n\tlet text = `${theme.fg(\"toolTitle\", theme.bold(\"write\"))} ${pathDisplay}`;\n\n\tif (fileContent === null) {\n\t\ttext += `\\n\\n${theme.fg(\"error\", \"[invalid content arg - expected string]\")}`;\n\t} else if (fileContent) {\n\t\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\t\tlet totalLines: number;\n\t\tlet displayLines: string[];\n\t\tif (lang && cache && !cache.all && !options.expanded) {\n\t\t\t// Collapsed, with only the first lines highlighted. The lines are counted as they are when all are\n\t\t\t// highlighted.\n\t\t\ttotalLines = countCollapsedLines(cache);\n\t\t\tdisplayLines = cache.highlightedLines.slice(0, Math.min(WRITE_COLLAPSED_LINES, totalLines));\n\t\t} else {\n\t\t\tconst renderedLines = lang\n\t\t\t\t? (cache?.highlightedLines ?? highlightCode(replaceTabs(normalizeDisplayText(fileContent)), lang))\n\t\t\t\t: normalizeDisplayText(fileContent).split(\"\\n\");\n\t\t\tconst lines = trimTrailingEmptyLines(renderedLines);\n\t\t\ttotalLines = lines.length;\n\t\t\tdisplayLines = lines.slice(0, options.expanded ? lines.length : WRITE_COLLAPSED_LINES);\n\t\t}\n\t\tconst maxLines = options.expanded ? totalLines : WRITE_COLLAPSED_LINES;\n\t\tconst remaining = totalLines - maxLines;\n\t\ttext += `\\n\\n${displayLines.map((line) => (lang ? line : theme.fg(\"toolOutput\", replaceTabs(line)))).join(\"\\n\")}`;\n\t\tif (remaining > 0) {\n\t\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines, ${totalLines} total,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\t\t}\n\t}\n\n\treturn text;\n}\nfunction formatWriteResult(\n\tresult: { content: Array<{ type: string; text?: string; data?: string; mimeType?: string }>; isError?: boolean },\n\ttheme: Theme,\n): string | undefined {\n\tif (!result.isError) {\n\t\treturn undefined;\n\t}\n\tconst output = result.content\n\t\t.filter((c) => c.type === \"text\")\n\t\t.map((c) => c.text || \"\")\n\t\t.join(\"\\n\");\n\tif (!output) {\n\t\treturn undefined;\n\t}\n\treturn `\\n${theme.fg(\"error\", output)}`;\n}\n\nexport const writeRenderers: Pick<ToolRenderers, \"renderCall\" | \"renderResult\"> = {\n\trenderCall(args, theme, context) {\n\t\tconst renderArgs = args as { path?: string; file_path?: string; content?: string } | undefined;\n\t\tconst rawPath = str(renderArgs?.file_path ?? renderArgs?.path);\n\t\tconst fileContent = str(renderArgs?.content);\n\t\tconst component =\n\t\t\t(context.lastComponent as WriteCallRenderComponent | undefined) ?? new WriteCallRenderComponent();\n\t\tif (fileContent !== null) {\n\t\t\t// Expanded, the whole file is highlighted once it is complete. Collapsed, the first lines are, as they were\n\t\t\t// while it streamed in.\n\t\t\tif (!context.argsComplete) {\n\t\t\t\tcomponent.cache = updateWriteHighlightCacheIncremental(\n\t\t\t\t\tcomponent.cache,\n\t\t\t\t\trawPath,\n\t\t\t\t\tfileContent,\n\t\t\t\t\tcontext.expanded,\n\t\t\t\t);\n\t\t\t} else if (context.expanded) {\n\t\t\t\tcomponent.cache = rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\t\t\t} else {\n\t\t\t\tconst cache = component.cache;\n\t\t\t\tif (cache?.complete && !cache.all && cache.rawPath === rawPath && cache.rawContent === fileContent) {\n\t\t\t\t\trefreshWriteHighlightPrefix(cache);\n\t\t\t\t} else {\n\t\t\t\t\tcomponent.cache = rebuildWriteHighlightCacheCollapsed(rawPath, fileContent);\n\t\t\t\t\tif (component.cache) component.cache.complete = true;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tcomponent.cache = undefined;\n\t\t}\n\t\tconst cache = component.cache;\n\t\tif (cache && !cache.all && !context.expanded && !context.isPartial && cache.lineCount === undefined) {\n\t\t\tcache.lineCount = countCollapsedLines(cache);\n\t\t\tcache.normalizedLines = cache.normalizedLines.slice(0, WRITE_PARTIAL_FULL_HIGHLIGHT_LINES);\n\t\t}\n\t\tcomponent.setText(\n\t\t\tformatWriteCall(\n\t\t\t\trenderArgs,\n\t\t\t\t{ expanded: context.expanded, isPartial: context.isPartial },\n\t\t\t\ttheme,\n\t\t\t\tcomponent.cache,\n\t\t\t\tcontext.cwd,\n\t\t\t),\n\t\t);\n\t\treturn component;\n\t},\n\trenderResult(result, _options, theme, context) {\n\t\tconst output = formatWriteResult({ ...result, isError: context.isError }, theme);\n\t\tif (!output) {\n\t\t\tconst component = (context.lastComponent as Container | undefined) ?? new Container();\n\t\t\tcomponent.clear();\n\t\t\treturn component;\n\t\t}\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(output);\n\t\treturn text;\n\t},\n};\n\ndeclarePathHighlightingRenderers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ChB,eAAe,CACd,UAAU,EACV,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,EAC5D,KAAK,EACL,SAAS,CAAC,KAAK,EACf,SAAS,CAAC,WAAW,EACrB,OAAO,CAAC,GAAG,CACX,CACD,CAAC;QACF,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO;QAC5C,MAAM,MAAM,GAAG,iBAAiB,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;QACjF,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,MAAM,SAAS,GAAI,OAAO,CAAC,aAAuC,IAAI,IAAI,SAAS,EAAE,CAAC;YACtF,SAAS,CAAC,KAAK,EAAE,CAAC;YAClB,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,MAAM,IAAI,GAAI,OAAO,CAAC,aAAkC,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAC;AAEF,gCAAgC,CAAC,cAAc,CAAC,CAAC","sourcesContent":["// Derived from Pi-Bolt (MIT, Copyright (c) 2026 OpenSec (Pi-Bolt)), commit b93895d2; modified for HUMAIN Code CLI.\n/**\n * Presentation for the write tool.\n *\n * Renderers live apart from the implementation so a process that only displays tool output does not\n * load the execution path or its typebox parameter schema. `write.ts` spreads these into its\n * definition, so the tool's public shape is unchanged.\n */\n\nimport { Container, sanitizeTerminalText, Text } from \"@earendil-works/pi-tui\";\nimport { keyHint } from \"../../../modes/interactive/components/keybinding-hints.ts\";\nimport {\n\tCodeHighlighter,\n\tgetLanguageFromPath,\n\thighlightCode,\n\ttype Theme,\n} from \"../../../modes/interactive/theme/theme.ts\";\nimport type { ToolRenderers, ToolRenderResultOptions } from \"../../extensions/types.ts\";\nimport { normalizeDisplayText, renderToolPath, replaceTabs, str } from \"../render-utils.ts\";\nimport { declarePathHighlightingRenderers } from \"./highlighting.ts\";\n\ntype WriteHighlightCache = {\n\trawPath: string | null;\n\tlang: string;\n\trawContent: string;\n\tnormalizedLines: string[];\n\t/**\n\t * The lines highlighted. When the call is shown collapsed, only the first lines are: the lines after the ones that can\n\t * be shown are highlighted when the call is expanded (`all`), not as each one arrives and again when the file is\n\t * complete, which for a large file stops everything for as long as highlighting all of it takes.\n\t */\n\thighlightedLines: string[];\n\tall: boolean;\n\t/** Made from the complete file, not from the pieces it arrived in. */\n\tcomplete?: boolean;\n\t/**\n\t * Set once the call has its result and is shown collapsed: the count of lines shown when expanded, with\n\t * normalizedLines cut to the first lines. A collapsed call needs no more of them, and every write of a session stays in\n\t * the chat: keeping each file split into lines again holds more memory than the files themselves.\n\t */\n\tlineCount?: number;\n\tprefixSource?: string;\n};\nclass WriteCallRenderComponent extends Text {\n\t// Line by line highlighting of a call whose content is still streaming.\n\tcache?: WriteHighlightCache;\n\t// A streamed call highlights its first lines on every delta, which stop changing once the file is longer, and a\n\t// complete call highlights the whole file on every update and expand toggle. Either way the row reuses the last\n\t// highlighting; it also holds the only copy of a complete call's displayed source.\n\treadonly highlighter = new CodeHighlighter();\n\n\tconstructor() {\n\t\tsuper(\"\", 0, 0);\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\t// Theme changes invalidate the highlighted prefix as well as the rendered text.\n\t\tthis.cache = undefined;\n\t}\n}\nconst WRITE_PARTIAL_FULL_HIGHLIGHT_LINES = 50;\n/** The lines of a collapsed call that are shown. */\nconst WRITE_COLLAPSED_LINES = 10;\nfunction highlightSingleLine(line: string, lang: string): string {\n\tconst highlighted = highlightCode(line, lang);\n\treturn highlighted[0] ?? \"\";\n}\nfunction refreshWriteHighlightPrefix(cache: WriteHighlightCache, highlighter: CodeHighlighter): void {\n\tconst prefixCount = Math.min(WRITE_PARTIAL_FULL_HIGHLIGHT_LINES, cache.normalizedLines.length);\n\tif (prefixCount === 0) return;\n\tconst prefixSource = cache.normalizedLines.slice(0, prefixCount).join(\"\\n\");\n\tif (cache.prefixSource === prefixSource) return;\n\tcache.prefixSource = prefixSource;\n\tconst prefixHighlighted = highlighter.highlight(prefixSource, cache.lang);\n\tfor (let i = 0; i < prefixCount; i++) {\n\t\tcache.highlightedLines[i] =\n\t\t\tprefixHighlighted[i] ?? highlightSingleLine(cache.normalizedLines[i] ?? \"\", cache.lang);\n\t}\n}\nfunction rebuildWriteHighlightCacheFull(\n\trawPath: string | null,\n\tfileContent: string,\n\thighlighter: CodeHighlighter,\n): WriteHighlightCache | undefined {\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tif (!lang) return undefined;\n\tconst displayContent = normalizeDisplayText(fileContent);\n\tconst normalized = replaceTabs(displayContent);\n\treturn {\n\t\trawPath,\n\t\tlang,\n\t\trawContent: fileContent,\n\t\tnormalizedLines: normalized.split(\"\\n\"),\n\t\thighlightedLines: [...highlighter.highlight(normalized, lang)],\n\t\tall: true,\n\t\tcomplete: true,\n\t};\n}\n/** The cache for a call shown collapsed: the first lines highlighted, as they are while the file streams in. */\nfunction rebuildWriteHighlightCacheCollapsed(\n\trawPath: string | null,\n\tfileContent: string,\n\thighlighter: CodeHighlighter,\n): WriteHighlightCache | undefined {\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tif (!lang) return undefined;\n\tconst cache: WriteHighlightCache = {\n\t\trawPath,\n\t\tlang,\n\t\trawContent: fileContent,\n\t\tnormalizedLines: replaceTabs(normalizeDisplayText(fileContent)).split(\"\\n\"),\n\t\thighlightedLines: [],\n\t\tall: false,\n\t};\n\trefreshWriteHighlightPrefix(cache, highlighter);\n\tcache.all = cache.normalizedLines.length <= WRITE_PARTIAL_FULL_HIGHLIGHT_LINES;\n\treturn cache;\n}\n/** Highlights, each on its own, the lines after the first ones that a collapsed call left unhighlighted. */\nfunction highlightRemainingLines(cache: WriteHighlightCache): void {\n\tif (cache.all) return;\n\tfor (\n\t\tlet i = Math.min(WRITE_PARTIAL_FULL_HIGHLIGHT_LINES, cache.normalizedLines.length);\n\t\ti < cache.normalizedLines.length;\n\t\ti++\n\t) {\n\t\tcache.highlightedLines[i] = highlightSingleLine(cache.normalizedLines[i], cache.lang);\n\t}\n\tcache.all = true;\n}\nfunction updateWriteHighlightCacheIncremental(\n\tcache: WriteHighlightCache | undefined,\n\trawPath: string | null,\n\tfileContent: string,\n\texpanded: boolean,\n\thighlighter: CodeHighlighter,\n): WriteHighlightCache | undefined {\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tif (!lang) return undefined;\n\tif (\n\t\t!cache ||\n\t\tcache.lang !== lang ||\n\t\tcache.rawPath !== rawPath ||\n\t\t!fileContent.startsWith(cache.rawContent) ||\n\t\t(cache.lineCount !== undefined && (expanded || fileContent.length !== cache.rawContent.length))\n\t) {\n\t\treturn expanded\n\t\t\t? rebuildWriteHighlightCacheFull(rawPath, fileContent, highlighter)\n\t\t\t: rebuildWriteHighlightCacheCollapsed(rawPath, fileContent, highlighter);\n\t}\n\tif (expanded) highlightRemainingLines(cache);\n\tif (fileContent.length === cache.rawContent.length) return cache;\n\tcache.complete = false;\n\tif (!expanded) {\n\t\t// Collapsed: the lines are kept, and the first of them highlighted.\n\t\tconst added = replaceTabs(normalizeDisplayText(fileContent.slice(cache.rawContent.length))).split(\"\\n\");\n\t\tcache.rawContent = fileContent;\n\t\tcache.all = false;\n\t\tif (cache.normalizedLines.length === 0) cache.normalizedLines.push(\"\");\n\t\tconst lastLine = cache.normalizedLines.length - 1;\n\t\tcache.normalizedLines[lastLine] += added[0];\n\t\tfor (let i = 1; i < added.length; i++) cache.normalizedLines.push(added[i]);\n\t\trefreshWriteHighlightPrefix(cache, highlighter);\n\t\t// (While the first lines are all the lines, every line is highlighted.)\n\t\tcache.all = cache.normalizedLines.length <= WRITE_PARTIAL_FULL_HIGHLIGHT_LINES;\n\t\treturn cache;\n\t}\n\n\tconst deltaRaw = fileContent.slice(cache.rawContent.length);\n\tconst deltaDisplay = normalizeDisplayText(deltaRaw);\n\tconst deltaNormalized = replaceTabs(deltaDisplay);\n\tcache.rawContent = fileContent;\n\tif (cache.normalizedLines.length === 0) {\n\t\tcache.normalizedLines.push(\"\");\n\t\tcache.highlightedLines.push(\"\");\n\t}\n\n\tconst segments = deltaNormalized.split(\"\\n\");\n\tconst lastIndex = cache.normalizedLines.length - 1;\n\tcache.normalizedLines[lastIndex] += segments[0];\n\tcache.highlightedLines[lastIndex] = highlightSingleLine(cache.normalizedLines[lastIndex], cache.lang);\n\tfor (let i = 1; i < segments.length; i++) {\n\t\tcache.normalizedLines.push(segments[i]);\n\t\tcache.highlightedLines.push(highlightSingleLine(segments[i], cache.lang));\n\t}\n\trefreshWriteHighlightPrefix(cache, highlighter);\n\treturn cache;\n}\n/** The lines of a collapsed cache that are counted: without the empty lines at the end, as formatWriteCall() counts them. */\nfunction countCollapsedLines(cache: WriteHighlightCache): number {\n\tif (cache.lineCount !== undefined) return cache.lineCount;\n\tlet totalLines = cache.normalizedLines.length;\n\t// Without the empty lines at the end, unless an empty line is not empty once highlighted (in a language without a\n\t// highlighter, every line is colored).\n\tif (highlightSingleLine(\"\", cache.lang) === \"\") {\n\t\twhile (totalLines > 0 && cache.normalizedLines[totalLines - 1] === \"\") totalLines--;\n\t}\n\treturn totalLines;\n}\nfunction trimTrailingEmptyLines(lines: readonly string[]): string[] {\n\tlet end = lines.length;\n\twhile (end > 0 && lines[end - 1] === \"\") {\n\t\tend--;\n\t}\n\treturn lines.slice(0, end);\n}\nfunction formatWriteCall(\n\targs: { path?: string; file_path?: string; content?: string } | undefined,\n\toptions: ToolRenderResultOptions,\n\ttheme: Theme,\n\tcache: WriteHighlightCache | undefined,\n\thighlighter: CodeHighlighter,\n\tcwd: string,\n): string {\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tconst fileContent = str(args?.content);\n\tconst pathDisplay = renderToolPath(rawPath, theme, cwd);\n\tlet text = `${theme.fg(\"toolTitle\", theme.bold(\"write\"))} ${pathDisplay}`;\n\n\tif (fileContent === null) {\n\t\ttext += `\\n\\n${theme.fg(\"error\", \"[invalid content arg - expected string]\")}`;\n\t} else if (fileContent) {\n\t\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\t\tlet totalLines: number;\n\t\tlet displayLines: string[];\n\t\tif (lang && cache && !cache.all && !options.expanded) {\n\t\t\t// Collapsed, with only the first lines highlighted. The lines are counted as they are when all are\n\t\t\t// highlighted.\n\t\t\ttotalLines = countCollapsedLines(cache);\n\t\t\tdisplayLines = cache.highlightedLines.slice(0, Math.min(WRITE_COLLAPSED_LINES, totalLines));\n\t\t} else {\n\t\t\tconst renderedLines = lang\n\t\t\t\t? (cache?.highlightedLines ?? highlighter.highlight(replaceTabs(normalizeDisplayText(fileContent)), lang))\n\t\t\t\t: normalizeDisplayText(fileContent).split(\"\\n\");\n\t\t\tconst lines = trimTrailingEmptyLines(renderedLines);\n\t\t\ttotalLines = lines.length;\n\t\t\tdisplayLines = lines.slice(0, options.expanded ? lines.length : WRITE_COLLAPSED_LINES);\n\t\t}\n\t\tconst maxLines = options.expanded ? totalLines : WRITE_COLLAPSED_LINES;\n\t\tconst remaining = totalLines - maxLines;\n\t\ttext += `\\n\\n${displayLines.map((line) => (lang ? line : theme.fg(\"toolOutput\", replaceTabs(line)))).join(\"\\n\")}`;\n\t\tif (remaining > 0) {\n\t\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines, ${totalLines} total,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\t\t}\n\t}\n\n\treturn text;\n}\nfunction formatWriteResult(\n\tresult: { content: Array<{ type: string; text?: string; data?: string; mimeType?: string }>; isError?: boolean },\n\ttheme: Theme,\n): string | undefined {\n\tif (!result.isError) {\n\t\treturn undefined;\n\t}\n\tconst output = result.content\n\t\t.filter((c) => c.type === \"text\")\n\t\t.map((c) => c.text || \"\")\n\t\t.join(\"\\n\");\n\tif (!output) {\n\t\treturn undefined;\n\t}\n\treturn `\\n${theme.fg(\"error\", sanitizeTerminalText(output))}`;\n}\n\nexport const writeRenderers: Pick<ToolRenderers, \"renderCall\" | \"renderResult\"> = {\n\trenderCall(args, theme, context) {\n\t\tconst renderArgs = args as { path?: string; file_path?: string; content?: string } | undefined;\n\t\tconst rawPath = str(renderArgs?.file_path ?? renderArgs?.path);\n\t\tconst fileContent = str(renderArgs?.content);\n\t\tconst component =\n\t\t\t(context.lastComponent as WriteCallRenderComponent | undefined) ?? new WriteCallRenderComponent();\n\t\tif (fileContent !== null) {\n\t\t\t// Expanded, the whole file is highlighted once it is complete. Collapsed, the first lines are, as they were\n\t\t\t// while it streamed in.\n\t\t\tif (!context.argsComplete) {\n\t\t\t\tcomponent.cache = updateWriteHighlightCacheIncremental(\n\t\t\t\t\tcomponent.cache,\n\t\t\t\t\trawPath,\n\t\t\t\t\tfileContent,\n\t\t\t\t\tcontext.expanded,\n\t\t\t\t\tcomponent.highlighter,\n\t\t\t\t);\n\t\t\t} else if (context.expanded) {\n\t\t\t\tconst cache = component.cache;\n\t\t\t\tif (!cache?.complete || !cache.all || cache.rawPath !== rawPath || cache.rawContent !== fileContent) {\n\t\t\t\t\tcomponent.cache = rebuildWriteHighlightCacheFull(rawPath, fileContent, component.highlighter);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst cache = component.cache;\n\t\t\t\tif (cache?.complete && !cache.all && cache.rawPath === rawPath && cache.rawContent === fileContent) {\n\t\t\t\t\trefreshWriteHighlightPrefix(cache, component.highlighter);\n\t\t\t\t} else {\n\t\t\t\t\tcomponent.cache = rebuildWriteHighlightCacheCollapsed(rawPath, fileContent, component.highlighter);\n\t\t\t\t\tif (component.cache) component.cache.complete = true;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tcomponent.cache = undefined;\n\t\t}\n\t\tconst cache = component.cache;\n\t\tif (cache && !cache.all && !context.expanded && !context.isPartial && cache.lineCount === undefined) {\n\t\t\tcache.lineCount = countCollapsedLines(cache);\n\t\t\tcache.normalizedLines = cache.normalizedLines.slice(0, WRITE_PARTIAL_FULL_HIGHLIGHT_LINES);\n\t\t}\n\t\tcomponent.setText(\n\t\t\tformatWriteCall(\n\t\t\t\trenderArgs,\n\t\t\t\t{ expanded: context.expanded, isPartial: context.isPartial },\n\t\t\t\ttheme,\n\t\t\t\tcomponent.cache,\n\t\t\t\tcomponent.highlighter,\n\t\t\t\tcontext.cwd,\n\t\t\t),\n\t\t);\n\t\treturn component;\n\t},\n\trenderResult(result, _options, theme, context) {\n\t\tconst output = formatWriteResult({ ...result, isError: context.isError }, theme);\n\t\tif (!output) {\n\t\t\tconst component = (context.lastComponent as Container | undefined) ?? new Container();\n\t\t\tcomponent.clear();\n\t\t\treturn component;\n\t\t}\n\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\ttext.setText(output);\n\t\treturn text;\n\t},\n};\n\ndeclarePathHighlightingRenderers(writeRenderers);\n"]}
|
|
@@ -18,6 +18,7 @@ import type { ToolDefinition } from "../extensions/types.ts";
|
|
|
18
18
|
import type { UsageEntry } from "../session-manager.ts";
|
|
19
19
|
export { SUBAGENT_DEPTH_ENV } from "./subagent-env.ts";
|
|
20
20
|
import { type SubagentIsolation, type SubagentMergeOutcome } from "./subagent-worktree.ts";
|
|
21
|
+
import { type TypeBoxAgentTool } from "./tool-definition-wrapper.ts";
|
|
21
22
|
export type AgentScope = "user" | "project" | "both";
|
|
22
23
|
export interface AgentConfig {
|
|
23
24
|
name: string;
|
|
@@ -193,21 +194,21 @@ declare const SubagentParams: Type.TObject<{
|
|
|
193
194
|
agent: Type.TOptional<Type.TString>;
|
|
194
195
|
task: Type.TOptional<Type.TString>;
|
|
195
196
|
model: Type.TOptional<Type.TString>;
|
|
196
|
-
thinking: Type.TOptional<Type.
|
|
197
|
+
thinking: Type.TOptional<Type.TEnum<["off", "minimal", "low", "medium", "high", "xhigh", "max"]>>;
|
|
197
198
|
tasks: Type.TOptional<Type.TArray<Type.TObject<{
|
|
198
199
|
agent: Type.TString;
|
|
199
200
|
task: Type.TString;
|
|
200
201
|
id: Type.TOptional<Type.TString>;
|
|
201
|
-
thinking: Type.TOptional<Type.
|
|
202
|
+
thinking: Type.TOptional<Type.TEnum<["off", "minimal", "low", "medium", "high", "xhigh", "max"]>>;
|
|
202
203
|
model: Type.TOptional<Type.TString>;
|
|
203
204
|
cwd: Type.TOptional<Type.TString>;
|
|
204
|
-
isolation: Type.TOptional<Type.
|
|
205
|
+
isolation: Type.TOptional<Type.TEnum<["shared", "worktree"]>>;
|
|
205
206
|
dependsOn: Type.TOptional<Type.TArray<Type.TString>>;
|
|
206
207
|
ownerPaths: Type.TOptional<Type.TArray<Type.TString>>;
|
|
207
208
|
onFailure: Type.TOptional<Type.TObject<{
|
|
208
209
|
retryWith: Type.TOptional<Type.TObject<{
|
|
209
210
|
model: Type.TOptional<Type.TString>;
|
|
210
|
-
thinking: Type.TOptional<Type.
|
|
211
|
+
thinking: Type.TOptional<Type.TEnum<["off", "minimal", "low", "medium", "high", "xhigh", "max"]>>;
|
|
211
212
|
}>>;
|
|
212
213
|
maxAttempts: Type.TOptional<Type.TInteger>;
|
|
213
214
|
}>>;
|
|
@@ -221,14 +222,14 @@ declare const SubagentParams: Type.TObject<{
|
|
|
221
222
|
agent: Type.TString;
|
|
222
223
|
task: Type.TString;
|
|
223
224
|
model: Type.TOptional<Type.TString>;
|
|
224
|
-
thinking: Type.TOptional<Type.
|
|
225
|
+
thinking: Type.TOptional<Type.TEnum<["off", "minimal", "low", "medium", "high", "xhigh", "max"]>>;
|
|
225
226
|
cwd: Type.TOptional<Type.TString>;
|
|
226
227
|
}>>>;
|
|
227
|
-
agentScope: Type.TOptional<Type.
|
|
228
|
+
agentScope: Type.TOptional<Type.TEnum<["user", "project", "both"]>>;
|
|
228
229
|
confirmProjectAgents: Type.TOptional<Type.TBoolean>;
|
|
229
230
|
cwd: Type.TOptional<Type.TString>;
|
|
230
|
-
isolation: Type.TOptional<Type.
|
|
231
|
+
isolation: Type.TOptional<Type.TEnum<["shared", "worktree"]>>;
|
|
231
232
|
}>;
|
|
232
233
|
export declare function createSubagentToolDefinition(cwd: string): ToolDefinition<typeof SubagentParams, SubagentDetails>;
|
|
233
|
-
export declare function createSubagentTool(cwd: string):
|
|
234
|
+
export declare function createSubagentTool(cwd: string): TypeBoxAgentTool<typeof SubagentParams, SubagentDetails>;
|
|
234
235
|
//# sourceMappingURL=subagent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagent.d.ts","sourceRoot":"","sources":["../../../src/core/tools/subagent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,OAAO,KAAK,EAAO,OAAO,EAAgB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"subagent.d.ts","sourceRoot":"","sources":["../../../src/core/tools/subagent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,OAAO,KAAK,EAAO,OAAO,EAAgB,MAAM,uBAAuB,CAAC;AAOxE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAM/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AA4BxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,EAGN,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAEzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,KAAK,gBAAgB,EAAsB,MAAM,8BAA8B,CAAC;AAQzF,MAAM,MAAM,UAAU,GAAG,MA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AK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAkED,uHAAuH;AACvH,eAAO,MAAM,mBAAmB,wCAAwC,CAAC;AAkDzE,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBlB,CAAC;AAwRH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,cAAc,EAAE,eAAe,CAAC,CA83BhH;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC,OAAO,cAAc,EAAE,eAAe,CAAC,CAExG"}
|
|
@@ -15,7 +15,6 @@ import { spawn } from "node:child_process";
|
|
|
15
15
|
import * as fs from "node:fs";
|
|
16
16
|
import * as os from "node:os";
|
|
17
17
|
import * as path from "node:path";
|
|
18
|
-
import { StringEnum } from "@earendil-works/pi-ai";
|
|
19
18
|
import { Container, Markdown, Spacer, Text } from "@earendil-works/pi-tui";
|
|
20
19
|
import { SUBAGENT_PROGRESS_MAX_WORKERS_PER_RUN, } from "@humain/humain-code-contracts";
|
|
21
20
|
import { Type } from "typebox";
|
|
@@ -977,7 +976,8 @@ async function runSingleAgent(defaultCwd, agents, agentDiagnostics, agentName, t
|
|
|
977
976
|
options.traceChild?.finishAttempt(currentResult, isFailedResult(currentResult));
|
|
978
977
|
return currentResult;
|
|
979
978
|
}
|
|
980
|
-
const ThinkingLevelSchema =
|
|
979
|
+
const ThinkingLevelSchema = Type.Enum(["off", "minimal", "low", "medium", "high", "xhigh", "max"], {
|
|
980
|
+
type: "string",
|
|
981
981
|
description: "Reasoning effort for this child. Maps to the CLI --thinking level. Defaults to the child's own default.",
|
|
982
982
|
});
|
|
983
983
|
const TaskItem = Type.Object({
|
|
@@ -989,7 +989,8 @@ const TaskItem = Type.Object({
|
|
|
989
989
|
description: "Optional canonical provider/model for this child. Defaults to the parent provider/model.",
|
|
990
990
|
})),
|
|
991
991
|
cwd: Type.Optional(Type.String({ description: "Working directory for the agent process" })),
|
|
992
|
-
isolation: Type.Optional(
|
|
992
|
+
isolation: Type.Optional(Type.Enum(["shared", "worktree"], {
|
|
993
|
+
type: "string",
|
|
993
994
|
description: "Filesystem isolation for this child. 'worktree' runs it in a disposable git worktree and merges its changes back; the caller's policy sets this, not the model.",
|
|
994
995
|
})),
|
|
995
996
|
dependsOn: Type.Optional(Type.Array(Type.String(), {
|
|
@@ -1054,7 +1055,8 @@ const ChainItem = Type.Object({
|
|
|
1054
1055
|
thinking: Type.Optional(ThinkingLevelSchema),
|
|
1055
1056
|
cwd: Type.Optional(Type.String({ description: "Working directory for the agent process" })),
|
|
1056
1057
|
});
|
|
1057
|
-
const AgentScopeSchema =
|
|
1058
|
+
const AgentScopeSchema = Type.Enum(["user", "project", "both"], {
|
|
1059
|
+
type: "string",
|
|
1058
1060
|
description: 'Which agent directories to use. Default: "user". Use "both" to include project-local agents.',
|
|
1059
1061
|
default: "user",
|
|
1060
1062
|
});
|
|
@@ -1070,7 +1072,8 @@ const SubagentParams = Type.Object({
|
|
|
1070
1072
|
agentScope: Type.Optional(AgentScopeSchema),
|
|
1071
1073
|
confirmProjectAgents: Type.Optional(Type.Boolean({ description: "Prompt before running project-local agents. Default: true.", default: true })),
|
|
1072
1074
|
cwd: Type.Optional(Type.String({ description: "Working directory for the agent process (single mode)" })),
|
|
1073
|
-
isolation: Type.Optional(
|
|
1075
|
+
isolation: Type.Optional(Type.Enum(["shared", "worktree"], {
|
|
1076
|
+
type: "string",
|
|
1074
1077
|
description: "Filesystem isolation for this child. 'worktree' runs it in a disposable git worktree and merges its changes back; the caller's policy sets this, not the model.",
|
|
1075
1078
|
})),
|
|
1076
1079
|
});
|