@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,160 @@
|
|
|
1
|
+
import { applyBackgroundToLine, renderedMarkdownGeneration, stripTerminalSequences, truncateToWidth, visibleWidth, } from "@earendil-works/pi-tui";
|
|
2
|
+
import { copyToClipboard } from "../../../utils/clipboard.js";
|
|
3
|
+
import { supportsLanguage } from "../../../utils/syntax-highlight.js";
|
|
4
|
+
import { theme } from "../theme/theme.js";
|
|
5
|
+
/** A fenced assistant block. Clipboard text never passes through highlighting or terminal layout. */
|
|
6
|
+
export class AssistantCodeBlock {
|
|
7
|
+
text;
|
|
8
|
+
language;
|
|
9
|
+
markdownTheme;
|
|
10
|
+
displayText;
|
|
11
|
+
wrapLine;
|
|
12
|
+
copyUnavailable;
|
|
13
|
+
changed;
|
|
14
|
+
copyFinished;
|
|
15
|
+
feedback = "Copy";
|
|
16
|
+
copying = false;
|
|
17
|
+
feedbackTimer;
|
|
18
|
+
copyColumn = 0;
|
|
19
|
+
copyRow = 0;
|
|
20
|
+
copyWidth = 0;
|
|
21
|
+
lineCache;
|
|
22
|
+
decorated = { widths: new Map() };
|
|
23
|
+
highlighted;
|
|
24
|
+
/** One bounded decoration cache per owning Markdown, surviving streamed component replacement. */
|
|
25
|
+
static renderer(markdownTheme, changed, copyFinished) {
|
|
26
|
+
const cache = { widths: new Map() };
|
|
27
|
+
return (block) => new AssistantCodeBlock(block, markdownTheme, changed, copyFinished, cache);
|
|
28
|
+
}
|
|
29
|
+
constructor(block, markdownTheme, changed, copyFinished, lineCache) {
|
|
30
|
+
this.lineCache = lineCache;
|
|
31
|
+
this.text = block.text;
|
|
32
|
+
this.wrapLine = block.wrapLine;
|
|
33
|
+
this.language =
|
|
34
|
+
stripTerminalSequences(block.language ?? "")
|
|
35
|
+
.replace(/\p{Cc}/gu, "")
|
|
36
|
+
.split(/\s+/)[0] || "Text";
|
|
37
|
+
this.displayText = block.displayText ?? block.text;
|
|
38
|
+
this.copyUnavailable = block.copyUnavailable ?? false;
|
|
39
|
+
this.markdownTheme = markdownTheme;
|
|
40
|
+
this.changed = changed;
|
|
41
|
+
this.copyFinished = copyFinished;
|
|
42
|
+
}
|
|
43
|
+
async copy() {
|
|
44
|
+
if (this.copying)
|
|
45
|
+
return;
|
|
46
|
+
this.copying = true;
|
|
47
|
+
clearTimeout(this.feedbackTimer);
|
|
48
|
+
this.feedback = "Copying";
|
|
49
|
+
this.changed();
|
|
50
|
+
let failure;
|
|
51
|
+
try {
|
|
52
|
+
if (this.copyUnavailable)
|
|
53
|
+
throw new Error("Original block source is ambiguous after Markdown transformation. Copy the original message instead.");
|
|
54
|
+
await copyToClipboard(this.text);
|
|
55
|
+
this.feedback = "Copied";
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
this.feedback = "Copy failed";
|
|
60
|
+
failure = error instanceof Error && error.message ? error.message : "Clipboard unavailable";
|
|
61
|
+
return failure;
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
this.copying = false;
|
|
65
|
+
this.copyFinished(failure);
|
|
66
|
+
this.changed();
|
|
67
|
+
this.feedbackTimer = setTimeout(() => {
|
|
68
|
+
this.feedback = "Copy";
|
|
69
|
+
this.changed();
|
|
70
|
+
}, 2000);
|
|
71
|
+
this.feedbackTimer.unref?.();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
render(width) {
|
|
75
|
+
if (width <= 0)
|
|
76
|
+
return [];
|
|
77
|
+
const generation = renderedMarkdownGeneration();
|
|
78
|
+
const cache = this.lineCache;
|
|
79
|
+
for (const entry of [cache, this.decorated]) {
|
|
80
|
+
if (entry.generation !== generation) {
|
|
81
|
+
entry.widths.clear();
|
|
82
|
+
entry.generation = generation;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const previousLines = cache.widths.get(width);
|
|
86
|
+
const borderWidth = width >= 3 ? 1 : 0;
|
|
87
|
+
const padding = width >= 8 ? 1 : 0;
|
|
88
|
+
const inside = width - borderWidth * 2;
|
|
89
|
+
const contentWidth = Math.max(1, inside - padding * 2);
|
|
90
|
+
const border = (text) => theme.fg("borderMuted", text);
|
|
91
|
+
const row = (text) => borderWidth
|
|
92
|
+
? border("│") + applyBackgroundToLine(text, inside, (line) => theme.bg("userMessageBg", line)) + border("│")
|
|
93
|
+
: applyBackgroundToLine(text, inside, (line) => theme.bg("userMessageBg", line));
|
|
94
|
+
const lines = [];
|
|
95
|
+
if (borderWidth)
|
|
96
|
+
lines.push(border(`┌${"─".repeat(inside)}┐`));
|
|
97
|
+
const action = truncateToWidth(this.feedback, contentWidth, "");
|
|
98
|
+
const labelWidth = Math.max(0, contentWidth - visibleWidth(action) - 1);
|
|
99
|
+
const label = truncateToWidth(this.language, labelWidth, "");
|
|
100
|
+
this.copyColumn = borderWidth + padding + contentWidth - visibleWidth(action);
|
|
101
|
+
this.copyRow = lines.length;
|
|
102
|
+
this.copyWidth = visibleWidth(action);
|
|
103
|
+
const header = `${" ".repeat(padding)}${theme.fg("muted", label)}${" ".repeat(contentWidth - visibleWidth(label) - visibleWidth(action))}${theme.fg(this.feedback === "Copy failed" ? "error" : "muted", action)}${" ".repeat(padding)}`;
|
|
104
|
+
lines.push(row(header));
|
|
105
|
+
const recognized = this.language.toLowerCase() !== "text" && supportsLanguage(this.language);
|
|
106
|
+
const formatter = this.markdownTheme.highlightCode;
|
|
107
|
+
if (!this.highlighted ||
|
|
108
|
+
this.highlighted.generation !== generation ||
|
|
109
|
+
this.highlighted.formatter !== formatter ||
|
|
110
|
+
this.highlighted.recognized !== recognized) {
|
|
111
|
+
this.decorated.widths.clear();
|
|
112
|
+
// Tabs expand for display only. Drop one structural final newline, not blank content lines.
|
|
113
|
+
const display = stripTerminalSequences(this.displayText)
|
|
114
|
+
.replace(/\r\n|\r/g, "\n")
|
|
115
|
+
.replace(/\n$/, "")
|
|
116
|
+
.replace(/\t/g, " ")
|
|
117
|
+
.replace(/\p{Cc}/gu, (character) => (character === "\n" ? "\n" : ""));
|
|
118
|
+
this.highlighted = {
|
|
119
|
+
generation,
|
|
120
|
+
formatter,
|
|
121
|
+
recognized,
|
|
122
|
+
lines: recognized && formatter
|
|
123
|
+
? formatter.call(this.markdownTheme, display, this.language)
|
|
124
|
+
: display.split("\n").map((line) => theme.fg("text", line)),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
const nextLines = this.decorated.widths.get(width) ?? new Map();
|
|
128
|
+
for (const line of this.highlighted.lines) {
|
|
129
|
+
let decorated = nextLines.get(line) ?? previousLines?.get(line);
|
|
130
|
+
if (!decorated) {
|
|
131
|
+
decorated = this.wrapLine(line, contentWidth).map((wrapped) => row(`${" ".repeat(padding)}${truncateToWidth(wrapped, contentWidth, "")}${" ".repeat(padding)}`));
|
|
132
|
+
}
|
|
133
|
+
nextLines.set(line, decorated);
|
|
134
|
+
lines.push(...decorated);
|
|
135
|
+
}
|
|
136
|
+
for (const entry of [cache, this.decorated]) {
|
|
137
|
+
entry.widths.delete(width);
|
|
138
|
+
entry.widths.set(width, nextLines);
|
|
139
|
+
if (entry.widths.size > 2)
|
|
140
|
+
entry.widths.delete(entry.widths.keys().next().value);
|
|
141
|
+
}
|
|
142
|
+
if (borderWidth)
|
|
143
|
+
lines.push(border(`└${"─".repeat(inside)}┘`));
|
|
144
|
+
return lines;
|
|
145
|
+
}
|
|
146
|
+
handleMouse(event) {
|
|
147
|
+
if (event.type !== "click" || event.button !== "left" || event.shift || event.alt || event.ctrl)
|
|
148
|
+
return undefined;
|
|
149
|
+
if (event.y !== this.copyRow || event.x < this.copyColumn || event.x >= this.copyColumn + this.copyWidth)
|
|
150
|
+
return undefined;
|
|
151
|
+
void this.copy();
|
|
152
|
+
return { handled: true };
|
|
153
|
+
}
|
|
154
|
+
invalidate() {
|
|
155
|
+
this.highlighted = undefined;
|
|
156
|
+
this.decorated.widths.clear();
|
|
157
|
+
this.lineCache.widths.clear();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=assistant-code-block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant-code-block.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,KAAK,EAAE,CAAC;IAC/B,CAAC;CACD","sourcesContent":["import {\n\tapplyBackgroundToLine,\n\ttype Component,\n\ttype MarkdownCodeBlock,\n\ttype MarkdownOptions,\n\ttype MarkdownTheme,\n\trenderedMarkdownGeneration,\n\tstripTerminalSequences,\n\ttype TuiMouseEvent,\n\ttype TuiMouseEventResult,\n\ttruncateToWidth,\n\tvisibleWidth,\n} from \"@earendil-works/pi-tui\";\nimport { copyToClipboard } from \"../../../utils/clipboard.ts\";\nimport { supportsLanguage } from \"../../../utils/syntax-highlight.ts\";\nimport { theme } from \"../theme/theme.ts\";\n\ninterface CodeLineCache {\n\tgeneration?: number;\n\twidths: Map<number, Map<string, readonly string[]>>;\n}\n\n/** A fenced assistant block. Clipboard text never passes through highlighting or terminal layout. */\nexport class AssistantCodeBlock implements Component {\n\treadonly text: string;\n\treadonly language: string;\n\tprivate markdownTheme: MarkdownTheme;\n\tprivate displayText: string;\n\tprivate wrapLine: MarkdownCodeBlock[\"wrapLine\"];\n\tprivate copyUnavailable: boolean;\n\tprivate changed: () => void;\n\tprivate copyFinished: (error?: string) => void;\n\tprivate feedback: \"Copy\" | \"Copying\" | \"Copied\" | \"Copy failed\" = \"Copy\";\n\tprivate copying = false;\n\tprivate feedbackTimer?: ReturnType<typeof setTimeout>;\n\tprivate copyColumn = 0;\n\tprivate copyRow = 0;\n\tprivate copyWidth = 0;\n\tprivate lineCache: CodeLineCache;\n\tprivate decorated: CodeLineCache = { widths: new Map() };\n\tprivate highlighted?: {\n\t\tgeneration: number;\n\t\tformatter: MarkdownTheme[\"highlightCode\"];\n\t\trecognized: boolean;\n\t\tlines: string[];\n\t};\n\n\t/** One bounded decoration cache per owning Markdown, surviving streamed component replacement. */\n\tstatic renderer(\n\t\tmarkdownTheme: MarkdownTheme,\n\t\tchanged: () => void,\n\t\tcopyFinished: (error?: string) => void,\n\t): NonNullable<MarkdownOptions[\"renderCodeBlock\"]> {\n\t\tconst cache: CodeLineCache = { widths: new Map() };\n\t\treturn (block) => new AssistantCodeBlock(block, markdownTheme, changed, copyFinished, cache);\n\t}\n\n\tconstructor(\n\t\tblock: MarkdownCodeBlock,\n\t\tmarkdownTheme: MarkdownTheme,\n\t\tchanged: () => void,\n\t\tcopyFinished: (error?: string) => void,\n\t\tlineCache: CodeLineCache,\n\t) {\n\t\tthis.lineCache = lineCache;\n\t\tthis.text = block.text;\n\t\tthis.wrapLine = block.wrapLine;\n\t\tthis.language =\n\t\t\tstripTerminalSequences(block.language ?? \"\")\n\t\t\t\t.replace(/\\p{Cc}/gu, \"\")\n\t\t\t\t.split(/\\s+/)[0] || \"Text\";\n\t\tthis.displayText = block.displayText ?? block.text;\n\t\tthis.copyUnavailable = block.copyUnavailable ?? false;\n\t\tthis.markdownTheme = markdownTheme;\n\t\tthis.changed = changed;\n\t\tthis.copyFinished = copyFinished;\n\t}\n\n\tasync copy(): Promise<true | string | undefined> {\n\t\tif (this.copying) return;\n\t\tthis.copying = true;\n\t\tclearTimeout(this.feedbackTimer);\n\t\tthis.feedback = \"Copying\";\n\t\tthis.changed();\n\t\tlet failure: string | undefined;\n\t\ttry {\n\t\t\tif (this.copyUnavailable)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Original block source is ambiguous after Markdown transformation. Copy the original message instead.\",\n\t\t\t\t);\n\t\t\tawait copyToClipboard(this.text);\n\t\t\tthis.feedback = \"Copied\";\n\t\t\treturn true;\n\t\t} catch (error) {\n\t\t\tthis.feedback = \"Copy failed\";\n\t\t\tfailure = error instanceof Error && error.message ? error.message : \"Clipboard unavailable\";\n\t\t\treturn failure;\n\t\t} finally {\n\t\t\tthis.copying = false;\n\t\t\tthis.copyFinished(failure);\n\t\t\tthis.changed();\n\t\t\tthis.feedbackTimer = setTimeout(() => {\n\t\t\t\tthis.feedback = \"Copy\";\n\t\t\t\tthis.changed();\n\t\t\t}, 2000);\n\t\t\tthis.feedbackTimer.unref?.();\n\t\t}\n\t}\n\n\trender(width: number): string[] {\n\t\tif (width <= 0) return [];\n\t\tconst generation = renderedMarkdownGeneration();\n\t\tconst cache = this.lineCache;\n\t\tfor (const entry of [cache, this.decorated]) {\n\t\t\tif (entry.generation !== generation) {\n\t\t\t\tentry.widths.clear();\n\t\t\t\tentry.generation = generation;\n\t\t\t}\n\t\t}\n\t\tconst previousLines = cache.widths.get(width);\n\t\tconst borderWidth = width >= 3 ? 1 : 0;\n\t\tconst padding = width >= 8 ? 1 : 0;\n\t\tconst inside = width - borderWidth * 2;\n\t\tconst contentWidth = Math.max(1, inside - padding * 2);\n\t\tconst border = (text: string) => theme.fg(\"borderMuted\", text);\n\t\tconst row = (text: string) =>\n\t\t\tborderWidth\n\t\t\t\t? border(\"│\") + applyBackgroundToLine(text, inside, (line) => theme.bg(\"userMessageBg\", line)) + border(\"│\")\n\t\t\t\t: applyBackgroundToLine(text, inside, (line) => theme.bg(\"userMessageBg\", line));\n\t\tconst lines: string[] = [];\n\t\tif (borderWidth) lines.push(border(`┌${\"─\".repeat(inside)}┐`));\n\t\tconst action = truncateToWidth(this.feedback, contentWidth, \"\");\n\t\tconst labelWidth = Math.max(0, contentWidth - visibleWidth(action) - 1);\n\t\tconst label = truncateToWidth(this.language, labelWidth, \"\");\n\t\tthis.copyColumn = borderWidth + padding + contentWidth - visibleWidth(action);\n\t\tthis.copyRow = lines.length;\n\t\tthis.copyWidth = visibleWidth(action);\n\t\tconst header = `${\" \".repeat(padding)}${theme.fg(\"muted\", label)}${\" \".repeat(contentWidth - visibleWidth(label) - visibleWidth(action))}${theme.fg(this.feedback === \"Copy failed\" ? \"error\" : \"muted\", action)}${\" \".repeat(padding)}`;\n\t\tlines.push(row(header));\n\t\tconst recognized = this.language.toLowerCase() !== \"text\" && supportsLanguage(this.language);\n\t\tconst formatter = this.markdownTheme.highlightCode;\n\t\tif (\n\t\t\t!this.highlighted ||\n\t\t\tthis.highlighted.generation !== generation ||\n\t\t\tthis.highlighted.formatter !== formatter ||\n\t\t\tthis.highlighted.recognized !== recognized\n\t\t) {\n\t\t\tthis.decorated.widths.clear();\n\t\t\t// Tabs expand for display only. Drop one structural final newline, not blank content lines.\n\t\t\tconst display = stripTerminalSequences(this.displayText)\n\t\t\t\t.replace(/\\r\\n|\\r/g, \"\\n\")\n\t\t\t\t.replace(/\\n$/, \"\")\n\t\t\t\t.replace(/\\t/g, \" \")\n\t\t\t\t.replace(/\\p{Cc}/gu, (character) => (character === \"\\n\" ? \"\\n\" : \"\"));\n\t\t\tthis.highlighted = {\n\t\t\t\tgeneration,\n\t\t\t\tformatter,\n\t\t\t\trecognized,\n\t\t\t\tlines:\n\t\t\t\t\trecognized && formatter\n\t\t\t\t\t\t? formatter.call(this.markdownTheme, display, this.language)\n\t\t\t\t\t\t: display.split(\"\\n\").map((line) => theme.fg(\"text\", line)),\n\t\t\t};\n\t\t}\n\t\tconst nextLines = this.decorated.widths.get(width) ?? new Map<string, readonly string[]>();\n\t\tfor (const line of this.highlighted.lines) {\n\t\t\tlet decorated = nextLines.get(line) ?? previousLines?.get(line);\n\t\t\tif (!decorated) {\n\t\t\t\tdecorated = this.wrapLine(line, contentWidth).map((wrapped) =>\n\t\t\t\t\trow(`${\" \".repeat(padding)}${truncateToWidth(wrapped, contentWidth, \"\")}${\" \".repeat(padding)}`),\n\t\t\t\t);\n\t\t\t}\n\t\t\tnextLines.set(line, decorated);\n\t\t\tlines.push(...decorated);\n\t\t}\n\t\tfor (const entry of [cache, this.decorated]) {\n\t\t\tentry.widths.delete(width);\n\t\t\tentry.widths.set(width, nextLines);\n\t\t\tif (entry.widths.size > 2) entry.widths.delete(entry.widths.keys().next().value!);\n\t\t}\n\t\tif (borderWidth) lines.push(border(`└${\"─\".repeat(inside)}┘`));\n\t\treturn lines;\n\t}\n\n\thandleMouse(event: TuiMouseEvent): TuiMouseEventResult | undefined {\n\t\tif (event.type !== \"click\" || event.button !== \"left\" || event.shift || event.alt || event.ctrl) return undefined;\n\t\tif (event.y !== this.copyRow || event.x < this.copyColumn || event.x >= this.copyColumn + this.copyWidth)\n\t\t\treturn undefined;\n\t\tvoid this.copy();\n\t\treturn { handled: true };\n\t}\n\n\tinvalidate(): void {\n\t\tthis.highlighted = undefined;\n\t\tthis.decorated.widths.clear();\n\t\tthis.lineCache.widths.clear();\n\t}\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AssistantMessage } from "@earendil-works/pi-ai";
|
|
2
2
|
import { Container, type LiveLines, type MarkdownTheme } from "@earendil-works/pi-tui";
|
|
3
3
|
import type { MarkdownTransformer } from "../../../core/extensions/types.ts";
|
|
4
|
+
import { AssistantCodeBlock } from "./assistant-code-block.ts";
|
|
4
5
|
/** Whether `text` contains one of `names` (lowercase), ignoring case. */
|
|
5
6
|
export declare function mentionsAny(text: string, names: ReadonlySet<string>): boolean;
|
|
6
7
|
/**
|
|
@@ -15,35 +16,43 @@ export declare class AssistantMessageComponent extends Container {
|
|
|
15
16
|
private markdownTransformers;
|
|
16
17
|
private lastMessage?;
|
|
17
18
|
private hasToolCalls;
|
|
18
|
-
private isStreaming;
|
|
19
|
-
private contentIsStale;
|
|
20
|
-
private thinkingVisibilityOverrides;
|
|
21
|
-
/** The children's lines with the prompt markers added, and the lines they were added to. */
|
|
22
19
|
private markedFrom?;
|
|
23
20
|
private markedLines;
|
|
24
|
-
/** renderLive()'s lines: the children's live lines with the prompt markers added, and what they were made from. */
|
|
25
21
|
private markedLive?;
|
|
22
|
+
private isStreaming;
|
|
23
|
+
private contentIsStale;
|
|
24
|
+
private thinkingVisibilityOverrides;
|
|
25
|
+
private messageId?;
|
|
26
|
+
private timestamp?;
|
|
26
27
|
/**
|
|
27
28
|
* The Markdown components of the content, with what they were made from. A rebuild with the same text takes the
|
|
28
29
|
* component again instead of making a new one, which would parse its text again and render it from nothing: on
|
|
29
30
|
* invalidate() (theme changes), and while a reply streams, for every block but the one growing.
|
|
30
31
|
*/
|
|
31
32
|
private markdownBlocks;
|
|
32
|
-
|
|
33
|
+
private requestRender?;
|
|
34
|
+
private copyError?;
|
|
35
|
+
/**
|
|
36
|
+
* What the content was last built for while the reply streamed in (buildContent()): the plan's key and the theme. Dropped
|
|
37
|
+
* when anything the components were made with may have changed (invalidate() and the setters).
|
|
38
|
+
*/
|
|
39
|
+
private built?;
|
|
40
|
+
/** The text and thinking blocks of the message, by index (BlockText). */
|
|
41
|
+
private blockTexts;
|
|
42
|
+
constructor(message?: AssistantMessage, hideThinkingBlock?: boolean, markdownTheme?: MarkdownTheme, hiddenThinkingLabel?: string, outputPad?: number, markdownTransformers?: readonly MarkdownTransformer[], requestRender?: () => void, messageId?: string, timestamp?: string);
|
|
33
43
|
invalidate(): void;
|
|
34
44
|
/**
|
|
35
45
|
* Whether this message may show code highlighted in one of `languages` (lowercase names): whether its text names one
|
|
36
46
|
* of them anywhere, which every code block in that language does. Markdown transformers (extensions) may add any.
|
|
37
47
|
*/
|
|
38
48
|
mayHighlight(languages: ReadonlySet<string>): boolean;
|
|
49
|
+
/** Copy targets come from native fenced components, never rendered lines or thinking blocks. */
|
|
50
|
+
getCodeBlocks(): readonly AssistantCodeBlock[];
|
|
39
51
|
setHideThinkingBlock(hide: boolean): void;
|
|
40
52
|
setHiddenThinkingLabel(label: string): void;
|
|
41
53
|
setOutputPad(padding: number): void;
|
|
42
54
|
renderShared(width: number): string[];
|
|
43
|
-
/**
|
|
44
|
-
* renderShared()'s lines as LiveLines (renderLiveLines()): the children's live lines with the prompt markers added,
|
|
45
|
-
* changed from the first line the children's lines changed from (and the line that was last before).
|
|
46
|
-
*/
|
|
55
|
+
/** Render the latest streamed content through the children's live lines. */
|
|
47
56
|
renderLive(width: number): LiveLines;
|
|
48
57
|
updateContent(message: AssistantMessage, isStreaming?: boolean): void;
|
|
49
58
|
/**
|
|
@@ -53,6 +62,18 @@ export declare class AssistantMessageComponent extends Container {
|
|
|
53
62
|
* before (Markdown.renderLive()).
|
|
54
63
|
*/
|
|
55
64
|
private markdownFor;
|
|
65
|
+
/** The texts of the text and thinking blocks of `message` (BlockText.follow(): for each delta, while a reply streams in). */
|
|
66
|
+
private followTexts;
|
|
67
|
+
/**
|
|
68
|
+
* What buildContent() adds to the content container for `message`, in order. While a reply streams in, a chunk usually
|
|
69
|
+
* changes only the texts of its Markdown components: the same plan but for those texts (planKey()).
|
|
70
|
+
*/
|
|
71
|
+
private planContent;
|
|
72
|
+
/**
|
|
73
|
+
* Everything the components buildContent() makes for `parts` depend on but the texts of the Markdown components: two
|
|
74
|
+
* plans with the same key give the same components, but for the text each Markdown component is given.
|
|
75
|
+
*/
|
|
76
|
+
private planKey;
|
|
56
77
|
private buildContent;
|
|
57
78
|
}
|
|
58
79
|
//# sourceMappingURL=assistant-message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant-message.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/assistant-message.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAEN,SAAS,EAET,KAAK,SAAS,EAEd,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"assistant-message.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/assistant-message.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAEN,SAAS,EAET,KAAK,SAAS,EAEd,KAAK,aAAa,EASlB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAU/D,yEAAyE;AACzE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,OAAO,CAO7E;AAyGD;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,SAAS;IACvD,OAAO,CAAC,gBAAgB,CAAY;IACpC,OAAO,CAAC,iBAAiB,CAAU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