@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
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import * as fs from "node:fs";
|
|
7
7
|
import * as path from "node:path";
|
|
8
8
|
import { Agent } from "@earendil-works/pi-agent-core";
|
|
9
|
-
import {
|
|
9
|
+
import { clampThinkingLevel, modelsAreEqual } from "@earendil-works/pi-ai";
|
|
10
10
|
import { isRetryableAssistantError, } from "@earendil-works/pi-ai/compat";
|
|
11
11
|
import * as TuiLayouts from "@earendil-works/pi-tui";
|
|
12
12
|
import { CombinedAutocompleteProvider, Container, fuzzyFilter, getCapabilities, hyperlink, Markdown, matchesKey, onCapabilitiesChange, Spacer, setCapabilityOverrides, setKeybindings, Text, TruncatedText, TuiAltScreen, TuiMainScreen, visibleWidth, } from "@earendil-works/pi-tui";
|
|
@@ -43,22 +43,29 @@ import { isInstallTelemetryEnabled } from "../../core/telemetry.js";
|
|
|
43
43
|
import { withBuiltInRenderers } from "../../core/tools/renderers/index.js";
|
|
44
44
|
import { hasTrustRequiringProjectResources, ProjectTrustStore } from "../../core/trust-manager.js";
|
|
45
45
|
import { getUsageCostBreakdown } from "../../core/usage-totals.js";
|
|
46
|
+
import { getBranchSelection, isVirtualModel } from "../../core/virtual-models.js";
|
|
46
47
|
import { loadMcpConfig } from "../../extensions/mcp/config.js";
|
|
48
|
+
import { bindClaudeUsageReconnect } from "../../extensions/usage/account-reconnect.js";
|
|
49
|
+
import { readClaudeUsage } from "../../extensions/usage/overview.js";
|
|
47
50
|
import { resolveAdhdSessionMode } from "../../humain/adhd/index.js";
|
|
48
51
|
import { renderHumainCodeIcon } from "../../humain/brand-logo.js";
|
|
49
52
|
import { CAVEMAN_LEVELS, getCavemanDefaultMode, resolveCavemanSessionMode } from "../../humain/caveman/index.js";
|
|
50
53
|
import { bindFlowAccountsHost, createFlowAccountReporter, FLOW_ACCOUNT_PERSISTENCE_NOTICE, flowUsageTargets, formatFlowAccountAdvanced, listFlowAccountMetadata, nodeLabelContainsStoredKey, readFlowNodeFallbackState, refreshFlowCatalog, updateFlowNodeFallback, } from "../../humain/flow-accounts-host.js";
|
|
51
54
|
import { HUMAIN_FUSE_PROVIDER } from "../../humain/fuse-provider.js";
|
|
52
55
|
import { HCODE_SESSION_ONLY_NOTICE } from "../../humain/hcode/account.js";
|
|
56
|
+
import { sameReference } from "../../humain/hcode/account-store.js";
|
|
57
|
+
import { watchHcodeCatalog } from "../../humain/hcode/catalog-watch.js";
|
|
58
|
+
import { hcodeDisplayName } from "../../humain/hcode/environment.js";
|
|
53
59
|
import { HCODE_PROVIDER } from "../../humain/hcode/http.js";
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
60
|
+
import { HCODE_LOGIN_MISMATCH_DETAILS, hcodeEmptyCatalogNotice, hcodeEmptyCatalogReason, hcodeLoginAvailability, hcodeSignedInElsewhereNotice, } from "../../humain/hcode/login-copy.js";
|
|
61
|
+
import { availableHcodeSelection, HCODE_SELECTION_CHANGED_MESSAGE, HCODE_UNSUPPORTED_THINKING_MESSAGE, } from "../../humain/hcode/selection.js";
|
|
56
62
|
import { ACCOUNT_LOGIN_LABEL, API_KEY_LOGIN_LABEL, HUMAIN_LOGIN_LABEL, HUMAIN_SHIMMER_COLORS, humainLoginProviders, topLevelLoginOptions, } from "../../humain/login-menu.js";
|
|
57
63
|
import { RUNTIME_MODES, readDefaultMode, resolveSessionMode as resolvePonytailSessionMode, } from "../../humain/ponytail/index.js";
|
|
58
|
-
import { raceWithAbortSignal } from "../../utils/abort.js";
|
|
64
|
+
import { raceWithAbortSignal, timerSignal } from "../../utils/abort.js";
|
|
59
65
|
import { getChangelogPath, getNewEntries, normalizeChangelogLinks, parseChangelog } from "../../utils/changelog.js";
|
|
60
66
|
import { copyToClipboard, readClipboardFilePaths, readClipboardText } from "../../utils/clipboard.js";
|
|
61
67
|
import { readClipboardImage, writePastedImage } from "../../utils/clipboard-image.js";
|
|
68
|
+
import { flushStdout } from "../../utils/flush-stdout.js";
|
|
62
69
|
import { parseGitUrl } from "../../utils/git.js";
|
|
63
70
|
import { ensurePngTranscoderOnFirstUse } from "../../utils/image-convert.js";
|
|
64
71
|
import { getCwdRelativePath, shortenHomePath } from "../../utils/paths.js";
|
|
@@ -95,7 +102,7 @@ import { ScopedModelsSelectorComponent } from "./components/scoped-models-select
|
|
|
95
102
|
import { SessionSelectorComponent } from "./components/session-selector.js";
|
|
96
103
|
import { SettingsSelectorComponent } from "./components/settings-selector.js";
|
|
97
104
|
import { SkillInvocationMessageComponent } from "./components/skill-invocation-message.js";
|
|
98
|
-
import {
|
|
105
|
+
import { BranchSummaryStatusIndicator, CompactionStatusIndicator, IdleStatus, RetryStatusIndicator, WorkingStatusIndicator, } from "./components/status-indicator.js";
|
|
99
106
|
import { ThemedText } from "./components/themed-text.js";
|
|
100
107
|
import { ThinkingSelectorComponent } from "./components/thinking-selector.js";
|
|
101
108
|
import { ToolExecutionComponent } from "./components/tool-execution.js";
|
|
@@ -105,9 +112,9 @@ import { TrustSelectorComponent } from "./components/trust-selector.js";
|
|
|
105
112
|
import { UserMessageComponent } from "./components/user-message.js";
|
|
106
113
|
import { UserMessageSelectorComponent } from "./components/user-message-selector.js";
|
|
107
114
|
import { editInExternalEditor } from "./external-editor.js";
|
|
108
|
-
import { refreshModelCatalogs, refreshStartupModelCatalogs } from "./model-catalog-refresh.js";
|
|
115
|
+
import { checkWatchedHcodeCatalog, refreshModelCatalogs, refreshStartupModelCatalogs, retryHcodeCatalog, } from "./model-catalog-refresh.js";
|
|
109
116
|
import { getModelSearchText } from "./model-search.js";
|
|
110
|
-
import { formatOAuthAccountOption, formatOAuthAccountResetTime, } from "./oauth-account-format.js";
|
|
117
|
+
import { formatOAuthAccountOption, formatOAuthAccountResetTime, formatOAuthAccountUsage, } from "./oauth-account-format.js";
|
|
111
118
|
import { ProgramStatusReporter } from "./program-status-reporter.js";
|
|
112
119
|
import { shareSession } from "./session-share.js";
|
|
113
120
|
import { DEFAULT_THEME_NAME, getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getSelectListTheme, getThemeByName, onThemeChange, setRegisteredThemes, stopThemeWatcher, Theme, theme, } from "./theme/theme.js";
|
|
@@ -207,6 +214,13 @@ function llamaCppPostLoginGuidance(actionLabel, loadedModelCount) {
|
|
|
207
214
|
: `${actionLabel}. Use /model to select a loaded llama.cpp model, or /llama to manage models.`;
|
|
208
215
|
}
|
|
209
216
|
const RADIUS_LOGIN_INTRO = "Radius is a service by Earendil Works";
|
|
217
|
+
// Bounds a stalled HUMAIN Code sign-in check; its config and discovery requests time out sooner.
|
|
218
|
+
const HCODE_LOGIN_CHECK_TIMEOUT_MS = 10_000;
|
|
219
|
+
// Inline spinner for a /login row that is waiting on its connection check.
|
|
220
|
+
const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
221
|
+
const SPINNER_INTERVAL_MS = 80;
|
|
222
|
+
// Footer status key for the signed-in-without-models state.
|
|
223
|
+
const HCODE_STATUS_KEY = "humain-code";
|
|
210
224
|
const EXTERNAL_SOURCE_NOTICE = "External sources are read-only in /accounts. Change the runtime, environment or configuration outside /accounts. Runtime overrides stored selection; stored credentials block models.json; models.json precedes ambient credentials. Selection is global. Stored configuration references cannot be replaced here; use /logout to explicitly remove the stored credential before selecting an account.";
|
|
211
225
|
const AUTH_TYPE_ORDER = { oauth: 0, api_key: 1 };
|
|
212
226
|
function createFuzzyAutocompleteItems(items, prefix, getSearchText, toAutocompleteItem) {
|
|
@@ -247,6 +261,41 @@ function formatLoginProviderCompletionDescription(provider) {
|
|
|
247
261
|
.join("/");
|
|
248
262
|
return provider.name === provider.id ? authTypes : `${provider.name} · ${authTypes}`;
|
|
249
263
|
}
|
|
264
|
+
/** Assistant diagnostics that list reasoning a provider withheld from the model, by diagnostic type. */
|
|
265
|
+
const REASONING_DROP_DIAGNOSTICS = new Map([
|
|
266
|
+
[
|
|
267
|
+
"anthropic_input_transformations",
|
|
268
|
+
{ provider: "Anthropic", droppedType: "thinking_dropped", noun: ["thinking block", "thinking blocks"] },
|
|
269
|
+
],
|
|
270
|
+
[
|
|
271
|
+
"openai_input_transformations",
|
|
272
|
+
{ provider: "OpenAI", droppedType: "reasoning", noun: ["reasoning item", "reasoning items"] },
|
|
273
|
+
],
|
|
274
|
+
]);
|
|
275
|
+
/** Count the reasoning blocks a provider reported as withheld from the request that produced `message`. */
|
|
276
|
+
function getDroppedReasoning(message) {
|
|
277
|
+
for (const diagnostic of message.diagnostics ?? []) {
|
|
278
|
+
const kind = REASONING_DROP_DIAGNOSTICS.get(diagnostic.type);
|
|
279
|
+
if (!kind)
|
|
280
|
+
continue;
|
|
281
|
+
// Session data: diagnostics details are untyped JSON.
|
|
282
|
+
const transformations = diagnostic.details?.transformations;
|
|
283
|
+
if (!Array.isArray(transformations))
|
|
284
|
+
continue;
|
|
285
|
+
const dropped = transformations.filter((transformation) => typeof transformation === "object" &&
|
|
286
|
+
transformation !== null &&
|
|
287
|
+
transformation.type === kind.droppedType);
|
|
288
|
+
if (dropped.length === 0)
|
|
289
|
+
continue;
|
|
290
|
+
const reasons = new Set();
|
|
291
|
+
for (const transformation of dropped) {
|
|
292
|
+
if (typeof transformation.reason === "string")
|
|
293
|
+
reasons.add(transformation.reason);
|
|
294
|
+
}
|
|
295
|
+
return { diagnostic: kind, count: dropped.length, reasons: [...reasons] };
|
|
296
|
+
}
|
|
297
|
+
return undefined;
|
|
298
|
+
}
|
|
250
299
|
export class InteractiveMode {
|
|
251
300
|
extensionOverlays = new Map();
|
|
252
301
|
runtimeHost;
|
|
@@ -281,7 +330,6 @@ export class InteractiveMode {
|
|
|
281
330
|
onInputCallback;
|
|
282
331
|
pendingUserInputs = [];
|
|
283
332
|
activeStatusIndicator = undefined;
|
|
284
|
-
adaptiveStatus;
|
|
285
333
|
activeWorkingIndicatorEmbedded = false;
|
|
286
334
|
idleStatus = new IdleStatus();
|
|
287
335
|
workingMessage = undefined;
|
|
@@ -297,6 +345,10 @@ export class InteractiveMode {
|
|
|
297
345
|
startupNoticesShown = false;
|
|
298
346
|
/** The /model save-as-default tip is shown once per run. */
|
|
299
347
|
modelSaveTipShown = false;
|
|
348
|
+
/** Background re-check of an empty HUMAIN Code catalog after sign-in, whether its last load failed, and its status line. */
|
|
349
|
+
hcodeCatalogWatch;
|
|
350
|
+
hcodeCatalogFailed = false;
|
|
351
|
+
hcodeCatalogStatus;
|
|
300
352
|
anthropicSubscriptionWarningShown = false;
|
|
301
353
|
// Status line tracking (for mutating immediately-sequential status updates)
|
|
302
354
|
lastStatusSpacer = undefined;
|
|
@@ -340,6 +392,7 @@ export class InteractiveMode {
|
|
|
340
392
|
shutdownRequested = false;
|
|
341
393
|
/** Releases the Flow accounts host bound to the current session's registry. */
|
|
342
394
|
flowAccountsRelease;
|
|
395
|
+
claudeUsageReconnectRelease;
|
|
343
396
|
/** Set while a Flow account interaction is open; cancels its login dialogs when the host aborts. */
|
|
344
397
|
activeFlowAccountsSignal;
|
|
345
398
|
/** Session-bound usage reporter; created lazily and cancelled when the host is released. */
|
|
@@ -395,11 +448,14 @@ export class InteractiveMode {
|
|
|
395
448
|
this.options = { ...options, tuiMode };
|
|
396
449
|
this.autoTrustOnReloadCwd = options.autoTrustOnReloadCwd;
|
|
397
450
|
this.runtimeHost.setBeforeSessionInvalidate(() => {
|
|
451
|
+
// The next session may bring a new model runtime; its account starts without the re-check.
|
|
452
|
+
this.hcodeCatalogWatch?.stop();
|
|
398
453
|
this.resetExtensionUI();
|
|
399
454
|
});
|
|
400
455
|
this.runtimeHost.setRebindSession(async () => {
|
|
401
456
|
await this.rebindCurrentSession({ renderBeforeBind: true });
|
|
402
457
|
this.themeController.applyFromSettings();
|
|
458
|
+
this.showRuntimeDiagnostics(this.runtimeHost.takeUnreportedDiagnostics());
|
|
403
459
|
});
|
|
404
460
|
this.version = VERSION;
|
|
405
461
|
this.renderer = createInteractiveTui({
|
|
@@ -537,11 +593,14 @@ export class InteractiveMode {
|
|
|
537
593
|
if (loginCommand) {
|
|
538
594
|
loginCommand.getArgumentCompletions = (prefix) => {
|
|
539
595
|
const providers = getLoginProviderCompletionOptions(this.getLoginProviderOptions());
|
|
540
|
-
|
|
596
|
+
const items = createFuzzyAutocompleteItems(providers, prefix, getLoginProviderSearchText, (provider) => ({
|
|
541
597
|
value: provider.id,
|
|
542
598
|
label: provider.id,
|
|
543
599
|
description: formatLoginProviderCompletionDescription(provider),
|
|
544
|
-
}));
|
|
600
|
+
})) ?? [];
|
|
601
|
+
if ("status".startsWith(prefix.trim().toLowerCase()))
|
|
602
|
+
items.push({ value: "status", label: "status", description: "HUMAIN Code sign-in status" });
|
|
603
|
+
return items.length ? items : null;
|
|
545
604
|
};
|
|
546
605
|
}
|
|
547
606
|
const accountsCommand = slashCommands.find((command) => command.name === "accounts");
|
|
@@ -697,6 +756,7 @@ export class InteractiveMode {
|
|
|
697
756
|
});
|
|
698
757
|
nextUi.setClearOnShrink(clearOnShrink);
|
|
699
758
|
nextUi.onDebug = onDebug;
|
|
759
|
+
nextUi.setSuspendSignalHandler(() => this.handleCtrlZ());
|
|
700
760
|
if (nextUi instanceof TuiMainScreen && this.mainScreenRenderState) {
|
|
701
761
|
nextUi.restoreRenderState(this.mainScreenRenderState);
|
|
702
762
|
}
|
|
@@ -766,6 +826,8 @@ export class InteractiveMode {
|
|
|
766
826
|
this.ui.invalidate();
|
|
767
827
|
this.ui.requestRender();
|
|
768
828
|
});
|
|
829
|
+
// An external SIGTSTP (kill -TSTP) restores the terminal like Ctrl+Z (#12272).
|
|
830
|
+
this.ui.setSuspendSignalHandler(() => this.handleCtrlZ());
|
|
769
831
|
// Start the UI before initializing extensions so session_start handlers can use interactive dialogs
|
|
770
832
|
this.ui.start();
|
|
771
833
|
this.isInitialized = true;
|
|
@@ -899,6 +961,15 @@ export class InteractiveMode {
|
|
|
899
961
|
*/
|
|
900
962
|
async run() {
|
|
901
963
|
await this.init();
|
|
964
|
+
const startupSession = this.session;
|
|
965
|
+
const hcode = startupSession.modelRuntime.hcode;
|
|
966
|
+
const savedSignIn = hcode.account.status(hcode.environment.id);
|
|
967
|
+
if (!savedSignIn) {
|
|
968
|
+
const elsewhere = hcodeSignedInElsewhereNotice(hcode.environment.id, this.session.modelRuntime.hcodeSignedInElsewhere());
|
|
969
|
+
if (elsewhere)
|
|
970
|
+
this.showStatus(elsewhere);
|
|
971
|
+
}
|
|
972
|
+
let restoringHcode;
|
|
902
973
|
if (!(process.env[ENV_OFFLINE] || process.env.PI_OFFLINE)) {
|
|
903
974
|
const controller = new AbortController();
|
|
904
975
|
const timeout = setTimeout(() => controller.abort(), 15_000);
|
|
@@ -906,6 +977,27 @@ export class InteractiveMode {
|
|
|
906
977
|
.then(() => this.updateAvailableProviderCount())
|
|
907
978
|
.catch(() => { })
|
|
908
979
|
.finally(() => clearTimeout(timeout));
|
|
980
|
+
// Read the saved account's catalog without holding open a login or model selector.
|
|
981
|
+
const runtime = startupSession.modelRuntime;
|
|
982
|
+
if (savedSignIn && !runtime.hcodeCatalogLoaded()) {
|
|
983
|
+
const saved = this.options.restoreSavedHcodeModel && !startupSession.agent.selectedModel
|
|
984
|
+
? (getBranchSelection(startupSession.sessionManager.getBranch(), (provider, id) => runtime.getModel(provider, id)) ?? {
|
|
985
|
+
provider: this.settingsManager.getDefaultProvider(),
|
|
986
|
+
modelId: this.settingsManager.getDefaultModel(),
|
|
987
|
+
})
|
|
988
|
+
: undefined;
|
|
989
|
+
const savedId = saved?.provider === HCODE_PROVIDER ? saved.modelId : undefined;
|
|
990
|
+
const refresh = this.refreshSavedHcodeCatalog(savedId);
|
|
991
|
+
if (savedId)
|
|
992
|
+
restoringHcode = refresh;
|
|
993
|
+
}
|
|
994
|
+
// The readiness check outlives unrelated provider refreshes.
|
|
995
|
+
const readiness = this.checkHcodeLogin(AbortSignal.timeout(15_000));
|
|
996
|
+
if (savedSignIn)
|
|
997
|
+
void this.showStartupHcodeSignIn(savedSignIn, readiness);
|
|
998
|
+
}
|
|
999
|
+
else if (savedSignIn) {
|
|
1000
|
+
this.showStatus(`${hcodeDisplayName(hcode.environment.id)}: signed in · offline`);
|
|
909
1001
|
}
|
|
910
1002
|
// Start version check asynchronously
|
|
911
1003
|
checkForNewPiVersion(this.version).then((newRelease) => {
|
|
@@ -935,17 +1027,7 @@ export class InteractiveMode {
|
|
|
935
1027
|
});
|
|
936
1028
|
// Show startup warnings
|
|
937
1029
|
const { migratedProviders, startupDiagnostics, modelFallbackMessage, initialMessage, initialImages, initialMessages, } = this.options;
|
|
938
|
-
|
|
939
|
-
if (diagnostic.type === "error") {
|
|
940
|
-
this.showError(diagnostic.message);
|
|
941
|
-
}
|
|
942
|
-
else if (diagnostic.type === "warning") {
|
|
943
|
-
this.showWarning(diagnostic.message);
|
|
944
|
-
}
|
|
945
|
-
else {
|
|
946
|
-
this.showStatus(diagnostic.message);
|
|
947
|
-
}
|
|
948
|
-
}
|
|
1030
|
+
this.showRuntimeDiagnostics(startupDiagnostics ?? []);
|
|
949
1031
|
if (migratedProviders && migratedProviders.length > 0) {
|
|
950
1032
|
this.showWarning(`Migrated credentials to auth.json: ${migratedProviders.join(", ")}`);
|
|
951
1033
|
}
|
|
@@ -953,7 +1035,7 @@ export class InteractiveMode {
|
|
|
953
1035
|
if (modelsJsonError) {
|
|
954
1036
|
this.showError(`models.json error: ${modelsJsonError}`);
|
|
955
1037
|
}
|
|
956
|
-
if (modelFallbackMessage) {
|
|
1038
|
+
if (modelFallbackMessage && !restoringHcode) {
|
|
957
1039
|
this.showWarning(modelFallbackMessage);
|
|
958
1040
|
}
|
|
959
1041
|
const crash = takeUnnotifiedCrash();
|
|
@@ -962,7 +1044,9 @@ export class InteractiveMode {
|
|
|
962
1044
|
this.showWarning(`${APP_TITLE} crashed on ${when} (${crash.message}). Run /bug to export a report zip; the crash details are attached automatically.`);
|
|
963
1045
|
}
|
|
964
1046
|
void this.maybeWarnAboutAnthropicSubscriptionAuth();
|
|
965
|
-
//
|
|
1047
|
+
// Initial and typed prompts use the saved model, not an uninitialized selection.
|
|
1048
|
+
if (initialMessage || initialMessages?.length)
|
|
1049
|
+
await restoringHcode;
|
|
966
1050
|
if (initialMessage) {
|
|
967
1051
|
try {
|
|
968
1052
|
await this.session.prompt(initialMessage, { images: initialImages });
|
|
@@ -986,6 +1070,8 @@ export class InteractiveMode {
|
|
|
986
1070
|
// Main interactive loop
|
|
987
1071
|
while (true) {
|
|
988
1072
|
const userInput = await this.getUserInput();
|
|
1073
|
+
if (this.session === startupSession && !startupSession.agent.selectedModel)
|
|
1074
|
+
await restoringHcode;
|
|
989
1075
|
const session = this.session;
|
|
990
1076
|
const messages = session.messages;
|
|
991
1077
|
try {
|
|
@@ -1005,6 +1091,57 @@ export class InteractiveMode {
|
|
|
1005
1091
|
}
|
|
1006
1092
|
}
|
|
1007
1093
|
}
|
|
1094
|
+
async refreshSavedHcodeCatalog(savedId) {
|
|
1095
|
+
const session = this.session;
|
|
1096
|
+
const runtime = session.modelRuntime;
|
|
1097
|
+
const initialScope = session.scopedModels;
|
|
1098
|
+
const reference = runtime.hcode.account.status(runtime.hcode.environment.id);
|
|
1099
|
+
const isCurrent = () => this.session === session &&
|
|
1100
|
+
sameReference(runtime.hcode.account.status(runtime.hcode.environment.id), reference);
|
|
1101
|
+
const signal = AbortSignal.timeout(15_000);
|
|
1102
|
+
const result = await retryHcodeCatalog(runtime, signal).catch(() => undefined);
|
|
1103
|
+
if (!isCurrent())
|
|
1104
|
+
return;
|
|
1105
|
+
this.hcodeCatalogFailed = !result || result.aborted || result.errors.size > 0;
|
|
1106
|
+
if (this.options.restoreSavedModelScope && !this.hcodeCatalogFailed && session.scopedModels === initialScope) {
|
|
1107
|
+
const patterns = this.settingsManager.getEnabledModels();
|
|
1108
|
+
if (patterns?.length) {
|
|
1109
|
+
const { scopedModels } = resolveModelScopeFromModels(patterns, runtime.getAvailableSnapshot());
|
|
1110
|
+
session.setScopedModels(scopedModels);
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
if (savedId && !session.agent.selectedModel && !session.hasRequestedModelSelection) {
|
|
1114
|
+
const model = availableHcodeSelection(runtime, savedId);
|
|
1115
|
+
if (model) {
|
|
1116
|
+
const existing = session.sessionManager.buildSessionContext();
|
|
1117
|
+
const recorded = session.sessionManager
|
|
1118
|
+
.getBranch()
|
|
1119
|
+
.findLast((entry) => entry.type === "thinking_level_change");
|
|
1120
|
+
const requested = (existing.messages.length
|
|
1121
|
+
? recorded?.thinkingLevel
|
|
1122
|
+
: this.settingsManager.getModelThinkingLevel(model.provider, model.id)) ??
|
|
1123
|
+
this.settingsManager.getDefaultThinkingLevel() ??
|
|
1124
|
+
DEFAULT_THINKING_LEVEL;
|
|
1125
|
+
const thinkingLevel = clampThinkingLevel(model, requested);
|
|
1126
|
+
try {
|
|
1127
|
+
await session.setModel(model, { thinkingLevel, signal });
|
|
1128
|
+
if (thinkingLevel !== requested)
|
|
1129
|
+
this.showStatus(`Thinking level adjusted from ${requested} to ${thinkingLevel}.`);
|
|
1130
|
+
}
|
|
1131
|
+
catch {
|
|
1132
|
+
if (isCurrent() && !session.agent.selectedModel)
|
|
1133
|
+
this.showWarning("Couldn't restore the saved HUMAIN Code model. Use /model to retry.");
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
else {
|
|
1137
|
+
this.showWarning(this.hcodeCatalogFailed
|
|
1138
|
+
? "Signed in to HUMAIN Code, but the model list could not be loaded. Use /model to retry."
|
|
1139
|
+
: (this.options.modelFallbackMessage ??
|
|
1140
|
+
"The saved HUMAIN Code model is unavailable. Use /model to choose another."));
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
await this.updateAvailableProviderCount();
|
|
1144
|
+
}
|
|
1008
1145
|
async checkForPackageUpdates() {
|
|
1009
1146
|
if (process.env[ENV_OFFLINE] || process.env.PI_OFFLINE) {
|
|
1010
1147
|
return [];
|
|
@@ -1732,6 +1869,19 @@ export class InteractiveMode {
|
|
|
1732
1869
|
this.editor.setAutocompleteMaxVisible?.(autocompleteMaxVisible);
|
|
1733
1870
|
}
|
|
1734
1871
|
}
|
|
1872
|
+
showRuntimeDiagnostics(diagnostics) {
|
|
1873
|
+
for (const diagnostic of diagnostics) {
|
|
1874
|
+
if (diagnostic.type === "error") {
|
|
1875
|
+
this.showError(diagnostic.message);
|
|
1876
|
+
}
|
|
1877
|
+
else if (diagnostic.type === "warning") {
|
|
1878
|
+
this.showWarning(diagnostic.message);
|
|
1879
|
+
}
|
|
1880
|
+
else {
|
|
1881
|
+
this.showStatus(diagnostic.message);
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1735
1885
|
async rebindCurrentSession(options = {}) {
|
|
1736
1886
|
const session = this.session;
|
|
1737
1887
|
this.unsubscribe?.();
|
|
@@ -1770,6 +1920,7 @@ export class InteractiveMode {
|
|
|
1770
1920
|
await this.runtimeHost.dispose();
|
|
1771
1921
|
}
|
|
1772
1922
|
finally {
|
|
1923
|
+
await flushStdout();
|
|
1773
1924
|
process.exit(1);
|
|
1774
1925
|
}
|
|
1775
1926
|
}
|
|
@@ -1930,8 +2081,7 @@ export class InteractiveMode {
|
|
|
1930
2081
|
}
|
|
1931
2082
|
setEditorWorkingStatusIndicator(indicator) {
|
|
1932
2083
|
this.defaultEditor.setWorkingStatusIndicator(undefined);
|
|
1933
|
-
|
|
1934
|
-
if (indicator instanceof AdaptiveStatusIndicator || !isEmbeddedStatus(this.editor))
|
|
2084
|
+
if (!isEmbeddedStatus(this.editor))
|
|
1935
2085
|
return false;
|
|
1936
2086
|
this.editor.setWorkingStatusIndicator(indicator);
|
|
1937
2087
|
return true;
|
|
@@ -1967,16 +2117,6 @@ export class InteractiveMode {
|
|
|
1967
2117
|
}
|
|
1968
2118
|
}
|
|
1969
2119
|
showWorkingStatusIndicator() {
|
|
1970
|
-
if (this.adaptiveStatus) {
|
|
1971
|
-
if (this.activeStatusIndicator instanceof AdaptiveStatusIndicator) {
|
|
1972
|
-
this.activeStatusIndicator.setStatus(this.adaptiveStatus);
|
|
1973
|
-
return;
|
|
1974
|
-
}
|
|
1975
|
-
const indicator = new AdaptiveStatusIndicator(this.ui, this.adaptiveStatus, () => this.setToolsExpanded(false), this.workingIndicatorOptions);
|
|
1976
|
-
this.showStatusIndicator(indicator);
|
|
1977
|
-
indicator.setExpanded(this.toolOutputExpanded);
|
|
1978
|
-
return;
|
|
1979
|
-
}
|
|
1980
2120
|
const colorFn = isEmbeddedStatus(this.editor)
|
|
1981
2121
|
? (text) => (this.editor.borderColor ?? theme.getThinkingBorderColor(this.session.thinkingLevel || "off"))(text)
|
|
1982
2122
|
: undefined;
|
|
@@ -1989,7 +2129,7 @@ export class InteractiveMode {
|
|
|
1989
2129
|
this.ui.requestRender();
|
|
1990
2130
|
return;
|
|
1991
2131
|
}
|
|
1992
|
-
if (
|
|
2132
|
+
if (this.session.isStreaming && this.activeStatusIndicator?.kind !== "working") {
|
|
1993
2133
|
this.showWorkingStatusIndicator();
|
|
1994
2134
|
}
|
|
1995
2135
|
this.ui.requestRender();
|
|
@@ -2062,9 +2202,6 @@ export class InteractiveMode {
|
|
|
2062
2202
|
this.renderWidgets();
|
|
2063
2203
|
}
|
|
2064
2204
|
resetExtensionUI() {
|
|
2065
|
-
this.adaptiveStatus = undefined;
|
|
2066
|
-
if (this.activeStatusIndicator instanceof AdaptiveStatusIndicator)
|
|
2067
|
-
this.clearStatusIndicator();
|
|
2068
2205
|
this.disposeActiveSelector();
|
|
2069
2206
|
// Release first: aborting resolves pending account dialogs before their UI is hidden.
|
|
2070
2207
|
this.releaseFlowAccountsHost();
|
|
@@ -2080,6 +2217,9 @@ export class InteractiveMode {
|
|
|
2080
2217
|
this.setExtensionHeader(undefined);
|
|
2081
2218
|
this.clearExtensionWidgets();
|
|
2082
2219
|
this.footerDataProvider.clearExtensionStatuses();
|
|
2220
|
+
// The HUMAIN Code status line belongs to the account, not to an extension.
|
|
2221
|
+
if (this.hcodeCatalogStatus)
|
|
2222
|
+
this.footerDataProvider.setExtensionStatus(HCODE_STATUS_KEY, this.hcodeCatalogStatus);
|
|
2083
2223
|
this.footer.invalidate();
|
|
2084
2224
|
this.autocompleteProviderWrappers = [];
|
|
2085
2225
|
this.extensionEditorAccent = undefined;
|
|
@@ -2231,8 +2371,7 @@ export class InteractiveMode {
|
|
|
2231
2371
|
setStatus: (key, text) => this.setExtensionStatus(key, text),
|
|
2232
2372
|
setWorkingMessage: (message) => {
|
|
2233
2373
|
this.workingMessage = message;
|
|
2234
|
-
if (this.activeStatusIndicator?.kind === "working"
|
|
2235
|
-
!(this.activeStatusIndicator instanceof AdaptiveStatusIndicator)) {
|
|
2374
|
+
if (this.activeStatusIndicator?.kind === "working") {
|
|
2236
2375
|
this.activeStatusIndicator.setMessage(message ?? this.defaultWorkingMessage);
|
|
2237
2376
|
}
|
|
2238
2377
|
},
|
|
@@ -2699,6 +2838,20 @@ export class InteractiveMode {
|
|
|
2699
2838
|
}
|
|
2700
2839
|
const image = await readClipboardImage();
|
|
2701
2840
|
if (image) {
|
|
2841
|
+
const model = this.session.model;
|
|
2842
|
+
if (!this.isBashMode && model && !isVirtualModel(model) && !model.input.includes("image")) {
|
|
2843
|
+
const candidates = [
|
|
2844
|
+
...new Set(this.session.modelRuntime
|
|
2845
|
+
.getAvailableSnapshot()
|
|
2846
|
+
.filter((candidate) => candidate.input.includes("image"))
|
|
2847
|
+
.map(({ provider, id }) => `${provider}/${id}`.replace(/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/gu, ""))),
|
|
2848
|
+
];
|
|
2849
|
+
const guidance = candidates.length
|
|
2850
|
+
? `Choose an image-capable model with /model: ${candidates.slice(0, 3).join(", ")}${candidates.length > 3 ? ", …" : ""}.`
|
|
2851
|
+
: "No image-capable models are available.";
|
|
2852
|
+
this.showStatus(`Image not attached. ${guidance} Send your text without the image.`);
|
|
2853
|
+
return;
|
|
2854
|
+
}
|
|
2702
2855
|
this.editor.insertTextAtCursor?.(writePastedImage(image));
|
|
2703
2856
|
this.ui.requestRender();
|
|
2704
2857
|
return;
|
|
@@ -2959,12 +3112,6 @@ export class InteractiveMode {
|
|
|
2959
3112
|
this.footer.markActivity();
|
|
2960
3113
|
}
|
|
2961
3114
|
switch (event.type) {
|
|
2962
|
-
case "adaptive_status":
|
|
2963
|
-
this.adaptiveStatus = event.status;
|
|
2964
|
-
if (this.workingVisible)
|
|
2965
|
-
this.showWorkingStatusIndicator();
|
|
2966
|
-
this.ui.requestRender();
|
|
2967
|
-
break;
|
|
2968
3115
|
case "agent_start":
|
|
2969
3116
|
this.pendingTools.clear();
|
|
2970
3117
|
// Restore main escape handler if retry handler is still active
|
|
@@ -3046,6 +3193,10 @@ export class InteractiveMode {
|
|
|
3046
3193
|
this.footer.invalidate();
|
|
3047
3194
|
this.updateEditorBorderColor();
|
|
3048
3195
|
break;
|
|
3196
|
+
case "request_thinking_clamped":
|
|
3197
|
+
case "request_images_omitted":
|
|
3198
|
+
this.showStatus(event.message);
|
|
3199
|
+
break;
|
|
3049
3200
|
case "message_start":
|
|
3050
3201
|
if (event.message.role === "custom") {
|
|
3051
3202
|
this.addMessageToChat(event.message);
|
|
@@ -3141,6 +3292,9 @@ export class InteractiveMode {
|
|
|
3141
3292
|
}
|
|
3142
3293
|
this.ui.requestRender();
|
|
3143
3294
|
break;
|
|
3295
|
+
case "thinking_level_adjusted":
|
|
3296
|
+
this.showStatus(event.notice);
|
|
3297
|
+
break;
|
|
3144
3298
|
case "bash_execution_update":
|
|
3145
3299
|
// The bash execution callback handles TUI output rendering.
|
|
3146
3300
|
break;
|
|
@@ -3193,9 +3347,7 @@ export class InteractiveMode {
|
|
|
3193
3347
|
if (this.settingsManager.getShowTerminalProgress()) {
|
|
3194
3348
|
this.ui.terminal.setProgress(false);
|
|
3195
3349
|
}
|
|
3196
|
-
|
|
3197
|
-
if (!this.adaptiveStatus)
|
|
3198
|
-
this.clearStatusIndicator("working");
|
|
3350
|
+
this.clearStatusIndicator("working");
|
|
3199
3351
|
if (this.streamingComponent) {
|
|
3200
3352
|
this.chatContainer.removeChild(this.streamingComponent);
|
|
3201
3353
|
this.streamingComponent = undefined;
|
|
@@ -3205,11 +3357,6 @@ export class InteractiveMode {
|
|
|
3205
3357
|
this.ui.requestRender();
|
|
3206
3358
|
break;
|
|
3207
3359
|
case "agent_settled":
|
|
3208
|
-
if (this.adaptiveStatus) {
|
|
3209
|
-
this.adaptiveStatus = undefined;
|
|
3210
|
-
this.workingMessage = undefined;
|
|
3211
|
-
this.clearStatusIndicator("working");
|
|
3212
|
-
}
|
|
3213
3360
|
// The session records deferred user bash results when the run settles; show them there too.
|
|
3214
3361
|
this.flushPendingBashComponents();
|
|
3215
3362
|
this.ui.requestRender();
|
|
@@ -3647,42 +3794,30 @@ export class InteractiveMode {
|
|
|
3647
3794
|
this.chatContainer.addChild(new Spacer(1));
|
|
3648
3795
|
this.chatContainer.addChild(new ThemedText(() => theme.fg("warning", `${label}: ${formatTokens(tokens)} tokens billed${cost}`), 1, 0));
|
|
3649
3796
|
}
|
|
3650
|
-
static countDroppedThinkingBlocks(message) {
|
|
3651
|
-
let count = 0;
|
|
3652
|
-
for (const diagnostic of message.diagnostics ?? []) {
|
|
3653
|
-
if (diagnostic.type !== "anthropic_input_transformations")
|
|
3654
|
-
continue;
|
|
3655
|
-
const transformations = diagnostic.details?.transformations;
|
|
3656
|
-
if (!Array.isArray(transformations))
|
|
3657
|
-
continue;
|
|
3658
|
-
count += transformations.filter((transformation) => typeof transformation === "object" &&
|
|
3659
|
-
transformation !== null &&
|
|
3660
|
-
transformation.type === "thinking_dropped").length;
|
|
3661
|
-
}
|
|
3662
|
-
return count;
|
|
3663
|
-
}
|
|
3664
3797
|
maybeShowThinkingDropNotice(message) {
|
|
3665
3798
|
if (!this.settingsManager.getShowCacheMissNotices())
|
|
3666
3799
|
return;
|
|
3667
|
-
const
|
|
3668
|
-
if (
|
|
3800
|
+
const dropped = getDroppedReasoning(message);
|
|
3801
|
+
if (!dropped)
|
|
3669
3802
|
return;
|
|
3670
|
-
|
|
3671
|
-
//
|
|
3672
|
-
// so the branch's last assistant message is the previous response.
|
|
3803
|
+
// Providers report a withheld block again on every later request that replays it, so only
|
|
3804
|
+
// a count above the previous response's means new losses. message_end reaches the UI before
|
|
3805
|
+
// the current message is persisted, so the branch's last assistant message is the previous response.
|
|
3673
3806
|
const branch = this.sessionManager.getBranch();
|
|
3674
3807
|
for (let i = branch.length - 1; i >= 0; i--) {
|
|
3675
3808
|
const entry = branch[i];
|
|
3676
3809
|
if (entry.type === "message" && entry.message.role === "assistant") {
|
|
3677
|
-
|
|
3810
|
+
const previous = getDroppedReasoning(entry.message);
|
|
3811
|
+
if (previous?.diagnostic === dropped.diagnostic && dropped.count <= previous.count)
|
|
3812
|
+
return;
|
|
3678
3813
|
break;
|
|
3679
3814
|
}
|
|
3680
3815
|
}
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
const
|
|
3816
|
+
const { provider, noun: nouns } = dropped.diagnostic;
|
|
3817
|
+
const noun = nouns[dropped.count === 1 ? 0 : 1];
|
|
3818
|
+
const reasons = dropped.reasons.length > 0 ? `: ${dropped.reasons.join(", ")}` : "";
|
|
3684
3819
|
this.chatContainer.addChild(new Spacer(1));
|
|
3685
|
-
this.chatContainer.addChild(new ThemedText(() => theme.fg("warning",
|
|
3820
|
+
this.chatContainer.addChild(new ThemedText(() => theme.fg("warning", `${provider} dropped ${dropped.count} ${noun}${reasons} (details in session)`), 1, 0));
|
|
3686
3821
|
}
|
|
3687
3822
|
/**
|
|
3688
3823
|
* Show a transcript notice when a completed assistant message paid for a
|
|
@@ -3801,6 +3936,7 @@ export class InteractiveMode {
|
|
|
3801
3936
|
this.themeController.disableAutoSync();
|
|
3802
3937
|
await this.ui.terminal.drainInput(1000);
|
|
3803
3938
|
this.stop();
|
|
3939
|
+
await flushStdout();
|
|
3804
3940
|
process.exit(0);
|
|
3805
3941
|
}
|
|
3806
3942
|
// Interactive quit (Ctrl+D, Ctrl+C, /quit, extension shutdown()). Stop the
|
|
@@ -3819,8 +3955,10 @@ export class InteractiveMode {
|
|
|
3819
3955
|
}
|
|
3820
3956
|
const resumeCommand = formatResumeCommand(this.sessionManager);
|
|
3821
3957
|
if (resumeCommand) {
|
|
3822
|
-
|
|
3958
|
+
// Own line so the command can be selected with a triple-click (#12237).
|
|
3959
|
+
process.stdout.write(`${chalk.dim("To resume this session:")}\n${resumeCommand}\n`);
|
|
3823
3960
|
}
|
|
3961
|
+
await flushStdout();
|
|
3824
3962
|
process.exit(0);
|
|
3825
3963
|
}
|
|
3826
3964
|
emergencyTerminalExit() {
|
|
@@ -4057,6 +4195,8 @@ export class InteractiveMode {
|
|
|
4057
4195
|
void this.refreshOAuthAccountFooter();
|
|
4058
4196
|
const thinkingStr = result.model.reasoning && result.thinkingLevel !== "off" ? ` (thinking: ${result.thinkingLevel})` : "";
|
|
4059
4197
|
this.showStatus(`Switched to ${result.model.name || result.model.id}${thinkingStr}`);
|
|
4198
|
+
if (result.notice)
|
|
4199
|
+
this.showStatus(result.notice);
|
|
4060
4200
|
void this.maybeWarnAboutAnthropicSubscriptionAuth(result.model);
|
|
4061
4201
|
}
|
|
4062
4202
|
}
|
|
@@ -4071,8 +4211,6 @@ export class InteractiveMode {
|
|
|
4071
4211
|
if (expanded === this.toolOutputExpanded)
|
|
4072
4212
|
return;
|
|
4073
4213
|
this.toolOutputExpanded = expanded;
|
|
4074
|
-
if (isExpandable(this.activeStatusIndicator))
|
|
4075
|
-
this.activeStatusIndicator.setExpanded(expanded);
|
|
4076
4214
|
const activeHeader = this.customHeader ?? this.builtInHeader;
|
|
4077
4215
|
if (isExpandable(activeHeader)) {
|
|
4078
4216
|
activeHeader.setExpanded(expanded);
|
|
@@ -4722,13 +4860,19 @@ export class InteractiveMode {
|
|
|
4722
4860
|
this.showModelSelector();
|
|
4723
4861
|
return;
|
|
4724
4862
|
}
|
|
4863
|
+
const session = this.session;
|
|
4864
|
+
await this.reloadHcodeAccount();
|
|
4865
|
+
if (this.session !== session)
|
|
4866
|
+
return;
|
|
4725
4867
|
const model = await this.findExactModelMatch(searchTerm);
|
|
4868
|
+
if (this.session !== session)
|
|
4869
|
+
return;
|
|
4726
4870
|
if (model) {
|
|
4727
4871
|
try {
|
|
4728
|
-
await this.session.
|
|
4872
|
+
const notice = await this.session.setModelKeepingThinking(model);
|
|
4729
4873
|
this.footer.invalidate();
|
|
4730
4874
|
this.updateEditorBorderColor();
|
|
4731
|
-
this.showStatus(`Model: ${model.id}`);
|
|
4875
|
+
this.showStatus(`Model: ${model.id}${notice ? ` · ${notice}` : ""}`);
|
|
4732
4876
|
void this.maybeWarnAboutAnthropicSubscriptionAuth(model);
|
|
4733
4877
|
}
|
|
4734
4878
|
catch (error) {
|
|
@@ -4739,11 +4883,23 @@ export class InteractiveMode {
|
|
|
4739
4883
|
this.showModelSelector(searchTerm);
|
|
4740
4884
|
}
|
|
4741
4885
|
async findExactModelMatch(searchTerm) {
|
|
4742
|
-
const
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4886
|
+
const session = this.session;
|
|
4887
|
+
const runtime = session.modelRuntime;
|
|
4888
|
+
const scope = session.scopedModels;
|
|
4889
|
+
if (scope.length > 0) {
|
|
4890
|
+
const match = findExactModelReferenceMatch(searchTerm, scope.map(({ model }) => model));
|
|
4891
|
+
if (match?.provider !== HCODE_PROVIDER)
|
|
4892
|
+
return match;
|
|
4893
|
+
const current = () => runtime.getAvailableSnapshot().find((model) => modelsAreEqual(model, match));
|
|
4894
|
+
const cached = current();
|
|
4895
|
+
if (cached)
|
|
4896
|
+
return cached;
|
|
4897
|
+
this.showStatus("Refreshing HUMAIN Code models…");
|
|
4898
|
+
await retryHcodeCatalog(runtime, AbortSignal.timeout(15_000)).catch(() => undefined);
|
|
4899
|
+
return session.scopedModels === scope ? current() : undefined;
|
|
4900
|
+
}
|
|
4901
|
+
const cachedMatch = findExactModelReferenceMatch(searchTerm, runtime.getAvailableSnapshot());
|
|
4902
|
+
if (cachedMatch)
|
|
4747
4903
|
return cachedMatch;
|
|
4748
4904
|
this.showStatus("Refreshing model catalogs…");
|
|
4749
4905
|
const controller = new AbortController();
|
|
@@ -4753,7 +4909,7 @@ export class InteractiveMode {
|
|
|
4753
4909
|
controller.abort();
|
|
4754
4910
|
}, 15_000);
|
|
4755
4911
|
try {
|
|
4756
|
-
const result = await refreshModelCatalogs(
|
|
4912
|
+
const result = await refreshModelCatalogs(runtime, controller.signal);
|
|
4757
4913
|
if (result.aborted && timedOut) {
|
|
4758
4914
|
this.showWarning("Model refresh timed out; searching cached models.");
|
|
4759
4915
|
}
|
|
@@ -4769,7 +4925,7 @@ export class InteractiveMode {
|
|
|
4769
4925
|
finally {
|
|
4770
4926
|
clearTimeout(timeout);
|
|
4771
4927
|
}
|
|
4772
|
-
return findExactModelReferenceMatch(searchTerm,
|
|
4928
|
+
return findExactModelReferenceMatch(searchTerm, runtime.getAvailableSnapshot());
|
|
4773
4929
|
}
|
|
4774
4930
|
/** Update the footer's available provider count from the current snapshot without refreshing catalogs. */
|
|
4775
4931
|
updateAvailableProviderCount() {
|
|
@@ -4881,73 +5037,42 @@ export class InteractiveMode {
|
|
|
4881
5037
|
const session = this.session;
|
|
4882
5038
|
this.showSelector((done) => {
|
|
4883
5039
|
const controller = new AbortController();
|
|
4884
|
-
let owner = "model";
|
|
4885
|
-
let finishSelection = done;
|
|
4886
5040
|
const cancelSelection = () => {
|
|
4887
|
-
|
|
5041
|
+
done();
|
|
4888
5042
|
if (selectionContext.kind === "hcode" && this.session === session)
|
|
4889
|
-
this.showStatus(`Signed in to ${
|
|
5043
|
+
this.showStatus(`Signed in to ${hcodeDisplayName(session.modelRuntime.hcode.environment.id)}. No model selected. Use /model when you're ready.`);
|
|
4890
5044
|
this.ui.requestRender();
|
|
4891
5045
|
};
|
|
4892
5046
|
const selectModel = async (model, persist) => {
|
|
4893
5047
|
try {
|
|
4894
|
-
const reference = model.provider === HCODE_PROVIDER ? captureHcodeSelection(session.modelRuntime, model) : undefined;
|
|
4895
|
-
let thinkingLevel = session.settingsManager.getModelThinkingLevel(model.provider, model.id) ??
|
|
4896
|
-
session.settingsManager.getDefaultThinkingLevel() ??
|
|
4897
|
-
session.thinkingLevel;
|
|
4898
|
-
const levels = getSupportedThinkingLevels(model);
|
|
4899
|
-
if (reference && !levels.includes(thinkingLevel)) {
|
|
4900
|
-
owner = "thinking";
|
|
4901
|
-
const chosen = await new Promise((resolve) => {
|
|
4902
|
-
this.showSelector((finish) => {
|
|
4903
|
-
finishSelection = finish;
|
|
4904
|
-
const selector = new ThinkingSelectorComponent(thinkingLevel, levels, (level) => resolve(level), () => {
|
|
4905
|
-
resolve(undefined);
|
|
4906
|
-
cancelSelection();
|
|
4907
|
-
});
|
|
4908
|
-
return {
|
|
4909
|
-
component: selector,
|
|
4910
|
-
focus: selector,
|
|
4911
|
-
dispose: () => {
|
|
4912
|
-
controller.abort();
|
|
4913
|
-
resolve(undefined);
|
|
4914
|
-
},
|
|
4915
|
-
};
|
|
4916
|
-
});
|
|
4917
|
-
});
|
|
4918
|
-
if (chosen === undefined || this.session !== session)
|
|
4919
|
-
return;
|
|
4920
|
-
thinkingLevel = chosen;
|
|
4921
|
-
}
|
|
4922
5048
|
if (this.session !== session || controller.signal.aborted)
|
|
4923
5049
|
return;
|
|
4924
|
-
|
|
4925
|
-
assertHcodeSelection(session.modelRuntime, model, reference);
|
|
4926
|
-
await session.setModel(model, { persist, thinkingLevel, signal: controller.signal });
|
|
5050
|
+
const notice = await session.setModelKeepingThinking(model, { persist, signal: controller.signal });
|
|
4927
5051
|
if (this.session !== session)
|
|
4928
5052
|
return;
|
|
4929
5053
|
this.updateAvailableProviderCount();
|
|
4930
5054
|
this.footer.invalidate();
|
|
4931
5055
|
this.updateEditorBorderColor();
|
|
4932
|
-
|
|
5056
|
+
done();
|
|
4933
5057
|
const isDefault = this.settingsManager.getDefaultProvider() === model.provider &&
|
|
4934
5058
|
this.settingsManager.getDefaultModel() === model.id;
|
|
4935
5059
|
const showTip = !persist && !isDefault && !this.modelSaveTipShown;
|
|
4936
5060
|
if (showTip)
|
|
4937
5061
|
this.modelSaveTipShown = true;
|
|
4938
|
-
|
|
5062
|
+
const status = modelSelectionStatus({
|
|
4939
5063
|
model,
|
|
4940
5064
|
persist,
|
|
4941
5065
|
isDefault,
|
|
4942
5066
|
showTip,
|
|
4943
5067
|
saveKey: keyDisplayText("app.models.save"),
|
|
4944
|
-
})
|
|
5068
|
+
});
|
|
5069
|
+
this.showStatus(notice ? `${status} · ${notice}` : status);
|
|
4945
5070
|
void this.maybeWarnAboutAnthropicSubscriptionAuth(model);
|
|
4946
5071
|
}
|
|
4947
5072
|
catch (error) {
|
|
4948
5073
|
if (controller.signal.aborted || this.session !== session)
|
|
4949
5074
|
return;
|
|
4950
|
-
|
|
5075
|
+
done();
|
|
4951
5076
|
this.showError(error instanceof Error ? error.message : String(error));
|
|
4952
5077
|
}
|
|
4953
5078
|
};
|
|
@@ -4958,9 +5083,10 @@ export class InteractiveMode {
|
|
|
4958
5083
|
component: selector,
|
|
4959
5084
|
focus: selector,
|
|
4960
5085
|
dispose: () => {
|
|
4961
|
-
|
|
4962
|
-
controller.abort();
|
|
5086
|
+
controller.abort();
|
|
4963
5087
|
selector.dispose();
|
|
5088
|
+
// /model refreshes HUMAIN Code too; announce models that appeared after an empty sign-in.
|
|
5089
|
+
this.hcodeCatalogWatch?.observe();
|
|
4964
5090
|
},
|
|
4965
5091
|
};
|
|
4966
5092
|
});
|
|
@@ -5440,7 +5566,9 @@ export class InteractiveMode {
|
|
|
5440
5566
|
this.releaseFlowAccountsHost();
|
|
5441
5567
|
const runtime = this.session.modelRuntime;
|
|
5442
5568
|
const reporter = this.getFlowAccountReporter();
|
|
5443
|
-
|
|
5569
|
+
const registry = this.session.extensionRunner.getModelRegistry();
|
|
5570
|
+
this.claudeUsageReconnectRelease = bindClaudeUsageReconnect(registry, (accountKey) => this.reauthenticateAccount(ANTHROPIC_USAGE_PROVIDER_ID, "oauth", accountKey));
|
|
5571
|
+
this.flowAccountsRelease = bindFlowAccountsHost(registry, {
|
|
5444
5572
|
openAccounts: (signal) => this.runFlowAccountsInteraction(signal),
|
|
5445
5573
|
refreshCatalog: (providerId, signal) => refreshFlowCatalog(runtime, providerId, signal),
|
|
5446
5574
|
refreshAccountUsage: (target, signal) => reporter.refreshAccountUsage(target, signal),
|
|
@@ -5450,6 +5578,8 @@ export class InteractiveMode {
|
|
|
5450
5578
|
});
|
|
5451
5579
|
}
|
|
5452
5580
|
releaseFlowAccountsHost() {
|
|
5581
|
+
this.claudeUsageReconnectRelease?.();
|
|
5582
|
+
this.claudeUsageReconnectRelease = undefined;
|
|
5453
5583
|
this.flowAccountsRelease?.();
|
|
5454
5584
|
this.flowAccountsRelease = undefined;
|
|
5455
5585
|
this.flowAccountReporter?.cancelAll();
|
|
@@ -5612,8 +5742,9 @@ export class InteractiveMode {
|
|
|
5612
5742
|
}
|
|
5613
5743
|
await this.startProviderLogin(method);
|
|
5614
5744
|
}
|
|
5615
|
-
async showOAuthAccountSelector(provider, mode = "manage") {
|
|
5745
|
+
async showOAuthAccountSelector(provider, mode = "manage", refreshKey) {
|
|
5616
5746
|
const runtime = this.session.modelRuntime;
|
|
5747
|
+
const isClaude = provider.id === ANTHROPIC_USAGE_PROVIDER_ID;
|
|
5617
5748
|
const pool = runtime.oauthAccounts;
|
|
5618
5749
|
let accounts;
|
|
5619
5750
|
let sources;
|
|
@@ -5639,7 +5770,7 @@ export class InteractiveMode {
|
|
|
5639
5770
|
for (const account of accounts)
|
|
5640
5771
|
labelCounts.set(account.label, (labelCounts.get(account.label) ?? 0) + 1);
|
|
5641
5772
|
const isCodex = provider.id === CODEX_USAGE_PROVIDER_ID;
|
|
5642
|
-
const hasSubscriptionUsage = isCodex ||
|
|
5773
|
+
const hasSubscriptionUsage = isCodex || isClaude;
|
|
5643
5774
|
const accountLabel = (account) => {
|
|
5644
5775
|
const auth = runtime.getProvider(provider.id)?.auth;
|
|
5645
5776
|
const subscription = account.type === "oauth" ? auth?.oauth?.isSubscription : auth?.apiKey?.isSubscription;
|
|
@@ -5657,6 +5788,7 @@ export class InteractiveMode {
|
|
|
5657
5788
|
return `${label} (${markers.join(", ")})`;
|
|
5658
5789
|
};
|
|
5659
5790
|
const usageStates = accounts.map((account) => hasSubscriptionUsage && account.type === "oauth" ? { kind: "loading" } : { kind: "none" });
|
|
5791
|
+
const claudeActions = new Map();
|
|
5660
5792
|
const sourceOptions = sources.map((source) => `${source.label} [read-only] (${source.effective ? "effective" : "shadowed"})`);
|
|
5661
5793
|
const addAccountOption = "Add another account…";
|
|
5662
5794
|
const policyOption = "Provider policy…";
|
|
@@ -5701,7 +5833,7 @@ export class InteractiveMode {
|
|
|
5701
5833
|
void this.removeOAuthAccount(provider, account.key);
|
|
5702
5834
|
}
|
|
5703
5835
|
else {
|
|
5704
|
-
void this.showOAuthAccountActions(provider, account);
|
|
5836
|
+
void this.showOAuthAccountActions(provider, account, undefined, claudeActions.get(account.key));
|
|
5705
5837
|
}
|
|
5706
5838
|
}, () => {
|
|
5707
5839
|
done();
|
|
@@ -5711,20 +5843,30 @@ export class InteractiveMode {
|
|
|
5711
5843
|
let closed = false;
|
|
5712
5844
|
if (hasSubscriptionUsage) {
|
|
5713
5845
|
const subscriptionAccounts = accounts.filter((account) => account.type === "oauth");
|
|
5846
|
+
const registry = this.session.extensionRunner?.getModelRegistry();
|
|
5714
5847
|
let nextIndex = 0;
|
|
5715
5848
|
const worker = async () => {
|
|
5716
5849
|
while (!closed && nextIndex < subscriptionAccounts.length) {
|
|
5717
5850
|
const account = subscriptionAccounts[nextIndex++];
|
|
5718
5851
|
const signal = AbortSignal.any([controller.signal, AbortSignal.timeout(10_000)]);
|
|
5852
|
+
const options = { accountKey: account.key, signal };
|
|
5719
5853
|
let result;
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5854
|
+
if (isCodex) {
|
|
5855
|
+
try {
|
|
5856
|
+
result = await registry?.getCodexUsage(options);
|
|
5857
|
+
}
|
|
5858
|
+
catch {
|
|
5859
|
+
// Account removal or lookup failure must not hide other accounts or expose backend errors.
|
|
5860
|
+
}
|
|
5727
5861
|
}
|
|
5862
|
+
if (closed)
|
|
5863
|
+
return;
|
|
5864
|
+
const claude = isClaude && registry
|
|
5865
|
+
? await readClaudeUsage(registry, account.key, {
|
|
5866
|
+
signal,
|
|
5867
|
+
...(account.key === refreshKey ? { bypassCache: true } : {}),
|
|
5868
|
+
})
|
|
5869
|
+
: undefined;
|
|
5728
5870
|
if (closed)
|
|
5729
5871
|
return;
|
|
5730
5872
|
const index = accounts.indexOf(account);
|
|
@@ -5746,7 +5888,18 @@ export class InteractiveMode {
|
|
|
5746
5888
|
}
|
|
5747
5889
|
if (closed)
|
|
5748
5890
|
return;
|
|
5749
|
-
|
|
5891
|
+
const fallback = claude?.fallback;
|
|
5892
|
+
const state = {
|
|
5893
|
+
kind: "subscription",
|
|
5894
|
+
result: claude?.result ?? result,
|
|
5895
|
+
status: fallback &&
|
|
5896
|
+
[fallback.status, fallback.reconnect === "required" ? "Reconnect required" : undefined]
|
|
5897
|
+
.filter(Boolean)
|
|
5898
|
+
.join(" · "),
|
|
5899
|
+
};
|
|
5900
|
+
usageStates[index] = state;
|
|
5901
|
+
if (claude)
|
|
5902
|
+
claudeActions.set(account.key, { state, reconnect: fallback?.reconnect });
|
|
5750
5903
|
currentOptions = [
|
|
5751
5904
|
...accounts.map((entry, accountIndex) => formatOAuthAccountOption(accountLabel(entry), usageStates[accountIndex])),
|
|
5752
5905
|
...extraOptions,
|
|
@@ -5813,14 +5966,25 @@ export class InteractiveMode {
|
|
|
5813
5966
|
this.showError("Could not read or save account policy. Reopen /accounts to check current state.");
|
|
5814
5967
|
}
|
|
5815
5968
|
}
|
|
5969
|
+
async reauthenticateAccount(providerId, type, accountKey) {
|
|
5970
|
+
const method = this.getLoginProviderOptions(type).find((entry) => entry.id === providerId);
|
|
5971
|
+
if (method)
|
|
5972
|
+
await this.startProviderLogin(method, undefined, accountKey);
|
|
5973
|
+
else
|
|
5974
|
+
this.showError("Login method is no longer available.");
|
|
5975
|
+
}
|
|
5816
5976
|
/** `flow` runs the actions inside the awaited Flow setup, where Back and Add another account stay in that flow. */
|
|
5817
|
-
async showOAuthAccountActions(provider, account, flow) {
|
|
5977
|
+
async showOAuthAccountActions(provider, account, flow, claudeUsage) {
|
|
5818
5978
|
const signal = flow?.signal;
|
|
5819
|
-
const
|
|
5979
|
+
const canRefresh = !flow && provider.id === ANTHROPIC_USAGE_PROVIDER_ID && account.type === "oauth";
|
|
5980
|
+
const usageText = claudeUsage ? `\n${formatOAuthAccountUsage(claudeUsage.state)}` : "";
|
|
5981
|
+
const reauthenticate = claudeUsage?.reconnect ? "Reconnect…" : "Reauthenticate…";
|
|
5982
|
+
const action = await this.showExtensionSelector(`HUMAIN Code / Accounts — ${provider.name}: ${account.label}${usageText}\nSelection is global. OAuth plans may bill extra usage at the provider. OAuth logins without provider identity cannot detect duplicates; reconnect this account to keep the same entry.${flow ? `\n${FLOW_ACCOUNT_PERSISTENCE_NOTICE}` : ""}`, [
|
|
5820
5983
|
"Use for future requests",
|
|
5821
5984
|
"Rename…",
|
|
5822
5985
|
"Add another account…",
|
|
5823
|
-
"
|
|
5986
|
+
...(canRefresh ? ["Refresh"] : []),
|
|
5987
|
+
reauthenticate,
|
|
5824
5988
|
"Remove from HUMAIN Code…",
|
|
5825
5989
|
"Back",
|
|
5826
5990
|
], { signal });
|
|
@@ -5836,12 +6000,11 @@ export class InteractiveMode {
|
|
|
5836
6000
|
else
|
|
5837
6001
|
await this.handleLoginCommand(provider.id);
|
|
5838
6002
|
}
|
|
5839
|
-
else if (action === "
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
this.showError("Login method is no longer available.");
|
|
6003
|
+
else if (action === "Refresh" && canRefresh) {
|
|
6004
|
+
await this.showOAuthAccountSelector(provider, "manage", account.key);
|
|
6005
|
+
}
|
|
6006
|
+
else if (action === reauthenticate) {
|
|
6007
|
+
await this.reauthenticateAccount(provider.id, account.type, account.key);
|
|
5845
6008
|
}
|
|
5846
6009
|
else if (action === "Rename…" || action === "Use for future requests") {
|
|
5847
6010
|
try {
|
|
@@ -5951,11 +6114,32 @@ export class InteractiveMode {
|
|
|
5951
6114
|
return this.getLoginProviderOptions().filter((provider) => provider.id.toLowerCase() === normalizedProviderRef ||
|
|
5952
6115
|
provider.name.toLowerCase() === normalizedProviderRef);
|
|
5953
6116
|
}
|
|
6117
|
+
/** Picks up a sign-in or sign-out that another humain-code process saved for this environment. */
|
|
6118
|
+
async reloadHcodeAccount() {
|
|
6119
|
+
const session = this.session;
|
|
6120
|
+
let changed;
|
|
6121
|
+
try {
|
|
6122
|
+
changed = await session.modelRuntime.reloadHcodeAccount(AbortSignal.timeout(5_000));
|
|
6123
|
+
}
|
|
6124
|
+
catch {
|
|
6125
|
+
// Unreadable shared storage keeps the current state; sign-in itself reports storage failures.
|
|
6126
|
+
return;
|
|
6127
|
+
}
|
|
6128
|
+
if (!changed || this.session !== session)
|
|
6129
|
+
return;
|
|
6130
|
+
this.updateAvailableProviderCount();
|
|
6131
|
+
this.footer.invalidate();
|
|
6132
|
+
}
|
|
5954
6133
|
async handleLoginCommand(providerRef) {
|
|
6134
|
+
await this.reloadHcodeAccount();
|
|
5955
6135
|
if (!providerRef) {
|
|
5956
6136
|
this.showLoginAuthTypeSelector();
|
|
5957
6137
|
return;
|
|
5958
6138
|
}
|
|
6139
|
+
if (providerRef === "status") {
|
|
6140
|
+
await this.showHcodeLoginStatus();
|
|
6141
|
+
return;
|
|
6142
|
+
}
|
|
5959
6143
|
const providerOptions = this.findLoginProviderOptions(providerRef);
|
|
5960
6144
|
if (providerOptions.length === 1) {
|
|
5961
6145
|
await this.startProviderLogin(providerOptions[0]);
|
|
@@ -5978,16 +6162,24 @@ export class InteractiveMode {
|
|
|
5978
6162
|
let close = () => { };
|
|
5979
6163
|
this.showSelector((done) => {
|
|
5980
6164
|
close = done;
|
|
5981
|
-
const selector = new ExtensionSelectorComponent(`Checking ${
|
|
6165
|
+
const selector = new ExtensionSelectorComponent(`Checking ${providerOption.name} availability…`, ["Cancel"], () => done(), () => done());
|
|
5982
6166
|
return { component: selector, focus: selector, dispose: () => controller.abort() };
|
|
5983
6167
|
});
|
|
5984
|
-
const
|
|
6168
|
+
const readiness = await this.checkHcodeLogin(controller.signal);
|
|
5985
6169
|
if (controller.signal.aborted || this.session !== session)
|
|
5986
6170
|
return;
|
|
5987
6171
|
close();
|
|
5988
6172
|
this.ui.requestRender();
|
|
5989
|
-
if (
|
|
5990
|
-
this.showStatus(
|
|
6173
|
+
if (readiness.kind === "unreachable") {
|
|
6174
|
+
this.showStatus(`Can't reach ${readiness.host}: check VPN/Zscaler, then try /login again.`);
|
|
6175
|
+
return;
|
|
6176
|
+
}
|
|
6177
|
+
if (readiness.kind === "mismatch") {
|
|
6178
|
+
this.showWarning(HCODE_LOGIN_MISMATCH_DETAILS);
|
|
6179
|
+
return;
|
|
6180
|
+
}
|
|
6181
|
+
if (readiness.kind !== "ready") {
|
|
6182
|
+
this.showStatus(`${providerOption.name} is unavailable for this environment. Try /login again later.`);
|
|
5991
6183
|
return;
|
|
5992
6184
|
}
|
|
5993
6185
|
}
|
|
@@ -6061,19 +6253,77 @@ export class InteractiveMode {
|
|
|
6061
6253
|
});
|
|
6062
6254
|
}
|
|
6063
6255
|
async checkHcodeLogin(signal) {
|
|
6064
|
-
const
|
|
6256
|
+
const runtime = this.session.modelRuntime;
|
|
6257
|
+
const timeout = timerSignal(HCODE_LOGIN_CHECK_TIMEOUT_MS);
|
|
6258
|
+
const bounded = AbortSignal.any([signal, timeout]);
|
|
6065
6259
|
try {
|
|
6066
|
-
return
|
|
6260
|
+
return await raceWithAbortSignal(runtime.probeHcodeLogin(bounded), bounded);
|
|
6067
6261
|
}
|
|
6068
6262
|
catch {
|
|
6069
|
-
|
|
6263
|
+
// The check's own requests time out sooner; this bound only covers a stalled check.
|
|
6264
|
+
return timeout.aborted && !signal.aborted
|
|
6265
|
+
? { kind: "unreachable", host: new URL(runtime.hcode.environment.origin).host }
|
|
6266
|
+
: { kind: "unavailable" };
|
|
6070
6267
|
}
|
|
6071
6268
|
}
|
|
6269
|
+
async showStartupHcodeSignIn(reference, readiness) {
|
|
6270
|
+
const session = this.session;
|
|
6271
|
+
const { environment, account } = session.modelRuntime.hcode;
|
|
6272
|
+
const chat = this.chatContainer;
|
|
6273
|
+
const spacer = new Spacer(1);
|
|
6274
|
+
let server = hcodeLoginAvailability(undefined).text;
|
|
6275
|
+
const line = new ThemedText(() => theme.fg("dim", `${hcodeDisplayName(environment.id)}: signed in · ${server}`), 1, 0);
|
|
6276
|
+
chat.addChild(spacer);
|
|
6277
|
+
chat.addChild(line);
|
|
6278
|
+
this.ui.requestRender();
|
|
6279
|
+
const availability = hcodeLoginAvailability(await readiness);
|
|
6280
|
+
if (this.session !== session || !sameReference(account.status(environment.id), reference)) {
|
|
6281
|
+
chat.removeChild(line);
|
|
6282
|
+
chat.removeChild(spacer);
|
|
6283
|
+
}
|
|
6284
|
+
else {
|
|
6285
|
+
server =
|
|
6286
|
+
availability.state === "ready"
|
|
6287
|
+
? availability.text
|
|
6288
|
+
: `${availability.text.replace(/ \[(Retry|Details)\]$/, "")} · /login for details`;
|
|
6289
|
+
line.invalidate();
|
|
6290
|
+
}
|
|
6291
|
+
this.ui.requestRender();
|
|
6292
|
+
}
|
|
6293
|
+
async showHcodeLoginStatus() {
|
|
6294
|
+
const session = this.session;
|
|
6295
|
+
const runtime = session.modelRuntime;
|
|
6296
|
+
const environmentId = runtime.hcode.environment.id;
|
|
6297
|
+
const name = hcodeDisplayName(environmentId);
|
|
6298
|
+
const reference = runtime.hcode.account.status(environmentId);
|
|
6299
|
+
const lines = [];
|
|
6300
|
+
if (!reference)
|
|
6301
|
+
lines.push(hcodeSignedInElsewhereNotice(environmentId, runtime.hcodeSignedInElsewhere()) ??
|
|
6302
|
+
`${name}: not signed in. Use /login to sign in.`);
|
|
6303
|
+
else {
|
|
6304
|
+
const email = runtime.hcodeAccountEmail(reference);
|
|
6305
|
+
const count = runtime.getAvailableSnapshot().filter((model) => model.provider === HCODE_PROVIDER).length;
|
|
6306
|
+
lines.push(`${name}: signed in${email ? ` as ${email}` : ""} · ${count} models`);
|
|
6307
|
+
if (count === 0 && !this.hcodeCatalogFailed && !runtime.hcodeCatalogLoaded())
|
|
6308
|
+
lines.push(" Model list not loaded yet. /model to check.");
|
|
6309
|
+
else if (count === 0) {
|
|
6310
|
+
const { reason, fix } = hcodeEmptyCatalogReason(this.hcodeCatalogFailed
|
|
6311
|
+
? { kind: "failed" }
|
|
6312
|
+
: { kind: "empty", reason: runtime.hcodeCatalogEmptyReason() });
|
|
6313
|
+
lines.push(` No models available in the CLI yet: ${reason}.`, ` ${fix}`, " /model to retry.");
|
|
6314
|
+
}
|
|
6315
|
+
}
|
|
6316
|
+
// Show the account at once; the server line updates in place when the (usually cached) check settles.
|
|
6317
|
+
const show = (server) => this.showStatus([...lines, ` Sign-in server: ${server}`].join("\n"));
|
|
6318
|
+
show(hcodeLoginAvailability(undefined).text);
|
|
6319
|
+
const readiness = hcodeLoginAvailability(await this.checkHcodeLogin(new AbortController().signal));
|
|
6320
|
+
if (this.session === session)
|
|
6321
|
+
show(readiness.text.replace(/ \[(Retry|Details)\]$/, ""));
|
|
6322
|
+
}
|
|
6072
6323
|
showLoginProviderSelector(authType, initialSearchInput, humainOnly = false) {
|
|
6073
6324
|
const session = this.session;
|
|
6074
6325
|
const available = this.getLoginProviderOptions().filter((provider) => provider.id === HCODE_PROVIDER ? authType !== "api_key" : !authType || provider.authType === authType);
|
|
6075
6326
|
const ordered = humainOnly ? humainLoginProviders(available) : available;
|
|
6076
|
-
let providerOptions = ordered.filter((provider) => provider.id !== HCODE_PROVIDER);
|
|
6077
6327
|
if (ordered.length === 0) {
|
|
6078
6328
|
const message = humainOnly
|
|
6079
6329
|
? "No HUMAIN providers available."
|
|
@@ -6085,14 +6335,78 @@ export class InteractiveMode {
|
|
|
6085
6335
|
this.showStatus(message);
|
|
6086
6336
|
return;
|
|
6087
6337
|
}
|
|
6338
|
+
const code = ordered.find((provider) => provider.id === HCODE_PROVIDER);
|
|
6088
6339
|
this.showSelector((done) => {
|
|
6089
|
-
const
|
|
6340
|
+
const controller = new AbortController();
|
|
6341
|
+
// HUMAIN Code renders at once and shows its connection check; selecting it before the check
|
|
6342
|
+
// finishes waits inline with a spinner and continues on its own once ready.
|
|
6343
|
+
let readiness;
|
|
6344
|
+
let spinner;
|
|
6345
|
+
let frame = 0;
|
|
6346
|
+
const providers = () => ordered.map((provider) => {
|
|
6347
|
+
if (provider !== code)
|
|
6348
|
+
return provider;
|
|
6349
|
+
const availability = hcodeLoginAvailability(readiness);
|
|
6350
|
+
return {
|
|
6351
|
+
...provider,
|
|
6352
|
+
availability: spinner
|
|
6353
|
+
? {
|
|
6354
|
+
...availability,
|
|
6355
|
+
text: `${SPINNER_FRAMES[frame % SPINNER_FRAMES.length]} ${availability.text}`,
|
|
6356
|
+
}
|
|
6357
|
+
: availability,
|
|
6358
|
+
};
|
|
6359
|
+
});
|
|
6360
|
+
const update = () => {
|
|
6361
|
+
selector.setProviders(providers());
|
|
6362
|
+
this.ui.requestRender();
|
|
6363
|
+
};
|
|
6364
|
+
const start = (provider) => {
|
|
6090
6365
|
done();
|
|
6091
|
-
|
|
6092
|
-
|
|
6366
|
+
void this.startProviderLogin(provider, () => this.showLoginProviderSelector(authType, initialSearchInput, humainOnly));
|
|
6367
|
+
};
|
|
6368
|
+
const check = () => {
|
|
6369
|
+
readiness = undefined;
|
|
6370
|
+
void this.checkHcodeLogin(controller.signal).then((result) => {
|
|
6371
|
+
if (controller.signal.aborted || this.session !== session)
|
|
6372
|
+
return;
|
|
6373
|
+
readiness = result;
|
|
6374
|
+
const waiting = spinner !== undefined;
|
|
6375
|
+
clearInterval(spinner);
|
|
6376
|
+
spinner = undefined;
|
|
6377
|
+
if (waiting && code && result.kind === "ready")
|
|
6378
|
+
start(code);
|
|
6379
|
+
else
|
|
6380
|
+
update();
|
|
6381
|
+
});
|
|
6382
|
+
};
|
|
6383
|
+
const wait = () => {
|
|
6384
|
+
frame = 0;
|
|
6385
|
+
spinner = setInterval(() => {
|
|
6386
|
+
frame++;
|
|
6387
|
+
update();
|
|
6388
|
+
}, SPINNER_INTERVAL_MS);
|
|
6389
|
+
update();
|
|
6390
|
+
};
|
|
6391
|
+
const selector = new OAuthSelectorComponent("login", providers(), (providerId, selectedAuthType) => {
|
|
6392
|
+
const providerOption = ordered.find((provider) => provider.id === providerId && provider.authType === selectedAuthType);
|
|
6393
|
+
if (!providerOption)
|
|
6394
|
+
return;
|
|
6395
|
+
if (providerOption === code && readiness?.kind !== "ready") {
|
|
6396
|
+
if (spinner)
|
|
6397
|
+
return;
|
|
6398
|
+
if (readiness?.kind === "mismatch") {
|
|
6399
|
+
done();
|
|
6400
|
+
this.showWarning(HCODE_LOGIN_MISMATCH_DETAILS);
|
|
6401
|
+
return;
|
|
6402
|
+
}
|
|
6403
|
+
// Retry after a failure; otherwise join the check already running.
|
|
6404
|
+
if (readiness)
|
|
6405
|
+
check();
|
|
6406
|
+
wait();
|
|
6093
6407
|
return;
|
|
6094
6408
|
}
|
|
6095
|
-
|
|
6409
|
+
start(providerOption);
|
|
6096
6410
|
}, () => {
|
|
6097
6411
|
done();
|
|
6098
6412
|
if (authType || humainOnly) {
|
|
@@ -6102,15 +6416,16 @@ export class InteractiveMode {
|
|
|
6102
6416
|
this.ui.requestRender();
|
|
6103
6417
|
}
|
|
6104
6418
|
}, initialSearchInput);
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6419
|
+
if (code)
|
|
6420
|
+
check();
|
|
6421
|
+
return {
|
|
6422
|
+
component: selector,
|
|
6423
|
+
focus: selector,
|
|
6424
|
+
dispose: () => {
|
|
6425
|
+
controller.abort();
|
|
6426
|
+
clearInterval(spinner);
|
|
6427
|
+
},
|
|
6428
|
+
};
|
|
6114
6429
|
});
|
|
6115
6430
|
}
|
|
6116
6431
|
async showOAuthSelector(mode) {
|
|
@@ -6150,30 +6465,17 @@ export class InteractiveMode {
|
|
|
6150
6465
|
const fresh = getModelSelectionIntent(this.session.sessionManager).kind === "fresh";
|
|
6151
6466
|
if (providerId === HCODE_PROVIDER) {
|
|
6152
6467
|
if (this.session.modelRuntime.getProviderAuthStatus(providerId).source === "runtime")
|
|
6153
|
-
this.showStatus(`Signed in to ${
|
|
6154
|
-
this.showStatus(fresh
|
|
6155
|
-
? `Signed in to ${HCODE_LOGIN_LABEL}.`
|
|
6156
|
-
: `Signed in to ${HCODE_LOGIN_LABEL}. Your current model was kept. Use /model to choose a HUMAIN Code model.`);
|
|
6468
|
+
this.showStatus(`Signed in to ${providerName} for this session only. Nothing from this sign-in was saved.`);
|
|
6157
6469
|
}
|
|
6158
6470
|
else
|
|
6159
6471
|
this.showStatus(`Saved API key for ${providerName}. Credentials saved to ${getAuthPath()}`);
|
|
6160
6472
|
this.updateAvailableProviderCount();
|
|
6161
6473
|
this.footer.invalidate();
|
|
6162
6474
|
this.updateEditorBorderColor();
|
|
6163
|
-
if (providerId === HCODE_PROVIDER
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
if (!reference) {
|
|
6167
|
-
this.showStatus(HCODE_SELECTION_CHANGED_MESSAGE);
|
|
6168
|
-
return;
|
|
6169
|
-
}
|
|
6170
|
-
// Reuse Agent's unselected sentinel without resetting messages, tools or user history.
|
|
6171
|
-
this.session.agent.state.model = new Agent({ streamFn: this.session.agent.streamFunction }).state.model;
|
|
6172
|
-
this.showModelSelector(undefined, { kind: "hcode", reference });
|
|
6173
|
-
}
|
|
6174
|
-
else {
|
|
6475
|
+
if (providerId === HCODE_PROVIDER)
|
|
6476
|
+
await this.finishHcodeSignIn(fresh);
|
|
6477
|
+
else
|
|
6175
6478
|
await this.refreshLoginCatalog(providerId, providerName);
|
|
6176
|
-
}
|
|
6177
6479
|
return;
|
|
6178
6480
|
}
|
|
6179
6481
|
const actionLabel = authType === "oauth" ? `Logged in to ${providerName}` : `Saved API key for ${providerName}`;
|
|
@@ -6269,41 +6571,119 @@ export class InteractiveMode {
|
|
|
6269
6571
|
})
|
|
6270
6572
|
.finally(() => clearTimeout(timeout));
|
|
6271
6573
|
}
|
|
6574
|
+
/** Load the new account's models; an empty list returns to the prompt with a notice and a background re-check. */
|
|
6575
|
+
async finishHcodeSignIn(fresh) {
|
|
6576
|
+
const session = this.session;
|
|
6577
|
+
const runtime = session.modelRuntime;
|
|
6578
|
+
this.hcodeCatalogWatch?.stop();
|
|
6579
|
+
this.hcodeCatalogFailed = false;
|
|
6580
|
+
const name = hcodeDisplayName(runtime.hcode.environment.id);
|
|
6581
|
+
const loaded = await this.loadLoginCatalog(HCODE_PROVIDER, name);
|
|
6582
|
+
if (this.session !== session)
|
|
6583
|
+
return;
|
|
6584
|
+
if (!loaded) {
|
|
6585
|
+
this.showStatus(`Signed in to ${name}. Use /model to load its models.`);
|
|
6586
|
+
return;
|
|
6587
|
+
}
|
|
6588
|
+
const reference = runtime.hcode.account.status(runtime.hcode.environment.id);
|
|
6589
|
+
if (!reference) {
|
|
6590
|
+
this.showStatus(HCODE_SELECTION_CHANGED_MESSAGE);
|
|
6591
|
+
return;
|
|
6592
|
+
}
|
|
6593
|
+
if (loaded === "ready") {
|
|
6594
|
+
this.showStatus(fresh
|
|
6595
|
+
? `Signed in to ${name}.`
|
|
6596
|
+
: `Signed in to ${name}. Your current model was kept. Use /model to choose a HUMAIN Code model.`);
|
|
6597
|
+
if (!fresh)
|
|
6598
|
+
return;
|
|
6599
|
+
// Reuse Agent's unselected sentinel without resetting messages, tools or user history.
|
|
6600
|
+
session.agent.state.model = new Agent({ streamFn: session.agent.streamFunction }).state.model;
|
|
6601
|
+
this.showModelSelector(undefined, { kind: "hcode", reference });
|
|
6602
|
+
return;
|
|
6603
|
+
}
|
|
6604
|
+
// Keep the sign-in and the current model; the user can go on with other providers.
|
|
6605
|
+
const cause = loaded === "failed" ? { kind: "failed" } : { kind: "empty", reason: runtime.hcodeCatalogEmptyReason() };
|
|
6606
|
+
this.showStatus(hcodeEmptyCatalogNotice(runtime.hcode.environment.id, runtime.hcodeAccountEmail(reference), cause));
|
|
6607
|
+
this.hcodeCatalogFailed = loaded === "failed";
|
|
6608
|
+
this.hcodeCatalogWatch = watchHcodeCatalog({
|
|
6609
|
+
refresh: async (signal) => {
|
|
6610
|
+
try {
|
|
6611
|
+
const result = await checkWatchedHcodeCatalog(runtime, signal);
|
|
6612
|
+
if (result && !signal.aborted)
|
|
6613
|
+
this.hcodeCatalogFailed = result.aborted || result.errors.size > 0;
|
|
6614
|
+
}
|
|
6615
|
+
catch {
|
|
6616
|
+
// An account/session stop says nothing about the catalog.
|
|
6617
|
+
if (!signal.aborted ||
|
|
6618
|
+
(signal.reason instanceof DOMException && signal.reason.name === "TimeoutError")) {
|
|
6619
|
+
this.hcodeCatalogFailed = true;
|
|
6620
|
+
}
|
|
6621
|
+
}
|
|
6622
|
+
},
|
|
6623
|
+
count: () => runtime.getAvailableSnapshot().filter((model) => model.provider === HCODE_PROVIDER).length,
|
|
6624
|
+
setStatus: (text) => {
|
|
6625
|
+
this.hcodeCatalogStatus = text;
|
|
6626
|
+
this.footerDataProvider.setExtensionStatus(HCODE_STATUS_KEY, text);
|
|
6627
|
+
this.footer.invalidate();
|
|
6628
|
+
this.ui.requestRender();
|
|
6629
|
+
},
|
|
6630
|
+
announce: (count) => {
|
|
6631
|
+
this.updateAvailableProviderCount();
|
|
6632
|
+
// Someone who already picked one in /model needs no pointer back to it.
|
|
6633
|
+
if (this.session.model?.provider === HCODE_PROVIDER)
|
|
6634
|
+
return;
|
|
6635
|
+
this.showStatus(count === 1
|
|
6636
|
+
? `1 ${name} model is now available. Use /model to choose it.`
|
|
6637
|
+
: `${count} ${name} models are now available. Use /model to choose one.`);
|
|
6638
|
+
},
|
|
6639
|
+
subscribe: (listener) => runtime.hcode.account.subscribe((next) => {
|
|
6640
|
+
if (!sameReference(next, reference))
|
|
6641
|
+
listener();
|
|
6642
|
+
}),
|
|
6643
|
+
}, runtime.hcode.environment.id);
|
|
6644
|
+
}
|
|
6645
|
+
/** Refresh one provider's catalog behind a cancellable loading menu; `undefined` when cancelled or replaced. */
|
|
6646
|
+
async loadLoginCatalog(providerId, providerName) {
|
|
6647
|
+
const session = this.session;
|
|
6648
|
+
const controller = new AbortController();
|
|
6649
|
+
let close = () => { };
|
|
6650
|
+
this.showSelector((done) => {
|
|
6651
|
+
close = done;
|
|
6652
|
+
const selector = new ExtensionSelectorComponent(`Loading ${providerName} models…`, ["Cancel"], done, done);
|
|
6653
|
+
return { component: selector, focus: selector, dispose: () => controller.abort() };
|
|
6654
|
+
});
|
|
6655
|
+
const signal = AbortSignal.any([controller.signal, AbortSignal.timeout(15_000)]);
|
|
6656
|
+
let failed = false;
|
|
6657
|
+
try {
|
|
6658
|
+
const result = await raceWithAbortSignal(session.modelRuntime.refresh({ providers: [providerId], signal }), signal);
|
|
6659
|
+
failed = result.aborted || result.errors.size > 0;
|
|
6660
|
+
}
|
|
6661
|
+
catch {
|
|
6662
|
+
failed = true;
|
|
6663
|
+
}
|
|
6664
|
+
if (controller.signal.aborted || this.session !== session)
|
|
6665
|
+
return undefined;
|
|
6666
|
+
close();
|
|
6667
|
+
this.ui.requestRender();
|
|
6668
|
+
this.updateAvailableProviderCount();
|
|
6669
|
+
this.footer.invalidate();
|
|
6670
|
+
if (failed)
|
|
6671
|
+
return "failed";
|
|
6672
|
+
return session.modelRuntime.getAvailableSnapshot().some((model) => model.provider === providerId)
|
|
6673
|
+
? "ready"
|
|
6674
|
+
: "empty";
|
|
6675
|
+
}
|
|
6272
6676
|
async refreshLoginCatalog(providerId, providerName) {
|
|
6273
6677
|
const session = this.session;
|
|
6274
6678
|
do {
|
|
6275
|
-
const
|
|
6276
|
-
|
|
6277
|
-
this.showSelector((done) => {
|
|
6278
|
-
close = done;
|
|
6279
|
-
const selector = new ExtensionSelectorComponent(`Loading ${providerName} models…`, ["Cancel"], done, done);
|
|
6280
|
-
return { component: selector, focus: selector, dispose: () => controller.abort() };
|
|
6281
|
-
});
|
|
6282
|
-
const signal = AbortSignal.any([controller.signal, AbortSignal.timeout(15_000)]);
|
|
6283
|
-
let failed = false;
|
|
6284
|
-
try {
|
|
6285
|
-
const result = await raceWithAbortSignal(session.modelRuntime.refresh({ providers: [providerId], signal }), signal);
|
|
6286
|
-
failed = result.aborted || result.errors.size > 0;
|
|
6287
|
-
}
|
|
6288
|
-
catch {
|
|
6289
|
-
failed = true;
|
|
6290
|
-
}
|
|
6291
|
-
if (controller.signal.aborted || this.session !== session)
|
|
6679
|
+
const loaded = await this.loadLoginCatalog(providerId, providerName);
|
|
6680
|
+
if (!loaded)
|
|
6292
6681
|
return;
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
this.updateAvailableProviderCount();
|
|
6296
|
-
this.footer.invalidate();
|
|
6297
|
-
if (!failed && session.modelRuntime.getAvailableSnapshot().some((model) => model.provider === providerId)) {
|
|
6298
|
-
if (providerId !== HCODE_PROVIDER)
|
|
6299
|
-
this.showStatus(`Use /model to select a ${providerName} model. Your current model was not changed.`);
|
|
6682
|
+
if (loaded === "ready") {
|
|
6683
|
+
this.showStatus(`Use /model to select a ${providerName} model. Your current model was not changed.`);
|
|
6300
6684
|
return;
|
|
6301
6685
|
}
|
|
6302
|
-
const message = failed
|
|
6303
|
-
? "Couldn't load models."
|
|
6304
|
-
: providerId === HCODE_PROVIDER
|
|
6305
|
-
? "Your admin hasn't enabled CLI models yet."
|
|
6306
|
-
: "No HUMAIN Fuse models are available.";
|
|
6686
|
+
const message = loaded === "failed" ? "Couldn't load models." : "No HUMAIN Fuse models are available.";
|
|
6307
6687
|
if ((await this.showExtensionSelector(message, ["Retry", "Cancel"])) !== "Retry")
|
|
6308
6688
|
return;
|
|
6309
6689
|
} while (this.session === session);
|
|
@@ -6389,10 +6769,12 @@ export class InteractiveMode {
|
|
|
6389
6769
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
6390
6770
|
if (error instanceof CredentialSynchronizationError) {
|
|
6391
6771
|
this.showError(providerId === HCODE_PROVIDER
|
|
6392
|
-
? `Signed in to ${
|
|
6772
|
+
? `Signed in to ${providerName}, but local model state could not be synchronized: ${errorMsg}`
|
|
6393
6773
|
: `Saved API key for ${providerName}, but local model state could not be synchronized: ${errorMsg}`);
|
|
6394
6774
|
}
|
|
6395
6775
|
else if (errorMsg === "Login cancelled") {
|
|
6776
|
+
if (providerId === HCODE_PROVIDER)
|
|
6777
|
+
this.showStatus(`${providerName} sign-in cancelled.`);
|
|
6396
6778
|
onBack?.();
|
|
6397
6779
|
}
|
|
6398
6780
|
else if (error instanceof SafeCredentialError) {
|
|
@@ -6400,7 +6782,7 @@ export class InteractiveMode {
|
|
|
6400
6782
|
}
|
|
6401
6783
|
else {
|
|
6402
6784
|
this.showError(providerId === HCODE_PROVIDER
|
|
6403
|
-
? `Sign-in failed for ${
|
|
6785
|
+
? `Sign-in failed for ${providerName}: ${errorMsg}`
|
|
6404
6786
|
: `Failed to save API key for ${providerName}: ${errorMsg}`);
|
|
6405
6787
|
}
|
|
6406
6788
|
}
|
|
@@ -7032,7 +7414,7 @@ export class InteractiveMode {
|
|
|
7032
7414
|
| \`${cycleThinkingLevel}\` | Cycle thinking level |
|
|
7033
7415
|
| \`${cycleModelForward}\` / \`${cycleModelBackward}\` | Cycle models |
|
|
7034
7416
|
| \`${selectModel}\` | Open model selector |
|
|
7035
|
-
| \`${expandTools}\` | Toggle tool output
|
|
7417
|
+
| \`${expandTools}\` | Toggle tool output expansion |
|
|
7036
7418
|
| \`${toggleThinking}\` | Toggle thinking block visibility |
|
|
7037
7419
|
| \`${externalEditor}\` | Edit message in external editor |
|
|
7038
7420
|
| \`${copyMessage}\` | Copy selection or last assistant message |
|