@humain/humain-code 0.4.15 → 0.4.18
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 +86 -0
- package/README.md +1 -1
- package/dist/bundle/agent-monitor.js +1 -1
- package/dist/bundle/chunks/anthropic-messages-TSNY5MWH.js +67 -0
- package/dist/bundle/chunks/azure-openai-responses-Z4DCXO2G.js +15 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +59 -42
- package/dist/bundle/chunks/{chunk-W2QRCQBX.js → chunk-26EAEXO5.js} +18 -16
- package/dist/bundle/chunks/chunk-2ZFUMXOZ.js +1790 -0
- package/dist/bundle/chunks/{chunk-W5YJZKPF.js → chunk-3UXBFT4Q.js} +2264 -2432
- package/dist/bundle/chunks/{chunk-OX2IBCCA.js → chunk-3XDL5ZE4.js} +88 -82
- package/dist/bundle/chunks/{chunk-LUL775V7.js → chunk-5K5RFXXO.js} +4 -4
- package/dist/bundle/chunks/{chunk-AIXI6RIE.js → chunk-7PRU6YW3.js} +114 -82
- package/dist/bundle/chunks/{chunk-DUSJT2W4.js → chunk-7VY5IL74.js} +1 -1
- package/dist/bundle/chunks/chunk-AWCJWXGD.js +212 -0
- package/dist/bundle/chunks/chunk-FZUJXM6D.js +816 -0
- package/dist/bundle/chunks/{chunk-KK3KUUMM.js → chunk-G6ABHCPB.js} +115 -95
- package/dist/bundle/chunks/{chunk-NNKA2PAP.js → chunk-HPSQKIWK.js} +1 -1
- package/dist/bundle/chunks/chunk-IJYVMOB4.js +6 -0
- package/dist/bundle/chunks/{chunk-36Q5UVQL.js → chunk-L5OUCJ7N.js} +9 -9
- package/dist/bundle/chunks/chunk-NCQ6WAQK.js +125 -0
- package/dist/bundle/chunks/chunk-NSMMDV3N.js +131 -0
- package/dist/bundle/chunks/{chunk-Z74ZYQPX.js → chunk-OKALNPTJ.js} +80 -210
- package/dist/bundle/chunks/{chunk-UHLW4KJ7.js → chunk-OWLBGSXY.js} +94 -91
- package/dist/bundle/chunks/{chunk-JRX7GYW3.js → chunk-P4UKLIQB.js} +8 -8
- package/dist/bundle/chunks/chunk-PY7SOXCA.js +10 -0
- package/dist/bundle/chunks/chunk-Q7VXYXY3.js +7 -0
- package/dist/bundle/chunks/{chunk-COF5P635.js → chunk-QEF72EIZ.js} +13 -13
- package/dist/bundle/chunks/{chunk-EYIYBQAR.js → chunk-RXOCQRBG.js} +1 -1
- package/dist/bundle/chunks/{chunk-BVHXWQLD.js → chunk-SCBU5WOP.js} +1 -1
- package/dist/bundle/chunks/{chunk-DNGJMRJW.js → chunk-SCIGZFN5.js} +11 -11
- package/dist/bundle/chunks/{chunk-UDVC7A5S.js → chunk-TIFFHHW6.js} +16 -14
- package/dist/bundle/chunks/{chunk-L3J4P5JR.js → chunk-UGJAAWNC.js} +1 -1
- package/dist/bundle/chunks/chunk-V76YPIMT.js +48 -0
- package/dist/bundle/chunks/{chunk-Y3RFGBG2.js → chunk-X3O5MCKJ.js} +1 -1
- package/dist/bundle/chunks/chunk-Y26OS23T.js +80 -0
- package/dist/bundle/chunks/chunk-YDBNMIA3.js +34 -0
- package/dist/bundle/chunks/chunk-YLYOJQQX.js +1951 -0
- package/dist/bundle/chunks/{chunk-TJG52LZB.js → chunk-YMBXWW36.js} +1 -1
- package/dist/bundle/chunks/{cli-SRI4UOSL.js → cli-2NKM2RNJ.js} +1 -1
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-JGN7NZCV.js → cloudflare-workers-ai-system-one-MUJQ6LT2.js} +1 -1
- package/dist/bundle/chunks/{compat-2S3PCPEI.js → compat-VDGEZSVM.js} +8 -8
- package/dist/bundle/chunks/dist-LKDZAEUQ.js +7 -0
- package/dist/bundle/chunks/{dist-JXEXN6S2.js → dist-XVXV2CL4.js} +1 -1
- package/dist/bundle/chunks/{dist-SGQMXO45.js → dist-ZJIYY3GA.js} +1416 -866
- package/dist/bundle/chunks/dist-cjs-AXBW3N4F.js +182 -0
- package/dist/bundle/chunks/{easter-egg-3d-ZJ2JUFOA.js → easter-egg-3d-VGJ77XZQ.js} +1 -1
- package/dist/bundle/chunks/es-N6YFJOD7.js +1901 -0
- package/dist/bundle/chunks/{esm-NCUV2DF7.js → esm-GIR7QH65.js} +1 -1
- package/dist/bundle/chunks/{execute-LRTXH4YJ.js → execute-ZBEZNJ4E.js} +10 -9
- package/dist/bundle/chunks/{extract-OZW5JHG6.js → extract-RFWEHH6W.js} +16 -15
- package/dist/bundle/chunks/github-copilot.js +34 -47
- package/dist/bundle/chunks/{google-generative-ai-YXXFSTX7.js → google-generative-ai-4OVYRP24.js} +2 -2
- package/dist/bundle/chunks/{google-vertex-3IVWLYJ5.js → google-vertex-3WQAZJQD.js} +2 -2
- package/dist/bundle/chunks/host-63SNKK5Y.js +2 -0
- package/dist/bundle/chunks/jiti-static-loader-7OZNBOCI.js +2 -0
- package/dist/bundle/chunks/{mistral-conversations-Y7GWO3QB.js → mistral-conversations-G3GN6CMT.js} +20 -20
- package/dist/bundle/chunks/{node-ELWNZC34.js → node-A6SZ3T7E.js} +185 -185
- package/dist/bundle/chunks/{node-SPBTZUUS.js → node-DZCAT4Q6.js} +1 -1
- package/dist/bundle/chunks/{openai-codex-responses-NSXWHIDT.js → openai-codex-responses-FJFDAWHI.js} +17 -17
- package/dist/bundle/chunks/openai-completions-IC7WRLTI.js +82 -0
- package/dist/bundle/chunks/{openai-decisions-QWEISDVO.js → openai-decisions-HESOHYZB.js} +1 -1
- package/dist/bundle/chunks/openai-responses-XXCYDFSM.js +24 -0
- package/dist/bundle/chunks/{openrouter-images-BMVMAROU.js → openrouter-images-DT2HMZNO.js} +1 -1
- package/dist/bundle/chunks/pdfjs-EK6K7CXX.js +3593 -0
- package/dist/bundle/chunks/{pi-messages-XNEG23NU.js → pi-messages-SAOV3JNW.js} +1 -1
- package/dist/bundle/chunks/{runtime-VGSK3QCM.js → runtime-HJEUOD4R.js} +1 -1
- package/dist/bundle/chunks/{typesafe-system-one-62YHYXZV.js → typesafe-system-one-HCMGHK6A.js} +1 -1
- package/dist/bundle/chunks/{undici-7EW63V4X.js → undici-4BK3MVJV.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-CFJTDIXL.js +5 -0
- package/dist/bundle/cli-runtime.js +3 -3
- package/dist/bundle/cli.js +2 -2
- package/dist/bundle/flow/package.json +6 -5
- package/dist/bundle/index.js +8 -8
- package/dist/bundle/rpc-entry.js +3 -3
- package/dist/cli/credential-print.d.ts.map +1 -1
- package/dist/cli/credential-print.js +4 -4
- package/dist/cli/credential-print.js.map +1 -1
- package/dist/coordination/adapter/index.d.ts.map +1 -1
- package/dist/coordination/adapter/index.js +1 -1
- package/dist/coordination/adapter/index.js.map +1 -1
- package/dist/coordination/adapter/integration-notices.d.ts +1 -1
- package/dist/coordination/adapter/integration-notices.d.ts.map +1 -1
- package/dist/coordination/adapter/integration-notices.js +5 -2
- package/dist/coordination/adapter/integration-notices.js.map +1 -1
- package/dist/coordination/broker/extension-state.js +3 -3
- package/dist/coordination/broker/extension-state.js.map +1 -1
- package/dist/coordination/transport/framing.d.ts.map +1 -1
- package/dist/coordination/transport/framing.js +2 -1
- package/dist/coordination/transport/framing.js.map +1 -1
- package/dist/core/account-reporting.d.ts +3 -1
- package/dist/core/account-reporting.d.ts.map +1 -1
- package/dist/core/account-reporting.js +12 -2
- package/dist/core/account-reporting.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +39 -36
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +4 -2
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +5 -4
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/codex-usage.d.ts +11 -2
- package/dist/core/codex-usage.d.ts.map +1 -1
- package/dist/core/codex-usage.js +74 -2
- package/dist/core/codex-usage.js.map +1 -1
- package/dist/core/export-html/template.js +21 -16
- package/dist/core/model-config.d.ts +33 -8
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +22 -4
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-resolver.d.ts +56 -43
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +256 -361
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +6 -3
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +19 -5
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/models-store.d.ts.map +1 -1
- package/dist/core/models-store.js +7 -2
- package/dist/core/models-store.js.map +1 -1
- package/dist/core/oauth-account-pool.d.ts +9 -1
- package/dist/core/oauth-account-pool.d.ts.map +1 -1
- package/dist/core/oauth-account-pool.js +63 -12
- package/dist/core/oauth-account-pool.js.map +1 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +7 -2
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +2 -0
- package/dist/core/settings-defaults.d.ts.map +1 -1
- package/dist/core/settings-defaults.js +2 -0
- package/dist/core/settings-defaults.js.map +1 -1
- package/dist/core/settings-manager.d.ts +4 -2
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +11 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +4 -0
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +8 -0
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/slash-commands.js +1 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +2 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +21 -0
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/renderers/read.d.ts.map +1 -1
- package/dist/core/tools/renderers/read.js +7 -10
- package/dist/core/tools/renderers/read.js.map +1 -1
- package/dist/core/tools/subagent.d.ts.map +1 -1
- package/dist/core/tools/subagent.js +4 -7
- package/dist/core/tools/subagent.js.map +1 -1
- package/dist/core/trace/redaction.d.ts.map +1 -1
- package/dist/core/trace/redaction.js +3 -1
- package/dist/core/trace/redaction.js.map +1 -1
- package/dist/extensions/codemode/execute.d.ts.map +1 -1
- package/dist/extensions/codemode/execute.js +12 -0
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/codemode/index.d.ts.map +1 -1
- package/dist/extensions/codemode/index.js +5 -0
- package/dist/extensions/codemode/index.js.map +1 -1
- package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +74 -20
- package/dist/humain/flow-accounts-host.d.ts.map +1 -1
- package/dist/humain/flow-accounts-host.js +3 -0
- package/dist/humain/flow-accounts-host.js.map +1 -1
- package/dist/humain/node-provider.d.ts.map +1 -1
- package/dist/humain/node-provider.js +2 -0
- package/dist/humain/node-provider.js.map +1 -1
- package/dist/humain/trace-capture/index.js +3 -3
- package/dist/humain/trace-capture/index.js.map +1 -1
- package/dist/humain/web-access/vendor/credential-source.d.ts +2 -0
- package/dist/humain/web-access/vendor/credential-source.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/credential-source.js +50 -4
- package/dist/humain/web-access/vendor/credential-source.js.map +1 -1
- package/dist/humain/web-access/vendor/curator-page.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/curator-page.js +3 -1
- package/dist/humain/web-access/vendor/curator-page.js.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.js +2 -0
- package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
- package/dist/humain/web-access/vendor/deepseek.d.ts +4 -0
- package/dist/humain/web-access/vendor/deepseek.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/deepseek.js +201 -0
- package/dist/humain/web-access/vendor/deepseek.js.map +1 -0
- package/dist/humain/web-access/vendor/extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/extract.js +4 -2
- package/dist/humain/web-access/vendor/extract.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-adc.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-adc.js +49 -5
- package/dist/humain/web-access/vendor/gemini-adc.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.d.ts +3 -3
- package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.js +11 -4
- package/dist/humain/web-access/vendor/gemini-search.js.map +1 -1
- package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/index.js +16 -1
- package/dist/humain/web-access/vendor/index.js.map +1 -1
- package/dist/humain/web-access/vendor/page-query.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/page-query.js +12 -6
- package/dist/humain/web-access/vendor/page-query.js.map +1 -1
- package/dist/humain/web-access/vendor/query-rewrite.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/query-rewrite.js +11 -4
- package/dist/humain/web-access/vendor/query-rewrite.js.map +1 -1
- package/dist/humain/web-access/vendor/searxng.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/searxng.js +2 -1
- package/dist/humain/web-access/vendor/searxng.js.map +1 -1
- package/dist/humain/web-access/vendor/ssrf-protection.d.ts +1 -0
- package/dist/humain/web-access/vendor/ssrf-protection.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/ssrf-protection.js +10 -0
- package/dist/humain/web-access/vendor/ssrf-protection.js.map +1 -1
- package/dist/humain/web-access/vendor/summary-review.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/summary-review.js +17 -6
- package/dist/humain/web-access/vendor/summary-review.js.map +1 -1
- package/dist/humain/web-access/vendor/utils.d.ts +2 -0
- package/dist/humain/web-access/vendor/utils.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/utils.js +18 -0
- package/dist/humain/web-access/vendor/utils.js.map +1 -1
- package/dist/humain/web-access/vendor/web-tool-core.d.ts +2 -0
- package/dist/humain/web-access/vendor/web-tool-core.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/web-tool-core.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +10 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +5 -0
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +27 -2
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +2 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +4 -2
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +2 -9
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +28 -14
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/oauth-account-format.d.ts +4 -4
- package/dist/modes/interactive/oauth-account-format.d.ts.map +1 -1
- package/dist/modes/interactive/oauth-account-format.js +5 -2
- package/dist/modes/interactive/oauth-account-format.js.map +1 -1
- package/dist/modes/interactive/session-share.d.ts.map +1 -1
- package/dist/modes/interactive/session-share.js +9 -2
- package/dist/modes/interactive/session-share.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +8 -3
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +2 -1
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/cli.md +3 -3
- package/docs/codemode.md +3 -1
- package/docs/coordination.md +6 -0
- package/docs/docs.json +4 -0
- package/docs/environment-variables.md +4 -0
- package/docs/flow.md +6 -0
- package/docs/humain-code-forge-flow-walkthrough.md +1 -1
- package/docs/humain-code.md +2 -4
- package/docs/json.md +2 -2
- package/docs/llama-cpp.md +1 -1
- package/docs/nvidia-rtx-llama-cpp.md +96 -0
- package/docs/rpc-commands.md +1 -1
- package/docs/rpc.md +9 -1
- package/docs/sessions.md +1 -1
- package/docs/settings.md +2 -0
- package/docs/trace.md +4 -0
- package/docs/usage.md +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +16 -6
- package/examples/extensions/custom-provider-anthropic/package.json +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +16 -16
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/minimal-mode.ts +4 -4
- package/examples/extensions/sandbox/package-lock.json +6 -6
- package/examples/extensions/sandbox/package.json +2 -2
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/plugins/pi-example-plugin/package.json +2 -2
- package/examples/rpc-subagent-progress-host.ts +6 -2
- package/npm-shrinkwrap.json +129 -171
- package/package.json +19 -19
- package/schemas/models.schema.json +9 -5
- package/schemas/settings.schema.json +32 -0
- package/src/coordination/UPSTREAM.md +31 -1
- package/src/coordination/upstream.json +3 -3
- package/src/humain/adhd/UPSTREAM.md +8 -0
- package/src/humain/caveman/UPSTREAM.md +19 -3
- package/src/humain/caveman/upstream.json +2 -2
- package/src/humain/ponytail/UPSTREAM.md +23 -2
- package/src/humain/ponytail/upstream.json +8 -8
- package/src/humain/ponytail/vendor/skills/ponytail/SKILL.md +1 -1
- package/src/humain/ponytail/vendor/skills/ponytail-debt/SKILL.md +1 -2
- package/src/humain/ponytail/vendor/skills/ponytail-gain/SKILL.md +0 -1
- package/src/humain/web-access/UPSTREAM.md +45 -1
- package/src/humain/web-access/upstream.json +4 -4
- package/dist/bundle/chunks/anthropic-messages-YSAHA7QM.js +0 -67
- package/dist/bundle/chunks/azure-openai-responses-Z5XYDPHS.js +0 -15
- package/dist/bundle/chunks/chunk-2TTB6GIB.js +0 -47
- package/dist/bundle/chunks/chunk-5JHUWRJN.js +0 -1790
- package/dist/bundle/chunks/chunk-A7QKOI62.js +0 -572
- package/dist/bundle/chunks/chunk-FRUFMISJ.js +0 -505
- package/dist/bundle/chunks/chunk-MF2NEHP4.js +0 -1575
- package/dist/bundle/chunks/chunk-MG5PX4KU.js +0 -31
- package/dist/bundle/chunks/chunk-OEOXBLWI.js +0 -540
- package/dist/bundle/chunks/chunk-RYC5BYVE.js +0 -5
- package/dist/bundle/chunks/chunk-YJ3NQWES.js +0 -9
- package/dist/bundle/chunks/dist-MNSGVI4C.js +0 -7
- package/dist/bundle/chunks/dist-cjs-4BMVQ74V.js +0 -179
- package/dist/bundle/chunks/es-YEFEOGR3.js +0 -1905
- package/dist/bundle/chunks/host-2RMBOGA7.js +0 -2
- package/dist/bundle/chunks/jiti-static-loader-2RCDI6B4.js +0 -2
- package/dist/bundle/chunks/openai-completions-WGBQHTYA.js +0 -79
- package/dist/bundle/chunks/openai-responses-OKGCSIEY.js +0 -23
- package/dist/bundle/chunks/pdfjs-6UVU6XFX.js +0 -3564
- package/dist/bundle/chunks/virtual-modules-7HDINPIK.js +0 -5
- /package/dist/bundle/chunks/{chunk-XQRYOCHA.js → chunk-WZMA7HAJ.js} +0 -0
|
@@ -23,6 +23,8 @@ export interface CredentialOptions {
|
|
|
23
23
|
runCommand?: CredentialCommandRunner;
|
|
24
24
|
}
|
|
25
25
|
export declare function redactCredential(text: string, credential: string | null | undefined): string;
|
|
26
|
+
/** Resolves bash on Windows in Pi's own `!command` order: Git Bash install locations, then bash.exe on PATH. */
|
|
27
|
+
export declare function findWindowsBash(environment: Record<string, string | undefined>, exists: (path: string) => boolean, findOnPath: () => Promise<string | null>): Promise<string | null>;
|
|
26
28
|
export declare function hasCredentialSource(options: CredentialOptions): boolean;
|
|
27
29
|
export declare function resolveCredential(options: CredentialOptions): Promise<string | null>;
|
|
28
30
|
//# sourceMappingURL=credential-source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-source.d.ts","sourceRoot":"","sources":["../../../../src/humain/web-access/vendor/credential-source.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"credential-source.d.ts","sourceRoot":"","sources":["../../../../src/humain/web-access/vendor/credential-source.ts"],"names":[],"mappings":"AA8CA,MAAM,MAAM,yBAAyB,GAClC,gBAAgB,GAChB,gBAAgB,GAChB,iBAAiB,GACjB,iBAAiB,GACjB,eAAe,GACf,wBAAwB,GACxB,0BAA0B,GAC1B,mBAAmB,GACnB,2BAA2B,CAAC;AAE/B,qBAAa,yBAA0B,SAAQ,KAAK;IACnD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;IAE7C,YAAY,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,yBAAyB,EAShE;CACD;AAED,MAAM,WAAW,uBAAuB;IACvC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,wBAAwB;IACxC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAED,MAAM,MAAM,uBAAuB,GAAG,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,wBAAwB,KAC7B,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAEtC,MAAM,WAAW,iBAAiB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACjD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,UAAU,CAAC,EAAE,uBAAuB,CAAC;CACrC;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAE5F;AA+CD,gHAAgH;AAChH,wBAAsB,eAAe,CACpC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAC/C,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,EACjC,UAAU,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GACtC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAOxB;AAmCD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAKvE;AAED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAwC1F"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { exec } from "node:child_process";
|
|
1
|
+
import { exec, execFile } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
2
3
|
import { promisify } from "node:util";
|
|
3
4
|
const execAsync = promisify(exec);
|
|
5
|
+
const execFileAsync = promisify(execFile);
|
|
4
6
|
const COMMAND_TIMEOUT_MS = 5_000;
|
|
5
7
|
const MAX_CREDENTIAL_BYTES = 16_384;
|
|
6
8
|
const ENV_SOURCE = /^\$(?:([A-Za-z_][A-Za-z0-9_]*)|\{([A-Za-z_][A-Za-z0-9_]*)\})$/;
|
|
7
9
|
const OP_SESSION_NAME = /^OP_SESSION_[A-Za-z0-9_]+$/;
|
|
10
|
+
// Pi drives the legacy WSL launcher through stdin; credential commands fall back to cmd.exe instead.
|
|
11
|
+
const LEGACY_WSL_BASH = /^[a-z]:\\windows\\(?:system32|sysnative)\\bash\.exe$/i;
|
|
8
12
|
const COMMAND_ENVIRONMENT_NAMES = [
|
|
9
13
|
"HOME",
|
|
10
14
|
"USER",
|
|
@@ -22,6 +26,21 @@ const COMMAND_ENVIRONMENT_NAMES = [
|
|
|
22
26
|
"SSH_AUTH_SOCK",
|
|
23
27
|
"WSL_DISTRO_NAME",
|
|
24
28
|
"WSL_INTEROP",
|
|
29
|
+
// Git Bash derives $HOME from USERPROFILE, and Windows children need SystemRoot for networking and crypto.
|
|
30
|
+
"SystemRoot",
|
|
31
|
+
"windir",
|
|
32
|
+
"ComSpec",
|
|
33
|
+
"PATHEXT",
|
|
34
|
+
"USERPROFILE",
|
|
35
|
+
"HOMEDRIVE",
|
|
36
|
+
"HOMEPATH",
|
|
37
|
+
"APPDATA",
|
|
38
|
+
"LOCALAPPDATA",
|
|
39
|
+
"TEMP",
|
|
40
|
+
"TMP",
|
|
41
|
+
"ProgramData",
|
|
42
|
+
"ProgramFiles",
|
|
43
|
+
"ProgramFiles(x86)",
|
|
25
44
|
];
|
|
26
45
|
export class CredentialResolutionError extends Error {
|
|
27
46
|
provider;
|
|
@@ -73,15 +92,42 @@ function escapedSource(source) {
|
|
|
73
92
|
function isMalformedExplicitSource(source) {
|
|
74
93
|
return source.startsWith("$") && escapedSource(source) === null && explicitEnvironmentName(source) === null;
|
|
75
94
|
}
|
|
95
|
+
async function bashOnPath(signal, timeoutMs) {
|
|
96
|
+
try {
|
|
97
|
+
const { stdout } = await execFileAsync("where", ["bash.exe"], { encoding: "utf8", signal, timeout: timeoutMs, windowsHide: true });
|
|
98
|
+
return stdout.trim().split(/\r?\n/)[0] || null;
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/** Resolves bash on Windows in Pi's own `!command` order: Git Bash install locations, then bash.exe on PATH. */
|
|
105
|
+
export async function findWindowsBash(environment, exists, findOnPath) {
|
|
106
|
+
for (const root of [environment.ProgramFiles, environment["ProgramFiles(x86)"]]) {
|
|
107
|
+
const candidate = root ? `${root}\\Git\\bin\\bash.exe` : null;
|
|
108
|
+
if (candidate && exists(candidate))
|
|
109
|
+
return candidate;
|
|
110
|
+
}
|
|
111
|
+
const found = await findOnPath();
|
|
112
|
+
return found && exists(found) && !LEGACY_WSL_BASH.test(found.replace(/\//g, "\\")) ? found : null;
|
|
113
|
+
}
|
|
76
114
|
async function defaultRunCommand(command, options) {
|
|
77
|
-
|
|
115
|
+
// The bash lookup and the command share one timeout budget and the caller's abort signal.
|
|
116
|
+
const deadline = Date.now() + options.timeoutMs;
|
|
117
|
+
const bash = process.platform === "win32"
|
|
118
|
+
? await findWindowsBash(process.env, existsSync, () => bashOnPath(options.signal, options.timeoutMs))
|
|
119
|
+
: null;
|
|
120
|
+
const execOptions = {
|
|
78
121
|
encoding: "utf8",
|
|
79
122
|
env: options.environment,
|
|
80
123
|
maxBuffer: options.maxOutputBytes + 1,
|
|
81
124
|
signal: options.signal,
|
|
82
|
-
timeout:
|
|
125
|
+
timeout: Math.max(1, deadline - Date.now()),
|
|
83
126
|
windowsHide: true,
|
|
84
|
-
}
|
|
127
|
+
};
|
|
128
|
+
const result = bash
|
|
129
|
+
? await execFileAsync(bash, ["-c", command], execOptions)
|
|
130
|
+
: await execAsync(command, execOptions);
|
|
85
131
|
return { stdout: result.stdout };
|
|
86
132
|
}
|
|
87
133
|
function commandFailureCategory(error, signal) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-source.js","sourceRoot":"","sources":["../../../../src/humain/web-access/vendor/credential-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAClC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D,CAAC","sourcesContent":["import { exec } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\nconst execAsync = promisify(exec);\nconst COMMAND_TIMEOUT_MS = 5_000;\nconst MAX_CREDENTIAL_BYTES = 16_384;\nconst ENV_SOURCE = /^\\$(?:([A-Za-z_][A-Za-z0-9_]*)|\\{([A-Za-z_][A-Za-z0-9_]*)\\})$/;\nconst OP_SESSION_NAME = /^OP_SESSION_[A-Za-z0-9_]+$/;\nconst COMMAND_ENVIRONMENT_NAMES = [\n\t\"HOME\",\n\t\"USER\",\n\t\"LOGNAME\",\n\t\"OP_SERVICE_ACCOUNT_TOKEN\",\n\t\"PATH\",\n\t\"LANG\",\n\t\"LC_ALL\",\n\t\"LC_CTYPE\",\n\t\"TERM\",\n\t\"TMPDIR\",\n\t\"XDG_CONFIG_HOME\",\n\t\"XDG_RUNTIME_DIR\",\n\t\"DBUS_SESSION_BUS_ADDRESS\",\n\t\"SSH_AUTH_SOCK\",\n\t\"WSL_DISTRO_NAME\",\n\t\"WSL_INTEROP\",\n] as const;\n\nexport type CredentialFailureCategory =\n\t| \"invalid-source\"\n\t| \"command-failed\"\n\t| \"command-timeout\"\n\t| \"command-aborted\"\n\t| \"command-empty\"\n\t| \"command-invalid-output\"\n\t| \"command-output-too-large\"\n\t| \"environment-empty\"\n\t| \"oauth-credential-rejected\";\n\nexport class CredentialResolutionError extends Error {\n\treadonly provider: string;\n\treadonly category: CredentialFailureCategory;\n\n\tconstructor(provider: string, category: CredentialFailureCategory) {\n\t\tconst suffix =\n\t\t\tcategory === \"command-aborted\" ? \"aborted\" :\n\t\t\tcategory === \"oauth-credential-rejected\" ? \"OAuth token exchange rejected the credentials\" :\n\t\t\tcategory;\n\t\tsuper(`${provider} credential resolution failed: ${suffix}`);\n\t\tthis.name = \"CredentialResolutionError\";\n\t\tthis.provider = provider;\n\t\tthis.category = category;\n\t}\n}\n\nexport interface CredentialCommandResult {\n\tstdout: string | Buffer;\n}\n\nexport interface CredentialCommandOptions {\n\tsignal?: AbortSignal;\n\ttimeoutMs: number;\n\tmaxOutputBytes: number;\n\tenvironment: Record<string, string>;\n}\n\nexport type CredentialCommandRunner = (\n\tcommand: string,\n\toptions: CredentialCommandOptions,\n) => Promise<CredentialCommandResult>;\n\nexport interface CredentialOptions {\n\tprovider: string;\n\tconfiguredValue?: unknown;\n\tenvironmentValue?: unknown;\n\tenvironment?: Record<string, string | undefined>;\n\tsignal?: AbortSignal;\n\trunCommand?: CredentialCommandRunner;\n}\n\nexport function redactCredential(text: string, credential: string | null | undefined): string {\n\treturn credential ? text.split(credential).join(\"[redacted]\") : text;\n}\n\nfunction normalize(value: unknown): string | null {\n\tif (typeof value !== \"string\") return null;\n\tconst normalized = value.trim();\n\treturn normalized.length > 0 ? normalized : null;\n}\n\nfunction commandEnvironment(source: Record<string, string | undefined>): Record<string, string> {\n\tconst environment: Record<string, string> = {};\n\tfor (const name of COMMAND_ENVIRONMENT_NAMES) {\n\t\tconst value = source[name];\n\t\tif (value !== undefined) environment[name] = value;\n\t}\n\tfor (const [name, value] of Object.entries(source)) {\n\t\tif (value !== undefined && OP_SESSION_NAME.test(name)) environment[name] = value;\n\t}\n\treturn environment;\n}\n\nfunction configuredSource(options: CredentialOptions): string | null {\n\treturn normalize(options.configuredValue);\n}\n\nfunction explicitEnvironmentName(source: string): string | null {\n\tconst match = source.match(ENV_SOURCE);\n\treturn match ? match[1] ?? match[2] : null;\n}\n\nfunction escapedSource(source: string): string | null {\n\tif (source.startsWith(\"$$\") || source.startsWith(\"$!\")) return source.slice(1);\n\treturn null;\n}\n\nfunction isMalformedExplicitSource(source: string): boolean {\n\treturn source.startsWith(\"$\") && escapedSource(source) === null && explicitEnvironmentName(source) === null;\n}\n\nasync function defaultRunCommand(\n\tcommand: string,\n\toptions: CredentialCommandOptions,\n): Promise<CredentialCommandResult> {\n\tconst result = await execAsync(command, {\n\t\tencoding: \"utf8\",\n\t\tenv: options.environment,\n\t\tmaxBuffer: options.maxOutputBytes + 1,\n\t\tsignal: options.signal,\n\t\ttimeout: options.timeoutMs,\n\t\twindowsHide: true,\n\t});\n\treturn { stdout: result.stdout };\n}\n\nfunction commandFailureCategory(error: unknown, signal?: AbortSignal): CredentialFailureCategory {\n\tif (signal?.aborted) return \"command-aborted\";\n\tif (error && typeof error === \"object\") {\n\t\tconst code = (error as { code?: string }).code;\n\t\tif (code === \"ERR_CHILD_PROCESS_STDIO_MAXBUFFER\") return \"command-output-too-large\";\n\t\tif ((error as { killed?: boolean }).killed || code === \"ETIMEDOUT\") return \"command-timeout\";\n\t}\n\treturn \"command-failed\";\n}\n\nexport function hasCredentialSource(options: CredentialOptions): boolean {\n\tconst source = configuredSource(options);\n\tif (source?.startsWith(\"!\")) return true;\n\tif (source?.startsWith(\"$\")) return true;\n\treturn normalize(options.environmentValue) !== null || source !== null;\n}\n\nexport async function resolveCredential(options: CredentialOptions): Promise<string | null> {\n\tconst source = configuredSource(options);\n\tconst escaped = source ? escapedSource(source) : null;\n\tif (escaped !== null) return escaped;\n\tif (source?.startsWith(\"!\")) {\n\t\tconst command = source.slice(1).trim();\n\t\tif (!command) throw new CredentialResolutionError(options.provider, \"invalid-source\");\n\t\tlet result: CredentialCommandResult;\n\t\ttry {\n\t\t\tresult = await (options.runCommand ?? defaultRunCommand)(command, {\n\t\t\t\tsignal: options.signal,\n\t\t\t\ttimeoutMs: COMMAND_TIMEOUT_MS,\n\t\t\t\tmaxOutputBytes: MAX_CREDENTIAL_BYTES,\n\t\t\t\tenvironment: commandEnvironment(options.environment ?? process.env),\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tthrow new CredentialResolutionError(options.provider, commandFailureCategory(error, options.signal));\n\t\t}\n\t\tconst stdout = Buffer.isBuffer(result.stdout) ? result.stdout.toString(\"utf8\") : result.stdout;\n\t\tif (Buffer.byteLength(stdout, \"utf8\") > MAX_CREDENTIAL_BYTES) {\n\t\t\tthrow new CredentialResolutionError(options.provider, \"command-output-too-large\");\n\t\t}\n\t\tconst value = stdout.trim();\n\t\tif (!value) throw new CredentialResolutionError(options.provider, \"command-empty\");\n\t\tif (/[\\0-\\x1f\\x7f]/.test(value)) {\n\t\t\tthrow new CredentialResolutionError(options.provider, \"command-invalid-output\");\n\t\t}\n\t\treturn value;\n\t}\n\tif (source && isMalformedExplicitSource(source)) {\n\t\tthrow new CredentialResolutionError(options.provider, \"invalid-source\");\n\t}\n\tif (source?.startsWith(\"$\")) {\n\t\tconst name = explicitEnvironmentName(source);\n\t\tif (!name) throw new CredentialResolutionError(options.provider, \"invalid-source\");\n\t\tconst value = normalize((options.environment ?? process.env)[name]);\n\t\tif (!value) throw new CredentialResolutionError(options.provider, \"environment-empty\");\n\t\treturn value;\n\t}\n\treturn normalize(options.environmentValue) ?? source;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"credential-source.js","sourceRoot":"","sources":["../../../../src/humain/web-access/vendor/credential-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAClC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC1C,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACjC,MAAM,oBAAoB,GAAG,MAAM,CAAC;AACpC,MAAM,UAAU,GAAG,+DAA+D,CAAC;AACnF,MAAM,eAAe,GAAG,4BAA4B,CAAC;AACrD,qGAAqG;AACrG,MAAM,eAAe,GAAG,uDAAuD,CAAC;AAChF,MAAM,yBAAyB,GAAG;IACjC,MAAM;IACN,MAAM;IACN,SAAS;IACT,0BAA0B;IAC1B,MAAM;IACN,MAAM;IACN,QAAQ;IACR,UAAU;IACV,MAAM;IACN,QAAQ;IACR,iBAAiB;IACjB,iBAAiB;IACjB,0BAA0B;IAC1B,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AAC,CAAC;QACpE,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,yBAAyB,CAAC,OAAO,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;QACvF,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,MAAM,CAAC;AACtD,CAAC","sourcesContent":["import { exec, execFile } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { promisify } from \"node:util\";\n\nconst execAsync = promisify(exec);\nconst execFileAsync = promisify(execFile);\nconst COMMAND_TIMEOUT_MS = 5_000;\nconst MAX_CREDENTIAL_BYTES = 16_384;\nconst ENV_SOURCE = /^\\$(?:([A-Za-z_][A-Za-z0-9_]*)|\\{([A-Za-z_][A-Za-z0-9_]*)\\})$/;\nconst OP_SESSION_NAME = /^OP_SESSION_[A-Za-z0-9_]+$/;\n// Pi drives the legacy WSL launcher through stdin; credential commands fall back to cmd.exe instead.\nconst LEGACY_WSL_BASH = /^[a-z]:\\\\windows\\\\(?:system32|sysnative)\\\\bash\\.exe$/i;\nconst COMMAND_ENVIRONMENT_NAMES = [\n\t\"HOME\",\n\t\"USER\",\n\t\"LOGNAME\",\n\t\"OP_SERVICE_ACCOUNT_TOKEN\",\n\t\"PATH\",\n\t\"LANG\",\n\t\"LC_ALL\",\n\t\"LC_CTYPE\",\n\t\"TERM\",\n\t\"TMPDIR\",\n\t\"XDG_CONFIG_HOME\",\n\t\"XDG_RUNTIME_DIR\",\n\t\"DBUS_SESSION_BUS_ADDRESS\",\n\t\"SSH_AUTH_SOCK\",\n\t\"WSL_DISTRO_NAME\",\n\t\"WSL_INTEROP\",\n\t// Git Bash derives $HOME from USERPROFILE, and Windows children need SystemRoot for networking and crypto.\n\t\"SystemRoot\",\n\t\"windir\",\n\t\"ComSpec\",\n\t\"PATHEXT\",\n\t\"USERPROFILE\",\n\t\"HOMEDRIVE\",\n\t\"HOMEPATH\",\n\t\"APPDATA\",\n\t\"LOCALAPPDATA\",\n\t\"TEMP\",\n\t\"TMP\",\n\t\"ProgramData\",\n\t\"ProgramFiles\",\n\t\"ProgramFiles(x86)\",\n] as const;\n\nexport type CredentialFailureCategory =\n\t| \"invalid-source\"\n\t| \"command-failed\"\n\t| \"command-timeout\"\n\t| \"command-aborted\"\n\t| \"command-empty\"\n\t| \"command-invalid-output\"\n\t| \"command-output-too-large\"\n\t| \"environment-empty\"\n\t| \"oauth-credential-rejected\";\n\nexport class CredentialResolutionError extends Error {\n\treadonly provider: string;\n\treadonly category: CredentialFailureCategory;\n\n\tconstructor(provider: string, category: CredentialFailureCategory) {\n\t\tconst suffix =\n\t\t\tcategory === \"command-aborted\" ? \"aborted\" :\n\t\t\tcategory === \"oauth-credential-rejected\" ? \"OAuth token exchange rejected the credentials\" :\n\t\t\tcategory;\n\t\tsuper(`${provider} credential resolution failed: ${suffix}`);\n\t\tthis.name = \"CredentialResolutionError\";\n\t\tthis.provider = provider;\n\t\tthis.category = category;\n\t}\n}\n\nexport interface CredentialCommandResult {\n\tstdout: string | Buffer;\n}\n\nexport interface CredentialCommandOptions {\n\tsignal?: AbortSignal;\n\ttimeoutMs: number;\n\tmaxOutputBytes: number;\n\tenvironment: Record<string, string>;\n}\n\nexport type CredentialCommandRunner = (\n\tcommand: string,\n\toptions: CredentialCommandOptions,\n) => Promise<CredentialCommandResult>;\n\nexport interface CredentialOptions {\n\tprovider: string;\n\tconfiguredValue?: unknown;\n\tenvironmentValue?: unknown;\n\tenvironment?: Record<string, string | undefined>;\n\tsignal?: AbortSignal;\n\trunCommand?: CredentialCommandRunner;\n}\n\nexport function redactCredential(text: string, credential: string | null | undefined): string {\n\treturn credential ? text.split(credential).join(\"[redacted]\") : text;\n}\n\nfunction normalize(value: unknown): string | null {\n\tif (typeof value !== \"string\") return null;\n\tconst normalized = value.trim();\n\treturn normalized.length > 0 ? normalized : null;\n}\n\nfunction commandEnvironment(source: Record<string, string | undefined>): Record<string, string> {\n\tconst environment: Record<string, string> = {};\n\tfor (const name of COMMAND_ENVIRONMENT_NAMES) {\n\t\tconst value = source[name];\n\t\tif (value !== undefined) environment[name] = value;\n\t}\n\tfor (const [name, value] of Object.entries(source)) {\n\t\tif (value !== undefined && OP_SESSION_NAME.test(name)) environment[name] = value;\n\t}\n\treturn environment;\n}\n\nfunction configuredSource(options: CredentialOptions): string | null {\n\treturn normalize(options.configuredValue);\n}\n\nfunction explicitEnvironmentName(source: string): string | null {\n\tconst match = source.match(ENV_SOURCE);\n\treturn match ? match[1] ?? match[2] : null;\n}\n\nfunction escapedSource(source: string): string | null {\n\tif (source.startsWith(\"$$\") || source.startsWith(\"$!\")) return source.slice(1);\n\treturn null;\n}\n\nfunction isMalformedExplicitSource(source: string): boolean {\n\treturn source.startsWith(\"$\") && escapedSource(source) === null && explicitEnvironmentName(source) === null;\n}\n\nasync function bashOnPath(signal: AbortSignal | undefined, timeoutMs: number): Promise<string | null> {\n\ttry {\n\t\tconst { stdout } = await execFileAsync(\"where\", [\"bash.exe\"], { encoding: \"utf8\", signal, timeout: timeoutMs, windowsHide: true });\n\t\treturn stdout.trim().split(/\\r?\\n/)[0] || null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/** Resolves bash on Windows in Pi's own `!command` order: Git Bash install locations, then bash.exe on PATH. */\nexport async function findWindowsBash(\n\tenvironment: Record<string, string | undefined>,\n\texists: (path: string) => boolean,\n\tfindOnPath: () => Promise<string | null>,\n): Promise<string | null> {\n\tfor (const root of [environment.ProgramFiles, environment[\"ProgramFiles(x86)\"]]) {\n\t\tconst candidate = root ? `${root}\\\\Git\\\\bin\\\\bash.exe` : null;\n\t\tif (candidate && exists(candidate)) return candidate;\n\t}\n\tconst found = await findOnPath();\n\treturn found && exists(found) && !LEGACY_WSL_BASH.test(found.replace(/\\//g, \"\\\\\")) ? found : null;\n}\n\nasync function defaultRunCommand(\n\tcommand: string,\n\toptions: CredentialCommandOptions,\n): Promise<CredentialCommandResult> {\n\t// The bash lookup and the command share one timeout budget and the caller's abort signal.\n\tconst deadline = Date.now() + options.timeoutMs;\n\tconst bash = process.platform === \"win32\"\n\t\t? await findWindowsBash(process.env, existsSync, () => bashOnPath(options.signal, options.timeoutMs))\n\t\t: null;\n\tconst execOptions = {\n\t\tencoding: \"utf8\",\n\t\tenv: options.environment,\n\t\tmaxBuffer: options.maxOutputBytes + 1,\n\t\tsignal: options.signal,\n\t\ttimeout: Math.max(1, deadline - Date.now()),\n\t\twindowsHide: true,\n\t} as const;\n\tconst result = bash\n\t\t? await execFileAsync(bash, [\"-c\", command], execOptions)\n\t\t: await execAsync(command, execOptions);\n\treturn { stdout: result.stdout };\n}\n\nfunction commandFailureCategory(error: unknown, signal?: AbortSignal): CredentialFailureCategory {\n\tif (signal?.aborted) return \"command-aborted\";\n\tif (error && typeof error === \"object\") {\n\t\tconst code = (error as { code?: string }).code;\n\t\tif (code === \"ERR_CHILD_PROCESS_STDIO_MAXBUFFER\") return \"command-output-too-large\";\n\t\tif ((error as { killed?: boolean }).killed || code === \"ETIMEDOUT\") return \"command-timeout\";\n\t}\n\treturn \"command-failed\";\n}\n\nexport function hasCredentialSource(options: CredentialOptions): boolean {\n\tconst source = configuredSource(options);\n\tif (source?.startsWith(\"!\")) return true;\n\tif (source?.startsWith(\"$\")) return true;\n\treturn normalize(options.environmentValue) !== null || source !== null;\n}\n\nexport async function resolveCredential(options: CredentialOptions): Promise<string | null> {\n\tconst source = configuredSource(options);\n\tconst escaped = source ? escapedSource(source) : null;\n\tif (escaped !== null) return escaped;\n\tif (source?.startsWith(\"!\")) {\n\t\tconst command = source.slice(1).trim();\n\t\tif (!command) throw new CredentialResolutionError(options.provider, \"invalid-source\");\n\t\tlet result: CredentialCommandResult;\n\t\ttry {\n\t\t\tresult = await (options.runCommand ?? defaultRunCommand)(command, {\n\t\t\t\tsignal: options.signal,\n\t\t\t\ttimeoutMs: COMMAND_TIMEOUT_MS,\n\t\t\t\tmaxOutputBytes: MAX_CREDENTIAL_BYTES,\n\t\t\t\tenvironment: commandEnvironment(options.environment ?? process.env),\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tthrow new CredentialResolutionError(options.provider, commandFailureCategory(error, options.signal));\n\t\t}\n\t\tconst stdout = Buffer.isBuffer(result.stdout) ? result.stdout.toString(\"utf8\") : result.stdout;\n\t\tif (Buffer.byteLength(stdout, \"utf8\") > MAX_CREDENTIAL_BYTES) {\n\t\t\tthrow new CredentialResolutionError(options.provider, \"command-output-too-large\");\n\t\t}\n\t\tconst value = stdout.trim();\n\t\tif (!value) throw new CredentialResolutionError(options.provider, \"command-empty\");\n\t\tif (/[\\0-\\x1f\\x7f]/.test(value)) {\n\t\t\tthrow new CredentialResolutionError(options.provider, \"command-invalid-output\");\n\t\t}\n\t\treturn value;\n\t}\n\tif (source && isMalformedExplicitSource(source)) {\n\t\tthrow new CredentialResolutionError(options.provider, \"invalid-source\");\n\t}\n\tif (source?.startsWith(\"$\")) {\n\t\tconst name = explicitEnvironmentName(source);\n\t\tif (!name) throw new CredentialResolutionError(options.provider, \"invalid-source\");\n\t\tconst value = normalize((options.environment ?? process.env)[name]);\n\t\tif (!value) throw new CredentialResolutionError(options.provider, \"environment-empty\");\n\t\treturn value;\n\t}\n\treturn normalize(options.environmentValue) ?? source;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curator-page.d.ts","sourceRoot":"","sources":["../../../../src/humain/web-access/vendor/curator-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"curator-page.d.ts","sourceRoot":"","sources":["../../../../src/humain/web-access/vendor/curator-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAsE/D,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,MAAM,EAAE,EACjB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,kBAAkB,EAAE,oBAAoB,EACxC,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,EACtD,mBAAmB,EAAE,MAAM,GAAG,IAAI,GAChC,MAAM,CA0IR"}
|
|
@@ -46,6 +46,7 @@ function buildProviderButtons(available, selected, hasInitialQueries) {
|
|
|
46
46
|
{ value: "valyu", label: "Valyu", available: available.valyu },
|
|
47
47
|
{ value: "keenable", label: "Keenable", available: available.keenable },
|
|
48
48
|
{ value: "ceramic", label: "Ceramic", available: available.ceramic },
|
|
49
|
+
{ value: "deepseek", label: "DeepSeek", available: available.deepseek },
|
|
49
50
|
];
|
|
50
51
|
return providers
|
|
51
52
|
.filter(p => p.available)
|
|
@@ -1458,7 +1459,7 @@ const SCRIPT = `(function() {
|
|
|
1458
1459
|
var token = DATA.sessionToken;
|
|
1459
1460
|
var timeoutSec = DATA.timeout;
|
|
1460
1461
|
var queries = Array.isArray(DATA.queries) ? DATA.queries : [];
|
|
1461
|
-
var providers = ["auto", "all", "openai", "exa", "brave", "parallel", "parallel-mcp", "tinyfish", "search1api", "searchinfinity", "querit", "tavily", "firecrawl", "jina", "serpdive", "kagi", "bocha", "ollama", "searxng", "degoog", "duckduckgo", "perplexity", "gemini", "kimi", "anysearch", "xcrawl", "xai", "mistral", "brightdata", "serpbase", "serpapi", "serper", "serply", "valyu", "baizhi", "you", "zai", "keenable", "ceramic"];
|
|
1462
|
+
var providers = ["auto", "all", "openai", "exa", "brave", "parallel", "parallel-mcp", "tinyfish", "search1api", "searchinfinity", "querit", "tavily", "firecrawl", "jina", "serpdive", "kagi", "bocha", "ollama", "searxng", "degoog", "duckduckgo", "perplexity", "gemini", "kimi", "anysearch", "xcrawl", "xai", "mistral", "brightdata", "serpbase", "serpapi", "serper", "serply", "valyu", "baizhi", "you", "zai", "keenable", "ceramic", "deepseek"];
|
|
1462
1463
|
var availProviders = DATA.availableProviders && typeof DATA.availableProviders === "object" ? DATA.availableProviders : {};
|
|
1463
1464
|
var workflow = "summary-review";
|
|
1464
1465
|
var initialDefaultProvider = typeof DATA.defaultProvider === "string" ? DATA.defaultProvider : "exa";
|
|
@@ -1700,6 +1701,7 @@ const SCRIPT = `(function() {
|
|
|
1700
1701
|
if (provider === "valyu") return "Valyu";
|
|
1701
1702
|
if (provider === "keenable") return "Keenable";
|
|
1702
1703
|
if (provider === "ceramic") return "Ceramic";
|
|
1704
|
+
if (provider === "deepseek") return "DeepSeek";
|
|
1703
1705
|
return "Unknown";
|
|
1704
1706
|
}
|
|
1705
1707
|
|