@humain/humain-code 0.5.3 → 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 +180 -0
- package/README.md +2 -2
- 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/assets/humain-code-logo.svg +8 -0
- 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
|
@@ -17,82 +17,433 @@ function renderBar(theme, bar, width) {
|
|
|
17
17
|
const empty = theme.fg("muted", "░".repeat(width - filled));
|
|
18
18
|
return `${fill}${empty}`;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
*/
|
|
20
|
+
function providerLabel(providerId) {
|
|
21
|
+
return providerId === "openai-codex" ? "Codex" : providerId === "anthropic" ? "Claude" : providerId;
|
|
22
|
+
}
|
|
23
|
+
/** Account selection inspects usage only; actions delegate side effects to the caller. */
|
|
24
24
|
export class UsagePopupComponent {
|
|
25
25
|
focused = false;
|
|
26
26
|
theme;
|
|
27
27
|
keybindings;
|
|
28
|
-
|
|
28
|
+
tabs;
|
|
29
29
|
onClose;
|
|
30
|
-
|
|
30
|
+
requestRender;
|
|
31
|
+
getHeight;
|
|
32
|
+
onAction;
|
|
33
|
+
disposed = false;
|
|
34
|
+
view;
|
|
35
|
+
detailFocus = false;
|
|
36
|
+
selectedId;
|
|
37
|
+
scrollTop = 0;
|
|
38
|
+
viewportHeight = 1;
|
|
39
|
+
maxScrollTop = 0;
|
|
40
|
+
regions = [];
|
|
41
|
+
renderedWidth = 0;
|
|
42
|
+
listWidth = 0;
|
|
43
|
+
constructor(theme, keybindings, tabs, onClose, requestRender, getHeight = () => 24, onAction) {
|
|
31
44
|
this.theme = theme;
|
|
32
45
|
this.keybindings = keybindings;
|
|
33
|
-
this.
|
|
46
|
+
this.tabs = tabs;
|
|
34
47
|
this.onClose = onClose;
|
|
48
|
+
this.requestRender = requestRender;
|
|
49
|
+
this.getHeight = getHeight;
|
|
50
|
+
this.onAction = onAction;
|
|
51
|
+
this.selectedId = this.accounts[0]?.id;
|
|
52
|
+
this.view = this.selectedId ? "accounts" : "session";
|
|
53
|
+
}
|
|
54
|
+
get accounts() {
|
|
55
|
+
const providers = new Map();
|
|
56
|
+
for (const tab of this.tabs) {
|
|
57
|
+
if (tab.id === "session")
|
|
58
|
+
continue;
|
|
59
|
+
const group = providers.get(tab.overview.providerId) ?? [];
|
|
60
|
+
group.push(tab);
|
|
61
|
+
providers.set(tab.overview.providerId, group);
|
|
62
|
+
}
|
|
63
|
+
return [...providers.values()].flat();
|
|
64
|
+
}
|
|
65
|
+
get selectedAccount() {
|
|
66
|
+
const accounts = this.accounts;
|
|
67
|
+
return accounts.find((tab) => tab.id === this.selectedId) ?? accounts[0];
|
|
68
|
+
}
|
|
69
|
+
dispose() {
|
|
70
|
+
if (this.disposed)
|
|
71
|
+
return;
|
|
72
|
+
this.disposed = true;
|
|
73
|
+
this.regions = [];
|
|
74
|
+
this.onClose();
|
|
75
|
+
}
|
|
76
|
+
showView(view) {
|
|
77
|
+
this.view = view;
|
|
78
|
+
this.detailFocus = view === "session";
|
|
79
|
+
this.scrollTop = 0;
|
|
80
|
+
this.regions = [];
|
|
81
|
+
this.requestRender();
|
|
82
|
+
}
|
|
83
|
+
selectAccount(id) {
|
|
84
|
+
if (id !== this.selectedAccount?.id)
|
|
85
|
+
this.scrollTop = 0;
|
|
86
|
+
this.selectedId = id;
|
|
87
|
+
this.regions = [];
|
|
88
|
+
this.requestRender();
|
|
89
|
+
}
|
|
90
|
+
moveAccount(delta, wrap = false) {
|
|
91
|
+
const accounts = this.accounts;
|
|
92
|
+
if (this.view !== "accounts" || accounts.length === 0)
|
|
93
|
+
return false;
|
|
94
|
+
const current = accounts.findIndex((tab) => tab.id === this.selectedAccount?.id);
|
|
95
|
+
const next = wrap
|
|
96
|
+
? (current + delta + accounts.length) % accounts.length
|
|
97
|
+
: Math.max(0, Math.min(accounts.length - 1, current + delta));
|
|
98
|
+
if (next === current)
|
|
99
|
+
return false;
|
|
100
|
+
this.selectAccount(accounts[next].id);
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
scrollBy(delta) {
|
|
104
|
+
const next = Math.max(0, Math.min(this.maxScrollTop, this.scrollTop + delta));
|
|
105
|
+
if (next === this.scrollTop)
|
|
106
|
+
return false;
|
|
107
|
+
this.scrollTop = next;
|
|
108
|
+
this.regions = [];
|
|
109
|
+
this.requestRender();
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
invokeAction(action) {
|
|
113
|
+
const tab = this.selectedAccount;
|
|
114
|
+
if (this.view !== "accounts" || !tab || !this.onAction)
|
|
115
|
+
return;
|
|
116
|
+
if (action === "reset" && (!tab.resetAction || tab.resetDisabled))
|
|
117
|
+
return;
|
|
118
|
+
this.onAction(tab, action);
|
|
119
|
+
this.requestRender();
|
|
35
120
|
}
|
|
36
121
|
handleInput(data) {
|
|
37
|
-
if (this.
|
|
38
|
-
|
|
122
|
+
if (this.disposed)
|
|
123
|
+
return;
|
|
124
|
+
const kb = this.keybindings;
|
|
125
|
+
if (kb.matches(data, "app.clear"))
|
|
126
|
+
this.dispose();
|
|
127
|
+
else if (kb.matches(data, "tui.select.cancel")) {
|
|
128
|
+
if (this.view === "accounts" && this.detailFocus) {
|
|
129
|
+
this.detailFocus = false;
|
|
130
|
+
this.regions = [];
|
|
131
|
+
this.requestRender();
|
|
132
|
+
}
|
|
133
|
+
else
|
|
134
|
+
this.dispose();
|
|
135
|
+
}
|
|
136
|
+
else if (kb.matches(data, "app.usage.showAccounts"))
|
|
137
|
+
this.showView("accounts");
|
|
138
|
+
else if (kb.matches(data, "app.usage.showSession"))
|
|
139
|
+
this.showView("session");
|
|
140
|
+
else if (kb.matches(data, "app.usage.reset"))
|
|
141
|
+
this.invokeAction("reset");
|
|
142
|
+
else if (kb.matches(data, "app.usage.billing"))
|
|
143
|
+
this.invokeAction("billing");
|
|
144
|
+
else if (kb.matches(data, "app.usage.nextTab"))
|
|
145
|
+
this.moveAccount(1, true);
|
|
146
|
+
else if (kb.matches(data, "app.usage.previousTab"))
|
|
147
|
+
this.moveAccount(-1, true);
|
|
148
|
+
else if (kb.matches(data, "tui.select.confirm") && this.view === "accounts" && this.selectedAccount) {
|
|
149
|
+
this.detailFocus = true;
|
|
150
|
+
this.regions = [];
|
|
151
|
+
this.requestRender();
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
let delta = 0;
|
|
155
|
+
if (kb.matches(data, "tui.select.up"))
|
|
156
|
+
delta = -1;
|
|
157
|
+
else if (kb.matches(data, "tui.select.down"))
|
|
158
|
+
delta = 1;
|
|
159
|
+
else if (kb.matches(data, "tui.select.pageUp"))
|
|
160
|
+
delta = -this.viewportHeight;
|
|
161
|
+
else if (kb.matches(data, "tui.select.pageDown"))
|
|
162
|
+
delta = this.viewportHeight;
|
|
163
|
+
if (delta) {
|
|
164
|
+
if (this.view === "accounts" && !this.detailFocus)
|
|
165
|
+
this.moveAccount(delta);
|
|
166
|
+
else
|
|
167
|
+
this.scrollBy(delta);
|
|
168
|
+
}
|
|
39
169
|
}
|
|
40
170
|
}
|
|
41
171
|
handleMouse(event) {
|
|
42
|
-
if (
|
|
43
|
-
|
|
172
|
+
if (this.disposed)
|
|
173
|
+
return { handled: true, render: false };
|
|
174
|
+
const inBody = event.x >= 0 && event.x < this.renderedWidth && event.y >= 3 && event.y < 3 + this.viewportHeight;
|
|
175
|
+
if (event.type === "wheel" && inBody) {
|
|
176
|
+
const inList = this.view === "accounts" && (this.listWidth > 0 ? event.x < this.listWidth : !this.detailFocus);
|
|
177
|
+
const delta = event.wheelDelta ?? 0;
|
|
178
|
+
if (!delta)
|
|
179
|
+
return { handled: true, render: false };
|
|
180
|
+
const focusChanged = this.detailFocus === inList;
|
|
181
|
+
this.detailFocus = !inList;
|
|
182
|
+
const changed = inList ? this.moveAccount(delta) : this.scrollBy(delta);
|
|
183
|
+
if (focusChanged && !changed)
|
|
184
|
+
this.requestRender();
|
|
185
|
+
return { handled: true, render: changed || focusChanged, focus: true };
|
|
186
|
+
}
|
|
187
|
+
if (event.type !== "click" || event.button !== "left")
|
|
188
|
+
return { handled: true, render: false };
|
|
189
|
+
const region = this.regions.find((item) => event.y === item.y && event.x >= item.x && event.x < item.x + item.width);
|
|
190
|
+
if (region) {
|
|
191
|
+
region.activate();
|
|
192
|
+
return { handled: true, render: true, focus: true };
|
|
193
|
+
}
|
|
194
|
+
if (inBody && this.view === "accounts" && this.listWidth > 0 && event.x > this.listWidth + 2) {
|
|
195
|
+
this.detailFocus = true;
|
|
196
|
+
this.requestRender();
|
|
197
|
+
return { handled: true, render: true, focus: true };
|
|
198
|
+
}
|
|
44
199
|
return { handled: true, render: false };
|
|
45
200
|
}
|
|
46
|
-
invalidate() {
|
|
47
|
-
|
|
201
|
+
invalidate() {
|
|
202
|
+
this.regions = [];
|
|
203
|
+
}
|
|
204
|
+
key(action) {
|
|
205
|
+
const key = this.keybindings.getKeys(action)[0];
|
|
206
|
+
return key ? formatKeyText(key) : "";
|
|
207
|
+
}
|
|
208
|
+
detailRows(tab, width) {
|
|
48
209
|
const theme = this.theme;
|
|
49
|
-
const { providerId, modelId, bars, lines, notes } =
|
|
210
|
+
const { providerId, modelId, bars, lines, notes } = tab.overview;
|
|
211
|
+
const session = this.view === "session";
|
|
50
212
|
const out = [];
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
213
|
+
const add = (text, action, disabled) => {
|
|
214
|
+
for (const wrapped of wrapTextWithAnsi(text, width))
|
|
215
|
+
out.push({ text: wrapped, action, disabled });
|
|
216
|
+
};
|
|
217
|
+
const row = (line) => {
|
|
218
|
+
const padded = line.label + " ".repeat(Math.max(0, 13 - visibleWidth(line.label)));
|
|
219
|
+
const value = line.tone ? theme.fg(TONE_COLOR[line.tone], line.value) : line.value;
|
|
220
|
+
add(` ${theme.fg("dim", padded)} ${value}`);
|
|
56
221
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// One row per bar keeps several limit windows on screen: label, bar, percentage, then the note when it fits.
|
|
222
|
+
const addBars = (bars) => {
|
|
223
|
+
if (bars.length === 0)
|
|
224
|
+
return;
|
|
225
|
+
// Keep compact bars when they fit; stack and wrap details instead of truncating limits on narrow screens.
|
|
62
226
|
const labelWidth = Math.min(MAX_LABEL_WIDTH, Math.max(...bars.map((bar) => visibleWidth(bar.label))));
|
|
63
227
|
const displayWidth = Math.max(...bars.map((bar) => visibleWidth(bar.display)));
|
|
64
|
-
const barWidth = Math.max(MIN_BAR_WIDTH, Math.min(BAR_WIDTH, width -
|
|
228
|
+
const barWidth = Math.max(MIN_BAR_WIDTH, Math.min(BAR_WIDTH, width - 2 - labelWidth - 3 - displayWidth));
|
|
65
229
|
for (const bar of bars) {
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
const head = `${pad}${theme.fg("dim", label)} ${renderBar(theme, bar, barWidth)} ${theme.fg("dim", bar.display)}`;
|
|
230
|
+
const label = bar.label + " ".repeat(Math.max(0, labelWidth - visibleWidth(bar.label)));
|
|
231
|
+
const head = ` ${theme.fg("dim", label)} ${renderBar(theme, bar, barWidth)} ${theme.fg("dim", bar.display)}`;
|
|
69
232
|
const note = bar.note ? theme.fg("dim", bar.note) : undefined;
|
|
70
|
-
if (
|
|
71
|
-
|
|
233
|
+
if (visibleWidth(head) > width) {
|
|
234
|
+
add(` ${theme.fg("dim", `${bar.label} · ${bar.display}`)}`);
|
|
235
|
+
add(renderBar(theme, bar, Math.min(BAR_WIDTH, width)));
|
|
236
|
+
if (note)
|
|
237
|
+
add(` ${note}`);
|
|
238
|
+
}
|
|
239
|
+
else if (note && visibleWidth(head) + 2 + visibleWidth(note) <= width)
|
|
240
|
+
add(`${head} ${note}`);
|
|
72
241
|
else {
|
|
73
|
-
|
|
242
|
+
add(head);
|
|
74
243
|
if (note)
|
|
75
|
-
|
|
244
|
+
add(` ${note}`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
add(theme.bold(session ? "This session" : tab.label) +
|
|
249
|
+
(!session && tab.active ? ` ${theme.fg("success", "In use")}` : ""));
|
|
250
|
+
add(theme.fg("dim", `${providerId} · ${modelId}`));
|
|
251
|
+
add("");
|
|
252
|
+
if (!session)
|
|
253
|
+
add(theme.bold("INCLUDED USAGE"));
|
|
254
|
+
const includedBars = session ? bars : bars.filter((bar) => !bar.section);
|
|
255
|
+
addBars(includedBars);
|
|
256
|
+
for (const line of lines)
|
|
257
|
+
if (session || !line.section)
|
|
258
|
+
row(line);
|
|
259
|
+
if (!session) {
|
|
260
|
+
if (includedBars.length === 0 && !lines.some((line) => !line.section))
|
|
261
|
+
add(theme.fg("muted", " Usage not reported."));
|
|
262
|
+
for (const [section, title] of [
|
|
263
|
+
["resets", "SAVED RESETS"],
|
|
264
|
+
["paid", "PAID USAGE"],
|
|
265
|
+
]) {
|
|
266
|
+
add("");
|
|
267
|
+
add(theme.bold(title));
|
|
268
|
+
const sectionBars = bars.filter((bar) => bar.section === section);
|
|
269
|
+
addBars(sectionBars);
|
|
270
|
+
const sectionLines = lines.filter((line) => line.section === section);
|
|
271
|
+
for (const line of sectionLines)
|
|
272
|
+
row(line);
|
|
273
|
+
if (sectionBars.length === 0 && sectionLines.length === 0)
|
|
274
|
+
add(theme.fg("muted", " Not reported."));
|
|
275
|
+
const action = section === "resets" ? "reset" : "billing";
|
|
276
|
+
const label = section === "resets" ? tab.resetAction : this.onAction ? "Open billing settings" : undefined;
|
|
277
|
+
if (label) {
|
|
278
|
+
const key = this.key(`app.usage.${action}`);
|
|
279
|
+
const disabled = !this.onAction || (action === "reset" && tab.resetDisabled === true);
|
|
280
|
+
const text = `[${key ? `${key} ` : ""}${label}]${disabled ? " (disabled)" : ""}`;
|
|
281
|
+
add(theme.fg(disabled ? "muted" : "accent", text), action, disabled);
|
|
76
282
|
}
|
|
77
283
|
}
|
|
78
|
-
out.push("");
|
|
79
|
-
}
|
|
80
|
-
out.push(theme.bold("This session"));
|
|
81
|
-
for (const line of lines) {
|
|
82
|
-
out.push(row(line.label, line.value, line.tone));
|
|
83
284
|
}
|
|
84
285
|
if (notes.length > 0) {
|
|
85
|
-
|
|
86
|
-
for (const note of notes)
|
|
87
|
-
|
|
88
|
-
|
|
286
|
+
add("");
|
|
287
|
+
for (const note of notes)
|
|
288
|
+
add(theme.fg("warning", note));
|
|
289
|
+
}
|
|
290
|
+
return out;
|
|
291
|
+
}
|
|
292
|
+
accountRows(width, height) {
|
|
293
|
+
const accounts = this.accounts;
|
|
294
|
+
const selected = this.selectedAccount;
|
|
295
|
+
const all = [];
|
|
296
|
+
let provider;
|
|
297
|
+
for (const account of accounts) {
|
|
298
|
+
if (provider !== account.overview.providerId) {
|
|
299
|
+
provider = account.overview.providerId;
|
|
300
|
+
all.push({ text: this.theme.fg("muted", this.theme.bold(providerLabel(provider))), provider });
|
|
301
|
+
}
|
|
302
|
+
const marker = account.id === selected?.id ? "> " : " ";
|
|
303
|
+
const status = account.active ? this.theme.fg("success", " In use") : "";
|
|
304
|
+
const label = truncateToWidth(account.label, Math.max(0, width - 2 - visibleWidth(status)), "…");
|
|
305
|
+
const text = `${marker}${label}`;
|
|
306
|
+
all.push({
|
|
307
|
+
text: (account.id === selected?.id ? this.theme.fg("accent", this.theme.bold(text)) : text) + status,
|
|
308
|
+
provider: account.overview.providerId,
|
|
309
|
+
account,
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
if (all.length === 0)
|
|
313
|
+
return wrapTextWithAnsi("No saved accounts. Run /login.", width).slice(0, height);
|
|
314
|
+
const selectedRow = all.findIndex((row) => row.account?.id === selected?.id);
|
|
315
|
+
let start = Math.max(0, Math.min(selectedRow - Math.floor((height - 1) / 2), all.length - height));
|
|
316
|
+
const sticky = start > 0 && all[start].account && height > 1;
|
|
317
|
+
if (sticky && selectedRow >= start + height - 1)
|
|
318
|
+
start = selectedRow - height + 2;
|
|
319
|
+
const visible = all.slice(start, start + height - (sticky ? 1 : 0));
|
|
320
|
+
const output = [];
|
|
321
|
+
if (sticky)
|
|
322
|
+
output.push(this.theme.fg("muted", this.theme.bold(providerLabel(all[start].provider))));
|
|
323
|
+
for (const row of visible) {
|
|
324
|
+
if (row.account) {
|
|
325
|
+
const id = row.account.id;
|
|
326
|
+
this.regions.push({
|
|
327
|
+
x: 0,
|
|
328
|
+
y: 3 + output.length,
|
|
329
|
+
width,
|
|
330
|
+
activate: () => {
|
|
331
|
+
this.detailFocus = this.listWidth === 0;
|
|
332
|
+
this.selectAccount(id);
|
|
333
|
+
},
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
output.push(truncateToWidth(row.text, width, "…"));
|
|
337
|
+
}
|
|
338
|
+
return output;
|
|
339
|
+
}
|
|
340
|
+
render(width) {
|
|
341
|
+
this.regions = [];
|
|
342
|
+
if (this.disposed || width < 1)
|
|
343
|
+
return [];
|
|
344
|
+
const theme = this.theme;
|
|
345
|
+
this.renderedWidth = width;
|
|
346
|
+
const accounts = this.accounts;
|
|
347
|
+
const selected = this.selectedAccount;
|
|
348
|
+
this.listWidth = this.view === "accounts" && width >= 76 ? Math.min(32, Math.floor(width / 3)) : 0;
|
|
349
|
+
const split = this.listWidth > 0;
|
|
350
|
+
const showingList = this.view === "accounts" && !this.detailFocus;
|
|
351
|
+
const detailWidth = split ? width - this.listWidth - 3 : width;
|
|
352
|
+
const tab = this.view === "session" ? this.tabs.find((item) => item.id === "session") : selected;
|
|
353
|
+
const details = tab ? this.detailRows(tab, detailWidth) : [{ text: "No usage data available." }];
|
|
354
|
+
const controls = [
|
|
355
|
+
["accounts", "app.usage.showAccounts", "Accounts"],
|
|
356
|
+
["session", "app.usage.showSession", "Session"],
|
|
357
|
+
].map(([view, action, label]) => {
|
|
358
|
+
const key = this.key(action);
|
|
359
|
+
return { view, text: `[${key ? `${key} ` : ""}${label}]` };
|
|
360
|
+
});
|
|
361
|
+
const stackedControls = controls.reduce((sum, control) => sum + visibleWidth(control.text), 2) > width;
|
|
362
|
+
let controlX = 0;
|
|
363
|
+
const navigation = controls.map(({ view, text }, index) => {
|
|
364
|
+
const x = stackedControls ? 0 : controlX;
|
|
365
|
+
this.regions.push({
|
|
366
|
+
x,
|
|
367
|
+
y: stackedControls ? index : 1,
|
|
368
|
+
width: Math.min(visibleWidth(text), width - x),
|
|
369
|
+
activate: () => this.showView(view),
|
|
370
|
+
});
|
|
371
|
+
controlX += visibleWidth(text) + 2;
|
|
372
|
+
return this.view === view ? theme.fg("accent", theme.bold(text)) : theme.fg("muted", text);
|
|
373
|
+
});
|
|
374
|
+
const header = stackedControls ? navigation : [theme.bold("Usage"), navigation.join(" ")];
|
|
375
|
+
const selectKeys = [this.key("tui.select.up"), this.key("tui.select.down")].filter(Boolean).join("/");
|
|
376
|
+
const confirm = showingList && selected ? this.key("tui.select.confirm") : "";
|
|
377
|
+
const cycleKeys = this.view === "accounts"
|
|
378
|
+
? [this.key("app.usage.nextTab"), this.key("app.usage.previousTab")].filter(Boolean).join("/")
|
|
379
|
+
: "";
|
|
380
|
+
const cancel = this.key("tui.select.cancel");
|
|
381
|
+
const footerParts = [
|
|
382
|
+
selectKeys ? `${selectKeys} ${showingList ? "select" : "scroll"}` : "",
|
|
383
|
+
confirm ? `${confirm} details` : "",
|
|
384
|
+
];
|
|
385
|
+
if (cycleKeys && width >= 60)
|
|
386
|
+
footerParts.push(`${cycleKeys} cycle`);
|
|
387
|
+
const actionHints = [];
|
|
388
|
+
if (this.view === "accounts" && selected && this.onAction) {
|
|
389
|
+
for (const [action, label, enabled] of [
|
|
390
|
+
["reset", "saved reset", selected.resetAction && !selected.resetDisabled],
|
|
391
|
+
["billing", "billing settings", true],
|
|
392
|
+
]) {
|
|
393
|
+
const key = this.key(`app.usage.${action}`);
|
|
394
|
+
if (key && enabled)
|
|
395
|
+
actionHints.push(theme.fg("accent", `${key} ${label}`));
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
const footer = [
|
|
399
|
+
...wrapTextWithAnsi(footerParts.filter(Boolean).join(" · "), width),
|
|
400
|
+
...wrapTextWithAnsi([
|
|
401
|
+
cancel ? `${cancel} ${this.view === "accounts" && this.detailFocus ? "accounts" : "close"}` : "",
|
|
402
|
+
...actionHints,
|
|
403
|
+
]
|
|
404
|
+
.filter(Boolean)
|
|
405
|
+
.join(" · "), width),
|
|
406
|
+
];
|
|
407
|
+
// The editor dock measures render() at its natural height; leave room for the transcript, spacer, and footer.
|
|
408
|
+
const height = Math.max(1, Math.floor(this.getHeight()) - 5);
|
|
409
|
+
const visibleFooter = footer.slice(0, Math.max(0, height - 4));
|
|
410
|
+
this.viewportHeight = Math.max(1, height - 3 - visibleFooter.length);
|
|
411
|
+
this.maxScrollTop = Math.max(0, details.length - this.viewportHeight);
|
|
412
|
+
this.scrollTop = Math.min(this.scrollTop, this.maxScrollTop);
|
|
413
|
+
const accountHeading = `Accounts ${selected ? accounts.findIndex((item) => item.id === selected.id) + 1 : 0}/${accounts.length}`;
|
|
414
|
+
const detailHeading = `${this.view === "session" ? "Session" : "Details"}${this.detailFocus ? " (focused)" : ""} ${this.scrollTop + 1}/${this.maxScrollTop + 1}`;
|
|
415
|
+
const heading = split
|
|
416
|
+
? truncateToWidth(theme.bold(accountHeading), this.listWidth, "…", true) +
|
|
417
|
+
theme.fg("dim", " │ ") +
|
|
418
|
+
theme.bold(detailHeading)
|
|
419
|
+
: theme.bold(showingList ? accountHeading : detailHeading);
|
|
420
|
+
const list = this.view === "accounts" && (split || showingList)
|
|
421
|
+
? this.accountRows(split ? this.listWidth : width, this.viewportHeight)
|
|
422
|
+
: [];
|
|
423
|
+
const body = [];
|
|
424
|
+
for (let index = 0; index < this.viewportHeight; index++) {
|
|
425
|
+
const row = details[this.scrollTop + index];
|
|
426
|
+
if (row?.action && !row.disabled && (!showingList || split)) {
|
|
427
|
+
const action = row.action;
|
|
428
|
+
this.regions.push({
|
|
429
|
+
x: split ? this.listWidth + 3 : 0,
|
|
430
|
+
y: 3 + index,
|
|
431
|
+
width: visibleWidth(row.text),
|
|
432
|
+
activate: () => this.invokeAction(action),
|
|
433
|
+
});
|
|
89
434
|
}
|
|
435
|
+
body.push(split
|
|
436
|
+
? truncateToWidth(list[index] ?? "", this.listWidth, "", true) +
|
|
437
|
+
theme.fg("dim", " │ ") +
|
|
438
|
+
(row?.text ?? "")
|
|
439
|
+
: showingList
|
|
440
|
+
? (list[index] ?? "")
|
|
441
|
+
: (row?.text ?? ""));
|
|
90
442
|
}
|
|
91
|
-
const closeKey = formatKeyText(this.keybindings.getKeys("tui.select.cancel")[0] ?? "escape");
|
|
92
|
-
out.push("");
|
|
93
|
-
out.push(theme.fg("muted", `${closeKey} to close`));
|
|
94
443
|
// A line wider than the terminal aborts rendering.
|
|
95
|
-
return
|
|
444
|
+
return [...header, heading, ...body, ...visibleFooter.map((line) => theme.fg("muted", line))]
|
|
445
|
+
.slice(0, height)
|
|
446
|
+
.map((line) => truncateToWidth(line, width, "…"));
|
|
96
447
|
}
|
|
97
448
|
}
|
|
98
449
|
//# sourceMappingURL=popup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popup.js","sourceRoot":"","sources":["../../../src/extensions/usage/popup.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,OAAO,EAKN,eAAe,EACf,YAAY,EACZ,gBAAgB,GAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,wDAAwD,CAAC;AAIvF,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,MAAM,UAAU,GAAG;IAClB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;CACT,CAAC;AAEX,SAAS,SAAS,CAAC,KAAY,EAAE,GAAa,EAAE,KAAa;IAC5D,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAA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C,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;IAC7D,CAAC;CACD","sourcesContent":["// Derived from Pi-Bolt (MIT, Copyright (c) 2026 OpenSec (Pi-Bolt)), commit a6df6a2c; modified for HUMAIN Code CLI.\nimport {\n\ttype Component,\n\ttype Focusable,\n\ttype TuiMouseEvent,\n\ttype TuiMouseEventResult,\n\ttruncateToWidth,\n\tvisibleWidth,\n\twrapTextWithAnsi,\n} from \"@earendil-works/pi-tui\";\nimport type { KeybindingsManager } from \"../../core/keybindings.ts\";\nimport { formatKeyText } from \"../../modes/interactive/components/keybinding-hints.ts\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport type { UsageBar, UsageLine, UsageOverview } from \"./overview.ts\";\n\nconst BAR_WIDTH = 24;\nconst MIN_BAR_WIDTH = 8;\nconst MAX_LABEL_WIDTH = 28;\n\nconst TONE_COLOR = {\n\taccent: \"accent\",\n\twarning: \"warning\",\n\terror: \"error\",\n\tsuccess: \"success\",\n} as const;\n\nfunction renderBar(theme: Theme, bar: UsageBar, width: number): string {\n\tconst frac = bar.total && bar.total > 0 ? Math.min(1, Math.max(0, bar.used / bar.total)) : 0;\n\tconst filled = Math.round(frac * width);\n\tconst fill = theme.fg(TONE_COLOR[bar.tone], \"█\".repeat(filled));\n\tconst empty = theme.fg(\"muted\", \"░\".repeat(width - filled));\n\treturn `${fill}${empty}`;\n}\n\n/**\n * A read-only view showing account/session usage with tqdm-style progress\n * bars. Esc (or a click) closes it.\n */\nexport class UsagePopupComponent implements Component, Focusable {\n\tfocused = false;\n\n\tprivate readonly theme: Theme;\n\tprivate readonly keybindings: KeybindingsManager;\n\tprivate readonly overview: UsageOverview;\n\tprivate readonly onClose: () => void;\n\n\tconstructor(theme: Theme, keybindings: KeybindingsManager, overview: UsageOverview, onClose: () => void) {\n\t\tthis.theme = theme;\n\t\tthis.keybindings = keybindings;\n\t\tthis.overview = overview;\n\t\tthis.onClose = onClose;\n\t}\n\n\thandleInput(data: string): void {\n\t\tif (this.keybindings.matches(data, \"tui.select.cancel\") || this.keybindings.matches(data, \"app.clear\")) {\n\t\t\tthis.onClose();\n\t\t}\n\t}\n\n\thandleMouse(event: TuiMouseEvent): TuiMouseEventResult {\n\t\tif (event.type === \"click\") this.onClose();\n\t\treturn { handled: true, render: false };\n\t}\n\n\tinvalidate(): void {}\n\n\trender(width: number): string[] {\n\t\tconst theme = this.theme;\n\t\tconst { providerId, modelId, bars, lines, notes } = this.overview;\n\t\tconst out: string[] = [];\n\t\tconst pad = \" \";\n\n\t\tconst row = (label: string, value: string, tone?: UsageLine[\"tone\"]): string => {\n\t\t\tconst padded = label.padEnd(13);\n\t\t\tconst coloredValue = tone ? theme.fg(TONE_COLOR[tone], value) : value;\n\t\t\treturn `${pad}${theme.fg(\"dim\", padded)} ${coloredValue}`;\n\t\t};\n\n\t\tout.push(theme.bold(\"Usage\"));\n\t\tout.push(theme.fg(\"dim\", `${providerId} · ${modelId}`));\n\t\tout.push(\"\");\n\n\t\tif (bars.length > 0) {\n\t\t\t// One row per bar keeps several limit windows on screen: label, bar, percentage, then the note when it fits.\n\t\t\tconst labelWidth = Math.min(MAX_LABEL_WIDTH, Math.max(...bars.map((bar) => visibleWidth(bar.label))));\n\t\t\tconst displayWidth = Math.max(...bars.map((bar) => visibleWidth(bar.display)));\n\t\t\tconst barWidth = Math.max(\n\t\t\t\tMIN_BAR_WIDTH,\n\t\t\t\tMath.min(BAR_WIDTH, width - pad.length - labelWidth - 1 - 2 - displayWidth),\n\t\t\t);\n\t\t\tfor (const bar of bars) {\n\t\t\t\tconst truncated = truncateToWidth(bar.label, labelWidth, \"…\");\n\t\t\t\tconst label = truncated + \" \".repeat(Math.max(0, labelWidth - visibleWidth(truncated)));\n\t\t\t\tconst head = `${pad}${theme.fg(\"dim\", label)} ${renderBar(theme, bar, barWidth)} ${theme.fg(\"dim\", bar.display)}`;\n\t\t\t\tconst note = bar.note ? theme.fg(\"dim\", bar.note) : undefined;\n\t\t\t\tif (note && visibleWidth(head) + 2 + visibleWidth(note) <= width) out.push(`${head} ${note}`);\n\t\t\t\telse {\n\t\t\t\t\tout.push(head);\n\t\t\t\t\tif (note) out.push(`${pad}${\" \".repeat(labelWidth + 1)}${note}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tout.push(\"\");\n\t\t}\n\n\t\tout.push(theme.bold(\"This session\"));\n\t\tfor (const line of lines) {\n\t\t\tout.push(row(line.label, line.value, line.tone));\n\t\t}\n\n\t\tif (notes.length > 0) {\n\t\t\tout.push(\"\");\n\t\t\tfor (const note of notes) {\n\t\t\t\tfor (const wrapped of wrapTextWithAnsi(note, Math.max(1, width))) out.push(theme.fg(\"warning\", wrapped));\n\t\t\t}\n\t\t}\n\n\t\tconst closeKey = formatKeyText(this.keybindings.getKeys(\"tui.select.cancel\")[0] ?? \"escape\");\n\t\tout.push(\"\");\n\t\tout.push(theme.fg(\"muted\", `${closeKey} to close`));\n\n\t\t// A line wider than the terminal aborts rendering.\n\t\treturn out.map((line) => truncateToWidth(line, width, \"…\"));\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"popup.js","sourceRoot":"","sources":["../../../src/extensions/usage/popup.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,OAAO,EAMN,eAAe,EACf,YAAY,EACZ,gBAAgB,GAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,wDAAwD,CAAC;AA2BvF,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,MAAM,UAAU,GAAG;IAClB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;CACT,CAAC;AAEX,SAAS,SAAS,CAAC,KAAY,EAAE,GAAa,EAAE,KAAa;IAC5D,MAAM,IAAI,GAAG,GAAG,CAAC,KAA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C,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;IACpD,CAAC;CACD","sourcesContent":["// Derived from Pi-Bolt (MIT, Copyright (c) 2026 OpenSec (Pi-Bolt)), commit a6df6a2c; modified for HUMAIN Code CLI.\nimport {\n\ttype Component,\n\ttype Focusable,\n\ttype Keybinding,\n\ttype TuiMouseEvent,\n\ttype TuiMouseEventResult,\n\ttruncateToWidth,\n\tvisibleWidth,\n\twrapTextWithAnsi,\n} from \"@earendil-works/pi-tui\";\nimport type { KeybindingsManager } from \"../../core/keybindings.ts\";\nimport { formatKeyText } from \"../../modes/interactive/components/keybinding-hints.ts\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport type { UsageBar, UsageLine, UsageOverview } from \"./overview.ts\";\n\nexport interface UsageTab {\n\tid: string;\n\tlabel: string;\n\toverview: UsageOverview;\n\tactive?: boolean;\n\tresetAction?: string;\n\tresetDisabled?: boolean;\n}\n\ntype UsageAction = \"reset\" | \"billing\";\ntype UsageView = \"accounts\" | \"session\";\ninterface DetailRow {\n\ttext: string;\n\taction?: UsageAction;\n\tdisabled?: boolean;\n}\ninterface HitRegion {\n\tx: number;\n\ty: number;\n\twidth: number;\n\tactivate: () => void;\n}\n\nconst BAR_WIDTH = 24;\nconst MIN_BAR_WIDTH = 8;\nconst MAX_LABEL_WIDTH = 28;\n\nconst TONE_COLOR = {\n\taccent: \"accent\",\n\twarning: \"warning\",\n\terror: \"error\",\n\tsuccess: \"success\",\n} as const;\n\nfunction renderBar(theme: Theme, bar: UsageBar, width: number): string {\n\tconst frac = bar.total && bar.total > 0 ? Math.min(1, Math.max(0, bar.used / bar.total)) : 0;\n\tconst filled = Math.round(frac * width);\n\tconst fill = theme.fg(TONE_COLOR[bar.tone], \"█\".repeat(filled));\n\tconst empty = theme.fg(\"muted\", \"░\".repeat(width - filled));\n\treturn `${fill}${empty}`;\n}\n\nfunction providerLabel(providerId: string): string {\n\treturn providerId === \"openai-codex\" ? \"Codex\" : providerId === \"anthropic\" ? \"Claude\" : providerId;\n}\n\n/** Account selection inspects usage only; actions delegate side effects to the caller. */\nexport class UsagePopupComponent implements Component, Focusable {\n\tfocused = false;\n\n\tprivate readonly theme: Theme;\n\tprivate readonly keybindings: KeybindingsManager;\n\tprivate readonly tabs: readonly UsageTab[];\n\tprivate readonly onClose: () => void;\n\tprivate readonly requestRender: () => void;\n\tprivate readonly getHeight: () => number;\n\tprivate readonly onAction?: (tab: UsageTab, action: UsageAction) => void;\n\tprivate disposed = false;\n\tprivate view: UsageView;\n\tprivate detailFocus = false;\n\tprivate selectedId: string | undefined;\n\tprivate scrollTop = 0;\n\tprivate viewportHeight = 1;\n\tprivate maxScrollTop = 0;\n\tprivate regions: HitRegion[] = [];\n\tprivate renderedWidth = 0;\n\tprivate listWidth = 0;\n\n\tconstructor(\n\t\ttheme: Theme,\n\t\tkeybindings: KeybindingsManager,\n\t\ttabs: readonly UsageTab[],\n\t\tonClose: () => void,\n\t\trequestRender: () => void,\n\t\tgetHeight: () => number = () => 24,\n\t\tonAction?: (tab: UsageTab, action: UsageAction) => void,\n\t) {\n\t\tthis.theme = theme;\n\t\tthis.keybindings = keybindings;\n\t\tthis.tabs = tabs;\n\t\tthis.onClose = onClose;\n\t\tthis.requestRender = requestRender;\n\t\tthis.getHeight = getHeight;\n\t\tthis.onAction = onAction;\n\t\tthis.selectedId = this.accounts[0]?.id;\n\t\tthis.view = this.selectedId ? \"accounts\" : \"session\";\n\t}\n\n\tprivate get accounts(): UsageTab[] {\n\t\tconst providers = new Map<string, UsageTab[]>();\n\t\tfor (const tab of this.tabs) {\n\t\t\tif (tab.id === \"session\") continue;\n\t\t\tconst group = providers.get(tab.overview.providerId) ?? [];\n\t\t\tgroup.push(tab);\n\t\t\tproviders.set(tab.overview.providerId, group);\n\t\t}\n\t\treturn [...providers.values()].flat();\n\t}\n\n\tprivate get selectedAccount(): UsageTab | undefined {\n\t\tconst accounts = this.accounts;\n\t\treturn accounts.find((tab) => tab.id === this.selectedId) ?? accounts[0];\n\t}\n\n\tdispose(): void {\n\t\tif (this.disposed) return;\n\t\tthis.disposed = true;\n\t\tthis.regions = [];\n\t\tthis.onClose();\n\t}\n\n\tprivate showView(view: UsageView): void {\n\t\tthis.view = view;\n\t\tthis.detailFocus = view === \"session\";\n\t\tthis.scrollTop = 0;\n\t\tthis.regions = [];\n\t\tthis.requestRender();\n\t}\n\n\tprivate selectAccount(id: string): void {\n\t\tif (id !== this.selectedAccount?.id) this.scrollTop = 0;\n\t\tthis.selectedId = id;\n\t\tthis.regions = [];\n\t\tthis.requestRender();\n\t}\n\n\tprivate moveAccount(delta: number, wrap = false): boolean {\n\t\tconst accounts = this.accounts;\n\t\tif (this.view !== \"accounts\" || accounts.length === 0) return false;\n\t\tconst current = accounts.findIndex((tab) => tab.id === this.selectedAccount?.id);\n\t\tconst next = wrap\n\t\t\t? (current + delta + accounts.length) % accounts.length\n\t\t\t: Math.max(0, Math.min(accounts.length - 1, current + delta));\n\t\tif (next === current) return false;\n\t\tthis.selectAccount(accounts[next].id);\n\t\treturn true;\n\t}\n\n\tprivate scrollBy(delta: number): boolean {\n\t\tconst next = Math.max(0, Math.min(this.maxScrollTop, this.scrollTop + delta));\n\t\tif (next === this.scrollTop) return false;\n\t\tthis.scrollTop = next;\n\t\tthis.regions = [];\n\t\tthis.requestRender();\n\t\treturn true;\n\t}\n\n\tprivate invokeAction(action: UsageAction): void {\n\t\tconst tab = this.selectedAccount;\n\t\tif (this.view !== \"accounts\" || !tab || !this.onAction) return;\n\t\tif (action === \"reset\" && (!tab.resetAction || tab.resetDisabled)) return;\n\t\tthis.onAction(tab, action);\n\t\tthis.requestRender();\n\t}\n\n\thandleInput(data: string): void {\n\t\tif (this.disposed) return;\n\t\tconst kb = this.keybindings;\n\t\tif (kb.matches(data, \"app.clear\")) this.dispose();\n\t\telse if (kb.matches(data, \"tui.select.cancel\")) {\n\t\t\tif (this.view === \"accounts\" && this.detailFocus) {\n\t\t\t\tthis.detailFocus = false;\n\t\t\t\tthis.regions = [];\n\t\t\t\tthis.requestRender();\n\t\t\t} else this.dispose();\n\t\t} else if (kb.matches(data, \"app.usage.showAccounts\")) this.showView(\"accounts\");\n\t\telse if (kb.matches(data, \"app.usage.showSession\")) this.showView(\"session\");\n\t\telse if (kb.matches(data, \"app.usage.reset\")) this.invokeAction(\"reset\");\n\t\telse if (kb.matches(data, \"app.usage.billing\")) this.invokeAction(\"billing\");\n\t\telse if (kb.matches(data, \"app.usage.nextTab\")) this.moveAccount(1, true);\n\t\telse if (kb.matches(data, \"app.usage.previousTab\")) this.moveAccount(-1, true);\n\t\telse if (kb.matches(data, \"tui.select.confirm\") && this.view === \"accounts\" && this.selectedAccount) {\n\t\t\tthis.detailFocus = true;\n\t\t\tthis.regions = [];\n\t\t\tthis.requestRender();\n\t\t} else {\n\t\t\tlet delta = 0;\n\t\t\tif (kb.matches(data, \"tui.select.up\")) delta = -1;\n\t\t\telse if (kb.matches(data, \"tui.select.down\")) delta = 1;\n\t\t\telse if (kb.matches(data, \"tui.select.pageUp\")) delta = -this.viewportHeight;\n\t\t\telse if (kb.matches(data, \"tui.select.pageDown\")) delta = this.viewportHeight;\n\t\t\tif (delta) {\n\t\t\t\tif (this.view === \"accounts\" && !this.detailFocus) this.moveAccount(delta);\n\t\t\t\telse this.scrollBy(delta);\n\t\t\t}\n\t\t}\n\t}\n\n\thandleMouse(event: TuiMouseEvent): TuiMouseEventResult {\n\t\tif (this.disposed) return { handled: true, render: false };\n\t\tconst inBody = event.x >= 0 && event.x < this.renderedWidth && event.y >= 3 && event.y < 3 + this.viewportHeight;\n\t\tif (event.type === \"wheel\" && inBody) {\n\t\t\tconst inList = this.view === \"accounts\" && (this.listWidth > 0 ? event.x < this.listWidth : !this.detailFocus);\n\t\t\tconst delta = event.wheelDelta ?? 0;\n\t\t\tif (!delta) return { handled: true, render: false };\n\t\t\tconst focusChanged = this.detailFocus === inList;\n\t\t\tthis.detailFocus = !inList;\n\t\t\tconst changed = inList ? this.moveAccount(delta) : this.scrollBy(delta);\n\t\t\tif (focusChanged && !changed) this.requestRender();\n\t\t\treturn { handled: true, render: changed || focusChanged, focus: true };\n\t\t}\n\t\tif (event.type !== \"click\" || event.button !== \"left\") return { handled: true, render: false };\n\t\tconst region = this.regions.find(\n\t\t\t(item) => event.y === item.y && event.x >= item.x && event.x < item.x + item.width,\n\t\t);\n\t\tif (region) {\n\t\t\tregion.activate();\n\t\t\treturn { handled: true, render: true, focus: true };\n\t\t}\n\t\tif (inBody && this.view === \"accounts\" && this.listWidth > 0 && event.x > this.listWidth + 2) {\n\t\t\tthis.detailFocus = true;\n\t\t\tthis.requestRender();\n\t\t\treturn { handled: true, render: true, focus: true };\n\t\t}\n\t\treturn { handled: true, render: false };\n\t}\n\n\tinvalidate(): void {\n\t\tthis.regions = [];\n\t}\n\n\tprivate key(action: Keybinding): string {\n\t\tconst key = this.keybindings.getKeys(action)[0];\n\t\treturn key ? formatKeyText(key) : \"\";\n\t}\n\n\tprivate detailRows(tab: UsageTab, width: number): DetailRow[] {\n\t\tconst theme = this.theme;\n\t\tconst { providerId, modelId, bars, lines, notes } = tab.overview;\n\t\tconst session = this.view === \"session\";\n\t\tconst out: DetailRow[] = [];\n\t\tconst add = (text: string, action?: UsageAction, disabled?: boolean): void => {\n\t\t\tfor (const wrapped of wrapTextWithAnsi(text, width)) out.push({ text: wrapped, action, disabled });\n\t\t};\n\t\tconst row = (line: UsageLine): void => {\n\t\t\tconst padded = line.label + \" \".repeat(Math.max(0, 13 - visibleWidth(line.label)));\n\t\t\tconst value = line.tone ? theme.fg(TONE_COLOR[line.tone], line.value) : line.value;\n\t\t\tadd(` ${theme.fg(\"dim\", padded)} ${value}`);\n\t\t};\n\t\tconst addBars = (bars: UsageBar[]): void => {\n\t\t\tif (bars.length === 0) return;\n\t\t\t// Keep compact bars when they fit; stack and wrap details instead of truncating limits on narrow screens.\n\t\t\tconst labelWidth = Math.min(MAX_LABEL_WIDTH, Math.max(...bars.map((bar) => visibleWidth(bar.label))));\n\t\t\tconst displayWidth = Math.max(...bars.map((bar) => visibleWidth(bar.display)));\n\t\t\tconst barWidth = Math.max(MIN_BAR_WIDTH, Math.min(BAR_WIDTH, width - 2 - labelWidth - 3 - displayWidth));\n\t\t\tfor (const bar of bars) {\n\t\t\t\tconst label = bar.label + \" \".repeat(Math.max(0, labelWidth - visibleWidth(bar.label)));\n\t\t\t\tconst head = ` ${theme.fg(\"dim\", label)} ${renderBar(theme, bar, barWidth)} ${theme.fg(\"dim\", bar.display)}`;\n\t\t\t\tconst note = bar.note ? theme.fg(\"dim\", bar.note) : undefined;\n\t\t\t\tif (visibleWidth(head) > width) {\n\t\t\t\t\tadd(` ${theme.fg(\"dim\", `${bar.label} · ${bar.display}`)}`);\n\t\t\t\t\tadd(renderBar(theme, bar, Math.min(BAR_WIDTH, width)));\n\t\t\t\t\tif (note) add(` ${note}`);\n\t\t\t\t} else if (note && visibleWidth(head) + 2 + visibleWidth(note) <= width) add(`${head} ${note}`);\n\t\t\t\telse {\n\t\t\t\t\tadd(head);\n\t\t\t\t\tif (note) add(` ${note}`);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tadd(\n\t\t\ttheme.bold(session ? \"This session\" : tab.label) +\n\t\t\t\t(!session && tab.active ? ` ${theme.fg(\"success\", \"In use\")}` : \"\"),\n\t\t);\n\t\tadd(theme.fg(\"dim\", `${providerId} · ${modelId}`));\n\t\tadd(\"\");\n\t\tif (!session) add(theme.bold(\"INCLUDED USAGE\"));\n\t\tconst includedBars = session ? bars : bars.filter((bar) => !bar.section);\n\t\taddBars(includedBars);\n\t\tfor (const line of lines) if (session || !line.section) row(line);\n\t\tif (!session) {\n\t\t\tif (includedBars.length === 0 && !lines.some((line) => !line.section))\n\t\t\t\tadd(theme.fg(\"muted\", \" Usage not reported.\"));\n\t\t\tfor (const [section, title] of [\n\t\t\t\t[\"resets\", \"SAVED RESETS\"],\n\t\t\t\t[\"paid\", \"PAID USAGE\"],\n\t\t\t] as const) {\n\t\t\t\tadd(\"\");\n\t\t\t\tadd(theme.bold(title));\n\t\t\t\tconst sectionBars = bars.filter((bar) => bar.section === section);\n\t\t\t\taddBars(sectionBars);\n\t\t\t\tconst sectionLines = lines.filter((line) => line.section === section);\n\t\t\t\tfor (const line of sectionLines) row(line);\n\t\t\t\tif (sectionBars.length === 0 && sectionLines.length === 0) add(theme.fg(\"muted\", \" Not reported.\"));\n\t\t\t\tconst action = section === \"resets\" ? \"reset\" : \"billing\";\n\t\t\t\tconst label = section === \"resets\" ? tab.resetAction : this.onAction ? \"Open billing settings\" : undefined;\n\t\t\t\tif (label) {\n\t\t\t\t\tconst key = this.key(`app.usage.${action}`);\n\t\t\t\t\tconst disabled = !this.onAction || (action === \"reset\" && tab.resetDisabled === true);\n\t\t\t\t\tconst text = `[${key ? `${key} ` : \"\"}${label}]${disabled ? \" (disabled)\" : \"\"}`;\n\t\t\t\t\tadd(theme.fg(disabled ? \"muted\" : \"accent\", text), action, disabled);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (notes.length > 0) {\n\t\t\tadd(\"\");\n\t\t\tfor (const note of notes) add(theme.fg(\"warning\", note));\n\t\t}\n\t\treturn out;\n\t}\n\n\tprivate accountRows(width: number, height: number): string[] {\n\t\tconst accounts = this.accounts;\n\t\tconst selected = this.selectedAccount;\n\t\tconst all: { text: string; provider: string; account?: UsageTab }[] = [];\n\t\tlet provider: string | undefined;\n\t\tfor (const account of accounts) {\n\t\t\tif (provider !== account.overview.providerId) {\n\t\t\t\tprovider = account.overview.providerId;\n\t\t\t\tall.push({ text: this.theme.fg(\"muted\", this.theme.bold(providerLabel(provider))), provider });\n\t\t\t}\n\t\t\tconst marker = account.id === selected?.id ? \"> \" : \" \";\n\t\t\tconst status = account.active ? this.theme.fg(\"success\", \" In use\") : \"\";\n\t\t\tconst label = truncateToWidth(account.label, Math.max(0, width - 2 - visibleWidth(status)), \"…\");\n\t\t\tconst text = `${marker}${label}`;\n\t\t\tall.push({\n\t\t\t\ttext: (account.id === selected?.id ? this.theme.fg(\"accent\", this.theme.bold(text)) : text) + status,\n\t\t\t\tprovider: account.overview.providerId,\n\t\t\t\taccount,\n\t\t\t});\n\t\t}\n\t\tif (all.length === 0) return wrapTextWithAnsi(\"No saved accounts. Run /login.\", width).slice(0, height);\n\t\tconst selectedRow = all.findIndex((row) => row.account?.id === selected?.id);\n\t\tlet start = Math.max(0, Math.min(selectedRow - Math.floor((height - 1) / 2), all.length - height));\n\t\tconst sticky = start > 0 && all[start].account && height > 1;\n\t\tif (sticky && selectedRow >= start + height - 1) start = selectedRow - height + 2;\n\t\tconst visible = all.slice(start, start + height - (sticky ? 1 : 0));\n\t\tconst output: string[] = [];\n\t\tif (sticky) output.push(this.theme.fg(\"muted\", this.theme.bold(providerLabel(all[start].provider))));\n\t\tfor (const row of visible) {\n\t\t\tif (row.account) {\n\t\t\t\tconst id = row.account.id;\n\t\t\t\tthis.regions.push({\n\t\t\t\t\tx: 0,\n\t\t\t\t\ty: 3 + output.length,\n\t\t\t\t\twidth,\n\t\t\t\t\tactivate: () => {\n\t\t\t\t\t\tthis.detailFocus = this.listWidth === 0;\n\t\t\t\t\t\tthis.selectAccount(id);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t\toutput.push(truncateToWidth(row.text, width, \"…\"));\n\t\t}\n\t\treturn output;\n\t}\n\n\trender(width: number): string[] {\n\t\tthis.regions = [];\n\t\tif (this.disposed || width < 1) return [];\n\t\tconst theme = this.theme;\n\t\tthis.renderedWidth = width;\n\t\tconst accounts = this.accounts;\n\t\tconst selected = this.selectedAccount;\n\t\tthis.listWidth = this.view === \"accounts\" && width >= 76 ? Math.min(32, Math.floor(width / 3)) : 0;\n\t\tconst split = this.listWidth > 0;\n\t\tconst showingList = this.view === \"accounts\" && !this.detailFocus;\n\t\tconst detailWidth = split ? width - this.listWidth - 3 : width;\n\t\tconst tab = this.view === \"session\" ? this.tabs.find((item) => item.id === \"session\") : selected;\n\t\tconst details: DetailRow[] = tab ? this.detailRows(tab, detailWidth) : [{ text: \"No usage data available.\" }];\n\t\tconst controls = (\n\t\t\t[\n\t\t\t\t[\"accounts\", \"app.usage.showAccounts\", \"Accounts\"],\n\t\t\t\t[\"session\", \"app.usage.showSession\", \"Session\"],\n\t\t\t] as const\n\t\t).map(([view, action, label]) => {\n\t\t\tconst key = this.key(action);\n\t\t\treturn { view, text: `[${key ? `${key} ` : \"\"}${label}]` };\n\t\t});\n\t\tconst stackedControls = controls.reduce((sum, control) => sum + visibleWidth(control.text), 2) > width;\n\t\tlet controlX = 0;\n\t\tconst navigation = controls.map(({ view, text }, index) => {\n\t\t\tconst x = stackedControls ? 0 : controlX;\n\t\t\tthis.regions.push({\n\t\t\t\tx,\n\t\t\t\ty: stackedControls ? index : 1,\n\t\t\t\twidth: Math.min(visibleWidth(text), width - x),\n\t\t\t\tactivate: () => this.showView(view),\n\t\t\t});\n\t\t\tcontrolX += visibleWidth(text) + 2;\n\t\t\treturn this.view === view ? theme.fg(\"accent\", theme.bold(text)) : theme.fg(\"muted\", text);\n\t\t});\n\t\tconst header = stackedControls ? navigation : [theme.bold(\"Usage\"), navigation.join(\" \")];\n\t\tconst selectKeys = [this.key(\"tui.select.up\"), this.key(\"tui.select.down\")].filter(Boolean).join(\"/\");\n\t\tconst confirm = showingList && selected ? this.key(\"tui.select.confirm\") : \"\";\n\t\tconst cycleKeys =\n\t\t\tthis.view === \"accounts\"\n\t\t\t\t? [this.key(\"app.usage.nextTab\"), this.key(\"app.usage.previousTab\")].filter(Boolean).join(\"/\")\n\t\t\t\t: \"\";\n\t\tconst cancel = this.key(\"tui.select.cancel\");\n\t\tconst footerParts = [\n\t\t\tselectKeys ? `${selectKeys} ${showingList ? \"select\" : \"scroll\"}` : \"\",\n\t\t\tconfirm ? `${confirm} details` : \"\",\n\t\t];\n\t\tif (cycleKeys && width >= 60) footerParts.push(`${cycleKeys} cycle`);\n\t\tconst actionHints: string[] = [];\n\t\tif (this.view === \"accounts\" && selected && this.onAction) {\n\t\t\tfor (const [action, label, enabled] of [\n\t\t\t\t[\"reset\", \"saved reset\", selected.resetAction && !selected.resetDisabled],\n\t\t\t\t[\"billing\", \"billing settings\", true],\n\t\t\t] as const) {\n\t\t\t\tconst key = this.key(`app.usage.${action}`);\n\t\t\t\tif (key && enabled) actionHints.push(theme.fg(\"accent\", `${key} ${label}`));\n\t\t\t}\n\t\t}\n\t\tconst footer = [\n\t\t\t...wrapTextWithAnsi(footerParts.filter(Boolean).join(\" · \"), width),\n\t\t\t...wrapTextWithAnsi(\n\t\t\t\t[\n\t\t\t\t\tcancel ? `${cancel} ${this.view === \"accounts\" && this.detailFocus ? \"accounts\" : \"close\"}` : \"\",\n\t\t\t\t\t...actionHints,\n\t\t\t\t]\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.join(\" · \"),\n\t\t\t\twidth,\n\t\t\t),\n\t\t];\n\t\t// The editor dock measures render() at its natural height; leave room for the transcript, spacer, and footer.\n\t\tconst height = Math.max(1, Math.floor(this.getHeight()) - 5);\n\t\tconst visibleFooter = footer.slice(0, Math.max(0, height - 4));\n\t\tthis.viewportHeight = Math.max(1, height - 3 - visibleFooter.length);\n\t\tthis.maxScrollTop = Math.max(0, details.length - this.viewportHeight);\n\t\tthis.scrollTop = Math.min(this.scrollTop, this.maxScrollTop);\n\t\tconst accountHeading = `Accounts ${selected ? accounts.findIndex((item) => item.id === selected.id) + 1 : 0}/${accounts.length}`;\n\t\tconst detailHeading = `${this.view === \"session\" ? \"Session\" : \"Details\"}${this.detailFocus ? \" (focused)\" : \"\"} ${this.scrollTop + 1}/${this.maxScrollTop + 1}`;\n\t\tconst heading = split\n\t\t\t? truncateToWidth(theme.bold(accountHeading), this.listWidth, \"…\", true) +\n\t\t\t\ttheme.fg(\"dim\", \" │ \") +\n\t\t\t\ttheme.bold(detailHeading)\n\t\t\t: theme.bold(showingList ? accountHeading : detailHeading);\n\t\tconst list =\n\t\t\tthis.view === \"accounts\" && (split || showingList)\n\t\t\t\t? this.accountRows(split ? this.listWidth : width, this.viewportHeight)\n\t\t\t\t: [];\n\t\tconst body: string[] = [];\n\t\tfor (let index = 0; index < this.viewportHeight; index++) {\n\t\t\tconst row = details[this.scrollTop + index];\n\t\t\tif (row?.action && !row.disabled && (!showingList || split)) {\n\t\t\t\tconst action = row.action;\n\t\t\t\tthis.regions.push({\n\t\t\t\t\tx: split ? this.listWidth + 3 : 0,\n\t\t\t\t\ty: 3 + index,\n\t\t\t\t\twidth: visibleWidth(row.text),\n\t\t\t\t\tactivate: () => this.invokeAction(action),\n\t\t\t\t});\n\t\t\t}\n\t\t\tbody.push(\n\t\t\t\tsplit\n\t\t\t\t\t? truncateToWidth(list[index] ?? \"\", this.listWidth, \"\", true) +\n\t\t\t\t\t\t\ttheme.fg(\"dim\", \" │ \") +\n\t\t\t\t\t\t\t(row?.text ?? \"\")\n\t\t\t\t\t: showingList\n\t\t\t\t\t\t? (list[index] ?? \"\")\n\t\t\t\t\t\t: (row?.text ?? \"\"),\n\t\t\t);\n\t\t}\n\t\t// A line wider than the terminal aborts rendering.\n\t\treturn [...header, heading, ...body, ...visibleFooter.map((line) => theme.fg(\"muted\", line))]\n\t\t\t.slice(0, height)\n\t\t\t.map((line) => truncateToWidth(line, width, \"…\"));\n\t}\n}\n"]}
|