@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
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
+
import{getProviderEnvValue}from"./chunk-FACBDLFU.js";var __rewriteRelativeImportExtension=function(path,preserveJsx){return typeof path=="string"&&/^\.\.?\//.test(path)?path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(m,tsx,d,ext,cm){return tsx?preserveJsx?".jsx":".js":d&&(!ext||!cm)?m:d+ext+"."+cm.toLowerCase()+"js"}):path},_existsSync=null,_homedir=null,_join=null,dynamicImport=specifier=>import(__rewriteRelativeImportExtension(specifier)),NODE_FS_SPECIFIER="node:fs",NODE_OS_SPECIFIER="node:os",NODE_PATH_SPECIFIER="node:p\
|
|
3
|
+
ath";typeof process<"u"&&(process.versions?.node||process.versions?.bun)&&(dynamicImport(NODE_FS_SPECIFIER).then(m=>{_existsSync=m.existsSync}),dynamicImport(NODE_OS_SPECIFIER).then(m=>{_homedir=m.homedir}),dynamicImport(NODE_PATH_SPECIFIER).then(m=>{_join=m.join}));var ANTHROPIC_AUTH_TOKEN_ENV="ANTHROPIC_AUTH_TOKEN",ANTHROPIC_OAUTH_TOKEN_ENV="ANTHROPIC_OAUTH_TOKEN",ANTHROPIC_API_KEY_ENV="ANTHROPIC_API_KEY",ANTHROPIC_FEDERATION_RULE_ID_ENV="ANTHROPIC_FEDERATION_RULE_ID",ANTHROPIC_ORGANIZATION_ID_ENV="\
|
|
4
|
+
ANTHROPIC_ORGANIZATION_ID",ANTHROPIC_SERVICE_ACCOUNT_ID_ENV="ANTHROPIC_SERVICE_ACCOUNT_ID",ANTHROPIC_IDENTITY_TOKEN_FILE_ENV="ANTHROPIC_IDENTITY_TOKEN_FILE",ANTHROPIC_WORKSPACE_ID_ENV="ANTHROPIC_WORKSPACE_ID",cachedVertexAdcCredentialsExists=null;function hasVertexAdcCredentials(env){let explicitCredentialsPath=env?.GOOGLE_APPLICATION_CREDENTIALS;if(explicitCredentialsPath)return _existsSync?_existsSync(explicitCredentialsPath):!1;if(cachedVertexAdcCredentialsExists===null){if(!_existsSync||!_homedir||
|
|
5
|
+
!_join)return typeof process<"u"&&(process.versions?.node||process.versions?.bun)||(cachedVertexAdcCredentialsExists=!1),!1;let gacPath=getProviderEnvValue("GOOGLE_APPLICATION_CREDENTIALS",env);gacPath?cachedVertexAdcCredentialsExists=_existsSync(gacPath):cachedVertexAdcCredentialsExists=_existsSync(_join(_homedir(),".config","gcloud","application_default_credentials.json"))}return cachedVertexAdcCredentialsExists}function getApiKeyEnvVars(provider){if(provider==="github-copilot")return["COPILOT\
|
|
6
|
+
_GITHUB_TOKEN"];if(provider==="anthropic")return[ANTHROPIC_AUTH_TOKEN_ENV,ANTHROPIC_OAUTH_TOKEN_ENV,ANTHROPIC_API_KEY_ENV];let envVars={"ant-ling":"ANT_LING_API_KEY","qwen-token-plan":["QWEN_TOKEN_PLAN_TEAM_API_KEY","QWEN_TOKEN_PLAN_API_KEY"],"qwen-token-plan-cn":["QWEN_TOKEN_PLAN_TEAM_CN_API_KEY","QWEN_TOKEN_PLAN_CN_API_KEY"],"qwen-token-plan-individual":["QWEN_TOKEN_PLAN_INDIVIDUAL_API_KEY","QWEN_TOKEN_PLAN_API_KEY"],openai:"OPENAI_API_KEY",azure:"AZURE_OPENAI_API_KEY",nvidia:"NVIDIA_API_KEY",
|
|
7
|
+
deepseek:"DEEPSEEK_API_KEY",google:"GEMINI_API_KEY","google-vertex":"GOOGLE_CLOUD_API_KEY",groq:"GROQ_API_KEY",cerebras:"CEREBRAS_API_KEY",xai:"XAI_API_KEY",typesafe:"TYPESAFE_API_KEY",radius:"RADIUS_API_KEY",openrouter:"OPENROUTER_API_KEY","vercel-ai-gateway":"AI_GATEWAY_API_KEY",zai:"ZAI_API_KEY","zai-coding-cn":"ZAI_CODING_CN_API_KEY",mistral:"MISTRAL_API_KEY",minimax:"MINIMAX_API_KEY","minimax-cn":"MINIMAX_CN_API_KEY",moonshotai:"MOONSHOT_API_KEY","moonshotai-cn":"MOONSHOT_API_KEY",huggingface:"\
|
|
8
|
+
HF_TOKEN",fireworks:"FIREWORKS_API_KEY",together:"TOGETHER_API_KEY",baseten:"BASETEN_API_KEY",opencode:"OPENCODE_API_KEY","opencode-go":"OPENCODE_API_KEY","kimi-coding":"KIMI_API_KEY",meta:"META_API_KEY","humain-node":"HUMAIN_NODE_API_KEY","cloudflare-workers-ai":"CLOUDFLARE_API_KEY","cloudflare-ai-gateway":"CLOUDFLARE_API_KEY",xiaomi:"XIAOMI_API_KEY","xiaomi-token-plan-cn":"XIAOMI_TOKEN_PLAN_CN_API_KEY","xiaomi-token-plan-ams":"XIAOMI_TOKEN_PLAN_AMS_API_KEY","xiaomi-token-plan-sgp":"XIAOMI_TOKE\
|
|
9
|
+
N_PLAN_SGP_API_KEY"}[provider];return typeof envVars=="string"?[envVars]:envVars}function findEnvKeys(provider,env){let envVars=getApiKeyEnvVars(provider);if(!envVars)return;let found=envVars.filter(envVar=>!!getProviderEnvValue(envVar,env));return found.length>0?found:void 0}function getEnvApiKey(provider,env){let envKeys=findEnvKeys(provider,env);if(envKeys?.[0]){let apiKeyEnv=provider==="anthropic"?envKeys.find(key=>key!==ANTHROPIC_AUTH_TOKEN_ENV):envKeys[0];if(apiKeyEnv)return getProviderEnvValue(
|
|
10
|
+
apiKeyEnv,env)}if(provider==="google-vertex"){let hasCredentials=hasVertexAdcCredentials(env),hasProject=!!(getProviderEnvValue("GOOGLE_CLOUD_PROJECT",env)||getProviderEnvValue("GCLOUD_PROJECT",env)),hasLocation=!!getProviderEnvValue("GOOGLE_CLOUD_LOCATION",env);if(hasCredentials&&hasProject&&hasLocation)return"<authenticated>"}if(provider==="amazon-bedrock"&&(getProviderEnvValue("AWS_PROFILE",env)||getProviderEnvValue("AWS_ACCESS_KEY_ID",env)&&getProviderEnvValue("AWS_SECRET_ACCESS_KEY",env)||getProviderEnvValue(
|
|
11
|
+
"AWS_BEARER_TOKEN_BEDROCK",env)||getProviderEnvValue("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",env)||getProviderEnvValue("AWS_CONTAINER_CREDENTIALS_FULL_URI",env)||getProviderEnvValue("AWS_WEB_IDENTITY_TOKEN_FILE",env)))return"<authenticated>"}export{ANTHROPIC_AUTH_TOKEN_ENV,ANTHROPIC_OAUTH_TOKEN_ENV,ANTHROPIC_API_KEY_ENV,ANTHROPIC_FEDERATION_RULE_ID_ENV,ANTHROPIC_ORGANIZATION_ID_ENV,ANTHROPIC_SERVICE_ACCOUNT_ID_ENV,ANTHROPIC_IDENTITY_TOKEN_FILE_ENV,ANTHROPIC_WORKSPACE_ID_ENV,findEnvKeys,getEnvApiKey};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{Compile}from"./chunk-
|
|
2
|
+
import{Compile}from"./chunk-VCMXBP5S.js";function lazyValidator(schema){let validator;return()=>validator??=Compile(schema)}export{lazyValidator};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{AGENT_MONITOR_PROTOCOL,AGENT_MONITOR_ROLE,MAX_AGENTS,MAX_REPORT_FRAME_BYTES,MAX_SNAPSHOT_FRAME_BYTES,parseHello,parseReport,resolveAgentMonitorPaths}from"./chunk-
|
|
2
|
+
import{AGENT_MONITOR_PROTOCOL,AGENT_MONITOR_ROLE,MAX_AGENTS,MAX_REPORT_FRAME_BYTES,MAX_SNAPSHOT_FRAME_BYTES,parseHello,parseReport,resolveAgentMonitorPaths}from"./chunk-4TDNOR36.js";import{COORDINATION_ROLE_ENV}from"./chunk-6HTHDVJC.js";import{MAX_RUNTIME_TEXT_FILE_BYTES,createMessageReader,ensureCoordinationRuntimeDir,restrictRuntimeFile,writeMessage,writeTextAtomic}from"./chunk-B47PNNLL.js";import{getAgentDir}from"./chunk-VFLVWPLZ.js";import{lstatSync,unlinkSync}from"node:fs";import net from"node:net";import{execFile}from"node:child_process";import{readlink}from"node:fs/promises";import{basename}from"node:path";import{promisify}from"node:util";var execFileAsync=promisify(execFile),PS_TIMEOUT_MS=2e3,PS_MAX_BYTES=8*1024*1024,CWD_TIMEOUT_MS=2e3,UNAVAILABLE_NOTE="Claude Code and Codex discovery is unavailable.",TOOL_NAMES={claude:"Claude Code",codex:"Codex"},NO_TTY=new Set(["?","??","-"]),LINE=/^\s*(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+([A-Z][a-z]{2}\s+[A-Z][a-z]{2}\s+\d{1,2}\s+\d{2}:\d{2}:\d{2}\s+\d{4})\s+(.*)$/;
|
|
3
3
|
function parsePsOutput(stdout){let entries=[];for(let line of stdout.split(`
|
|
4
4
|
`)){let match=LINE.exec(line);if(!match)continue;let tool=classifyProcess(match[6]??"");entries.push({uid:Number(match[1]),pid:Number(match[2]),ppid:Number(match[3]),tty:match[4]??"",started:match[5]??"",...tool?{tool}:{}})}return entries}function classifyProcess(args){let[first="",second=""]=args.trim().split(/\s+/,2),executable=basename(first);if(executable==="claude")return"claude";if(executable==="codex")return"codex";if(!(executable!=="node"&&executable!=="bun")){if(/[\\/]@anthropic-ai[\\/]claude-code[\\/]cli\.js$/.
|
|
5
5
|
test(second))return"claude";if(/[\\/]@openai[\\/]codex[\\/]bin[\\/]codex\.js$/.test(second))return"codex"}}function findExternalAgents(entries,uid){let candidates=new Map;for(let entry of entries){if(entry.uid!==uid||NO_TTY.has(entry.tty))continue;let{tool}=entry;tool&&candidates.set(entry.pid,{tool,pid:entry.pid,ppid:entry.ppid,started:entry.started})}return[...candidates.values()].filter(candidate=>candidates.get(candidate.ppid)?.tool!==candidate.tool)}async function defaultListProcesses(){let{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{METHOD,extractCiRefs,formatDuration,getFlowAgentsDir,isCredentialName,isWaitCommand,redactCredentials,sanitizeControlChars}from"./chunk-
|
|
2
|
+
import{METHOD,extractCiRefs,formatDuration,getFlowAgentsDir,isCredentialName,isWaitCommand,redactCredentials,sanitizeControlChars}from"./chunk-HQMUDHC3.js";var DEFAULT_DISPATCH_TIMEOUT_MS=1800*1e3,DEFAULT_LEAD_INACTIVITY_TIMEOUT_MS=1800*1e3,LOOP_WINDOW_SIZE=12,TOOL_CALL_RECORD_LIMIT=256,NESTED_WORKER_LIMIT=32,EVICTED_WORKER_ID_LIMIT=256,ORCHESTRATING_CAPABILITIES=new Set(["architect","technical_lead",...Object.values(METHOD.rules.lead_sizing.sizes)]);function configuredTimeout(env,name,fallback,notes){let raw=env[name];if(raw===void 0)return fallback;let parsed=Number(raw),value=Math.trunc(parsed);return!Number.isFinite(parsed)||parsed<=0||value<=0?
|
|
3
3
|
(notes.push(`${name}=${JSON.stringify(raw)} is invalid; using the default ${fallback}ms.`),fallback):value}function resolveDispatchTimeoutPolicy(capability,env){let notes=[];return!capability||!ORCHESTRATING_CAPABILITIES.has(capability)?{mode:"leaf",inactivityMs:configuredTimeout(env,"HUMAIN_ORCHESTRATOR_DISPATCH_TIMEOUT_MS",DEFAULT_DISPATCH_TIMEOUT_MS,notes),notes}:{mode:"lead",inactivityMs:configuredTimeout(env,"HUMAIN_ORCHESTRATOR_LEAD_INACTIVITY_TIMEOUT_MS",DEFAULT_LEAD_INACTIVITY_TIMEOUT_MS,
|
|
4
4
|
notes),notes}}function stableValue(value){if(Array.isArray(value))return value.map(stableValue);if(value&&typeof value=="object"){let record=value;return Object.fromEntries(Object.keys(record).sort().map(key=>[key,stableValue(record[key])]))}return value}function stableJson(value){try{return JSON.stringify(stableValue(value))??"undefined"}catch{return"[unserializable]"}}function fingerprint(toolName,args){return`${toolName}:${stableJson(args)}`.slice(0,2e3)}function textHash(text){let hash=2166136261;
|
|
5
5
|
for(let index=0;index<text.length;index++)hash^=text.charCodeAt(index),hash=Math.imul(hash,16777619);return(hash>>>0).toString(16)}function finiteNumber(value,fallback){return typeof value=="number"&&Number.isFinite(value)?value:fallback}function assistantContent(message){let content=message.content;return typeof content=="string"?content:Array.isArray(content)?content.map(part=>{if(!part||typeof part!="object")return"";let item=part;return item.type==="text"&&typeof item.text=="string"?item.text:
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
+
import{ANTHROPIC_USAGE_PROVIDER_ID,HCODE_PROVIDER,fetchWithRetry,getCodexAvailability,getPiUserAgent,isWSL,parseAnthropicSubscriptionUsage,parseSubscriptionCreditAmount}from"./chunk-P42E6YY6.js";import{addUsageToTotals,createUsageTotals,getSessionUsage,stripAnsi}from"./chunk-3CGMVKHA.js";import{raceWithAbortSignal}from"./chunk-JWOPWHVH.js";import{areExperimentalFeaturesEnabled}from"./chunk-FQ4KS5S4.js";import{hcodeDisplayName,require_semver}from"./chunk-IMUFBWEK.js";
|
|
3
|
+
import{getThemeInstance,keyHint,theme}from"./chunk-KONLZKPL.js";import{Container,Text,getNativeClipboard,hyperlink,sanitizeTerminalText,truncateToWidth,visibleWidth,wrapTextWithAnsi}from"./chunk-WBSGWISD.js";import{killTrackedDetachedChildrenAsync}from"./chunk-SKCJ25SX.js";import{APP_COMMAND,ENV_OFFLINE,ENV_SKIP_VERSION_CHECK,getVersionCheckUrl}from"./chunk-VFLVWPLZ.js";import{__toESM}from"./chunk-JXWJOIH4.js";var HCODE_LOGIN_MISMATCH_DETAILS="HUMAIN Code's sign-in settings (/api/cli/config or issuer discovery) don't match what this CLI version accepts. Update the CLI with `humain-code update`, or ask the HUMAIN Code platform team to check the server's CLI sign-in configuration.",EMPTY_REASONS={no_cli_models_approved:{reason:"no model is approved for CLI",fix:"Ask an admin to set a model to Web + CLI or CLI only in Settings > Model Access."},provider_key_not_cli_enabled:{reason:"the provider key isn't\
|
|
4
|
+
enabled for CLI",fix:"Ask an admin to enable CLI on the key in Settings > Provider Keys."},cli_capacity_unconfigured:{reason:"CLI capacity hasn't been configured",fix:"Ask the HUMAIN Code platform team to check the deployment's CLI capacity limits."},provider_key_not_dedicated:{reason:"the provider key is shared or isn't approved for CLI use",fix:"Ask an admin to configure a dedicated key for HUMAIN Code CLI."},models_not_qualified:{reason:"this server hasn't finished CLI setup for the approved\
|
|
5
|
+
models",fix:"Ask an admin to report it to the HUMAIN Code platform team."}};function hcodeEmptyCatalogMessage(reason){if(!reason)return"Your admin hasn't enabled CLI models yet.";let{reason:why,fix}=EMPTY_REASONS[reason];return`No models are available in the CLI: ${why}. ${fix}`}function hcodeEmptyCatalogReason(cause){return cause.kind==="failed"?{reason:"the model list couldn't be loaded",fix:"Check your network, VPN or Zscaler."}:cause.reason?EMPTY_REASONS[cause.reason]:{reason:"your admin ha\
|
|
6
|
+
sn't enabled CLI models yet",fix:"Ask an admin to enable a model for CLI."}}function hcodeEmptyCatalogNotice(environmentId,email,cause){let{reason,fix}=hcodeEmptyCatalogReason(cause);return[`\u2713 Signed in to ${hcodeDisplayName(environmentId)}${email?` as ${email}`:""}`,` No models available in the CLI yet: ${reason}.`,` ${fix}`," You can keep using your other providers. I'll check again automatically."," /model to retry \xB7 /login status for details"].join(`
|
|
7
|
+
`)}function hcodeLoginAvailability(readiness){if(!readiness)return{state:"pending",text:"checking connection\u2026"};switch(readiness.kind){case"ready":return{state:"ready",text:"connected"};case"unreachable":return{state:"failed",text:`Can't reach ${readiness.host}: check VPN/Zscaler [Retry]`};case"mismatch":return{state:"failed",text:"Server sign-in settings don't match this CLI version [Details]"};case"unavailable":return{state:"failed",text:"Sign-in is not available in this environment [Retr\
|
|
8
|
+
y]"}}}function hcodeSignedInElsewhereNotice(environmentId,elsewhere){let other=elsewhere[0];if(other)return`${hcodeDisplayName(environmentId)}: not signed in. HUMAIN Code now defaults to production. Your saved sign-in is for ${hcodeDisplayName(other)} and was not moved: start humain-code with --env ${other} to use it, or /login to sign in here.`}import{randomUUID}from"node:crypto";import{unlinkSync,writeFileSync}from"node:fs";import{platform,tmpdir}from"node:os";import{join}from"node:path";import{spawn}from"node:child_process";function runClipboardCommand(command,args,options){return new Promise(resolve2=>{let child=spawn(command,args,{stdio:["pipe",options?.input===void 0?"pipe":"ignore","ignore"],cwd:"/",detached:process.platform!=="win32",windowsHide:!0}),chunks=[],length=0,settled=!1,finish=result=>{settled||(settled=!0,clearTimeout(timer),resolve2(result))},abort=()=>{child.kill("SIGKILL"),child.stdout?.destroy(),child.stdin?.destroy(),finish(void 0)},timer=setTimeout(abort,options?.
|
|
9
|
+
timeoutMs??3e3);child.on("error",()=>finish(void 0)),child.on("close",code=>{settled||finish(code===0?Buffer.concat(chunks,length):void 0)}),child.stdout?.on("data",chunk=>{settled||(length+=chunk.length,length>(options?.maxBufferBytes??50*1024*1024)?abort():chunks.push(chunk))}),child.stdin?.on("error",()=>{}),child.stdin?.end(options?.input)})}var MAX_OSC52_ENCODED_LENGTH=1e5;function isRemoteSession(env){return!!(env.SSH_CONNECTION||env.SSH_CLIENT||env.MOSH_CONNECTION||env.HUMAIN_TERMINAL_CLIPBOARD_OSC52==="1")}function emitOsc52(text){let encoded=Buffer.from(text).toString("base64");return encoded.length>MAX_OSC52_ENCODED_LENGTH?!1:(process.stdout.write(`\x1B]52;c;${encoded}\x07`),!0)}async function copyViaWindowsClipboard(text){let tmpFile=join(tmpdir(),`pi-wsl-clip-${randomUUID()}.txt`);try{writeFileSync(tmpFile,text,{encoding:"ut\
|
|
10
|
+
f8",mode:384});let winPath=(await runClipboardCommand("wslpath",["-w",tmpFile],{timeoutMs:1e3}))?.toString("utf8").trim();if(!winPath)return!1;let script=`Set-Clipboard -Value ([System.IO.File]::ReadAllText('${winPath.replaceAll("'","''")}', [System.Text.Encoding]::UTF8))`;return await runClipboardCommand("powershell.exe",["-NoProfile","-Command",script],{timeoutMs:5e3})!==void 0}catch{return!1}finally{try{unlinkSync(tmpFile)}catch{}}}async function readClipboardText(){let commands=[];process.env.
|
|
11
|
+
TERMUX_VERSION&&commands.push(["termux-clipboard-get",[]]),platform()==="linux"&&(process.env.WAYLAND_DISPLAY&&commands.push(["wl-paste",["--no-newline","--type","text"]]),process.env.DISPLAY&&commands.push(["xclip",["-selection","clipboard","-out"]],["xsel",["--clipboard","--output"]]));for(let[command,args]of commands){let bytes=await runClipboardCommand(command,args,{timeoutMs:5e3});if(bytes!==void 0)return bytes.toString("utf8")||null}try{return await getNativeClipboard()?.getText()||null}catch{
|
|
12
|
+
return null}}async function readClipboardFilePaths(){let paths=await getNativeClipboard()?.getFilePaths?.();return paths?.length?paths:null}async function copyToClipboard(text){let p=platform(),env=process.env,copied=!1;if(p!=="linux")try{let clipboard=getNativeClipboard();clipboard?.setText&&(await clipboard.setText(text),copied=!0)}catch{}if(!copied){let commands=[];p==="darwin"?commands.push(["pbcopy",[]]):p==="win32"?commands.push(["clip",[]]):(env.TERMUX_VERSION&&commands.push(["termux-clip\
|
|
13
|
+
board-set",[]]),env.WAYLAND_DISPLAY&&commands.push(["wl-copy",[]]),env.DISPLAY&&commands.push(["xclip",["-selection","clipboard"]],["xsel",["--clipboard","--input"]]));for(let[command,args]of commands)if(await runClipboardCommand(command,args,{input:text,timeoutMs:5e3})!==void 0){copied=!0;break}}let osc52Emitted=!1;!copied&&p==="linux"&&isWSL(env)&&(env.WT_SESSION&&(osc52Emitted=emitOsc52(text)),copied=osc52Emitted||await copyViaWindowsClipboard(text));let headless=p==="linux"&&!env.DISPLAY&&!env.
|
|
14
|
+
WAYLAND_DISPLAY&&!env.TERMUX_VERSION,oversized=!1;if(!osc52Emitted&&(isRemoteSession(env)||!copied&&headless)&&(emitOsc52(text)?copied=!0:oversized=!0),!copied){if(oversized)throw new Error("Clipboard unavailable: text exceeds the OSC 52 size limit");if(env.TERMUX_VERSION)throw new Error("Clipboard unavailable: install the Termux:API app and `termux-api` package");if(p==="linux"){if(env.WAYLAND_DISPLAY)throw new Error("Clipboard unavailable: install `wl-clipboard` (`wl-copy`) or check Wayland ac\
|
|
15
|
+
cess");if(env.DISPLAY)throw new Error("Clipboard unavailable: install `xclip` or `xsel`, or check X11 access")}throw new Error("Clipboard unavailable")}}var current,listeners=new Set;function notify(){for(let listener of listeners)try{listener()}catch{}}function trackUserWait(reason,promise){let wait={reason};return current=wait,notify(),promise.finally(()=>{current===wait&&(current=void 0,notify())})}function currentUserWait(){return current?.reason}function onUserWaitChange(listener){return listeners.add(listener),()=>{listeners.delete(listener)}}var handlers=new WeakMap;function bindClaudeUsageReconnect(registry,handler){return handlers.set(registry,handler),()=>{handlers.get(registry)===handler&&handlers.delete(registry)}}function getClaudeUsageReconnect(registry){return handlers.get(registry)}function formatSubscriptionCredits(credits){if(credits?.unlimited===!0)return"unlimited";if(credits?.hasCredits===!1)return"none";let balance=parseSubscriptionCreditAmount(credits?.balance);if(balance===void 0||credits?.unit===void 0)return"unavailable";if(Number(balance)===0)return"none";let[integer,fraction]=balance.split("."),amount=`${Number(integer).toLocaleString("en-US")}${fraction===void 0?"":`.${fraction}`}`;return credits.unit==="USD"?`$${amount}`:`${amount} credits`}function formatSubscriptionAccountSummary(result){
|
|
16
|
+
let usage=subscriptionAccountUsage(result),weekly=usage.weeklyLeft===void 0?`weekly usage: unavailable${usage.expired?" (sign-in expired)":""}`:`weekly: ${usage.weeklyLeft}% left`;return usage.availability&&(weekly+=`, provider: ${usage.availability}`),usage.reset&&(weekly+=usage.availability?`, resets ${usage.reset}`:`, Next reset ${usage.reset}`),`${weekly}, saved resets: ${usage.savedResets}, paid credits: ${usage.paidCredits}${usage.extraUsage===void 0?"":`, extra usage: ${usage.extraUsage}`}`}
|
|
17
|
+
function subscriptionAccountUsage(result){let ok=result?.status==="ok"?result:void 0,claude=ok&&"fetchedAt"in ok?ok:void 0,codex=ok&&"usage"in ok?ok.usage:void 0,weekly=claude?.windows.find(window=>window.id==="seven_day"),percent=weekly?100-weekly.usedPercent:codex?.remainingPercent,count=ok?.resets?.availableCount,enabled=ok?.credits?.enabled;return{expired:result?.status==="unavailable"&&result.reason==="expired_credential",weeklyLeft:percent===void 0?void 0:Math.round(percent),reset:claude?formatNextQuotaReset(
|
|
18
|
+
claude.windows):codex?.resetsAt===void 0?void 0:formatOAuthAccountResetTime(codex.resetsAt),availability:codex?getCodexAvailability(codex):void 0,savedResets:count===void 0?"unavailable":count===0?"none":String(count),paidCredits:formatSubscriptionCredits(ok?.credits),extraUsage:enabled===void 0?void 0:enabled?"enabled":"disabled"}}function formatNextQuotaReset(windows,now=Date.now()){let nearest=1/0;for(let{resetsAt}of windows)resetsAt!==void 0&&resetsAt>now&&resetsAt<nearest&&(nearest=resetsAt);
|
|
19
|
+
return nearest===1/0?void 0:formatOAuthAccountResetTime(nearest)}function formatOAuthAccountResetTime(epochMs){let date=new Date(epochMs),time=`${String(date.getHours()).padStart(2,"0")}:${String(date.getMinutes()).padStart(2,"0")}`;return date.toDateString()===new Date().toDateString()?time:`${time} on ${date.toLocaleDateString()}`}function formatOAuthAccountUsage(usage){switch(usage.kind){case"none":return"";case"loading":return"weekly usage: loading\u2026";case"subscription":return[usage.status,
|
|
20
|
+
formatSubscriptionAccountSummary(usage.result)].filter(Boolean).join(", ");case"unavailable":return usage.reason==="expired_credential"?"weekly usage: unavailable (sign-in expired)":"weekly usage: unavailable";case"available":{let remaining=`weekly: ${Math.round(usage.remainingPercent)}% left, provider: ${getCodexAvailability(usage)}`;return usage.resetsAt!==void 0?`${remaining}, resets ${formatOAuthAccountResetTime(usage.resetsAt)}`:remaining}}}function formatOAuthAccountOption(label,usage){let usageText=formatOAuthAccountUsage(
|
|
21
|
+
usage);return usageText?`${label} (${usageText})`:label}import{readFile}from"node:fs/promises";import{homedir}from"node:os";import{join as join2}from"node:path";function usageDisplayText(text){return sanitizeTerminalText(text).replace(/[\t\r\n\u061c\u200e\u200f\u2028\u2029\u202a-\u202e\u2066-\u2069]/g," ")}function formatTokens(count){return count<1e3?count.toString():count<1e4?`${(count/1e3).toFixed(1)}k`:count<1e6?`${Math.round(count/1e3)}k`:count<1e7?`${(count/1e6).toFixed(1)}M`:`${Math.round(count/1e6)}M`}function formatDuration(ms){let totalSeconds=Math.max(0,Math.floor(ms/1e3)),hours=Math.floor(totalSeconds/3600),minutes=Math.floor(totalSeconds%3600/
|
|
22
|
+
60),seconds=totalSeconds%60;return hours>0?`${hours}h ${minutes}m ${seconds}s`:minutes>0?`${minutes}m ${seconds}s`:`${seconds}s`}function percentTone(percent){return percent>90?"error":percent>70?"warning":"accent"}function contextTone(percent){return percent===null?"accent":percentTone(percent)}function buildUsageOverview(opts){let{providerId,modelId,stats,durationMs,usageIncomplete,subscriptionBacked,accountBars}=opts,bars=[],lines=[],notes=[];accountBars&&bars.push(...accountBars);let cu=stats.
|
|
23
|
+
contextUsage;return cu&&bars.push({id:"context",label:"Context",used:cu.tokens??0,total:cu.contextWindow,display:`${cu.percent!==null?`${cu.percent.toFixed(1)}%`:"?"} / ${formatTokens(cu.contextWindow)}`,tone:contextTone(cu.percent)}),lines.push({label:"tokens",value:`\u2191${formatTokens(stats.tokens.input)} \u2193${formatTokens(stats.tokens.output)}`}),lines.push(usageIncomplete?{label:"cost",value:`\u2265$${stats.cost.toFixed(3)} (usage incomplete)`,tone:"warning"}:{label:"cost",value:`$${stats.
|
|
24
|
+
cost.toFixed(3)}`}),durationMs!==null&&lines.push({label:"time",value:formatDuration(durationMs)}),subscriptionBacked&¬es.push("Subscription limits (weekly / 5h) are not exposed by this provider's API. See its usage dashboard."),{providerId,modelId,bars,lines,notes}}function formatUsageOverview(overview){let rows=[...overview.bars.map(bar=>({label:bar.label,value:`${bar.display}${bar.note?` (${bar.note})`:""}`})),...overview.lines],labelWidth=Math.max(0,...rows.map(row=>visibleWidth(row.label)));
|
|
25
|
+
return[`${overview.providerId} \xB7 ${overview.modelId}`,...rows.map(row=>` ${row.label}${" ".repeat(labelWidth-visibleWidth(row.label))} ${row.value}`),...overview.notes].map(line=>sanitizeTerminalText(line)).join(`
|
|
26
|
+
`)}function weeklyResetLines(resets){let lines=[{label:"saved resets",value:resets?.availableCount===void 0?"unavailable":resets.availableCount===0?"none":`${resets.availableCount} banked`,section:"resets"}];return resets?.eligible!==void 0&&lines.push({label:"use now",value:resets.eligible?"available":"not available",section:"resets"}),resets?.expiresAt!==void 0&&lines.push({label:"reset expiry",value:formatOAuthAccountResetTime(resets.expiresAt),section:"resets"}),lines}function paidUsageLines(credits){
|
|
27
|
+
let lines=[{label:"paid credits",value:formatSubscriptionCredits(credits),section:"paid"}];return credits?.enabled!==void 0&&lines.push({label:"extra usage",value:credits.enabled?"enabled":"disabled",section:"paid"}),credits?.limit!==void 0&&lines.push({label:"spending limit",value:formatSubscriptionCredits({balance:credits.limit,unit:credits.unit}),section:"paid"}),lines.push({label:"auto reload",value:credits?.autoReload===void 0?"unavailable":credits.autoReload?"on":"off",section:"paid"}),lines}
|
|
28
|
+
function limitBar(id,label,usedPercent,resetsAt,limitReached,now){let used=Math.min(100,Math.max(0,usedPercent)),notes=[resetsAt===void 0?void 0:`${resetsAt<=now?"reset at":"resets"} ${formatOAuthAccountResetTime(resetsAt)}`,limitReached?"limit reached":void 0].filter(note=>note!==void 0);return{id,label,used,total:100,display:`${used.toFixed(0)}% used`,tone:limitReached?"error":percentTone(used),...notes.length>0?{note:notes.join(", ")}:{}}}function claudeUsageBars(windows,now=Date.now()){return windows.
|
|
29
|
+
map(window=>({...limitBar(`claude-${window.id}`,window.label,window.usedPercent,window.resetsAt,window.usedPercent>=100,now),...window.id==="extra_usage"?{section:"paid"}:{}}))}function parseClaudeUtilization(raw,now=Date.now()){if(!raw||typeof raw!="object")return[];let u=raw.utilization??raw;if(!u||typeof u!="object")return[];let bars=claudeUsageBars(parseAnthropicSubscriptionUsage(u),now);for(let[key,value]of Object.entries(u)){if(key==="extra_usage"||!value||typeof value!="object")continue;let{
|
|
30
|
+
used_dollars:used,limit_dollars:total}=value;if(!(typeof used!="number"||typeof total!="number"||!Number.isFinite(used)||!(total>0))){bars.push({id:`claude-${key}`,label:"Credits",used,total,display:`$${used.toFixed(2)} / $${total.toFixed(2)}`,tone:percentTone(used/total*100)});break}}return bars}var CLAUDE_UNAVAILABLE={expired_credential:"Claude sign-in expired.",refresh_failed:"Claude sign-in could not be refreshed. Try again later.",refresh_rejected:"Claude rejected the sign-in refresh.",unauthorized:"\
|
|
31
|
+
Claude usage was refused (HTTP 401/403).",rate_limited:"Claude usage is rate limited (HTTP 429). Try again later.",http_error:"Claude usage is unavailable (HTTP error).",timeout:"Claude usage timed out.",network:"Claude usage is unreachable.",malformed:"Claude usage returned an unexpected response."},CODEX_UNAVAILABLE={expired_credential:"Codex sign-in expired. Run /login.",unauthorized:"Codex usage was refused (HTTP 401/403).",rate_limited:"Codex usage is rate limited (HTTP 429). Try again late\
|
|
32
|
+
r.",http_error:"Codex usage is unavailable (HTTP error).",timeout:"Codex usage timed out.",network:"Codex usage is unreachable.",malformed:"Codex usage returned an unexpected response.",no_weekly_window:"Codex reported no weekly limit."};function codexUsageBars(result,now=Date.now()){return result?result.status==="unavailable"?{error:CODEX_UNAVAILABLE[result.reason]}:result.windows.length===0&&!result.credits?{error:"Codex reported no usage limits."}:{bars:result.windows.map(window=>limitBar(`co\
|
|
33
|
+
dex-${window.id}`,window.label,window.usedPercent,window.resetsAt,window.limitReached===!0,now)),lines:[...nextQuotaResetLines(result.windows,now),...paidUsageLines(result.credits)]}:{error:"No active Codex account. Run /login."}}function usageAge(ms){return`${ms>=1728e5?`${Math.floor(ms/864e5)} days`:formatAge(ms)} ago`}function formatAge(ms){let minutes=Math.floor(Math.max(0,ms)/6e4);if(minutes<1)return"under a minute";if(minutes<60)return`${minutes} min`;let hours=Math.floor(minutes/60);return hours<
|
|
34
|
+
48?`${hours} h`:`${Math.floor(hours/24)} d`}async function readClaudeCachedUsage(readOwner,now,home=homedir()){let text;try{text=await readFile(join2(home,".claude.json"),"utf8")}catch(err){return err.code==="ENOENT"?{error:"~/.claude.json not found."}:{error:"Could not read ~/.claude.json."}}let data;try{data=JSON.parse(text)}catch{return{error:"~/.claude.json is not valid JSON."}}let identity=data&&typeof data=="object"?data.oauthAccount:void 0,{accountUuid,organizationUuid}=identity??{},{accountId,
|
|
35
|
+
organizationId}=await readOwner()??{},sameOrganization=typeof organizationUuid=="string"?organizationUuid.toLowerCase()===organizationId?.toLowerCase():organizationUuid===void 0&&organizationId===void 0;if(!accountId||typeof accountUuid!="string"||accountUuid.toLowerCase()!==accountId.toLowerCase()||!sameOrganization)return{error:"Claude Code's cache does not match this account."};let cached=data&&typeof data=="object"?data.cachedUsageUtilization:void 0;if(!cached||typeof cached!="object")return{
|
|
36
|
+
error:"No cached Claude Code usage in ~/.claude.json."};let fetchedAt=cached.fetchedAtMs,fetchedAtMs=typeof fetchedAt=="number"&&Number.isFinite(fetchedAt)&&fetchedAt>=0&&fetchedAt<=now?fetchedAt:void 0,payload=cached.utilization??cached,stale=fetchedAtMs===void 0||now-fetchedAtMs>36e5||parseAnthropicSubscriptionUsage(payload).some(window=>window.resetsAt!==void 0&&window.resetsAt<=now),bars=parseClaudeUtilization(cached,now);return bars.length===0?{error:"No cached Claude Code usage in ~/.claud\
|
|
37
|
+
e.json."}:{bars:stale?[]:bars,fetchedAtMs,stale}}async function readClaudeUsage(registry,accountKey,request,home){let result,failure,lastKnown;try{if(result=await registry.getAnthropicUsage({accountKey,...request}),result?.status==="ok"&&result.windows.length>0){let now2=Date.now(),windows=result.windows.filter(({resetsAt})=>resetsAt===void 0||resetsAt>now2);if(windows.length>0&&now2-result.fetchedAt<=36e5)return{result:{...result,windows}};lastKnown=result.fetchedAt,result={...result,windows:[]}}
|
|
38
|
+
failure=result?.status==="unavailable"?CLAUDE_UNAVAILABLE[result.reason]:result?"Claude reported no usage limits.":"No saved Claude account. Run /login."}catch{failure="Claude usage is unavailable."}let now=Date.now(),cache=await readClaudeCachedUsage(async()=>{try{return(await registry.getUsageAccounts(ANTHROPIC_USAGE_PROVIDER_ID,{signal:request.signal})).find(({key})=>key===accountKey)}catch{return}},now,home),required=result?.status==="unavailable"&&result.reason==="refresh_rejected";if("erro\
|
|
39
|
+
r"in cache)return{result,fallback:{status:lastKnown===void 0?"No live data":`No live data; last known ${usageAge(now-lastKnown)}`,bars:[],failure,cacheError:cache.error,reconnect:required?"required":lastKnown!==void 0?"optional":void 0}};let age=cache.fetchedAtMs===void 0?void 0:usageAge(now-cache.fetchedAtMs);return{result,fallback:{status:cache.stale?`No live data; last known ${age??"(age unknown)"}`:`Claude Code's cached numbers, from ${age}`,bars:cache.bars,failure,reconnect:required?"requir\
|
|
40
|
+
ed":cache.stale?"optional":void 0}}}function nextQuotaResetLines(windows,now){let reset=formatNextQuotaReset(windows,now);return reset?[{label:"Next reset",value:reset}]:[]}var import_semver=__toESM(require_semver(),1);var DEFAULT_VERSION_CHECK_TIMEOUT_MS=1e4;function formatVersionCheckError(error){let rootMessage=error instanceof Error&&error.message?error.message:String(error),cause=error instanceof Error?error.cause:void 0,causes=cause instanceof AggregateError?cause.errors:cause===void 0?[]:[cause],codes=causes.map(value=>typeof value=="object"&&value!==null&&"code"in value&&typeof value.code=="string"?value.code:void 0).filter(code=>code!==void 0);if(codes.length>0)return`${rootMessage} (${[...new Set(codes)].
|
|
41
|
+
join(", ")})`;let causeMessage=causes.find(value=>value instanceof Error&&!!value.message)?.message;return causeMessage?`${rootMessage} (cause: ${causeMessage})`:rootMessage}function comparePackageVersions(leftVersion,rightVersion){let left=(0,import_semver.valid)(leftVersion.trim()),right=(0,import_semver.valid)(rightVersion.trim());if(!(!left||!right))return(0,import_semver.compare)(left,right)}function isNewerPackageVersion(candidateVersion,currentVersion){let comparison=comparePackageVersions(
|
|
42
|
+
candidateVersion,currentVersion);return comparison!==void 0?comparison>0:candidateVersion.trim()!==currentVersion.trim()}async function getLatestPiRelease(currentVersion,options={}){if(process.env[ENV_OFFLINE])return;let response=await fetchWithRetry(getVersionCheckUrl(),{headers:{"User-Agent":getPiUserAgent(currentVersion),accept:"application/json"}},{maxRetries:options.retry?2:0,timeoutMs:options.timeoutMs??DEFAULT_VERSION_CHECK_TIMEOUT_MS});if(!response.ok)return;let data=await response.json();
|
|
43
|
+
if(typeof data.version!="string"||!data.version.trim())return;let packageField=data.packageName??data.name,packageName=typeof packageField=="string"&&packageField.trim()?packageField.trim():void 0,note=typeof data.note=="string"&&data.note.trim()?data.note.trim():void 0;return{version:data.version.trim(),packageName,...note?{note}:{}}}async function checkForNewPiVersion(currentVersion){if(!process.env[ENV_SKIP_VERSION_CHECK])try{let latestRelease=await getLatestPiRelease(currentVersion);return latestRelease&&isNewerPackageVersion(latestRelease.version,currentVersion)?latestRelease:void 0}catch{return}}var SIGNAL_SHUTDOWN_GRACE_MS=1500;async function waitForSignalShutdown(shutdown){let timer;try{await Promise.race([shutdown,new Promise(resolve2=>{timer=setTimeout(resolve2,SIGNAL_SHUTDOWN_GRACE_MS)})])}finally{clearTimeout(timer)}}async function exitAfterSignalShutdown(shutdown,exitCode){try{await waitForSignalShutdown(shutdown)}finally{await killTrackedDetachedChildrenAsync(),process.exit(exitCode)}}import{basename,isAbsolute,relative,resolve,sep}from"node:path";function sanitizeStatusText(text){return text.replace(/[\r\n\t]/g," ").replace(/ +/g," ").trim()}function formatTokens2(count){return count<1e3?count.toString():count<1e4?`${(count/1e3).toFixed(1)}k`:count<1e6?`${Math.round(count/1e3)}k`:count<1e7?`${(count/1e6).toFixed(1)}M`:`${Math.round(count/1e6)}M`}function formatCwdForFooter(cwd,home){if(!home)return cwd;let resolvedCwd=resolve(cwd),resolvedHome=resolve(home),relativeToHome=relative(resolvedHome,resolvedCwd);return relativeToHome===""||relativeToHome!==
|
|
44
|
+
".."&&!relativeToHome.startsWith(`..${sep}`)&&!isAbsolute(relativeToHome)?relativeToHome===""?"~":`~${sep}${relativeToHome}`:cwd}var FOOTER_VALUE_INPUTS=["width","theme","identity","effort","modelName","accountLabel","routedModelId","provider","age","contextPercent","contextWindow","usingSubscription","usageIncomplete","cost","input","output","cacheRead","cacheWrite","latestCacheHitRate","experimental"];var NO_EXTENSION_STATUSES=[];function sameFooterInputs(a,b){for(let key of FOOTER_VALUE_INPUTS)if(!Object.is(a[key],b[key]))return!1;let statuses=a.extensionStatuses;if(statuses.length!==b.extensionStatuses.length)return!1;for(let i=0;i<statuses.length;i++)if(statuses[i]!==b.extensionStatuses[i])return!1;return!0}var FooterComponent=class{lastEventAt;activitySessionId;activityTimer;session;footerData;sessionStats;rendered;constructor(session,footerData,requestRender){this.session=session,this.footerData=
|
|
45
|
+
footerData,this.activitySessionId=session.sessionManager.getSessionId(),this.refreshActivityFromSession(),requestRender&&this.startActivityTimer(requestRender)}setSession(session){let changed=this.session!==session||this.activitySessionId!==session.sessionManager.getSessionId();this.session=session,changed&&this.refreshActivityFromSession()}markActivity(){this.lastEventAt=performance.now()}refreshActivityFromSession(){this.activitySessionId=this.session.sessionManager.getSessionId(),this.lastEventAt=
|
|
46
|
+
void 0;let now=Date.now(),latest=0;for(let entry of this.session.sessionManager.getBranch()){if(entry.type!=="message"||entry.message.role!=="user"&&entry.message.role!=="assistant"&&entry.message.role!=="toolResult")continue;let timestamp=Date.parse(entry.timestamp);Number.isFinite(timestamp)&×tamp>latest&×tamp<=now&&(latest=timestamp)}latest>0&&(this.lastEventAt=performance.now()-(now-latest))}startActivityTimer(onTick){this.activityTimer||(this.activityTimer=setInterval(()=>{this.lastEventAt!==
|
|
47
|
+
void 0&&onTick()},1e3),this.activityTimer.unref())}invalidate(){}dispose(){this.activityTimer&&clearInterval(this.activityTimer),this.activityTimer=void 0}getSessionStats(){let sessionManager=this.session.sessionManager,entryCount=sessionManager.getEntryCount(),sessionId=sessionManager.getSessionId(),leafId=sessionManager.getLeafId(),limitsModel=this.session.routedModel?.model??this.session.model,cached=this.sessionStats;if(cached&&cached.session===this.session&&cached.sessionId===sessionId&&cached.
|
|
48
|
+
leafId===leafId&&cached.entryCount===entryCount&&cached.limitsModel===limitsModel)return cached;let usageTotals=createUsageTotals(),latestCacheHitRate,entries=sessionManager.getEntries();for(let{usage}of getSessionUsage(entries))addUsageToTotals(usageTotals,usage);for(let entry of entries)if(entry.type==="message"&&entry.message.role==="assistant"){let latestPromptTokens=entry.message.usage.input+entry.message.usage.cacheRead+entry.message.usage.cacheWrite;latestCacheHitRate=latestPromptTokens>0?
|
|
49
|
+
entry.message.usage.cacheRead/latestPromptTokens*100:void 0}let contextUsage=this.session.getContextUsage();return this.sessionStats={session:this.session,sessionId,leafId,entryCount,limitsModel,usageTotals,latestCacheHitRate,contextUsage},this.sessionStats}renderInputs(width){let state=this.session.state,{usageTotals,latestCacheHitRate,contextUsage}=this.getSessionStats(),routed=this.session.routedModel,pwd=basename(this.session.sessionManager.getCwd())||sep,branch=this.footerData.getGitBranch(),
|
|
50
|
+
sessionName=this.session.sessionManager.getSessionName(),effectiveModel=routed?.model??state.model,thinkingLevel=routed?.thinkingLevel??state.thinkingLevel??"off",elapsed=this.lastEventAt===void 0?void 0:Math.max(0,Math.floor((performance.now()-this.lastEventAt)/1e3)),accountLabel=state.model?this.footerData.getOAuthAccountLabel(state.model.provider):void 0,statuses=this.footerData.getExtensionStatuses();return{width,theme:getThemeInstance(),identity:[pwd,branch,sessionName].filter(Boolean).map(
|
|
51
|
+
text=>stripAnsi(sanitizeStatusText(text))).join(" \xB7 "),effort:this.session.autoEffortSelecting?"Choosing effort\u2026":effectiveModel?.reasoning&&thinkingLevel!=="off"?thinkingLevel[0].toUpperCase()+thinkingLevel.slice(1):"Thinking off",modelName:stripAnsi(sanitizeStatusText(state.model?.id??"no-model")),accountLabel:accountLabel?stripAnsi(sanitizeStatusText(accountLabel)):void 0,routedModelId:routed?stripAnsi(sanitizeStatusText(routed.model.id)):void 0,provider:this.footerData.getAvailableProviderCount()>
|
|
52
|
+
1&&state.model?stripAnsi(sanitizeStatusText(state.model.provider)):void 0,age:elapsed===void 0?"\u2014":elapsed===0?"now":elapsed<60?`${elapsed}s ago`:elapsed<3600?`${Math.floor(elapsed/60)}m ago`:elapsed<86400?`${Math.floor(elapsed/3600)}h ago`:`${Math.floor(elapsed/86400)}d ago`,contextPercent:contextUsage?.percent??void 0,contextWindow:contextUsage?.contextWindow??routed?.model.contextWindow??state.model?.contextWindow??0,usingSubscription:state.model?this.session.modelRuntime.isUsingSubscription(
|
|
53
|
+
state.model.provider):!1,usageIncomplete:!!usageTotals.usageIncomplete,cost:usageTotals.cost,input:usageTotals.input,output:usageTotals.output,cacheRead:usageTotals.cacheRead,cacheWrite:usageTotals.cacheWrite,latestCacheHitRate,experimental:areExperimentalFeaturesEnabled(),extensionStatuses:statuses.size===0?NO_EXTENSION_STATUSES:Array.from(statuses.entries()).filter(([key])=>key!=="adhd"&&key!=="caveman"&&key!=="ponytail").sort(([a],[b])=>a.localeCompare(b)).map(([,text])=>sanitizeStatusText(text))}}render(width){
|
|
54
|
+
if(width<1)return[];let inputs=this.renderInputs(width),known=this.rendered;if(known&&sameFooterInputs(known.inputs,inputs))return known.lines.slice();let lines=this.renderLines(inputs);return this.rendered={inputs,lines:lines.slice()},lines}renderLines(inputs){let{width,contextPercent}=inputs,context=`Context ${contextPercent===void 0?"?":`${contextPercent.toFixed(1)}%`}/${formatTokens2(inputs.contextWindow)}`,lines=[truncateToWidth(theme.fg("dim",inputs.identity),width,theme.fg("dim","..."))],
|
|
55
|
+
{effort,modelName}=inputs,model=modelName,modelFields=[theme.fg("accent",effort)],activity=theme.fg("dim",`Last event ${inputs.age}`);if(inputs.accountLabel){let withAccount=`${modelName} [${inputs.accountLabel}]`;visibleWidth(effort)+3+visibleWidth(withAccount)+2+visibleWidth(activity)<=width&&(model=withAccount)}if(modelFields.push(theme.fg("text",model)),inputs.routedModelId!==void 0&&modelFields.push(theme.fg("muted",`\u2192 ${inputs.routedModelId}`)),inputs.provider!==void 0){let provider=theme.
|
|
56
|
+
fg("dim",`(${inputs.provider})`);visibleWidth([...modelFields,provider].join(" \xB7 "))+2+visibleWidth(activity)<=width&&modelFields.push(provider)}lines.push(...this.renderBand(modelFields,activity,width));let contextColor=(contextPercent??0)>90?"error":(contextPercent??0)>70?"warning":"text",{usingSubscription}=inputs,statsParts=[theme.fg(contextColor,context)];inputs.usageIncomplete?statsParts.push(theme.fg("muted",`${inputs.cost>0?`\u2265$${inputs.cost.toFixed(3)}`:"Cost unknown"}${usingSubscription?
|
|
57
|
+
" (sub)":""} (usage incomplete)`)):(inputs.cost||usingSubscription)&&statsParts.push(theme.fg("muted",`$${inputs.cost.toFixed(3)}${usingSubscription?" (sub)":""}`)),statsParts.push(theme.fg("dim",`In ${formatTokens2(inputs.input)}`),theme.fg("dim",`Out ${formatTokens2(inputs.output)}`)),inputs.experimental&&statsParts.push(theme.bold(theme.fg("warning","xp"))),lines.push(...this.renderBand(statsParts,void 0,width));let cacheParts=[theme.fg("dim",`Cache read ${formatTokens2(inputs.cacheRead)}`)];
|
|
58
|
+
return inputs.cacheWrite&&cacheParts.push(theme.fg("dim",`Cache write ${formatTokens2(inputs.cacheWrite)}`)),cacheParts.push(theme.fg("dim",`Hit ${inputs.latestCacheHitRate===void 0?"\u2014":`${inputs.latestCacheHitRate.toFixed(1)}%`}`)),lines.push(...this.renderBand(cacheParts,theme.fg("dim","/settings"),width)),inputs.extensionStatuses.length&&lines.push(truncateToWidth(inputs.extensionStatuses.join(" "),width,theme.fg("dim","..."))),lines}renderBand(fields,right,width){let lines=[],line="";for(let field of fields)
|
|
59
|
+
if(line&&visibleWidth(`${line} \xB7 ${field}`)>width&&(lines.push(line),line=""),visibleWidth(field)>width){let wrapped=wrapTextWithAnsi(field,width);lines.push(...wrapped.slice(0,-1)),line=wrapped.at(-1)??""}else line=line?`${line} \xB7 ${field}`:field;if(right)if(line&&visibleWidth(line)+2+visibleWidth(right)<=width)line+=" ".repeat(width-visibleWidth(line)-visibleWidth(right))+right;else{line&&lines.push(line);let wrapped=wrapTextWithAnsi(right,width);lines.push(...wrapped.slice(0,-1)),line=wrapped.
|
|
60
|
+
at(-1)??""}return line&&lines.push(line),lines.map(rendered=>truncateToWidth(rendered,width,""))}};var ModelCatalogRefreshCoordinator=class{activeByRuntime=new WeakMap;hcodeOnlyByRuntime=new WeakMap;checkWatchedHcode(runtime,signal){return this.activeByRuntime.has(runtime)||this.hcodeOnlyByRuntime.has(runtime)?Promise.resolve(void 0):this.refreshHcode(runtime,signal)}refreshHcode(runtime,signal){signal.throwIfAborted();let hcode=this.hcodeOnlyByRuntime.get(runtime);if(hcode)return raceWithAbortSignal(hcode,signal);if(this.activeByRuntime.has(runtime))return this.refresh(runtime,signal).then(({
|
|
61
|
+
aborted,errors})=>({aborted,errors:new Map([...errors].filter(([provider])=>provider===HCODE_PROVIDER))}));let operation=raceWithAbortSignal(runtime.refresh({providers:[HCODE_PROVIDER],signal}),signal).finally(()=>this.hcodeOnlyByRuntime.delete(runtime));return this.hcodeOnlyByRuntime.set(runtime,operation),operation}refresh(modelRuntime,signal){signal.throwIfAborted();let active=this.activeByRuntime.get(modelRuntime);if(!active){let controller=new AbortController,created,hcode=this.hcodeOnlyByRuntime.
|
|
62
|
+
get(modelRuntime),operation=hcode?raceWithAbortSignal(hcode,controller.signal).then(result=>(controller.signal.throwIfAborted(),result.aborted?result:modelRuntime.refresh({signal:controller.signal}))):modelRuntime.refresh({signal:controller.signal}),promise=raceWithAbortSignal(operation,controller.signal).finally(()=>{this.activeByRuntime.get(modelRuntime)===created&&this.activeByRuntime.delete(modelRuntime)});created={controller,promise,waiters:0},active=created,this.activeByRuntime.set(modelRuntime,
|
|
63
|
+
active)}return active.waiters++,raceWithAbortSignal(active.promise,signal).finally(()=>{active.waiters--,active.waiters===0&&this.activeByRuntime.get(modelRuntime)===active&&active.controller.abort()})}},modelCatalogRefreshCoordinator=new ModelCatalogRefreshCoordinator;async function checkWatchedHcodeCatalog(modelRuntime,signal){return modelCatalogRefreshCoordinator.checkWatchedHcode(modelRuntime,signal)}async function retryHcodeCatalog(modelRuntime,signal){return modelCatalogRefreshCoordinator.
|
|
64
|
+
refreshHcode(modelRuntime,signal)}function refreshModelCatalogs(modelRuntime,signal){return modelCatalogRefreshCoordinator.refresh(modelRuntime,signal)}function refreshStartupModelCatalogs(modelRuntime,signal){return signal.throwIfAborted(),raceWithAbortSignal(modelRuntime.refresh({providers:modelRuntime.getProviders().filter(provider=>provider.id!==HCODE_PROVIDER).map(provider=>provider.id),signal}),signal)}var AuthCommandError=class extends Error{},AUTH_COMMAND_USAGE={check:`${APP_COMMAND} auth check --provider <provider> [--json] [--credentials] [--no-refresh]`,api_key:`${APP_COMMAND} auth print-api-key --provider <provider> [--model <model>]`,bearer_token:`${APP_COMMAND} auth print-bearer-token --provider <provider> [--model <model>] [--min-expiry <duration>]`};function getAuthCommandName(kind){return kind==="check"?"auth check":kind==="api_key"?"auth print-api-key":"auth print-bearer-token"}function getAuthCommandUsage(kind){
|
|
65
|
+
return AUTH_COMMAND_USAGE[kind]}function isAuthCommandHelp(args){return args[0]==="auth"&&(args[1]===void 0||args[1]==="help"||args.includes("--help")||args.includes("-h"))}function printAuthCommandHelp(){console.log(`Usage:
|
|
66
|
+
${APP_COMMAND} auth print-api-key [--provider <provider>] [--model <model>]
|
|
67
|
+
${APP_COMMAND} auth print-bearer-token [--provider <provider>] [--model <model>] [--min-expiry <duration>]
|
|
68
|
+
${APP_COMMAND} auth check [--provider <provider>] [--model <model>] [--json] [--credentials] [--no-refresh]
|
|
69
|
+
|
|
70
|
+
Auth commands require at least one of --provider or --model. Checks refresh expired OAuth credentials by default; --no-refresh prevents this. --credentials emits the credential, or includes it in JSON output.`)}function parseAuthCommand(args){if(args[0]!=="auth")return;let kind=args[1]==="check"?"check":args[1]==="print-api-key"?"api_key":args[1]==="print-bearer-token"?"bearer_token":void 0;if(!kind)throw new AuthCommandError(`Unknown auth command "${args[1]??""}". Use "${APP_COMMAND} auth print\
|
|
71
|
+
-api-key", "${APP_COMMAND} auth print-bearer-token", or "${APP_COMMAND} auth check".`);let commandArgs=[],json=!1,credentials=!1,noRefresh=!1,minExpiryMs;for(let index=2;index<args.length;index++){let arg=args[index];if(arg==="--min-expiry"){if(kind!=="bearer_token")throw new AuthCommandError("--min-expiry is only supported by print-bearer-token");let value=args[++index],match=value?/^(\d+)(ms|s|m|h)$/iu.exec(value):void 0;if(!match)throw new AuthCommandError("--min-expiry must use a duration su\
|
|
72
|
+
ch as 30m or 1h");let amount=Number(match[1]),unit=match[2];minExpiryMs=amount*(unit==="ms"?1:unit==="s"?1e3:unit==="m"?6e4:36e5);continue}if(arg==="--json"||arg==="--credentials"||arg==="--no-refresh"){if(kind!=="check")throw new AuthCommandError(`${arg} is only supported by auth check`);arg==="--json"?json=!0:arg==="--credentials"?credentials=!0:noRefresh=!0;continue}commandArgs.push(arg)}return minExpiryMs===void 0?{kind,args:commandArgs,json,credentials,noRefresh}:{kind,args:commandArgs,json,
|
|
73
|
+
credentials,noRefresh,minExpiryMs}}function validateAuthCommandArgs(args,kind){let provider=args.provider?.trim()||void 0,model=args.model?.trim()||void 0;if(args.unknownFlags.size>0){let option=args.unknownFlags.keys().next().value;throw new AuthCommandError(`Unknown option --${option} for "${getAuthCommandName(kind)}".`)}if(args.apiKey!==void 0||args.messages.length>0||args.fileArgs.length>0)throw new AuthCommandError("Auth commands only accept --provider and --model");if(kind==="check"){if(!provider&&
|
|
74
|
+
!model)throw new AuthCommandError("Auth checks require --provider <provider> or --model <model>");return{provider,model}}if(!provider&&!model)throw new AuthCommandError("Credential printing requires --provider <provider> or --model <model>");return{provider,model}}function getAuthCredential(auth){if(auth?.auth.apiKey)return auth.auth.apiKey;let authorization=Object.entries(auth?.auth.headers??{}).find(([name])=>name.toLowerCase()==="authorization")?.[1];return typeof authorization=="string"?/^Bearer\s+(.+)$/iu.
|
|
75
|
+
exec(authorization)?.[1]:void 0}var AuthUrlComponent=class extends Container{url;tui;hint;constructor(tui,url){super(),this.tui=tui,this.url=url,this.addChild(new Text(theme.fg("accent",hyperlink(url,url)),1,0)),this.hint=new Text("",1,0),this.addChild(this.hint),this.setHint(keyHint("app.message.copy","to copy"))}setHint(suffix){let clickHint=process.platform==="darwin"?"Cmd+click to open":"Ctrl+click to open";this.hint.setText(`${theme.fg("dim",hyperlink(clickHint,this.url))} ${theme.fg("dim","\u2022")} ${suffix}`),this.tui.
|
|
76
|
+
requestRender()}async copy(){try{await copyToClipboard(this.url),this.setHint(theme.fg("success","Copied URL to clipboard"))}catch(error){this.setHint(theme.fg("error",error instanceof Error?error.message:String(error)))}}};function usagePaneRow(theme2,list,detail,listWidth){return truncateToWidth(list,listWidth,"\u2026",!0)+theme2.fg("dim"," \u2502 ")+detail}function renderUsageBar(theme2,bar,width){let fraction=bar.total&&bar.total>0?Math.min(1,Math.max(0,bar.used/bar.total)):0,filled=Math.round(fraction*width);return theme2.fg(bar.tone,"\u2588".repeat(filled))+theme2.fg("muted","\u2591".repeat(width-filled))}export{AuthCommandError,getAuthCommandName,getAuthCommandUsage,isAuthCommandHelp,printAuthCommandHelp,parseAuthCommand,validateAuthCommandArgs,getAuthCredential,HCODE_LOGIN_MISMATCH_DETAILS,hcodeEmptyCatalogMessage,hcodeEmptyCatalogReason,hcodeEmptyCatalogNotice,hcodeLoginAvailability,hcodeSignedInElsewhereNotice,runClipboardCommand,readClipboardText,readClipboardFilePaths,copyToClipboard,AuthUrlComponent,trackUserWait,currentUserWait,onUserWaitChange,bindClaudeUsageReconnect,getClaudeUsageReconnect,
|
|
77
|
+
subscriptionAccountUsage,formatOAuthAccountResetTime,formatOAuthAccountUsage,formatOAuthAccountOption,usageDisplayText,buildUsageOverview,formatUsageOverview,weeklyResetLines,paidUsageLines,claudeUsageBars,codexUsageBars,usageAge,readClaudeUsage,nextQuotaResetLines,formatVersionCheckError,isNewerPackageVersion,getLatestPiRelease,checkForNewPiVersion,waitForSignalShutdown,exitAfterSignalShutdown,usagePaneRow,renderUsageBar,formatTokens2 as formatTokens,formatCwdForFooter,FooterComponent,checkWatchedHcodeCatalog,
|
|
78
|
+
retryHcodeCatalog,refreshModelCatalogs,refreshStartupModelCatalogs};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{theme}from"./chunk-
|
|
2
|
+
import{theme}from"./chunk-KONLZKPL.js";var ARMIN_WIDTH=31,ARMIN_HEIGHT=36,WIDTH=ARMIN_WIDTH,HEIGHT=ARMIN_HEIGHT,BITS=[255,255,255,127,255,240,255,127,255,237,255,127,255,219,255,127,255,183,255,127,255,119,254,127,63,248,254,127,223,255,254,127,223,63,252,127,159,195,251,127,111,252,244,127,247,15,247,127,247,255,247,127,247,255,227,127,247,7,232,127,239,248,103,112,15,255,187,111,241,0,208,91,253,63,236,83,193,255,239,87,159,253,238,95,159,252,174,95,31,120,172,95,63,0,80,108,127,0,220,119,255,192,63,120,255,1,248,127,255,3,156,120,
|
|
3
3
|
255,7,140,124,255,15,206,120,255,255,207,127,255,255,207,120,255,255,223,120,255,255,223,125,255,255,63,126,255,255,255,127],BYTES_PER_ROW=Math.ceil(WIDTH/8),DISPLAY_HEIGHT=Math.ceil(HEIGHT/2),EFFECTS=["typewriter","scanline","rain","fade","crt","glitch","dissolve"];function isArminPixel(x,y){if(y>=HEIGHT)return!1;let byteIndex=y*BYTES_PER_ROW+Math.floor(x/8),bitIndex=x%8;return(BITS[byteIndex]>>bitIndex&1)===0}function getChar(x,row){let upper=isArminPixel(x,row*2),lower=isArminPixel(x,row*2+1);
|
|
4
4
|
return upper&&lower?"\u2588":upper?"\u2580":lower?"\u2584":" "}function buildFinalGrid(){let grid=[];for(let row=0;row<DISPLAY_HEIGHT;row++){let line=[];for(let x=0;x<WIDTH;x++)line.push(getChar(x,row));grid.push(line)}return grid}var ArminComponent=class{ui;interval=null;effect;finalGrid;currentGrid;effectState={};cachedLines=[];cachedWidth=0;gridVersion=0;cachedVersion=-1;constructor(ui){this.ui=ui,this.effect=EFFECTS[Math.floor(Math.random()*EFFECTS.length)],this.finalGrid=buildFinalGrid(),this.
|
|
5
5
|
currentGrid=this.createEmptyGrid(),this.initEffect(),this.startAnimation()}invalidate(){this.cachedWidth=0}render(width){if(width===this.cachedWidth&&this.cachedVersion===this.gridVersion)return this.cachedLines;let padding=1,availableWidth=width-padding;this.cachedLines=this.currentGrid.map(row=>{let clipped=row.slice(0,availableWidth).join(""),padRight=Math.max(0,width-padding-clipped.length);return` ${theme.fg("accent",clipped)}${" ".repeat(padRight)}`});let message="ARMIN SAYS HI",msgPadRight=Math.
|
|
@@ -9,8 +9,15 @@ if(resolve(runtimeDir)!==runtimeDir)throw new Error(`Refusing to use ${runtimeDi
|
|
|
9
9
|
not canonical (it resolves through a symbolic link or is not absolute, to ${canonical}); derive paths with resolveCoordinationRuntimePaths`)}function ensureRuntimeDir(dir,uid=currentUid()){mkdirSync(dir,{recursive:!0,mode:COORDINATION_DIR_MODE}),assertSafeAncestors(dir,uid);let checked=lstatSync(dir);assertRealDirectory(dir,checked,uid);let fd=openSync(dir,constants.O_RDONLY|constants.O_DIRECTORY|constants.O_NOFOLLOW);try{let opened=fstatSync(fd);if(opened.dev!==checked.dev||opened.ino!==checked.
|
|
10
10
|
ino)throw new Error(`Refusing to use ${dir}: it changed while being verified`);if(fchmodSync(fd,COORDINATION_DIR_MODE),(fstatSync(fd).mode&63)!==0)throw new Error(`Refusing to use ${dir}: its permissions could not be restricted to owner-only`)}finally{closeSync(fd)}}function ensureCoordinationRuntimeDir(paths,uid=currentUid()){ensureRuntimeDir(dirname(paths.runtimeDir),uid),ensureRuntimeDir(paths.runtimeDir,uid);let socketDir=dirname(paths.socketPath);socketDir!==paths.runtimeDir&&ensureRuntimeDir(
|
|
11
11
|
socketDir,uid)}function assertPrivateSocket(socketPath,uid=currentUid()){let parent=dirname(socketPath),parentStats=lstatSync(parent);if(assertRealDirectory(parent,parentStats,uid),(parentStats.mode&63)!==0)throw new Error(`Refusing to connect to ${socketPath}: directory ${parent} is accessible to other users`);let socketStats=lstatSync(socketPath);if(!socketStats.isSocket())throw new Error(`Refusing to connect to ${socketPath}: it is not a socket`);assertOwnedByUser(socketPath,socketStats,uid)}
|
|
12
|
-
function restrictRuntimeFile(filePath){chmodSync(filePath,COORDINATION_FILE_MODE)}
|
|
12
|
+
function restrictRuntimeFile(filePath){chmodSync(filePath,COORDINATION_FILE_MODE)}import{randomBytes}from"node:crypto";import{closeSync as closeSync2,constants as constants2,fchmodSync as fchmodSync2,fstatSync as fstatSync2,fsyncSync,linkSync,openSync as openSync2,readSync,renameSync,unlinkSync,writeSync}from"node:fs";import{dirname as dirname2}from"node:path";var MAX_RUNTIME_TEXT_FILE_BYTES=4096;function fsyncDirectory(dir){let fd;try{fd=openSync2(dir,constants2.O_RDONLY),fsyncSync(fd)}catch{}finally{if(fd!==void 0)try{closeSync2(fd)}catch{}}}function removeQuietly(path){try{unlinkSync(path)}catch{}}function errorCode(error){if(!(typeof error!="object"||error===null||!("code"in error)))return typeof error.code=="string"?error.code:void 0}function writeAll(fd,body){let offset=0;for(;offset<body.length;)offset+=writeSync(fd,body,offset)}function temporaryPathFor(path){
|
|
13
|
+
return`${path}.${randomBytes(6).toString("hex")}.tmp`}function writeBytesAtomic(path,body){let tempPath=temporaryPathFor(path),fd=openSync2(tempPath,constants2.O_WRONLY|constants2.O_CREAT|constants2.O_EXCL,COORDINATION_FILE_MODE),fdOpen=!0,renamed=!1;try{writeAll(fd,body),fchmodSync2(fd,COORDINATION_FILE_MODE),fsyncSync(fd),fdOpen=!1,closeSync2(fd),renameSync(tempPath,path),renamed=!0}finally{if(fdOpen)try{closeSync2(fd)}catch{}renamed||removeQuietly(tempPath)}fsyncDirectory(dirname2(path))}function writeJsonAtomic(path,value,maxBytes){
|
|
14
|
+
writeTextAtomic(path,`${JSON.stringify(value)}
|
|
15
|
+
`,maxBytes)}function writeTextAtomic(path,text,maxBytes){let body=Buffer.from(text,"utf8");if(body.length>maxBytes)throw new Error(`Snapshot exceeds ${maxBytes} bytes`);writeBytesAtomic(path,body)}function createFileExclusive(path,content){let body=Buffer.from(content,"utf8"),tempPath=temporaryPathFor(path),fd=openSync2(tempPath,constants2.O_WRONLY|constants2.O_CREAT|constants2.O_EXCL,COORDINATION_FILE_MODE);try{try{writeAll(fd,body),fchmodSync2(fd,COORDINATION_FILE_MODE)}finally{closeSync2(fd)}
|
|
16
|
+
return linkSync(tempPath,path),!0}catch(error){if(errorCode(error)==="EEXIST")return!1;throw error}finally{removeQuietly(tempPath)}}function readBoundedTextFile(path,maxBytes){let fd;try{fd=openSync2(path,constants2.O_RDONLY|constants2.O_NOFOLLOW|constants2.O_NONBLOCK)}catch(error){if(errorCode(error)==="ENOENT")return;throw error}try{let stats=fstatSync2(fd);if(!stats.isFile())throw new Error(`${path} is not a regular file`);if(stats.size>maxBytes)throw new Error(`${path} exceeds ${maxBytes} by\
|
|
17
|
+
tes`);let limit=Math.min(stats.size,maxBytes)+1,buffer=Buffer.allocUnsafe(limit),length=0;for(;length<limit;){let read=readSync(fd,buffer,length,limit-length,null);if(read===0)break;length+=read}if(length>stats.size)throw new Error(`${path} changed while being read`);return{text:buffer.toString("utf8",0,length),dev:stats.dev,ino:stats.ino,mtimeMs:stats.mtimeMs}}finally{closeSync2(fd)}}function readTextFile(path,maxBytes){return readBoundedTextFile(path,maxBytes)?.text}function readJsonFile(path,maxBytes){
|
|
18
|
+
let file=readBoundedTextFile(path,maxBytes);return file===void 0?void 0:JSON.parse(file.text)}function framePayloadBytes(msg){return Buffer.byteLength(JSON.stringify(msg),"utf-8")}var MAX_SOCKET_WRITE_BACKLOG_BYTES=8*1024*1024;function writeMessage(socket,msg){let json=JSON.stringify(msg),payloadLength=Buffer.byteLength(json,"utf-8"),frame=Buffer.allocUnsafeSlow(4+payloadLength);frame.writeUInt32BE(payloadLength,0),frame.write(json,4,payloadLength,"utf-8"),socket.write(frame),socket.writableLength>MAX_SOCKET_WRITE_BACKLOG_BYTES&&socket.destroy()}function createMessageReader(onMessage,onError,maxFrameBytes=1048576){
|
|
13
19
|
let header=Buffer.allocUnsafe(4),headerBytes=0,payload=null,payloadBytes=0,payloadLength=0;function reportMessage(framePayload){let msg;try{msg=JSON.parse(framePayload.toString("utf-8"))}catch(error){let message=error instanceof Error?error.message:String(error);return onError(new Error(`Failed to parse intercom message: ${message}`,{cause:error})),!1}try{return onMessage(msg),!0}catch(error){let message=error instanceof Error?error.message:String(error);return onError(new Error(`Failed to handl\
|
|
14
20
|
e intercom message: ${message}`,{cause:error})),!1}}return data=>{let offset=0;for(;offset<data.length;){if(headerBytes<4){let bytes2=Math.min(4-headerBytes,data.length-offset);if(data.copy(header,headerBytes,offset,offset+bytes2),headerBytes+=bytes2,offset+=bytes2,headerBytes<4)return;if(payloadLength=header.readUInt32BE(0),payloadLength>maxFrameBytes){headerBytes=0,onError(new Error(`Intercom frame length ${payloadLength} exceeds maximum ${maxFrameBytes} bytes`));return}}if(payloadBytes===0&&data.
|
|
15
21
|
length-offset>=payloadLength){let framePayload2=data.subarray(offset,offset+payloadLength);if(offset+=payloadLength,headerBytes=0,payload=null,payloadLength=0,!reportMessage(framePayload2))return;continue}(payload===null||payload.length!==payloadLength)&&(payload=Buffer.allocUnsafe(payloadLength));let bytes=Math.min(payloadLength-payloadBytes,data.length-offset);if(data.copy(payload,payloadBytes,offset,offset+bytes),payloadBytes+=bytes,offset+=bytes,payloadBytes<payloadLength)return;let framePayload=payload;
|
|
16
|
-
if(headerBytes=0,payload=null,payloadBytes=0,payloadLength=0,!reportMessage(framePayload))return}}}export{COORDINATION_DIR_MODE,COORDINATION_FILE_MODE,COORDINATION_PROTOCOL_NAME,COORDINATION_PROTOCOL_VERSION,MAX_MESSAGE_TEXT_BYTES,getCanonicalTmpDir,getCoordinationRuntimePaths,resolveCoordinationRuntimePaths,assertSafeAncestors,assertCanonicalRuntimeDir,ensureRuntimeDir,ensureCoordinationRuntimeDir,assertPrivateSocket,restrictRuntimeFile,framePayloadBytes,
|
|
22
|
+
if(headerBytes=0,payload=null,payloadBytes=0,payloadLength=0,!reportMessage(framePayload))return}}}export{COORDINATION_DIR_MODE,COORDINATION_FILE_MODE,COORDINATION_PROTOCOL_NAME,COORDINATION_PROTOCOL_VERSION,MAX_MESSAGE_TEXT_BYTES,getCanonicalTmpDir,getCoordinationRuntimePaths,resolveCoordinationRuntimePaths,assertSafeAncestors,assertCanonicalRuntimeDir,ensureRuntimeDir,ensureCoordinationRuntimeDir,assertPrivateSocket,restrictRuntimeFile,MAX_RUNTIME_TEXT_FILE_BYTES,fsyncDirectory,writeJsonAtomic,writeTextAtomic,createFileExclusive,readBoundedTextFile,readTextFile,readJsonFile,framePayloadBytes,
|
|
23
|
+
writeMessage,createMessageReader};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{FirstTimeSetupComponent,getDefaultThemeName}from"./chunk-
|
|
3
|
-
setRegisteredThemes,setTerminalColors,setTheme}from"./chunk-
|
|
2
|
+
import{FirstTimeSetupComponent,getDefaultThemeName}from"./chunk-SXOIQWNX.js";import{ExtensionInputComponent,ExtensionSelectorComponent,requestTerminalColors}from"./chunk-DJG2WUNM.js";import{KeybindingsManager,areExperimentalFeaturesEnabled,flushStdout}from"./chunk-FQ4KS5S4.js";import{DefaultPackageManager,SettingsManager,resolveHcodeEnvironment}from"./chunk-IMUFBWEK.js";import{DEFAULT_THEME_NAME,getTerminalTheme,initTheme,loadThemeFromPath,markTerminalColorsPending,resolveThemeSetting,
|
|
3
|
+
setRegisteredThemes,setTerminalColors,setTheme}from"./chunk-KONLZKPL.js";import{ProcessTerminal,TuiMainScreen,setCapabilityOverrides,setKeybindings}from"./chunk-WBSGWISD.js";import{APP_NAME,CONFIG_DIR_NAME,ENV_AGENT_DIR,FIRST_TIME_SETUP_ENABLED,PACKAGE_NAME,getAgentDir,getSettingsPath,stripBom}from"./chunk-VFLVWPLZ.js";import{existsSync,readFileSync}from"fs";var OFFICIAL_PACKAGE_NAME="@humain/humain-code",OFFICIAL_APP_NAME="humain-terminal",OFFICIAL_CONFIG_DIR_NAME=".humain-terminal";function isOfficialDistribution({packageName,appName,configDirName}){return packageName===OFFICIAL_PACKAGE_NAME&&appName===OFFICIAL_APP_NAME&&configDirName===OFFICIAL_CONFIG_DIR_NAME}function loadThemes(resources){let themes=[],seen=new Set;for(let resource of resources)if(resource.enabled)try{let loadedTheme=loadThemeFromPath(resource.path);if(loadedTheme.name){if(seen.
|
|
4
4
|
has(loadedTheme.name))continue;seen.add(loadedTheme.name)}themes.push(loadedTheme)}catch{}return themes}async function loadStartupThemes(settingsManager){let globalSettingsManager=SettingsManager.inMemory(settingsManager.getGlobalSettings(),{projectTrusted:!1}),resolvedPaths=await new DefaultPackageManager({cwd:process.cwd(),agentDir:getAgentDir(),settingsManager:globalSettingsManager}).resolve(async()=>"skip");return loadThemes(resolvedPaths.themes)}async function createStartupTui(settingsManager){
|
|
5
5
|
setCapabilityOverrides(settingsManager.getTerminalCapabilityOverrides()),setRegisteredThemes(await loadStartupThemes(settingsManager)),markTerminalColorsPending(),initTheme(resolveThemeSetting(settingsManager.getThemeSetting(),getTerminalTheme())??DEFAULT_THEME_NAME),setKeybindings(KeybindingsManager.create());let ui=new TuiMainScreen(new ProcessTerminal,settingsManager.getShowHardwareCursor(),getAgentDir());return ui.setClearOnShrink(settingsManager.getClearOnShrink()),ui}function startStartupTui(ui,settingsManager){
|
|
6
6
|
ui.start();let themeSetting=settingsManager.getThemeSetting();queryStartupTerminalColors(ui,()=>{setTheme(resolveThemeSetting(themeSetting,getTerminalTheme())??DEFAULT_THEME_NAME)})}function queryStartupTerminalColors(ui,onColors){requestTerminalColors(ui,colors=>{setTerminalColors(colors),onColors(),ui.invalidate(),ui.requestRender()})}async function clearStartupTui(ui){ui.clear(),ui.requestRender(),await new Promise(resolve=>setTimeout(resolve,25))}function shouldRunFirstTimeSetupForDistribution(metadata){
|
|
7
7
|
return FIRST_TIME_SETUP_ENABLED||isOfficialDistribution(metadata)&&areExperimentalFeaturesEnabled()}function shouldRunFirstTimeSetup(settingsPath=getSettingsPath()){if(!shouldRunFirstTimeSetupForDistribution({packageName:PACKAGE_NAME,appName:APP_NAME,configDirName:CONFIG_DIR_NAME})||process.env[ENV_AGENT_DIR])return!1;try{let settings=JSON.parse(stripBom(readFileSync(settingsPath,"utf-8")));return!(typeof settings=="object"&&settings!==null&&"hcodeMetadataDisclosureVersion"in settings&&settings.
|
|
8
|
-
hcodeMetadataDisclosureVersion===1)}catch{return!0}}async function showStartupSelector(settingsManager,title,options){let ui=await createStartupTui(settingsManager);return new Promise(resolve=>{let settled=!1,finish=async result=>{settled||(settled=!0,await clearStartupTui(ui),ui.stop(),resolve(result))},selector=new ExtensionSelectorComponent(title,options.map(option=>option.label),option=>{finish(options.find(entry=>entry.label===option)?.value)},()=>{finish(void 0)},{tui:ui});
|
|
9
|
-
ui.setFocus(selector),startStartupTui(ui,settingsManager)})}async function showFirstTimeSetup(settingsManager,origin=resolveHcodeEnvironment().origin){let initialStep=existsSync(getSettingsPath())?"disclosure":"theme",ui=await createStartupTui(settingsManager);return new Promise((resolve,reject)=>{let settled=!1,finish=async result=>{if(!settled){settled=!0;try{result&&await settingsManager.acknowledgeHcodeMetadataDisclosure(result.theme),await clearStartupTui(ui)
|
|
10
|
-
ui.stop()}}};ui.start();let previewTheme=initialStep==="theme"?getDefaultThemeName():resolveThemeSetting(settingsManager.getThemeSetting(),getTerminalTheme())??DEFAULT_THEME_NAME;setTheme(previewTheme);let component=new FirstTimeSetupComponent({origin,initialStep,tui:ui,onThemePreview:themeName=>{previewTheme=themeName,setTheme(themeName),ui.requestRender()},onSubmit:result=>{finish(result)},onCancel:()=>{finish(void 0)}});ui.addChild(component),
|
|
11
|
-
ui,()=>setTheme(previewTheme))})}async function showStartupInput(settingsManager,title,placeholder){let ui=await createStartupTui(settingsManager);return new Promise(resolve=>{let settled=!1,finish=async result=>{settled||(settled=!0,input.dispose(),await clearStartupTui(ui),ui.stop(),resolve(result))},input=new ExtensionInputComponent(title,placeholder,value=>{finish(value)},()=>{finish(void 0)},{tui:ui});ui.
|
|
8
|
+
hcodeMetadataDisclosureVersion===1)}catch{return!0}}async function showStartupSelector(settingsManager,title,options){let ui=await createStartupTui(settingsManager);return new Promise(resolve=>{let settled=!1,finish=async result=>{settled||(settled=!0,await clearStartupTui(ui),ui.stop(),await flushStdout(),resolve(result))},selector=new ExtensionSelectorComponent(title,options.map(option=>option.label),option=>{finish(options.find(entry=>entry.label===option)?.value)},()=>{finish(void 0)},{tui:ui});
|
|
9
|
+
ui.addChild(selector),ui.setFocus(selector),startStartupTui(ui,settingsManager)})}async function showFirstTimeSetup(settingsManager,origin=resolveHcodeEnvironment().origin){let initialStep=existsSync(getSettingsPath())?"disclosure":"theme",ui=await createStartupTui(settingsManager);return new Promise((resolve,reject)=>{let settled=!1,finish=async result=>{if(!settled){settled=!0;try{result&&await settingsManager.acknowledgeHcodeMetadataDisclosure(result.theme),await clearStartupTui(ui)}catch(error){
|
|
10
|
+
ui.stop(),reject(error);return}ui.stop(),await flushStdout(),resolve()}};ui.start();let previewTheme=initialStep==="theme"?getDefaultThemeName():resolveThemeSetting(settingsManager.getThemeSetting(),getTerminalTheme())??DEFAULT_THEME_NAME;setTheme(previewTheme);let component=new FirstTimeSetupComponent({origin,initialStep,tui:ui,onThemePreview:themeName=>{previewTheme=themeName,setTheme(themeName),ui.requestRender()},onSubmit:result=>{finish(result)},onCancel:()=>{finish(void 0)}});ui.addChild(component),
|
|
11
|
+
ui.setFocus(component),ui.requestRender(),queryStartupTerminalColors(ui,()=>setTheme(previewTheme))})}async function showStartupInput(settingsManager,title,placeholder){let ui=await createStartupTui(settingsManager);return new Promise(resolve=>{let settled=!1,finish=async result=>{settled||(settled=!0,input.dispose(),await clearStartupTui(ui),ui.stop(),await flushStdout(),resolve(result))},input=new ExtensionInputComponent(title,placeholder,value=>{finish(value)},()=>{finish(void 0)},{tui:ui});ui.
|
|
12
|
+
addChild(input),ui.setFocus(input),startStartupTui(ui,settingsManager)})}export{createStartupTui,startStartupTui,shouldRunFirstTimeSetupForDistribution,shouldRunFirstTimeSetup,showStartupSelector,showFirstTimeSetup,showStartupInput};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{resolveSchemaRef}from"./chunk-
|
|
2
|
+
import{resolveSchemaRef}from"./chunk-P2Y2H7SD.js";import{typebox_exports}from"./chunk-VEGJT52D.js";var TOOL_SEARCH_TOOL_NAME="tool_search",DEFAULT_TOOL_SEARCH_LIMIT=8,wordSegmenter=new Intl.Segmenter(void 0,{granularity:"word"}),STOP_WORDS=new Set(["a","an","and","are","as","at","be","by","for","from","in","is","it","of","on","or","that","the","this","to","with"]);function stem(term){return term.length>4&&term.endsWith("ies")?`${term.slice(0,-3)}y`:term.length>4&&/(ches|shes|sses|xes|zes)$/.test(term)?term.slice(0,-2):term.length>3&&term.endsWith("s")&&!term.endsWith("ss")?term.slice(0,-1):term}
|
|
3
3
|
function tokenize(text){let normalized=text.normalize("NFC").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").toLowerCase().replace(/[^\p{L}\p{M}\p{N}]+/gu," ");return(/^[a-z0-9 ]*$/.test(normalized)?normalized.split(" "):Array.from(wordSegmenter.segment(normalized),segment=>segment.isWordLike?segment.segment:"")).filter(word=>word.length>0&&!STOP_WORDS.has(word)).map(word=>/^[a-z0-9]+$/.test(word)?stem(word):word)}function isObject(value){return typeof value=="obje\
|
|
4
4
|
ct"&&value!==null&&!Array.isArray(value)}function schemaText(schema,root,parts,seen){if(isObject(schema)){if(typeof schema.$ref=="string"){let target=resolveSchemaRef(schema.$ref,root);isObject(target)&&!seen.has(target)&&(seen.add(target),schemaText(target,root,parts,seen))}if(typeof schema.description=="string"&&parts.push(schema.description),isObject(schema.properties))for(let[name,property]of Object.entries(schema.properties))parts.push(name),schemaText(property,root,parts,seen);schemaText(schema.
|
|
5
5
|
items,root,parts,seen);for(let key of["anyOf","oneOf","allOf"]){let variants=schema[key];if(Array.isArray(variants))for(let variant of variants)schemaText(variant,root,parts,seen)}}}function createToolSearchDocument(tool,namespace){let parts=[tool.description];schemaText(tool.parameters,tool.parameters,parts,new Set([tool.parameters]));let namespaceText=namespace?[namespace.name,namespace.description??"",namespace.instructions??""].join(" "):"";return{name:tool.name,text:parts.filter(part=>part.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{JSON_RPC_ERROR_CODES,LATEST_PROTOCOL_VERSION,McpAuthRequiredError,McpClient,McpError,McpHttpError,McpSessionExpiredError,StdioTransport,StreamableHttpTransport,isObject}from"./chunk-Q5RKNQ2T.js";import{oauthErrorHtml,oauthSuccessHtml}from"./chunk-7NKUVTBL.js";import{FileAuthStorageBackend,mcpNamespace,resolveConfigValueOrThrow,resolveHeadersOrThrow}from"./chunk-
|
|
2
|
+
import{JSON_RPC_ERROR_CODES,LATEST_PROTOCOL_VERSION,McpAuthRequiredError,McpClient,McpError,McpHttpError,McpSessionExpiredError,StdioTransport,StreamableHttpTransport,isObject}from"./chunk-Q5RKNQ2T.js";import{oauthErrorHtml,oauthSuccessHtml}from"./chunk-7NKUVTBL.js";import{FileAuthStorageBackend,mcpNamespace,resolveConfigValueOrThrow,resolveHeadersOrThrow}from"./chunk-JWOPWHVH.js";import{sliceTail}from"./chunk-3HVHETMU.js";import{require_proper_lockfile}from"./chunk-F6ZAYLU2.js";
|
|
3
3
|
import{APP_TITLE,ENV_MCP_CLIENT_METADATA_URL,VERSION,getAgentDir}from"./chunk-VFLVWPLZ.js";import{__toESM}from"./chunk-JXWJOIH4.js";import{homedir}from"node:os";import{basename,join as join2,resolve}from"node:path";import{setTimeout as sleep}from"node:timers/promises";import{pathToFileURL}from"node:url";import{createServer}from"node:http";var ALLOWED_ERROR_CODES=new Set(["invalid_request","invalid_client","invalid_grant","unauthorized_client","unsupported_grant_type","invalid_scope","access_denied","unsupported_response_type","server_error","temporarily_unavailable","invalid_token","insufficient_scope","authorization_pending","slow_down","expired_token","invalid_redirect_uri","invalid_client_metadata","invalid_software_statement","unapproved_software_statement"]);function isAllowedOAuthErrorCode(value){return ALLOWED_ERROR_CODES.
|
|
4
4
|
has(value)}function sanitizeOAuthErrorCode(value,fallback="server_error"){return value&&ALLOWED_ERROR_CODES.has(value)?value:fallback}var OAuthError=class extends Error{code;errorUri;constructor(code,message,errorUri){super(message||code),this.name="OAuthError",this.code=code,this.errorUri=errorUri}},OAuthIssuerMismatchError=class extends Error{expected;received;constructor(expected,received){let format=issuer=>issuer===void 0?"none":JSON.stringify(issuer);super(`OAuth issuer mismatch: expected ${format(
|
|
5
5
|
expected)}, received ${format(received)}`),this.name="OAuthIssuerMismatchError",this.expected=expected,this.received=received}},OAuthInsecureEndpointError=class extends Error{endpoint;constructor(endpoint){super(`Refusing to send OAuth credentials to non-HTTPS endpoint ${endpoint}`),this.name="OAuthInsecureEndpointError",this.endpoint=endpoint}},OAuthRedirectError=class extends Error{constructor(){super("OAuth endpoint redirected; refusing to follow the redirect"),this.name="OAuthRedirectError"}},
|