@humain/humain-code 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +160 -0
- package/README.md +2 -2
- package/dist/bundle/agent-monitor.js +1 -1
- package/dist/bundle/chunks/anthropic-messages-XFCDMGD6.js +77 -0
- package/dist/bundle/chunks/anthropic.js +25 -24
- package/dist/bundle/chunks/azure-openai-responses-F4KQM3NK.js +15 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +460 -431
- package/dist/bundle/chunks/bowser-DXKSTXFQ.js +89 -0
- package/dist/bundle/chunks/{chunk-2G7YVAVF.js → chunk-2JNJJ6SZ.js} +1 -1
- package/dist/bundle/chunks/{chunk-HTA325LJ.js → chunk-2NVGOSBN.js} +1 -1
- package/dist/bundle/chunks/{chunk-5B25YXF7.js → chunk-3CGMVKHA.js} +13 -3
- package/dist/bundle/chunks/{chunk-SCINMV4X.js → chunk-46C6D7UC.js} +22 -21
- package/dist/bundle/chunks/chunk-4MKATHT2.js +24 -0
- package/dist/bundle/chunks/{chunk-TGDPZCSW.js → chunk-4TDNOR36.js} +1 -1
- package/dist/bundle/chunks/{chunk-C6VERWRZ.js → chunk-4XF5JX7X.js} +1 -1
- package/dist/bundle/chunks/{chunk-4HTVBBJD.js → chunk-65FLSKDA.js} +2 -2
- package/dist/bundle/chunks/chunk-6HTHDVJC.js +4 -0
- package/dist/bundle/chunks/{chunk-4PRNKB6V.js → chunk-6P6MMQUH.js} +7 -7
- package/dist/bundle/chunks/{chunk-66FZJO75.js → chunk-6TTMNQXI.js} +472 -3924
- package/dist/bundle/chunks/{chunk-32QLLD2P.js → chunk-6YVORXTX.js} +410 -352
- package/dist/bundle/chunks/chunk-7H2WNBX7.js +11 -0
- package/dist/bundle/chunks/{chunk-2FYYW6FY.js → chunk-7OZNMWAJ.js} +1 -1
- package/dist/bundle/chunks/{chunk-R6YQR7TZ.js → chunk-7WE77IE3.js} +1 -1
- package/dist/bundle/chunks/{chunk-Z5YLKK3S.js → chunk-7WETECIB.js} +1 -1
- package/dist/bundle/chunks/chunk-7X6DNT45.js +78 -0
- package/dist/bundle/chunks/{chunk-KRCX3ZBA.js → chunk-APNPBT7Y.js} +1 -1
- package/dist/bundle/chunks/{chunk-R5OOX7RW.js → chunk-B47PNNLL.js} +9 -2
- package/dist/bundle/chunks/{chunk-PPBDDQHP.js → chunk-CQ2CE3RB.js} +7 -6
- package/dist/bundle/chunks/{chunk-MD7K7RPN.js → chunk-D3KYOSQY.js} +1 -1
- package/dist/bundle/chunks/{chunk-I3NDOUHE.js → chunk-DCXHRP6C.js} +1 -1
- package/dist/bundle/chunks/{chunk-OB332KMV.js → chunk-DD5UT56Y.js} +46 -32
- package/dist/bundle/chunks/{chunk-I5E7RQ5V.js → chunk-DJG2WUNM.js} +5 -5
- package/dist/bundle/chunks/{chunk-4QAXV5T6.js → chunk-E7OBH44W.js} +9 -9
- package/dist/bundle/chunks/{chunk-Q7VXYXY3.js → chunk-ENBDASDN.js} +2 -2
- package/dist/bundle/chunks/{chunk-RS6PZK35.js → chunk-F2H47FRF.js} +249 -216
- package/dist/bundle/chunks/{chunk-2H3LUS62.js → chunk-FJIISX5W.js} +241 -229
- package/dist/bundle/chunks/chunk-FQ4KS5S4.js +23 -0
- package/dist/bundle/chunks/{chunk-SSRCVJZK.js → chunk-GPLWWO5Q.js} +5 -5
- package/dist/bundle/chunks/{chunk-WQOOJP7U.js → chunk-GV5OVRKK.js} +1 -1
- package/dist/bundle/chunks/{chunk-KTSJYIYC.js → chunk-HHWVVNGG.js} +1 -1
- package/dist/bundle/chunks/{chunk-4JRER4XK.js → chunk-HQMUDHC3.js} +19 -19
- package/dist/bundle/chunks/{chunk-G4QPSFBF.js → chunk-IMUFBWEK.js} +216 -223
- package/dist/bundle/chunks/{chunk-RU7ADKA7.js → chunk-J4GII2EE.js} +112 -96
- package/dist/bundle/chunks/{chunk-QT6ZHDMP.js → chunk-JBSWWCT5.js} +1 -1
- package/dist/bundle/chunks/{chunk-PWUDFU5V.js → chunk-JWOPWHVH.js} +4 -4
- package/dist/bundle/chunks/{chunk-AEWYICBL.js → chunk-KI7CHPWC.js} +2 -2
- package/dist/bundle/chunks/{chunk-4V5VL2BO.js → chunk-KLSRGGOH.js} +131 -154
- package/dist/bundle/chunks/{chunk-JF7FYXAI.js → chunk-KONLZKPL.js} +7 -6
- package/dist/bundle/chunks/{chunk-N2SNMUD3.js → chunk-KRBELWQH.js} +1 -1
- package/dist/bundle/chunks/{chunk-UZNIPOGS.js → chunk-L4J7SMJB.js} +1 -1
- package/dist/bundle/chunks/{chunk-EIC7CQX3.js → chunk-LSRXA7OS.js} +1 -1
- package/dist/bundle/chunks/{chunk-GRJUKEE3.js → chunk-MIAXMK5F.js} +4 -4
- package/dist/bundle/chunks/chunk-MPRAQ6ZI.js +41 -0
- package/dist/bundle/chunks/{chunk-GUHNFZ2Q.js → chunk-NICPFMOP.js} +20 -19
- package/dist/bundle/chunks/{chunk-WAPZN4KP.js → chunk-P2Y2H7SD.js} +2 -2
- package/dist/bundle/chunks/{chunk-T7BXP46S.js → chunk-P42E6YY6.js} +1892 -1680
- package/dist/bundle/chunks/{chunk-3EDMWQ35.js → chunk-PFBAIRCY.js} +17 -15
- package/dist/bundle/chunks/{chunk-XHDVDJM7.js → chunk-PVNXN2TC.js} +7 -7
- package/dist/bundle/chunks/{chunk-TWAHPPXN.js → chunk-PWFM6AQQ.js} +1307 -1194
- package/dist/bundle/chunks/{chunk-RNBZBCH2.js → chunk-QJB5YI3I.js} +1 -1
- package/dist/bundle/chunks/{chunk-P6AXBESH.js → chunk-QRRVZYTG.js} +1119 -1098
- package/dist/bundle/chunks/{chunk-WQ7EJQIT.js → chunk-ROFZVEFN.js} +247 -250
- package/dist/bundle/chunks/chunk-SKCJ25SX.js +24 -0
- package/dist/bundle/chunks/{chunk-AZXVJN6E.js → chunk-SXOIQWNX.js} +1 -1
- package/dist/bundle/chunks/{chunk-6E6RHNOU.js → chunk-UXM4WFLH.js} +12 -11
- package/dist/bundle/chunks/{chunk-LB4CIS4F.js → chunk-VCMXBP5S.js} +17 -17
- package/dist/bundle/chunks/{chunk-JYWUOKOI.js → chunk-WBSGWISD.js} +367 -353
- package/dist/bundle/chunks/chunk-XZ7FTBXS.js +2102 -0
- package/dist/bundle/chunks/chunk-YSWDFV2L.js +11 -0
- package/dist/bundle/chunks/chunk-ZG74NES2.js +2 -0
- package/dist/bundle/chunks/chunk-ZTG5OKI7.js +3 -0
- package/dist/bundle/chunks/{cli-H4LJNE2V.js → cli-6DJO467D.js} +2 -2
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-T5R2RVFQ.js → cloudflare-workers-ai-system-one-JEZVYITT.js} +1 -1
- package/dist/bundle/chunks/codemode-worker.js +68 -68
- package/dist/bundle/chunks/compat-SRCNS6OQ.js +15 -0
- package/dist/bundle/chunks/curator-server-QB4GITGS.js +3600 -0
- package/dist/bundle/chunks/dist-35STTNYA.js +37 -0
- package/dist/bundle/chunks/{dist-FMWWM4H7.js → dist-4OMLHRJE.js} +2 -2
- package/dist/bundle/chunks/dist-CBODG4CA.js +11 -0
- package/dist/bundle/chunks/{dist-NHQTBDHT.js → dist-TRAK7EXI.js} +91 -257
- package/dist/bundle/chunks/dist-cjs-EROMDUKS.js +193 -0
- package/dist/bundle/chunks/{easter-egg-3d-BUEOC3NO.js → easter-egg-3d-VVUF3C3X.js} +1 -1
- package/dist/bundle/chunks/entry-2GZ3PTWQ.js +2 -0
- package/dist/bundle/chunks/{entry-A2CSLKHC.js → entry-SRYLSS5P.js} +3 -3
- package/dist/bundle/chunks/{event-streams-7YGFEPBZ.js → event-streams-F67JLS6B.js} +1 -1
- package/dist/bundle/chunks/{execute-MY5JSEPV.js → execute-I3WGGPWL.js} +2 -2
- package/dist/bundle/chunks/{extract-PTGACPGP.js → extract-L373D6O7.js} +68 -65
- package/dist/bundle/chunks/{flow-implementer-APJFY4YI.js → flow-implementer-4KO3Q4B5.js} +8 -9
- package/dist/bundle/chunks/github-copilot.js +53 -46
- package/dist/bundle/chunks/google-generative-ai-WIASMWS3.js +22 -0
- package/dist/bundle/chunks/google-vertex-WSPHRZIZ.js +25 -0
- package/dist/bundle/chunks/host-WOLZCWQQ.js +3 -0
- package/dist/bundle/chunks/image-resize-worker.js +3 -3
- package/dist/bundle/chunks/{index.bundle-THL4EUSU.js → index.bundle-HONF3PUD.js} +177 -176
- package/dist/bundle/chunks/{inprocess-5NP5VJHZ.js → inprocess-TOBRVK4C.js} +6 -6
- package/dist/bundle/chunks/interactive-mode-BJJKPBXD.js +5 -0
- package/dist/bundle/chunks/{llama-cpp-classify-GJAXULWL.js → llama-cpp-classify-KYZT532X.js} +1 -1
- package/dist/bundle/chunks/mistral-conversations-7JYDDRUT.js +43 -0
- package/dist/bundle/chunks/{node-UNHECG4X.js → node-MHHE76P4.js} +475 -440
- package/dist/bundle/chunks/{node-ZFIIS5IM.js → node-N7TPBUJB.js} +53 -30
- package/dist/bundle/chunks/{openai-codex-responses-S7CMCAOY.js → openai-codex-responses-7PAML4NF.js} +30 -29
- package/dist/bundle/chunks/openai-codex.js +9 -8
- package/dist/bundle/chunks/{openai-completions-2Z57N7PC.js → openai-completions-UJDAIGTK.js} +22 -22
- package/dist/bundle/chunks/{openai-decisions-JIOJDB4C.js → openai-decisions-JMSDGR7K.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-5VBZSTHL.js → openai-responses-2WNCE6AY.js} +4 -5
- package/dist/bundle/chunks/{openrouter-images-S6O7DBEJ.js → openrouter-images-V3UCCO6X.js} +1 -1
- package/dist/bundle/chunks/openrouter.js +9 -8
- package/dist/bundle/chunks/pdfjs-FE3L72A6.js +3662 -0
- package/dist/bundle/chunks/{pdfjs-decoders-OFXX4HDZ.js → pdfjs-decoders-VCMCTQJ2.js} +1 -1
- package/dist/bundle/chunks/pdfjs-jbig2_nowasm_fallback-I4K6AIV4.js +295 -0
- package/dist/bundle/chunks/pdfjs-openjpeg-PYQCV6CM.js +590 -0
- package/dist/bundle/chunks/pdfjs-openjpeg_nowasm_fallback-G363SGDI.js +775 -0
- package/dist/bundle/chunks/{pi-messages-SMLN5J2W.js → pi-messages-TQ7LJUNQ.js} +11 -11
- package/dist/bundle/chunks/radius.js +8 -7
- package/dist/bundle/chunks/{runtime-OYTWXIUM.js → runtime-H7LYNKCZ.js} +1 -1
- package/dist/bundle/chunks/session-picker-4JQEGLDD.js +4 -0
- package/dist/bundle/chunks/startup-ui-AKTA4NDP.js +3 -0
- package/dist/bundle/chunks/{trace-command-YLDYCL55.js → trace-command-7ORDQ3JS.js} +4 -4
- package/dist/bundle/chunks/{typesafe-system-one-7BEL3H5N.js → typesafe-system-one-YP7GGN4C.js} +1 -1
- package/dist/bundle/chunks/{undici-C6S56CGI.js → undici-WVNE45GY.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-3CT5BMBA.js +28 -0
- package/dist/bundle/cli-runtime.js +5 -5
- package/dist/bundle/flow/package.json +5 -5
- package/dist/bundle/index.js +13 -13
- package/dist/bundle/orchestrate/package.json +22 -6
- package/dist/bundle/rpc-entry.js +4 -5
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +4 -3
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +9 -6
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +16 -1
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +9 -6
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli/setup.d.ts +1 -1
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +3 -2
- package/dist/cli/setup.js.map +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +8 -4
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +14 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +30 -2
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +0 -2
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +0 -2
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +31 -39
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +231 -535
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/anthropic-subscription-usage.d.ts +4 -2
- package/dist/core/anthropic-subscription-usage.d.ts.map +1 -1
- package/dist/core/anthropic-subscription-usage.js +32 -16
- package/dist/core/anthropic-subscription-usage.js.map +1 -1
- package/dist/core/auto-session-namer.js +1 -1
- package/dist/core/auto-session-namer.js.map +1 -1
- package/dist/core/cache-warmer.d.ts.map +1 -1
- package/dist/core/cache-warmer.js +2 -0
- package/dist/core/cache-warmer.js.map +1 -1
- package/dist/core/exec.d.ts +1 -0
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +4 -1
- package/dist/core/exec.js.map +1 -1
- package/dist/core/export-html/ansi-to-html.d.ts +6 -1
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/dist/core/export-html/ansi-to-html.js +57 -20
- package/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/dist/core/export-html/template.js +1 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +2 -3
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +18 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +5 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +5 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/flow-implementer.d.ts.map +1 -1
- package/dist/core/flow-implementer.js +3 -9
- package/dist/core/flow-implementer.js.map +1 -1
- package/dist/core/keybindings.d.ts +64 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +8 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-config.d.ts +13 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-registry.d.ts +3 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +44 -9
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +0 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +14 -17
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +28 -8
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +64 -14
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/oauth-account-pool.d.ts +9 -0
- package/dist/core/oauth-account-pool.d.ts.map +1 -1
- package/dist/core/oauth-account-pool.js +138 -23
- package/dist/core/oauth-account-pool.js.map +1 -1
- package/dist/core/package-manager.d.ts +16 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +46 -3
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/pi-ai-schemas.d.ts +1 -0
- package/dist/core/pi-ai-schemas.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +7 -0
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts +5 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +2 -0
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/run-outcome.d.ts +6 -3
- package/dist/core/run-outcome.d.ts.map +1 -1
- package/dist/core/run-outcome.js +36 -9
- package/dist/core/run-outcome.js.map +1 -1
- package/dist/core/run-preflight.d.ts +1 -1
- package/dist/core/run-preflight.d.ts.map +1 -1
- package/dist/core/run-preflight.js +19 -11
- package/dist/core/run-preflight.js.map +1 -1
- package/dist/core/sdk.d.ts +0 -6
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +9 -18
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager.d.ts +0 -5
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +0 -9
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +0 -4
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +0 -1
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tools/bash-jobs.d.ts.map +1 -1
- package/dist/core/tools/bash-jobs.js +2 -9
- package/dist/core/tools/bash-jobs.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +28 -16
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +4 -1
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/read.d.ts +8 -4
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +10 -15
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/renderers/read.d.ts.map +1 -1
- package/dist/core/tools/renderers/read.js +6 -2
- package/dist/core/tools/renderers/read.js.map +1 -1
- package/dist/core/tools/subagent-worktree.d.ts.map +1 -1
- package/dist/core/tools/subagent-worktree.js +2 -10
- package/dist/core/tools/subagent-worktree.js.map +1 -1
- package/dist/core/trace-client/credential-store.d.ts.map +1 -1
- package/dist/core/trace-client/credential-store.js +9 -5
- package/dist/core/trace-client/credential-store.js.map +1 -1
- package/dist/extensions/codemode/execute.js +2 -2
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +6 -4
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/usage/account-reconnect.d.ts +5 -0
- package/dist/extensions/usage/account-reconnect.d.ts.map +1 -0
- package/dist/extensions/usage/account-reconnect.js +12 -0
- package/dist/extensions/usage/account-reconnect.js.map +1 -0
- package/dist/extensions/usage/confirmation.d.ts.map +1 -1
- package/dist/extensions/usage/confirmation.js +1 -1
- package/dist/extensions/usage/confirmation.js.map +1 -1
- package/dist/extensions/usage/hcode-overview.d.ts +6 -19
- package/dist/extensions/usage/hcode-overview.d.ts.map +1 -1
- package/dist/extensions/usage/hcode-overview.js +86 -100
- package/dist/extensions/usage/hcode-overview.js.map +1 -1
- package/dist/extensions/usage/index.d.ts.map +1 -1
- package/dist/extensions/usage/index.js +75 -99
- package/dist/extensions/usage/index.js.map +1 -1
- package/dist/extensions/usage/overview.d.ts +22 -17
- package/dist/extensions/usage/overview.d.ts.map +1 -1
- package/dist/extensions/usage/overview.js +98 -13
- package/dist/extensions/usage/overview.js.map +1 -1
- package/dist/extensions/usage/panes.d.ts +5 -0
- package/dist/extensions/usage/panes.d.ts.map +1 -0
- package/dist/extensions/usage/panes.js +10 -0
- package/dist/extensions/usage/panes.js.map +1 -0
- package/dist/extensions/usage/popup.d.ts +9 -14
- package/dist/extensions/usage/popup.d.ts.map +1 -1
- package/dist/extensions/usage/popup.js +87 -183
- package/dist/extensions/usage/popup.js.map +1 -1
- package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +4 -1
- package/dist/humain/flow-command.js +1 -1
- package/dist/humain/flow-command.js.map +1 -1
- package/dist/humain/flow-loader.d.ts +9 -4
- package/dist/humain/flow-loader.d.ts.map +1 -1
- package/dist/humain/flow-loader.js +30 -21
- package/dist/humain/flow-loader.js.map +1 -1
- package/dist/humain/gateway/client.d.ts +3 -1
- package/dist/humain/gateway/client.d.ts.map +1 -1
- package/dist/humain/gateway/client.js +10 -5
- package/dist/humain/gateway/client.js.map +1 -1
- package/dist/humain/gateway/login.d.ts.map +1 -1
- package/dist/humain/gateway/login.js +160 -53
- package/dist/humain/gateway/login.js.map +1 -1
- package/dist/humain/hcode/account-store.d.ts +29 -5
- package/dist/humain/hcode/account-store.d.ts.map +1 -1
- package/dist/humain/hcode/account-store.js +224 -124
- package/dist/humain/hcode/account-store.js.map +1 -1
- package/dist/humain/hcode/account.d.ts +6 -0
- package/dist/humain/hcode/account.d.ts.map +1 -1
- package/dist/humain/hcode/account.js +348 -129
- package/dist/humain/hcode/account.js.map +1 -1
- package/dist/humain/hcode/catalog-watch.d.ts +21 -0
- package/dist/humain/hcode/catalog-watch.d.ts.map +1 -0
- package/dist/humain/hcode/catalog-watch.js +46 -0
- package/dist/humain/hcode/catalog-watch.js.map +1 -0
- package/dist/humain/hcode/contracts.d.ts +31 -1
- package/dist/humain/hcode/contracts.d.ts.map +1 -1
- package/dist/humain/hcode/contracts.js +205 -136
- package/dist/humain/hcode/contracts.js.map +1 -1
- package/dist/humain/hcode/environment.d.ts +3 -1
- package/dist/humain/hcode/environment.d.ts.map +1 -1
- package/dist/humain/hcode/environment.js +14 -2
- package/dist/humain/hcode/environment.js.map +1 -1
- package/dist/humain/hcode/facade.d.ts +26 -6
- package/dist/humain/hcode/facade.d.ts.map +1 -1
- package/dist/humain/hcode/facade.js +148 -38
- package/dist/humain/hcode/facade.js.map +1 -1
- package/dist/humain/hcode/http.d.ts +3 -1
- package/dist/humain/hcode/http.d.ts.map +1 -1
- package/dist/humain/hcode/http.js +44 -23
- package/dist/humain/hcode/http.js.map +1 -1
- package/dist/humain/hcode/images.d.ts +67 -0
- package/dist/humain/hcode/images.d.ts.map +1 -0
- package/dist/humain/hcode/images.js +465 -0
- package/dist/humain/hcode/images.js.map +1 -0
- package/dist/humain/hcode/login-copy.d.ts +28 -0
- package/dist/humain/hcode/login-copy.d.ts.map +1 -0
- package/dist/humain/hcode/login-copy.js +74 -0
- package/dist/humain/hcode/login-copy.js.map +1 -0
- package/dist/humain/hcode/login-failure.d.ts +26 -0
- package/dist/humain/hcode/login-failure.d.ts.map +1 -0
- package/dist/humain/hcode/login-failure.js +50 -0
- package/dist/humain/hcode/login-failure.js.map +1 -0
- package/dist/humain/hcode/notices.d.ts +45 -1
- package/dist/humain/hcode/notices.d.ts.map +1 -1
- package/dist/humain/hcode/notices.js +124 -7
- package/dist/humain/hcode/notices.js.map +1 -1
- package/dist/humain/hcode/provider.d.ts +9 -3
- package/dist/humain/hcode/provider.d.ts.map +1 -1
- package/dist/humain/hcode/provider.js +204 -20
- package/dist/humain/hcode/provider.js.map +1 -1
- package/dist/humain/hcode/run-credential.d.ts +21 -0
- package/dist/humain/hcode/run-credential.d.ts.map +1 -0
- package/dist/humain/hcode/run-credential.js +140 -0
- package/dist/humain/hcode/run-credential.js.map +1 -0
- package/dist/humain/hcode/sandbox.d.ts +6 -0
- package/dist/humain/hcode/sandbox.d.ts.map +1 -0
- package/dist/humain/hcode/sandbox.js +139 -0
- package/dist/humain/hcode/sandbox.js.map +1 -0
- package/dist/humain/hcode/selection.d.ts +9 -2
- package/dist/humain/hcode/selection.d.ts.map +1 -1
- package/dist/humain/hcode/selection.js +37 -6
- package/dist/humain/hcode/selection.js.map +1 -1
- package/dist/humain/hcode/transport.d.ts +14 -10
- package/dist/humain/hcode/transport.d.ts.map +1 -1
- package/dist/humain/hcode/transport.js +119 -149
- package/dist/humain/hcode/transport.js.map +1 -1
- package/dist/humain/hcode/wire.d.ts +3 -0
- package/dist/humain/hcode/wire.d.ts.map +1 -1
- package/dist/humain/hcode/wire.js +11 -0
- package/dist/humain/hcode/wire.js.map +1 -1
- package/dist/humain/metadata/contracts.d.ts +1 -0
- package/dist/humain/metadata/contracts.d.ts.map +1 -1
- package/dist/humain/metadata/contracts.js +2 -1
- package/dist/humain/metadata/contracts.js.map +1 -1
- package/dist/humain/remote/broker.d.ts +84 -0
- package/dist/humain/remote/broker.d.ts.map +1 -0
- package/dist/humain/remote/broker.js +427 -0
- package/dist/humain/remote/broker.js.map +1 -0
- package/dist/humain/remote/deny-store.d.ts +12 -0
- package/dist/humain/remote/deny-store.d.ts.map +1 -0
- package/dist/humain/remote/deny-store.js +164 -0
- package/dist/humain/remote/deny-store.js.map +1 -0
- package/dist/humain/remote/enablement.d.ts +5 -0
- package/dist/humain/remote/enablement.d.ts.map +1 -0
- package/dist/humain/remote/enablement.js +8 -0
- package/dist/humain/remote/enablement.js.map +1 -0
- package/dist/humain/remote/environment.d.ts +11 -0
- package/dist/humain/remote/environment.d.ts.map +1 -0
- package/dist/humain/remote/environment.js +19 -0
- package/dist/humain/remote/environment.js.map +1 -0
- package/dist/humain/remote/host-watch.d.ts +21 -0
- package/dist/humain/remote/host-watch.d.ts.map +1 -0
- package/dist/humain/remote/host-watch.js +186 -0
- package/dist/humain/remote/host-watch.js.map +1 -0
- package/dist/humain/remote/ipc-posix.d.ts +5 -0
- package/dist/humain/remote/ipc-posix.d.ts.map +1 -0
- package/dist/humain/remote/ipc-posix.js +29 -0
- package/dist/humain/remote/ipc-posix.js.map +1 -0
- package/dist/humain/remote/ipc-windows.d.ts +3 -0
- package/dist/humain/remote/ipc-windows.d.ts.map +1 -0
- package/dist/humain/remote/ipc-windows.js +5 -0
- package/dist/humain/remote/ipc-windows.js.map +1 -0
- package/dist/humain/remote/ipc.d.ts +10 -0
- package/dist/humain/remote/ipc.d.ts.map +1 -0
- package/dist/humain/remote/ipc.js +19 -0
- package/dist/humain/remote/ipc.js.map +1 -0
- package/dist/humain/remote/protocol.d.ts +43 -0
- package/dist/humain/remote/protocol.d.ts.map +1 -0
- package/dist/humain/remote/protocol.js +76 -0
- package/dist/humain/remote/protocol.js.map +1 -0
- package/dist/humain/remote/relay-socket.d.ts +30 -0
- package/dist/humain/remote/relay-socket.d.ts.map +1 -0
- package/dist/humain/remote/relay-socket.js +137 -0
- package/dist/humain/remote/relay-socket.js.map +1 -0
- package/dist/humain/remote/secure-channel.d.ts +10 -0
- package/dist/humain/remote/secure-channel.d.ts.map +1 -0
- package/dist/humain/remote/secure-channel.js +5 -0
- package/dist/humain/remote/secure-channel.js.map +1 -0
- package/dist/humain/remote/terminal.d.ts +48 -0
- package/dist/humain/remote/terminal.d.ts.map +1 -0
- package/dist/humain/remote/terminal.js +119 -0
- package/dist/humain/remote/terminal.js.map +1 -0
- package/dist/humain/remote/tickets.d.ts +35 -0
- package/dist/humain/remote/tickets.d.ts.map +1 -0
- package/dist/humain/remote/tickets.js +132 -0
- package/dist/humain/remote/tickets.js.map +1 -0
- package/dist/humain/web-access/vendor/anysearch.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/anysearch.js +7 -3
- package/dist/humain/web-access/vendor/anysearch.js.map +1 -1
- package/dist/humain/web-access/vendor/autom.d.ts +4 -0
- package/dist/humain/web-access/vendor/autom.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/autom.js +191 -0
- package/dist/humain/web-access/vendor/autom.js.map +1 -0
- package/dist/humain/web-access/vendor/cloro.d.ts +4 -0
- package/dist/humain/web-access/vendor/cloro.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/cloro.js +236 -0
- package/dist/humain/web-access/vendor/cloro.js.map +1 -0
- package/dist/humain/web-access/vendor/curator-page.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/curator-page.js +7 -1
- package/dist/humain/web-access/vendor/curator-page.js.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.js +6 -0
- package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
- package/dist/humain/web-access/vendor/domain-filter-normalization.d.ts +8 -0
- package/dist/humain/web-access/vendor/domain-filter-normalization.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/domain-filter-normalization.js +37 -0
- package/dist/humain/web-access/vendor/domain-filter-normalization.js.map +1 -1
- package/dist/humain/web-access/vendor/duckduckgo-rate-limit.d.ts +28 -8
- package/dist/humain/web-access/vendor/duckduckgo-rate-limit.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/duckduckgo-rate-limit.js +135 -34
- package/dist/humain/web-access/vendor/duckduckgo-rate-limit.js.map +1 -1
- package/dist/humain/web-access/vendor/duckduckgo.d.ts +1 -1
- package/dist/humain/web-access/vendor/duckduckgo.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/duckduckgo.js +10 -3
- package/dist/humain/web-access/vendor/duckduckgo.js.map +1 -1
- package/dist/humain/web-access/vendor/extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/extract.js +61 -5
- package/dist/humain/web-access/vendor/extract.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.d.ts +3 -3
- package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.js +35 -5
- package/dist/humain/web-access/vendor/gemini-search.js.map +1 -1
- package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/index.js +8 -1
- package/dist/humain/web-access/vendor/index.js.map +1 -1
- package/dist/humain/web-access/vendor/page-query.d.ts +5 -0
- package/dist/humain/web-access/vendor/page-query.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/page-query.js +12 -2
- package/dist/humain/web-access/vendor/page-query.js.map +1 -1
- package/dist/humain/web-access/vendor/specstream.d.ts +6 -0
- package/dist/humain/web-access/vendor/specstream.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/specstream.js +253 -0
- package/dist/humain/web-access/vendor/specstream.js.map +1 -0
- package/dist/humain/web-access/vendor/tool-activation.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/tool-activation.js +21 -5
- package/dist/humain/web-access/vendor/tool-activation.js.map +1 -1
- package/dist/humain/web-access/vendor/upgrade-notice.d.ts +1 -1
- package/dist/humain/web-access/vendor/upgrade-notice.js +1 -1
- package/dist/humain/web-access/vendor/upgrade-notice.js.map +1 -1
- package/dist/humain/web-access/vendor/utils.d.ts +1 -0
- package/dist/humain/web-access/vendor/utils.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/utils.js +3 -0
- package/dist/humain/web-access/vendor/utils.js.map +1 -1
- package/dist/humain/web-access/vendor/video-extract.js +2 -2
- package/dist/humain/web-access/vendor/video-extract.js.map +1 -1
- package/dist/humain/web-access/vendor/web-tool-core.d.ts +13 -0
- package/dist/humain/web-access/vendor/web-tool-core.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/web-tool-core.js +16 -5
- package/dist/humain/web-access/vendor/web-tool-core.js.map +1 -1
- package/dist/humain/web-access/vendor/youtube-extract.js +2 -2
- package/dist/humain/web-access/vendor/youtube-extract.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +109 -29
- package/dist/main.js.map +1 -1
- package/dist/modes/diagnostics-stderr.d.ts +4 -0
- package/dist/modes/diagnostics-stderr.d.ts.map +1 -0
- package/dist/modes/diagnostics-stderr.js +11 -0
- package/dist/modes/diagnostics-stderr.js.map +1 -0
- package/dist/modes/interactive/components/account-picker.d.ts +31 -0
- package/dist/modes/interactive/components/account-picker.d.ts.map +1 -0
- package/dist/modes/interactive/components/account-picker.js +150 -0
- package/dist/modes/interactive/components/account-picker.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +5 -2
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +14 -5
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +2 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +6 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +10 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +101 -23
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +5 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +17 -6
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/radius-login-selector.js +2 -1
- package/dist/modes/interactive/components/radius-login-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +13 -6
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +8 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +41 -9
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.js +5 -1
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +0 -17
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +1 -78
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/themed-text.d.ts +1 -1
- package/dist/modes/interactive/components/themed-text.d.ts.map +1 -1
- package/dist/modes/interactive/components/themed-text.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +5 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +3 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/trust-selector.js +14 -5
- package/dist/modes/interactive/components/trust-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts +2 -2
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +35 -4
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +821 -250
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/model-catalog-refresh.d.ts +4 -0
- package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -1
- package/dist/modes/interactive/model-catalog-refresh.js +40 -1
- package/dist/modes/interactive/model-catalog-refresh.js.map +1 -1
- package/dist/modes/interactive/oauth-account-format.d.ts +15 -2
- package/dist/modes/interactive/oauth-account-format.d.ts.map +1 -1
- package/dist/modes/interactive/oauth-account-format.js +39 -21
- package/dist/modes/interactive/oauth-account-format.js.map +1 -1
- package/dist/modes/interactive/session-share.js +2 -0
- package/dist/modes/interactive/session-share.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +1 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +30 -32
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +26 -39
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +1 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +14 -1
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/abort.d.ts +5 -0
- package/dist/utils/abort.d.ts.map +1 -1
- package/dist/utils/abort.js +9 -0
- package/dist/utils/abort.js.map +1 -1
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +3 -2
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/flush-stdout.d.ts +8 -0
- package/dist/utils/flush-stdout.d.ts.map +1 -0
- package/dist/utils/flush-stdout.js +23 -0
- package/dist/utils/flush-stdout.js.map +1 -0
- package/dist/utils/image-process.d.ts +2 -0
- package/dist/utils/image-process.d.ts.map +1 -1
- package/dist/utils/image-process.js +3 -3
- package/dist/utils/image-process.js.map +1 -1
- package/dist/utils/image-resize-core.js +2 -2
- package/dist/utils/image-resize-core.js.map +1 -1
- package/dist/utils/shell.d.ts +2 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +19 -0
- package/dist/utils/shell.js.map +1 -1
- package/docs/cli.md +1 -1
- package/docs/development.md +0 -13
- package/docs/extensions.md +6 -4
- package/docs/flow.md +4 -62
- package/docs/forge-run-bootstrap.md +46 -0
- package/docs/humain-code-forge-architecture.md +1 -47
- package/docs/humain-code-forge-flow-walkthrough.md +1 -1
- package/docs/humain-code.md +2 -2
- package/docs/index.md +2 -1
- package/docs/keybindings.md +12 -0
- package/docs/llama-cpp.md +5 -5
- package/docs/models-configuration.md +4 -2
- package/docs/nvidia-rtx-llama-cpp.md +5 -5
- package/docs/providers.md +14 -9
- package/docs/quickstart.md +16 -2
- package/docs/rpc-commands.md +1 -1
- package/docs/run-preflight.md +1 -1
- package/docs/slash-commands.md +5 -3
- package/docs/tui.md +2 -0
- package/examples/README.md +0 -3
- package/examples/extensions/custom-provider-anthropic/package-lock.json +4 -4
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/gondolin/index.ts +4 -7
- package/examples/tsconfig.json +96 -76
- package/npm-shrinkwrap.json +285 -764
- package/package.json +24 -37
- package/schemas/keybindings.schema.json +32 -0
- package/schemas/models.schema.json +5 -1
- package/schemas/settings.schema.json +0 -13
- package/src/humain/web-access/UPSTREAM.md +52 -1
- package/src/humain/web-access/upstream.json +5 -5
- package/src/humain/web-access/vendor/CHANGELOG.md +29 -0
- package/dist/bundle/chunks/adaptive-peer-worker-X2ZNZE3S.js +0 -8
- package/dist/bundle/chunks/adaptive-session-host-7KDSQV5I.js +0 -162
- package/dist/bundle/chunks/anthropic-messages-TQK3FUV3.js +0 -68
- package/dist/bundle/chunks/azure-openai-responses-JY7OSLH2.js +0 -15
- package/dist/bundle/chunks/chunk-5L4PBYC7.js +0 -11
- package/dist/bundle/chunks/chunk-6PNQYO6A.js +0 -10
- package/dist/bundle/chunks/chunk-CRN54O4D.js +0 -24
- package/dist/bundle/chunks/chunk-CTU2ECLD.js +0 -7
- package/dist/bundle/chunks/chunk-DBL35X7L.js +0 -3
- package/dist/bundle/chunks/chunk-GME4AWDG.js +0 -23
- package/dist/bundle/chunks/chunk-GTILMMUF.js +0 -12
- package/dist/bundle/chunks/chunk-J57HOSWD.js +0 -21
- package/dist/bundle/chunks/chunk-KQM7ZGL6.js +0 -11
- package/dist/bundle/chunks/chunk-MX4Q4W6H.js +0 -214
- package/dist/bundle/chunks/chunk-NXA6NEHE.js +0 -54
- package/dist/bundle/chunks/chunk-PJACZCIR.js +0 -2
- package/dist/bundle/chunks/chunk-T5A6T24H.js +0 -93
- package/dist/bundle/chunks/chunk-WCFHG6NO.js +0 -16
- package/dist/bundle/chunks/chunk-ZJUU6WOV.js +0 -2052
- package/dist/bundle/chunks/compat-ZK2DIW3P.js +0 -15
- package/dist/bundle/chunks/dist-EY7YKQHB.js +0 -11
- package/dist/bundle/chunks/dist-J5IUPLMH.js +0 -37
- package/dist/bundle/chunks/dist-cjs-2SKN226B.js +0 -184
- package/dist/bundle/chunks/entry-AL54ZGYO.js +0 -2
- package/dist/bundle/chunks/es5-GYTRHFKS.js +0 -77
- package/dist/bundle/chunks/google-generative-ai-UL7YEQ6J.js +0 -21
- package/dist/bundle/chunks/google-vertex-OTMSPUYH.js +0 -26
- package/dist/bundle/chunks/host-75YAHLDR.js +0 -3
- package/dist/bundle/chunks/interactive-mode-IW4PIVAQ.js +0 -5
- package/dist/bundle/chunks/mistral-conversations-E72Y6OC3.js +0 -43
- package/dist/bundle/chunks/pdfjs-AKD6EBKN.js +0 -3614
- package/dist/bundle/chunks/pdfjs-jbig2_nowasm_fallback-FH3KJM4H.js +0 -326
- package/dist/bundle/chunks/pdfjs-openjpeg-SKR7C34X.js +0 -671
- package/dist/bundle/chunks/pdfjs-openjpeg_nowasm_fallback-VUBL7UEE.js +0 -974
- package/dist/bundle/chunks/session-picker-DM6S37IF.js +0 -4
- package/dist/bundle/chunks/startup-ui-4GGLWNSU.js +0 -3
- package/dist/bundle/chunks/virtual-modules-TI3W24YL.js +0 -28
- package/dist/core/internal-process.d.ts +0 -23
- package/dist/core/internal-process.d.ts.map +0 -1
- package/dist/core/internal-process.js +0 -88
- package/dist/core/internal-process.js.map +0 -1
- package/dist/humain/adaptive-execution.d.ts +0 -51
- package/dist/humain/adaptive-execution.d.ts.map +0 -1
- package/dist/humain/adaptive-execution.js +0 -100
- package/dist/humain/adaptive-execution.js.map +0 -1
- package/dist/humain/adaptive-peer-process.d.ts +0 -44
- package/dist/humain/adaptive-peer-process.d.ts.map +0 -1
- package/dist/humain/adaptive-peer-process.js +0 -159
- package/dist/humain/adaptive-peer-process.js.map +0 -1
- package/dist/humain/adaptive-peer-worker.d.ts +0 -3
- package/dist/humain/adaptive-peer-worker.d.ts.map +0 -1
- package/dist/humain/adaptive-peer-worker.js +0 -122
- package/dist/humain/adaptive-peer-worker.js.map +0 -1
- package/dist/humain/adaptive-runtime-types.d.ts +0 -621
- package/dist/humain/adaptive-runtime-types.d.ts.map +0 -1
- package/dist/humain/adaptive-runtime-types.js +0 -3
- package/dist/humain/adaptive-runtime-types.js.map +0 -1
- package/dist/humain/adaptive-session-host.d.ts +0 -113
- package/dist/humain/adaptive-session-host.d.ts.map +0 -1
- package/dist/humain/adaptive-session-host.js +0 -1838
- package/dist/humain/adaptive-session-host.js.map +0 -1
- package/dist/utils/deprecation.d.ts +0 -4
- package/dist/utils/deprecation.d.ts.map +0 -1
- package/dist/utils/deprecation.js +0 -13
- package/dist/utils/deprecation.js.map +0 -1
- package/examples/plugins/pi-example-plugin/README.md +0 -38
- package/examples/plugins/pi-example-plugin/package.json +0 -10
- package/examples/plugins/pi-example-plugin/src/contract.ts +0 -13
- package/examples/plugins/pi-example-plugin/src/session.ts +0 -24
- package/examples/plugins/pi-example-plugin/src/tui.ts +0 -31
|
@@ -4,10 +4,12 @@ import { pollOAuthDeviceCodeFlow } from "@earendil-works/pi-ai/oauth";
|
|
|
4
4
|
import { OsSecretStoreError } from "../../core/os-secret-store.js";
|
|
5
5
|
import { SafeCredentialError } from "../../core/safe-credential-error.js";
|
|
6
6
|
import { raceWithAbortSignal } from "../../utils/abort.js";
|
|
7
|
-
import {
|
|
7
|
+
import { sleep } from "../../utils/sleep.js";
|
|
8
|
+
import { HcodeAccountStore, HcodeUncertainRotationError, HcodeUncommittedRotationError, parseGrant, sameReference, } from "./account-store.js";
|
|
8
9
|
import { parseHcodeAccount, parseHcodeCliConfig } from "./contracts.js";
|
|
9
10
|
import { resolveHcodeEnvironment } from "./environment.js";
|
|
10
|
-
import { assertHcodeRequest, hcodeJson } from "./http.js";
|
|
11
|
+
import { assertHcodeRequest, HCODE_REVOCATION_TIMEOUT_MS, hcodeJson } from "./http.js";
|
|
12
|
+
import { HCODE_LOGIN_FAILURES, HcodeHttpError, hcodeLoginStage } from "./login-failure.js";
|
|
11
13
|
import * as wire from "./wire.js";
|
|
12
14
|
/** Consequences shown beside explicit session-only consent, before acquiring a grant. */
|
|
13
15
|
export const HCODE_SESSION_ONLY_NOTICE = "Nothing from this sign-in will be saved. HUMAIN Code will attempt to revoke this session when you exit normally. If the process crashes, the session remains valid until it expires.";
|
|
@@ -17,7 +19,8 @@ export function createHcodeAccount(options = {}) {
|
|
|
17
19
|
let profile = options.profile ? validateProfile(options.profile) : undefined;
|
|
18
20
|
let profileLifetime = new AbortController();
|
|
19
21
|
let memory;
|
|
20
|
-
let savedHidden
|
|
22
|
+
let savedHidden;
|
|
23
|
+
let signedIn;
|
|
21
24
|
if (profile && profile.environmentId !== environment.id)
|
|
22
25
|
throw new Error("HUMAIN Code account environment conflicts with the requested environment.");
|
|
23
26
|
const fetcher = options.fetch ?? globalThis.fetch;
|
|
@@ -43,15 +46,23 @@ export function createHcodeAccount(options = {}) {
|
|
|
43
46
|
throw new Error("HUMAIN Code account is unavailable: native issuer qualification is required.");
|
|
44
47
|
return profile;
|
|
45
48
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
// The saved sign-in is shared by every process for this environment, so it is visible before the issuer profile
|
|
50
|
+
// loads; every private use still activates the profile and checks the stored issuer binding.
|
|
51
|
+
const status = (environmentId) => {
|
|
52
|
+
if (environmentId !== environment.id)
|
|
53
|
+
return null;
|
|
54
|
+
if (memory)
|
|
55
|
+
return memory.state === "active" ? memory.reference : null;
|
|
56
|
+
if (savedHidden)
|
|
57
|
+
return null;
|
|
58
|
+
try {
|
|
59
|
+
return storage().status(environmentId);
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// An unusable agent directory is signed out here; login reports the storage failure.
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
55
66
|
const revoke = async (refreshToken, signal, p = qualified()) => {
|
|
56
67
|
if (signal.aborted)
|
|
57
68
|
throw new Error("Revocation unconfirmed.");
|
|
@@ -69,37 +80,33 @@ export function createHcodeAccount(options = {}) {
|
|
|
69
80
|
token_type_hint: "refresh_token",
|
|
70
81
|
}),
|
|
71
82
|
signal,
|
|
72
|
-
});
|
|
83
|
+
}, HCODE_REVOCATION_TIMEOUT_MS);
|
|
73
84
|
};
|
|
74
85
|
// Caller cancellation must not cancel the separately bounded cleanup request.
|
|
75
86
|
const revokeUncommitted = (refreshToken, binding) => {
|
|
76
|
-
const signal = AbortSignal.timeout(
|
|
87
|
+
const signal = AbortSignal.timeout(HCODE_REVOCATION_TIMEOUT_MS);
|
|
77
88
|
return raceWithAbortSignal(revoke(refreshToken, signal, binding), signal);
|
|
78
89
|
};
|
|
90
|
+
const retireSaved = async (issued, grant) => {
|
|
91
|
+
// A changed issuer/client is not authority to send an older issuer's grant there.
|
|
92
|
+
const p = profile;
|
|
93
|
+
if (p && p.environmentId === issued.environmentId && p.issuer === issued.issuer && p.clientId === issued.clientId)
|
|
94
|
+
await revokeUncommitted(grant.refreshToken, p);
|
|
95
|
+
};
|
|
79
96
|
const publication = options.publication && {
|
|
80
97
|
...options.publication,
|
|
81
|
-
retire:
|
|
82
|
-
// A changed issuer/client is not authority to send an older issuer's grant there.
|
|
83
|
-
const p = profile;
|
|
84
|
-
if (p &&
|
|
85
|
-
p.environmentId === issued.environmentId &&
|
|
86
|
-
p.issuer === issued.issuer &&
|
|
87
|
-
p.clientId === issued.clientId)
|
|
88
|
-
await revokeUncommitted(grant.refreshToken, p);
|
|
89
|
-
},
|
|
98
|
+
retire: retireSaved,
|
|
90
99
|
};
|
|
91
100
|
const recover = async (signal) => {
|
|
92
101
|
if (!memory && (await storage().recoverPendingReplacement(signal)))
|
|
93
|
-
notify(
|
|
102
|
+
notify(status(environment.id));
|
|
94
103
|
};
|
|
95
|
-
const accountResource = async (grant, signal) => {
|
|
96
|
-
const
|
|
104
|
+
const accountResource = async (grant, signal, fetchWith = fetcher) => {
|
|
105
|
+
const value = await hcodeLoginStage("accountTransport", signal, () => hcodeJson(fetchWith, `${environment.origin}/api/user/account`, {
|
|
97
106
|
headers: { Authorization: `Bearer ${grant.accessToken}` },
|
|
98
107
|
signal,
|
|
99
108
|
}));
|
|
100
|
-
|
|
101
|
-
throw new Error("HUMAIN Code account environment changed.");
|
|
102
|
-
return account;
|
|
109
|
+
return hcodeLoginStage("accountSchema", signal, async () => parseHcodeAccount(value));
|
|
103
110
|
};
|
|
104
111
|
return {
|
|
105
112
|
status,
|
|
@@ -116,20 +123,35 @@ export function createHcodeAccount(options = {}) {
|
|
|
116
123
|
if (memory)
|
|
117
124
|
memory.state = "invalid";
|
|
118
125
|
if (profile) {
|
|
119
|
-
savedHidden =
|
|
126
|
+
savedHidden = { kind: "profile" };
|
|
120
127
|
notify(null);
|
|
121
128
|
}
|
|
122
129
|
profile = next;
|
|
123
130
|
},
|
|
131
|
+
email(expected) {
|
|
132
|
+
return signedIn && sameReference(signedIn.reference, expected) ? (signedIn.email ?? undefined) : undefined;
|
|
133
|
+
},
|
|
124
134
|
persistence(expected) {
|
|
125
135
|
if (memory && sameReference(memory.reference, expected))
|
|
126
136
|
return "session";
|
|
127
137
|
return sameReference(status(expected.environmentId), expected) ? "persistent" : undefined;
|
|
128
138
|
},
|
|
139
|
+
observeSavedReference(next) {
|
|
140
|
+
if (savedHidden?.kind !== "session")
|
|
141
|
+
return true;
|
|
142
|
+
// Both auth.json and private metadata must name a new generation; the hidden grant stays hidden.
|
|
143
|
+
if (memory ||
|
|
144
|
+
sameReference(savedHidden.previous, next) ||
|
|
145
|
+
!sameReference(storage().status(environment.id), next))
|
|
146
|
+
return false;
|
|
147
|
+
savedHidden = undefined;
|
|
148
|
+
return true;
|
|
149
|
+
},
|
|
129
150
|
dispose() {
|
|
130
151
|
profileLifetime.abort();
|
|
131
152
|
memory = undefined;
|
|
132
|
-
|
|
153
|
+
signedIn = undefined;
|
|
154
|
+
savedHidden = { kind: "profile" };
|
|
133
155
|
listeners.clear();
|
|
134
156
|
},
|
|
135
157
|
subscribe(listener) {
|
|
@@ -175,7 +197,7 @@ export function createHcodeAccount(options = {}) {
|
|
|
175
197
|
}
|
|
176
198
|
signal.throwIfAborted();
|
|
177
199
|
if (persistence === "persistent")
|
|
178
|
-
await storage().recover(signal);
|
|
200
|
+
await storage().recover(signal, retireSaved);
|
|
179
201
|
const observed = status(p.environmentId);
|
|
180
202
|
if (observed &&
|
|
181
203
|
(await interaction.prompt({
|
|
@@ -189,12 +211,12 @@ export function createHcodeAccount(options = {}) {
|
|
|
189
211
|
})) !== "replace")
|
|
190
212
|
throw new Error("Login cancelled.");
|
|
191
213
|
let uncommitted;
|
|
214
|
+
let email = null;
|
|
192
215
|
try {
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
await
|
|
197
|
-
const device = wire.object(await hcodeJson(fetcher, p.deviceAuthorizationEndpoint, {
|
|
216
|
+
const authorizeDevice = async () => {
|
|
217
|
+
const device = wire.fields(
|
|
218
|
+
// A lost reply only abandons an unused device code, so one retry is safe.
|
|
219
|
+
await retryOnce(signal, () => hcodeJson(fetcher, p.deviceAuthorizationEndpoint, {
|
|
198
220
|
method: "POST",
|
|
199
221
|
body: new URLSearchParams({
|
|
200
222
|
client_id: p.clientId,
|
|
@@ -202,7 +224,7 @@ export function createHcodeAccount(options = {}) {
|
|
|
202
224
|
audience: p.audience,
|
|
203
225
|
}),
|
|
204
226
|
signal,
|
|
205
|
-
}), [
|
|
227
|
+
})), [
|
|
206
228
|
"device_code",
|
|
207
229
|
"user_code",
|
|
208
230
|
"verification_uri",
|
|
@@ -214,6 +236,8 @@ export function createHcodeAccount(options = {}) {
|
|
|
214
236
|
if (wire.https(device.verification_uri) !== p.verificationUri || /[\p{Cc}]/u.test(userCode))
|
|
215
237
|
return wire.invalid();
|
|
216
238
|
const expiresInSeconds = wire.integer(device.expires_in, 900, 1), intervalSeconds = device.interval === undefined ? 5 : wire.integer(device.interval, 60, 1);
|
|
239
|
+
const expiresAt = Date.now() + expiresInSeconds * 1000;
|
|
240
|
+
let transientFailures = 0;
|
|
217
241
|
// The manual URI/code is always shown; the host owns optional browser confirmation.
|
|
218
242
|
interaction.notify({
|
|
219
243
|
type: "device_code",
|
|
@@ -223,36 +247,70 @@ export function createHcodeAccount(options = {}) {
|
|
|
223
247
|
intervalSeconds,
|
|
224
248
|
expiresInSeconds,
|
|
225
249
|
});
|
|
226
|
-
|
|
250
|
+
return pollOAuthDeviceCodeFlow({
|
|
227
251
|
signal,
|
|
228
252
|
expiresInSeconds,
|
|
229
253
|
intervalSeconds,
|
|
230
254
|
waitBeforeFirstPoll: true,
|
|
231
255
|
poll: async () => {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
256
|
+
let response;
|
|
257
|
+
try {
|
|
258
|
+
response = await tokenRequest(p, fetcher, { grant_type: "urn:ietf:params:oauth:grant-type:device_code", device_code: code }, signal, (refreshToken) => {
|
|
259
|
+
uncommitted = refreshToken;
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
catch (error) {
|
|
263
|
+
if (!(error instanceof HcodeTransientError)) {
|
|
264
|
+
if (signal.aborted)
|
|
265
|
+
throw error;
|
|
266
|
+
throw new SafeCredentialError(HCODE_LOGIN_FAILURES[error instanceof HcodeHttpError && error.kind === "timeout"
|
|
267
|
+
? "networkTimeout"
|
|
268
|
+
: "device"]);
|
|
269
|
+
}
|
|
270
|
+
// A DNS, connection or 5xx blip must not end sign-in: back off (1 s doubling to 30 s)
|
|
271
|
+
// and poll again until the device code expires.
|
|
272
|
+
await sleep(Math.max(0, Math.min(30_000, 1000 * 2 ** transientFailures++, expiresAt - Date.now())), signal);
|
|
273
|
+
return { status: "pending" };
|
|
274
|
+
}
|
|
275
|
+
transientFailures = 0;
|
|
235
276
|
if ("error" in response) {
|
|
236
277
|
if (response.error === "authorization_pending")
|
|
237
278
|
return { status: "pending" };
|
|
238
279
|
if (response.error === "slow_down")
|
|
239
280
|
return { status: "slow_down" };
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
? "
|
|
244
|
-
: "
|
|
245
|
-
|
|
281
|
+
const failure = response.error === "access_denied"
|
|
282
|
+
? "denied"
|
|
283
|
+
: response.error === "expired_token"
|
|
284
|
+
? "expired"
|
|
285
|
+
: "device";
|
|
286
|
+
throw new SafeCredentialError(HCODE_LOGIN_FAILURES[failure]);
|
|
246
287
|
}
|
|
247
288
|
return { status: "complete", value: response.grant };
|
|
248
289
|
},
|
|
290
|
+
}).catch((error) => {
|
|
291
|
+
if (signal.aborted || error instanceof SafeCredentialError || Date.now() < expiresAt)
|
|
292
|
+
throw error;
|
|
293
|
+
throw new SafeCredentialError(HCODE_LOGIN_FAILURES.expired);
|
|
249
294
|
});
|
|
295
|
+
};
|
|
296
|
+
const accountChanged = () => {
|
|
297
|
+
const current = status(p.environmentId);
|
|
298
|
+
return (observed !== null || current !== null) && !sameReference(observed, current);
|
|
299
|
+
};
|
|
300
|
+
const obtain = async () => {
|
|
301
|
+
if (accountChanged())
|
|
302
|
+
throw new SafeCredentialError(HCODE_LOGIN_FAILURES.accountChanged);
|
|
303
|
+
await discover(p, fetcher, signal, environment);
|
|
304
|
+
const granted = await hcodeLoginStage("device", signal, authorizeDevice);
|
|
250
305
|
uncommitted = granted.refreshToken;
|
|
251
306
|
signal.throwIfAborted();
|
|
252
307
|
const account = await accountResource(granted, signal);
|
|
308
|
+
if (account.environmentId !== p.environmentId)
|
|
309
|
+
throw new SafeCredentialError(HCODE_LOGIN_FAILURES.accountEnvironment);
|
|
253
310
|
// Persistent storage owns retirement from this handoff, including ambiguous host publication.
|
|
254
311
|
if (persistence === "persistent")
|
|
255
312
|
uncommitted = undefined;
|
|
313
|
+
email = account.email;
|
|
256
314
|
return { accountId: account.accountId, grant: granted };
|
|
257
315
|
};
|
|
258
316
|
const retire = async (old, binding = p) => {
|
|
@@ -270,24 +328,48 @@ export function createHcodeAccount(options = {}) {
|
|
|
270
328
|
};
|
|
271
329
|
let reference;
|
|
272
330
|
if (persistence === "session") {
|
|
331
|
+
const previousSaved = storage().status(environment.id);
|
|
273
332
|
const result = await obtain();
|
|
274
333
|
signal.throwIfAborted();
|
|
275
334
|
const previous = memory;
|
|
276
335
|
reference = { environmentId: p.environmentId, accountId: result.accountId, generation: randomUUID() };
|
|
277
336
|
memory = { state: "active", reference, grant: result.grant, profile: p };
|
|
278
|
-
savedHidden
|
|
279
|
-
if (previous)
|
|
337
|
+
savedHidden ??= { kind: "session", previous: previousSaved };
|
|
338
|
+
if (previous && (await previous.refreshing?.catch(() => undefined)) !== "rejected")
|
|
280
339
|
await retire(previous.grant, previous.profile);
|
|
281
340
|
}
|
|
282
341
|
else {
|
|
283
|
-
|
|
284
|
-
|
|
342
|
+
let obtainFailed = false;
|
|
343
|
+
try {
|
|
344
|
+
reference = await storage().replace(p, async () => {
|
|
345
|
+
try {
|
|
346
|
+
return await obtain();
|
|
347
|
+
}
|
|
348
|
+
catch (error) {
|
|
349
|
+
obtainFailed = true;
|
|
350
|
+
throw error;
|
|
351
|
+
}
|
|
352
|
+
}, retire, publish && ((next) => hcodeLoginStage("publication", signal, () => publish(next))));
|
|
353
|
+
}
|
|
354
|
+
catch (error) {
|
|
355
|
+
// Grant acquisition keeps its own stage, and a concurrent logout or replacement is not a storage
|
|
356
|
+
// failure; any other replacement failure is local persistence.
|
|
357
|
+
if (error instanceof SafeCredentialError || signal.aborted)
|
|
358
|
+
throw error;
|
|
359
|
+
if (accountChanged())
|
|
360
|
+
throw new SafeCredentialError(HCODE_LOGIN_FAILURES.accountChanged);
|
|
361
|
+
if (obtainFailed)
|
|
362
|
+
throw error;
|
|
363
|
+
throw new SafeCredentialError(HCODE_LOGIN_FAILURES.localStorage);
|
|
364
|
+
}
|
|
365
|
+
savedHidden = undefined;
|
|
285
366
|
}
|
|
286
367
|
uncommitted = undefined;
|
|
287
368
|
if (!sameReference(status(reference.environmentId), reference)) {
|
|
288
369
|
notify(null);
|
|
289
|
-
throw new
|
|
370
|
+
throw new SafeCredentialError(HCODE_LOGIN_FAILURES.accountChanged);
|
|
290
371
|
}
|
|
372
|
+
signedIn = { reference, email };
|
|
291
373
|
notify(reference);
|
|
292
374
|
if (persistence === "persistent" && storage().cleanupIncomplete)
|
|
293
375
|
interaction.notify({
|
|
@@ -308,9 +390,13 @@ export function createHcodeAccount(options = {}) {
|
|
|
308
390
|
});
|
|
309
391
|
}
|
|
310
392
|
}
|
|
393
|
+
if (suppliedSignal.aborted || interaction.signal?.aborted)
|
|
394
|
+
throw new SafeCredentialError("Login cancelled");
|
|
395
|
+
if (signal.aborted)
|
|
396
|
+
throw new SafeCredentialError(HCODE_LOGIN_FAILURES.accountChanged);
|
|
311
397
|
if (error instanceof SafeCredentialError)
|
|
312
398
|
throw error;
|
|
313
|
-
throw new
|
|
399
|
+
throw new SafeCredentialError(HCODE_LOGIN_FAILURES.localStorage);
|
|
314
400
|
}
|
|
315
401
|
},
|
|
316
402
|
async logout(expected, signal) {
|
|
@@ -320,12 +406,13 @@ export function createHcodeAccount(options = {}) {
|
|
|
320
406
|
await recover(signal);
|
|
321
407
|
const p = profile;
|
|
322
408
|
if (memory && sameReference(memory.reference, expected)) {
|
|
323
|
-
const
|
|
409
|
+
const retiring = memory;
|
|
324
410
|
memory = undefined;
|
|
325
|
-
savedHidden = true;
|
|
326
411
|
notify(null);
|
|
327
412
|
try {
|
|
328
|
-
await
|
|
413
|
+
if ((await retiring.refreshing?.catch(() => undefined)) === "rejected")
|
|
414
|
+
return { remoteRevocation: "unconfirmed" };
|
|
415
|
+
await revokeUncommitted(retiring.grant.refreshToken, retiring.profile);
|
|
329
416
|
return { remoteRevocation: "confirmed" };
|
|
330
417
|
}
|
|
331
418
|
catch {
|
|
@@ -348,7 +435,8 @@ export function createHcodeAccount(options = {}) {
|
|
|
348
435
|
const p = qualified();
|
|
349
436
|
if (expected.environmentId !== p.environmentId)
|
|
350
437
|
throw new Error("HUMAIN Code account changed.");
|
|
351
|
-
const
|
|
438
|
+
const lifetime = profileLifetime.signal;
|
|
439
|
+
const signal = AbortSignal.any([lifetime, ...(init.signal ? [init.signal] : [])]);
|
|
352
440
|
try {
|
|
353
441
|
signal.throwIfAborted();
|
|
354
442
|
await recover(signal);
|
|
@@ -377,86 +465,154 @@ export function createHcodeAccount(options = {}) {
|
|
|
377
465
|
throw new Error("HUMAIN Code request failed. Outcome may be unknown; do not automatically resend.");
|
|
378
466
|
}
|
|
379
467
|
};
|
|
380
|
-
|
|
381
|
-
|
|
468
|
+
// Bound only by the profile lifetime: a caller's cancel would lose a grant the issuer already rotated.
|
|
469
|
+
const refresh = async (grant, save, markRotation) => {
|
|
470
|
+
const revokeQuietly = async (refreshToken) => {
|
|
471
|
+
try {
|
|
472
|
+
await revokeUncommitted(refreshToken, p);
|
|
473
|
+
}
|
|
474
|
+
catch {
|
|
475
|
+
/* No grant is retained for background revocation. */
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
let next = grant;
|
|
479
|
+
// Retry a pending identity check without spending another refresh token unless access already expired.
|
|
480
|
+
if (!grant.pendingVerification || grant.expiresAt <= Date.now()) {
|
|
481
|
+
lifetime.throwIfAborted();
|
|
482
|
+
markRotation(true);
|
|
483
|
+
let received;
|
|
484
|
+
let response;
|
|
485
|
+
try {
|
|
486
|
+
response = await tokenRequest(p, fetcher, { grant_type: "refresh_token", refresh_token: grant.refreshToken }, lifetime, (token) => {
|
|
487
|
+
received = token;
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
catch (error) {
|
|
491
|
+
if (received)
|
|
492
|
+
await revokeQuietly(received);
|
|
493
|
+
if (!(error instanceof HcodeTransientError))
|
|
494
|
+
throw new HcodeUncertainRotationError();
|
|
495
|
+
markRotation(false);
|
|
496
|
+
throw new HcodeRefreshUnavailableError();
|
|
497
|
+
}
|
|
498
|
+
if ("error" in response) {
|
|
499
|
+
if (response.error === "invalid_grant")
|
|
500
|
+
return "rejected";
|
|
501
|
+
// Other OAuth errors do not establish that the refresh token was left unspent.
|
|
502
|
+
throw new HcodeUncertainRotationError();
|
|
503
|
+
}
|
|
504
|
+
next = { ...response.grant, pendingVerification: true };
|
|
505
|
+
try {
|
|
506
|
+
save(next);
|
|
507
|
+
}
|
|
508
|
+
catch (error) {
|
|
509
|
+
if (error instanceof HcodeUncommittedRotationError)
|
|
510
|
+
await revokeQuietly(next.refreshToken);
|
|
511
|
+
throw new HcodeRefreshUnavailableError();
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
let accountStatus;
|
|
515
|
+
let account;
|
|
382
516
|
try {
|
|
383
|
-
|
|
384
|
-
|
|
517
|
+
account = await accountResource(next, lifetime, async (url, init) => {
|
|
518
|
+
const reply = await fetcher(url, init);
|
|
519
|
+
accountStatus = reply.status;
|
|
520
|
+
return reply;
|
|
385
521
|
});
|
|
386
|
-
if ("error" in response)
|
|
387
|
-
throw new Error("HUMAIN Code refresh unavailable. Sign in again.");
|
|
388
|
-
const account = await accountResource(response.grant, signal);
|
|
389
|
-
if (account.accountId !== expected.accountId || account.environmentId !== expected.environmentId)
|
|
390
|
-
throw new Error("HUMAIN Code account changed during refresh.");
|
|
391
|
-
return response.grant;
|
|
392
522
|
}
|
|
393
523
|
catch {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
524
|
+
// The rotated grant is already saved; only an explicit rejection ends the sign-in.
|
|
525
|
+
if (accountStatus !== 401 && accountStatus !== 403)
|
|
526
|
+
throw new HcodeRefreshUnavailableError();
|
|
527
|
+
await revokeQuietly(next.refreshToken);
|
|
528
|
+
return "rejected";
|
|
529
|
+
}
|
|
530
|
+
if (account.accountId !== expected.accountId || account.environmentId !== expected.environmentId) {
|
|
531
|
+
await revokeQuietly(next.refreshToken);
|
|
532
|
+
return "rejected";
|
|
533
|
+
}
|
|
534
|
+
const { pendingVerification: _pendingVerification, ...verified } = next;
|
|
535
|
+
try {
|
|
536
|
+
save(verified);
|
|
537
|
+
}
|
|
538
|
+
catch {
|
|
539
|
+
throw new HcodeRefreshUnavailableError();
|
|
403
540
|
}
|
|
541
|
+
return "rotated";
|
|
404
542
|
};
|
|
405
543
|
if (memory?.state === "active" && sameReference(memory.reference, expected)) {
|
|
406
544
|
const captured = memory;
|
|
407
|
-
if (captured.
|
|
408
|
-
captured.
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
signal.throwIfAborted();
|
|
412
|
-
if (memory !== captured)
|
|
413
|
-
throw new Error("HUMAIN Code account changed.");
|
|
545
|
+
if (captured.refreshing ||
|
|
546
|
+
captured.grant.pendingVerification ||
|
|
547
|
+
captured.grant.expiresAt <= Date.now() + 30000) {
|
|
548
|
+
captured.refreshing ??= refresh(captured.grant, (next) => {
|
|
414
549
|
captured.grant = next;
|
|
415
|
-
captured.
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
|
|
550
|
+
captured.rotationUncertain = false;
|
|
551
|
+
}, (inFlight) => {
|
|
552
|
+
if (inFlight && captured.rotationUncertain)
|
|
553
|
+
throw new HcodeUncertainRotationError();
|
|
554
|
+
captured.rotationUncertain = inFlight;
|
|
555
|
+
})
|
|
556
|
+
.then((outcome) => {
|
|
557
|
+
// The shared refresh owns rejection even if every waiter cancelled.
|
|
558
|
+
if (outcome === "rejected" && memory === captured) {
|
|
419
559
|
captured.state = "invalid";
|
|
420
560
|
notify(null);
|
|
421
561
|
}
|
|
422
|
-
|
|
423
|
-
}
|
|
562
|
+
return outcome;
|
|
563
|
+
})
|
|
564
|
+
.finally(() => {
|
|
565
|
+
captured.refreshing = undefined;
|
|
566
|
+
});
|
|
567
|
+
if ((await raceWithAbortSignal(captured.refreshing, signal)) === "rejected")
|
|
568
|
+
throw new Error("HUMAIN Code sign-in expired. Sign in again.");
|
|
424
569
|
}
|
|
425
570
|
signal.throwIfAborted();
|
|
426
|
-
if (memory !== captured)
|
|
571
|
+
if (memory !== captured || captured.state !== "active" || captured.grant.pendingVerification)
|
|
427
572
|
throw new Error("HUMAIN Code account changed.");
|
|
428
573
|
return await send(captured.grant);
|
|
429
574
|
}
|
|
430
575
|
if (savedHidden)
|
|
431
576
|
throw new Error("HUMAIN Code account changed.");
|
|
432
|
-
|
|
577
|
+
// The store finishes a started refresh under its lock even when this caller stops waiting.
|
|
578
|
+
return await raceWithAbortSignal(storage().use(expected, p, send, refresh, signal), signal);
|
|
433
579
|
}
|
|
434
|
-
catch {
|
|
580
|
+
catch (error) {
|
|
435
581
|
if (!status(p.environmentId))
|
|
436
582
|
notify(null);
|
|
583
|
+
else if (!signal.aborted &&
|
|
584
|
+
(error instanceof HcodeRefreshUnavailableError || error instanceof HcodeUncertainRotationError))
|
|
585
|
+
throw error;
|
|
437
586
|
throw new Error("HUMAIN Code request failed. Sign in again if the account changed; do not automatically resend.");
|
|
438
587
|
}
|
|
439
588
|
},
|
|
440
589
|
};
|
|
441
590
|
}
|
|
442
591
|
async function discover(p, fetcher, signal, environment) {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
config.
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
592
|
+
await hcodeLoginStage("configuration", signal, async () => {
|
|
593
|
+
const config = parseHcodeCliConfig(await retryOnce(signal, () => hcodeJson(fetcher, `${environment.origin}/api/cli/config`, { signal })));
|
|
594
|
+
if (config.origin !== environment.origin ||
|
|
595
|
+
config.inferenceBaseUrl !== environment.inferenceBaseUrl ||
|
|
596
|
+
config.environmentId !== p.environmentId ||
|
|
597
|
+
config.auth.issuer !== p.issuer ||
|
|
598
|
+
config.auth.clientId !== p.clientId ||
|
|
599
|
+
config.auth.audience !== p.audience ||
|
|
600
|
+
JSON.stringify(config.auth.scopes) !== JSON.stringify(p.scopes) ||
|
|
601
|
+
config.auth.qualification !== p.qualification ||
|
|
602
|
+
config.auth.maxAccessTokenSeconds !== p.maxAccessTokenSeconds ||
|
|
603
|
+
config.auth.deviceAuthorizationEndpoint !== p.deviceAuthorizationEndpoint ||
|
|
604
|
+
config.auth.tokenEndpoint !== p.tokenEndpoint ||
|
|
605
|
+
config.auth.revocationEndpoint !== p.revocationEndpoint ||
|
|
606
|
+
config.auth.verificationUri !== p.verificationUri ||
|
|
607
|
+
config.auth.revocation !== p.revocation)
|
|
608
|
+
throw new Error("HUMAIN Code issuer configuration is unavailable.");
|
|
609
|
+
});
|
|
610
|
+
await hcodeLoginStage("discovery", signal, () => verifyHcodeIssuer(p, fetcher, signal));
|
|
611
|
+
}
|
|
612
|
+
/** Checks the issuer's discovery document against the pinned profile endpoints. */
|
|
613
|
+
export async function verifyHcodeIssuer(p, fetcher, signal) {
|
|
614
|
+
validateProfile(p);
|
|
615
|
+
const discovery = await retryOnce(signal, () => hcodeJson(fetcher, `${p.issuer}/.well-known/openid-configuration`, { signal }));
|
|
460
616
|
// Issuer discovery is external wire input; extensions are allowed, but endpoint authority is pinned by the owner.
|
|
461
617
|
if (discovery === null || typeof discovery !== "object" || Array.isArray(discovery))
|
|
462
618
|
return wire.invalid();
|
|
@@ -469,28 +625,93 @@ async function discover(p, fetcher, signal, environment) {
|
|
|
469
625
|
!["urn:ietf:params:oauth:grant-type:device_code", "refresh_token"].every((kind) => Array.isArray(record.grant_types_supported) && record.grant_types_supported.includes(kind)))
|
|
470
626
|
return wire.invalid();
|
|
471
627
|
}
|
|
628
|
+
/** Sends an idempotent sign-in request once more after a short pause when it failed in transport or by status. */
|
|
629
|
+
async function retryOnce(signal, request) {
|
|
630
|
+
try {
|
|
631
|
+
return await request();
|
|
632
|
+
}
|
|
633
|
+
catch (error) {
|
|
634
|
+
if (signal.aborted || !(error instanceof HcodeHttpError))
|
|
635
|
+
throw error;
|
|
636
|
+
await sleep(1000, signal);
|
|
637
|
+
return request();
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
/** A retryable exchange: a known no-send refresh failure, or a device polling interruption. */
|
|
641
|
+
class HcodeTransientError extends Error {
|
|
642
|
+
constructor() {
|
|
643
|
+
super("HUMAIN Code request unavailable.");
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
/** A refresh that left the saved sign-in in place; the next request refreshes again. */
|
|
647
|
+
class HcodeRefreshUnavailableError extends Error {
|
|
648
|
+
constructor() {
|
|
649
|
+
super("HUMAIN Code could not renew the sign-in. You are still signed in. Check your connection and try again.");
|
|
650
|
+
}
|
|
651
|
+
}
|
|
472
652
|
async function tokenRequest(p, fetcher, fields, signal, received) {
|
|
653
|
+
let status;
|
|
654
|
+
let notSent = false;
|
|
655
|
+
const polling = fields.grant_type === "urn:ietf:params:oauth:grant-type:device_code";
|
|
473
656
|
// OAuth polling legitimately returns HTTP 400 with authorization_pending/slow_down.
|
|
474
657
|
const value = await hcodeJson(async (url, init) => {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
658
|
+
let response;
|
|
659
|
+
try {
|
|
660
|
+
response = await fetcher(url, init);
|
|
661
|
+
}
|
|
662
|
+
catch (error) {
|
|
663
|
+
// Fetch doesn't distinguish lost replies from an unsent request. Only structured connect/DNS failures do.
|
|
664
|
+
const cause = error instanceof Error ? error.cause : undefined;
|
|
665
|
+
const code = cause && typeof cause === "object" && "code" in cause ? cause.code : undefined;
|
|
666
|
+
notSent =
|
|
667
|
+
code === "EAI_AGAIN" ||
|
|
668
|
+
code === "ENOTFOUND" ||
|
|
669
|
+
code === "ECONNREFUSED" ||
|
|
670
|
+
code === "UND_ERR_CONNECT_TIMEOUT";
|
|
671
|
+
throw error;
|
|
672
|
+
}
|
|
673
|
+
status = response.status;
|
|
674
|
+
if (status === 400 || (polling && status === 403))
|
|
675
|
+
return new Response(response.body, { status: 200, headers: response.headers });
|
|
676
|
+
return response;
|
|
677
|
+
}, p.tokenEndpoint, { method: "POST", body: new URLSearchParams({ ...fields, client_id: p.clientId }), signal }).catch((error) => {
|
|
678
|
+
if (signal.aborted)
|
|
679
|
+
throw error;
|
|
680
|
+
if (polling && (status === 403 || status === 408 || status === 429))
|
|
681
|
+
return undefined;
|
|
682
|
+
// Neither a lost reply nor an intermediary status proves the issuer left the token unspent.
|
|
683
|
+
if (notSent ||
|
|
684
|
+
(polling && (status === undefined || status >= 500 || (status === 400 && error instanceof HcodeHttpError))))
|
|
685
|
+
throw new HcodeTransientError();
|
|
686
|
+
throw error;
|
|
687
|
+
});
|
|
688
|
+
const raw = value !== null && typeof value === "object" && !Array.isArray(value)
|
|
689
|
+
? Object.fromEntries(Object.entries(value))
|
|
690
|
+
: undefined;
|
|
691
|
+
if (status === 400 || (polling && status === 403)) {
|
|
692
|
+
// OAuth errors must not also contain a grant, or be confused with a success or an intermediary response.
|
|
693
|
+
if (raw &&
|
|
694
|
+
typeof raw.error === "string" &&
|
|
695
|
+
raw.error.length > 0 &&
|
|
696
|
+
raw.error.length <= 128 &&
|
|
697
|
+
Object.entries(raw).every(([key, value]) => ["error", "error_description", "error_uri"].includes(key) && typeof value === "string")) {
|
|
698
|
+
if (status === 400 || raw.error === "access_denied")
|
|
699
|
+
return { error: raw.error };
|
|
700
|
+
}
|
|
701
|
+
if (status === 403)
|
|
702
|
+
return { error: "slow_down" };
|
|
482
703
|
return wire.invalid();
|
|
483
|
-
const raw = Object.fromEntries(Object.entries(value));
|
|
484
|
-
if (raw.error === undefined) {
|
|
485
|
-
const refreshToken = wire.string(raw.refresh_token, 1048576);
|
|
486
|
-
if (/[\p{Cc}]/u.test(refreshToken))
|
|
487
|
-
return wire.invalid();
|
|
488
|
-
received(refreshToken);
|
|
489
704
|
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
705
|
+
if (polling && (status === 408 || status === 429))
|
|
706
|
+
return { error: "slow_down" };
|
|
707
|
+
// Capture a safe revocation token before validating the rest of the issuer's token response.
|
|
708
|
+
if (!raw || raw.error !== undefined)
|
|
709
|
+
return wire.invalid();
|
|
710
|
+
const refreshToken = wire.string(raw.refresh_token, 1048576);
|
|
711
|
+
if (/[\p{Cc}]/u.test(refreshToken))
|
|
712
|
+
return wire.invalid();
|
|
713
|
+
received(refreshToken);
|
|
714
|
+
const v = wire.fields(raw, [
|
|
494
715
|
"access_token",
|
|
495
716
|
"refresh_token",
|
|
496
717
|
"token_type",
|
|
@@ -501,8 +722,6 @@ async function tokenRequest(p, fetcher, fields, signal, received) {
|
|
|
501
722
|
"session_state",
|
|
502
723
|
"not-before-policy",
|
|
503
724
|
]);
|
|
504
|
-
if (v.error !== undefined)
|
|
505
|
-
return { error: wire.string(v.error, 128) };
|
|
506
725
|
if (typeof v.token_type !== "string" || v.token_type.toLowerCase() !== "bearer")
|
|
507
726
|
return wire.invalid();
|
|
508
727
|
if (v.scope !== undefined) {
|