@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
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Nothing here runs until a tool calls `ctx.executeTool()`.
|
|
9
9
|
*/
|
|
10
|
-
import type {
|
|
10
|
+
import type { AgentToolCall, AgentToolCallOutcome, AgentToolResult, AgentToolUpdateCallback } from "@earendil-works/pi-agent-core";
|
|
11
11
|
import type { NestedToolCallRecord, NestedToolCalls, Usage } from "@earendil-works/pi-ai";
|
|
12
12
|
/**
|
|
13
13
|
* Limits of the nested-call record on a tool result: arguments
|
|
@@ -76,10 +76,11 @@ export type NestedToolExecutionEvent = {
|
|
|
76
76
|
parentToolCallId: string;
|
|
77
77
|
};
|
|
78
78
|
export interface NestedToolCallHost {
|
|
79
|
-
/**
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Whether a nested call of the named tool runs exclusively: every call when the agent executes tool calls
|
|
81
|
+
* sequentially, else calls of tools that must not run concurrently with other calls.
|
|
82
|
+
*/
|
|
83
|
+
isExclusive(name: string): boolean;
|
|
83
84
|
/** Run the call through the tool pipeline, with hooks that report `parentToolCallId`. */
|
|
84
85
|
runToolCall(toolCall: AgentToolCall, parentToolCallId: string, signal: AbortSignal | undefined, onUpdate: (partialResult: AgentToolResult<unknown>) => Promise<void>): Promise<AgentToolCallOutcome>;
|
|
85
86
|
emit(event: NestedToolExecutionEvent): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nested-tool-calls.d.ts","sourceRoot":"","sources":["../../src/core/nested-tool-calls.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACX,
|
|
1
|
+
{"version":3,"file":"nested-tool-calls.d.ts","sourceRoot":"","sources":["../../src/core/nested-tool-calls.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACX,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,MAA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ACG,OAAO,CACZ,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,OAAO,GAAE,qBAA0B,GACjC,OAAO,CAAC,oBAAoB,CAAC,CAkE/B;IAED,iFAAiF;IACjF,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAK5D;IAED,KAAK,IAAI,IAAI,CAEZ;CACD"}
|
|
@@ -115,9 +115,7 @@ export class NestedToolCallRunner {
|
|
|
115
115
|
args: toolCall.arguments,
|
|
116
116
|
parentToolCallId: callerId,
|
|
117
117
|
});
|
|
118
|
-
const exclusive = !scope.holdsQueue &&
|
|
119
|
-
(this.host.isSequential() ||
|
|
120
|
-
this.host.getTools().find((tool) => tool.name === name)?.executionMode === "sequential");
|
|
118
|
+
const exclusive = !scope.holdsQueue && this.host.isExclusive(name);
|
|
121
119
|
let release;
|
|
122
120
|
if (exclusive) {
|
|
123
121
|
const previous = this.queueTail;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nested-tool-calls.js","sourceRoot":"","sources":["../../src/core/nested-tool-calls.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,QAAQ,EAAE,GAAG;IACb,uBAAuB,EAAE,CAAC,GAAG,IAAI;IACjC,qBAAqB,EAAE,EAAE,GAAG,IAAI;IAChC,aAAa,EAAE,GAAG;CACT,CAAC;AAEX,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAUlC;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IACb,KAAK,GAA2B,EAAE,CAAC;IACnC,SAAS,GAAG,IAAI,GAAG,EAAgC,CAAC;IAC7D,QAAQ,GAAG,IAAI,CAAC;IAChB,aAAa,GAAG,CAAC,CAAC;IAC1B,oFAAoF;IAC5E,K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AAE,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IAC/E,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;CACD","sourcesContent":["/**\n * Tool calls that a tool makes while it runs (`ctx.executeTool()`), for example from codemode\n * scripts. The agent loop does not know about them: the session runs each one through the agent's\n * tool pipeline (`runToolCall`) with its own hooks, emits `tool_execution_*` events with\n * `parentToolCallId`, and records the calls and their usage on the model-issued call's tool result\n * message.\n *\n * Nothing here runs until a tool calls `ctx.executeTool()`.\n */\n\nimport type {\n\tAgentTool,\n\tAgentToolCall,\n\tAgentToolCallOutcome,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n} from \"@earendil-works/pi-agent-core\";\nimport type { JsonObject, NestedToolCallRecord, NestedToolCalls, TextContent, Usage } from \"@earendil-works/pi-ai\";\nimport { combineUsage } from \"./usage-totals.ts\";\n\n/**\n * Limits of the nested-call record on a tool result: arguments\n * over the per-call or total size are omitted, calls beyond the count are dropped, and the record\n * is marked incomplete when any of that happens.\n */\nexport const NESTED_CALL_LIMITS = {\n\tmaxCalls: 256,\n\tmaxArgumentBytesPerCall: 8 * 1024,\n\tmaxArgumentBytesTotal: 32 * 1024,\n\tmaxErrorChars: 500,\n} as const;\n\nconst encoder = new TextEncoder();\n\n/** What the nested calls of one model-issued tool call leave on its tool result message. */\nexport interface NestedCallSummary {\n\t/** Becomes `nestedCalls`. Undefined when no nested call was made. */\n\tcalls: NestedToolCalls | undefined;\n\t/** Summed `usage` of the nested results, added to the message's `usage`. */\n\tusage: Usage | undefined;\n}\n\n/**\n * Collects the nested calls of one model-issued tool call, including calls made by nested tools.\n * The snapshot becomes `nestedCalls` on the tool result message.\n */\nexport class NestedCallRecorder {\n\tprivate readonly calls: NestedToolCallRecord[] = [];\n\tprivate readonly startedAt = new Map<NestedToolCallRecord, number>();\n\tprivate complete = true;\n\tprivate argumentBytes = 0;\n\t/** Summed usage of every nested result, including calls dropped from the record. */\n\tprivate usage: Usage | undefined;\n\n\t/** Record a call as it starts. Returns undefined when the call is dropped. */\n\tstart(toolCall: AgentToolCall): NestedToolCallRecord | undefined {\n\t\tif (this.calls.length >= NESTED_CALL_LIMITS.maxCalls) {\n\t\t\tthis.complete = false;\n\t\t\treturn undefined;\n\t\t}\n\t\tconst record: NestedToolCallRecord = { id: toolCall.id, name: toolCall.name, status: \"unfinished\" };\n\t\tconst json = JSON.stringify(toolCall.arguments ?? {});\n\t\tconst bytes = encoder.encode(json).length;\n\t\tif (\n\t\t\tbytes > NESTED_CALL_LIMITS.maxArgumentBytesPerCall ||\n\t\t\tthis.argumentBytes + bytes > NESTED_CALL_LIMITS.maxArgumentBytesTotal\n\t\t) {\n\t\t\trecord.argumentsBytes = bytes;\n\t\t\tthis.complete = false;\n\t\t} else {\n\t\t\trecord.arguments = JSON.parse(json) as JsonObject;\n\t\t\tthis.argumentBytes += bytes;\n\t\t}\n\t\tthis.calls.push(record);\n\t\tthis.startedAt.set(record, performance.now());\n\t\treturn record;\n\t}\n\n\tfinish(record: NestedToolCallRecord | undefined, isError: boolean, errorText: string): void {\n\t\tif (!record) return;\n\t\trecord.status = isError ? \"error\" : \"ok\";\n\t\trecord.durationMs = Math.round(performance.now() - (this.startedAt.get(record) ?? performance.now()));\n\t\tthis.startedAt.delete(record);\n\t\tif (isError && errorText) record.error = errorText.slice(0, NESTED_CALL_LIMITS.maxErrorChars);\n\t}\n\n\taddUsage(usage: Usage): void {\n\t\tthis.usage = this.usage ? combineUsage(this.usage, usage) : usage;\n\t}\n\n\tget totalUsage(): Usage | undefined {\n\t\treturn this.usage;\n\t}\n\n\t/** Copy of the record so far, or undefined when no nested call was made. */\n\tsnapshot(): NestedToolCalls | undefined {\n\t\tif (this.calls.length === 0 && this.complete) return undefined;\n\t\tconst calls = this.calls.map((call) => ({ ...call }));\n\t\treturn { calls, complete: this.complete && calls.every((call) => call.status !== \"unfinished\") };\n\t}\n}\n\nexport interface NestedToolCallOptions {\n\t/** Defaults to the calling tool's signal. */\n\tsignal?: AbortSignal;\n\t/** Receives partial results of the nested tool, in addition to `tool_execution_update` events. */\n\tonUpdate?: AgentToolUpdateCallback;\n}\n\n/** `tool_execution_*` events of nested calls. */\nexport type NestedToolExecutionEvent =\n\t| { type: \"tool_execution_start\"; toolCallId: string; toolName: string; args: unknown; parentToolCallId: string }\n\t| {\n\t\t\ttype: \"tool_execution_update\";\n\t\t\ttoolCallId: string;\n\t\t\ttoolName: string;\n\t\t\targs: unknown;\n\t\t\tpartialResult: AgentToolResult<unknown>;\n\t\t\tparentToolCallId: string;\n\t }\n\t| {\n\t\t\ttype: \"tool_execution_end\";\n\t\t\ttoolCallId: string;\n\t\t\ttoolName: string;\n\t\t\tresult: AgentToolResult<unknown>;\n\t\t\tisError: boolean;\n\t\t\tdurationMs?: number;\n\t\t\tparentToolCallId: string;\n\t };\n\nexport interface NestedToolCallHost {\n\t/** Tools nested calls resolve against. */\n\tgetTools(): readonly AgentTool[];\n\t/** Whether every nested call runs exclusively, as when the agent executes tool calls sequentially. */\n\tisSequential(): boolean;\n\t/** Run the call through the tool pipeline, with hooks that report `parentToolCallId`. */\n\trunToolCall(\n\t\ttoolCall: AgentToolCall,\n\t\tparentToolCallId: string,\n\t\tsignal: AbortSignal | undefined,\n\t\tonUpdate: (partialResult: AgentToolResult<unknown>) => Promise<void>,\n\t): Promise<AgentToolCallOutcome>;\n\temit(event: NestedToolExecutionEvent): Promise<void>;\n}\n\n/** Calls below one model-issued call share its recorder. */\ninterface CallScope {\n\trecorder: NestedCallRecorder;\n\tnextId: number;\n\t/** Set inside a call that holds the exclusive queue, so its own nested calls do not wait on it. */\n\tholdsQueue: boolean;\n}\n\nfunction textOf(result: AgentToolResult<unknown>): string {\n\treturn (result.content ?? [])\n\t\t.filter((block): block is TextContent => block.type === \"text\")\n\t\t.map((block) => block.text)\n\t\t.join(\"\\n\");\n}\n\nexport class NestedToolCallRunner {\n\tprivate readonly host: NestedToolCallHost;\n\t/** Scopes by the id of the calling tool call. */\n\tprivate readonly scopes = new Map<string, CallScope>();\n\t/** Serializes nested calls that must not run concurrently. */\n\tprivate queueTail: Promise<void> = Promise.resolve();\n\n\tconstructor(host: NestedToolCallHost) {\n\t\tthis.host = host;\n\t}\n\n\t/**\n\t * Run `name` on behalf of the call `callerId`. The nested call gets the id `<callerId>/<n>`.\n\t * Never rejects for tool failures: they come back as `isError: true`.\n\t */\n\tasync execute(\n\t\tcallerId: string,\n\t\tname: string,\n\t\targs: unknown,\n\t\toptions: NestedToolCallOptions = {},\n\t): Promise<AgentToolCallOutcome> {\n\t\tlet scope = this.scopes.get(callerId);\n\t\tif (!scope) {\n\t\t\tscope = { recorder: new NestedCallRecorder(), nextId: 1, holdsQueue: false };\n\t\t\tthis.scopes.set(callerId, scope);\n\t\t}\n\t\tconst toolCall: AgentToolCall = {\n\t\t\ttype: \"toolCall\",\n\t\t\tid: `${callerId}/${scope.nextId++}`,\n\t\t\tname,\n\t\t\targuments: (args ?? {}) as AgentToolCall[\"arguments\"],\n\t\t};\n\t\tconst record = scope.recorder.start(toolCall);\n\t\tawait this.host.emit({\n\t\t\ttype: \"tool_execution_start\",\n\t\t\ttoolCallId: toolCall.id,\n\t\t\ttoolName: name,\n\t\t\targs: toolCall.arguments,\n\t\t\tparentToolCallId: callerId,\n\t\t});\n\n\t\tconst exclusive =\n\t\t\t!scope.holdsQueue &&\n\t\t\t(this.host.isSequential() ||\n\t\t\t\tthis.host.getTools().find((tool) => tool.name === name)?.executionMode === \"sequential\");\n\t\tlet release: (() => void) | undefined;\n\t\tif (exclusive) {\n\t\t\tconst previous = this.queueTail;\n\t\t\tthis.queueTail = new Promise((resolve) => {\n\t\t\t\trelease = resolve;\n\t\t\t});\n\t\t\tawait previous;\n\t\t}\n\t\tthis.scopes.set(toolCall.id, {\n\t\t\trecorder: scope.recorder,\n\t\t\tnextId: 1,\n\t\t\tholdsQueue: scope.holdsQueue || exclusive,\n\t\t});\n\t\tlet outcome: AgentToolCallOutcome;\n\t\ttry {\n\t\t\toutcome = await this.host.runToolCall(toolCall, callerId, options.signal, async (partialResult) => {\n\t\t\t\toptions.onUpdate?.(partialResult);\n\t\t\t\tawait this.host.emit({\n\t\t\t\t\ttype: \"tool_execution_update\",\n\t\t\t\t\ttoolCallId: toolCall.id,\n\t\t\t\t\ttoolName: name,\n\t\t\t\t\targs: toolCall.arguments,\n\t\t\t\t\tpartialResult,\n\t\t\t\t\tparentToolCallId: callerId,\n\t\t\t\t});\n\t\t\t});\n\t\t} finally {\n\t\t\tthis.scopes.delete(toolCall.id);\n\t\t\trelease?.();\n\t\t}\n\n\t\tscope.recorder.finish(record, outcome.isError, textOf(outcome.result));\n\t\t// Nested results are not persisted, so their usage is only counted through the recorder.\n\t\tif (outcome.result.usage) scope.recorder.addUsage(outcome.result.usage);\n\t\tawait this.host.emit({\n\t\t\ttype: \"tool_execution_end\",\n\t\t\ttoolCallId: toolCall.id,\n\t\t\ttoolName: name,\n\t\t\tresult: outcome.result,\n\t\t\tisError: outcome.isError,\n\t\t\t...(outcome.durationMs === undefined ? {} : { durationMs: outcome.durationMs }),\n\t\t\tparentToolCallId: callerId,\n\t\t});\n\t\treturn outcome;\n\t}\n\n\t/** Remove and return the record of the nested calls a model-issued call made. */\n\ttakeRecord(toolCallId: string): NestedCallSummary | undefined {\n\t\tconst scope = this.scopes.get(toolCallId);\n\t\tthis.scopes.delete(toolCallId);\n\t\tif (!scope) return undefined;\n\t\treturn { calls: scope.recorder.snapshot(), usage: scope.recorder.totalUsage };\n\t}\n\n\tclear(): void {\n\t\tthis.scopes.clear();\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nested-tool-calls.js","sourceRoot":"","sources":["../../src/core/nested-tool-calls.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,QAAQ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G,CAAC,UAAU,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC/B,IAAI,CAAC,KAAK;YAAE,OAAO,SAAS,CAAC;QAC7B,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IAC/E,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;CACD","sourcesContent":["/**\n * Tool calls that a tool makes while it runs (`ctx.executeTool()`), for example from codemode\n * scripts. The agent loop does not know about them: the session runs each one through the agent's\n * tool pipeline (`runToolCall`) with its own hooks, emits `tool_execution_*` events with\n * `parentToolCallId`, and records the calls and their usage on the model-issued call's tool result\n * message.\n *\n * Nothing here runs until a tool calls `ctx.executeTool()`.\n */\n\nimport type {\n\tAgentToolCall,\n\tAgentToolCallOutcome,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n} from \"@earendil-works/pi-agent-core\";\nimport type { JsonObject, NestedToolCallRecord, NestedToolCalls, TextContent, Usage } from \"@earendil-works/pi-ai\";\nimport { combineUsage } from \"./usage-totals.ts\";\n\n/**\n * Limits of the nested-call record on a tool result: arguments\n * over the per-call or total size are omitted, calls beyond the count are dropped, and the record\n * is marked incomplete when any of that happens.\n */\nexport const NESTED_CALL_LIMITS = {\n\tmaxCalls: 256,\n\tmaxArgumentBytesPerCall: 8 * 1024,\n\tmaxArgumentBytesTotal: 32 * 1024,\n\tmaxErrorChars: 500,\n} as const;\n\nconst encoder = new TextEncoder();\n\n/** What the nested calls of one model-issued tool call leave on its tool result message. */\nexport interface NestedCallSummary {\n\t/** Becomes `nestedCalls`. Undefined when no nested call was made. */\n\tcalls: NestedToolCalls | undefined;\n\t/** Summed `usage` of the nested results, added to the message's `usage`. */\n\tusage: Usage | undefined;\n}\n\n/**\n * Collects the nested calls of one model-issued tool call, including calls made by nested tools.\n * The snapshot becomes `nestedCalls` on the tool result message.\n */\nexport class NestedCallRecorder {\n\tprivate readonly calls: NestedToolCallRecord[] = [];\n\tprivate readonly startedAt = new Map<NestedToolCallRecord, number>();\n\tprivate complete = true;\n\tprivate argumentBytes = 0;\n\t/** Summed usage of every nested result, including calls dropped from the record. */\n\tprivate usage: Usage | undefined;\n\n\t/** Record a call as it starts. Returns undefined when the call is dropped. */\n\tstart(toolCall: AgentToolCall): NestedToolCallRecord | undefined {\n\t\tif (this.calls.length >= NESTED_CALL_LIMITS.maxCalls) {\n\t\t\tthis.complete = false;\n\t\t\treturn undefined;\n\t\t}\n\t\tconst record: NestedToolCallRecord = { id: toolCall.id, name: toolCall.name, status: \"unfinished\" };\n\t\tconst json = JSON.stringify(toolCall.arguments ?? {});\n\t\tconst bytes = encoder.encode(json).length;\n\t\tif (\n\t\t\tbytes > NESTED_CALL_LIMITS.maxArgumentBytesPerCall ||\n\t\t\tthis.argumentBytes + bytes > NESTED_CALL_LIMITS.maxArgumentBytesTotal\n\t\t) {\n\t\t\trecord.argumentsBytes = bytes;\n\t\t\tthis.complete = false;\n\t\t} else {\n\t\t\trecord.arguments = JSON.parse(json) as JsonObject;\n\t\t\tthis.argumentBytes += bytes;\n\t\t}\n\t\tthis.calls.push(record);\n\t\tthis.startedAt.set(record, performance.now());\n\t\treturn record;\n\t}\n\n\tfinish(record: NestedToolCallRecord | undefined, isError: boolean, errorText: string): void {\n\t\tif (!record) return;\n\t\trecord.status = isError ? \"error\" : \"ok\";\n\t\trecord.durationMs = Math.round(performance.now() - (this.startedAt.get(record) ?? performance.now()));\n\t\tthis.startedAt.delete(record);\n\t\tif (isError && errorText) record.error = errorText.slice(0, NESTED_CALL_LIMITS.maxErrorChars);\n\t}\n\n\taddUsage(usage: Usage): void {\n\t\tthis.usage = this.usage ? combineUsage(this.usage, usage) : usage;\n\t}\n\n\tget totalUsage(): Usage | undefined {\n\t\treturn this.usage;\n\t}\n\n\t/** Copy of the record so far, or undefined when no nested call was made. */\n\tsnapshot(): NestedToolCalls | undefined {\n\t\tif (this.calls.length === 0 && this.complete) return undefined;\n\t\tconst calls = this.calls.map((call) => ({ ...call }));\n\t\treturn { calls, complete: this.complete && calls.every((call) => call.status !== \"unfinished\") };\n\t}\n}\n\nexport interface NestedToolCallOptions {\n\t/** Defaults to the calling tool's signal. */\n\tsignal?: AbortSignal;\n\t/** Receives partial results of the nested tool, in addition to `tool_execution_update` events. */\n\tonUpdate?: AgentToolUpdateCallback;\n}\n\n/** `tool_execution_*` events of nested calls. */\nexport type NestedToolExecutionEvent =\n\t| { type: \"tool_execution_start\"; toolCallId: string; toolName: string; args: unknown; parentToolCallId: string }\n\t| {\n\t\t\ttype: \"tool_execution_update\";\n\t\t\ttoolCallId: string;\n\t\t\ttoolName: string;\n\t\t\targs: unknown;\n\t\t\tpartialResult: AgentToolResult<unknown>;\n\t\t\tparentToolCallId: string;\n\t }\n\t| {\n\t\t\ttype: \"tool_execution_end\";\n\t\t\ttoolCallId: string;\n\t\t\ttoolName: string;\n\t\t\tresult: AgentToolResult<unknown>;\n\t\t\tisError: boolean;\n\t\t\tdurationMs?: number;\n\t\t\tparentToolCallId: string;\n\t };\n\nexport interface NestedToolCallHost {\n\t/**\n\t * Whether a nested call of the named tool runs exclusively: every call when the agent executes tool calls\n\t * sequentially, else calls of tools that must not run concurrently with other calls.\n\t */\n\tisExclusive(name: string): boolean;\n\t/** Run the call through the tool pipeline, with hooks that report `parentToolCallId`. */\n\trunToolCall(\n\t\ttoolCall: AgentToolCall,\n\t\tparentToolCallId: string,\n\t\tsignal: AbortSignal | undefined,\n\t\tonUpdate: (partialResult: AgentToolResult<unknown>) => Promise<void>,\n\t): Promise<AgentToolCallOutcome>;\n\temit(event: NestedToolExecutionEvent): Promise<void>;\n}\n\n/** Calls below one model-issued call share its recorder. */\ninterface CallScope {\n\trecorder: NestedCallRecorder;\n\tnextId: number;\n\t/** Set inside a call that holds the exclusive queue, so its own nested calls do not wait on it. */\n\tholdsQueue: boolean;\n}\n\nfunction textOf(result: AgentToolResult<unknown>): string {\n\treturn (result.content ?? [])\n\t\t.filter((block): block is TextContent => block.type === \"text\")\n\t\t.map((block) => block.text)\n\t\t.join(\"\\n\");\n}\n\nexport class NestedToolCallRunner {\n\tprivate readonly host: NestedToolCallHost;\n\t/** Scopes by the id of the calling tool call. */\n\tprivate readonly scopes = new Map<string, CallScope>();\n\t/** Serializes nested calls that must not run concurrently. */\n\tprivate queueTail: Promise<void> = Promise.resolve();\n\n\tconstructor(host: NestedToolCallHost) {\n\t\tthis.host = host;\n\t}\n\n\t/**\n\t * Run `name` on behalf of the call `callerId`. The nested call gets the id `<callerId>/<n>`.\n\t * Never rejects for tool failures: they come back as `isError: true`.\n\t */\n\tasync execute(\n\t\tcallerId: string,\n\t\tname: string,\n\t\targs: unknown,\n\t\toptions: NestedToolCallOptions = {},\n\t): Promise<AgentToolCallOutcome> {\n\t\tlet scope = this.scopes.get(callerId);\n\t\tif (!scope) {\n\t\t\tscope = { recorder: new NestedCallRecorder(), nextId: 1, holdsQueue: false };\n\t\t\tthis.scopes.set(callerId, scope);\n\t\t}\n\t\tconst toolCall: AgentToolCall = {\n\t\t\ttype: \"toolCall\",\n\t\t\tid: `${callerId}/${scope.nextId++}`,\n\t\t\tname,\n\t\t\targuments: (args ?? {}) as AgentToolCall[\"arguments\"],\n\t\t};\n\t\tconst record = scope.recorder.start(toolCall);\n\t\tawait this.host.emit({\n\t\t\ttype: \"tool_execution_start\",\n\t\t\ttoolCallId: toolCall.id,\n\t\t\ttoolName: name,\n\t\t\targs: toolCall.arguments,\n\t\t\tparentToolCallId: callerId,\n\t\t});\n\n\t\tconst exclusive = !scope.holdsQueue && this.host.isExclusive(name);\n\t\tlet release: (() => void) | undefined;\n\t\tif (exclusive) {\n\t\t\tconst previous = this.queueTail;\n\t\t\tthis.queueTail = new Promise((resolve) => {\n\t\t\t\trelease = resolve;\n\t\t\t});\n\t\t\tawait previous;\n\t\t}\n\t\tthis.scopes.set(toolCall.id, {\n\t\t\trecorder: scope.recorder,\n\t\t\tnextId: 1,\n\t\t\tholdsQueue: scope.holdsQueue || exclusive,\n\t\t});\n\t\tlet outcome: AgentToolCallOutcome;\n\t\ttry {\n\t\t\toutcome = await this.host.runToolCall(toolCall, callerId, options.signal, async (partialResult) => {\n\t\t\t\toptions.onUpdate?.(partialResult);\n\t\t\t\tawait this.host.emit({\n\t\t\t\t\ttype: \"tool_execution_update\",\n\t\t\t\t\ttoolCallId: toolCall.id,\n\t\t\t\t\ttoolName: name,\n\t\t\t\t\targs: toolCall.arguments,\n\t\t\t\t\tpartialResult,\n\t\t\t\t\tparentToolCallId: callerId,\n\t\t\t\t});\n\t\t\t});\n\t\t} finally {\n\t\t\tthis.scopes.delete(toolCall.id);\n\t\t\trelease?.();\n\t\t}\n\n\t\tscope.recorder.finish(record, outcome.isError, textOf(outcome.result));\n\t\t// Nested results are not persisted, so their usage is only counted through the recorder.\n\t\tif (outcome.result.usage) scope.recorder.addUsage(outcome.result.usage);\n\t\tawait this.host.emit({\n\t\t\ttype: \"tool_execution_end\",\n\t\t\ttoolCallId: toolCall.id,\n\t\t\ttoolName: name,\n\t\t\tresult: outcome.result,\n\t\t\tisError: outcome.isError,\n\t\t\t...(outcome.durationMs === undefined ? {} : { durationMs: outcome.durationMs }),\n\t\t\tparentToolCallId: callerId,\n\t\t});\n\t\treturn outcome;\n\t}\n\n\t/** Remove and return the record of the nested calls a model-issued call made. */\n\ttakeRecord(toolCallId: string): NestedCallSummary | undefined {\n\t\tconst scope = this.scopes.get(toolCallId);\n\t\tthis.scopes.delete(toolCallId);\n\t\tif (!scope) return undefined;\n\t\treturn { calls: scope.recorder.snapshot(), usage: scope.recorder.totalUsage };\n\t}\n\n\tclear(): void {\n\t\tthis.scopes.clear();\n\t}\n}\n"]}
|
|
@@ -262,7 +262,7 @@ function createBackend(namespace, options) {
|
|
|
262
262
|
throw new OsSecretStoreError("macOS Keychain is unavailable: /usr/bin/security was not found.");
|
|
263
263
|
}
|
|
264
264
|
if (platform === "linux") {
|
|
265
|
-
if (isWSL(env)) {
|
|
265
|
+
if (isWSL(platform, env)) {
|
|
266
266
|
// Keep every operation on one backend, even when WSL also has a Linux keyring.
|
|
267
267
|
const powershell = findExecutable("powershell.exe");
|
|
268
268
|
if (powershell)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"os-secret-store.js","sourceRoot":"","sources":["../../src/core/os-secret-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAsB,YAAY,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAUnH,MAAM,OAAO,kBAAmB,SAAQ,mBAAmB;IAC1D,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IAClC,CAAC;CACD;AAgBD,MAAM,eAAe,GAAG,0BAA0B,CAAC;AACnD,qFAAqF;AACrF,MAAM,iBAAiB,GAAG,oCAAoC,CAAC;AAC/D,MAAM,uBAAuB,GAAG,EAAE,CAAC;AACnC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B,SAAS,aAAa,CAAC,OAAe;IACrC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,kBAAkB,CAAC,iCAAiC,CAAC,CAAC;IACjE,CAAC;AACF,CAAC;AAED,KAAK,UAAU,GAAG,CACjB,MAAqB,EACrB,OAAe,EACf,IAAuB,EACvB,KAAc,EACd,MAAoB,EACpB,cAAc,GAAG,4CAA4C;IAE7D,IAAI,CAAC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B,CAC3B,mFAAmF,CACnF,CAAC;QACH,CAAC;QACD,OAAO,IAAI,sBAAsB,CAChC,MAAM,EACN,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,gBAAgB,CAAC,EACjF,SAAS,CAAC,OAAO,CACjB,CAAC;IACH,CAAC;IACD,MAAM,IAAI,kBAAkB,CAC3B,GAAG,SAAS,CAAC,KAAK,gCAAgC,QAAQ,oFAAoF,CAC9I,CAAC;AACH,CAAC","sourcesContent":["import { randomBytes, randomUUID } from \"node:crypto\";\nimport { win32 } from \"node:path\";\nimport { isWSL } from \"../utils/wsl.ts\";\nimport { SafeCredentialError } from \"./safe-credential-error.ts\";\nimport { type CommandRunner, spawnCommand, systemTraceCredentialProbes } from \"./trace-client/credential-store.ts\";\n\nexport interface OsSecretStore {\n\t/** Verifies write/read/delete using a disposable random key, never an account credential. */\n\tprobe(signal?: AbortSignal): Promise<void>;\n\tget(account: string, signal?: AbortSignal): Promise<string | undefined>;\n\tset(account: string, secret: string, signal?: AbortSignal): Promise<void>;\n\tdelete(account: string, signal?: AbortSignal): Promise<void>;\n}\n\nexport class OsSecretStoreError extends SafeCredentialError {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"OsSecretStoreError\";\n\t}\n}\n\nexport interface OsSecretStoreOptions {\n\tplatform?: NodeJS.Platform;\n\trun?: CommandRunner;\n\tenv?: NodeJS.ProcessEnv;\n\tfindExecutable?: (name: string) => string | undefined;\n}\n\ntype SecretBackend = Pick<OsSecretStore, \"get\" | \"set\" | \"delete\">;\n\nexport interface OsSecretNamespace {\n\tservice: string;\n\tlabel: string;\n}\n\nconst ACCOUNT_PATTERN = /^[A-Za-z0-9:._-]{1,128}$/;\n/** Secrets embedded in a double-quoted `security -i` line must not need escaping. */\nconst MACOS_SAFE_SECRET = /^[\\x21\\x23-\\x5b\\x5d-\\x7e]{1,3000}$/;\nconst KEYCHAIN_ITEM_NOT_FOUND = 44;\nconst WINDOWS_NOT_FOUND = 3;\n\nfunction assertAccount(account: string): void {\n\tif (!ACCOUNT_PATTERN.test(account)) {\n\t\tthrow new OsSecretStoreError(\"Invalid credential account name\");\n\t}\n}\n\nasync function run(\n\trunner: CommandRunner,\n\tcommand: string,\n\targs: readonly string[],\n\tstdin?: string,\n\tsignal?: AbortSignal,\n\tfailureMessage = \"Could not run the credential store command\",\n) {\n\ttry {\n\t\tsignal?.throwIfAborted();\n\t\tconst result = await runner(command, args, stdin, signal);\n\t\tsignal?.throwIfAborted();\n\t\treturn result;\n\t} catch {\n\t\tif (signal?.aborted) throw new DOMException(\"Credential operation aborted.\", \"AbortError\");\n\t\tthrow new OsSecretStoreError(failureMessage);\n\t}\n}\n\nclass KeychainSecretStore implements SecretBackend {\n\tprivate readonly runner: CommandRunner;\n\tprivate readonly securityPath: string;\n\tprivate readonly service: string;\n\n\tconstructor(runner: CommandRunner, securityPath: string, service: string) {\n\t\tthis.runner = runner;\n\t\tthis.securityPath = securityPath;\n\t\tthis.service = service;\n\t}\n\n\tasync get(account: string, signal?: AbortSignal): Promise<string | undefined> {\n\t\tassertAccount(account);\n\t\tconst result = await run(\n\t\t\tthis.runner,\n\t\t\tthis.securityPath,\n\t\t\t[\"find-generic-password\", \"-s\", this.service, \"-a\", account, \"-w\"],\n\t\t\tundefined,\n\t\t\tsignal,\n\t\t);\n\t\tif (result.code === KEYCHAIN_ITEM_NOT_FOUND) return undefined;\n\t\tif (result.code !== 0) throw new OsSecretStoreError(`Keychain lookup failed (exit ${result.code})`);\n\t\treturn result.stdout.replace(/\\r?\\n$/, \"\");\n\t}\n\n\tasync set(account: string, secret: string, signal?: AbortSignal): Promise<void> {\n\t\tassertAccount(account);\n\t\tif (!MACOS_SAFE_SECRET.test(secret)) throw new OsSecretStoreError(\"Secret cannot be stored in the keychain\");\n\t\t// The secret travels only on stdin.\n\t\tconst command = `add-generic-password -U -s \"${this.service}\" -a \"${account}\" -w \"${secret}\"\\n`;\n\t\tconst result = await run(this.runner, this.securityPath, [\"-i\"], command, signal);\n\t\tif (result.code !== 0 || result.stderr.trim().length > 0) {\n\t\t\tthrow new OsSecretStoreError(`Keychain write failed (exit ${result.code})`);\n\t\t}\n\t}\n\n\tasync delete(account: string, signal?: AbortSignal): Promise<void> {\n\t\tassertAccount(account);\n\t\tconst result = await run(\n\t\t\tthis.runner,\n\t\t\tthis.securityPath,\n\t\t\t[\"delete-generic-password\", \"-s\", this.service, \"-a\", account],\n\t\t\tundefined,\n\t\t\tsignal,\n\t\t);\n\t\tif (result.code !== 0 && result.code !== KEYCHAIN_ITEM_NOT_FOUND) {\n\t\t\tthrow new OsSecretStoreError(`Keychain delete failed (exit ${result.code})`);\n\t\t}\n\t}\n}\n\nconst SECRET_SERVICE_HELP = \"Start or unlock a Secret Service keyring in the current D-Bus session.\";\n\nclass SecretServiceStore implements SecretBackend {\n\tprivate readonly runner: CommandRunner;\n\tprivate readonly secretToolPath: string;\n\tprivate readonly service: string;\n\tprivate readonly label: string;\n\n\tconstructor(runner: CommandRunner, secretToolPath: string, namespace: OsSecretNamespace) {\n\t\tthis.runner = runner;\n\t\tthis.secretToolPath = secretToolPath;\n\t\tthis.service = namespace.service;\n\t\tthis.label = namespace.label;\n\t}\n\n\tasync get(account: string, signal?: AbortSignal): Promise<string | undefined> {\n\t\tassertAccount(account);\n\t\tconst result = await run(\n\t\t\tthis.runner,\n\t\t\tthis.secretToolPath,\n\t\t\t[\"lookup\", \"service\", this.service, \"account\", account],\n\t\t\tundefined,\n\t\t\tsignal,\n\t\t);\n\t\tif (result.code === 0) return result.stdout.length === 0 ? undefined : result.stdout;\n\t\t// Unlike the trace credential store, Gateway fails closed here instead of treating every exit 1 as missing.\n\t\t// Exit 1 with stderr means a D-Bus/Secret Service failure, not a missing item.\n\t\tif (result.code === 1 && result.stderr.trim().length === 0) return undefined;\n\t\tthrow new OsSecretStoreError(`Secret Service lookup failed (exit ${result.code}). ${SECRET_SERVICE_HELP}`);\n\t}\n\n\tasync set(account: string, secret: string, signal?: AbortSignal): Promise<void> {\n\t\tassertAccount(account);\n\t\tconst result = await run(\n\t\t\tthis.runner,\n\t\t\tthis.secretToolPath,\n\t\t\t[\"store\", `--label=${this.label}`, \"service\", this.service, \"account\", account],\n\t\t\tsecret,\n\t\t\tsignal,\n\t\t);\n\t\tif (result.code !== 0)\n\t\t\tthrow new OsSecretStoreError(`Secret Service write failed (exit ${result.code}). ${SECRET_SERVICE_HELP}`);\n\t}\n\n\tasync delete(account: string, signal?: AbortSignal): Promise<void> {\n\t\tassertAccount(account);\n\t\tconst result = await run(\n\t\t\tthis.runner,\n\t\t\tthis.secretToolPath,\n\t\t\t[\"clear\", \"service\", this.service, \"account\", account],\n\t\t\tundefined,\n\t\t\tsignal,\n\t\t);\n\t\tif (result.code !== 0 && !(result.code === 1 && result.stderr.trim().length === 0)) {\n\t\t\tthrow new OsSecretStoreError(`Secret Service delete failed (exit ${result.code}). ${SECRET_SERVICE_HELP}`);\n\t\t}\n\t}\n}\n\n/**\n * Constant PowerShell script. Operation and account arrive as trailing arguments (validated before spawning;\n * `-Command` appends them to the script block call), the secret only on stdin. Exit 3 = not found.\n */\nconst WINDOWS_CREDENTIAL_SCRIPT = `& {\nparam([string]$Op, [string]$Account)\n$ErrorActionPreference = 'Stop'\nAdd-Type -TypeDefinition '\nusing System;\nusing System.Runtime.InteropServices;\npublic static class HumainCred {\n [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]\n public struct CREDENTIAL {\n public UInt32 Flags; public UInt32 Type; public string TargetName; public string Comment;\n public System.Runtime.InteropServices.ComTypes.FILETIME LastWritten;\n public UInt32 CredentialBlobSize; public IntPtr CredentialBlob; public UInt32 Persist;\n public UInt32 AttributeCount; public IntPtr Attributes; public string TargetAlias; public string UserName;\n }\n [DllImport(\"advapi32.dll\", CharSet = CharSet.Unicode, SetLastError = true)]\n public static extern bool CredWriteW(ref CREDENTIAL cred, UInt32 flags);\n [DllImport(\"advapi32.dll\", CharSet = CharSet.Unicode, SetLastError = true)]\n public static extern bool CredReadW(string target, UInt32 type, UInt32 flags, out IntPtr cred);\n [DllImport(\"advapi32.dll\", CharSet = CharSet.Unicode, SetLastError = true)]\n public static extern bool CredDeleteW(string target, UInt32 type, UInt32 flags);\n [DllImport(\"advapi32.dll\")]\n public static extern void CredFree(IntPtr buffer);\n public static int Write(ref CREDENTIAL cred) {\n return CredWriteW(ref cred, 0) ? 0 : Marshal.GetLastWin32Error();\n }\n public static int Read(string target, out IntPtr cred) {\n return CredReadW(target, 1, 0, out cred) ? 0 : Marshal.GetLastWin32Error();\n }\n public static int Delete(string target) {\n return CredDeleteW(target, 1, 0) ? 0 : Marshal.GetLastWin32Error();\n }\n}\n'\n$target = '__SERVICE__:' + $Account\n$notFound = 1168\nif ($Op -eq 'set') {\n $secret = [Console]::In.ReadToEnd()\n $bytes = [System.Text.Encoding]::Unicode.GetBytes($secret)\n $blob = [System.Runtime.InteropServices.Marshal]::AllocHGlobal($bytes.Length)\n try {\n [System.Runtime.InteropServices.Marshal]::Copy($bytes, 0, $blob, $bytes.Length)\n $cred = New-Object HumainCred+CREDENTIAL\n $cred.Type = 1\n $cred.TargetName = $target\n $cred.CredentialBlobSize = $bytes.Length\n $cred.CredentialBlob = $blob\n $cred.Persist = 2\n $cred.UserName = 'humain-code'\n if ([HumainCred]::Write([ref]$cred) -ne 0) { exit 4 }\n } finally { [System.Runtime.InteropServices.Marshal]::FreeHGlobal($blob) }\n} elseif ($Op -eq 'get') {\n $ptr = [IntPtr]::Zero\n $err = [HumainCred]::Read($target, [ref]$ptr)\n if ($err -ne 0) {\n if ($err -eq $notFound) { exit 3 }\n exit 4\n }\n try {\n $cred = [System.Runtime.InteropServices.Marshal]::PtrToStructure($ptr, [Type][HumainCred+CREDENTIAL])\n $text = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($cred.CredentialBlob, [int]($cred.CredentialBlobSize / 2))\n [Console]::Out.Write($text)\n } finally { [HumainCred]::CredFree($ptr) }\n} elseif ($Op -eq 'delete') {\n $err = [HumainCred]::Delete($target)\n if ($err -ne 0) {\n if ($err -eq $notFound) { exit 3 }\n exit 4\n }\n} else { exit 5 }\n}`;\n\nconst WINDOWS_CREDENTIAL_HELP =\n\t\"Check Windows Credential Manager access. On WSL, enable Windows interoperability and make powershell.exe available on PATH.\";\n\nclass WindowsCredentialStore implements SecretBackend {\n\tprivate readonly runner: CommandRunner;\n\tprivate readonly powershellPath: string;\n\tprivate readonly script: string;\n\n\tconstructor(runner: CommandRunner, powershellPath: string, service: string) {\n\t\tthis.runner = runner;\n\t\tthis.powershellPath = powershellPath;\n\t\tthis.script = WINDOWS_CREDENTIAL_SCRIPT.replace(\"__SERVICE__\", service);\n\t}\n\n\tprivate exec(operation: \"set\" | \"get\" | \"delete\", account: string, stdin?: string, signal?: AbortSignal) {\n\t\tassertAccount(account);\n\t\treturn run(\n\t\t\tthis.runner,\n\t\t\tthis.powershellPath,\n\t\t\t[\"-NoProfile\", \"-NonInteractive\", \"-Command\", this.script, operation, account],\n\t\t\tstdin,\n\t\t\tsignal,\n\t\t\t`Could not run Windows Credential Manager. ${WINDOWS_CREDENTIAL_HELP}`,\n\t\t);\n\t}\n\n\tasync get(account: string, signal?: AbortSignal): Promise<string | undefined> {\n\t\tconst result = await this.exec(\"get\", account, undefined, signal);\n\t\tif (result.code === WINDOWS_NOT_FOUND) return undefined;\n\t\tif (result.code !== 0)\n\t\t\tthrow new OsSecretStoreError(\n\t\t\t\t`Credential Manager lookup failed (exit ${result.code}). ${WINDOWS_CREDENTIAL_HELP}`,\n\t\t\t);\n\t\treturn result.stdout;\n\t}\n\n\tasync set(account: string, secret: string, signal?: AbortSignal): Promise<void> {\n\t\tconst result = await this.exec(\"set\", account, secret, signal);\n\t\tif (result.code !== 0)\n\t\t\tthrow new OsSecretStoreError(\n\t\t\t\t`Credential Manager write failed (exit ${result.code}). ${WINDOWS_CREDENTIAL_HELP}`,\n\t\t\t);\n\t}\n\n\tasync delete(account: string, signal?: AbortSignal): Promise<void> {\n\t\tconst result = await this.exec(\"delete\", account, undefined, signal);\n\t\tif (result.code !== 0 && result.code !== WINDOWS_NOT_FOUND) {\n\t\t\tthrow new OsSecretStoreError(\n\t\t\t\t`Credential Manager delete failed (exit ${result.code}). ${WINDOWS_CREDENTIAL_HELP}`,\n\t\t\t);\n\t\t}\n\t}\n}\n\n/** Creates an isolated OS namespace with no file fallback or eager credential access. */\nexport function createOsSecretStore(namespace: OsSecretNamespace, options: OsSecretStoreOptions = {}): OsSecretStore {\n\t// Namespace metadata enters Keychain's command parser and a PowerShell string literal.\n\tif (namespace.service.length < 1 || namespace.service.length > 128 || /[^A-Za-z0-9._-]/.test(namespace.service)) {\n\t\tthrow new OsSecretStoreError(\"Invalid credential service name\");\n\t}\n\tif (namespace.label.length < 1 || namespace.label.length > 128 || /[^\\x20-\\x7e]/.test(namespace.label)) {\n\t\tthrow new OsSecretStoreError(\"Invalid credential label\");\n\t}\n\tconst backend = createBackend(namespace, options);\n\treturn {\n\t\tget: (account, signal) => backend.get(account, signal),\n\t\tset: (account, secret, signal) => backend.set(account, secret, signal),\n\t\tdelete: (account, signal) => backend.delete(account, signal),\n\t\tasync probe(signal) {\n\t\t\tsignal?.throwIfAborted();\n\t\t\tconst account = `probe:${randomUUID()}`;\n\t\t\tconst secret = randomBytes(32).toString(\"base64\");\n\t\t\ttry {\n\t\t\t\tawait backend.set(account, secret, signal);\n\t\t\t\tif ((await backend.get(account, signal)) !== secret) {\n\t\t\t\t\tthrow new OsSecretStoreError(\n\t\t\t\t\t\t\"OS credential store readback failed. Check that the keyring is unlocked and accessible.\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\t// Cleanup must still run when the operation's signal was cancelled.\n\t\t\t\ttry {\n\t\t\t\t\tawait backend.delete(account, signal?.aborted ? AbortSignal.timeout(3000) : signal);\n\t\t\t\t} finally {\n\t\t\t\t\tsignal?.throwIfAborted();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t};\n}\n\nfunction createBackend(namespace: OsSecretNamespace, options: OsSecretStoreOptions): SecretBackend {\n\tconst platform = options.platform ?? process.platform;\n\tconst runner = options.run ?? spawnCommand;\n\tconst env = options.env ?? process.env;\n\tconst findExecutable = options.findExecutable ?? systemTraceCredentialProbes.findExecutable;\n\tif (platform === \"darwin\") {\n\t\tconst security = findExecutable(\"/usr/bin/security\");\n\t\tif (security) return new KeychainSecretStore(runner, security, namespace.service);\n\t\tthrow new OsSecretStoreError(\"macOS Keychain is unavailable: /usr/bin/security was not found.\");\n\t}\n\tif (platform === \"linux\") {\n\t\tif (isWSL(env)) {\n\t\t\t// Keep every operation on one backend, even when WSL also has a Linux keyring.\n\t\t\tconst powershell = findExecutable(\"powershell.exe\");\n\t\t\tif (powershell) return new WindowsCredentialStore(runner, powershell, namespace.service);\n\t\t\tthrow new OsSecretStoreError(\n\t\t\t\t`${namespace.label} on WSL needs Windows Credential Manager. ${WINDOWS_CREDENTIAL_HELP}`,\n\t\t\t);\n\t\t}\n\t\tconst secretTool = findExecutable(\"secret-tool\");\n\t\tif (!secretTool) {\n\t\t\tthrow new OsSecretStoreError(\n\t\t\t\t`${namespace.label} needs secret-tool from libsecret (Debian/Ubuntu: sudo apt install libsecret-tools) and a running Secret Service keyring.`,\n\t\t\t);\n\t\t}\n\t\tif (!env.DBUS_SESSION_BUS_ADDRESS) {\n\t\t\tthrow new OsSecretStoreError(\n\t\t\t\t`${namespace.label} needs a D-Bus session with DBUS_SESSION_BUS_ADDRESS set and a running, unlocked Secret Service keyring. Headless Linux must configure both before sign-in.`,\n\t\t\t);\n\t\t}\n\t\treturn new SecretServiceStore(runner, secretTool, namespace);\n\t}\n\tif (platform === \"win32\") {\n\t\tconst systemRoot = env.SystemRoot;\n\t\tif (!systemRoot || !/^[a-z]:[\\\\/]/i.test(systemRoot)) {\n\t\t\tthrow new OsSecretStoreError(\n\t\t\t\t\"Windows Credential Manager is unavailable: SystemRoot is not set to a drive path.\",\n\t\t\t);\n\t\t}\n\t\treturn new WindowsCredentialStore(\n\t\t\trunner,\n\t\t\twin32.join(systemRoot, \"System32\", \"WindowsPowerShell\", \"v1.0\", \"powershell.exe\"),\n\t\t\tnamespace.service,\n\t\t);\n\t}\n\tthrow new OsSecretStoreError(\n\t\t`${namespace.label} sign-in is not supported on ${platform}: it requires macOS Keychain, Linux Secret Service, or Windows Credential Manager.`,\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"os-secret-store.js","sourceRoot":"","sources":["../../src/core/os-secret-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAsB,YAAY,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAUnH,MAAM,OAAO,kBAAmB,SAAQ,mBAAmB;IAC1D,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IAClC,CAAC;CACD;AAgBD,MAAM,eAAe,GAAG,0BAA0B,CAAC;AACnD,qFAAqF;AACrF,MAAM,iBAAiB,GAAG,oCAAoC,CAAC;AAC/D,MAAM,uBAAuB,GAAG,EAAE,CAAC;AACnC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B,SAAS,aAAa,CAAC,OAAe;IACrC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,kBAAkB,CAAC,iCAAiC,CAAC,CAAC;IACjE,CAAC;AACF,CAAC;AAED,KAAK,UAAU,GAAG,CACjB,MAAqB,EACrB,OAAe,EACf,IAAuB,EACvB,KAAc,EACd,MAAoB,EACpB,cAAc,GAAG,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AAC,EAAE,CAAC;YACtD,MAAM,IAAI,kBAAkB,CAC3B,mFAAmF,CACnF,CAAC;QACH,CAAC;QACD,OAAO,IAAI,sBAAsB,CAChC,MAAM,EACN,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,gBAAgB,CAAC,EACjF,SAAS,CAAC,OAAO,CACjB,CAAC;IACH,CAAC;IACD,MAAM,IAAI,kBAAkB,CAC3B,GAAG,SAAS,CAAC,KAAK,gCAAgC,QAAQ,oFAAoF,CAC9I,CAAC;AACH,CAAC","sourcesContent":["import { randomBytes, randomUUID } from \"node:crypto\";\nimport { win32 } from \"node:path\";\nimport { isWSL } from \"../utils/wsl.ts\";\nimport { SafeCredentialError } from \"./safe-credential-error.ts\";\nimport { type CommandRunner, spawnCommand, systemTraceCredentialProbes } from \"./trace-client/credential-store.ts\";\n\nexport interface OsSecretStore {\n\t/** Verifies write/read/delete using a disposable random key, never an account credential. */\n\tprobe(signal?: AbortSignal): Promise<void>;\n\tget(account: string, signal?: AbortSignal): Promise<string | undefined>;\n\tset(account: string, secret: string, signal?: AbortSignal): Promise<void>;\n\tdelete(account: string, signal?: AbortSignal): Promise<void>;\n}\n\nexport class OsSecretStoreError extends SafeCredentialError {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"OsSecretStoreError\";\n\t}\n}\n\nexport interface OsSecretStoreOptions {\n\tplatform?: NodeJS.Platform;\n\trun?: CommandRunner;\n\tenv?: NodeJS.ProcessEnv;\n\tfindExecutable?: (name: string) => string | undefined;\n}\n\ntype SecretBackend = Pick<OsSecretStore, \"get\" | \"set\" | \"delete\">;\n\nexport interface OsSecretNamespace {\n\tservice: string;\n\tlabel: string;\n}\n\nconst ACCOUNT_PATTERN = /^[A-Za-z0-9:._-]{1,128}$/;\n/** Secrets embedded in a double-quoted `security -i` line must not need escaping. */\nconst MACOS_SAFE_SECRET = /^[\\x21\\x23-\\x5b\\x5d-\\x7e]{1,3000}$/;\nconst KEYCHAIN_ITEM_NOT_FOUND = 44;\nconst WINDOWS_NOT_FOUND = 3;\n\nfunction assertAccount(account: string): void {\n\tif (!ACCOUNT_PATTERN.test(account)) {\n\t\tthrow new OsSecretStoreError(\"Invalid credential account name\");\n\t}\n}\n\nasync function run(\n\trunner: CommandRunner,\n\tcommand: string,\n\targs: readonly string[],\n\tstdin?: string,\n\tsignal?: AbortSignal,\n\tfailureMessage = \"Could not run the credential store command\",\n) {\n\ttry {\n\t\tsignal?.throwIfAborted();\n\t\tconst result = await runner(command, args, stdin, signal);\n\t\tsignal?.throwIfAborted();\n\t\treturn result;\n\t} catch {\n\t\tif (signal?.aborted) throw new DOMException(\"Credential operation aborted.\", \"AbortError\");\n\t\tthrow new OsSecretStoreError(failureMessage);\n\t}\n}\n\nclass KeychainSecretStore implements SecretBackend {\n\tprivate readonly runner: CommandRunner;\n\tprivate readonly securityPath: string;\n\tprivate readonly service: string;\n\n\tconstructor(runner: CommandRunner, securityPath: string, service: string) {\n\t\tthis.runner = runner;\n\t\tthis.securityPath = securityPath;\n\t\tthis.service = service;\n\t}\n\n\tasync get(account: string, signal?: AbortSignal): Promise<string | undefined> {\n\t\tassertAccount(account);\n\t\tconst result = await run(\n\t\t\tthis.runner,\n\t\t\tthis.securityPath,\n\t\t\t[\"find-generic-password\", \"-s\", this.service, \"-a\", account, \"-w\"],\n\t\t\tundefined,\n\t\t\tsignal,\n\t\t);\n\t\tif (result.code === KEYCHAIN_ITEM_NOT_FOUND) return undefined;\n\t\tif (result.code !== 0) throw new OsSecretStoreError(`Keychain lookup failed (exit ${result.code})`);\n\t\treturn result.stdout.replace(/\\r?\\n$/, \"\");\n\t}\n\n\tasync set(account: string, secret: string, signal?: AbortSignal): Promise<void> {\n\t\tassertAccount(account);\n\t\tif (!MACOS_SAFE_SECRET.test(secret)) throw new OsSecretStoreError(\"Secret cannot be stored in the keychain\");\n\t\t// The secret travels only on stdin.\n\t\tconst command = `add-generic-password -U -s \"${this.service}\" -a \"${account}\" -w \"${secret}\"\\n`;\n\t\tconst result = await run(this.runner, this.securityPath, [\"-i\"], command, signal);\n\t\tif (result.code !== 0 || result.stderr.trim().length > 0) {\n\t\t\tthrow new OsSecretStoreError(`Keychain write failed (exit ${result.code})`);\n\t\t}\n\t}\n\n\tasync delete(account: string, signal?: AbortSignal): Promise<void> {\n\t\tassertAccount(account);\n\t\tconst result = await run(\n\t\t\tthis.runner,\n\t\t\tthis.securityPath,\n\t\t\t[\"delete-generic-password\", \"-s\", this.service, \"-a\", account],\n\t\t\tundefined,\n\t\t\tsignal,\n\t\t);\n\t\tif (result.code !== 0 && result.code !== KEYCHAIN_ITEM_NOT_FOUND) {\n\t\t\tthrow new OsSecretStoreError(`Keychain delete failed (exit ${result.code})`);\n\t\t}\n\t}\n}\n\nconst SECRET_SERVICE_HELP = \"Start or unlock a Secret Service keyring in the current D-Bus session.\";\n\nclass SecretServiceStore implements SecretBackend {\n\tprivate readonly runner: CommandRunner;\n\tprivate readonly secretToolPath: string;\n\tprivate readonly service: string;\n\tprivate readonly label: string;\n\n\tconstructor(runner: CommandRunner, secretToolPath: string, namespace: OsSecretNamespace) {\n\t\tthis.runner = runner;\n\t\tthis.secretToolPath = secretToolPath;\n\t\tthis.service = namespace.service;\n\t\tthis.label = namespace.label;\n\t}\n\n\tasync get(account: string, signal?: AbortSignal): Promise<string | undefined> {\n\t\tassertAccount(account);\n\t\tconst result = await run(\n\t\t\tthis.runner,\n\t\t\tthis.secretToolPath,\n\t\t\t[\"lookup\", \"service\", this.service, \"account\", account],\n\t\t\tundefined,\n\t\t\tsignal,\n\t\t);\n\t\tif (result.code === 0) return result.stdout.length === 0 ? undefined : result.stdout;\n\t\t// Unlike the trace credential store, Gateway fails closed here instead of treating every exit 1 as missing.\n\t\t// Exit 1 with stderr means a D-Bus/Secret Service failure, not a missing item.\n\t\tif (result.code === 1 && result.stderr.trim().length === 0) return undefined;\n\t\tthrow new OsSecretStoreError(`Secret Service lookup failed (exit ${result.code}). ${SECRET_SERVICE_HELP}`);\n\t}\n\n\tasync set(account: string, secret: string, signal?: AbortSignal): Promise<void> {\n\t\tassertAccount(account);\n\t\tconst result = await run(\n\t\t\tthis.runner,\n\t\t\tthis.secretToolPath,\n\t\t\t[\"store\", `--label=${this.label}`, \"service\", this.service, \"account\", account],\n\t\t\tsecret,\n\t\t\tsignal,\n\t\t);\n\t\tif (result.code !== 0)\n\t\t\tthrow new OsSecretStoreError(`Secret Service write failed (exit ${result.code}). ${SECRET_SERVICE_HELP}`);\n\t}\n\n\tasync delete(account: string, signal?: AbortSignal): Promise<void> {\n\t\tassertAccount(account);\n\t\tconst result = await run(\n\t\t\tthis.runner,\n\t\t\tthis.secretToolPath,\n\t\t\t[\"clear\", \"service\", this.service, \"account\", account],\n\t\t\tundefined,\n\t\t\tsignal,\n\t\t);\n\t\tif (result.code !== 0 && !(result.code === 1 && result.stderr.trim().length === 0)) {\n\t\t\tthrow new OsSecretStoreError(`Secret Service delete failed (exit ${result.code}). ${SECRET_SERVICE_HELP}`);\n\t\t}\n\t}\n}\n\n/**\n * Constant PowerShell script. Operation and account arrive as trailing arguments (validated before spawning;\n * `-Command` appends them to the script block call), the secret only on stdin. Exit 3 = not found.\n */\nconst WINDOWS_CREDENTIAL_SCRIPT = `& {\nparam([string]$Op, [string]$Account)\n$ErrorActionPreference = 'Stop'\nAdd-Type -TypeDefinition '\nusing System;\nusing System.Runtime.InteropServices;\npublic static class HumainCred {\n [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]\n public struct CREDENTIAL {\n public UInt32 Flags; public UInt32 Type; public string TargetName; public string Comment;\n public System.Runtime.InteropServices.ComTypes.FILETIME LastWritten;\n public UInt32 CredentialBlobSize; public IntPtr CredentialBlob; public UInt32 Persist;\n public UInt32 AttributeCount; public IntPtr Attributes; public string TargetAlias; public string UserName;\n }\n [DllImport(\"advapi32.dll\", CharSet = CharSet.Unicode, SetLastError = true)]\n public static extern bool CredWriteW(ref CREDENTIAL cred, UInt32 flags);\n [DllImport(\"advapi32.dll\", CharSet = CharSet.Unicode, SetLastError = true)]\n public static extern bool CredReadW(string target, UInt32 type, UInt32 flags, out IntPtr cred);\n [DllImport(\"advapi32.dll\", CharSet = CharSet.Unicode, SetLastError = true)]\n public static extern bool CredDeleteW(string target, UInt32 type, UInt32 flags);\n [DllImport(\"advapi32.dll\")]\n public static extern void CredFree(IntPtr buffer);\n public static int Write(ref CREDENTIAL cred) {\n return CredWriteW(ref cred, 0) ? 0 : Marshal.GetLastWin32Error();\n }\n public static int Read(string target, out IntPtr cred) {\n return CredReadW(target, 1, 0, out cred) ? 0 : Marshal.GetLastWin32Error();\n }\n public static int Delete(string target) {\n return CredDeleteW(target, 1, 0) ? 0 : Marshal.GetLastWin32Error();\n }\n}\n'\n$target = '__SERVICE__:' + $Account\n$notFound = 1168\nif ($Op -eq 'set') {\n $secret = [Console]::In.ReadToEnd()\n $bytes = [System.Text.Encoding]::Unicode.GetBytes($secret)\n $blob = [System.Runtime.InteropServices.Marshal]::AllocHGlobal($bytes.Length)\n try {\n [System.Runtime.InteropServices.Marshal]::Copy($bytes, 0, $blob, $bytes.Length)\n $cred = New-Object HumainCred+CREDENTIAL\n $cred.Type = 1\n $cred.TargetName = $target\n $cred.CredentialBlobSize = $bytes.Length\n $cred.CredentialBlob = $blob\n $cred.Persist = 2\n $cred.UserName = 'humain-code'\n if ([HumainCred]::Write([ref]$cred) -ne 0) { exit 4 }\n } finally { [System.Runtime.InteropServices.Marshal]::FreeHGlobal($blob) }\n} elseif ($Op -eq 'get') {\n $ptr = [IntPtr]::Zero\n $err = [HumainCred]::Read($target, [ref]$ptr)\n if ($err -ne 0) {\n if ($err -eq $notFound) { exit 3 }\n exit 4\n }\n try {\n $cred = [System.Runtime.InteropServices.Marshal]::PtrToStructure($ptr, [Type][HumainCred+CREDENTIAL])\n $text = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($cred.CredentialBlob, [int]($cred.CredentialBlobSize / 2))\n [Console]::Out.Write($text)\n } finally { [HumainCred]::CredFree($ptr) }\n} elseif ($Op -eq 'delete') {\n $err = [HumainCred]::Delete($target)\n if ($err -ne 0) {\n if ($err -eq $notFound) { exit 3 }\n exit 4\n }\n} else { exit 5 }\n}`;\n\nconst WINDOWS_CREDENTIAL_HELP =\n\t\"Check Windows Credential Manager access. On WSL, enable Windows interoperability and make powershell.exe available on PATH.\";\n\nclass WindowsCredentialStore implements SecretBackend {\n\tprivate readonly runner: CommandRunner;\n\tprivate readonly powershellPath: string;\n\tprivate readonly script: string;\n\n\tconstructor(runner: CommandRunner, powershellPath: string, service: string) {\n\t\tthis.runner = runner;\n\t\tthis.powershellPath = powershellPath;\n\t\tthis.script = WINDOWS_CREDENTIAL_SCRIPT.replace(\"__SERVICE__\", service);\n\t}\n\n\tprivate exec(operation: \"set\" | \"get\" | \"delete\", account: string, stdin?: string, signal?: AbortSignal) {\n\t\tassertAccount(account);\n\t\treturn run(\n\t\t\tthis.runner,\n\t\t\tthis.powershellPath,\n\t\t\t[\"-NoProfile\", \"-NonInteractive\", \"-Command\", this.script, operation, account],\n\t\t\tstdin,\n\t\t\tsignal,\n\t\t\t`Could not run Windows Credential Manager. ${WINDOWS_CREDENTIAL_HELP}`,\n\t\t);\n\t}\n\n\tasync get(account: string, signal?: AbortSignal): Promise<string | undefined> {\n\t\tconst result = await this.exec(\"get\", account, undefined, signal);\n\t\tif (result.code === WINDOWS_NOT_FOUND) return undefined;\n\t\tif (result.code !== 0)\n\t\t\tthrow new OsSecretStoreError(\n\t\t\t\t`Credential Manager lookup failed (exit ${result.code}). ${WINDOWS_CREDENTIAL_HELP}`,\n\t\t\t);\n\t\treturn result.stdout;\n\t}\n\n\tasync set(account: string, secret: string, signal?: AbortSignal): Promise<void> {\n\t\tconst result = await this.exec(\"set\", account, secret, signal);\n\t\tif (result.code !== 0)\n\t\t\tthrow new OsSecretStoreError(\n\t\t\t\t`Credential Manager write failed (exit ${result.code}). ${WINDOWS_CREDENTIAL_HELP}`,\n\t\t\t);\n\t}\n\n\tasync delete(account: string, signal?: AbortSignal): Promise<void> {\n\t\tconst result = await this.exec(\"delete\", account, undefined, signal);\n\t\tif (result.code !== 0 && result.code !== WINDOWS_NOT_FOUND) {\n\t\t\tthrow new OsSecretStoreError(\n\t\t\t\t`Credential Manager delete failed (exit ${result.code}). ${WINDOWS_CREDENTIAL_HELP}`,\n\t\t\t);\n\t\t}\n\t}\n}\n\n/** Creates an isolated OS namespace with no file fallback or eager credential access. */\nexport function createOsSecretStore(namespace: OsSecretNamespace, options: OsSecretStoreOptions = {}): OsSecretStore {\n\t// Namespace metadata enters Keychain's command parser and a PowerShell string literal.\n\tif (namespace.service.length < 1 || namespace.service.length > 128 || /[^A-Za-z0-9._-]/.test(namespace.service)) {\n\t\tthrow new OsSecretStoreError(\"Invalid credential service name\");\n\t}\n\tif (namespace.label.length < 1 || namespace.label.length > 128 || /[^\\x20-\\x7e]/.test(namespace.label)) {\n\t\tthrow new OsSecretStoreError(\"Invalid credential label\");\n\t}\n\tconst backend = createBackend(namespace, options);\n\treturn {\n\t\tget: (account, signal) => backend.get(account, signal),\n\t\tset: (account, secret, signal) => backend.set(account, secret, signal),\n\t\tdelete: (account, signal) => backend.delete(account, signal),\n\t\tasync probe(signal) {\n\t\t\tsignal?.throwIfAborted();\n\t\t\tconst account = `probe:${randomUUID()}`;\n\t\t\tconst secret = randomBytes(32).toString(\"base64\");\n\t\t\ttry {\n\t\t\t\tawait backend.set(account, secret, signal);\n\t\t\t\tif ((await backend.get(account, signal)) !== secret) {\n\t\t\t\t\tthrow new OsSecretStoreError(\n\t\t\t\t\t\t\"OS credential store readback failed. Check that the keyring is unlocked and accessible.\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\t// Cleanup must still run when the operation's signal was cancelled.\n\t\t\t\ttry {\n\t\t\t\t\tawait backend.delete(account, signal?.aborted ? AbortSignal.timeout(3000) : signal);\n\t\t\t\t} finally {\n\t\t\t\t\tsignal?.throwIfAborted();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t};\n}\n\nfunction createBackend(namespace: OsSecretNamespace, options: OsSecretStoreOptions): SecretBackend {\n\tconst platform = options.platform ?? process.platform;\n\tconst runner = options.run ?? spawnCommand;\n\tconst env = options.env ?? process.env;\n\tconst findExecutable = options.findExecutable ?? systemTraceCredentialProbes.findExecutable;\n\tif (platform === \"darwin\") {\n\t\tconst security = findExecutable(\"/usr/bin/security\");\n\t\tif (security) return new KeychainSecretStore(runner, security, namespace.service);\n\t\tthrow new OsSecretStoreError(\"macOS Keychain is unavailable: /usr/bin/security was not found.\");\n\t}\n\tif (platform === \"linux\") {\n\t\tif (isWSL(platform, env)) {\n\t\t\t// Keep every operation on one backend, even when WSL also has a Linux keyring.\n\t\t\tconst powershell = findExecutable(\"powershell.exe\");\n\t\t\tif (powershell) return new WindowsCredentialStore(runner, powershell, namespace.service);\n\t\t\tthrow new OsSecretStoreError(\n\t\t\t\t`${namespace.label} on WSL needs Windows Credential Manager. ${WINDOWS_CREDENTIAL_HELP}`,\n\t\t\t);\n\t\t}\n\t\tconst secretTool = findExecutable(\"secret-tool\");\n\t\tif (!secretTool) {\n\t\t\tthrow new OsSecretStoreError(\n\t\t\t\t`${namespace.label} needs secret-tool from libsecret (Debian/Ubuntu: sudo apt install libsecret-tools) and a running Secret Service keyring.`,\n\t\t\t);\n\t\t}\n\t\tif (!env.DBUS_SESSION_BUS_ADDRESS) {\n\t\t\tthrow new OsSecretStoreError(\n\t\t\t\t`${namespace.label} needs a D-Bus session with DBUS_SESSION_BUS_ADDRESS set and a running, unlocked Secret Service keyring. Headless Linux must configure both before sign-in.`,\n\t\t\t);\n\t\t}\n\t\treturn new SecretServiceStore(runner, secretTool, namespace);\n\t}\n\tif (platform === \"win32\") {\n\t\tconst systemRoot = env.SystemRoot;\n\t\tif (!systemRoot || !/^[a-z]:[\\\\/]/i.test(systemRoot)) {\n\t\t\tthrow new OsSecretStoreError(\n\t\t\t\t\"Windows Credential Manager is unavailable: SystemRoot is not set to a drive path.\",\n\t\t\t);\n\t\t}\n\t\treturn new WindowsCredentialStore(\n\t\t\trunner,\n\t\t\twin32.join(systemRoot, \"System32\", \"WindowsPowerShell\", \"v1.0\", \"powershell.exe\"),\n\t\t\tnamespace.service,\n\t\t);\n\t}\n\tthrow new OsSecretStoreError(\n\t\t`${namespace.label} sign-in is not supported on ${platform}: it requires macOS Keychain, Linux Secret Service, or Windows Credential Manager.`,\n\t);\n}\n"]}
|
|
@@ -117,7 +117,9 @@ export declare class DefaultPackageManager implements PackageManager {
|
|
|
117
117
|
getInstalledPath(source: string, scope: "user" | "project"): string | undefined;
|
|
118
118
|
private emitProgress;
|
|
119
119
|
private withProgress;
|
|
120
|
-
resolve(onMissing?: (source: string) => Promise<MissingSourceAction
|
|
120
|
+
resolve(onMissing?: (source: string) => Promise<MissingSourceAction>, options?: {
|
|
121
|
+
inspectOnly: true;
|
|
122
|
+
}): Promise<ResolvedPaths>;
|
|
121
123
|
resolveExtensionSources(sources: string[], options?: {
|
|
122
124
|
local?: boolean;
|
|
123
125
|
temporary?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../../src/core/package-manager.ts"],"names":[],"mappings":"AAwDA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAwC5E,MAAM,WAAW,YAAY;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,SAAS,GAAG,WAAW,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC;CACvB;AAED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rC,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,uBAAuB;IA0D/B,OAAO,CAAC,uBAAuB;IAsB/B,OAAO,CAAC,kBAAkB;IA0B1B,OAAO,CAAC,uBAAuB;IAkB/B;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAsB5B,OAAO,CAAC,kBAAkB;IAoB1B,OAAO,CAAC,+BAA+B;IAYvC,OAAO,CAAC,mBAAmB;IAuB3B,OAAO,CAAC,0BAA0B;IAsKlC,OAAO,CAAC,qBAAqB;IAmB7B,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,eAAe;IA4BvB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,iBAAiB;IA4CzB,OAAO,CAAC,UAAU;IAiBlB;;;OAGG;YACW,kBAAkB;IAoBhC,OAAO,CAAC,cAAc;CActB"}
|
|
@@ -765,7 +765,7 @@ export class DefaultPackageManager {
|
|
|
765
765
|
throw error;
|
|
766
766
|
}
|
|
767
767
|
}
|
|
768
|
-
async resolve(onMissing) {
|
|
768
|
+
async resolve(onMissing, options) {
|
|
769
769
|
const accumulator = this.createAccumulator();
|
|
770
770
|
const globalSettings = this.settingsManager.getGlobalSettings();
|
|
771
771
|
const projectSettings = this.settingsManager.getProjectSettings();
|
|
@@ -779,9 +779,21 @@ export class DefaultPackageManager {
|
|
|
779
779
|
}
|
|
780
780
|
// Dedupe: project scope wins over global for same package identity
|
|
781
781
|
const packageSources = this.dedupePackages(allPackages);
|
|
782
|
-
const installFailures = await this.resolvePackageSources(packageSources, accumulator, onMissing);
|
|
782
|
+
const installFailures = await this.resolvePackageSources(packageSources, accumulator, onMissing, options);
|
|
783
783
|
const globalBaseDir = this.agentDir;
|
|
784
784
|
const projectBaseDir = join(this.cwd, CONFIG_DIR_NAME);
|
|
785
|
+
if (options?.inspectOnly) {
|
|
786
|
+
for (const [scope, settings, baseDir] of [
|
|
787
|
+
["user", globalSettings, globalBaseDir],
|
|
788
|
+
["project", projectSettings, projectBaseDir],
|
|
789
|
+
]) {
|
|
790
|
+
for (const source of splitPatterns(settings.extensions ?? []).plain) {
|
|
791
|
+
if (!source.startsWith(BUILTIN_PATH_PREFIX) && !existsSync(this.resolvePathFromBase(source, baseDir))) {
|
|
792
|
+
installFailures.push({ source, scope, message: "Local extension unavailable" });
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
785
797
|
for (const resourceType of RESOURCE_TYPES) {
|
|
786
798
|
const target = this.getTargetMap(accumulator, resourceType);
|
|
787
799
|
const globalEntries = (globalSettings[resourceType] ?? []);
|
|
@@ -1087,7 +1099,7 @@ export class DefaultPackageManager {
|
|
|
1087
1099
|
const results = await this.runWithConcurrency(checks, UPDATE_CHECK_CONCURRENCY);
|
|
1088
1100
|
return results.filter((result) => result !== undefined);
|
|
1089
1101
|
}
|
|
1090
|
-
async resolvePackageSources(sources, accumulator, onMissing) {
|
|
1102
|
+
async resolvePackageSources(sources, accumulator, onMissing, options) {
|
|
1091
1103
|
const installFailures = [];
|
|
1092
1104
|
for (const { pkg, scope } of sources) {
|
|
1093
1105
|
const sourceStr = typeof pkg === "string" ? pkg : pkg.source;
|
|
@@ -1097,12 +1109,19 @@ export class DefaultPackageManager {
|
|
|
1097
1109
|
const resolvedScope = deltaBase?.scope ?? scope;
|
|
1098
1110
|
const parsed = this.parseSource(resolvedSource);
|
|
1099
1111
|
const metadata = { source: sourceStr, scope, origin: "package" };
|
|
1112
|
+
const missing = () => installFailures.push({ source: resolvedSource, scope: resolvedScope, message: "Local source unavailable" });
|
|
1100
1113
|
if (parsed.type === "local") {
|
|
1101
1114
|
const baseDir = this.getBaseDirForScope(resolvedScope);
|
|
1115
|
+
if (options?.inspectOnly && !existsSync(this.resolvePathFromBase(parsed.path, baseDir)))
|
|
1116
|
+
missing();
|
|
1102
1117
|
this.resolveLocalExtensionSource(parsed, accumulator, filter, metadata, baseDir);
|
|
1103
1118
|
continue;
|
|
1104
1119
|
}
|
|
1105
1120
|
const installMissing = async () => {
|
|
1121
|
+
if (options?.inspectOnly) {
|
|
1122
|
+
missing();
|
|
1123
|
+
return false;
|
|
1124
|
+
}
|
|
1106
1125
|
if (isOfflineModeEnabled())
|
|
1107
1126
|
return false;
|
|
1108
1127
|
if (onMissing) {
|
|
@@ -1128,7 +1147,9 @@ export class DefaultPackageManager {
|
|
|
1128
1147
|
}
|
|
1129
1148
|
};
|
|
1130
1149
|
if (parsed.type === "npm") {
|
|
1131
|
-
let installedPath =
|
|
1150
|
+
let installedPath = options?.inspectOnly
|
|
1151
|
+
? this.getManagedNpmInstallPath(parsed, resolvedScope)
|
|
1152
|
+
: this.getNpmInstallPath(parsed, resolvedScope);
|
|
1132
1153
|
const needsInstall = !existsSync(installedPath) || !(await this.installedNpmMatchesConfiguredVersion(parsed, installedPath));
|
|
1133
1154
|
if (!needsInstall &&
|
|
1134
1155
|
resolvedScope === "temporary" &&
|