@humain/humain-code 0.7.0 → 0.8.0
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 +139 -0
- package/README.md +2 -2
- package/dist/bundle/agent-monitor.js +1 -1
- package/dist/bundle/chunks/anthropic-messages-UZB5HJE3.js +77 -0
- package/dist/bundle/chunks/anthropic.js +25 -24
- package/dist/bundle/chunks/azure-openai-responses-J3LCMWPQ.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-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-RS6PZK35.js → chunk-4EV7CK26.js} +249 -216
- package/dist/bundle/chunks/{chunk-T7BXP46S.js → chunk-4SFWYKL5.js} +1848 -1662
- 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-6HTHDVJC.js +4 -0
- package/dist/bundle/chunks/{chunk-2G7YVAVF.js → chunk-7EONJCBE.js} +1 -1
- 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-EIC7CQX3.js → chunk-AI7EHDAX.js} +1 -1
- package/dist/bundle/chunks/{chunk-KRCX3ZBA.js → chunk-APNPBT7Y.js} +1 -1
- package/dist/bundle/chunks/{chunk-4HTVBBJD.js → chunk-ATFZAFMS.js} +2 -2
- package/dist/bundle/chunks/{chunk-R5OOX7RW.js → chunk-B47PNNLL.js} +9 -2
- package/dist/bundle/chunks/{chunk-AZXVJN6E.js → chunk-C4DHVDYT.js} +1 -1
- package/dist/bundle/chunks/{chunk-4PRNKB6V.js → chunk-CET2MXXN.js} +7 -7
- package/dist/bundle/chunks/{chunk-66FZJO75.js → chunk-CU6KU7JK.js} +472 -3924
- 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-G4QPSFBF.js → chunk-EMBIUIQ2.js} +216 -223
- package/dist/bundle/chunks/{chunk-Q7VXYXY3.js → chunk-ENBDASDN.js} +2 -2
- package/dist/bundle/chunks/{chunk-2H3LUS62.js → chunk-FJIISX5W.js} +241 -229
- 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-WQ7EJQIT.js → chunk-IOLLZXQN.js} +225 -239
- package/dist/bundle/chunks/chunk-IXQYPQRQ.js +2079 -0
- package/dist/bundle/chunks/{chunk-RU7ADKA7.js → chunk-J4GII2EE.js} +112 -96
- package/dist/bundle/chunks/chunk-J5TSAJGC.js +22 -0
- package/dist/bundle/chunks/{chunk-QT6ZHDMP.js → chunk-JBSWWCT5.js} +1 -1
- package/dist/bundle/chunks/{chunk-P6AXBESH.js → chunk-JV7VHOAY.js} +1119 -1098
- package/dist/bundle/chunks/{chunk-PWUDFU5V.js → chunk-JWOPWHVH.js} +4 -4
- 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-32QLLD2P.js → chunk-KQXXBQ57.js} +360 -332
- package/dist/bundle/chunks/{chunk-UZNIPOGS.js → chunk-L4J7SMJB.js} +1 -1
- package/dist/bundle/chunks/chunk-MPRAQ6ZI.js +41 -0
- package/dist/bundle/chunks/{chunk-GUHNFZ2Q.js → chunk-NNWNIBLG.js} +20 -19
- package/dist/bundle/chunks/{chunk-TWAHPPXN.js → chunk-OVDMYBIT.js} +1307 -1194
- package/dist/bundle/chunks/{chunk-WAPZN4KP.js → chunk-P2Y2H7SD.js} +2 -2
- package/dist/bundle/chunks/{chunk-PPBDDQHP.js → chunk-PGVDL4KB.js} +7 -6
- package/dist/bundle/chunks/{chunk-XHDVDJM7.js → chunk-PVNXN2TC.js} +7 -7
- package/dist/bundle/chunks/{chunk-RNBZBCH2.js → chunk-QJB5YI3I.js} +1 -1
- package/dist/bundle/chunks/{chunk-I5E7RQ5V.js → chunk-QRYDGY5I.js} +5 -5
- package/dist/bundle/chunks/{chunk-4QAXV5T6.js → chunk-R3VDXQW2.js} +9 -9
- package/dist/bundle/chunks/chunk-SKCJ25SX.js +24 -0
- package/dist/bundle/chunks/chunk-SQ7NTRLJ.js +77 -0
- package/dist/bundle/chunks/{chunk-SSRCVJZK.js → chunk-TYN46EVI.js} +5 -5
- 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-N2SNMUD3.js → chunk-VKQNYZUA.js} +1 -1
- package/dist/bundle/chunks/{chunk-JYWUOKOI.js → chunk-WBSGWISD.js} +367 -353
- package/dist/bundle/chunks/{chunk-3EDMWQ35.js → chunk-WGXMYMPE.js} +17 -15
- package/dist/bundle/chunks/chunk-WRYGY5XG.js +24 -0
- package/dist/bundle/chunks/{chunk-GRJUKEE3.js → chunk-XVIQYONJ.js} +4 -4
- package/dist/bundle/chunks/chunk-YSWDFV2L.js +11 -0
- package/dist/bundle/chunks/{chunk-AEWYICBL.js → chunk-Z5UFSRO4.js} +2 -2
- 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-ETKC6B2S.js} +1 -1
- package/dist/bundle/chunks/codemode-worker.js +68 -68
- package/dist/bundle/chunks/compat-HS4ARZK3.js +15 -0
- package/dist/bundle/chunks/curator-server-TC7RVVN2.js +3600 -0
- package/dist/bundle/chunks/dist-35STTNYA.js +37 -0
- package/dist/bundle/chunks/{dist-FMWWM4H7.js → dist-5AQPJ2TI.js} +2 -2
- package/dist/bundle/chunks/{dist-NHQTBDHT.js → dist-DYB3AR7C.js} +91 -257
- package/dist/bundle/chunks/dist-NMEXYUP3.js +11 -0
- 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-QHZTEVJP.js} +68 -65
- package/dist/bundle/chunks/{flow-implementer-APJFY4YI.js → flow-implementer-QMN3HKE2.js} +8 -9
- package/dist/bundle/chunks/github-copilot.js +55 -45
- package/dist/bundle/chunks/google-generative-ai-ZND73WDQ.js +22 -0
- package/dist/bundle/chunks/google-vertex-YAH62YRM.js +25 -0
- package/dist/bundle/chunks/host-Q565BCXB.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-453SLFL5.js} +6 -6
- package/dist/bundle/chunks/interactive-mode-MVZOJ5OU.js +5 -0
- package/dist/bundle/chunks/{llama-cpp-classify-GJAXULWL.js → llama-cpp-classify-Z4GZY4GC.js} +1 -1
- package/dist/bundle/chunks/mistral-conversations-7I5JURDP.js +43 -0
- package/dist/bundle/chunks/{node-ZFIIS5IM.js → node-IMSYVRPL.js} +53 -30
- package/dist/bundle/chunks/{node-UNHECG4X.js → node-MHHE76P4.js} +475 -440
- package/dist/bundle/chunks/{openai-codex-responses-S7CMCAOY.js → openai-codex-responses-LTHOMN37.js} +30 -29
- package/dist/bundle/chunks/openai-codex.js +9 -8
- package/dist/bundle/chunks/{openai-completions-2Z57N7PC.js → openai-completions-W2X635EE.js} +22 -22
- package/dist/bundle/chunks/{openai-decisions-JIOJDB4C.js → openai-decisions-TN2GNOYI.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-5VBZSTHL.js → openai-responses-DVY4QXOG.js} +4 -5
- package/dist/bundle/chunks/{openrouter-images-S6O7DBEJ.js → openrouter-images-SE2JMS44.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-WAS6Z5L5.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-XNVLSJ22.js +4 -0
- package/dist/bundle/chunks/startup-ui-3TCT465D.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-AAZH6S3I.js} +1 -1
- package/dist/bundle/chunks/{undici-C6S56CGI.js → undici-WVNE45GY.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-CIVXCEAN.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/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/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 +11 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +19 -0
- 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 +40 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +5 -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 +32 -8
- 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 +3 -10
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +18 -7
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +41 -8
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/oauth-account-pool.d.ts +5 -0
- package/dist/core/oauth-account-pool.d.ts.map +1 -1
- package/dist/core/oauth-account-pool.js +34 -3
- 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 +7 -16
- 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/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/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 +74 -98
- 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/popup.d.ts +9 -14
- package/dist/extensions/usage/popup.d.ts.map +1 -1
- package/dist/extensions/usage/popup.js +78 -165
- 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 +16 -1
- package/dist/humain/hcode/contracts.d.ts.map +1 -1
- package/dist/humain/hcode/contracts.js +122 -128
- 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 +12 -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 +463 -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 +24 -1
- package/dist/humain/hcode/notices.d.ts.map +1 -1
- package/dist/humain/hcode/notices.js +93 -7
- package/dist/humain/hcode/notices.js.map +1 -1
- package/dist/humain/hcode/provider.d.ts +7 -3
- package/dist/humain/hcode/provider.d.ts.map +1 -1
- package/dist/humain/hcode/provider.js +123 -19
- package/dist/humain/hcode/provider.js.map +1 -1
- package/dist/humain/hcode/selection.d.ts +2 -0
- package/dist/humain/hcode/selection.d.ts.map +1 -1
- package/dist/humain/hcode/selection.js +8 -1
- package/dist/humain/hcode/selection.js.map +1 -1
- package/dist/humain/hcode/transport.d.ts +13 -10
- package/dist/humain/hcode/transport.d.ts.map +1 -1
- package/dist/humain/hcode/transport.js +103 -148
- 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/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.map +1 -1
- package/dist/main.js +96 -28
- 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/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 +20 -2
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +605 -223
- 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 +6 -2
- package/dist/modes/interactive/oauth-account-format.d.ts.map +1 -1
- package/dist/modes/interactive/oauth-account-format.js +12 -3
- 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/humain-code-forge-architecture.md +1 -47
- package/docs/humain-code-forge-flow-walkthrough.md +1 -1
- package/docs/humain-code.md +1 -1
- package/docs/keybindings.md +2 -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/rpc-commands.md +1 -1
- package/docs/run-preflight.md +1 -1
- package/docs/slash-commands.md +1 -1
- 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 +20 -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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{VisualLinePreview,getTextOutput,replaceTabs,startToolTimer,str,toolTimerText}from"./chunk-
|
|
2
|
+
import{VisualLinePreview,getTextOutput,replaceTabs,startToolTimer,str,toolTimerText}from"./chunk-3CGMVKHA.js";import{SETTINGS_DEFAULTS}from"./chunk-GV5OVRKK.js";import{CodeHighlighter,keyHint}from"./chunk-KONLZKPL.js";import{Container,Spacer,Text,sanitizeTerminalText}from"./chunk-WBSGWISD.js";import{typebox_exports}from"./chunk-VEGJT52D.js";import{getDocsPath}from"./chunk-VFLVWPLZ.js";function toCodemodeIdentifier(name){let identifier="";for(let char of name){let valid=identifier===""?/^[A-Za-z_$]$/.test(char):/^[A-Za-z0-9_$]$/.test(char);identifier+=valid?char:"_"}return identifier===""?"_":identifier}var IDENTIFIER=/^[A-Za-z_$][A-Za-z0-9_$]*$/,INDENT=" ",DEFAULT_INPUT_SCHEMA_MAX_CHARS=16e3,MAX_REF_EXPANSIONS=32,TAG_KEYWORDS=["minimum","exclusiveMinimum","maximum","exclusiveMaximum","multipleOf","minLength","maxLength","pattern","format","minItems","maxItems"],LOWER_BOUNDS=new Set(["minimum","exclusiveMinimum","minLength","minItems"]),UPPER_BOUNDS=new Set(["maximum","exclusiveMaximum","maxLength","maxItems"]),MAX_TAG_CHARS=80,LINE_TERMINATORS=/[\r\n\u2028\u2029]/g;function renderToolSignature(tool,options={}){let input=tool.inputSchema===void 0?"unknown":schemaToType(tool.inputSchema,{maxChars:options.inputMaxChars??DEFAULT_INPUT_SCHEMA_MAX_CHARS});return`${toCodemodeIdentifier(tool.name)}(args: ${input}): Promise<${renderToolOutputType(tool.outputSchema)}>;`}function renderToolSample(tool,options={}){let declaration=`declare const tools: { ${renderToolSignature(tool,options)} };`;return`${tool.description?.trim()??""}
|
|
3
3
|
|
|
4
4
|
codemode tool declaration:
|
|
5
5
|
\`\`\`ts
|
|
@@ -32,7 +32,7 @@ d fields ${SUPPORTED_FIELDS_TEXT}: ${error instanceof Error?error.message:String
|
|
|
32
32
|
if(max_output_tokens!==void 0){if(!isSafeInteger(max_output_tokens))throw new CodemodeSourceError("@options field `max_output_tokens` must be a non-negative safe integer");options.maxOutputTokens=max_output_tokens}if(timeout_ms!==void 0){if(!isSafeInteger(timeout_ms)||timeout_ms===0||timeout_ms>2147483647)throw new CodemodeSourceError("@options field `timeout_ms` must be a positive integer up to 2147483647");options.timeoutMs=timeout_ms}return options}function parseCodemodeSource(input){if(input.
|
|
33
33
|
trim()==="")throw new CodemodeSourceError('Expected JavaScript source text (non-empty). Provide JS only, optionally with a first line `// @options: {"max_output_tokens": 1000}`.');let lines=input.split(`
|
|
34
34
|
`),misplaced=lines.findIndex((line,index)=>index>0&&line.trimStart().startsWith(CODEMODE_OPTIONS_PREFIX));if(misplaced!==-1)throw new CodemodeSourceError(`The ${CODEMODE_OPTIONS_PREFIX} line must be the first line of the input; found one on line ${misplaced+1}`);let newline=input.indexOf(`
|
|
35
|
-
`),trimmed=lines[0].replace(/\r$/,"").trimStart();if(!trimmed.startsWith(CODEMODE_OPTIONS_PREFIX))return{code:input,options:{}};let code=newline===-1?"":input.slice(newline);if(code.trim()==="")throw new CodemodeSourceError("The @options line must be followed by JavaScript source on subsequent lines");return{code,options:parseOptions(trimmed.slice(CODEMODE_OPTIONS_PREFIX.length).trim())}}import{join}from"node:path";var loadCodemodeExecutor=()=>import("./execute-
|
|
35
|
+
`),trimmed=lines[0].replace(/\r$/,"").trimStart();if(!trimmed.startsWith(CODEMODE_OPTIONS_PREFIX))return{code:input,options:{}};let code=newline===-1?"":input.slice(newline);if(code.trim()==="")throw new CodemodeSourceError("The @options line must be followed by JavaScript source on subsequent lines");return{code,options:parseOptions(trimmed.slice(CODEMODE_OPTIONS_PREFIX.length).trim())}}import{join}from"node:path";var loadCodemodeExecutor=()=>import("./execute-I3WGGPWL.js");var CODE_PREVIEW_LINES=10,CALL_PREVIEW_COUNT=8,OUTPUT_PREVIEW_LINES=5,COLLAPSED_ARGS_CHARS=80,SCRIPT_HEADER=/^Script (completed|failed)\nWall time [\d.]+ seconds\nOutput:\n$/;function expandHint(theme,hidden,noun){return`${theme.fg("muted",`... (${hidden} more ${noun},`)} ${keyHint("app.tools.expand","to expand")}${theme.fg("muted",")")}`}function formatDuration(ms){return ms===void 0?"":ms<1e3?`${Math.round(ms)}ms`:`${(ms/1e3).toFixed(1)}s`}function formatCost(cost){return`$${cost>=.01?cost.toFixed(
|
|
36
36
|
2):cost.toPrecision(2)}`}function statusIcon(call,theme){switch(call.status){case"running":return theme.fg("warning","\u2026");case"ok":return theme.fg("success","\u2713");case"error":return theme.fg("error","\u2717");case"cancelled":return theme.fg("muted","\u2298")}}function formatCall(call,theme,expanded){let callArgs=sanitizeTerminalText(call.args),args=!expanded&&callArgs.length>COLLAPSED_ARGS_CHARS?`${callArgs.slice(0,COLLAPSED_ARGS_CHARS-3)}...`:callArgs,duration=formatDuration(call.durationMs),
|
|
37
37
|
line=`${statusIcon(call,theme)} ${theme.fg("toolTitle",sanitizeTerminalText(call.name))}`;return args&&(line+=` ${theme.fg("muted",args)}`),duration&&(line+=` ${theme.fg("dim",duration)}`),call.cost&&(line+=` ${theme.fg("dim",formatCost(call.cost))}`),expanded&&call.error&&(line+=`
|
|
38
38
|
${theme.fg("error",sanitizeTerminalText(call.error).split(`
|
|
@@ -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-C4DHVDYT.js";import{ExtensionInputComponent,ExtensionSelectorComponent,requestTerminalColors}from"./chunk-QRYDGY5I.js";import{KeybindingsManager,areExperimentalFeaturesEnabled,flushStdout}from"./chunk-J5TSAJGC.js";import{DefaultPackageManager,SettingsManager,resolveHcodeEnvironment}from"./chunk-EMBIUIQ2.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,11 +1,11 @@
|
|
|
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";import{typebox_exports}from"./chunk-VEGJT52D.js";var FLOW_ID_PATTERN="^[a-z0-9][a-z0-9_.:-]{0,127}$",FLOW_MODEL_ID_PATTERN="^(?=.{1,128}$)[a-z0-9][a-z0-9_.:-]*(?:/[a-z0-9][a-z0-9_.:-]*)?$",FLOW_DIGEST_PATTERN="^[a-f0-9]{64}$",FLOW_TS_PATTERN="^\\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\\d|3[01])T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d{1,9})?(?:Z|[+-](?:[01]\\d|2[0-3]):[0-5]\\d)$",FLOW_CONTRACT_ERROR_CODES={profile_invalid:"Invalid flow profile",admission_invalid:"Invalid flow run admission",event_invalid:"Invalid flow event",command_invalid:"\
|
|
3
3
|
Invalid flow control command",receipt_invalid:"Invalid flow control receipt",status_invalid:"Invalid flow status",digest_mismatch:"Flow digest mismatch",digest_unverifiable:"Flow digest cannot be verified",canonical_invalid:"Flow data cannot be canonicalized",receipt_conflict:"Flow receipt conflicts with the first receipt"},FlowContractError=class extends Error{code;constructor(code){super(FLOW_CONTRACT_ERROR_CODES[code]),this.name="FlowContractError",this.code=code}},lit=(...values)=>typebox_exports.
|
|
4
|
-
Union(values.map(value=>typebox_exports.Literal(value))),StrictObject=properties=>typebox_exports.Object(properties,{additionalProperties:!1}),FlowIdSchema=typebox_exports.String({pattern:FLOW_ID_PATTERN}),FlowDigestSchema=typebox_exports.String({pattern:FLOW_DIGEST_PATTERN}),DAYS_IN_MONTH=[31,28,31,30,31,30,31,31,30,31,30,31];function isRealCalendarDate(timestamp){let year=Number(timestamp.slice(0,4)),month=Number(
|
|
5
|
-
0||year%400===0;return day<=(month===2&&leap?29:DAYS_IN_MONTH[month-1]??0)}var FlowTimestampSchema=typebox_exports.Refine(typebox_exports.String({pattern:FLOW_TS_PATTERN}),isRealCalendarDate),FlowMicrousdSchema=typebox_exports.Integer({minimum:0,maximum:Number.MAX_SAFE_INTEGER}),FlowCountSchema=typebox_exports.Integer({minimum:0,maximum:Number.MAX_SAFE_INTEGER}),FlowPositiveIntSchema=typebox_exports.Integer({minimum:1,
|
|
6
|
-
model:typebox_exports.String({pattern:FLOW_MODEL_ID_PATTERN})}),FLOW_ROLES=["scout","worker","implementer","lead","lead_large","architect","reviewer","security_reviewer","qa","triage"],FlowRoleSchema=typebox_exports.Union([typebox_exports.Literal("scout"),typebox_exports.Literal("worker"),typebox_exports.Literal("implementer"),typebox_exports.Literal("lead"),typebox_exports.Literal("lead_large"),typebox_exports.
|
|
7
|
-
|
|
8
|
-
Optional(schema)});var FlowSizeSchema=typebox_exports.Union([typebox_exports.Literal("small"),typebox_exports.Literal("medium"),typebox_exports.Literal("large")]);var FlowFailureClassSchema=typebox_exports.Union([typebox_exports.Literal("provider_error"),typebox_exports.Literal("provider_unreachable"),typebox_exports.Literal("rate_limit"),typebox_exports.Literal("timeout"),typebox_exports.Literal("check_failed"),typebox_exports.Literal("review_rejected"),typebox_exports.Literal("qa_failed"),typebox_exports.Literal("budget_stop"),typebox_exports.Literal("cancelled"),typebox_exports.Literal("crash"),typebox_exports.Literal("unsafe_scope"),typebox_exports.Literal(
|
|
4
|
+
Union(values.map(value=>typebox_exports.Literal(value))),FlowSelectionEffortSchema=lit("off","minimal","low","medium","high","xhigh","max"),StrictObject=properties=>typebox_exports.Object(properties,{additionalProperties:!1}),FlowIdSchema=typebox_exports.String({pattern:FLOW_ID_PATTERN}),FlowDigestSchema=typebox_exports.String({pattern:FLOW_DIGEST_PATTERN}),DAYS_IN_MONTH=[31,28,31,30,31,30,31,31,30,31,30,31];function isRealCalendarDate(timestamp){let year=Number(timestamp.slice(0,4)),month=Number(
|
|
5
|
+
timestamp.slice(5,7)),day=Number(timestamp.slice(8,10)),leap=year%4===0&&year%100!==0||year%400===0;return day<=(month===2&&leap?29:DAYS_IN_MONTH[month-1]??0)}var FlowTimestampSchema=typebox_exports.Refine(typebox_exports.String({pattern:FLOW_TS_PATTERN}),isRealCalendarDate),FlowMicrousdSchema=typebox_exports.Integer({minimum:0,maximum:Number.MAX_SAFE_INTEGER}),FlowCountSchema=typebox_exports.Integer({minimum:0,maximum:Number.MAX_SAFE_INTEGER}),FlowPositiveIntSchema=typebox_exports.Integer({minimum:1,
|
|
6
|
+
maximum:Number.MAX_SAFE_INTEGER}),FlowModelRefSchema=StrictObject({provider:FlowIdSchema,model:typebox_exports.String({pattern:FLOW_MODEL_ID_PATTERN})}),FLOW_ROLES=["scout","worker","implementer","lead","lead_large","architect","reviewer","security_reviewer","qa","triage"],FlowRoleSchema=typebox_exports.Union([typebox_exports.Literal("scout"),typebox_exports.Literal("worker"),typebox_exports.Literal("implementer"),typebox_exports.Literal("lead"),typebox_exports.Literal("lead_large"),typebox_exports.
|
|
7
|
+
Literal("architect"),typebox_exports.Literal("reviewer"),typebox_exports.Literal("security_reviewer"),typebox_exports.Literal("qa"),typebox_exports.Literal("triage")]),partialByRole=schema=>StrictObject({scout:typebox_exports.Optional(schema),worker:typebox_exports.Optional(schema),implementer:typebox_exports.Optional(schema),lead:typebox_exports.Optional(schema),lead_large:typebox_exports.Optional(schema),architect:typebox_exports.Optional(schema),reviewer:typebox_exports.Optional(schema),security_reviewer:typebox_exports.
|
|
8
|
+
Optional(schema),qa:typebox_exports.Optional(schema),triage:typebox_exports.Optional(schema)});var FlowSizeSchema=typebox_exports.Union([typebox_exports.Literal("small"),typebox_exports.Literal("medium"),typebox_exports.Literal("large")]);var FlowFailureClassSchema=typebox_exports.Union([typebox_exports.Literal("provider_error"),typebox_exports.Literal("provider_unreachable"),typebox_exports.Literal("rate_limit"),typebox_exports.Literal("timeout"),typebox_exports.Literal("check_failed"),typebox_exports.Literal("review_rejected"),typebox_exports.Literal("qa_failed"),typebox_exports.Literal("budget_stop"),typebox_exports.Literal("cancelled"),typebox_exports.Literal("crash"),typebox_exports.Literal("unsafe_scope"),typebox_exports.Literal(
|
|
9
9
|
"stalled"),typebox_exports.Literal("config_invalid"),typebox_exports.Literal("internal"),typebox_exports.Literal("review_verdict_missing"),typebox_exports.Literal("verification_unavailable"),typebox_exports.Literal("unsupported_configuration"),typebox_exports.Literal("blocked"),typebox_exports.Literal("review_findings")]),FlowReasonClassSchema=typebox_exports.Union([FlowFailureClassSchema,typebox_exports.Literal("size_underestimated")]),FlowProfileRefSchema=StrictObject({id:FlowIdSchema,version:FlowPositiveIntSchema,
|
|
10
10
|
digest:FlowDigestSchema});function verifyFlowDigest(hasher,text,expected){let actual;try{actual=hasher.sha256Hex(text)}catch{throw new FlowContractError("digest_unverifiable")}if(typeof actual!="string")throw new FlowContractError("digest_unverifiable");return actual===expected}var MAX_SNAPSHOT_DEPTH=16,MAX_SNAPSHOT_NODES=1e4,MAX_SNAPSHOT_STRING=65536;function isIndexKey(key,length){let index=Number(key);return Number.isInteger(index)&&index>=0&&index<length&&String(index)===key}function snapshotValue(value,depth,budget){
|
|
11
11
|
if(budget.nodes+=1,depth>MAX_SNAPSHOT_DEPTH||budget.nodes>MAX_SNAPSHOT_NODES)throw new Error("bounds");if(value===null||typeof value=="boolean")return value;if(typeof value=="string"){if(value.length>MAX_SNAPSHOT_STRING||!value.isWellFormed())throw new Error("string");return value}if(typeof value=="number"){if(!Number.isFinite(value))throw new Error("number");return value}if(typeof value!="object")throw new Error("type");if(Array.isArray(value)){let length=value.length;if(length>MAX_SNAPSHOT_NODES)
|
|
@@ -14,4 +14,4 @@ null)throw new Error("prototype");let out={};for(let key of Reflect.ownKeys(valu
|
|
|
14
14
|
return snapshotValue(input,0,{nodes:0})}function parseFlowData(code,input,validate){let snapshot=trySnapshotFlowData(code,input);if(!validate(snapshot))throw new FlowContractError(code);return snapshot}function trySnapshotFlowData(code,input){try{return snapshotFlowData(input)}catch{throw new FlowContractError(code)}}function compileFlow(schema){return Compile(schema)}function modelKey(ref){return`${ref.provider}\0${ref.model}`}function hasDuplicateModels(refs){return new Set(refs.map(modelKey)).
|
|
15
15
|
size!==refs.length}function canonicalFlowJson(value){if(value===null||typeof value=="boolean")return JSON.stringify(value);if(typeof value=="string"){if(!value.isWellFormed())throw new FlowContractError("canonical_invalid");return JSON.stringify(value)}if(typeof value=="number"){if(!Number.isFinite(value))throw new FlowContractError("canonical_invalid");return JSON.stringify(value)}if(Array.isArray(value))return`[${value.map(canonicalFlowJson).join(",")}]`;if(typeof value!="object")throw new FlowContractError(
|
|
16
16
|
"canonical_invalid");let record=value,parts=[];for(let key of Object.keys(record).sort()){if(!key.isWellFormed())throw new FlowContractError("canonical_invalid");record[key]!==void 0&&parts.push(`${JSON.stringify(key)}:${canonicalFlowJson(record[key])}`)}return`{${parts.join(",")}}`}function canonicalWithout(doc,omit){let copy={...doc};return delete copy[omit],canonicalFlowJson(copy)}var TERMINAL_FAILURE_EXIT_CODES={auth:20,provider:21,setup:22,timeout:23,checker:24,completed_wrong:25,completed_unverified:26};function parseRunOutcome(input){if(input===null||typeof input!="object"||!("type"in input)||input.type!=="run_end"||!("failureClass"in input)||!("exitCode"in input))return;if(input.failureClass===null&&input.exitCode===0)return{type:"run_end",failureClass:null,exitCode:0};if(typeof input.failureClass!="string"||!Object.hasOwn(TERMINAL_FAILURE_EXIT_CODES,input.failureClass))
|
|
17
|
-
return;let failureClass=input.failureClass,exitCode=TERMINAL_FAILURE_EXIT_CODES[failureClass];return input.exitCode===exitCode?{type:"run_end",failureClass,exitCode}:void 0}export{FLOW_ID_PATTERN,FLOW_MODEL_ID_PATTERN,FLOW_DIGEST_PATTERN,FlowContractError,lit,StrictObject,FlowIdSchema,FlowDigestSchema,FlowTimestampSchema,FlowMicrousdSchema,FlowCountSchema,FlowPositiveIntSchema,FlowModelRefSchema,FLOW_ROLES,FlowRoleSchema,partialByRole,FlowSizeSchema,FlowFailureClassSchema,FlowReasonClassSchema,FlowProfileRefSchema,verifyFlowDigest,parseFlowData,compileFlow,hasDuplicateModels,canonicalFlowJson,canonicalWithout,TERMINAL_FAILURE_EXIT_CODES,parseRunOutcome};
|
|
17
|
+
return;let failureClass=input.failureClass,exitCode=TERMINAL_FAILURE_EXIT_CODES[failureClass];return input.exitCode===exitCode?{type:"run_end",failureClass,exitCode}:void 0}export{FLOW_ID_PATTERN,FLOW_MODEL_ID_PATTERN,FLOW_DIGEST_PATTERN,FlowContractError,lit,FlowSelectionEffortSchema,StrictObject,FlowIdSchema,FlowDigestSchema,FlowTimestampSchema,FlowMicrousdSchema,FlowCountSchema,FlowPositiveIntSchema,FlowModelRefSchema,FLOW_ROLES,FlowRoleSchema,partialByRole,FlowSizeSchema,FlowFailureClassSchema,FlowReasonClassSchema,FlowProfileRefSchema,verifyFlowDigest,parseFlowData,compileFlow,hasDuplicateModels,canonicalFlowJson,canonicalWithout,TERMINAL_FAILURE_EXIT_CODES,parseRunOutcome};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{APIError,Stream}from"./chunk-
|
|
2
|
+
import{APIError,Stream}from"./chunk-46C6D7UC.js";import{createSseDecoder,decodeSseText}from"./chunk-YZMQXAJM.js";function isAbortError(error){return typeof error=="object"&&error!==null&&("name"in error&&error.name==="AbortError"||"message"in error&&String(error.message).includes("FetchRequestCanceledException"))}var LOG_LEVELS={off:0,error:200,warn:300,info:400,debug:500};function logError(client,message){if(!client){console.error(message);return}let level=LOG_LEVELS[client.logLevel??"off"];client.logger&&level!==void 0&&level>=LOG_LEVELS.error&&client.logger.error(message)}async function*iterateOpenAISseMessages(body,signal){
|
|
3
3
|
let reader=body.getReader(),decoder=new TextDecoder("utf-8",{ignoreBOM:!0}),state=createSseDecoder({stripLineBom:!0}),closed=!1,failed=!1,cancellation,cancel=()=>(closed||cancellation||(cancellation=reader.cancel(),cancellation.catch(()=>{})),cancellation),onAbort=()=>queueMicrotask(()=>{cancel()});signal.addEventListener("abort",onAbort,{once:!0}),signal.aborted&&onAbort();try{for(;;){if(signal.aborted)return;let result;try{result=await reader.read()}catch(error){if(signal.aborted&&(isAbortError(
|
|
4
4
|
error)||error===signal.reason))return;throw error}if(signal.aborted)return;if(result.done){closed=!0;break}for(let event of decodeSseText(state,decoder.decode(result.value,{stream:!0}),!1)){if(signal.aborted)return;yield event}}for(let event of decodeSseText(state,decoder.decode(),!0)){if(signal.aborted)return;yield event}}catch(error){if(failed=!0,!signal.aborted||!isAbortError(error)&&error!==signal.reason)throw error}finally{if(signal.removeEventListener("abort",onAbort),!closed){let pending=cancel();
|
|
5
5
|
pending&&!failed&&!signal.aborted&&await pending}reader.releaseLock()}}function parseEventData(data,client){try{return JSON.parse(data)}catch{throw logError(client,"Could not parse message into JSON:"),logError(client,"From chunk:"),new SyntaxError("Error reading response: malformed server-sent event JSON.")}}async function*iterateOpenAIStream(stream,response,client){if(!(stream instanceof Stream)||!response.body){yield*stream;return}let controller=stream.controller,done=!1,receivedCompletionSentinel=!1,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{DynamicBorder}from"./chunk-
|
|
2
|
+
import{DynamicBorder}from"./chunk-J5TSAJGC.js";import{DEFAULT_THEME_NAME,SYSTEM_THEME_NAME,getTerminalTheme,initTheme,keyHint,markTerminalColorsPending,parseAutoThemeSetting,resolveThemeSetting,selectNavigationHint,setTerminalColorScheme,setTerminalColors,setTheme,setThemeInstance,theme}from"./chunk-KONLZKPL.js";import{Container,Input,Spacer,Text,getKeybindings}from"./chunk-WBSGWISD.js";var CountdownTimer=class{intervalId;remainingSeconds;tui;onTick;onExpire;constructor(timeoutMs,tui,onTick,onExpire){this.tui=tui,this.onTick=onTick,this.onExpire=onExpire,this.remainingSeconds=Math.ceil(timeoutMs/1e3),this.onTick(this.remainingSeconds),this.intervalId=setInterval(()=>{this.remainingSeconds--,this.onTick(this.remainingSeconds),this.tui?.requestRender(),this.remainingSeconds<=0&&(this.dispose(),this.onExpire())},1e3)}dispose(){this.intervalId&&(clearInterval(this.intervalId),this.
|
|
3
3
|
intervalId=void 0)}};var ExtensionInputComponent=class extends Container{input;onSubmitCallback;onCancelCallback;titleText;baseTitle;countdown;_focused=!1;get focused(){return this._focused}set focused(value){this._focused=value,this.input.focused=value}constructor(title,_placeholder,onSubmit,onCancel,opts){super(),this.onSubmitCallback=onSubmit,this.onCancelCallback=onCancel,this.baseTitle=title,this.addChild(new DynamicBorder),this.addChild(new Spacer(1)),this.titleText=new Text(theme.fg("accent",title),1,0),this.
|
|
4
4
|
addChild(this.titleText),opts?.description&&(this.addChild(new Spacer(1)),this.addChild(new Text(theme.fg("text",opts.description),1,0))),this.addChild(new Spacer(1)),opts?.timeout&&opts.timeout>0&&opts.tui&&(this.countdown=new CountdownTimer(opts.timeout,opts.tui,s=>this.titleText.setText(theme.fg("accent",`${this.baseTitle} (${s}s)`)),()=>this.onCancelCallback())),this.input=new Input,opts?.initialValue&&this.input.setValue(opts.initialValue),this.addChild(this.input),this.addChild(new Spacer(
|
|
5
5
|
1)),this.addChild(new Text(`${keyHint("tui.select.confirm","submit")} ${keyHint("tui.select.cancel","cancel")}`,1,0)),this.addChild(new Spacer(1)),this.addChild(new DynamicBorder)}handleInput(keyData){let kb=getKeybindings();kb.matches(keyData,"tui.select.confirm")||keyData===`
|
|
6
6
|
`?this.onSubmitCallback(this.input.getValue()):kb.matches(keyData,"tui.select.cancel")?this.onCancelCallback():this.input.handleInput(keyData)}dispose(){this.countdown?.dispose()}};var ExtensionSelectorComponent=class extends Container{options;selectedIndex=0;listContainer;onSelectCallback;onCancelCallback;titleText;baseTitle;countdown;onToggleToolsExpanded;constructor(title,options,onSelect,onCancel,opts){super(),this.options=options,this.onSelectCallback=onSelect,this.onCancelCallback=onCancel,this.onToggleToolsExpanded=opts?.onToggleToolsExpanded,this.baseTitle=title,this.addChild(new DynamicBorder),this.addChild(new Spacer(1)),this.titleText=new Text(theme.fg("accent",
|
|
7
7
|
theme.bold(title)),1,0),this.addChild(this.titleText),opts?.description&&(this.addChild(new Spacer(1)),this.addChild(new Text(theme.fg("text",opts.description),1,0))),this.addChild(new Spacer(1)),opts?.timeout&&opts.timeout>0&&opts.tui&&(this.countdown=new CountdownTimer(opts.timeout,opts.tui,s=>this.titleText.setText(theme.fg("accent",theme.bold(`${this.baseTitle} (${s}s)`))),()=>this.onCancelCallback())),this.listContainer=new Container,this.addChild(this.listContainer),this.addChild(new Spacer(
|
|
8
|
-
1)),this.addChild(new Text(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
1)),this.addChild(new Text(selectNavigationHint()+" "+keyHint("tui.select.confirm","select")+" "+keyHint("tui.select.cancel","cancel"),1,0)),this.addChild(new Spacer(1)),this.addChild(new DynamicBorder),this.updateList()}setOptions(options){this.options=options,this.selectedIndex=options.length===0?0:Math.max(0,Math.min(this.selectedIndex,options.length-1)),this.updateList()}updateList(){this.listContainer.clear();let maxVisible=10,startIndex=Math.max(0,Math.min(this.selectedIndex-Math.floor(maxVisible/
|
|
9
|
+
2),this.options.length-maxVisible)),endIndex=Math.min(startIndex+maxVisible,this.options.length);for(let i=startIndex;i<endIndex;i++){let text=i===this.selectedIndex?theme.fg("accent","\u2192 ")+theme.fg("accent",this.options[i]):` ${theme.fg("text",this.options[i])}`;this.listContainer.addChild(new Text(text,1,0))}if(startIndex>0||endIndex<this.options.length){let scrollInfo=theme.fg("muted",` (${this.selectedIndex+1}/${this.options.length})`);this.listContainer.addChild(new Text(scrollInfo,0,
|
|
10
|
+
0))}}handleInput(keyData){let kb=getKeybindings();if(kb.matches(keyData,"app.tools.expand"))this.onToggleToolsExpanded?.();else if(kb.matches(keyData,"tui.select.up"))this.selectedIndex=Math.max(0,this.selectedIndex-1),this.updateList();else if(kb.matches(keyData,"tui.select.down"))this.selectedIndex=Math.min(this.options.length-1,this.selectedIndex+1),this.updateList();else if(kb.matches(keyData,"tui.select.confirm")){let selected=this.options[this.selectedIndex];selected&&this.onSelectCallback(
|
|
11
|
+
selected)}else kb.matches(keyData,"tui.select.cancel")?this.onCancelCallback():kb.matches(keyData,"app.select.upAlternate")?(this.selectedIndex=Math.max(0,this.selectedIndex-1),this.updateList()):kb.matches(keyData,"app.select.downAlternate")&&(this.selectedIndex=Math.min(this.options.length-1,this.selectedIndex+1),this.updateList())}dispose(){this.countdown?.dispose()}};var HUMAIN_CODE_ICON_LINES=["\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588","\u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588"],HUMAIN_CODE_ICON_BAR_ROWS=[2,4],BAR_START=3,
|
|
12
12
|
BAR_END=12;function renderHumainCodeIcon(bracket,bar){return HUMAIN_CODE_ICON_LINES.map((line,index)=>HUMAIN_CODE_ICON_BAR_ROWS.includes(index)?bracket(line.slice(0,BAR_START))+bar(line.slice(BAR_START,BAR_END))+bracket(line.slice(BAR_END)):bracket(line))}var HUMAIN_CODE_LOGO_LINES=[...HUMAIN_CODE_ICON_LINES,"HUMAIN CODE"];var TERMINAL_QUERY_TIMEOUT_MS=100;function requestTerminalColors(ui,apply){let query;try{query=ui.queryTerminalColors({timeoutMs:TERMINAL_QUERY_TIMEOUT_MS,onLateReply:apply})}catch{query=Promise.resolve({})}return query.then(apply,()=>apply({}))}function sameRgb(a,b){return a===b||a!==void 0&&b!==void 0&&a.r===b.r&&a.g===b.g&&a.b===b.b}function sameTerminalColors(a,b){return!sameRgb(a.foreground,b.foreground)||!sameRgb(a.background,b.background)?!1:a.palette===b.palette?!0:!a.palette||!b.palette||
|
|
13
13
|
a.palette.length!==b.palette.length?!1:a.palette.every((color,index)=>sameRgb(color,b.palette?.[index]))}var InteractiveThemeController=class{ui;getSettingsManager;showError;onChanged;currentThemeSetting;terminalColors;activeThemeName;autoSyncEnabled=!1;terminalColorSchemeUnsubscribe;terminalColorQuery=Promise.resolve();constructor(ui,options){this.ui=ui,this.getSettingsManager=options.getSettingsManager,this.showError=options.showError,this.onChanged=options.onChanged,this.currentThemeSetting=options.
|
|
14
14
|
initialThemeSetting,this.activeThemeName=this.resolveThemeName(),markTerminalColorsPending(),initTheme(this.activeThemeName,!0),this.bindTerminalColorSchemeListener()}rebindTui(){this.terminalColorSchemeUnsubscribe?.(),this.bindTerminalColorSchemeListener(),this.ui.setTerminalColorSchemeNotifications(this.autoSyncEnabled)}applyFromSettings(){let themeSetting=this.getThemeSetting(),themeName=this.resolveThemeName();this.setAutoSync(parseAutoThemeSetting(themeSetting)!==void 0||themeName===SYSTEM_THEME_NAME),
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CompactionSummaryMessageComponent,CustomEditor,CustomMessageComponent,ExtensionEditorComponent,FLOW_ACCOUNT_PERSISTENCE_NOTICE,InteractiveMode,LoginDialogComponent,ModelSelectorComponent,OAuthSelectorComponent,SettingsSelectorComponent,SkillInvocationMessageComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,getFlowAccountsHost}from"./chunk-
|
|
3
|
-
import{ArminComponent}from"./chunk-
|
|
4
|
-
import{FooterComponent,copyToClipboard}from"./chunk-
|
|
5
|
-
createAgentSessionRuntime,createAgentSessionServices,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createJobsTool,createJobsToolDefinition,createLocalPowerShellOperations,createLsTool,
|
|
6
|
-
defineTool,detectSupportedImageMimeTypeFromFile,discoverAgents,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,
|
|
7
|
-
isToolCallEventType,isWriteToolResult,loadProjectContextFiles,loadSkills,loadSkillsFromDir,parseArgs,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import{Container,SelectList}from"./chunk-
|
|
2
|
+
import{AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CompactionSummaryMessageComponent,CustomEditor,CustomMessageComponent,ExtensionEditorComponent,FLOW_ACCOUNT_PERSISTENCE_NOTICE,InteractiveMode,LoginDialogComponent,ModelSelectorComponent,OAuthSelectorComponent,SettingsSelectorComponent,SkillInvocationMessageComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,getFlowAccountsHost}from"./chunk-KQXXBQ57.js";
|
|
3
|
+
import{ArminComponent}from"./chunk-APNPBT7Y.js";import{SessionSelectorComponent}from"./chunk-NNWNIBLG.js";import{ExtensionInputComponent,ExtensionSelectorComponent}from"./chunk-QRYDGY5I.js";import{AgentExecInputError,MAX_RPC_FRAME_LENGTH,attachJsonlLineReader,createMcpExtension,createPiAgentExecutionHost,createToolSearchExtension,executeHumainAgentRequest,main,parseRpcWireFrame,runAgentExecMode,runPrintMode,runRpcMode,serializeJsonLine}from"./chunk-IOLLZXQN.js";import{FLOW_SETUP_TERMINAL_ONLY,
|
|
4
|
+
FLOW_SUBCOMMANDS,completeFlowArguments,createCodemodeExtension,flowBuildUnavailable,parseFlowCommand,renderFlowHelp}from"./chunk-CU6KU7JK.js";import{FooterComponent,copyToClipboard}from"./chunk-SQ7NTRLJ.js";import{ACCOUNT_RETURN_COOLDOWN_MS,ACCOUNT_RETURN_MAX_COOLDOWN_MS,AgentSession,AgentSessionRuntime,BashJobManager,CredentialSynchronizationError,DEFAULT_COMPACTION_SETTINGS,DefaultResourceLoader,ExtensionRunner,ModelRegistry,ModelRuntime,OAuthAccountPool,VIRTUAL_MODEL_STATE_ENTRY,assessNodeFallback,
|
|
5
|
+
calculateContextTokens,collectEntriesForBranchSummary,compact,convertToPng,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createJobsTool,createJobsToolDefinition,createLocalBashOperations,createLocalPowerShellOperations,createLsTool,
|
|
6
|
+
createLsToolDefinition,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSubagentTool,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAgents,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getCompactionThreshold,getFlowChildLaunchHost,
|
|
7
|
+
getFlowControlHost,getFlowTraceProducer,getLastAssistantUsage,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,loadProjectContextFiles,loadSkills,loadSkillsFromDir,parseArgs,parseFrontmatter,parseSkillBlock,prepareBranchEntries,prepareChildLaunch,renderDiff,renderTaskWithContext,resolveCliModel,resolveModelScopeWithDiagnostics,serializeConversation,shouldCompact,stripFrontmatter,withFileMutationQueue,
|
|
8
|
+
wrapRegisteredTool,wrapRegisteredTools}from"./chunk-4SFWYKL5.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunk-JSZBTGI6.js";import{CURRENT_SESSION_VERSION,SessionManager,buildContextEntries,buildSessionContext,buildSessionProjection,convertToLlm,formatDimensionNote,getLatestCompactionEntry,migrateSessionEntries,parseSessionEntries,resizeImage,sessionEntryToContextMessages}from"./chunk-TYN46EVI.js";import{formatReadLineRange,truncateToVisualLines}from"./chunk-3CGMVKHA.js";
|
|
9
|
+
import{readStoredCredential}from"./chunk-JWOPWHVH.js";import{DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,formatSize,truncateHead,truncateLine,truncateTail}from"./chunk-3HVHETMU.js";import{DynamicBorder}from"./chunk-J5TSAJGC.js";import{DefaultPackageManager,SettingsManager,createSyntheticSourceInfo}from"./chunk-EMBIUIQ2.js";import{Theme,getAvailableThemes,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme,keyHint,keyText,rawKeyHint}from"./chunk-KONLZKPL.js";
|
|
10
|
+
import{Container,SelectList}from"./chunk-WBSGWISD.js";import{getPowerShellConfig,getShellConfig}from"./chunk-SKCJ25SX.js";import{HUMAIN_AGENT_EXECUTION_FAILURE_CODES,HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION,HumainAgentArtifactSchema,HumainAgentExecutionClaimSchema,HumainAgentExecutionControlsSchema,HumainAgentExecutionOutcomeSchema,HumainAgentExecutionRequestSchema,HumainAgentExecutionResponseSchema,HumainAgentRouteRefSchema,HumainAgentUsageSchema,parseHumainAgentExecutionRequest,parseHumainAgentExecutionResponse}from"./chunk-2NVGOSBN.js";
|
|
11
11
|
import{CONFIG_DIR_NAME,UPSTREAM_PI_VERSION,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunk-VFLVWPLZ.js";import{__export}from"./chunk-JXWJOIH4.js";var dist_exports={};__export(dist_exports,{ACCOUNT_RETURN_COOLDOWN_MS:()=>ACCOUNT_RETURN_COOLDOWN_MS,ACCOUNT_RETURN_MAX_COOLDOWN_MS:()=>ACCOUNT_RETURN_MAX_COOLDOWN_MS,AgentExecInputError:()=>AgentExecInputError,AgentSession:()=>AgentSession,AgentSessionRuntime:()=>AgentSessionRuntime,ArminComponent:()=>ArminComponent,AssistantMessageComponent:()=>AssistantMessageComponent,BashExecutionComponent:()=>BashExecutionComponent,BashJobManager:()=>BashJobManager,BorderedLoader:()=>BorderedLoader,BranchSummaryMessageComponent:()=>BranchSummaryMessageComponent,
|
|
12
12
|
CONFIG_DIR_NAME:()=>CONFIG_DIR_NAME,CURRENT_SESSION_VERSION:()=>CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent:()=>CompactionSummaryMessageComponent,CredentialSynchronizationError:()=>CredentialSynchronizationError,CustomEditor:()=>CustomEditor,CustomMessageComponent:()=>CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS:()=>DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES:()=>DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES:()=>DEFAULT_MAX_LINES,DefaultPackageManager:()=>DefaultPackageManager,DefaultResourceLoader:()=>DefaultResourceLoader,
|
|
13
13
|
DynamicBorder:()=>DynamicBorder,ExtensionEditorComponent:()=>ExtensionEditorComponent,ExtensionInputComponent:()=>ExtensionInputComponent,ExtensionRunner:()=>ExtensionRunner,ExtensionSelectorComponent:()=>ExtensionSelectorComponent,FLOW_ACCOUNT_PERSISTENCE_NOTICE:()=>FLOW_ACCOUNT_PERSISTENCE_NOTICE,FLOW_SETUP_TERMINAL_ONLY:()=>FLOW_SETUP_TERMINAL_ONLY,FLOW_SUBCOMMANDS:()=>FLOW_SUBCOMMANDS,FooterComponent:()=>FooterComponent,HUMAIN_AGENT_EXECUTION_FAILURE_CODES:()=>HUMAIN_AGENT_EXECUTION_FAILURE_CODES,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
+
import{getBinDir}from"./chunk-VFLVWPLZ.js";import{accessSync,constants}from"node:fs";import{delimiter,join,win32}from"node:path";import{spawn,spawnSync}from"child_process";function isLegacyWslBashPath(path){let normalized=win32.normalize(path).toLowerCase(),systemRoot=process.env.SystemRoot;return systemRoot?/^[a-z]:[\\/]/i.test(systemRoot)?["System32","Sysnative"].some(directory=>normalized===win32.join(systemRoot,directory,"bash.exe").toLowerCase()):!1:/^[a-z]:\\windows\\(?:system32|sysnative)\\bash\.exe$/.test(normalized)}function getBashShellConfig(shell){return isLegacyWslBashPath(shell)?{shell,args:["-s"],commandTransport:"stdin"}:{shell,args:["-c"]}}function shellPathExists(path){
|
|
3
|
+
try{return accessSync(path,constants.F_OK),!0}catch{return!1}}function findExecutableOnPath(executable){if(process.platform==="win32"){try{let result=spawnSync("where",[executable],{encoding:"utf-8",timeout:5e3,windowsHide:!0});if(result.status===0&&result.stdout){let firstMatch=result.stdout.trim().split(/\r?\n/)[0];if(firstMatch&&shellPathExists(firstMatch))return firstMatch}}catch{}return null}try{let result=spawnSync("which",[executable],{encoding:"utf-8",timeout:5e3});if(result.status===0&&
|
|
4
|
+
result.stdout){let firstMatch=result.stdout.trim().split(/\r?\n/)[0];if(firstMatch)return firstMatch}}catch{}return null}function getShellConfig(customShellPath){if(customShellPath){if(shellPathExists(customShellPath))return getBashShellConfig(customShellPath);throw new Error(`Custom shell path not found: ${customShellPath}`)}if(process.platform==="win32"){let paths=[],programFiles=process.env.ProgramFiles;programFiles&&paths.push(`${programFiles}\\Git\\bin\\bash.exe`);let programFilesX86=process.
|
|
5
|
+
env["ProgramFiles(x86)"];programFilesX86&&paths.push(`${programFilesX86}\\Git\\bin\\bash.exe`);for(let path of paths)if(shellPathExists(path))return getBashShellConfig(path);let bashOnPath2=findExecutableOnPath("bash.exe");if(bashOnPath2)return getBashShellConfig(bashOnPath2);throw new Error(`No bash shell found. Options:
|
|
6
|
+
1. Install Git for Windows: https://git-scm.com/download/win
|
|
7
|
+
2. Add your bash to PATH (Cygwin, MSYS2, etc.)
|
|
8
|
+
3. Set shellPath in settings.json
|
|
9
|
+
|
|
10
|
+
Searched Git Bash in:
|
|
11
|
+
${paths.map(p=>` ${p}`).join(`
|
|
12
|
+
`)}`)}if(shellPathExists("/bin/bash"))return getBashShellConfig("/bin/bash");let bashOnPath=findExecutableOnPath("bash");return bashOnPath?getBashShellConfig(bashOnPath):{shell:"sh",args:["-c"]}}var POWERSHELL_ARGS=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command"];function getPowerShellConfig(){if(process.platform!=="win32")throw new Error("The powershell tool is only available on Windows.");let shell=findExecutableOnPath("pwsh.exe"),programFiles=process.env.ProgramFiles;if(!shell&&
|
|
13
|
+
programFiles){let pwsh7=win32.join(programFiles,"PowerShell","7","pwsh.exe");shellPathExists(pwsh7)&&(shell=pwsh7)}shell??=findExecutableOnPath("powershell.exe");let systemRoot=process.env.SystemRoot;if(!shell&&systemRoot){let windowsPowerShell=win32.join(systemRoot,"System32","WindowsPowerShell","v1.0","powershell.exe");shellPathExists(windowsPowerShell)&&(shell=windowsPowerShell)}if(!shell)throw new Error("No PowerShell executable found. Install PowerShell or add powershell.exe/pwsh.exe to PAT\
|
|
14
|
+
H.");return{shell,args:[...POWERSHELL_ARGS]}}function getShellEnv(environment=process.env){let binDir=getBinDir(),pathKey=Object.keys(environment).find(key=>key.toLowerCase()==="path")??"PATH",currentPath=environment[pathKey]??"",updatedPath=currentPath.split(delimiter).filter(Boolean).includes(binDir)?currentPath:[binDir,currentPath].filter(Boolean).join(delimiter);return{...environment,[pathKey]:updatedPath}}function sanitizeBinaryOutput(str){return str.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F\uFFF9-\uFFFB]/g,
|
|
15
|
+
"")}var terminationCleanups=[];function onTerminationSignal(cleanup){if(terminationCleanups.push(cleanup),terminationCleanups.length===1)for(let signal of["SIGINT","SIGTERM","SIGHUP"]){let handler=()=>{for(let callback of terminationCleanups)callback();process.listenerCount(signal)===1&&(process.removeListener(signal,handler),process.kill(process.pid,signal))};process.prependListener(signal,handler)}}var trackedDetachedChildren=new Map,TERMINATION_GRACE_MS=1500,TERMINATION_CONFIRM_MS=500,TERMINATION_POLL_MS=20,
|
|
16
|
+
custodyMonitor;function releaseChild(record){record.released=!0,trackedDetachedChildren.get(record.pid)===record&&trackedDetachedChildren.delete(record.pid),trackedDetachedChildren.size===0&&custodyMonitor&&(clearInterval(custodyMonitor),custodyMonitor=void 0)}function validatePid(pid){if(!Number.isSafeInteger(pid)||pid<=1||pid===process.pid)throw new RangeError("Expected an owned child pid greater than 1")}function isProcessAlive(pid){try{return process.kill(pid,0),!0}catch(error){return error.
|
|
17
|
+
code!=="ESRCH"}}function processTreeTarget(record){let{pid,child}=record;if(record.released||trackedDetachedChildren.get(pid)!==record)return;let leaderRunning=child&&child.exitCode===null&&child.signalCode===null;if(process.platform!=="win32"&&isProcessAlive(-pid))return-pid;if((leaderRunning||process.platform==="win32"&&!child)&&isProcessAlive(pid))return pid;releaseChild(record)}function signalProcess(target,signal,child){if(process.platform==="darwin"&&target<0&&signal==="SIGKILL")try{process.
|
|
18
|
+
kill(target,"SIGSTOP")}catch{}try{target>0&&child?child.kill(signal):process.kill(target,signal)}catch{}}function trackDetachedChildPid(pid,child){if(validatePid(pid),child&&child.pid!==pid)throw new RangeError("ChildProcess pid does not match");let record={pid,child};trackedDetachedChildren.set(pid,record),child?.once("exit",()=>processTreeTarget(record)),custodyMonitor??=setInterval(()=>{for(let owned of trackedDetachedChildren.values())processTreeTarget(owned)},250).unref()}function hasTrackedProcessEffects(pid,child){
|
|
19
|
+
let record=trackedDetachedChildren.get(pid);return record?.child===child&&processTreeTarget(record)!==void 0}function untrackDetachedChildPid(pid,child){validatePid(pid);let record=trackedDetachedChildren.get(pid);child&&record?.child!==child||record&&!record.terminationRequested&&releaseChild(record)}function killProcessTreeAsync(pid,graceMs=TERMINATION_GRACE_MS,child){if(validatePid(pid),!Number.isFinite(graceMs)||graceMs<0)throw new RangeError("Invalid termination grace period");let record=trackedDetachedChildren.
|
|
20
|
+
get(pid);if(!record||child&&record.child!==child)return Promise.resolve(!0);if(record.termination)return record.termination;record.terminationRequested=!0;let termination=(async()=>{process.platform==="win32"&&killProcessTree(pid);for(let signal of["SIGTERM","SIGKILL"]){if(trackedDetachedChildren.get(pid)!==record)return!0;let target=processTreeTarget(record);if(target===void 0)return!0;process.platform!=="win32"&&signalProcess(target,signal,record.child);let deadline=performance.now()+(signal===
|
|
21
|
+
"SIGTERM"?graceMs:TERMINATION_CONFIRM_MS);for(;processTreeTarget(record)!==void 0&&performance.now()<deadline;)if(await new Promise(resolve=>setTimeout(resolve,TERMINATION_POLL_MS)),trackedDetachedChildren.get(pid)!==record)return!0;if(processTreeTarget(record)===void 0)return!0}return!1})().then(confirmed=>(confirmed?releaseChild(record):record.termination=void 0,confirmed));return record.termination=termination,termination}async function killTrackedDetachedChildrenAsync(graceMs=TERMINATION_GRACE_MS){
|
|
22
|
+
return(await Promise.all([...trackedDetachedChildren.keys()].map(pid=>killProcessTreeAsync(pid,graceMs)))).every(Boolean)}function killTrackedDetachedChildren(graceMs=TERMINATION_GRACE_MS){if(!Number.isFinite(graceMs)||graceMs<0)throw new RangeError("Invalid termination grace period");let records=[...trackedDetachedChildren.values()];for(let record of records)record.terminationRequested=!0;if(process.platform==="win32")for(let record of records)killProcessTree(record.pid);else{let sleeper=new Int32Array(
|
|
23
|
+
new SharedArrayBuffer(4));for(let signal of["SIGTERM","SIGKILL"]){for(let record of records){let target=processTreeTarget(record);target!==void 0&&(signal==="SIGTERM"&&record.termination||isProcessAlive(target)&&signalProcess(target,signal,record.child))}let deadline=performance.now()+(signal==="SIGTERM"?graceMs:TERMINATION_CONFIRM_MS);for(;;){let alive=!1;for(let record of records)processTreeTarget(record)!==void 0&&(alive=!0);if(!alive||performance.now()>=deadline)break;Atomics.wait(sleeper,0,
|
|
24
|
+
0,TERMINATION_POLL_MS)}}}for(let record of records)processTreeTarget(record)}function killProcessTree(pid,child){validatePid(pid);let record=trackedDetachedChildren.get(pid);if(!(!record||child&&record.child!==child||processTreeTarget(record)===void 0))if(process.platform==="win32")try{spawn(join(process.env.SystemRoot||"C:\\Windows","System32","taskkill.exe"),["/F","/T","/PID",String(pid)],{stdio:"ignore",detached:!0,windowsHide:!0}).once("error",()=>{})}catch{}else killProcessTreeAsync(pid)}export{getShellConfig,getPowerShellConfig,getShellEnv,sanitizeBinaryOutput,onTerminationSignal,trackDetachedChildPid,hasTrackedProcessEffects,untrackDetachedChildPid,killProcessTreeAsync,killTrackedDetachedChildrenAsync,killTrackedDetachedChildren};
|
|
@@ -0,0 +1,77 @@
|
|
|
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-4SFWYKL5.js";import{addUsageToTotals,createUsageTotals,getSessionUsage,stripAnsi}from"./chunk-3CGMVKHA.js";import{raceWithAbortSignal}from"./chunk-JWOPWHVH.js";import{areExperimentalFeaturesEnabled}from"./chunk-J5TSAJGC.js";import{hcodeDisplayName,require_semver}from"./chunk-EMBIUIQ2.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";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?.
|
|
4
|
+
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\
|
|
5
|
+
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.
|
|
6
|
+
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{
|
|
7
|
+
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\
|
|
8
|
+
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.
|
|
9
|
+
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\
|
|
10
|
+
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){
|
|
11
|
+
let weekly=formatOAuthAccountUsage({kind:"unavailable",...result?.status==="unavailable"?{reason:result.reason}:{}});if(result?.status!=="ok")return`${weekly}, saved resets: unavailable, paid credits: unavailable`;if("fetchedAt"in result){let window=result.windows.find(window2=>window2.id==="seven_day");window&&(weekly=`weekly: ${Math.round(100-window.usedPercent)}% left`);let reset=formatNextQuotaReset(result.windows);reset&&(weekly+=`, Next reset ${reset}`)}else result.usage&&(weekly=formatOAuthAccountUsage(
|
|
12
|
+
{kind:"available",...result.usage}));let count=result.resets?.availableCount,resets=count===void 0?"unavailable":count===0?"none":String(count),enabled=result.credits?.enabled;return`${weekly}, saved resets: ${resets}, paid credits: ${formatSubscriptionCredits(result.credits)}${enabled===void 0?"":`, extra usage: ${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=
|
|
13
|
+
resetsAt);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[
|
|
14
|
+
usage.status,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){
|
|
15
|
+
let usageText=formatOAuthAccountUsage(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/
|
|
16
|
+
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.
|
|
17
|
+
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.
|
|
18
|
+
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)));
|
|
19
|
+
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(`
|
|
20
|
+
`)}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){
|
|
21
|
+
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}
|
|
22
|
+
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.
|
|
23
|
+
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{
|
|
24
|
+
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:"\
|
|
25
|
+
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\
|
|
26
|
+
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\
|
|
27
|
+
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<
|
|
28
|
+
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,
|
|
29
|
+
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{
|
|
30
|
+
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\
|
|
31
|
+
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:[]}}
|
|
32
|
+
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\
|
|
33
|
+
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\
|
|
34
|
+
ed":cache.stale?"optional":void 0}}}function nextQuotaResetLines(windows,now){let reset=formatNextQuotaReset(windows,now);return reset?[{label:"Next reset",value:reset}]:[]}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\
|
|
35
|
+
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\
|
|
36
|
+
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\
|
|
37
|
+
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(`
|
|
38
|
+
`)}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\
|
|
39
|
+
y]"}}}function hcodeSignedInElsewhereNotice(environmentId,elsewhere){let other=elsewhere[0];if(other)return`${hcodeDisplayName(environmentId)}: not signed in. Your saved sign-in is for ${hcodeDisplayName(other)}: start humain-code with --env ${other} to use it, or /login to sign in here.`}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)].
|
|
40
|
+
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(
|
|
41
|
+
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();
|
|
42
|
+
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!==
|
|
43
|
+
".."&&!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=
|
|
44
|
+
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=
|
|
45
|
+
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!==
|
|
46
|
+
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.
|
|
47
|
+
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?
|
|
48
|
+
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(),
|
|
49
|
+
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(
|
|
50
|
+
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()>
|
|
51
|
+
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(
|
|
52
|
+
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){
|
|
53
|
+
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","..."))],
|
|
54
|
+
{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.
|
|
55
|
+
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?
|
|
56
|
+
" (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)}`)];
|
|
57
|
+
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)
|
|
58
|
+
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.
|
|
59
|
+
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(({
|
|
60
|
+
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.
|
|
61
|
+
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,
|
|
62
|
+
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.
|
|
63
|
+
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){
|
|
64
|
+
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:
|
|
65
|
+
${APP_COMMAND} auth print-api-key [--provider <provider>] [--model <model>]
|
|
66
|
+
${APP_COMMAND} auth print-bearer-token [--provider <provider>] [--model <model>] [--min-expiry <duration>]
|
|
67
|
+
${APP_COMMAND} auth check [--provider <provider>] [--model <model>] [--json] [--credentials] [--no-refresh]
|
|
68
|
+
|
|
69
|
+
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\
|
|
70
|
+
-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\
|
|
71
|
+
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,
|
|
72
|
+
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&&
|
|
73
|
+
!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.
|
|
74
|
+
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.
|
|
75
|
+
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)))}}};export{AuthCommandError,getAuthCommandName,getAuthCommandUsage,isAuthCommandHelp,printAuthCommandHelp,parseAuthCommand,validateAuthCommandArgs,getAuthCredential,runClipboardCommand,readClipboardText,readClipboardFilePaths,copyToClipboard,AuthUrlComponent,trackUserWait,currentUserWait,onUserWaitChange,bindClaudeUsageReconnect,getClaudeUsageReconnect,formatOAuthAccountResetTime,formatOAuthAccountUsage,formatOAuthAccountOption,usageDisplayText,buildUsageOverview,formatUsageOverview,weeklyResetLines,
|
|
76
|
+
paidUsageLines,claudeUsageBars,codexUsageBars,usageAge,readClaudeUsage,nextQuotaResetLines,HCODE_LOGIN_MISMATCH_DETAILS,hcodeEmptyCatalogMessage,hcodeEmptyCatalogReason,hcodeEmptyCatalogNotice,hcodeLoginAvailability,hcodeSignedInElsewhereNotice,formatVersionCheckError,isNewerPackageVersion,getLatestPiRelease,checkForNewPiVersion,waitForSignalShutdown,exitAfterSignalShutdown,formatTokens2 as formatTokens,formatCwdForFooter,FooterComponent,checkWatchedHcodeCatalog,retryHcodeCatalog,refreshModelCatalogs,
|
|
77
|
+
refreshStartupModelCatalogs};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{getCurrentSystemMessage}from"./chunk-
|
|
2
|
+
import{getCurrentSystemMessage}from"./chunk-Z5UFSRO4.js";import{uuidv7}from"./chunk-ATFZAFMS.js";import{APP_TITLE,getAgentDir,getSessionsDir,normalizePath,pathsEqual,resolvePath}from"./chunk-VFLVWPLZ.js";function readOrientationFromTiff(bytes,tiffStart){if(tiffStart+8>bytes.length)return 1;let le=(bytes[tiffStart]<<8|bytes[tiffStart+1])===18761,read16=pos=>le?bytes[pos]|bytes[pos+1]<<8:bytes[pos]<<8|bytes[pos+1],ifdOffset=(pos=>le?bytes[pos]|bytes[pos+1]<<8|bytes[pos+2]<<16|bytes[pos+3]<<24:(bytes[pos]<<24|bytes[pos+1]<<16|bytes[pos+2]<<8|bytes[pos+3])>>>0)(tiffStart+4),ifdStart=tiffStart+ifdOffset;if(ifdStart+2>bytes.length)return 1;let entryCount=read16(ifdStart);for(let i=0;i<entryCount;i++){
|
|
3
3
|
let entryPos=ifdStart+2+i*12;if(entryPos+12>bytes.length)return 1;if(read16(entryPos)===274){let value=read16(entryPos+8);return value>=1&&value<=8?value:1}}return 1}function findJpegTiffOffset(bytes){let offset=2;for(;offset<bytes.length-1;){if(bytes[offset]!==255)return-1;let marker=bytes[offset+1];if(marker===255){offset++;continue}if(marker===225){if(offset+4>=bytes.length)return-1;let segmentStart=offset+4;if(segmentStart+6>bytes.length)return-1;if(hasExifHeader(bytes,segmentStart))return segmentStart+
|
|
4
4
|
6}if(offset+4>bytes.length)return-1;let length=bytes[offset+2]<<8|bytes[offset+3];offset+=2+length}return-1}function findWebpTiffOffset(bytes){let offset=12;for(;offset+8<=bytes.length;){let chunkId=String.fromCharCode(bytes[offset],bytes[offset+1],bytes[offset+2],bytes[offset+3]),chunkSize=bytes[offset+4]|bytes[offset+5]<<8|bytes[offset+6]<<16|bytes[offset+7]<<24,dataStart=offset+8;if(chunkId==="EXIF")return dataStart+chunkSize>bytes.length?-1:chunkSize>=6&&hasExifHeader(bytes,dataStart)?dataStart+
|
|
5
5
|
6:dataStart;offset=dataStart+chunkSize+chunkSize%2}return-1}function hasExifHeader(bytes,offset){return bytes[offset]===69&&bytes[offset+1]===120&&bytes[offset+2]===105&&bytes[offset+3]===102&&bytes[offset+4]===0&&bytes[offset+5]===0}function getExifOrientation(bytes){let tiffOffset=-1;return bytes.length>=2&&bytes[0]===255&&bytes[1]===216?tiffOffset=findJpegTiffOffset(bytes):bytes.length>=12&&bytes[0]===82&&bytes[1]===73&&bytes[2]===70&&bytes[3]===70&&bytes[8]===87&&bytes[9]===69&&bytes[10]===66&&
|
|
@@ -11,9 +11,9 @@ fallbackPath,options);throw error}return originalReadFileSync(...args)});try{mut
|
|
|
11
11
|
try{return photonModule=await import("@silvia-odwyer/photon-node"),photonModule}catch{return photonModule=null,photonModule}finally{restoreReadFileSync()}})(),loadPromise)}var IMAGE_RESIZE_WORKER_RESPONSE_TYPE="pi:image-resize-response",DEFAULT_MAX_BYTES=4.5*1024*1024,DEFAULT_OPTIONS={maxWidth:2e3,maxHeight:2e3,maxBytes:DEFAULT_MAX_BYTES,jpegQuality:80};function encodeCandidate(buffer,mimeType){let data=Buffer.from(buffer).toString("base64");return{data,encodedSize:Buffer.byteLength(data,"utf-8"),mimeType}}async function resizeImageInProcess(inputBytes,mimeType,options){let opts={...DEFAULT_OPTIONS,...options},inputBase64Size=Math.ceil(inputBytes.byteLength/3)*4,photon=await loadPhoton();
|
|
12
12
|
if(!photon)return null;let image;try{let tryEncodings=function(width,height,jpegQualities){let resized=photon.resize(image,width,height,photon.SamplingFilter.Lanczos3);try{let candidates=[encodeCandidate(resized.get_bytes(),"image/png")];for(let quality of jpegQualities)candidates.push(encodeCandidate(resized.get_bytes_jpeg(quality),"image/jpeg"));return candidates}finally{resized.free()}},rawImage=photon.PhotonImage.new_from_byteslice(inputBytes);image=applyExifOrientation(photon,rawImage,inputBytes),
|
|
13
13
|
image!==rawImage&&rawImage.free();let originalWidth=image.get_width(),originalHeight=image.get_height(),format=mimeType.split("/")[1]??"png";if(originalWidth<=opts.maxWidth&&originalHeight<=opts.maxHeight&&inputBase64Size<opts.maxBytes)return{data:Buffer.from(inputBytes).toString("base64"),mimeType:mimeType||`image/${format}`,originalWidth,originalHeight,width:originalWidth,height:originalHeight,wasResized:!1};let targetWidth=originalWidth,targetHeight=originalHeight;targetWidth>opts.maxWidth&&(targetHeight=
|
|
14
|
-
Math.round(targetHeight*opts.maxWidth/targetWidth),targetWidth=opts.maxWidth),targetHeight>opts.maxHeight&&(targetWidth=Math.round(targetWidth*opts.maxHeight/targetHeight),targetHeight=opts.maxHeight);let qualitySteps=Array.from(new Set([opts.jpegQuality,85,70,55,40])),currentWidth=targetWidth,currentHeight=targetHeight;for(;;){let[png,jpeg,...lowerQualityJpegs]=tryEncodings(currentWidth,currentHeight,qualitySteps),preferred=jpeg&&jpeg.encodedSize<png.encodedSize?[jpeg,png]:
|
|
15
|
-
...preferred,...lowerQualityJpegs])if(candidate&&candidate.encodedSize<opts.maxBytes)return{data:candidate.data,mimeType:candidate.mimeType,originalWidth,originalHeight,width:currentWidth,height:currentHeight,wasResized:!0};if(currentWidth===1&¤tHeight===1)break;let nextWidth=currentWidth===1?1:Math.max(1,Math.floor(currentWidth*.75)),nextHeight=currentHeight===1?1:Math.max(1,Math.floor(currentHeight*.75));if(nextWidth===currentWidth&&nextHeight===currentHeight)
|
|
16
|
-
currentHeight=nextHeight}return null}catch{return null}finally{image&&image.free()}}function toTransferableBytes(input){return new Uint8Array(input)}function isResizeImageWorkerResponse(value){return value!==null&&typeof value=="object"&&"type"in value&&value.type===IMAGE_RESIZE_WORKER_RESPONSE_TYPE}function createResizeWorker(workerSpecifier){return new(process.getBuiltinModule("node:worker_threads")).Worker(workerSpecifier)}async function resizeImageInWorker(workerSpecifier,inputBytes,mimeType,options){let worker=createResizeWorker(workerSpecifier);try{let inputBytesForWorker=toTransferableBytes(
|
|
14
|
+
Math.max(1,Math.round(targetHeight*opts.maxWidth/targetWidth)),targetWidth=opts.maxWidth),targetHeight>opts.maxHeight&&(targetWidth=Math.max(1,Math.round(targetWidth*opts.maxHeight/targetHeight)),targetHeight=opts.maxHeight);let qualitySteps=Array.from(new Set([opts.jpegQuality,85,70,55,40])),currentWidth=targetWidth,currentHeight=targetHeight;for(;;){let[png,jpeg,...lowerQualityJpegs]=tryEncodings(currentWidth,currentHeight,qualitySteps),preferred=jpeg&&jpeg.encodedSize<png.encodedSize?[jpeg,png]:
|
|
15
|
+
[png,jpeg];for(let candidate of[...preferred,...lowerQualityJpegs])if(candidate&&candidate.encodedSize<opts.maxBytes)return{data:candidate.data,mimeType:candidate.mimeType,originalWidth,originalHeight,width:currentWidth,height:currentHeight,wasResized:!0};if(currentWidth===1&¤tHeight===1)break;let nextWidth=currentWidth===1?1:Math.max(1,Math.floor(currentWidth*.75)),nextHeight=currentHeight===1?1:Math.max(1,Math.floor(currentHeight*.75));if(nextWidth===currentWidth&&nextHeight===currentHeight)
|
|
16
|
+
break;currentWidth=nextWidth,currentHeight=nextHeight}return null}catch{return null}finally{image&&image.free()}}function toTransferableBytes(input){return new Uint8Array(input)}function isResizeImageWorkerResponse(value){return value!==null&&typeof value=="object"&&"type"in value&&value.type===IMAGE_RESIZE_WORKER_RESPONSE_TYPE}function createResizeWorker(workerSpecifier){return new(process.getBuiltinModule("node:worker_threads")).Worker(workerSpecifier)}async function resizeImageInWorker(workerSpecifier,inputBytes,mimeType,options){let worker=createResizeWorker(workerSpecifier);try{let inputBytesForWorker=toTransferableBytes(
|
|
17
17
|
inputBytes);return await new Promise((resolve2,reject)=>{let settled=!1,settle=result=>{settled||(settled=!0,resolve2(result))},fail=error=>{settled||(settled=!0,reject(error))};worker.on("message",message=>{isResizeImageWorkerResponse(message)&&("error"in message?fail(new Error(message.error)):settle(message.result))}),worker.once("error",fail),worker.once("exit",code=>{settled||fail(new Error(`Image resize worker exited with code ${code}`))}),worker.postMessage({inputBytes:inputBytesForWorker,
|
|
18
18
|
mimeType,options},[inputBytesForWorker.buffer])})}finally{await worker.terminate().catch(()=>{})}}async function resizeImage(inputBytes,mimeType,options){let isTypeScriptRuntime=import.meta.url.endsWith(".ts"),workerUrl=new URL(isTypeScriptRuntime?"./image-resize-worker.ts":"./image-resize-worker.js",import.meta.url);if(typeof process.versions.bun=="string")try{return await resizeImageInWorker("./src/utils/image-resize-worker.ts",inputBytes,mimeType,options)}catch{}try{return await resizeImageInWorker(
|
|
19
19
|
workerUrl,inputBytes,mimeType,options)}catch{return resizeImageInProcess(inputBytes,mimeType,options)}}function formatDimensionNote(result){if(!result.wasResized)return;let scale=result.originalWidth/result.width;return`[Image: original ${result.originalWidth}x${result.originalHeight}, displayed at ${result.width}x${result.height}. Multiply coordinates by ${scale.toFixed(2)} to map to original image.]`}var COMPACTION_SUMMARY_PREFIX=`The conversation history before this point was compacted into the following summary:
|
|
@@ -118,4 +118,4 @@ let dir=sessionDir?normalizePath(sessionDir):getDefaultSessionDir(cwd),resolvedC
|
|
|
118
118
|
"string"?normalizePath(sessionDirOrOnProgress):void 0,progress=typeof sessionDirOrOnProgress=="function"?sessionDirOrOnProgress:typeof onProgressOrSignal=="function"?onProgressOrSignal:void 0,abortSignal=typeof sessionDirOrOnProgress=="string"||typeof onProgressOrSignal=="function"?signal:onProgressOrSignal??signal;if(abortSignal?.throwIfAborted(),customSessionDir)return sortSessionInfos(await listSessionsFromDir(customSessionDir,progress,abortSignal));let sessionsDir=getSessionsDir();try{if(!existsSync(
|
|
119
119
|
sessionsDir))return[];let dirs=(await readdir(sessionsDir,{withFileTypes:!0})).filter(entry=>entry.isDirectory()||entry.isSymbolicLink()).map(entry=>join2(sessionsDir,entry.name)),allFiles=(await mapWithConcurrency(dirs,MAX_CONCURRENT_SESSION_DISCOVERY_LOADS,async dir=>{try{return(await readdir(dir)).filter(file=>file.endsWith(".jsonl")).map(file=>join2(dir,file))}catch{return[]}},abortSignal)).flat(),candidates=await mapWithConcurrency(allFiles,MAX_CONCURRENT_SESSION_DISCOVERY_LOADS,async path2=>{
|
|
120
120
|
try{return{path:path2,stats:await stat(path2)}}catch{return{path:path2}}},abortSignal);candidates.sort((a,b)=>(b.stats?.mtimeMs??Number.NEGATIVE_INFINITY)-(a.stats?.mtimeMs??Number.NEGATIVE_INFINITY)||basename(b.path).localeCompare(basename(a.path)));let totalFiles=candidates.length,loaded=0,firstCandidateLoaded=!1,partialSessions=[],results=await buildSessionInfosWithConcurrency(candidates,(info,index)=>{loaded++,index===0&&(firstCandidateLoaded=!0),info&&partialSessions.push(info);let publishPartial=firstCandidateLoaded&&
|
|
121
|
-
(index===0||loaded%ALL_SESSION_LIST_PUBLISH_INTERVAL===0||loaded===totalFiles);progress?.(loaded,totalFiles,publishPartial?sortSessionInfos([...partialSessions]):void 0)},abortSignal);return sortSessionInfos(results.filter(info=>info!==null))}catch{return abortSignal?.throwIfAborted(),[]}}};export{loadPhoton,
|
|
121
|
+
(index===0||loaded%ALL_SESSION_LIST_PUBLISH_INTERVAL===0||loaded===totalFiles);progress?.(loaded,totalFiles,publishPartial?sortSessionInfos([...partialSessions]):void 0)},abortSignal);return sortSessionInfos(results.filter(info=>info!==null))}catch{return abortSignal?.throwIfAborted(),[]}}};export{applyExifOrientation,loadPhoton,resizeImage,formatDimensionNote,createBranchSummaryMessage,createCompactionSummaryMessage,createCustomMessage,convertToLlm,CURRENT_SESSION_VERSION,includeSummaryUsageEntries,assertValidSessionId,migrateSessionEntries,parseSessionEntries,getLatestCompactionEntry,sessionEntryToContextMessages,buildContextEntries,projectContextEntry,getControlDeniedEntryIds,buildSessionProjection,buildSessionContext,getDefaultSessionDir,SessionManager};
|
|
@@ -184,15 +184,16 @@ throw new TypeError("Epoch timestamps must be expressed as floating point number
|
|
|
184
184
|
new Date(Date.UTC(input.getUTCFullYear()-100,input.getUTCMonth(),input.getUTCDate(),input.getUTCHours(),input.getUTCMinutes(),input.getUTCSeconds(),input.getUTCMilliseconds())):input,parseMonthByShortName=value=>{let monthIdx=MONTHS.indexOf(value);if(monthIdx<0)throw new TypeError(`Invalid month: ${value}`);return monthIdx+1},DAYS_IN_MONTH=[31,28,31,30,31,30,31,31,30,31,30,31],validateDayOfMonth=(year2,month,day)=>{let maxDays=DAYS_IN_MONTH[month];if(month===1&&isLeapYear(year2)&&(maxDays=29),day>
|
|
185
185
|
maxDays)throw new TypeError(`Invalid day for ${MONTHS[month]} in ${year2}: ${day}`)},isLeapYear=year2=>year2%4===0&&(year2%100!==0||year2%400===0),parseDateValue=(value,type,lower,upper)=>{let dateVal=strictParseByte(stripLeadingZeroes(value));if(dateVal<lower||dateVal>upper)throw new TypeError(`${type} must be between ${lower} and ${upper}, inclusive`);return dateVal},parseMilliseconds=value=>value==null?0:strictParseFloat32("0."+value)*1e3,parseOffsetToMilliseconds=value=>{let directionStr=value[0],
|
|
186
186
|
direction=1;if(directionStr=="+")direction=1;else if(directionStr=="-")direction=-1;else throw new TypeError(`Offset direction, ${directionStr}, must be "+" or "-"`);let hour=Number(value.substring(1,3)),minute=Number(value.substring(4,6));return direction*(hour*60+minute)*60*1e3},stripLeadingZeroes=value=>{let idx=0;for(;idx<value.length-1&&value.charAt(idx)==="0";)idx++;return idx===0?value:value.slice(idx)}}});var LazyJsonString,init_lazy_json=__esm({"node_modules/@smithy/core/dist-es/submodules/serde/lazy-json.js"(){LazyJsonString=function(val){return Object.assign(new String(val),{deserializeJSON(){return JSON.parse(String(val))},toString(){return String(val)},toJSON(){return String(val)}})};LazyJsonString.from=object=>object&&typeof object=="object"&&(object instanceof LazyJsonString||"deserializeJSON"in object)?object:typeof object=="string"||Object.getPrototypeOf(object)===String.prototype?LazyJsonString(
|
|
187
|
-
String(object)):LazyJsonString(JSON.stringify(object));LazyJsonString.fromObject=LazyJsonString.from}});function quoteHeader(part){return(part.includes(",")||part.includes('"'))&&(part=`"${part.replace(/"/g,'\\"')}"`),part}var init_quote_header=__esm({"node_modules/@smithy/core/dist-es/submodules/serde/quote-header.js"(){}});function range(v,min,max){let _v=Number(v);if(_v<min||_v>max)throw new Error(`Value ${_v} out of range [${min}, ${max}]`)}var ddd,mmm,time,date,year,RFC3339_WITH_OFFSET2,IMF_FIXDATE2,RFC_850_DATE2,ASC_TIME2,months,_parseEpochTimestamp,_parseRfc3339DateTimeWithOffset,_parseRfc7231DateTime,init_schema_date_utils=__esm({"node_modules/@smithy/core/dist-es/submodules/serde/schema-serde-lib/schema-date-utils.js"(){ddd="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",mmm="(Jan|
|
|
188
|
-
|
|
189
|
-
"Oct","Nov","Dec"],_parseEpochTimestamp=value=>{if(value==null)return;let num=NaN;if(typeof value=="number")num=value;else if(typeof value=="string"){if(!/^-?\d*\.?\d+$/.test(value))throw new TypeError("parseEpochTimestamp - numeric string invalid.");num=Number.parseFloat(value)}else typeof value=="object"&&
|
|
190
|
-
value=>{if(value==null)return;if(typeof value!="string")throw new TypeError("RFC3339 timestamps must be strings");let matches=RFC3339_WITH_OFFSET2.exec(value);if(!matches)throw new TypeError(`Invalid RFC3339 timestamp format ${value}`);let[,yearStr,monthStr,dayStr,hours,minutes,seconds,,ms,offsetStr]=matches;
|
|
191
|
-
Number(minutes),Number(seconds),Number(ms)?Math.round(parseFloat(`0.${ms}`)*1e3):0));if(date2.setUTCFullYear(Number(yearStr)),offsetStr.toUpperCase()!="Z"){let[,sign2,offsetH,offsetM]=/([+-])(\d\d):(\d\d)/.exec(offsetStr)||[void 0,"+",0,0],scalar=sign2==="-"?1:-1;date2.setTime(date2.getTime()+scalar*(Number(offsetH)*
|
|
192
|
-
.");let day,month,year2,hour,minute,second,fraction,matches;if((matches=IMF_FIXDATE2.exec(value))?[,day,month,year2,hour,minute,second,fraction]=matches:(matches=RFC_850_DATE2.exec(value))?([,day,month,year2,hour,minute,second,fraction]=matches,year2=(Number(year2)+
|
|
193
|
-
fraction?Math.round(parseFloat(`0.${fraction}`)*1e3):0);range(day,1,31),range(hour,0,23),range(minute,0,59),range(second,0,60);let date2=new Date(timestamp);return date2.setUTCFullYear(Number(year2)),date2}throw new TypeError(`Invalid RFC7231 date-time value ${value}
|
|
194
|
-
|
|
195
|
-
|
|
187
|
+
String(object)):LazyJsonString(JSON.stringify(object));LazyJsonString.fromObject=LazyJsonString.from}});function quoteHeader(part){return(part.includes(",")||part.includes('"'))&&(part=`"${part.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`),part}var init_quote_header=__esm({"node_modules/@smithy/core/dist-es/submodules/serde/quote-header.js"(){}});function range(v,min,max){let _v=Number(v);if(_v<min||_v>max)throw new Error(`Value ${_v} out of range [${min}, ${max}]`)}var ddd,mmm,time,date,year,RFC3339_WITH_OFFSET2,IMF_FIXDATE_NATIVE,IMF_FIXDATE2,RFC_850_DATE2,ASC_TIME2,months,_parseEpochTimestamp,_parseRfc3339DateTimeWithOffset,_parseRfc7231DateTime,init_schema_date_utils=__esm({"node_modules/@smithy/core/dist-es/submodules/serde/schema-serde-lib/schema-date-utils.js"(){ddd="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",mmm="(Jan|Fe\
|
|
188
|
+
b|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",time="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",date="(\\d?\\d)",year="(\\d{4})",RFC3339_WITH_OFFSET2=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),IMF_FIXDATE_NATIVE=/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (?:0[1-9]|[12]\d|3[01]) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [1-9]\d{3} (?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d GMT$/,IMF_FIXDATE2=new RegExp(`^${ddd}, ${date} ${mmm} ${year} ${time} GMT$`),RFC_850_DATE2=
|
|
189
|
+
new RegExp(`^${ddd}, ${date}-${mmm}-(\\d\\d) ${time} GMT$`),ASC_TIME2=new RegExp(`^${ddd} ${mmm} ( [1-9]|\\d\\d) ${time} ${year}$`),months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],_parseEpochTimestamp=value=>{if(value==null)return;let num=NaN;if(typeof value=="number")num=value;else if(typeof value=="string"){if(!/^-?\d*\.?\d+$/.test(value))throw new TypeError("parseEpochTimestamp - numeric string invalid.");num=Number.parseFloat(value)}else typeof value=="object"&&
|
|
190
|
+
value.tag===1&&(num=value.value);if(isNaN(num)||Math.abs(num)===1/0)throw new TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(num*1e3))},_parseRfc3339DateTimeWithOffset=value=>{if(value==null)return;if(typeof value!="string")throw new TypeError("RFC3339 timestamps must be strings");let matches=RFC3339_WITH_OFFSET2.exec(value);if(!matches)throw new TypeError(`Invalid RFC3339 timestamp format ${value}`);let[,yearStr,monthStr,dayStr,hours,minutes,seconds,,ms,offsetStr]=matches;
|
|
191
|
+
range(monthStr,1,12),range(dayStr,1,31),range(hours,0,23),range(minutes,0,59),range(seconds,0,60);let date2=new Date(Date.UTC(Number(yearStr),Number(monthStr)-1,Number(dayStr),Number(hours),Number(minutes),Number(seconds),Number(ms)?Math.round(parseFloat(`0.${ms}`)*1e3):0));if(date2.setUTCFullYear(Number(yearStr)),offsetStr.toUpperCase()!="Z"){let[,sign2,offsetH,offsetM]=/([+-])(\d\d):(\d\d)/.exec(offsetStr)||[void 0,"+",0,0],scalar=sign2==="-"?1:-1;date2.setTime(date2.getTime()+scalar*(Number(offsetH)*
|
|
192
|
+
60*60*1e3+Number(offsetM)*60*1e3))}return date2},_parseRfc7231DateTime=value=>{if(value==null)return;if(typeof value!="string")throw new TypeError("RFC7231 timestamps must be strings.");if(IMF_FIXDATE_NATIVE.test(value))return new Date(value);let day,month,year2,hour,minute,second,fraction,matches;if((matches=IMF_FIXDATE2.exec(value))?[,day,month,year2,hour,minute,second,fraction]=matches:(matches=RFC_850_DATE2.exec(value))?([,day,month,year2,hour,minute,second,fraction]=matches,year2=(Number(year2)+
|
|
193
|
+
1900).toString()):(matches=ASC_TIME2.exec(value))&&([,month,day,hour,minute,second,fraction,year2]=matches),year2&&second){let timestamp=Date.UTC(Number(year2),months.indexOf(month),Number(day),Number(hour),Number(minute),Number(second),fraction?Math.round(parseFloat(`0.${fraction}`)*1e3):0);range(day,1,31),range(hour,0,23),range(minute,0,59),range(second,0,60);let date2=new Date(timestamp);return date2.setUTCFullYear(Number(year2)),date2}throw new TypeError(`Invalid RFC7231 date-time value ${value}\
|
|
194
|
+
.`)}}});function splitEvery(value,delimiter,numDelimiters){if(numDelimiters<=0||!Number.isInteger(numDelimiters))throw new Error("Invalid number of delimiters ("+numDelimiters+") for splitEvery.");let segments=value.split(delimiter);if(numDelimiters===1)return segments;let compoundSegments=[],currentSegment="";for(let i=0;i<segments.length;i++)currentSegment===""?currentSegment=segments[i]:currentSegment+=delimiter+segments[i],(i+1)%numDelimiters===0&&(compoundSegments.push(currentSegment),currentSegment=
|
|
195
|
+
"");return currentSegment!==""&&compoundSegments.push(currentSegment),compoundSegments}var init_split_every=__esm({"node_modules/@smithy/core/dist-es/submodules/serde/split-every.js"(){}});var splitHeader,init_split_header=__esm({"node_modules/@smithy/core/dist-es/submodules/serde/split-header.js"(){splitHeader=value=>{let z=value.length,values=[],withinQuotes=!1,escaped=!1,anchor=0;for(let i=0;i<z;++i){let char=value[i];switch(char){case'"':escaped||(withinQuotes=!withinQuotes);break;case",":withinQuotes||(values.push(value.slice(anchor,i)),anchor=i+1);break;default:}escaped=char==="\\"&&!escaped}return values.push(value.slice(anchor)),values.map(v=>{v=v.trim();let z2=v.length;return z2<
|
|
196
|
+
2?v:v[0]==='"'&&v[z2-1]==='"'?(v=v.slice(1,z2-1),v.replace(/\\(["\\])/g,"$1")):v.replace(/\\"/g,'"')})}}});function nv(input){return new NumericValue(String(input),"bigDecimal")}var format,NumericValue,init_NumericValue=__esm({"node_modules/@smithy/core/dist-es/submodules/serde/value/NumericValue.js"(){format=/^-?((0|[1-9]\d*)(\.\d+)?|\.\d+)([eE][+-]?\d+)?$/,NumericValue=class _NumericValue{string;type;constructor(string,type){if(this.string=string,this.type=type,!format.test(string))throw new Error(`@smithy/core/serde - NumericValue string must conform to the Smithy bigDecimal format. Received: "${string}\
|
|
196
197
|
"`)}toString(){return this.string}static[Symbol.hasInstance](object){if(!object||typeof object!="object")return!1;let _nv=object;return _NumericValue.prototype.isPrototypeOf(object)||_nv.type==="bigDecimal"&&format.test(_nv.string)}}}});function fromHex(encoded){if(encoded.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let out=new Uint8Array(encoded.length/2);for(let i=0;i<encoded.length;i+=2){let encodedByte=encoded.slice(i,i+2).toLowerCase();if(encodedByte in HEX_TO_SHORT)out[i/2]=HEX_TO_SHORT[encodedByte];else throw new Error(`Cannot decode unrecognized sequence ${encodedByte} as hexadecimal`)}return out}function toHex(bytes){let out="";for(let i=0;i<bytes.byteLength;i++)out+=SHORT_TO_HEX[bytes[i]];
|
|
197
198
|
return out}var SHORT_TO_HEX,HEX_TO_SHORT,init_hex_encoding=__esm({"node_modules/@smithy/core/dist-es/submodules/serde/util-hex-encoding/hex-encoding.js"(){SHORT_TO_HEX={},HEX_TO_SHORT={};for(let i=0;i<256;i++){let encodedByte=i.toString(16).toLowerCase();encodedByte.length===1&&(encodedByte=`0${encodedByte}`),SHORT_TO_HEX[i]=encodedByte,HEX_TO_SHORT[encodedByte]=i}}});import{ReadStream,fstatSync,lstatSync}from"node:fs";var calculateBodyLength,init_calculateBodyLength=__esm({"node_modules/@smithy/core/dist-es/submodules/serde/util-body-length/calculateBodyLength.js"(){calculateBodyLength=body=>{if(!body)return 0;if(typeof body=="string")return Buffer.byteLength(body);if(typeof body.byteLength=="number")return body.byteLength;if(typeof body.size=="number")return body.size;if(typeof body.start=="number"&&typeof body.end=="number")return body.end+1-body.start;if(body instanceof
|
|
198
199
|
ReadStream){if(body.path!=null)return lstatSync(body.path).size;if(typeof body.fd=="number")return fstatSync(body.fd).size}throw new Error(`Body Length computation failed for ${body}`)}}});var toUint8Array,init_toUint8Array=__esm({"node_modules/@smithy/core/dist-es/submodules/serde/util-utf8/toUint8Array.js"(){init_fromUtf8();toUint8Array=data=>data instanceof Uint8Array?data:typeof data=="string"?fromUtf8(data):ArrayBuffer.isView(data)?new Uint8Array(data.buffer,data.byteOffset,data.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(data)}});function concatBytes(arrays,length){if(length===void 0){length=0;for(let bytes of arrays)length+=bytes.byteLength}let result=new Uint8Array(length),offset=0;for(let buf of arrays)result.set(buf,offset),offset+=buf.byteLength;return result}var init_concatBytes=__esm({"node_modules/@smithy/core/dist-es/submodules/serde/concatBytes.js"(){}});var deserializerMiddleware,findHeader2,init_deserializerMiddleware=__esm({"node_modules/@smithy/core/dist-es/submodules/serde/middleware-serde/deserializerMiddleware.js"(){init_transport();deserializerMiddleware=(options,deserializer)=>(next,context)=>async args=>{let{response}=await next(args);try{let parsed=await deserializer(response,options);return{response,output:parsed}}catch(error2){if(Object.defineProperty(error2,"$response",{value:response,enumerable:!1,writable:!1,configurable:!1}),!("\
|
|
@@ -264,7 +265,7 @@ hasNativeCrypto2=(()=>{try{return createHash4("sha256"),!0}catch{return!1}})(),S
|
|
|
264
265
|
secret&&(this.secret=toUint8Array(secret))}update(data){if(this.finished)throw new Error("Attempted to update an already finished HMAC.");if(this.fallback){this.fallback.update(data);return}this.pending.push(data.slice()),this.pendingBytes+=data.byteLength,this.pendingBytes>=MAX_PENDING_BYTES&&this.switchToFallback()}async digest(){if(this.fallback)return this.fallback.digest();if(this.secret&&this.finished)throw new Error("Attempted to digest an already finished HMAC.");let data=concatBytes(this.
|
|
265
266
|
pending);if(subtle){if(this.secret){this.finished=!0;let key=await subtle.importKey("raw",this.secret,{name:"HMAC",hash:"SHA-256"},!1,["sign"]),sig=await subtle.sign("HMAC",key,data);return new Uint8Array(sig)}let hash=await subtle.digest("SHA-256",data);return new Uint8Array(hash)}let sha256=new Sha256Js(this.secret);return sha256.update(data),sha256.digest()}reset(){this.pending=[],this.pendingBytes=0,this.fallback=void 0,this.finished=!1}switchToFallback(){let sha256Js=new Sha256Js(this.secret);
|
|
266
267
|
for(let chunk of this.pending)sha256Js.update(chunk);this.fallback=sha256Js,this.pending=[],this.pendingBytes=0}}}});var checksum_exports={};__export(checksum_exports,{Crc32:()=>Crc32Node,Crc32Js:()=>Crc32Js,Crc32Node:()=>Crc32Node,Md5:()=>Md5Node,Md5Js:()=>Md5Js,Md5Node:()=>Md5Node,Sha256:()=>Sha256Node,Sha256Js:()=>Sha256Js,Sha256Node:()=>Sha256Node,Sha256WebCrypto:()=>Sha256WebCrypto,blobHasher:()=>blobHasher,blobReader:()=>blobReader,fileStreamHasher:()=>fileStreamHasher,readableStreamHasher:()=>readableStreamHasher});var init_checksum2=__esm({"node_modules/@smithy/core/dist-es/submodules/checksum/index.js"(){
|
|
267
|
-
init_blobHasher();init_fileStreamHasher();init_readableStreamHasher();init_Md5Js();init_Md5Node();init_Crc32Js();init_Crc32Node();init_Sha256Js();init_Sha256Node();init_Sha256WebCrypto();init_chunked_blob_reader()}});export{require_dist_cjs,getSmithyContext,hasOwn,HttpRequest,HttpResponse,isValidHostLabel,isValidHostname,normalizeProvider,parseQueryString,parseUrl,init_transport,
|
|
268
|
-
|
|
268
|
+
init_blobHasher();init_fileStreamHasher();init_readableStreamHasher();init_Md5Js();init_Md5Node();init_Crc32Js();init_Crc32Node();init_Sha256Js();init_Sha256Node();init_Sha256WebCrypto();init_chunked_blob_reader()}});export{fromBase64,fromUtf8,toBase64,toUtf8,require_dist_cjs,getSmithyContext,hasOwn,HttpRequest,HttpResponse,isValidHostLabel,isValidHostname,normalizeProvider,parseQueryString,parseUrl,init_transport,expectUnion,dateToUtcString,parseRfc3339DateTimeWithOffset,parseRfc7231DateTime,parseEpochTimestamp,LazyJsonString,quoteHeader,_parseEpochTimestamp,_parseRfc3339DateTimeWithOffset,_parseRfc7231DateTime,splitEvery,splitHeader,NumericValue,nv,fromHex,toHex,calculateBodyLength,ProviderError,booleanSelector,
|
|
269
|
+
SelectorType,loadConfig,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,Client,deref,getSchemaSerdePlugin,translateTraits,NormalizedSchema,TypeRegistry,schema_exports,init_schema,Command,createAggregatedClient,ServiceException,decorateServiceException,loadConfigsForDefaultMode,emitWarningIfUnsupportedVersion,getDefaultExtensionConfiguration,resolveDefaultRuntimeConfig,getValueFromTextNode,NoOpLogger,makeBuilder,client_exports,init_client2 as init_client,REGION_ENV_NAME,
|
|
269
270
|
REGION_INI_NAME,NODE_REGION_CONFIG_OPTIONS,NODE_REGION_CONFIG_FILE_OPTIONS,resolveRegionConfig,resolveDefaultsModeConfig,config_exports,init_config2 as init_config,resolveParams,BinaryDecisionDiagram,EndpointCache,EndpointError,customEndpointFunctions,isIpAddress,decideEndpoint,resolveEndpoint,resolveEndpointConfig,getEndpointPlugin,endpoints_exports,init_endpoints,sdkStreamMixin2 as sdkStreamMixin,writeKey,Uint8ArrayBlobAdapter,v4,generateIdempotencyToken,serde_exports,init_serde,Crc32Node,Sha256Node,
|
|
270
271
|
checksum_exports,init_checksum2 as init_checksum};
|