@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
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
+
import{combineAbortSignals}from"./chunk-L6Z6JKKC.js";import{shortHash}from"./chunk-PJACZCIR.js";import{cacheJsonSerialization}from"./chunk-Q7VXYXY3.js";import{buildBaseOptions,getJsonSchemaToolParameters,resolveJsonSchemaStrictSampling,transformMessages}from"./chunk-T3KDZFM4.js";import{hasIncompleteUsage}from"./chunk-YTVFIA3A.js";import{sanitizeSurrogates}from"./chunk-L2ZPNLYD.js";import{truncateErrorText}from"./chunk-TEOMXMW6.js";import{createRequestObserver,
|
|
3
|
+
headersToRecord}from"./chunk-5JSLXC2A.js";import{ToolCallArgumentsStream}from"./chunk-NN53K2QQ.js";import{calculateCost,clampThinkingLevel,getCurrentTools,resolveTranscript}from"./chunk-EDONIPUJ.js";import{AssistantMessageEventStream}from"./chunk-IJYVMOB4.js";import{getIdentityHeaders,getSystemMessageText,renderSystemMessageUpdate}from"./chunk-XMZGB3H4.js";import"./chunk-JXWJOIH4.js";var MISTRAL_TOOL_CALL_ID_LENGTH=9,MAX_MISTRAL_ERROR_BODY_CHARS=4e3,stream=(model,context,options)=>{let stream2=new AssistantMessageEventStream,normalizedContext=resolveTranscript(context,model.compat?.supportsMidConvoSystemMessages);return(async()=>{let output=createOutput(model);try{let apiKey=options?.apiKey;if(!apiKey)throw new Error(`No API key for provider: ${model.provider}`);let normalizeMistralToolCallId=createMistralToolCallIdNormalizer(),transformedMessages=transformMessages(normalizedContext.
|
|
4
|
+
messages,model,id=>normalizeMistralToolCallId(id)),payload=buildChatPayload(model,normalizedContext,transformedMessages,options),onPayload=options?.onPayload,nextPayload=await onPayload?.call(options,payload,model);nextPayload!==void 0&&(payload=nextPayload);let mistralStream=await requestMistralStream(model,payload,apiKey,!!onPayload,options);if(stream2.push({type:"start",partial:output}),await consumeChatStream(model,output,stream2,mistralStream,options?.onProviderStreamEvent),options?.signal?.
|
|
5
|
+
aborted)throw new Error("Request was aborted");if(output.stopReason==="pending")throw new Error("Mistral stream ended without a finish reason");if(output.stopReason==="aborted"||output.stopReason==="error")throw new Error(output.errorMessage||"An unknown error occurred");stream2.push({type:"done",reason:output.stopReason,message:output}),stream2.end()}catch(error){output.usage.usageIncomplete=!0,output.stopReason=options?.signal?.aborted?"aborted":"error",output.errorMessage=formatMistralError(error),
|
|
6
|
+
stream2.push({type:"error",reason:output.stopReason,error:output}),stream2.end()}})(),stream2},streamSimple=(model,context,options)=>{let apiKey=options?.apiKey;if(!apiKey)throw new Error(`No API key for provider: ${model.provider}`);let base={...buildBaseOptions(model,context,options,apiKey),toolChoice:options?.toolChoice},clampedReasoning=options?.reasoning?clampThinkingLevel(model,options.reasoning):void 0,reasoning=clampedReasoning==="off"?void 0:clampedReasoning,effortMap=model.reasoning?model.
|
|
7
|
+
thinkingLevelMap:void 0,reasoningEffort=effortMap?reasoning?effortMap[reasoning]??"high":effortMap.off??void 0:void 0;return stream(model,context,{...base,promptMode:model.reasoning&&!effortMap&&reasoning?"reasoning":void 0,reasoningEffort})};function createOutput(model){return{role:"assistant",content:[],api:model.api,provider:model.provider,model:model.id,usage:{usageIncomplete:!0,input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},
|
|
8
|
+
stopReason:"pending",timestamp:Date.now()}}function createMistralToolCallIdNormalizer(){let idMap=new Map,reverseMap=new Map;return id=>{let existing=idMap.get(id);if(existing)return existing;let attempt=0;for(;;){let candidate=deriveMistralToolCallId(id,attempt),owner=reverseMap.get(candidate);if(!owner||owner===id)return idMap.set(id,candidate),reverseMap.set(candidate,id),candidate;attempt++}}}function deriveMistralToolCallId(id,attempt){let normalized=id.replace(/[^a-zA-Z0-9]/g,"");if(attempt===
|
|
9
|
+
0&&normalized.length===MISTRAL_TOOL_CALL_ID_LENGTH)return normalized;let seedBase=normalized||id,seed=attempt===0?seedBase:`${seedBase}:${attempt}`;return shortHash(seed).replace(/[^a-zA-Z0-9]/g,"").slice(0,MISTRAL_TOOL_CALL_ID_LENGTH)}function formatMistralError(error){if(error instanceof Error){let httpError=error,statusCode=typeof httpError.statusCode=="number"?httpError.statusCode:void 0,bodyText=typeof httpError.body=="string"?httpError.body.trim():void 0;return statusCode!==void 0&&bodyText?
|
|
10
|
+
`Mistral API error (${statusCode}): ${truncateErrorText(bodyText,MAX_MISTRAL_ERROR_BODY_CHARS)}`:statusCode!==void 0?`Mistral API error (${statusCode}): ${error.message}`:error.message}return safeJsonStringify(error)}function safeJsonStringify(value){try{let serialized=JSON.stringify(value);return serialized===void 0?String(value):serialized}catch{return String(value)}}async function requestMistralStream(model,payload,apiKey,usedPayloadHook,options){let baseUrl=new URL(model.baseUrl);baseUrl.pathname=
|
|
11
|
+
`${baseUrl.pathname.replace(/\/+$/u,"")}/`;let url=new URL("v1/chat/completions",baseUrl),headers=buildMistralHeaders(model,apiKey,options),wirePayload=toMistralWirePayload(payload);usedPayloadHook||cacheJsonSerialization(wirePayload.messages);let body=JSON.stringify(wirePayload);await createRequestObserver(options,{api:model.api,provider:model.provider,model:model.id,operation:"chat"})(body);let timeoutMs=options?.timeoutMs??6e4,headerTimeoutSignal=AbortSignal.timeout(timeoutMs),combinedSignal=combineAbortSignals(
|
|
12
|
+
[options?.signal,headerTimeoutSignal]),response;try{response=await(options?.fetch??globalThis.fetch)(url,{method:"POST",headers,body,signal:combinedSignal.signal})}catch(error){throw headerTimeoutSignal.aborted&&!options?.signal?.aborted?new Error(`Mistral response headers timed out after ${timeoutMs}ms`):error}finally{combinedSignal.cleanup()}if(await options?.onResponse?.({status:response.status,headers:headersToRecord(response.headers)},model),!response.ok){let body2=await response.text();throw new MistralHttpError(
|
|
13
|
+
response.status,body2,response.statusText)}if(!response.body)throw new Error("Mistral response has no body");return readMistralEvents(response.body,options?.signal)}var MistralHttpError=class extends Error{statusCode;body;constructor(statusCode,body,statusText){super(statusText||`Request failed with status ${statusCode}`),this.name="MistralHttpError",this.statusCode=statusCode,this.body=body}};function buildMistralHeaders(model,apiKey,options){let headers=new Headers({...getIdentityHeaders(model,
|
|
14
|
+
options?.identity),accept:"text/event-stream",authorization:`Bearer ${apiKey}`,"content-type":"application/json"});applyMistralHeaderOverrides(headers,model.headers),applyMistralHeaderOverrides(headers,options?.headers);let hasExplicitAffinity=hasMistralHeaderOverride(model.headers,"x-affinity")||hasMistralHeaderOverride(options?.headers,"x-affinity");return shouldUsePromptCaching(options)&&!hasExplicitAffinity&&headers.set("x-affinity",options.sessionId),headers}function applyMistralHeaderOverrides(headers,overrides){
|
|
15
|
+
if(overrides)for(let[name,value]of Object.entries(overrides))value===null?headers.delete(name):headers.set(name,value)}function hasMistralHeaderOverride(overrides,target){return!!overrides&&Object.keys(overrides).some(name=>name.toLowerCase()===target)}function toMistralWirePayload(payload){let wirePayload={...payload};for(let[source,target]of[["topP","top_p"],["maxTokens","max_tokens"],["randomSeed","random_seed"],["responseFormat","response_format"],["toolChoice","tool_choice"],["presencePenal\
|
|
16
|
+
ty","presence_penalty"],["frequencyPenalty","frequency_penalty"],["parallelToolCalls","parallel_tool_calls"],["reasoningEffort","reasoning_effort"],["promptMode","prompt_mode"],["promptCacheKey","prompt_cache_key"],["safePrompt","safe_prompt"]])remapMistralProperty(wirePayload,source,target);wirePayload.messages=payload.messages.map(message=>toMistralWireMessage(message));let responseFormat=wirePayload.response_format;if(isMistralRecord(responseFormat)){let wireResponseFormat={...responseFormat};
|
|
17
|
+
remapMistralProperty(wireResponseFormat,"jsonSchema","json_schema");let jsonSchema=wireResponseFormat.json_schema;if(isMistralRecord(jsonSchema)){let wireJsonSchema={...jsonSchema};remapMistralProperty(wireJsonSchema,"schemaDefinition","schema"),wireResponseFormat.json_schema=wireJsonSchema}wirePayload.response_format=wireResponseFormat}return wirePayload}function toMistralWireMessage(message){let wireMessage={...message};return remapMistralProperty(wireMessage,"toolCalls","tool_calls"),remapMistralProperty(
|
|
18
|
+
wireMessage,"toolCallId","tool_call_id"),Array.isArray(message.content)&&(wireMessage.content=message.content.map(chunk=>toMistralWireContentChunk(chunk))),wireMessage}function toMistralWireContentChunk(chunk){let wireChunk={...chunk};for(let[source,target]of[["imageUrl","image_url"],["documentUrl","document_url"],["documentName","document_name"],["fileId","file_id"],["referenceIds","reference_ids"],["inputAudio","input_audio"]])remapMistralProperty(wireChunk,source,target);return wireChunk}function remapMistralProperty(record,source,target){
|
|
19
|
+
source in record&&(record[target]=record[source],delete record[source])}function isMistralRecord(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)}var MISTRAL_STREAM_DONE=Symbol("mistral-stream-done");async function*readMistralEvents(body,signal){let reader=body.getReader(),decoder=new TextDecoder,buffer="",onAbort=()=>{reader.cancel().catch(()=>{})};signal?.addEventListener("abort",onAbort,{once:!0});try{for(;;){if(signal?.aborted)throw signal.reason;let{done,value}=await reader.
|
|
20
|
+
read();if(signal?.aborted)throw signal.reason;buffer+=done?decoder.decode():decoder.decode(value,{stream:!0});let boundary=findMistralEventBoundary(buffer);for(;boundary;){let event=parseMistralEvent(buffer.slice(0,boundary.index));if(buffer=buffer.slice(boundary.index+boundary.length),event===MISTRAL_STREAM_DONE)return;event&&(yield event),boundary=findMistralEventBoundary(buffer)}if(done)break}if(buffer.trim()){let event=parseMistralEvent(buffer);event!==MISTRAL_STREAM_DONE&&event&&(yield event)}}finally{
|
|
21
|
+
signal?.removeEventListener("abort",onAbort);try{await reader.cancel()}catch{}try{reader.releaseLock()}catch{}}}function findMistralEventBoundary(buffer){let match=/\r\n\r\n|\r\n\r|\r\n\n|\r\r\n|\n\r\n|\r\r|\n\r|\n\n/u.exec(buffer);return match?.index===void 0?void 0:{index:match.index,length:match[0].length}}function parseMistralEvent(raw){let data=raw.split(/\r\n|\r|\n/u).filter(line=>line.startsWith("data:")).map(line=>line.slice(5).trimStart()).join(`
|
|
22
|
+
`).trim();if(!data)return;if(data==="[DONE]")return MISTRAL_STREAM_DONE;let parsed=JSON.parse(data);if(!isMistralRecord(parsed)||!Array.isArray(parsed.choices))throw new Error("Invalid Mistral streaming event");return{data:parsed}}function buildChatPayload(model,context,messages,options){let payload={model:model.id,stream:!0,messages:toChatMessages(messages,model.input.includes("image"))},currentTools=getCurrentTools(context.messages);return currentTools.length>0&&(payload.tools=toFunctionTools(
|
|
23
|
+
currentTools)),options?.temperature!==void 0&&(payload.temperature=options.temperature),options?.maxTokens!==void 0&&(payload.maxTokens=options.maxTokens),options?.toolChoice&&(payload.toolChoice=mapToolChoice(options.toolChoice)),options?.promptMode&&(payload.promptMode=options.promptMode),options?.reasoningEffort&&(payload.reasoningEffort=options.reasoningEffort),shouldUsePromptCaching(options)&&(payload.promptCacheKey=options.sessionId),payload}function shouldUsePromptCaching(options){return options?.
|
|
24
|
+
cacheRetention!=="none"&&!!options?.sessionId}function getMistralCachedPromptTokens(usage,promptTokens){let rawUsage=usage,cacheCounters=[rawUsage.promptTokensDetails?.cachedTokens,rawUsage.prompt_tokens_details?.cached_tokens,rawUsage.promptTokenDetails?.cachedTokens,rawUsage.prompt_token_details?.cached_tokens,rawUsage.numCachedTokens,rawUsage.num_cached_tokens],rawCachedTokens=cacheCounters.find(value=>value!=null),cachedTokens=typeof rawCachedTokens=="number"&&Number.isFinite(rawCachedTokens)?
|
|
25
|
+
rawCachedTokens:0;return{count:Math.min(promptTokens,Math.max(0,cachedTokens)),incomplete:hasIncompleteUsage([promptTokens-cachedTokens],cacheCounters)}}async function consumeChatStream(model,output,stream2,mistralStream,onProviderStreamEvent){let currentBlock=null,blocks=output.content,blockIndex=()=>blocks.length-1,toolCallsByKey=new Map,finishCurrentBlock=block=>{if(block){if(block.type==="text"){stream2.push({type:"text_end",contentIndex:blockIndex(),content:block.text,partial:output});return}
|
|
26
|
+
block.type==="thinking"&&stream2.push({type:"thinking_end",contentIndex:blockIndex(),content:block.thinking,partial:output})}};for await(let event of mistralStream){let chunk=event.data;if(await onProviderStreamEvent?.(chunk,model),output.responseId||=chunk.id,chunk.usage){let promptTokens=chunk.usage.prompt_tokens||0,cached=getMistralCachedPromptTokens(chunk.usage,promptTokens),cachedPromptTokens=cached.count;output.usage.usageIncomplete=cached.incomplete||hasIncompleteUsage([chunk.usage.prompt_tokens,
|
|
27
|
+
chunk.usage.completion_tokens],[chunk.usage.total_tokens]),output.usage.input=Math.max(0,promptTokens-cachedPromptTokens),output.usage.output=chunk.usage.completion_tokens||0,output.usage.cacheRead=cachedPromptTokens,output.usage.cacheWrite=0,output.usage.totalTokens=chunk.usage.total_tokens||output.usage.input+output.usage.output+output.usage.cacheRead+output.usage.cacheWrite,output.usage.usageIncomplete||=hasIncompleteUsage([output.usage.totalTokens]),calculateCost(model,output.usage)}let choice=chunk.
|
|
28
|
+
choices[0];if(!choice)continue;if(choice.finish_reason){output.rawStopReason=choice.finish_reason;let stopReasonResult=mapChatStopReason(choice.finish_reason);output.stopReason=stopReasonResult.stopReason,stopReasonResult.errorMessage&&(output.errorMessage=stopReasonResult.errorMessage)}let delta=choice.delta;if(delta.content!==null&&delta.content!==void 0){let contentItems=typeof delta.content=="string"?[delta.content]:delta.content;for(let item of contentItems){if(typeof item=="string"){let textDelta=sanitizeSurrogates(
|
|
29
|
+
item);if(!textDelta)continue;currentBlock?.type!=="text"&&(finishCurrentBlock(currentBlock),currentBlock={type:"text",text:""},output.content.push(currentBlock),stream2.push({type:"text_start",contentIndex:blockIndex(),partial:output})),currentBlock.text+=textDelta,stream2.push({type:"text_delta",contentIndex:blockIndex(),delta:textDelta,partial:output});continue}if(item.type==="thinking"){let deltaText=(item.thinking??[]).map(part=>part.text??"").filter(text=>text.length>0).join(""),thinkingDelta=sanitizeSurrogates(
|
|
30
|
+
deltaText);if(!thinkingDelta)continue;currentBlock?.type!=="thinking"&&(finishCurrentBlock(currentBlock),currentBlock={type:"thinking",thinking:""},output.content.push(currentBlock),stream2.push({type:"thinking_start",contentIndex:blockIndex(),partial:output})),currentBlock.thinking+=thinkingDelta,stream2.push({type:"thinking_delta",contentIndex:blockIndex(),delta:thinkingDelta,partial:output});continue}if(item.type==="text"){let textDelta=sanitizeSurrogates(item.text??"");if(!textDelta)continue;
|
|
31
|
+
currentBlock?.type!=="text"&&(finishCurrentBlock(currentBlock),currentBlock={type:"text",text:""},output.content.push(currentBlock),stream2.push({type:"text_start",contentIndex:blockIndex(),partial:output})),currentBlock.text+=textDelta,stream2.push({type:"text_delta",contentIndex:blockIndex(),delta:textDelta,partial:output})}}}let toolCalls=delta.tool_calls||[];for(let toolCall of toolCalls){currentBlock&&(finishCurrentBlock(currentBlock),currentBlock=null);let callId=toolCall.id&&toolCall.id!==
|
|
32
|
+
"null"?toolCall.id:deriveMistralToolCallId(`toolcall:${toolCall.index??0}`,0),key=toolCall.index??callId,open=toolCallsByKey.get(key);open||(output.content.push({type:"toolCall",id:callId,name:toolCall.function.name,arguments:{}}),open={contentIndex:output.content.length-1,arguments:new ToolCallArgumentsStream},toolCallsByKey.set(key,open),stream2.push({type:"toolcall_start",contentIndex:open.contentIndex,partial:output}));let argsDelta=typeof toolCall.function.arguments=="string"?toolCall.function.
|
|
33
|
+
arguments:JSON.stringify(toolCall.function.arguments||{});output.content[open.contentIndex].arguments=open.arguments.append(argsDelta),stream2.push({type:"toolcall_delta",contentIndex:open.contentIndex,delta:argsDelta,partial:output})}}finishCurrentBlock(currentBlock);for(let open of toolCallsByKey.values()){let block=output.content[open.contentIndex];Object.assign(block,open.arguments.finish()),stream2.push({type:"toolcall_end",contentIndex:open.contentIndex,toolCall:block,partial:output})}}function toFunctionTools(tools){
|
|
34
|
+
return tools.map(tool=>{let strict=resolveJsonSchemaStrictSampling(tool,!0);return{type:"function",function:{name:tool.name,description:tool.description,parameters:stripSymbolKeys(getJsonSchemaToolParameters(tool,strict)),strict:strict??!1}}})}function stripSymbolKeys(value){if(Array.isArray(value))return value.map(item=>stripSymbolKeys(item));if(value&&typeof value=="object"){let result={};for(let[key,entry]of Object.entries(value))result[key]=stripSymbolKeys(entry);return result}return value}function toChatMessages(messages,supportsImages){
|
|
35
|
+
let result=[];for(let[index,msg]of messages.entries()){if(msg.role==="system"){let text=index===0?getSystemMessageText(msg):renderSystemMessageUpdate(msg);text.length>0&&result.push({role:"system",content:sanitizeSurrogates(text)});continue}if(msg.role==="user"){if(typeof msg.content=="string"){result.push({role:"user",content:sanitizeSurrogates(msg.content)});continue}let hadImages=msg.content.some(item=>item.type==="image"),content=msg.content.filter(item=>item.type==="text"||supportsImages).map(
|
|
36
|
+
item=>item.type==="text"?{type:"text",text:sanitizeSurrogates(item.text)}:{type:"image_url",imageUrl:`data:${item.mimeType};base64,${item.data}`});if(content.length>0){result.push({role:"user",content});continue}hadImages&&!supportsImages&&result.push({role:"user",content:"(image omitted: model does not support images)"});continue}if(msg.role==="assistant"){let contentParts=[],toolCalls=[];for(let block of msg.content){if(block.type==="text"){block.text.trim().length>0&&contentParts.push({type:"\
|
|
37
|
+
text",text:sanitizeSurrogates(block.text)});continue}if(block.type==="thinking"){block.thinking.trim().length>0&&contentParts.push({type:"thinking",thinking:[{type:"text",text:sanitizeSurrogates(block.thinking)}]});continue}toolCalls.push({id:block.id,type:"function",function:{name:block.name,arguments:JSON.stringify(block.arguments||{})},index:0})}let assistantMessage={role:"assistant",prefix:!1};contentParts.length>0&&(assistantMessage.content=contentParts),toolCalls.length>0&&(assistantMessage.
|
|
38
|
+
toolCalls=toolCalls),(contentParts.length>0||toolCalls.length>0)&&result.push(assistantMessage);continue}let toolContent=[],textResult=msg.content.filter(part=>part.type==="text").map(part=>part.type==="text"?sanitizeSurrogates(part.text):"").join(`
|
|
39
|
+
`),hasImages=msg.content.some(part=>part.type==="image"),toolText=buildToolResultText(textResult,hasImages,supportsImages,msg.isError);toolContent.push({type:"text",text:toolText});for(let part of msg.content)supportsImages&&part.type==="image"&&toolContent.push({type:"image_url",imageUrl:`data:${part.mimeType};base64,${part.data}`});result.push({role:"tool",toolCallId:msg.toolCallId,name:msg.toolName,content:toolContent})}return result}function buildToolResultText(text,hasImages,supportsImages,isError){
|
|
40
|
+
let trimmed=text.trim(),errorPrefix=isError?"[tool error] ":"";return trimmed.length>0?`${errorPrefix}${trimmed}${hasImages&&!supportsImages?`
|
|
41
|
+
[tool image omitted: model does not support images]`:""}`:hasImages?supportsImages?isError?"[tool error] (see attached image)":"(see attached image)":isError?"[tool error] (image omitted: model does not support images)":"(image omitted: model does not support images)":isError?"[tool error] (no tool output)":"(no tool output)"}function mapToolChoice(choice){if(choice)return choice==="auto"||choice==="none"||choice==="any"||choice==="required"?choice:{type:"function",function:{name:choice.function.
|
|
42
|
+
name}}}function mapChatStopReason(reason){if(reason===null)return{stopReason:"stop"};switch(reason){case"stop":return{stopReason:"stop"};case"length":case"model_length":return{stopReason:"length"};case"tool_calls":return{stopReason:"toolUse"};case"error":return{stopReason:"error",errorMessage:"Provider stopped with: error (server error)"};default:return{stopReason:"error",errorMessage:`Provider stopped with: ${reason}`}}}export{stream,streamSimple};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{AnthropicError,DEFAULT_MEMORY_SYNC_INTERVAL_MS,MIN_MEMORY_SYNC_INTERVAL_MS,ToolError,__classPrivateFieldGet,__classPrivateFieldSet,checkMemorySyncInterval,decodeUTF8,encodeUTF8,isStatus,loggerFor,promiseWithResolvers}from"./chunk-
|
|
2
|
+
import{AnthropicError,DEFAULT_MEMORY_SYNC_INTERVAL_MS,MIN_MEMORY_SYNC_INTERVAL_MS,ToolError,__classPrivateFieldGet,__classPrivateFieldSet,checkMemorySyncInterval,decodeUTF8,encodeUTF8,isStatus,loggerFor,promiseWithResolvers}from"./chunk-RGUZULEE.js";import{child_process,crypto,fs,path,stream,util}from"./chunk-7ZC4UXSL.js";import"./chunk-JXWJOIH4.js";import*as fs4 from"node:fs/promises";import*as fssync from"node:fs";import*as path2 from"node:path";import*as cp from"node:child_process";import*as crypto2 from"node:crypto";import*as readline from"node:readline";function betaTool(options){let{name,inputSchema,description,run,...extraProps}=options;if(inputSchema.type!=="object")throw new Error(`JSON schema for tool "${name}" must be an object, but got ${inputSchema.type}`);return{...extraProps,type:"custom",name,input_schema:inputSchema,description,run,parse:content=>content}}var fs2=fs.promises,DIR_CREATE_MODE=448,FILE_CREATE_MODE=384;function isWithin(root,p){let rel=path.relative(root,p);return rel===""||!rel.startsWith(".."+path.sep)&&rel!==".."&&!path.isAbsolute(rel)}async function containingRoot(roots,target){for(let root of roots)if(isWithin(await canonicalize(path.resolve(root)),target))return root}var MAX_SYMLINK_HOPS=40;function errnoCode(err){let code=err?.code;return typeof code=="string"?code:void 0}async function canonicalize(abs){let tail=[],prefix=abs,
|
|
3
3
|
hops=0;for(;;){let real;try{real=await fs2.realpath(prefix)}catch(realpathErr){let isLink;try{isLink=(await fs2.lstat(prefix)).isSymbolicLink()}catch(lstatErr){let code=errnoCode(lstatErr);if(code!=="ENOENT"&&code!=="ENOTDIR")throw lstatErr;let parent=path.dirname(prefix);if(parent===prefix)throw lstatErr;tail.push(path.basename(prefix)),prefix=parent;continue}if(!isLink)throw realpathErr;if(++hops>MAX_SYMLINK_HOPS)throw Object.assign(new Error("too many levels of symbolic links"),{code:"ELOOP"});
|
|
4
4
|
prefix=path.resolve(path.dirname(prefix),await fs2.readlink(prefix));continue}return tail.length?path.join(real,...tail.reverse()):real}}async function confineToRoot(root,p,opts){let allowedRoots=opts?.allowedRoots??[],realRoot=await canonicalize(path.resolve(root)),real;try{real=await canonicalize(path.resolve(realRoot,p))}catch(err){throw new ToolError(fsErrorMessage(err,`path ${JSON.stringify(p)}`))}if(isWithin(realRoot,real)||await containingRoot(allowedRoots,real)!==void 0)return real;let permitted=allowedRoots.
|
|
5
5
|
length?"the session's working directory and its other permitted directories":"the session's working directory";throw new ToolError(`path ${JSON.stringify(p)} is outside ${permitted}`)}async function atomicWriteFile(targetPath,content){let dir=path.dirname(targetPath),tempPath=path.join(dir,`.tmp-${process.pid}-${crypto.randomUUID()}`),existingMode=await fs2.stat(targetPath).then(st=>st.mode&511,()=>{}),handle;try{handle=await fs2.open(tempPath,"wx",FILE_CREATE_MODE),existingMode!==void 0&&await handle.
|