fengming 0.3.3 → 0.3.5
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 +3 -3
- package/dist/abort-CjCDVBbH.js +277 -0
- package/dist/abort.runtime-DxJ8129J.js +2 -0
- package/dist/abort.runtime.js +1 -1
- package/dist/accounts-Cyn0sm_v.js +423 -0
- package/dist/accounts-DzcLKcN5.js +2 -0
- package/dist/acp/control-plane/manager.js +1 -1
- package/dist/acp-spawn-4lfz_3K9.js +1286 -0
- package/dist/acp-spawn-BCUjuO6L.js +2 -0
- package/dist/acp-stateful-target-driver-Bv99uwEA.js +89 -0
- package/dist/action-info-CP-p6RHS.js +75 -0
- package/dist/active-runtime-registry-DjKe53a5.js +62 -0
- package/dist/active-tool-schema-warnings-p7CqUnu1.js +105 -0
- package/dist/active-tool-schema-warnings-pGI92yka.js +2 -0
- package/dist/agent-B77yluip.js +1825 -0
- package/dist/agent-BooUvZnR.js +2 -0
- package/dist/agent-bundle-lsp-runtime-3ieSgTgo.js +389 -0
- package/dist/agent-bundle-lsp-runtime-CkJ0XJK7.js +2 -0
- package/dist/agent-bundle-mcp-materialize-BH-esGZL.js +124 -0
- package/dist/agent-bundle-mcp-tools-DkixTTnL.js +3 -0
- package/dist/agent-command-BJKcnQy6.js +1435 -0
- package/dist/agent-delivery-CEfe_Zzt.js +117 -0
- package/dist/agent-harness-runtime-R_Ae6o9C.js +207 -0
- package/dist/agent-kWSaRcQt.js +3 -0
- package/dist/agent-model-discovery-C49swEgd.js +238 -0
- package/dist/agent-model-discovery-DZbixJQs.js +3 -0
- package/dist/agent-runner-utils-BChpi9Ec.js +267 -0
- package/dist/agent-runner.runtime-3LOdt215.js +3784 -0
- package/dist/agent-runner.runtime.js +1 -1
- package/dist/agent-runtime-3jsv8b7Y.js +199 -0
- package/dist/agent-runtime-label-uoFI4ovH.js +30 -0
- package/dist/agent-runtime-metadata-BhFt6kLt.js +53 -0
- package/dist/agent-tool-result-middleware-loader-BxYJNC1i.js +55 -0
- package/dist/agent-tools-COLEG7aL.js +2506 -0
- package/dist/agent-tools.before-tool-call--rMZI5Rd.js +1274 -0
- package/dist/agent-tools.before-tool-call-CbX2sfP4.js +2 -0
- package/dist/agent-via-gateway-DfKij3De.js +486 -0
- package/dist/agent-wait-dedupe-BAUSJotw.js +180 -0
- package/dist/agents/agent-bundle-mcp-materialize.js +1 -1
- package/dist/agents/auth-profiles.runtime.js +1 -1
- package/dist/agents/compaction-planning.worker.js +1 -1
- package/dist/agents/embedded-agent-runner/effective-tool-policy.js +1 -1
- package/dist/agents/embedded-agent-runner/tool-split.js +1 -1
- package/dist/agents/model-catalog.runtime.js +1 -1
- package/dist/agents/model-provider-auth.worker.js +3 -3
- package/dist/agents/models-config.runtime.js +1 -1
- package/dist/agents-CZSNDJWD.js +632 -0
- package/dist/agents.command-shared-DgbjfH23.js +16 -0
- package/dist/agents.commands.add-DknGM1oz.js +304 -0
- package/dist/agents.commands.bind-DDVI0yDe.js +265 -0
- package/dist/agents.commands.delete-Dv4RHEhc.js +128 -0
- package/dist/agents.commands.identity-BSZbc1QR.js +143 -0
- package/dist/agents.commands.list-CA0OTw59.js +235 -0
- package/dist/aliases-EY1GbfwT.js +97 -0
- package/dist/api-CY0oKcRz.js +3 -0
- package/dist/api-DgjY0gIl.js +6 -0
- package/dist/api-VyMyAYze.js +2 -0
- package/dist/api-key-rotation-DxPKIdmC.js +167 -0
- package/dist/app-registration-BBDxCbFo.js +194 -0
- package/dist/apply-DMYy7tc3.js +544 -0
- package/dist/apply-Dd0n97MD.js +2 -0
- package/dist/apply-bHIT1nMp.js +416 -0
- package/dist/apply-g8x7Z83S.js +510 -0
- package/dist/apply-nnbx9TaB.js +2 -0
- package/dist/approval-native-helpers-CjaYvOaZ.js +398 -0
- package/dist/artifacts-B55YR-uA.js +368 -0
- package/dist/assistant-hJaOgfKl.js +291 -0
- package/dist/attachment-normalize-COsastJx.js +213 -0
- package/dist/attempt-execution-fDWDWcWe.js +584 -0
- package/dist/attempt-execution.helpers-Cze5xPim.js +969 -0
- package/dist/attempt-execution.runtime-B1iCG6LN.js +3 -0
- package/dist/attempt-execution.runtime.js +1 -1
- package/dist/attempt.prompt-helpers-CkBYHBBo.js +543 -0
- package/dist/attempt.tool-run-context-DzfRK5pV.js +1240 -0
- package/dist/audio-preflight.runtime-rjWd9uyk.js +7 -0
- package/dist/audio-preflight.runtime.js +1 -1
- package/dist/audit-DgFtNg3U.js +1108 -0
- package/dist/audit-L8EC3WhV.js +477 -0
- package/dist/audit.nondeep.runtime-D0sQ6bO2.js +1416 -0
- package/dist/audit.nondeep.runtime.js +1 -1
- package/dist/audit.runtime-CiG82F31.js +7 -0
- package/dist/audit.runtime.js +1 -1
- package/dist/auth-CzPdsZVM.js +567 -0
- package/dist/auth-choice-BNzS9QBI.js +3 -0
- package/dist/auth-choice-Cwr5kgcD.js +110 -0
- package/dist/auth-choice-DW9qPpMS.js +400 -0
- package/dist/auth-choice.apply.api-providers-C68tOdqj.js +34 -0
- package/dist/auth-choice.apply.api-providers-DSRK0gYo.js +2 -0
- package/dist/auth-choice.plugin-providers.runtime-BJ9VyO1C.js +11 -0
- package/dist/auth-choice.plugin-providers.runtime.js +1 -1
- package/dist/auth-health-BanKwsTW.js +219 -0
- package/dist/auth-list-Dq8obVno.js +115 -0
- package/dist/auth-order-VXqoAroP.js +105 -0
- package/dist/auth-profiles-6VFEdgC-.js +73 -0
- package/dist/auth-profiles-a0M4JYYg.js +14 -0
- package/dist/backend-config-COaTdVnN.js +259 -0
- package/dist/bash-tools-BMAquSiM.js +3 -0
- package/dist/bash-tools-DLiUXfaS.js +3497 -0
- package/dist/binding-routing-Bwvdx_7S.js +113 -0
- package/dist/binding-targets-Z_d0mK_1.js +121 -0
- package/dist/bootstrap-files-CoCV_zqu.js +202 -0
- package/dist/bootstrap-files-_T3VoTrV.js +3 -0
- package/dist/bridge-server-BIaNurGa.js +113 -0
- package/dist/browser-cli-D4wL8NU9.js +230 -0
- package/dist/browser-cli-actions-input-z40PGiYI.js +522 -0
- package/dist/browser-cli-actions-observe-C4TeyNke.js +81 -0
- package/dist/browser-cli-debug-Dv0gH-c8.js +137 -0
- package/dist/browser-cli-inspect-BUXeITYc.js +117 -0
- package/dist/browser-cli-manage-qMb3Yw5Y.js +446 -0
- package/dist/browser-cli-resize-CZWnGwGz.js +32 -0
- package/dist/browser-cli-shared-BpinhvE3.js +69 -0
- package/dist/browser-cli-state-CBbKqqgP.js +371 -0
- package/dist/browser-cli-uI5GGX51.js +2 -0
- package/dist/browser-control-auth-CFPJXdN_.js +2 -0
- package/dist/browser-profiles-D4ni3t4J.js +2 -0
- package/dist/browser-runtime-Dm5D_PLf.js +389 -0
- package/dist/browser-tool.schema-Bek02ox5.js +132 -0
- package/dist/btw-command-DdrwvCK4.js +18 -0
- package/dist/build-DkEeJ9sO.js +261 -0
- package/dist/build-info.json +2 -2
- package/dist/bundled/boot-md/handler.js +2 -2
- package/dist/bundled/session-memory/handler.js +1 -1
- package/dist/bundled-channel-config-schema-BeowdkHi.d.ts +3168 -0
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/capability-cli-DTRuKZJC.js +1809 -0
- package/dist/capability-provider-runtime-Cpp-Jq9g.js +346 -0
- package/dist/cdp.helpers-GfQkB-B5.js +637 -0
- package/dist/channel-BRehZ4Cg.js +2309 -0
- package/dist/channel-actions-hdQKe_se.js +46 -0
- package/dist/channel-bootstrap.runtime-BzjlNG_j.js +38 -0
- package/dist/channel-bootstrap.runtime-CmNNVl40.js +2 -0
- package/dist/channel-bootstrap.runtime.js +1 -1
- package/dist/channel-core-BLcWqSk-.js +5 -0
- package/dist/channel-inbound-pR1B7HTU.js +121 -0
- package/dist/channel-message-W0VurpjH.js +12 -0
- package/dist/channel-outbound-DO4HI6E_.js +436 -0
- package/dist/channel-plugin-resolution-CLA7S5_A.js +2 -0
- package/dist/channel-plugin-resolution-DzwVj01h.js +135 -0
- package/dist/channel-resolution-DOPyiG4k.js +46 -0
- package/dist/channel-selection-kwoWZDQ3.js +171 -0
- package/dist/channel-selection.runtime-LiDliif9.js +2 -0
- package/dist/channel-selection.runtime.js +1 -1
- package/dist/channel.runtime-DDt3PayH.js +697 -0
- package/dist/channel.runtime.js +1 -1
- package/dist/channels-CKJd4eUz.js +1004 -0
- package/dist/channels-cli-DLAPi8pX.js +331 -0
- package/dist/chat-6WsYrS9m.js +3 -0
- package/dist/chat-DpsCEXAx.js +2940 -0
- package/dist/chrome-BWHc9vYG.js +1517 -0
- package/dist/chrome-mcp-BGKgR8A_.js +2 -0
- package/dist/chrome-mcp-Bg5D5PDc.js +864 -0
- package/dist/claude-live-session-BLCZnv-A.js +2 -0
- package/dist/claude-live-session-CGnB64D6.js +1338 -0
- package/dist/clawbot-cli-ynXzgp8B.js +9 -0
- package/dist/cli/daemon-cli.js +3 -3
- package/dist/cli/gateway-lifecycle.runtime.js +4 -4
- package/dist/cli/run-main.js +12 -12
- package/dist/cli-B4Ttnj0P.js +2 -0
- package/dist/cli-BjVgdamH.js +2 -0
- package/dist/cli-CNqBrHLU.js +293 -0
- package/dist/cli-backends.runtime-DoxtCrow.js +7 -0
- package/dist/cli-backends.runtime.js +1 -1
- package/dist/cli-compaction-BCuLbs75.js +363 -0
- package/dist/cli-mthNIkji.js +141 -0
- package/dist/cli-registry-loader-B2sNTdgY.js +2 -0
- package/dist/cli-registry-loader-Dz9YFrjw.js +193 -0
- package/dist/cli-runner-C9t-9-Io.js +597 -0
- package/dist/cli-runner-D21qMGk7.js +2 -0
- package/dist/cli-runner.runtime-BNqbJFgu.js +3 -0
- package/dist/cli-runner.runtime-Dv50IEvH.js +4 -0
- package/dist/cli-runner.runtime.js +1 -1
- package/dist/cli-session-jBtClYfT.js +119 -0
- package/dist/cli-startup-metadata.json +9 -9
- package/dist/cli.runtime-CGBzSGAG.js +1276 -0
- package/dist/cli.runtime.js +1 -1
- package/dist/codex-native-web-search-B3C-srtm.js +20 -0
- package/dist/codex-native-web-search-B7xh2Xcb.js +4 -0
- package/dist/codex-native-web-search-core-CrwANQg5.js +106 -0
- package/dist/command-auth-Dz_pdczs.js +135 -0
- package/dist/command-config-resolution-XCA63Yv8.js +25 -0
- package/dist/command-config-resolution-xtKMDTG9.js +2 -0
- package/dist/command-config-resolution.runtime-xtKMDTG9.js +2 -0
- package/dist/command-config-resolution.runtime.js +1 -1
- package/dist/command-execution-startup-CasEqEXh.js +90 -0
- package/dist/command-primitives-runtime-DC9gtSI3.js +3 -0
- package/dist/command-registry-BQnMdca9.js +9 -0
- package/dist/command-registry-core-hx2t1jQP.js +114 -0
- package/dist/command-registry-rbKA-L_8.js +4 -0
- package/dist/command-secret-gateway-7oveYQCx.js +589 -0
- package/dist/command-secret-targets-B7M1Us_C.js +2 -0
- package/dist/command-status-builders-DrSoZhiI.js +147 -0
- package/dist/command-status.runtime-By0071-y.js +90 -0
- package/dist/command-status.runtime.js +1 -1
- package/dist/commands/status.summary.runtime.js +3 -3
- package/dist/commands-B1MnUj5-.js +161 -0
- package/dist/commands-compact.runtime-DELj3JaW.js +10 -0
- package/dist/commands-compact.runtime.js +1 -1
- package/dist/commands-core.runtime-Zw0grrkC.js +2 -0
- package/dist/commands-core.runtime.js +1 -1
- package/dist/commands-handlers.runtime-BCl_ZHJZ.js +6327 -0
- package/dist/commands-handlers.runtime.js +1 -1
- package/dist/commands-models-Uurm-0C3.js +448 -0
- package/dist/commands-registry-Bo1AeDcq.js +195 -0
- package/dist/commands-registry.runtime-C9DBHyhh.js +4 -0
- package/dist/commands-registry.runtime.js +1 -1
- package/dist/commands-status-BoAXH-wg.js +16 -0
- package/dist/commands-status-CNALMTN9.js +3 -0
- package/dist/commands-status.runtime-CNALMTN9.js +3 -0
- package/dist/commands-status.runtime.js +1 -1
- package/dist/commands-subagents-control.runtime-Dl4IuTzV.js +2 -0
- package/dist/commands-subagents-control.runtime.js +1 -1
- package/dist/commands-system-prompt-BPzpLmUp.js +2 -0
- package/dist/commands-system-prompt-DCOZSNh5.js +161 -0
- package/dist/commands.runtime-bfCLM0Sg.js +175 -0
- package/dist/commands.runtime.js +1 -1
- package/dist/commitments/runtime.js +1 -1
- package/dist/common-CoOYhmSg.js +286 -0
- package/dist/compact-yqaUOESq.js +1165 -0
- package/dist/compact.runtime-Y91AFZVE.js +12 -0
- package/dist/compact.runtime.js +1 -1
- package/dist/compaction-planning-DVnykwzd.js +202 -0
- package/dist/completion-cli-BJjq_g_B.js +393 -0
- package/dist/config-CsmSEaNn.js +374 -0
- package/dist/config-CtNXZ0iy.js +610 -0
- package/dist/config-cli-CNpIVdqp.js +1703 -0
- package/dist/config-mutation-B-SErGM0.js +5 -0
- package/dist/config-mutations-Bu3ahkX8.js +161 -0
- package/dist/config-utils-Bv0Nisds.js +141 -0
- package/dist/config-validation-DitvTYD8.js +33 -0
- package/dist/configure-CdjbRKTg.js +771 -0
- package/dist/configure-Cvi-5ml4.js +3 -0
- package/dist/configure.commands-BJii4733.js +1253 -0
- package/dist/configure.commands-tJzVFJ0o.js +2 -0
- package/dist/context-D1N9oPds.js +2 -0
- package/dist/context-XMtJ9b3v.js +248 -0
- package/dist/context-engine-host-compat-3QznbSaW.js +280 -0
- package/dist/context-engine-host-compat-DquSpnKD.js +2 -0
- package/dist/context-engine-lifecycle-Bqdhy9JU.js +627 -0
- package/dist/control-auth-CMW_9jmY.js +114 -0
- package/dist/control-service-D-r3k91q.js +40 -0
- package/dist/control-service-uIPYrp9F.js +3 -0
- package/dist/control-ui/assets/activity-DgMhyllD.js +124 -0
- package/dist/control-ui/assets/agents-CsRhxO2O.js +1030 -0
- package/dist/control-ui/assets/channels-Dq8bzpMg.js +120 -0
- package/dist/control-ui/assets/cron-Dk5bqYwg.js +1016 -0
- package/dist/control-ui/assets/debug-CNIwFEQO.js +97 -0
- package/dist/control-ui/assets/index-CV2NsPlu.js +7214 -0
- package/dist/control-ui/assets/instances-DLr0iEvT.js +57 -0
- package/dist/control-ui/assets/nodes-D3JEksjl.js +444 -0
- package/dist/control-ui/assets/sessions-nbXWGlHZ.js +425 -0
- package/dist/control-ui/assets/skills-tBOi8OBq.js +362 -0
- package/dist/control-ui/assets/workboard-ClTo7wmK.js +402 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/control-ui/sw.js +1 -1
- package/dist/control-ui-AkRMsk9S.js +750 -0
- package/dist/conversation-label-generator-DHtcgSBn.js +72 -0
- package/dist/conversation-runtime-BEgHW4ta.js +31 -0
- package/dist/core-Bslrvfnp.js +284 -0
- package/dist/core-api-BOlUb7G8.js +5 -0
- package/dist/core-api-CiBoGa2I.js +2 -0
- package/dist/crestodian/crestodian.js +1 -1
- package/dist/crestodian/rescue-message.js +1 -1
- package/dist/crestodian-mXnyuHx9.js +55 -0
- package/dist/cron-PbdpyFrD.js +453 -0
- package/dist/daemon-install-C-d4dFvn.js +66 -0
- package/dist/daemon-install-auth-profiles-store.runtime-CvE2EVVo.js +2 -0
- package/dist/daemon-install-auth-profiles-store.runtime.js +1 -1
- package/dist/dashboard-Ey5dnvMI.js +263 -0
- package/dist/defaults-CsRAv-qE.js +130 -0
- package/dist/defaults-DHZBSNHC.js +3 -0
- package/dist/defaults.constants-CR4S_tvw.js +76 -0
- package/dist/deliver-BkuuFBlm.js +1399 -0
- package/dist/deliver-P4upyes7.js +3 -0
- package/dist/deliver-runtime-CjnLI_nC.js +2 -0
- package/dist/delivery-outbound.runtime-fcJ-M8qj.js +7 -0
- package/dist/delivery-outbound.runtime.js +1 -1
- package/dist/delivery-queue-BqgHvNlY.js +863 -0
- package/dist/delivery-queue-CfsRscJb.js +2 -0
- package/dist/delivery-queue-runtime-D0PKG1Bv.js +16 -0
- package/dist/delivery-target.runtime-C5e8d0WH.js +45 -0
- package/dist/delivery-target.runtime.js +1 -1
- package/dist/delivery.runtime-2Ut8xM3P.js +470 -0
- package/dist/delivery.runtime.js +1 -1
- package/dist/detached-task-runtime-OOZBqRy-.js +86 -0
- package/dist/diagnostics-zf6WQ2h7.js +168 -0
- package/dist/dialogue-C8IOya-l.js +37 -0
- package/dist/direct-dm-wPF-KfNb.js +81 -0
- package/dist/directive-handling.defaults-C-1lmFYo.js +22 -0
- package/dist/directive-handling.fast-lane-DENPMtYI.js +70 -0
- package/dist/directive-handling.impl-C1p5t3qA.js +2 -0
- package/dist/directive-handling.impl-DOo2Sa7C.js +823 -0
- package/dist/directive-handling.model-selection-6gC-fr_g.js +122 -0
- package/dist/directive-handling.persist.runtime-CuhUd2kW.js +274 -0
- package/dist/directive-handling.persist.runtime.js +1 -1
- package/dist/directives-BIKSyN8C.js +319 -0
- package/dist/directory-cli-DZ0PU0Rv.js +239 -0
- package/dist/dispatch-DQLImAqt.js +2057 -0
- package/dist/dispatch-acp-DzyX7wsq.js +1102 -0
- package/dist/dispatch-acp-manager.runtime-CoAfs4O1.js +3 -0
- package/dist/dispatch-acp-manager.runtime.js +1 -1
- package/dist/dispatch-acp-media.runtime-7uUP_jr9.js +4 -0
- package/dist/dispatch-acp-media.runtime.js +1 -1
- package/dist/dispatch-acp-transcript.runtime-BUlmV_h0.js +40 -0
- package/dist/dispatch-acp-transcript.runtime.js +1 -1
- package/dist/dispatch-acp-tts.runtime-ChBnVkNt.js +3 -0
- package/dist/dispatch-acp-tts.runtime.js +1 -1
- package/dist/dispatch-acp.runtime-DAexFaBu.js +18 -0
- package/dist/dispatch-acp.runtime.js +1 -1
- package/dist/dispatcher-D3IQEbf9.js +106 -0
- package/dist/doctor-BSqEqfb6.js +760 -0
- package/dist/doctor-auth-flat-profiles-BIZ4wsYP.js +2 -0
- package/dist/doctor-auth-flat-profiles-DXtD5LfC.js +516 -0
- package/dist/doctor-auth-legacy-oauth-DwFbRYTP.js +48 -0
- package/dist/doctor-auth-oauth-sidecar-6I3FEJbi.js +2 -0
- package/dist/doctor-auth-oauth-sidecar-BSC3rnDM.js +177 -0
- package/dist/doctor-auth-tVGsUiM6.js +216 -0
- package/dist/doctor-bootstrap-size-B0q6bdkO.js +57 -0
- package/dist/doctor-claude-cli-Bn79OuBT.js +150 -0
- package/dist/doctor-config-flow-CCwocXpV.js +1819 -0
- package/dist/doctor-core-checks-D7-1l8jy.js +666 -0
- package/dist/doctor-core-checks-eM8FNi8B.js +2 -0
- package/dist/doctor-core-checks.runtime-Dc03aeoU.js +278 -0
- package/dist/doctor-core-checks.runtime.js +1 -1
- package/dist/doctor-gRYfpEbB.js +6 -0
- package/dist/doctor-gateway-daemon-flow-KTnHAdeV.js +349 -0
- package/dist/doctor-gateway-services-BByDQtjY.js +465 -0
- package/dist/doctor-health-CnoM718z.js +65 -0
- package/dist/doctor-health-contributions-flVKMQwr.js +874 -0
- package/dist/doctor-lint-BBm6gtBa.js +95 -0
- package/dist/doctor-memory-search-DjHVDCGo.js +407 -0
- package/dist/doctor-state-integrity-Bgw25cz1.js +1257 -0
- package/dist/doctor-tool-result-cap-advice-B8wTpiTO.js +27 -0
- package/dist/doctor-workspace-status-DcjeJIpT.js +76 -0
- package/dist/dreaming-BE4t8DVf.js +523 -0
- package/dist/dreaming-command-DWm1lB-Z.js +101 -0
- package/dist/dreaming-narrative-8DM-OMrm.js +721 -0
- package/dist/dreaming-narrative-CcFfheQI.js +2 -0
- package/dist/dreaming-phases-CqOhhTdZ.js +2 -0
- package/dist/dreaming-phases-D9eT6Kk0.js +1162 -0
- package/dist/drive-D2M5B7-2.js +899 -0
- package/dist/echo-transcript-B-wl5MoX.js +52 -0
- package/dist/effective-tool-policy-Cx8mC5aA.js +89 -0
- package/dist/embedded-agent-BTvtoOe_.js +4 -0
- package/dist/embedded-agent-CGmSKuNM.js +4074 -0
- package/dist/embedded-agent-helpers-CboIPx57.js +6 -0
- package/dist/embedded-agent-helpers-cw0InMDZ.js +1037 -0
- package/dist/embedded-agent.runtime-Bfe4bjyF.js +4 -0
- package/dist/embedded-agent.runtime.js +1 -1
- package/dist/embedded-backend-D-EshN85.js +744 -0
- package/dist/embedded-gateway-stub.runtime-Cx9qs0KV.js +12 -0
- package/dist/embedded-gateway-stub.runtime.js +1 -1
- package/dist/embedding-provider-runtime-DaXfsUPo.js +86 -0
- package/dist/embedding-providers-CdU99clu.js +2 -0
- package/dist/embeddings-http-BQnlTr-1.js +222 -0
- package/dist/engine-qmd-5jbjGywA.js +708 -0
- package/dist/engine-storage-CfAgwoDp.js +203 -0
- package/dist/entry.js +1 -1
- package/dist/errors-C0AUxo3P.js +2 -0
- package/dist/exec-approval-forwarder.runtime-BvR47p5Z.js +4 -0
- package/dist/exec-approval-forwarder.runtime.js +1 -1
- package/dist/exec-approval-session-target-CCqYgaVa.js +177 -0
- package/dist/exec-auto-reviewer-BfJaNkNy.js +2 -0
- package/dist/exec-auto-reviewer-Dqx7I88Z.js +241 -0
- package/dist/execute.runtime-Qb6Z75sG.js +579 -0
- package/dist/execute.runtime.js +1 -1
- package/dist/extensionAPI.js +2 -2
- package/dist/extensions/active-memory/index.js +3 -3
- package/dist/extensions/admin-http-rpc/index.js +1 -1
- package/dist/extensions/alibaba/index.js +1 -1
- package/dist/extensions/alibaba/video-generation-provider.js +1 -1
- package/dist/extensions/baichuan/index.js +1 -1
- package/dist/extensions/browser/browser-bridge.js +1 -1
- package/dist/extensions/browser/browser-cdp.js +1 -1
- package/dist/extensions/browser/browser-config.js +5 -5
- package/dist/extensions/browser/browser-control-auth.js +2 -2
- package/dist/extensions/browser/browser-doctor.js +3 -3
- package/dist/extensions/browser/browser-maintenance.js +1 -1
- package/dist/extensions/browser/browser-profiles.js +3 -3
- package/dist/extensions/browser/browser-runtime-api.js +14 -14
- package/dist/extensions/browser/cli-metadata.js +1 -1
- package/dist/extensions/browser/index.js +1 -1
- package/dist/extensions/browser/plugin-registration.js +1 -1
- package/dist/extensions/browser/register.runtime.js +4 -4
- package/dist/extensions/browser/runtime-api.js +16 -16
- package/dist/extensions/byteplus/index.js +3 -3
- package/dist/extensions/byteplus/video-generation-provider.js +1 -1
- package/dist/extensions/canvas/index.js +3 -3
- package/dist/extensions/canvas/runtime-api.js +2 -2
- package/dist/extensions/deepseek/index.js +1 -1
- package/dist/extensions/device-pair/api.js +2 -2
- package/dist/extensions/device-pair/pair-command-approve.js +1 -1
- package/dist/extensions/device-pair/qr-image.js +2 -2
- package/dist/extensions/longcat/index.js +1 -1
- package/dist/extensions/memory-core/api.js +3 -3
- package/dist/extensions/memory-core/cli-metadata.js +1 -1
- package/dist/extensions/memory-core/cli.js +2 -2
- package/dist/extensions/memory-core/index.js +11 -11
- package/dist/extensions/memory-core/manager-runtime.js +1 -1
- package/dist/extensions/memory-core/runtime-api.js +6 -6
- package/dist/extensions/minimax/image-generation-provider.js +1 -1
- package/dist/extensions/minimax/index.js +7 -7
- package/dist/extensions/minimax/media-understanding-provider.js +1 -1
- package/dist/extensions/minimax/music-generation-provider.js +1 -1
- package/dist/extensions/minimax/oauth.js +1 -1
- package/dist/extensions/minimax/oauth.runtime.js +1 -1
- package/dist/extensions/minimax/provider-registration.js +1 -1
- package/dist/extensions/minimax/speech-provider.js +1 -1
- package/dist/extensions/minimax/video-generation-provider.js +1 -1
- package/dist/extensions/minimax/web-search-provider.js +1 -1
- package/dist/extensions/moonshot/index.js +5 -5
- package/dist/extensions/moonshot/media-understanding-provider.js +1 -1
- package/dist/extensions/moonshot/web-search-provider.js +1 -1
- package/dist/extensions/qianfan/index.js +1 -1
- package/dist/extensions/qwen/index.js +5 -5
- package/dist/extensions/qwen/media-understanding-provider.js +1 -1
- package/dist/extensions/qwen/video-generation-provider.js +1 -1
- package/dist/extensions/sensenova/index.js +1 -1
- package/dist/extensions/skill-workshop/api.js +2 -2
- package/dist/extensions/skill-workshop/index.js +4 -4
- package/dist/extensions/stepfun/index.js +2 -2
- package/dist/extensions/tavily/index.js +1 -1
- package/dist/extensions/tavily/web-search-provider.js +1 -1
- package/dist/extensions/tencent/index.js +2 -2
- package/dist/extensions/tiangong/index.js +1 -1
- package/dist/extensions/volcengine/index.js +3 -3
- package/dist/extensions/volcengine/speech-provider.js +1 -1
- package/dist/extensions/webhooks/api.js +1 -1
- package/dist/extensions/webhooks/index.js +1 -1
- package/dist/extensions/weixin/index.js +7 -7
- package/dist/extensions/workboard/index.js +2 -2
- package/dist/extensions/xiaomi/index.js +4 -4
- package/dist/extensions/xiaomi/speech-provider.js +1 -1
- package/dist/extensions/xingchen/index.js +1 -1
- package/dist/extensions/yi/index.js +1 -1
- package/dist/extensions/zai/index.js +4 -4
- package/dist/extensions/zai/media-understanding-provider.js +1 -1
- package/dist/extensions/zhinao/index.js +1 -1
- package/dist/external-cli-auth-selection-CM_aOUJw.js +113 -0
- package/dist/extra-params-Bm1eLWN9.js +615 -0
- package/dist/fallback-notice-state-v1kyWACv.js +15 -0
- package/dist/fallbacks-CDllk2g1.js +31 -0
- package/dist/fallbacks-shared-DdMKEmAC.js +116 -0
- package/dist/fengming-runtime-DSv30J04.js +33 -0
- package/dist/fengming-runtime-config-BE-DquuY.js +2 -0
- package/dist/fengming-runtime-memory-BE-DquuY.js +2 -0
- package/dist/fengming-runtime-session-BE-DquuY.js +2 -0
- package/dist/fengming-tools-DHb-ZeDC.js +12221 -0
- package/dist/flows-Cz3y10A9.js +189 -0
- package/dist/fs-utils-D05rps7O.js +9 -0
- package/dist/gateway-DTi2D7ZS.js +133 -0
- package/dist/gateway-cli-DT2fL2fX.js +443 -0
- package/dist/gateway-install-token-CJhAycOA.js +136 -0
- package/dist/gateway-method-runtime-BuiYTDQk.js +21 -0
- package/dist/gateway-runtime-C5_cVlSW.js +23 -0
- package/dist/get-reply-Cz-dUrWm.js +5198 -0
- package/dist/get-reply-from-config.runtime-BC1HT67i.js +2 -0
- package/dist/get-reply-from-config.runtime.js +1 -1
- package/dist/github-copilot-token-09lxV3kH.js +2 -0
- package/dist/health-CmihbcqN.js +621 -0
- package/dist/health-D8L37hBZ.js +111 -0
- package/dist/health-DU7I9RrJ.js +3 -0
- package/dist/health-state-QZ2E6xGQ.js +106 -0
- package/dist/heartbeat-runner-Bz5PMzEI.js +1930 -0
- package/dist/heartbeat-runner-DfqqQ_8w.js +5 -0
- package/dist/heartbeat-runner.runtime-8BshUhoS.js +3 -0
- package/dist/heartbeat-runner.runtime.js +1 -1
- package/dist/helpers-Bkq4POdX.js +406 -0
- package/dist/hook-helpers-nmDwt3Fa.js +44 -0
- package/dist/hooks-9FOcRqfu.js +536 -0
- package/dist/hooks-cli-CrQelcwo.js +465 -0
- package/dist/http-endpoint-helpers-BD5u6YsT.js +37 -0
- package/dist/http-utils-RcKuBJ0I.js +98 -0
- package/dist/image-DwNoypK2.js +385 -0
- package/dist/image-fallbacks-BUyDnmUX.js +31 -0
- package/dist/image-generation-core.auth.runtime-CA8miEMh.js +2 -0
- package/dist/image-generation-core.auth.runtime.js +1 -1
- package/dist/image-generation-provider-DXMW5EmB.js +152 -0
- package/dist/image-runtime-D5QpNNzz.js +9 -0
- package/dist/image-tool.helpers-6vGxo1Y0.js +150 -0
- package/dist/images-BGWLzQEJ.js +416 -0
- package/dist/images-Db4UB3JG.js +2 -0
- package/dist/inbound-reply-dispatch-DRF6ZmQg.js +2 -0
- package/dist/inbound-reply-dispatch-RAKLqow4.js +147 -0
- package/dist/index.js +1 -1
- package/dist/infra-runtime-BFrpRc_V.js +32 -0
- package/dist/init-sR7bCS9D.js +59 -0
- package/dist/install-BzdJbOUx.js +262 -0
- package/dist/install.runtime-Zye6pbZ6.js +2 -0
- package/dist/internal-DL_vFx8C.js +399 -0
- package/dist/isolated-agent-Qif8Llbt.js +2 -0
- package/dist/isolated-agent-aqEjxqs-.js +1097 -0
- package/dist/kernel-B-i4c2IK.js +979 -0
- package/dist/kernel-DYDJ_hLb.js +3 -0
- package/dist/kimi-web-search-provider.runtime-95HAkvHY.js +307 -0
- package/dist/kimi-web-search-provider.runtime.js +1 -1
- package/dist/library-CZVbE5hF.js +45 -0
- package/dist/lifecycle-C8M3YLbT.js +2 -0
- package/dist/lifecycle-CPDNQnUN.js +570 -0
- package/dist/lifecycle-DpuP7n3J.js +355 -0
- package/dist/lifecycle.runtime-C8M3YLbT.js +2 -0
- package/dist/lifecycle.runtime.js +1 -1
- package/dist/link-understanding/apply.runtime.js +3 -3
- package/dist/list-B_ALwpPl.js +2 -0
- package/dist/list-Bda_GYFy.js +207 -0
- package/dist/list.list-command-W9OGfAIU.js +429 -0
- package/dist/list.model-row-LV4AaX0H.js +39 -0
- package/dist/list.probe-CrZm6BH2.js +451 -0
- package/dist/list.probe-Dfdmb8bC.js +2 -0
- package/dist/list.provider-catalog-7T1jKk0n.js +211 -0
- package/dist/list.provider-catalog-DjGyZVEj.js +2 -0
- package/dist/list.registry-load-DkCS8JZQ.js +152 -0
- package/dist/list.row-sources-B1vjo_Y9.js +474 -0
- package/dist/list.source-plan-C9Sa6zRK.js +81 -0
- package/dist/list.status-command-9daSZZDm.js +815 -0
- package/dist/live-model-switch-Dy-UFUMS.js +119 -0
- package/dist/llm-slug-generator-DEmh5-_1.js +78 -0
- package/dist/llm-slug-generator.js +1 -1
- package/dist/load-config-CvQpC8k6.js +27 -0
- package/dist/load-context-_qSHpZ5S.js +82 -0
- package/dist/loader-CntMt07B.js +7008 -0
- package/dist/local-dispatch.runtime-BSN_gqNS.js +10 -0
- package/dist/local-dispatch.runtime.js +1 -1
- package/dist/main-session-restart-recovery-Db7366lt.js +2 -0
- package/dist/main-session-restart-recovery-n87NTooQ.js +389 -0
- package/dist/managed-image-attachments-BTBBHlKl.js +2 -0
- package/dist/managed-image-attachments-C6_V1yX0.js +616 -0
- package/dist/manager-CKrWxjV6.js +3737 -0
- package/dist/manager-Dvb1FVnx.js +2314 -0
- package/dist/mcp/plugin-tools-serve.js +2 -2
- package/dist/mcp-http-CSoGXOa_.js +583 -0
- package/dist/mcp-http-D4ieDB3W.js +2 -0
- package/dist/media-runtime-GeQTQkkK.js +391 -0
- package/dist/media-services-CWbIUZDe.js +416 -0
- package/dist/media-understanding/apply.runtime.js +1 -1
- package/dist/media-understanding-DXc2BD2L.js +87 -0
- package/dist/media-understanding-provider-BkdUiVWU.js +70 -0
- package/dist/media-understanding-provider-BlgmLViW.js +13 -0
- package/dist/media-understanding-provider-C9P2VjkC.js +29 -0
- package/dist/media-understanding-provider-CJlbgAvl.js +69 -0
- package/dist/memory-CnC2jM1l.js +437 -0
- package/dist/memory-core-host-engine-embeddings-Dy9vN-Ce.js +667 -0
- package/dist/memory-core-host-engine-foundation-C-pGGQnm.js +15 -0
- package/dist/memory-core-host-engine-qmd-DLJDON9w.js +2 -0
- package/dist/memory-core-host-engine-storage-Bzf-C8XE.js +2 -0
- package/dist/memory-core-host-runtime-cli-_LWA6G3x.js +10 -0
- package/dist/memory-core-host-runtime-core-CromkNBr.js +12 -0
- package/dist/memory-core-host-runtime-files-DpbviC1b.js +4 -0
- package/dist/memory-embedding-provider-runtime-CaVVaYC5.js +36 -0
- package/dist/memory-host-core-B5dWHwBF.js +78 -0
- package/dist/memory-host-search.runtime-DqlCFac1.js +2 -0
- package/dist/memory-host-search.runtime.js +1 -1
- package/dist/memory-runtime-BCeeWb1G.js +2 -0
- package/dist/memory-runtime-pR9KGin0.js +57 -0
- package/dist/memory-search-CpDEEY2Q.js +235 -0
- package/dist/message-BeGCG-D8.js +284 -0
- package/dist/message-YGMOyqP5.js +2 -0
- package/dist/message-action-runner-ByMT3_eb.js +1922 -0
- package/dist/message-action-runner-VXmKO_W7.js +2 -0
- package/dist/message-handler-MZ0DMbCx.js +1806 -0
- package/dist/metadata-registry-loader-BH9D1UOx.js +2 -0
- package/dist/metadata-registry-loader-BK1cHCas.js +22 -0
- package/dist/migrate-BA6w0hd3.js +2 -0
- package/dist/migrate-BGuQC-1W.js +458 -0
- package/dist/migration-provider-runtime-BBdDegWG.js +2 -0
- package/dist/migration-provider-runtime-C5WUjrQz.js +68 -0
- package/dist/minimax-web-search-provider.runtime-suVFk3Zx.js +148 -0
- package/dist/minimax-web-search-provider.runtime.js +1 -1
- package/dist/model-BJZXR9dq.js +1302 -0
- package/dist/model-BL7xlN5h.js +2 -0
- package/dist/model-auth-C-6dYVob.js +6 -0
- package/dist/model-auth-DJz7R41W.js +705 -0
- package/dist/model-auth-label-DKNXktIu.js +67 -0
- package/dist/model-catalog-BjiK5rtT.js +3 -0
- package/dist/model-catalog-DM1CTjkW.js +434 -0
- package/dist/model-catalog-visibility-DEJZG0In.js +76 -0
- package/dist/model-config.helpers-BKcUeE_P.js +95 -0
- package/dist/model-context-tokens-5y_PQELY.js +572 -0
- package/dist/model-fallback-BDdBR053.js +1288 -0
- package/dist/model-fallback-auth.runtime-pcWfkIUF.js +5 -0
- package/dist/model-fallback-auth.runtime.js +1 -1
- package/dist/model-picker-Bpvp4_N4.js +1135 -0
- package/dist/model-picker-DWPPtq6d.js +3 -0
- package/dist/model-picker-visibility-BtdqVF80.js +22 -0
- package/dist/model-picker.runtime-CYlqts2z.js +48 -0
- package/dist/model-picker.runtime.js +1 -1
- package/dist/model-pricing-cache-BmmncDqL.js +856 -0
- package/dist/model-pricing-cache-CEwRyWw2.js +3 -0
- package/dist/model-pricing-cache-state-B8Aspp85.js +83 -0
- package/dist/model-provider-auth-B3KXoKkE.js +2 -0
- package/dist/model-provider-auth-Bo_8T7of.js +375 -0
- package/dist/model-runtime-aliases-Br-ZlhrL.js +133 -0
- package/dist/model-selection-D5-ERakL.js +254 -0
- package/dist/model-selection-DrzgktRu.js +7 -0
- package/dist/model-selection-ibwsPgIw.js +352 -0
- package/dist/model-selection.runtime-BRkOZejt.js +7 -0
- package/dist/model-selection.runtime.js +1 -1
- package/dist/models-RPAH3ZBn.js +57 -0
- package/dist/models-auth-status-Cwu9OXU8.js +280 -0
- package/dist/models-cli-CrYkSUoa.js +257 -0
- package/dist/models-config-Ayzj9gDz.js +1189 -0
- package/dist/models-config-BFcjB7nN.js +2 -0
- package/dist/models-config.providers.secrets-CCRUW7gL.js +2 -0
- package/dist/models-config.providers.secrets-DdX_XSRo.js +382 -0
- package/dist/models-http-jLFnelH7.js +88 -0
- package/dist/monitor-CqWICrjO.js +60 -0
- package/dist/monitor-DwccYPfp.js +1024 -0
- package/dist/monitor.account-e9EVttpP.js +5382 -0
- package/dist/music-generation-provider-Dfc--R-x.js +308 -0
- package/dist/native-hook-relay-Cioqiqv8.js +1378 -0
- package/dist/native-hook-relay-DRwJIspI.js +19 -0
- package/dist/node-cli-CrG3LH9J.js +2806 -0
- package/dist/node-command-policy-CkBTEmhl.js +295 -0
- package/dist/nodes-BxrWFA09.js +1483 -0
- package/dist/nodes-DFPTGZjc.js +3 -0
- package/dist/nodes-cli-Czwyt6r1.js +960 -0
- package/dist/nodes-pending-B_4QHyB2.js +211 -0
- package/dist/nodes-utils-c4k31OaG.js +85 -0
- package/dist/oauth-BXncC0JP.js +852 -0
- package/dist/oauth-Ba1O2vqP.js +207 -0
- package/dist/oauth-CGQkfxbJ.js +746 -0
- package/dist/onboard-I5tQlVm6.js +768 -0
- package/dist/onboard-channels-BleKfB1D.js +2 -0
- package/dist/onboard-channels-jVaUjGYX.js +1534 -0
- package/dist/onboard-custom-BR_5oqUr.js +3 -0
- package/dist/onboard-custom-Ss0DThuP.js +280 -0
- package/dist/onboard-custom-config-B-knjQm7.js +422 -0
- package/dist/onboard-search-BsIztGYF.js +412 -0
- package/dist/openai-compat-errors-UkLkk8Q9.js +136 -0
- package/dist/openai-http-mTQB44gu.js +836 -0
- package/dist/openai-transport-stream-CZSs3SIi.js +3427 -0
- package/dist/openresponses-http-BA1Shmj-.js +1175 -0
- package/dist/operations-DhgPih1F.js +805 -0
- package/dist/order-CaXafMPG.js +218 -0
- package/dist/outbound-attachment-BAp7DXDc.js +19 -0
- package/dist/param-readers-De-m2SoB.js +2 -0
- package/dist/payloads-Dg9aAEOC.js +256 -0
- package/dist/persistent-bindings.lifecycle-BkLOz501.js +2 -0
- package/dist/persistent-bindings.lifecycle-e2MLbBCo.js +85 -0
- package/dist/plugin-enabled-CGSENjXc.js +232 -0
- package/dist/plugin-install-BI9_bsVT.js +118 -0
- package/dist/plugin-install-an4V2iXO.js +2 -0
- package/dist/plugin-install-config-policy-C66Nss3D.js +169 -0
- package/dist/plugin-registration-DMerQktl.js +97 -0
- package/dist/plugin-registry-BZfdCw65.js +3 -0
- package/dist/plugin-registry-I1fegSdK.js +2 -0
- package/dist/plugin-runtime-B3XMLJka.js +102 -0
- package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
- package/dist/plugin-sdk/acp-binding-runtime.js +1 -1
- package/dist/plugin-sdk/acp-runtime-backend.js +1 -1
- package/dist/plugin-sdk/acp-runtime.js +2 -2
- package/dist/plugin-sdk/agent-config-primitives.d.ts +1 -1
- package/dist/plugin-sdk/agent-harness-runtime.js +16 -16
- package/dist/plugin-sdk/agent-harness-task-runtime.js +4 -4
- package/dist/plugin-sdk/agent-harness.js +17 -17
- package/dist/plugin-sdk/agent-runtime.js +17 -17
- package/dist/plugin-sdk/agent-sessions.js +1 -1
- package/dist/plugin-sdk/approval-native-runtime.js +2 -2
- package/dist/plugin-sdk/approval-reaction-runtime.js +1 -1
- package/dist/plugin-sdk/approval-runtime.js +2 -2
- package/dist/plugin-sdk/bundled-channel-config-schema-BsOWCrJT.d.ts +3169 -0
- package/dist/plugin-sdk/bundled-channel-config-schema.d.ts +3 -3
- package/dist/plugin-sdk/channel-actions.js +2 -2
- package/dist/plugin-sdk/channel-config-primitives.d.ts +2 -2
- package/dist/plugin-sdk/channel-config-schema-legacy.d.ts +3 -3
- package/dist/plugin-sdk/channel-config-schema.d.ts +2 -2
- package/dist/plugin-sdk/channel-core.d.ts +1 -1
- package/dist/plugin-sdk/channel-core.js +2 -2
- package/dist/plugin-sdk/channel-envelope.js +1 -1
- package/dist/plugin-sdk/channel-inbound-roots.js +1 -1
- package/dist/plugin-sdk/channel-inbound.js +4 -4
- package/dist/plugin-sdk/channel-location.js +1 -1
- package/dist/plugin-sdk/channel-message-runtime.js +5 -5
- package/dist/plugin-sdk/channel-message.js +5 -5
- package/dist/plugin-sdk/channel-outbound.js +2 -2
- package/dist/plugin-sdk/channel-plugin-common.d.ts +1 -1
- package/dist/plugin-sdk/channel-reply-options-runtime.js +1 -1
- package/dist/plugin-sdk/command-auth-native.js +2 -2
- package/dist/plugin-sdk/command-auth.js +4 -4
- package/dist/plugin-sdk/command-primitives-runtime.js +2 -2
- package/dist/plugin-sdk/command-status-runtime.js +1 -1
- package/dist/plugin-sdk/command-status.js +1 -1
- package/dist/plugin-sdk/compat.d.ts +2 -2
- package/dist/plugin-sdk/compat.js +2 -2
- package/dist/plugin-sdk/config-mutation.js +2 -2
- package/dist/plugin-sdk/config-runtime.js +1 -1
- package/dist/plugin-sdk/config-schema-DUddICQM.d.ts +33 -0
- package/dist/plugin-sdk/conversation-binding-runtime.js +1 -1
- package/dist/plugin-sdk/conversation-runtime.js +3 -3
- package/dist/plugin-sdk/core.d.ts +1 -1
- package/dist/plugin-sdk/core.js +3 -3
- package/dist/plugin-sdk/delivery-queue-runtime.js +1 -1
- package/dist/plugin-sdk/direct-dm.js +1 -1
- package/dist/plugin-sdk/discord.d.ts +2 -2
- package/dist/plugin-sdk/embedding-providers.js +2 -2
- package/dist/plugin-sdk/gateway-method-runtime.js +1 -1
- package/dist/plugin-sdk/gateway-runtime.js +2 -2
- package/dist/plugin-sdk/health.js +1 -1
- package/dist/plugin-sdk/image-generation-core.js +3 -3
- package/dist/plugin-sdk/image-generation-runtime.js +1 -1
- package/dist/plugin-sdk/image-generation.js +2 -2
- package/dist/plugin-sdk/inbound-reply-dispatch.js +3 -3
- package/dist/plugin-sdk/index.js +1 -1
- package/dist/plugin-sdk/infra-runtime.js +3 -3
- package/dist/plugin-sdk/mattermost.js +1 -1
- package/dist/plugin-sdk/media-generation-runtime-shared.js +1 -1
- package/dist/plugin-sdk/media-generation-runtime.js +1 -1
- package/dist/plugin-sdk/media-runtime.js +7 -7
- package/dist/plugin-sdk/media-understanding-runtime.js +1 -1
- package/dist/plugin-sdk/media-understanding.js +2 -2
- package/dist/plugin-sdk/memory-core-host-engine-embeddings.js +4 -4
- package/dist/plugin-sdk/memory-core-host-engine-foundation.js +2 -2
- package/dist/plugin-sdk/memory-core-host-engine-qmd.js +2 -2
- package/dist/plugin-sdk/memory-core-host-engine-storage.js +6 -6
- package/dist/plugin-sdk/memory-core-host-runtime-cli.js +2 -2
- package/dist/plugin-sdk/memory-core-host-runtime-core.js +3 -3
- package/dist/plugin-sdk/memory-core-host-runtime-files.js +4 -4
- package/dist/plugin-sdk/memory-core.js +3 -3
- package/dist/plugin-sdk/memory-host-core.js +3 -3
- package/dist/plugin-sdk/memory-host-files.js +4 -4
- package/dist/plugin-sdk/memory-host-search.js +1 -1
- package/dist/plugin-sdk/models-provider-runtime.js +1 -1
- package/dist/plugin-sdk/music-generation-core.js +1 -1
- package/dist/plugin-sdk/native-command-registry.js +1 -1
- package/dist/plugin-sdk/outbound-media.js +2 -2
- package/dist/plugin-sdk/outbound-runtime.js +3 -3
- package/dist/plugin-sdk/param-readers.js +2 -2
- package/dist/plugin-sdk/plugin-runtime.js +2 -2
- package/dist/plugin-sdk/provider-auth-api-key.js +4 -4
- package/dist/plugin-sdk/provider-auth-login.js +1 -1
- package/dist/plugin-sdk/provider-auth-runtime.js +2 -2
- package/dist/plugin-sdk/provider-auth.js +6 -6
- package/dist/plugin-sdk/provider-catalog-runtime.js +2 -2
- package/dist/plugin-sdk/provider-entry.js +1 -1
- package/dist/plugin-sdk/provider-setup.js +1 -1
- package/dist/plugin-sdk/provider-stream-family.js +3 -3
- package/dist/plugin-sdk/provider-stream.js +2 -2
- package/dist/plugin-sdk/provider-transport-runtime.js +1 -1
- package/dist/plugin-sdk/provider-web-fetch.js +2 -2
- package/dist/plugin-sdk/provider-web-search.js +4 -4
- package/dist/plugin-sdk/realtime-bootstrap-context.js +2 -2
- package/dist/plugin-sdk/realtime-transcription.js +1 -1
- package/dist/plugin-sdk/realtime-voice.js +2 -2
- package/dist/plugin-sdk/reply-dispatch-runtime.js +1 -1
- package/dist/plugin-sdk/reply-runtime.js +6 -6
- package/dist/plugin-sdk/runtime-secret-resolution.js +2 -2
- package/dist/plugin-sdk/runtime.js +3 -3
- package/dist/plugin-sdk/self-hosted-provider-setup.js +1 -1
- package/dist/plugin-sdk/simple-completion-runtime.js +1 -1
- package/dist/plugin-sdk/speech-core.js +2 -2
- package/dist/plugin-sdk/speech.js +1 -1
- package/dist/plugin-sdk/tool-plugin.js +1 -1
- package/dist/plugin-sdk/transcripts.js +1 -1
- package/dist/plugin-sdk/tts-runtime.d.ts +1 -1
- package/dist/plugin-sdk/tts-runtime.js +1 -1
- package/dist/plugin-sdk/video-generation-core.js +2 -2
- package/dist/plugin-sdk/video-generation-runtime.js +1 -1
- package/dist/plugin-sdk/web-media.js +3 -3
- package/dist/plugin-sdk/zalouser.js +1 -1
- package/dist/plugin-sdk/zod-schema.core-B4_b2R5K.d.ts +166 -0
- package/dist/plugin-service-2XF6Lu_a.js +1249 -0
- package/dist/plugins/build-smoke-entry.js +2 -2
- package/dist/plugins/loader.js +1 -1
- package/dist/plugins/provider-discovery.runtime.js +1 -1
- package/dist/plugins/provider-runtime.runtime.js +1 -1
- package/dist/plugins/runtime/index.js +21 -21
- package/dist/plugins/tools.js +1 -1
- package/dist/plugins-authoring-command-CCX6tJwd.js +304 -0
- package/dist/plugins-cli-HX8nTV2h.js +63 -0
- package/dist/plugins-cli.runtime-BYn4VsLP.js +339 -0
- package/dist/plugins-cli.runtime.js +1 -1
- package/dist/plugins-command-helpers-ByuW-yNj.js +2 -0
- package/dist/plugins-command-helpers-DaaxGnCD.js +164 -0
- package/dist/plugins-inspect-command-C9NDk23X.js +248 -0
- package/dist/plugins-install-command-B0NfUxeA.js +993 -0
- package/dist/plugins-install-command-BmuScfLI.js +2 -0
- package/dist/plugins-install-persist-CfwO876P.js +252 -0
- package/dist/plugins-list-command-Bx8X908n.js +184 -0
- package/dist/plugins-uninstall-command-p6h44-Ft.js +118 -0
- package/dist/postinstall-inventory.json +862 -862
- package/dist/prepare.runtime-8DdQ4k9k.js +798 -0
- package/dist/prepare.runtime.js +1 -1
- package/dist/presentation-card-DeAf3jYW.js +164 -0
- package/dist/preview-warnings-BF7nlTo8.js +618 -0
- package/dist/profiles-DUhMLnqX.js +194 -0
- package/dist/program-C7f_U7fr.js +131 -0
- package/dist/provider-adapters-CWLwE9KS.js +104 -0
- package/dist/provider-api-key-auth-CshQbUPZ.js +117 -0
- package/dist/provider-api-key-auth.runtime-B64jPCKn.js +14 -0
- package/dist/provider-api-key-auth.runtime.js +1 -1
- package/dist/provider-auth-D-I3YLSn.js +281 -0
- package/dist/provider-auth-api-key-Bub0Rjak.js +5 -0
- package/dist/provider-auth-choice-DpNAEScm.js +311 -0
- package/dist/provider-auth-choice-helpers-Bof937LW.js +210 -0
- package/dist/provider-auth-choice.runtime-B3spikLY.js +18 -0
- package/dist/provider-auth-choice.runtime-vVgz7FKq.js +2 -0
- package/dist/provider-auth-choice.runtime.js +1 -1
- package/dist/provider-auth-guidance-DcCL0Q2U.js +2 -0
- package/dist/provider-auth-guidance-rWRMN4Jn.js +34 -0
- package/dist/provider-auth-helpers-Cp8L-Xha.js +177 -0
- package/dist/provider-auth-login.runtime-BJUzc4iH.js +156 -0
- package/dist/provider-auth-login.runtime.js +1 -1
- package/dist/provider-auth-runtime-DmcWtzbb.js +186 -0
- package/dist/provider-discovery-JyAJi97k.js +95 -0
- package/dist/provider-discovery.runtime-D_0WTYr8.js +290 -0
- package/dist/provider-discovery.runtime.js +1 -1
- package/dist/provider-dispatcher-C8Jt94Xl.js +22 -0
- package/dist/provider-dispatcher.runtime.js +1 -1
- package/dist/provider-entry-By0ggZuI.js +134 -0
- package/dist/provider-hook-runtime-B8AUbQxf.js +255 -0
- package/dist/provider-openai-codex-oauth-C9Mmnt7d.js +2 -0
- package/dist/provider-openai-codex-oauth-CH5Jg1vk.js +44 -0
- package/dist/provider-registration-C1zvaHQP.js +235 -0
- package/dist/provider-registry-B9diJyLv.js +31 -0
- package/dist/provider-registry-BXSxmPGA.js +61 -0
- package/dist/provider-registry-CoE-sxbq.js +61 -0
- package/dist/provider-registry-DLth_GdI.js +61 -0
- package/dist/provider-registry-J4LRd5Rg.js +36 -0
- package/dist/provider-runtime-B4cw16pt.js +3 -0
- package/dist/provider-runtime-DNNbfwOK.js +386 -0
- package/dist/provider-runtime.runtime-98mAe_ni.js +26 -0
- package/dist/provider-runtime.runtime.js +1 -1
- package/dist/provider-self-hosted-setup-Dysv2Kwt.js +373 -0
- package/dist/provider-stream-BLaC8bqO.js +1084 -0
- package/dist/provider-stream-Caa5YOx2.js +313 -0
- package/dist/provider-stream-family-CvvfxLyP.js +2 -0
- package/dist/provider-usage-CVNosTP3.js +71 -0
- package/dist/provider-usage-D2NudXbO.js +4 -0
- package/dist/provider-usage.load-DG6R3lkG.js +357 -0
- package/dist/provider-web-search-DmgTaxRU.js +58 -0
- package/dist/provider-wizard-Cw-5H3tX.js +125 -0
- package/dist/providers.runtime-DF0T9lFz.js +240 -0
- package/dist/providers.runtime-oM9Vn1wr.js +2 -0
- package/dist/providers.runtime.js +1 -1
- package/dist/proxy-BxGnVyJu.js +662 -0
- package/dist/public-artifacts-BMP9hZfh.js +7 -0
- package/dist/pw-ai-CD52qfYo.js +3064 -0
- package/dist/qmd-manager-BYbvU4YC.js +2040 -0
- package/dist/qr-cli-Btz2ZdO3.js +2 -0
- package/dist/qr-cli-eyTRwMm2.js +371 -0
- package/dist/qr-image-BCwiO6tL.js +2 -0
- package/dist/queue-CJRoTOBi.js +923 -0
- package/dist/read-file-ogB-HjbK.js +183 -0
- package/dist/register-service-commands-D_gQ3b6_.js +77 -0
- package/dist/register.agent-DXQLn-r0.js +152 -0
- package/dist/register.configure-FavQPGce.js +16 -0
- package/dist/register.crestodian-Cbfmnl6h.js +24 -0
- package/dist/register.maintenance-B8xODEMU.js +85 -0
- package/dist/register.message-B8PYgZ-j.js +404 -0
- package/dist/register.migrate-CieoN8zZ.js +106 -0
- package/dist/register.onboard-BqWDIDKH.js +115 -0
- package/dist/register.setup-CgeTBW4T.js +40 -0
- package/dist/register.status-health-sessions-C99aHa5h.js +293 -0
- package/dist/register.subclis-79SvyMFt.js +31 -0
- package/dist/register.subclis-CXrO8_TO.js +3 -0
- package/dist/register.subclis-core-GoXV1yMG.js +273 -0
- package/dist/rem-harness-laL5luQa.js +649 -0
- package/dist/repair-sequencing-DGY2mBg6.js +652 -0
- package/dist/reply-media-paths.runtime-BeWVPkgy.js +2 -0
- package/dist/reply-media-paths.runtime-rzAV_Kee.js +154 -0
- package/dist/reply-media-paths.runtime.js +1 -1
- package/dist/reply-payloads-D_JHMviC.js +79 -0
- package/dist/reply-payloads-dedupe-B9GGGaL-.js +176 -0
- package/dist/reply-payloads-dedupe.runtime--C3jHs9y.js +2 -0
- package/dist/reply-payloads-dedupe.runtime.js +1 -1
- package/dist/reply-timing-tracker-DPjlETUb.js +205 -0
- package/dist/reply-turn-admission-DdfIwcMK.js +2056 -0
- package/dist/reply.runtime-BC1HT67i.js +2 -0
- package/dist/reply.runtime.js +1 -1
- package/dist/reset-preserved-selection-Czd80hug.js +45 -0
- package/dist/resolve-COJFlAZT.js +106 -0
- package/dist/restart-B9GMMIZt.js +121 -0
- package/dist/result-fallback-classifier-By0Z6b8r.js +98 -0
- package/dist/root-help-Bp0kGaUZ.js +43 -0
- package/dist/route-CgG9Z7OI.js +475 -0
- package/dist/route-reply-D9_9oRg1.js +174 -0
- package/dist/route-reply.runtime-BwNl3h2m.js +2 -0
- package/dist/route-reply.runtime.js +1 -1
- package/dist/routes-Cz2NHUV4.js +2 -0
- package/dist/routes-DMo6Eacc.js +3701 -0
- package/dist/run-SFRSThMI.js +1162 -0
- package/dist/run-auth-profile.runtime-BxLM8m_2.js +2 -0
- package/dist/run-auth-profile.runtime.js +1 -1
- package/dist/run-command-Cd5iN7eN.js +2 -0
- package/dist/run-command-ah46O06U.js +23 -0
- package/dist/run-context-DGCQJldA.js +66 -0
- package/dist/run-context.runtime-CSBHDAd5.js +2 -0
- package/dist/run-context.runtime.js +1 -1
- package/dist/run-delivery.runtime-C9xoiZ3h.js +762 -0
- package/dist/run-delivery.runtime.js +1 -1
- package/dist/run-embedded.runtime-D8bz5vfV.js +4 -0
- package/dist/run-embedded.runtime.js +1 -1
- package/dist/run-execution-cli.runtime-BAa8KPn7.js +4 -0
- package/dist/run-execution-cli.runtime.js +1 -1
- package/dist/run-executor.runtime-CNnemqSa.js +330 -0
- package/dist/run-executor.runtime.js +1 -1
- package/dist/run-model-catalog.runtime-Dh7EghXr.js +2 -0
- package/dist/run-model-catalog.runtime.js +1 -1
- package/dist/run-session-state-cMlTFwT_.js +159 -0
- package/dist/run-subagent-registry.runtime-BgQU86-E.js +2 -0
- package/dist/run-subagent-registry.runtime.js +1 -1
- package/dist/runner-B3YXRJOB.js +704 -0
- package/dist/runner.entries-DMTKpRDP.js +1485 -0
- package/dist/runtime-BHReFHE2.js +2 -0
- package/dist/runtime-BiQZ6Usw.js +615 -0
- package/dist/runtime-CAeriu2O.js +10 -0
- package/dist/runtime-CAnCRCX3.js +224 -0
- package/dist/runtime-CV_2NqSY.js +300 -0
- package/dist/runtime-CmpnvXo3.js +245 -0
- package/dist/runtime-D2fci1Ey.js +2 -0
- package/dist/runtime-DAsYmYeA.js +3 -0
- package/dist/runtime-DeA45VKG.js +210 -0
- package/dist/runtime-DvkZ8tHI.js +436 -0
- package/dist/runtime-DxVUR2Xg.js +2 -0
- package/dist/runtime-api-B88le0UE.js +12 -0
- package/dist/runtime-channel-AubRWvnH.js +2 -0
- package/dist/runtime-channel-DdclSuEu.js +148 -0
- package/dist/runtime-config-collectors-DukTj2va.js +525 -0
- package/dist/runtime-embedded-agent.runtime-BpLweeFv.js +2 -0
- package/dist/runtime-embedded-agent.runtime.js +1 -1
- package/dist/runtime-internal-CaoUylZw.js +2 -0
- package/dist/runtime-llm.runtime-DlpqGc7S.js +307 -0
- package/dist/runtime-llm.runtime.js +1 -1
- package/dist/runtime-model-auth.runtime-CLAaWzxY.js +46 -0
- package/dist/runtime-model-auth.runtime-DxVvqRTd.js +2 -0
- package/dist/runtime-model-auth.runtime.js +1 -1
- package/dist/runtime-options-TTtN01-I.js +275 -0
- package/dist/runtime-plugin-ClqxJSbp.js +92 -0
- package/dist/runtime-plugins-Bq01wLXP.js +32 -0
- package/dist/runtime-plugins.runtime-cwCvl1TR.js +2 -0
- package/dist/runtime-plugins.runtime.js +1 -1
- package/dist/runtime-prepare.runtime-Cz_hV_k5.js +81 -0
- package/dist/runtime-prepare.runtime.js +1 -1
- package/dist/runtime-provider-QCJq90av.js +24 -0
- package/dist/runtime-provider-Wllc3jC6.js +2 -0
- package/dist/runtime-registry-loader-BM1mQBJr.js +2 -0
- package/dist/runtime-registry-loader-DzhYCt4s.js +117 -0
- package/dist/runtime-shared-BfqOW-Vb.js +365 -0
- package/dist/runtime-web-channel-plugin-BcVPgD14.js +204 -0
- package/dist/runtime-web-tools-fallback.runtime.js +1 -1
- package/dist/scan-ldbaD8jq.js +573 -0
- package/dist/sdk-security-runtime-Bxhq2O1G.js +86 -0
- package/dist/sdk-setup-tools-CsQM9pF0.js +8 -0
- package/dist/secrets-cli-DbpIf4-z.js +150 -0
- package/dist/security-cli-BK4Xpa6h.js +520 -0
- package/dist/selection-BXKik6Ps.js +3 -0
- package/dist/selection-D4O3gK3Q.js +18365 -0
- package/dist/send-DaoGIay5.js +1222 -0
- package/dist/send-DzNjJGJX.js +178 -0
- package/dist/send-f5w9krNS.js +711 -0
- package/dist/send-media-cOciBxcg.js +2072 -0
- package/dist/send-result-DMFwBuOl.js +141 -0
- package/dist/server-BoC1mxZ-.js +24 -0
- package/dist/server-DZnI6w5k.js +72 -0
- package/dist/server-aux-handlers-BwRdYdub.js +1347 -0
- package/dist/server-chat-Q95f4ywD.js +827 -0
- package/dist/server-close.runtime.js +3 -3
- package/dist/server-context-CnXNaarB.js +2 -0
- package/dist/server-context-DRBebo7Y.js +955 -0
- package/dist/server-cron-C0o0ZvqF.js +3173 -0
- package/dist/server-cron-CLeBvurR.js +2 -0
- package/dist/server-maintenance-CqHfTnFD.js +152 -0
- package/dist/server-methods-BmlBQJMD.js +497 -0
- package/dist/server-middleware-DJhnR6jl.js +122 -0
- package/dist/server-model-catalog-CoSSk_Gy.js +2 -0
- package/dist/server-model-catalog-D32oDTQp.js +73 -0
- package/dist/server-node-events-DX9a4etQ.js +597 -0
- package/dist/server-plugin-bootstrap-Vco-EpxY.js +71 -0
- package/dist/server-plugins-WBX2fZRp.js +435 -0
- package/dist/server-reload-handlers-DGJLH8bg.js +719 -0
- package/dist/server-restart-sentinel-Bvon7f8K.js +700 -0
- package/dist/server-runtime-services-BNcH4vhR.js +3 -0
- package/dist/server-runtime-services-BjcQG5y7.js +147 -0
- package/dist/server-runtime-subscriptions-W39HeyoT.js +67 -0
- package/dist/server-session-events-CO73dMU-.js +244 -0
- package/dist/server-session-key-D8V67lDk.js +2 -0
- package/dist/server-session-key-v-KYSmRS.js +75 -0
- package/dist/server-startup-config-u54lUdWN.js +305 -0
- package/dist/server-startup-early-Cy5kArJG.js +87 -0
- package/dist/server-startup-memory-DvINFAYn.js +72 -0
- package/dist/server-startup-plugins-CerpbOSQ.js +127 -0
- package/dist/server-startup-post-attach-COUCwhNa.js +793 -0
- package/dist/server-ws-runtime-BfznAnbI.js +374 -0
- package/dist/server.impl-dQXccj0z.js +2622 -0
- package/dist/session-cost-usage-Bs5yIOBH.js +1600 -0
- package/dist/session-kill-http-DVleb3RW.js +121 -0
- package/dist/session-log-runtime-OG7J4j9m.js +1258 -0
- package/dist/session-override-LIWl5a9T.js +134 -0
- package/dist/session-reset-model.runtime-BpnTi4sa.js +144 -0
- package/dist/session-reset-model.runtime.js +1 -1
- package/dist/session-reset-service-HA07zS8L.js +651 -0
- package/dist/session-status.runtime-D6_clH8l.js +2 -0
- package/dist/session-status.runtime.js +1 -1
- package/dist/session-store-Cj4Rh6qc.js +273 -0
- package/dist/session-store.runtime-DSCxACdZ.js +4 -0
- package/dist/session-store.runtime.js +1 -1
- package/dist/session-subagent-reactivation.runtime-CcwaHAxg.js +2 -0
- package/dist/session-subagent-reactivation.runtime.js +1 -1
- package/dist/session-tab-registry-C-9uI2Wi.js +551 -0
- package/dist/session-utils-BRtPESA4.js +1508 -0
- package/dist/sessions-Beltl3Ra.js +1917 -0
- package/dist/sessions-DR-X-j8D.js +316 -0
- package/dist/sessions-cleanup-CR1CFcJb.js +165 -0
- package/dist/sessions-history-http-CjyHWYEv.js +432 -0
- package/dist/sessions-patch-peSeltuF.js +401 -0
- package/dist/sessions-resolve-D9ULr95s.js +180 -0
- package/dist/sessions-table-Da6bua9d.js +161 -0
- package/dist/sessions-uKpnhod0.js +12736 -0
- package/dist/sessions.runtime-C1mVNaU3.js +2 -0
- package/dist/sessions.runtime.js +1 -1
- package/dist/set-DVj21EuB.js +31 -0
- package/dist/set-image-JChDCaAP.js +17 -0
- package/dist/setup-5I-zpID3.js +614 -0
- package/dist/setup-CjtY6cli.js +2 -0
- package/dist/setup-onboard-configure-help-fast-path-C5GcSuXb.js +64 -0
- package/dist/setup.finalize-Bf10PNbl.js +586 -0
- package/dist/setup.gateway-config-EH5Rvwzy.js +281 -0
- package/dist/setup.migration-import-CoeV4Kc1.js +200 -0
- package/dist/setup.migration-import-DFFGw4DI.js +2 -0
- package/dist/setup.post-install-migration-DcQmWTE7.js +128 -0
- package/dist/shared-BFSJZ6B3.js +212 -0
- package/dist/shared-CVM-dYkO.js +5 -0
- package/dist/shared-fvgcmCsj.js +71 -0
- package/dist/simple-completion-runtime-C_TXe4M1.js +2 -0
- package/dist/simple-completion-runtime-DREq-fcF.js +206 -0
- package/dist/simple-completion-transport-DtD1fEvJ.js +83 -0
- package/dist/snapshot-urls-B-wkwDI9.js +317 -0
- package/dist/speech-core-KQg6oKcR.js +119 -0
- package/dist/speech-provider-DfyLYitQ.js +171 -0
- package/dist/speech-provider-oDvTumNW.js +227 -0
- package/dist/speech-provider-yL-TQ3Em.js +233 -0
- package/dist/stale-oauth-profile-shadows-CW11VYMM.js +2 -0
- package/dist/stale-oauth-profile-shadows-DFl6Lyf1.js +186 -0
- package/dist/standalone-runtime-registry-loader-BiponY-y.js +59 -0
- package/dist/startup-context-PVXYM-X3.js +314 -0
- package/dist/status-BA_0z83w.js +249 -0
- package/dist/status-Bc7BGlRt.js +2 -0
- package/dist/status-BwPWg9eQ.js +3 -0
- package/dist/status-CLQ66eml.js +4 -0
- package/dist/status-Ci2gChtY.js +466 -0
- package/dist/status-CmtBWJEE.js +2 -0
- package/dist/status-DdnMnPNs.js +73 -0
- package/dist/status-all-BpTvkYrt.js +573 -0
- package/dist/status-json-CizozZCr.js +15 -0
- package/dist/status-json-command-FzKa2t6O.js +84 -0
- package/dist/status-message-BHbnxwmt.js +495 -0
- package/dist/status-message.runtime-Df5WBBAk.js +6 -0
- package/dist/status-message.runtime.js +1 -1
- package/dist/status-queue.runtime-CXnZV4Bj.js +2 -0
- package/dist/status-queue.runtime.js +1 -1
- package/dist/status-runtime-shared-D3Hz8WZ_.js +289 -0
- package/dist/status-subagents.runtime-PoDdwwaw.js +32 -0
- package/dist/status-subagents.runtime.js +1 -1
- package/dist/status-text-DNxXSCuI.js +301 -0
- package/dist/status.command-C_e9GcMg.js +2 -0
- package/dist/status.command-DjVKDmt_.js +425 -0
- package/dist/status.command.text-runtime-BeHlqL8b.js +15 -0
- package/dist/status.runtime-h--fx9HY.js +2 -0
- package/dist/status.scan-WyR8TeJz.js +72 -0
- package/dist/status.scan-overview-CMzUAQMQ.js +460 -0
- package/dist/status.scan.deps.runtime-1JTrdyHk.js +19 -0
- package/dist/status.scan.deps.runtime.js +1 -1
- package/dist/status.scan.fast-json-D2jw1wKO.js +163 -0
- package/dist/status.scan.fast-json-DbN1KxJT.js +2 -0
- package/dist/status.summary-6ZijZM1g.js +2 -0
- package/dist/status.summary-CiCsChO-.js +276 -0
- package/dist/store-CdBPITcg.js +2302 -0
- package/dist/store-D0l2NCdn.js +3 -0
- package/dist/stored-model-override-HEgnFh6b.js +79 -0
- package/dist/subagent-announce-BUv_kA1W.js +353 -0
- package/dist/subagent-announce-delivery-Ci2Y_p--.js +1369 -0
- package/dist/subagent-control-BM3vNgsQ.js +492 -0
- package/dist/subagent-control.runtime-Df3pVQL9.js +3 -0
- package/dist/subagent-control.runtime.js +1 -1
- package/dist/subagent-hooks-CN2fLez2.js +2 -0
- package/dist/subagent-hooks-CeOmTJBf.js +230 -0
- package/dist/subagent-hooks-api-Cfe4DAT9.js +23 -0
- package/dist/subagent-registry-B9RPAXUs.js +2627 -0
- package/dist/subagent-registry-C7tedtVB.js +3 -0
- package/dist/subagent-registry.runtime.js +2 -2
- package/dist/subagent-session-cleanup-y0ijZ-LQ.js +390 -0
- package/dist/system-DVtrOGbV.js +111 -0
- package/dist/system-prompt-config-BVmrcmmr.js +918 -0
- package/dist/talk-CrdgqTCl.js +2454 -0
- package/dist/target-id-CrUyi-Uq.js +107 -0
- package/dist/targets-KZ2ezPwx.js +267 -0
- package/dist/targets.runtime-iZ8KdQ1C.js +2 -0
- package/dist/targets.runtime.js +1 -1
- package/dist/task-executor-893pMqzn.js +349 -0
- package/dist/task-owner-access-DC7MKz3n.js +74 -0
- package/dist/task-registry-control.runtime.js +2 -2
- package/dist/task-registry-delivery-runtime-YGMOyqP5.js +2 -0
- package/dist/task-registry-uaYJfgXF.js +2362 -0
- package/dist/task-registry.maintenance-Dx0m2NYh.js +2 -0
- package/dist/task-registry.maintenance-gApg-XOt.js +764 -0
- package/dist/task-status-access-CFhD_ieY.js +18 -0
- package/dist/tasks-B_Qoz38D.js +153 -0
- package/dist/tasks-DtV85zJT.js +548 -0
- package/dist/tasks-audit-system-Con3yYnm.js +210 -0
- package/dist/tasks-json-BM3pauZl.js +73 -0
- package/dist/tavily-web-search-provider.runtime-Cmyyc5kX.js +112 -0
- package/dist/tavily-web-search-provider.runtime.js +1 -1
- package/dist/text-report-CKxmVmt5.js +695 -0
- package/dist/text-transforms.runtime-DVwVsBRS.js +113 -0
- package/dist/text-transforms.runtime.js +1 -1
- package/dist/thread-bindings-B6UEVp9q.js +228 -0
- package/dist/tool-KOZc7TIF.js +143 -0
- package/dist/tool-dispatch-Ca4z2GEr.js +155 -0
- package/dist/tool-images-CzDwHeDR.js +247 -0
- package/dist/tool-plugin-BvQBJ2gU.js +93 -0
- package/dist/tool-resolution-Ddxl6tjh.js +153 -0
- package/dist/tool-result-truncation-BSKuIhd5.js +498 -0
- package/dist/tool-schema-nB27q-vb.js +40 -0
- package/dist/tool-schema-projection-COrMarLR.js +215 -0
- package/dist/tool-split-BjPHBFrv.js +323 -0
- package/dist/tools-CV40BWkc.js +901 -0
- package/dist/tools-catalog-5stC7W2V.js +156 -0
- package/dist/tools-effective-BVjqz2FV.js +442 -0
- package/dist/tools-effective-inventory-esPY5jRB.js +379 -0
- package/dist/tools-invoke-Czk_NM9G.js +51 -0
- package/dist/tools-invoke-http-D7PbsODz.js +68 -0
- package/dist/tools-invoke-shared-CzrEn0Dm.js +200 -0
- package/dist/tools-rSjgf61B.js +579 -0
- package/dist/tools.runtime-DiChCSGI.js +5 -0
- package/dist/tools.runtime.js +1 -1
- package/dist/transcript-rewrite-4IQefjvK.js +688 -0
- package/dist/transcripts-tool-BXTS8tE5.js +2 -0
- package/dist/transcripts-tool-CeWGgz5k.js +656 -0
- package/dist/tts-BS8EeM8p.js +2 -0
- package/dist/tts-BlTZjsaE.js +194 -0
- package/dist/tts-runtime-BfRdJDyY.js +1337 -0
- package/dist/tts-vRSvSw-t.js +3 -0
- package/dist/tts.runtime-ChBnVkNt.js +3 -0
- package/dist/tts.runtime-CmVCUbzq.js +2 -0
- package/dist/tts.runtime.js +1 -1
- package/dist/tui-BoQVBgWB.js +4860 -0
- package/dist/tui-DBYK9BeQ.js +2 -0
- package/dist/tui-backend-X0NI7rAv.js +256 -0
- package/dist/tui-cli-BpUtjV38.js +40 -0
- package/dist/typing-policy-CBwyAQh4.js +199 -0
- package/dist/usage-Bl-tgGx-.js +623 -0
- package/dist/usage-Cj_ektBl.js +1113 -0
- package/dist/usage-format-DWO9ckX3.js +394 -0
- package/dist/usage-format-DnCIXsqG.js +2 -0
- package/dist/video-generation-provider-B7ib4AeI.js +297 -0
- package/dist/video-generation-provider-CXQ6fqJx.js +64 -0
- package/dist/video-generation-provider-DXjl05T6.js +325 -0
- package/dist/video-generation-provider-Db8h71jA.js +77 -0
- package/dist/web-fetch/runtime.js +1 -1
- package/dist/web-fetch-providers.runtime-DhPkYjgB.js +41 -0
- package/dist/web-fetch-providers.runtime.js +1 -1
- package/dist/web-guarded-fetch-BdsVyvDS.js +58 -0
- package/dist/web-guarded-fetch-CJR3JCwT.js +2 -0
- package/dist/web-media-BzzQJAwk.js +4 -0
- package/dist/web-media-DViZjNBa.js +2 -0
- package/dist/web-media-inHawfBU.js +651 -0
- package/dist/web-provider-runtime-shared-Cc08Lt9p.js +142 -0
- package/dist/web-search-provider-common-CtbtmUL-.js +252 -0
- package/dist/web-search-providers.runtime-B7x_cRVn.js +41 -0
- package/dist/web-search-providers.runtime.js +1 -1
- package/package.json +1 -1
- package/dist/abort-CR0u3VsG.js +0 -277
- package/dist/abort.runtime-CXUxanGg.js +0 -2
- package/dist/accounts-BxBaquAf.js +0 -423
- package/dist/accounts-vQjpoqEe.js +0 -2
- package/dist/acp-spawn-2elSoS0E.js +0 -1286
- package/dist/acp-spawn-DtKOHNO1.js +0 -2
- package/dist/acp-stateful-target-driver-BqeA5j0h.js +0 -89
- package/dist/action-info-B8NotHFw.js +0 -75
- package/dist/active-runtime-registry-BO9mpPuB.js +0 -62
- package/dist/active-tool-schema-warnings-C8vGj5FX.js +0 -105
- package/dist/active-tool-schema-warnings-CVeFJuWI.js +0 -2
- package/dist/agent-BgEaDMdp.js +0 -1825
- package/dist/agent-_V5GbziF.js +0 -2
- package/dist/agent-bundle-lsp-runtime-0jBcDEHh.js +0 -389
- package/dist/agent-bundle-lsp-runtime-CQ6dZLs_.js +0 -2
- package/dist/agent-bundle-mcp-materialize-Cu6JqMzC.js +0 -124
- package/dist/agent-bundle-mcp-tools-BGL827cn.js +0 -3
- package/dist/agent-command-CMJdGr16.js +0 -1435
- package/dist/agent-delivery-DMu1MOeq.js +0 -117
- package/dist/agent-harness-runtime-BKSW2E1O.js +0 -207
- package/dist/agent-model-discovery-Cu4YL31r.js +0 -3
- package/dist/agent-model-discovery-DdmVtkZo.js +0 -238
- package/dist/agent-runner-utils-DXNDhwkI.js +0 -267
- package/dist/agent-runner.runtime-Cym4Odfd.js +0 -3784
- package/dist/agent-runtime-BkbhevY3.js +0 -199
- package/dist/agent-runtime-label-DNP06p76.js +0 -30
- package/dist/agent-runtime-metadata-JaTKc7mA.js +0 -53
- package/dist/agent-tool-result-middleware-loader-FbZE0Qpk.js +0 -55
- package/dist/agent-tools-Nwh8BlKX.js +0 -2506
- package/dist/agent-tools.before-tool-call-BwY-FYFl.js +0 -1274
- package/dist/agent-tools.before-tool-call-DwUmYhE3.js +0 -2
- package/dist/agent-u5NDWrw9.js +0 -3
- package/dist/agent-via-gateway-DMtOMwZa.js +0 -486
- package/dist/agent-wait-dedupe-CLuKbI_7.js +0 -180
- package/dist/agents-CiW7UEuB.js +0 -632
- package/dist/agents.command-shared-CXGSQscb.js +0 -16
- package/dist/agents.commands.add-BYBrZDXD.js +0 -304
- package/dist/agents.commands.bind-nfg3AlVc.js +0 -265
- package/dist/agents.commands.delete-pRj6vIrn.js +0 -128
- package/dist/agents.commands.identity-Ci2PnDDl.js +0 -143
- package/dist/agents.commands.list-Crj3BmqB.js +0 -235
- package/dist/aliases-BFspFx3-.js +0 -97
- package/dist/api-BiXhdPle.js +0 -3
- package/dist/api-Cptkjys5.js +0 -6
- package/dist/api-D3vT4ZVi.js +0 -2
- package/dist/api-key-rotation-CQgW8LEx.js +0 -167
- package/dist/app-registration-YW276fZC.js +0 -194
- package/dist/apply-BRxKrOiK.js +0 -510
- package/dist/apply-D0fWCa-U.js +0 -2
- package/dist/apply-DIR8y0ZA.js +0 -2
- package/dist/apply-DNUIV0Lt.js +0 -416
- package/dist/apply-Dux9jI7f.js +0 -544
- package/dist/approval-native-helpers-BMT-5X47.js +0 -398
- package/dist/artifacts-CTrtIv9T.js +0 -368
- package/dist/assistant-ClfI8Kho.js +0 -291
- package/dist/attachment-normalize-DAW86mZY.js +0 -213
- package/dist/attempt-execution-DTi2UfET.js +0 -584
- package/dist/attempt-execution.helpers-DrX0QToi.js +0 -969
- package/dist/attempt-execution.runtime-BCmAxwGy.js +0 -3
- package/dist/attempt.prompt-helpers-BE6kGRtT.js +0 -543
- package/dist/attempt.tool-run-context-J9O2yjbV.js +0 -1240
- package/dist/audio-preflight.runtime-D3GXVYBI.js +0 -7
- package/dist/audit-5T20D-xm.js +0 -1108
- package/dist/audit-CWuV5GlP.js +0 -477
- package/dist/audit.nondeep.runtime-DeYwRDYj.js +0 -1416
- package/dist/audit.runtime-rUlvK4Rb.js +0 -7
- package/dist/auth-DunUSatn.js +0 -567
- package/dist/auth-choice--eBzca8Y.js +0 -3
- package/dist/auth-choice-DJ9jsFUq.js +0 -400
- package/dist/auth-choice-_pLkIdVh.js +0 -110
- package/dist/auth-choice.apply.api-providers-CALcopRP.js +0 -2
- package/dist/auth-choice.apply.api-providers-Dzzm1snk.js +0 -34
- package/dist/auth-choice.plugin-providers.runtime-BHKTeZZc.js +0 -11
- package/dist/auth-health-Cs4OjiF2.js +0 -219
- package/dist/auth-list-bwJ4QDs0.js +0 -115
- package/dist/auth-order-BoHN3Dc_.js +0 -105
- package/dist/auth-profiles-BOLncVgy.js +0 -73
- package/dist/auth-profiles-BiQRkULt.js +0 -14
- package/dist/backend-config-B5yga5ay.js +0 -259
- package/dist/bash-tools-BWvldguc.js +0 -3
- package/dist/bash-tools-DEAAO5np.js +0 -3497
- package/dist/binding-routing-BbtHmU_l.js +0 -113
- package/dist/binding-targets-DSNv3-QA.js +0 -121
- package/dist/bootstrap-files-DD8V2dLe.js +0 -202
- package/dist/bootstrap-files-_6u1uJW2.js +0 -3
- package/dist/bridge-server-v1-XPnAZ.js +0 -113
- package/dist/browser-cli-CnpuO4KR.js +0 -230
- package/dist/browser-cli-DPbIn8SK.js +0 -2
- package/dist/browser-cli-actions-input-DoGR6LI-.js +0 -522
- package/dist/browser-cli-actions-observe-CYMpgmtF.js +0 -81
- package/dist/browser-cli-debug-ChJjSq-h.js +0 -137
- package/dist/browser-cli-inspect-Bbci-WPG.js +0 -117
- package/dist/browser-cli-manage-Bnscjb7b.js +0 -446
- package/dist/browser-cli-resize-D1MJdvZI.js +0 -32
- package/dist/browser-cli-shared-BCQwqz51.js +0 -69
- package/dist/browser-cli-state-BWkPsvUg.js +0 -371
- package/dist/browser-control-auth-CEP_ExeC.js +0 -2
- package/dist/browser-profiles-SvnqnHVN.js +0 -2
- package/dist/browser-runtime-0mRxjFpp.js +0 -389
- package/dist/browser-tool.schema--CLR3nDv.js +0 -132
- package/dist/btw-command-DV6HfrRV.js +0 -18
- package/dist/build-DiRmljCi.js +0 -261
- package/dist/bundled-channel-config-schema-DpdKMATU.d.ts +0 -3168
- package/dist/capability-cli-ATfwTYFe.js +0 -1809
- package/dist/capability-provider-runtime-l3nnLGvn.js +0 -346
- package/dist/cdp.helpers-IIuc0KGS.js +0 -637
- package/dist/channel-CzTD2ouI.js +0 -2309
- package/dist/channel-actions-B5Yk5Axf.js +0 -46
- package/dist/channel-bootstrap.runtime-C9F-Pq1o.js +0 -38
- package/dist/channel-bootstrap.runtime-TPyY5Ngv.js +0 -2
- package/dist/channel-core-XMZJ-ZGF.js +0 -5
- package/dist/channel-inbound-DvqkKmiH.js +0 -121
- package/dist/channel-message-CnJ4vUyt.js +0 -12
- package/dist/channel-outbound-BhefGAqY.js +0 -436
- package/dist/channel-plugin-resolution-BiaJ8aRa.js +0 -2
- package/dist/channel-plugin-resolution-D_CxkMVc.js +0 -135
- package/dist/channel-resolution-DzI28gIM.js +0 -46
- package/dist/channel-selection-CLFO4-eQ.js +0 -171
- package/dist/channel-selection.runtime-Beb2-bMH.js +0 -2
- package/dist/channel.runtime-By5T5eGw.js +0 -697
- package/dist/channels-BrRY9Mag.js +0 -1004
- package/dist/channels-cli-CF--e2RU.js +0 -331
- package/dist/chat-BTMPilpx.js +0 -2940
- package/dist/chat-DnC7XCWK.js +0 -3
- package/dist/chrome-C3_dN9jE.js +0 -1517
- package/dist/chrome-mcp-5jjDHIgn.js +0 -864
- package/dist/chrome-mcp-DFAa-WzK.js +0 -2
- package/dist/claude-live-session-BUPeOzLE.js +0 -1338
- package/dist/claude-live-session-Bprgmr1-.js +0 -2
- package/dist/clawbot-cli-5UVkLT1Y.js +0 -9
- package/dist/cli-6a6sMEUB.js +0 -2
- package/dist/cli-COCN9B5e.js +0 -2
- package/dist/cli-CpI4dBXy.js +0 -141
- package/dist/cli-YLx-ekdH.js +0 -293
- package/dist/cli-backends.runtime-CsBjr7ag.js +0 -7
- package/dist/cli-compaction-Bh0oMwUa.js +0 -363
- package/dist/cli-registry-loader-DDbaAJgY.js +0 -2
- package/dist/cli-registry-loader-xc2Ah8S4.js +0 -193
- package/dist/cli-runner-BfSrIn-9.js +0 -597
- package/dist/cli-runner-D_FAjNbR.js +0 -2
- package/dist/cli-runner.runtime-BJetQDu1.js +0 -3
- package/dist/cli-runner.runtime-BKJQkc7C.js +0 -4
- package/dist/cli-session-Cy3IeH0g.js +0 -119
- package/dist/cli.runtime-BpOz0s3N.js +0 -1276
- package/dist/codex-native-web-search-BDtKRV3F.js +0 -4
- package/dist/codex-native-web-search-C0TrfoMX.js +0 -20
- package/dist/codex-native-web-search-core-CzlK1GfN.js +0 -106
- package/dist/command-auth-CFnvdYX2.js +0 -135
- package/dist/command-config-resolution-B_86rG8v.js +0 -2
- package/dist/command-config-resolution-BbadcA2M.js +0 -25
- package/dist/command-config-resolution.runtime-B_86rG8v.js +0 -2
- package/dist/command-execution-startup-Rrwwdg_5.js +0 -90
- package/dist/command-primitives-runtime-C9bTt5IV.js +0 -3
- package/dist/command-registry-CbpdQKmu.js +0 -9
- package/dist/command-registry-Dw-XC_Zk.js +0 -4
- package/dist/command-registry-core-rvEDki6p.js +0 -114
- package/dist/command-secret-gateway-BX6BIiFn.js +0 -589
- package/dist/command-secret-targets-DCzlTkb5.js +0 -2
- package/dist/command-status-builders-DIsZN9aY.js +0 -147
- package/dist/command-status.runtime-C2x4yMRd.js +0 -90
- package/dist/commands-FYCxWqIx.js +0 -161
- package/dist/commands-compact.runtime-BTMQfx1k.js +0 -10
- package/dist/commands-core.runtime-CuNLz2wm.js +0 -2
- package/dist/commands-handlers.runtime-DyNuPOmY.js +0 -6327
- package/dist/commands-models-s7BRmLQh.js +0 -448
- package/dist/commands-registry-BxEq-3UJ.js +0 -195
- package/dist/commands-registry.runtime-CbXW33S_.js +0 -4
- package/dist/commands-status-BRJMba4h.js +0 -16
- package/dist/commands-status-DCXEwlSF.js +0 -3
- package/dist/commands-status.runtime-DCXEwlSF.js +0 -3
- package/dist/commands-subagents-control.runtime-CduLQJFD.js +0 -2
- package/dist/commands-system-prompt-B3LD8CDs.js +0 -161
- package/dist/commands-system-prompt-DPsXTqOQ.js +0 -2
- package/dist/commands.runtime-3sVz8Qgo.js +0 -175
- package/dist/common-CZvBLb3w.js +0 -286
- package/dist/compact-DxU_9XEc.js +0 -1165
- package/dist/compact.runtime-CqQTypVl.js +0 -12
- package/dist/compaction-planning-DArTi9SN.js +0 -202
- package/dist/completion-cli-CiKl5HhI.js +0 -393
- package/dist/config--yllOaSC.js +0 -374
- package/dist/config-Yt5UcD91.js +0 -610
- package/dist/config-cli-BeXS3R6k.js +0 -1703
- package/dist/config-mutation-cQeWhUqy.js +0 -5
- package/dist/config-mutations-Cg04LH_S.js +0 -161
- package/dist/config-utils-Dhq_UKMC.js +0 -141
- package/dist/config-validation-BANohTKD.js +0 -33
- package/dist/configure-CWxhlx9G.js +0 -771
- package/dist/configure-Jejkc6dn.js +0 -3
- package/dist/configure.commands-BYy1bz8G.js +0 -2
- package/dist/configure.commands-C3hDvZse.js +0 -1253
- package/dist/context-DptQ59DZ.js +0 -248
- package/dist/context-_ZshNBhD.js +0 -2
- package/dist/context-engine-host-compat-C_eflvRw.js +0 -2
- package/dist/context-engine-host-compat-s15Pu845.js +0 -280
- package/dist/context-engine-lifecycle-COHFLnj4.js +0 -627
- package/dist/control-auth-CQJpLoIb.js +0 -114
- package/dist/control-service-BFSgA0Py.js +0 -40
- package/dist/control-service-D7GZv-GS.js +0 -3
- package/dist/control-ui/assets/activity-B7yRLbf3.js +0 -124
- package/dist/control-ui/assets/agents-E-3DAkaW.js +0 -1030
- package/dist/control-ui/assets/channels-D0c7A9OX.js +0 -120
- package/dist/control-ui/assets/cron-B54j2Vmo.js +0 -1016
- package/dist/control-ui/assets/debug-CRcGYNA9.js +0 -97
- package/dist/control-ui/assets/index-bZJJ7U8q.js +0 -7214
- package/dist/control-ui/assets/instances-RcBeqNzx.js +0 -57
- package/dist/control-ui/assets/nodes-BoWRh42t.js +0 -444
- package/dist/control-ui/assets/sessions-BmRQ932H.js +0 -425
- package/dist/control-ui/assets/skills-BDn45kHZ.js +0 -362
- package/dist/control-ui/assets/workboard-BwbcNuC5.js +0 -402
- package/dist/control-ui-ChfTPXZo.js +0 -750
- package/dist/conversation-label-generator-CTfnInQF.js +0 -72
- package/dist/conversation-runtime-B7oAN9Tq.js +0 -31
- package/dist/core-api-CBD0dvTQ.js +0 -5
- package/dist/core-api-ClCm_yM8.js +0 -2
- package/dist/core-wuoxL08a.js +0 -284
- package/dist/crestodian--iYeGB8u.js +0 -55
- package/dist/cron-D2SzQyqo.js +0 -453
- package/dist/daemon-install-B6CAkU3V.js +0 -66
- package/dist/daemon-install-auth-profiles-store.runtime-Cpt5LSD6.js +0 -2
- package/dist/dashboard-ChYOQjM2.js +0 -263
- package/dist/defaults-CCopehWw.js +0 -130
- package/dist/defaults-H4kBp17N.js +0 -3
- package/dist/defaults.constants-CjB9HP6f.js +0 -76
- package/dist/deliver-BzPhWO_F.js +0 -3
- package/dist/deliver-DGyKH3Qi.js +0 -1399
- package/dist/deliver-runtime-Ca2kcQoZ.js +0 -2
- package/dist/delivery-outbound.runtime-D7ycPxY-.js +0 -7
- package/dist/delivery-queue-CnLv30ko.js +0 -863
- package/dist/delivery-queue-CuaDjNMh.js +0 -2
- package/dist/delivery-queue-runtime-DO2vqOIJ.js +0 -16
- package/dist/delivery-target.runtime-QcBVk_j8.js +0 -45
- package/dist/delivery.runtime-L09v4tys.js +0 -470
- package/dist/detached-task-runtime-BqU7YXYT.js +0 -86
- package/dist/diagnostics-T-Hk_Qzi.js +0 -168
- package/dist/dialogue-C0VnTMMn.js +0 -37
- package/dist/direct-dm-BWn67tDD.js +0 -81
- package/dist/directive-handling.defaults-DO6Snm4_.js +0 -22
- package/dist/directive-handling.fast-lane-BemYRfPn.js +0 -70
- package/dist/directive-handling.impl-BMVh1pMh.js +0 -823
- package/dist/directive-handling.impl-vr4MsYbt.js +0 -2
- package/dist/directive-handling.model-selection-DegP9exp.js +0 -122
- package/dist/directive-handling.persist.runtime-BUdU6_zm.js +0 -274
- package/dist/directives-1xk_ZcMf.js +0 -319
- package/dist/directory-cli-D83WEjEG.js +0 -239
- package/dist/dispatch-Ck2tvRYH.js +0 -2057
- package/dist/dispatch-acp-GdaHNdvf.js +0 -1102
- package/dist/dispatch-acp-manager.runtime-BGSrJqrW.js +0 -3
- package/dist/dispatch-acp-media.runtime-DQ8dYQh8.js +0 -4
- package/dist/dispatch-acp-transcript.runtime-CsJZGhnu.js +0 -40
- package/dist/dispatch-acp-tts.runtime-Bo-QxKgx.js +0 -3
- package/dist/dispatch-acp.runtime-C_u7sGcQ.js +0 -18
- package/dist/dispatcher-GtuYO6Ni.js +0 -106
- package/dist/doctor-B2qP9g8d.js +0 -760
- package/dist/doctor-D9wCez5t.js +0 -6
- package/dist/doctor-auth-XnseqtS7.js +0 -216
- package/dist/doctor-auth-flat-profiles-B6cL-TiJ.js +0 -516
- package/dist/doctor-auth-flat-profiles-Birb7qIk.js +0 -2
- package/dist/doctor-auth-legacy-oauth-CXO3OtyG.js +0 -48
- package/dist/doctor-auth-oauth-sidecar-BSgQPbcS.js +0 -177
- package/dist/doctor-auth-oauth-sidecar-CzzyNwxc.js +0 -2
- package/dist/doctor-bootstrap-size-BlVcO5D6.js +0 -57
- package/dist/doctor-claude-cli-_MTVnCQ-.js +0 -150
- package/dist/doctor-config-flow-0kxzjUjK.js +0 -1819
- package/dist/doctor-core-checks-C_g9REOd.js +0 -666
- package/dist/doctor-core-checks-CahzmM1L.js +0 -2
- package/dist/doctor-core-checks.runtime-Bi_oTiTZ.js +0 -278
- package/dist/doctor-gateway-daemon-flow-UAIWsI9w.js +0 -349
- package/dist/doctor-gateway-services-BiMEGiw_.js +0 -465
- package/dist/doctor-health-C69GVfMl.js +0 -65
- package/dist/doctor-health-contributions-Bz19QhI4.js +0 -874
- package/dist/doctor-lint-BVW4E6Qf.js +0 -95
- package/dist/doctor-memory-search-D2PWzDCY.js +0 -407
- package/dist/doctor-state-integrity-DuJIszQj.js +0 -1257
- package/dist/doctor-tool-result-cap-advice-Dpn4zNH3.js +0 -27
- package/dist/doctor-workspace-status-nW9TcIWi.js +0 -76
- package/dist/dreaming-CcOWzGN5.js +0 -523
- package/dist/dreaming-command-sxm3FQGb.js +0 -101
- package/dist/dreaming-narrative-BSRwiUPL.js +0 -2
- package/dist/dreaming-narrative-BskwmYdC.js +0 -721
- package/dist/dreaming-phases-BuHjGyPw.js +0 -2
- package/dist/dreaming-phases-ChVT8Ovk.js +0 -1162
- package/dist/drive-C_u5W4ln.js +0 -899
- package/dist/echo-transcript-tnZWH4EO.js +0 -52
- package/dist/effective-tool-policy-CeHdL2D7.js +0 -89
- package/dist/embedded-agent-CGULn3lb.js +0 -4
- package/dist/embedded-agent-DZTa1YiK.js +0 -4074
- package/dist/embedded-agent-helpers-B65K9o55.js +0 -6
- package/dist/embedded-agent-helpers-BPXCvWBb.js +0 -1037
- package/dist/embedded-agent.runtime-TfBgXcUV.js +0 -4
- package/dist/embedded-backend-BAaFwayA.js +0 -744
- package/dist/embedded-gateway-stub.runtime-CNyrjvgT.js +0 -12
- package/dist/embedding-provider-runtime-EnkHdROJ.js +0 -86
- package/dist/embedding-providers-CDkDb0kv.js +0 -2
- package/dist/embeddings-http-ClIu4_mP.js +0 -222
- package/dist/engine-qmd-DZRiT9i4.js +0 -708
- package/dist/engine-storage-BEqlN8TR.js +0 -203
- package/dist/errors-Co8auIlv.js +0 -2
- package/dist/exec-approval-forwarder.runtime-C7QvfWQ6.js +0 -4
- package/dist/exec-approval-session-target-ChuH1nXL.js +0 -177
- package/dist/exec-auto-reviewer-Bm7380HF.js +0 -2
- package/dist/exec-auto-reviewer-BrrdGleK.js +0 -241
- package/dist/execute.runtime-B-8jUqDB.js +0 -579
- package/dist/external-cli-auth-selection-0BxmRUps.js +0 -113
- package/dist/extra-params-BgyvpEpv.js +0 -615
- package/dist/fallback-notice-state-BXk_kRWM.js +0 -15
- package/dist/fallbacks-CPdVRP81.js +0 -31
- package/dist/fallbacks-shared-CSGf1oaf.js +0 -116
- package/dist/fengming-runtime-NUA51sEw.js +0 -33
- package/dist/fengming-runtime-config-CIZ-SHPt.js +0 -2
- package/dist/fengming-runtime-memory-CIZ-SHPt.js +0 -2
- package/dist/fengming-runtime-session-CIZ-SHPt.js +0 -2
- package/dist/fengming-tools-MvRSt0JA.js +0 -12221
- package/dist/flows-BocRit8D.js +0 -189
- package/dist/fs-utils-DSXeBcjj.js +0 -9
- package/dist/gateway-BCrUxrVw.js +0 -133
- package/dist/gateway-cli-B8bXBd_L.js +0 -443
- package/dist/gateway-install-token-pngTMc-f.js +0 -136
- package/dist/gateway-method-runtime-ueZTz7WH.js +0 -21
- package/dist/gateway-runtime-DbsoThML.js +0 -23
- package/dist/get-reply-DUuaxcBz.js +0 -5198
- package/dist/get-reply-from-config.runtime-B4Dgs3Hg.js +0 -2
- package/dist/github-copilot-token-7AfRRF7J.js +0 -2
- package/dist/health-7Yq5zpoZ.js +0 -3
- package/dist/health-DlZqxm2f.js +0 -621
- package/dist/health-DxesUuur.js +0 -111
- package/dist/health-state-BMG8kOby.js +0 -106
- package/dist/heartbeat-runner-Bq7A_Cjm.js +0 -5
- package/dist/heartbeat-runner-DVwbVyft.js +0 -1930
- package/dist/heartbeat-runner.runtime-DQ2NPXMD.js +0 -3
- package/dist/helpers-PCu2RivJ.js +0 -406
- package/dist/hook-helpers-DLEnCRO7.js +0 -44
- package/dist/hooks-Bv-otcl7.js +0 -536
- package/dist/hooks-cli-C5ve0nzF.js +0 -465
- package/dist/http-endpoint-helpers-w2SagsQz.js +0 -37
- package/dist/http-utils-CVvn0ZA-.js +0 -98
- package/dist/image-BeixBis4.js +0 -385
- package/dist/image-fallbacks-CPbmIMn9.js +0 -31
- package/dist/image-generation-core.auth.runtime-Co38iRxQ.js +0 -2
- package/dist/image-generation-provider-BA4Ar91S.js +0 -152
- package/dist/image-runtime-7ZsfioS1.js +0 -9
- package/dist/image-tool.helpers-upjA3ksB.js +0 -150
- package/dist/images-ChLi1Uog.js +0 -2
- package/dist/images-nB0XAnTa.js +0 -416
- package/dist/inbound-reply-dispatch-DglobJ8j.js +0 -2
- package/dist/inbound-reply-dispatch-QKOgNx-m.js +0 -147
- package/dist/infra-runtime-CGD3RE_2.js +0 -32
- package/dist/init-poVZDCAM.js +0 -59
- package/dist/install-Dn9oPGmU.js +0 -262
- package/dist/install.runtime-D5sllsjl.js +0 -2
- package/dist/internal-CnOL_Roa.js +0 -399
- package/dist/isolated-agent-CNw6E3F0.js +0 -1097
- package/dist/isolated-agent-DjkHhEyR.js +0 -2
- package/dist/kernel-B5Y5IQ-A.js +0 -3
- package/dist/kernel-CMuO4VJy.js +0 -979
- package/dist/kimi-web-search-provider.runtime-V4m_MHsk.js +0 -307
- package/dist/library-B-1EZjtY.js +0 -45
- package/dist/lifecycle-B-5gEZ7O.js +0 -570
- package/dist/lifecycle-Bzh5Jo09.js +0 -2
- package/dist/lifecycle-DvbcJYMl.js +0 -355
- package/dist/lifecycle.runtime-Bzh5Jo09.js +0 -2
- package/dist/list-B4xSHRdU.js +0 -2
- package/dist/list-BnhZHpxx.js +0 -207
- package/dist/list.list-command-DAz-Ws_6.js +0 -429
- package/dist/list.model-row-DtdX9KDu.js +0 -39
- package/dist/list.probe-CY6lxq51.js +0 -2
- package/dist/list.probe-DPuE1GOH.js +0 -451
- package/dist/list.provider-catalog-BHc9WXI6.js +0 -211
- package/dist/list.provider-catalog-CFbrroys.js +0 -2
- package/dist/list.registry-load-C1_sr3gb.js +0 -152
- package/dist/list.row-sources-BMtHc9oi.js +0 -474
- package/dist/list.source-plan-Dth72qPP.js +0 -81
- package/dist/list.status-command-BXCnEq8Q.js +0 -815
- package/dist/live-model-switch-Dxav22vq.js +0 -119
- package/dist/llm-slug-generator-6o8RXL11.js +0 -78
- package/dist/load-config-EF3n0Dyo.js +0 -27
- package/dist/load-context-CI_ogQt_.js +0 -82
- package/dist/loader-DtwEzpp-.js +0 -7008
- package/dist/local-dispatch.runtime-21liE3rA.js +0 -10
- package/dist/main-session-restart-recovery-D1g62iJ5.js +0 -2
- package/dist/main-session-restart-recovery-v2I9CEXi.js +0 -389
- package/dist/managed-image-attachments-BEl5qfCT.js +0 -616
- package/dist/managed-image-attachments-D5KqX2Qy.js +0 -2
- package/dist/manager-DZc3xiNq.js +0 -2314
- package/dist/manager-Vf3vLTGe.js +0 -3737
- package/dist/mcp-http-BaJoPKF9.js +0 -583
- package/dist/mcp-http-CpEaJIGJ.js +0 -2
- package/dist/media-runtime-DtP_Ff8m.js +0 -391
- package/dist/media-services-CXYbyIIp.js +0 -416
- package/dist/media-understanding-DvTIsIyr.js +0 -87
- package/dist/media-understanding-provider-DBBAvuwG.js +0 -13
- package/dist/media-understanding-provider-DOf_uZrx.js +0 -70
- package/dist/media-understanding-provider-DdRfNh9h.js +0 -69
- package/dist/media-understanding-provider-mqpQDt8V.js +0 -29
- package/dist/memory-BNk25Hi6.js +0 -437
- package/dist/memory-core-host-engine-embeddings-XsK5xS70.js +0 -667
- package/dist/memory-core-host-engine-foundation-BYkoOLXl.js +0 -15
- package/dist/memory-core-host-engine-qmd-0JuUCKCK.js +0 -2
- package/dist/memory-core-host-engine-storage-MCFGjDwW.js +0 -2
- package/dist/memory-core-host-runtime-cli-fVGH65E8.js +0 -10
- package/dist/memory-core-host-runtime-core-JtXIAdlM.js +0 -12
- package/dist/memory-core-host-runtime-files-BGw_ypoN.js +0 -4
- package/dist/memory-embedding-provider-runtime-3UBzs4sx.js +0 -36
- package/dist/memory-host-core-Y_O5V-mu.js +0 -78
- package/dist/memory-host-search.runtime-B4TzyvmR.js +0 -2
- package/dist/memory-runtime-9kEPAeKV.js +0 -2
- package/dist/memory-runtime-BU4t85uu.js +0 -57
- package/dist/memory-search-CVX--mSz.js +0 -235
- package/dist/message-BVXoNpWP.js +0 -284
- package/dist/message-HaiKqj0A.js +0 -2
- package/dist/message-action-runner-Chwzn02r.js +0 -2
- package/dist/message-action-runner-tEEliptt.js +0 -1922
- package/dist/message-handler-CHDS_NF-.js +0 -1806
- package/dist/metadata-registry-loader-Croa1pgR.js +0 -22
- package/dist/metadata-registry-loader-w0p86vis.js +0 -2
- package/dist/migrate-CPCZJ4H5.js +0 -2
- package/dist/migrate-CUj6m6Cx.js +0 -458
- package/dist/migration-provider-runtime-4r4WGtf2.js +0 -2
- package/dist/migration-provider-runtime-TxrH_mM7.js +0 -68
- package/dist/minimax-web-search-provider.runtime-Dr2GJiWj.js +0 -148
- package/dist/model-BQSouNOa.js +0 -2
- package/dist/model-CAk0bcuO.js +0 -1302
- package/dist/model-auth-BF7w9Fiv.js +0 -705
- package/dist/model-auth-label-r729wcPk.js +0 -67
- package/dist/model-auth-us8b_D5d.js +0 -6
- package/dist/model-catalog-BGykBGxx.js +0 -434
- package/dist/model-catalog-BVXrqFbI.js +0 -3
- package/dist/model-catalog-visibility-Bsup46vy.js +0 -76
- package/dist/model-config.helpers-wzD1EEfE.js +0 -95
- package/dist/model-context-tokens-DrIU9eJc.js +0 -572
- package/dist/model-fallback-GySPjr3J.js +0 -1288
- package/dist/model-fallback-auth.runtime-Dg_Jmguu.js +0 -5
- package/dist/model-picker-BI6jXOjt.js +0 -3
- package/dist/model-picker-DYyJHhfH.js +0 -1135
- package/dist/model-picker-visibility-D_IMZfxd.js +0 -22
- package/dist/model-picker.runtime-B70kQMyc.js +0 -48
- package/dist/model-pricing-cache-CSpUDzSt.js +0 -856
- package/dist/model-pricing-cache-dkPwTUVJ.js +0 -3
- package/dist/model-pricing-cache-state-C6shoEWy.js +0 -83
- package/dist/model-provider-auth-BfZHbTaj.js +0 -2
- package/dist/model-provider-auth-CPCBWvqL.js +0 -375
- package/dist/model-runtime-aliases-DUzusc9_.js +0 -133
- package/dist/model-selection-8UzO5mgF.js +0 -254
- package/dist/model-selection-Cb7azWw1.js +0 -7
- package/dist/model-selection-jDYEo0WI.js +0 -352
- package/dist/model-selection.runtime-D_yHZLbs.js +0 -7
- package/dist/models-BxA2IU3W.js +0 -57
- package/dist/models-auth-status-yG7yyRcv.js +0 -280
- package/dist/models-cli-DUt4uiMH.js +0 -257
- package/dist/models-config-B5bkuh6A.js +0 -1189
- package/dist/models-config-Xj8vG_x2.js +0 -2
- package/dist/models-config.providers.secrets-DNBB440Z.js +0 -2
- package/dist/models-config.providers.secrets-DNIQlBSE.js +0 -382
- package/dist/models-http-DMILRsry.js +0 -88
- package/dist/monitor-7tD_FE_5.js +0 -60
- package/dist/monitor-HjEwlqJs.js +0 -1024
- package/dist/monitor.account-D0F9tnWD.js +0 -5382
- package/dist/music-generation-provider-3ykPaUwR.js +0 -308
- package/dist/native-hook-relay-BJKHIhWd.js +0 -1378
- package/dist/native-hook-relay-V8Kappw1.js +0 -19
- package/dist/node-cli-BLVyQ93e.js +0 -2806
- package/dist/node-command-policy-B0ezpI_O.js +0 -295
- package/dist/nodes-DnWH_15m.js +0 -3
- package/dist/nodes-RkB4ZmP6.js +0 -1483
- package/dist/nodes-cli-upwPs91b.js +0 -960
- package/dist/nodes-pending--sojaxpI.js +0 -211
- package/dist/nodes-utils-Yks_uDZK.js +0 -85
- package/dist/oauth-CQN2efEy.js +0 -207
- package/dist/oauth-DApi3OI9.js +0 -746
- package/dist/oauth-DkUWBub2.js +0 -852
- package/dist/onboard-CiQSBSrz.js +0 -768
- package/dist/onboard-channels-DaWYXiLv.js +0 -1534
- package/dist/onboard-channels-DnwM2_IL.js +0 -2
- package/dist/onboard-custom-BQPckD0V.js +0 -3
- package/dist/onboard-custom-config-BmbThk2-.js +0 -422
- package/dist/onboard-custom-xInFj1Rs.js +0 -280
- package/dist/onboard-search-DSfmthe5.js +0 -412
- package/dist/openai-compat-errors-VR4SN1MV.js +0 -136
- package/dist/openai-http-DV95ynPi.js +0 -836
- package/dist/openai-transport-stream-BwpzqR-b.js +0 -3427
- package/dist/openresponses-http-DPchx8IC.js +0 -1175
- package/dist/operations-f9R8j-r9.js +0 -805
- package/dist/order-BQx8mNGZ.js +0 -218
- package/dist/outbound-attachment-C4yojK6p.js +0 -19
- package/dist/param-readers-BIXyd5la.js +0 -2
- package/dist/payloads-DrY1bKyF.js +0 -256
- package/dist/persistent-bindings.lifecycle-BiPN7luW.js +0 -85
- package/dist/persistent-bindings.lifecycle-X3wfan2Z.js +0 -2
- package/dist/plugin-enabled-CqsBObeO.js +0 -232
- package/dist/plugin-install-CfB1_kpX.js +0 -118
- package/dist/plugin-install-DzMraXHH.js +0 -2
- package/dist/plugin-install-config-policy-BD_elPNg.js +0 -169
- package/dist/plugin-registration-Dy58ncPf.js +0 -97
- package/dist/plugin-registry-BlmODeop.js +0 -3
- package/dist/plugin-registry-k5OK18l5.js +0 -2
- package/dist/plugin-runtime-B3t53CKr.js +0 -102
- package/dist/plugin-sdk/bundled-channel-config-schema-C3pWWvwG.d.ts +0 -3169
- package/dist/plugin-sdk/config-schema-D7cABQ6o.d.ts +0 -33
- package/dist/plugin-sdk/zod-schema.core-CwBNqcXp.d.ts +0 -166
- package/dist/plugin-service-sKF4gWFm.js +0 -1249
- package/dist/plugins-authoring-command-I72k2cuv.js +0 -304
- package/dist/plugins-cli-DMQRbPsU.js +0 -63
- package/dist/plugins-cli.runtime-CvDuKFJj.js +0 -339
- package/dist/plugins-command-helpers-C5WMM4bk.js +0 -164
- package/dist/plugins-command-helpers-DDt_pMQ4.js +0 -2
- package/dist/plugins-inspect-command-ka7Hpld3.js +0 -248
- package/dist/plugins-install-command-BHSgof-_.js +0 -2
- package/dist/plugins-install-command-t5caX9q_.js +0 -993
- package/dist/plugins-install-persist-Bah1m3x7.js +0 -252
- package/dist/plugins-list-command-BXLWwXHM.js +0 -184
- package/dist/plugins-uninstall-command-C_3m6CrW.js +0 -118
- package/dist/prepare.runtime-COZaHg5E.js +0 -798
- package/dist/presentation-card-CciJv4ru.js +0 -164
- package/dist/preview-warnings-L4VuEOyB.js +0 -618
- package/dist/profiles-CM2xoUYX.js +0 -194
- package/dist/program-B-4C7bC-.js +0 -131
- package/dist/provider-adapters-Eh8mS2Fd.js +0 -104
- package/dist/provider-api-key-auth-DTh2cbmS.js +0 -117
- package/dist/provider-api-key-auth.runtime-DrTYYfxK.js +0 -14
- package/dist/provider-auth-Bnaijzmv.js +0 -281
- package/dist/provider-auth-api-key-CNP8o5E7.js +0 -5
- package/dist/provider-auth-choice-Devw4sQf.js +0 -311
- package/dist/provider-auth-choice-helpers-DmVudRp6.js +0 -210
- package/dist/provider-auth-choice.runtime-C337IQ3W.js +0 -2
- package/dist/provider-auth-choice.runtime-DqGYalFo.js +0 -18
- package/dist/provider-auth-guidance-Bk4WV6Lg.js +0 -2
- package/dist/provider-auth-guidance-C7NCKuKn.js +0 -34
- package/dist/provider-auth-helpers-r7mC8I5l.js +0 -177
- package/dist/provider-auth-login.runtime-BFJgAAS6.js +0 -156
- package/dist/provider-auth-runtime-BiLPGiMW.js +0 -186
- package/dist/provider-discovery-uxRmAIf_.js +0 -95
- package/dist/provider-discovery.runtime-mwbSivDS.js +0 -290
- package/dist/provider-dispatcher-CtKWj3r-.js +0 -22
- package/dist/provider-entry-DjACqdrB.js +0 -134
- package/dist/provider-hook-runtime-CpJsM7Dk.js +0 -255
- package/dist/provider-openai-codex-oauth-DWGmVUYg.js +0 -2
- package/dist/provider-openai-codex-oauth-ctxd00JW.js +0 -44
- package/dist/provider-registration-l8EX4voM.js +0 -235
- package/dist/provider-registry-BgIQXJle.js +0 -31
- package/dist/provider-registry-CVuzobHN.js +0 -36
- package/dist/provider-registry-DmdDbSQs.js +0 -61
- package/dist/provider-registry-LqtLqheu.js +0 -61
- package/dist/provider-registry-pTYVjODc.js +0 -61
- package/dist/provider-runtime-BQZSuC9l.js +0 -3
- package/dist/provider-runtime-D9Q-7VuO.js +0 -386
- package/dist/provider-runtime.runtime-C6YZ8YI0.js +0 -26
- package/dist/provider-self-hosted-setup-BIAD2ISe.js +0 -373
- package/dist/provider-stream-DScdaoRo.js +0 -313
- package/dist/provider-stream-PE0IxmpZ.js +0 -1084
- package/dist/provider-stream-family-S2fhlydZ.js +0 -2
- package/dist/provider-usage-DVKHMF6l.js +0 -4
- package/dist/provider-usage-EEjx1av0.js +0 -71
- package/dist/provider-usage.load-Cu11xbrw.js +0 -357
- package/dist/provider-web-search-Dbk7MO-1.js +0 -58
- package/dist/provider-wizard-DS2Xb2eu.js +0 -125
- package/dist/providers.runtime-BPhGcupv.js +0 -240
- package/dist/providers.runtime-DoylK-ht.js +0 -2
- package/dist/proxy-BxacG0p3.js +0 -662
- package/dist/public-artifacts-Dq3y7bBv.js +0 -7
- package/dist/pw-ai-DlSSqerW.js +0 -3064
- package/dist/qmd-manager-B_SG-ejE.js +0 -2040
- package/dist/qr-cli-CT-sE_j9.js +0 -2
- package/dist/qr-cli-DPlDCXJQ.js +0 -371
- package/dist/qr-image--VmmvuDB.js +0 -2
- package/dist/queue-Be2Y7PcO.js +0 -923
- package/dist/read-file-hhemkDfq.js +0 -183
- package/dist/register-service-commands-CeVpCQU3.js +0 -77
- package/dist/register.agent-JLsb-giw.js +0 -152
- package/dist/register.configure-CP0Q-ost.js +0 -16
- package/dist/register.crestodian-CBXyXEix.js +0 -24
- package/dist/register.maintenance-DGIPQ2Vo.js +0 -85
- package/dist/register.message-BBQwz0Ld.js +0 -404
- package/dist/register.migrate-CkgNlvLD.js +0 -106
- package/dist/register.onboard-CS9gRK0c.js +0 -115
- package/dist/register.setup-DhqDOer9.js +0 -40
- package/dist/register.status-health-sessions-CiwQN_lw.js +0 -293
- package/dist/register.subclis-86Md7P0P.js +0 -3
- package/dist/register.subclis-CTVI8zvZ.js +0 -31
- package/dist/register.subclis-core-Cy4AnRCu.js +0 -273
- package/dist/rem-harness-vSsq3HiK.js +0 -649
- package/dist/repair-sequencing-SHADYdcA.js +0 -652
- package/dist/reply-media-paths.runtime-Bf5nxPuP.js +0 -154
- package/dist/reply-media-paths.runtime-sLsMpKGO.js +0 -2
- package/dist/reply-payloads-CJ3w8rSA.js +0 -79
- package/dist/reply-payloads-dedupe-DDFXWCVR.js +0 -176
- package/dist/reply-payloads-dedupe.runtime-DbXPzKmG.js +0 -2
- package/dist/reply-timing-tracker-DjVIBsVb.js +0 -205
- package/dist/reply-turn-admission-nEW5QbY5.js +0 -2056
- package/dist/reply.runtime-B4Dgs3Hg.js +0 -2
- package/dist/reset-preserved-selection-CVD1yeVC.js +0 -45
- package/dist/resolve-DidlinMh.js +0 -106
- package/dist/restart-DzTrO95c.js +0 -121
- package/dist/result-fallback-classifier-BqsFUDvP.js +0 -98
- package/dist/root-help-QGs0dCCN.js +0 -43
- package/dist/route-B3R-uzFG.js +0 -475
- package/dist/route-reply-CdfhgIoY.js +0 -174
- package/dist/route-reply.runtime-DwuU2WjH.js +0 -2
- package/dist/routes-ChXmJocl.js +0 -3701
- package/dist/routes-D-ZF4AdA.js +0 -2
- package/dist/run-ClmVDTET.js +0 -1162
- package/dist/run-auth-profile.runtime-CTxrwz0y.js +0 -2
- package/dist/run-command-CqZJQ0Im.js +0 -2
- package/dist/run-command-GClW75NL.js +0 -23
- package/dist/run-context-BOdGeRg5.js +0 -66
- package/dist/run-context.runtime-CwuKVYPj.js +0 -2
- package/dist/run-delivery.runtime-BQ39dm34.js +0 -762
- package/dist/run-embedded.runtime-e1K4Bt1_.js +0 -4
- package/dist/run-execution-cli.runtime-Cjrgt4cV.js +0 -4
- package/dist/run-executor.runtime-C2JE6JGb.js +0 -330
- package/dist/run-model-catalog.runtime-DkrLKopr.js +0 -2
- package/dist/run-session-state-C5YdQs7o.js +0 -159
- package/dist/run-subagent-registry.runtime-Dl_lXi6y.js +0 -2
- package/dist/runner-CNGHdaIg.js +0 -704
- package/dist/runner.entries-dckPkeld.js +0 -1485
- package/dist/runtime-9LxcVCyw.js +0 -615
- package/dist/runtime-BCOtBS5G.js +0 -3
- package/dist/runtime-C-pgjoJr.js +0 -210
- package/dist/runtime-CyF0vJXG.js +0 -10
- package/dist/runtime-D-7lMvGV.js +0 -2
- package/dist/runtime-D17OmF9G.js +0 -224
- package/dist/runtime-D6SweufG.js +0 -245
- package/dist/runtime-DVAM7AFd.js +0 -2
- package/dist/runtime-DX2ClrP-.js +0 -436
- package/dist/runtime-FOOWuiYX.js +0 -300
- package/dist/runtime-api-B0F0JsV1.js +0 -12
- package/dist/runtime-cREKSBYC.js +0 -2
- package/dist/runtime-channel-BmD4hoCR.js +0 -148
- package/dist/runtime-channel-BsebQSPL.js +0 -2
- package/dist/runtime-config-collectors-BjYeQ0Tk.js +0 -525
- package/dist/runtime-embedded-agent.runtime-A4r23Bn8.js +0 -2
- package/dist/runtime-internal-DkV-EMTK.js +0 -2
- package/dist/runtime-llm.runtime-BQKNnuRc.js +0 -307
- package/dist/runtime-model-auth.runtime-BbGqHVM5.js +0 -2
- package/dist/runtime-model-auth.runtime-rtJH4LBB.js +0 -46
- package/dist/runtime-options-B0EGb1Wq.js +0 -275
- package/dist/runtime-plugin-Bdqm44bH.js +0 -92
- package/dist/runtime-plugins-rZk1eAK_.js +0 -32
- package/dist/runtime-plugins.runtime-DApiYzny.js +0 -2
- package/dist/runtime-prepare.runtime-DWxvnbyY.js +0 -81
- package/dist/runtime-provider-B0slPjtk.js +0 -2
- package/dist/runtime-provider-DLgupOKt.js +0 -24
- package/dist/runtime-registry-loader-Cf2HuMjd.js +0 -2
- package/dist/runtime-registry-loader-DLzDrA7e.js +0 -117
- package/dist/runtime-shared-Bg-OiD4u.js +0 -365
- package/dist/runtime-web-channel-plugin-DrMjRaqi.js +0 -204
- package/dist/scan-DA7Oqxuv.js +0 -573
- package/dist/sdk-security-runtime-WjOaCbga.js +0 -86
- package/dist/sdk-setup-tools-DaYT6_jD.js +0 -8
- package/dist/secrets-cli-fJQ0geWO.js +0 -150
- package/dist/security-cli-CJMwGp8U.js +0 -520
- package/dist/selection-BNwLQzqJ.js +0 -3
- package/dist/selection-Cj-l80pO.js +0 -18365
- package/dist/send-DstYcrDW.js +0 -711
- package/dist/send-aTxtLkJm.js +0 -178
- package/dist/send-media-Bl2ryo6a.js +0 -2072
- package/dist/send-qwDMMnM6.js +0 -1222
- package/dist/send-result-BWRKr16H.js +0 -141
- package/dist/server-CMtA1S09.js +0 -24
- package/dist/server-DIRaYiiH.js +0 -72
- package/dist/server-aux-handlers-BRO-9-Jf.js +0 -1347
- package/dist/server-chat-0J_ke0ph.js +0 -827
- package/dist/server-context-DWOSX34k.js +0 -2
- package/dist/server-context-R7MFLFdI.js +0 -955
- package/dist/server-cron-2FuFg2j8.js +0 -2
- package/dist/server-cron-ChPAVQtg.js +0 -3173
- package/dist/server-maintenance-ZvS7Id6T.js +0 -152
- package/dist/server-methods-DSbhPK3k.js +0 -497
- package/dist/server-middleware-CYxFU-e5.js +0 -122
- package/dist/server-model-catalog-B22UhmRr.js +0 -73
- package/dist/server-model-catalog-BJIHPP3P.js +0 -2
- package/dist/server-node-events-tNWJnXQM.js +0 -597
- package/dist/server-plugin-bootstrap-Ccu97zi8.js +0 -71
- package/dist/server-plugins-ByXwKPnj.js +0 -435
- package/dist/server-reload-handlers-ConGiT9Q.js +0 -719
- package/dist/server-restart-sentinel-mPHo61LL.js +0 -700
- package/dist/server-runtime-services-BR1icaUW.js +0 -3
- package/dist/server-runtime-services-Bx8n34dj.js +0 -147
- package/dist/server-runtime-subscriptions-CZklTkRG.js +0 -67
- package/dist/server-session-events-DxdiZYM2.js +0 -244
- package/dist/server-session-key-CYvLslFO.js +0 -75
- package/dist/server-session-key-D9GQut81.js +0 -2
- package/dist/server-startup-config-Byb0vR8j.js +0 -305
- package/dist/server-startup-early-a65fHTQS.js +0 -87
- package/dist/server-startup-memory-ClwzC9jX.js +0 -72
- package/dist/server-startup-plugins-CaBj0Nt2.js +0 -127
- package/dist/server-startup-post-attach-B7TcxkmO.js +0 -793
- package/dist/server-ws-runtime-Cxk_CqMr.js +0 -374
- package/dist/server.impl-CQ6dnx43.js +0 -2622
- package/dist/session-cost-usage-GsYDNvka.js +0 -1600
- package/dist/session-kill-http-CKkxZhhd.js +0 -121
- package/dist/session-log-runtime-Bwc2Oijk.js +0 -1258
- package/dist/session-override-CWbKiXiC.js +0 -134
- package/dist/session-reset-model.runtime-CDFMjwWA.js +0 -144
- package/dist/session-reset-service-SE0aK4cw.js +0 -651
- package/dist/session-status.runtime-Df89I7Fk.js +0 -2
- package/dist/session-store-RkvjJPMQ.js +0 -273
- package/dist/session-store.runtime-C7P5asx7.js +0 -4
- package/dist/session-subagent-reactivation.runtime-BhGUZG1Z.js +0 -2
- package/dist/session-tab-registry-9rSuQ0Yz.js +0 -551
- package/dist/session-utils-De8TIM0h.js +0 -1508
- package/dist/sessions-6b9a00Tl.js +0 -1917
- package/dist/sessions-CEPHczjC.js +0 -316
- package/dist/sessions-CEojHc8b.js +0 -12736
- package/dist/sessions-cleanup-BkG7_sq9.js +0 -165
- package/dist/sessions-history-http-BjJEfjJa.js +0 -432
- package/dist/sessions-patch-PwG5sknc.js +0 -401
- package/dist/sessions-resolve-CSIrd_fi.js +0 -180
- package/dist/sessions-table-8CbU7jXa.js +0 -161
- package/dist/sessions.runtime-BYHMD0M7.js +0 -2
- package/dist/set-BJDpe28W.js +0 -31
- package/dist/set-image-CwTFx7PX.js +0 -17
- package/dist/setup-B6LmeIms.js +0 -614
- package/dist/setup-B_zxHfYu.js +0 -2
- package/dist/setup-onboard-configure-help-fast-path-Bck3SKEH.js +0 -64
- package/dist/setup.finalize-CmLYX-Rf.js +0 -586
- package/dist/setup.gateway-config-H_89Msro.js +0 -281
- package/dist/setup.migration-import-DVzyUjX6.js +0 -2
- package/dist/setup.migration-import-DmJpqoqf.js +0 -200
- package/dist/setup.post-install-migration-WPFWKXXg.js +0 -128
- package/dist/shared-CUhu8NTs.js +0 -5
- package/dist/shared-D-BN2JhY.js +0 -71
- package/dist/shared-ES8nDIcn.js +0 -212
- package/dist/simple-completion-runtime-BGZkWvKr.js +0 -206
- package/dist/simple-completion-runtime-CM_IISYW.js +0 -2
- package/dist/simple-completion-transport-Bo0u9dhp.js +0 -83
- package/dist/snapshot-urls-C1KjRQD5.js +0 -317
- package/dist/speech-core-Bas7e4h0.js +0 -119
- package/dist/speech-provider-BonJQv5S.js +0 -227
- package/dist/speech-provider-CwdKQmDv.js +0 -171
- package/dist/speech-provider-DcQRnYhZ.js +0 -233
- package/dist/stale-oauth-profile-shadows-C3aeAWfv.js +0 -186
- package/dist/stale-oauth-profile-shadows-m5rb8dPc.js +0 -2
- package/dist/standalone-runtime-registry-loader-B9n2LBKC.js +0 -59
- package/dist/startup-context-DY7C4riM.js +0 -314
- package/dist/status-6EPKat7p.js +0 -73
- package/dist/status-C6Fa7Dsf.js +0 -2
- package/dist/status-CNnxDQlM.js +0 -4
- package/dist/status-D2Scvbc0.js +0 -3
- package/dist/status-Ducanro3.js +0 -2
- package/dist/status-_XX_6QVA.js +0 -466
- package/dist/status-all-BP1u6vou.js +0 -573
- package/dist/status-json-DPlOJ_ue.js +0 -15
- package/dist/status-json-command-BT7EwVKj.js +0 -84
- package/dist/status-message-Dzr9-MX-.js +0 -495
- package/dist/status-message.runtime-DFezIt1d.js +0 -6
- package/dist/status-prBlcUV5.js +0 -249
- package/dist/status-queue.runtime-C1bmg2rl.js +0 -2
- package/dist/status-runtime-shared-RjKIPEQ0.js +0 -289
- package/dist/status-subagents.runtime-tsCCe4Ny.js +0 -32
- package/dist/status-text-Bkeyg8Bf.js +0 -301
- package/dist/status.command-D06_4ATq.js +0 -425
- package/dist/status.command-dDEZM84a.js +0 -2
- package/dist/status.command.text-runtime-WH9tP7yg.js +0 -15
- package/dist/status.runtime-B76GaBIR.js +0 -2
- package/dist/status.scan-Bc6clx0F.js +0 -72
- package/dist/status.scan-overview-v_-AaFhC.js +0 -460
- package/dist/status.scan.deps.runtime-BkH1HAb4.js +0 -19
- package/dist/status.scan.fast-json-CrlfKKI3.js +0 -2
- package/dist/status.scan.fast-json-D8v6zfP8.js +0 -163
- package/dist/status.summary-DBhvgOPr.js +0 -276
- package/dist/status.summary-hQV0PKFO.js +0 -2
- package/dist/store-BClomp_4.js +0 -3
- package/dist/store-BHqDPtNw.js +0 -2302
- package/dist/stored-model-override-vm4CtQWX.js +0 -79
- package/dist/subagent-announce-D244Q4w2.js +0 -353
- package/dist/subagent-announce-delivery-qKZfF7Bs.js +0 -1369
- package/dist/subagent-control-c87mVGUE.js +0 -492
- package/dist/subagent-control.runtime-DfQtIsDb.js +0 -3
- package/dist/subagent-hooks-B_UW5Len.js +0 -2
- package/dist/subagent-hooks-CYvFWt_r.js +0 -230
- package/dist/subagent-hooks-api-DZgaJf19.js +0 -23
- package/dist/subagent-registry-BlcoCggo.js +0 -2627
- package/dist/subagent-registry-CuObhNeO.js +0 -3
- package/dist/subagent-session-cleanup-hFF8Z34s.js +0 -390
- package/dist/system-CN_Knfqq.js +0 -111
- package/dist/system-prompt-config-BmZlhYK9.js +0 -918
- package/dist/talk-DrjGczYs.js +0 -2454
- package/dist/target-id-BNpbyWkq.js +0 -107
- package/dist/targets-CQcGo6u4.js +0 -267
- package/dist/targets.runtime-DwcxNI-x.js +0 -2
- package/dist/task-executor-CZg-qt4u.js +0 -349
- package/dist/task-owner-access-Duem5jjb.js +0 -74
- package/dist/task-registry-Cw8pc3Ry.js +0 -2362
- package/dist/task-registry-delivery-runtime-HaiKqj0A.js +0 -2
- package/dist/task-registry.maintenance-BLv3wpK9.js +0 -764
- package/dist/task-registry.maintenance-CvlIcxE-.js +0 -2
- package/dist/task-status-access-C5nDJSI4.js +0 -18
- package/dist/tasks-D3CfEAlq.js +0 -548
- package/dist/tasks-WKnE5fvr.js +0 -153
- package/dist/tasks-audit-system-okJjcOjU.js +0 -210
- package/dist/tasks-json-C-iUgWNu.js +0 -73
- package/dist/tavily-web-search-provider.runtime-jpagljrA.js +0 -112
- package/dist/text-report-BTsF3Pv3.js +0 -695
- package/dist/text-transforms.runtime-CgH_pbcQ.js +0 -113
- package/dist/thread-bindings-BWxpUE9U.js +0 -228
- package/dist/tool-DhJbbm91.js +0 -143
- package/dist/tool-dispatch-CpFUfblu.js +0 -155
- package/dist/tool-images-C-tFlXjE.js +0 -247
- package/dist/tool-plugin-3NejWxZW.js +0 -93
- package/dist/tool-resolution-oW8Cbamd.js +0 -153
- package/dist/tool-result-truncation-CWFGf7Eu.js +0 -498
- package/dist/tool-schema-CMtc7PdZ.js +0 -40
- package/dist/tool-schema-projection-DJRPEEvY.js +0 -215
- package/dist/tool-split-E4RdK5jS.js +0 -323
- package/dist/tools-BAl3JiNw.js +0 -901
- package/dist/tools-DC8tCPxR.js +0 -579
- package/dist/tools-catalog-Dzv9zaBD.js +0 -156
- package/dist/tools-effective-CGvzyIL2.js +0 -442
- package/dist/tools-effective-inventory-GI5N5Q9v.js +0 -379
- package/dist/tools-invoke-CU2U0hNH.js +0 -51
- package/dist/tools-invoke-http-8s3FiUy4.js +0 -68
- package/dist/tools-invoke-shared-DIETrEY7.js +0 -200
- package/dist/tools.runtime-Bnm8CI7w.js +0 -5
- package/dist/transcript-rewrite-Buv2ITw4.js +0 -688
- package/dist/transcripts-tool-BCFlLCFd.js +0 -2
- package/dist/transcripts-tool-CWgNd0Uw.js +0 -656
- package/dist/tts-Aguo4zC5.js +0 -3
- package/dist/tts-Bf77cURn.js +0 -2
- package/dist/tts-DnADOKOP.js +0 -194
- package/dist/tts-runtime-MBSH-nOM.js +0 -1337
- package/dist/tts.runtime-B-NR9osE.js +0 -2
- package/dist/tts.runtime-Bo-QxKgx.js +0 -3
- package/dist/tui-B0CdNmCz.js +0 -4860
- package/dist/tui-ByRcXM3Z.js +0 -2
- package/dist/tui-backend-C52BUoZI.js +0 -256
- package/dist/tui-cli-BQHpZ4n0.js +0 -40
- package/dist/typing-policy-XspVOezC.js +0 -199
- package/dist/usage-BOYwzimH.js +0 -1113
- package/dist/usage-BSmLrVWB.js +0 -623
- package/dist/usage-format-CfzICmvv.js +0 -2
- package/dist/usage-format-DPJKCPic.js +0 -394
- package/dist/video-generation-provider-CdCTztQ7.js +0 -77
- package/dist/video-generation-provider-MUUshUzz.js +0 -325
- package/dist/video-generation-provider-XmzzTa6e.js +0 -297
- package/dist/video-generation-provider-weiQUJE5.js +0 -64
- package/dist/web-fetch-providers.runtime-tD9zqAS2.js +0 -41
- package/dist/web-guarded-fetch-CyhQZ1yD.js +0 -2
- package/dist/web-guarded-fetch-DIXHI-yJ.js +0 -58
- package/dist/web-media-BPnTMYE5.js +0 -4
- package/dist/web-media-DV_tCQiQ.js +0 -2
- package/dist/web-media-DYydVGCK.js +0 -651
- package/dist/web-provider-runtime-shared-h3M6Bqyg.js +0 -142
- package/dist/web-search-provider-common-CEYWuDcp.js +0 -252
- package/dist/web-search-providers.runtime-YrayP296.js +0 -41
- /package/dist/{acp-runtime-backend-CHZtaM6t.js → acp-runtime-backend-B83JR5Zf.js} +0 -0
- /package/dist/{agent-turn-attachments-BYCRK86s.js → agent-turn-attachments-D5uJijuK.js} +0 -0
- /package/dist/{auth-install-policy-t46tJ8jV.js → auth-install-policy-BIpdwrZ9.js} +0 -0
- /package/dist/{cli-backends-BHXnrVN_.js → cli-backends-79CCRQ2a.js} +0 -0
- /package/dist/{command-secret-targets-DZ0J2Wm3.js → command-secret-targets-BOJlcBil.js} +0 -0
- /package/dist/{commands-DWp49Exc.js → commands-Dw9hwmVt.js} +0 -0
- /package/dist/{commands-reset-hooks-MMq2dvff.js → commands-reset-hooks-epArfNOY.js} +0 -0
- /package/dist/{delegate-Dkj_5OvH.js → delegate-Bw8NQXVr.js} +0 -0
- /package/dist/{jobs-BGELIHcx.js → jobs-BIOTaq7l.js} +0 -0
- /package/dist/{kimi-web-search-provider-4PlMYsPx.js → kimi-web-search-provider-Bzg_DiXO.js} +0 -0
- /package/dist/{memory-host-search-Ds9GiNpf.js → memory-host-search-Dph0Mq-v.js} +0 -0
- /package/dist/{minimax-web-search-provider-d5gTJUNg.js → minimax-web-search-provider-CETxDkkI.js} +0 -0
- /package/dist/{model-selection-cli-CO6BHPiL.js → model-selection-cli-DizUvxeY.js} +0 -0
- /package/dist/{provider-auth-choice-preference-f7Us6TQL.js → provider-auth-choice-preference-uJn1811S.js} +0 -0
- /package/dist/{runtime-wfO9bV5y.js → runtime-BEVbpIgZ.js} +0 -0
- /package/dist/{runtime-web-tools-B6vr1LZs.js → runtime-web-tools-Bf0aEe-F.js} +0 -0
- /package/dist/{runtime-web-tools-fallback.runtime-Crs7KfH5.js → runtime-web-tools-fallback.runtime-DU6rTj6l.js} +0 -0
- /package/dist/{session-subagent-reactivation-H5Rdwkyy.js → session-subagent-reactivation-Bb5SCi9J.js} +0 -0
- /package/dist/{tavily-web-search-provider-DbdIzpMv.js → tavily-web-search-provider-CIEhV60D.js} +0 -0
|
@@ -1,3497 +0,0 @@
|
|
|
1
|
-
import { a as normalizeLowercaseStringOrEmpty, c as normalizeOptionalString, o as normalizeNullableString, s as normalizeOptionalLowercaseString } from "./string-coerce-DKw2K5wM.js";
|
|
2
|
-
import { a as asFiniteNumber } from "./number-coercion-D1aDmIZp.js";
|
|
3
|
-
import { o as isRecord } from "./record-coerce-Btbek4uV.js";
|
|
4
|
-
import { i as formatErrorMessage } from "./errors-5ePGD43N.js";
|
|
5
|
-
import { t as createLazyImportLoader } from "./lazy-promise-Djskx0qC.js";
|
|
6
|
-
import { l as normalizeStringEntries } from "./string-normalization-B8G0vlWE.js";
|
|
7
|
-
import { s as sanitizeHostExecEnvWithDiagnostics } from "./host-env-security-BujxmR07.js";
|
|
8
|
-
import "./utils-v5zGdVpj.js";
|
|
9
|
-
import { t as escapeRegExp } from "./regexp-gnNKXe6h.js";
|
|
10
|
-
import { a as isSubagentSessionKey, c as parseAgentSessionKey, i as isCronSessionKey } from "./session-key-utils-CdfsDYvz.js";
|
|
11
|
-
import { d as resolveAgentIdFromSessionKey, l as normalizeAgentId } from "./session-key-CJf5_zWs.js";
|
|
12
|
-
import { a as logWarn, r as logInfo } from "./logger-BZdGwGcr.js";
|
|
13
|
-
import { J as getShellPathFromLoginShell, Y as resolveShellEnvFallbackTimeoutMs } from "./io-DAZXanmU.js";
|
|
14
|
-
import { f as resolveApprovalAuditTrustPath } from "./exec-safe-bin-trust-BavWgRnC.js";
|
|
15
|
-
import { O as normalizeExecutableToken, c as isShellWrapperExecutable, k as splitShellArgs, t as POSIX_SHELL_WRAPPERS, u as resolveShellWrapperTransportArgv } from "./shell-wrapper-resolution-Cl9437dq.js";
|
|
16
|
-
import { t as killProcessTree } from "./kill-tree-kSm0C74g.js";
|
|
17
|
-
import { i as INTERNAL_MESSAGE_CHANNEL } from "./message-channel-core-rOsWksPZ.js";
|
|
18
|
-
import { i as normalizeMessageChannel, n as isGatewayMessageChannel } from "./message-channel-normalize-CaOaCinb.js";
|
|
19
|
-
import "./message-channel-DcN_7tYD.js";
|
|
20
|
-
import { n as addSafeTimeoutDelayGraceMs } from "./timeouts-tJvqW40V.js";
|
|
21
|
-
import { n as APPROVALS_SCOPE, o as WRITE_SCOPE } from "./operator-scopes-DGvgHuOd.js";
|
|
22
|
-
import { o as normalizeDeliveryContext } from "./delivery-context.shared-CHlZnq4E.js";
|
|
23
|
-
import { C as parseExecApprovalResultText, S as isExecDeniedResultText, d as sanitizeUserFacingText, x as formatExecDeniedUserMessage } from "./sanitize-user-facing-text-B7CiNPI8.js";
|
|
24
|
-
import { n as getDiagnosticSessionState } from "./diagnostic-session-state-DwjGSduD.js";
|
|
25
|
-
import { c as EXEC_TOOL_DISPLAY_SUMMARY, l as PROCESS_TOOL_DISPLAY_SUMMARY } from "./tool-catalog-BfQXK2pl.js";
|
|
26
|
-
import { C as textResult, o as failedTextResult } from "./common-CZvBLb3w.js";
|
|
27
|
-
import { t as callGatewayTool } from "./gateway-BCrUxrVw.js";
|
|
28
|
-
import { c as describeInterpreterInlineEval, t as buildCommandPayloadCandidates } from "./risks-DM4Eigd_.js";
|
|
29
|
-
import { l as analyzeShellCommand, n as evaluateShellAllowlist, u as buildEnforcedShellCommand } from "./exec-approvals-allowlist-au7CtSQ2.js";
|
|
30
|
-
import { A as resolveExecApprovals, C as recordAllowlistMatchesUse, D as requiresExecApproval, E as requireValidExecTarget, F as resolveExecModePolicy, O as resolveExecApprovalAllowedDecisions, d as loadExecApprovals, f as maxAsk, g as normalizeExecAsk, j as resolveExecApprovalsFromFile, l as hasDurableExecApproval, m as minSecurity, o as addDurableCommandApproval, s as commandRequiresSecurityAuditSuppressionApproval, x as persistAllowAlwaysPatterns } from "./exec-approvals-OmSY2hSB.js";
|
|
31
|
-
import { r as resolveExecSafeBinRuntimePolicy } from "./exec-safe-bin-runtime-policy-D8i-qd_X.js";
|
|
32
|
-
import { n as describeProcessTool, t as describeExecTool } from "./bash-tools.descriptions-CmnntKkL.js";
|
|
33
|
-
import { n as processSchema, t as execSchema } from "./bash-tools.schemas-DHPBVmIy.js";
|
|
34
|
-
import "./delivery-context-D5p4ZNuR.js";
|
|
35
|
-
import { t as resolveExternalBestEffortDeliveryTarget } from "./best-effort-delivery-B8Rfs1sR.js";
|
|
36
|
-
import { t as sendMessage } from "./message-BVXoNpWP.js";
|
|
37
|
-
import { i as resolveNodeIdFromList, t as listNodes } from "./nodes-utils-Yks_uDZK.js";
|
|
38
|
-
import { t as formatDurationCompact } from "./format-duration-BrZ-AaEJ.js";
|
|
39
|
-
import { a as coerceEnv, c as readEnvInt, d as sliceLogLines, f as truncateMiddle, i as clampWithDefault, l as resolveSandboxWorkdir, n as buildSandboxEnv, o as deriveSessionName, s as pad, u as resolveWorkdir } from "./bash-tools.shared-Bb5t2u25.js";
|
|
40
|
-
import { a as drainSession, c as listFinishedSessions, d as markExited, f as setJobTtlMs, i as deleteSession, l as listRunningSessions, o as getFinishedSession, p as tail, s as getSession, u as markBackgrounded } from "./bash-process-registry-DExu0hla.js";
|
|
41
|
-
import { _ as normalizePathPrepend, a as DEFAULT_PENDING_MAX_OUTPUT, c as createApprovalSlug, f as resolveApprovalRunningNoticeMs, g as applyPathPrepend, h as renderExecOutputText, i as DEFAULT_PATH, m as runExecProcess, n as DEFAULT_APPROVAL_TIMEOUT_MS, o as applyShellPath, p as resolveExecTarget, r as DEFAULT_MAX_OUTPUT, s as buildApprovalPendingMessage, t as DEFAULT_APPROVAL_REQUEST_TIMEOUT_MS, u as normalizeNotifyOutput } from "./bash-tools.exec-runtime-DucFjdEu.js";
|
|
42
|
-
import { t as getProcessSupervisor } from "./supervisor-DMuvlusb.js";
|
|
43
|
-
import { i as resolveExecApprovalInitiatingSurfaceState } from "./exec-approval-surface-CwdMVtrH.js";
|
|
44
|
-
import { u as buildExecApprovalUnavailableReplyPayload } from "./exec-approval-reply-D3XuHTa1.js";
|
|
45
|
-
import { n as detectPolicyInlineEval } from "./policy-D0zs1tEW.js";
|
|
46
|
-
import { i as defaultExecAutoReviewer, t as createModelExecAutoReviewer } from "./exec-auto-reviewer-BrrdGleK.js";
|
|
47
|
-
import { i as registerExecApprovalFollowupRuntimeHandoff, t as buildExecApprovalFollowupIdempotencyKey } from "./bash-tools.exec-approval-followup-state-CZKm2nN5.js";
|
|
48
|
-
import { n as formatExecCommand, r as resolveSystemRunCommandRequest, t as extractShellCommandFromArgv } from "./system-run-command-5NffG1dK.js";
|
|
49
|
-
import { t as parsePreparedSystemRunPayload } from "./system-run-approval-context-Mn9Sfzu2.js";
|
|
50
|
-
import { n as recordCommandPoll, r as resetCommandPollCount } from "./command-poll-backoff-DmjJeZIx.js";
|
|
51
|
-
import { constants } from "node:fs";
|
|
52
|
-
import path from "node:path";
|
|
53
|
-
import fs$1 from "node:fs/promises";
|
|
54
|
-
import crypto, { randomUUID } from "node:crypto";
|
|
55
|
-
//#region src/agents/bash-tools.exec-approval-request.ts
|
|
56
|
-
let execApprovalCommandSpansRuntimePromise = null;
|
|
57
|
-
const POSIX_COMMAND_HIGHLIGHT_SHELLS = POSIX_SHELL_WRAPPERS;
|
|
58
|
-
function loadExecApprovalCommandSpansRuntime() {
|
|
59
|
-
execApprovalCommandSpansRuntimePromise ??= import("./bash-tools.exec-approval-request.runtime.js");
|
|
60
|
-
return execApprovalCommandSpansRuntimePromise;
|
|
61
|
-
}
|
|
62
|
-
function buildExecApprovalRequestToolParams(params) {
|
|
63
|
-
return {
|
|
64
|
-
id: params.id,
|
|
65
|
-
...params.command ? { command: params.command } : {},
|
|
66
|
-
...params.commandArgv ? { commandArgv: params.commandArgv } : {},
|
|
67
|
-
systemRunPlan: params.systemRunPlan,
|
|
68
|
-
env: params.env,
|
|
69
|
-
cwd: params.cwd,
|
|
70
|
-
nodeId: params.nodeId,
|
|
71
|
-
host: params.host,
|
|
72
|
-
security: params.security,
|
|
73
|
-
ask: params.ask,
|
|
74
|
-
warningText: params.warningText,
|
|
75
|
-
commandSpans: params.commandSpans,
|
|
76
|
-
agentId: params.agentId,
|
|
77
|
-
resolvedPath: params.resolvedPath,
|
|
78
|
-
sessionKey: params.sessionKey,
|
|
79
|
-
turnSourceChannel: params.turnSourceChannel,
|
|
80
|
-
turnSourceTo: params.turnSourceTo,
|
|
81
|
-
turnSourceAccountId: params.turnSourceAccountId,
|
|
82
|
-
turnSourceThreadId: params.turnSourceThreadId,
|
|
83
|
-
requireDeliveryRoute: params.requireDeliveryRoute,
|
|
84
|
-
suppressDelivery: params.suppressDelivery,
|
|
85
|
-
timeoutMs: DEFAULT_APPROVAL_TIMEOUT_MS,
|
|
86
|
-
twoPhase: true
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
function parseDecision(value) {
|
|
90
|
-
if (!value || typeof value !== "object") return {
|
|
91
|
-
present: false,
|
|
92
|
-
value: null
|
|
93
|
-
};
|
|
94
|
-
if (!Object.hasOwn(value, "decision")) return {
|
|
95
|
-
present: false,
|
|
96
|
-
value: null
|
|
97
|
-
};
|
|
98
|
-
const decision = value.decision;
|
|
99
|
-
return {
|
|
100
|
-
present: true,
|
|
101
|
-
value: typeof decision === "string" ? decision : null
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
function parseExpiresAtMs(value) {
|
|
105
|
-
return asFiniteNumber(value);
|
|
106
|
-
}
|
|
107
|
-
async function registerExecApprovalRequest(params) {
|
|
108
|
-
const registrationResult = await callGatewayTool("exec.approval.request", { timeoutMs: DEFAULT_APPROVAL_REQUEST_TIMEOUT_MS }, buildExecApprovalRequestToolParams(params), { expectFinal: false });
|
|
109
|
-
const decision = parseDecision(registrationResult);
|
|
110
|
-
const id = normalizeOptionalString(registrationResult?.id) ?? params.id;
|
|
111
|
-
const expiresAtMs = parseExpiresAtMs(registrationResult?.expiresAtMs) ?? Date.now() + DEFAULT_APPROVAL_TIMEOUT_MS;
|
|
112
|
-
if (decision.present) return {
|
|
113
|
-
id,
|
|
114
|
-
expiresAtMs,
|
|
115
|
-
finalDecision: decision.value
|
|
116
|
-
};
|
|
117
|
-
return {
|
|
118
|
-
id,
|
|
119
|
-
expiresAtMs
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
async function waitForExecApprovalDecision(id) {
|
|
123
|
-
try {
|
|
124
|
-
return parseDecision(await callGatewayTool("exec.approval.waitDecision", { timeoutMs: DEFAULT_APPROVAL_REQUEST_TIMEOUT_MS }, { id })).value;
|
|
125
|
-
} catch (err) {
|
|
126
|
-
if (normalizeLowercaseStringOrEmpty(String(err)).includes("approval expired or not found")) return null;
|
|
127
|
-
throw err;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
async function resolveRegisteredExecApprovalDecision(params) {
|
|
131
|
-
if (params.preResolvedDecision !== void 0) return params.preResolvedDecision ?? null;
|
|
132
|
-
return await waitForExecApprovalDecision(params.approvalId);
|
|
133
|
-
}
|
|
134
|
-
function buildExecApprovalRequesterContext(params) {
|
|
135
|
-
return {
|
|
136
|
-
agentId: params.agentId,
|
|
137
|
-
sessionKey: params.sessionKey
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
function buildExecApprovalTurnSourceContext(params) {
|
|
141
|
-
return {
|
|
142
|
-
turnSourceChannel: params.turnSourceChannel,
|
|
143
|
-
turnSourceTo: params.turnSourceTo,
|
|
144
|
-
turnSourceAccountId: params.turnSourceAccountId,
|
|
145
|
-
turnSourceThreadId: params.turnSourceThreadId
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
async function resolveCommandSpans(command) {
|
|
149
|
-
if (!command) return;
|
|
150
|
-
try {
|
|
151
|
-
const { resolveExecApprovalCommandSpans } = await loadExecApprovalCommandSpansRuntime();
|
|
152
|
-
return await resolveExecApprovalCommandSpans(command);
|
|
153
|
-
} catch {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function hasUnsupportedShellArgv(argv) {
|
|
158
|
-
if (!argv?.length) return false;
|
|
159
|
-
const executable = (resolveShellWrapperTransportArgv([...argv]) ?? argv)[0];
|
|
160
|
-
if (!executable) return false;
|
|
161
|
-
const normalizedExecutable = normalizeExecutableToken(executable);
|
|
162
|
-
return isShellWrapperExecutable(normalizedExecutable) && !POSIX_COMMAND_HIGHLIGHT_SHELLS.has(normalizedExecutable);
|
|
163
|
-
}
|
|
164
|
-
function shouldSkipGeneratedCommandSpans(params) {
|
|
165
|
-
if (params.host === "gateway" && process.platform === "win32") return true;
|
|
166
|
-
return hasUnsupportedShellArgv(params.commandArgv?.length ? params.commandArgv : params.systemRunPlan?.argv);
|
|
167
|
-
}
|
|
168
|
-
async function buildHostApprovalDecisionParams(params) {
|
|
169
|
-
const commandSpans = params.commandHighlighting === true ? params.commandSpans ?? (shouldSkipGeneratedCommandSpans(params) ? void 0 : await resolveCommandSpans(params.command ?? params.systemRunPlan?.commandText)) : void 0;
|
|
170
|
-
return {
|
|
171
|
-
id: params.approvalId,
|
|
172
|
-
command: params.command,
|
|
173
|
-
commandArgv: params.commandArgv,
|
|
174
|
-
systemRunPlan: params.systemRunPlan,
|
|
175
|
-
env: params.env,
|
|
176
|
-
cwd: params.workdir,
|
|
177
|
-
nodeId: params.nodeId,
|
|
178
|
-
host: params.host,
|
|
179
|
-
security: params.security,
|
|
180
|
-
ask: params.ask,
|
|
181
|
-
warningText: params.warningText,
|
|
182
|
-
commandSpans,
|
|
183
|
-
...buildExecApprovalRequesterContext({
|
|
184
|
-
agentId: params.agentId,
|
|
185
|
-
sessionKey: params.sessionKey
|
|
186
|
-
}),
|
|
187
|
-
resolvedPath: params.resolvedPath,
|
|
188
|
-
requireDeliveryRoute: params.requireDeliveryRoute,
|
|
189
|
-
suppressDelivery: params.suppressDelivery,
|
|
190
|
-
...buildExecApprovalTurnSourceContext(params)
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
async function registerExecApprovalRequestForHost(params) {
|
|
194
|
-
return await registerExecApprovalRequest(await buildHostApprovalDecisionParams(params));
|
|
195
|
-
}
|
|
196
|
-
async function registerExecApprovalRequestForHostOrThrow(params) {
|
|
197
|
-
try {
|
|
198
|
-
return await registerExecApprovalRequestForHost(params);
|
|
199
|
-
} catch (err) {
|
|
200
|
-
throw new Error(`Exec approval registration failed: ${String(err)}`, { cause: err });
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
//#endregion
|
|
204
|
-
//#region src/agents/bash-tools.exec-approval-followup.ts
|
|
205
|
-
function buildExecDeniedFollowupPrompt(resultText) {
|
|
206
|
-
return [
|
|
207
|
-
"An async command did not run.",
|
|
208
|
-
"Do not run the command again.",
|
|
209
|
-
"There is no new command output.",
|
|
210
|
-
"Do not mention, summarize, or reuse output from any earlier run in this session.",
|
|
211
|
-
"",
|
|
212
|
-
"Exact completion details:",
|
|
213
|
-
resultText.trim(),
|
|
214
|
-
"",
|
|
215
|
-
"Reply to the user in a helpful way.",
|
|
216
|
-
"Explain that the command did not run and why.",
|
|
217
|
-
"Do not claim there is new command output."
|
|
218
|
-
].join("\n");
|
|
219
|
-
}
|
|
220
|
-
function formatUnknownError(error) {
|
|
221
|
-
if (error instanceof Error) return error.message;
|
|
222
|
-
if (typeof error === "string") return error;
|
|
223
|
-
try {
|
|
224
|
-
return JSON.stringify(error);
|
|
225
|
-
} catch {
|
|
226
|
-
return "unknown error";
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
function buildExecApprovalFollowupPrompt(resultText) {
|
|
230
|
-
const trimmed = resultText.trim();
|
|
231
|
-
if (isExecDeniedResultText(trimmed)) return buildExecDeniedFollowupPrompt(trimmed);
|
|
232
|
-
return [
|
|
233
|
-
"An async command the user already approved has completed.",
|
|
234
|
-
"Do not run the command again.",
|
|
235
|
-
"If the task requires more steps, continue from this result before replying to the user.",
|
|
236
|
-
"Only ask the user for help if you are actually blocked.",
|
|
237
|
-
"",
|
|
238
|
-
"Exact completion details:",
|
|
239
|
-
trimmed,
|
|
240
|
-
"",
|
|
241
|
-
"Continue the task if needed, then reply to the user in a helpful way.",
|
|
242
|
-
"If it succeeded, share the relevant output.",
|
|
243
|
-
"If it failed, explain what went wrong."
|
|
244
|
-
].join("\n");
|
|
245
|
-
}
|
|
246
|
-
function shouldSuppressExecDeniedFollowup(sessionKey) {
|
|
247
|
-
return isSubagentSessionKey(sessionKey) || isCronSessionKey(sessionKey);
|
|
248
|
-
}
|
|
249
|
-
function formatDirectExecApprovalFollowupText(resultText, opts = {}) {
|
|
250
|
-
const parsed = parseExecApprovalResultText(resultText);
|
|
251
|
-
if (parsed.kind === "other" && !parsed.raw) return null;
|
|
252
|
-
if (parsed.kind === "denied") return opts.allowDenied ? formatExecDeniedUserMessage(parsed.raw) : null;
|
|
253
|
-
if (parsed.kind === "finished") {
|
|
254
|
-
const metadata = normalizeLowercaseStringOrEmpty(parsed.metadata);
|
|
255
|
-
const body = sanitizeUserFacingText(parsed.body, { errorContext: !metadata.includes("code 0") }).trim();
|
|
256
|
-
let prefix = "";
|
|
257
|
-
if (!body) prefix = metadata.includes("code 0") ? "Background command finished." : metadata.includes("signal") ? "Background command stopped unexpectedly." : "Background command finished with an error.";
|
|
258
|
-
return body ? `${prefix ? `${prefix}\n\n` : ""}${body}` : prefix || null;
|
|
259
|
-
}
|
|
260
|
-
if (parsed.kind === "completed") return sanitizeUserFacingText(parsed.body, { errorContext: true }).trim() || "Background command finished.";
|
|
261
|
-
return sanitizeUserFacingText(parsed.raw, { errorContext: true }).trim() || null;
|
|
262
|
-
}
|
|
263
|
-
function buildSessionResumeFallbackPrefix() {
|
|
264
|
-
return "Automatic session resume failed, so sending the status directly.\n\n";
|
|
265
|
-
}
|
|
266
|
-
function readGatewayStatus(value) {
|
|
267
|
-
return value && typeof value === "object" && !Array.isArray(value) ? normalizeOptionalString(value.status) : void 0;
|
|
268
|
-
}
|
|
269
|
-
function readGatewayRunId(value) {
|
|
270
|
-
return value && typeof value === "object" && !Array.isArray(value) ? normalizeOptionalString(value.runId) : void 0;
|
|
271
|
-
}
|
|
272
|
-
function buildFollowupWaitError(params) {
|
|
273
|
-
const suffix = typeof params.error === "string" && params.error.trim() ? `: ${params.error.trim()}` : params.status ? `: ${params.status}` : "";
|
|
274
|
-
return /* @__PURE__ */ new Error(`exec approval followup session resume failed${suffix}`);
|
|
275
|
-
}
|
|
276
|
-
function isSuccessfulFollowupStatus(status) {
|
|
277
|
-
return status === "ok";
|
|
278
|
-
}
|
|
279
|
-
async function waitForAgentFollowupRun(params) {
|
|
280
|
-
const wait = await callGatewayTool("agent.wait", { timeoutMs: params.timeoutMs + 2e3 }, {
|
|
281
|
-
runId: params.runId,
|
|
282
|
-
timeoutMs: params.timeoutMs
|
|
283
|
-
});
|
|
284
|
-
const status = readGatewayStatus(wait);
|
|
285
|
-
if (isSuccessfulFollowupStatus(status)) return;
|
|
286
|
-
throw buildFollowupWaitError({
|
|
287
|
-
status,
|
|
288
|
-
error: wait.error
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
function shouldPrefixDirectFollowupWithSessionResumeFailure(params) {
|
|
292
|
-
if (!params.sessionError) return false;
|
|
293
|
-
const parsed = parseExecApprovalResultText(params.resultText);
|
|
294
|
-
if (parsed.kind !== "finished") return true;
|
|
295
|
-
return !normalizeLowercaseStringOrEmpty(parsed.metadata).includes("code 0");
|
|
296
|
-
}
|
|
297
|
-
function canDirectSendDeniedFollowup(sessionError) {
|
|
298
|
-
return sessionError !== null;
|
|
299
|
-
}
|
|
300
|
-
function buildAgentFollowupArgs(params) {
|
|
301
|
-
const { deliveryTarget, sessionOnlyOriginChannel } = params;
|
|
302
|
-
const fallbackChannel = sessionOnlyOriginChannel ?? params.turnSourceChannel;
|
|
303
|
-
return {
|
|
304
|
-
sessionKey: params.sessionKey,
|
|
305
|
-
message: buildExecApprovalFollowupPrompt(params.resultText),
|
|
306
|
-
deliver: deliveryTarget.deliver,
|
|
307
|
-
...deliveryTarget.deliver ? { bestEffortDeliver: true } : {},
|
|
308
|
-
channel: deliveryTarget.deliver ? deliveryTarget.channel : fallbackChannel,
|
|
309
|
-
to: deliveryTarget.deliver ? deliveryTarget.to : sessionOnlyOriginChannel ? params.turnSourceTo : void 0,
|
|
310
|
-
accountId: deliveryTarget.deliver ? deliveryTarget.accountId : sessionOnlyOriginChannel ? params.turnSourceAccountId : void 0,
|
|
311
|
-
threadId: deliveryTarget.deliver ? deliveryTarget.threadId : sessionOnlyOriginChannel ? params.turnSourceThreadId : void 0,
|
|
312
|
-
idempotencyKey: params.idempotencyKey ?? buildExecApprovalFollowupIdempotencyKey({ approvalId: params.approvalId }),
|
|
313
|
-
...params.internalRuntimeHandoffId ? { internalRuntimeHandoffId: params.internalRuntimeHandoffId } : {}
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
async function sendDirectFollowupFallback(params) {
|
|
317
|
-
const directText = formatDirectExecApprovalFollowupText(params.resultText, { allowDenied: params.allowDenied ?? canDirectSendDeniedFollowup(params.sessionError) });
|
|
318
|
-
if (!params.deliveryTarget.deliver || !directText) return false;
|
|
319
|
-
const prefix = !params.allowDenied && shouldPrefixDirectFollowupWithSessionResumeFailure(params) ? buildSessionResumeFallbackPrefix() : "";
|
|
320
|
-
await sendMessage({
|
|
321
|
-
channel: params.deliveryTarget.channel,
|
|
322
|
-
to: params.deliveryTarget.to ?? "",
|
|
323
|
-
accountId: params.deliveryTarget.accountId,
|
|
324
|
-
threadId: params.deliveryTarget.threadId,
|
|
325
|
-
content: `${prefix}${directText}`,
|
|
326
|
-
agentId: void 0,
|
|
327
|
-
idempotencyKey: `exec-approval-followup:${params.approvalId}`
|
|
328
|
-
});
|
|
329
|
-
return true;
|
|
330
|
-
}
|
|
331
|
-
async function sendExecApprovalFollowup(params) {
|
|
332
|
-
const sessionKey = params.sessionKey?.trim();
|
|
333
|
-
const resultText = params.resultText.trim();
|
|
334
|
-
if (!resultText) return false;
|
|
335
|
-
const isDenied = isExecDeniedResultText(resultText);
|
|
336
|
-
const deliveryTarget = resolveExternalBestEffortDeliveryTarget({
|
|
337
|
-
channel: params.turnSourceChannel,
|
|
338
|
-
to: params.turnSourceTo,
|
|
339
|
-
accountId: params.turnSourceAccountId,
|
|
340
|
-
threadId: params.turnSourceThreadId
|
|
341
|
-
});
|
|
342
|
-
const normalizedTurnSourceChannel = normalizeMessageChannel(params.turnSourceChannel);
|
|
343
|
-
const sessionOnlyOriginChannel = normalizedTurnSourceChannel && isGatewayMessageChannel(normalizedTurnSourceChannel) ? normalizedTurnSourceChannel : void 0;
|
|
344
|
-
if (isDenied) {
|
|
345
|
-
if (!sessionKey || shouldSuppressExecDeniedFollowup(sessionKey)) return false;
|
|
346
|
-
return await sendDirectFollowupFallback({
|
|
347
|
-
approvalId: params.approvalId,
|
|
348
|
-
deliveryTarget,
|
|
349
|
-
resultText,
|
|
350
|
-
sessionError: null,
|
|
351
|
-
allowDenied: true
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
let sessionError = null;
|
|
355
|
-
if (sessionKey && params.direct !== true) try {
|
|
356
|
-
const agentArgs = buildAgentFollowupArgs({
|
|
357
|
-
approvalId: params.approvalId,
|
|
358
|
-
sessionKey,
|
|
359
|
-
resultText,
|
|
360
|
-
deliveryTarget,
|
|
361
|
-
sessionOnlyOriginChannel,
|
|
362
|
-
turnSourceChannel: params.turnSourceChannel,
|
|
363
|
-
turnSourceTo: params.turnSourceTo,
|
|
364
|
-
turnSourceAccountId: params.turnSourceAccountId,
|
|
365
|
-
turnSourceThreadId: params.turnSourceThreadId,
|
|
366
|
-
internalRuntimeHandoffId: params.internalRuntimeHandoffId,
|
|
367
|
-
idempotencyKey: params.idempotencyKey
|
|
368
|
-
});
|
|
369
|
-
const accepted = await callGatewayTool("agent", { timeoutMs: 6e4 }, agentArgs);
|
|
370
|
-
const status = readGatewayStatus(accepted);
|
|
371
|
-
if (isSuccessfulFollowupStatus(status)) return true;
|
|
372
|
-
if (status === "accepted" || status === "in_flight" || status === "pending") {
|
|
373
|
-
const runId = readGatewayRunId(accepted) ?? normalizeOptionalString(agentArgs.idempotencyKey);
|
|
374
|
-
if (!runId) throw buildFollowupWaitError({ status: "missing-run-id" });
|
|
375
|
-
await waitForAgentFollowupRun({
|
|
376
|
-
runId,
|
|
377
|
-
timeoutMs: 6e4
|
|
378
|
-
});
|
|
379
|
-
return true;
|
|
380
|
-
}
|
|
381
|
-
throw buildFollowupWaitError({
|
|
382
|
-
status,
|
|
383
|
-
error: accepted.error
|
|
384
|
-
});
|
|
385
|
-
} catch (err) {
|
|
386
|
-
sessionError = err;
|
|
387
|
-
}
|
|
388
|
-
if (await sendDirectFollowupFallback({
|
|
389
|
-
approvalId: params.approvalId,
|
|
390
|
-
deliveryTarget,
|
|
391
|
-
resultText,
|
|
392
|
-
sessionError
|
|
393
|
-
})) return true;
|
|
394
|
-
if (sessionError) throw new Error(`Session followup failed: ${formatUnknownError(sessionError)}`);
|
|
395
|
-
if (isDenied) return false;
|
|
396
|
-
throw new Error("需要会话密钥或可投递来源路由");
|
|
397
|
-
}
|
|
398
|
-
const loggedExecApprovalFollowupFailures = /* @__PURE__ */ new Set();
|
|
399
|
-
function rememberExecApprovalFollowupFailureKey(key) {
|
|
400
|
-
if (loggedExecApprovalFollowupFailures.has(key)) return false;
|
|
401
|
-
loggedExecApprovalFollowupFailures.add(key);
|
|
402
|
-
if (loggedExecApprovalFollowupFailures.size > 256) {
|
|
403
|
-
const oldestKey = loggedExecApprovalFollowupFailures.values().next().value;
|
|
404
|
-
if (typeof oldestKey === "string") loggedExecApprovalFollowupFailures.delete(oldestKey);
|
|
405
|
-
}
|
|
406
|
-
return true;
|
|
407
|
-
}
|
|
408
|
-
function isHeadlessExecTrigger(trigger) {
|
|
409
|
-
return trigger === "cron";
|
|
410
|
-
}
|
|
411
|
-
function createExecApprovalPendingState(params) {
|
|
412
|
-
return {
|
|
413
|
-
warningText: params.warnings.length ? `${params.warnings.join("\n")}\n\n` : "",
|
|
414
|
-
expiresAtMs: Date.now() + params.timeoutMs,
|
|
415
|
-
preResolvedDecision: void 0
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
function createExecApprovalRequestState(params) {
|
|
419
|
-
return {
|
|
420
|
-
...createExecApprovalPendingState({
|
|
421
|
-
warnings: params.warnings,
|
|
422
|
-
timeoutMs: params.timeoutMs
|
|
423
|
-
}),
|
|
424
|
-
noticeSeconds: Math.max(1, Math.round(params.approvalRunningNoticeMs / 1e3))
|
|
425
|
-
};
|
|
426
|
-
}
|
|
427
|
-
function createExecApprovalRequestContext(params) {
|
|
428
|
-
const approvalId = crypto.randomUUID();
|
|
429
|
-
return {
|
|
430
|
-
...createExecApprovalRequestState({
|
|
431
|
-
warnings: params.warnings,
|
|
432
|
-
timeoutMs: params.timeoutMs,
|
|
433
|
-
approvalRunningNoticeMs: params.approvalRunningNoticeMs
|
|
434
|
-
}),
|
|
435
|
-
approvalId,
|
|
436
|
-
approvalSlug: params.createApprovalSlug(approvalId),
|
|
437
|
-
contextKey: `exec:${approvalId}`
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
function createDefaultExecApprovalRequestContext(params) {
|
|
441
|
-
return createExecApprovalRequestContext({
|
|
442
|
-
warnings: params.warnings,
|
|
443
|
-
timeoutMs: DEFAULT_APPROVAL_TIMEOUT_MS,
|
|
444
|
-
approvalRunningNoticeMs: params.approvalRunningNoticeMs,
|
|
445
|
-
createApprovalSlug: params.createApprovalSlug
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
function resolveBaseExecApprovalDecision(params) {
|
|
449
|
-
if (params.decision === "deny") return {
|
|
450
|
-
approvedByAsk: false,
|
|
451
|
-
deniedReason: "user-denied",
|
|
452
|
-
timedOut: false
|
|
453
|
-
};
|
|
454
|
-
if (!params.decision) {
|
|
455
|
-
if (params.askFallback === "full") return {
|
|
456
|
-
approvedByAsk: true,
|
|
457
|
-
deniedReason: null,
|
|
458
|
-
timedOut: true
|
|
459
|
-
};
|
|
460
|
-
if (params.askFallback === "deny") return {
|
|
461
|
-
approvedByAsk: false,
|
|
462
|
-
deniedReason: "approval-timeout",
|
|
463
|
-
timedOut: true
|
|
464
|
-
};
|
|
465
|
-
return {
|
|
466
|
-
approvedByAsk: false,
|
|
467
|
-
deniedReason: null,
|
|
468
|
-
timedOut: true
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
return {
|
|
472
|
-
approvedByAsk: false,
|
|
473
|
-
deniedReason: null,
|
|
474
|
-
timedOut: false
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
function resolveExecHostApprovalContext(params) {
|
|
478
|
-
const approvals = resolveExecApprovals(params.agentId, {
|
|
479
|
-
security: params.security,
|
|
480
|
-
ask: params.ask
|
|
481
|
-
});
|
|
482
|
-
const hostSecurity = minSecurity(params.security, approvals.agent.security);
|
|
483
|
-
const hostAsk = maxAsk(params.ask, approvals.agent.ask);
|
|
484
|
-
const askFallback = minSecurity(hostSecurity, approvals.agent.askFallback);
|
|
485
|
-
if (hostSecurity === "deny") throw new Error(`exec denied: host=${params.host} security=deny`);
|
|
486
|
-
return {
|
|
487
|
-
approvals,
|
|
488
|
-
hostSecurity,
|
|
489
|
-
hostAsk,
|
|
490
|
-
askFallback
|
|
491
|
-
};
|
|
492
|
-
}
|
|
493
|
-
async function resolveApprovalDecisionOrUndefined(params) {
|
|
494
|
-
try {
|
|
495
|
-
return await resolveRegisteredExecApprovalDecision({
|
|
496
|
-
approvalId: params.approvalId,
|
|
497
|
-
preResolvedDecision: params.preResolvedDecision
|
|
498
|
-
});
|
|
499
|
-
} catch {
|
|
500
|
-
params.onFailure();
|
|
501
|
-
return;
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
function resolveExecApprovalUnavailableState(params) {
|
|
505
|
-
const initiatingSurface = resolveExecApprovalInitiatingSurfaceState({
|
|
506
|
-
channel: params.turnSourceChannel,
|
|
507
|
-
accountId: params.turnSourceAccountId
|
|
508
|
-
});
|
|
509
|
-
return {
|
|
510
|
-
initiatingSurface,
|
|
511
|
-
sentApproverDms: false,
|
|
512
|
-
unavailableReason: params.preResolvedDecision === null ? "no-approval-route" : initiatingSurface.kind === "disabled" ? "initiating-platform-disabled" : initiatingSurface.kind === "unsupported" ? "initiating-platform-unsupported" : null
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
async function createAndRegisterDefaultExecApprovalRequest(params) {
|
|
516
|
-
const { approvalId, approvalSlug, warningText, expiresAtMs: defaultExpiresAtMs, preResolvedDecision: defaultPreResolvedDecision } = createDefaultExecApprovalRequestContext({
|
|
517
|
-
warnings: params.warnings,
|
|
518
|
-
approvalRunningNoticeMs: params.approvalRunningNoticeMs,
|
|
519
|
-
createApprovalSlug: params.createApprovalSlug
|
|
520
|
-
});
|
|
521
|
-
const registration = await params.register(approvalId);
|
|
522
|
-
const preResolvedDecision = registration.finalDecision;
|
|
523
|
-
const { initiatingSurface, sentApproverDms, unavailableReason } = resolveExecApprovalUnavailableState({
|
|
524
|
-
turnSourceChannel: params.turnSourceChannel,
|
|
525
|
-
turnSourceAccountId: params.turnSourceAccountId,
|
|
526
|
-
preResolvedDecision
|
|
527
|
-
});
|
|
528
|
-
return {
|
|
529
|
-
approvalId,
|
|
530
|
-
approvalSlug,
|
|
531
|
-
warningText,
|
|
532
|
-
expiresAtMs: registration.expiresAtMs ?? defaultExpiresAtMs,
|
|
533
|
-
preResolvedDecision: registration.finalDecision === void 0 ? defaultPreResolvedDecision : registration.finalDecision,
|
|
534
|
-
initiatingSurface,
|
|
535
|
-
sentApproverDms,
|
|
536
|
-
unavailableReason
|
|
537
|
-
};
|
|
538
|
-
}
|
|
539
|
-
function buildDefaultExecApprovalRequestArgs(params) {
|
|
540
|
-
return {
|
|
541
|
-
warnings: params.warnings,
|
|
542
|
-
approvalRunningNoticeMs: params.approvalRunningNoticeMs,
|
|
543
|
-
createApprovalSlug: params.createApprovalSlug,
|
|
544
|
-
turnSourceChannel: params.turnSourceChannel,
|
|
545
|
-
turnSourceAccountId: params.turnSourceAccountId
|
|
546
|
-
};
|
|
547
|
-
}
|
|
548
|
-
function buildExecApprovalFollowupTarget(params) {
|
|
549
|
-
return {
|
|
550
|
-
approvalId: params.approvalId,
|
|
551
|
-
sessionKey: params.sessionKey,
|
|
552
|
-
turnSourceChannel: params.turnSourceChannel,
|
|
553
|
-
turnSourceTo: params.turnSourceTo,
|
|
554
|
-
turnSourceAccountId: params.turnSourceAccountId,
|
|
555
|
-
turnSourceThreadId: params.turnSourceThreadId,
|
|
556
|
-
direct: params.direct,
|
|
557
|
-
bashElevated: params.bashElevated
|
|
558
|
-
};
|
|
559
|
-
}
|
|
560
|
-
function createExecApprovalDecisionState(params) {
|
|
561
|
-
const baseDecision = resolveBaseExecApprovalDecision({
|
|
562
|
-
decision: params.decision ?? null,
|
|
563
|
-
askFallback: params.askFallback
|
|
564
|
-
});
|
|
565
|
-
return {
|
|
566
|
-
baseDecision,
|
|
567
|
-
approvedByAsk: baseDecision.approvedByAsk,
|
|
568
|
-
deniedReason: baseDecision.deniedReason
|
|
569
|
-
};
|
|
570
|
-
}
|
|
571
|
-
function enforceStrictInlineEvalApprovalBoundary(params) {
|
|
572
|
-
const requiresRealApproval = params.requiresInlineEvalApproval || params.requiresAutoReviewHumanApproval === true;
|
|
573
|
-
if (!params.baseDecision.timedOut || !requiresRealApproval || !params.approvedByAsk) return {
|
|
574
|
-
approvedByAsk: params.approvedByAsk,
|
|
575
|
-
deniedReason: params.deniedReason
|
|
576
|
-
};
|
|
577
|
-
return {
|
|
578
|
-
approvedByAsk: false,
|
|
579
|
-
deniedReason: params.deniedReason ?? "approval-timeout"
|
|
580
|
-
};
|
|
581
|
-
}
|
|
582
|
-
function shouldResolveExecApprovalUnavailableInline(params) {
|
|
583
|
-
return isHeadlessExecTrigger(params.trigger) && params.unavailableReason === "no-approval-route" && params.preResolvedDecision === null;
|
|
584
|
-
}
|
|
585
|
-
function buildHeadlessExecApprovalDeniedMessage(params) {
|
|
586
|
-
return [
|
|
587
|
-
`exec denied: ${params.trigger === "cron" ? "Cron runs" : "Headless runs"} cannot wait for interactive exec approval.`,
|
|
588
|
-
`Effective host exec policy: security=${params.security} ask=${params.ask} askFallback=${params.askFallback}`,
|
|
589
|
-
"Stricter values from tools.exec and ~/.fengming/exec-approvals.json both apply.",
|
|
590
|
-
"Fix one of these:",
|
|
591
|
-
"- align both files to security=\"full\" and ask=\"off\" for trusted local automation",
|
|
592
|
-
"- keep allowlist mode and add an explicit allowlist entry for this command",
|
|
593
|
-
"- enable Web UI, terminal UI, or chat exec approvals and rerun interactively",
|
|
594
|
-
"Tip: run \"fengming doctor\" and \"fengming approvals get --gateway\" to inspect the effective policy."
|
|
595
|
-
].join("\n");
|
|
596
|
-
}
|
|
597
|
-
async function sendExecApprovalFollowupResult(target, resultText, deps = {}) {
|
|
598
|
-
const send = deps.sendExecApprovalFollowup ?? sendExecApprovalFollowup;
|
|
599
|
-
const warn = deps.logWarn ?? logWarn;
|
|
600
|
-
const runtimeHandoff = target.direct === true || !target.sessionKey || isExecDeniedResultText(resultText) ? void 0 : registerExecApprovalFollowupRuntimeHandoff({
|
|
601
|
-
approvalId: target.approvalId,
|
|
602
|
-
sessionKey: target.sessionKey,
|
|
603
|
-
bashElevated: target.bashElevated
|
|
604
|
-
});
|
|
605
|
-
await send({
|
|
606
|
-
approvalId: target.approvalId,
|
|
607
|
-
sessionKey: target.sessionKey,
|
|
608
|
-
turnSourceChannel: target.turnSourceChannel,
|
|
609
|
-
turnSourceTo: target.turnSourceTo,
|
|
610
|
-
turnSourceAccountId: target.turnSourceAccountId,
|
|
611
|
-
turnSourceThreadId: target.turnSourceThreadId,
|
|
612
|
-
resultText,
|
|
613
|
-
direct: target.direct,
|
|
614
|
-
...runtimeHandoff ? {
|
|
615
|
-
internalRuntimeHandoffId: runtimeHandoff.handoffId,
|
|
616
|
-
idempotencyKey: runtimeHandoff.idempotencyKey
|
|
617
|
-
} : {}
|
|
618
|
-
}).catch((error) => {
|
|
619
|
-
const message = formatErrorMessage(error);
|
|
620
|
-
if (!rememberExecApprovalFollowupFailureKey(`${target.approvalId}:${message}`)) return;
|
|
621
|
-
warn(`exec approval followup dispatch failed (id=${target.approvalId}): ${message}`);
|
|
622
|
-
});
|
|
623
|
-
}
|
|
624
|
-
function buildExecApprovalPendingToolResult(params) {
|
|
625
|
-
const allowedDecisions = params.allowedDecisions ?? resolveExecApprovalAllowedDecisions();
|
|
626
|
-
return {
|
|
627
|
-
content: [{
|
|
628
|
-
type: "text",
|
|
629
|
-
text: params.unavailableReason !== null ? buildExecApprovalUnavailableReplyPayload({
|
|
630
|
-
warningText: params.warningText,
|
|
631
|
-
reason: params.unavailableReason,
|
|
632
|
-
channel: params.initiatingSurface.channel,
|
|
633
|
-
channelLabel: params.initiatingSurface.channelLabel,
|
|
634
|
-
accountId: params.initiatingSurface.accountId,
|
|
635
|
-
sentApproverDms: params.sentApproverDms
|
|
636
|
-
}).text ?? "" : buildApprovalPendingMessage({
|
|
637
|
-
warningText: params.warningText,
|
|
638
|
-
approvalSlug: params.approvalSlug,
|
|
639
|
-
approvalId: params.approvalId,
|
|
640
|
-
allowedDecisions,
|
|
641
|
-
command: params.command,
|
|
642
|
-
cwd: params.cwd,
|
|
643
|
-
host: params.host,
|
|
644
|
-
nodeId: params.nodeId
|
|
645
|
-
})
|
|
646
|
-
}],
|
|
647
|
-
details: params.unavailableReason !== null ? {
|
|
648
|
-
status: "approval-unavailable",
|
|
649
|
-
reason: params.unavailableReason,
|
|
650
|
-
channel: params.initiatingSurface.channel,
|
|
651
|
-
channelLabel: params.initiatingSurface.channelLabel,
|
|
652
|
-
accountId: params.initiatingSurface.accountId,
|
|
653
|
-
sentApproverDms: params.sentApproverDms,
|
|
654
|
-
host: params.host,
|
|
655
|
-
command: params.command,
|
|
656
|
-
cwd: params.cwd,
|
|
657
|
-
nodeId: params.nodeId,
|
|
658
|
-
warningText: params.warningText
|
|
659
|
-
} : {
|
|
660
|
-
status: "approval-pending",
|
|
661
|
-
approvalId: params.approvalId,
|
|
662
|
-
approvalSlug: params.approvalSlug,
|
|
663
|
-
expiresAtMs: params.expiresAtMs,
|
|
664
|
-
allowedDecisions,
|
|
665
|
-
host: params.host,
|
|
666
|
-
command: params.command,
|
|
667
|
-
cwd: params.cwd,
|
|
668
|
-
nodeId: params.nodeId,
|
|
669
|
-
warningText: params.warningText
|
|
670
|
-
}
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
|
-
//#endregion
|
|
674
|
-
//#region src/agents/bash-tools.exec-host-gateway.ts
|
|
675
|
-
function hasGatewayAllowlistMiss(params) {
|
|
676
|
-
return params.hostSecurity === "allowlist" && (!params.analysisOk || !params.allowlistSatisfied) && !params.durableApprovalSatisfied;
|
|
677
|
-
}
|
|
678
|
-
function resolveGatewayAutoReviewReason(params) {
|
|
679
|
-
if (params.requiresInlineEvalApproval) return "strict-inline-eval";
|
|
680
|
-
if (params.requiresHeredocApproval) return "heredoc";
|
|
681
|
-
if (params.requiresAllowlistPlanApproval) return "execution-plan-miss";
|
|
682
|
-
if (hasGatewayAllowlistMiss({
|
|
683
|
-
hostSecurity: params.hostSecurity,
|
|
684
|
-
analysisOk: params.analysisOk,
|
|
685
|
-
allowlistSatisfied: params.allowlistSatisfied,
|
|
686
|
-
durableApprovalSatisfied: params.durableApprovalSatisfied
|
|
687
|
-
})) return "allowlist-miss";
|
|
688
|
-
return "approval-required";
|
|
689
|
-
}
|
|
690
|
-
function formatOutcomeExitLabel(outcome) {
|
|
691
|
-
return outcome.timedOut ? "timeout" : `code ${outcome.exitCode ?? "?"}`;
|
|
692
|
-
}
|
|
693
|
-
function formatBytes(value) {
|
|
694
|
-
if (typeof value !== "number" || !Number.isFinite(value)) return null;
|
|
695
|
-
return `${Math.max(0, Math.round(value))} bytes`;
|
|
696
|
-
}
|
|
697
|
-
function formatDiagnosticsContents(manifest) {
|
|
698
|
-
const contents = Array.isArray(manifest.contents) ? manifest.contents : [];
|
|
699
|
-
if (contents.length === 0) return [];
|
|
700
|
-
const lines = [`Contents (${contents.length} files):`];
|
|
701
|
-
for (const entry of contents.slice(0, 12)) {
|
|
702
|
-
if (!isRecord(entry)) continue;
|
|
703
|
-
const path = typeof entry.path === "string" ? entry.path : "";
|
|
704
|
-
if (!path) continue;
|
|
705
|
-
const bytes = formatBytes(entry.bytes);
|
|
706
|
-
lines.push(`- ${bytes ? `${path} (${bytes})` : path}`);
|
|
707
|
-
}
|
|
708
|
-
if (contents.length > 12) lines.push(`- ... ${contents.length - 12} more`);
|
|
709
|
-
return lines;
|
|
710
|
-
}
|
|
711
|
-
function formatDiagnosticsPrivacy(manifest) {
|
|
712
|
-
const privacy = isRecord(manifest.privacy) ? manifest.privacy : null;
|
|
713
|
-
if (!privacy) return [];
|
|
714
|
-
const lines = ["Privacy:"];
|
|
715
|
-
if (typeof privacy.payloadFree === "boolean") lines.push(`- payload-free: ${privacy.payloadFree ? "yes" : "no"}`);
|
|
716
|
-
if (typeof privacy.rawLogsIncluded === "boolean") lines.push(`- raw logs included: ${privacy.rawLogsIncluded ? "yes" : "no"}`);
|
|
717
|
-
const notes = Array.isArray(privacy.notes) ? privacy.notes.filter((note) => typeof note === "string") : [];
|
|
718
|
-
for (const note of notes.slice(0, 4)) lines.push(`- ${note}`);
|
|
719
|
-
return lines.length > 1 ? lines : [];
|
|
720
|
-
}
|
|
721
|
-
function formatDiagnosticsExportSuccess(aggregated) {
|
|
722
|
-
const trimmed = aggregated.trim();
|
|
723
|
-
if (!trimmed) return "Diagnostics export completed, but no JSON output was returned.";
|
|
724
|
-
try {
|
|
725
|
-
const parsed = JSON.parse(trimmed);
|
|
726
|
-
if (!isRecord(parsed)) return trimmed;
|
|
727
|
-
const manifest = isRecord(parsed.manifest) ? parsed.manifest : {};
|
|
728
|
-
const lines = [
|
|
729
|
-
"Diagnostics export created.",
|
|
730
|
-
"",
|
|
731
|
-
"Local Gateway bundle:"
|
|
732
|
-
];
|
|
733
|
-
const bundlePath = typeof parsed.path === "string" ? parsed.path : "";
|
|
734
|
-
if (bundlePath) lines.push(`Path: ${bundlePath}`);
|
|
735
|
-
const bytes = formatBytes(parsed.bytes);
|
|
736
|
-
if (bytes) lines.push(`Size: ${bytes}`);
|
|
737
|
-
if (typeof manifest.generatedAt === "string") lines.push(`Generated at: ${manifest.generatedAt}`);
|
|
738
|
-
if (typeof manifest.fengmingVersion === "string") lines.push(`FengMing version: ${manifest.fengmingVersion}`);
|
|
739
|
-
const contents = formatDiagnosticsContents(manifest);
|
|
740
|
-
if (contents.length > 0) lines.push("", ...contents);
|
|
741
|
-
const privacy = formatDiagnosticsPrivacy(manifest);
|
|
742
|
-
if (privacy.length > 0) lines.push("", ...privacy);
|
|
743
|
-
return lines.join("\n");
|
|
744
|
-
} catch {
|
|
745
|
-
return trimmed;
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
function formatDiagnosticsExportFailure(params) {
|
|
749
|
-
const output = normalizeNotifyOutput(tail(params.outcome.aggregated || "", 4e3));
|
|
750
|
-
const lines = [`Diagnostics export failed (${params.exitLabel}).`];
|
|
751
|
-
if (params.outcome.reason) lines.push(params.outcome.reason);
|
|
752
|
-
if (output) lines.push("", output);
|
|
753
|
-
return lines.join("\n");
|
|
754
|
-
}
|
|
755
|
-
function buildGatewayExecApprovalFollowupSummary(params) {
|
|
756
|
-
const exitLabel = formatOutcomeExitLabel(params.outcome);
|
|
757
|
-
if (params.trigger === "diagnostics") {
|
|
758
|
-
const body = [params.outcome.status === "completed" && params.outcome.exitCode === 0 ? formatDiagnosticsExportSuccess(params.outcome.aggregated) : formatDiagnosticsExportFailure({
|
|
759
|
-
outcome: params.outcome,
|
|
760
|
-
exitLabel
|
|
761
|
-
}), params.approvalFollowupText?.trim()].filter(Boolean).join("\n\n");
|
|
762
|
-
return `Exec finished (gateway id=${params.approvalId}, session=${params.sessionId}, ${exitLabel})\n${body}`;
|
|
763
|
-
}
|
|
764
|
-
const output = normalizeNotifyOutput(tail(params.outcome.aggregated || "", 400));
|
|
765
|
-
return output ? `Exec finished (gateway id=${params.approvalId}, session=${params.sessionId}, ${exitLabel})\n${output}` : `Exec finished (gateway id=${params.approvalId}, session=${params.sessionId}, ${exitLabel})`;
|
|
766
|
-
}
|
|
767
|
-
function shouldAwaitGatewayApprovalInline(params) {
|
|
768
|
-
if (params.approvalFollowupMode === "direct") return false;
|
|
769
|
-
return normalizeMessageChannel(params.turnSourceChannel) === INTERNAL_MESSAGE_CHANNEL;
|
|
770
|
-
}
|
|
771
|
-
function buildGatewayExecApprovalDeniedToolResult(params) {
|
|
772
|
-
const text = `Exec denied (gateway id=${params.approvalId}, ${params.deniedReason}): ${params.command}`;
|
|
773
|
-
return {
|
|
774
|
-
content: [{
|
|
775
|
-
type: "text",
|
|
776
|
-
text
|
|
777
|
-
}],
|
|
778
|
-
details: {
|
|
779
|
-
status: "failed",
|
|
780
|
-
exitCode: null,
|
|
781
|
-
durationMs: 0,
|
|
782
|
-
aggregated: text,
|
|
783
|
-
timedOut: params.deniedReason.includes("timeout"),
|
|
784
|
-
cwd: params.cwd
|
|
785
|
-
}
|
|
786
|
-
};
|
|
787
|
-
}
|
|
788
|
-
async function resolveGatewayExecApprovalFollowupText(params) {
|
|
789
|
-
if (!params.approvalFollowup) return;
|
|
790
|
-
try {
|
|
791
|
-
return await params.approvalFollowup({
|
|
792
|
-
approvalId: params.approvalId,
|
|
793
|
-
sessionId: params.sessionId,
|
|
794
|
-
trigger: params.trigger,
|
|
795
|
-
outcome: params.outcome
|
|
796
|
-
});
|
|
797
|
-
} catch (error) {
|
|
798
|
-
return `Diagnostics follow-up failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
async function processGatewayAllowlist(params) {
|
|
802
|
-
const { approvals, hostSecurity, hostAsk, askFallback } = resolveExecHostApprovalContext({
|
|
803
|
-
agentId: params.agentId,
|
|
804
|
-
security: params.security,
|
|
805
|
-
ask: params.ask,
|
|
806
|
-
host: "gateway"
|
|
807
|
-
});
|
|
808
|
-
const allowlistEval = evaluateShellAllowlist({
|
|
809
|
-
command: params.command,
|
|
810
|
-
allowlist: approvals.allowlist,
|
|
811
|
-
safeBins: params.safeBins,
|
|
812
|
-
safeBinProfiles: params.safeBinProfiles,
|
|
813
|
-
cwd: params.workdir,
|
|
814
|
-
env: params.env,
|
|
815
|
-
platform: process.platform,
|
|
816
|
-
trustedSafeBinDirs: params.trustedSafeBinDirs
|
|
817
|
-
});
|
|
818
|
-
const allowlistMatches = allowlistEval.allowlistMatches;
|
|
819
|
-
const analysisOk = allowlistEval.analysisOk;
|
|
820
|
-
const allowlistSatisfied = hostSecurity === "allowlist" && analysisOk ? allowlistEval.allowlistSatisfied : false;
|
|
821
|
-
const durableApprovalSatisfied = hasDurableExecApproval({
|
|
822
|
-
analysisOk,
|
|
823
|
-
segmentAllowlistEntries: allowlistEval.segmentAllowlistEntries,
|
|
824
|
-
allowlist: approvals.allowlist,
|
|
825
|
-
commandText: params.command
|
|
826
|
-
});
|
|
827
|
-
const inlineEvalHit = params.strictInlineEval === true ? detectPolicyInlineEval(allowlistEval.segments) : null;
|
|
828
|
-
if (inlineEvalHit) params.warnings.push(`Warning: strict inline-eval mode requires reviewer or explicit approval for ${describeInterpreterInlineEval(inlineEvalHit)}.`);
|
|
829
|
-
let enforcedCommand;
|
|
830
|
-
let allowlistPlanUnavailableReason = null;
|
|
831
|
-
if (hostSecurity === "allowlist" && analysisOk && allowlistSatisfied) {
|
|
832
|
-
const enforced = buildEnforcedShellCommand({
|
|
833
|
-
command: params.command,
|
|
834
|
-
segments: allowlistEval.segments,
|
|
835
|
-
platform: process.platform
|
|
836
|
-
});
|
|
837
|
-
if (!enforced.ok || !enforced.command) allowlistPlanUnavailableReason = enforced.reason ?? "unsupported platform";
|
|
838
|
-
else enforcedCommand = enforced.command;
|
|
839
|
-
}
|
|
840
|
-
const recordMatchedAllowlistUse = (resolvedPath) => recordAllowlistMatchesUse({
|
|
841
|
-
approvals: approvals.file,
|
|
842
|
-
agentId: params.agentId,
|
|
843
|
-
matches: allowlistMatches,
|
|
844
|
-
command: params.command,
|
|
845
|
-
resolvedPath
|
|
846
|
-
});
|
|
847
|
-
const hasHeredocSegment = allowlistEval.segments.some((segment) => segment.argv.some((token) => token.startsWith("<<")));
|
|
848
|
-
const requiresHeredocApproval = hostSecurity === "allowlist" && analysisOk && allowlistSatisfied && hasHeredocSegment;
|
|
849
|
-
const requiresInlineEvalApproval = inlineEvalHit !== null;
|
|
850
|
-
const requiresAllowlistPlanApproval = hostSecurity === "allowlist" && analysisOk && allowlistSatisfied && !enforcedCommand && allowlistPlanUnavailableReason !== null;
|
|
851
|
-
const requiresSecurityAuditSuppressionApproval = commandRequiresSecurityAuditSuppressionApproval({
|
|
852
|
-
command: params.command,
|
|
853
|
-
cwd: params.workdir,
|
|
854
|
-
env: params.env,
|
|
855
|
-
segments: allowlistEval.segments
|
|
856
|
-
}) && !(hostSecurity === "full" && hostAsk === "off");
|
|
857
|
-
const requiresAsk = requiresExecApproval({
|
|
858
|
-
ask: hostAsk,
|
|
859
|
-
security: hostSecurity,
|
|
860
|
-
analysisOk,
|
|
861
|
-
allowlistSatisfied,
|
|
862
|
-
durableApprovalSatisfied
|
|
863
|
-
}) || requiresAllowlistPlanApproval || requiresHeredocApproval || requiresInlineEvalApproval || requiresSecurityAuditSuppressionApproval;
|
|
864
|
-
if (requiresHeredocApproval) params.warnings.push("Warning: heredoc execution requires reviewer or explicit approval in allowlist mode.");
|
|
865
|
-
if (requiresAllowlistPlanApproval) params.warnings.push(`Warning: allowlist auto-execution is unavailable on ${process.platform}; reviewer or explicit approval is required.`);
|
|
866
|
-
if (requiresSecurityAuditSuppressionApproval) params.warnings.push("Warning: security audit suppression changes require explicit approval unless exec is running in yolo mode.");
|
|
867
|
-
if (requiresAsk) {
|
|
868
|
-
const [autoReviewSegment] = allowlistEval.segments;
|
|
869
|
-
const autoReviewArgv = allowlistEval.segments.length === 1 && (autoReviewSegment?.raw === void 0 || autoReviewSegment.raw.trim() === params.command.trim()) ? autoReviewSegment.argv : void 0;
|
|
870
|
-
const autoReviewHasBoundCommand = analysisOk && autoReviewArgv !== void 0;
|
|
871
|
-
const canAutoReviewApprovalMiss = params.autoReview === true && hostAsk !== "always" && autoReviewHasBoundCommand && !requiresSecurityAuditSuppressionApproval;
|
|
872
|
-
let autoReviewRequiresHumanApproval = params.autoReview === true && hostAsk !== "always" && !autoReviewHasBoundCommand || requiresSecurityAuditSuppressionApproval;
|
|
873
|
-
if (canAutoReviewApprovalMiss) {
|
|
874
|
-
const decision = await (params.autoReviewer ?? defaultExecAutoReviewer)({
|
|
875
|
-
command: params.command,
|
|
876
|
-
argv: autoReviewArgv,
|
|
877
|
-
cwd: params.workdir,
|
|
878
|
-
envKeys: Object.keys(params.requestedEnv ?? {}).toSorted(),
|
|
879
|
-
host: "gateway",
|
|
880
|
-
reason: resolveGatewayAutoReviewReason({
|
|
881
|
-
requiresInlineEvalApproval,
|
|
882
|
-
requiresHeredocApproval,
|
|
883
|
-
requiresAllowlistPlanApproval,
|
|
884
|
-
hostSecurity,
|
|
885
|
-
analysisOk,
|
|
886
|
-
allowlistSatisfied,
|
|
887
|
-
durableApprovalSatisfied
|
|
888
|
-
}),
|
|
889
|
-
analysis: {
|
|
890
|
-
parsed: analysisOk,
|
|
891
|
-
allowlistMatched: allowlistSatisfied,
|
|
892
|
-
durableApprovalMatched: durableApprovalSatisfied,
|
|
893
|
-
inlineEval: requiresInlineEvalApproval,
|
|
894
|
-
heredoc: requiresHeredocApproval
|
|
895
|
-
},
|
|
896
|
-
agent: {
|
|
897
|
-
id: params.agentId,
|
|
898
|
-
sessionKey: params.sessionKey
|
|
899
|
-
}
|
|
900
|
-
});
|
|
901
|
-
if (decision.decision === "allow-once") {
|
|
902
|
-
params.warnings.push(`Exec auto-review allowed once (risk=${decision.risk}): ${decision.rationale}`);
|
|
903
|
-
recordMatchedAllowlistUse(resolveApprovalAuditTrustPath(allowlistEval.segments[0]?.resolution ?? null, params.workdir));
|
|
904
|
-
return {
|
|
905
|
-
execCommandOverride: enforcedCommand,
|
|
906
|
-
allowWithoutEnforcedCommand: enforcedCommand === void 0
|
|
907
|
-
};
|
|
908
|
-
}
|
|
909
|
-
params.warnings.push(`Exec auto-review deferred to human approval (risk=${decision.risk}): ${decision.rationale}`);
|
|
910
|
-
autoReviewRequiresHumanApproval = true;
|
|
911
|
-
}
|
|
912
|
-
const requestArgs = buildDefaultExecApprovalRequestArgs({
|
|
913
|
-
warnings: params.warnings,
|
|
914
|
-
approvalRunningNoticeMs: params.approvalRunningNoticeMs,
|
|
915
|
-
createApprovalSlug,
|
|
916
|
-
turnSourceChannel: params.turnSourceChannel,
|
|
917
|
-
turnSourceAccountId: params.turnSourceAccountId
|
|
918
|
-
});
|
|
919
|
-
const registerGatewayApproval = async (approvalId) => await registerExecApprovalRequestForHostOrThrow({
|
|
920
|
-
approvalId,
|
|
921
|
-
command: params.command,
|
|
922
|
-
env: params.requestedEnv,
|
|
923
|
-
workdir: params.workdir,
|
|
924
|
-
host: "gateway",
|
|
925
|
-
security: hostSecurity,
|
|
926
|
-
ask: hostAsk,
|
|
927
|
-
commandHighlighting: params.commandHighlighting,
|
|
928
|
-
warningText: params.warnings.join("\n").trim() || void 0,
|
|
929
|
-
...buildExecApprovalRequesterContext({
|
|
930
|
-
agentId: params.agentId,
|
|
931
|
-
sessionKey: params.sessionKey
|
|
932
|
-
}),
|
|
933
|
-
resolvedPath: resolveApprovalAuditTrustPath(allowlistEval.segments[0]?.resolution ?? null, params.workdir),
|
|
934
|
-
...buildExecApprovalTurnSourceContext(params)
|
|
935
|
-
});
|
|
936
|
-
const { approvalId, approvalSlug, warningText, expiresAtMs, preResolvedDecision, initiatingSurface, sentApproverDms, unavailableReason } = await createAndRegisterDefaultExecApprovalRequest({
|
|
937
|
-
...requestArgs,
|
|
938
|
-
register: registerGatewayApproval
|
|
939
|
-
});
|
|
940
|
-
if (shouldResolveExecApprovalUnavailableInline({
|
|
941
|
-
trigger: params.trigger,
|
|
942
|
-
unavailableReason,
|
|
943
|
-
preResolvedDecision
|
|
944
|
-
})) {
|
|
945
|
-
const { baseDecision, approvedByAsk, deniedReason } = createExecApprovalDecisionState({
|
|
946
|
-
decision: preResolvedDecision,
|
|
947
|
-
askFallback
|
|
948
|
-
});
|
|
949
|
-
const strictInlineEvalDecision = enforceStrictInlineEvalApprovalBoundary({
|
|
950
|
-
baseDecision,
|
|
951
|
-
approvedByAsk,
|
|
952
|
-
deniedReason,
|
|
953
|
-
requiresInlineEvalApproval,
|
|
954
|
-
requiresAutoReviewHumanApproval: autoReviewRequiresHumanApproval
|
|
955
|
-
});
|
|
956
|
-
if (strictInlineEvalDecision.deniedReason || !strictInlineEvalDecision.approvedByAsk) throw new Error(buildHeadlessExecApprovalDeniedMessage({
|
|
957
|
-
trigger: params.trigger,
|
|
958
|
-
host: "gateway",
|
|
959
|
-
security: hostSecurity,
|
|
960
|
-
ask: hostAsk,
|
|
961
|
-
askFallback
|
|
962
|
-
}));
|
|
963
|
-
recordMatchedAllowlistUse(resolveApprovalAuditTrustPath(allowlistEval.segments[0]?.resolution ?? null, params.workdir));
|
|
964
|
-
return {
|
|
965
|
-
execCommandOverride: enforcedCommand,
|
|
966
|
-
allowWithoutEnforcedCommand: enforcedCommand === void 0
|
|
967
|
-
};
|
|
968
|
-
}
|
|
969
|
-
const resolvedPath = resolveApprovalAuditTrustPath(allowlistEval.segments[0]?.resolution ?? null, params.workdir);
|
|
970
|
-
const resolveApprovalForExecution = async (onFailure) => {
|
|
971
|
-
const decision = await resolveApprovalDecisionOrUndefined({
|
|
972
|
-
approvalId,
|
|
973
|
-
preResolvedDecision,
|
|
974
|
-
onFailure
|
|
975
|
-
});
|
|
976
|
-
if (decision === void 0) return {
|
|
977
|
-
deniedReason: "approval-request-failed",
|
|
978
|
-
requestFailed: true
|
|
979
|
-
};
|
|
980
|
-
const { baseDecision, approvedByAsk: initialApprovedByAsk, deniedReason: initialDeniedReason } = createExecApprovalDecisionState({
|
|
981
|
-
decision,
|
|
982
|
-
askFallback
|
|
983
|
-
});
|
|
984
|
-
let approvedByAsk = initialApprovedByAsk;
|
|
985
|
-
let deniedReason = initialDeniedReason;
|
|
986
|
-
if (baseDecision.timedOut && askFallback === "allowlist") if (!analysisOk || !allowlistSatisfied) deniedReason = "approval-timeout: allowlist-miss";
|
|
987
|
-
else approvedByAsk = true;
|
|
988
|
-
else if (decision === "allow-once") approvedByAsk = true;
|
|
989
|
-
else if (decision === "allow-always") {
|
|
990
|
-
approvedByAsk = true;
|
|
991
|
-
if (!requiresInlineEvalApproval) {
|
|
992
|
-
if (persistAllowAlwaysPatterns({
|
|
993
|
-
approvals: approvals.file,
|
|
994
|
-
agentId: params.agentId,
|
|
995
|
-
segments: allowlistEval.segments,
|
|
996
|
-
cwd: params.workdir,
|
|
997
|
-
env: params.env,
|
|
998
|
-
platform: process.platform,
|
|
999
|
-
strictInlineEval: params.strictInlineEval === true
|
|
1000
|
-
}).length === 0) addDurableCommandApproval(approvals.file, params.agentId, params.command);
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
({approvedByAsk, deniedReason} = enforceStrictInlineEvalApprovalBoundary({
|
|
1004
|
-
baseDecision,
|
|
1005
|
-
approvedByAsk,
|
|
1006
|
-
deniedReason,
|
|
1007
|
-
requiresInlineEvalApproval,
|
|
1008
|
-
requiresAutoReviewHumanApproval: autoReviewRequiresHumanApproval
|
|
1009
|
-
}));
|
|
1010
|
-
if (!approvedByAsk && hasGatewayAllowlistMiss({
|
|
1011
|
-
hostSecurity,
|
|
1012
|
-
analysisOk,
|
|
1013
|
-
allowlistSatisfied,
|
|
1014
|
-
durableApprovalSatisfied
|
|
1015
|
-
})) deniedReason = deniedReason ?? "allowlist-miss";
|
|
1016
|
-
return {
|
|
1017
|
-
deniedReason,
|
|
1018
|
-
requestFailed: false
|
|
1019
|
-
};
|
|
1020
|
-
};
|
|
1021
|
-
if (unavailableReason === null && shouldAwaitGatewayApprovalInline(params)) {
|
|
1022
|
-
const approvalDecision = await resolveApprovalForExecution(() => void 0);
|
|
1023
|
-
if (approvalDecision.deniedReason) return { deniedResult: buildGatewayExecApprovalDeniedToolResult({
|
|
1024
|
-
approvalId,
|
|
1025
|
-
deniedReason: approvalDecision.deniedReason,
|
|
1026
|
-
command: params.command,
|
|
1027
|
-
cwd: params.workdir
|
|
1028
|
-
}) };
|
|
1029
|
-
recordMatchedAllowlistUse(resolvedPath ?? void 0);
|
|
1030
|
-
return {
|
|
1031
|
-
execCommandOverride: enforcedCommand,
|
|
1032
|
-
allowWithoutEnforcedCommand: enforcedCommand === void 0
|
|
1033
|
-
};
|
|
1034
|
-
}
|
|
1035
|
-
const effectiveTimeout = typeof params.timeoutSec === "number" ? params.timeoutSec : params.defaultTimeoutSec;
|
|
1036
|
-
const followupTarget = buildExecApprovalFollowupTarget({
|
|
1037
|
-
approvalId,
|
|
1038
|
-
sessionKey: params.notifySessionKey ?? params.sessionKey,
|
|
1039
|
-
bashElevated: params.bashElevated,
|
|
1040
|
-
turnSourceChannel: params.turnSourceChannel,
|
|
1041
|
-
turnSourceTo: params.turnSourceTo,
|
|
1042
|
-
turnSourceAccountId: params.turnSourceAccountId,
|
|
1043
|
-
turnSourceThreadId: params.turnSourceThreadId,
|
|
1044
|
-
direct: params.approvalFollowupMode === "direct"
|
|
1045
|
-
});
|
|
1046
|
-
(async () => {
|
|
1047
|
-
const approvalDecision = await resolveApprovalForExecution(() => void sendExecApprovalFollowupResult(followupTarget, `Exec denied (gateway id=${approvalId}, approval-request-failed): ${params.command}`));
|
|
1048
|
-
if (approvalDecision.requestFailed) return;
|
|
1049
|
-
if (approvalDecision.deniedReason) {
|
|
1050
|
-
await sendExecApprovalFollowupResult(followupTarget, `Exec denied (gateway id=${approvalId}, ${approvalDecision.deniedReason}): ${params.command}`);
|
|
1051
|
-
return;
|
|
1052
|
-
}
|
|
1053
|
-
recordMatchedAllowlistUse(resolvedPath ?? void 0);
|
|
1054
|
-
let run = null;
|
|
1055
|
-
try {
|
|
1056
|
-
run = await runExecProcess({
|
|
1057
|
-
command: params.command,
|
|
1058
|
-
execCommand: enforcedCommand,
|
|
1059
|
-
workdir: params.workdir,
|
|
1060
|
-
env: params.env,
|
|
1061
|
-
pathPrepend: params.pathPrepend,
|
|
1062
|
-
sandbox: void 0,
|
|
1063
|
-
containerWorkdir: null,
|
|
1064
|
-
usePty: params.pty,
|
|
1065
|
-
warnings: params.warnings,
|
|
1066
|
-
maxOutput: params.maxOutput,
|
|
1067
|
-
pendingMaxOutput: params.pendingMaxOutput,
|
|
1068
|
-
notifyOnExit: false,
|
|
1069
|
-
notifyOnExitEmptySuccess: false,
|
|
1070
|
-
scopeKey: params.scopeKey,
|
|
1071
|
-
sessionKey: params.notifySessionKey ?? params.sessionKey,
|
|
1072
|
-
timeoutSec: effectiveTimeout
|
|
1073
|
-
});
|
|
1074
|
-
} catch {
|
|
1075
|
-
await sendExecApprovalFollowupResult(followupTarget, `Exec denied (gateway id=${approvalId}, spawn-failed): ${params.command}`);
|
|
1076
|
-
return;
|
|
1077
|
-
}
|
|
1078
|
-
markBackgrounded(run.session);
|
|
1079
|
-
const outcome = await run.promise;
|
|
1080
|
-
const dynamicFollowupText = await resolveGatewayExecApprovalFollowupText({
|
|
1081
|
-
approvalFollowup: params.approvalFollowup,
|
|
1082
|
-
approvalId,
|
|
1083
|
-
sessionId: run.session.id,
|
|
1084
|
-
trigger: params.trigger,
|
|
1085
|
-
outcome
|
|
1086
|
-
});
|
|
1087
|
-
const approvalFollowupText = normalizeStringEntries([params.approvalFollowupText ?? "", dynamicFollowupText ?? ""]).join("\n\n");
|
|
1088
|
-
await sendExecApprovalFollowupResult(followupTarget, buildGatewayExecApprovalFollowupSummary({
|
|
1089
|
-
approvalId,
|
|
1090
|
-
sessionId: run.session.id,
|
|
1091
|
-
outcome,
|
|
1092
|
-
trigger: params.trigger,
|
|
1093
|
-
approvalFollowupText
|
|
1094
|
-
}));
|
|
1095
|
-
})();
|
|
1096
|
-
return { pendingResult: buildExecApprovalPendingToolResult({
|
|
1097
|
-
host: "gateway",
|
|
1098
|
-
command: params.command,
|
|
1099
|
-
cwd: params.workdir,
|
|
1100
|
-
warningText,
|
|
1101
|
-
approvalId,
|
|
1102
|
-
approvalSlug,
|
|
1103
|
-
expiresAtMs,
|
|
1104
|
-
initiatingSurface,
|
|
1105
|
-
sentApproverDms,
|
|
1106
|
-
unavailableReason,
|
|
1107
|
-
allowedDecisions: resolveExecApprovalAllowedDecisions({ ask: hostAsk })
|
|
1108
|
-
}) };
|
|
1109
|
-
}
|
|
1110
|
-
if (hasGatewayAllowlistMiss({
|
|
1111
|
-
hostSecurity,
|
|
1112
|
-
analysisOk,
|
|
1113
|
-
allowlistSatisfied,
|
|
1114
|
-
durableApprovalSatisfied
|
|
1115
|
-
})) throw new Error("exec denied: allowlist miss");
|
|
1116
|
-
recordMatchedAllowlistUse(resolveApprovalAuditTrustPath(allowlistEval.segments[0]?.resolution ?? null, params.workdir));
|
|
1117
|
-
return { execCommandOverride: enforcedCommand };
|
|
1118
|
-
}
|
|
1119
|
-
//#endregion
|
|
1120
|
-
//#region src/infra/node-shell.ts
|
|
1121
|
-
function buildNodeShellCommand(command, platform) {
|
|
1122
|
-
if (normalizeLowercaseStringOrEmpty((platform ?? "").trim()).startsWith("win")) return [
|
|
1123
|
-
"cmd.exe",
|
|
1124
|
-
"/d",
|
|
1125
|
-
"/s",
|
|
1126
|
-
"/c",
|
|
1127
|
-
command
|
|
1128
|
-
];
|
|
1129
|
-
return [
|
|
1130
|
-
"/bin/sh",
|
|
1131
|
-
"-lc",
|
|
1132
|
-
command
|
|
1133
|
-
];
|
|
1134
|
-
}
|
|
1135
|
-
//#endregion
|
|
1136
|
-
//#region src/agents/bash-tools.exec-host-node-phases.ts
|
|
1137
|
-
function resolveNodeRunTimeoutSec(timeoutSec, defaultTimeoutSec) {
|
|
1138
|
-
return typeof timeoutSec === "number" && Number.isFinite(timeoutSec) ? timeoutSec : defaultTimeoutSec;
|
|
1139
|
-
}
|
|
1140
|
-
function resolveNodeInvokeTimeoutMs(runTimeoutSec, defaultTimeoutSec) {
|
|
1141
|
-
const baseTimeoutSec = Number.isFinite(runTimeoutSec) && runTimeoutSec > 0 ? runTimeoutSec : defaultTimeoutSec;
|
|
1142
|
-
if (!Number.isFinite(baseTimeoutSec) || baseTimeoutSec <= 0) return 1e4;
|
|
1143
|
-
return Math.max(1e4, addSafeTimeoutDelayGraceMs(baseTimeoutSec * 1e3, 5e3));
|
|
1144
|
-
}
|
|
1145
|
-
function resolveNodeRunTimeoutMs(runTimeoutSec) {
|
|
1146
|
-
return Number.isFinite(runTimeoutSec) && runTimeoutSec > 0 ? addSafeTimeoutDelayGraceMs(runTimeoutSec * 1e3, 0, { minMs: 0 }) : 0;
|
|
1147
|
-
}
|
|
1148
|
-
function hasExactCommandDurableApproval(params) {
|
|
1149
|
-
const normalizedCommand = params.commandText.trim();
|
|
1150
|
-
if (!normalizedCommand) return false;
|
|
1151
|
-
const commandPattern = `=command:${crypto.createHash("sha256").update(normalizedCommand).digest("hex").slice(0, 16)}`;
|
|
1152
|
-
return params.allowlist.some((entry) => entry.source === "allow-always" && (entry.pattern === commandPattern || typeof entry.commandText === "string" && entry.commandText.trim() === normalizedCommand));
|
|
1153
|
-
}
|
|
1154
|
-
function extractPreparedNodeShellPayload(argv) {
|
|
1155
|
-
const extracted = extractShellCommandFromArgv([...argv]);
|
|
1156
|
-
if (extracted) return extracted;
|
|
1157
|
-
const executable = argv[0]?.split(/[\\/]/).pop()?.toLowerCase();
|
|
1158
|
-
const flag = argv[1]?.trim();
|
|
1159
|
-
const payload = argv[2]?.trim();
|
|
1160
|
-
if (argv.length === 3 && executable === "sh" && flag === "-lc" && payload) return payload;
|
|
1161
|
-
return null;
|
|
1162
|
-
}
|
|
1163
|
-
function shouldSkipNodeApprovalPrepare(params) {
|
|
1164
|
-
return params.hostSecurity === "full" && params.hostAsk === "off" && params.strictInlineEval !== true;
|
|
1165
|
-
}
|
|
1166
|
-
function formatNodeRunToolResult(params) {
|
|
1167
|
-
const payload = params.raw && typeof params.raw === "object" ? params.raw.payload : void 0;
|
|
1168
|
-
const payloadObj = payload && typeof payload === "object" ? payload : {};
|
|
1169
|
-
const stdout = typeof payloadObj.stdout === "string" ? payloadObj.stdout : "";
|
|
1170
|
-
const stderr = typeof payloadObj.stderr === "string" ? payloadObj.stderr : "";
|
|
1171
|
-
const errorText = typeof payloadObj.error === "string" ? payloadObj.error : "";
|
|
1172
|
-
const success = typeof payloadObj.success === "boolean" ? payloadObj.success : false;
|
|
1173
|
-
const exitCode = typeof payloadObj.exitCode === "number" ? payloadObj.exitCode : null;
|
|
1174
|
-
return {
|
|
1175
|
-
content: [{
|
|
1176
|
-
type: "text",
|
|
1177
|
-
text: renderExecOutputText(stdout || stderr || errorText)
|
|
1178
|
-
}],
|
|
1179
|
-
details: {
|
|
1180
|
-
status: success ? "completed" : "failed",
|
|
1181
|
-
exitCode,
|
|
1182
|
-
durationMs: Date.now() - params.startedAt,
|
|
1183
|
-
aggregated: [
|
|
1184
|
-
stdout,
|
|
1185
|
-
stderr,
|
|
1186
|
-
errorText
|
|
1187
|
-
].filter(Boolean).join("\n"),
|
|
1188
|
-
cwd: params.cwd
|
|
1189
|
-
}
|
|
1190
|
-
};
|
|
1191
|
-
}
|
|
1192
|
-
async function resolveNodeExecutionTarget(params) {
|
|
1193
|
-
if (params.boundNode && params.requestedNode && params.boundNode !== params.requestedNode) throw new Error(`exec node not allowed (bound to ${params.boundNode})`);
|
|
1194
|
-
const nodeQuery = params.boundNode || params.requestedNode;
|
|
1195
|
-
const nodes = await listNodes({});
|
|
1196
|
-
if (nodes.length === 0) throw new Error("exec host=node requires a paired node (none available). This requires a companion app or node host.");
|
|
1197
|
-
let nodeId;
|
|
1198
|
-
try {
|
|
1199
|
-
nodeId = resolveNodeIdFromList(nodes, nodeQuery, !nodeQuery);
|
|
1200
|
-
} catch (err) {
|
|
1201
|
-
if (!nodeQuery && String(err).includes("node required")) throw new Error("exec host=node requires a node id when multiple nodes are available (set tools.exec.node or exec.node).", { cause: err });
|
|
1202
|
-
throw err;
|
|
1203
|
-
}
|
|
1204
|
-
const nodeInfo = nodes.find((entry) => entry.nodeId === nodeId);
|
|
1205
|
-
if (nodeInfo?.connected === false) throw new Error(`exec host=node requires a connected node (${nodeId} is currently disconnected). Start or reconnect the companion app or node host, or select a connected node.`);
|
|
1206
|
-
const declaredCommands = Array.isArray(nodeInfo?.commands) ? nodeInfo.commands : [];
|
|
1207
|
-
if (!declaredCommands.includes("system.run")) throw new Error("exec host=node requires a node that supports system.run (companion app or node host).");
|
|
1208
|
-
const runTimeoutSec = resolveNodeRunTimeoutSec(params.timeoutSec, params.defaultTimeoutSec);
|
|
1209
|
-
return {
|
|
1210
|
-
nodeId,
|
|
1211
|
-
platform: nodeInfo?.platform,
|
|
1212
|
-
argv: buildNodeShellCommand(params.command, nodeInfo?.platform),
|
|
1213
|
-
env: params.requestedEnv ? { ...params.requestedEnv } : void 0,
|
|
1214
|
-
invokeTimeoutMs: resolveNodeInvokeTimeoutMs(runTimeoutSec, params.defaultTimeoutSec),
|
|
1215
|
-
runTimeoutSec,
|
|
1216
|
-
supportsSystemRunPrepare: declaredCommands.includes("system.run.prepare")
|
|
1217
|
-
};
|
|
1218
|
-
}
|
|
1219
|
-
function buildNodeSystemRunInvoke(params) {
|
|
1220
|
-
const timeoutMs = resolveNodeRunTimeoutMs(params.target.runTimeoutSec);
|
|
1221
|
-
const runId = params.runId ?? crypto.randomUUID();
|
|
1222
|
-
return {
|
|
1223
|
-
nodeId: params.target.nodeId,
|
|
1224
|
-
command: "system.run",
|
|
1225
|
-
params: {
|
|
1226
|
-
command: params.command,
|
|
1227
|
-
rawCommand: params.rawCommand,
|
|
1228
|
-
...params.systemRunPlan ? { systemRunPlan: params.systemRunPlan } : {},
|
|
1229
|
-
...params.cwd != null ? { cwd: params.cwd } : {},
|
|
1230
|
-
env: params.target.env,
|
|
1231
|
-
timeoutMs,
|
|
1232
|
-
agentId: params.agentId,
|
|
1233
|
-
sessionKey: params.sessionKey,
|
|
1234
|
-
...params.turnSourceChannel != null ? { turnSourceChannel: params.turnSourceChannel } : {},
|
|
1235
|
-
...params.turnSourceTo != null ? { turnSourceTo: params.turnSourceTo } : {},
|
|
1236
|
-
...params.turnSourceAccountId != null ? { turnSourceAccountId: params.turnSourceAccountId } : {},
|
|
1237
|
-
...params.turnSourceThreadId != null ? { turnSourceThreadId: params.turnSourceThreadId } : {},
|
|
1238
|
-
approved: params.approved,
|
|
1239
|
-
approvalDecision: params.approvalDecision ?? void 0,
|
|
1240
|
-
runId,
|
|
1241
|
-
suppressNotifyOnExit: params.suppressNotifyOnExit === true || params.notifyOnExit === false ? true : void 0
|
|
1242
|
-
},
|
|
1243
|
-
idempotencyKey: crypto.randomUUID()
|
|
1244
|
-
};
|
|
1245
|
-
}
|
|
1246
|
-
async function invokeNodeSystemRunDirect(params) {
|
|
1247
|
-
const startedAt = Date.now();
|
|
1248
|
-
return formatNodeRunToolResult({
|
|
1249
|
-
raw: await callGatewayTool("node.invoke", { timeoutMs: params.target.invokeTimeoutMs }, buildNodeSystemRunInvoke({
|
|
1250
|
-
target: params.target,
|
|
1251
|
-
command: params.target.argv,
|
|
1252
|
-
rawCommand: params.request.command,
|
|
1253
|
-
cwd: params.request.workdir,
|
|
1254
|
-
agentId: params.request.agentId,
|
|
1255
|
-
sessionKey: params.request.sessionKey,
|
|
1256
|
-
notifyOnExit: params.request.notifyOnExit
|
|
1257
|
-
})),
|
|
1258
|
-
startedAt,
|
|
1259
|
-
cwd: params.request.workdir
|
|
1260
|
-
});
|
|
1261
|
-
}
|
|
1262
|
-
async function prepareNodeSystemRun(params) {
|
|
1263
|
-
if (!params.target.supportsSystemRunPrepare) return buildLocalPreparedNodeRun(params);
|
|
1264
|
-
const prepared = parsePreparedSystemRunPayload((await callGatewayTool("node.invoke", { timeoutMs: 15e3 }, {
|
|
1265
|
-
nodeId: params.target.nodeId,
|
|
1266
|
-
command: "system.run.prepare",
|
|
1267
|
-
params: {
|
|
1268
|
-
command: params.target.argv,
|
|
1269
|
-
rawCommand: params.request.command,
|
|
1270
|
-
...params.request.workdir != null ? { cwd: params.request.workdir } : {},
|
|
1271
|
-
agentId: params.request.agentId,
|
|
1272
|
-
sessionKey: params.request.sessionKey
|
|
1273
|
-
},
|
|
1274
|
-
idempotencyKey: crypto.randomUUID()
|
|
1275
|
-
}))?.payload);
|
|
1276
|
-
if (!prepared) throw new Error("invalid system.run.prepare response");
|
|
1277
|
-
return {
|
|
1278
|
-
plan: prepared.plan,
|
|
1279
|
-
argv: prepared.plan.argv,
|
|
1280
|
-
rawCommand: prepared.plan.commandText,
|
|
1281
|
-
cwd: prepared.plan.cwd ?? params.request.workdir,
|
|
1282
|
-
agentId: prepared.plan.agentId ?? params.request.agentId,
|
|
1283
|
-
sessionKey: prepared.plan.sessionKey ?? params.request.sessionKey,
|
|
1284
|
-
...prepared.execPolicy ? { execPolicy: prepared.execPolicy } : {}
|
|
1285
|
-
};
|
|
1286
|
-
}
|
|
1287
|
-
function buildLocalPreparedNodeRun(params) {
|
|
1288
|
-
const rawCommand = formatExecCommand(params.target.argv);
|
|
1289
|
-
const command = resolveSystemRunCommandRequest({
|
|
1290
|
-
command: params.target.argv,
|
|
1291
|
-
rawCommand
|
|
1292
|
-
});
|
|
1293
|
-
if (!command.ok) throw new Error(command.message);
|
|
1294
|
-
if (command.argv.length === 0) throw new Error("命令是必需的");
|
|
1295
|
-
const commandText = formatExecCommand(command.argv);
|
|
1296
|
-
const previewText = params.request.command.trim() || command.previewText?.trim();
|
|
1297
|
-
const commandPreview = previewText && previewText !== commandText ? previewText : null;
|
|
1298
|
-
const plan = {
|
|
1299
|
-
argv: [...command.argv],
|
|
1300
|
-
cwd: normalizeNullableString(params.request.workdir),
|
|
1301
|
-
commandText,
|
|
1302
|
-
commandPreview,
|
|
1303
|
-
agentId: normalizeNullableString(params.request.agentId),
|
|
1304
|
-
sessionKey: normalizeNullableString(params.request.sessionKey)
|
|
1305
|
-
};
|
|
1306
|
-
return {
|
|
1307
|
-
plan,
|
|
1308
|
-
argv: plan.argv,
|
|
1309
|
-
rawCommand: plan.commandText,
|
|
1310
|
-
cwd: plan.cwd ?? params.request.workdir,
|
|
1311
|
-
agentId: plan.agentId ?? params.request.agentId,
|
|
1312
|
-
sessionKey: plan.sessionKey ?? params.request.sessionKey
|
|
1313
|
-
};
|
|
1314
|
-
}
|
|
1315
|
-
async function analyzeNodeApprovalRequirement(params) {
|
|
1316
|
-
const approvalCommand = params.prepared.rawCommand;
|
|
1317
|
-
const approvalCwd = params.prepared.cwd ?? params.request.workdir;
|
|
1318
|
-
const baseAllowlistEval = evaluateShellAllowlist({
|
|
1319
|
-
command: approvalCommand,
|
|
1320
|
-
allowlist: [],
|
|
1321
|
-
safeBins: /* @__PURE__ */ new Set(),
|
|
1322
|
-
cwd: approvalCwd,
|
|
1323
|
-
env: params.request.env,
|
|
1324
|
-
platform: params.target.platform,
|
|
1325
|
-
trustedSafeBinDirs: params.request.trustedSafeBinDirs
|
|
1326
|
-
});
|
|
1327
|
-
const bindingCommandEvals = [{
|
|
1328
|
-
command: approvalCommand,
|
|
1329
|
-
cwd: approvalCwd,
|
|
1330
|
-
allowlistEval: baseAllowlistEval
|
|
1331
|
-
}];
|
|
1332
|
-
const addCommandEval = (entries, command, cwd) => {
|
|
1333
|
-
const normalizedCommand = command?.trim();
|
|
1334
|
-
if (!normalizedCommand) return;
|
|
1335
|
-
if (entries.some((entry) => entry.command.trim() === normalizedCommand && entry.cwd === cwd)) return;
|
|
1336
|
-
entries.push({
|
|
1337
|
-
command: normalizedCommand,
|
|
1338
|
-
cwd,
|
|
1339
|
-
allowlistEval: evaluateShellAllowlist({
|
|
1340
|
-
command: normalizedCommand,
|
|
1341
|
-
allowlist: [],
|
|
1342
|
-
safeBins: /* @__PURE__ */ new Set(),
|
|
1343
|
-
cwd,
|
|
1344
|
-
env: params.request.env,
|
|
1345
|
-
platform: params.target.platform,
|
|
1346
|
-
trustedSafeBinDirs: params.request.trustedSafeBinDirs
|
|
1347
|
-
})
|
|
1348
|
-
});
|
|
1349
|
-
};
|
|
1350
|
-
const preparedCommand = resolveSystemRunCommandRequest({
|
|
1351
|
-
command: params.prepared.argv,
|
|
1352
|
-
rawCommand: params.prepared.rawCommand
|
|
1353
|
-
});
|
|
1354
|
-
const preparedShellPayload = extractPreparedNodeShellPayload(params.prepared.argv) ?? (preparedCommand.ok ? preparedCommand.shellPayload : null);
|
|
1355
|
-
addCommandEval(bindingCommandEvals, preparedShellPayload, approvalCwd);
|
|
1356
|
-
const autoReviewBindingCommand = preparedShellPayload?.trim() || approvalCommand;
|
|
1357
|
-
const autoReviewBindingEval = bindingCommandEvals.find((entry) => entry.command.trim() === autoReviewBindingCommand.trim() && entry.cwd === approvalCwd)?.allowlistEval ?? baseAllowlistEval;
|
|
1358
|
-
const policyCommandEvals = [...bindingCommandEvals];
|
|
1359
|
-
addCommandEval(policyCommandEvals, params.prepared.plan.commandPreview, approvalCwd);
|
|
1360
|
-
addCommandEval(policyCommandEvals, params.request.command, params.request.workdir);
|
|
1361
|
-
let analysisOk = baseAllowlistEval.analysisOk;
|
|
1362
|
-
let allowlistSatisfied = false;
|
|
1363
|
-
let durableApprovalSatisfied = false;
|
|
1364
|
-
let nodeApprovalsFileKnown = false;
|
|
1365
|
-
const inlineEvalHit = params.request.strictInlineEval === true ? policyCommandEvals.map((entry) => detectPolicyInlineEval(entry.allowlistEval.segments)).find((hit) => hit !== null) ?? null : null;
|
|
1366
|
-
if (inlineEvalHit) params.request.warnings.push(`Warning: strict inline-eval mode requires reviewer or explicit approval for ${describeInterpreterInlineEval(inlineEvalHit)}.`);
|
|
1367
|
-
const requiresSecurityAuditSuppressionApproval = (preparedShellPayload && preparedShellPayload.trim().length > 0 ? policyCommandEvals.filter((entry) => entry.command.trim() !== approvalCommand.trim() || entry.cwd !== approvalCwd) : policyCommandEvals).some((entry) => commandRequiresSecurityAuditSuppressionApproval({
|
|
1368
|
-
command: entry.command,
|
|
1369
|
-
cwd: entry.cwd,
|
|
1370
|
-
env: params.request.env,
|
|
1371
|
-
segments: entry.allowlistEval.segments
|
|
1372
|
-
})) && !(params.hostSecurity === "full" && params.hostAsk === "off");
|
|
1373
|
-
if ((params.hostAsk === "always" || params.hostSecurity === "allowlist" || params.request.autoReview === true) && analysisOk) try {
|
|
1374
|
-
const approvalsSnapshot = await callGatewayTool("exec.approvals.node.get", { timeoutMs: 1e4 }, { nodeId: params.target.nodeId });
|
|
1375
|
-
const approvalsFile = approvalsSnapshot && typeof approvalsSnapshot === "object" ? approvalsSnapshot.file : void 0;
|
|
1376
|
-
if (approvalsFile && typeof approvalsFile === "object") {
|
|
1377
|
-
nodeApprovalsFileKnown = true;
|
|
1378
|
-
const resolved = resolveExecApprovalsFromFile({
|
|
1379
|
-
file: approvalsFile,
|
|
1380
|
-
agentId: params.prepared.agentId,
|
|
1381
|
-
overrides: { security: "full" }
|
|
1382
|
-
});
|
|
1383
|
-
const allowlistEvals = bindingCommandEvals.map((entry) => {
|
|
1384
|
-
const allowlistEval = evaluateShellAllowlist({
|
|
1385
|
-
command: entry.command,
|
|
1386
|
-
allowlist: resolved.allowlist,
|
|
1387
|
-
safeBins: /* @__PURE__ */ new Set(),
|
|
1388
|
-
cwd: entry.cwd,
|
|
1389
|
-
env: params.request.env,
|
|
1390
|
-
platform: params.target.platform,
|
|
1391
|
-
trustedSafeBinDirs: params.request.trustedSafeBinDirs
|
|
1392
|
-
});
|
|
1393
|
-
return {
|
|
1394
|
-
command: entry.command,
|
|
1395
|
-
allowlistEligible: !preparedShellPayload || entry.command.trim() === preparedShellPayload.trim(),
|
|
1396
|
-
exactDurableApprovalSatisfied: hasExactCommandDurableApproval({
|
|
1397
|
-
allowlist: resolved.allowlist,
|
|
1398
|
-
commandText: entry.command
|
|
1399
|
-
}),
|
|
1400
|
-
allowlistEval,
|
|
1401
|
-
durableApprovalSatisfied: hasDurableExecApproval({
|
|
1402
|
-
analysisOk: allowlistEval.analysisOk,
|
|
1403
|
-
segmentAllowlistEntries: allowlistEval.segmentAllowlistEntries,
|
|
1404
|
-
allowlist: resolved.allowlist,
|
|
1405
|
-
commandText: entry.command
|
|
1406
|
-
})
|
|
1407
|
-
};
|
|
1408
|
-
});
|
|
1409
|
-
durableApprovalSatisfied = allowlistEvals.some((entry) => entry.durableApprovalSatisfied && (entry.allowlistEligible || entry.exactDurableApprovalSatisfied));
|
|
1410
|
-
allowlistSatisfied = allowlistEvals.some((entry) => entry.allowlistEligible && entry.allowlistEval.allowlistSatisfied);
|
|
1411
|
-
analysisOk = allowlistEvals.some((entry) => entry.allowlistEval.analysisOk);
|
|
1412
|
-
}
|
|
1413
|
-
} catch {}
|
|
1414
|
-
return {
|
|
1415
|
-
analysisOk,
|
|
1416
|
-
allowlistSatisfied,
|
|
1417
|
-
durableApprovalSatisfied,
|
|
1418
|
-
nodeApprovalPolicyKnown: nodeApprovalsFileKnown && params.prepared.execPolicy !== void 0,
|
|
1419
|
-
nodeSecurity: params.prepared.execPolicy?.security,
|
|
1420
|
-
nodeAsk: params.prepared.execPolicy?.ask,
|
|
1421
|
-
inlineEvalHit,
|
|
1422
|
-
requiresSecurityAuditSuppressionApproval,
|
|
1423
|
-
autoReviewArgv: autoReviewBindingEval.segments.length === 1 && (autoReviewBindingEval.segments[0]?.raw === void 0 || autoReviewBindingEval.segments[0].raw.trim() === autoReviewBindingCommand.trim()) ? autoReviewBindingEval.segments[0].argv : void 0
|
|
1424
|
-
};
|
|
1425
|
-
}
|
|
1426
|
-
//#endregion
|
|
1427
|
-
//#region src/agents/bash-tools.exec-host-node.ts
|
|
1428
|
-
const APPROVED_NODE_INVOKE_SCOPES = [WRITE_SCOPE, APPROVALS_SCOPE];
|
|
1429
|
-
function resolveNodeAutoReviewReason(params) {
|
|
1430
|
-
if (params.inlineEvalHit !== null) return "strict-inline-eval";
|
|
1431
|
-
if (params.hostSecurity === "allowlist" && (!params.analysisOk || !params.allowlistSatisfied) && !params.durableApprovalSatisfied) return "allowlist-miss";
|
|
1432
|
-
return "approval-required";
|
|
1433
|
-
}
|
|
1434
|
-
function execSecurityFloorRank(security) {
|
|
1435
|
-
switch (security) {
|
|
1436
|
-
case "full": return 0;
|
|
1437
|
-
case "allowlist": return 1;
|
|
1438
|
-
case "deny": return 2;
|
|
1439
|
-
}
|
|
1440
|
-
throw new Error("不支持的执行安全下限");
|
|
1441
|
-
}
|
|
1442
|
-
function nodePolicyBlocksAutoReview(params) {
|
|
1443
|
-
return !params.nodeApprovalPolicyKnown || params.nodeAsk === "always" || params.nodeSecurity !== void 0 && execSecurityFloorRank(params.nodeSecurity) > execSecurityFloorRank(params.hostSecurity);
|
|
1444
|
-
}
|
|
1445
|
-
async function executeNodeHostCommand(params) {
|
|
1446
|
-
const { hostSecurity, hostAsk, askFallback } = resolveExecHostApprovalContext({
|
|
1447
|
-
agentId: params.agentId,
|
|
1448
|
-
security: params.security,
|
|
1449
|
-
ask: params.ask,
|
|
1450
|
-
host: "node"
|
|
1451
|
-
});
|
|
1452
|
-
const target = await resolveNodeExecutionTarget(params);
|
|
1453
|
-
if (shouldSkipNodeApprovalPrepare({
|
|
1454
|
-
hostSecurity,
|
|
1455
|
-
hostAsk,
|
|
1456
|
-
strictInlineEval: params.strictInlineEval
|
|
1457
|
-
})) return await invokeNodeSystemRunDirect({
|
|
1458
|
-
request: params,
|
|
1459
|
-
target
|
|
1460
|
-
});
|
|
1461
|
-
const prepared = await prepareNodeSystemRun({
|
|
1462
|
-
request: params,
|
|
1463
|
-
target
|
|
1464
|
-
});
|
|
1465
|
-
const { analysisOk, allowlistSatisfied, durableApprovalSatisfied, nodeApprovalPolicyKnown, nodeSecurity, nodeAsk, inlineEvalHit, requiresSecurityAuditSuppressionApproval, autoReviewArgv } = await analyzeNodeApprovalRequirement({
|
|
1466
|
-
request: params,
|
|
1467
|
-
target,
|
|
1468
|
-
prepared,
|
|
1469
|
-
hostSecurity,
|
|
1470
|
-
hostAsk
|
|
1471
|
-
});
|
|
1472
|
-
const requiresAsk = requiresExecApproval({
|
|
1473
|
-
ask: hostAsk,
|
|
1474
|
-
security: hostSecurity,
|
|
1475
|
-
analysisOk,
|
|
1476
|
-
allowlistSatisfied,
|
|
1477
|
-
durableApprovalSatisfied
|
|
1478
|
-
}) || inlineEvalHit !== null || requiresSecurityAuditSuppressionApproval;
|
|
1479
|
-
if (requiresSecurityAuditSuppressionApproval) params.warnings.push("Warning: security audit suppression changes require explicit approval unless exec is running in yolo mode.");
|
|
1480
|
-
const registerNodeApproval = async (approvalId, options = {}) => await registerExecApprovalRequestForHostOrThrow({
|
|
1481
|
-
approvalId,
|
|
1482
|
-
systemRunPlan: prepared.plan,
|
|
1483
|
-
env: target.env,
|
|
1484
|
-
workdir: prepared.cwd,
|
|
1485
|
-
host: "node",
|
|
1486
|
-
nodeId: target.nodeId,
|
|
1487
|
-
security: hostSecurity,
|
|
1488
|
-
ask: hostAsk,
|
|
1489
|
-
commandHighlighting: params.commandHighlighting,
|
|
1490
|
-
...buildExecApprovalRequesterContext({
|
|
1491
|
-
agentId: prepared.agentId,
|
|
1492
|
-
sessionKey: prepared.sessionKey
|
|
1493
|
-
}),
|
|
1494
|
-
...options.requireDeliveryRoute !== void 0 ? { requireDeliveryRoute: options.requireDeliveryRoute } : {},
|
|
1495
|
-
...options.suppressDelivery !== void 0 ? { suppressDelivery: options.suppressDelivery } : {},
|
|
1496
|
-
...buildExecApprovalTurnSourceContext(params)
|
|
1497
|
-
});
|
|
1498
|
-
let inlineApprovedByAsk = false;
|
|
1499
|
-
let inlineApprovalDecision = null;
|
|
1500
|
-
let inlineApprovalId;
|
|
1501
|
-
if (requiresAsk) {
|
|
1502
|
-
const autoReviewHasBoundCommand = analysisOk && autoReviewArgv !== void 0;
|
|
1503
|
-
const autoReviewBlockedByNodePolicy = params.autoReview === true && hostAsk !== "always" && nodePolicyBlocksAutoReview({
|
|
1504
|
-
hostSecurity,
|
|
1505
|
-
nodeApprovalPolicyKnown,
|
|
1506
|
-
nodeSecurity,
|
|
1507
|
-
nodeAsk
|
|
1508
|
-
});
|
|
1509
|
-
let autoReviewRequiresHumanApproval = autoReviewBlockedByNodePolicy || params.autoReview === true && hostAsk !== "always" && !autoReviewHasBoundCommand || requiresSecurityAuditSuppressionApproval;
|
|
1510
|
-
if (params.autoReview === true && hostAsk !== "always" && autoReviewHasBoundCommand && !autoReviewBlockedByNodePolicy && !requiresSecurityAuditSuppressionApproval) {
|
|
1511
|
-
const decision = await (params.autoReviewer ?? defaultExecAutoReviewer)({
|
|
1512
|
-
command: prepared.rawCommand,
|
|
1513
|
-
argv: autoReviewArgv,
|
|
1514
|
-
cwd: prepared.cwd,
|
|
1515
|
-
envKeys: Object.keys(params.requestedEnv ?? {}).toSorted(),
|
|
1516
|
-
host: "node",
|
|
1517
|
-
reason: resolveNodeAutoReviewReason({
|
|
1518
|
-
inlineEvalHit,
|
|
1519
|
-
hostSecurity,
|
|
1520
|
-
analysisOk,
|
|
1521
|
-
allowlistSatisfied,
|
|
1522
|
-
durableApprovalSatisfied
|
|
1523
|
-
}),
|
|
1524
|
-
analysis: {
|
|
1525
|
-
parsed: analysisOk,
|
|
1526
|
-
allowlistMatched: allowlistSatisfied,
|
|
1527
|
-
durableApprovalMatched: durableApprovalSatisfied,
|
|
1528
|
-
inlineEval: inlineEvalHit !== null
|
|
1529
|
-
},
|
|
1530
|
-
agent: {
|
|
1531
|
-
id: prepared.agentId,
|
|
1532
|
-
sessionKey: prepared.sessionKey
|
|
1533
|
-
}
|
|
1534
|
-
});
|
|
1535
|
-
if (decision.decision === "allow-once") {
|
|
1536
|
-
const approvalId = randomUUID();
|
|
1537
|
-
await registerNodeApproval(approvalId, {
|
|
1538
|
-
requireDeliveryRoute: false,
|
|
1539
|
-
suppressDelivery: true
|
|
1540
|
-
});
|
|
1541
|
-
await callGatewayTool("exec.approval.resolve", { timeoutMs: 15e3 }, {
|
|
1542
|
-
id: approvalId,
|
|
1543
|
-
decision: "allow-once"
|
|
1544
|
-
}, { scopes: [APPROVALS_SCOPE] });
|
|
1545
|
-
inlineApprovedByAsk = true;
|
|
1546
|
-
inlineApprovalDecision = "allow-once";
|
|
1547
|
-
inlineApprovalId = approvalId;
|
|
1548
|
-
}
|
|
1549
|
-
if (decision.decision !== "allow-once") {
|
|
1550
|
-
autoReviewRequiresHumanApproval = true;
|
|
1551
|
-
params.warnings.push(`Exec auto-review deferred to human approval (risk=${decision.risk}): ${decision.rationale}`);
|
|
1552
|
-
}
|
|
1553
|
-
}
|
|
1554
|
-
if (!inlineApprovedByAsk) {
|
|
1555
|
-
const { approvalId, approvalSlug, warningText, expiresAtMs, preResolvedDecision, initiatingSurface, sentApproverDms, unavailableReason } = await createAndRegisterDefaultExecApprovalRequest({
|
|
1556
|
-
...buildDefaultExecApprovalRequestArgs({
|
|
1557
|
-
warnings: params.warnings,
|
|
1558
|
-
approvalRunningNoticeMs: params.approvalRunningNoticeMs,
|
|
1559
|
-
createApprovalSlug,
|
|
1560
|
-
turnSourceChannel: params.turnSourceChannel,
|
|
1561
|
-
turnSourceAccountId: params.turnSourceAccountId
|
|
1562
|
-
}),
|
|
1563
|
-
register: registerNodeApproval
|
|
1564
|
-
});
|
|
1565
|
-
if (shouldResolveExecApprovalUnavailableInline({
|
|
1566
|
-
trigger: params.trigger,
|
|
1567
|
-
unavailableReason,
|
|
1568
|
-
preResolvedDecision
|
|
1569
|
-
})) {
|
|
1570
|
-
const { baseDecision, approvedByAsk, deniedReason } = createExecApprovalDecisionState({
|
|
1571
|
-
decision: preResolvedDecision,
|
|
1572
|
-
askFallback
|
|
1573
|
-
});
|
|
1574
|
-
const strictInlineEvalDecision = enforceStrictInlineEvalApprovalBoundary({
|
|
1575
|
-
baseDecision,
|
|
1576
|
-
approvedByAsk,
|
|
1577
|
-
deniedReason,
|
|
1578
|
-
requiresInlineEvalApproval: inlineEvalHit !== null,
|
|
1579
|
-
requiresAutoReviewHumanApproval: autoReviewRequiresHumanApproval
|
|
1580
|
-
});
|
|
1581
|
-
if (strictInlineEvalDecision.deniedReason || !strictInlineEvalDecision.approvedByAsk) throw new Error(buildHeadlessExecApprovalDeniedMessage({
|
|
1582
|
-
trigger: params.trigger,
|
|
1583
|
-
host: "node",
|
|
1584
|
-
security: hostSecurity,
|
|
1585
|
-
ask: hostAsk,
|
|
1586
|
-
askFallback
|
|
1587
|
-
}));
|
|
1588
|
-
inlineApprovedByAsk = strictInlineEvalDecision.approvedByAsk;
|
|
1589
|
-
inlineApprovalDecision = strictInlineEvalDecision.approvedByAsk ? "allow-once" : null;
|
|
1590
|
-
inlineApprovalId = approvalId;
|
|
1591
|
-
} else {
|
|
1592
|
-
const followupTarget = buildExecApprovalFollowupTarget({
|
|
1593
|
-
approvalId,
|
|
1594
|
-
sessionKey: params.notifySessionKey ?? params.sessionKey,
|
|
1595
|
-
bashElevated: params.bashElevated,
|
|
1596
|
-
turnSourceChannel: params.turnSourceChannel,
|
|
1597
|
-
turnSourceTo: params.turnSourceTo,
|
|
1598
|
-
turnSourceAccountId: params.turnSourceAccountId,
|
|
1599
|
-
turnSourceThreadId: params.turnSourceThreadId
|
|
1600
|
-
});
|
|
1601
|
-
(async () => {
|
|
1602
|
-
const decision = await resolveApprovalDecisionOrUndefined({
|
|
1603
|
-
approvalId,
|
|
1604
|
-
preResolvedDecision,
|
|
1605
|
-
onFailure: () => void sendExecApprovalFollowupResult(followupTarget, `Exec denied (node=${target.nodeId} id=${approvalId}, approval-request-failed): ${params.command}`)
|
|
1606
|
-
});
|
|
1607
|
-
if (decision === void 0) return;
|
|
1608
|
-
const { baseDecision, approvedByAsk: initialApprovedByAsk, deniedReason: initialDeniedReason } = createExecApprovalDecisionState({
|
|
1609
|
-
decision,
|
|
1610
|
-
askFallback
|
|
1611
|
-
});
|
|
1612
|
-
let approvedByAsk = initialApprovedByAsk;
|
|
1613
|
-
let approvalDecision = null;
|
|
1614
|
-
let deniedReason = initialDeniedReason;
|
|
1615
|
-
if (baseDecision.timedOut && askFallback === "full" && approvedByAsk) approvalDecision = "allow-once";
|
|
1616
|
-
else if (decision === "allow-once") {
|
|
1617
|
-
approvedByAsk = true;
|
|
1618
|
-
approvalDecision = "allow-once";
|
|
1619
|
-
} else if (decision === "allow-always") {
|
|
1620
|
-
approvedByAsk = true;
|
|
1621
|
-
approvalDecision = "allow-always";
|
|
1622
|
-
}
|
|
1623
|
-
({approvedByAsk, deniedReason} = enforceStrictInlineEvalApprovalBoundary({
|
|
1624
|
-
baseDecision,
|
|
1625
|
-
approvedByAsk,
|
|
1626
|
-
deniedReason,
|
|
1627
|
-
requiresInlineEvalApproval: inlineEvalHit !== null,
|
|
1628
|
-
requiresAutoReviewHumanApproval: autoReviewRequiresHumanApproval
|
|
1629
|
-
}));
|
|
1630
|
-
if (deniedReason) approvalDecision = null;
|
|
1631
|
-
if (deniedReason) {
|
|
1632
|
-
await sendExecApprovalFollowupResult(followupTarget, `Exec denied (node=${target.nodeId} id=${approvalId}, ${deniedReason}): ${params.command}`);
|
|
1633
|
-
return;
|
|
1634
|
-
}
|
|
1635
|
-
try {
|
|
1636
|
-
const raw = await callGatewayTool("node.invoke", { timeoutMs: target.invokeTimeoutMs }, buildNodeSystemRunInvoke({
|
|
1637
|
-
target,
|
|
1638
|
-
command: prepared.argv,
|
|
1639
|
-
rawCommand: prepared.rawCommand,
|
|
1640
|
-
cwd: prepared.cwd,
|
|
1641
|
-
agentId: prepared.agentId,
|
|
1642
|
-
sessionKey: prepared.sessionKey,
|
|
1643
|
-
turnSourceChannel: params.turnSourceChannel,
|
|
1644
|
-
turnSourceTo: params.turnSourceTo,
|
|
1645
|
-
turnSourceAccountId: params.turnSourceAccountId,
|
|
1646
|
-
turnSourceThreadId: params.turnSourceThreadId,
|
|
1647
|
-
approved: approvedByAsk,
|
|
1648
|
-
approvalDecision: approvalDecision === "allow-always" && inlineEvalHit !== null ? "allow-once" : approvalDecision,
|
|
1649
|
-
runId: approvalId,
|
|
1650
|
-
suppressNotifyOnExit: true,
|
|
1651
|
-
notifyOnExit: params.notifyOnExit,
|
|
1652
|
-
systemRunPlan: prepared.plan
|
|
1653
|
-
}), { scopes: APPROVED_NODE_INVOKE_SCOPES });
|
|
1654
|
-
const payload = raw?.payload && typeof raw.payload === "object" ? raw.payload : {};
|
|
1655
|
-
const output = normalizeNotifyOutput([
|
|
1656
|
-
payload.stdout,
|
|
1657
|
-
payload.stderr,
|
|
1658
|
-
payload.error
|
|
1659
|
-
].filter(Boolean).join("\n").slice(-400));
|
|
1660
|
-
const exitLabel = payload.timedOut ? "timeout" : `code ${payload.exitCode ?? "?"}`;
|
|
1661
|
-
await sendExecApprovalFollowupResult(followupTarget, output ? `Exec finished (node=${target.nodeId} id=${approvalId}, ${exitLabel})\n${output}` : `Exec finished (node=${target.nodeId} id=${approvalId}, ${exitLabel})`);
|
|
1662
|
-
} catch {
|
|
1663
|
-
await sendExecApprovalFollowupResult(followupTarget, `Exec denied (node=${target.nodeId} id=${approvalId}, invoke-failed): ${params.command}`);
|
|
1664
|
-
}
|
|
1665
|
-
})();
|
|
1666
|
-
return buildExecApprovalPendingToolResult({
|
|
1667
|
-
host: "node",
|
|
1668
|
-
command: params.command,
|
|
1669
|
-
cwd: params.workdir,
|
|
1670
|
-
warningText,
|
|
1671
|
-
approvalId,
|
|
1672
|
-
approvalSlug,
|
|
1673
|
-
expiresAtMs,
|
|
1674
|
-
initiatingSurface,
|
|
1675
|
-
sentApproverDms,
|
|
1676
|
-
unavailableReason,
|
|
1677
|
-
allowedDecisions: resolveExecApprovalAllowedDecisions({ ask: hostAsk }),
|
|
1678
|
-
nodeId: target.nodeId
|
|
1679
|
-
});
|
|
1680
|
-
}
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
const startedAt = Date.now();
|
|
1684
|
-
const invoke = buildNodeSystemRunInvoke({
|
|
1685
|
-
target,
|
|
1686
|
-
command: prepared.argv,
|
|
1687
|
-
rawCommand: prepared.rawCommand,
|
|
1688
|
-
cwd: prepared.cwd,
|
|
1689
|
-
agentId: prepared.agentId,
|
|
1690
|
-
sessionKey: prepared.sessionKey,
|
|
1691
|
-
approved: inlineApprovedByAsk,
|
|
1692
|
-
approvalDecision: inlineApprovalDecision,
|
|
1693
|
-
runId: inlineApprovalId,
|
|
1694
|
-
notifyOnExit: params.notifyOnExit,
|
|
1695
|
-
systemRunPlan: prepared.plan
|
|
1696
|
-
});
|
|
1697
|
-
return formatNodeRunToolResult({
|
|
1698
|
-
raw: inlineApprovedByAsk && inlineApprovalId ? await callGatewayTool("node.invoke", { timeoutMs: target.invokeTimeoutMs }, invoke, { scopes: APPROVED_NODE_INVOKE_SCOPES }) : await callGatewayTool("node.invoke", { timeoutMs: target.invokeTimeoutMs }, invoke),
|
|
1699
|
-
startedAt,
|
|
1700
|
-
cwd: params.workdir
|
|
1701
|
-
});
|
|
1702
|
-
}
|
|
1703
|
-
//#endregion
|
|
1704
|
-
//#region src/agents/bash-tools.exec.ts
|
|
1705
|
-
function buildExecForegroundResult(params) {
|
|
1706
|
-
const warningText = params.warningText?.trim() ? `${params.warningText}\n\n` : "";
|
|
1707
|
-
if (params.outcome.status === "failed") return failedTextResult(`${warningText}${params.outcome.reason}`, {
|
|
1708
|
-
status: "failed",
|
|
1709
|
-
exitCode: params.outcome.exitCode ?? null,
|
|
1710
|
-
durationMs: params.outcome.durationMs,
|
|
1711
|
-
aggregated: params.outcome.aggregated,
|
|
1712
|
-
timedOut: params.outcome.timedOut,
|
|
1713
|
-
cwd: params.cwd
|
|
1714
|
-
});
|
|
1715
|
-
return textResult(`${warningText}${renderExecOutputText(params.outcome.aggregated)}`, {
|
|
1716
|
-
status: "completed",
|
|
1717
|
-
exitCode: params.outcome.exitCode,
|
|
1718
|
-
durationMs: params.outcome.durationMs,
|
|
1719
|
-
aggregated: params.outcome.aggregated,
|
|
1720
|
-
cwd: params.cwd
|
|
1721
|
-
});
|
|
1722
|
-
}
|
|
1723
|
-
const PREFLIGHT_ENV_OPTIONS_WITH_VALUES = new Set([
|
|
1724
|
-
"-C",
|
|
1725
|
-
"-S",
|
|
1726
|
-
"-u",
|
|
1727
|
-
"--argv0",
|
|
1728
|
-
"--block-signal",
|
|
1729
|
-
"--chdir",
|
|
1730
|
-
"--default-signal",
|
|
1731
|
-
"--ignore-signal",
|
|
1732
|
-
"--split-string",
|
|
1733
|
-
"--unset"
|
|
1734
|
-
]);
|
|
1735
|
-
const SKIPPABLE_SCRIPT_PREFLIGHT_FS_ERROR_CODES = new Set([
|
|
1736
|
-
"EACCES",
|
|
1737
|
-
"EISDIR",
|
|
1738
|
-
"ELOOP",
|
|
1739
|
-
"EINVAL",
|
|
1740
|
-
"ENAMETOOLONG",
|
|
1741
|
-
"ENOENT",
|
|
1742
|
-
"ENOTDIR",
|
|
1743
|
-
"EPERM"
|
|
1744
|
-
]);
|
|
1745
|
-
const SCRIPT_PREFLIGHT_MAX_BYTES = 512 * 1024;
|
|
1746
|
-
const FS_CONSTANTS_WITH_OPTIONAL_NONBLOCK = constants;
|
|
1747
|
-
const SCRIPT_PREFLIGHT_OPEN_FLAGS = constants.O_RDONLY | (FS_CONSTANTS_WITH_OPTIONAL_NONBLOCK.O_NONBLOCK ?? 0);
|
|
1748
|
-
function getNodeErrorCode(error) {
|
|
1749
|
-
if (typeof error !== "object" || error === null || !("code" in error)) return;
|
|
1750
|
-
return String(error.code);
|
|
1751
|
-
}
|
|
1752
|
-
const fsSafeModuleLoader = createLazyImportLoader(() => import("./fs-safe-DWIAc9pN.js"));
|
|
1753
|
-
async function loadFsSafeModule() {
|
|
1754
|
-
return await fsSafeModuleLoader.load();
|
|
1755
|
-
}
|
|
1756
|
-
function shouldSkipScriptPreflightPathError(error, FsSafeError) {
|
|
1757
|
-
if (error instanceof FsSafeError) return true;
|
|
1758
|
-
const errorCode = getNodeErrorCode(error);
|
|
1759
|
-
return !!(errorCode && SKIPPABLE_SCRIPT_PREFLIGHT_FS_ERROR_CODES.has(errorCode));
|
|
1760
|
-
}
|
|
1761
|
-
function resolvePreflightRelativePath(params) {
|
|
1762
|
-
const root = path.resolve(params.rootDir);
|
|
1763
|
-
const candidate = path.resolve(params.absPath);
|
|
1764
|
-
const relative = path.relative(root, candidate);
|
|
1765
|
-
if (/^\.\.(?:[\\/]|$)/u.test(relative) || path.isAbsolute(relative)) return null;
|
|
1766
|
-
return relative;
|
|
1767
|
-
}
|
|
1768
|
-
function hasLeadingTildePathSegment(relativePath) {
|
|
1769
|
-
return /^~(?:$|[\\/])/u.test(relativePath);
|
|
1770
|
-
}
|
|
1771
|
-
async function readLiteralTildePreflightScript(params) {
|
|
1772
|
-
let handle;
|
|
1773
|
-
try {
|
|
1774
|
-
handle = await fs$1.open(params.absPath, SCRIPT_PREFLIGHT_OPEN_FLAGS);
|
|
1775
|
-
const stat = await handle.stat();
|
|
1776
|
-
if (!stat.isFile()) throw new params.fsSafe.FsSafeError("not-file", "not a file");
|
|
1777
|
-
if (stat.size > SCRIPT_PREFLIGHT_MAX_BYTES) throw new params.fsSafe.FsSafeError("too-large", `file exceeds limit of ${SCRIPT_PREFLIGHT_MAX_BYTES} bytes (got ${stat.size})`);
|
|
1778
|
-
const realPath = await params.fsSafe.resolveOpenedFileRealPathForHandle(handle, params.absPath);
|
|
1779
|
-
if (!params.fsSafe.isPathInside(params.workspaceRoot.rootReal, realPath)) throw new params.fsSafe.FsSafeError("outside-workspace", "file is outside workspace root");
|
|
1780
|
-
const buffer = await handle.readFile();
|
|
1781
|
-
if (buffer.byteLength > SCRIPT_PREFLIGHT_MAX_BYTES) throw new params.fsSafe.FsSafeError("too-large", `file exceeds limit of ${SCRIPT_PREFLIGHT_MAX_BYTES} bytes (got ${buffer.byteLength})`);
|
|
1782
|
-
return buffer.toString("utf-8");
|
|
1783
|
-
} finally {
|
|
1784
|
-
await handle?.close().catch(() => void 0);
|
|
1785
|
-
}
|
|
1786
|
-
}
|
|
1787
|
-
function isShellEnvAssignmentToken(token) {
|
|
1788
|
-
return /^[A-Za-z_][A-Za-z0-9_]*=.*$/u.test(token);
|
|
1789
|
-
}
|
|
1790
|
-
function isEnvExecutableToken(token) {
|
|
1791
|
-
if (!token) return false;
|
|
1792
|
-
const base = normalizeOptionalLowercaseString(token.split(/[\\/]/u).at(-1)) ?? "";
|
|
1793
|
-
return (base.endsWith(".exe") ? base.slice(0, -4) : base) === "env";
|
|
1794
|
-
}
|
|
1795
|
-
function stripPreflightEnvPrefix(argv) {
|
|
1796
|
-
if (argv.length === 0) return argv;
|
|
1797
|
-
let idx = 0;
|
|
1798
|
-
while (idx < argv.length && isShellEnvAssignmentToken(argv[idx])) idx += 1;
|
|
1799
|
-
if (!isEnvExecutableToken(argv[idx])) return argv;
|
|
1800
|
-
idx += 1;
|
|
1801
|
-
while (idx < argv.length) {
|
|
1802
|
-
const token = argv[idx];
|
|
1803
|
-
if (token === "--") {
|
|
1804
|
-
idx += 1;
|
|
1805
|
-
break;
|
|
1806
|
-
}
|
|
1807
|
-
if (isShellEnvAssignmentToken(token)) {
|
|
1808
|
-
idx += 1;
|
|
1809
|
-
continue;
|
|
1810
|
-
}
|
|
1811
|
-
if (!token.startsWith("-") || token === "-") break;
|
|
1812
|
-
idx += 1;
|
|
1813
|
-
const option = token.split("=", 1)[0];
|
|
1814
|
-
if (PREFLIGHT_ENV_OPTIONS_WITH_VALUES.has(option) && !token.includes("=") && idx < argv.length) idx += 1;
|
|
1815
|
-
}
|
|
1816
|
-
return argv.slice(idx);
|
|
1817
|
-
}
|
|
1818
|
-
function findFirstPythonScriptArg(tokens) {
|
|
1819
|
-
const optionsWithSeparateValue = new Set([
|
|
1820
|
-
"-W",
|
|
1821
|
-
"-X",
|
|
1822
|
-
"-Q",
|
|
1823
|
-
"--check-hash-based-pycs"
|
|
1824
|
-
]);
|
|
1825
|
-
for (let i = 0; i < tokens.length; i += 1) {
|
|
1826
|
-
const token = tokens[i];
|
|
1827
|
-
if (token === "--") {
|
|
1828
|
-
const next = tokens[i + 1];
|
|
1829
|
-
return normalizeLowercaseStringOrEmpty(next).endsWith(".py") ? next : null;
|
|
1830
|
-
}
|
|
1831
|
-
if (token === "-") return null;
|
|
1832
|
-
if (token === "-c" || token === "-m") return null;
|
|
1833
|
-
if ((token.startsWith("-c") || token.startsWith("-m")) && token.length > 2) return null;
|
|
1834
|
-
if (optionsWithSeparateValue.has(token)) {
|
|
1835
|
-
i += 1;
|
|
1836
|
-
continue;
|
|
1837
|
-
}
|
|
1838
|
-
if (token.startsWith("-")) continue;
|
|
1839
|
-
return normalizeLowercaseStringOrEmpty(token).endsWith(".py") ? token : null;
|
|
1840
|
-
}
|
|
1841
|
-
return null;
|
|
1842
|
-
}
|
|
1843
|
-
function findNodeScriptArgs(tokens) {
|
|
1844
|
-
const optionsWithSeparateValue = new Set([
|
|
1845
|
-
"-r",
|
|
1846
|
-
"--require",
|
|
1847
|
-
"--import"
|
|
1848
|
-
]);
|
|
1849
|
-
const preloadScripts = [];
|
|
1850
|
-
let entryScript = null;
|
|
1851
|
-
let hasInlineEvalOrPrint = false;
|
|
1852
|
-
for (let i = 0; i < tokens.length; i += 1) {
|
|
1853
|
-
const token = tokens[i];
|
|
1854
|
-
if (token === "--") {
|
|
1855
|
-
if (!hasInlineEvalOrPrint && !entryScript) {
|
|
1856
|
-
const next = tokens[i + 1];
|
|
1857
|
-
if (normalizeLowercaseStringOrEmpty(next).endsWith(".js")) entryScript = next;
|
|
1858
|
-
}
|
|
1859
|
-
break;
|
|
1860
|
-
}
|
|
1861
|
-
if (token === "-e" || token === "-p" || token === "--eval" || token === "--print" || token.startsWith("--eval=") || token.startsWith("--print=") || (token.startsWith("-e") || token.startsWith("-p")) && token.length > 2) {
|
|
1862
|
-
hasInlineEvalOrPrint = true;
|
|
1863
|
-
if (token === "-e" || token === "-p" || token === "--eval" || token === "--print") i += 1;
|
|
1864
|
-
continue;
|
|
1865
|
-
}
|
|
1866
|
-
if (optionsWithSeparateValue.has(token)) {
|
|
1867
|
-
const next = tokens[i + 1];
|
|
1868
|
-
if (normalizeLowercaseStringOrEmpty(next).endsWith(".js")) preloadScripts.push(next);
|
|
1869
|
-
i += 1;
|
|
1870
|
-
continue;
|
|
1871
|
-
}
|
|
1872
|
-
if (token.startsWith("-r") && token.length > 2 || token.startsWith("--require=") || token.startsWith("--import=")) {
|
|
1873
|
-
const inlineValue = token.startsWith("-r") ? token.slice(2) : token.slice(token.indexOf("=") + 1);
|
|
1874
|
-
if (normalizeLowercaseStringOrEmpty(inlineValue).endsWith(".js")) preloadScripts.push(inlineValue);
|
|
1875
|
-
continue;
|
|
1876
|
-
}
|
|
1877
|
-
if (token.startsWith("-")) continue;
|
|
1878
|
-
if (!hasInlineEvalOrPrint && !entryScript && normalizeLowercaseStringOrEmpty(token).endsWith(".js")) entryScript = token;
|
|
1879
|
-
break;
|
|
1880
|
-
}
|
|
1881
|
-
const targets = [...preloadScripts];
|
|
1882
|
-
if (entryScript) targets.push(entryScript);
|
|
1883
|
-
return targets;
|
|
1884
|
-
}
|
|
1885
|
-
function extractInterpreterScriptTargetFromArgv(argv) {
|
|
1886
|
-
if (!argv || argv.length === 0) return null;
|
|
1887
|
-
let commandIdx = 0;
|
|
1888
|
-
while (commandIdx < argv.length && /^[A-Za-z_][A-Za-z0-9_]*=.*$/u.test(argv[commandIdx])) commandIdx += 1;
|
|
1889
|
-
const executable = normalizeOptionalLowercaseString(argv[commandIdx]);
|
|
1890
|
-
if (!executable) return null;
|
|
1891
|
-
const args = argv.slice(commandIdx + 1);
|
|
1892
|
-
if (/^python(?:3(?:\.\d+)?)?$/i.test(executable)) {
|
|
1893
|
-
const script = findFirstPythonScriptArg(args);
|
|
1894
|
-
if (script) return {
|
|
1895
|
-
kind: "python",
|
|
1896
|
-
relOrAbsPaths: [script]
|
|
1897
|
-
};
|
|
1898
|
-
return null;
|
|
1899
|
-
}
|
|
1900
|
-
if (executable === "node") {
|
|
1901
|
-
const scripts = findNodeScriptArgs(args);
|
|
1902
|
-
if (scripts.length > 0) return {
|
|
1903
|
-
kind: "node",
|
|
1904
|
-
relOrAbsPaths: scripts
|
|
1905
|
-
};
|
|
1906
|
-
return null;
|
|
1907
|
-
}
|
|
1908
|
-
return null;
|
|
1909
|
-
}
|
|
1910
|
-
function extractInterpreterScriptPathsFromSegment(rawSegment) {
|
|
1911
|
-
const argv = splitShellArgs(rawSegment.trim());
|
|
1912
|
-
if (!argv || argv.length === 0) return [];
|
|
1913
|
-
return extractInterpreterScriptTargetFromArgv(stripPreflightEnvPrefix(/^(?:if|then|do|elif|else|while|until|time)$/i.test(argv[0] ?? "") ? argv.slice(1) : argv))?.relOrAbsPaths ?? [];
|
|
1914
|
-
}
|
|
1915
|
-
function extractScriptTargetFromCommand(command) {
|
|
1916
|
-
const raw = command.trim();
|
|
1917
|
-
const splitShellArgsPreservingBackslashes = (value) => {
|
|
1918
|
-
const tokens = [];
|
|
1919
|
-
let buf = "";
|
|
1920
|
-
let inSingle = false;
|
|
1921
|
-
let inDouble = false;
|
|
1922
|
-
const pushToken = () => {
|
|
1923
|
-
if (buf.length > 0) {
|
|
1924
|
-
tokens.push(buf);
|
|
1925
|
-
buf = "";
|
|
1926
|
-
}
|
|
1927
|
-
};
|
|
1928
|
-
for (let i = 0; i < value.length; i += 1) {
|
|
1929
|
-
const ch = value[i];
|
|
1930
|
-
if (inSingle) {
|
|
1931
|
-
if (ch === "'") inSingle = false;
|
|
1932
|
-
else buf += ch;
|
|
1933
|
-
continue;
|
|
1934
|
-
}
|
|
1935
|
-
if (inDouble) {
|
|
1936
|
-
if (ch === "\"") inDouble = false;
|
|
1937
|
-
else buf += ch;
|
|
1938
|
-
continue;
|
|
1939
|
-
}
|
|
1940
|
-
if (ch === "'") {
|
|
1941
|
-
inSingle = true;
|
|
1942
|
-
continue;
|
|
1943
|
-
}
|
|
1944
|
-
if (ch === "\"") {
|
|
1945
|
-
inDouble = true;
|
|
1946
|
-
continue;
|
|
1947
|
-
}
|
|
1948
|
-
if (/\s/.test(ch)) {
|
|
1949
|
-
pushToken();
|
|
1950
|
-
continue;
|
|
1951
|
-
}
|
|
1952
|
-
buf += ch;
|
|
1953
|
-
}
|
|
1954
|
-
if (inSingle || inDouble) return null;
|
|
1955
|
-
pushToken();
|
|
1956
|
-
return tokens;
|
|
1957
|
-
};
|
|
1958
|
-
const candidateArgv = process.platform === "win32" && /(?:^|[\s"'`])(?:[A-Za-z]:\\|\\\\|[^\s"'`|&;()<>]+\\[^\s"'`|&;()<>]+)/.test(raw) ? [splitShellArgsPreservingBackslashes(raw)] : [splitShellArgs(raw)];
|
|
1959
|
-
for (const argv of candidateArgv) {
|
|
1960
|
-
const attempts = [argv, argv ? stripPreflightEnvPrefix(argv) : null];
|
|
1961
|
-
for (const attempt of attempts) {
|
|
1962
|
-
const target = extractInterpreterScriptTargetFromArgv(attempt);
|
|
1963
|
-
if (target) return target;
|
|
1964
|
-
}
|
|
1965
|
-
}
|
|
1966
|
-
return null;
|
|
1967
|
-
}
|
|
1968
|
-
function extractUnquotedShellText(raw) {
|
|
1969
|
-
let out = "";
|
|
1970
|
-
let inSingle = false;
|
|
1971
|
-
let inDouble = false;
|
|
1972
|
-
let escaped = false;
|
|
1973
|
-
for (let i = 0; i < raw.length; i += 1) {
|
|
1974
|
-
const ch = raw[i];
|
|
1975
|
-
if (escaped) {
|
|
1976
|
-
if (!inSingle && !inDouble) out += `\\${ch}`;
|
|
1977
|
-
escaped = false;
|
|
1978
|
-
continue;
|
|
1979
|
-
}
|
|
1980
|
-
if (!inSingle && ch === "\\") {
|
|
1981
|
-
escaped = true;
|
|
1982
|
-
continue;
|
|
1983
|
-
}
|
|
1984
|
-
if (inSingle) {
|
|
1985
|
-
if (ch === "'") inSingle = false;
|
|
1986
|
-
continue;
|
|
1987
|
-
}
|
|
1988
|
-
if (inDouble) {
|
|
1989
|
-
const next = raw[i + 1];
|
|
1990
|
-
if (ch === "\\" && next && /[\\'"$`\n\r]/.test(next)) {
|
|
1991
|
-
i += 1;
|
|
1992
|
-
continue;
|
|
1993
|
-
}
|
|
1994
|
-
if (ch === "\"") inDouble = false;
|
|
1995
|
-
continue;
|
|
1996
|
-
}
|
|
1997
|
-
if (ch === "'") {
|
|
1998
|
-
inSingle = true;
|
|
1999
|
-
continue;
|
|
2000
|
-
}
|
|
2001
|
-
if (ch === "\"") {
|
|
2002
|
-
inDouble = true;
|
|
2003
|
-
continue;
|
|
2004
|
-
}
|
|
2005
|
-
out += ch;
|
|
2006
|
-
}
|
|
2007
|
-
if (escaped || inSingle || inDouble) return null;
|
|
2008
|
-
return out;
|
|
2009
|
-
}
|
|
2010
|
-
function splitShellSegmentsOutsideQuotes(rawText, params) {
|
|
2011
|
-
const segments = [];
|
|
2012
|
-
let buf = "";
|
|
2013
|
-
let inSingle = false;
|
|
2014
|
-
let inDouble = false;
|
|
2015
|
-
let escaped = false;
|
|
2016
|
-
const pushSegment = () => {
|
|
2017
|
-
if (buf.trim().length > 0) segments.push(buf);
|
|
2018
|
-
buf = "";
|
|
2019
|
-
};
|
|
2020
|
-
for (let i = 0; i < rawText.length; i += 1) {
|
|
2021
|
-
const ch = rawText[i];
|
|
2022
|
-
const next = rawText[i + 1];
|
|
2023
|
-
if (escaped) {
|
|
2024
|
-
buf += ch;
|
|
2025
|
-
escaped = false;
|
|
2026
|
-
continue;
|
|
2027
|
-
}
|
|
2028
|
-
if (!inSingle && ch === "\\") {
|
|
2029
|
-
buf += ch;
|
|
2030
|
-
escaped = true;
|
|
2031
|
-
continue;
|
|
2032
|
-
}
|
|
2033
|
-
if (inSingle) {
|
|
2034
|
-
buf += ch;
|
|
2035
|
-
if (ch === "'") inSingle = false;
|
|
2036
|
-
continue;
|
|
2037
|
-
}
|
|
2038
|
-
if (inDouble) {
|
|
2039
|
-
buf += ch;
|
|
2040
|
-
if (ch === "\"") inDouble = false;
|
|
2041
|
-
continue;
|
|
2042
|
-
}
|
|
2043
|
-
if (ch === "'") {
|
|
2044
|
-
inSingle = true;
|
|
2045
|
-
buf += ch;
|
|
2046
|
-
continue;
|
|
2047
|
-
}
|
|
2048
|
-
if (ch === "\"") {
|
|
2049
|
-
inDouble = true;
|
|
2050
|
-
buf += ch;
|
|
2051
|
-
continue;
|
|
2052
|
-
}
|
|
2053
|
-
if (ch === "\n" || ch === "\r") {
|
|
2054
|
-
pushSegment();
|
|
2055
|
-
continue;
|
|
2056
|
-
}
|
|
2057
|
-
if (ch === ";") {
|
|
2058
|
-
pushSegment();
|
|
2059
|
-
continue;
|
|
2060
|
-
}
|
|
2061
|
-
if (ch === "&" && next === "&") {
|
|
2062
|
-
pushSegment();
|
|
2063
|
-
i += 1;
|
|
2064
|
-
continue;
|
|
2065
|
-
}
|
|
2066
|
-
if (ch === "|" && next === "|") {
|
|
2067
|
-
pushSegment();
|
|
2068
|
-
i += 1;
|
|
2069
|
-
continue;
|
|
2070
|
-
}
|
|
2071
|
-
if (params.splitPipes && ch === "|") {
|
|
2072
|
-
pushSegment();
|
|
2073
|
-
continue;
|
|
2074
|
-
}
|
|
2075
|
-
buf += ch;
|
|
2076
|
-
}
|
|
2077
|
-
pushSegment();
|
|
2078
|
-
return segments;
|
|
2079
|
-
}
|
|
2080
|
-
function isInterpreterExecutable(executable) {
|
|
2081
|
-
if (!executable) return false;
|
|
2082
|
-
return /^python(?:3(?:\.\d+)?)?$/i.test(executable) || executable === "node";
|
|
2083
|
-
}
|
|
2084
|
-
function hasUnescapedSequence(raw, sequence) {
|
|
2085
|
-
if (sequence.length === 0) return false;
|
|
2086
|
-
let escaped = false;
|
|
2087
|
-
for (let i = 0; i < raw.length; i += 1) {
|
|
2088
|
-
const ch = raw[i];
|
|
2089
|
-
if (escaped) {
|
|
2090
|
-
escaped = false;
|
|
2091
|
-
continue;
|
|
2092
|
-
}
|
|
2093
|
-
if (ch === "\\") {
|
|
2094
|
-
escaped = true;
|
|
2095
|
-
continue;
|
|
2096
|
-
}
|
|
2097
|
-
if (raw.startsWith(sequence, i)) return true;
|
|
2098
|
-
}
|
|
2099
|
-
return false;
|
|
2100
|
-
}
|
|
2101
|
-
function hasUnquotedScriptHint(raw) {
|
|
2102
|
-
let inSingle = false;
|
|
2103
|
-
let inDouble = false;
|
|
2104
|
-
let escaped = false;
|
|
2105
|
-
let token = "";
|
|
2106
|
-
const flushToken = () => {
|
|
2107
|
-
const normalizedToken = normalizeLowercaseStringOrEmpty(token);
|
|
2108
|
-
if (normalizedToken.endsWith(".py") || normalizedToken.endsWith(".js")) return true;
|
|
2109
|
-
token = "";
|
|
2110
|
-
return false;
|
|
2111
|
-
};
|
|
2112
|
-
for (let i = 0; i < raw.length; i += 1) {
|
|
2113
|
-
const ch = raw[i];
|
|
2114
|
-
if (escaped) {
|
|
2115
|
-
if (!inSingle && !inDouble) token += ch;
|
|
2116
|
-
escaped = false;
|
|
2117
|
-
continue;
|
|
2118
|
-
}
|
|
2119
|
-
if (!inSingle && ch === "\\") {
|
|
2120
|
-
escaped = true;
|
|
2121
|
-
continue;
|
|
2122
|
-
}
|
|
2123
|
-
if (inSingle) {
|
|
2124
|
-
if (ch === "'") inSingle = false;
|
|
2125
|
-
continue;
|
|
2126
|
-
}
|
|
2127
|
-
if (inDouble) {
|
|
2128
|
-
if (ch === "\"") inDouble = false;
|
|
2129
|
-
continue;
|
|
2130
|
-
}
|
|
2131
|
-
if (ch === "'") {
|
|
2132
|
-
if (flushToken()) return true;
|
|
2133
|
-
inSingle = true;
|
|
2134
|
-
continue;
|
|
2135
|
-
}
|
|
2136
|
-
if (ch === "\"") {
|
|
2137
|
-
if (flushToken()) return true;
|
|
2138
|
-
inDouble = true;
|
|
2139
|
-
continue;
|
|
2140
|
-
}
|
|
2141
|
-
if (/\s/u.test(ch) || "|&;()<>".includes(ch)) {
|
|
2142
|
-
if (flushToken()) return true;
|
|
2143
|
-
continue;
|
|
2144
|
-
}
|
|
2145
|
-
token += ch;
|
|
2146
|
-
}
|
|
2147
|
-
return flushToken();
|
|
2148
|
-
}
|
|
2149
|
-
function resolveLeadingShellSegmentExecutable(rawSegment) {
|
|
2150
|
-
const argv = splitShellArgs((extractUnquotedShellText(rawSegment) ?? rawSegment).trim());
|
|
2151
|
-
if (!argv || argv.length === 0) return;
|
|
2152
|
-
const withoutLeadingKeyword = /^(?:if|then|do|elif|else|while|until|time)$/i.test(argv[0] ?? "") ? argv.slice(1) : argv;
|
|
2153
|
-
if (withoutLeadingKeyword.length === 0) return;
|
|
2154
|
-
const normalizedArgv = stripPreflightEnvPrefix(withoutLeadingKeyword);
|
|
2155
|
-
let commandIdx = 0;
|
|
2156
|
-
while (commandIdx < normalizedArgv.length && /^[A-Za-z_][A-Za-z0-9_]*=.*$/u.test(normalizedArgv[commandIdx] ?? "")) commandIdx += 1;
|
|
2157
|
-
return normalizeOptionalLowercaseString(normalizedArgv[commandIdx]);
|
|
2158
|
-
}
|
|
2159
|
-
function analyzeInterpreterHeuristicsFromUnquoted(raw) {
|
|
2160
|
-
const hasPython = splitShellSegmentsOutsideQuotes(raw, { splitPipes: true }).some((segment) => /^python(?:3(?:\.\d+)?)?$/i.test(resolveLeadingShellSegmentExecutable(segment) ?? ""));
|
|
2161
|
-
const hasNode = splitShellSegmentsOutsideQuotes(raw, { splitPipes: true }).some((segment) => resolveLeadingShellSegmentExecutable(segment) === "node");
|
|
2162
|
-
const hasProcessSubstitution = hasUnescapedSequence(raw, "<(") || hasUnescapedSequence(raw, ">(");
|
|
2163
|
-
return {
|
|
2164
|
-
hasPython,
|
|
2165
|
-
hasNode,
|
|
2166
|
-
hasComplexSyntax: hasUnescapedSequence(raw, "|") || hasUnescapedSequence(raw, "&&") || hasUnescapedSequence(raw, "||") || hasUnescapedSequence(raw, ";") || raw.includes("\n") || raw.includes("\r") || hasUnescapedSequence(raw, "$(") || hasUnescapedSequence(raw, "`") || hasProcessSubstitution,
|
|
2167
|
-
hasProcessSubstitution,
|
|
2168
|
-
hasScriptHint: hasUnquotedScriptHint(raw)
|
|
2169
|
-
};
|
|
2170
|
-
}
|
|
2171
|
-
function extractShellWrappedCommandPayload(executable, args) {
|
|
2172
|
-
if (!executable) return null;
|
|
2173
|
-
const executableBase = normalizeOptionalLowercaseString(executable.split(/[\\/]/u).at(-1)) ?? "";
|
|
2174
|
-
const normalizedExecutable = executableBase.endsWith(".exe") ? executableBase.slice(0, -4) : executableBase;
|
|
2175
|
-
if (!/^(?:bash|dash|fish|ksh|sh|zsh)$/i.test(normalizedExecutable)) return null;
|
|
2176
|
-
const shortOptionsWithSeparateValue = new Set(["-O", "-o"]);
|
|
2177
|
-
for (let i = 0; i < args.length; i += 1) {
|
|
2178
|
-
const arg = args[i];
|
|
2179
|
-
if (arg === "--") return null;
|
|
2180
|
-
if (arg === "-c") return args[i + 1] ?? null;
|
|
2181
|
-
if (/^-[A-Za-z]+$/u.test(arg)) {
|
|
2182
|
-
if (arg.includes("c")) return args[i + 1] ?? null;
|
|
2183
|
-
if (shortOptionsWithSeparateValue.has(arg)) i += 1;
|
|
2184
|
-
continue;
|
|
2185
|
-
}
|
|
2186
|
-
if (/^--[A-Za-z0-9][A-Za-z0-9-]*(?:=.*)?$/u.test(arg)) {
|
|
2187
|
-
if (!arg.includes("=")) {
|
|
2188
|
-
const next = args[i + 1];
|
|
2189
|
-
if (next && next !== "--" && !next.startsWith("-")) i += 1;
|
|
2190
|
-
}
|
|
2191
|
-
continue;
|
|
2192
|
-
}
|
|
2193
|
-
return null;
|
|
2194
|
-
}
|
|
2195
|
-
return null;
|
|
2196
|
-
}
|
|
2197
|
-
function shouldFailClosedInterpreterPreflight(command) {
|
|
2198
|
-
const raw = command.trim();
|
|
2199
|
-
const rawArgv = splitShellArgs(raw);
|
|
2200
|
-
const argv = rawArgv ? stripPreflightEnvPrefix(rawArgv) : null;
|
|
2201
|
-
let commandIdx = 0;
|
|
2202
|
-
if (argv) while (commandIdx < argv.length && /^[A-Za-z_][A-Za-z0-9_]*=.*$/u.test(argv[commandIdx] ?? "")) commandIdx += 1;
|
|
2203
|
-
const directExecutable = normalizeOptionalLowercaseString(argv?.[commandIdx]);
|
|
2204
|
-
const args = argv ? argv.slice(commandIdx + 1) : [];
|
|
2205
|
-
const isDirectInterpreterCommand = Boolean(directExecutable && /^python(?:3(?:\.\d+)?)?$/i.test(directExecutable)) || directExecutable === "node";
|
|
2206
|
-
const topLevel = analyzeInterpreterHeuristicsFromUnquoted(extractUnquotedShellText(raw) ?? raw);
|
|
2207
|
-
const shellWrappedPayload = extractShellWrappedCommandPayload(directExecutable, args);
|
|
2208
|
-
const nestedUnquoted = shellWrappedPayload ? extractUnquotedShellText(shellWrappedPayload) ?? shellWrappedPayload : "";
|
|
2209
|
-
const nested = shellWrappedPayload ? analyzeInterpreterHeuristicsFromUnquoted(nestedUnquoted) : {
|
|
2210
|
-
hasPython: false,
|
|
2211
|
-
hasNode: false,
|
|
2212
|
-
hasComplexSyntax: false,
|
|
2213
|
-
hasProcessSubstitution: false,
|
|
2214
|
-
hasScriptHint: false
|
|
2215
|
-
};
|
|
2216
|
-
const hasInterpreterInvocationInSegment = (rawSegment) => isInterpreterExecutable(resolveLeadingShellSegmentExecutable(rawSegment));
|
|
2217
|
-
const isScriptExecutingInterpreterCommand = (rawCommand) => {
|
|
2218
|
-
const argv = splitShellArgs(rawCommand.trim());
|
|
2219
|
-
if (!argv || argv.length === 0) return false;
|
|
2220
|
-
const withoutLeadingKeyword = /^(?:if|then|do|elif|else|while|until|time)$/i.test(argv[0] ?? "") ? argv.slice(1) : argv;
|
|
2221
|
-
if (withoutLeadingKeyword.length === 0) return false;
|
|
2222
|
-
const normalizedArgv = stripPreflightEnvPrefix(withoutLeadingKeyword);
|
|
2223
|
-
let commandIdx = 0;
|
|
2224
|
-
while (commandIdx < normalizedArgv.length && /^[A-Za-z_][A-Za-z0-9_]*=.*$/u.test(normalizedArgv[commandIdx] ?? "")) commandIdx += 1;
|
|
2225
|
-
const executable = normalizeOptionalLowercaseString(normalizedArgv[commandIdx]);
|
|
2226
|
-
if (!executable) return false;
|
|
2227
|
-
const args = normalizedArgv.slice(commandIdx + 1);
|
|
2228
|
-
if (/^python(?:3(?:\.\d+)?)?$/i.test(executable)) {
|
|
2229
|
-
const pythonInfoOnlyFlags = new Set([
|
|
2230
|
-
"-V",
|
|
2231
|
-
"--version",
|
|
2232
|
-
"-h",
|
|
2233
|
-
"--help"
|
|
2234
|
-
]);
|
|
2235
|
-
if (args.some((arg) => pythonInfoOnlyFlags.has(arg))) return false;
|
|
2236
|
-
if (args.some((arg) => arg === "-c" || arg === "-m" || arg.startsWith("-c") || arg.startsWith("-m") || arg === "--check-hash-based-pycs")) return false;
|
|
2237
|
-
return true;
|
|
2238
|
-
}
|
|
2239
|
-
if (executable === "node") {
|
|
2240
|
-
const nodeInfoOnlyFlags = new Set([
|
|
2241
|
-
"-v",
|
|
2242
|
-
"--version",
|
|
2243
|
-
"-h",
|
|
2244
|
-
"--help",
|
|
2245
|
-
"-c",
|
|
2246
|
-
"--check"
|
|
2247
|
-
]);
|
|
2248
|
-
if (args.some((arg) => nodeInfoOnlyFlags.has(arg))) return false;
|
|
2249
|
-
if (args.some((arg) => arg === "-e" || arg === "-p" || arg === "--eval" || arg === "--print" || arg.startsWith("--eval=") || arg.startsWith("--print=") || (arg.startsWith("-e") || arg.startsWith("-p")) && arg.length > 2)) return false;
|
|
2250
|
-
return true;
|
|
2251
|
-
}
|
|
2252
|
-
return false;
|
|
2253
|
-
};
|
|
2254
|
-
const hasScriptHintInSegment = (segment) => extractInterpreterScriptPathsFromSegment(segment).length > 0 || hasUnquotedScriptHint(segment);
|
|
2255
|
-
const hasInterpreterAndScriptHintInSameSegment = (rawText) => {
|
|
2256
|
-
return splitShellSegmentsOutsideQuotes(rawText, { splitPipes: true }).some((segment) => {
|
|
2257
|
-
if (!isScriptExecutingInterpreterCommand(segment)) return false;
|
|
2258
|
-
return hasScriptHintInSegment(segment);
|
|
2259
|
-
});
|
|
2260
|
-
};
|
|
2261
|
-
const hasInterpreterPipelineScriptHintInSameSegment = (rawText) => {
|
|
2262
|
-
return splitShellSegmentsOutsideQuotes(rawText, { splitPipes: false }).some((segment) => {
|
|
2263
|
-
if (!splitShellSegmentsOutsideQuotes(segment, { splitPipes: true }).slice(1).some((pipelineCommand) => isScriptExecutingInterpreterCommand(pipelineCommand))) return false;
|
|
2264
|
-
return hasScriptHintInSegment(segment);
|
|
2265
|
-
});
|
|
2266
|
-
};
|
|
2267
|
-
const hasInterpreterSegmentScriptHint = hasInterpreterAndScriptHintInSameSegment(raw) || shellWrappedPayload !== null && hasInterpreterAndScriptHintInSameSegment(shellWrappedPayload);
|
|
2268
|
-
const hasInterpreterPipelineScriptHint = hasInterpreterPipelineScriptHintInSameSegment(raw) || shellWrappedPayload !== null && hasInterpreterPipelineScriptHintInSameSegment(shellWrappedPayload);
|
|
2269
|
-
const hasShellWrappedInterpreterSegmentScriptHint = shellWrappedPayload !== null && hasInterpreterAndScriptHintInSameSegment(shellWrappedPayload);
|
|
2270
|
-
const hasShellWrappedInterpreterInvocation = (nested.hasPython || nested.hasNode) && (hasShellWrappedInterpreterSegmentScriptHint || nested.hasScriptHint || nested.hasComplexSyntax || nested.hasProcessSubstitution);
|
|
2271
|
-
const hasTopLevelInterpreterInvocation = splitShellSegmentsOutsideQuotes(raw, { splitPipes: true }).some((segment) => hasInterpreterInvocationInSegment(segment));
|
|
2272
|
-
return {
|
|
2273
|
-
hasInterpreterInvocation: isDirectInterpreterCommand || hasShellWrappedInterpreterInvocation || hasTopLevelInterpreterInvocation,
|
|
2274
|
-
hasComplexSyntax: topLevel.hasComplexSyntax || hasShellWrappedInterpreterInvocation,
|
|
2275
|
-
hasProcessSubstitution: topLevel.hasProcessSubstitution || nested.hasProcessSubstitution,
|
|
2276
|
-
hasInterpreterSegmentScriptHint,
|
|
2277
|
-
hasInterpreterPipelineScriptHint,
|
|
2278
|
-
isDirectInterpreterCommand
|
|
2279
|
-
};
|
|
2280
|
-
}
|
|
2281
|
-
async function validateScriptFileForShellBleed(params) {
|
|
2282
|
-
const target = extractScriptTargetFromCommand(params.command);
|
|
2283
|
-
if (!target) {
|
|
2284
|
-
const { hasInterpreterInvocation, hasComplexSyntax, hasProcessSubstitution, hasInterpreterSegmentScriptHint, hasInterpreterPipelineScriptHint, isDirectInterpreterCommand } = shouldFailClosedInterpreterPreflight(params.command);
|
|
2285
|
-
if (hasInterpreterInvocation && hasComplexSyntax && (hasInterpreterSegmentScriptHint || hasInterpreterPipelineScriptHint || hasProcessSubstitution && isDirectInterpreterCommand)) throw new Error("exec preflight: complex interpreter invocation detected; refusing to run without script preflight validation. Use a direct `python <file>.py` or `node <file>.js` command.");
|
|
2286
|
-
return;
|
|
2287
|
-
}
|
|
2288
|
-
const fsSafe = await loadFsSafeModule();
|
|
2289
|
-
const { FsSafeError, root: fsRoot } = fsSafe;
|
|
2290
|
-
const workspaceRoot = await fsRoot(params.workdir);
|
|
2291
|
-
for (const relOrAbsPath of target.relOrAbsPaths) {
|
|
2292
|
-
const absPath = path.isAbsolute(relOrAbsPath) ? path.resolve(relOrAbsPath) : path.resolve(params.workdir, relOrAbsPath);
|
|
2293
|
-
const relativePath = resolvePreflightRelativePath({
|
|
2294
|
-
rootDir: params.workdir,
|
|
2295
|
-
absPath
|
|
2296
|
-
});
|
|
2297
|
-
if (!relativePath) continue;
|
|
2298
|
-
let content;
|
|
2299
|
-
try {
|
|
2300
|
-
content = hasLeadingTildePathSegment(relativePath) ? await readLiteralTildePreflightScript({
|
|
2301
|
-
absPath,
|
|
2302
|
-
fsSafe,
|
|
2303
|
-
workspaceRoot
|
|
2304
|
-
}) : (await workspaceRoot.read(relativePath, {
|
|
2305
|
-
nonBlockingRead: true,
|
|
2306
|
-
symlinks: "follow-within-root",
|
|
2307
|
-
maxBytes: SCRIPT_PREFLIGHT_MAX_BYTES
|
|
2308
|
-
})).buffer.toString("utf-8");
|
|
2309
|
-
} catch (error) {
|
|
2310
|
-
if (shouldSkipScriptPreflightPathError(error, FsSafeError)) continue;
|
|
2311
|
-
throw error;
|
|
2312
|
-
}
|
|
2313
|
-
const first = /\$[A-Z_][A-Z0-9_]{1,}/g.exec(content);
|
|
2314
|
-
if (first) {
|
|
2315
|
-
const idx = first.index;
|
|
2316
|
-
const line = content.slice(0, idx).split("\n").length;
|
|
2317
|
-
const token = first[0];
|
|
2318
|
-
throw new Error([
|
|
2319
|
-
`exec preflight: detected likely shell variable injection (${token}) in ${target.kind} script: ${path.basename(absPath)}:${line}.`,
|
|
2320
|
-
target.kind === "python" ? `In Python, use os.environ.get(${JSON.stringify(token.slice(1))}) instead of raw ${token}.` : `In Node.js, use process.env[${JSON.stringify(token.slice(1))}] instead of raw ${token}.`,
|
|
2321
|
-
"(If this is inside a string literal on purpose, escape it or restructure the code.)"
|
|
2322
|
-
].join("\n"));
|
|
2323
|
-
}
|
|
2324
|
-
if (target.kind === "node") {
|
|
2325
|
-
const firstNonEmpty = content.split(/\r?\n/).map((l) => l.trim()).find((l) => l.length > 0);
|
|
2326
|
-
if (firstNonEmpty && /^NODE\b/.test(firstNonEmpty)) throw new Error(`exec preflight: JS file starts with shell syntax (${firstNonEmpty}). This looks like a shell command, not JavaScript.`);
|
|
2327
|
-
}
|
|
2328
|
-
}
|
|
2329
|
-
}
|
|
2330
|
-
function shouldSkipExecScriptPreflight(params) {
|
|
2331
|
-
return params.host === "gateway" && params.security === "full" && params.ask === "off";
|
|
2332
|
-
}
|
|
2333
|
-
function parseExecApprovalShellCommand(raw) {
|
|
2334
|
-
const match = raw.trimStart().match(/^\/approve(?:@[^\s]+)?\s+([A-Za-z0-9][A-Za-z0-9._:-]*)\s+(allow-once|allow-always|always|deny)\b/i);
|
|
2335
|
-
if (!match) return null;
|
|
2336
|
-
return {
|
|
2337
|
-
approvalId: match[1],
|
|
2338
|
-
decision: normalizeLowercaseStringOrEmpty(match[2]) === "always" ? "allow-always" : normalizeLowercaseStringOrEmpty(match[2])
|
|
2339
|
-
};
|
|
2340
|
-
}
|
|
2341
|
-
function normalizeCommandBaseName(token) {
|
|
2342
|
-
if (!token) return "";
|
|
2343
|
-
return normalizeLowercaseStringOrEmpty(token.split(/[\\/]/u).at(-1)).replace(/\.(?:cmd|exe)$/u, "");
|
|
2344
|
-
}
|
|
2345
|
-
function stripFengMingPackageRunner(argv) {
|
|
2346
|
-
const commandName = normalizeCommandBaseName(argv[0]);
|
|
2347
|
-
if (commandName === "fengming") return argv;
|
|
2348
|
-
if ((commandName === "pnpm" || commandName === "npm" || commandName === "yarn") && normalizeCommandBaseName(argv[1]) === "fengming") return argv.slice(1);
|
|
2349
|
-
if ((commandName === "pnpm" || commandName === "npm" || commandName === "yarn") && (argv[1] === "exec" || argv[1] === "dlx" || argv[1] === "run") && normalizeCommandBaseName(argv[2]) === "fengming") return argv.slice(2);
|
|
2350
|
-
if (commandName === "npx" || commandName === "bunx") {
|
|
2351
|
-
let idx = 1;
|
|
2352
|
-
while (idx < argv.length) {
|
|
2353
|
-
const token = argv[idx];
|
|
2354
|
-
if (token === "--") {
|
|
2355
|
-
idx += 1;
|
|
2356
|
-
break;
|
|
2357
|
-
}
|
|
2358
|
-
if (!token.startsWith("-") || token === "-") break;
|
|
2359
|
-
idx += 1;
|
|
2360
|
-
if ((token === "-p" || token === "--package") && idx < argv.length) idx += 1;
|
|
2361
|
-
}
|
|
2362
|
-
if (normalizeCommandBaseName(argv[idx]) === "fengming") return argv.slice(idx);
|
|
2363
|
-
}
|
|
2364
|
-
return argv;
|
|
2365
|
-
}
|
|
2366
|
-
function parseFengMingChannelsLoginShellCommand(raw) {
|
|
2367
|
-
const argv = splitShellArgs(raw);
|
|
2368
|
-
if (!argv) return false;
|
|
2369
|
-
const fengmingArgv = stripFengMingPackageRunner(argv);
|
|
2370
|
-
return normalizeCommandBaseName(fengmingArgv[0]) === "fengming" && (fengmingArgv[1] === "channels" || fengmingArgv[1] === "channel") && fengmingArgv[2] === "login";
|
|
2371
|
-
}
|
|
2372
|
-
function rejectUnsafeControlShellCommand(command) {
|
|
2373
|
-
const rawCommand = command.trim();
|
|
2374
|
-
const analysis = analyzeShellCommand({ command: rawCommand });
|
|
2375
|
-
const candidates = analysis.ok ? analysis.segments.flatMap((segment) => buildCommandPayloadCandidates(segment.argv)) : normalizeStringEntries(rawCommand.split(/\r?\n/)).flatMap((line) => {
|
|
2376
|
-
const argv = splitShellArgs(line);
|
|
2377
|
-
return argv ? buildCommandPayloadCandidates(argv) : [line];
|
|
2378
|
-
});
|
|
2379
|
-
for (const candidate of candidates) {
|
|
2380
|
-
if (parseExecApprovalShellCommand(candidate)) throw new Error(["exec cannot run /approve commands.", "Show the /approve command to the user as chat text, or route it through the approval command handler instead of shell execution."].join(" "));
|
|
2381
|
-
if (parseFengMingChannelsLoginShellCommand(candidate)) throw new Error(["exec cannot run interactive FengMing channel login commands.", "Run `fengming channels login` in a terminal on the gateway host, or use the channel-specific login agent tool when available (for WhatsApp: `whatsapp_login`)."].join(" "));
|
|
2382
|
-
}
|
|
2383
|
-
}
|
|
2384
|
-
function resolveExecReviewerDefaults(params) {
|
|
2385
|
-
if (params.defaults?.reviewer) return params.defaults.reviewer;
|
|
2386
|
-
const cfg = params.defaults?.config;
|
|
2387
|
-
const agentId = params.agentId ? normalizeAgentId(params.agentId) : void 0;
|
|
2388
|
-
return (agentId ? cfg?.agents?.list?.find((entry) => normalizeAgentId(entry.id) === agentId)?.tools?.exec : void 0)?.reviewer ?? cfg?.tools?.exec?.reviewer;
|
|
2389
|
-
}
|
|
2390
|
-
function createExecTool(defaults) {
|
|
2391
|
-
const defaultBackgroundMs = clampWithDefault(defaults?.backgroundMs ?? readEnvInt("FENGMING_BASH_YIELD_MS", "PI_BASH_YIELD_MS"), 1e4, 10, 12e4);
|
|
2392
|
-
const allowBackground = defaults?.allowBackground ?? true;
|
|
2393
|
-
const defaultTimeoutSec = typeof defaults?.timeoutSec === "number" && defaults.timeoutSec > 0 ? defaults.timeoutSec : 1800;
|
|
2394
|
-
const defaultPathPrepend = normalizePathPrepend(defaults?.pathPrepend);
|
|
2395
|
-
const { safeBins, safeBinProfiles, trustedSafeBinDirs, unprofiledSafeBins, unprofiledInterpreterSafeBins } = resolveExecSafeBinRuntimePolicy({
|
|
2396
|
-
local: {
|
|
2397
|
-
safeBins: defaults?.safeBins,
|
|
2398
|
-
safeBinTrustedDirs: defaults?.safeBinTrustedDirs,
|
|
2399
|
-
safeBinProfiles: defaults?.safeBinProfiles
|
|
2400
|
-
},
|
|
2401
|
-
onWarning: (message) => {
|
|
2402
|
-
logInfo(message);
|
|
2403
|
-
}
|
|
2404
|
-
});
|
|
2405
|
-
if (unprofiledSafeBins.length > 0) logInfo(`exec: ignoring unprofiled safeBins entries (${unprofiledSafeBins.toSorted().join(", ")}); use allowlist or define tools.exec.safeBinProfiles.<bin>`);
|
|
2406
|
-
if (unprofiledInterpreterSafeBins.length > 0) logInfo(`exec: interpreter/runtime binaries in safeBins (${unprofiledInterpreterSafeBins.join(", ")}) are unsafe without explicit hardened profiles; prefer allowlist entries`);
|
|
2407
|
-
const notifyOnExit = defaults?.notifyOnExit !== false;
|
|
2408
|
-
const notifyOnExitEmptySuccess = defaults?.notifyOnExitEmptySuccess === true;
|
|
2409
|
-
const notifySessionKey = normalizeOptionalString(defaults?.sessionKey);
|
|
2410
|
-
const notifyDeliveryContext = normalizeDeliveryContext({
|
|
2411
|
-
channel: defaults?.messageProvider,
|
|
2412
|
-
to: defaults?.currentChannelId,
|
|
2413
|
-
accountId: defaults?.accountId,
|
|
2414
|
-
threadId: defaults?.currentThreadTs
|
|
2415
|
-
});
|
|
2416
|
-
const approvalRunningNoticeMs = resolveApprovalRunningNoticeMs(defaults?.approvalRunningNoticeMs);
|
|
2417
|
-
const parsedAgentSession = parseAgentSessionKey(defaults?.sessionKey);
|
|
2418
|
-
const agentId = defaults?.agentId ?? (parsedAgentSession ? resolveAgentIdFromSessionKey(defaults?.sessionKey) : void 0);
|
|
2419
|
-
const autoReviewer = defaults?.autoReviewer ?? createModelExecAutoReviewer({
|
|
2420
|
-
cfg: defaults?.config,
|
|
2421
|
-
agentId,
|
|
2422
|
-
reviewer: resolveExecReviewerDefaults({
|
|
2423
|
-
defaults,
|
|
2424
|
-
agentId
|
|
2425
|
-
})
|
|
2426
|
-
});
|
|
2427
|
-
return {
|
|
2428
|
-
name: "exec",
|
|
2429
|
-
label: "exec",
|
|
2430
|
-
displaySummary: EXEC_TOOL_DISPLAY_SUMMARY,
|
|
2431
|
-
get description() {
|
|
2432
|
-
return describeExecTool({
|
|
2433
|
-
agentId,
|
|
2434
|
-
hasCronTool: defaults?.hasCronTool === true
|
|
2435
|
-
});
|
|
2436
|
-
},
|
|
2437
|
-
parameters: execSchema,
|
|
2438
|
-
execute: async (_toolCallId, args, signal, onUpdate) => {
|
|
2439
|
-
const params = args;
|
|
2440
|
-
if (!params.command) throw new Error("Provide a command to start.");
|
|
2441
|
-
const maxOutput = DEFAULT_MAX_OUTPUT;
|
|
2442
|
-
const pendingMaxOutput = DEFAULT_PENDING_MAX_OUTPUT;
|
|
2443
|
-
const warnings = [];
|
|
2444
|
-
const approvalWarningText = normalizeOptionalString(defaults?.approvalWarningText);
|
|
2445
|
-
if (approvalWarningText) warnings.push(approvalWarningText);
|
|
2446
|
-
let execCommandOverride;
|
|
2447
|
-
const backgroundRequested = params.background === true;
|
|
2448
|
-
const yieldRequested = typeof params.yieldMs === "number";
|
|
2449
|
-
if (!allowBackground && (backgroundRequested || yieldRequested)) warnings.push("Warning: background execution is disabled; running synchronously.");
|
|
2450
|
-
const yieldWindow = allowBackground ? backgroundRequested ? 0 : clampWithDefault(params.yieldMs ?? defaultBackgroundMs, defaultBackgroundMs, 10, 12e4) : null;
|
|
2451
|
-
const elevatedDefaults = defaults?.elevated;
|
|
2452
|
-
const elevatedAllowed = Boolean(elevatedDefaults?.enabled && elevatedDefaults.allowed);
|
|
2453
|
-
const elevatedDefaultMode = elevatedDefaults?.defaultLevel === "full" ? "full" : elevatedDefaults?.defaultLevel === "ask" ? "ask" : elevatedDefaults?.defaultLevel === "on" ? "ask" : "off";
|
|
2454
|
-
const effectiveDefaultMode = elevatedAllowed ? elevatedDefaultMode : "off";
|
|
2455
|
-
const elevatedMode = typeof params.elevated === "boolean" ? params.elevated ? elevatedDefaultMode === "full" ? "full" : "ask" : "off" : effectiveDefaultMode;
|
|
2456
|
-
const elevatedRequested = elevatedMode !== "off";
|
|
2457
|
-
if (elevatedRequested) {
|
|
2458
|
-
if (!elevatedDefaults?.enabled || !elevatedDefaults.allowed) {
|
|
2459
|
-
const runtime = defaults?.sandbox ? "sandboxed" : "direct";
|
|
2460
|
-
const gates = [];
|
|
2461
|
-
const contextParts = [];
|
|
2462
|
-
const provider = normalizeOptionalString(defaults?.messageProvider);
|
|
2463
|
-
const sessionKey = normalizeOptionalString(defaults?.sessionKey);
|
|
2464
|
-
if (provider) contextParts.push(`provider=${provider}`);
|
|
2465
|
-
if (sessionKey) contextParts.push(`session=${sessionKey}`);
|
|
2466
|
-
if (!elevatedDefaults?.enabled) gates.push("enabled (tools.elevated.enabled / agents.list[].tools.elevated.enabled)");
|
|
2467
|
-
else gates.push("allowFrom (tools.elevated.allowFrom.<provider> / agents.list[].tools.elevated.allowFrom.<provider>)");
|
|
2468
|
-
throw new Error([
|
|
2469
|
-
`elevated is not available right now (runtime=${runtime}).`,
|
|
2470
|
-
`Failing gates: ${gates.join(", ")}`,
|
|
2471
|
-
contextParts.length > 0 ? `Context: ${contextParts.join(" ")}` : void 0,
|
|
2472
|
-
"Fix-it keys:",
|
|
2473
|
-
"- tools.elevated.enabled",
|
|
2474
|
-
"- tools.elevated.allowFrom.<provider>",
|
|
2475
|
-
"- agents.list[].tools.elevated.enabled",
|
|
2476
|
-
"- agents.list[].tools.elevated.allowFrom.<provider>"
|
|
2477
|
-
].filter(Boolean).join("\n"));
|
|
2478
|
-
}
|
|
2479
|
-
}
|
|
2480
|
-
if (elevatedRequested) logInfo(`exec: elevated command ${truncateMiddle(params.command, 120)}`);
|
|
2481
|
-
const requestedTarget = requireValidExecTarget(params.host);
|
|
2482
|
-
const target = resolveExecTarget({
|
|
2483
|
-
configuredTarget: defaults?.host,
|
|
2484
|
-
requestedTarget,
|
|
2485
|
-
elevatedRequested,
|
|
2486
|
-
sandboxAvailable: Boolean(defaults?.sandbox)
|
|
2487
|
-
});
|
|
2488
|
-
const host = target.effectiveHost;
|
|
2489
|
-
const explicitSecurity = defaults?.security;
|
|
2490
|
-
const configuredSecurity = explicitSecurity ?? (host === "sandbox" ? "deny" : "full");
|
|
2491
|
-
const modePolicy = resolveExecModePolicy({
|
|
2492
|
-
mode: defaults?.mode,
|
|
2493
|
-
security: configuredSecurity,
|
|
2494
|
-
ask: defaults?.ask ?? "off"
|
|
2495
|
-
});
|
|
2496
|
-
const approvalPolicy = host === "sandbox" ? void 0 : resolveExecApprovalsFromFile({
|
|
2497
|
-
file: loadExecApprovals(),
|
|
2498
|
-
agentId,
|
|
2499
|
-
overrides: {
|
|
2500
|
-
security: "full",
|
|
2501
|
-
ask: "off"
|
|
2502
|
-
}
|
|
2503
|
-
}).agent;
|
|
2504
|
-
let security = minSecurity(modePolicy.security, approvalPolicy?.security ?? modePolicy.security);
|
|
2505
|
-
if (security === "deny" && (host !== "sandbox" || defaults?.mode === "deny" || explicitSecurity === "deny")) throw new Error(`exec denied: host=${host} security=deny`);
|
|
2506
|
-
const hostPolicyAllowsFullBypass = (approvalPolicy?.security ?? "full") === "full" && (approvalPolicy?.ask ?? "off") === "off";
|
|
2507
|
-
const modePolicyAllowsFullBypass = modePolicy.security === "full" && modePolicy.ask === "off";
|
|
2508
|
-
if (elevatedRequested && elevatedMode === "full" && modePolicyAllowsFullBypass && hostPolicyAllowsFullBypass) security = "full";
|
|
2509
|
-
const requestedAsk = normalizeExecAsk(params.ask);
|
|
2510
|
-
const hostAsk = maxAsk(modePolicy.ask, approvalPolicy?.ask ?? modePolicy.ask);
|
|
2511
|
-
let ask = maxAsk(hostAsk, requestedAsk ?? hostAsk);
|
|
2512
|
-
const bypassApprovals = elevatedRequested && elevatedMode === "full" && modePolicyAllowsFullBypass && hostPolicyAllowsFullBypass;
|
|
2513
|
-
if (bypassApprovals) ask = "off";
|
|
2514
|
-
const autoReview = modePolicy.autoReview && ask === modePolicy.ask && !bypassApprovals;
|
|
2515
|
-
const sandbox = host === "sandbox" ? defaults?.sandbox : void 0;
|
|
2516
|
-
if (target.selectedTarget === "sandbox" && !sandbox) throw new Error(["exec host=sandbox requires a sandbox runtime for this session.", "Enable sandbox mode (`agents.defaults.sandbox.mode=\"non-main\"` or `\"all\"`) or use host=auto/gateway/node."].join("\n"));
|
|
2517
|
-
const explicitWorkdir = normalizeOptionalString(params.workdir);
|
|
2518
|
-
const defaultWorkdir = normalizeOptionalString(defaults?.cwd);
|
|
2519
|
-
let workdir;
|
|
2520
|
-
let containerWorkdir = sandbox?.containerWorkdir;
|
|
2521
|
-
if (sandbox) {
|
|
2522
|
-
const resolved = await resolveSandboxWorkdir({
|
|
2523
|
-
workdir: explicitWorkdir ?? defaultWorkdir ?? process.cwd(),
|
|
2524
|
-
sandbox,
|
|
2525
|
-
warnings
|
|
2526
|
-
});
|
|
2527
|
-
workdir = resolved.hostWorkdir;
|
|
2528
|
-
containerWorkdir = resolved.containerWorkdir;
|
|
2529
|
-
} else if (host === "node") workdir = explicitWorkdir;
|
|
2530
|
-
else workdir = resolveWorkdir(explicitWorkdir ?? defaultWorkdir ?? process.cwd(), warnings);
|
|
2531
|
-
rejectUnsafeControlShellCommand(params.command);
|
|
2532
|
-
const inheritedBaseEnv = coerceEnv(process.env);
|
|
2533
|
-
const hostEnvResult = host === "sandbox" ? null : sanitizeHostExecEnvWithDiagnostics({
|
|
2534
|
-
baseEnv: inheritedBaseEnv,
|
|
2535
|
-
overrides: params.env,
|
|
2536
|
-
blockPathOverrides: true
|
|
2537
|
-
});
|
|
2538
|
-
if (hostEnvResult && params.env && (hostEnvResult.rejectedOverrideBlockedKeys.length > 0 || hostEnvResult.rejectedOverrideInvalidKeys.length > 0)) {
|
|
2539
|
-
const blockedKeys = hostEnvResult.rejectedOverrideBlockedKeys;
|
|
2540
|
-
const invalidKeys = hostEnvResult.rejectedOverrideInvalidKeys;
|
|
2541
|
-
const pathBlocked = blockedKeys.includes("PATH");
|
|
2542
|
-
if (pathBlocked && blockedKeys.length === 1 && invalidKeys.length === 0) throw new Error("Security Violation: Custom 'PATH' variable is forbidden during host execution.");
|
|
2543
|
-
if (blockedKeys.length === 1 && invalidKeys.length === 0) throw new Error(`Security Violation: Environment variable '${blockedKeys[0]}' is forbidden during host execution.`);
|
|
2544
|
-
const details = [];
|
|
2545
|
-
if (blockedKeys.length > 0) details.push(`blocked override keys: ${blockedKeys.join(", ")}`);
|
|
2546
|
-
if (invalidKeys.length > 0) details.push(`invalid non-portable override keys: ${invalidKeys.join(", ")}`);
|
|
2547
|
-
const suffix = details.join("; ");
|
|
2548
|
-
if (pathBlocked) throw new Error(`Security Violation: Custom 'PATH' variable is forbidden during host execution (${suffix}).`);
|
|
2549
|
-
throw new Error(`Security Violation: ${suffix}.`);
|
|
2550
|
-
}
|
|
2551
|
-
const env = sandbox && host === "sandbox" ? buildSandboxEnv({
|
|
2552
|
-
defaultPath: DEFAULT_PATH,
|
|
2553
|
-
paramsEnv: params.env,
|
|
2554
|
-
sandboxEnv: sandbox.env,
|
|
2555
|
-
containerWorkdir: containerWorkdir ?? sandbox.containerWorkdir
|
|
2556
|
-
}) : hostEnvResult?.env ?? inheritedBaseEnv;
|
|
2557
|
-
if (!sandbox && host === "gateway" && !params.env?.PATH) applyShellPath(env, getShellPathFromLoginShell({
|
|
2558
|
-
env: process.env,
|
|
2559
|
-
timeoutMs: resolveShellEnvFallbackTimeoutMs(process.env)
|
|
2560
|
-
}));
|
|
2561
|
-
if (host === "node" && defaultPathPrepend.length > 0) warnings.push("Warning: tools.exec.pathPrepend is ignored for host=node. Configure PATH on the node host/service instead.");
|
|
2562
|
-
else applyPathPrepend(env, defaultPathPrepend);
|
|
2563
|
-
if (host === "node") return executeNodeHostCommand({
|
|
2564
|
-
command: params.command,
|
|
2565
|
-
workdir,
|
|
2566
|
-
env,
|
|
2567
|
-
requestedEnv: params.env,
|
|
2568
|
-
requestedNode: params.node?.trim(),
|
|
2569
|
-
boundNode: defaults?.node?.trim(),
|
|
2570
|
-
sessionKey: defaults?.sessionKey,
|
|
2571
|
-
bashElevated: elevatedDefaults,
|
|
2572
|
-
turnSourceChannel: defaults?.messageProvider,
|
|
2573
|
-
turnSourceTo: defaults?.currentChannelId,
|
|
2574
|
-
turnSourceAccountId: defaults?.accountId,
|
|
2575
|
-
turnSourceThreadId: defaults?.currentThreadTs,
|
|
2576
|
-
agentId,
|
|
2577
|
-
security,
|
|
2578
|
-
ask,
|
|
2579
|
-
autoReview,
|
|
2580
|
-
autoReviewer,
|
|
2581
|
-
strictInlineEval: defaults?.strictInlineEval,
|
|
2582
|
-
commandHighlighting: defaults?.commandHighlighting,
|
|
2583
|
-
trigger: defaults?.trigger,
|
|
2584
|
-
timeoutSec: params.timeout,
|
|
2585
|
-
defaultTimeoutSec,
|
|
2586
|
-
approvalRunningNoticeMs,
|
|
2587
|
-
warnings,
|
|
2588
|
-
notifySessionKey,
|
|
2589
|
-
notifyOnExit,
|
|
2590
|
-
trustedSafeBinDirs
|
|
2591
|
-
});
|
|
2592
|
-
if (!workdir) throw new Error("exec internal error: local execution requires a resolved workdir");
|
|
2593
|
-
if (host === "gateway" && !bypassApprovals) {
|
|
2594
|
-
const gatewayResult = await processGatewayAllowlist({
|
|
2595
|
-
command: params.command,
|
|
2596
|
-
workdir,
|
|
2597
|
-
env,
|
|
2598
|
-
pathPrepend: defaultPathPrepend,
|
|
2599
|
-
requestedEnv: params.env,
|
|
2600
|
-
pty: params.pty === true && !sandbox,
|
|
2601
|
-
timeoutSec: params.timeout,
|
|
2602
|
-
defaultTimeoutSec,
|
|
2603
|
-
security,
|
|
2604
|
-
ask,
|
|
2605
|
-
autoReview,
|
|
2606
|
-
autoReviewer,
|
|
2607
|
-
safeBins,
|
|
2608
|
-
safeBinProfiles,
|
|
2609
|
-
strictInlineEval: defaults?.strictInlineEval,
|
|
2610
|
-
commandHighlighting: defaults?.commandHighlighting,
|
|
2611
|
-
trigger: defaults?.trigger,
|
|
2612
|
-
agentId,
|
|
2613
|
-
sessionKey: defaults?.sessionKey,
|
|
2614
|
-
bashElevated: elevatedDefaults,
|
|
2615
|
-
turnSourceChannel: defaults?.messageProvider,
|
|
2616
|
-
turnSourceTo: defaults?.currentChannelId,
|
|
2617
|
-
turnSourceAccountId: defaults?.accountId,
|
|
2618
|
-
turnSourceThreadId: defaults?.currentThreadTs,
|
|
2619
|
-
scopeKey: defaults?.scopeKey,
|
|
2620
|
-
approvalFollowupText: defaults?.approvalFollowupText,
|
|
2621
|
-
approvalFollowup: defaults?.approvalFollowup,
|
|
2622
|
-
approvalFollowupMode: defaults?.approvalFollowupMode,
|
|
2623
|
-
warnings,
|
|
2624
|
-
notifySessionKey,
|
|
2625
|
-
approvalRunningNoticeMs,
|
|
2626
|
-
maxOutput,
|
|
2627
|
-
pendingMaxOutput,
|
|
2628
|
-
trustedSafeBinDirs
|
|
2629
|
-
});
|
|
2630
|
-
if (gatewayResult.pendingResult) return gatewayResult.pendingResult;
|
|
2631
|
-
if (gatewayResult.deniedResult) return gatewayResult.deniedResult;
|
|
2632
|
-
execCommandOverride = gatewayResult.execCommandOverride;
|
|
2633
|
-
if (gatewayResult.allowWithoutEnforcedCommand) execCommandOverride = void 0;
|
|
2634
|
-
}
|
|
2635
|
-
const effectiveTimeout = (typeof params.timeout === "number" ? params.timeout : null) ?? defaultTimeoutSec;
|
|
2636
|
-
const getWarningText = () => warnings.length ? `${warnings.join("\n")}\n\n` : "";
|
|
2637
|
-
const usePty = params.pty === true && !sandbox;
|
|
2638
|
-
if (!shouldSkipExecScriptPreflight({
|
|
2639
|
-
host,
|
|
2640
|
-
security,
|
|
2641
|
-
ask
|
|
2642
|
-
})) await validateScriptFileForShellBleed({
|
|
2643
|
-
command: params.command,
|
|
2644
|
-
workdir
|
|
2645
|
-
});
|
|
2646
|
-
const run = await runExecProcess({
|
|
2647
|
-
command: params.command,
|
|
2648
|
-
execCommand: execCommandOverride,
|
|
2649
|
-
workdir,
|
|
2650
|
-
env,
|
|
2651
|
-
pathPrepend: defaultPathPrepend,
|
|
2652
|
-
sandbox,
|
|
2653
|
-
containerWorkdir,
|
|
2654
|
-
usePty,
|
|
2655
|
-
warnings,
|
|
2656
|
-
maxOutput,
|
|
2657
|
-
pendingMaxOutput,
|
|
2658
|
-
notifyOnExit,
|
|
2659
|
-
notifyOnExitEmptySuccess,
|
|
2660
|
-
scopeKey: defaults?.scopeKey,
|
|
2661
|
-
sessionKey: notifySessionKey,
|
|
2662
|
-
mainKey: defaults?.mainKey,
|
|
2663
|
-
sessionScope: defaults?.sessionScope,
|
|
2664
|
-
eventRouting: defaults?.eventRouting,
|
|
2665
|
-
notifyDeliveryContext,
|
|
2666
|
-
timeoutSec: effectiveTimeout,
|
|
2667
|
-
onUpdate
|
|
2668
|
-
});
|
|
2669
|
-
let yielded = false;
|
|
2670
|
-
let yieldTimer = null;
|
|
2671
|
-
let registeredAbortSignal = null;
|
|
2672
|
-
const onAbortSignal = () => {
|
|
2673
|
-
run.disableUpdates();
|
|
2674
|
-
if (yielded || run.session.backgrounded) return;
|
|
2675
|
-
run.kill();
|
|
2676
|
-
};
|
|
2677
|
-
const cleanupToolRunListeners = () => {
|
|
2678
|
-
if (registeredAbortSignal) {
|
|
2679
|
-
registeredAbortSignal.removeEventListener("abort", onAbortSignal);
|
|
2680
|
-
registeredAbortSignal = null;
|
|
2681
|
-
}
|
|
2682
|
-
if (yieldTimer) {
|
|
2683
|
-
clearTimeout(yieldTimer);
|
|
2684
|
-
yieldTimer = null;
|
|
2685
|
-
}
|
|
2686
|
-
};
|
|
2687
|
-
if (signal?.aborted) onAbortSignal();
|
|
2688
|
-
else if (signal) {
|
|
2689
|
-
signal.addEventListener("abort", onAbortSignal, { once: true });
|
|
2690
|
-
registeredAbortSignal = signal;
|
|
2691
|
-
}
|
|
2692
|
-
return new Promise((resolve, reject) => {
|
|
2693
|
-
const resolveRunning = () => {
|
|
2694
|
-
cleanupToolRunListeners();
|
|
2695
|
-
resolve({
|
|
2696
|
-
content: [{
|
|
2697
|
-
type: "text",
|
|
2698
|
-
text: `${getWarningText()}Command still running (session ${run.session.id}, pid ${run.session.pid ?? "n/a"}). Use process (list/poll/log/write/send-keys/submit/paste/kill/clear/remove) for follow-up.`
|
|
2699
|
-
}],
|
|
2700
|
-
details: {
|
|
2701
|
-
status: "running",
|
|
2702
|
-
sessionId: run.session.id,
|
|
2703
|
-
pid: run.session.pid ?? void 0,
|
|
2704
|
-
startedAt: run.startedAt,
|
|
2705
|
-
cwd: run.session.cwd,
|
|
2706
|
-
tail: run.session.tail
|
|
2707
|
-
}
|
|
2708
|
-
});
|
|
2709
|
-
};
|
|
2710
|
-
const onYieldNow = () => {
|
|
2711
|
-
if (yielded) return;
|
|
2712
|
-
yielded = true;
|
|
2713
|
-
markBackgrounded(run.session);
|
|
2714
|
-
resolveRunning();
|
|
2715
|
-
};
|
|
2716
|
-
if (allowBackground && yieldWindow !== null) if (yieldWindow === 0) onYieldNow();
|
|
2717
|
-
else yieldTimer = setTimeout(() => {
|
|
2718
|
-
if (yielded) return;
|
|
2719
|
-
yielded = true;
|
|
2720
|
-
markBackgrounded(run.session);
|
|
2721
|
-
resolveRunning();
|
|
2722
|
-
}, yieldWindow);
|
|
2723
|
-
run.promise.then((outcome) => {
|
|
2724
|
-
cleanupToolRunListeners();
|
|
2725
|
-
if (yielded || run.session.backgrounded) return;
|
|
2726
|
-
resolve(buildExecForegroundResult({
|
|
2727
|
-
outcome,
|
|
2728
|
-
cwd: run.session.cwd,
|
|
2729
|
-
warningText: getWarningText()
|
|
2730
|
-
}));
|
|
2731
|
-
}).catch((err) => {
|
|
2732
|
-
cleanupToolRunListeners();
|
|
2733
|
-
if (yielded || run.session.backgrounded) return;
|
|
2734
|
-
reject(err);
|
|
2735
|
-
});
|
|
2736
|
-
});
|
|
2737
|
-
}
|
|
2738
|
-
};
|
|
2739
|
-
}
|
|
2740
|
-
const execTool = createExecTool();
|
|
2741
|
-
//#endregion
|
|
2742
|
-
//#region src/agents/pty-keys.ts
|
|
2743
|
-
const ESC = "\x1B";
|
|
2744
|
-
const CR = "\r";
|
|
2745
|
-
const TAB = " ";
|
|
2746
|
-
const BACKSPACE = "";
|
|
2747
|
-
const BRACKETED_PASTE_START = `${ESC}[200~`;
|
|
2748
|
-
const BRACKETED_PASTE_END = `${ESC}[201~`;
|
|
2749
|
-
/** SS3 sequences for DECCKM application cursor key mode (smkx). */
|
|
2750
|
-
const DECCKM_SS3_KEYS = {
|
|
2751
|
-
up: `${ESC}OA`,
|
|
2752
|
-
down: `${ESC}OB`,
|
|
2753
|
-
right: `${ESC}OC`,
|
|
2754
|
-
left: `${ESC}OD`,
|
|
2755
|
-
home: `${ESC}OH`,
|
|
2756
|
-
end: `${ESC}OF`
|
|
2757
|
-
};
|
|
2758
|
-
const namedKeyMap = new Map([
|
|
2759
|
-
["enter", CR],
|
|
2760
|
-
["return", CR],
|
|
2761
|
-
["tab", TAB],
|
|
2762
|
-
["escape", ESC],
|
|
2763
|
-
["esc", ESC],
|
|
2764
|
-
["space", " "],
|
|
2765
|
-
["bspace", BACKSPACE],
|
|
2766
|
-
["backspace", BACKSPACE],
|
|
2767
|
-
["up", `${ESC}[A`],
|
|
2768
|
-
["down", `${ESC}[B`],
|
|
2769
|
-
["right", `${ESC}[C`],
|
|
2770
|
-
["left", `${ESC}[D`],
|
|
2771
|
-
["home", `${ESC}[1~`],
|
|
2772
|
-
["end", `${ESC}[4~`],
|
|
2773
|
-
["pageup", `${ESC}[5~`],
|
|
2774
|
-
["pgup", `${ESC}[5~`],
|
|
2775
|
-
["ppage", `${ESC}[5~`],
|
|
2776
|
-
["pagedown", `${ESC}[6~`],
|
|
2777
|
-
["pgdn", `${ESC}[6~`],
|
|
2778
|
-
["npage", `${ESC}[6~`],
|
|
2779
|
-
["insert", `${ESC}[2~`],
|
|
2780
|
-
["ic", `${ESC}[2~`],
|
|
2781
|
-
["delete", `${ESC}[3~`],
|
|
2782
|
-
["del", `${ESC}[3~`],
|
|
2783
|
-
["dc", `${ESC}[3~`],
|
|
2784
|
-
["btab", `${ESC}[Z`],
|
|
2785
|
-
["f1", `${ESC}OP`],
|
|
2786
|
-
["f2", `${ESC}OQ`],
|
|
2787
|
-
["f3", `${ESC}OR`],
|
|
2788
|
-
["f4", `${ESC}OS`],
|
|
2789
|
-
["f5", `${ESC}[15~`],
|
|
2790
|
-
["f6", `${ESC}[17~`],
|
|
2791
|
-
["f7", `${ESC}[18~`],
|
|
2792
|
-
["f8", `${ESC}[19~`],
|
|
2793
|
-
["f9", `${ESC}[20~`],
|
|
2794
|
-
["f10", `${ESC}[21~`],
|
|
2795
|
-
["f11", `${ESC}[23~`],
|
|
2796
|
-
["f12", `${ESC}[24~`],
|
|
2797
|
-
["kp/", `${ESC}Oo`],
|
|
2798
|
-
["kp*", `${ESC}Oj`],
|
|
2799
|
-
["kp-", `${ESC}Om`],
|
|
2800
|
-
["kp+", `${ESC}Ok`],
|
|
2801
|
-
["kp7", `${ESC}Ow`],
|
|
2802
|
-
["kp8", `${ESC}Ox`],
|
|
2803
|
-
["kp9", `${ESC}Oy`],
|
|
2804
|
-
["kp4", `${ESC}Ot`],
|
|
2805
|
-
["kp5", `${ESC}Ou`],
|
|
2806
|
-
["kp6", `${ESC}Ov`],
|
|
2807
|
-
["kp1", `${ESC}Oq`],
|
|
2808
|
-
["kp2", `${ESC}Or`],
|
|
2809
|
-
["kp3", `${ESC}Os`],
|
|
2810
|
-
["kp0", `${ESC}Op`],
|
|
2811
|
-
["kp.", `${ESC}On`],
|
|
2812
|
-
["kpenter", `${ESC}OM`]
|
|
2813
|
-
]);
|
|
2814
|
-
const modifiableNamedKeys = new Set([
|
|
2815
|
-
"up",
|
|
2816
|
-
"down",
|
|
2817
|
-
"left",
|
|
2818
|
-
"right",
|
|
2819
|
-
"home",
|
|
2820
|
-
"end",
|
|
2821
|
-
"pageup",
|
|
2822
|
-
"pgup",
|
|
2823
|
-
"ppage",
|
|
2824
|
-
"pagedown",
|
|
2825
|
-
"pgdn",
|
|
2826
|
-
"npage",
|
|
2827
|
-
"insert",
|
|
2828
|
-
"ic",
|
|
2829
|
-
"delete",
|
|
2830
|
-
"del",
|
|
2831
|
-
"dc"
|
|
2832
|
-
]);
|
|
2833
|
-
function hasCursorModeSensitiveKeys(request) {
|
|
2834
|
-
return request.keys?.some((raw) => {
|
|
2835
|
-
const token = raw.trim();
|
|
2836
|
-
if (!token) return false;
|
|
2837
|
-
const parsed = parseModifiers(token);
|
|
2838
|
-
if (hasAnyModifier(parsed.mods)) return false;
|
|
2839
|
-
return normalizeLowercaseStringOrEmpty(parsed.base) in DECCKM_SS3_KEYS;
|
|
2840
|
-
}) ?? false;
|
|
2841
|
-
}
|
|
2842
|
-
function encodeKeySequence(request, cursorKeyMode) {
|
|
2843
|
-
const warnings = [];
|
|
2844
|
-
let data = "";
|
|
2845
|
-
if (request.literal) data += request.literal;
|
|
2846
|
-
if (request.hex?.length) for (const raw of request.hex) {
|
|
2847
|
-
const byte = parseHexByte(raw);
|
|
2848
|
-
if (byte === null) {
|
|
2849
|
-
warnings.push(`Invalid hex byte: ${raw}`);
|
|
2850
|
-
continue;
|
|
2851
|
-
}
|
|
2852
|
-
data += String.fromCharCode(byte);
|
|
2853
|
-
}
|
|
2854
|
-
if (request.keys?.length) for (const token of request.keys) data += encodeKeyToken(token, warnings, cursorKeyMode);
|
|
2855
|
-
return {
|
|
2856
|
-
data,
|
|
2857
|
-
warnings
|
|
2858
|
-
};
|
|
2859
|
-
}
|
|
2860
|
-
function encodePaste(text, bracketed = true) {
|
|
2861
|
-
if (!bracketed) return text;
|
|
2862
|
-
return `${BRACKETED_PASTE_START}${text}${BRACKETED_PASTE_END}`;
|
|
2863
|
-
}
|
|
2864
|
-
function encodeKeyToken(raw, warnings, cursorKeyMode) {
|
|
2865
|
-
const token = raw.trim();
|
|
2866
|
-
if (!token) return "";
|
|
2867
|
-
if (token.length === 2 && token.startsWith("^")) {
|
|
2868
|
-
const ctrl = toCtrlChar(token[1]);
|
|
2869
|
-
if (ctrl) return ctrl;
|
|
2870
|
-
}
|
|
2871
|
-
const parsed = parseModifiers(token);
|
|
2872
|
-
const base = parsed.base;
|
|
2873
|
-
const baseLower = normalizeLowercaseStringOrEmpty(base);
|
|
2874
|
-
if (baseLower === "tab" && parsed.mods.shift) return `${ESC}[Z`;
|
|
2875
|
-
if (modifiableNamedKeys.has(baseLower) && cursorKeyMode === "application" && !hasAnyModifier(parsed.mods)) {
|
|
2876
|
-
const ss3Seq = DECCKM_SS3_KEYS[baseLower];
|
|
2877
|
-
if (ss3Seq) return ss3Seq;
|
|
2878
|
-
}
|
|
2879
|
-
const baseSeq = namedKeyMap.get(baseLower);
|
|
2880
|
-
if (baseSeq) {
|
|
2881
|
-
let seq = baseSeq;
|
|
2882
|
-
if (modifiableNamedKeys.has(baseLower) && hasAnyModifier(parsed.mods)) {
|
|
2883
|
-
const mod = xtermModifier(parsed.mods);
|
|
2884
|
-
if (mod > 1) {
|
|
2885
|
-
const modified = applyXtermModifier(seq, mod);
|
|
2886
|
-
if (modified) {
|
|
2887
|
-
seq = modified;
|
|
2888
|
-
return seq;
|
|
2889
|
-
}
|
|
2890
|
-
}
|
|
2891
|
-
}
|
|
2892
|
-
if (parsed.mods.alt) return `${ESC}${seq}`;
|
|
2893
|
-
return seq;
|
|
2894
|
-
}
|
|
2895
|
-
if (base.length === 1) return applyCharModifiers(base, parsed.mods);
|
|
2896
|
-
if (parsed.hasModifiers) warnings.push(`Unknown key "${base}" for modifiers; sending literal.`);
|
|
2897
|
-
return base;
|
|
2898
|
-
}
|
|
2899
|
-
function parseModifiers(token) {
|
|
2900
|
-
const mods = {
|
|
2901
|
-
ctrl: false,
|
|
2902
|
-
alt: false,
|
|
2903
|
-
shift: false
|
|
2904
|
-
};
|
|
2905
|
-
let rest = token;
|
|
2906
|
-
let sawModifiers = false;
|
|
2907
|
-
while (rest.length > 2 && rest[1] === "-") {
|
|
2908
|
-
const mod = normalizeLowercaseStringOrEmpty(rest[0]);
|
|
2909
|
-
if (mod === "c") mods.ctrl = true;
|
|
2910
|
-
else if (mod === "m") mods.alt = true;
|
|
2911
|
-
else if (mod === "s") mods.shift = true;
|
|
2912
|
-
else break;
|
|
2913
|
-
sawModifiers = true;
|
|
2914
|
-
rest = rest.slice(2);
|
|
2915
|
-
}
|
|
2916
|
-
return {
|
|
2917
|
-
mods,
|
|
2918
|
-
base: rest,
|
|
2919
|
-
hasModifiers: sawModifiers
|
|
2920
|
-
};
|
|
2921
|
-
}
|
|
2922
|
-
function applyCharModifiers(char, mods) {
|
|
2923
|
-
let value = char;
|
|
2924
|
-
if (mods.shift && value.length === 1 && /[a-z]/.test(value)) value = value.toUpperCase();
|
|
2925
|
-
if (mods.ctrl) {
|
|
2926
|
-
const ctrl = toCtrlChar(value);
|
|
2927
|
-
if (ctrl) value = ctrl;
|
|
2928
|
-
}
|
|
2929
|
-
if (mods.alt) value = `${ESC}${value}`;
|
|
2930
|
-
return value;
|
|
2931
|
-
}
|
|
2932
|
-
function toCtrlChar(char) {
|
|
2933
|
-
if (char.length !== 1) return null;
|
|
2934
|
-
if (char === "?") return "";
|
|
2935
|
-
const code = char.toUpperCase().charCodeAt(0);
|
|
2936
|
-
if (code >= 64 && code <= 95) return String.fromCharCode(code & 31);
|
|
2937
|
-
return null;
|
|
2938
|
-
}
|
|
2939
|
-
function xtermModifier(mods) {
|
|
2940
|
-
let mod = 1;
|
|
2941
|
-
if (mods.shift) mod += 1;
|
|
2942
|
-
if (mods.alt) mod += 2;
|
|
2943
|
-
if (mods.ctrl) mod += 4;
|
|
2944
|
-
return mod;
|
|
2945
|
-
}
|
|
2946
|
-
function applyXtermModifier(sequence, modifier) {
|
|
2947
|
-
const escPattern = escapeRegExp(ESC);
|
|
2948
|
-
const csiNumber = new RegExp(`^${escPattern}\\[(\\d+)([~A-Z])$`);
|
|
2949
|
-
const csiArrow = new RegExp(`^${escPattern}\\[(A|B|C|D|H|F)$`);
|
|
2950
|
-
const numberMatch = sequence.match(csiNumber);
|
|
2951
|
-
if (numberMatch) return `${ESC}[${numberMatch[1]};${modifier}${numberMatch[2]}`;
|
|
2952
|
-
const arrowMatch = sequence.match(csiArrow);
|
|
2953
|
-
if (arrowMatch) return `${ESC}[1;${modifier}${arrowMatch[1]}`;
|
|
2954
|
-
return null;
|
|
2955
|
-
}
|
|
2956
|
-
function hasAnyModifier(mods) {
|
|
2957
|
-
return mods.ctrl || mods.alt || mods.shift;
|
|
2958
|
-
}
|
|
2959
|
-
function parseHexByte(raw) {
|
|
2960
|
-
const lower = normalizeLowercaseStringOrEmpty(raw);
|
|
2961
|
-
const normalized = lower.startsWith("0x") ? lower.slice(2) : lower;
|
|
2962
|
-
if (!/^[0-9a-f]{1,2}$/.test(normalized)) return null;
|
|
2963
|
-
const value = Number.parseInt(normalized, 16);
|
|
2964
|
-
if (Number.isNaN(value) || value < 0 || value > 255) return null;
|
|
2965
|
-
return value;
|
|
2966
|
-
}
|
|
2967
|
-
//#endregion
|
|
2968
|
-
//#region src/agents/bash-tools.process-send-keys.ts
|
|
2969
|
-
function failText$1(text) {
|
|
2970
|
-
return {
|
|
2971
|
-
content: [{
|
|
2972
|
-
type: "text",
|
|
2973
|
-
text
|
|
2974
|
-
}],
|
|
2975
|
-
details: { status: "failed" }
|
|
2976
|
-
};
|
|
2977
|
-
}
|
|
2978
|
-
async function writeToStdin(stdin, data) {
|
|
2979
|
-
await new Promise((resolve, reject) => {
|
|
2980
|
-
stdin.write(data, (err) => {
|
|
2981
|
-
if (err) reject(err);
|
|
2982
|
-
else resolve();
|
|
2983
|
-
});
|
|
2984
|
-
});
|
|
2985
|
-
}
|
|
2986
|
-
async function handleProcessSendKeys(params) {
|
|
2987
|
-
const request = {
|
|
2988
|
-
keys: params.keys,
|
|
2989
|
-
hex: params.hex,
|
|
2990
|
-
literal: params.literal
|
|
2991
|
-
};
|
|
2992
|
-
if (params.session.cursorKeyMode === "unknown" && hasCursorModeSensitiveKeys(request)) return failText$1(`Session ${params.sessionId} cursor key mode is not known yet. Poll or log until startup output appears, then retry send-keys.`);
|
|
2993
|
-
const { data, warnings } = encodeKeySequence(request, params.session.cursorKeyMode === "unknown" ? void 0 : params.session.cursorKeyMode);
|
|
2994
|
-
if (!data) return failText$1("No key data provided.");
|
|
2995
|
-
await writeToStdin(params.stdin, data);
|
|
2996
|
-
return {
|
|
2997
|
-
content: [{
|
|
2998
|
-
type: "text",
|
|
2999
|
-
text: `Sent ${data.length} bytes to session ${params.sessionId}.` + (warnings.length ? `\nWarnings:\n- ${warnings.join("\n- ")}` : "")
|
|
3000
|
-
}],
|
|
3001
|
-
details: {
|
|
3002
|
-
status: "running",
|
|
3003
|
-
sessionId: params.sessionId,
|
|
3004
|
-
name: deriveSessionName(params.session.command)
|
|
3005
|
-
}
|
|
3006
|
-
};
|
|
3007
|
-
}
|
|
3008
|
-
//#endregion
|
|
3009
|
-
//#region src/agents/bash-tools.process.ts
|
|
3010
|
-
const DEFAULT_LOG_TAIL_LINES = 200;
|
|
3011
|
-
const DEFAULT_INPUT_WAIT_IDLE_MS = 15e3;
|
|
3012
|
-
const MIN_INPUT_WAIT_IDLE_MS = 1e3;
|
|
3013
|
-
const MAX_INPUT_WAIT_IDLE_MS = 600 * 1e3;
|
|
3014
|
-
function resolveLogSliceWindow(offset, limit) {
|
|
3015
|
-
const usingDefaultTail = offset === void 0 && limit === void 0;
|
|
3016
|
-
return {
|
|
3017
|
-
effectiveOffset: offset,
|
|
3018
|
-
effectiveLimit: typeof limit === "number" && Number.isFinite(limit) ? limit : usingDefaultTail ? DEFAULT_LOG_TAIL_LINES : void 0,
|
|
3019
|
-
usingDefaultTail
|
|
3020
|
-
};
|
|
3021
|
-
}
|
|
3022
|
-
function defaultTailNote(totalLines, usingDefaultTail) {
|
|
3023
|
-
if (!usingDefaultTail || totalLines <= DEFAULT_LOG_TAIL_LINES) return "";
|
|
3024
|
-
return `\n\n[showing last ${DEFAULT_LOG_TAIL_LINES} of ${totalLines} lines; pass offset/limit to page]`;
|
|
3025
|
-
}
|
|
3026
|
-
const MAX_POLL_WAIT_MS = 3e4;
|
|
3027
|
-
function resolveSessionStdin(session) {
|
|
3028
|
-
return session.stdin ?? session.child?.stdin;
|
|
3029
|
-
}
|
|
3030
|
-
function isWritableStdin(stdin) {
|
|
3031
|
-
if (!stdin || stdin.destroyed) return false;
|
|
3032
|
-
if (stdin.writable === false || stdin.writableEnded === true || stdin.writableFinished === true) return false;
|
|
3033
|
-
return true;
|
|
3034
|
-
}
|
|
3035
|
-
function runningSessionInputDetails(runtime) {
|
|
3036
|
-
return {
|
|
3037
|
-
stdinWritable: runtime.stdinWritable,
|
|
3038
|
-
waitingForInput: runtime.waitingForInput,
|
|
3039
|
-
idleMs: runtime.idleMs,
|
|
3040
|
-
lastOutputAt: runtime.lastOutputAt
|
|
3041
|
-
};
|
|
3042
|
-
}
|
|
3043
|
-
function resolvePollWaitMs(value) {
|
|
3044
|
-
if (typeof value === "number" && Number.isFinite(value)) return Math.max(0, Math.min(MAX_POLL_WAIT_MS, Math.floor(value)));
|
|
3045
|
-
if (typeof value === "string" && /^[+-]?\d+$/.test(value.trim())) {
|
|
3046
|
-
const parsed = Number(value.trim());
|
|
3047
|
-
if (Number.isSafeInteger(parsed)) return Math.max(0, Math.min(MAX_POLL_WAIT_MS, parsed));
|
|
3048
|
-
}
|
|
3049
|
-
return 0;
|
|
3050
|
-
}
|
|
3051
|
-
function failText(text) {
|
|
3052
|
-
return {
|
|
3053
|
-
content: [{
|
|
3054
|
-
type: "text",
|
|
3055
|
-
text
|
|
3056
|
-
}],
|
|
3057
|
-
details: { status: "failed" }
|
|
3058
|
-
};
|
|
3059
|
-
}
|
|
3060
|
-
function recordPollRetrySuggestion(sessionId, hasNewOutput) {
|
|
3061
|
-
try {
|
|
3062
|
-
return recordCommandPoll(getDiagnosticSessionState({ sessionId }), sessionId, hasNewOutput);
|
|
3063
|
-
} catch {
|
|
3064
|
-
return;
|
|
3065
|
-
}
|
|
3066
|
-
}
|
|
3067
|
-
function resetPollRetrySuggestion(sessionId) {
|
|
3068
|
-
try {
|
|
3069
|
-
resetCommandPollCount(getDiagnosticSessionState({ sessionId }), sessionId);
|
|
3070
|
-
} catch {}
|
|
3071
|
-
}
|
|
3072
|
-
function createAbortError(reason) {
|
|
3073
|
-
if (reason instanceof Error) return reason;
|
|
3074
|
-
const error = new Error(typeof reason === "string" ? reason : "Aborted");
|
|
3075
|
-
error.name = "AbortError";
|
|
3076
|
-
return error;
|
|
3077
|
-
}
|
|
3078
|
-
async function sleepPollInterval(ms, signal) {
|
|
3079
|
-
if (signal?.aborted) throw createAbortError(signal.reason);
|
|
3080
|
-
await new Promise((resolve, reject) => {
|
|
3081
|
-
let timer;
|
|
3082
|
-
let onAbort;
|
|
3083
|
-
const cleanup = () => {
|
|
3084
|
-
if (timer) clearTimeout(timer);
|
|
3085
|
-
if (onAbort) signal?.removeEventListener("abort", onAbort);
|
|
3086
|
-
};
|
|
3087
|
-
const onResolve = () => {
|
|
3088
|
-
cleanup();
|
|
3089
|
-
resolve();
|
|
3090
|
-
};
|
|
3091
|
-
onAbort = () => {
|
|
3092
|
-
cleanup();
|
|
3093
|
-
reject(createAbortError(signal?.reason));
|
|
3094
|
-
};
|
|
3095
|
-
timer = setTimeout(onResolve, ms);
|
|
3096
|
-
timer.unref?.();
|
|
3097
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
3098
|
-
});
|
|
3099
|
-
}
|
|
3100
|
-
function createProcessTool(defaults) {
|
|
3101
|
-
if (defaults?.cleanupMs !== void 0) setJobTtlMs(defaults.cleanupMs);
|
|
3102
|
-
const scopeKey = defaults?.scopeKey;
|
|
3103
|
-
const supervisor = getProcessSupervisor();
|
|
3104
|
-
const inputWaitIdleMs = clampWithDefault(defaults?.inputWaitIdleMs ?? readEnvInt("FENGMING_PROCESS_INPUT_WAIT_IDLE_MS"), DEFAULT_INPUT_WAIT_IDLE_MS, MIN_INPUT_WAIT_IDLE_MS, MAX_INPUT_WAIT_IDLE_MS);
|
|
3105
|
-
const isInScope = (session) => !scopeKey || session?.scopeKey === scopeKey;
|
|
3106
|
-
const describeRunningSession = (session) => {
|
|
3107
|
-
const lastOutputAt = supervisor.getRecord(session.id)?.lastOutputAtMs ?? session.startedAt;
|
|
3108
|
-
const idleMs = Math.max(0, Date.now() - lastOutputAt);
|
|
3109
|
-
const stdinWritable = isWritableStdin(resolveSessionStdin(session));
|
|
3110
|
-
return {
|
|
3111
|
-
stdinWritable,
|
|
3112
|
-
waitingForInput: stdinWritable && idleMs >= inputWaitIdleMs,
|
|
3113
|
-
idleMs,
|
|
3114
|
-
lastOutputAt
|
|
3115
|
-
};
|
|
3116
|
-
};
|
|
3117
|
-
const buildInputWaitHint = (runtime) => {
|
|
3118
|
-
if (!runtime?.waitingForInput) return "";
|
|
3119
|
-
return `\n\nNo new output for ${formatDurationCompact(runtime.idleMs) ?? `${runtime.idleMs}ms`}; this session may be waiting for input. Use process write, send-keys, submit, or paste to provide input.`;
|
|
3120
|
-
};
|
|
3121
|
-
const cancelManagedSession = (sessionId) => {
|
|
3122
|
-
const record = supervisor.getRecord(sessionId);
|
|
3123
|
-
if (!record || record.state === "exited") return false;
|
|
3124
|
-
supervisor.cancel(sessionId, "manual-cancel");
|
|
3125
|
-
return true;
|
|
3126
|
-
};
|
|
3127
|
-
const terminateSessionFallback = (session) => {
|
|
3128
|
-
const pid = session.pid ?? session.child?.pid;
|
|
3129
|
-
if (typeof pid !== "number" || !Number.isFinite(pid) || pid <= 0) return false;
|
|
3130
|
-
killProcessTree(pid);
|
|
3131
|
-
return true;
|
|
3132
|
-
};
|
|
3133
|
-
return {
|
|
3134
|
-
name: "process",
|
|
3135
|
-
label: "process",
|
|
3136
|
-
displaySummary: PROCESS_TOOL_DISPLAY_SUMMARY,
|
|
3137
|
-
description: describeProcessTool({ hasCronTool: defaults?.hasCronTool === true }),
|
|
3138
|
-
parameters: processSchema,
|
|
3139
|
-
execute: async (_toolCallId, args, signal, _onUpdate) => {
|
|
3140
|
-
const params = args;
|
|
3141
|
-
if (params.action === "list") {
|
|
3142
|
-
const running = listRunningSessions().filter((s) => isInScope(s)).map((s) => {
|
|
3143
|
-
const runtime = describeRunningSession(s);
|
|
3144
|
-
return {
|
|
3145
|
-
sessionId: s.id,
|
|
3146
|
-
status: "running",
|
|
3147
|
-
pid: s.pid ?? void 0,
|
|
3148
|
-
startedAt: s.startedAt,
|
|
3149
|
-
runtimeMs: Date.now() - s.startedAt,
|
|
3150
|
-
cwd: s.cwd,
|
|
3151
|
-
command: s.command,
|
|
3152
|
-
name: deriveSessionName(s.command),
|
|
3153
|
-
tail: s.tail,
|
|
3154
|
-
truncated: s.truncated,
|
|
3155
|
-
stdinWritable: runtime.stdinWritable,
|
|
3156
|
-
waitingForInput: runtime.waitingForInput,
|
|
3157
|
-
idleMs: runtime.idleMs,
|
|
3158
|
-
lastOutputAt: runtime.lastOutputAt
|
|
3159
|
-
};
|
|
3160
|
-
});
|
|
3161
|
-
const finished = listFinishedSessions().filter((s) => isInScope(s)).map((s) => ({
|
|
3162
|
-
sessionId: s.id,
|
|
3163
|
-
status: s.status,
|
|
3164
|
-
startedAt: s.startedAt,
|
|
3165
|
-
endedAt: s.endedAt,
|
|
3166
|
-
runtimeMs: s.endedAt - s.startedAt,
|
|
3167
|
-
cwd: s.cwd,
|
|
3168
|
-
command: s.command,
|
|
3169
|
-
name: deriveSessionName(s.command),
|
|
3170
|
-
tail: s.tail,
|
|
3171
|
-
truncated: s.truncated,
|
|
3172
|
-
exitCode: s.exitCode ?? void 0,
|
|
3173
|
-
exitSignal: s.exitSignal ?? void 0
|
|
3174
|
-
}));
|
|
3175
|
-
return {
|
|
3176
|
-
content: [{
|
|
3177
|
-
type: "text",
|
|
3178
|
-
text: [...running, ...finished].toSorted((a, b) => b.startedAt - a.startedAt).map((s) => {
|
|
3179
|
-
const label = s.name ? truncateMiddle(s.name, 80) : truncateMiddle(s.command, 120);
|
|
3180
|
-
const marker = "waitingForInput" in s && s.waitingForInput ? " [input-wait]" : "";
|
|
3181
|
-
return `${s.sessionId} ${pad(s.status, 9)} ${formatDurationCompact(s.runtimeMs) ?? "n/a"}${marker} :: ${label}`;
|
|
3182
|
-
}).join("\n") || "No running or recent sessions."
|
|
3183
|
-
}],
|
|
3184
|
-
details: {
|
|
3185
|
-
status: "completed",
|
|
3186
|
-
sessions: [...running, ...finished]
|
|
3187
|
-
}
|
|
3188
|
-
};
|
|
3189
|
-
}
|
|
3190
|
-
if (!params.sessionId) return {
|
|
3191
|
-
content: [{
|
|
3192
|
-
type: "text",
|
|
3193
|
-
text: "sessionId is required for this action."
|
|
3194
|
-
}],
|
|
3195
|
-
details: { status: "failed" }
|
|
3196
|
-
};
|
|
3197
|
-
const session = getSession(params.sessionId);
|
|
3198
|
-
const finished = getFinishedSession(params.sessionId);
|
|
3199
|
-
const scopedSession = isInScope(session) ? session : void 0;
|
|
3200
|
-
const scopedFinished = isInScope(finished) ? finished : void 0;
|
|
3201
|
-
const failedResult = (text) => ({
|
|
3202
|
-
content: [{
|
|
3203
|
-
type: "text",
|
|
3204
|
-
text
|
|
3205
|
-
}],
|
|
3206
|
-
details: { status: "failed" }
|
|
3207
|
-
});
|
|
3208
|
-
const resolveBackgroundedWritableStdin = () => {
|
|
3209
|
-
if (!scopedSession) return {
|
|
3210
|
-
ok: false,
|
|
3211
|
-
result: failedResult(`No active session found for ${params.sessionId}`)
|
|
3212
|
-
};
|
|
3213
|
-
if (!scopedSession.backgrounded) return {
|
|
3214
|
-
ok: false,
|
|
3215
|
-
result: failedResult(`Session ${params.sessionId} is not backgrounded.`)
|
|
3216
|
-
};
|
|
3217
|
-
const stdin = resolveSessionStdin(scopedSession);
|
|
3218
|
-
if (!isWritableStdin(stdin)) return {
|
|
3219
|
-
ok: false,
|
|
3220
|
-
result: failedResult(`Session ${params.sessionId} stdin is not writable.`)
|
|
3221
|
-
};
|
|
3222
|
-
return {
|
|
3223
|
-
ok: true,
|
|
3224
|
-
session: scopedSession,
|
|
3225
|
-
stdin
|
|
3226
|
-
};
|
|
3227
|
-
};
|
|
3228
|
-
const writeToStdin = async (stdin, data) => {
|
|
3229
|
-
await new Promise((resolve, reject) => {
|
|
3230
|
-
stdin.write(data, (err) => {
|
|
3231
|
-
if (err) reject(err);
|
|
3232
|
-
else resolve();
|
|
3233
|
-
});
|
|
3234
|
-
});
|
|
3235
|
-
};
|
|
3236
|
-
const runningSessionResult = (session, text) => ({
|
|
3237
|
-
content: [{
|
|
3238
|
-
type: "text",
|
|
3239
|
-
text
|
|
3240
|
-
}],
|
|
3241
|
-
details: {
|
|
3242
|
-
status: "running",
|
|
3243
|
-
sessionId: params.sessionId,
|
|
3244
|
-
name: deriveSessionName(session.command)
|
|
3245
|
-
}
|
|
3246
|
-
});
|
|
3247
|
-
switch (params.action) {
|
|
3248
|
-
case "poll": {
|
|
3249
|
-
if (!scopedSession) {
|
|
3250
|
-
if (scopedFinished) {
|
|
3251
|
-
resetPollRetrySuggestion(params.sessionId);
|
|
3252
|
-
return {
|
|
3253
|
-
content: [{
|
|
3254
|
-
type: "text",
|
|
3255
|
-
text: (scopedFinished.tail || `(no output recorded${scopedFinished.truncated ? " — truncated to cap" : ""})`) + `\n\nProcess exited with ${scopedFinished.exitSignal ? `signal ${scopedFinished.exitSignal}` : `code ${scopedFinished.exitCode ?? 0}`}.`
|
|
3256
|
-
}],
|
|
3257
|
-
details: {
|
|
3258
|
-
status: scopedFinished.status === "completed" ? "completed" : "failed",
|
|
3259
|
-
sessionId: params.sessionId,
|
|
3260
|
-
exitCode: scopedFinished.exitCode ?? void 0,
|
|
3261
|
-
aggregated: scopedFinished.aggregated,
|
|
3262
|
-
name: deriveSessionName(scopedFinished.command)
|
|
3263
|
-
}
|
|
3264
|
-
};
|
|
3265
|
-
}
|
|
3266
|
-
resetPollRetrySuggestion(params.sessionId);
|
|
3267
|
-
return failText(`No session found for ${params.sessionId}`);
|
|
3268
|
-
}
|
|
3269
|
-
if (!scopedSession.backgrounded) return failText(`Session ${params.sessionId} is not backgrounded.`);
|
|
3270
|
-
const pollWaitMs = resolvePollWaitMs(params.timeout);
|
|
3271
|
-
if (pollWaitMs > 0 && !scopedSession.exited) {
|
|
3272
|
-
const deadline = Date.now() + pollWaitMs;
|
|
3273
|
-
while (!scopedSession.exited && Date.now() < deadline) await sleepPollInterval(Math.max(0, Math.min(250, deadline - Date.now())), signal);
|
|
3274
|
-
}
|
|
3275
|
-
const { stdout, stderr } = drainSession(scopedSession);
|
|
3276
|
-
const exited = scopedSession.exited;
|
|
3277
|
-
const exitCode = scopedSession.exitCode ?? 0;
|
|
3278
|
-
const exitSignal = scopedSession.exitSignal ?? void 0;
|
|
3279
|
-
if (exited) {
|
|
3280
|
-
const status = exitCode === 0 && exitSignal == null ? "completed" : "failed";
|
|
3281
|
-
markExited(scopedSession, scopedSession.exitCode ?? null, scopedSession.exitSignal ?? null, status);
|
|
3282
|
-
}
|
|
3283
|
-
const status = exited ? exitCode === 0 && exitSignal == null ? "completed" : "failed" : "running";
|
|
3284
|
-
const output = [stdout.trimEnd(), stderr.trimEnd()].filter(Boolean).join("\n").trim();
|
|
3285
|
-
const hasNewOutput = output.length > 0;
|
|
3286
|
-
const retryInMs = exited ? void 0 : recordPollRetrySuggestion(params.sessionId, hasNewOutput);
|
|
3287
|
-
if (exited) resetPollRetrySuggestion(params.sessionId);
|
|
3288
|
-
const runtime = exited ? void 0 : describeRunningSession(scopedSession);
|
|
3289
|
-
return {
|
|
3290
|
-
content: [{
|
|
3291
|
-
type: "text",
|
|
3292
|
-
text: (output || "(no new output)") + (exited ? `\n\nProcess exited with ${exitSignal ? `signal ${exitSignal}` : `code ${exitCode}`}.` : buildInputWaitHint(runtime) || "\n\nProcess still running.")
|
|
3293
|
-
}],
|
|
3294
|
-
details: {
|
|
3295
|
-
status,
|
|
3296
|
-
sessionId: params.sessionId,
|
|
3297
|
-
exitCode: exited ? exitCode : void 0,
|
|
3298
|
-
aggregated: scopedSession.aggregated,
|
|
3299
|
-
name: deriveSessionName(scopedSession.command),
|
|
3300
|
-
...runtime ? runningSessionInputDetails(runtime) : {},
|
|
3301
|
-
...typeof retryInMs === "number" ? { retryInMs } : {}
|
|
3302
|
-
}
|
|
3303
|
-
};
|
|
3304
|
-
}
|
|
3305
|
-
case "log":
|
|
3306
|
-
if (scopedSession) {
|
|
3307
|
-
if (!scopedSession.backgrounded) return {
|
|
3308
|
-
content: [{
|
|
3309
|
-
type: "text",
|
|
3310
|
-
text: `Session ${params.sessionId} is not backgrounded.`
|
|
3311
|
-
}],
|
|
3312
|
-
details: { status: "failed" }
|
|
3313
|
-
};
|
|
3314
|
-
const window = resolveLogSliceWindow(params.offset, params.limit);
|
|
3315
|
-
const { slice, totalLines, totalChars } = sliceLogLines(scopedSession.aggregated, window.effectiveOffset, window.effectiveLimit);
|
|
3316
|
-
const runtime = describeRunningSession(scopedSession);
|
|
3317
|
-
const logDefaultTailNote = defaultTailNote(totalLines, window.usingDefaultTail);
|
|
3318
|
-
return {
|
|
3319
|
-
content: [{
|
|
3320
|
-
type: "text",
|
|
3321
|
-
text: (slice || "(no output yet)") + logDefaultTailNote + buildInputWaitHint(runtime)
|
|
3322
|
-
}],
|
|
3323
|
-
details: {
|
|
3324
|
-
status: scopedSession.exited ? "completed" : "running",
|
|
3325
|
-
sessionId: params.sessionId,
|
|
3326
|
-
total: totalLines,
|
|
3327
|
-
totalLines,
|
|
3328
|
-
totalChars,
|
|
3329
|
-
truncated: scopedSession.truncated,
|
|
3330
|
-
name: deriveSessionName(scopedSession.command),
|
|
3331
|
-
...runningSessionInputDetails(runtime)
|
|
3332
|
-
}
|
|
3333
|
-
};
|
|
3334
|
-
}
|
|
3335
|
-
if (scopedFinished) {
|
|
3336
|
-
const window = resolveLogSliceWindow(params.offset, params.limit);
|
|
3337
|
-
const { slice, totalLines, totalChars } = sliceLogLines(scopedFinished.aggregated, window.effectiveOffset, window.effectiveLimit);
|
|
3338
|
-
const status = scopedFinished.status === "completed" ? "completed" : "failed";
|
|
3339
|
-
const logDefaultTailNote = defaultTailNote(totalLines, window.usingDefaultTail);
|
|
3340
|
-
return {
|
|
3341
|
-
content: [{
|
|
3342
|
-
type: "text",
|
|
3343
|
-
text: (slice || "(no output recorded)") + logDefaultTailNote
|
|
3344
|
-
}],
|
|
3345
|
-
details: {
|
|
3346
|
-
status,
|
|
3347
|
-
sessionId: params.sessionId,
|
|
3348
|
-
total: totalLines,
|
|
3349
|
-
totalLines,
|
|
3350
|
-
totalChars,
|
|
3351
|
-
truncated: scopedFinished.truncated,
|
|
3352
|
-
exitCode: scopedFinished.exitCode ?? void 0,
|
|
3353
|
-
exitSignal: scopedFinished.exitSignal ?? void 0,
|
|
3354
|
-
name: deriveSessionName(scopedFinished.command)
|
|
3355
|
-
}
|
|
3356
|
-
};
|
|
3357
|
-
}
|
|
3358
|
-
return {
|
|
3359
|
-
content: [{
|
|
3360
|
-
type: "text",
|
|
3361
|
-
text: `No session found for ${params.sessionId}`
|
|
3362
|
-
}],
|
|
3363
|
-
details: { status: "failed" }
|
|
3364
|
-
};
|
|
3365
|
-
case "write": {
|
|
3366
|
-
const resolved = resolveBackgroundedWritableStdin();
|
|
3367
|
-
if (!resolved.ok) return resolved.result;
|
|
3368
|
-
await writeToStdin(resolved.stdin, params.data ?? "");
|
|
3369
|
-
if (params.eof) resolved.stdin.end();
|
|
3370
|
-
return runningSessionResult(resolved.session, `Wrote ${(params.data ?? "").length} bytes to session ${params.sessionId}${params.eof ? " (stdin closed)" : ""}.`);
|
|
3371
|
-
}
|
|
3372
|
-
case "send-keys": {
|
|
3373
|
-
const resolved = resolveBackgroundedWritableStdin();
|
|
3374
|
-
if (!resolved.ok) return resolved.result;
|
|
3375
|
-
return await handleProcessSendKeys({
|
|
3376
|
-
sessionId: params.sessionId,
|
|
3377
|
-
session: resolved.session,
|
|
3378
|
-
stdin: resolved.stdin,
|
|
3379
|
-
keys: params.keys,
|
|
3380
|
-
hex: params.hex,
|
|
3381
|
-
literal: params.literal
|
|
3382
|
-
});
|
|
3383
|
-
}
|
|
3384
|
-
case "submit": {
|
|
3385
|
-
const resolved = resolveBackgroundedWritableStdin();
|
|
3386
|
-
if (!resolved.ok) return resolved.result;
|
|
3387
|
-
await writeToStdin(resolved.stdin, "\r");
|
|
3388
|
-
return runningSessionResult(resolved.session, `Submitted session ${params.sessionId} (sent CR).`);
|
|
3389
|
-
}
|
|
3390
|
-
case "paste": {
|
|
3391
|
-
const resolved = resolveBackgroundedWritableStdin();
|
|
3392
|
-
if (!resolved.ok) return resolved.result;
|
|
3393
|
-
const payload = encodePaste(params.text ?? "", params.bracketed !== false);
|
|
3394
|
-
if (!payload) return {
|
|
3395
|
-
content: [{
|
|
3396
|
-
type: "text",
|
|
3397
|
-
text: "No paste text provided."
|
|
3398
|
-
}],
|
|
3399
|
-
details: { status: "failed" }
|
|
3400
|
-
};
|
|
3401
|
-
await writeToStdin(resolved.stdin, payload);
|
|
3402
|
-
return runningSessionResult(resolved.session, `Pasted ${params.text?.length ?? 0} chars to session ${params.sessionId}.`);
|
|
3403
|
-
}
|
|
3404
|
-
case "kill": {
|
|
3405
|
-
if (!scopedSession) return failText(`No active session found for ${params.sessionId}`);
|
|
3406
|
-
if (!scopedSession.backgrounded) return failText(`Session ${params.sessionId} is not backgrounded.`);
|
|
3407
|
-
const canceled = cancelManagedSession(scopedSession.id);
|
|
3408
|
-
if (!canceled) {
|
|
3409
|
-
if (!terminateSessionFallback(scopedSession)) return failText(`Unable to terminate session ${params.sessionId}: no active supervisor run or process id.`);
|
|
3410
|
-
markExited(scopedSession, null, "SIGKILL", "failed");
|
|
3411
|
-
}
|
|
3412
|
-
resetPollRetrySuggestion(params.sessionId);
|
|
3413
|
-
return {
|
|
3414
|
-
content: [{
|
|
3415
|
-
type: "text",
|
|
3416
|
-
text: canceled ? `Termination requested for session ${params.sessionId}.` : `Killed session ${params.sessionId}.`
|
|
3417
|
-
}],
|
|
3418
|
-
details: {
|
|
3419
|
-
status: "failed",
|
|
3420
|
-
name: scopedSession ? deriveSessionName(scopedSession.command) : void 0
|
|
3421
|
-
}
|
|
3422
|
-
};
|
|
3423
|
-
}
|
|
3424
|
-
case "clear":
|
|
3425
|
-
if (scopedFinished) {
|
|
3426
|
-
resetPollRetrySuggestion(params.sessionId);
|
|
3427
|
-
deleteSession(params.sessionId);
|
|
3428
|
-
return {
|
|
3429
|
-
content: [{
|
|
3430
|
-
type: "text",
|
|
3431
|
-
text: `Cleared session ${params.sessionId}.`
|
|
3432
|
-
}],
|
|
3433
|
-
details: { status: "completed" }
|
|
3434
|
-
};
|
|
3435
|
-
}
|
|
3436
|
-
return {
|
|
3437
|
-
content: [{
|
|
3438
|
-
type: "text",
|
|
3439
|
-
text: `No finished session found for ${params.sessionId}`
|
|
3440
|
-
}],
|
|
3441
|
-
details: { status: "failed" }
|
|
3442
|
-
};
|
|
3443
|
-
case "remove":
|
|
3444
|
-
if (scopedSession) {
|
|
3445
|
-
const canceled = cancelManagedSession(scopedSession.id);
|
|
3446
|
-
if (canceled) {
|
|
3447
|
-
scopedSession.backgrounded = false;
|
|
3448
|
-
deleteSession(params.sessionId);
|
|
3449
|
-
} else {
|
|
3450
|
-
if (!terminateSessionFallback(scopedSession)) return failText(`Unable to remove session ${params.sessionId}: no active supervisor run or process id.`);
|
|
3451
|
-
markExited(scopedSession, null, "SIGKILL", "failed");
|
|
3452
|
-
deleteSession(params.sessionId);
|
|
3453
|
-
}
|
|
3454
|
-
resetPollRetrySuggestion(params.sessionId);
|
|
3455
|
-
return {
|
|
3456
|
-
content: [{
|
|
3457
|
-
type: "text",
|
|
3458
|
-
text: canceled ? `Removed session ${params.sessionId} (termination requested).` : `Removed session ${params.sessionId}.`
|
|
3459
|
-
}],
|
|
3460
|
-
details: {
|
|
3461
|
-
status: "failed",
|
|
3462
|
-
name: scopedSession ? deriveSessionName(scopedSession.command) : void 0
|
|
3463
|
-
}
|
|
3464
|
-
};
|
|
3465
|
-
}
|
|
3466
|
-
if (scopedFinished) {
|
|
3467
|
-
resetPollRetrySuggestion(params.sessionId);
|
|
3468
|
-
deleteSession(params.sessionId);
|
|
3469
|
-
return {
|
|
3470
|
-
content: [{
|
|
3471
|
-
type: "text",
|
|
3472
|
-
text: `Removed session ${params.sessionId}.`
|
|
3473
|
-
}],
|
|
3474
|
-
details: { status: "completed" }
|
|
3475
|
-
};
|
|
3476
|
-
}
|
|
3477
|
-
return {
|
|
3478
|
-
content: [{
|
|
3479
|
-
type: "text",
|
|
3480
|
-
text: `No session found for ${params.sessionId}`
|
|
3481
|
-
}],
|
|
3482
|
-
details: { status: "failed" }
|
|
3483
|
-
};
|
|
3484
|
-
}
|
|
3485
|
-
return {
|
|
3486
|
-
content: [{
|
|
3487
|
-
type: "text",
|
|
3488
|
-
text: `Unknown action ${params.action}`
|
|
3489
|
-
}],
|
|
3490
|
-
details: { status: "failed" }
|
|
3491
|
-
};
|
|
3492
|
-
}
|
|
3493
|
-
};
|
|
3494
|
-
}
|
|
3495
|
-
const processTool = createProcessTool();
|
|
3496
|
-
//#endregion
|
|
3497
|
-
export { execTool as i, processTool as n, createExecTool as r, createProcessTool as t };
|