@humain/humain-code 0.8.3 → 0.8.4
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 +141 -0
- package/dist/bundle/agent-monitor.js +1 -1
- package/dist/bundle/chunks/anthropic-messages-42CGJCSR.js +82 -0
- package/dist/bundle/chunks/ask-VH7GNX75.js +97 -0
- package/dist/bundle/chunks/azure-openai-responses-DOKKMBUN.js +15 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +200 -179
- package/dist/bundle/chunks/bowser-UX7KDMIY.js +92 -0
- package/dist/bundle/chunks/{chunk-46C6D7UC.js → chunk-2CYGUEQO.js} +1 -1
- package/dist/bundle/chunks/chunk-3RXT35Y3.js +3 -0
- package/dist/bundle/chunks/chunk-4BNDLR6C.js +177 -0
- package/dist/bundle/chunks/{chunk-MPRAQ6ZI.js → chunk-4LGBXPUD.js} +1 -1
- package/dist/bundle/chunks/chunk-4SL6URR3.js +90 -0
- package/dist/bundle/chunks/{chunk-7LSTTCSC.js → chunk-52642TYH.js} +316 -148
- package/dist/bundle/chunks/{chunk-LSRXA7OS.js → chunk-5C5K4EVJ.js} +3 -3
- package/dist/bundle/chunks/{chunk-2JNJJ6SZ.js → chunk-5KUCY54O.js} +3 -3
- package/dist/bundle/chunks/{chunk-4TDNOR36.js → chunk-625QJSFJ.js} +1 -1
- package/dist/bundle/chunks/chunk-73YX5XGR.js +2461 -0
- package/dist/bundle/chunks/chunk-7DIRHF4H.js +17 -0
- package/dist/bundle/chunks/{chunk-QJB5YI3I.js → chunk-7PAXKU7M.js} +1 -1
- package/dist/bundle/chunks/{chunk-R2KD2HFT.js → chunk-7YB3HRRN.js} +83 -196
- package/dist/bundle/chunks/{chunk-DCXHRP6C.js → chunk-A2UZYK23.js} +13 -13
- package/dist/bundle/chunks/chunk-A5ZMBTTM.js +12 -0
- package/dist/bundle/chunks/{chunk-JKX5EGOT.js → chunk-AER66CNP.js} +13 -13
- package/dist/bundle/chunks/chunk-ARTF7ZMQ.js +5 -0
- package/dist/bundle/chunks/chunk-B3FT6L6S.js +131 -0
- package/dist/bundle/chunks/chunk-BIC5BSNX.js +13 -0
- package/dist/bundle/chunks/{chunk-JSHKS7VH.js → chunk-BNZZJ4LO.js} +1 -1
- package/dist/bundle/chunks/{chunk-4MKATHT2.js → chunk-CG43CMFH.js} +1 -1
- package/dist/bundle/chunks/{chunk-2XD7TLKB.js → chunk-CIAXW64K.js} +16 -16
- package/dist/bundle/chunks/{chunk-VFLVWPLZ.js → chunk-CKFLQGJN.js} +20 -16
- package/dist/bundle/chunks/chunk-D4UCXXDP.js +115 -0
- package/dist/bundle/chunks/{chunk-HQMUDHC3.js → chunk-D6ZWWDW5.js} +6 -5
- package/dist/bundle/chunks/{chunk-4GB7A76U.js → chunk-EVDQRT3I.js} +225 -348
- package/dist/bundle/chunks/{chunk-FJIISX5W.js → chunk-F74XLJPC.js} +195 -192
- package/dist/bundle/chunks/chunk-FDRBTGFJ.js +4 -0
- package/dist/bundle/chunks/{chunk-E4VUW4RI.js → chunk-FLWO3H5J.js} +12 -12
- package/dist/bundle/chunks/{chunk-KLSRGGOH.js → chunk-G2PFPQX7.js} +2 -2
- package/dist/bundle/chunks/chunk-GMPJWLZS.js +57 -0
- package/dist/bundle/chunks/{chunk-M5TVWJ5T.js → chunk-H35P7ROY.js} +462 -441
- package/dist/bundle/chunks/chunk-HCHCYBNK.js +2 -0
- package/dist/bundle/chunks/{chunk-7WE77IE3.js → chunk-HRNYDRL7.js} +1 -1
- package/dist/bundle/chunks/chunk-HWFAAGYK.js +23 -0
- package/dist/bundle/chunks/{chunk-VSXVZVBE.js → chunk-HWXQCJDP.js} +408 -392
- package/dist/bundle/chunks/{chunk-PVNXN2TC.js → chunk-II5C7G67.js} +1 -1
- package/dist/bundle/chunks/{chunk-F2H47FRF.js → chunk-IMRZP5SC.js} +182 -137
- package/dist/bundle/chunks/{chunk-AW24RHGJ.js → chunk-J5YFXMTM.js} +4 -4
- package/dist/bundle/chunks/chunk-J64VNQ6D.js +13 -0
- package/dist/bundle/chunks/{chunk-65FLSKDA.js → chunk-K5EFEIFP.js} +5 -4
- package/dist/bundle/chunks/{chunk-KI7CHPWC.js → chunk-KJ3QRSSY.js} +46 -43
- package/dist/bundle/chunks/{cli-6DJO467D.js → chunk-KSEO2LRK.js} +12 -10
- package/dist/bundle/chunks/{chunk-HHWVVNGG.js → chunk-MA2WCMSN.js} +2 -2
- package/dist/bundle/chunks/{chunk-L4J7SMJB.js → chunk-MAEKQSFU.js} +1 -1
- package/dist/bundle/chunks/chunk-MHQNLTZR.js +8 -0
- package/dist/bundle/chunks/chunk-MLOUZAVZ.js +122 -0
- package/dist/bundle/chunks/chunk-MQYR4Q6X.js +5 -0
- package/dist/bundle/chunks/chunk-MXF3KYLZ.js +4 -0
- package/dist/bundle/chunks/{chunk-GY663MNP.js → chunk-MZRTVX7F.js} +1 -1
- package/dist/bundle/chunks/chunk-MZYHSWHX.js +59 -0
- package/dist/bundle/chunks/{chunk-6HTHDVJC.js → chunk-NPVRWPGX.js} +1 -1
- package/dist/bundle/chunks/{chunk-BRSLXHED.js → chunk-O44A4E4K.js} +1 -1
- package/dist/bundle/chunks/{chunk-T2ZGMEMV.js → chunk-OADQOW67.js} +175 -260
- package/dist/bundle/chunks/chunk-OTVHRZ67.js +17 -0
- package/dist/bundle/chunks/{chunk-J4GII2EE.js → chunk-P7SLTLSZ.js} +51 -46
- package/dist/bundle/chunks/{chunk-7OZNMWAJ.js → chunk-PPGSQZZF.js} +1 -1
- package/dist/bundle/chunks/chunk-PYX6ZCC7.js +29 -0
- package/dist/bundle/chunks/chunk-PZ7NYBHJ.js +8 -0
- package/dist/bundle/chunks/{chunk-VCMXBP5S.js → chunk-QESIDBMW.js} +1 -7
- package/dist/bundle/chunks/chunk-QUWVILLB.js +3 -0
- package/dist/bundle/chunks/chunk-QZWUXGY7.js +99 -0
- package/dist/bundle/chunks/{chunk-MIAXMK5F.js → chunk-QZXLTW7V.js} +8 -7
- package/dist/bundle/chunks/chunk-RP6MWUAP.js +4 -0
- package/dist/bundle/chunks/{chunk-MUN4ZZZP.js → chunk-SOE25WIS.js} +1143 -1167
- package/dist/bundle/chunks/{chunk-JSZBTGI6.js → chunk-SZZ5PNP6.js} +2 -2
- package/dist/bundle/chunks/chunk-T5WECB2D.js +7 -0
- package/dist/bundle/chunks/{chunk-2NVGOSBN.js → chunk-T7F2TEIS.js} +37 -13
- package/dist/bundle/chunks/{chunk-ZSWU5KKA.js → chunk-UOSJTMCL.js} +7 -3
- package/dist/bundle/chunks/{chunk-6P6MMQUH.js → chunk-UTRUALFN.js} +3 -3
- package/dist/bundle/chunks/{chunk-PWFM6AQQ.js → chunk-V2HTCZRF.js} +70 -67
- package/dist/bundle/chunks/{chunk-JX6YIPNK.js → chunk-WCKS2DPT.js} +1 -1
- package/dist/bundle/chunks/chunk-XGOJCV6Z.js +2 -0
- package/dist/bundle/chunks/chunk-XGSJX23G.js +1151 -0
- package/dist/bundle/chunks/{chunk-7WETECIB.js → chunk-Z7BWHPJ2.js} +1 -1
- package/dist/bundle/chunks/chunk-ZFFDBTG3.js +17 -0
- package/dist/bundle/chunks/cli-NJLV3XDZ.js +3 -0
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-JEZVYITT.js → cloudflare-workers-ai-system-one-ZAZW4M4B.js} +1 -1
- package/dist/bundle/chunks/{compat-4ILE5BEC.js → compat-7UJJAO4E.js} +12 -12
- package/dist/bundle/chunks/{curator-server-QB4GITGS.js → curator-server-MW645JI3.js} +2 -2
- package/dist/bundle/chunks/{dist-NXHRL2KY.js → dist-7PCCEUQF.js} +2 -2
- package/dist/bundle/chunks/{dist-I6CI3CG5.js → dist-I53JI67E.js} +9 -9
- package/dist/bundle/chunks/{dist-35STTNYA.js → dist-NI2PTSLH.js} +1 -1
- package/dist/bundle/chunks/{dist-CBODG4CA.js → dist-VXQT3DQY.js} +6 -6
- package/dist/bundle/chunks/{dist-cjs-EROMDUKS.js → dist-cjs-4JQA6W3S.js} +31 -31
- package/dist/bundle/chunks/doctor-KJVAYG3F.js +83 -0
- package/dist/bundle/chunks/{easter-egg-3d-VZC5WOYV.js → easter-egg-3d-Z24JLXD4.js} +1 -1
- package/dist/bundle/chunks/entry-3EL6GOWK.js +2 -0
- package/dist/bundle/chunks/{entry-6XDR2IDE.js → entry-4IMREZBD.js} +80 -79
- package/dist/bundle/chunks/{execute-6MEJJF2T.js → execute-C4BZQRPQ.js} +23 -22
- package/dist/bundle/chunks/{extract-L373D6O7.js → extract-XVQCIS7D.js} +5 -5
- package/dist/bundle/chunks/{flow-implementer-XOP4MG5X.js → flow-implementer-GE2ARQKR.js} +5 -5
- package/dist/bundle/chunks/github-copilot.js +57 -56
- package/dist/bundle/chunks/google-generative-ai-P2P45MYP.js +22 -0
- package/dist/bundle/chunks/google-vertex-SHY4IS5F.js +26 -0
- package/dist/bundle/chunks/{host-WOLZCWQQ.js → host-YESS2VAB.js} +1 -1
- package/dist/bundle/chunks/{index.bundle-HONF3PUD.js → index.bundle-TZT64KLH.js} +102 -89
- package/dist/bundle/chunks/{inprocess-MBKFGDM2.js → inprocess-MGMVI6HN.js} +6 -6
- package/dist/bundle/chunks/interactive-mode-HHWOE4FD.js +5 -0
- package/dist/bundle/chunks/{llama-cpp-classify-KYZT532X.js → llama-cpp-classify-RSRH4KV2.js} +5 -5
- package/dist/bundle/chunks/mistral-conversations-YTMJKHHI.js +42 -0
- package/dist/bundle/chunks/{node-N7TPBUJB.js → node-FF6QQQLH.js} +1 -1
- package/dist/bundle/chunks/openai-codex-responses-NUCJOJSZ.js +97 -0
- package/dist/bundle/chunks/openai-completions-E5NRJUHA.js +91 -0
- package/dist/bundle/chunks/{openai-decisions-JMSDGR7K.js → openai-decisions-342J5ZYG.js} +1 -1
- package/dist/bundle/chunks/openai-responses-BN5Z4HFI.js +26 -0
- package/dist/bundle/chunks/openrouter-images-7RNG3JVF.js +12 -0
- package/dist/bundle/chunks/{pdfjs-FE3L72A6.js → pdfjs-LSTLRXQW.js} +1415 -1416
- package/dist/bundle/chunks/pi-messages-2L7FV5OK.js +22 -0
- package/dist/bundle/chunks/questionnaire-session-XEVAK7JS.js +123 -0
- package/dist/bundle/chunks/runtime-2FSZRUG5.js +2 -0
- package/dist/bundle/chunks/session-picker-666KJIVM.js +4 -0
- package/dist/bundle/chunks/startup-ui-INEVSNGK.js +3 -0
- package/dist/bundle/chunks/{trace-command-VM7FBWPE.js → trace-command-BCVMZ5ZD.js} +4 -4
- package/dist/bundle/chunks/typesafe-system-one-UJUNSZG4.js +3 -0
- package/dist/bundle/chunks/{undici-WVNE45GY.js → undici-7IGAYA4S.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-UXSSFNV5.js +29 -0
- package/dist/bundle/cli-runtime.js +5 -5
- package/dist/bundle/flow/package.json +3 -3
- package/dist/bundle/index.js +13 -13
- package/dist/bundle/orchestrate/package.json +1 -1
- package/dist/bundle/rpc-entry.js +5 -4
- package/dist/cli/agent-dir-arg.d.ts +12 -0
- package/dist/cli/agent-dir-arg.d.ts.map +1 -0
- package/dist/cli/agent-dir-arg.js +15 -0
- package/dist/cli/agent-dir-arg.js.map +1 -0
- package/dist/cli/args.d.ts +9 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +19 -5
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth-check.d.ts +1 -1
- package/dist/cli/auth-check.d.ts.map +1 -1
- package/dist/cli/auth-check.js +4 -2
- package/dist/cli/auth-check.js.map +1 -1
- package/dist/cli/doctor-config.d.ts +14 -0
- package/dist/cli/doctor-config.d.ts.map +1 -0
- package/dist/cli/doctor-config.js +92 -0
- package/dist/cli/doctor-config.js.map +1 -0
- package/dist/cli/doctor-system.d.ts +12 -0
- package/dist/cli/doctor-system.d.ts.map +1 -0
- package/dist/cli/doctor-system.js +109 -0
- package/dist/cli/doctor-system.js.map +1 -0
- package/dist/cli/doctor.d.ts +11 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +323 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/doctor.lazy.d.ts +3 -0
- package/dist/cli/doctor.lazy.d.ts.map +1 -0
- package/dist/cli/doctor.lazy.js +3 -0
- package/dist/cli/doctor.lazy.js.map +1 -0
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +0 -4
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/project-trust.d.ts.map +1 -1
- package/dist/cli/project-trust.js +6 -6
- package/dist/cli/project-trust.js.map +1 -1
- package/dist/cli/startup-ui.d.ts +3 -2
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +23 -10
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/config.d.ts +5 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +13 -3
- package/dist/config.js.map +1 -1
- package/dist/coordination/broker/broker.d.ts +3 -3
- package/dist/coordination/broker/broker.d.ts.map +1 -1
- package/dist/coordination/broker/broker.js +15 -7
- package/dist/coordination/broker/broker.js.map +1 -1
- package/dist/core/acceptance-command.d.ts +6 -3
- package/dist/core/acceptance-command.d.ts.map +1 -1
- package/dist/core/acceptance-command.js +43 -12
- package/dist/core/acceptance-command.js.map +1 -1
- package/dist/core/acceptance-ledger.d.ts +2 -0
- package/dist/core/acceptance-ledger.d.ts.map +1 -1
- package/dist/core/acceptance-ledger.js +14 -3
- package/dist/core/acceptance-ledger.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +11 -4
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +13 -4
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +6 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +19 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +131 -36
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +7 -1
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts +3 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +18 -8
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +2 -2
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +9 -15
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +3 -0
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +12 -10
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/template.js +23 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +13 -2
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +9 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +2 -4
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts +5 -2
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +6 -3
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/keybindings.d.ts +20 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +4 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/mcp-servers.d.ts +29 -0
- package/dist/core/mcp-servers.d.ts.map +1 -1
- package/dist/core/mcp-servers.js +63 -17
- package/dist/core/mcp-servers.js.map +1 -1
- package/dist/core/messages.d.ts +4 -0
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +10 -2
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-config.d.ts +36 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +6 -2
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/nested-tool-calls.d.ts +6 -5
- package/dist/core/nested-tool-calls.d.ts.map +1 -1
- package/dist/core/nested-tool-calls.js +1 -3
- package/dist/core/nested-tool-calls.js.map +1 -1
- package/dist/core/os-secret-store.js +1 -1
- package/dist/core/os-secret-store.js.map +1 -1
- package/dist/core/package-manager.d.ts +3 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +25 -4
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/pi-ai-schemas.d.ts +4 -0
- package/dist/core/pi-ai-schemas.d.ts.map +1 -1
- package/dist/core/project-trust.d.ts.map +1 -1
- package/dist/core/project-trust.js +1 -1
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/provider-composer.d.ts +1 -0
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +1 -0
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts +4 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +14 -3
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +40 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js +11 -7
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +8 -4
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +22 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +227 -37
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +10 -1
- package/dist/core/settings-defaults.d.ts.map +1 -1
- package/dist/core/settings-defaults.js +7 -1
- package/dist/core/settings-defaults.js.map +1 -1
- package/dist/core/settings-manager.d.ts +14 -4
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +48 -15
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +20 -2
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +27 -4
- 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 +2 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tools/bash-jobs.js +2 -2
- package/dist/core/tools/bash-jobs.js.map +1 -1
- package/dist/core/tools/bash.d.ts +3 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +78 -46
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +7 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +139 -75
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +4 -1
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +21 -6
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +90 -76
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +7 -2
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +14 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts.map +1 -1
- package/dist/core/tools/renderers/bash.js +9 -3
- package/dist/core/tools/renderers/bash.js.map +1 -1
- package/dist/core/tools/truncate.d.ts +1 -1
- package/dist/core/tools/truncate.d.ts.map +1 -1
- package/dist/core/tools/truncate.js +16 -7
- package/dist/core/tools/truncate.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +2 -0
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trust-manager.d.ts +2 -0
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +5 -4
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/core/usage-totals.d.ts.map +1 -1
- package/dist/core/usage-totals.js +3 -0
- package/dist/core/usage-totals.js.map +1 -1
- package/dist/extensions/codemode/execute.d.ts.map +1 -1
- package/dist/extensions/codemode/execute.js +64 -20
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/codemode/renderer.d.ts.map +1 -1
- package/dist/extensions/codemode/renderer.js +8 -3
- package/dist/extensions/codemode/renderer.js.map +1 -1
- package/dist/extensions/codemode/tool.d.ts +5 -0
- package/dist/extensions/codemode/tool.d.ts.map +1 -1
- package/dist/extensions/codemode/tool.js.map +1 -1
- package/dist/extensions/llama/client.d.ts.map +1 -1
- package/dist/extensions/llama/client.js +3 -13
- package/dist/extensions/llama/client.js.map +1 -1
- package/dist/extensions/llama/ui.d.ts.map +1 -1
- package/dist/extensions/llama/ui.js +2 -1
- package/dist/extensions/llama/ui.js.map +1 -1
- package/dist/extensions/mcp/cli.d.ts +7 -0
- package/dist/extensions/mcp/cli.d.ts.map +1 -1
- package/dist/extensions/mcp/cli.js +35 -8
- package/dist/extensions/mcp/cli.js.map +1 -1
- package/dist/extensions/mcp/config.d.ts +33 -0
- package/dist/extensions/mcp/config.d.ts.map +1 -1
- package/dist/extensions/mcp/config.js +11 -2
- package/dist/extensions/mcp/config.js.map +1 -1
- package/dist/extensions/mcp/index.d.ts +8 -0
- package/dist/extensions/mcp/index.d.ts.map +1 -1
- package/dist/extensions/mcp/index.js +16 -0
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/resources.d.ts +1 -1
- package/dist/extensions/mcp/resources.d.ts.map +1 -1
- package/dist/extensions/mcp/resources.js +4 -3
- package/dist/extensions/mcp/resources.js.map +1 -1
- package/dist/extensions/mcp/runtime.d.ts +1 -1
- package/dist/extensions/mcp/runtime.d.ts.map +1 -1
- package/dist/extensions/mcp/runtime.js +15 -14
- package/dist/extensions/mcp/runtime.js.map +1 -1
- package/dist/extensions/mcp/tools.d.ts +1 -24
- package/dist/extensions/mcp/tools.d.ts.map +1 -1
- package/dist/extensions/mcp/tools.js +10 -163
- package/dist/extensions/mcp/tools.js.map +1 -1
- package/dist/humain/ask-user-question/index.d.ts +4 -0
- package/dist/humain/ask-user-question/index.d.ts.map +1 -0
- package/dist/humain/ask-user-question/index.js +18 -0
- package/dist/humain/ask-user-question/index.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/answer-channel.d.ts +38 -0
- package/dist/humain/ask-user-question/vendor/ask/answer-channel.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/answer-channel.js +97 -0
- package/dist/humain/ask-user-question/vendor/ask/answer-channel.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/ask-user-question.d.ts +41 -0
- package/dist/humain/ask-user-question/vendor/ask/ask-user-question.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/ask-user-question.js +441 -0
- package/dist/humain/ask-user-question/vendor/ask/ask-user-question.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/config.d.ts +39 -0
- package/dist/humain/ask-user-question/vendor/ask/config.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/config.js +95 -0
- package/dist/humain/ask-user-question/vendor/ask/config.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/events.d.ts +132 -0
- package/dist/humain/ask-user-question/vendor/ask/events.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/events.js +50 -0
- package/dist/humain/ask-user-question/vendor/ask/events.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/index.d.ts +5 -0
- package/dist/humain/ask-user-question/vendor/ask/index.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/index.js +15 -0
- package/dist/humain/ask-user-question/vendor/ask/index.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/presentation.d.ts +81 -0
- package/dist/humain/ask-user-question/vendor/ask/presentation.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/presentation.js +105 -0
- package/dist/humain/ask-user-question/vendor/ask/presentation.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/reconcile.d.ts +28 -0
- package/dist/humain/ask-user-question/vendor/ask/reconcile.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/reconcile.js +45 -0
- package/dist/humain/ask-user-question/vendor/ask/reconcile.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/rpc-fallback.d.ts +41 -0
- package/dist/humain/ask-user-question/vendor/ask/rpc-fallback.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/rpc-fallback.js +166 -0
- package/dist/humain/ask-user-question/vendor/ask/rpc-fallback.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/build-questionnaire.d.ts +46 -0
- package/dist/humain/ask-user-question/vendor/ask/state/build-questionnaire.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/build-questionnaire.js +247 -0
- package/dist/humain/ask-user-question/vendor/ask/state/build-questionnaire.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/external-editor.d.ts +11 -0
- package/dist/humain/ask-user-question/vendor/ask/state/external-editor.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/external-editor.js +56 -0
- package/dist/humain/ask-user-question/vendor/ask/state/external-editor.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/i18n-bridge.d.ts +6 -0
- package/dist/humain/ask-user-question/vendor/ask/state/i18n-bridge.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/i18n-bridge.js +10 -0
- package/dist/humain/ask-user-question/vendor/ask/state/i18n-bridge.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/key-router.d.ts +57 -0
- package/dist/humain/ask-user-question/vendor/ask/state/key-router.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/key-router.js +357 -0
- package/dist/humain/ask-user-question/vendor/ask/state/key-router.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/questionnaire-session.d.ts +112 -0
- package/dist/humain/ask-user-question/vendor/ask/state/questionnaire-session.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/questionnaire-session.js +240 -0
- package/dist/humain/ask-user-question/vendor/ask/state/questionnaire-session.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/row-intent.d.ts +87 -0
- package/dist/humain/ask-user-question/vendor/ask/state/row-intent.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/row-intent.js +79 -0
- package/dist/humain/ask-user-question/vendor/ask/state/row-intent.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/contract.d.ts +22 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/contract.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/contract.js +2 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/contract.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/derivations.d.ts +27 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/derivations.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/derivations.js +48 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/derivations.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/focus.d.ts +13 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/focus.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/focus.js +15 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/focus.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/projections.d.ts +14 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/projections.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/projections.js +96 -0
- package/dist/humain/ask-user-question/vendor/ask/state/selectors/projections.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/state-reducer.d.ts +58 -0
- package/dist/humain/ask-user-question/vendor/ask/state/state-reducer.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/state-reducer.js +310 -0
- package/dist/humain/ask-user-question/vendor/ask/state/state-reducer.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/state.d.ts +68 -0
- package/dist/humain/ask-user-question/vendor/ask/state/state.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/state/state.js +2 -0
- package/dist/humain/ask-user-question/vendor/ask/state/state.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/external-answer.d.ts +24 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/external-answer.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/external-answer.js +114 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/external-answer.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/format-answer.d.ts +18 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/format-answer.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/format-answer.js +29 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/format-answer.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/normalize-params.d.ts +41 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/normalize-params.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/normalize-params.js +99 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/normalize-params.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/response-envelope.d.ts +37 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/response-envelope.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/response-envelope.js +70 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/response-envelope.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/types.d.ts +129 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/types.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/types.js +76 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/types.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/validate-questionnaire.d.ts +21 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/validate-questionnaire.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/validate-questionnaire.js +49 -0
- package/dist/humain/ask-user-question/vendor/ask/tool/validate-questionnaire.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/component-binding.d.ts +23 -0
- package/dist/humain/ask-user-question/vendor/ask/view/component-binding.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/component-binding.js +16 -0
- package/dist/humain/ask-user-question/vendor/ask/view/component-binding.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/inline-input.d.ts +21 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/inline-input.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/inline-input.js +49 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/inline-input.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/multi-select-view.d.ts +43 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/multi-select-view.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/multi-select-view.js +130 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/multi-select-view.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/option-list-view.d.ts +45 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/option-list-view.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/option-list-view.js +39 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/option-list-view.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/markdown-content-cache.d.ts +36 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/markdown-content-cache.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/markdown-content-cache.js +72 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/markdown-content-cache.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-block-renderer.d.ts +61 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-block-renderer.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-block-renderer.js +108 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-block-renderer.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-box-renderer.d.ts +39 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-box-renderer.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-box-renderer.js +76 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-box-renderer.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-layout-decider.d.ts +123 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-layout-decider.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-layout-decider.js +180 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-layout-decider.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-pane.d.ts +108 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-pane.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-pane.js +235 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/preview/preview-pane.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/submit-picker.d.ts +37 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/submit-picker.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/submit-picker.js +47 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/submit-picker.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/tab-bar.d.ts +31 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/tab-bar.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/tab-bar.js +35 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/tab-bar.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/wrapping-select.d.ts +124 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/wrapping-select.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/wrapping-select.js +205 -0
- package/dist/humain/ask-user-question/vendor/ask/view/components/wrapping-select.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/dialog-builder.d.ts +83 -0
- package/dist/humain/ask-user-question/vendor/ask/view/dialog-builder.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/dialog-builder.js +186 -0
- package/dist/humain/ask-user-question/vendor/ask/view/dialog-builder.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/dialog-copy.d.ts +47 -0
- package/dist/humain/ask-user-question/vendor/ask/view/dialog-copy.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/dialog-copy.js +48 -0
- package/dist/humain/ask-user-question/vendor/ask/view/dialog-copy.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/props-adapter.d.ts +58 -0
- package/dist/humain/ask-user-question/vendor/ask/view/props-adapter.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/props-adapter.js +84 -0
- package/dist/humain/ask-user-question/vendor/ask/view/props-adapter.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/scroll-window.d.ts +20 -0
- package/dist/humain/ask-user-question/vendor/ask/view/scroll-window.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/scroll-window.js +55 -0
- package/dist/humain/ask-user-question/vendor/ask/view/scroll-window.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/stateful-view.d.ts +23 -0
- package/dist/humain/ask-user-question/vendor/ask/view/stateful-view.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/stateful-view.js +2 -0
- package/dist/humain/ask-user-question/vendor/ask/view/stateful-view.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/tab-components.d.ts +15 -0
- package/dist/humain/ask-user-question/vendor/ask/view/tab-components.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/tab-components.js +2 -0
- package/dist/humain/ask-user-question/vendor/ask/view/tab-components.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/tab-content-strategy.d.ts +98 -0
- package/dist/humain/ask-user-question/vendor/ask/view/tab-content-strategy.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/tab-content-strategy.js +248 -0
- package/dist/humain/ask-user-question/vendor/ask/view/tab-content-strategy.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/transcript.d.ts +23 -0
- package/dist/humain/ask-user-question/vendor/ask/view/transcript.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/ask/view/transcript.js +131 -0
- package/dist/humain/ask-user-question/vendor/ask/view/transcript.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/config/config.d.ts +132 -0
- package/dist/humain/ask-user-question/vendor/config/config.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/config/config.js +286 -0
- package/dist/humain/ask-user-question/vendor/config/config.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/config/index.d.ts +2 -0
- package/dist/humain/ask-user-question/vendor/config/index.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/config/index.js +2 -0
- package/dist/humain/ask-user-question/vendor/config/index.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/i18n/i18n.d.ts +64 -0
- package/dist/humain/ask-user-question/vendor/i18n/i18n.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/i18n/i18n.js +185 -0
- package/dist/humain/ask-user-question/vendor/i18n/i18n.js.map +1 -0
- package/dist/humain/ask-user-question/vendor/i18n/loader.d.ts +44 -0
- package/dist/humain/ask-user-question/vendor/i18n/loader.d.ts.map +1 -0
- package/dist/humain/ask-user-question/vendor/i18n/loader.js +55 -0
- package/dist/humain/ask-user-question/vendor/i18n/loader.js.map +1 -0
- package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +26 -16
- package/dist/humain/brand-logo.d.ts +2 -0
- package/dist/humain/brand-logo.d.ts.map +1 -1
- package/dist/humain/brand-logo.js +4 -0
- package/dist/humain/brand-logo.js.map +1 -1
- package/dist/humain/bundled-extension-names.d.ts +1 -0
- package/dist/humain/bundled-extension-names.d.ts.map +1 -1
- package/dist/humain/bundled-extension-names.js +1 -0
- package/dist/humain/bundled-extension-names.js.map +1 -1
- package/dist/humain/checklist/footer-progress.d.ts +7 -0
- package/dist/humain/checklist/footer-progress.d.ts.map +1 -0
- package/dist/humain/checklist/footer-progress.js +15 -0
- package/dist/humain/checklist/footer-progress.js.map +1 -0
- package/dist/humain/checklist/glyphs.d.ts +7 -0
- package/dist/humain/checklist/glyphs.d.ts.map +1 -0
- package/dist/humain/checklist/glyphs.js +8 -0
- package/dist/humain/checklist/glyphs.js.map +1 -0
- package/dist/humain/checklist/index.d.ts +6 -0
- package/dist/humain/checklist/index.d.ts.map +1 -0
- package/dist/humain/checklist/index.js +37 -0
- package/dist/humain/checklist/index.js.map +1 -0
- package/dist/humain/checklist/progress.d.ts +37 -0
- package/dist/humain/checklist/progress.d.ts.map +1 -0
- package/dist/humain/checklist/progress.js +234 -0
- package/dist/humain/checklist/progress.js.map +1 -0
- package/dist/humain/checklist/projector.d.ts +53 -0
- package/dist/humain/checklist/projector.d.ts.map +1 -0
- package/dist/humain/checklist/projector.js +198 -0
- package/dist/humain/checklist/projector.js.map +1 -0
- package/dist/humain/checklist/sidebar.d.ts +18 -0
- package/dist/humain/checklist/sidebar.d.ts.map +1 -0
- package/dist/humain/checklist/sidebar.js +38 -0
- package/dist/humain/checklist/sidebar.js.map +1 -0
- package/dist/humain/checklist/status-segment.d.ts +19 -0
- package/dist/humain/checklist/status-segment.d.ts.map +1 -0
- package/dist/humain/checklist/status-segment.js +59 -0
- package/dist/humain/checklist/status-segment.js.map +1 -0
- package/dist/humain/checklist/vendor/add-task-dialog.d.ts +54 -0
- package/dist/humain/checklist/vendor/add-task-dialog.d.ts.map +1 -0
- package/dist/humain/checklist/vendor/add-task-dialog.js +238 -0
- package/dist/humain/checklist/vendor/add-task-dialog.js.map +1 -0
- package/dist/humain/checklist/vendor/commands.d.ts +38 -0
- package/dist/humain/checklist/vendor/commands.d.ts.map +1 -0
- package/dist/humain/checklist/vendor/commands.js +193 -0
- package/dist/humain/checklist/vendor/commands.js.map +1 -0
- package/dist/humain/checklist/vendor/index.d.ts +3 -0
- package/dist/humain/checklist/vendor/index.d.ts.map +1 -0
- package/dist/humain/checklist/vendor/index.js +276 -0
- package/dist/humain/checklist/vendor/index.js.map +1 -0
- package/dist/humain/checklist/vendor/render.d.ts +97 -0
- package/dist/humain/checklist/vendor/render.d.ts.map +1 -0
- package/dist/humain/checklist/vendor/render.js +354 -0
- package/dist/humain/checklist/vendor/render.js.map +1 -0
- package/dist/humain/checklist/vendor/settings.d.ts +11 -0
- package/dist/humain/checklist/vendor/settings.d.ts.map +1 -0
- package/dist/humain/checklist/vendor/settings.js +8 -0
- package/dist/humain/checklist/vendor/settings.js.map +1 -0
- package/dist/humain/checklist/vendor/store.d.ts +120 -0
- package/dist/humain/checklist/vendor/store.d.ts.map +1 -0
- package/dist/humain/checklist/vendor/store.js +990 -0
- package/dist/humain/checklist/vendor/store.js.map +1 -0
- package/dist/humain/checklist/vendor/tools.d.ts +21 -0
- package/dist/humain/checklist/vendor/tools.d.ts.map +1 -0
- package/dist/humain/checklist/vendor/tools.js +162 -0
- package/dist/humain/checklist/vendor/tools.js.map +1 -0
- package/dist/humain/checklist/vendor/types.d.ts +188 -0
- package/dist/humain/checklist/vendor/types.d.ts.map +1 -0
- package/dist/humain/checklist/vendor/types.js +32 -0
- package/dist/humain/checklist/vendor/types.js.map +1 -0
- package/dist/humain/gateway/catalog.d.ts +1 -0
- package/dist/humain/gateway/catalog.d.ts.map +1 -1
- package/dist/humain/gateway/catalog.js +1 -0
- package/dist/humain/gateway/catalog.js.map +1 -1
- package/dist/humain/gateway/client.d.ts +1 -0
- package/dist/humain/gateway/client.d.ts.map +1 -1
- package/dist/humain/gateway/client.js +8 -1
- package/dist/humain/gateway/client.js.map +1 -1
- package/dist/humain/gateway/http.d.ts.map +1 -1
- package/dist/humain/gateway/http.js +11 -3
- package/dist/humain/gateway/http.js.map +1 -1
- package/dist/humain/gateway/images.d.ts +3 -0
- package/dist/humain/gateway/images.d.ts.map +1 -0
- package/dist/humain/gateway/images.js +73 -0
- package/dist/humain/gateway/images.js.map +1 -0
- package/dist/humain/gateway/provider.js +1 -1
- package/dist/humain/gateway/provider.js.map +1 -1
- package/dist/humain/hcode/account-store.d.ts.map +1 -1
- package/dist/humain/hcode/account-store.js +3 -1
- package/dist/humain/hcode/account-store.js.map +1 -1
- package/dist/humain/hcode/account.d.ts.map +1 -1
- package/dist/humain/hcode/account.js +23 -13
- package/dist/humain/hcode/account.js.map +1 -1
- package/dist/humain/hcode/images.d.ts.map +1 -1
- package/dist/humain/hcode/images.js +19 -13
- package/dist/humain/hcode/images.js.map +1 -1
- package/dist/humain/hcode/login-failure.d.ts +1 -0
- package/dist/humain/hcode/login-failure.d.ts.map +1 -1
- package/dist/humain/hcode/login-failure.js +1 -0
- package/dist/humain/hcode/login-failure.js.map +1 -1
- package/dist/humain/hcode/provider.d.ts.map +1 -1
- package/dist/humain/hcode/provider.js +2 -1
- package/dist/humain/hcode/provider.js.map +1 -1
- package/dist/humain/hcode/run-credential.d.ts +1 -0
- package/dist/humain/hcode/run-credential.d.ts.map +1 -1
- package/dist/humain/hcode/run-credential.js +12 -4
- package/dist/humain/hcode/run-credential.js.map +1 -1
- package/dist/humain/index.d.ts.map +1 -1
- package/dist/humain/index.js +4 -0
- package/dist/humain/index.js.map +1 -1
- package/dist/humain/node-provider.d.ts.map +1 -1
- package/dist/humain/node-provider.js +37 -8
- package/dist/humain/node-provider.js.map +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +36 -26
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/chat-viewport.js +1 -1
- package/dist/modes/interactive/chat-viewport.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +2 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +7 -4
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +1 -1
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +2 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +20 -1
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +1 -1
- package/dist/modes/interactive/components/extension-editor.js +2 -2
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +7 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +74 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
- package/dist/modes/interactive/components/mermaid.js +11 -4
- package/dist/modes/interactive/components/mermaid.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +2 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +56 -8
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +13 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +10 -9
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +3 -3
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +4 -3
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +83 -37
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.js +3 -3
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +18 -7
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +70 -24
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/status-line.d.ts +16 -0
- package/dist/modes/interactive/components/status-line.d.ts.map +1 -0
- package/dist/modes/interactive/components/status-line.js +51 -0
- package/dist/modes/interactive/components/status-line.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +5 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +8 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.js +11 -3
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +13 -3
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +17 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +232 -108
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/program-status-reporter.d.ts +2 -0
- package/dist/modes/interactive/program-status-reporter.d.ts.map +1 -1
- package/dist/modes/interactive/program-status-reporter.js +4 -0
- package/dist/modes/interactive/program-status-reporter.js.map +1 -1
- package/dist/modes/interactive/session-share.d.ts.map +1 -1
- package/dist/modes/interactive/session-share.js +9 -1
- package/dist/modes/interactive/session-share.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +34 -7
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/jsonl.js +6 -5
- package/dist/modes/rpc/jsonl.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +2 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +9 -2
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +2 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +113 -13
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +22 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modes/uncaught-errors.d.ts +20 -0
- package/dist/modes/uncaught-errors.d.ts.map +1 -0
- package/dist/modes/uncaught-errors.js +56 -0
- package/dist/modes/uncaught-errors.js.map +1 -0
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +10 -1
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/clipboard-image.js +1 -1
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.js +2 -2
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/image-process.d.ts +5 -0
- package/dist/utils/image-process.d.ts.map +1 -1
- package/dist/utils/image-process.js +22 -4
- package/dist/utils/image-process.js.map +1 -1
- package/dist/utils/output-files.d.ts +44 -7
- package/dist/utils/output-files.d.ts.map +1 -1
- package/dist/utils/output-files.js +206 -12
- package/dist/utils/output-files.js.map +1 -1
- package/dist/utils/piped-stdin.d.ts +21 -0
- package/dist/utils/piped-stdin.d.ts.map +1 -0
- package/dist/utils/piped-stdin.js +60 -0
- package/dist/utils/piped-stdin.js.map +1 -0
- package/dist/utils/shell.d.ts +5 -2
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +77 -8
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts +33 -2
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +77 -10
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +9 -8
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/wsl.d.ts +8 -2
- package/dist/utils/wsl.d.ts.map +1 -1
- package/dist/utils/wsl.js +12 -3
- package/dist/utils/wsl.js.map +1 -1
- package/docs/cli.md +39 -3
- package/docs/codemode.md +7 -3
- package/docs/compaction.md +1 -1
- package/docs/development.md +6 -0
- package/docs/environment-variables.md +3 -2
- package/docs/extensions.md +19 -5
- package/docs/keybindings.md +2 -0
- package/docs/llama-cpp.md +2 -2
- package/docs/message-types.md +1 -0
- package/docs/models-configuration.md +14 -3
- package/docs/models.md +29 -7
- package/docs/providers.md +20 -2
- package/docs/rpc-commands.md +25 -2
- package/docs/rpc.md +20 -0
- package/docs/run-preflight.md +2 -2
- package/docs/session-format.md +9 -0
- package/docs/settings.md +35 -5
- package/docs/shell-aliases.md +1 -1
- package/docs/slash-commands.md +3 -1
- package/docs/terminal-setup.md +25 -0
- package/docs/windows.md +2 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +4 -4
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/rpc-extension-ui.ts +8 -7
- package/npm-shrinkwrap.json +209 -180
- package/package.json +26 -20
- package/schemas/keybindings.schema.json +12 -0
- package/schemas/models.schema.json +20 -7
- package/schemas/settings.schema.json +43 -5
- package/src/coordination/UPSTREAM.md +27 -1
- package/src/coordination/upstream.json +3 -3
- package/src/humain/ask-user-question/UPSTREAM.md +31 -0
- package/src/humain/ask-user-question/upstream.json +258 -0
- package/src/humain/ask-user-question/vendor/ask/LICENSE +21 -0
- package/src/humain/ask-user-question/vendor/ask/locales/de.json +38 -0
- package/src/humain/ask-user-question/vendor/ask/locales/en.json +41 -0
- package/src/humain/ask-user-question/vendor/ask/locales/es.json +38 -0
- package/src/humain/ask-user-question/vendor/ask/locales/fr.json +38 -0
- package/src/humain/ask-user-question/vendor/ask/locales/pt-BR.json +38 -0
- package/src/humain/ask-user-question/vendor/ask/locales/pt.json +38 -0
- package/src/humain/ask-user-question/vendor/ask/locales/ru.json +38 -0
- package/src/humain/ask-user-question/vendor/ask/locales/uk.json +38 -0
- package/src/humain/ask-user-question/vendor/ask/locales/zh.json +40 -0
- package/src/humain/ask-user-question/vendor/config/LICENSE +21 -0
- package/src/humain/ask-user-question/vendor/i18n/LICENSE +21 -0
- package/src/humain/caveman/UPSTREAM.md +44 -11
- package/src/humain/caveman/upstream.json +3 -3
- package/src/humain/caveman/vendor/NOTICE +4 -0
- package/dist/bundle/chunks/anthropic-messages-XFCDMGD6.js +0 -77
- package/dist/bundle/chunks/azure-openai-responses-F4KQM3NK.js +0 -15
- package/dist/bundle/chunks/bowser-DXKSTXFQ.js +0 -89
- package/dist/bundle/chunks/chunk-3E37CJCE.js +0 -34
- package/dist/bundle/chunks/chunk-3HVHETMU.js +0 -18
- package/dist/bundle/chunks/chunk-6JTCRCNF.js +0 -74
- package/dist/bundle/chunks/chunk-B3ZLWVDA.js +0 -80
- package/dist/bundle/chunks/chunk-F77J5EQZ.js +0 -3
- package/dist/bundle/chunks/chunk-GPLWWO5Q.js +0 -121
- package/dist/bundle/chunks/chunk-GV5OVRKK.js +0 -4
- package/dist/bundle/chunks/chunk-JBSWWCT5.js +0 -12
- package/dist/bundle/chunks/chunk-JWOPWHVH.js +0 -51
- package/dist/bundle/chunks/chunk-KRBELWQH.js +0 -7
- package/dist/bundle/chunks/chunk-PFBAIRCY.js +0 -56
- package/dist/bundle/chunks/chunk-Q5RKNQ2T.js +0 -73
- package/dist/bundle/chunks/chunk-QFDZEUFU.js +0 -12
- package/dist/bundle/chunks/chunk-SKCJ25SX.js +0 -24
- package/dist/bundle/chunks/chunk-UZOIHLNU.js +0 -23
- package/dist/bundle/chunks/chunk-YSWDFV2L.js +0 -11
- package/dist/bundle/chunks/chunk-YZMQXAJM.js +0 -8
- package/dist/bundle/chunks/chunk-ZAHVC5V2.js +0 -3591
- package/dist/bundle/chunks/entry-2GZ3PTWQ.js +0 -2
- package/dist/bundle/chunks/google-generative-ai-WIASMWS3.js +0 -22
- package/dist/bundle/chunks/google-vertex-WSPHRZIZ.js +0 -25
- package/dist/bundle/chunks/interactive-mode-3322RQEH.js +0 -5
- package/dist/bundle/chunks/mistral-conversations-7JYDDRUT.js +0 -43
- package/dist/bundle/chunks/openai-codex-responses-7PAML4NF.js +0 -102
- package/dist/bundle/chunks/openai-completions-UJDAIGTK.js +0 -87
- package/dist/bundle/chunks/openai-responses-2WNCE6AY.js +0 -26
- package/dist/bundle/chunks/openrouter-images-V3UCCO6X.js +0 -8
- package/dist/bundle/chunks/pi-messages-TQ7LJUNQ.js +0 -28
- package/dist/bundle/chunks/runtime-H7LYNKCZ.js +0 -2
- package/dist/bundle/chunks/session-picker-EYKCMFQR.js +0 -4
- package/dist/bundle/chunks/startup-ui-7ODOR34R.js +0 -3
- package/dist/bundle/chunks/typesafe-system-one-YP7GGN4C.js +0 -3
- package/dist/bundle/chunks/virtual-modules-47MGUPYN.js +0 -28
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.8.4] - 2026-11-30
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `--agent-dir` selects the agent directory for a CLI invocation.
|
|
10
|
+
- Added configurable `tui.input.endPendingInput` (default `Ctrl+C`) to recover from an unterminated bracketed paste or terminal reply.
|
|
11
|
+
- Bundled session checklist tools and `/checklist`, controlled through native `/settings`, with fixed Unicode glyphs and duplicate npm-package guidance (!191). The configurable `alt+t` details overlay and live Tasks status share one task provider (!214); hosts can opt into progress snapshots and bounded per-task activity RPC (!215). See [Checklist settings](docs/settings.md#checklist).
|
|
12
|
+
- Bundled `ask_user_question` in interactive mode, with multi-select questions, previews and custom answers; external duplicates are skipped with a notice. Print, RPC, Flow children and Forge headless builds do not register it (!212).
|
|
13
|
+
- Added `/exit` as an interactive `/quit` alias (!206).
|
|
14
|
+
- Added passive `humain-code doctor` setup diagnostics, opt-in `--online` connectivity checks and versioned `--json` reports (!207, #365).
|
|
15
|
+
- Added reasoning controls, streamed summaries and encrypted reasoning replay for verified HUMAIN Node OpenAI Responses models, with model-specific effort limits and low as minimum (!211, #384).
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Replaced built-in footer rows with a theme-aware status line in the input border; `/status` and configurable `alt+s` show detailed usage while extension statuses remain below the editor (!197).
|
|
20
|
+
- Compaction, branch summaries and retry countdowns use the configured working indicator, session-stable rotation, reduced motion and extension frames (!204).
|
|
21
|
+
- Publish matching `@humain/humain-code-contracts` 0.4.23 for the new checklist-progress and curated-model exports; upgrade strict consumers before opting into new RPC fields.
|
|
22
|
+
- Curated model suggestions highlight current qualified models, including Bedrock backups and regional alternatives. Show all qualified models restores the accessible inventory without switching saved sessions; reproducible catalog refresh reports metadata drift and newer versions for review (!213).
|
|
23
|
+
- Reduced wrapping work for long, unbroken ASCII output in collapsed shell previews without changing the visible preview, hidden-line count, or full output (!208).
|
|
24
|
+
- Updated the upstream Pi baseline to 1.7.0, preserving the HUMAIN behavior and exclusions in the [refresh record](../../docs/upstream-refresh-20261128.md).
|
|
25
|
+
- Ported reviewed Pi-Bolt 1.4.0 fixes and performance changes; see the [port record](../tui/src/pibolt/UPSTREAM.md#140-selective-reconciliation-2026-11-28).
|
|
26
|
+
- Refreshed exact dependency pins, including the AWS, Anthropic and OpenAI SDKs and `cross-spawn` 7.1.2 for Windows security fixes.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- Native device sign-in sends PKCE S256 and an attempt-bound token verifier; secure-storage rejection inside a Git ancestor gives actionable path-free guidance (!202, #354).
|
|
31
|
+
- HUMAIN Gateway models accept images only when discovery advertises support, with local inline PNG/JPEG safety limits (!201).
|
|
32
|
+
- Build-token inference accepts dedicated Forge Run inference origins (!210).
|
|
33
|
+
- Fixed single-command acceptance admission and independently verified Flow dispatch completion (!192).
|
|
34
|
+
- Fixed RPC busy-prompt outcome ownership and abort admission races; pending or idle aborts return typed refusal reasons without changing active native or Flow cancellation (!193).
|
|
35
|
+
- Split session benchmarks into load, context and render phases and removed expensive validation from measured work; lightweight validation regressions avoid cold-worker timeouts. These are benchmark improvements, not a production session-load speedup (!189, !196, #344).
|
|
36
|
+
- Fixed Chord base-watcher test readiness without changing production behavior (!198).
|
|
37
|
+
- Fixed a CI-only JSON parser differential-test timeout with deterministic long-payload sampling; no product change (!222).
|
|
38
|
+
- Hardened damaged-session recovery and HTML export: skip invalid entries, bound cyclic history walks and preserve literal dollar sequences in exported content.
|
|
39
|
+
- Kept tools outside the active allowlist disabled when extensions register them late, and let prompts proceed when piped stdin stays idle before its first byte.
|
|
40
|
+
|
|
5
41
|
## [0.8.3] - 2026-11-27
|
|
6
42
|
|
|
7
43
|
### Added
|
|
@@ -907,6 +943,111 @@ Version 0.4.16 was never published to npm and is superseded by 0.4.17. This rele
|
|
|
907
943
|
- Removed Supacode tab renaming and state indicators. Auto-generated names and `/name` still set the session name without changing Supacode tab titles.
|
|
908
944
|
- Removed the vendored `pi-mcp-adapter` bundle, its upstream check and bundle scripts (see Breaking Changes).
|
|
909
945
|
- Removed the `@humain/terminal` extension import alias (see Breaking Changes).
|
|
946
|
+
## [1.7.0] - 2026-11-27
|
|
947
|
+
|
|
948
|
+
### New Features
|
|
949
|
+
|
|
950
|
+
- **[Terminal session resume](docs/terminal-setup.md#program-resume):** Compatible terminals can reopen the current pi session after a restart with its original profile, tool restrictions, and instructions.
|
|
951
|
+
- **[Image generation in codemode](docs/codemode.md#generate-images):** Generate images with Radius, or set the aspect ratio and size when using OpenRouter image models.
|
|
952
|
+
- **GitHub Copilot prompt caching:** Changing the thinking level preserves the prompt cache on supported Claude 5.x and GPT-6 models. Supported Claude 5.x models also keep the cache when tools change, and Copilot Claude models support [cache warming](docs/settings.md#model-and-thinking).
|
|
953
|
+
|
|
954
|
+
### Breaking Changes
|
|
955
|
+
|
|
956
|
+
- Removed telemetry reporting from pi for new installs and updates (`/api/report-install`), the `enableInstallTelemetry` setting (`SettingsManager.getEnableInstallTelemetry()` / `setEnableInstallTelemetry()`), and `PI_TELEMETRY`
|
|
957
|
+
|
|
958
|
+
### Added
|
|
959
|
+
|
|
960
|
+
- Added program resume through the [Program Resume Protocol (OSC 7577)](https://www.superlogical.com/rex/docs/build/program-resume): in terminals that set `OSC7577_TOKEN`, interactive mode reports `pi --session <id>` for the current session, so the terminal can bring it back after it restarts. Pi removes the token from the environment of every process it starts. See [Terminal setup](docs/terminal-setup.md#program-resume)
|
|
961
|
+
- Added optional `{ aspectRatio, size }` as the third argument to codemode `models.generateImages()`
|
|
962
|
+
- Added `--agent-dir <dir>`, the command-line form of `PI_CODING_AGENT_DIR`. The resume command pi prints on exit and reports through OSC 7577 now includes it when the config directory is not `~/.pi/agent`. Without it, a session started with `PI_CODING_AGENT_DIR` came back with the default directory's settings and auth: a terminal resumes the command without the environment pi was started in. This is for setups that keep a separate pi profile per project, for example a shell function that sets `PI_CODING_AGENT_DIR` for one directory tree. Terminals that resume programs, such as Rex, need a rule that trusts the longer command; see [Terminal setup](docs/terminal-setup.md#program-resume)
|
|
963
|
+
- The OSC 7577 resume command now repeats the restriction and resource flags pi was started with (`--tools`, `--no-extensions`, `-e`, `--skill`, `--system-prompt`, and similar), as typed, so a terminal cannot resume a session with other tools or instructions, possibly more access, than it had. The command printed on exit is unchanged. A terminal rule must trust each flag combination; see [Terminal setup](docs/terminal-setup.md#program-resume)
|
|
964
|
+
- Added Radius image generation to [codemode](docs/codemode.md#generate-images). Radius image and classifier models are now listed in the built-in catalog as well as through provider discovery
|
|
965
|
+
|
|
966
|
+
### Changed
|
|
967
|
+
|
|
968
|
+
- The default model for `cloudflare-workers-ai` and `cloudflare-ai-gateway` is now `@cf/zai-org/glm-5.3`, because Cloudflare deprecated Workers AI Kimi K2.6 and K2.7 Code
|
|
969
|
+
- Changed the `ant-ling` default model from the retired `Ring-2.6-1T` to `Ling-3.1-flash`. Existing `models.json` files can keep `thinkingFormat: "ant-ling"` as a deprecated alias for `"deepseek"` ([#11800](https://github.com/earendil-works/pi/pull/11800) by [@lvisei](https://github.com/lvisei))
|
|
970
|
+
- Replaced the retired `qwen4-max-preview` with `qwen4-max` on Qwen Token Plan Individual
|
|
971
|
+
- Preserved the GitHub Copilot prompt cache when changing thinking levels on supported Claude 5.x and GPT-6 models or changing tools on supported Claude 5.x models. Copilot Claude models now support cache warming, and GPT-5.3 Codex and MAI-Code receive mid-conversation system messages where they take effect ([#12316](https://github.com/earendil-works/pi/issues/12316))
|
|
972
|
+
|
|
973
|
+
### Fixed
|
|
974
|
+
|
|
975
|
+
- Fixed `/llama` "Download model" downloading the typed text instead of the highlighted result when the query looked like `owner/repository` and the user had moved the selection with the arrow keys ([#12465](https://github.com/earendil-works/pi/issues/12465))
|
|
976
|
+
- Fixed key hints that named the wrong keybinding or a hardcoded key: the extension editor and session rename now name `tui.input.submit`, `/hotkeys` names `tui.select.cancel` for cancelling autocomplete, and the settings submenu, `/config` selector, session selector and fullscreen copy setting follow remapped keys
|
|
977
|
+
- Fixed a console Ctrl+Break on Windows ending pi without restoring the terminal, which left the shell in the alternate screen with mouse reports typed into the prompt. A child process in the same console can send Ctrl+Break too. pi now shuts down normally on it ([#12133](https://github.com/earendil-works/pi/issues/12133))
|
|
978
|
+
- Fixed print, JSON, and RPC modes not reporting an invalid `models.json`, so a typo such as `"contextWindow": "32000"` showed up only as `Model "..." not found` or `No API key found`. `createAgentSessionServices()` now returns the error as a warning in `diagnostics`, so every mode and SDK runtimes report it; interactive mode shows it as a warning instead of an error, as reported in [#12522](https://github.com/earendil-works/pi/issues/12522) ([#12523](https://github.com/earendil-works/pi/pull/12523) by [@acmerfight](https://github.com/acmerfight))
|
|
979
|
+
- Fixed `app.message.followUp` (Alt+Enter) ignoring an open autocomplete menu and queuing the half-typed text. It now applies the selected suggestion like Enter: a completed command name is queued, and other completions are inserted without queuing
|
|
980
|
+
- Fixed running `!` commands showing the wrong cancel shortcut. The hint now names the configured `app.interrupt` key ([#12518](https://github.com/earendil-works/pi/pull/12518) by [@acmerfight](https://github.com/acmerfight))
|
|
981
|
+
- Fixed `!!` commands counting toward the context estimate even though the model never sees them. Large outputs no longer trigger early compaction or crowd out recent history ([#12513](https://github.com/earendil-works/pi/issues/12513))
|
|
982
|
+
- Fixed Kitty images disappearing in Konsole and regular mode clearing the screen and scrollback when an appended image extended past the bottom of the screen ([#12548](https://github.com/earendil-works/pi/issues/12548))
|
|
983
|
+
- Fixed Amazon Bedrock Kimi K3.1 and GLM 5.3 ignoring the selected thinking level ([#12462](https://github.com/earendil-works/pi/issues/12462)). Kimi K3 and K3.1 also no longer send earlier reasoning back to Bedrock, which could make later turns fail
|
|
984
|
+
- Fixed GitHub Copilot models using `openai-completions` losing their reasoning state between turns ([#12418](https://github.com/earendil-works/pi/issues/12418))
|
|
985
|
+
- Fixed codemode image generation reporting success for failed OpenRouter responses. Image and classifier usage now includes reasoning tokens when reported; image usage distinguishes image output tokens, and OpenRouter costs use the reported total or the model's image output rate when estimating
|
|
986
|
+
|
|
987
|
+
## [1.6.1] - 2026-11-25
|
|
988
|
+
|
|
989
|
+
### New Features
|
|
990
|
+
|
|
991
|
+
- **Decision models in codemode**: GitHub Copilot's `gpt-6-luna-decisions` and Radius decision models can be called from codemode `models.classify()`, and results include the provider's `responseId`. See [Classify](docs/codemode.md#classify).
|
|
992
|
+
- **One setting per transcript notice**: cache misses, cache warming, compaction costs, and reasoning drops each have their own setting under Notices in `/settings`. See [Model and thinking](docs/settings.md#model-and-thinking).
|
|
993
|
+
- **Dialog status kind for extensions**: `ctx.ui.select()`, `ctx.ui.confirm()`, and `ctx.ui.input()` accept `blockedKind`, so terminals with program status can show a dialog as a permission request, question, or login. See [Program Status Kind](docs/extensions.md#program-status-kind).
|
|
994
|
+
|
|
995
|
+
### Breaking Changes
|
|
996
|
+
|
|
997
|
+
- Replaced the `showCacheMissNotices` setting with one setting per transcript notice: `notices.cacheMisses`, `notices.cacheWarming`, `notices.compactionCosts`, and `notices.reasoningDrops`, configured under Notices in `/settings`. An existing `showCacheMissNotices` value is migrated to all four. `SettingsManager.getShowCacheMissNotices()` and `setShowCacheMissNotices()` are removed; use `getNotices()` and `setNotice()` instead
|
|
998
|
+
|
|
999
|
+
### Added
|
|
1000
|
+
|
|
1001
|
+
- Added `compat.supportsStrictMode` for `google-generative-ai` and `google-vertex` models in `models.json`, so Gemini 3+ models served under IDs without the version can use strict tools ([#12321](https://github.com/earendil-works/pi/issues/12321))
|
|
1002
|
+
- Added a `blockedKind` option to `ctx.ui.select()`, `ctx.ui.confirm()` and `ctx.ui.input()` that sets the kind of blocked program status (OSC 7501) the dialog reports, for example `"permission"` for a select that approves an action. See [Dialogs](docs/extensions.md#program-status-kind)
|
|
1003
|
+
- Added `full_output_error` to the bash tool's structured output and `fullOutputError` to its details, `BashResult` and `BashExecutionMessage`, giving the reason when truncated output could not be saved to a temp file. User bash output that was truncated without a saved file now says so in the model context and the TUI ([#10585](https://github.com/earendil-works/pi/issues/10585))
|
|
1004
|
+
- Added the `gpt-6-luna-decisions` decision model for GitHub Copilot, callable from codemode `models.classify()` with text and images ([#12395](https://github.com/earendil-works/pi/issues/12395))
|
|
1005
|
+
- Added decision models on the Radius provider, callable from codemode `models.classify()`
|
|
1006
|
+
- Added `responseId` to codemode `models.classify()` results. OpenRouter's System One fills it with its generation ID, and its billed cost replaces the catalog estimate. See [codemode](docs/codemode.md)
|
|
1007
|
+
|
|
1008
|
+
### Changed
|
|
1009
|
+
|
|
1010
|
+
- Changed the default Mistral model from `devstral-medium-latest` to `mistral-medium-latest`, because Mistral retired Devstral and the model catalog no longer lists it
|
|
1011
|
+
- Changed `after_provider_response` to also fire for HTTP error responses (4xx/5xx) and for each retried attempt on OpenAI, Azure OpenAI, Anthropic, and Google models, as it already did for OpenAI Codex, Mistral, Radius, and Amazon Bedrock, so extensions can read the status and `retry-after` of rate-limited requests ([#12376](https://github.com/earendil-works/pi/issues/12376))
|
|
1012
|
+
- Changed first-time setup to show the colored pi logo and only ask about analytics; the theme defaults to the system theme, which follows the terminal's colors
|
|
1013
|
+
|
|
1014
|
+
### Fixed
|
|
1015
|
+
|
|
1016
|
+
- Fixed selecting the `xhigh` thinking level for Gemini 4 Hydrogen and Neon on the `google` and `google-vertex` providers failing with `Unsupported Google thinking level mapping ... xhigh -> xhigh` ([#12184](https://github.com/earendil-works/pi/issues/12184))
|
|
1017
|
+
- Fixed sessions with very many entries after the last compaction (about 120k or more) failing to load with `RangeError: Maximum call stack size exceeded` when building the context ([#12154](https://github.com/earendil-works/pi/issues/12154))
|
|
1018
|
+
- Fixed `ctx.ui.pasteToEditor()` and `ctx.ui.setEditorText()` not repainting the editor when called outside terminal input handling, such as after an `await` in a command handler ([#12295](https://github.com/earendil-works/pi/issues/12295))
|
|
1019
|
+
- Fixed the bash tool returning `(no output)` when the output ended with a line over 50KB followed by an empty line; it now shows the end of that line ([#12350](https://github.com/earendil-works/pi/issues/12350))
|
|
1020
|
+
- Fixed `/tree` navigation adding the branch's prompts to Up-arrow history again on every navigation; prompts already in history now move to the most recent position instead of repeating ([#12279](https://github.com/earendil-works/pi/issues/12279))
|
|
1021
|
+
- Fixed closing the console window or terminal tab on Windows skipping `session_shutdown` and leaving commands started by the bash tool running, for example `sleep 300` from `bash -c "sleep 300"`. pi now handles SIGHUP on Windows like on POSIX and waits for `taskkill` to finish before it exits. Quitting with Ctrl+D or `/quit` while a `!` command runs, or ending RPC mode while a `bash` command runs, no longer leaves that command running on Windows either
|
|
1022
|
+
- Fixed the `AuthStorage` coalesced-reload test failing intermittently on systems with coarse file timestamps ([#12190](https://github.com/earendil-works/pi/issues/12190))
|
|
1023
|
+
- Fixed the `thinkingLevelMap` reference in the models.json schema and docs suggesting pi does not support the `xhigh` and `max` thinking levels; it now says they are opt-in and only offered when mapped, and the model guide explains how to map thinking levels ([#12281](https://github.com/earendil-works/pi/issues/12281))
|
|
1024
|
+
- Fixed Mermaid diagrams wider than the terminal falling back to their source without explanation; a note now says how many columns the diagram needs ([#12324](https://github.com/earendil-works/pi/issues/12324))
|
|
1025
|
+
- Fixed copies on Wayland silently failing when `wl-copy` guessed a non-text MIME type from the copied text, for example `application/x-ruby` for text starting with `def`, which clipboard managers such as Klipper discard; pi now copies as `text/plain` ([#12446](https://github.com/earendil-works/pi/pull/12446) by [@ttempaa](https://github.com/ttempaa))
|
|
1026
|
+
- Fixed pi crashing when the bash tool or a `!` command could not write its full-output temp file, for example when `/tmp` was full, over a per-user quota or not writable; both now keep the truncated output and say why the full output could not be saved. Opening the external editor and `/share` now report such failures instead of crashing ([#10585](https://github.com/earendil-works/pi/issues/10585))
|
|
1027
|
+
- Fixed `/login` showing a provider as configured when its stored `auth.json` key is a `!command` that fails, while requests failed with `No API key found`. `/login` now shows `stored key did not resolve`, `getProviderAuthStatus()` returns `{ configured: false, source: "stored" }`, and entering the same `!command` again in `/login` runs it again instead of reusing the cached failure ([#12164](https://github.com/earendil-works/pi/issues/12164))
|
|
1028
|
+
- Fixed `pi update` run from WSL through the Windows installation of pi rebuilding that installation with Linux npm; it now stops and says that running the Windows installation from WSL is unsupported ([#12172](https://github.com/earendil-works/pi/issues/12172))
|
|
1029
|
+
- Fixed right-click paste inserting the clipboard twice in Tabby on Windows, which pastes on right-click itself ([#12406](https://github.com/earendil-works/pi/issues/12406))
|
|
1030
|
+
- Fixed dialogs shown before interactive mode starts, such as the project trust prompt, the missing session folder prompt and first-time setup, reporting no `blocked` program status (OSC 7501). Blocked messages of multi-line dialog titles are now the first line only, for example `Trust project folder?` instead of the folder path and explanation. The project trust prompt and first-time setup report `kind=permission` ([#12439](https://github.com/earendil-works/pi/issues/12439))
|
|
1031
|
+
- Fixed GitHub Copilot listing decision models the account cannot use, such as `microsoft-decision-1` on accounts whose plan does not include it, where every call failed with HTTP 400. After `/login` or the next token refresh, only the decision models in the account's Copilot model catalog are listed ([#12395](https://github.com/earendil-works/pi/issues/12395))
|
|
1032
|
+
- Fixed the bash tool on Windows not finding Git for Windows installed outside Program Files and running commands through the WSL launcher `System32\bash.exe` instead. pi now asks the `git.exe` on `PATH` for its installation (`git var GIT_SHELL_PATH`, Git 2.47+) and uses its Git Bash before other `bash.exe` on `PATH` ([#12408](https://github.com/earendil-works/pi/issues/12408))
|
|
1033
|
+
- Fixed RPC mode, session loading, and llama.cpp model events rescanning an incomplete line on every chunk, which made large lines, such as messages with images, take time quadratic in their size. llama.cpp model events also accept lone CR line endings and CRLF split across chunks ([#12224](https://github.com/earendil-works/pi/issues/12224))
|
|
1034
|
+
- Fixed `!` command output coming back collapsed after compaction, `/reload`, `/resume` or `/tree` while ctrl+o was set to expanded ([#12426](https://github.com/earendil-works/pi/issues/12426), [#12427](https://github.com/earendil-works/pi/pull/12427) by [@acmerfight](https://github.com/acmerfight))
|
|
1035
|
+
- Fixed more temporary provider failures not being retried automatically: Cloudflare HTTP 525, gateway "provider is temporarily unavailable" and partial-response errors, Anthropic `api_error` events during streaming, OpenRouter empty responses and stops without output, streams ending with `finish_reason: "error"`, and "request rate increased too quickly" throttling ([#12206](https://github.com/earendil-works/pi/issues/12206), [#12227](https://github.com/earendil-works/pi/issues/12227), [#12240](https://github.com/earendil-works/pi/issues/12240), [#12407](https://github.com/earendil-works/pi/issues/12407))
|
|
1036
|
+
- Fixed unrelated request errors whose code contains `request_too_large` inside a longer identifier, such as `plugin_request_too_large`, triggering compact-and-retry as if the context overflowed ([#12343](https://github.com/earendil-works/pi/issues/12343), [#12438](https://github.com/earendil-works/pi/pull/12438) by [@muyiyr](https://github.com/muyiyr))
|
|
1037
|
+
- Fixed HTTP 400 with thinking `off` on Claude Sonnet 5.5 through GitHub Copilot, and on Claude Opus 5.5 and Sonnet 5.5 through Cloudflare AI Gateway and Vercel AI Gateway; selecting `off` on those models now uses the lowest supported level ([#12429](https://github.com/earendil-works/pi/issues/12429))
|
|
1038
|
+
- Fixed Gemini 3+ models whose IDs carry a prefix, such as `vendor-gemini-4-argon`, being treated as older Gemini models: they now get strict tools, tool-call IDs, and images inside function responses ([#12321](https://github.com/earendil-works/pi/issues/12321))
|
|
1039
|
+
- Fixed Google prompt blocks being reported and retried as incomplete streams; the error now includes the block reason and safety ratings ([#12330](https://github.com/earendil-works/pi/issues/12330))
|
|
1040
|
+
- Fixed `openai-codex` starting GPT-6 requests at `medium` regardless of the selected thinking level ([#12361](https://github.com/earendil-works/pi/issues/12361))
|
|
1041
|
+
- Fixed GPT-6.2 dropping earlier reasoning as `prefix_mismatch` after the OpenAI Codex WebSocket connection expired ([#12367](https://github.com/earendil-works/pi/issues/12367))
|
|
1042
|
+
- Fixed Amazon Bedrock requests hanging behind `HTTPS_PROXY` with AWS SSO profiles ([#12353](https://github.com/earendil-works/pi/issues/12353))
|
|
1043
|
+
- Fixed HTTP 400 after tool calls without text on Cloudflare Workers AI's GPT-OSS 120B and 20B, Granite 4.0 H Micro, and Llama 3.3 70B Instruct FP8 Fast ([#12194](https://github.com/earendil-works/pi/issues/12194))
|
|
1044
|
+
- Fixed HTTP 400 for non-strict Anthropic tools with Draft 7 tuples ([#12212](https://github.com/earendil-works/pi/issues/12212))
|
|
1045
|
+
- Fixed OpenAI Decisions usage dropping cache read and write tokens ([#12264](https://github.com/earendil-works/pi/issues/12264))
|
|
1046
|
+
- Fixed extension providers with `fetchModels` making model lookups quadratic in catalog size, which blocked pi for about a second with ~10k models ([#12311](https://github.com/earendil-works/pi/issues/12311))
|
|
1047
|
+
- Fixed the model list still offering models their providers shut down: `gpt-5-chat-latest` on `openai` and `azure`, Groq's `llama-3.1-8b-instant`, `llama-3.3-70b-versatile` and `qwen/qwen3.6-27b`, and the undocumented `mistral-medium-3.5` ([#12202](https://github.com/earendil-works/pi/issues/12202))
|
|
1048
|
+
- Fixed Markdown after an unclosed `$` before a number, such as `+$50`, rendering as raw text for the rest of the paragraph ([#12389](https://github.com/earendil-works/pi/issues/12389) by [@wuhaoyujerry](https://github.com/wuhaoyujerry))
|
|
1049
|
+
- Fixed rendering a bare URL that runs into a multi-megabyte line exhausting the heap in terminals with OSC 8 hyperlinks ([#12416](https://github.com/earendil-works/pi/issues/12416))
|
|
1050
|
+
- Fixed MCP requests to servers that echo request IDs as strings timing out, and large MCP Streamable HTTP events blocking pi for seconds ([#12205](https://github.com/earendil-works/pi/issues/12205), [#12224](https://github.com/earendil-works/pi/issues/12224))
|
|
910
1051
|
|
|
911
1052
|
## [1.6.0] - 2026-11-20
|
|
912
1053
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{runAgentMonitorCommand}from"./chunks/chunk-
|
|
2
|
+
import{runAgentMonitorCommand}from"./chunks/chunk-HRNYDRL7.js";import"./chunks/chunk-625QJSFJ.js";import"./chunks/chunk-T7F2TEIS.js";import"./chunks/chunk-II5C7G67.js";import"./chunks/chunk-NPVRWPGX.js";import"./chunks/chunk-B47PNNLL.js";import"./chunks/chunk-PPGSQZZF.js";import"./chunks/chunk-MHQNLTZR.js";import"./chunks/chunk-QESIDBMW.js";import"./chunks/chunk-VEGJT52D.js";import"./chunks/chunk-CKFLQGJN.js";import"./chunks/chunk-JXWJOIH4.js";process.exitCode=await runAgentMonitorCommand(process.env);
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
+
import{combineAbortSignals}from"./chunk-HCHCYBNK.js";import{buildCopilotDynamicHeaders,hasCopilotVisionInput}from"./chunk-JEJQVFWK.js";import{applyOpenRouterReportedCost,isOpenRouterModel}from"./chunk-J7AP2BUJ.js";import{APIError,Anthropic}from"./chunk-IMRZP5SC.js";import{collectReasoningDrops,isDroppedBlock}from"./chunk-FDRBTGFJ.js";import{cacheJsonSerialization,shortHash}from"./chunk-ENBDASDN.js";import{adjustMaxTokensForThinking,buildBaseOptions,clampMaxTokensToContext,
|
|
3
|
+
getJsonSchemaToolParameters,prefersJsonSchemaStrictSampling,resolveJsonSchemaStrictSampling,splitErrorToolResultImages,transformMessages}from"./chunk-UTRUALFN.js";import{sanitizeSurrogates}from"./chunk-L2ZPNLYD.js";import{getServerRetryDelayMs,retryProviderRequest}from"./chunk-5C5K4EVJ.js";import{ANTHROPIC_FEDERATION_RULE_ID_ENV,ANTHROPIC_IDENTITY_TOKEN_FILE_ENV,ANTHROPIC_ORGANIZATION_ID_ENV,ANTHROPIC_SERVICE_ACCOUNT_ID_ENV,ANTHROPIC_WORKSPACE_ID_ENV}from"./chunk-7H2WNBX7.js";
|
|
4
|
+
import{registerSessionResourceCleanup}from"./chunk-ZG74NES2.js";import{calculateCost,getCurrentTools,getInitialSystemMessage,resolveTranscript}from"./chunk-KJ3QRSSY.js";import{hasIncompleteUsage}from"./chunk-YTVFIA3A.js";import{iterateSseMessages}from"./chunk-PZ7NYBHJ.js";import{appendProviderHttpStatusDiagnostic,normalizeProviderError,safeJsonStringify}from"./chunk-CG43CMFH.js";import{getProviderEnvValue}from"./chunk-FACBDLFU.js";import{ToolCallArgumentsStream,
|
|
5
|
+
parseJsonWithRepair}from"./chunk-LYZ37DJP.js";import"./chunk-AQ4EXORZ.js";import{AssistantMessageEventStream}from"./chunk-MZRTVX7F.js";import{PROVIDER_CLIENT_VERSIONS,SubmissionAdmissionError,appendAssistantMessageDiagnostic,createAssistantMessageDiagnostic,createRequestObserver,findSubmissionAdmissionError,getIdentityHeaders,getModelHeaders,getSystemMessageText,headersToRecord,mergeHeaders,renderSystemMessageUpdate,reportContentProgress}from"./chunk-K5EFEIFP.js";import"./chunk-JXWJOIH4.js";function supportsDisabledAnthropicThinking(model){let name=`${model.id} ${model.name}`.toLowerCase().replace(/[.\s]+/g,"-");return model.thinkingLevelMap?.off!==null&&!/(?:fable-5|mythos-(?:5|preview)|opus-5-5|sonnet-5-5)(?:-|$)/.test(name)}function resolveCacheRetention(cacheRetention,env){return cacheRetention||(getProviderEnvValue("HUMAIN_TERMINAL_CACHE_RETENTION",env)==="long"||getProviderEnvValue("PI_CACHE_RETENTION",env)==="long"?"long":"short")}function getCacheControl(model,cacheRetention,env){let retention=resolveCacheRetention(cacheRetention,env);if(retention==="none")return{retention};let ttl=retention==="long"&&getAnthropicCompat(model).supportsLongCacheRetention?"1h":void 0;return{retention,cacheControl:{type:"ephemera\
|
|
6
|
+
l",...ttl&&{ttl}}}}var claudeCodeVersion=PROVIDER_CLIENT_VERSIONS.claudeCode,claudeCodeTools=["Read","Write","Edit","Bash","Grep","Glob","AskUserQuestion","EnterPlanMode","ExitPlanMode","KillShell","NotebookEdit","Skill","Task","TaskOutput","TodoWrite","WebFetch","WebSearch"],ccToolLookup=new Map(claudeCodeTools.map(t=>[t.toLowerCase(),t])),toClaudeCodeName=name=>ccToolLookup.get(name.toLowerCase())??name,fromClaudeCodeName=(name,tools)=>{if(tools&&tools.length>0){let lowerName=name.toLowerCase(),
|
|
7
|
+
matchedTool=tools.find(tool=>tool.name.toLowerCase()===lowerName);if(matchedTool)return matchedTool.name}return name};function convertImageBlock(image){return{type:"image",source:{type:"base64",media_type:image.mimeType,data:image.data}}}function convertContentBlocks(content){if(!content.some(c=>c.type==="image"))return sanitizeSurrogates(content.map(c=>c.text).join(`
|
|
8
|
+
`));let blocks=content.map(block=>block.type==="text"?{type:"text",text:sanitizeSurrogates(block.text)}:convertImageBlock(block));return blocks.some(b=>b.type==="text")||blocks.unshift({type:"text",text:"(see attached image)"}),blocks}var FINE_GRAINED_TOOL_STREAMING_BETA="fine-grained-tool-streaming-2025-05-14",INTERLEAVED_THINKING_BETA="interleaved-thinking-2025-05-14",SERVER_SIDE_FALLBACK_BETA="server-side-fallback-2026-07-01",MID_CONVERSATION_OUTPUT_CONFIG_BETA="mid-conversation-output-config\
|
|
9
|
+
-2026-07-01",THINKING_BINDING_CONTROLS_BETA="thinking-binding-controls-2026-08-01",INLINE_TOOLS_BETA="inline-tools-2026-09-15",MESSAGE_THREADS_BETA="message-threads-2026-08-12",DEFERRED_TOOL_PLACEHOLDER={name:"__pi_deferred_placeholder__",description:"Reserved placeholder. Never available. Never call this.",input_schema:{type:"object",properties:{},required:[]},defer_loading:!0};function shouldUseServerSideFallbackBeta(model){return(model.compat?.allowedFallbackModels?.length??0)>0}function getAnthropicCompat(model){
|
|
10
|
+
let isOpenRouter=model.provider==="openrouter"||model.baseUrl.includes("openrouter.ai");return{supportsEagerToolInputStreaming:model.compat?.supportsEagerToolInputStreaming??!0,supportsLongCacheRetention:model.compat?.supportsLongCacheRetention??!0,sendSessionAffinityHeaders:model.compat?.sendSessionAffinityHeaders??isOpenRouter,sessionAffinityFormat:model.compat?.sessionAffinityFormat??(isOpenRouter?"openrouter":void 0),supportsCacheControlOnTools:model.compat?.supportsCacheControlOnTools??!0,allowEmptySignature:model.
|
|
11
|
+
compat?.allowEmptySignature??!1,supportsStrictTools:model.compat?.supportsStrictTools??!1,supportsMidConvoSystemMessages:model.compat?.supportsMidConvoSystemMessages??!1,supportsMidConvoToolChanges:model.compat?.supportsMidConvoToolChanges??!1,supportsMessageThreads:model.compat?.supportsMessageThreads??isAnthropicApiHost(model.baseUrl)}}function isAnthropicApiHost(baseUrl){try{return new URL(baseUrl).hostname==="api.anthropic.com"}catch{return!1}}var threadState=new Map,MAX_THREAD_STATE_ENTRIES=1e4,
|
|
12
|
+
NEW_THREAD_ERRORS=new Set(["thread_not_found","thread_already_continued","thread_continue_in_flight","thread_fingerprint_mismatch"]);function setThreadState(sessionId,value){if(threadState.delete(sessionId),threadState.set(sessionId,value),threadState.size>MAX_THREAD_STATE_ENTRIES){let oldest=threadState.keys().next().value;oldest!==void 0&&threadState.delete(oldest)}}registerSessionResourceCleanup(sessionId=>{sessionId?threadState.delete(sessionId):threadState.clear()});function hashThreadPrefix(model,params,messages,credential){
|
|
13
|
+
let{system,tools,thinking,output_config,tool_choice,betas,fallbacks}=params,settings=JSON.stringify([model.provider,model.baseUrl,credential,params.model,system,tools,thinking,output_config,tool_choice,betas,fallbacks]),conversation=JSON.stringify(messages,(key,value)=>{if(key!=="cache_control")return key==="content"&&typeof value=="string"?[{type:"text",text:value}]:value});return shortHash(settings+conversation)}function createThreadRequest(sessionId,credential,params){return{sessionId,credential,
|
|
14
|
+
body:{...params,thread:{type:"create"}}}}function prepareThreadRequest(model,sessionId,credential,params){let state=threadState.get(sessionId);if(state!=="off"){if(state!==void 0&¶ms.messages.length>state.prefixCount&&hashThreadPrefix(model,params,params.messages.slice(0,state.prefixCount),credential)===state.prefixHash){threadState.delete(sessionId);let{system:_system,tools:_tools,...rest}=params;return{body:{...rest,messages:params.messages.slice(state.prefixCount),thread:{type:"continue",
|
|
15
|
+
previous_message_id:state.replyId}},sessionId,credential}}return createThreadRequest(sessionId,credential,params)}}function getThreadErrorCode(error){let code=error.error?.error?.details?.error_code;return typeof code=="string"?code:void 0}async function sendThreadRequest(thread,params,send,output,signal){try{return{response:await send(thread.body),thread}}catch(error){if(signal?.aborted||!(error instanceof APIError))throw error;let errorCode=getThreadErrorCode(error),startNewThread=errorCode!==
|
|
16
|
+
void 0&&NEW_THREAD_ERRORS.has(errorCode),threadsUnsupported=errorCode==="thread_unsupported_request"||errorCode===void 0&&error.status===400&&error.message.includes("thread");if(!startNewThread&&!threadsUnsupported)throw error;if(appendAssistantMessageDiagnostic(output,{type:"anthropic_thread_fallback",timestamp:Date.now(),error:{message:error.message},details:{reason:errorCode??String(error.status)}}),startNewThread){let created=createThreadRequest(thread.sessionId,thread.credential,params);return{
|
|
17
|
+
response:await send(created.body),thread:created}}let response=await send(params);return setThreadState(thread.sessionId,"off"),{response,thread:void 0}}}function recordThreadReply(model,thread,params,output,isOAuth,allowEmptySignature){if(output.responseId===void 0||output.responseModel!==void 0)return;let reply=convertMessages(transformMessages([output],model,normalizeToolCallId),isOAuth,void 0,allowEmptySignature).messages.filter(message=>message.role==="assistant"),prefix=[...params.messages,
|
|
18
|
+
...reply];setThreadState(thread.sessionId,{prefixCount:prefix.length,prefixHash:hashThreadPrefix(model,params,prefix,thread.credential),replyId:output.responseId})}function hasHeader(headers,name){if(!headers)return!1;let expected=name.toLowerCase();for(let[key,value]of Object.entries(headers))if(key.toLowerCase()===expected&&value!==null&&value.trim().length>0)return!0;return!1}function hasRequestAuth(apiKey,headers){return!!apiKey||hasHeader(headers,"authorization")||hasHeader(headers,"x-api-k\
|
|
19
|
+
ey")||hasHeader(headers,"cf-aig-authorization")}function assertRequestAuth(provider,apiKey,headers){if(!hasRequestAuth(apiKey,headers))throw new Error(`No API key for provider: ${provider}`)}var PiAnthropic=class extends Anthropic{_shouldResolveDefaultCredentials(){return!1}};function getAnthropicFederation(model,apiKey,headers,env){if(model.provider!=="anthropic"||hasRequestAuth(apiKey,headers))return;let federationRuleId=getProviderEnvValue(ANTHROPIC_FEDERATION_RULE_ID_ENV,env),organizationId=getProviderEnvValue(
|
|
20
|
+
ANTHROPIC_ORGANIZATION_ID_ENV,env),identityTokenFile=getProviderEnvValue(ANTHROPIC_IDENTITY_TOKEN_FILE_ENV,env);if(!(!federationRuleId||!organizationId||!identityTokenFile))return{organization_id:organizationId,workspace_id:getProviderEnvValue(ANTHROPIC_WORKSPACE_ID_ENV,env),authentication:{type:"oidc_federation",federation_rule_id:federationRuleId,service_account_id:getProviderEnvValue(ANTHROPIC_SERVICE_ACCOUNT_ID_ENV,env),identity_token:{source:"file",path:identityTokenFile}}}}var federationClient,
|
|
21
|
+
ANTHROPIC_MESSAGE_EVENTS=new Set(["message_start","message_delta","message_stop","content_block_start","content_block_delta","content_block_stop"]),ANTHROPIC_FIRST_EVENT_TIMEOUT_MS=6e4,MAX_TIMER_MS=2147483647;function firstEventWatchdog(model,timeoutMs){let configured=timeoutMs!==void 0&&timeoutMs>0&&timeoutMs<=MAX_TIMER_MS?timeoutMs:void 0,deadlineMs=isAnthropicApiHost(model.baseUrl)?Math.min(configured??ANTHROPIC_FIRST_EVENT_TIMEOUT_MS,ANTHROPIC_FIRST_EVENT_TIMEOUT_MS):configured,controller=deadlineMs===
|
|
22
|
+
void 0?void 0:new AbortController,timer,timedOut=!1;return{signal:controller?.signal,start(){!controller||deadlineMs===void 0||(timer=setTimeout(()=>{timedOut=!0,controller.abort()},deadlineMs),timer.unref?.())},stop(){clearTimeout(timer),timer=void 0},error(){return timedOut?new Error(`Anthropic sent no message events for ${(deadlineMs??0)/1e3} s after the response headers (timed out)`):void 0}}}async function*iterateAnthropicEvents(response,signal){if(!response.body)throw new Error("Attempted \
|
|
23
|
+
to iterate over an Anthropic response with no body");let sawMessageStart=!1,sawMessageEnd=!1;for await(let sse of iterateSseMessages(response.body,{signal})){if(sse.event==="error")throw new Error(sse.data);if(ANTHROPIC_MESSAGE_EVENTS.has(sse.event??""))try{let event=parseJsonWithRepair(sse.data);event.type==="message_start"?sawMessageStart=!0:event.type==="message_stop"&&(sawMessageEnd=!0),yield event}catch(error){let message=error instanceof Error?error.message:String(error);throw new Error(`C\
|
|
24
|
+
ould not parse Anthropic SSE event ${sse.event}: ${message}; data=${sse.data}; raw=${sse.raw.join("\\n")}`)}}if(sawMessageStart&&!sawMessageEnd)throw new Error("Anthropic stream ended before message_stop")}var stream=(model,context,options)=>{let stream2=new AssistantMessageEventStream,compat=getAnthropicCompat(model),normalizedContext=resolveTranscript(context,compat.supportsMidConvoSystemMessages),currentTools=getCurrentTools(normalizedContext.messages);return(async()=>{let output={role:"assis\
|
|
25
|
+
tant",content:[],api:model.api,provider:model.provider,model:model.id,usage:{usageIncomplete:!0,input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()},isOAuth=!1,firstEvent=firstEventWatchdog(model,options?.timeoutMs);try{let client,usageModel=model,inputUsageIncomplete=!0,optionalUsage={},inputTransformations,cacheSessionId=resolveCacheRetention(options?.cacheRetention,options?.env)==="none"?void 0:
|
|
26
|
+
options?.sessionId,threadSessionId=(options?.client?model.compat?.supportsMessageThreads===!0:compat.supportsMessageThreads)?cacheSessionId:void 0,suppliedClient=options?.client;if(suppliedClient&&options?.beforeSubmission)throw new SubmissionAdmissionError("unsupported-route");if(suppliedClient)client=suppliedClient,isOAuth=!1;else{let apiKey=options?.apiKey,federation=getAnthropicFederation(model,apiKey,options?.headers,options?.env);federation||assertRequestAuth(model.provider,apiKey,options?.
|
|
27
|
+
headers);let copilotDynamicHeaders;if(model.provider==="github-copilot"){let hasImages=hasCopilotVisionInput(normalizedContext.messages);copilotDynamicHeaders=buildCopilotDynamicHeaders({messages:normalizedContext.messages,hasImages})}let created=createClient(model,apiKey,options?.headers,options?.fetch,copilotDynamicHeaders,cacheSessionId,federation,options?.identity);client=created.client,isOAuth=created.isOAuthToken}let observe=createRequestObserver(options,{api:"anthropic-messages",provider:model.
|
|
28
|
+
provider,model:model.id,operation:"chat"}),observeMiddleware=async(request,next,ctx)=>{if(ctx.options!==void 0){if(typeof request.body=="string")await observe(request.body);else if(observe.requiresAdmission)throw new SubmissionAdmissionError("unsupported-route")}return next(request)},requestSignal=combineAbortSignals([options?.signal,firstEvent.signal]),requestOptions={...requestSignal?{signal:requestSignal}:{},...options?.timeoutMs!==void 0?{timeout:options.timeoutMs}:{},...options?.onRequest||
|
|
29
|
+
options?.beforeSubmission?{middleware:[observeMiddleware]}:{},maxRetries:0};options?.signal?.throwIfAborted();let built=buildParams(model,normalizedContext,isOAuth,options,threadSessionId!==void 0);built.providerThinkingLevel&&(output.providerThinkingLevel=built.providerThinkingLevel);let params=built.params,onPayload=options?.onPayload,nextParams=await onPayload?.call(options,params,model);nextParams!==void 0&&(params={...nextParams,stream:!0}),!onPayload&&!suppliedClient&&cacheJsonSerialization(
|
|
30
|
+
params.messages);let sentMessages=params.messages,send=body=>retryProviderRequest(async()=>{try{return sentMessages=body.messages,await client.beta.messages.create(body,requestOptions).asResponse()}catch(error){if(model.provider!=="anthropic"||!isOAuth||!(error instanceof APIError)||error.status!==429||error.headers?.get("anthropic-ratelimit-unified-status")!=="rejected")throw error;let now=Date.now(),resetsAt=Number(error.headers.get("anthropic-ratelimit-unified-reset"))*1e3,validReset=Number.isFinite(
|
|
31
|
+
resetsAt)&&resetsAt>now&&resetsAt<=now+367*864e5;throw appendAssistantMessageDiagnostic(output,createAssistantMessageDiagnostic("provider_http_error",error,{status:429,code:"usage_limit_reached",retryable:!1,...validReset?{resetsAt}:{}})),await options?.onResponse?.({status:429,headers:headersToRecord(error.headers)},model),new Error(error.message,{cause:error})}},{maxRetries:options?.maxRetries,maxRetryDelayMs:options?.maxRetryDelayMs,signal:options?.signal,onErrorResponse:errorResponse=>options?.
|
|
32
|
+
onResponse?.(errorResponse,model)}),prepared=threadSessionId!==void 0&&options?.disableContinuation!==!0?prepareThreadRequest(model,threadSessionId,shortHash(options?.apiKey??""),params):void 0,sent=prepared?await sendThreadRequest(prepared,params,send,output,options?.signal):{response:await send(params),thread:void 0},response=sent.response,thread=sent.thread;await options?.onResponse?.({status:response.status,headers:headersToRecord(response.headers)},model),stream2.push({type:"start",partial:output});
|
|
33
|
+
let openBlocks=new Map,openBlock=anthropicIndex=>{let open=openBlocks.get(anthropicIndex);return open===void 0?void 0:{...open,block:output.content[open.contentIndex]}};firstEvent.start();for await(let event of iterateAnthropicEvents(response,requestSignal))if(firstEvent.stop(),await options?.onProviderStreamEvent?.(event,model),event.type==="message_start"){output.responseId=event.message.id;let transformations=event.message.input_transformations;Array.isArray(transformations)&&(inputTransformations=
|
|
34
|
+
transformations);let responseModel=event.message.model;responseModel!==model.id&&(output.responseModel=responseModel);let fallbackCost=responseModel===model.id?void 0:model.compat?.allowedFallbackModels?.find(fallback=>fallback.provider===model.provider&&fallback.model===responseModel)?.cost;usageModel=fallbackCost?{...model,id:responseModel,cost:fallbackCost}:model,inputUsageIncomplete=hasIncompleteUsage([event.message.usage?.input_tokens]),optionalUsage.cacheRead=event.message.usage?.cache_read_input_tokens,
|
|
35
|
+
optionalUsage.cacheWrite=event.message.usage?.cache_creation_input_tokens,optionalUsage.cacheWrite1h=event.message.usage?.cache_creation?.ephemeral_1h_input_tokens,output.usage.input=event.message.usage?.input_tokens||0,output.usage.output=event.message.usage?.output_tokens||0,output.usage.cacheRead=event.message.usage?.cache_read_input_tokens||0,output.usage.cacheWrite=event.message.usage?.cache_creation_input_tokens||0,output.usage.cacheWrite1h=event.message.usage?.cache_creation?.ephemeral_1h_input_tokens||
|
|
36
|
+
0,output.usage.totalTokens=output.usage.input+output.usage.output+output.usage.cacheRead+output.usage.cacheWrite,calculateCost(usageModel,output.usage)}else if(event.type==="content_block_start"){if(event.content_block.type==="fallback"){if(output.content.length>0)throw new Error("Anthropic performed an unsupported mid-output model fallback");continue}event.content_block.type==="text"?(output.content.push({type:"text",text:event.content_block.text??""}),openBlocks.set(event.index,{contentIndex:output.
|
|
37
|
+
content.length-1}),event.content_block.text?.length&&reportContentProgress(options?.signal),stream2.push({type:"text_start",contentIndex:output.content.length-1,partial:output})):event.content_block.type==="thinking"?(output.content.push({type:"thinking",thinking:event.content_block.thinking??"",thinkingSignature:event.content_block.signature??""}),openBlocks.set(event.index,{contentIndex:output.content.length-1}),(event.content_block.thinking?.length||event.content_block.signature)&&reportContentProgress(
|
|
38
|
+
options?.signal),stream2.push({type:"thinking_start",contentIndex:output.content.length-1,partial:output})):event.content_block.type==="redacted_thinking"?(output.content.push({type:"thinking",thinking:"[Reasoning redacted]",thinkingSignature:event.content_block.data,redacted:!0}),openBlocks.set(event.index,{contentIndex:output.content.length-1}),event.content_block.data.length>0&&reportContentProgress(options?.signal),stream2.push({type:"thinking_start",contentIndex:output.content.length-1,partial:output})):
|
|
39
|
+
event.content_block.type==="tool_use"&&(output.content.push({type:"toolCall",id:event.content_block.id,name:isOAuth?fromClaudeCodeName(event.content_block.name,currentTools):event.content_block.name,arguments:event.content_block.input??{}}),openBlocks.set(event.index,{contentIndex:output.content.length-1,arguments:new ToolCallArgumentsStream}),stream2.push({type:"toolcall_start",contentIndex:output.content.length-1,partial:output}))}else if(event.type==="content_block_delta"){let open=openBlock(
|
|
40
|
+
event.index);event.delta.type==="text_delta"?open?.block.type==="text"&&(open.block.text+=event.delta.text,stream2.push({type:"text_delta",contentIndex:open.contentIndex,delta:event.delta.text,partial:output})):event.delta.type==="thinking_delta"?open?.block.type==="thinking"&&(open.block.thinking+=event.delta.thinking,stream2.push({type:"thinking_delta",contentIndex:open.contentIndex,delta:event.delta.thinking,partial:output})):event.delta.type==="input_json_delta"?open?.block.type==="toolCall"&&
|
|
41
|
+
open.arguments!==void 0&&(open.block.arguments=open.arguments.append(event.delta.partial_json),stream2.push({type:"toolcall_delta",contentIndex:open.contentIndex,delta:event.delta.partial_json,partial:output})):event.delta.type==="signature_delta"&&open?.block.type==="thinking"&&(open.block.thinkingSignature=open.block.thinkingSignature||"",open.block.thinkingSignature+=event.delta.signature,event.delta.signature.length>0&&reportContentProgress(options?.signal))}else if(event.type==="content_blo\
|
|
42
|
+
ck_stop"){let open=openBlock(event.index);if(openBlocks.delete(event.index),open){let{block,contentIndex:index}=open;block.type==="text"?stream2.push({type:"text_end",contentIndex:index,content:block.text,partial:output}):block.type==="thinking"?stream2.push({type:"thinking_end",contentIndex:index,content:block.thinking,partial:output}):block.type==="toolCall"&&open.arguments!==void 0&&(Object.assign(block,open.arguments.finish()),stream2.push({type:"toolcall_end",contentIndex:index,toolCall:block,
|
|
43
|
+
partial:output}))}}else if(event.type==="message_delta"){let transformations=event.input_transformations;if(Array.isArray(transformations)&&(inputTransformations=transformations),event.delta.stop_reason){output.rawStopReason=event.delta.stop_reason;let stopReasonResult=mapStopReason(event.delta.stop_reason,event.delta.stop_details);output.stopReason=stopReasonResult.stopReason,stopReasonResult.errorMessage&&(output.errorMessage=stopReasonResult.errorMessage)}if(event.usage){event.usage.input_tokens!=
|
|
44
|
+
null&&(output.usage.input=event.usage.input_tokens,inputUsageIncomplete=hasIncompleteUsage([event.usage.input_tokens])),event.usage.output_tokens!=null&&(output.usage.output=event.usage.output_tokens),event.usage.cache_read_input_tokens!==void 0&&(optionalUsage.cacheRead=event.usage.cache_read_input_tokens),event.usage.cache_read_input_tokens!=null&&(output.usage.cacheRead=event.usage.cache_read_input_tokens),event.usage.cache_creation_input_tokens!==void 0&&(optionalUsage.cacheWrite=event.usage.
|
|
45
|
+
cache_creation_input_tokens),event.usage.cache_creation_input_tokens!=null&&(output.usage.cacheWrite=event.usage.cache_creation_input_tokens);let cacheCreation=event.usage.cache_creation;cacheCreation?.ephemeral_1h_input_tokens!==void 0&&(optionalUsage.cacheWrite1h=cacheCreation.ephemeral_1h_input_tokens),cacheCreation?.ephemeral_1h_input_tokens!=null&&(output.usage.cacheWrite1h=cacheCreation.ephemeral_1h_input_tokens);let thinkingTokens=event.usage.output_tokens_details?.thinking_tokens;thinkingTokens!==
|
|
46
|
+
void 0&&(optionalUsage.reasoning=thinkingTokens),event.delta.stop_reason&&(output.usage.usageIncomplete=inputUsageIncomplete||hasIncompleteUsage([event.usage.output_tokens],[event.usage.input_tokens,...Object.values(optionalUsage)])),thinkingTokens!=null&&(output.usage.reasoning=thinkingTokens)}output.usage.totalTokens=output.usage.input+output.usage.output+output.usage.cacheRead+output.usage.cacheWrite,output.usage.usageIncomplete||=hasIncompleteUsage([output.usage.totalTokens]),calculateCost(usageModel,
|
|
47
|
+
output.usage),isOpenRouterModel(model)&&event.usage&&applyOpenRouterReportedCost(output.usage,event.usage)}if(options?.signal?.aborted)throw new Error("Request was aborted");if(output.stopReason==="pending")throw new Error("Anthropic stream ended without a stop reason");if(output.stopReason==="aborted"||output.stopReason==="error")throw new Error(output.errorMessage||"An unknown error occurred");for(let open of openBlocks.values()){let block=output.content[open.contentIndex];if(block.type==="too\
|
|
48
|
+
lCall"&&open.arguments!==void 0&&output.stopReason!=="length")throw new Error(`Anthropic stream completed with an unfinished tool call: ${block.name} (${block.id})`)}thread&&recordThreadReply(model,thread,params,output,isOAuth,compat.allowEmptySignature),inputTransformations&&inputTransformations.length>0&&appendAssistantMessageDiagnostic(output,{type:"anthropic_input_transformations",timestamp:Date.now(),details:{transformations:inputTransformations.map(transformation=>{let signatureHash=droppedSignatureHash(
|
|
49
|
+
sentMessages,transformation);return{type:transformation.type??void 0,path:transformation.path??void 0,reason:transformation.reason??void 0,...signatureHash===void 0?{}:{signatureHash}}})}}),stream2.push({type:"done",reason:output.stopReason,message:output}),stream2.end()}catch(caught){let error=firstEvent.error()??caught;output.stopReason=options?.signal?.aborted?"aborted":"error";let refusal=findSubmissionAdmissionError(error);output.errorMessage=refusal?.message??(error instanceof Error?error.
|
|
50
|
+
message:safeJsonStringify(error)),refusal||appendProviderHttpStatusDiagnostic(output,normalizeProviderError(error)),refusal?appendAssistantMessageDiagnostic(output,{type:"provider_http_error",timestamp:Date.now(),details:{retryable:!1}}):model.provider==="anthropic"&&isOAuth&&error instanceof APIError&&error.status===429&&error.type==="rate_limit_error"&&appendAssistantMessageDiagnostic(output,createAssistantMessageDiagnostic("provider_http_error",error,{status:429,retryable:!0}));let retryAfterMs=getServerRetryDelayMs(
|
|
51
|
+
error);retryAfterMs!==void 0&&(output.retryAfterMs=retryAfterMs),stream2.push({type:"error",reason:output.stopReason,error:output}),stream2.end()}finally{firstEvent.stop()}})(),stream2};function mapThinkingLevelToEffort(model,level){let mapped=level?model.thinkingLevelMap?.[level]:void 0;if(typeof mapped=="string")return mapped;switch(level){case"minimal":case"low":return"low";case"medium":return"medium";case"high":return"high";default:return"high"}}var streamSimple=(model,context,options)=>{getAnthropicFederation(
|
|
52
|
+
model,options?.apiKey,options?.headers,options?.env)||assertRequestAuth(model.provider,options?.apiKey,options?.headers);let base={...buildBaseOptions(model,context,options,options?.apiKey),toolChoice:options?.toolChoice};if(!options?.reasoning)return stream(model,context,{...base,thinkingEnabled:!1});if(model.compat?.forceAdaptiveThinking===!0){let effort=mapThinkingLevelToEffort(model,options.reasoning);return stream(model,context,{...base,thinkingEnabled:!0,effort})}let adjusted=adjustMaxTokensForThinking(
|
|
53
|
+
base.maxTokens,model.maxTokens,options.reasoning,options.thinkingBudgets),maxTokens=clampMaxTokensToContext(model,context,adjusted.maxTokens);return stream(model,context,{...base,maxTokens,thinkingEnabled:!0,thinkingBudgetTokens:Math.min(adjusted.thinkingBudget,Math.max(0,maxTokens-1024))})};function isOAuthToken(apiKey){return apiKey.startsWith("sk-ant-oat")}function createClient(model,apiKey,optionsHeaders,fetch,dynamicHeaders,sessionId,federation,identity){if(model.provider==="github-copilot")
|
|
54
|
+
return{client:new PiAnthropic({apiKey:null,authToken:apiKey??null,baseURL:model.baseUrl,dangerouslyAllowBrowser:!0,fetch,defaultHeaders:mergeHeaders(getIdentityHeaders(model,identity),{accept:"application/json","anthropic-dangerous-direct-browser-access":"true"},getModelHeaders(model),dynamicHeaders,optionsHeaders)}),isOAuthToken:!1};if(apiKey&&isOAuthToken(apiKey))return{client:new PiAnthropic({apiKey:null,authToken:apiKey,baseURL:model.baseUrl,dangerouslyAllowBrowser:!0,fetch,defaultHeaders:mergeHeaders(
|
|
55
|
+
{accept:"application/json","anthropic-dangerous-direct-browser-access":"true","user-agent":`claude-cli/${claudeCodeVersion}`,"x-app":"cli"},model.headers,optionsHeaders)}),isOAuthToken:!0};let compat=getAnthropicCompat(model),sessionAffinityHeaders={};if(sessionId&&compat.sendSessionAffinityHeaders){let header=compat.sessionAffinityFormat==="openrouter"?"x-session-id":"x-session-affinity";sessionAffinityHeaders[header]=sessionId}let defaultHeaders=mergeHeaders(getIdentityHeaders(model,identity),
|
|
56
|
+
{accept:"application/json","anthropic-dangerous-direct-browser-access":"true"},sessionAffinityHeaders,model.headers,optionsHeaders);if(federation){let key=JSON.stringify([model.baseUrl,federation]);if(federationClient?.key!==key||federationClient.fetch!==fetch){let client2=new PiAnthropic({apiKey:null,authToken:null,config:federation,baseURL:model.baseUrl,dangerouslyAllowBrowser:!0,fetch});federationClient={key,fetch,client:client2}}return{client:federationClient.client.withOptions({defaultHeaders}),
|
|
57
|
+
isOAuthToken:!1}}return{client:new PiAnthropic({apiKey:apiKey??null,authToken:null,baseURL:model.baseUrl,dangerouslyAllowBrowser:!0,fetch,defaultHeaders}),isOAuthToken:!1}}function getBetaFeatures(model,context,options,{isOAuthToken:isOAuthToken2,nativeToolChanges,messageThreads}){let configuredFeatures;for(let headers of[model.headers,options?.headers])for(let[name,value]of Object.entries(headers??{}))name.toLowerCase()==="anthropic-beta"&&(configuredFeatures=value);if(configuredFeatures===null)
|
|
58
|
+
return[];if(configuredFeatures!==void 0)return[...new Set(configuredFeatures.split(",").map(feature=>feature.trim()).filter(feature=>feature.length>0))];let features=[];return isOAuthToken2&&features.push("claude-code-20250219","oauth-2025-04-20"),shouldUseFineGrainedToolStreamingBeta(model,context)&&features.push(FINE_GRAINED_TOOL_STREAMING_BETA),model.reasoning&&options?.thinkingEnabled===!0&&(options.interleavedThinking??!0)&&model.compat?.forceAdaptiveThinking!==!0&&features.push(INTERLEAVED_THINKING_BETA),
|
|
59
|
+
shouldUseServerSideFallbackBeta(model)&&features.push(SERVER_SIDE_FALLBACK_BETA),model.compat?.supportsMidConvoEffort===!0&&features.push(MID_CONVERSATION_OUTPUT_CONFIG_BETA,THINKING_BINDING_CONTROLS_BETA),nativeToolChanges&&features.push(INLINE_TOOLS_BETA),messageThreads&&features.push(MESSAGE_THREADS_BETA),[...new Set(features)]}var ANTHROPIC_REASONING_DROPS={diagnostic:"anthropic_input_transformations",droppedType:"thinking_dropped",keyField:"signatureHash",prefixReason:"prefix_binding_mismat\
|
|
60
|
+
ch",modelReason:"model_binding_mismatch",blockKey:block=>block.thinkingSignature?shortHash(block.thinkingSignature):void 0},TRANSFORMATION_PATH=/^messages\.(\d+)\.content\.(\d+)$/;function droppedSignatureHash(sent,transformation){if(transformation.type!=="thinking_dropped"||typeof transformation.path!="string")return;let match=TRANSFORMATION_PATH.exec(transformation.path);if(!match)return;let content=sent[Number(match[1])]?.content;if(!Array.isArray(content))return;let block=content[Number(match[2])],
|
|
61
|
+
signature=block?.type==="thinking"?block.signature:block?.type==="redacted_thinking"?block.data:void 0;return signature?shortHash(signature):void 0}function buildParams(model,context,isOAuthToken2,options,messageThreads){let{cacheControl}=getCacheControl(model,options?.cacheRetention,options?.env),compat=getAnthropicCompat(model),initialSystemMessage=getInitialSystemMessage(context.messages),initialSystemText=initialSystemMessage?getSystemMessageText(initialSystemMessage):"",transformedMessages=transformMessages(
|
|
62
|
+
context.messages,model,normalizeToolCallId),conversationMessages=initialSystemMessage?transformedMessages.slice(1):transformedMessages,convertToolDefinitions=(tools,toolCacheControl2)=>convertTools(tools,isOAuthToken2,compat.supportsEagerToolInputStreaming,compat.supportsStrictTools,toolCacheControl2),initialTools=initialSystemMessage?.toolsAdded??[],nativeToolChanges=compat.supportsMidConvoSystemMessages&&compat.supportsMidConvoToolChanges&&initialTools.length>0,thinkingDisabled=(model.reasoning||
|
|
63
|
+
/claude/i.test(model.id))&&options?.thinkingEnabled===!1&&supportsDisabledAnthropicThinking(model),effortMessages=model.compat?.supportsMidConvoEffort===!0&&!thinkingDisabled,converted=convertMessages(conversationMessages,isOAuthToken2,cacheControl,compat.allowEmptySignature,effortMessages?model.provider:void 0,nativeToolChanges?convertToolDefinitions:void 0,collectReasoningDrops(context.messages,ANTHROPIC_REASONING_DROPS,model)),activeEffort=options?.effort??"high",betaFeatures=getBetaFeatures(
|
|
64
|
+
model,context,options,{isOAuthToken:isOAuthToken2,nativeToolChanges,messageThreads}),params={model:model.id,messages:effortMessages?insertThinkingLevelMessages(converted,activeEffort):converted.messages,max_tokens:options?.maxTokens??model.maxTokens,stream:!0,...betaFeatures.length>0?{betas:betaFeatures}:{}};isOAuthToken2?(params.system=[{type:"text",text:"You are Claude Code, Anthropic's official CLI for Claude.",...cacheControl?{cache_control:cacheControl}:{}}],initialSystemText&¶ms.system.
|
|
65
|
+
push({type:"text",text:sanitizeSurrogates(initialSystemText),...cacheControl?{cache_control:cacheControl}:{}})):initialSystemText&&(params.system=[{type:"text",text:sanitizeSurrogates(initialSystemText),...cacheControl?{cache_control:cacheControl}:{}}]);let toolCacheControl=compat.supportsCacheControlOnTools?cacheControl:void 0;if(nativeToolChanges)params.tools=[...convertToolDefinitions(initialTools,toolCacheControl),DEFERRED_TOOL_PLACEHOLDER];else{let tools=getCurrentTools(context.messages);tools.
|
|
66
|
+
length>0&&(params.tools=convertToolDefinitions(tools,toolCacheControl))}if(thinkingDisabled)params.thinking={type:"disabled"};else if(effortMessages)params.thinking={type:"adaptive",display:options?.thinkingDisplay??"summarized",block_binding:{prefix_mismatch_behavior:"drop_block"}},params.output_config={effort:"low"};else if(model.reasoning&&options?.thinkingEnabled){let display=options.thinkingDisplay??"summarized";model.compat?.forceAdaptiveThinking===!0?(params.thinking={type:"adaptive",display},
|
|
67
|
+
options.effort&&(params.output_config={effort:options.effort})):params.thinking={type:"enabled",budget_tokens:options.thinkingBudgetTokens||1024,display}}if(options?.metadata){let userId=options.metadata.user_id;typeof userId=="string"&&(params.metadata={user_id:userId})}options?.toolChoice&&(typeof options.toolChoice=="string"?params.tool_choice={type:options.toolChoice}:params.tool_choice=options.toolChoice);let allowedFallbackModels=model.compat?.allowedFallbackModels;return allowedFallbackModels&&
|
|
68
|
+
allowedFallbackModels.length>0&&(params.fallbacks=allowedFallbackModels.map(fallback=>({model:fallback.model}))),{params,providerThinkingLevel:effortMessages?activeEffort:void 0}}function normalizeToolCallId(id){return id.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,64)}function convertToolResult(msg,content=msg.content){return{type:"tool_result",tool_use_id:msg.toolCallId,content:convertContentBlocks(content),is_error:msg.isError}}function convertMessages(transformedMessages,isOAuthToken2,cacheControl,allowEmptySignature=!1,managedProvider,convertToolDefinitions,drops){
|
|
69
|
+
let params=[],assistantLevels=new Map,pendingSystemMessages=[],flushPendingSystemMessages=()=>{params.push(...pendingSystemMessages),pendingSystemMessages.length=0};for(let i=0;i<transformedMessages.length;i++){let msg=transformedMessages[i];if(msg.role==="system"){let text=renderSystemMessageUpdate(msg),blocks=[];if(text.length>0&&blocks.push({type:"text",text:sanitizeSurrogates(text)}),convertToolDefinitions){let added=msg.toolsAdded??[],redefined=new Set(added.map(tool=>tool.name));for(let tool of msg.
|
|
70
|
+
toolsRemoved??[])redefined.has(tool.name)||blocks.push({type:"tool_removal",tool:{type:"tool_reference",name:isOAuthToken2?toClaudeCodeName(tool.name):tool.name}});for(let definition of convertToolDefinitions(added))blocks.push({type:"tool_addition",tool:{type:"tool_definition",definition}})}blocks.length>0&&pendingSystemMessages.push({role:"system",content:blocks})}else if(msg.role==="user")if(typeof msg.content=="string")msg.content.trim().length>0&¶ms.push({role:"user",content:sanitizeSurrogates(
|
|
71
|
+
msg.content)});else{let filteredBlocks=msg.content.map(item=>item.type==="text"?{type:"text",text:sanitizeSurrogates(item.text)}:convertImageBlock(item)).filter(b=>b.type==="text"?b.text.trim().length>0:!0);if(filteredBlocks.length===0)continue;params.push({role:"user",content:filteredBlocks})}else if(msg.role==="assistant"){let blocks=[];for(let block of msg.content)if(block.type==="text"){if(block.text.trim().length===0)continue;blocks.push({type:"text",text:sanitizeSurrogates(block.text)})}else if(block.
|
|
72
|
+
type==="thinking"){if(isDroppedBlock(block,drops,ANTHROPIC_REASONING_DROPS))continue;if(block.redacted){blocks.push({type:"redacted_thinking",data:block.thinkingSignature});continue}let thinkingSignature=block.thinkingSignature,hasThinkingSignature=!!thinkingSignature&&thinkingSignature.trim().length>0;if(block.thinking.trim().length===0&&!hasThinkingSignature)continue;hasThinkingSignature?blocks.push({type:"thinking",thinking:sanitizeSurrogates(block.thinking),signature:thinkingSignature}):blocks.
|
|
73
|
+
push(allowEmptySignature?{type:"thinking",thinking:sanitizeSurrogates(block.thinking),signature:""}:{type:"text",text:sanitizeSurrogates(block.thinking)})}else block.type==="toolCall"&&blocks.push({type:"tool_use",id:block.id,name:isOAuthToken2?toClaudeCodeName(block.name):block.name,input:block.arguments??{}});if(blocks.length===0)continue;flushPendingSystemMessages();let messageIndex=params.length;params.push({role:"assistant",content:blocks}),managedProvider!==void 0&&msg.api==="anthropic-mes\
|
|
74
|
+
sages"&&msg.provider===managedProvider&&isAnthropicEffort(msg.providerThinkingLevel)&&assistantLevels.set(messageIndex,msg.providerThinkingLevel)}else if(msg.role==="toolResult"){let toolResults=[],errorImages=[],j=i;for(;j<transformedMessages.length&&transformedMessages[j].role==="toolResult";){let toolMsg=transformedMessages[j],split=splitErrorToolResultImages(toolMsg);toolResults.push(convertToolResult(toolMsg,split?.content)),split&&errorImages.push({type:"text",text:split.caption},...split.
|
|
75
|
+
images.map(convertImageBlock)),j++}i=j-1,params.push({role:"user",content:[...toolResults,...errorImages]})}}if(flushPendingSystemMessages(),cacheControl&¶ms.length>0){let lastMessage=params[params.length-1];if(lastMessage.role==="user"||lastMessage.role==="system")if(Array.isArray(lastMessage.content)){let lastBlock=lastMessage.content[lastMessage.content.length-1];lastBlock&&(lastBlock.type==="text"||lastBlock.type==="image"||lastBlock.type==="tool_result"||lastBlock.type==="tool_addition"||
|
|
76
|
+
lastBlock.type==="tool_removal")&&(lastBlock.cache_control=cacheControl)}else typeof lastMessage.content=="string"&&(lastMessage.content=[{type:"text",text:lastMessage.content,cache_control:cacheControl}])}return{messages:params,assistantLevels}}function isAnthropicEffort(value){return value==="low"||value==="medium"||value==="high"||value==="xhigh"||value==="max"}function insertThinkingLevelMessages(converted,activeEffort){let messages=[];for(let index=0;index<converted.messages.length;index++){
|
|
77
|
+
let historicalEffort=converted.assistantLevels.get(index);historicalEffort!==void 0&&messages.push({role:"system",content:[],output_config:{effort:historicalEffort}}),messages.push(converted.messages[index])}return messages.push({role:"system",content:[],output_config:{effort:activeEffort}}),messages}function shouldUseFineGrainedToolStreamingBeta(model,context){return getCurrentTools(context.messages).length>0&&!getAnthropicCompat(model).supportsEagerToolInputStreaming}var ANTHROPIC_STRICT_UNSUPPORTED_KEYWORDS=new Set(
|
|
78
|
+
["minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","maxItems","uniqueItems","minContains","maxContains","minProperties","maxProperties"]),ANTHROPIC_STRICT_STRING_FORMATS=new Set(["date-time","time","date","duration","email","hostname","uri","ipv4","ipv6","uuid"]),isAnthropicStrictUnsupportedKeyword=(key,value)=>ANTHROPIC_STRICT_UNSUPPORTED_KEYWORDS.has(key)?!0:key==="minItems"?value!==0&&value!==1:key==="format"?typeof value!="string"||!ANTHROPIC_STRICT_STRING_FORMATS.has(value):
|
|
79
|
+
!1;function convertTools(tools,isOAuthToken2,supportsEagerToolInputStreaming,supportsStrictTools,cacheControl){return tools?tools.map((tool,index)=>{let strict=prefersJsonSchemaStrictSampling(tool)?void 0:resolveJsonSchemaStrictSampling(tool,supportsStrictTools,isAnthropicStrictUnsupportedKeyword),parameters=getJsonSchemaToolParameters(tool,strict),schema=parameters,legacyInputSchema={type:"object",properties:schema.properties??{},required:schema.required??[],...schema.additionalProperties===void 0?
|
|
80
|
+
{}:{additionalProperties:schema.additionalProperties},...schema.$schema===void 0?{}:{$schema:schema.$schema},...schema.$defs===void 0?{}:{$defs:schema.$defs},...schema.definitions===void 0?{}:{definitions:schema.definitions}},inputSchema=strict===!0?{...parameters,...legacyInputSchema}:legacyInputSchema;return{name:isOAuthToken2?toClaudeCodeName(tool.name):tool.name,description:tool.description,...supportsEagerToolInputStreaming?{eager_input_streaming:!0}:{},...strict===!0?{strict:!0}:{},input_schema:inputSchema,
|
|
81
|
+
...cacheControl&&index===tools.length-1?{cache_control:cacheControl}:{}}}):[]}function mapStopReason(reason,stopDetails){switch(reason){case"end_turn":return{stopReason:"stop"};case"max_tokens":return{stopReason:"length"};case"tool_use":return{stopReason:"toolUse"};case"refusal":return{stopReason:"error",errorMessage:stopDetails?.explanation||"The model refused to complete the request"};case"pause_turn":return{stopReason:"stop"};case"stop_sequence":return{stopReason:"stop"};case"sensitive":return{
|
|
82
|
+
stopReason:"error",errorMessage:"Provider stopped with: sensitive"};default:throw new Error(`Unhandled stop reason: ${reason}`)}}export{stream,streamSimple};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
+
import{COLLAPSE_KEY_OFF,I18N_NAMESPACE,NO_INPUT_PLACEHOLDER,ROW_INTENT_META,SUPPORTED_LOCALES,displayLabel,formatAnswerScalar,formatKeySpecForDisplay,loadConfig,registerStrings,resolveCollapseKey,resolveNotesKey,sentinelsToAppend,stripFenceMarkers,t,validateGuidanceFields}from"./chunk-ZFFDBTG3.js";import{SettingsManager}from"./chunk-4SL6URR3.js";import"./chunk-RP6MWUAP.js";import{isKeyRelease,isKeyRepeat,matchesKey,truncateToWidth,visibleWidth,wrapTextWithAnsi}from"./chunk-H35P7ROY.js";
|
|
3
|
+
import"./chunk-F6ZAYLU2.js";import"./chunk-F74XLJPC.js";import"./chunk-BIC5BSNX.js";import"./chunk-QESIDBMW.js";import{typebox_exports}from"./chunk-VEGJT52D.js";import{getHumainModuleAssetsDir}from"./chunk-CKFLQGJN.js";import"./chunk-JXWJOIH4.js";import{join as join2}from"node:path";import{pathToFileURL}from"node:url";import{readFileSync}from"node:fs";import{fileURLToPath}from"node:url";function registerLocalesFromDir(namespace,packageUrl,options){let label2=options?.label??namespace,byLocale={};for(let{code}of SUPPORTED_LOCALES)byLocale[code]=loadOneLocale(packageUrl,code,label2);registerStrings(namespace,byLocale)}function loadOneLocale(packageUrl,code,label2){try{let filePath=fileURLToPath(new URL(`./locales/${code}.json`,packageUrl));return JSON.parse(readFileSync(filePath,"utf-8"))}catch(err){return console.warn(`${label2}: failed to load locales/${code}.json \u2014 falling bac\
|
|
4
|
+
k to English (${err.message})`),{}}}var ASK_USER_PROMPT_EVENT="rpiv:ask-user:prompt",ASK_USER_BLOCKED_EVENT="rpiv:ask-user:blocked",ASK_USER_ANSWER_EVENT="rpiv:ask-user:answer",ASK_USER_ANSWER_RESULT_EVENT="rpiv:ask-user:answer-result";var reject=(code,reason)=>({ok:!1,code,reason}),isRecord=v=>typeof v=="object"&&v!==null&&!Array.isArray(v);function noteOf(v){let trimmed=v?.trim();return trimmed||void 0}function resolveExternalAnswer(questions,payload){let{answers,globalNote,cancel}=payload;if(cancel!==void 0&&typeof cancel!="boolean")return reject("invalid_payload","cancel must be a boolean");if(globalNote!==void 0&&typeof globalNote!="string")return reject("invalid_payload","globalNote must be a string");let note=noteOf(globalNote),
|
|
5
|
+
withNote=note?{globalNote:note}:{};if(cancel===!0)return answers!==void 0&&!(Array.isArray(answers)&&answers.length===0)?reject("invalid_payload","cancel takes no answers"):{ok:!0,result:{answers:[],cancelled:!0,...withNote}};if(!Array.isArray(answers))return reject("invalid_payload","answers must be an array");let byQuestion=new Map;for(let entry of answers){if(!isRecord(entry))return reject("invalid_payload","each answer must be an object");let index=entry.questionIndex;if(!Number.isInteger(index))
|
|
6
|
+
return reject("invalid_payload","questionIndex must be an integer");let i=index;if(i<0||i>=questions.length)return reject("invalid_answer",`questionIndex ${i} out of range (0..${questions.length-1})`);if(byQuestion.has(i))return reject("invalid_answer",`question ${i} answered twice`);byQuestion.set(i,entry)}let resolved=[];for(let i=0;i<questions.length;i++){let entry=byQuestion.get(i);if(!entry)return reject("invalid_answer",`no answer for question ${i} ("${questions[i].header}")`);let answer=resolveEntry(
|
|
7
|
+
questions[i],i,entry);if(!answer.ok)return answer;resolved.push(answer.answer)}return{ok:!0,result:{answers:resolved,cancelled:!1,...withNote}}}function resolveEntry(q,i,entry){let{optionIndexes,text,notes}=entry;if(optionIndexes!==void 0&&(!Array.isArray(optionIndexes)||!optionIndexes.every(Number.isInteger)))return{ok:!1,code:"invalid_payload",reason:`question ${i}: optionIndexes must be an array of integers`};if(text!==void 0&&typeof text!="string")return{ok:!1,code:"invalid_payload",reason:`\
|
|
8
|
+
question ${i}: text must be a string`};if(notes!==void 0&&typeof notes!="string")return{ok:!1,code:"invalid_payload",reason:`question ${i}: notes must be a string`};let invalid=reason=>({ok:!1,code:"invalid_answer",reason:`question ${i}: ${reason}`}),picked=optionIndexes??[],out=picked.find(n=>n<0||n>=q.options.length);if(out!==void 0)return invalid(`option index ${out} out of range (0..${q.options.length-1})`);if(new Set(picked).size!==picked.length)return invalid("option index repeated");if(text!==
|
|
9
|
+
void 0&&text.trim().length===0)return invalid("text is blank");if(picked.length===0&&text===void 0)return invalid("needs optionIndexes or text");let base={questionIndex:i,question:q.question},note=noteOf(notes),withNote=note?{notes:note}:{};if(q.multiSelect){let selected=q.options.filter((_o,n)=>picked.includes(n)).map(o=>o.label);return{ok:!0,answer:{...base,kind:"multi",answer:text??null,selected,...withNote}}}if(picked.length>0&&text!==void 0)return invalid("single-select takes optionIndexes \
|
|
10
|
+
or text, not both");if(picked.length>1)return invalid(`single-select takes one option, got ${picked.length}`);if(text!==void 0)return{ok:!0,answer:{...base,kind:"custom",answer:text,...withNote}};let option=q.options[picked[0]],withPreview=option.preview&&option.preview.length>0?{preview:option.preview}:{};return{ok:!0,answer:{...base,kind:"option",answer:option.label,...withPreview,...withNote}}}var OpenQuestionnaire=class{result;deliver;resolveEarly;answeredEarly=new Promise(resolve=>{this.resolveEarly=resolve});toolCallId;questions;host;constructor(toolCallId,questions,host){this.toolCallId=toolCallId,this.questions=questions,this.host=host}get settled(){return this.result}attach(done){this.deliver=done}settle(result){return this.result?!1:(this.result=result,this.deliver?this.deliver(result):this.resolveEarly(result),!0)}},isRecord2=v=>typeof v=="object"&&v!==null&&!Array.isArray(v);
|
|
11
|
+
function registerAnswerChannel(pi){let open=new Map;return pi.events.on(ASK_USER_ANSWER_EVENT,data=>{let payload=isRecord2(data)?data:{},requestId=typeof payload.requestId=="string"?payload.requestId:void 0,toolCallId=typeof payload.toolCallId=="string"?payload.toolCallId:void 0,reply=(code,reason)=>{let verdict={ok:code===void 0,...code?{code,reason}:{},...requestId!==void 0?{requestId}:{},...toolCallId!==void 0?{toolCallId}:{}};pi.events.emit(ASK_USER_ANSWER_RESULT_EVENT,verdict)};if(!isRecord2(
|
|
12
|
+
data))return reply("invalid_payload","payload must be an object");if(payload.requestId!==void 0&&requestId===void 0)return reply("invalid_payload","requestId must be a string");if(toolCallId===void 0)return reply("invalid_payload","toolCallId must be a string");let target=open.get(toolCallId);if(!target||target.settled)return reply("not_found",`no open questionnaire for tool call ${toolCallId}`);if(target.host==="rpc")return reply("unsupported_host","this host shows the questions in its own dial\
|
|
13
|
+
ogs");let outcome=resolveExternalAnswer(target.questions,payload);if(!outcome.ok)return reply(outcome.code,outcome.reason);if(!target.settle(outcome.result))return reply("not_found",`tool call ${toolCallId} is already answered`);reply()}),{open(toolCallId,questions,host){let questionnaire=new OpenQuestionnaire(toolCallId,questions,host);return open.set(toolCallId,questionnaire),questionnaire},close(questionnaire){open.get(questionnaire.toolCallId)===questionnaire&&open.delete(questionnaire.toolCallId)}}}var fullRowBudget=terminalRows=>terminalRows,HOST_ALLOCATED_ROWS=Symbol.for("rpiv-ask-user-question:host-allocated-rows");function hostAllocatesRows(terminal){return terminal[HOST_ALLOCATED_ROWS]===!0}function rowBudgetForHost(terminal,budget){return hostAllocatesRows(terminal)?fullRowBudget:budget}var YIELD_TO_OVERLAY=Object.freeze({answers:[],cancelled:!0});function mustYieldInlineSlot(tui){if(hostAllocatesRows(tui.terminal))return!1;let{getTopmostVisibleOverlay}=tui;return typeof getTopmostVisibleOverlay==
|
|
14
|
+
"function"?getTopmostVisibleOverlay.call(tui)!==void 0:typeof tui.hasOverlay=="function"&&tui.hasOverlay()}var inlineRowBudget=terminalRows=>Math.min(terminalRows,Math.max(12,Math.floor(terminalRows*.7))),inlineSlotHeld=!1;function claimInlineSlot(){if(inlineSlotHeld)return;inlineSlotHeld=!0;let released=!1;return()=>{released||(released=!0,inlineSlotHeld=!1)}}var OVERLAY_PRESENTATION=Object.freeze({overlay:!0,rowBudget:fullRowBudget,hideOnCollapse:!0}),STACKED_OVERLAY_PRESENTATION=Object.freeze(
|
|
15
|
+
{overlay:!0,rowBudget:fullRowBudget,hideOnCollapse:!1});function resolvePresentation(){let release=claimInlineSlot();return release?{overlay:!1,rowBudget:inlineRowBudget,release}:OVERLAY_PRESENTATION}var MULTI_SELECT_INSTRUCTIONS='Enter the numbers of all that apply, comma-separated (e.g. "1,3"). Add "; custom answer" to include your own text, or type only custom text.',CUSTOM_ANSWER_TITLE="Type your answer:",MULTI_SELECT_PLACEHOLDER="1,3; custom answer",MAX_PREVIEW_CHARS=600;function hasDialogUI(ui){let u=ui;return typeof u?.select=="function"&&typeof u?.input=="function"}function formatOptionLine(option,index){return`${index+1}. ${option.label} \u2014 ${option.description}`}function parseIndex(token,count){
|
|
16
|
+
let i=Number.parseInt(token,10)-1;return i>=0&&i<count?i:null}function buildPreviewBlock(question){let blocks=question.options.flatMap((o,i)=>o.preview&&o.preview.length>0?[`--- ${i+1}. ${o.label} preview ---
|
|
17
|
+
${o.preview.slice(0,MAX_PREVIEW_CHARS)}`]:[]);return blocks.length>0?`
|
|
18
|
+
|
|
19
|
+
${blocks.join(`
|
|
20
|
+
|
|
21
|
+
`)}`:""}async function runRpcQuestionnaire(ui,params){let answers=[];for(let qi=0;qi<params.questions.length;qi++){let q=params.questions[qi],header=q.header?`[${q.header}] `:"",answer=q.multiSelect?await askMultiSelect(ui,q,qi,header):await askSingleSelect(ui,q,qi,header);if(answer===void 0)return{answers,cancelled:!0};answers.push(answer)}return{answers,cancelled:!1}}async function askSingleSelect(ui,q,questionIndex,header){let options=q.options.map(formatOptionLine);options.push(`${q.options.
|
|
22
|
+
length+1}. ${displayLabel("other")}`);let title=`${header}${q.question}${buildPreviewBlock(q)}`;for(;;){let chosen=await ui.select(title,options);if(chosen==null)return;let reply=chosen.trim();if(reply.length===0)return;let idx=resolveSingleSelectReply(chosen,reply,options,q);if(idx===void 0)return{questionIndex,question:q.question,kind:"custom",answer:reply};if(idx<q.options.length){let o=q.options[idx];return{questionIndex,question:q.question,kind:"option",answer:o.label,preview:o.preview&&o.preview.
|
|
23
|
+
length>0?o.preview:void 0}}let typed=await ui.input(`${header}${q.question}
|
|
24
|
+
|
|
25
|
+
${q.options.map(formatOptionLine).join(`
|
|
26
|
+
`)}
|
|
27
|
+
|
|
28
|
+
${t("rpc.custom_answer_title",CUSTOM_ANSWER_TITLE)}`,"");if(!(typed==null||typed.trim().length===0))return{questionIndex,question:q.question,kind:"custom",answer:typed}}}function resolveSingleSelectReply(chosen,reply,lines,q){let line=lines.indexOf(chosen);if(line>=0)return line;if(/^\d+\.?$/.test(reply))return parseIndex(reply,lines.length)??void 0;let label2=q.options.findIndex(o=>o.label===reply);return label2>=0?label2:void 0}async function askMultiSelect(ui,q,questionIndex,header){let list=q.
|
|
29
|
+
options.map(formatOptionLine).join(`
|
|
30
|
+
`),value=await ui.input(`${header}${q.question}
|
|
31
|
+
|
|
32
|
+
${list}
|
|
33
|
+
|
|
34
|
+
${t("rpc.multi_instructions",MULTI_SELECT_INSTRUCTIONS)}`,MULTI_SELECT_PLACEHOLDER);if(value==null)return;let trimmed=value.trim();if(trimmed.length===0)return{questionIndex,question:q.question,kind:"multi",answer:null,selected:[]};let[selectionPart="",...customParts]=trimmed.split(";"),selection=selectionPart.trim(),custom=customParts.join(";").trim(),indices=selection.split(/[,\s]+/).filter(tok=>tok.length>0).map(tok=>/^\d+\.?$/.test(tok)?parseIndex(tok,q.options.length):null);if(selection.length===
|
|
35
|
+
0||indices.every(i=>i!=null)){let selected=[];for(let i of indices){if(i==null)continue;let label2=q.options[i].label;selected.includes(label2)||selected.push(label2)}return{questionIndex,question:q.question,kind:"multi",answer:custom.length>0?custom:null,selected}}return{questionIndex,question:q.question,kind:"multi",answer:trimmed,selected:[]}}import{spawn}from"node:child_process";import{mkdtempSync,readFileSync as readFileSync2,rmSync,writeFileSync}from"node:fs";import{tmpdir}from"node:os";import{join}from"node:path";function runEditor(command,file){let[editor,...args]=command.split(" ");return editor?new Promise((resolve,reject2)=>{let child=spawn(editor,[...args,file],{stdio:"inherit",shell:process.platform==="win32"});child.once("error",reject2),child.once("close",(code,signal)=>{if(code===0){resolve();return}let reason=signal?`si\
|
|
36
|
+
gnal ${signal}`:`exit code ${code??"unknown"}`;reject2(new Error(`External editor exited with ${reason}`))})}):Promise.reject(new Error("External editor command is empty"))}async function editWithExternalEditor(tui,command,value){let tempDir=mkdtempSync(join(tmpdir(),"rpiv-ask-user-question-")),tempFile=join(tempDir,"answer.md"),tuiStopped=!1;try{return writeFileSync(tempFile,value,"utf8"),tui.stop(),tuiStopped=!0,process.stdout.write(`Launching external editor: ${command}
|
|
37
|
+
Pi will resume when the editor exits.
|
|
38
|
+
`),await runEditor(command,tempFile),readFileSync2(tempFile,"utf8").replace(/\r?\n$/,"")}finally{try{rmSync(tempDir,{recursive:!0,force:!0})}catch{}tuiStopped&&(tui.start(),tui.requestRender(!0))}}function normalizeLineTerminators(text){return text.replace(/\r\n/g,`
|
|
39
|
+
`).replace(/\r/g,"")}function normalizeStringFields(obj,keys){let out={...obj};for(let key of keys){let value=obj[key];typeof value=="string"&&(out[key]=normalizeLineTerminators(value))}return out}function normalizeQuestionParams(params){return{...params,questions:params.questions.map(q=>({...normalizeStringFields(q,["question","header"]),options:q.options.map(o=>normalizeStringFields(o,["label","description","preview"]))}))}}function prepareQuestionArguments(args){if(!isRecord3(args))return args;
|
|
40
|
+
let questions=decodeArray(args.questions);if(!Array.isArray(questions))return args;let decoded=questions.map(q=>{let question=decodeObject(q);if(!isRecord3(question))return question;let options=decodeArray(question.options);return Array.isArray(options)?{...question,options:options.map(decodeObject)}:question});return{...args,questions:decoded}}function isRecord3(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)}function decodeArray(value){let parsed=typeof value=="string"?
|
|
41
|
+
parseJson(value):value;return Array.isArray(parsed)?parsed:value}function decodeObject(value){let parsed=typeof value=="string"?parseJson(value):value;return isRecord3(parsed)?parsed:value}function parseJson(text){try{return JSON.parse(text)}catch{return}}var DECLINE_MESSAGE="User declined to answer questions",ENVELOPE_PREFIX="User has answered your questions:",ENVELOPE_SUFFIX="You can now continue with the user's answers in mind.";function buildQuestionnaireResponse(result,params){if(!result||result.cancelled)return buildToolResult(DECLINE_MESSAGE,{answers:result?.answers??[],cancelled:!0,...result?.globalNote&&result.globalNote.length>0?{globalNote:result.globalNote}:{}});let segments=[],unanswered=[];for(let i=0;i<params.questions.length;i++){
|
|
42
|
+
let a=result.answers.find(x=>x.questionIndex===i);a?segments.push(buildAnswerSegment(a)):unanswered.push(i)}let hasGlobalNote=result.globalNote!==void 0&&result.globalNote.length>0;if(segments.length===0&&!hasGlobalNote)return buildToolResult(DECLINE_MESSAGE,{answers:result.answers,cancelled:!0});unanswered.length>0&&segments.push(buildUnansweredSegment(unanswered,params)),hasGlobalNote&&segments.push(`global note: ${result.globalNote}.`);let details=unanswered.length>0?{...result,unanswered}:result;
|
|
43
|
+
return buildToolResult(`${ENVELOPE_PREFIX} ${segments.join(" ")} ${ENVELOPE_SUFFIX}`,details)}function buildUnansweredSegment(indexes,params){return`unanswered: ${indexes.map(i=>`"${params.questions[i]?.question}"`).join(", ")}.`}function buildAnswerSegment(a){let parts=[`"${a.question}"="${formatAnswerScalar(a,"envelope")}"`];return a.preview&&a.preview.length>0&&parts.push(`selected preview: ${a.preview}`),a.notes&&a.notes.length>0&&parts.push(`user notes: ${a.notes}`),`${parts.join(". ")}.`}function buildToolResult(text,details){
|
|
44
|
+
return{content:[{type:"text",text}],details}}var MAX_QUESTIONS=4,MIN_OPTIONS=2,MAX_OPTIONS=4,MAX_HEADER_LENGTH=16,MAX_LABEL_LENGTH=60;var RESERVED_LABELS=["Other",ROW_INTENT_META.other.label,ROW_INTENT_META.next.label],OptionSchema=typebox_exports.Object({label:typebox_exports.String({maxLength:MAX_LABEL_LENGTH,description:`MAX ${MAX_LABEL_LENGTH} CHARACTERS \u2014 hard limit, requests over the limit are rejected. The display text for this option that the user will see and select. Should be concise (1-5 words) and clearly describe the choice.`}),description:typebox_exports.String({description:"Explanation of what this option m\
|
|
45
|
+
eans or what will happen if chosen. Useful for providing context about trade-offs or implications."}),preview:typebox_exports.Optional(typebox_exports.String({description:"Optional preview content rendered when this option is focused. Use for mockups, code snippets, or visual comparisons that help users compare options. See the tool description for the expected content format."}))}),QuestionSchema=typebox_exports.Object({question:typebox_exports.String({description:'The complete question to ask \
|
|
46
|
+
the user. Should be clear, specific, and end with a question mark. Example: "Which library should we use for date formatting?" If multiSelect is true, phrase it accordingly, e.g. "Which features do you want to enable?"'}),header:typebox_exports.String({maxLength:MAX_HEADER_LENGTH,description:`MAX ${MAX_HEADER_LENGTH} CHARACTERS \u2014 hard limit, requests over the limit are rejected. Very short chip/tag shown next to the question. Examples: "Auth method", "Library", "Approach".`}),options:typebox_exports.
|
|
47
|
+
Array(OptionSchema,{minItems:MIN_OPTIONS,maxItems:MAX_OPTIONS,description:"The available choices for this question. Must have 2-4 options. Each option should be a distinct, mutually exclusive choice (unless multiSelect is enabled). The 'Type something.' row is appended automatically \u2014 do NOT author it."}),multiSelect:typebox_exports.Optional(typebox_exports.Boolean({default:!1,description:"Set to true to allow the user to select multiple options instead of just one. Use when choices are not\
|
|
48
|
+
mutually exclusive."}))}),QuestionsSchema=typebox_exports.Array(QuestionSchema,{minItems:1,maxItems:MAX_QUESTIONS,description:"Questions to ask the user (1-4 questions)"}),QuestionParamsSchema=typebox_exports.Object({questions:QuestionsSchema});function isQuestionnaireResult(value){if(!value||typeof value!="object")return!1;let v=value;return Array.isArray(v.answers)&&typeof v.cancelled=="boolean"}var ERROR_NO_QUESTIONS="Error: At least one question is required",ERROR_TOO_MANY_QUESTIONS=`Error: At most ${MAX_QUESTIONS} questions are allowed per invocation`,ERROR_DUPLICATE_QUESTION="Error: Question text must be unique within an invocation",ERROR_TOO_FEW_OPTIONS=`Error: Each question requires at least ${MIN_OPTIONS} options`,ERROR_RESERVED_LABEL=`Error: Option label is reserved (${RESERVED_LABELS.join(", ")})`,ERROR_DUPLICATE_OPTION_LABEL="Error: Option labels must be unique within a questi\
|
|
49
|
+
on",RESERVED_LABEL_SET=new Set(RESERVED_LABELS);function validateQuestionnaire(typed){if(typed.questions.length===0)return{ok:!1,error:"no_questions",message:ERROR_NO_QUESTIONS};if(typed.questions.length>MAX_QUESTIONS)return{ok:!1,error:"too_many_questions",message:ERROR_TOO_MANY_QUESTIONS};let seenQuestions=new Set;for(let q of typed.questions){if(seenQuestions.has(q.question))return{ok:!1,error:"duplicate_question",message:ERROR_DUPLICATE_QUESTION};seenQuestions.add(q.question)}for(let q of typed.
|
|
50
|
+
questions){if(q.options.length<MIN_OPTIONS)return{ok:!1,error:"empty_options",message:ERROR_TOO_FEW_OPTIONS};let seenLabels=new Set;for(let o of q.options){if(RESERVED_LABEL_SET.has(o.label))return{ok:!1,error:"reserved_label",message:ERROR_RESERVED_LABEL};if(seenLabels.has(o.label))return{ok:!1,error:"duplicate_option_label",message:ERROR_DUPLICATE_OPTION_LABEL};seenLabels.add(o.label)}}return{ok:!0}}var INDENT=" ",COLUMN_GAP=" ",RECOMMENDED_SUFFIX=/\s*\(Recommended\)$/;function recordedQuestions(args){let questions=prepareQuestionArguments(args??{})?.questions;return Array.isArray(questions)?questions.map(q=>{let fields=typeof q=="object"&&q!==null?q:{};return{header:typeof fields.header=="string"?fields.header:"",question:typeof fields.question=="string"?fields.question:void 0}}):[]}var WidthLines=class{layout;constructor(layout){this.layout=layout}render(width){return this.layout(width).
|
|
51
|
+
map(line=>truncateToWidth(line,width,"\u2026"))}invalidate(){}};function renderAskCall(args,theme){let headers=recordedQuestions(args).map(q=>q.header).filter(Boolean),title=theme.fg("toolTitle",theme.bold("Ask")),text=headers.length>0?`${title} ${theme.fg("accent",headers.join(" \xB7 "))}`:title;return new WidthLines(()=>[text])}function renderAskResult(result,args,theme,options){let details=isQuestionnaireResult(result.details)?result.details:void 0;if(options.isError||details?.error)return new WidthLines(
|
|
52
|
+
()=>[theme.fg("error",`\u2717 ${firstTextLine(result)}`)]);if(!details)return new WidthLines(()=>[theme.fg("success","\u2713")]);if(details.cancelled)return new WidthLines(()=>[theme.fg("dim",`\u2717 ${t("transcript.no_answer","no answer")}`)]);let questions=recordedQuestions(args);return new WidthLines(width=>questions.length>1?tableLines(details,questions,theme,options.expanded,width):singleLines(details,questions[0]?.question,theme,options.expanded,width))}function singleLines(details,questionText,theme,expanded,width){
|
|
53
|
+
let answer=details.answers[0],lines=hanging(`${theme.fg("success","\u2713")} `,answerText(answer,theme),width);return lines.push(...detailLines(answer,expanded?questionText:void 0,INDENT,theme,width)),[...lines,...globalNoteLines(details,theme,width)]}function tableLines(details,questions,theme,expanded,width){let headerWidth=Math.max(...questions.map(q=>visibleWidth(q.header))),answerIndent=" ".repeat(INDENT.length+headerWidth+COLUMN_GAP.length);return[...questions.flatMap((q,i)=>{let answer=details.
|
|
54
|
+
answers.find(a=>a.questionIndex===i),header=q.header+" ".repeat(headerWidth-visibleWidth(q.header));return[...hanging(`${INDENT}${theme.fg("muted",header)}${COLUMN_GAP}`,answerText(answer,theme),width),...detailLines(answer,expanded?q.question:void 0,answerIndent,theme,width)]}),...globalNoteLines(details,theme,width)]}function detailLines(answer,questionText,indent,theme,width){let lines=[];if(questionText&&lines.push(...hanging(indent,theme.fg("dim",questionText),width)),questionText&&answer?.
|
|
55
|
+
preview)for(let line of stripFenceMarkers(answer.preview.split(`
|
|
56
|
+
`)))lines.push(truncateToWidth(`${indent}${theme.fg("dim",`\u2502 ${line}`)}`,width,"\u2026"));return answer?.notes&&lines.push(...hanging(indent,theme.fg("dim",`\u270E ${answer.notes}`),width)),lines}function globalNoteLines(details,theme,width){return details.globalNote?hanging(INDENT,theme.fg("dim",`\u270E ${details.globalNote}`),width):[]}function answerText(answer,theme){if(!answer)return theme.fg("dim",t("transcript.not_answered","not answered"));let typed=answer.answer?`"${answer.answer}"`:
|
|
57
|
+
void 0,picks=answer.kind==="option"?[label(answer.answer??"")]:answer.kind==="custom"?[typed]:[...(answer.selected??[]).map(label),typed];return theme.fg("toolOutput",picks.filter(Boolean).join(", ")||NO_INPUT_PLACEHOLDER)}function label(text){return text.replace(RECOMMENDED_SUFFIX,"")}function hanging(prefix,text,width){let indent=visibleWidth(prefix);return wrapTextWithAnsi(text,Math.max(1,width-indent)).map((line,i)=>(i===0?prefix:" ".repeat(indent))+line)}function firstTextLine(result){return(result.
|
|
58
|
+
content.find(c=>c.type==="text")?.text??"").split(`
|
|
59
|
+
`)[0]??""}function emitAskUserPromptEvent(pi,params,toolCallId){let payload={toolCallId,questions:params.questions.map(q=>({question:q.question,header:q.header,multiSelect:q.multiSelect??!1,options:q.options.map(o=>({label:o.label,description:o.description,hasPreview:typeof o.preview=="string"&&o.preview.length>0}))}))};pi.events.emit(ASK_USER_PROMPT_EVENT,payload)}var HERDR_BLOCKED_EVENT="herdr:blocked";function blockedMessage(){return t("status.blocked","Waiting for your answer")}function emitAskUserBlockedEvent(pi,active,toolCallId){
|
|
60
|
+
let payload={active,toolCallId};pi.events.emit(ASK_USER_BLOCKED_EVENT,payload),pi.events.emit(HERDR_BLOCKED_EVENT,{active,label:active?blockedMessage():void 0})}function rejectWithoutUi(){return buildToolResult(ERROR_NO_UI,{answers:[],cancelled:!0,error:"no_ui"})}async function runRpcPath(pi,ui,typed,toolCallId){emitAskUserBlockedEvent(pi,!0,toolCallId);try{return emitTerminalAttention(),buildQuestionnaireResponse(await runRpcQuestionnaire(ui,typed),typed)}finally{emitAskUserBlockedEvent(pi,!1,toolCallId)}}
|
|
61
|
+
var ASK_USER_QUESTION_TOOL_NAME="ask_user_question",ERROR_NO_UI="Error: UI not available (running in non-interactive mode)",ERROR_NO_CUSTOM_UI="Error: this client cannot render the questionnaire (custom UI is unavailable, e.g. RPC/ACP hosts such as Zed or Paseo). The user never saw the questions \u2014 do NOT treat this as a decline. Ask the questions as plain chat text instead, without using this tool.",ERROR_SESSION_LOAD_FAILED="Error: the questionnaire UI failed to load \u2014 the host's installed\
|
|
62
|
+
dependencies were likely replaced or removed on disk while Pi was running (e.g. a package-manager install touched the store). The user never saw the questions \u2014 do NOT treat this as a decline. Ask the questions as plain chat text instead, and tell the user that restoring this tool requires repairing the install if needed and restarting Pi.",ERROR_STALE_MODULE_CACHE="Error: the questionnaire UI cannot load \u2014 the host's module cache went stale after an earlier failed load (typically dependen\
|
|
63
|
+
cies replaced on disk mid-session). This is unrecoverable within the current Pi process. The user never saw the questions \u2014 do NOT treat this as a decline. Ask the questions as plain chat text instead, and tell the user to restart Pi to restore this tool.",BEL="\x07";function emitTerminalAttention(){try{process.stdout.isTTY&&process.stdout.write(BEL)}catch{}}var PREWARM_DELAY_MS=2e3;async function loadQuestionnaireSession(){let mod;try{mod=await import("./questionnaire-session-XEVAK7JS.js")}catch(e){
|
|
64
|
+
let cause=e instanceof Error?e.message:String(e);return{ok:!1,error:"session_load_failed",message:`${ERROR_SESSION_LOAD_FAILED} (cause: ${cause})`}}if(typeof mod.QuestionnaireSession!="function"){let keys=JSON.stringify(Object.keys(mod));return{ok:!1,error:"stale_module_cache",message:`${ERROR_STALE_MODULE_CACHE} (resolved namespace keys: ${keys})`}}return{ok:!0,module:mod}}function registerCollapseKeyListener(ctx,collapseKey,sessionRef,overlayHandleRef){if(collapseKey===COLLAPSE_KEY_OFF||typeof ctx.
|
|
65
|
+
ui.onTerminalInput!="function")return;let hasAnnouncedHide=!1;return ctx.ui.onTerminalInput(data=>{let handle=overlayHandleRef.current;if(handle&&!(!handle.isHidden()&&!handle.isFocused())&&matchesKey(data,collapseKey))return isKeyRelease(data)||isKeyRepeat(data)?{consume:!0}:(sessionRef.current?.toggleCollapsedExternal(),handle.isHidden()&&!hasAnnouncedHide&&(hasAnnouncedHide=!0,ctx.ui.notify?.(`ask_user_question hidden \u2014 press ${formatKeySpecForDisplay(collapseKey)} to reopen`,"info")),{consume:!0})})}
|
|
66
|
+
function makeSessionFactory(config){let{ctx,typed,itemsByTab,collapseKey,notesKey,canReopenWhileHidden,presentation,sessionRef,open,Session}=config;return(tui,theme,keybindings,done)=>{if(!presentation.overlay&&mustYieldInlineSlot(tui))return done(YIELD_TO_OVERLAY),INERT_COMPONENT;if(open.settled)return done(open.settled),INERT_COMPONENT;open.attach(done);let session=new Session({tui,theme,params:typed,itemsByTab,done:result=>open.settle(result),keybindings,editInput:async value=>{try{let editorCommand=SettingsManager.
|
|
67
|
+
create(ctx.cwd,void 0,{projectTrusted:ctx.isProjectTrusted()}).getExternalEditorCommand();if(!editorCommand)throw new Error("No external editor command is configured");return await editWithExternalEditor(tui,editorCommand,value)}catch(error){let message=error instanceof Error?error.message:String(error);ctx.ui.notify(`${t("editor.failed","External editor failed")}: ${message}`,"error");return}},collapseKey,notesKey,canReopenWhileHidden,rowBudget:rowBudgetForHost(tui.terminal,presentation.rowBudget)});
|
|
68
|
+
return sessionRef.current=session,session.component}}var INERT_COMPONENT={render:()=>[],invalidate:()=>{},handleInput:()=>{}};async function mountQuestionnaire(config){let{ctx,collapseKey,presentation}=config,sessionRef={current:null},overlayHandleRef={current:void 0},removeOverlayInputListener=presentation.hideOnCollapse?registerCollapseKeyListener(ctx,collapseKey,sessionRef,overlayHandleRef):void 0,canReopenWhileHidden=removeOverlayInputListener!==void 0,blocked={kind:"question",message:blockedMessage()},
|
|
69
|
+
options=presentation.overlay?{overlay:!0,blocked,overlayOptions:{anchor:"bottom-center",width:"100%",maxHeight:"100%",margin:{left:0,right:0,bottom:0}},onHandle:handle=>{overlayHandleRef.current=handle,sessionRef.current?.setOverlayHandle(handle)}}:{overlay:!1,blocked};try{return await ctx.ui.custom(makeSessionFactory({...config,canReopenWhileHidden,sessionRef}),options)}finally{removeOverlayInputListener?.()}}async function resolveUndefinedResult(ctx,typed){return hasDialogUI(ctx.ui)?buildQuestionnaireResponse(
|
|
70
|
+
await runRpcQuestionnaire(ctx.ui,typed),typed):buildToolResult(ERROR_NO_CUSTOM_UI,{answers:[],cancelled:!0,error:"no_custom_ui"})}async function runTuiPath(pi,ctx,typed,open){let itemsByTab=typed.questions.map(q=>buildItemsForQuestion(q)),presentation;emitAskUserBlockedEvent(pi,!0,open.toolCallId);try{let sessionLoad=await loadQuestionnaireSession();if(open.settled)return buildQuestionnaireResponse(open.settled,typed);if(!sessionLoad.ok)return buildToolResult(sessionLoad.message,{answers:[],cancelled:!0,
|
|
71
|
+
error:sessionLoad.error});let{QuestionnaireSession}=sessionLoad.module,config=loadConfig(),collapseKey=resolveCollapseKey(config),notesKey=resolveNotesKey(config),mount=p=>Promise.race([mountQuestionnaire({ctx,typed,itemsByTab,collapseKey,notesKey,presentation:p,open,Session:QuestionnaireSession}),open.answeredEarly]);presentation=resolvePresentation(),emitTerminalAttention();let result=await mount(presentation);return result===YIELD_TO_OVERLAY&&(presentation.release?.(),presentation=STACKED_OVERLAY_PRESENTATION,
|
|
72
|
+
result=await mount(presentation)),result===void 0?(open.host="rpc",await resolveUndefinedResult(ctx,typed)):buildQuestionnaireResponse(result,typed)}finally{presentation?.release?.(),emitAskUserBlockedEvent(pi,!1,open.toolCallId)}}function prewarmSessionGraph(){setTimeout(()=>{loadQuestionnaireSession().catch(()=>{})},PREWARM_DELAY_MS).unref?.()}function buildItemsForQuestion(question){let items=question.options.map(o=>({kind:"option",label:o.label,description:o.description}));for(let kind of sentinelsToAppend(
|
|
73
|
+
question))items.push({kind,label:displayLabel(kind)});return items}var DEFAULT_PROMPT_SNIPPET=`Ask the user up to ${MAX_QUESTIONS} structured questions (${MIN_OPTIONS}-${MAX_OPTIONS} options each) when requirements are ambiguous`,DEFAULT_PROMPT_GUIDELINES=[`Use ask_user_question whenever the user's request is underspecified and you cannot proceed without concrete decisions \u2014 you can ask up to ${MAX_QUESTIONS} questions per invocation.`,`Each question MUST have ${MIN_OPTIONS}-${MAX_OPTIONS} \
|
|
74
|
+
options. Every option requires a concise label (1-5 words) and a description explaining what the choice means or its trade-offs. The user can additionally type a custom answer via the automatically appended "Type something." row on every question, or press Esc to abandon the questionnaire. Do NOT author "Other" or "Type something." labels yourself \u2014 reserved labels are rejected at runtime.`,'Set multiSelect: true when multiple answers are valid. Provide an options[].preview markdown string \
|
|
75
|
+
when an option benefits from richer side-by-side context (mockups, code snippets, diagrams, configs) \u2014 single-select only. The "Type something." row is appended to every question; in preview mode it expands to the full pane width while typing so the custom answer is not cramped into the narrow options column. If you recommend a specific option, make that the first option and append "(Recommended)" to its label.',"Do not stack multiple ask_user_question calls back-to-back \u2014 group all clarify\
|
|
76
|
+
ing questions into one invocation."],DEFAULT_TOOL_DESCRIPTION=`Ask the user one or more structured questions during execution. Use when you need to:
|
|
77
|
+
1. Gather user preferences or requirements
|
|
78
|
+
2. Clarify ambiguous instructions
|
|
79
|
+
3. Get decisions on implementation choices as you work
|
|
80
|
+
4. Offer choices to the user about what direction to take
|
|
81
|
+
|
|
82
|
+
Usage notes:
|
|
83
|
+
- Users can type a custom answer via the automatically appended "Type something." row on every question or press Esc to abandon the questionnaire. Do NOT author "Other" or "Type something." labels yourself \u2014 reserved labels are rejected at runtime.
|
|
84
|
+
- Use multiSelect: true when multiple answers are valid. The "Type something." row is available on every question, including when options carry a \`preview\`; in preview mode it expands to the full pane width while typing so the custom answer is not cramped into the narrow options column.
|
|
85
|
+
- If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label.
|
|
86
|
+
|
|
87
|
+
Preview feature:
|
|
88
|
+
Use the optional \`preview\` field on options when presenting concrete artifacts that users need to visually compare:
|
|
89
|
+
- ASCII mockups of UI layouts or components
|
|
90
|
+
- Code snippets showing different implementations
|
|
91
|
+
- Diagram variations
|
|
92
|
+
- Configuration examples
|
|
93
|
+
|
|
94
|
+
Preview content is rendered as markdown in a monospace box. Multi-line text with newlines is supported. When any option has a preview, the UI switches to a side-by-side layout with a vertical option list on the left and preview on the right. Do not use previews for simple preference questions where labels and descriptions suffice. Note: previews are only supported for single-select questions (not multiSelect).`;function registerAskUserQuestionTool(pi){let guidance=validateGuidanceFields(loadConfig().
|
|
95
|
+
guidance),answers=registerAnswerChannel(pi);pi.registerTool({name:ASK_USER_QUESTION_TOOL_NAME,label:"Ask User Question",exposure:"model-only",description:guidance.description??DEFAULT_TOOL_DESCRIPTION,promptSnippet:guidance.promptSnippet??DEFAULT_PROMPT_SNIPPET,promptGuidelines:guidance.promptGuidelines??DEFAULT_PROMPT_GUIDELINES,parameters:QuestionParamsSchema,prepareArguments:prepareQuestionArguments,renderCall:(args,theme)=>renderAskCall(args,theme),renderResult:(result,{expanded},theme,context)=>renderAskResult(
|
|
96
|
+
result,context?.args,theme,{expanded,isError:context?.isError??!1}),async execute(toolCallId,params,_signal,_onUpdate,ctx){let typed=normalizeQuestionParams(params);if(!ctx.hasUI)return rejectWithoutUi();let validation=validateQuestionnaire(typed);if(!validation.ok)return buildToolResult(validation.message,{answers:[],cancelled:!0,error:validation.error});let viaRpc=ctx.mode==="rpc"&&hasDialogUI(ctx.ui),open=answers.open(toolCallId,typed.questions,viaRpc?"rpc":"tui");try{return emitAskUserPromptEvent(
|
|
97
|
+
pi,typed,toolCallId),viaRpc?await runRpcPath(pi,ctx.ui,typed,toolCallId):await runTuiPath(pi,ctx,typed,open)}finally{answers.close(open)}}}),prewarmSessionGraph()}function reconcileAskUserQuestionTool(pi,ctx){let active=pi.getActiveTools(),hasTool=active.includes(ASK_USER_QUESTION_TOOL_NAME);!ctx.hasUI&&hasTool?pi.setActiveTools(active.filter(n=>n!==ASK_USER_QUESTION_TOOL_NAME)):ctx.hasUI&&!hasTool&&pi.setActiveTools([...active,ASK_USER_QUESTION_TOOL_NAME])}function registerAskUserQuestionReconciler(pi){pi.on("before_agent_start",(_event,ctx)=>reconcileAskUserQuestionTool(pi,ctx))}registerLocalesFromDir(I18N_NAMESPACE,pathToFileURL(join2(getHumainModuleAssetsDir("ask-user-question"),"ask","index.ts")).href,{label:"rpiv-ask-user-question"});function ask_default(pi){registerAskUserQuestionTool(pi),registerAskUserQuestionReconciler(pi)}export{ASK_USER_ANSWER_EVENT,ASK_USER_ANSWER_RESULT_EVENT,ASK_USER_BLOCKED_EVENT,ASK_USER_PROMPT_EVENT,ask_default as default};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
+
import{prepareResponsesPrompt,processResponsesStream}from"./chunk-MZYHSWHX.js";import{iterateOpenAIStream}from"./chunk-7PAXKU7M.js";import{clampOpenAIPromptCacheKey}from"./chunk-PRRNXB7S.js";import{AzureOpenAI}from"./chunk-2CYGUEQO.js";import"./chunk-FDRBTGFJ.js";import{cacheJsonSerialization}from"./chunk-ENBDASDN.js";import{buildBaseOptions,createGrammarToolInputProperties,resolveSamplingParams}from"./chunk-UTRUALFN.js";import"./chunk-L2ZPNLYD.js";
|
|
3
|
+
import{getServerRetryDelayMs,retryProviderRequest}from"./chunk-5C5K4EVJ.js";import{resolveAzureConfig,resolveDeploymentName}from"./chunk-CIA6V3BP.js";import{clampThinkingLevel,getDeclaredTools,resolveTranscript}from"./chunk-KJ3QRSSY.js";import"./chunk-YTVFIA3A.js";import"./chunk-PZ7NYBHJ.js";import{appendProviderHttpStatusDiagnostic,formatProviderError,normalizeProviderError}from"./chunk-CG43CMFH.js";import"./chunk-FACBDLFU.js";import"./chunk-LYZ37DJP.js";
|
|
4
|
+
import"./chunk-AQ4EXORZ.js";import{AssistantMessageEventStream}from"./chunk-MZRTVX7F.js";import{createRequestObserver,getIdentityHeaders,headersToRecord,observeFetch}from"./chunk-K5EFEIFP.js";import"./chunk-JXWJOIH4.js";var AZURE_TOOL_CALL_PROVIDERS=new Set(["openai","openai-codex","opencode","azure"]),OPENAI_RESPONSES_MIN_OUTPUT_TOKENS=16,stream=(model,context,options)=>{let stream2=new AssistantMessageEventStream,normalizedContext=resolveTranscript(context,model.compat?.supportsMidConvoSystemMessages);return(async()=>{let deploymentName=resolveDeploymentName(model,options),output={role:"assistant",content:[],api:"azure-openai-responses",provider:model.provider,model:model.id,usage:{usageIncomplete:!0,input:0,
|
|
5
|
+
output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()};try{let apiKey=options?.apiKey;if(!apiKey)throw new Error(`No API key for provider: ${model.provider}`);let observe=createRequestObserver(options,{api:model.api,provider:model.provider,model:model.id,operation:"chat"}),client=createClient(model,apiKey,options,observeFetch(options?.fetch,observe)),grammarToolInputProperties=createGrammarToolInputProperties(
|
|
6
|
+
getDeclaredTools(normalizedContext.messages),model.compat?.supportsOpenAIGrammarTools??!1),params=buildParams(model,normalizedContext,options,deploymentName,grammarToolInputProperties),onPayload=options?.onPayload,nextParams=await onPayload?.call(options,params,model);nextParams!==void 0&&(params=nextParams),onPayload||cacheJsonSerialization(params.input);let requestOptions={...options?.signal?{signal:options.signal}:{},...options?.timeoutMs!==void 0?{timeout:options.timeoutMs}:{},maxRetries:0},
|
|
7
|
+
{data:openaiStream,response}=await retryProviderRequest(()=>client.responses.create(params,requestOptions).withResponse(),{maxRetries:options?.maxRetries,maxRetryDelayMs:options?.maxRetryDelayMs,signal:options?.signal,onErrorResponse:errorResponse=>options?.onResponse?.(errorResponse,model)});if(await options?.onResponse?.({status:response.status,headers:headersToRecord(response.headers)},model),stream2.push({type:"start",partial:output}),await processResponsesStream(iterateOpenAIStream(openaiStream,
|
|
8
|
+
response,client),output,stream2,model,{signal:options?.signal,onProviderStreamEvent:options?.onProviderStreamEvent,grammarToolInputProperties}),options?.signal?.aborted)throw new Error("Request was aborted");if(output.stopReason==="pending")throw new Error("Azure OpenAI Responses stream ended without a stop reason");if(output.stopReason==="aborted"||output.stopReason==="error")throw new Error(output.errorMessage||"An unknown error occurred");stream2.push({type:"done",reason:output.stopReason,message:output}),
|
|
9
|
+
stream2.end()}catch(error){output.stopReason=options?.signal?.aborted?"aborted":"error";let normalizedError=normalizeProviderError(error);output.errorMessage=formatProviderError(normalizedError,"Azure OpenAI API error"),appendProviderHttpStatusDiagnostic(output,normalizedError);let retryAfterMs=getServerRetryDelayMs(error);retryAfterMs!==void 0&&(output.retryAfterMs=retryAfterMs),stream2.push({type:"error",reason:output.stopReason,error:output}),stream2.end()}})(),stream2},streamSimple=(model,context,options)=>{
|
|
10
|
+
let apiKey=options?.apiKey;if(!apiKey)throw new Error(`No API key for provider: ${model.provider}`);let base={...buildBaseOptions(model,context,options,apiKey),toolChoice:options?.toolChoice},clampedReasoning=options?.reasoning?clampThinkingLevel(model,options.reasoning):void 0;return stream(model,context,{...base,reasoningEffort:clampedReasoning==="off"?void 0:clampedReasoning})};function createClient(model,apiKey,options,fetch){let headers={...getIdentityHeaders(model,options?.identity),...model.
|
|
11
|
+
headers};options?.headers&&Object.assign(headers,options.headers);let{baseUrl,apiVersion}=resolveAzureConfig(model,options);return new AzureOpenAI({apiKey,apiVersion,dangerouslyAllowBrowser:!0,fetch,defaultHeaders:headers,baseURL:baseUrl})}function buildParams(model,context,options,deploymentName,grammarToolInputProperties=createGrammarToolInputProperties(getDeclaredTools(context.messages),model.compat?.supportsOpenAIGrammarTools??!1)){let supportsAdditionalTools=model.compat?.supportsAdditionalTools??
|
|
12
|
+
!1,supportsToolSearch=model.compat?.supportsToolSearch??!1,{input,requestTools}=prepareResponsesPrompt(model,context,AZURE_TOOL_CALL_PROVIDERS,{grammarToolInputProperties,supportsMidConvoSystemMessages:model.compat?.supportsMidConvoSystemMessages??!1,supportsAdditionalTools,supportsToolSearch,toolOptions:{supportsStrictMode:model.compat?.supportsStrictMode??!0,supportsOpenAIGrammarTools:model.compat?.supportsOpenAIGrammarTools??!1}}),params={model:deploymentName,input,stream:!0,prompt_cache_key:options?.
|
|
13
|
+
cacheRetention==="none"||model.compat?.promptCacheKeyMode==="disabled"?void 0:clampOpenAIPromptCacheKey(options?.sessionId),store:!1};options?.maxTokens&&(params.max_output_tokens=Math.max(options.maxTokens,OPENAI_RESPONSES_MIN_OUTPUT_TOKENS)),options?.temperature!==void 0&&(params.temperature=options?.temperature),requestTools.length>0&&(params.tools=requestTools),options?.toolChoice!==void 0&&(params.tool_choice=options.toolChoice);let reasoningEffort=options?.reasoningEffort??(options?.reasoningSummary?
|
|
14
|
+
"medium":void 0);if(model.reasoning)if(reasoningEffort){let effort=options?.reasoningEffort?model.thinkingLevelMap?.[options.reasoningEffort]??options.reasoningEffort:reasoningEffort;params.reasoning={effort,summary:options?.reasoningSummary||"auto"},params.include=["reasoning.encrypted_content"]}else model.thinkingLevelMap?.off!==null&&(params.reasoning={effort:model.thinkingLevelMap?.off??"none"});let samplingParams=resolveSamplingParams(model,reasoningEffort??"off",options?.samplingParams);return samplingParams&&
|
|
15
|
+
Object.assign(params,samplingParams),params}export{stream,streamSimple};
|