@humain/humain-code 0.8.2 → 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 +152 -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-PJXBU6CR.js → chunk-52642TYH.js} +394 -204
- 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-EFY2QPVP.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-U4EAJPMO.js → chunk-EVDQRT3I.js} +252 -371
- 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-G2QMON4O.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-H2B3WLIM.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-S2US54IU.js +37 -0
- package/dist/bundle/chunks/{chunk-H7UPU2SH.js → chunk-SOE25WIS.js} +1218 -1239
- 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-ELBUCH6U.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-NERIS6SW.js → dist-7PCCEUQF.js} +2 -2
- package/dist/bundle/chunks/{dist-QSYDYE3Y.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-SRYLSS5P.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-3P3BHQ7E.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-3PDJKE5F.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/adapter/delivery.d.ts +27 -0
- package/dist/coordination/adapter/delivery.d.ts.map +1 -1
- package/dist/coordination/adapter/delivery.js +164 -4
- package/dist/coordination/adapter/delivery.js.map +1 -1
- package/dist/coordination/adapter/index.d.ts.map +1 -1
- package/dist/coordination/adapter/index.js +31 -5
- package/dist/coordination/adapter/index.js.map +1 -1
- package/dist/coordination/adapter/presence.d.ts +5 -0
- package/dist/coordination/adapter/presence.d.ts.map +1 -1
- package/dist/coordination/adapter/presence.js +25 -3
- package/dist/coordination/adapter/presence.js.map +1 -1
- package/dist/coordination/adapter/question-routing.d.ts +7 -0
- package/dist/coordination/adapter/question-routing.d.ts.map +1 -0
- package/dist/coordination/adapter/question-routing.js +40 -0
- package/dist/coordination/adapter/question-routing.js.map +1 -0
- package/dist/coordination/adapter/receipts.d.ts +7 -0
- package/dist/coordination/adapter/receipts.d.ts.map +1 -1
- package/dist/coordination/adapter/receipts.js +25 -2
- package/dist/coordination/adapter/receipts.js.map +1 -1
- package/dist/coordination/adapter/tool.d.ts +19 -3
- package/dist/coordination/adapter/tool.d.ts.map +1 -1
- package/dist/coordination/adapter/tool.js +93 -19
- package/dist/coordination/adapter/tool.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/coordination/client/client.d.ts +2 -2
- package/dist/coordination/client/client.d.ts.map +1 -1
- package/dist/coordination/client/client.js +4 -0
- package/dist/coordination/client/client.js.map +1 -1
- package/dist/coordination/transport/protocol.d.ts.map +1 -1
- package/dist/coordination/transport/protocol.js +23 -0
- package/dist/coordination/transport/protocol.js.map +1 -1
- package/dist/coordination/transport/types.d.ts +11 -1
- package/dist/coordination/transport/types.d.ts.map +1 -1
- package/dist/coordination/transport/types.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 +20 -10
- 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/oauth-account-pool.d.ts +14 -0
- package/dist/core/oauth-account-pool.d.ts.map +1 -1
- package/dist/core/oauth-account-pool.js +166 -14
- package/dist/core/oauth-account-pool.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/run-outcome.d.ts +1 -1
- package/dist/core/run-outcome.d.ts.map +1 -1
- package/dist/core/run-outcome.js +2 -2
- package/dist/core/run-outcome.js.map +1 -1
- package/dist/core/run-preflight.d.ts.map +1 -1
- package/dist/core/run-preflight.js +15 -8
- package/dist/core/run-preflight.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 +38 -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 +45 -3
- package/docs/codemode.md +7 -3
- package/docs/compaction.md +1 -1
- package/docs/coordination.md +16 -4
- package/docs/development.md +6 -0
- package/docs/environment-variables.md +5 -3
- 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 +25 -3
- 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-3PJ7NPWN.js +0 -80
- package/dist/bundle/chunks/chunk-6JTCRCNF.js +0 -74
- 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-JQBZUFH7.js +0 -3580
- 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-UEW6TUSP.js +0 -36
- 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/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-SDUO5OLD.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-IU5KWB2C.js +0 -28
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading piped stdin as the first prompt's prefix.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* How long to wait for the first data on piped stdin when the command line already has a prompt, from
|
|
6
|
+
* `HUMAIN_TERMINAL_STDIN_TIMEOUT_MS`; 0 waits for end of input as without a prompt.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getStdinFirstDataTimeoutMs(env?: NodeJS.ProcessEnv): number;
|
|
9
|
+
/** The stderr line for stdin that was not read because it sent nothing within `timeoutMs`. */
|
|
10
|
+
export declare function formatStdinIgnoredNotice(timeoutMs: number): string;
|
|
11
|
+
/**
|
|
12
|
+
* Read all of piped stdin. Undefined when stdin is a terminal or empty. With `firstDataTimeoutMs` above 0, stdin that
|
|
13
|
+
* sends nothing within that time counts as empty and is no longer read: a parent that keeps the pipe open without
|
|
14
|
+
* writing does not block a print run that has a prompt (upstream #10415). Once data arrives, it is read to the end.
|
|
15
|
+
* `onIgnored` runs when stdin is not read for that reason, so a slow producer's input is not dropped without a word.
|
|
16
|
+
*/
|
|
17
|
+
export declare function readPipedStdin(stdin: NodeJS.ReadableStream & {
|
|
18
|
+
isTTY?: boolean;
|
|
19
|
+
destroy?: () => void;
|
|
20
|
+
}, firstDataTimeoutMs?: number, onIgnored?: () => void): Promise<string | undefined>;
|
|
21
|
+
//# sourceMappingURL=piped-stdin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"piped-stdin.d.ts","sourceRoot":"","sources":["../../src/utils/piped-stdin.ts"],"names":[],"mappings":"AACA;;GAEG;AAOH;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAKvF;AAED,8FAA8F;AAC9F,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAElE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC7B,KAAK,EAAE,MAAM,CAAC,cAAc,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,EACxE,kBAAkB,SAAI,EACtB,SAAS,CAAC,EAAE,MAAM,IAAI,GACpB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA8B7B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Derived from Pi-Bolt (MIT, Copyright (c) 2026 OpenSec (Pi-Bolt)), commits 64198929, b798ee63; modified for HUMAIN Code CLI.
|
|
2
|
+
/**
|
|
3
|
+
* Reading piped stdin as the first prompt's prefix.
|
|
4
|
+
*/
|
|
5
|
+
import { ENV_STDIN_TIMEOUT_MS } from "../config.js";
|
|
6
|
+
/** Default for the stdin timeout variable: how long a prompt argument waits for piped stdin to send its first data. */
|
|
7
|
+
const DEFAULT_STDIN_TIMEOUT_MS = 2_000;
|
|
8
|
+
/**
|
|
9
|
+
* How long to wait for the first data on piped stdin when the command line already has a prompt, from
|
|
10
|
+
* `HUMAIN_TERMINAL_STDIN_TIMEOUT_MS`; 0 waits for end of input as without a prompt.
|
|
11
|
+
*/
|
|
12
|
+
export function getStdinFirstDataTimeoutMs(env = process.env) {
|
|
13
|
+
const raw = env[ENV_STDIN_TIMEOUT_MS];
|
|
14
|
+
if (raw === undefined || raw.trim() === "")
|
|
15
|
+
return DEFAULT_STDIN_TIMEOUT_MS;
|
|
16
|
+
const value = Number(raw);
|
|
17
|
+
return Number.isFinite(value) && value >= 0 ? value : DEFAULT_STDIN_TIMEOUT_MS;
|
|
18
|
+
}
|
|
19
|
+
/** The stderr line for stdin that was not read because it sent nothing within `timeoutMs`. */
|
|
20
|
+
export function formatStdinIgnoredNotice(timeoutMs) {
|
|
21
|
+
return `stdin sent nothing within ${timeoutMs / 1000} s and was not read; set ${ENV_STDIN_TIMEOUT_MS}=0 to wait for it`;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Read all of piped stdin. Undefined when stdin is a terminal or empty. With `firstDataTimeoutMs` above 0, stdin that
|
|
25
|
+
* sends nothing within that time counts as empty and is no longer read: a parent that keeps the pipe open without
|
|
26
|
+
* writing does not block a print run that has a prompt (upstream #10415). Once data arrives, it is read to the end.
|
|
27
|
+
* `onIgnored` runs when stdin is not read for that reason, so a slow producer's input is not dropped without a word.
|
|
28
|
+
*/
|
|
29
|
+
export function readPipedStdin(stdin, firstDataTimeoutMs = 0, onIgnored) {
|
|
30
|
+
if (stdin.isTTY)
|
|
31
|
+
return Promise.resolve(undefined);
|
|
32
|
+
return new Promise((resolve) => {
|
|
33
|
+
let data = "";
|
|
34
|
+
let timer;
|
|
35
|
+
const onData = (chunk) => {
|
|
36
|
+
clearTimeout(timer);
|
|
37
|
+
data += chunk;
|
|
38
|
+
};
|
|
39
|
+
const onEnd = () => {
|
|
40
|
+
clearTimeout(timer);
|
|
41
|
+
resolve(data.trim() || undefined);
|
|
42
|
+
};
|
|
43
|
+
stdin.setEncoding("utf8");
|
|
44
|
+
stdin.on("data", onData);
|
|
45
|
+
stdin.on("end", onEnd);
|
|
46
|
+
if (firstDataTimeoutMs > 0) {
|
|
47
|
+
timer = setTimeout(() => {
|
|
48
|
+
stdin.off("data", onData);
|
|
49
|
+
stdin.off("end", onEnd);
|
|
50
|
+
// Stop reading, so the open pipe does not keep the process alive.
|
|
51
|
+
stdin.pause();
|
|
52
|
+
stdin.destroy?.();
|
|
53
|
+
onIgnored?.();
|
|
54
|
+
resolve(undefined);
|
|
55
|
+
}, firstDataTimeoutMs);
|
|
56
|
+
}
|
|
57
|
+
stdin.resume();
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=piped-stdin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"piped-stdin.js","sourceRoot":"","sources":["../../src/utils/piped-stdin.ts"],"names":[],"mappings":"AAAA,8HAA8H;AAC9H;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,uHAAuH;AACvH,MAAM,wBAAwB,GAAG,KAAK,CAAC;AAEvC;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG;IAC9E,MAAM,GAAG,GAAG,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACtC,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,wBAAwB,CAAC;IAC5E,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,wBAAwB,CAAC;AAChF,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,wBAAwB,CAAC,SAAiB;IACzD,OAAO,6BAA6B,SAAS,GAAG,IAAI,4BAA4B,oBAAoB,mBAAmB,CAAC;AACzH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC7B,KAAwE,EACxE,kBAAkB,GAAG,CAAC,EACtB,SAAsB;IAEtB,IAAI,KAAK,CAAC,KAAK;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEnD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC9B,IAAI,IAAI,GAAG,EAAE,CAAC;QACd,IAAI,KAAgD,CAAC;QACrD,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,EAAE;YAChC,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,IAAI,IAAI,KAAK,CAAC;QACf,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,GAAG,EAAE;YAClB,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC,CAAC;QACnC,CAAC,CAAC;QACF,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC1B,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACzB,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACvB,IAAI,kBAAkB,GAAG,CAAC,EAAE,CAAC;YAC5B,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;gBACvB,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAC1B,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBACxB,kEAAkE;gBAClE,KAAK,CAAC,KAAK,EAAE,CAAC;gBACd,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;gBAClB,SAAS,EAAE,EAAE,CAAC;gBACd,OAAO,CAAC,SAAS,CAAC,CAAC;YACpB,CAAC,EAAE,kBAAkB,CAAC,CAAC;QACxB,CAAC;QACD,KAAK,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Derived from Pi-Bolt (MIT, Copyright (c) 2026 OpenSec (Pi-Bolt)), commits 64198929, b798ee63; modified for HUMAIN Code CLI.\n/**\n * Reading piped stdin as the first prompt's prefix.\n */\n\nimport { ENV_STDIN_TIMEOUT_MS } from \"../config.ts\";\n\n/** Default for the stdin timeout variable: how long a prompt argument waits for piped stdin to send its first data. */\nconst DEFAULT_STDIN_TIMEOUT_MS = 2_000;\n\n/**\n * How long to wait for the first data on piped stdin when the command line already has a prompt, from\n * `HUMAIN_TERMINAL_STDIN_TIMEOUT_MS`; 0 waits for end of input as without a prompt.\n */\nexport function getStdinFirstDataTimeoutMs(env: NodeJS.ProcessEnv = process.env): number {\n\tconst raw = env[ENV_STDIN_TIMEOUT_MS];\n\tif (raw === undefined || raw.trim() === \"\") return DEFAULT_STDIN_TIMEOUT_MS;\n\tconst value = Number(raw);\n\treturn Number.isFinite(value) && value >= 0 ? value : DEFAULT_STDIN_TIMEOUT_MS;\n}\n\n/** The stderr line for stdin that was not read because it sent nothing within `timeoutMs`. */\nexport function formatStdinIgnoredNotice(timeoutMs: number): string {\n\treturn `stdin sent nothing within ${timeoutMs / 1000} s and was not read; set ${ENV_STDIN_TIMEOUT_MS}=0 to wait for it`;\n}\n\n/**\n * Read all of piped stdin. Undefined when stdin is a terminal or empty. With `firstDataTimeoutMs` above 0, stdin that\n * sends nothing within that time counts as empty and is no longer read: a parent that keeps the pipe open without\n * writing does not block a print run that has a prompt (upstream #10415). Once data arrives, it is read to the end.\n * `onIgnored` runs when stdin is not read for that reason, so a slow producer's input is not dropped without a word.\n */\nexport function readPipedStdin(\n\tstdin: NodeJS.ReadableStream & { isTTY?: boolean; destroy?: () => void },\n\tfirstDataTimeoutMs = 0,\n\tonIgnored?: () => void,\n): Promise<string | undefined> {\n\tif (stdin.isTTY) return Promise.resolve(undefined);\n\n\treturn new Promise((resolve) => {\n\t\tlet data = \"\";\n\t\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\t\tconst onData = (chunk: string) => {\n\t\t\tclearTimeout(timer);\n\t\t\tdata += chunk;\n\t\t};\n\t\tconst onEnd = () => {\n\t\t\tclearTimeout(timer);\n\t\t\tresolve(data.trim() || undefined);\n\t\t};\n\t\tstdin.setEncoding(\"utf8\");\n\t\tstdin.on(\"data\", onData);\n\t\tstdin.on(\"end\", onEnd);\n\t\tif (firstDataTimeoutMs > 0) {\n\t\t\ttimer = setTimeout(() => {\n\t\t\t\tstdin.off(\"data\", onData);\n\t\t\t\tstdin.off(\"end\", onEnd);\n\t\t\t\t// Stop reading, so the open pipe does not keep the process alive.\n\t\t\t\tstdin.pause();\n\t\t\t\tstdin.destroy?.();\n\t\t\t\tonIgnored?.();\n\t\t\t\tresolve(undefined);\n\t\t\t}, firstDataTimeoutMs);\n\t\t}\n\t\tstdin.resume();\n\t});\n}\n"]}
|
package/dist/utils/shell.d.ts
CHANGED
|
@@ -2,13 +2,16 @@ import { type ChildProcess } from "child_process";
|
|
|
2
2
|
export interface ShellConfig {
|
|
3
3
|
shell: string;
|
|
4
4
|
args: string[];
|
|
5
|
-
|
|
5
|
+
/** How the command reaches the shell: appended to `args` (default), written to stdin, or set in `SHELL_COMMAND_ENV_VAR`. */
|
|
6
|
+
commandTransport?: "argv" | "stdin" | "env";
|
|
6
7
|
}
|
|
8
|
+
/** Environment variable that carries the command when `commandTransport` is `"env"`. */
|
|
9
|
+
export declare const SHELL_COMMAND_ENV_VAR = "PI_BASH_COMMAND";
|
|
7
10
|
/**
|
|
8
11
|
* Resolve shell configuration based on platform and an optional explicit shell path.
|
|
9
12
|
* Resolution order:
|
|
10
13
|
* 1. User-specified shellPath
|
|
11
|
-
* 2. On Windows: Git Bash in known locations, then bash on PATH
|
|
14
|
+
* 2. On Windows: Git Bash in known locations, then Git Bash of git on PATH, then bash on PATH
|
|
12
15
|
* 3. On Unix: /bin/bash, then bash on PATH, then fallback to sh
|
|
13
16
|
*/
|
|
14
17
|
export declare function getShellConfig(customShellPath?: string): ShellConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAoB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAoB,MAAM,eAAe,CAAC;AAIpE,MAAM,WAAW,WAAW;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AAO,CAAC,CAKvG;AAED,oEAAoE;AACpE,wBAAgB,2BAA2B,CAAC,OAAO,SAAuB,GAAG,IAAI,CA0ChF;AAOD;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,GAAG,IAAI,CAoBvE"}
|
package/dist/utils/shell.js
CHANGED
|
@@ -2,6 +2,9 @@ import { accessSync, constants } from "node:fs";
|
|
|
2
2
|
import { delimiter, join, win32 } from "node:path";
|
|
3
3
|
import { spawn, spawnSync } from "child_process";
|
|
4
4
|
import { getBinDir } from "../config.js";
|
|
5
|
+
import { resolveWindowsCommand } from "./child-process.js";
|
|
6
|
+
/** Environment variable that carries the command when `commandTransport` is `"env"`. */
|
|
7
|
+
export const SHELL_COMMAND_ENV_VAR = "PI_BASH_COMMAND";
|
|
5
8
|
// Keep in sync with packages/durable/src/env/node.ts.
|
|
6
9
|
function isLegacyWslBashPath(path) {
|
|
7
10
|
const normalized = win32.normalize(path).toLowerCase();
|
|
@@ -14,8 +17,28 @@ function isLegacyWslBashPath(path) {
|
|
|
14
17
|
// Fall back to conventional launcher paths only when the Windows directory is unknown.
|
|
15
18
|
return /^[a-z]:\\windows\\(?:system32|sysnative)\\bash\.exe$/.test(normalized);
|
|
16
19
|
}
|
|
20
|
+
// Keep in sync with packages/durable/src/env/node.ts.
|
|
21
|
+
// Bash builds for Windows (Git Bash, MSYS2, Cygwin) parse their command line with the Cygwin
|
|
22
|
+
// runtime, which silently cuts quoted arguments after about 8 KB and splits unquoted ones at
|
|
23
|
+
// newlines (upstream #12340), so `bash -c <command>` can run only part of a command. The command goes in
|
|
24
|
+
// an environment variable instead, which arrives whole or not at all. The runner drops the
|
|
25
|
+
// variable before the command runs so child processes do not inherit it, and fails if it is
|
|
26
|
+
// missing, for callers that still append the command to `args`.
|
|
27
|
+
const WINDOWS_ENV_COMMAND_RUNNER = `__pi_command=\${${SHELL_COMMAND_ENV_VAR}?pi: the command was not passed in ${SHELL_COMMAND_ENV_VAR}}; unset ${SHELL_COMMAND_ENV_VAR}; eval "$__pi_command"`;
|
|
17
28
|
function getBashShellConfig(shell) {
|
|
18
|
-
|
|
29
|
+
if (isLegacyWslBashPath(shell))
|
|
30
|
+
return { shell, args: ["-s"], commandTransport: "stdin" };
|
|
31
|
+
if (process.platform === "win32" && isWindowsBashPath(shell)) {
|
|
32
|
+
return { shell, args: ["-c", WINDOWS_ENV_COMMAND_RUNNER], commandTransport: "env" };
|
|
33
|
+
}
|
|
34
|
+
return { shell, args: ["-c"] };
|
|
35
|
+
}
|
|
36
|
+
// Other custom shells keep argv. The WindowsApps alias is a WSL launcher, which does not pass
|
|
37
|
+
// Windows environment variables into Linux.
|
|
38
|
+
function isWindowsBashPath(path) {
|
|
39
|
+
const normalized = win32.normalize(path).toLowerCase();
|
|
40
|
+
const name = win32.basename(normalized);
|
|
41
|
+
return (name === "bash.exe" || name === "bash") && win32.basename(win32.dirname(normalized)) !== "windowsapps";
|
|
19
42
|
}
|
|
20
43
|
// Matches harness-v2's pathExists (packages/durable/src/env/node.ts).
|
|
21
44
|
// On Unix this is identical to existsSync() (both are access(F_OK)), just
|
|
@@ -66,11 +89,35 @@ function findExecutableOnPath(executable) {
|
|
|
66
89
|
}
|
|
67
90
|
return null;
|
|
68
91
|
}
|
|
92
|
+
// Keep in sync with packages/durable/src/env/node.ts.
|
|
93
|
+
// Git for Windows reports its POSIX shell as `<root>/usr/bin/sh.exe`.
|
|
94
|
+
const GIT_FOR_WINDOWS_SHELL_SUFFIX = win32.join("usr", "bin", "sh.exe");
|
|
95
|
+
/**
|
|
96
|
+
* Find Git Bash of the Git for Windows installation whose git.exe is on PATH. Git itself reports
|
|
97
|
+
* where it is installed (`git var GIT_SHELL_PATH`, Git 2.47+), so this works for any install
|
|
98
|
+
* directory and any PATH layout (`cmd`, `bin`, `mingw64\bin`, `ucrt64\bin`, package-manager shims).
|
|
99
|
+
* It returns `<root>\bin\bash.exe`, not the shell Git reports: that launcher sets up MSYSTEM and
|
|
100
|
+
* PATH, without which `usr\bin\bash.exe` cannot find tools like `ls`.
|
|
101
|
+
*/
|
|
102
|
+
function findGitBashOfGitOnPath() {
|
|
103
|
+
// Windows `where` searches the current directory first; do not probe a repository's git.exe.
|
|
104
|
+
const git = resolveWindowsCommand("git.exe", undefined);
|
|
105
|
+
if (!shellPathExists(git))
|
|
106
|
+
return null;
|
|
107
|
+
const result = spawnSync(git, ["var", "GIT_SHELL_PATH"], { encoding: "utf-8", timeout: 5000, windowsHide: true });
|
|
108
|
+
if (result.status !== 0)
|
|
109
|
+
return null;
|
|
110
|
+
const gitShell = win32.normalize(result.stdout.trim());
|
|
111
|
+
if (!win32.isAbsolute(gitShell) || !gitShell.toLowerCase().endsWith(`\\${GIT_FOR_WINDOWS_SHELL_SUFFIX}`))
|
|
112
|
+
return null;
|
|
113
|
+
const bash = win32.join(gitShell.slice(0, -GIT_FOR_WINDOWS_SHELL_SUFFIX.length), "bin", "bash.exe");
|
|
114
|
+
return shellPathExists(bash) ? bash : null;
|
|
115
|
+
}
|
|
69
116
|
/**
|
|
70
117
|
* Resolve shell configuration based on platform and an optional explicit shell path.
|
|
71
118
|
* Resolution order:
|
|
72
119
|
* 1. User-specified shellPath
|
|
73
|
-
* 2. On Windows: Git Bash in known locations, then bash on PATH
|
|
120
|
+
* 2. On Windows: Git Bash in known locations, then Git Bash of git on PATH, then bash on PATH
|
|
74
121
|
* 3. On Unix: /bin/bash, then bash on PATH, then fallback to sh
|
|
75
122
|
*/
|
|
76
123
|
export function getShellConfig(customShellPath) {
|
|
@@ -97,7 +144,13 @@ export function getShellConfig(customShellPath) {
|
|
|
97
144
|
return getBashShellConfig(path);
|
|
98
145
|
}
|
|
99
146
|
}
|
|
100
|
-
// 3.
|
|
147
|
+
// 3. Git Bash installed elsewhere, found through git on PATH. This must precede the generic
|
|
148
|
+
// bash.exe lookup, which usually finds the WSL launcher in System32 first.
|
|
149
|
+
const gitBash = findGitBashOfGitOnPath();
|
|
150
|
+
if (gitBash) {
|
|
151
|
+
return getBashShellConfig(gitBash);
|
|
152
|
+
}
|
|
153
|
+
// 4. Fallback: search bash.exe on PATH (Cygwin, MSYS2, WSL, etc.)
|
|
101
154
|
const bashOnPath = findExecutableOnPath("bash.exe");
|
|
102
155
|
if (bashOnPath) {
|
|
103
156
|
return getBashShellConfig(bashOnPath);
|
|
@@ -106,7 +159,8 @@ export function getShellConfig(customShellPath) {
|
|
|
106
159
|
` 1. Install Git for Windows: https://git-scm.com/download/win\n` +
|
|
107
160
|
` 2. Add your bash to PATH (Cygwin, MSYS2, etc.)\n` +
|
|
108
161
|
" 3. Set shellPath in settings.json\n\n" +
|
|
109
|
-
`Searched Git Bash in:\n${paths.map((p) => ` ${p}`).join("\n")}`
|
|
162
|
+
`Searched Git Bash in:\n${paths.map((p) => ` ${p}`).join("\n")}\n` +
|
|
163
|
+
" the Git for Windows installation of git.exe on PATH");
|
|
110
164
|
}
|
|
111
165
|
// Unix: try /bin/bash, then bash on PATH, then fallback to sh
|
|
112
166
|
if (shellPathExists("/bin/bash")) {
|
|
@@ -332,8 +386,20 @@ export function killTrackedDetachedChildren(graceMs = TERMINATION_GRACE_MS) {
|
|
|
332
386
|
for (const record of records)
|
|
333
387
|
record.terminationRequested = true;
|
|
334
388
|
if (process.platform === "win32") {
|
|
335
|
-
|
|
336
|
-
|
|
389
|
+
const pidArgs = [];
|
|
390
|
+
for (const record of records) {
|
|
391
|
+
const target = processTreeTarget(record);
|
|
392
|
+
if (target !== undefined)
|
|
393
|
+
pidArgs.push("/PID", String(target));
|
|
394
|
+
}
|
|
395
|
+
// Let taskkill walk each still-owned tree before Node exits and kills its shell leader.
|
|
396
|
+
if (pidArgs.length > 0) {
|
|
397
|
+
spawnSync(getTaskkillPath(), ["/F", "/T", ...pidArgs], {
|
|
398
|
+
stdio: "ignore",
|
|
399
|
+
timeout: 2000,
|
|
400
|
+
windowsHide: true,
|
|
401
|
+
});
|
|
402
|
+
}
|
|
337
403
|
}
|
|
338
404
|
else {
|
|
339
405
|
const sleeper = new Int32Array(new SharedArrayBuffer(4));
|
|
@@ -366,6 +432,10 @@ export function killTrackedDetachedChildren(graceMs = TERMINATION_GRACE_MS) {
|
|
|
366
432
|
for (const record of records)
|
|
367
433
|
processTreeTarget(record);
|
|
368
434
|
}
|
|
435
|
+
// Use the trusted System32 executable so cleanup does not depend on PATH.
|
|
436
|
+
function getTaskkillPath() {
|
|
437
|
+
return join(process.env.SystemRoot || "C:\\Windows", "System32", "taskkill.exe");
|
|
438
|
+
}
|
|
369
439
|
/**
|
|
370
440
|
* Kill a process and all its children (cross-platform)
|
|
371
441
|
*/
|
|
@@ -375,9 +445,8 @@ export function killProcessTree(pid, child) {
|
|
|
375
445
|
if (!record || (child && record.child !== child) || processTreeTarget(record) === undefined)
|
|
376
446
|
return;
|
|
377
447
|
if (process.platform === "win32") {
|
|
378
|
-
// Use the trusted System32 executable so cleanup does not depend on PATH.
|
|
379
448
|
try {
|
|
380
|
-
const child = spawn(
|
|
449
|
+
const child = spawn(getTaskkillPath(), ["/F", "/T", "/PID", String(pid)], {
|
|
381
450
|
stdio: "ignore",
|
|
382
451
|
detached: true,
|
|
383
452
|
windowsHide: true,
|
package/dist/utils/shell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAqB,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQzC,sDAAsD;AACtD,SAAS,mBAAmB,CAAC,IAAY;IACxC,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,WAAW,EA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,CAAC,CAAC,EACjC;gBACC,KAAK,EAAE,QAAQ;gBACf,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,IAAI;aACjB,CACD,CAAC;YACF,kFAAkF;YAClF,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACR,mCAAmC;QACpC,CAAC;IACF,CAAC;SAAM,CAAC;QACP,mGAAmG;QACnG,KAAK,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;AACF,CAAC","sourcesContent":["import { accessSync, constants } from \"node:fs\";\nimport { delimiter, join, win32 } from \"node:path\";\nimport { type ChildProcess, spawn, spawnSync } from \"child_process\";\nimport { getBinDir } from \"../config.ts\";\n\nexport interface ShellConfig {\n\tshell: string;\n\targs: string[];\n\tcommandTransport?: \"argv\" | \"stdin\";\n}\n\n// Keep in sync with packages/durable/src/env/node.ts.\nfunction isLegacyWslBashPath(path: string): boolean {\n\tconst normalized = win32.normalize(path).toLowerCase();\n\tconst systemRoot = process.env.SystemRoot;\n\tif (systemRoot) {\n\t\tif (!/^[a-z]:[\\\\/]/i.test(systemRoot)) return false;\n\t\treturn [\"System32\", \"Sysnative\"].some(\n\t\t\t(directory) => normalized === win32.join(systemRoot, directory, \"bash.exe\").toLowerCase(),\n\t\t);\n\t}\n\t// Fall back to conventional launcher paths only when the Windows directory is unknown.\n\treturn /^[a-z]:\\\\windows\\\\(?:system32|sysnative)\\\\bash\\.exe$/.test(normalized);\n}\n\nfunction getBashShellConfig(shell: string): ShellConfig {\n\treturn isLegacyWslBashPath(shell) ? { shell, args: [\"-s\"], commandTransport: \"stdin\" } : { shell, args: [\"-c\"] };\n}\n\n// Matches harness-v2's pathExists (packages/durable/src/env/node.ts).\n// On Unix this is identical to existsSync() (both are access(F_OK)), just\n// spelled with try/catch. On Windows we explicitly avoid existsSync(): its\n// extra stat check rejects runnable Store aliases (nodejs/node#36790).\nfunction shellPathExists(path: string): boolean {\n\ttry {\n\t\taccessSync(path, constants.F_OK);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction findExecutableOnPath(executable: string): string | null {\n\tif (process.platform === \"win32\") {\n\t\t// Windows: use 'where' and check the returned path.\n\t\ttry {\n\t\t\tconst result = spawnSync(\"where\", [executable], {\n\t\t\t\tencoding: \"utf-8\",\n\t\t\t\ttimeout: 5000,\n\t\t\t\twindowsHide: true,\n\t\t\t});\n\t\t\tif (result.status === 0 && result.stdout) {\n\t\t\t\tconst firstMatch = result.stdout.trim().split(/\\r?\\n/)[0];\n\t\t\t\tif (firstMatch && shellPathExists(firstMatch)) {\n\t\t\t\t\treturn firstMatch;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore errors\n\t\t}\n\t\treturn null;\n\t}\n\n\t// Unix: Use 'which' and trust its output (handles Termux and special filesystems)\n\ttry {\n\t\tconst result = spawnSync(\"which\", [executable], { encoding: \"utf-8\", timeout: 5000 });\n\t\tif (result.status === 0 && result.stdout) {\n\t\t\tconst firstMatch = result.stdout.trim().split(/\\r?\\n/)[0];\n\t\t\tif (firstMatch) {\n\t\t\t\treturn firstMatch;\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Ignore errors\n\t}\n\treturn null;\n}\n\n/**\n * Resolve shell configuration based on platform and an optional explicit shell path.\n * Resolution order:\n * 1. User-specified shellPath\n * 2. On Windows: Git Bash in known locations, then bash on PATH\n * 3. On Unix: /bin/bash, then bash on PATH, then fallback to sh\n */\nexport function getShellConfig(customShellPath?: string): ShellConfig {\n\t// 1. Check user-specified shell path\n\tif (customShellPath) {\n\t\tif (shellPathExists(customShellPath)) {\n\t\t\treturn getBashShellConfig(customShellPath);\n\t\t}\n\t\tthrow new Error(`Custom shell path not found: ${customShellPath}`);\n\t}\n\n\tif (process.platform === \"win32\") {\n\t\t// 2. Try Git Bash in known locations\n\t\tconst paths: string[] = [];\n\t\tconst programFiles = process.env.ProgramFiles;\n\t\tif (programFiles) {\n\t\t\tpaths.push(`${programFiles}\\\\Git\\\\bin\\\\bash.exe`);\n\t\t}\n\t\tconst programFilesX86 = process.env[\"ProgramFiles(x86)\"];\n\t\tif (programFilesX86) {\n\t\t\tpaths.push(`${programFilesX86}\\\\Git\\\\bin\\\\bash.exe`);\n\t\t}\n\n\t\tfor (const path of paths) {\n\t\t\tif (shellPathExists(path)) {\n\t\t\t\treturn getBashShellConfig(path);\n\t\t\t}\n\t\t}\n\n\t\t// 3. Fallback: search bash.exe on PATH (Cygwin, MSYS2, WSL, etc.)\n\t\tconst bashOnPath = findExecutableOnPath(\"bash.exe\");\n\t\tif (bashOnPath) {\n\t\t\treturn getBashShellConfig(bashOnPath);\n\t\t}\n\n\t\tthrow new Error(\n\t\t\t`No bash shell found. Options:\\n` +\n\t\t\t\t` 1. Install Git for Windows: https://git-scm.com/download/win\\n` +\n\t\t\t\t` 2. Add your bash to PATH (Cygwin, MSYS2, etc.)\\n` +\n\t\t\t\t\" 3. Set shellPath in settings.json\\n\\n\" +\n\t\t\t\t`Searched Git Bash in:\\n${paths.map((p) => ` ${p}`).join(\"\\n\")}`,\n\t\t);\n\t}\n\n\t// Unix: try /bin/bash, then bash on PATH, then fallback to sh\n\tif (shellPathExists(\"/bin/bash\")) {\n\t\treturn getBashShellConfig(\"/bin/bash\");\n\t}\n\n\tconst bashOnPath = findExecutableOnPath(\"bash\");\n\tif (bashOnPath) {\n\t\treturn getBashShellConfig(bashOnPath);\n\t}\n\n\treturn { shell: \"sh\", args: [\"-c\"] };\n}\n\nexport const POWERSHELL_ARGS = [\"-NoProfile\", \"-NonInteractive\", \"-ExecutionPolicy\", \"Bypass\", \"-Command\"] as const;\n\n/** Resolve PowerShell on Windows, preferring PowerShell 7 when available. */\nexport function getPowerShellConfig(): ShellConfig {\n\tif (process.platform !== \"win32\") {\n\t\tthrow new Error(\"The powershell tool is only available on Windows.\");\n\t}\n\n\tlet shell = findExecutableOnPath(\"pwsh.exe\");\n\t// Installation directories may be on any drive and need not be on PATH.\n\tconst programFiles = process.env.ProgramFiles;\n\tif (!shell && programFiles) {\n\t\tconst pwsh7 = win32.join(programFiles, \"PowerShell\", \"7\", \"pwsh.exe\");\n\t\tif (shellPathExists(pwsh7)) shell = pwsh7;\n\t}\n\n\tshell ??= findExecutableOnPath(\"powershell.exe\");\n\tconst systemRoot = process.env.SystemRoot;\n\tif (!shell && systemRoot) {\n\t\tconst windowsPowerShell = win32.join(systemRoot, \"System32\", \"WindowsPowerShell\", \"v1.0\", \"powershell.exe\");\n\t\tif (shellPathExists(windowsPowerShell)) shell = windowsPowerShell;\n\t}\n\n\tif (!shell) {\n\t\tthrow new Error(\"No PowerShell executable found. Install PowerShell or add powershell.exe/pwsh.exe to PATH.\");\n\t}\n\n\treturn { shell, args: [...POWERSHELL_ARGS] };\n}\n\nexport function getShellEnv(environment: NodeJS.ProcessEnv = process.env): NodeJS.ProcessEnv {\n\tconst binDir = getBinDir();\n\tconst pathKey = Object.keys(environment).find((key) => key.toLowerCase() === \"path\") ?? \"PATH\";\n\tconst currentPath = environment[pathKey] ?? \"\";\n\tconst pathEntries = currentPath.split(delimiter).filter(Boolean);\n\tconst hasBinDir = pathEntries.includes(binDir);\n\tconst updatedPath = hasBinDir ? currentPath : [binDir, currentPath].filter(Boolean).join(delimiter);\n\n\treturn {\n\t\t...environment,\n\t\t[pathKey]: updatedPath,\n\t};\n}\n\n/**\n * Sanitize binary output for display/storage.\n * Removes characters that crash string-width or cause display issues:\n * - Control characters (except tab, newline, carriage return), DEL, and C1 controls (U+0080..U+009F, which some\n * terminals act on as escape sequences: U+009B starts a CSI sequence, U+009D an OSC one)\n * - Unicode interlinear annotation characters U+FFF9..U+FFFB (crash string-width due to a bug)\n */\nexport function sanitizeBinaryOutput(str: string): string {\n\t// All removed characters are single UTF-16 code units, so surrogate pairs are never split.\n\treturn str.replace(/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F-\\x9F\\uFFF9-\\uFFFB]/g, \"\");\n}\n\nconst terminationCleanups: Array<() => void> = [];\n\n/** Run synchronous library cleanup without taking over a host's signal disposition. */\nexport function onTerminationSignal(cleanup: () => void): void {\n\tterminationCleanups.push(cleanup);\n\tif (terminationCleanups.length !== 1) return;\n\n\tfor (const signal of [\"SIGINT\", \"SIGTERM\", \"SIGHUP\"] as const) {\n\t\tconst handler = () => {\n\t\t\tfor (const callback of terminationCleanups) callback();\n\t\t\t// The other library cleanups are callbacks, not competing shutdown owners.\n\t\t\tif (process.listenerCount(signal) === 1) {\n\t\t\t\tprocess.removeListener(signal, handler);\n\t\t\t\tprocess.kill(process.pid, signal);\n\t\t\t}\n\t\t};\n\t\tprocess.prependListener(signal, handler);\n\t}\n}\n\n/**\n * Detached child processes must be tracked so they can be killed on parent\n * shutdown signals (SIGHUP/SIGTERM/SIGINT).\n */\ninterface OwnedChild {\n\tpid: number;\n\tchild?: ChildProcess;\n\ttermination?: Promise<boolean>;\n\tterminationRequested?: boolean;\n\treleased?: boolean;\n}\n\nconst trackedDetachedChildren = new Map<number, OwnedChild>();\nconst TERMINATION_GRACE_MS = 1500;\nconst TERMINATION_CONFIRM_MS = 500;\nconst TERMINATION_POLL_MS = 20;\nlet custodyMonitor: NodeJS.Timeout | undefined;\n\nfunction releaseChild(record: OwnedChild): void {\n\trecord.released = true;\n\tif (trackedDetachedChildren.get(record.pid) === record) trackedDetachedChildren.delete(record.pid);\n\tif (trackedDetachedChildren.size === 0 && custodyMonitor) {\n\t\tclearInterval(custodyMonitor);\n\t\tcustodyMonitor = undefined;\n\t}\n}\n\nfunction validatePid(pid: number): void {\n\tif (!Number.isSafeInteger(pid) || pid <= 1 || pid === process.pid) {\n\t\tthrow new RangeError(\"Expected an owned child pid greater than 1\");\n\t}\n}\n\nfunction isProcessAlive(pid: number): boolean {\n\ttry {\n\t\tprocess.kill(pid, 0);\n\t\treturn true;\n\t} catch (error) {\n\t\t// EPERM and other errors are not confirmation of termination.\n\t\treturn (error as NodeJS.ErrnoException).code !== \"ESRCH\";\n\t}\n}\n\nfunction processTreeTarget(record: OwnedChild): number | undefined {\n\tconst { pid, child } = record;\n\tif (record.released || trackedDetachedChildren.get(pid) !== record) return undefined;\n\tconst leaderRunning = child && child.exitCode === null && child.signalCode === null;\n\t// POSIX has no stable process-group handle: PGID reuse between probes cannot be detected.\n\t// Once absence is observed we release custody, but reuse before that probe remains a platform limitation.\n\tif (process.platform !== \"win32\" && isProcessAlive(-pid)) return -pid;\n\t// An exited leader's absent group releases custody permanently, even during output drain.\n\t// Probe a still-running leader too: a non-detached child has no group of its own.\n\tif ((leaderRunning || (process.platform === \"win32\" && !child)) && isProcessAlive(pid)) return pid;\n\treleaseChild(record);\n\treturn undefined;\n}\n\nfunction signalProcess(target: number, signal: NodeJS.Signals, child?: ChildProcess): void {\n\tif (process.platform === \"darwin\" && target < 0 && signal === \"SIGKILL\") {\n\t\t// macOS can wake a waiting shell before signalling it; stop the group before escalation (#11252).\n\t\ttry {\n\t\t\tprocess.kill(target, \"SIGSTOP\");\n\t\t} catch {\n\t\t\t// A failed stop must not prevent the kill attempt.\n\t\t}\n\t}\n\ttry {\n\t\tif (target > 0 && child) child.kill(signal);\n\t\telse process.kill(target, signal);\n\t} catch {\n\t\t// Races and permission failures are resolved by the subsequent liveness check.\n\t}\n}\n\nexport function trackDetachedChildPid(pid: number, child?: ChildProcess): void {\n\tvalidatePid(pid);\n\tif (child && child.pid !== pid) throw new RangeError(\"ChildProcess pid does not match\");\n\tconst record = { pid, child };\n\ttrackedDetachedChildren.set(pid, record);\n\tchild?.once(\"exit\", () => processTreeTarget(record));\n\tcustodyMonitor ??= setInterval(() => {\n\t\tfor (const owned of trackedDetachedChildren.values()) processTreeTarget(owned);\n\t}, 250).unref();\n}\n\n/** Probe only this owned process identity, releasing custody after confirmed group absence. */\nexport function hasTrackedProcessEffects(pid: number, child: ChildProcess): boolean {\n\tconst record = trackedDetachedChildren.get(pid);\n\treturn record?.child === child && processTreeTarget(record) !== undefined;\n}\n\nexport function untrackDetachedChildPid(pid: number, child?: ChildProcess): void {\n\tvalidatePid(pid);\n\tconst record = trackedDetachedChildren.get(pid);\n\tif (child && record?.child !== child) return;\n\t// Normal completion releases background jobs; failed active termination retains custody.\n\tif (record && !record.terminationRequested) releaseChild(record);\n}\n\n/** Terminate an owned process group, allowing launchers to clean detached descendants. */\nexport function killProcessTreeAsync(\n\tpid: number,\n\tgraceMs = TERMINATION_GRACE_MS,\n\tchild?: ChildProcess,\n): Promise<boolean> {\n\tvalidatePid(pid);\n\tif (!Number.isFinite(graceMs) || graceMs < 0) throw new RangeError(\"Invalid termination grace period\");\n\tconst record = trackedDetachedChildren.get(pid);\n\tif (!record || (child && record.child !== child)) return Promise.resolve(true);\n\tif (record.termination) return record.termination;\n\n\trecord.terminationRequested = true;\n\tconst termination = (async () => {\n\t\tif (process.platform === \"win32\") killProcessTree(pid);\n\t\tfor (const signal of [\"SIGTERM\", \"SIGKILL\"] as const) {\n\t\t\tif (trackedDetachedChildren.get(pid) !== record) return true;\n\t\t\tconst target = processTreeTarget(record);\n\t\t\tif (target === undefined) return true;\n\t\t\tif (process.platform !== \"win32\") signalProcess(target, signal, record.child);\n\t\t\tconst deadline = performance.now() + (signal === \"SIGTERM\" ? graceMs : TERMINATION_CONFIRM_MS);\n\t\t\twhile (processTreeTarget(record) !== undefined && performance.now() < deadline) {\n\t\t\t\tawait new Promise<void>((resolve) => setTimeout(resolve, TERMINATION_POLL_MS));\n\t\t\t\tif (trackedDetachedChildren.get(pid) !== record) return true;\n\t\t\t}\n\t\t\tif (processTreeTarget(record) === undefined) return true;\n\t\t}\n\t\treturn false;\n\t})().then((confirmed) => {\n\t\tif (confirmed) releaseChild(record);\n\t\telse record.termination = undefined;\n\t\treturn confirmed;\n\t});\n\trecord.termination = termination;\n\treturn termination;\n}\n\n/** Signal every tracked group before waiting; the total bound is independent of group count. */\nexport async function killTrackedDetachedChildrenAsync(graceMs = TERMINATION_GRACE_MS): Promise<boolean> {\n\tconst results = await Promise.all(\n\t\t[...trackedDetachedChildren.keys()].map((pid) => killProcessTreeAsync(pid, graceMs)),\n\t);\n\treturn results.every(Boolean);\n}\n\n/** Last-resort shutdown when the caller must exit synchronously. */\nexport function killTrackedDetachedChildren(graceMs = TERMINATION_GRACE_MS): void {\n\tif (!Number.isFinite(graceMs) || graceMs < 0) throw new RangeError(\"Invalid termination grace period\");\n\tconst records = [...trackedDetachedChildren.values()];\n\tfor (const record of records) record.terminationRequested = true;\n\tif (process.platform === \"win32\") {\n\t\tfor (const record of records) killProcessTree(record.pid);\n\t} else {\n\t\tconst sleeper = new Int32Array(new SharedArrayBuffer(4));\n\t\tfor (const signal of [\"SIGTERM\", \"SIGKILL\"] as const) {\n\t\t\tfor (const record of records) {\n\t\t\t\tconst target = processTreeTarget(record);\n\t\t\t\tif (target === undefined) continue;\n\t\t\t\t// A second TERM can interrupt a launcher's one-shot cleanup handler.\n\t\t\t\tif (signal === \"SIGTERM\" && record.termination) continue;\n\t\t\t\tif (isProcessAlive(target)) signalProcess(target, signal, record.child);\n\t\t\t}\n\t\t\tconst deadline = performance.now() + (signal === \"SIGTERM\" ? graceMs : TERMINATION_CONFIRM_MS);\n\t\t\twhile (true) {\n\t\t\t\tlet alive = false;\n\t\t\t\t// The monitor cannot run during Atomics.wait; probe and release every record here.\n\t\t\t\tfor (const record of records) {\n\t\t\t\t\tif (processTreeTarget(record) !== undefined) alive = true;\n\t\t\t\t}\n\t\t\t\tif (!alive || performance.now() >= deadline) break;\n\t\t\t\tAtomics.wait(sleeper, 0, 0, TERMINATION_POLL_MS);\n\t\t\t}\n\t\t}\n\t}\n\t// A bounded wait is not confirmation. The shared monitor retains and probes failed records.\n\tfor (const record of records) processTreeTarget(record);\n}\n\n/**\n * Kill a process and all its children (cross-platform)\n */\nexport function killProcessTree(pid: number, child?: ChildProcess): void {\n\tvalidatePid(pid);\n\tconst record = trackedDetachedChildren.get(pid);\n\tif (!record || (child && record.child !== child) || processTreeTarget(record) === undefined) return;\n\tif (process.platform === \"win32\") {\n\t\t// Use the trusted System32 executable so cleanup does not depend on PATH.\n\t\ttry {\n\t\t\tconst child = spawn(\n\t\t\t\tjoin(process.env.SystemRoot || \"C:\\\\Windows\", \"System32\", \"taskkill.exe\"),\n\t\t\t\t[\"/F\", \"/T\", \"/PID\", String(pid)],\n\t\t\t\t{\n\t\t\t\t\tstdio: \"ignore\",\n\t\t\t\t\tdetached: true,\n\t\t\t\t\twindowsHide: true,\n\t\t\t\t},\n\t\t\t);\n\t\t\t// A failed spawn emits \"error\" asynchronously; consume it to avoid crashing Node.\n\t\t\tchild.once(\"error\", () => {});\n\t\t} catch {\n\t\t\t// Ignore errors if taskkill fails.\n\t\t}\n\t} else {\n\t\t// Preserve the synchronous API for abort/timeout callbacks; escalation keeps the event loop alive.\n\t\tvoid killProcessTreeAsync(pid);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAqB,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAS3D,wFAAwF;AACxF,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEvD,sDAAsD;AACtD,SAAS,mBAAmB,CAAC,IAAY;IACxC,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IACvD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;IAC1C,IAAI,UAAU,EAAE,CAAC;QAChB,IAAI,CAAC,eAAe,CAAC,I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,IAAI;gBACd,WAAW,EAAE,IAAI;aACjB,CAAC,CAAC;YACH,kFAAkF;YAClF,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACR,mCAAmC;QACpC,CAAC;IACF,CAAC;SAAM,CAAC;QACP,mGAAmG;QACnG,KAAK,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;AACF,CAAC","sourcesContent":["import { accessSync, constants } from \"node:fs\";\nimport { delimiter, join, win32 } from \"node:path\";\nimport { type ChildProcess, spawn, spawnSync } from \"child_process\";\nimport { getBinDir } from \"../config.ts\";\nimport { resolveWindowsCommand } from \"./child-process.ts\";\n\nexport interface ShellConfig {\n\tshell: string;\n\targs: string[];\n\t/** How the command reaches the shell: appended to `args` (default), written to stdin, or set in `SHELL_COMMAND_ENV_VAR`. */\n\tcommandTransport?: \"argv\" | \"stdin\" | \"env\";\n}\n\n/** Environment variable that carries the command when `commandTransport` is `\"env\"`. */\nexport const SHELL_COMMAND_ENV_VAR = \"PI_BASH_COMMAND\";\n\n// Keep in sync with packages/durable/src/env/node.ts.\nfunction isLegacyWslBashPath(path: string): boolean {\n\tconst normalized = win32.normalize(path).toLowerCase();\n\tconst systemRoot = process.env.SystemRoot;\n\tif (systemRoot) {\n\t\tif (!/^[a-z]:[\\\\/]/i.test(systemRoot)) return false;\n\t\treturn [\"System32\", \"Sysnative\"].some(\n\t\t\t(directory) => normalized === win32.join(systemRoot, directory, \"bash.exe\").toLowerCase(),\n\t\t);\n\t}\n\t// Fall back to conventional launcher paths only when the Windows directory is unknown.\n\treturn /^[a-z]:\\\\windows\\\\(?:system32|sysnative)\\\\bash\\.exe$/.test(normalized);\n}\n\n// Keep in sync with packages/durable/src/env/node.ts.\n// Bash builds for Windows (Git Bash, MSYS2, Cygwin) parse their command line with the Cygwin\n// runtime, which silently cuts quoted arguments after about 8 KB and splits unquoted ones at\n// newlines (upstream #12340), so `bash -c <command>` can run only part of a command. The command goes in\n// an environment variable instead, which arrives whole or not at all. The runner drops the\n// variable before the command runs so child processes do not inherit it, and fails if it is\n// missing, for callers that still append the command to `args`.\nconst WINDOWS_ENV_COMMAND_RUNNER = `__pi_command=\\${${SHELL_COMMAND_ENV_VAR}?pi: the command was not passed in ${SHELL_COMMAND_ENV_VAR}}; unset ${SHELL_COMMAND_ENV_VAR}; eval \"$__pi_command\"`;\n\nfunction getBashShellConfig(shell: string): ShellConfig {\n\tif (isLegacyWslBashPath(shell)) return { shell, args: [\"-s\"], commandTransport: \"stdin\" };\n\tif (process.platform === \"win32\" && isWindowsBashPath(shell)) {\n\t\treturn { shell, args: [\"-c\", WINDOWS_ENV_COMMAND_RUNNER], commandTransport: \"env\" };\n\t}\n\treturn { shell, args: [\"-c\"] };\n}\n\n// Other custom shells keep argv. The WindowsApps alias is a WSL launcher, which does not pass\n// Windows environment variables into Linux.\nfunction isWindowsBashPath(path: string): boolean {\n\tconst normalized = win32.normalize(path).toLowerCase();\n\tconst name = win32.basename(normalized);\n\treturn (name === \"bash.exe\" || name === \"bash\") && win32.basename(win32.dirname(normalized)) !== \"windowsapps\";\n}\n\n// Matches harness-v2's pathExists (packages/durable/src/env/node.ts).\n// On Unix this is identical to existsSync() (both are access(F_OK)), just\n// spelled with try/catch. On Windows we explicitly avoid existsSync(): its\n// extra stat check rejects runnable Store aliases (nodejs/node#36790).\nfunction shellPathExists(path: string): boolean {\n\ttry {\n\t\taccessSync(path, constants.F_OK);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction findExecutableOnPath(executable: string): string | null {\n\tif (process.platform === \"win32\") {\n\t\t// Windows: use 'where' and check the returned path.\n\t\ttry {\n\t\t\tconst result = spawnSync(\"where\", [executable], {\n\t\t\t\tencoding: \"utf-8\",\n\t\t\t\ttimeout: 5000,\n\t\t\t\twindowsHide: true,\n\t\t\t});\n\t\t\tif (result.status === 0 && result.stdout) {\n\t\t\t\tconst firstMatch = result.stdout.trim().split(/\\r?\\n/)[0];\n\t\t\t\tif (firstMatch && shellPathExists(firstMatch)) {\n\t\t\t\t\treturn firstMatch;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore errors\n\t\t}\n\t\treturn null;\n\t}\n\n\t// Unix: Use 'which' and trust its output (handles Termux and special filesystems)\n\ttry {\n\t\tconst result = spawnSync(\"which\", [executable], { encoding: \"utf-8\", timeout: 5000 });\n\t\tif (result.status === 0 && result.stdout) {\n\t\t\tconst firstMatch = result.stdout.trim().split(/\\r?\\n/)[0];\n\t\t\tif (firstMatch) {\n\t\t\t\treturn firstMatch;\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Ignore errors\n\t}\n\treturn null;\n}\n\n// Keep in sync with packages/durable/src/env/node.ts.\n// Git for Windows reports its POSIX shell as `<root>/usr/bin/sh.exe`.\nconst GIT_FOR_WINDOWS_SHELL_SUFFIX = win32.join(\"usr\", \"bin\", \"sh.exe\");\n\n/**\n * Find Git Bash of the Git for Windows installation whose git.exe is on PATH. Git itself reports\n * where it is installed (`git var GIT_SHELL_PATH`, Git 2.47+), so this works for any install\n * directory and any PATH layout (`cmd`, `bin`, `mingw64\\bin`, `ucrt64\\bin`, package-manager shims).\n * It returns `<root>\\bin\\bash.exe`, not the shell Git reports: that launcher sets up MSYSTEM and\n * PATH, without which `usr\\bin\\bash.exe` cannot find tools like `ls`.\n */\nfunction findGitBashOfGitOnPath(): string | null {\n\t// Windows `where` searches the current directory first; do not probe a repository's git.exe.\n\tconst git = resolveWindowsCommand(\"git.exe\", undefined);\n\tif (!shellPathExists(git)) return null;\n\tconst result = spawnSync(git, [\"var\", \"GIT_SHELL_PATH\"], { encoding: \"utf-8\", timeout: 5000, windowsHide: true });\n\tif (result.status !== 0) return null;\n\tconst gitShell = win32.normalize(result.stdout.trim());\n\tif (!win32.isAbsolute(gitShell) || !gitShell.toLowerCase().endsWith(`\\\\${GIT_FOR_WINDOWS_SHELL_SUFFIX}`))\n\t\treturn null;\n\tconst bash = win32.join(gitShell.slice(0, -GIT_FOR_WINDOWS_SHELL_SUFFIX.length), \"bin\", \"bash.exe\");\n\treturn shellPathExists(bash) ? bash : null;\n}\n\n/**\n * Resolve shell configuration based on platform and an optional explicit shell path.\n * Resolution order:\n * 1. User-specified shellPath\n * 2. On Windows: Git Bash in known locations, then Git Bash of git on PATH, then bash on PATH\n * 3. On Unix: /bin/bash, then bash on PATH, then fallback to sh\n */\nexport function getShellConfig(customShellPath?: string): ShellConfig {\n\t// 1. Check user-specified shell path\n\tif (customShellPath) {\n\t\tif (shellPathExists(customShellPath)) {\n\t\t\treturn getBashShellConfig(customShellPath);\n\t\t}\n\t\tthrow new Error(`Custom shell path not found: ${customShellPath}`);\n\t}\n\n\tif (process.platform === \"win32\") {\n\t\t// 2. Try Git Bash in known locations\n\t\tconst paths: string[] = [];\n\t\tconst programFiles = process.env.ProgramFiles;\n\t\tif (programFiles) {\n\t\t\tpaths.push(`${programFiles}\\\\Git\\\\bin\\\\bash.exe`);\n\t\t}\n\t\tconst programFilesX86 = process.env[\"ProgramFiles(x86)\"];\n\t\tif (programFilesX86) {\n\t\t\tpaths.push(`${programFilesX86}\\\\Git\\\\bin\\\\bash.exe`);\n\t\t}\n\n\t\tfor (const path of paths) {\n\t\t\tif (shellPathExists(path)) {\n\t\t\t\treturn getBashShellConfig(path);\n\t\t\t}\n\t\t}\n\n\t\t// 3. Git Bash installed elsewhere, found through git on PATH. This must precede the generic\n\t\t// bash.exe lookup, which usually finds the WSL launcher in System32 first.\n\t\tconst gitBash = findGitBashOfGitOnPath();\n\t\tif (gitBash) {\n\t\t\treturn getBashShellConfig(gitBash);\n\t\t}\n\n\t\t// 4. Fallback: search bash.exe on PATH (Cygwin, MSYS2, WSL, etc.)\n\t\tconst bashOnPath = findExecutableOnPath(\"bash.exe\");\n\t\tif (bashOnPath) {\n\t\t\treturn getBashShellConfig(bashOnPath);\n\t\t}\n\n\t\tthrow new Error(\n\t\t\t`No bash shell found. Options:\\n` +\n\t\t\t\t` 1. Install Git for Windows: https://git-scm.com/download/win\\n` +\n\t\t\t\t` 2. Add your bash to PATH (Cygwin, MSYS2, etc.)\\n` +\n\t\t\t\t\" 3. Set shellPath in settings.json\\n\\n\" +\n\t\t\t\t`Searched Git Bash in:\\n${paths.map((p) => ` ${p}`).join(\"\\n\")}\\n` +\n\t\t\t\t\" the Git for Windows installation of git.exe on PATH\",\n\t\t);\n\t}\n\n\t// Unix: try /bin/bash, then bash on PATH, then fallback to sh\n\tif (shellPathExists(\"/bin/bash\")) {\n\t\treturn getBashShellConfig(\"/bin/bash\");\n\t}\n\n\tconst bashOnPath = findExecutableOnPath(\"bash\");\n\tif (bashOnPath) {\n\t\treturn getBashShellConfig(bashOnPath);\n\t}\n\n\treturn { shell: \"sh\", args: [\"-c\"] };\n}\n\nexport const POWERSHELL_ARGS = [\"-NoProfile\", \"-NonInteractive\", \"-ExecutionPolicy\", \"Bypass\", \"-Command\"] as const;\n\n/** Resolve PowerShell on Windows, preferring PowerShell 7 when available. */\nexport function getPowerShellConfig(): ShellConfig {\n\tif (process.platform !== \"win32\") {\n\t\tthrow new Error(\"The powershell tool is only available on Windows.\");\n\t}\n\n\tlet shell = findExecutableOnPath(\"pwsh.exe\");\n\t// Installation directories may be on any drive and need not be on PATH.\n\tconst programFiles = process.env.ProgramFiles;\n\tif (!shell && programFiles) {\n\t\tconst pwsh7 = win32.join(programFiles, \"PowerShell\", \"7\", \"pwsh.exe\");\n\t\tif (shellPathExists(pwsh7)) shell = pwsh7;\n\t}\n\n\tshell ??= findExecutableOnPath(\"powershell.exe\");\n\tconst systemRoot = process.env.SystemRoot;\n\tif (!shell && systemRoot) {\n\t\tconst windowsPowerShell = win32.join(systemRoot, \"System32\", \"WindowsPowerShell\", \"v1.0\", \"powershell.exe\");\n\t\tif (shellPathExists(windowsPowerShell)) shell = windowsPowerShell;\n\t}\n\n\tif (!shell) {\n\t\tthrow new Error(\"No PowerShell executable found. Install PowerShell or add powershell.exe/pwsh.exe to PATH.\");\n\t}\n\n\treturn { shell, args: [...POWERSHELL_ARGS] };\n}\n\nexport function getShellEnv(environment: NodeJS.ProcessEnv = process.env): NodeJS.ProcessEnv {\n\tconst binDir = getBinDir();\n\tconst pathKey = Object.keys(environment).find((key) => key.toLowerCase() === \"path\") ?? \"PATH\";\n\tconst currentPath = environment[pathKey] ?? \"\";\n\tconst pathEntries = currentPath.split(delimiter).filter(Boolean);\n\tconst hasBinDir = pathEntries.includes(binDir);\n\tconst updatedPath = hasBinDir ? currentPath : [binDir, currentPath].filter(Boolean).join(delimiter);\n\n\treturn {\n\t\t...environment,\n\t\t[pathKey]: updatedPath,\n\t};\n}\n\n/**\n * Sanitize binary output for display/storage.\n * Removes characters that crash string-width or cause display issues:\n * - Control characters (except tab, newline, carriage return), DEL, and C1 controls (U+0080..U+009F, which some\n * terminals act on as escape sequences: U+009B starts a CSI sequence, U+009D an OSC one)\n * - Unicode interlinear annotation characters U+FFF9..U+FFFB (crash string-width due to a bug)\n */\nexport function sanitizeBinaryOutput(str: string): string {\n\t// All removed characters are single UTF-16 code units, so surrogate pairs are never split.\n\treturn str.replace(/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F-\\x9F\\uFFF9-\\uFFFB]/g, \"\");\n}\n\nconst terminationCleanups: Array<() => void> = [];\n\n/** Run synchronous library cleanup without taking over a host's signal disposition. */\nexport function onTerminationSignal(cleanup: () => void): void {\n\tterminationCleanups.push(cleanup);\n\tif (terminationCleanups.length !== 1) return;\n\n\tfor (const signal of [\"SIGINT\", \"SIGTERM\", \"SIGHUP\"] as const) {\n\t\tconst handler = () => {\n\t\t\tfor (const callback of terminationCleanups) callback();\n\t\t\t// The other library cleanups are callbacks, not competing shutdown owners.\n\t\t\tif (process.listenerCount(signal) === 1) {\n\t\t\t\tprocess.removeListener(signal, handler);\n\t\t\t\tprocess.kill(process.pid, signal);\n\t\t\t}\n\t\t};\n\t\tprocess.prependListener(signal, handler);\n\t}\n}\n\n/**\n * Detached child processes must be tracked so they can be killed on parent\n * shutdown signals (SIGHUP/SIGTERM/SIGINT).\n */\ninterface OwnedChild {\n\tpid: number;\n\tchild?: ChildProcess;\n\ttermination?: Promise<boolean>;\n\tterminationRequested?: boolean;\n\treleased?: boolean;\n}\n\nconst trackedDetachedChildren = new Map<number, OwnedChild>();\nconst TERMINATION_GRACE_MS = 1500;\nconst TERMINATION_CONFIRM_MS = 500;\nconst TERMINATION_POLL_MS = 20;\nlet custodyMonitor: NodeJS.Timeout | undefined;\n\nfunction releaseChild(record: OwnedChild): void {\n\trecord.released = true;\n\tif (trackedDetachedChildren.get(record.pid) === record) trackedDetachedChildren.delete(record.pid);\n\tif (trackedDetachedChildren.size === 0 && custodyMonitor) {\n\t\tclearInterval(custodyMonitor);\n\t\tcustodyMonitor = undefined;\n\t}\n}\n\nfunction validatePid(pid: number): void {\n\tif (!Number.isSafeInteger(pid) || pid <= 1 || pid === process.pid) {\n\t\tthrow new RangeError(\"Expected an owned child pid greater than 1\");\n\t}\n}\n\nfunction isProcessAlive(pid: number): boolean {\n\ttry {\n\t\tprocess.kill(pid, 0);\n\t\treturn true;\n\t} catch (error) {\n\t\t// EPERM and other errors are not confirmation of termination.\n\t\treturn (error as NodeJS.ErrnoException).code !== \"ESRCH\";\n\t}\n}\n\nfunction processTreeTarget(record: OwnedChild): number | undefined {\n\tconst { pid, child } = record;\n\tif (record.released || trackedDetachedChildren.get(pid) !== record) return undefined;\n\tconst leaderRunning = child && child.exitCode === null && child.signalCode === null;\n\t// POSIX has no stable process-group handle: PGID reuse between probes cannot be detected.\n\t// Once absence is observed we release custody, but reuse before that probe remains a platform limitation.\n\tif (process.platform !== \"win32\" && isProcessAlive(-pid)) return -pid;\n\t// An exited leader's absent group releases custody permanently, even during output drain.\n\t// Probe a still-running leader too: a non-detached child has no group of its own.\n\tif ((leaderRunning || (process.platform === \"win32\" && !child)) && isProcessAlive(pid)) return pid;\n\treleaseChild(record);\n\treturn undefined;\n}\n\nfunction signalProcess(target: number, signal: NodeJS.Signals, child?: ChildProcess): void {\n\tif (process.platform === \"darwin\" && target < 0 && signal === \"SIGKILL\") {\n\t\t// macOS can wake a waiting shell before signalling it; stop the group before escalation (#11252).\n\t\ttry {\n\t\t\tprocess.kill(target, \"SIGSTOP\");\n\t\t} catch {\n\t\t\t// A failed stop must not prevent the kill attempt.\n\t\t}\n\t}\n\ttry {\n\t\tif (target > 0 && child) child.kill(signal);\n\t\telse process.kill(target, signal);\n\t} catch {\n\t\t// Races and permission failures are resolved by the subsequent liveness check.\n\t}\n}\n\nexport function trackDetachedChildPid(pid: number, child?: ChildProcess): void {\n\tvalidatePid(pid);\n\tif (child && child.pid !== pid) throw new RangeError(\"ChildProcess pid does not match\");\n\tconst record = { pid, child };\n\ttrackedDetachedChildren.set(pid, record);\n\tchild?.once(\"exit\", () => processTreeTarget(record));\n\tcustodyMonitor ??= setInterval(() => {\n\t\tfor (const owned of trackedDetachedChildren.values()) processTreeTarget(owned);\n\t}, 250).unref();\n}\n\n/** Probe only this owned process identity, releasing custody after confirmed group absence. */\nexport function hasTrackedProcessEffects(pid: number, child: ChildProcess): boolean {\n\tconst record = trackedDetachedChildren.get(pid);\n\treturn record?.child === child && processTreeTarget(record) !== undefined;\n}\n\nexport function untrackDetachedChildPid(pid: number, child?: ChildProcess): void {\n\tvalidatePid(pid);\n\tconst record = trackedDetachedChildren.get(pid);\n\tif (child && record?.child !== child) return;\n\t// Normal completion releases background jobs; failed active termination retains custody.\n\tif (record && !record.terminationRequested) releaseChild(record);\n}\n\n/** Terminate an owned process group, allowing launchers to clean detached descendants. */\nexport function killProcessTreeAsync(\n\tpid: number,\n\tgraceMs = TERMINATION_GRACE_MS,\n\tchild?: ChildProcess,\n): Promise<boolean> {\n\tvalidatePid(pid);\n\tif (!Number.isFinite(graceMs) || graceMs < 0) throw new RangeError(\"Invalid termination grace period\");\n\tconst record = trackedDetachedChildren.get(pid);\n\tif (!record || (child && record.child !== child)) return Promise.resolve(true);\n\tif (record.termination) return record.termination;\n\n\trecord.terminationRequested = true;\n\tconst termination = (async () => {\n\t\tif (process.platform === \"win32\") killProcessTree(pid);\n\t\tfor (const signal of [\"SIGTERM\", \"SIGKILL\"] as const) {\n\t\t\tif (trackedDetachedChildren.get(pid) !== record) return true;\n\t\t\tconst target = processTreeTarget(record);\n\t\t\tif (target === undefined) return true;\n\t\t\tif (process.platform !== \"win32\") signalProcess(target, signal, record.child);\n\t\t\tconst deadline = performance.now() + (signal === \"SIGTERM\" ? graceMs : TERMINATION_CONFIRM_MS);\n\t\t\twhile (processTreeTarget(record) !== undefined && performance.now() < deadline) {\n\t\t\t\tawait new Promise<void>((resolve) => setTimeout(resolve, TERMINATION_POLL_MS));\n\t\t\t\tif (trackedDetachedChildren.get(pid) !== record) return true;\n\t\t\t}\n\t\t\tif (processTreeTarget(record) === undefined) return true;\n\t\t}\n\t\treturn false;\n\t})().then((confirmed) => {\n\t\tif (confirmed) releaseChild(record);\n\t\telse record.termination = undefined;\n\t\treturn confirmed;\n\t});\n\trecord.termination = termination;\n\treturn termination;\n}\n\n/** Signal every tracked group before waiting; the total bound is independent of group count. */\nexport async function killTrackedDetachedChildrenAsync(graceMs = TERMINATION_GRACE_MS): Promise<boolean> {\n\tconst results = await Promise.all(\n\t\t[...trackedDetachedChildren.keys()].map((pid) => killProcessTreeAsync(pid, graceMs)),\n\t);\n\treturn results.every(Boolean);\n}\n\n/** Last-resort shutdown when the caller must exit synchronously. */\nexport function killTrackedDetachedChildren(graceMs = TERMINATION_GRACE_MS): void {\n\tif (!Number.isFinite(graceMs) || graceMs < 0) throw new RangeError(\"Invalid termination grace period\");\n\tconst records = [...trackedDetachedChildren.values()];\n\tfor (const record of records) record.terminationRequested = true;\n\tif (process.platform === \"win32\") {\n\t\tconst pidArgs: string[] = [];\n\t\tfor (const record of records) {\n\t\t\tconst target = processTreeTarget(record);\n\t\t\tif (target !== undefined) pidArgs.push(\"/PID\", String(target));\n\t\t}\n\t\t// Let taskkill walk each still-owned tree before Node exits and kills its shell leader.\n\t\tif (pidArgs.length > 0) {\n\t\t\tspawnSync(getTaskkillPath(), [\"/F\", \"/T\", ...pidArgs], {\n\t\t\t\tstdio: \"ignore\",\n\t\t\t\ttimeout: 2000,\n\t\t\t\twindowsHide: true,\n\t\t\t});\n\t\t}\n\t} else {\n\t\tconst sleeper = new Int32Array(new SharedArrayBuffer(4));\n\t\tfor (const signal of [\"SIGTERM\", \"SIGKILL\"] as const) {\n\t\t\tfor (const record of records) {\n\t\t\t\tconst target = processTreeTarget(record);\n\t\t\t\tif (target === undefined) continue;\n\t\t\t\t// A second TERM can interrupt a launcher's one-shot cleanup handler.\n\t\t\t\tif (signal === \"SIGTERM\" && record.termination) continue;\n\t\t\t\tif (isProcessAlive(target)) signalProcess(target, signal, record.child);\n\t\t\t}\n\t\t\tconst deadline = performance.now() + (signal === \"SIGTERM\" ? graceMs : TERMINATION_CONFIRM_MS);\n\t\t\twhile (true) {\n\t\t\t\tlet alive = false;\n\t\t\t\t// The monitor cannot run during Atomics.wait; probe and release every record here.\n\t\t\t\tfor (const record of records) {\n\t\t\t\t\tif (processTreeTarget(record) !== undefined) alive = true;\n\t\t\t\t}\n\t\t\t\tif (!alive || performance.now() >= deadline) break;\n\t\t\t\tAtomics.wait(sleeper, 0, 0, TERMINATION_POLL_MS);\n\t\t\t}\n\t\t}\n\t}\n\t// A bounded wait is not confirmation. The shared monitor retains and probes failed records.\n\tfor (const record of records) processTreeTarget(record);\n}\n\n// Use the trusted System32 executable so cleanup does not depend on PATH.\nfunction getTaskkillPath(): string {\n\treturn join(process.env.SystemRoot || \"C:\\\\Windows\", \"System32\", \"taskkill.exe\");\n}\n\n/**\n * Kill a process and all its children (cross-platform)\n */\nexport function killProcessTree(pid: number, child?: ChildProcess): void {\n\tvalidatePid(pid);\n\tconst record = trackedDetachedChildren.get(pid);\n\tif (!record || (child && record.child !== child) || processTreeTarget(record) === undefined) return;\n\tif (process.platform === \"win32\") {\n\t\ttry {\n\t\t\tconst child = spawn(getTaskkillPath(), [\"/F\", \"/T\", \"/PID\", String(pid)], {\n\t\t\t\tstdio: \"ignore\",\n\t\t\t\tdetached: true,\n\t\t\t\twindowsHide: true,\n\t\t\t});\n\t\t\t// A failed spawn emits \"error\" asynchronously; consume it to avoid crashing Node.\n\t\t\tchild.once(\"error\", () => {});\n\t\t} catch {\n\t\t\t// Ignore errors if taskkill fails.\n\t\t}\n\t} else {\n\t\t// Preserve the synchronous API for abort/timeout callbacks; escalation keeps the event loop alive.\n\t\tvoid killProcessTreeAsync(pid);\n\t}\n}\n"]}
|
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
declare const eagerLanguages: {
|
|
2
|
+
python: import("highlight.js").LanguageFn;
|
|
3
|
+
java: import("highlight.js").LanguageFn;
|
|
4
|
+
go: import("highlight.js").LanguageFn;
|
|
5
|
+
javascript: import("highlight.js").LanguageFn;
|
|
6
|
+
json: import("highlight.js").LanguageFn;
|
|
7
|
+
cpp: import("highlight.js").LanguageFn;
|
|
8
|
+
typescript: import("highlight.js").LanguageFn;
|
|
9
|
+
php: import("highlight.js").LanguageFn;
|
|
10
|
+
ruby: import("highlight.js").LanguageFn;
|
|
11
|
+
c: import("highlight.js").LanguageFn;
|
|
12
|
+
csharp: import("highlight.js").LanguageFn;
|
|
13
|
+
nix: import("highlight.js").LanguageFn;
|
|
14
|
+
bash: import("highlight.js").LanguageFn;
|
|
15
|
+
rust: import("highlight.js").LanguageFn;
|
|
16
|
+
scala: import("highlight.js").LanguageFn;
|
|
17
|
+
kotlin: import("highlight.js").LanguageFn;
|
|
18
|
+
swift: import("highlight.js").LanguageFn;
|
|
19
|
+
dart: import("highlight.js").LanguageFn;
|
|
20
|
+
groovy: import("highlight.js").LanguageFn;
|
|
21
|
+
perl: import("highlight.js").LanguageFn;
|
|
22
|
+
lua: import("highlight.js").LanguageFn;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Every name an eager grammar answers to (its own and its aliases, lowercase), so that a grammar can be registered when it
|
|
26
|
+
* is first asked for by any of them without running the others' definitions. Exported for its test, which checks it against
|
|
27
|
+
* the grammars.
|
|
28
|
+
*/
|
|
29
|
+
export declare const EAGER_LANGUAGE_ALIASES: Readonly<Record<keyof typeof eagerLanguages, readonly string[]>>;
|
|
1
30
|
export declare function loadAllHighlightLanguages(): Promise<void>;
|
|
2
31
|
export type HighlightFormatter = (text: string) => string;
|
|
3
32
|
export type HighlightTheme = Partial<Record<string, HighlightFormatter>>;
|
|
@@ -18,8 +47,10 @@ export declare function highlight(code: string, options?: HighlightOptions): str
|
|
|
18
47
|
export declare function loadAllHighlightLanguagesOnDemand(onLoaded: (languages: ReadonlySet<string>) => void): void;
|
|
19
48
|
export declare function supportsLanguage(name: string): boolean;
|
|
20
49
|
/**
|
|
21
|
-
* Number of
|
|
22
|
-
* code that embeds another language, such as HTML in a
|
|
50
|
+
* Number of grammars there are: those registered and the eager ones that register when first asked for. It grows when the
|
|
51
|
+
* deferred grammars load, which can change the highlighting of code that embeds another language, such as HTML in a
|
|
52
|
+
* JavaScript template literal.
|
|
23
53
|
*/
|
|
24
54
|
export declare function getHighlightLanguageCount(): number;
|
|
55
|
+
export {};
|
|
25
56
|
//# sourceMappingURL=syntax-highlight.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syntax-highlight.d.ts","sourceRoot":"","sources":["../../src/utils/syntax-highlight.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"syntax-highlight.d.ts","sourceRoot":"","sources":["../../src/utils/syntax-highlight.ts"],"names":[],"mappings":"AA0BA,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;CAsBnB,CAAC;AAIF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,OAAO,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC,CAsBnG,CAAC;AA8CF,wBAAgB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAqBzD;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AAC1D,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAEzE,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,cAAc,CAAC;CACvB;AAoED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,cAAmB,GAAG,MAAM,CA8DtF;AAgID,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAmB9E;AAkBD;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,KAAK,IAAI,GAAG,IAAI,CAK1G;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAYtD;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAElD"}
|
|
@@ -45,12 +45,76 @@ const eagerLanguages = {
|
|
|
45
45
|
lua,
|
|
46
46
|
};
|
|
47
47
|
let hljs = baseHljs;
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Every name an eager grammar answers to (its own and its aliases, lowercase), so that a grammar can be registered when it
|
|
50
|
+
* is first asked for by any of them without running the others' definitions. Exported for its test, which checks it against
|
|
51
|
+
* the grammars.
|
|
52
|
+
*/
|
|
53
|
+
export const EAGER_LANGUAGE_ALIASES = {
|
|
54
|
+
python: ["py", "gyp", "ipython"],
|
|
55
|
+
java: ["jsp"],
|
|
56
|
+
go: ["golang"],
|
|
57
|
+
javascript: ["js", "jsx", "mjs", "cjs"],
|
|
58
|
+
json: ["jsonc", "json5"],
|
|
59
|
+
cpp: ["cc", "c++", "h++", "hpp", "hh", "hxx", "cxx"],
|
|
60
|
+
typescript: ["ts", "tsx", "mts", "cts"],
|
|
61
|
+
php: [],
|
|
62
|
+
ruby: ["rb", "gemspec", "podspec", "thor", "irb"],
|
|
63
|
+
c: ["h"],
|
|
64
|
+
csharp: ["cs", "c#"],
|
|
65
|
+
nix: ["nixos"],
|
|
66
|
+
bash: ["sh", "zsh"],
|
|
67
|
+
rust: ["rs"],
|
|
68
|
+
scala: [],
|
|
69
|
+
kotlin: ["kt", "kts", "ktm", "ktx"],
|
|
70
|
+
swift: [],
|
|
71
|
+
dart: [],
|
|
72
|
+
groovy: [],
|
|
73
|
+
perl: ["pl", "pm"],
|
|
74
|
+
lua: ["pluto"],
|
|
75
|
+
};
|
|
76
|
+
/** The eager grammars not registered yet, by every name they answer to. */
|
|
77
|
+
const pendingEagerLanguages = new Map();
|
|
78
|
+
for (const [name, aliases] of Object.entries(EAGER_LANGUAGE_ALIASES)) {
|
|
79
|
+
pendingEagerLanguages.set(name, name);
|
|
80
|
+
for (const alias of aliases)
|
|
81
|
+
pendingEagerLanguages.set(alias, name);
|
|
82
|
+
}
|
|
83
|
+
/** How many eager grammars are not registered yet. */
|
|
84
|
+
let pendingEagerCount = Object.keys(eagerLanguages).length;
|
|
85
|
+
/**
|
|
86
|
+
* Registers the eager grammar `name` names, if it is one that is not registered yet. Running all 21 definitions costs about
|
|
87
|
+
* 1 ms; a reply with a code block in one language needs one of them.
|
|
88
|
+
*/
|
|
89
|
+
function registerEagerLanguage(name) {
|
|
90
|
+
const language = pendingEagerLanguages.get(name.toLowerCase());
|
|
91
|
+
if (language === undefined)
|
|
92
|
+
return;
|
|
93
|
+
for (const [key, value] of pendingEagerLanguages)
|
|
94
|
+
if (value === language)
|
|
95
|
+
pendingEagerLanguages.delete(key);
|
|
96
|
+
pendingEagerCount--;
|
|
97
|
+
if (hljs.getLanguage(language) === undefined)
|
|
98
|
+
hljs.registerLanguage(language, eagerLanguages[language]);
|
|
99
|
+
}
|
|
100
|
+
/** Whether every eager grammar is registered, in the order of eagerLanguages. */
|
|
101
|
+
let eagerLanguagesInOrder = false;
|
|
102
|
+
/**
|
|
103
|
+
* Every eager grammar, in the order of eagerLanguages, as automatic detection and loading all grammars need. Automatic
|
|
104
|
+
* detection tries the grammars in the order they were registered and keeps the first of two that score the same, so the
|
|
105
|
+
* grammars registered one at a time on first use are registered again in that order: detection then picks what it picked
|
|
106
|
+
* when all of them were registered at the first code block.
|
|
107
|
+
*/
|
|
50
108
|
function registerEagerLanguages() {
|
|
51
|
-
if (
|
|
109
|
+
if (eagerLanguagesInOrder)
|
|
52
110
|
return;
|
|
53
|
-
|
|
111
|
+
eagerLanguagesInOrder = true;
|
|
112
|
+
for (const name of Object.keys(eagerLanguages)) {
|
|
113
|
+
if (!pendingEagerLanguages.has(name))
|
|
114
|
+
hljs.unregisterLanguage(name);
|
|
115
|
+
}
|
|
116
|
+
pendingEagerLanguages.clear();
|
|
117
|
+
pendingEagerCount = 0;
|
|
54
118
|
for (const [name, language] of Object.entries(eagerLanguages))
|
|
55
119
|
hljs.registerLanguage(name, language);
|
|
56
120
|
}
|
|
@@ -312,7 +376,10 @@ function renderHighlightedTree(root, classPrefix, theme) {
|
|
|
312
376
|
return output;
|
|
313
377
|
}
|
|
314
378
|
export function highlight(code, options = {}) {
|
|
315
|
-
|
|
379
|
+
if (options.language)
|
|
380
|
+
registerEagerLanguage(options.language);
|
|
381
|
+
else
|
|
382
|
+
registerEagerLanguages();
|
|
316
383
|
installFastHtmlEmitter();
|
|
317
384
|
const result = options.language
|
|
318
385
|
? hljs.highlight(code, {
|
|
@@ -359,7 +426,7 @@ export function loadAllHighlightLanguagesOnDemand(onLoaded) {
|
|
|
359
426
|
}
|
|
360
427
|
}
|
|
361
428
|
export function supportsLanguage(name) {
|
|
362
|
-
|
|
429
|
+
registerEagerLanguage(name);
|
|
363
430
|
if (hljs.getLanguage(name) !== undefined) {
|
|
364
431
|
return true;
|
|
365
432
|
}
|
|
@@ -374,11 +441,11 @@ export function supportsLanguage(name) {
|
|
|
374
441
|
return false;
|
|
375
442
|
}
|
|
376
443
|
/**
|
|
377
|
-
* Number of
|
|
378
|
-
* code that embeds another language, such as HTML in a
|
|
444
|
+
* Number of grammars there are: those registered and the eager ones that register when first asked for. It grows when the
|
|
445
|
+
* deferred grammars load, which can change the highlighting of code that embeds another language, such as HTML in a
|
|
446
|
+
* JavaScript template literal.
|
|
379
447
|
*/
|
|
380
448
|
export function getHighlightLanguageCount() {
|
|
381
|
-
|
|
382
|
-
return hljs.listLanguages().length;
|
|
449
|
+
return hljs.listLanguages().length + pendingEagerCount;
|
|
383
450
|
}
|
|
384
451
|
//# sourceMappingURL=syntax-highlight.js.map
|