@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
|
@@ -24,8 +24,8 @@ function source(value) {
|
|
|
24
24
|
}
|
|
25
25
|
/** Parse trusted-origin discovery data before the account owner qualifies the issuer. */
|
|
26
26
|
export function parseHcodeCliConfig(value) {
|
|
27
|
-
const v = wire.
|
|
28
|
-
const auth = wire.
|
|
27
|
+
const v = wire.fields(value, ["schemaVersion", "environmentId", "origin", "inferenceBaseUrl", "auth"]);
|
|
28
|
+
const auth = wire.fields(v.auth, [
|
|
29
29
|
"kind",
|
|
30
30
|
"issuer",
|
|
31
31
|
"clientId",
|
|
@@ -79,7 +79,7 @@ export function parseHcodeCliConfig(value) {
|
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
export function parseHcodeAccount(value) {
|
|
82
|
-
const v = wire.
|
|
82
|
+
const v = wire.fields(value, [
|
|
83
83
|
"schemaVersion",
|
|
84
84
|
"accountId",
|
|
85
85
|
"environmentId",
|
|
@@ -88,7 +88,7 @@ export function parseHcodeAccount(value) {
|
|
|
88
88
|
"role",
|
|
89
89
|
"eligibility",
|
|
90
90
|
]);
|
|
91
|
-
const eligibility = wire.
|
|
91
|
+
const eligibility = wire.fields(v.eligibility, ["kind"]);
|
|
92
92
|
const email = wire.nullable(v.email, (entry) => wire.string(entry, 320));
|
|
93
93
|
if (email !== null &&
|
|
94
94
|
!/^(?:[A-Za-z0-9_'+-]+\.)*[A-Za-z0-9_'+-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9-]*\.)+[A-Za-z]{2,}$/.test(email))
|
|
@@ -104,46 +104,37 @@ export function parseHcodeAccount(value) {
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
function parseValue(value) {
|
|
107
|
-
const v = wire.
|
|
107
|
+
const v = wire.fields(value, ["kind", "value"]);
|
|
108
108
|
if (v.kind === "known")
|
|
109
109
|
return { kind: "known", value: wire.integer(v.value) };
|
|
110
|
-
wire.object(value, ["kind"]);
|
|
111
110
|
return { kind: wire.member(v.kind, ["unknown", "redacted", "unavailable"]) };
|
|
112
111
|
}
|
|
112
|
+
const tokenKeys = ["input", "output", "cacheRead", "cacheWrite", "total"];
|
|
113
113
|
function parseTokens(value, max = 2147483647) {
|
|
114
|
-
|
|
114
|
+
// Statement and allowance totals are shown as sent.
|
|
115
|
+
return readTokenCounts(wire.fields(value, tokenKeys), max, parseValue);
|
|
116
|
+
}
|
|
117
|
+
function readTokenCounts(v, max, parse) {
|
|
115
118
|
const result = {
|
|
116
|
-
input:
|
|
117
|
-
output:
|
|
118
|
-
cacheRead:
|
|
119
|
-
cacheWrite:
|
|
120
|
-
total:
|
|
119
|
+
input: parse(v.input),
|
|
120
|
+
output: parse(v.output),
|
|
121
|
+
cacheRead: parse(v.cacheRead),
|
|
122
|
+
cacheWrite: parse(v.cacheWrite),
|
|
123
|
+
total: parse(v.total),
|
|
121
124
|
};
|
|
122
125
|
for (const token of Object.values(result))
|
|
123
126
|
if (token.kind === "known")
|
|
124
127
|
wire.integer(token.value, max);
|
|
125
|
-
if (result.input.kind === "known") {
|
|
126
|
-
if (result.output.kind === "known" &&
|
|
127
|
-
result.total.kind === "known" &&
|
|
128
|
-
(!Number.isSafeInteger(result.input.value + result.output.value) ||
|
|
129
|
-
result.total.value !== result.input.value + result.output.value))
|
|
130
|
-
return wire.invalid();
|
|
131
|
-
if ((result.cacheRead.kind === "known" ? result.cacheRead.value : 0) +
|
|
132
|
-
(result.cacheWrite.kind === "known" ? result.cacheWrite.value : 0) >
|
|
133
|
-
result.input.value)
|
|
134
|
-
return wire.invalid();
|
|
135
|
-
}
|
|
136
128
|
return result;
|
|
137
129
|
}
|
|
138
130
|
function parseAllowance(value) {
|
|
139
|
-
const v = wire.
|
|
131
|
+
const v = wire.fields(value, ["kind", "limitMicrocents"]);
|
|
140
132
|
if (v.kind === "limited")
|
|
141
133
|
return { kind: "limited", limitMicrocents: wire.integer(v.limitMicrocents) };
|
|
142
|
-
wire.object(value, ["kind"]);
|
|
143
134
|
return { kind: wire.literal(v.kind, "unlimited") };
|
|
144
135
|
}
|
|
145
136
|
function parseUsageSource(value) {
|
|
146
|
-
const v = wire.
|
|
137
|
+
const v = wire.fields(value, ["surface", "actual", "reserved", "tokens"]);
|
|
147
138
|
return {
|
|
148
139
|
surface: source(v.surface),
|
|
149
140
|
actual: parseValue(v.actual),
|
|
@@ -152,7 +143,7 @@ function parseUsageSource(value) {
|
|
|
152
143
|
};
|
|
153
144
|
}
|
|
154
145
|
function parseUsageItem(value) {
|
|
155
|
-
const v = wire.
|
|
146
|
+
const v = wire.fields(value, [
|
|
156
147
|
"id",
|
|
157
148
|
"at",
|
|
158
149
|
"surface",
|
|
@@ -186,7 +177,7 @@ function parseUsageItem(value) {
|
|
|
186
177
|
};
|
|
187
178
|
}
|
|
188
179
|
export function parseHcodeUsage(value) {
|
|
189
|
-
const v = wire.
|
|
180
|
+
const v = wire.fields(value, [
|
|
190
181
|
"schemaVersion",
|
|
191
182
|
"accountId",
|
|
192
183
|
"environmentId",
|
|
@@ -240,6 +231,19 @@ export function parseHcodeUsageQuery(value) {
|
|
|
240
231
|
};
|
|
241
232
|
}
|
|
242
233
|
const efforts = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
234
|
+
/** Header naming why a successful catalog is empty; Forge keeps the body closed for released clients. */
|
|
235
|
+
export const HCODE_CATALOG_EMPTY_REASON_HEADER = "x-hcode-catalog-empty-reason";
|
|
236
|
+
const HCODE_CATALOG_EMPTY_REASONS = [
|
|
237
|
+
"no_cli_models_approved",
|
|
238
|
+
"provider_key_not_cli_enabled",
|
|
239
|
+
"cli_capacity_unconfigured",
|
|
240
|
+
"provider_key_not_dedicated",
|
|
241
|
+
"models_not_qualified",
|
|
242
|
+
];
|
|
243
|
+
/** Accepts only a known reason code; unknown or missing values are dropped, never displayed. */
|
|
244
|
+
export function parseHcodeCatalogEmptyReason(value) {
|
|
245
|
+
return HCODE_CATALOG_EMPTY_REASONS.find((reason) => reason === value);
|
|
246
|
+
}
|
|
243
247
|
const bytes = (value) => new TextEncoder().encode(value).length;
|
|
244
248
|
function scalar(value, max = 1048576, min = 0) {
|
|
245
249
|
const text = wire.string(value, max, min);
|
|
@@ -358,18 +362,17 @@ function jsonSchema(value) {
|
|
|
358
362
|
refs(parsed, "schema");
|
|
359
363
|
return parsed;
|
|
360
364
|
}
|
|
361
|
-
function rates(value
|
|
362
|
-
const v = wire.
|
|
365
|
+
function rates(value) {
|
|
366
|
+
const v = wire.fields(value, ["input", "output", "cacheRead", "cacheWrite"]);
|
|
363
367
|
return {
|
|
364
368
|
input: wire.number(v.input),
|
|
365
369
|
output: wire.number(v.output),
|
|
366
370
|
cacheRead: wire.number(v.cacheRead),
|
|
367
371
|
cacheWrite: wire.number(v.cacheWrite),
|
|
368
|
-
...(tier ? { inputTokensAbove: wire.integer(v.inputTokensAbove) } : {}),
|
|
369
372
|
};
|
|
370
373
|
}
|
|
371
374
|
function parseModel(value) {
|
|
372
|
-
const v = wire.
|
|
375
|
+
const v = wire.fields(value, [
|
|
373
376
|
"id",
|
|
374
377
|
"name",
|
|
375
378
|
"api",
|
|
@@ -389,7 +392,7 @@ function parseModel(value) {
|
|
|
389
392
|
const input = wire.array(v.input, (entry) => wire.member(entry, ["text", "image"]), 2, 1);
|
|
390
393
|
if (input[0] !== "text" || (input.length === 2 && input[1] !== "image"))
|
|
391
394
|
return wire.invalid();
|
|
392
|
-
const map = wire.
|
|
395
|
+
const map = wire.fields(v.thinkingLevelMap, efforts);
|
|
393
396
|
const thinkingLevelMap = {};
|
|
394
397
|
for (const effort of efforts)
|
|
395
398
|
thinkingLevelMap[effort] = map[effort] === null ? null : wire.literal(map[effort], effort);
|
|
@@ -399,32 +402,25 @@ function parseModel(value) {
|
|
|
399
402
|
if (!efforts.some((e) => thinkingLevelMap[e] !== null) ||
|
|
400
403
|
(reasoning && !efforts.some((e) => e !== "off" && thinkingLevelMap[e] !== null)))
|
|
401
404
|
return wire.invalid();
|
|
402
|
-
const costRecord = wire.
|
|
403
|
-
const cost = {
|
|
404
|
-
...rates({
|
|
405
|
-
input: costRecord.input,
|
|
406
|
-
output: costRecord.output,
|
|
407
|
-
cacheRead: costRecord.cacheRead,
|
|
408
|
-
cacheWrite: costRecord.cacheWrite,
|
|
409
|
-
}),
|
|
410
|
-
};
|
|
405
|
+
const costRecord = wire.fields(v.cost, ["input", "output", "cacheRead", "cacheWrite", "tiers"]);
|
|
406
|
+
const cost = { ...rates(costRecord) };
|
|
411
407
|
if (costRecord.tiers !== undefined) {
|
|
412
|
-
const tiers = wire.array(costRecord.tiers, (entry) => {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
}, 1024);
|
|
408
|
+
const tiers = wire.array(costRecord.tiers, (entry) => ({
|
|
409
|
+
...rates(entry),
|
|
410
|
+
inputTokensAbove: wire.integer(wire.fields(entry, ["inputTokensAbove"]).inputTokensAbove),
|
|
411
|
+
}), 1024);
|
|
416
412
|
if (tiers.some((entry, i) => entry.inputTokensAbove <= (tiers[i - 1]?.inputTokensAbove ?? -1)))
|
|
417
413
|
return wire.invalid();
|
|
418
414
|
cost.tiers = tiers;
|
|
419
415
|
}
|
|
420
|
-
const limits = wire.
|
|
416
|
+
const limits = wire.fields(v.inputLimits, ["maxRequestBytes", "images"]);
|
|
421
417
|
const inputLimits = {};
|
|
422
418
|
if (limits.maxRequestBytes !== undefined)
|
|
423
419
|
inputLimits.maxRequestBytes = wire.integer(limits.maxRequestBytes, 12582912, 1);
|
|
424
420
|
if (limits.images !== undefined) {
|
|
425
421
|
if (input.length !== 2)
|
|
426
422
|
return wire.invalid();
|
|
427
|
-
const image = wire.
|
|
423
|
+
const image = wire.fields(limits.images, ["resize", "maxPerMessage", "maxPerRequest"]), resize = wire.fields(image.resize, ["maxWidth", "maxHeight", "maxBytes", "jpegQuality"]);
|
|
428
424
|
inputLimits.images = {
|
|
429
425
|
maxPerMessage: wire.integer(image.maxPerMessage, 4, 1),
|
|
430
426
|
maxPerRequest: wire.integer(image.maxPerRequest, 4, 1),
|
|
@@ -459,8 +455,7 @@ function parseModel(value) {
|
|
|
459
455
|
};
|
|
460
456
|
}
|
|
461
457
|
export function parseHcodeModelList(value) {
|
|
462
|
-
|
|
463
|
-
const v = wire.object(value, ["object", "data"]);
|
|
458
|
+
const v = wire.fields(value, ["object", "data"]);
|
|
464
459
|
const data = wire.array(v.data, parseModel, 1024);
|
|
465
460
|
if (new Set(data.map((model) => model.id)).size !== data.length)
|
|
466
461
|
return wire.invalid();
|
|
@@ -502,8 +497,8 @@ function thinkingBlock(value) {
|
|
|
502
497
|
return wire.invalid();
|
|
503
498
|
return result;
|
|
504
499
|
}
|
|
505
|
-
function toolCall(value) {
|
|
506
|
-
const v =
|
|
500
|
+
function toolCall(value, read) {
|
|
501
|
+
const v = read(value, ["type", "id", "name", "arguments", "thoughtSignature", "namespace", "argumentsError"]);
|
|
507
502
|
const result = {
|
|
508
503
|
type: wire.literal(v.type, "toolCall"),
|
|
509
504
|
id: ascii(v.id),
|
|
@@ -709,7 +704,7 @@ function parseMessage(value) {
|
|
|
709
704
|
return record.type === "thinking"
|
|
710
705
|
? thinkingBlock(entry)
|
|
711
706
|
: record.type === "toolCall"
|
|
712
|
-
? toolCall(entry)
|
|
707
|
+
? toolCall(entry, wire.object)
|
|
713
708
|
: textBlock(entry);
|
|
714
709
|
}, 2048),
|
|
715
710
|
api: scalar(v.api, 256, 1),
|
|
@@ -797,6 +792,25 @@ function parseOptions(value) {
|
|
|
797
792
|
}
|
|
798
793
|
return result;
|
|
799
794
|
}
|
|
795
|
+
export const HCODE_REQUEST_MAX_IMAGE_BYTES = 8 * 1024 * 1024;
|
|
796
|
+
export const HCODE_REQUEST_MAX_NON_IMAGE_BYTES = 1024 * 1024;
|
|
797
|
+
/** Base64 payload bytes are the only bytes excluded from the non-image envelope budget. */
|
|
798
|
+
export function hcodeImagePayloadBytes(messages) {
|
|
799
|
+
let bytes = 0;
|
|
800
|
+
for (const message of messages) {
|
|
801
|
+
if (typeof message.content === "string")
|
|
802
|
+
continue;
|
|
803
|
+
for (const block of message.content)
|
|
804
|
+
if (block.type === "image")
|
|
805
|
+
bytes += block.data.length;
|
|
806
|
+
}
|
|
807
|
+
return bytes;
|
|
808
|
+
}
|
|
809
|
+
/** Decoded size of an image payload already validated as canonical base64. */
|
|
810
|
+
export function hcodeDecodedImageBytes(data) {
|
|
811
|
+
const padding = data.endsWith("==") ? 2 : data.endsWith("=") ? 1 : 0;
|
|
812
|
+
return (data.length / 4) * 3 - padding;
|
|
813
|
+
}
|
|
800
814
|
export function parseHcodeMessagesRequest(value) {
|
|
801
815
|
const raw = boundedJson(value, 48, 1048576);
|
|
802
816
|
if (wire.jsonBytes(raw) > 12582912)
|
|
@@ -856,8 +870,7 @@ export function parseHcodeMessagesRequest(value) {
|
|
|
856
870
|
if (block.type === "image") {
|
|
857
871
|
images++;
|
|
858
872
|
perMessage++;
|
|
859
|
-
const
|
|
860
|
-
const decoded = (block.data.length / 4) * 3 - padding;
|
|
873
|
+
const decoded = hcodeDecodedImageBytes(block.data);
|
|
861
874
|
if (decoded > 3145728)
|
|
862
875
|
return wire.invalid();
|
|
863
876
|
imageBytes += decoded;
|
|
@@ -866,23 +879,19 @@ export function parseHcodeMessagesRequest(value) {
|
|
|
866
879
|
return wire.invalid();
|
|
867
880
|
}
|
|
868
881
|
}
|
|
869
|
-
if (pending.size || blocks > 2048 || images > 4 || imageBytes >
|
|
882
|
+
if (pending.size || blocks > 2048 || images > 4 || imageBytes > HCODE_REQUEST_MAX_IMAGE_BYTES)
|
|
870
883
|
return wire.invalid();
|
|
871
884
|
const choice = result.options?.toolChoice;
|
|
872
885
|
if (choice !== undefined && (!active.size || (typeof choice === "object" && !active.has(choice.function.name))))
|
|
873
886
|
return wire.invalid();
|
|
874
887
|
// Count the raw envelope, including ignored bookkeeping, with only actual image payloads emptied.
|
|
875
|
-
|
|
876
|
-
messages.reduce((sum, message) => sum +
|
|
877
|
-
(typeof message.content === "string"
|
|
878
|
-
? 0
|
|
879
|
-
: message.content.reduce((n, block) => n + (block.type === "image" ? block.data.length : 0), 0)), 0);
|
|
880
|
-
if (nonImage > 1048576)
|
|
888
|
+
if (wire.jsonBytes(raw) - hcodeImagePayloadBytes(messages) > HCODE_REQUEST_MAX_NON_IMAGE_BYTES)
|
|
881
889
|
return wire.invalid();
|
|
882
890
|
return result;
|
|
883
891
|
}
|
|
892
|
+
/** Open reader for streamed usage; request history closes its keys before calling this. */
|
|
884
893
|
export function parseHcodePiUsage(value) {
|
|
885
|
-
const v = wire.
|
|
894
|
+
const v = wire.fields(value, [
|
|
886
895
|
"input",
|
|
887
896
|
"output",
|
|
888
897
|
"cacheRead",
|
|
@@ -896,7 +905,7 @@ export function parseHcodePiUsage(value) {
|
|
|
896
905
|
const input = wire.integer(v.input, 2147483647), output = wire.integer(v.output, 2147483647), cacheRead = wire.integer(v.cacheRead, 2147483647), cacheWrite = wire.integer(v.cacheWrite, 2147483647), totalTokens = wire.integer(v.totalTokens, 2147483647);
|
|
897
906
|
if (totalTokens !== input + output + cacheRead + cacheWrite)
|
|
898
907
|
return wire.invalid();
|
|
899
|
-
const cost = wire.
|
|
908
|
+
const cost = wire.fields(v.cost, ["input", "output", "cacheRead", "cacheWrite", "total", "totalFromProvider"]);
|
|
900
909
|
const costResult = {
|
|
901
910
|
input: wire.number(cost.input, 0, Number.MAX_SAFE_INTEGER),
|
|
902
911
|
output: wire.number(cost.output, 0, Number.MAX_SAFE_INTEGER),
|
|
@@ -926,9 +935,9 @@ const safeStreamErrors = [
|
|
|
926
935
|
"HUMAIN Code account unavailable.",
|
|
927
936
|
"Request aborted.",
|
|
928
937
|
];
|
|
938
|
+
/** Parse one streamed event; unknown keys are ignored, unknown event types are invalid. */
|
|
929
939
|
export function parseHcodePiEvent(value) {
|
|
930
|
-
|
|
931
|
-
const v = wire.object(value, [
|
|
940
|
+
const v = wire.fields(value, [
|
|
932
941
|
"type",
|
|
933
942
|
"contentIndex",
|
|
934
943
|
"delta",
|
|
@@ -945,20 +954,9 @@ export function parseHcodePiEvent(value) {
|
|
|
945
954
|
"responseModel",
|
|
946
955
|
"providerThinkingLevel",
|
|
947
956
|
]);
|
|
948
|
-
if (v.type === "start")
|
|
949
|
-
wire.object(value, ["type"]);
|
|
957
|
+
if (v.type === "start")
|
|
950
958
|
return { type: "start" };
|
|
951
|
-
}
|
|
952
959
|
if (v.type === "done" || v.type === "error") {
|
|
953
|
-
wire.object(value, [
|
|
954
|
-
"type",
|
|
955
|
-
"reason",
|
|
956
|
-
"usage",
|
|
957
|
-
"responseId",
|
|
958
|
-
"responseModel",
|
|
959
|
-
"providerThinkingLevel",
|
|
960
|
-
...(v.type === "error" ? ["errorMessage"] : []),
|
|
961
|
-
]);
|
|
962
960
|
const terminal = {
|
|
963
961
|
usage: parseHcodePiUsage(v.usage),
|
|
964
962
|
...(v.responseId === undefined ? {} : { responseId: ascii(v.responseId) }),
|
|
@@ -972,30 +970,23 @@ export function parseHcodePiEvent(value) {
|
|
|
972
970
|
return wire.invalid();
|
|
973
971
|
return { type: "done", reason: wire.member(v.reason, ["stop", "length", "toolUse"]), ...terminal };
|
|
974
972
|
}
|
|
973
|
+
if (Object.hasOwn(v, "errorMessage") && typeof v.errorMessage !== "string")
|
|
974
|
+
return wire.invalid();
|
|
975
|
+
// Unknown or reworded text is dropped, never reflected; the CLI then shows its own generic failure.
|
|
976
|
+
const errorMessage = safeStreamErrors.find((entry) => entry === v.errorMessage);
|
|
975
977
|
return {
|
|
976
978
|
type: "error",
|
|
977
979
|
reason: wire.member(v.reason, ["aborted", "error"]),
|
|
978
980
|
...terminal,
|
|
979
|
-
...(
|
|
981
|
+
...(errorMessage === undefined ? {} : { errorMessage }),
|
|
980
982
|
};
|
|
981
983
|
}
|
|
982
984
|
const contentIndex = wire.integer(v.contentIndex, 2047);
|
|
983
|
-
if (v.type === "text_start" || v.type === "thinking_start")
|
|
984
|
-
wire.object(value, ["type", "contentIndex"]);
|
|
985
|
+
if (v.type === "text_start" || v.type === "thinking_start")
|
|
985
986
|
return { type: v.type, contentIndex };
|
|
986
|
-
|
|
987
|
-
if (v.type === "text_delta" || v.type === "thinking_delta" || v.type === "toolcall_delta") {
|
|
988
|
-
wire.object(value, ["type", "contentIndex", "delta"]);
|
|
987
|
+
if (v.type === "text_delta" || v.type === "thinking_delta" || v.type === "toolcall_delta")
|
|
989
988
|
return { type: v.type, contentIndex, delta: scalar(v.delta, v.type === "toolcall_delta" ? 65536 : 1048576) };
|
|
990
|
-
}
|
|
991
989
|
if (v.type === "text_end" || v.type === "thinking_end") {
|
|
992
|
-
wire.object(value, [
|
|
993
|
-
"type",
|
|
994
|
-
"contentIndex",
|
|
995
|
-
"content",
|
|
996
|
-
"contentSignature",
|
|
997
|
-
...(v.type === "thinking_end" ? ["redacted"] : []),
|
|
998
|
-
]);
|
|
999
990
|
const end = {
|
|
1000
991
|
contentIndex,
|
|
1001
992
|
content: scalar(v.content, 8388608),
|
|
@@ -1008,12 +999,9 @@ export function parseHcodePiEvent(value) {
|
|
|
1008
999
|
return wire.invalid();
|
|
1009
1000
|
return { type: "thinking_end", ...end, ...(redacted === undefined ? {} : { redacted }) };
|
|
1010
1001
|
}
|
|
1011
|
-
if (v.type === "toolcall_start")
|
|
1012
|
-
wire.object(value, ["type", "contentIndex", "id", "toolName"]);
|
|
1002
|
+
if (v.type === "toolcall_start")
|
|
1013
1003
|
return { type: "toolcall_start", contentIndex, id: ascii(v.id), toolName: toolName(v.toolName) };
|
|
1014
|
-
}
|
|
1015
|
-
wire.object(value, ["type", "contentIndex", "toolCall"]);
|
|
1016
|
-
return { type: wire.literal(v.type, "toolcall_end"), contentIndex, toolCall: toolCall(v.toolCall) };
|
|
1004
|
+
return { type: wire.literal(v.type, "toolcall_end"), contentIndex, toolCall: toolCall(v.toolCall, wire.fields) };
|
|
1017
1005
|
}
|
|
1018
1006
|
export function createHcodePiEventValidator() {
|
|
1019
1007
|
let started = false, terminal = false, failed = false, retained = 0, malformed = false;
|
|
@@ -1106,29 +1094,13 @@ const snapshotFields = [
|
|
|
1106
1094
|
"remaining",
|
|
1107
1095
|
"costComplete",
|
|
1108
1096
|
];
|
|
1109
|
-
function checkAllowanceConsistency(value) {
|
|
1110
|
-
if ((value.allowance.kind === "unlimited") !== (value.remaining.kind === "unlimited"))
|
|
1111
|
-
wire.invalid();
|
|
1112
|
-
if (value.actual.kind === "known" &&
|
|
1113
|
-
value.reserved.kind === "known" &&
|
|
1114
|
-
value.committed.kind === "known" &&
|
|
1115
|
-
(!Number.isSafeInteger(value.actual.value + value.reserved.value) ||
|
|
1116
|
-
value.committed.value !== value.actual.value + value.reserved.value))
|
|
1117
|
-
wire.invalid();
|
|
1118
|
-
if (value.allowance.kind === "limited" &&
|
|
1119
|
-
value.committed.kind === "known" &&
|
|
1120
|
-
value.remaining.kind === "known" &&
|
|
1121
|
-
value.remaining.value !== Math.max(0, value.allowance.limitMicrocents - value.committed.value))
|
|
1122
|
-
wire.invalid();
|
|
1123
|
-
}
|
|
1124
1097
|
export function parseAllowanceSnapshot(value) {
|
|
1125
|
-
const v = wire.
|
|
1098
|
+
const v = wire.fields(value, snapshotFields), period = wire.fields(v.period, ["start", "resetAt"]);
|
|
1126
1099
|
const start = wire.time(period.start), resetAt = wire.time(period.resetAt);
|
|
1127
1100
|
if (Date.parse(start) >= Date.parse(resetAt))
|
|
1128
1101
|
return wire.invalid();
|
|
1129
|
-
const
|
|
1130
|
-
|
|
1131
|
-
? { kind: wire.literal(wire.object(v.remaining, ["kind"]).kind, "unlimited") }
|
|
1102
|
+
const remaining = wire.fields(v.remaining, ["kind"]).kind === "unlimited"
|
|
1103
|
+
? { kind: "unlimited" }
|
|
1132
1104
|
: parseValue(v.remaining);
|
|
1133
1105
|
const result = {
|
|
1134
1106
|
asOf: wire.time(v.asOf),
|
|
@@ -1142,7 +1114,9 @@ export function parseAllowanceSnapshot(value) {
|
|
|
1142
1114
|
remaining,
|
|
1143
1115
|
costComplete: wire.boolean(v.costComplete),
|
|
1144
1116
|
};
|
|
1145
|
-
|
|
1117
|
+
// The server's arithmetic is shown as sent; only the allowance kind must agree with the remaining kind.
|
|
1118
|
+
if ((result.allowance.kind === "unlimited") !== (result.remaining.kind === "unlimited"))
|
|
1119
|
+
return wire.invalid();
|
|
1146
1120
|
return result;
|
|
1147
1121
|
}
|
|
1148
1122
|
export function parseHcodeAdminResolutionEvidence(value) {
|
|
@@ -1168,6 +1142,20 @@ export function parseHcodeAdminResolutionEvidence(value) {
|
|
|
1168
1142
|
const decision = wire.member(v.decision, ["charged", "not-charged"]), basis = wire.member(v.basis, ["provider-evidence", "no-charge-evidence", "administrative-waiver"]), costMicrocents = wire.integer(v.costMicrocents);
|
|
1169
1143
|
if (decision === "charged" ? basis !== "provider-evidence" : costMicrocents !== 0 || basis === "provider-evidence")
|
|
1170
1144
|
return wire.invalid();
|
|
1145
|
+
const tokens = readTokenCounts(wire.object(v.tokens, tokenKeys), 2147483647, (value) => {
|
|
1146
|
+
const count = wire.object(value, ["kind", "value"]);
|
|
1147
|
+
if (count.kind !== "known")
|
|
1148
|
+
wire.object(value, ["kind"]);
|
|
1149
|
+
return parseValue(count);
|
|
1150
|
+
});
|
|
1151
|
+
const { input, output, cacheRead, cacheWrite, total } = tokens;
|
|
1152
|
+
if (input.kind === "known") {
|
|
1153
|
+
if (output.kind === "known" && total.kind === "known" && total.value !== input.value + output.value)
|
|
1154
|
+
return wire.invalid();
|
|
1155
|
+
if ((cacheRead.kind === "known" ? cacheRead.value : 0) + (cacheWrite.kind === "known" ? cacheWrite.value : 0) >
|
|
1156
|
+
input.value)
|
|
1157
|
+
return wire.invalid();
|
|
1158
|
+
}
|
|
1171
1159
|
return {
|
|
1172
1160
|
kind: wire.literal(v.kind, "admin-resolution"),
|
|
1173
1161
|
resolutionId: wire.string(v.resolutionId),
|
|
@@ -1182,7 +1170,7 @@ export function parseHcodeAdminResolutionEvidence(value) {
|
|
|
1182
1170
|
basis,
|
|
1183
1171
|
reason,
|
|
1184
1172
|
evidenceReference,
|
|
1185
|
-
tokens
|
|
1173
|
+
tokens,
|
|
1186
1174
|
};
|
|
1187
1175
|
}
|
|
1188
1176
|
const errorMessages = {
|
|
@@ -1203,41 +1191,47 @@ const errorMessages = {
|
|
|
1203
1191
|
settlement_unavailable: "Settlement unavailable.",
|
|
1204
1192
|
};
|
|
1205
1193
|
export const HCODE_ALLOWANCE_ESTIMATE_MESSAGE = "Your remaining monthly allowance cannot cover this request.";
|
|
1194
|
+
/** Parse a refusal by its code; the server's wording and unknown keys are ignored, and the CLI shows its own text. */
|
|
1206
1195
|
export function parseHcodeInferenceError(value) {
|
|
1207
|
-
const outer = wire.
|
|
1196
|
+
const outer = wire.fields(value, ["error"]), v = wire.fields(outer.error, ["code", "message", "details"]);
|
|
1197
|
+
if (typeof v.message !== "string")
|
|
1198
|
+
return wire.invalid();
|
|
1199
|
+
// An unknown code stays invalid: the caller then shows the generic "do not resend" failure, never a refusal.
|
|
1208
1200
|
const code = wire.member(v.code, Object.keys(errorMessages));
|
|
1209
1201
|
if (code === "hcode_busy") {
|
|
1210
|
-
const d = wire.
|
|
1202
|
+
const d = wire.fields(v.details, ["dispatched", "automaticRetryAllowed", "retryAfterMs"]);
|
|
1211
1203
|
return {
|
|
1212
1204
|
error: {
|
|
1213
1205
|
code,
|
|
1214
|
-
message:
|
|
1206
|
+
message: errorMessages[code],
|
|
1215
1207
|
details: {
|
|
1216
1208
|
dispatched: wire.literal(d.dispatched, false),
|
|
1217
1209
|
automaticRetryAllowed: wire.literal(d.automaticRetryAllowed, false),
|
|
1218
|
-
retryAfterMs: wire.
|
|
1210
|
+
retryAfterMs: wire.integer(d.retryAfterMs, Number.MAX_SAFE_INTEGER, 1),
|
|
1219
1211
|
},
|
|
1220
1212
|
},
|
|
1221
1213
|
};
|
|
1222
1214
|
}
|
|
1223
1215
|
if (code === "quota_exceeded") {
|
|
1224
|
-
const d = wire.
|
|
1216
|
+
const d = wire.fields(v.details, ["dispatched", "automaticRetryAllowed", "usage"]);
|
|
1217
|
+
const usage = parseAllowanceSnapshot(d.usage);
|
|
1218
|
+
// Allowance left over means the request's estimate, not the allowance, was refused.
|
|
1219
|
+
const estimate = v.message === HCODE_ALLOWANCE_ESTIMATE_MESSAGE ||
|
|
1220
|
+
(usage.remaining.kind === "known" && usage.remaining.value > 0);
|
|
1225
1221
|
return {
|
|
1226
1222
|
error: {
|
|
1227
1223
|
code,
|
|
1228
|
-
message:
|
|
1224
|
+
message: estimate ? HCODE_ALLOWANCE_ESTIMATE_MESSAGE : errorMessages[code],
|
|
1229
1225
|
details: {
|
|
1230
1226
|
dispatched: wire.literal(d.dispatched, false),
|
|
1231
1227
|
automaticRetryAllowed: wire.literal(d.automaticRetryAllowed, false),
|
|
1232
|
-
usage
|
|
1228
|
+
usage,
|
|
1233
1229
|
},
|
|
1234
1230
|
},
|
|
1235
1231
|
};
|
|
1236
1232
|
}
|
|
1237
1233
|
if (v.details !== null)
|
|
1238
1234
|
return wire.invalid();
|
|
1239
|
-
return {
|
|
1240
|
-
error: { code, message: wire.literal(v.message, errorMessages[code]), details: null },
|
|
1241
|
-
};
|
|
1235
|
+
return { error: { code, message: errorMessages[code], details: null } };
|
|
1242
1236
|
}
|
|
1243
1237
|
//# sourceMappingURL=contracts.js.map
|