@humain/humain-code 0.7.0 → 0.8.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 +160 -0
- package/README.md +2 -2
- package/dist/bundle/agent-monitor.js +1 -1
- package/dist/bundle/chunks/anthropic-messages-XFCDMGD6.js +77 -0
- package/dist/bundle/chunks/anthropic.js +25 -24
- package/dist/bundle/chunks/azure-openai-responses-F4KQM3NK.js +15 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +460 -431
- package/dist/bundle/chunks/bowser-DXKSTXFQ.js +89 -0
- package/dist/bundle/chunks/{chunk-2G7YVAVF.js → chunk-2JNJJ6SZ.js} +1 -1
- package/dist/bundle/chunks/{chunk-HTA325LJ.js → chunk-2NVGOSBN.js} +1 -1
- package/dist/bundle/chunks/{chunk-5B25YXF7.js → chunk-3CGMVKHA.js} +13 -3
- package/dist/bundle/chunks/{chunk-SCINMV4X.js → chunk-46C6D7UC.js} +22 -21
- package/dist/bundle/chunks/chunk-4MKATHT2.js +24 -0
- package/dist/bundle/chunks/{chunk-TGDPZCSW.js → chunk-4TDNOR36.js} +1 -1
- package/dist/bundle/chunks/{chunk-C6VERWRZ.js → chunk-4XF5JX7X.js} +1 -1
- package/dist/bundle/chunks/{chunk-4HTVBBJD.js → chunk-65FLSKDA.js} +2 -2
- package/dist/bundle/chunks/chunk-6HTHDVJC.js +4 -0
- package/dist/bundle/chunks/{chunk-4PRNKB6V.js → chunk-6P6MMQUH.js} +7 -7
- package/dist/bundle/chunks/{chunk-66FZJO75.js → chunk-6TTMNQXI.js} +472 -3924
- package/dist/bundle/chunks/{chunk-32QLLD2P.js → chunk-6YVORXTX.js} +410 -352
- package/dist/bundle/chunks/chunk-7H2WNBX7.js +11 -0
- package/dist/bundle/chunks/{chunk-2FYYW6FY.js → chunk-7OZNMWAJ.js} +1 -1
- package/dist/bundle/chunks/{chunk-R6YQR7TZ.js → chunk-7WE77IE3.js} +1 -1
- package/dist/bundle/chunks/{chunk-Z5YLKK3S.js → chunk-7WETECIB.js} +1 -1
- package/dist/bundle/chunks/chunk-7X6DNT45.js +78 -0
- package/dist/bundle/chunks/{chunk-KRCX3ZBA.js → chunk-APNPBT7Y.js} +1 -1
- package/dist/bundle/chunks/{chunk-R5OOX7RW.js → chunk-B47PNNLL.js} +9 -2
- package/dist/bundle/chunks/{chunk-PPBDDQHP.js → chunk-CQ2CE3RB.js} +7 -6
- package/dist/bundle/chunks/{chunk-MD7K7RPN.js → chunk-D3KYOSQY.js} +1 -1
- package/dist/bundle/chunks/{chunk-I3NDOUHE.js → chunk-DCXHRP6C.js} +1 -1
- package/dist/bundle/chunks/{chunk-OB332KMV.js → chunk-DD5UT56Y.js} +46 -32
- package/dist/bundle/chunks/{chunk-I5E7RQ5V.js → chunk-DJG2WUNM.js} +5 -5
- package/dist/bundle/chunks/{chunk-4QAXV5T6.js → chunk-E7OBH44W.js} +9 -9
- package/dist/bundle/chunks/{chunk-Q7VXYXY3.js → chunk-ENBDASDN.js} +2 -2
- package/dist/bundle/chunks/{chunk-RS6PZK35.js → chunk-F2H47FRF.js} +249 -216
- package/dist/bundle/chunks/{chunk-2H3LUS62.js → chunk-FJIISX5W.js} +241 -229
- package/dist/bundle/chunks/chunk-FQ4KS5S4.js +23 -0
- package/dist/bundle/chunks/{chunk-SSRCVJZK.js → chunk-GPLWWO5Q.js} +5 -5
- package/dist/bundle/chunks/{chunk-WQOOJP7U.js → chunk-GV5OVRKK.js} +1 -1
- package/dist/bundle/chunks/{chunk-KTSJYIYC.js → chunk-HHWVVNGG.js} +1 -1
- package/dist/bundle/chunks/{chunk-4JRER4XK.js → chunk-HQMUDHC3.js} +19 -19
- package/dist/bundle/chunks/{chunk-G4QPSFBF.js → chunk-IMUFBWEK.js} +216 -223
- package/dist/bundle/chunks/{chunk-RU7ADKA7.js → chunk-J4GII2EE.js} +112 -96
- package/dist/bundle/chunks/{chunk-QT6ZHDMP.js → chunk-JBSWWCT5.js} +1 -1
- package/dist/bundle/chunks/{chunk-PWUDFU5V.js → chunk-JWOPWHVH.js} +4 -4
- package/dist/bundle/chunks/{chunk-AEWYICBL.js → chunk-KI7CHPWC.js} +2 -2
- package/dist/bundle/chunks/{chunk-4V5VL2BO.js → chunk-KLSRGGOH.js} +131 -154
- package/dist/bundle/chunks/{chunk-JF7FYXAI.js → chunk-KONLZKPL.js} +7 -6
- package/dist/bundle/chunks/{chunk-N2SNMUD3.js → chunk-KRBELWQH.js} +1 -1
- package/dist/bundle/chunks/{chunk-UZNIPOGS.js → chunk-L4J7SMJB.js} +1 -1
- package/dist/bundle/chunks/{chunk-EIC7CQX3.js → chunk-LSRXA7OS.js} +1 -1
- package/dist/bundle/chunks/{chunk-GRJUKEE3.js → chunk-MIAXMK5F.js} +4 -4
- package/dist/bundle/chunks/chunk-MPRAQ6ZI.js +41 -0
- package/dist/bundle/chunks/{chunk-GUHNFZ2Q.js → chunk-NICPFMOP.js} +20 -19
- package/dist/bundle/chunks/{chunk-WAPZN4KP.js → chunk-P2Y2H7SD.js} +2 -2
- package/dist/bundle/chunks/{chunk-T7BXP46S.js → chunk-P42E6YY6.js} +1892 -1680
- package/dist/bundle/chunks/{chunk-3EDMWQ35.js → chunk-PFBAIRCY.js} +17 -15
- package/dist/bundle/chunks/{chunk-XHDVDJM7.js → chunk-PVNXN2TC.js} +7 -7
- package/dist/bundle/chunks/{chunk-TWAHPPXN.js → chunk-PWFM6AQQ.js} +1307 -1194
- package/dist/bundle/chunks/{chunk-RNBZBCH2.js → chunk-QJB5YI3I.js} +1 -1
- package/dist/bundle/chunks/{chunk-P6AXBESH.js → chunk-QRRVZYTG.js} +1119 -1098
- package/dist/bundle/chunks/{chunk-WQ7EJQIT.js → chunk-ROFZVEFN.js} +247 -250
- package/dist/bundle/chunks/chunk-SKCJ25SX.js +24 -0
- package/dist/bundle/chunks/{chunk-AZXVJN6E.js → chunk-SXOIQWNX.js} +1 -1
- package/dist/bundle/chunks/{chunk-6E6RHNOU.js → chunk-UXM4WFLH.js} +12 -11
- package/dist/bundle/chunks/{chunk-LB4CIS4F.js → chunk-VCMXBP5S.js} +17 -17
- package/dist/bundle/chunks/{chunk-JYWUOKOI.js → chunk-WBSGWISD.js} +367 -353
- package/dist/bundle/chunks/chunk-XZ7FTBXS.js +2102 -0
- package/dist/bundle/chunks/chunk-YSWDFV2L.js +11 -0
- package/dist/bundle/chunks/chunk-ZG74NES2.js +2 -0
- package/dist/bundle/chunks/chunk-ZTG5OKI7.js +3 -0
- package/dist/bundle/chunks/{cli-H4LJNE2V.js → cli-6DJO467D.js} +2 -2
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-T5R2RVFQ.js → cloudflare-workers-ai-system-one-JEZVYITT.js} +1 -1
- package/dist/bundle/chunks/codemode-worker.js +68 -68
- package/dist/bundle/chunks/compat-SRCNS6OQ.js +15 -0
- package/dist/bundle/chunks/curator-server-QB4GITGS.js +3600 -0
- package/dist/bundle/chunks/dist-35STTNYA.js +37 -0
- package/dist/bundle/chunks/{dist-FMWWM4H7.js → dist-4OMLHRJE.js} +2 -2
- package/dist/bundle/chunks/dist-CBODG4CA.js +11 -0
- package/dist/bundle/chunks/{dist-NHQTBDHT.js → dist-TRAK7EXI.js} +91 -257
- package/dist/bundle/chunks/dist-cjs-EROMDUKS.js +193 -0
- package/dist/bundle/chunks/{easter-egg-3d-BUEOC3NO.js → easter-egg-3d-VVUF3C3X.js} +1 -1
- package/dist/bundle/chunks/entry-2GZ3PTWQ.js +2 -0
- package/dist/bundle/chunks/{entry-A2CSLKHC.js → entry-SRYLSS5P.js} +3 -3
- package/dist/bundle/chunks/{event-streams-7YGFEPBZ.js → event-streams-F67JLS6B.js} +1 -1
- package/dist/bundle/chunks/{execute-MY5JSEPV.js → execute-I3WGGPWL.js} +2 -2
- package/dist/bundle/chunks/{extract-PTGACPGP.js → extract-L373D6O7.js} +68 -65
- package/dist/bundle/chunks/{flow-implementer-APJFY4YI.js → flow-implementer-4KO3Q4B5.js} +8 -9
- package/dist/bundle/chunks/github-copilot.js +53 -46
- package/dist/bundle/chunks/google-generative-ai-WIASMWS3.js +22 -0
- package/dist/bundle/chunks/google-vertex-WSPHRZIZ.js +25 -0
- package/dist/bundle/chunks/host-WOLZCWQQ.js +3 -0
- package/dist/bundle/chunks/image-resize-worker.js +3 -3
- package/dist/bundle/chunks/{index.bundle-THL4EUSU.js → index.bundle-HONF3PUD.js} +177 -176
- package/dist/bundle/chunks/{inprocess-5NP5VJHZ.js → inprocess-TOBRVK4C.js} +6 -6
- package/dist/bundle/chunks/interactive-mode-BJJKPBXD.js +5 -0
- package/dist/bundle/chunks/{llama-cpp-classify-GJAXULWL.js → llama-cpp-classify-KYZT532X.js} +1 -1
- package/dist/bundle/chunks/mistral-conversations-7JYDDRUT.js +43 -0
- package/dist/bundle/chunks/{node-UNHECG4X.js → node-MHHE76P4.js} +475 -440
- package/dist/bundle/chunks/{node-ZFIIS5IM.js → node-N7TPBUJB.js} +53 -30
- package/dist/bundle/chunks/{openai-codex-responses-S7CMCAOY.js → openai-codex-responses-7PAML4NF.js} +30 -29
- package/dist/bundle/chunks/openai-codex.js +9 -8
- package/dist/bundle/chunks/{openai-completions-2Z57N7PC.js → openai-completions-UJDAIGTK.js} +22 -22
- package/dist/bundle/chunks/{openai-decisions-JIOJDB4C.js → openai-decisions-JMSDGR7K.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-5VBZSTHL.js → openai-responses-2WNCE6AY.js} +4 -5
- package/dist/bundle/chunks/{openrouter-images-S6O7DBEJ.js → openrouter-images-V3UCCO6X.js} +1 -1
- package/dist/bundle/chunks/openrouter.js +9 -8
- package/dist/bundle/chunks/pdfjs-FE3L72A6.js +3662 -0
- package/dist/bundle/chunks/{pdfjs-decoders-OFXX4HDZ.js → pdfjs-decoders-VCMCTQJ2.js} +1 -1
- package/dist/bundle/chunks/pdfjs-jbig2_nowasm_fallback-I4K6AIV4.js +295 -0
- package/dist/bundle/chunks/pdfjs-openjpeg-PYQCV6CM.js +590 -0
- package/dist/bundle/chunks/pdfjs-openjpeg_nowasm_fallback-G363SGDI.js +775 -0
- package/dist/bundle/chunks/{pi-messages-SMLN5J2W.js → pi-messages-TQ7LJUNQ.js} +11 -11
- package/dist/bundle/chunks/radius.js +8 -7
- package/dist/bundle/chunks/{runtime-OYTWXIUM.js → runtime-H7LYNKCZ.js} +1 -1
- package/dist/bundle/chunks/session-picker-4JQEGLDD.js +4 -0
- package/dist/bundle/chunks/startup-ui-AKTA4NDP.js +3 -0
- package/dist/bundle/chunks/{trace-command-YLDYCL55.js → trace-command-7ORDQ3JS.js} +4 -4
- package/dist/bundle/chunks/{typesafe-system-one-7BEL3H5N.js → typesafe-system-one-YP7GGN4C.js} +1 -1
- package/dist/bundle/chunks/{undici-C6S56CGI.js → undici-WVNE45GY.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-3CT5BMBA.js +28 -0
- package/dist/bundle/cli-runtime.js +5 -5
- package/dist/bundle/flow/package.json +5 -5
- package/dist/bundle/index.js +13 -13
- package/dist/bundle/orchestrate/package.json +22 -6
- package/dist/bundle/rpc-entry.js +4 -5
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +4 -3
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +9 -6
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +16 -1
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +9 -6
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli/setup.d.ts +1 -1
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +3 -2
- package/dist/cli/setup.js.map +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +8 -4
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +14 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +30 -2
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +0 -2
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +0 -2
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +31 -39
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +231 -535
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/anthropic-subscription-usage.d.ts +4 -2
- package/dist/core/anthropic-subscription-usage.d.ts.map +1 -1
- package/dist/core/anthropic-subscription-usage.js +32 -16
- package/dist/core/anthropic-subscription-usage.js.map +1 -1
- package/dist/core/auto-session-namer.js +1 -1
- package/dist/core/auto-session-namer.js.map +1 -1
- package/dist/core/cache-warmer.d.ts.map +1 -1
- package/dist/core/cache-warmer.js +2 -0
- package/dist/core/cache-warmer.js.map +1 -1
- package/dist/core/exec.d.ts +1 -0
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +4 -1
- package/dist/core/exec.js.map +1 -1
- package/dist/core/export-html/ansi-to-html.d.ts +6 -1
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/dist/core/export-html/ansi-to-html.js +57 -20
- package/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/dist/core/export-html/template.js +1 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +2 -3
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +18 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +5 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +5 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/flow-implementer.d.ts.map +1 -1
- package/dist/core/flow-implementer.js +3 -9
- package/dist/core/flow-implementer.js.map +1 -1
- package/dist/core/keybindings.d.ts +64 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +8 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-config.d.ts +13 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-registry.d.ts +3 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +44 -9
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +0 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +14 -17
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +28 -8
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +64 -14
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/oauth-account-pool.d.ts +9 -0
- package/dist/core/oauth-account-pool.d.ts.map +1 -1
- package/dist/core/oauth-account-pool.js +138 -23
- package/dist/core/oauth-account-pool.js.map +1 -1
- package/dist/core/package-manager.d.ts +16 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +46 -3
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/pi-ai-schemas.d.ts +1 -0
- package/dist/core/pi-ai-schemas.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +7 -0
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts +5 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +2 -0
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/run-outcome.d.ts +6 -3
- package/dist/core/run-outcome.d.ts.map +1 -1
- package/dist/core/run-outcome.js +36 -9
- package/dist/core/run-outcome.js.map +1 -1
- package/dist/core/run-preflight.d.ts +1 -1
- package/dist/core/run-preflight.d.ts.map +1 -1
- package/dist/core/run-preflight.js +19 -11
- package/dist/core/run-preflight.js.map +1 -1
- package/dist/core/sdk.d.ts +0 -6
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +9 -18
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager.d.ts +0 -5
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +0 -9
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +0 -4
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +0 -1
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tools/bash-jobs.d.ts.map +1 -1
- package/dist/core/tools/bash-jobs.js +2 -9
- package/dist/core/tools/bash-jobs.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +28 -16
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +4 -1
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/read.d.ts +8 -4
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +10 -15
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/renderers/read.d.ts.map +1 -1
- package/dist/core/tools/renderers/read.js +6 -2
- package/dist/core/tools/renderers/read.js.map +1 -1
- package/dist/core/tools/subagent-worktree.d.ts.map +1 -1
- package/dist/core/tools/subagent-worktree.js +2 -10
- package/dist/core/tools/subagent-worktree.js.map +1 -1
- package/dist/core/trace-client/credential-store.d.ts.map +1 -1
- package/dist/core/trace-client/credential-store.js +9 -5
- package/dist/core/trace-client/credential-store.js.map +1 -1
- package/dist/extensions/codemode/execute.js +2 -2
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +6 -4
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/usage/account-reconnect.d.ts +5 -0
- package/dist/extensions/usage/account-reconnect.d.ts.map +1 -0
- package/dist/extensions/usage/account-reconnect.js +12 -0
- package/dist/extensions/usage/account-reconnect.js.map +1 -0
- package/dist/extensions/usage/confirmation.d.ts.map +1 -1
- package/dist/extensions/usage/confirmation.js +1 -1
- package/dist/extensions/usage/confirmation.js.map +1 -1
- package/dist/extensions/usage/hcode-overview.d.ts +6 -19
- package/dist/extensions/usage/hcode-overview.d.ts.map +1 -1
- package/dist/extensions/usage/hcode-overview.js +86 -100
- package/dist/extensions/usage/hcode-overview.js.map +1 -1
- package/dist/extensions/usage/index.d.ts.map +1 -1
- package/dist/extensions/usage/index.js +75 -99
- package/dist/extensions/usage/index.js.map +1 -1
- package/dist/extensions/usage/overview.d.ts +22 -17
- package/dist/extensions/usage/overview.d.ts.map +1 -1
- package/dist/extensions/usage/overview.js +98 -13
- package/dist/extensions/usage/overview.js.map +1 -1
- package/dist/extensions/usage/panes.d.ts +5 -0
- package/dist/extensions/usage/panes.d.ts.map +1 -0
- package/dist/extensions/usage/panes.js +10 -0
- package/dist/extensions/usage/panes.js.map +1 -0
- package/dist/extensions/usage/popup.d.ts +9 -14
- package/dist/extensions/usage/popup.d.ts.map +1 -1
- package/dist/extensions/usage/popup.js +87 -183
- package/dist/extensions/usage/popup.js.map +1 -1
- package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +4 -1
- package/dist/humain/flow-command.js +1 -1
- package/dist/humain/flow-command.js.map +1 -1
- package/dist/humain/flow-loader.d.ts +9 -4
- package/dist/humain/flow-loader.d.ts.map +1 -1
- package/dist/humain/flow-loader.js +30 -21
- package/dist/humain/flow-loader.js.map +1 -1
- package/dist/humain/gateway/client.d.ts +3 -1
- package/dist/humain/gateway/client.d.ts.map +1 -1
- package/dist/humain/gateway/client.js +10 -5
- package/dist/humain/gateway/client.js.map +1 -1
- package/dist/humain/gateway/login.d.ts.map +1 -1
- package/dist/humain/gateway/login.js +160 -53
- package/dist/humain/gateway/login.js.map +1 -1
- package/dist/humain/hcode/account-store.d.ts +29 -5
- package/dist/humain/hcode/account-store.d.ts.map +1 -1
- package/dist/humain/hcode/account-store.js +224 -124
- package/dist/humain/hcode/account-store.js.map +1 -1
- package/dist/humain/hcode/account.d.ts +6 -0
- package/dist/humain/hcode/account.d.ts.map +1 -1
- package/dist/humain/hcode/account.js +348 -129
- package/dist/humain/hcode/account.js.map +1 -1
- package/dist/humain/hcode/catalog-watch.d.ts +21 -0
- package/dist/humain/hcode/catalog-watch.d.ts.map +1 -0
- package/dist/humain/hcode/catalog-watch.js +46 -0
- package/dist/humain/hcode/catalog-watch.js.map +1 -0
- package/dist/humain/hcode/contracts.d.ts +31 -1
- package/dist/humain/hcode/contracts.d.ts.map +1 -1
- package/dist/humain/hcode/contracts.js +205 -136
- package/dist/humain/hcode/contracts.js.map +1 -1
- package/dist/humain/hcode/environment.d.ts +3 -1
- package/dist/humain/hcode/environment.d.ts.map +1 -1
- package/dist/humain/hcode/environment.js +14 -2
- package/dist/humain/hcode/environment.js.map +1 -1
- package/dist/humain/hcode/facade.d.ts +26 -6
- package/dist/humain/hcode/facade.d.ts.map +1 -1
- package/dist/humain/hcode/facade.js +148 -38
- package/dist/humain/hcode/facade.js.map +1 -1
- package/dist/humain/hcode/http.d.ts +3 -1
- package/dist/humain/hcode/http.d.ts.map +1 -1
- package/dist/humain/hcode/http.js +44 -23
- package/dist/humain/hcode/http.js.map +1 -1
- package/dist/humain/hcode/images.d.ts +67 -0
- package/dist/humain/hcode/images.d.ts.map +1 -0
- package/dist/humain/hcode/images.js +465 -0
- package/dist/humain/hcode/images.js.map +1 -0
- package/dist/humain/hcode/login-copy.d.ts +28 -0
- package/dist/humain/hcode/login-copy.d.ts.map +1 -0
- package/dist/humain/hcode/login-copy.js +74 -0
- package/dist/humain/hcode/login-copy.js.map +1 -0
- package/dist/humain/hcode/login-failure.d.ts +26 -0
- package/dist/humain/hcode/login-failure.d.ts.map +1 -0
- package/dist/humain/hcode/login-failure.js +50 -0
- package/dist/humain/hcode/login-failure.js.map +1 -0
- package/dist/humain/hcode/notices.d.ts +45 -1
- package/dist/humain/hcode/notices.d.ts.map +1 -1
- package/dist/humain/hcode/notices.js +124 -7
- package/dist/humain/hcode/notices.js.map +1 -1
- package/dist/humain/hcode/provider.d.ts +9 -3
- package/dist/humain/hcode/provider.d.ts.map +1 -1
- package/dist/humain/hcode/provider.js +204 -20
- package/dist/humain/hcode/provider.js.map +1 -1
- package/dist/humain/hcode/run-credential.d.ts +21 -0
- package/dist/humain/hcode/run-credential.d.ts.map +1 -0
- package/dist/humain/hcode/run-credential.js +140 -0
- package/dist/humain/hcode/run-credential.js.map +1 -0
- package/dist/humain/hcode/sandbox.d.ts +6 -0
- package/dist/humain/hcode/sandbox.d.ts.map +1 -0
- package/dist/humain/hcode/sandbox.js +139 -0
- package/dist/humain/hcode/sandbox.js.map +1 -0
- package/dist/humain/hcode/selection.d.ts +9 -2
- package/dist/humain/hcode/selection.d.ts.map +1 -1
- package/dist/humain/hcode/selection.js +37 -6
- package/dist/humain/hcode/selection.js.map +1 -1
- package/dist/humain/hcode/transport.d.ts +14 -10
- package/dist/humain/hcode/transport.d.ts.map +1 -1
- package/dist/humain/hcode/transport.js +119 -149
- package/dist/humain/hcode/transport.js.map +1 -1
- package/dist/humain/hcode/wire.d.ts +3 -0
- package/dist/humain/hcode/wire.d.ts.map +1 -1
- package/dist/humain/hcode/wire.js +11 -0
- package/dist/humain/hcode/wire.js.map +1 -1
- package/dist/humain/metadata/contracts.d.ts +1 -0
- package/dist/humain/metadata/contracts.d.ts.map +1 -1
- package/dist/humain/metadata/contracts.js +2 -1
- package/dist/humain/metadata/contracts.js.map +1 -1
- package/dist/humain/remote/broker.d.ts +84 -0
- package/dist/humain/remote/broker.d.ts.map +1 -0
- package/dist/humain/remote/broker.js +427 -0
- package/dist/humain/remote/broker.js.map +1 -0
- package/dist/humain/remote/deny-store.d.ts +12 -0
- package/dist/humain/remote/deny-store.d.ts.map +1 -0
- package/dist/humain/remote/deny-store.js +164 -0
- package/dist/humain/remote/deny-store.js.map +1 -0
- package/dist/humain/remote/enablement.d.ts +5 -0
- package/dist/humain/remote/enablement.d.ts.map +1 -0
- package/dist/humain/remote/enablement.js +8 -0
- package/dist/humain/remote/enablement.js.map +1 -0
- package/dist/humain/remote/environment.d.ts +11 -0
- package/dist/humain/remote/environment.d.ts.map +1 -0
- package/dist/humain/remote/environment.js +19 -0
- package/dist/humain/remote/environment.js.map +1 -0
- package/dist/humain/remote/host-watch.d.ts +21 -0
- package/dist/humain/remote/host-watch.d.ts.map +1 -0
- package/dist/humain/remote/host-watch.js +186 -0
- package/dist/humain/remote/host-watch.js.map +1 -0
- package/dist/humain/remote/ipc-posix.d.ts +5 -0
- package/dist/humain/remote/ipc-posix.d.ts.map +1 -0
- package/dist/humain/remote/ipc-posix.js +29 -0
- package/dist/humain/remote/ipc-posix.js.map +1 -0
- package/dist/humain/remote/ipc-windows.d.ts +3 -0
- package/dist/humain/remote/ipc-windows.d.ts.map +1 -0
- package/dist/humain/remote/ipc-windows.js +5 -0
- package/dist/humain/remote/ipc-windows.js.map +1 -0
- package/dist/humain/remote/ipc.d.ts +10 -0
- package/dist/humain/remote/ipc.d.ts.map +1 -0
- package/dist/humain/remote/ipc.js +19 -0
- package/dist/humain/remote/ipc.js.map +1 -0
- package/dist/humain/remote/protocol.d.ts +43 -0
- package/dist/humain/remote/protocol.d.ts.map +1 -0
- package/dist/humain/remote/protocol.js +76 -0
- package/dist/humain/remote/protocol.js.map +1 -0
- package/dist/humain/remote/relay-socket.d.ts +30 -0
- package/dist/humain/remote/relay-socket.d.ts.map +1 -0
- package/dist/humain/remote/relay-socket.js +137 -0
- package/dist/humain/remote/relay-socket.js.map +1 -0
- package/dist/humain/remote/secure-channel.d.ts +10 -0
- package/dist/humain/remote/secure-channel.d.ts.map +1 -0
- package/dist/humain/remote/secure-channel.js +5 -0
- package/dist/humain/remote/secure-channel.js.map +1 -0
- package/dist/humain/remote/terminal.d.ts +48 -0
- package/dist/humain/remote/terminal.d.ts.map +1 -0
- package/dist/humain/remote/terminal.js +119 -0
- package/dist/humain/remote/terminal.js.map +1 -0
- package/dist/humain/remote/tickets.d.ts +35 -0
- package/dist/humain/remote/tickets.d.ts.map +1 -0
- package/dist/humain/remote/tickets.js +132 -0
- package/dist/humain/remote/tickets.js.map +1 -0
- package/dist/humain/web-access/vendor/anysearch.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/anysearch.js +7 -3
- package/dist/humain/web-access/vendor/anysearch.js.map +1 -1
- package/dist/humain/web-access/vendor/autom.d.ts +4 -0
- package/dist/humain/web-access/vendor/autom.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/autom.js +191 -0
- package/dist/humain/web-access/vendor/autom.js.map +1 -0
- package/dist/humain/web-access/vendor/cloro.d.ts +4 -0
- package/dist/humain/web-access/vendor/cloro.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/cloro.js +236 -0
- package/dist/humain/web-access/vendor/cloro.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 +7 -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 +6 -0
- package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
- package/dist/humain/web-access/vendor/domain-filter-normalization.d.ts +8 -0
- package/dist/humain/web-access/vendor/domain-filter-normalization.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/domain-filter-normalization.js +37 -0
- package/dist/humain/web-access/vendor/domain-filter-normalization.js.map +1 -1
- package/dist/humain/web-access/vendor/duckduckgo-rate-limit.d.ts +28 -8
- package/dist/humain/web-access/vendor/duckduckgo-rate-limit.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/duckduckgo-rate-limit.js +135 -34
- package/dist/humain/web-access/vendor/duckduckgo-rate-limit.js.map +1 -1
- package/dist/humain/web-access/vendor/duckduckgo.d.ts +1 -1
- package/dist/humain/web-access/vendor/duckduckgo.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/duckduckgo.js +10 -3
- package/dist/humain/web-access/vendor/duckduckgo.js.map +1 -1
- package/dist/humain/web-access/vendor/extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/extract.js +61 -5
- package/dist/humain/web-access/vendor/extract.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.d.ts +3 -3
- package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.js +35 -5
- package/dist/humain/web-access/vendor/gemini-search.js.map +1 -1
- package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/index.js +8 -1
- package/dist/humain/web-access/vendor/index.js.map +1 -1
- package/dist/humain/web-access/vendor/page-query.d.ts +5 -0
- package/dist/humain/web-access/vendor/page-query.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/page-query.js +12 -2
- package/dist/humain/web-access/vendor/page-query.js.map +1 -1
- package/dist/humain/web-access/vendor/specstream.d.ts +6 -0
- package/dist/humain/web-access/vendor/specstream.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/specstream.js +253 -0
- package/dist/humain/web-access/vendor/specstream.js.map +1 -0
- package/dist/humain/web-access/vendor/tool-activation.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/tool-activation.js +21 -5
- package/dist/humain/web-access/vendor/tool-activation.js.map +1 -1
- package/dist/humain/web-access/vendor/upgrade-notice.d.ts +1 -1
- package/dist/humain/web-access/vendor/upgrade-notice.js +1 -1
- package/dist/humain/web-access/vendor/upgrade-notice.js.map +1 -1
- package/dist/humain/web-access/vendor/utils.d.ts +1 -0
- package/dist/humain/web-access/vendor/utils.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/utils.js +3 -0
- package/dist/humain/web-access/vendor/utils.js.map +1 -1
- package/dist/humain/web-access/vendor/video-extract.js +2 -2
- package/dist/humain/web-access/vendor/video-extract.js.map +1 -1
- package/dist/humain/web-access/vendor/web-tool-core.d.ts +13 -0
- package/dist/humain/web-access/vendor/web-tool-core.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/web-tool-core.js +16 -5
- package/dist/humain/web-access/vendor/web-tool-core.js.map +1 -1
- package/dist/humain/web-access/vendor/youtube-extract.js +2 -2
- package/dist/humain/web-access/vendor/youtube-extract.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +109 -29
- package/dist/main.js.map +1 -1
- package/dist/modes/diagnostics-stderr.d.ts +4 -0
- package/dist/modes/diagnostics-stderr.d.ts.map +1 -0
- package/dist/modes/diagnostics-stderr.js +11 -0
- package/dist/modes/diagnostics-stderr.js.map +1 -0
- package/dist/modes/interactive/components/account-picker.d.ts +31 -0
- package/dist/modes/interactive/components/account-picker.d.ts.map +1 -0
- package/dist/modes/interactive/components/account-picker.js +150 -0
- package/dist/modes/interactive/components/account-picker.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +5 -2
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +14 -5
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +2 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +6 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +10 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +101 -23
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +5 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +17 -6
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/radius-login-selector.js +2 -1
- package/dist/modes/interactive/components/radius-login-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +13 -6
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +8 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +41 -9
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.js +5 -1
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +0 -17
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +1 -78
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/themed-text.d.ts +1 -1
- package/dist/modes/interactive/components/themed-text.d.ts.map +1 -1
- package/dist/modes/interactive/components/themed-text.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +5 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +3 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/trust-selector.js +14 -5
- package/dist/modes/interactive/components/trust-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts +2 -2
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +35 -4
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +821 -250
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/model-catalog-refresh.d.ts +4 -0
- package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -1
- package/dist/modes/interactive/model-catalog-refresh.js +40 -1
- package/dist/modes/interactive/model-catalog-refresh.js.map +1 -1
- package/dist/modes/interactive/oauth-account-format.d.ts +15 -2
- package/dist/modes/interactive/oauth-account-format.d.ts.map +1 -1
- package/dist/modes/interactive/oauth-account-format.js +39 -21
- package/dist/modes/interactive/oauth-account-format.js.map +1 -1
- package/dist/modes/interactive/session-share.js +2 -0
- package/dist/modes/interactive/session-share.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +1 -0
- 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 +30 -32
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +26 -39
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +1 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +14 -1
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/abort.d.ts +5 -0
- package/dist/utils/abort.d.ts.map +1 -1
- package/dist/utils/abort.js +9 -0
- package/dist/utils/abort.js.map +1 -1
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +3 -2
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/flush-stdout.d.ts +8 -0
- package/dist/utils/flush-stdout.d.ts.map +1 -0
- package/dist/utils/flush-stdout.js +23 -0
- package/dist/utils/flush-stdout.js.map +1 -0
- package/dist/utils/image-process.d.ts +2 -0
- package/dist/utils/image-process.d.ts.map +1 -1
- package/dist/utils/image-process.js +3 -3
- package/dist/utils/image-process.js.map +1 -1
- package/dist/utils/image-resize-core.js +2 -2
- package/dist/utils/image-resize-core.js.map +1 -1
- package/dist/utils/shell.d.ts +2 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +19 -0
- package/dist/utils/shell.js.map +1 -1
- package/docs/cli.md +1 -1
- package/docs/development.md +0 -13
- package/docs/extensions.md +6 -4
- package/docs/flow.md +4 -62
- package/docs/forge-run-bootstrap.md +46 -0
- package/docs/humain-code-forge-architecture.md +1 -47
- package/docs/humain-code-forge-flow-walkthrough.md +1 -1
- package/docs/humain-code.md +2 -2
- package/docs/index.md +2 -1
- package/docs/keybindings.md +12 -0
- package/docs/llama-cpp.md +5 -5
- package/docs/models-configuration.md +4 -2
- package/docs/nvidia-rtx-llama-cpp.md +5 -5
- package/docs/providers.md +14 -9
- package/docs/quickstart.md +16 -2
- package/docs/rpc-commands.md +1 -1
- package/docs/run-preflight.md +1 -1
- package/docs/slash-commands.md +5 -3
- package/docs/tui.md +2 -0
- package/examples/README.md +0 -3
- package/examples/extensions/custom-provider-anthropic/package-lock.json +4 -4
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/gondolin/index.ts +4 -7
- package/examples/tsconfig.json +96 -76
- package/npm-shrinkwrap.json +285 -764
- package/package.json +24 -37
- package/schemas/keybindings.schema.json +32 -0
- package/schemas/models.schema.json +5 -1
- package/schemas/settings.schema.json +0 -13
- package/src/humain/web-access/UPSTREAM.md +52 -1
- package/src/humain/web-access/upstream.json +5 -5
- package/src/humain/web-access/vendor/CHANGELOG.md +29 -0
- package/dist/bundle/chunks/adaptive-peer-worker-X2ZNZE3S.js +0 -8
- package/dist/bundle/chunks/adaptive-session-host-7KDSQV5I.js +0 -162
- package/dist/bundle/chunks/anthropic-messages-TQK3FUV3.js +0 -68
- package/dist/bundle/chunks/azure-openai-responses-JY7OSLH2.js +0 -15
- package/dist/bundle/chunks/chunk-5L4PBYC7.js +0 -11
- package/dist/bundle/chunks/chunk-6PNQYO6A.js +0 -10
- package/dist/bundle/chunks/chunk-CRN54O4D.js +0 -24
- package/dist/bundle/chunks/chunk-CTU2ECLD.js +0 -7
- package/dist/bundle/chunks/chunk-DBL35X7L.js +0 -3
- package/dist/bundle/chunks/chunk-GME4AWDG.js +0 -23
- package/dist/bundle/chunks/chunk-GTILMMUF.js +0 -12
- package/dist/bundle/chunks/chunk-J57HOSWD.js +0 -21
- package/dist/bundle/chunks/chunk-KQM7ZGL6.js +0 -11
- package/dist/bundle/chunks/chunk-MX4Q4W6H.js +0 -214
- package/dist/bundle/chunks/chunk-NXA6NEHE.js +0 -54
- package/dist/bundle/chunks/chunk-PJACZCIR.js +0 -2
- package/dist/bundle/chunks/chunk-T5A6T24H.js +0 -93
- package/dist/bundle/chunks/chunk-WCFHG6NO.js +0 -16
- package/dist/bundle/chunks/chunk-ZJUU6WOV.js +0 -2052
- package/dist/bundle/chunks/compat-ZK2DIW3P.js +0 -15
- package/dist/bundle/chunks/dist-EY7YKQHB.js +0 -11
- package/dist/bundle/chunks/dist-J5IUPLMH.js +0 -37
- package/dist/bundle/chunks/dist-cjs-2SKN226B.js +0 -184
- package/dist/bundle/chunks/entry-AL54ZGYO.js +0 -2
- package/dist/bundle/chunks/es5-GYTRHFKS.js +0 -77
- package/dist/bundle/chunks/google-generative-ai-UL7YEQ6J.js +0 -21
- package/dist/bundle/chunks/google-vertex-OTMSPUYH.js +0 -26
- package/dist/bundle/chunks/host-75YAHLDR.js +0 -3
- package/dist/bundle/chunks/interactive-mode-IW4PIVAQ.js +0 -5
- package/dist/bundle/chunks/mistral-conversations-E72Y6OC3.js +0 -43
- package/dist/bundle/chunks/pdfjs-AKD6EBKN.js +0 -3614
- package/dist/bundle/chunks/pdfjs-jbig2_nowasm_fallback-FH3KJM4H.js +0 -326
- package/dist/bundle/chunks/pdfjs-openjpeg-SKR7C34X.js +0 -671
- package/dist/bundle/chunks/pdfjs-openjpeg_nowasm_fallback-VUBL7UEE.js +0 -974
- package/dist/bundle/chunks/session-picker-DM6S37IF.js +0 -4
- package/dist/bundle/chunks/startup-ui-4GGLWNSU.js +0 -3
- package/dist/bundle/chunks/virtual-modules-TI3W24YL.js +0 -28
- package/dist/core/internal-process.d.ts +0 -23
- package/dist/core/internal-process.d.ts.map +0 -1
- package/dist/core/internal-process.js +0 -88
- package/dist/core/internal-process.js.map +0 -1
- package/dist/humain/adaptive-execution.d.ts +0 -51
- package/dist/humain/adaptive-execution.d.ts.map +0 -1
- package/dist/humain/adaptive-execution.js +0 -100
- package/dist/humain/adaptive-execution.js.map +0 -1
- package/dist/humain/adaptive-peer-process.d.ts +0 -44
- package/dist/humain/adaptive-peer-process.d.ts.map +0 -1
- package/dist/humain/adaptive-peer-process.js +0 -159
- package/dist/humain/adaptive-peer-process.js.map +0 -1
- package/dist/humain/adaptive-peer-worker.d.ts +0 -3
- package/dist/humain/adaptive-peer-worker.d.ts.map +0 -1
- package/dist/humain/adaptive-peer-worker.js +0 -122
- package/dist/humain/adaptive-peer-worker.js.map +0 -1
- package/dist/humain/adaptive-runtime-types.d.ts +0 -621
- package/dist/humain/adaptive-runtime-types.d.ts.map +0 -1
- package/dist/humain/adaptive-runtime-types.js +0 -3
- package/dist/humain/adaptive-runtime-types.js.map +0 -1
- package/dist/humain/adaptive-session-host.d.ts +0 -113
- package/dist/humain/adaptive-session-host.d.ts.map +0 -1
- package/dist/humain/adaptive-session-host.js +0 -1838
- package/dist/humain/adaptive-session-host.js.map +0 -1
- package/dist/utils/deprecation.d.ts +0 -4
- package/dist/utils/deprecation.d.ts.map +0 -1
- package/dist/utils/deprecation.js +0 -13
- package/dist/utils/deprecation.js.map +0 -1
- package/examples/plugins/pi-example-plugin/README.md +0 -38
- package/examples/plugins/pi-example-plugin/package.json +0 -10
- package/examples/plugins/pi-example-plugin/src/contract.ts +0 -13
- package/examples/plugins/pi-example-plugin/src/session.ts +0 -24
- package/examples/plugins/pi-example-plugin/src/tui.ts +0 -31
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
* plain lines, and notes carry warnings the UI should surface (e.g. a provider whose subscription limits are not
|
|
4
4
|
* exposed through its API).
|
|
5
5
|
*/
|
|
6
|
-
import { type
|
|
6
|
+
import { type AnthropicUsageResult, type AnthropicUsageWindow } from "../../core/anthropic-subscription-usage.ts";
|
|
7
7
|
import type { CodexUsageDetailsResult } from "../../core/codex-usage.ts";
|
|
8
|
+
import type { ModelRegistry } from "../../core/model-registry.ts";
|
|
8
9
|
import type { SubscriptionCreditsStatus } from "../../core/subscription-credits.ts";
|
|
9
10
|
import type { SubscriptionResetStatus } from "../../core/subscription-reset-status.ts";
|
|
10
11
|
export type BarTone = "accent" | "warning" | "error" | "success";
|
|
11
12
|
export interface UsageBar {
|
|
12
13
|
id: string;
|
|
13
14
|
label: string;
|
|
14
|
-
/**
|
|
15
|
+
/** Amount used to fill the bar, in the same unit as `total`. */
|
|
15
16
|
used: number;
|
|
16
17
|
/** Total limit; null means unlimited or unknown. */
|
|
17
18
|
total: number | null;
|
|
@@ -22,7 +23,6 @@ export interface UsageBar {
|
|
|
22
23
|
section?: "paid";
|
|
23
24
|
}
|
|
24
25
|
export interface UsageLine {
|
|
25
|
-
action?: "hcode-pending";
|
|
26
26
|
label: string;
|
|
27
27
|
value: string;
|
|
28
28
|
tone?: BarTone;
|
|
@@ -74,7 +74,6 @@ export declare function claudeUsageBars(windows: readonly AnthropicUsageWindow[]
|
|
|
74
74
|
* usage response, into progress bars. The `utilization` values are percentages of the limit consumed.
|
|
75
75
|
*/
|
|
76
76
|
export declare function parseClaudeUtilization(raw: unknown, now?: number): UsageBar[];
|
|
77
|
-
export declare const CLAUDE_UNAVAILABLE: Record<AnthropicUsageUnavailableReason, string>;
|
|
78
77
|
/**
|
|
79
78
|
* Every limit window of the active Codex account as one bar each (main 5h and weekly first), plus its credits, or the
|
|
80
79
|
* reason they are unavailable. The usage route is the one /accounts reads; its fields are parsed by core/codex-usage.ts.
|
|
@@ -85,18 +84,24 @@ export declare function codexUsageBars(result: CodexUsageDetailsResult | undefin
|
|
|
85
84
|
} | {
|
|
86
85
|
error: string;
|
|
87
86
|
};
|
|
88
|
-
/**
|
|
87
|
+
/** Human-readable age of cached usage. */
|
|
88
|
+
export declare function usageAge(ms: number): string;
|
|
89
89
|
export declare function formatAge(ms: number): string;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
90
|
+
export interface ClaudeUsageView {
|
|
91
|
+
result: AnthropicUsageResult | undefined;
|
|
92
|
+
fallback?: {
|
|
93
|
+
status: string;
|
|
94
|
+
bars: UsageBar[];
|
|
95
|
+
failure: string;
|
|
96
|
+
cacheError?: string;
|
|
97
|
+
reconnect?: "optional" | "required";
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export declare function readClaudeUsage(registry: ModelRegistry, accountKey: string, request: {
|
|
101
|
+
signal: AbortSignal;
|
|
102
|
+
bypassCache?: boolean;
|
|
103
|
+
}, home?: string): Promise<ClaudeUsageView>;
|
|
104
|
+
export declare function nextQuotaResetLines(windows: readonly {
|
|
105
|
+
resetsAt?: number;
|
|
106
|
+
}[], now: number): UsageLine[];
|
|
102
107
|
//# sourceMappingURL=overview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overview.d.ts","sourceRoot":"","sources":["../../../src/extensions/usage/overview.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAMH,OAAO,
|
|
1
|
+
{"version":3,"file":"overview.d.ts","sourceRoot":"","sources":["../../../src/extensions/usage/overview.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAMH,OAAO,EAEN,KAAK,oBAAoB,EAEzB,KAAK,oBAAoB,EAEzB,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,uBAAuB,EAAiD,MAAM,2BAA2B,CAAC;AACxH,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,8BAA8B,CAAC;AAChF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AACpF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAOvF,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAEjE,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,I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IAAI,EAAE,QAAQ,EAAE,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;KACpC,CAAC;CACF;AAED,wBAAsB,eAAe,CACpC,QAAQ,EAAE,aAAa,EACvB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,EACvD,IAAI,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,eAAe,CAAC,CA4D1B;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,SAAS;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,CAGvG"}
|
|
@@ -8,8 +8,8 @@ import { readFile } from "node:fs/promises";
|
|
|
8
8
|
import { homedir } from "node:os";
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
import { sanitizeTerminalText, visibleWidth } from "@earendil-works/pi-tui";
|
|
11
|
-
import { parseAnthropicSubscriptionUsage, } from "../../core/anthropic-subscription-usage.js";
|
|
12
|
-
import { formatOAuthAccountResetTime, formatSubscriptionCredits, } from "../../modes/interactive/oauth-account-format.js";
|
|
11
|
+
import { ANTHROPIC_USAGE_PROVIDER_ID, parseAnthropicSubscriptionUsage, } from "../../core/anthropic-subscription-usage.js";
|
|
12
|
+
import { formatNextQuotaReset, formatOAuthAccountResetTime, formatSubscriptionCredits, } from "../../modes/interactive/oauth-account-format.js";
|
|
13
13
|
/** Makes untrusted usage labels safe for a single terminal row, including bidi controls. */
|
|
14
14
|
export function usageDisplayText(text) {
|
|
15
15
|
return sanitizeTerminalText(text).replace(/[\t\r\n\u061c\u200e\u200f\u2028\u2029\u202a-\u202e\u2066-\u2069]/g, " ");
|
|
@@ -187,8 +187,10 @@ export function parseClaudeUtilization(raw, now = Date.now()) {
|
|
|
187
187
|
}
|
|
188
188
|
return bars;
|
|
189
189
|
}
|
|
190
|
-
|
|
191
|
-
expired_credential: "Claude sign-in expired.
|
|
190
|
+
const CLAUDE_UNAVAILABLE = {
|
|
191
|
+
expired_credential: "Claude sign-in expired.",
|
|
192
|
+
refresh_failed: "Claude sign-in could not be refreshed. Try again later.",
|
|
193
|
+
refresh_rejected: "Claude rejected the sign-in refresh.",
|
|
192
194
|
unauthorized: "Claude usage was refused (HTTP 401/403).",
|
|
193
195
|
rate_limited: "Claude usage is rate limited (HTTP 429). Try again later.",
|
|
194
196
|
http_error: "Claude usage is unavailable (HTTP error).",
|
|
@@ -219,10 +221,13 @@ export function codexUsageBars(result, now = Date.now()) {
|
|
|
219
221
|
return { error: "Codex reported no usage limits." };
|
|
220
222
|
return {
|
|
221
223
|
bars: result.windows.map((window) => limitBar(`codex-${window.id}`, window.label, window.usedPercent, window.resetsAt, window.limitReached === true, now)),
|
|
222
|
-
lines: paidUsageLines(result.credits),
|
|
224
|
+
lines: [...nextQuotaResetLines(result.windows, now), ...paidUsageLines(result.credits)],
|
|
223
225
|
};
|
|
224
226
|
}
|
|
225
|
-
/**
|
|
227
|
+
/** Human-readable age of cached usage. */
|
|
228
|
+
export function usageAge(ms) {
|
|
229
|
+
return `${ms >= 172_800_000 ? `${Math.floor(ms / 86_400_000)} days` : formatAge(ms)} ago`;
|
|
230
|
+
}
|
|
226
231
|
export function formatAge(ms) {
|
|
227
232
|
const minutes = Math.floor(Math.max(0, ms) / 60_000);
|
|
228
233
|
if (minutes < 1)
|
|
@@ -240,7 +245,7 @@ export function formatAge(ms) {
|
|
|
240
245
|
* HUMAIN Code CLI is signed in to Anthropic with a subscription; they are as old as Claude Code's last fetch. The file
|
|
241
246
|
* also holds Claude Code's credentials: errors never quote it.
|
|
242
247
|
*/
|
|
243
|
-
|
|
248
|
+
async function readClaudeCachedUsage(readOwner, now, home = homedir()) {
|
|
244
249
|
let text;
|
|
245
250
|
try {
|
|
246
251
|
text = await readFile(join(home, ".claude.json"), "utf8");
|
|
@@ -257,11 +262,20 @@ export async function readClaudeCachedUsage(home = homedir(), now = Date.now(),
|
|
|
257
262
|
catch {
|
|
258
263
|
return { error: "~/.claude.json is not valid JSON." };
|
|
259
264
|
}
|
|
260
|
-
const
|
|
261
|
-
? data.oauthAccount
|
|
265
|
+
const identity = data && typeof data === "object"
|
|
266
|
+
? data.oauthAccount
|
|
262
267
|
: undefined;
|
|
263
|
-
|
|
264
|
-
|
|
268
|
+
const { accountUuid, organizationUuid } = identity ?? {};
|
|
269
|
+
// Resolve the persisted owner after the disk read, not from the view's potentially obsolete account snapshot.
|
|
270
|
+
const { accountId, organizationId } = (await readOwner()) ?? {};
|
|
271
|
+
// Match both identifiers when present; missing or malformed scope must not match a known organization.
|
|
272
|
+
const sameOrganization = typeof organizationUuid === "string"
|
|
273
|
+
? organizationUuid.toLowerCase() === organizationId?.toLowerCase()
|
|
274
|
+
: organizationUuid === undefined && organizationId === undefined;
|
|
275
|
+
if (!accountId ||
|
|
276
|
+
typeof accountUuid !== "string" ||
|
|
277
|
+
accountUuid.toLowerCase() !== accountId.toLowerCase() ||
|
|
278
|
+
!sameOrganization) {
|
|
265
279
|
return { error: "Claude Code's cache does not match this account." };
|
|
266
280
|
}
|
|
267
281
|
const cached = data && typeof data === "object"
|
|
@@ -270,9 +284,80 @@ export async function readClaudeCachedUsage(home = homedir(), now = Date.now(),
|
|
|
270
284
|
if (!cached || typeof cached !== "object")
|
|
271
285
|
return { error: "No cached Claude Code usage in ~/.claude.json." };
|
|
272
286
|
const fetchedAt = cached.fetchedAtMs;
|
|
287
|
+
const fetchedAtMs = typeof fetchedAt === "number" && Number.isFinite(fetchedAt) && fetchedAt >= 0 && fetchedAt <= now
|
|
288
|
+
? fetchedAt
|
|
289
|
+
: undefined;
|
|
290
|
+
const payload = cached.utilization ?? cached;
|
|
291
|
+
const stale = fetchedAtMs === undefined ||
|
|
292
|
+
now - fetchedAtMs > 3_600_000 ||
|
|
293
|
+
parseAnthropicSubscriptionUsage(payload).some((window) => window.resetsAt !== undefined && window.resetsAt <= now);
|
|
294
|
+
const bars = parseClaudeUtilization(cached, now);
|
|
295
|
+
if (bars.length === 0)
|
|
296
|
+
return { error: "No cached Claude Code usage in ~/.claude.json." };
|
|
297
|
+
return { bars: stale ? [] : bars, fetchedAtMs, stale };
|
|
298
|
+
}
|
|
299
|
+
export async function readClaudeUsage(registry, accountKey, request, home) {
|
|
300
|
+
let result;
|
|
301
|
+
let failure;
|
|
302
|
+
let lastKnown;
|
|
303
|
+
try {
|
|
304
|
+
result = await registry.getAnthropicUsage({ accountKey, ...request });
|
|
305
|
+
if (result?.status === "ok" && result.windows.length > 0) {
|
|
306
|
+
const now = Date.now();
|
|
307
|
+
const windows = result.windows.filter(({ resetsAt }) => resetsAt === undefined || resetsAt > now);
|
|
308
|
+
if (windows.length > 0 && now - result.fetchedAt <= 3_600_000)
|
|
309
|
+
return { result: { ...result, windows } };
|
|
310
|
+
lastKnown = result.fetchedAt;
|
|
311
|
+
result = { ...result, windows: [] };
|
|
312
|
+
}
|
|
313
|
+
failure =
|
|
314
|
+
result?.status === "unavailable"
|
|
315
|
+
? CLAUDE_UNAVAILABLE[result.reason]
|
|
316
|
+
: result
|
|
317
|
+
? "Claude reported no usage limits."
|
|
318
|
+
: "No saved Claude account. Run /login.";
|
|
319
|
+
}
|
|
320
|
+
catch {
|
|
321
|
+
failure = "Claude usage is unavailable.";
|
|
322
|
+
}
|
|
323
|
+
const now = Date.now();
|
|
324
|
+
const cache = await readClaudeCachedUsage(async () => {
|
|
325
|
+
try {
|
|
326
|
+
const accounts = await registry.getUsageAccounts(ANTHROPIC_USAGE_PROVIDER_ID, { signal: request.signal });
|
|
327
|
+
return accounts.find(({ key }) => key === accountKey);
|
|
328
|
+
}
|
|
329
|
+
catch {
|
|
330
|
+
return undefined;
|
|
331
|
+
}
|
|
332
|
+
}, now, home);
|
|
333
|
+
const required = result?.status === "unavailable" && result.reason === "refresh_rejected";
|
|
334
|
+
if ("error" in cache) {
|
|
335
|
+
return {
|
|
336
|
+
result,
|
|
337
|
+
fallback: {
|
|
338
|
+
status: lastKnown === undefined ? "No live data" : `No live data; last known ${usageAge(now - lastKnown)}`,
|
|
339
|
+
bars: [],
|
|
340
|
+
failure,
|
|
341
|
+
cacheError: cache.error,
|
|
342
|
+
reconnect: required ? "required" : lastKnown !== undefined ? "optional" : undefined,
|
|
343
|
+
},
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
const age = cache.fetchedAtMs === undefined ? undefined : usageAge(now - cache.fetchedAtMs);
|
|
273
347
|
return {
|
|
274
|
-
|
|
275
|
-
|
|
348
|
+
result,
|
|
349
|
+
fallback: {
|
|
350
|
+
status: cache.stale
|
|
351
|
+
? `No live data; last known ${age ?? "(age unknown)"}`
|
|
352
|
+
: `Claude Code's cached numbers, from ${age}`,
|
|
353
|
+
bars: cache.bars,
|
|
354
|
+
failure,
|
|
355
|
+
reconnect: required ? "required" : cache.stale ? "optional" : undefined,
|
|
356
|
+
},
|
|
276
357
|
};
|
|
277
358
|
}
|
|
359
|
+
export function nextQuotaResetLines(windows, now) {
|
|
360
|
+
const reset = formatNextQuotaReset(windows, now);
|
|
361
|
+
return reset ? [{ label: "Next reset", value: reset }] : [];
|
|
362
|
+
}
|
|
278
363
|
//# sourceMappingURL=overview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overview.js","sourceRoot":"","sources":["../../../src/extensions/usage/overview.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAGN,+BAA+B,GAC/B,MAAM,4C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AAW,EAAE,OAAO,SAAS,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;KAChG,CAAC;AACH,CAAC","sourcesContent":["// Derived from Pi-Bolt (MIT, Copyright (c) 2026 OpenSec (Pi-Bolt)), commit a6df6a2c; modified for HUMAIN Code CLI.\n/**\n * A provider-agnostic model for the `/usage` popup: bounded quotas render as progress bars, key/value rows render as\n * plain lines, and notes carry warnings the UI should surface (e.g. a provider whose subscription limits are not\n * exposed through its API).\n */\n\nimport { readFile } from \"node:fs/promises\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { sanitizeTerminalText, visibleWidth } from \"@earendil-works/pi-tui\";\nimport {\n\ttype AnthropicUsageUnavailableReason,\n\ttype AnthropicUsageWindow,\n\tparseAnthropicSubscriptionUsage,\n} from \"../../core/anthropic-subscription-usage.ts\";\nimport type { CodexUsageDetailsResult, CodexUsageUnavailableReason, CodexUsageWindow } from \"../../core/codex-usage.ts\";\nimport type { SubscriptionCreditsStatus } from \"../../core/subscription-credits.ts\";\nimport type { SubscriptionResetStatus } from \"../../core/subscription-reset-status.ts\";\nimport {\n\tformatOAuthAccountResetTime,\n\tformatSubscriptionCredits,\n} from \"../../modes/interactive/oauth-account-format.ts\";\n\nexport type BarTone = \"accent\" | \"warning\" | \"error\" | \"success\";\n\nexport interface UsageBar {\n\tid: string;\n\tlabel: string;\n\t/** Consumed amount, in the same unit as `total`. */\n\tused: number;\n\t/** Total limit; null means unlimited or unknown. */\n\ttotal: number | null;\n\t/** Pre-formatted right-hand label, e.g. \"4.2% / 1.0M\" or \"35% used\". */\n\tdisplay: string;\n\ttone: BarTone;\n\tnote?: string;\n\tsection?: \"paid\";\n}\n\nexport interface UsageLine {\n\taction?: \"hcode-pending\";\n\tlabel: string;\n\tvalue: string;\n\ttone?: BarTone;\n\tsection?: \"resets\" | \"paid\";\n}\n\nexport interface UsageOverview {\n\tproviderId: string;\n\tmodelId: string;\n\tbars: UsageBar[];\n\tlines: UsageLine[];\n\tnotes: string[];\n}\n\n/** Makes untrusted usage labels safe for a single terminal row, including bidi controls. */\nexport function usageDisplayText(text: string): string {\n\treturn sanitizeTerminalText(text).replace(/[\\t\\r\\n\\u061c\\u200e\\u200f\\u2028\\u2029\\u202a-\\u202e\\u2066-\\u2069]/g, \" \");\n}\n\n/** Minimal stats shape the builder needs, decoupled from AgentSession. */\nexport interface UsageStatsInput {\n\ttokens: { input: number; output: number };\n\tcost: number;\n\tcontextUsage?: { tokens: number | null; contextWindow: number; percent: number | null };\n}\n\nexport function formatTokens(count: number): string {\n\tif (count < 1000) return count.toString();\n\tif (count < 10000) return `${(count / 1000).toFixed(1)}k`;\n\tif (count < 1000000) return `${Math.round(count / 1000)}k`;\n\tif (count < 10000000) return `${(count / 1000000).toFixed(1)}M`;\n\treturn `${Math.round(count / 1000000)}M`;\n}\n\nexport function formatDuration(ms: number): string {\n\tconst totalSeconds = Math.max(0, Math.floor(ms / 1000));\n\tconst hours = Math.floor(totalSeconds / 3600);\n\tconst minutes = Math.floor((totalSeconds % 3600) / 60);\n\tconst seconds = totalSeconds % 60;\n\tif (hours > 0) return `${hours}h ${minutes}m ${seconds}s`;\n\tif (minutes > 0) return `${minutes}m ${seconds}s`;\n\treturn `${seconds}s`;\n}\n\nfunction percentTone(percent: number): BarTone {\n\tif (percent > 90) return \"error\";\n\tif (percent > 70) return \"warning\";\n\treturn \"accent\";\n}\n\nfunction contextTone(percent: number | null): BarTone {\n\treturn percent === null ? \"accent\" : percentTone(percent);\n}\n\nexport function buildUsageOverview(opts: {\n\tproviderId: string;\n\tmodelId: string;\n\tstats: UsageStatsInput;\n\tdurationMs: number | null;\n\t/** The cost is a lower bound: some usage was not reported. */\n\tusageIncomplete?: boolean;\n\tsubscriptionBacked: boolean;\n\taccountBars?: UsageBar[];\n}): UsageOverview {\n\tconst { providerId, modelId, stats, durationMs, usageIncomplete, subscriptionBacked, accountBars } = opts;\n\n\tconst bars: UsageBar[] = [];\n\tconst lines: UsageLine[] = [];\n\tconst notes: string[] = [];\n\n\tif (accountBars) bars.push(...accountBars);\n\n\t// Context window is the one \"used vs left\" bar that is always available.\n\tconst cu = stats.contextUsage;\n\tif (cu) {\n\t\tbars.push({\n\t\t\tid: \"context\",\n\t\t\tlabel: \"Context\",\n\t\t\tused: cu.tokens ?? 0,\n\t\t\ttotal: cu.contextWindow,\n\t\t\tdisplay: `${cu.percent !== null ? `${cu.percent.toFixed(1)}%` : \"?\"} / ${formatTokens(cu.contextWindow)}`,\n\t\t\ttone: contextTone(cu.percent),\n\t\t});\n\t}\n\n\t// Session usage (works for every provider).\n\tlines.push({ label: \"tokens\", value: `↑${formatTokens(stats.tokens.input)} ↓${formatTokens(stats.tokens.output)}` });\n\tlines.push(\n\t\tusageIncomplete\n\t\t\t? { label: \"cost\", value: `≥$${stats.cost.toFixed(3)} (usage incomplete)`, tone: \"warning\" }\n\t\t\t: { label: \"cost\", value: `$${stats.cost.toFixed(3)}` },\n\t);\n\tif (durationMs !== null) {\n\t\tlines.push({ label: \"time\", value: formatDuration(durationMs) });\n\t}\n\n\tif (subscriptionBacked) {\n\t\tnotes.push(\"Subscription limits (weekly / 5h) are not exposed by this provider's API. See its usage dashboard.\");\n\t}\n\n\treturn { providerId, modelId, bars, lines, notes };\n}\n\n/** Render every overview row as aligned, terminal-safe plain text without depending on known window labels. */\nexport function formatUsageOverview(overview: UsageOverview): string {\n\tconst rows = [\n\t\t...overview.bars.map((bar) => ({ label: bar.label, value: `${bar.display}${bar.note ? ` (${bar.note})` : \"\"}` })),\n\t\t...overview.lines,\n\t];\n\tconst labelWidth = Math.max(0, ...rows.map((row) => visibleWidth(row.label)));\n\treturn [\n\t\t`${overview.providerId} · ${overview.modelId}`,\n\t\t...rows.map((row) => ` ${row.label}${\" \".repeat(labelWidth - visibleWidth(row.label))} ${row.value}`),\n\t\t...overview.notes,\n\t]\n\t\t.map((line) => sanitizeTerminalText(line))\n\t\t.join(\"\\n\");\n}\n\n/** Banked weekly resets are not proof that the provider will let this account redeem one now. */\nexport function weeklyResetLines(resets: SubscriptionResetStatus | undefined): UsageLine[] {\n\tconst lines: UsageLine[] = [\n\t\t{\n\t\t\tlabel: \"saved resets\",\n\t\t\tvalue:\n\t\t\t\tresets?.availableCount === undefined\n\t\t\t\t\t? \"unavailable\"\n\t\t\t\t\t: resets.availableCount === 0\n\t\t\t\t\t\t? \"none\"\n\t\t\t\t\t\t: `${resets.availableCount} banked`,\n\t\t\tsection: \"resets\",\n\t\t},\n\t];\n\tif (resets?.eligible !== undefined) {\n\t\tlines.push({ label: \"use now\", value: resets.eligible ? \"available\" : \"not available\", section: \"resets\" });\n\t}\n\tif (resets?.expiresAt !== undefined) {\n\t\tlines.push({ label: \"reset expiry\", value: formatOAuthAccountResetTime(resets.expiresAt), section: \"resets\" });\n\t}\n\treturn lines;\n}\n\nexport function paidUsageLines(credits: SubscriptionCreditsStatus | undefined): UsageLine[] {\n\tconst lines: UsageLine[] = [{ label: \"paid credits\", value: formatSubscriptionCredits(credits), section: \"paid\" }];\n\tif (credits?.enabled !== undefined) {\n\t\tlines.push({ label: \"extra usage\", value: credits.enabled ? \"enabled\" : \"disabled\", section: \"paid\" });\n\t}\n\tif (credits?.limit !== undefined) {\n\t\tlines.push({\n\t\t\tlabel: \"spending limit\",\n\t\t\tvalue: formatSubscriptionCredits({ balance: credits.limit, unit: credits.unit }),\n\t\t\tsection: \"paid\",\n\t\t});\n\t}\n\tlines.push({\n\t\tlabel: \"auto reload\",\n\t\tvalue: credits?.autoReload === undefined ? \"unavailable\" : credits.autoReload ? \"on\" : \"off\",\n\t\tsection: \"paid\",\n\t});\n\treturn lines;\n}\n\n/** A percent-of-limit bar with its reset time; a reached limit uses the blocked tone. */\nfunction limitBar(\n\tid: string,\n\tlabel: string,\n\tusedPercent: number,\n\tresetsAt: number | undefined,\n\tlimitReached: boolean,\n\tnow: number,\n): UsageBar {\n\tconst used = Math.min(100, Math.max(0, usedPercent));\n\tconst reset =\n\t\tresetsAt === undefined\n\t\t\t? undefined\n\t\t\t: `${resetsAt <= now ? \"reset at\" : \"resets\"} ${formatOAuthAccountResetTime(resetsAt)}`;\n\tconst notes = [reset, limitReached ? \"limit reached\" : undefined].filter((note) => note !== undefined);\n\treturn {\n\t\tid,\n\t\tlabel,\n\t\tused,\n\t\ttotal: 100,\n\t\tdisplay: `${used.toFixed(0)}% used`,\n\t\ttone: limitReached ? \"error\" : percentTone(used),\n\t\t...(notes.length > 0 ? { note: notes.join(\", \") } : {}),\n\t};\n}\n\n/** Claude subscription windows (live or cached) as bars. */\nexport function claudeUsageBars(windows: readonly AnthropicUsageWindow[], now: number = Date.now()): UsageBar[] {\n\treturn windows.map((window) => ({\n\t\t...limitBar(\n\t\t\t`claude-${window.id}`,\n\t\t\twindow.label,\n\t\t\twindow.usedPercent,\n\t\t\twindow.resetsAt,\n\t\t\twindow.usedPercent >= 100,\n\t\t\tnow,\n\t\t),\n\t\t...(window.id === \"extra_usage\" ? { section: \"paid\" as const } : {}),\n\t}));\n}\n\n/**\n * Parse Claude Code's `cachedUsageUtilization` (stored in ~/.claude.json), a cached copy of Anthropic's subscription\n * usage response, into progress bars. The `utilization` values are percentages of the limit consumed.\n */\nexport function parseClaudeUtilization(raw: unknown, now: number = Date.now()): UsageBar[] {\n\tif (!raw || typeof raw !== \"object\") return [];\n\n\tconst u = (raw as { utilization?: Record<string, unknown> }).utilization ?? (raw as Record<string, unknown>);\n\tif (!u || typeof u !== \"object\") return [];\n\tconst bars = claudeUsageBars(parseAnthropicSubscriptionUsage(u), now);\n\n\t// Dollar-denominated limits (e.g. usage credits) use used_dollars / limit_dollars.\n\tfor (const [key, value] of Object.entries(u)) {\n\t\tif (key === \"extra_usage\" || !value || typeof value !== \"object\") continue;\n\t\tconst { used_dollars: used, limit_dollars: total } = value as {\n\t\t\tused_dollars?: unknown;\n\t\t\tlimit_dollars?: unknown;\n\t\t};\n\t\tif (typeof used !== \"number\" || typeof total !== \"number\" || !Number.isFinite(used) || !(total > 0)) continue;\n\t\tbars.push({\n\t\t\tid: `claude-${key}`,\n\t\t\tlabel: \"Credits\",\n\t\t\tused,\n\t\t\ttotal,\n\t\t\tdisplay: `$${used.toFixed(2)} / $${total.toFixed(2)}`,\n\t\t\ttone: percentTone((used / total) * 100),\n\t\t});\n\t\tbreak;\n\t}\n\n\treturn bars;\n}\n\nexport const CLAUDE_UNAVAILABLE: Record<AnthropicUsageUnavailableReason, string> = {\n\texpired_credential: \"Claude sign-in expired. Run /login.\",\n\tunauthorized: \"Claude usage was refused (HTTP 401/403).\",\n\trate_limited: \"Claude usage is rate limited (HTTP 429). Try again later.\",\n\thttp_error: \"Claude usage is unavailable (HTTP error).\",\n\ttimeout: \"Claude usage timed out.\",\n\tnetwork: \"Claude usage is unreachable.\",\n\tmalformed: \"Claude usage returned an unexpected response.\",\n};\n\nconst CODEX_UNAVAILABLE: Record<CodexUsageUnavailableReason, string> = {\n\texpired_credential: \"Codex sign-in expired. Run /login.\",\n\tunauthorized: \"Codex usage was refused (HTTP 401/403).\",\n\trate_limited: \"Codex usage is rate limited (HTTP 429). Try again later.\",\n\thttp_error: \"Codex usage is unavailable (HTTP error).\",\n\ttimeout: \"Codex usage timed out.\",\n\tnetwork: \"Codex usage is unreachable.\",\n\tmalformed: \"Codex usage returned an unexpected response.\",\n\tno_weekly_window: \"Codex reported no weekly limit.\",\n};\n\n/**\n * Every limit window of the active Codex account as one bar each (main 5h and weekly first), plus its credits, or the\n * reason they are unavailable. The usage route is the one /accounts reads; its fields are parsed by core/codex-usage.ts.\n */\nexport function codexUsageBars(\n\tresult: CodexUsageDetailsResult | undefined,\n\tnow: number = Date.now(),\n): { bars: UsageBar[]; lines: UsageLine[] } | { error: string } {\n\tif (!result) return { error: \"No active Codex account. Run /login.\" };\n\tif (result.status === \"unavailable\") return { error: CODEX_UNAVAILABLE[result.reason] };\n\tif (result.windows.length === 0 && !result.credits) return { error: \"Codex reported no usage limits.\" };\n\treturn {\n\t\tbars: result.windows.map((window: CodexUsageWindow) =>\n\t\t\tlimitBar(\n\t\t\t\t`codex-${window.id}`,\n\t\t\t\twindow.label,\n\t\t\t\twindow.usedPercent,\n\t\t\t\twindow.resetsAt,\n\t\t\t\twindow.limitReached === true,\n\t\t\t\tnow,\n\t\t\t),\n\t\t),\n\t\tlines: paidUsageLines(result.credits),\n\t};\n}\n\n/** Age of cached numbers, e.g. 40s -> \"under a minute\", 12m -> \"12 min\", 3h -> \"3 h\", 2d -> \"2 d\". */\nexport function formatAge(ms: number): string {\n\tconst minutes = Math.floor(Math.max(0, ms) / 60_000);\n\tif (minutes < 1) return \"under a minute\";\n\tif (minutes < 60) return `${minutes} min`;\n\tconst hours = Math.floor(minutes / 60);\n\tif (hours < 48) return `${hours} h`;\n\treturn `${Math.floor(hours / 24)} d`;\n}\n\n/**\n * Read Claude Code's cached subscription usage. Claude Code fetches this with its own OAuth token and stores it in\n * ~/.claude.json with the fetch time. The 5h / weekly limits belong to the Claude subscription, so they apply only when\n * HUMAIN Code CLI is signed in to Anthropic with a subscription; they are as old as Claude Code's last fetch. The file\n * also holds Claude Code's credentials: errors never quote it.\n */\nexport async function readClaudeCachedUsage(\n\thome: string = homedir(),\n\tnow: number = Date.now(),\n\taccountId?: string,\n): Promise<{ bars: UsageBar[]; fetchedAtMs?: number } | { error: string }> {\n\tlet text: string;\n\ttry {\n\t\ttext = await readFile(join(home, \".claude.json\"), \"utf8\");\n\t} catch (err) {\n\t\tif ((err as NodeJS.ErrnoException).code === \"ENOENT\") return { error: \"~/.claude.json not found.\" };\n\t\treturn { error: \"Could not read ~/.claude.json.\" };\n\t}\n\tlet data: unknown;\n\ttry {\n\t\tdata = JSON.parse(text);\n\t} catch {\n\t\treturn { error: \"~/.claude.json is not valid JSON.\" };\n\t}\n\tconst uuid =\n\t\tdata && typeof data === \"object\"\n\t\t\t? (data as { oauthAccount?: { accountUuid?: unknown } }).oauthAccount?.accountUuid\n\t\t\t: undefined;\n\t// A shared Claude Code cache must never supply another subscription's limits.\n\tif (!accountId || typeof uuid !== \"string\" || uuid.toLowerCase() !== accountId.toLowerCase()) {\n\t\treturn { error: \"Claude Code's cache does not match this account.\" };\n\t}\n\tconst cached =\n\t\tdata && typeof data === \"object\"\n\t\t\t? (data as { cachedUsageUtilization?: unknown }).cachedUsageUtilization\n\t\t\t: undefined;\n\tif (!cached || typeof cached !== \"object\") return { error: \"No cached Claude Code usage in ~/.claude.json.\" };\n\tconst fetchedAt = (cached as { fetchedAtMs?: unknown }).fetchedAtMs;\n\treturn {\n\t\tbars: parseClaudeUtilization(cached, now),\n\t\tfetchedAtMs: typeof fetchedAt === \"number\" && Number.isFinite(fetchedAt) ? fetchedAt : undefined,\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"overview.js","sourceRoot":"","sources":["../../../src/extensions/usage/overview.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EACN,2BAA2B,EAI3B,+BAA+B,GAC/B,MAAM,4CAA4C,CAAC;AAKpD,OAAO,EACN,oBAAoB,EACpB,2BAA2B,EAC3B,yBAAyB,GACzB,MAAM,iDAAiD,CAAC;AAiCzD,4FAA4F;AAC5F,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC5C,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,mEAAmE,EAAE,GAAG,CAAC,CAAC;AACrH,CAAC;AASD,MAAM,UAAU,YAAY,CAAC,KAAa;IACzC,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1C,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AAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;SACvE;KACD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAyC,EAAE,GAAW;IACzF,MAAM,KAAK,GAAG,oBAAoB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACjD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC7D,CAAC","sourcesContent":["// Derived from Pi-Bolt (MIT, Copyright (c) 2026 OpenSec (Pi-Bolt)), commit a6df6a2c; modified for HUMAIN Code CLI.\n/**\n * A provider-agnostic model for the `/usage` popup: bounded quotas render as progress bars, key/value rows render as\n * plain lines, and notes carry warnings the UI should surface (e.g. a provider whose subscription limits are not\n * exposed through its API).\n */\n\nimport { readFile } from \"node:fs/promises\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { sanitizeTerminalText, visibleWidth } from \"@earendil-works/pi-tui\";\nimport {\n\tANTHROPIC_USAGE_PROVIDER_ID,\n\ttype AnthropicUsageResult,\n\ttype AnthropicUsageUnavailableReason,\n\ttype AnthropicUsageWindow,\n\tparseAnthropicSubscriptionUsage,\n} from \"../../core/anthropic-subscription-usage.ts\";\nimport type { CodexUsageDetailsResult, CodexUsageUnavailableReason, CodexUsageWindow } from \"../../core/codex-usage.ts\";\nimport type { ModelRegistry, UsageAccount } from \"../../core/model-registry.ts\";\nimport type { SubscriptionCreditsStatus } from \"../../core/subscription-credits.ts\";\nimport type { SubscriptionResetStatus } from \"../../core/subscription-reset-status.ts\";\nimport {\n\tformatNextQuotaReset,\n\tformatOAuthAccountResetTime,\n\tformatSubscriptionCredits,\n} from \"../../modes/interactive/oauth-account-format.ts\";\n\nexport type BarTone = \"accent\" | \"warning\" | \"error\" | \"success\";\n\nexport interface UsageBar {\n\tid: string;\n\tlabel: string;\n\t/** Amount used to fill the bar, in the same unit as `total`. */\n\tused: number;\n\t/** Total limit; null means unlimited or unknown. */\n\ttotal: number | null;\n\t/** Pre-formatted right-hand label, e.g. \"4.2% / 1.0M\" or \"35% used\". */\n\tdisplay: string;\n\ttone: BarTone;\n\tnote?: string;\n\tsection?: \"paid\";\n}\n\nexport interface UsageLine {\n\tlabel: string;\n\tvalue: string;\n\ttone?: BarTone;\n\tsection?: \"resets\" | \"paid\";\n}\n\nexport interface UsageOverview {\n\tproviderId: string;\n\tmodelId: string;\n\tbars: UsageBar[];\n\tlines: UsageLine[];\n\tnotes: string[];\n}\n\n/** Makes untrusted usage labels safe for a single terminal row, including bidi controls. */\nexport function usageDisplayText(text: string): string {\n\treturn sanitizeTerminalText(text).replace(/[\\t\\r\\n\\u061c\\u200e\\u200f\\u2028\\u2029\\u202a-\\u202e\\u2066-\\u2069]/g, \" \");\n}\n\n/** Minimal stats shape the builder needs, decoupled from AgentSession. */\nexport interface UsageStatsInput {\n\ttokens: { input: number; output: number };\n\tcost: number;\n\tcontextUsage?: { tokens: number | null; contextWindow: number; percent: number | null };\n}\n\nexport function formatTokens(count: number): string {\n\tif (count < 1000) return count.toString();\n\tif (count < 10000) return `${(count / 1000).toFixed(1)}k`;\n\tif (count < 1000000) return `${Math.round(count / 1000)}k`;\n\tif (count < 10000000) return `${(count / 1000000).toFixed(1)}M`;\n\treturn `${Math.round(count / 1000000)}M`;\n}\n\nexport function formatDuration(ms: number): string {\n\tconst totalSeconds = Math.max(0, Math.floor(ms / 1000));\n\tconst hours = Math.floor(totalSeconds / 3600);\n\tconst minutes = Math.floor((totalSeconds % 3600) / 60);\n\tconst seconds = totalSeconds % 60;\n\tif (hours > 0) return `${hours}h ${minutes}m ${seconds}s`;\n\tif (minutes > 0) return `${minutes}m ${seconds}s`;\n\treturn `${seconds}s`;\n}\n\nfunction percentTone(percent: number): BarTone {\n\tif (percent > 90) return \"error\";\n\tif (percent > 70) return \"warning\";\n\treturn \"accent\";\n}\n\nfunction contextTone(percent: number | null): BarTone {\n\treturn percent === null ? \"accent\" : percentTone(percent);\n}\n\nexport function buildUsageOverview(opts: {\n\tproviderId: string;\n\tmodelId: string;\n\tstats: UsageStatsInput;\n\tdurationMs: number | null;\n\t/** The cost is a lower bound: some usage was not reported. */\n\tusageIncomplete?: boolean;\n\tsubscriptionBacked: boolean;\n\taccountBars?: UsageBar[];\n}): UsageOverview {\n\tconst { providerId, modelId, stats, durationMs, usageIncomplete, subscriptionBacked, accountBars } = opts;\n\n\tconst bars: UsageBar[] = [];\n\tconst lines: UsageLine[] = [];\n\tconst notes: string[] = [];\n\n\tif (accountBars) bars.push(...accountBars);\n\n\t// Context window is the one \"used vs left\" bar that is always available.\n\tconst cu = stats.contextUsage;\n\tif (cu) {\n\t\tbars.push({\n\t\t\tid: \"context\",\n\t\t\tlabel: \"Context\",\n\t\t\tused: cu.tokens ?? 0,\n\t\t\ttotal: cu.contextWindow,\n\t\t\tdisplay: `${cu.percent !== null ? `${cu.percent.toFixed(1)}%` : \"?\"} / ${formatTokens(cu.contextWindow)}`,\n\t\t\ttone: contextTone(cu.percent),\n\t\t});\n\t}\n\n\t// Session usage (works for every provider).\n\tlines.push({ label: \"tokens\", value: `↑${formatTokens(stats.tokens.input)} ↓${formatTokens(stats.tokens.output)}` });\n\tlines.push(\n\t\tusageIncomplete\n\t\t\t? { label: \"cost\", value: `≥$${stats.cost.toFixed(3)} (usage incomplete)`, tone: \"warning\" }\n\t\t\t: { label: \"cost\", value: `$${stats.cost.toFixed(3)}` },\n\t);\n\tif (durationMs !== null) {\n\t\tlines.push({ label: \"time\", value: formatDuration(durationMs) });\n\t}\n\n\tif (subscriptionBacked) {\n\t\tnotes.push(\"Subscription limits (weekly / 5h) are not exposed by this provider's API. See its usage dashboard.\");\n\t}\n\n\treturn { providerId, modelId, bars, lines, notes };\n}\n\n/** Render every overview row as aligned, terminal-safe plain text without depending on known window labels. */\nexport function formatUsageOverview(overview: UsageOverview): string {\n\tconst rows = [\n\t\t...overview.bars.map((bar) => ({ label: bar.label, value: `${bar.display}${bar.note ? ` (${bar.note})` : \"\"}` })),\n\t\t...overview.lines,\n\t];\n\tconst labelWidth = Math.max(0, ...rows.map((row) => visibleWidth(row.label)));\n\treturn [\n\t\t`${overview.providerId} · ${overview.modelId}`,\n\t\t...rows.map((row) => ` ${row.label}${\" \".repeat(labelWidth - visibleWidth(row.label))} ${row.value}`),\n\t\t...overview.notes,\n\t]\n\t\t.map((line) => sanitizeTerminalText(line))\n\t\t.join(\"\\n\");\n}\n\n/** Banked weekly resets are not proof that the provider will let this account redeem one now. */\nexport function weeklyResetLines(resets: SubscriptionResetStatus | undefined): UsageLine[] {\n\tconst lines: UsageLine[] = [\n\t\t{\n\t\t\tlabel: \"saved resets\",\n\t\t\tvalue:\n\t\t\t\tresets?.availableCount === undefined\n\t\t\t\t\t? \"unavailable\"\n\t\t\t\t\t: resets.availableCount === 0\n\t\t\t\t\t\t? \"none\"\n\t\t\t\t\t\t: `${resets.availableCount} banked`,\n\t\t\tsection: \"resets\",\n\t\t},\n\t];\n\tif (resets?.eligible !== undefined) {\n\t\tlines.push({ label: \"use now\", value: resets.eligible ? \"available\" : \"not available\", section: \"resets\" });\n\t}\n\tif (resets?.expiresAt !== undefined) {\n\t\tlines.push({ label: \"reset expiry\", value: formatOAuthAccountResetTime(resets.expiresAt), section: \"resets\" });\n\t}\n\treturn lines;\n}\n\nexport function paidUsageLines(credits: SubscriptionCreditsStatus | undefined): UsageLine[] {\n\tconst lines: UsageLine[] = [{ label: \"paid credits\", value: formatSubscriptionCredits(credits), section: \"paid\" }];\n\tif (credits?.enabled !== undefined) {\n\t\tlines.push({ label: \"extra usage\", value: credits.enabled ? \"enabled\" : \"disabled\", section: \"paid\" });\n\t}\n\tif (credits?.limit !== undefined) {\n\t\tlines.push({\n\t\t\tlabel: \"spending limit\",\n\t\t\tvalue: formatSubscriptionCredits({ balance: credits.limit, unit: credits.unit }),\n\t\t\tsection: \"paid\",\n\t\t});\n\t}\n\tlines.push({\n\t\tlabel: \"auto reload\",\n\t\tvalue: credits?.autoReload === undefined ? \"unavailable\" : credits.autoReload ? \"on\" : \"off\",\n\t\tsection: \"paid\",\n\t});\n\treturn lines;\n}\n\n/** A percent-of-limit bar with its reset time; a reached limit uses the blocked tone. */\nfunction limitBar(\n\tid: string,\n\tlabel: string,\n\tusedPercent: number,\n\tresetsAt: number | undefined,\n\tlimitReached: boolean,\n\tnow: number,\n): UsageBar {\n\tconst used = Math.min(100, Math.max(0, usedPercent));\n\tconst reset =\n\t\tresetsAt === undefined\n\t\t\t? undefined\n\t\t\t: `${resetsAt <= now ? \"reset at\" : \"resets\"} ${formatOAuthAccountResetTime(resetsAt)}`;\n\tconst notes = [reset, limitReached ? \"limit reached\" : undefined].filter((note) => note !== undefined);\n\treturn {\n\t\tid,\n\t\tlabel,\n\t\tused,\n\t\ttotal: 100,\n\t\tdisplay: `${used.toFixed(0)}% used`,\n\t\ttone: limitReached ? \"error\" : percentTone(used),\n\t\t...(notes.length > 0 ? { note: notes.join(\", \") } : {}),\n\t};\n}\n\n/** Claude subscription windows (live or cached) as bars. */\nexport function claudeUsageBars(windows: readonly AnthropicUsageWindow[], now: number = Date.now()): UsageBar[] {\n\treturn windows.map((window) => ({\n\t\t...limitBar(\n\t\t\t`claude-${window.id}`,\n\t\t\twindow.label,\n\t\t\twindow.usedPercent,\n\t\t\twindow.resetsAt,\n\t\t\twindow.usedPercent >= 100,\n\t\t\tnow,\n\t\t),\n\t\t...(window.id === \"extra_usage\" ? { section: \"paid\" as const } : {}),\n\t}));\n}\n\n/**\n * Parse Claude Code's `cachedUsageUtilization` (stored in ~/.claude.json), a cached copy of Anthropic's subscription\n * usage response, into progress bars. The `utilization` values are percentages of the limit consumed.\n */\nexport function parseClaudeUtilization(raw: unknown, now: number = Date.now()): UsageBar[] {\n\tif (!raw || typeof raw !== \"object\") return [];\n\n\tconst u = (raw as { utilization?: Record<string, unknown> }).utilization ?? (raw as Record<string, unknown>);\n\tif (!u || typeof u !== \"object\") return [];\n\tconst bars = claudeUsageBars(parseAnthropicSubscriptionUsage(u), now);\n\n\t// Dollar-denominated limits (e.g. usage credits) use used_dollars / limit_dollars.\n\tfor (const [key, value] of Object.entries(u)) {\n\t\tif (key === \"extra_usage\" || !value || typeof value !== \"object\") continue;\n\t\tconst { used_dollars: used, limit_dollars: total } = value as {\n\t\t\tused_dollars?: unknown;\n\t\t\tlimit_dollars?: unknown;\n\t\t};\n\t\tif (typeof used !== \"number\" || typeof total !== \"number\" || !Number.isFinite(used) || !(total > 0)) continue;\n\t\tbars.push({\n\t\t\tid: `claude-${key}`,\n\t\t\tlabel: \"Credits\",\n\t\t\tused,\n\t\t\ttotal,\n\t\t\tdisplay: `$${used.toFixed(2)} / $${total.toFixed(2)}`,\n\t\t\ttone: percentTone((used / total) * 100),\n\t\t});\n\t\tbreak;\n\t}\n\n\treturn bars;\n}\n\nconst CLAUDE_UNAVAILABLE: Record<AnthropicUsageUnavailableReason, string> = {\n\texpired_credential: \"Claude sign-in expired.\",\n\trefresh_failed: \"Claude sign-in could not be refreshed. Try again later.\",\n\trefresh_rejected: \"Claude rejected the sign-in refresh.\",\n\tunauthorized: \"Claude usage was refused (HTTP 401/403).\",\n\trate_limited: \"Claude usage is rate limited (HTTP 429). Try again later.\",\n\thttp_error: \"Claude usage is unavailable (HTTP error).\",\n\ttimeout: \"Claude usage timed out.\",\n\tnetwork: \"Claude usage is unreachable.\",\n\tmalformed: \"Claude usage returned an unexpected response.\",\n};\n\nconst CODEX_UNAVAILABLE: Record<CodexUsageUnavailableReason, string> = {\n\texpired_credential: \"Codex sign-in expired. Run /login.\",\n\tunauthorized: \"Codex usage was refused (HTTP 401/403).\",\n\trate_limited: \"Codex usage is rate limited (HTTP 429). Try again later.\",\n\thttp_error: \"Codex usage is unavailable (HTTP error).\",\n\ttimeout: \"Codex usage timed out.\",\n\tnetwork: \"Codex usage is unreachable.\",\n\tmalformed: \"Codex usage returned an unexpected response.\",\n\tno_weekly_window: \"Codex reported no weekly limit.\",\n};\n\n/**\n * Every limit window of the active Codex account as one bar each (main 5h and weekly first), plus its credits, or the\n * reason they are unavailable. The usage route is the one /accounts reads; its fields are parsed by core/codex-usage.ts.\n */\nexport function codexUsageBars(\n\tresult: CodexUsageDetailsResult | undefined,\n\tnow: number = Date.now(),\n): { bars: UsageBar[]; lines: UsageLine[] } | { error: string } {\n\tif (!result) return { error: \"No active Codex account. Run /login.\" };\n\tif (result.status === \"unavailable\") return { error: CODEX_UNAVAILABLE[result.reason] };\n\tif (result.windows.length === 0 && !result.credits) return { error: \"Codex reported no usage limits.\" };\n\treturn {\n\t\tbars: result.windows.map((window: CodexUsageWindow) =>\n\t\t\tlimitBar(\n\t\t\t\t`codex-${window.id}`,\n\t\t\t\twindow.label,\n\t\t\t\twindow.usedPercent,\n\t\t\t\twindow.resetsAt,\n\t\t\t\twindow.limitReached === true,\n\t\t\t\tnow,\n\t\t\t),\n\t\t),\n\t\tlines: [...nextQuotaResetLines(result.windows, now), ...paidUsageLines(result.credits)],\n\t};\n}\n\n/** Human-readable age of cached usage. */\nexport function usageAge(ms: number): string {\n\treturn `${ms >= 172_800_000 ? `${Math.floor(ms / 86_400_000)} days` : formatAge(ms)} ago`;\n}\nexport function formatAge(ms: number): string {\n\tconst minutes = Math.floor(Math.max(0, ms) / 60_000);\n\tif (minutes < 1) return \"under a minute\";\n\tif (minutes < 60) return `${minutes} min`;\n\tconst hours = Math.floor(minutes / 60);\n\tif (hours < 48) return `${hours} h`;\n\treturn `${Math.floor(hours / 24)} d`;\n}\n\n/**\n * Read Claude Code's cached subscription usage. Claude Code fetches this with its own OAuth token and stores it in\n * ~/.claude.json with the fetch time. The 5h / weekly limits belong to the Claude subscription, so they apply only when\n * HUMAIN Code CLI is signed in to Anthropic with a subscription; they are as old as Claude Code's last fetch. The file\n * also holds Claude Code's credentials: errors never quote it.\n */\nasync function readClaudeCachedUsage(\n\treadOwner: () => Promise<UsageAccount | undefined>,\n\tnow: number,\n\thome: string = homedir(),\n): Promise<{ bars: UsageBar[]; fetchedAtMs?: number; stale: boolean } | { error: string }> {\n\tlet text: string;\n\ttry {\n\t\ttext = await readFile(join(home, \".claude.json\"), \"utf8\");\n\t} catch (err) {\n\t\tif ((err as NodeJS.ErrnoException).code === \"ENOENT\") return { error: \"~/.claude.json not found.\" };\n\t\treturn { error: \"Could not read ~/.claude.json.\" };\n\t}\n\tlet data: unknown;\n\ttry {\n\t\tdata = JSON.parse(text);\n\t} catch {\n\t\treturn { error: \"~/.claude.json is not valid JSON.\" };\n\t}\n\tconst identity =\n\t\tdata && typeof data === \"object\"\n\t\t\t? (data as { oauthAccount?: { accountUuid?: unknown; organizationUuid?: unknown } }).oauthAccount\n\t\t\t: undefined;\n\tconst { accountUuid, organizationUuid } = identity ?? {};\n\t// Resolve the persisted owner after the disk read, not from the view's potentially obsolete account snapshot.\n\tconst { accountId, organizationId } = (await readOwner()) ?? {};\n\t// Match both identifiers when present; missing or malformed scope must not match a known organization.\n\tconst sameOrganization =\n\t\ttypeof organizationUuid === \"string\"\n\t\t\t? organizationUuid.toLowerCase() === organizationId?.toLowerCase()\n\t\t\t: organizationUuid === undefined && organizationId === undefined;\n\tif (\n\t\t!accountId ||\n\t\ttypeof accountUuid !== \"string\" ||\n\t\taccountUuid.toLowerCase() !== accountId.toLowerCase() ||\n\t\t!sameOrganization\n\t) {\n\t\treturn { error: \"Claude Code's cache does not match this account.\" };\n\t}\n\tconst cached =\n\t\tdata && typeof data === \"object\"\n\t\t\t? (data as { cachedUsageUtilization?: unknown }).cachedUsageUtilization\n\t\t\t: undefined;\n\tif (!cached || typeof cached !== \"object\") return { error: \"No cached Claude Code usage in ~/.claude.json.\" };\n\tconst fetchedAt = (cached as { fetchedAtMs?: unknown }).fetchedAtMs;\n\tconst fetchedAtMs =\n\t\ttypeof fetchedAt === \"number\" && Number.isFinite(fetchedAt) && fetchedAt >= 0 && fetchedAt <= now\n\t\t\t? fetchedAt\n\t\t\t: undefined;\n\tconst payload = (cached as { utilization?: unknown }).utilization ?? cached;\n\tconst stale =\n\t\tfetchedAtMs === undefined ||\n\t\tnow - fetchedAtMs > 3_600_000 ||\n\t\tparseAnthropicSubscriptionUsage(payload).some(\n\t\t\t(window) => window.resetsAt !== undefined && window.resetsAt <= now,\n\t\t);\n\tconst bars = parseClaudeUtilization(cached, now);\n\tif (bars.length === 0) return { error: \"No cached Claude Code usage in ~/.claude.json.\" };\n\treturn { bars: stale ? [] : bars, fetchedAtMs, stale };\n}\n\nexport interface ClaudeUsageView {\n\tresult: AnthropicUsageResult | undefined;\n\tfallback?: {\n\t\tstatus: string;\n\t\tbars: UsageBar[];\n\t\tfailure: string;\n\t\tcacheError?: string;\n\t\treconnect?: \"optional\" | \"required\";\n\t};\n}\n\nexport async function readClaudeUsage(\n\tregistry: ModelRegistry,\n\taccountKey: string,\n\trequest: { signal: AbortSignal; bypassCache?: boolean },\n\thome?: string,\n): Promise<ClaudeUsageView> {\n\tlet result: AnthropicUsageResult | undefined;\n\tlet failure: string;\n\tlet lastKnown: number | undefined;\n\ttry {\n\t\tresult = await registry.getAnthropicUsage({ accountKey, ...request });\n\t\tif (result?.status === \"ok\" && result.windows.length > 0) {\n\t\t\tconst now = Date.now();\n\t\t\tconst windows = result.windows.filter(({ resetsAt }) => resetsAt === undefined || resetsAt > now);\n\t\t\tif (windows.length > 0 && now - result.fetchedAt <= 3_600_000) return { result: { ...result, windows } };\n\t\t\tlastKnown = result.fetchedAt;\n\t\t\tresult = { ...result, windows: [] };\n\t\t}\n\t\tfailure =\n\t\t\tresult?.status === \"unavailable\"\n\t\t\t\t? CLAUDE_UNAVAILABLE[result.reason]\n\t\t\t\t: result\n\t\t\t\t\t? \"Claude reported no usage limits.\"\n\t\t\t\t\t: \"No saved Claude account. Run /login.\";\n\t} catch {\n\t\tfailure = \"Claude usage is unavailable.\";\n\t}\n\tconst now = Date.now();\n\tconst cache = await readClaudeCachedUsage(\n\t\tasync () => {\n\t\t\ttry {\n\t\t\t\tconst accounts = await registry.getUsageAccounts(ANTHROPIC_USAGE_PROVIDER_ID, { signal: request.signal });\n\t\t\t\treturn accounts.find(({ key }) => key === accountKey);\n\t\t\t} catch {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t},\n\t\tnow,\n\t\thome,\n\t);\n\tconst required = result?.status === \"unavailable\" && result.reason === \"refresh_rejected\";\n\tif (\"error\" in cache) {\n\t\treturn {\n\t\t\tresult,\n\t\t\tfallback: {\n\t\t\t\tstatus: lastKnown === undefined ? \"No live data\" : `No live data; last known ${usageAge(now - lastKnown)}`,\n\t\t\t\tbars: [],\n\t\t\t\tfailure,\n\t\t\t\tcacheError: cache.error,\n\t\t\t\treconnect: required ? \"required\" : lastKnown !== undefined ? \"optional\" : undefined,\n\t\t\t},\n\t\t};\n\t}\n\tconst age = cache.fetchedAtMs === undefined ? undefined : usageAge(now - cache.fetchedAtMs);\n\treturn {\n\t\tresult,\n\t\tfallback: {\n\t\t\tstatus: cache.stale\n\t\t\t\t? `No live data; last known ${age ?? \"(age unknown)\"}`\n\t\t\t\t: `Claude Code's cached numbers, from ${age}`,\n\t\t\tbars: cache.bars,\n\t\t\tfailure,\n\t\t\treconnect: required ? \"required\" : cache.stale ? \"optional\" : undefined,\n\t\t},\n\t};\n}\n\nexport function nextQuotaResetLines(windows: readonly { resetsAt?: number }[], now: number): UsageLine[] {\n\tconst reset = formatNextQuotaReset(windows, now);\n\treturn reset ? [{ label: \"Next reset\", value: reset }] : [];\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Theme } from "../../modes/interactive/theme/theme.ts";
|
|
2
|
+
import type { UsageBar } from "./overview.ts";
|
|
3
|
+
export declare function usagePaneRow(theme: Theme, list: string, detail: string, listWidth: number): string;
|
|
4
|
+
export declare function renderUsageBar(theme: Theme, bar: Pick<UsageBar, "used" | "total" | "tone">, width: number): string;
|
|
5
|
+
//# sourceMappingURL=panes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panes.d.ts","sourceRoot":"","sources":["../../../src/extensions/usage/panes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAElG;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIlH"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
2
|
+
export function usagePaneRow(theme, list, detail, listWidth) {
|
|
3
|
+
return truncateToWidth(list, listWidth, "…", true) + theme.fg("dim", " │ ") + detail;
|
|
4
|
+
}
|
|
5
|
+
export function renderUsageBar(theme, bar, width) {
|
|
6
|
+
const fraction = bar.total && bar.total > 0 ? Math.min(1, Math.max(0, bar.used / bar.total)) : 0;
|
|
7
|
+
const filled = Math.round(fraction * width);
|
|
8
|
+
return theme.fg(bar.tone, "█".repeat(filled)) + theme.fg("muted", "░".repeat(width - filled));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=panes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panes.js","sourceRoot":"","sources":["../../../src/extensions/usage/panes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzD,MAAM,UAAU,YAAY,CAAC,KAAY,EAAE,IAAY,EAAE,MAAc,EAAE,SAAiB;IACzF,OAAO,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAY,EAAE,GAA8C,EAAE,KAAa;IACzG,MAAM,QAAQ,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,CAAC,CAAC;IACjG,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC;IAC5C,OAAO,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC;AAC/F,CAAC","sourcesContent":["import { truncateToWidth } from \"@earendil-works/pi-tui\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport type { UsageBar } from \"./overview.ts\";\n\nexport function usagePaneRow(theme: Theme, list: string, detail: string, listWidth: number): string {\n\treturn truncateToWidth(list, listWidth, \"…\", true) + theme.fg(\"dim\", \" │ \") + detail;\n}\n\nexport function renderUsageBar(theme: Theme, bar: Pick<UsageBar, \"used\" | \"total\" | \"tone\">, width: number): string {\n\tconst fraction = bar.total && bar.total > 0 ? Math.min(1, Math.max(0, bar.used / bar.total)) : 0;\n\tconst filled = Math.round(fraction * width);\n\treturn theme.fg(bar.tone, \"█\".repeat(filled)) + theme.fg(\"muted\", \"░\".repeat(width - filled));\n}\n"]}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type Component, type Focusable, type TuiMouseEvent, type TuiMouseEventResult } from "@earendil-works/pi-tui";
|
|
2
2
|
import type { KeybindingsManager } from "../../core/keybindings.ts";
|
|
3
|
-
import type { HcodeUsageQuery } from "../../humain/hcode/contracts.ts";
|
|
4
3
|
import type { Theme } from "../../modes/interactive/theme/theme.ts";
|
|
5
|
-
import {
|
|
4
|
+
import type { HcodeOverview } from "./hcode-overview.ts";
|
|
6
5
|
import { type UsageOverview } from "./overview.ts";
|
|
7
6
|
export interface UsageTab {
|
|
8
7
|
id: string;
|
|
@@ -11,8 +10,12 @@ export interface UsageTab {
|
|
|
11
10
|
active?: boolean;
|
|
12
11
|
resetAction?: string;
|
|
13
12
|
resetDisabled?: boolean;
|
|
13
|
+
usageActions?: {
|
|
14
|
+
reconnect: boolean;
|
|
15
|
+
refreshing?: boolean;
|
|
16
|
+
};
|
|
14
17
|
}
|
|
15
|
-
type UsageAction = "reset" | "billing";
|
|
18
|
+
export type UsageAction = "reset" | "billing" | "refresh" | "reconnect";
|
|
16
19
|
/** Account selection inspects usage only; actions delegate side effects to the caller. */
|
|
17
20
|
export declare class UsagePopupComponent implements Component, Focusable {
|
|
18
21
|
focused: boolean;
|
|
@@ -23,16 +26,11 @@ export declare class UsagePopupComponent implements Component, Focusable {
|
|
|
23
26
|
private readonly requestRender;
|
|
24
27
|
private readonly getHeight;
|
|
25
28
|
private readonly onAction?;
|
|
26
|
-
private readonly onHcodeDetails?;
|
|
27
29
|
private disposed;
|
|
28
30
|
private view;
|
|
29
31
|
private detailFocus;
|
|
30
|
-
private
|
|
31
|
-
private
|
|
32
|
-
private pendingPreviousDetail;
|
|
33
|
-
private selectedDetail;
|
|
34
|
-
private detailRowCount;
|
|
35
|
-
private pendingPreviousFocus;
|
|
32
|
+
private expanded;
|
|
33
|
+
private jumpToRecent;
|
|
36
34
|
private selectedId;
|
|
37
35
|
private scrollTop;
|
|
38
36
|
private viewportHeight;
|
|
@@ -40,7 +38,7 @@ export declare class UsagePopupComponent implements Component, Focusable {
|
|
|
40
38
|
private regions;
|
|
41
39
|
private renderedWidth;
|
|
42
40
|
private listWidth;
|
|
43
|
-
constructor(theme: Theme, keybindings: KeybindingsManager, tabs: readonly UsageTab[], onClose: () => void, requestRender: () => void, getHeight?: () => number, onAction?: (tab: UsageTab, action: UsageAction) => void
|
|
41
|
+
constructor(theme: Theme, keybindings: KeybindingsManager, tabs: readonly UsageTab[], onClose: () => void, requestRender: () => void, getHeight?: () => number, onAction?: (tab: UsageTab, action: UsageAction) => void);
|
|
44
42
|
private get accounts();
|
|
45
43
|
private get selectedAccount();
|
|
46
44
|
dispose(): void;
|
|
@@ -48,9 +46,7 @@ export declare class UsagePopupComponent implements Component, Focusable {
|
|
|
48
46
|
private selectAccount;
|
|
49
47
|
private moveAccount;
|
|
50
48
|
private scrollBy;
|
|
51
|
-
private togglePending;
|
|
52
49
|
private invokeAction;
|
|
53
|
-
private requestDetails;
|
|
54
50
|
handleInput(data: string): void;
|
|
55
51
|
handleMouse(event: TuiMouseEvent): TuiMouseEventResult;
|
|
56
52
|
invalidate(): void;
|
|
@@ -59,5 +55,4 @@ export declare class UsagePopupComponent implements Component, Focusable {
|
|
|
59
55
|
private accountRows;
|
|
60
56
|
render(width: number): string[];
|
|
61
57
|
}
|
|
62
|
-
export {};
|
|
63
58
|
//# sourceMappingURL=popup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popup.d.ts","sourceRoot":"","sources":["../../../src/extensions/usage/popup.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,SAAS,EACd,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"popup.d.ts","sourceRoot":"","sources":["../../../src/extensions/usage/popup.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,SAAS,EACd,KAAK,SAAS,EAGd,KAAK,aAAa,EAClB,KAAK,mBAAmB,EAIxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,KAAK,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