silentlake 2026.3.24
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 +4587 -0
- package/LICENSE +21 -0
- package/README.md +248 -0
- package/assets/avatar-placeholder.svg +19 -0
- package/assets/chrome-extension/icons/icon128.png +0 -0
- package/assets/chrome-extension/icons/icon16.png +0 -0
- package/assets/chrome-extension/icons/icon32.png +0 -0
- package/assets/chrome-extension/icons/icon48.png +0 -0
- package/assets/dmg-background-small.png +0 -0
- package/assets/dmg-background.png +0 -0
- package/assets/silentlake-banner.png +0 -0
- package/dist/APEv2Parser-BZv_dP9t.js +269 -0
- package/dist/APEv2Parser-CPzxFNBB.js +5 -0
- package/dist/AbstractID3Parser-mvDFcjYV.js +47 -0
- package/dist/AiffParser-BXQ9SRZk.js +145 -0
- package/dist/AsfParser-CmBDUlZE.js +631 -0
- package/dist/BasicParser-DhmXREDo.js +853 -0
- package/dist/DsdiffParser-CTKKGyZg.js +150 -0
- package/dist/DsfParser-Ds-YQe4Z.js +101 -0
- package/dist/FlacParser-B1XVPgXF.js +5 -0
- package/dist/FlacParser-DMPyL1y4.js +367 -0
- package/dist/ID3v1Parser-BICWWVDG.js +289 -0
- package/dist/ID3v2Parser-BmZHSUqs.js +650 -0
- package/dist/ID3v2Token-DeJf4tYQ.js +145 -0
- package/dist/MP4Parser-Cjf-Zs8T.js +1061 -0
- package/dist/MatroskaParser-DgBzBe8t.js +909 -0
- package/dist/MpegParser-D5swTpA1.js +744 -0
- package/dist/MusepackParser-D8EQXnpK.js +285 -0
- package/dist/OggParser-BcIYPHwP.js +390 -0
- package/dist/Util-D_zGsr97.js +170 -0
- package/dist/WavPackParser-hosU8gfo.js +166 -0
- package/dist/WaveParser-CA00FZrC.js +273 -0
- package/dist/abort-cutoff-CERmtgZI.js +56 -0
- package/dist/abort-cutoff.runtime-DZkGKKzv.js +61 -0
- package/dist/abort-signal-CsrBEr94.js +13 -0
- package/dist/account-helpers-D3c_eI7c.js +37 -0
- package/dist/account-helpers-ru3jdZSV.js +12 -0
- package/dist/account-id-DZnNZg8x.js +1 -0
- package/dist/account-id-ZCrgXl7Z.js +44 -0
- package/dist/account-lookup-nkoa-foB.js +10 -0
- package/dist/account-snapshot-fields-Cvq7803C.js +116 -0
- package/dist/account-summary-B5Xzvntm.js +36 -0
- package/dist/accounts-43SvCDEA.js +212 -0
- package/dist/accounts-CYgFhv2o.js +105 -0
- package/dist/accounts-ChlyF7cx.js +112 -0
- package/dist/ack-reactions-CNVwfOBj.js +43 -0
- package/dist/acp-cli-B4Rv7-xU.js +2033 -0
- package/dist/acp-runtime-BdLdT-QY.js +1 -0
- package/dist/actions.runtime-CqnQssoB.js +217 -0
- package/dist/actions.runtime-FLmCvVRd.js +236 -0
- package/dist/agent-CBOdzEvR.js +1 -0
- package/dist/agent-scope-BLhzf-o0.js +17 -0
- package/dist/agent-scope-DPP4Z_UU.js +193 -0
- package/dist/agents-D8pBK0II.js +855 -0
- package/dist/agents-Dihz1Ihx.js +323 -0
- package/dist/agents.config-C_lrnc9J.js +18 -0
- package/dist/agents.config-D1VqC78r.js +121 -0
- package/dist/allow-from-BPSBITdd.js +9 -0
- package/dist/allow-from-BwTLpvhp.js +20 -0
- package/dist/allow-from-C4iBpqFI.js +62 -0
- package/dist/allowlist-config-edit-CKbnMmwS.js +279 -0
- package/dist/allowlist-match-CYmPgg1K.js +63 -0
- package/dist/ansi-BEJF8NKS.js +54 -0
- package/dist/anthropic-vertex-provider-Dd5agCN9.js +60 -0
- package/dist/apply.runtime-DhKxNSJE.js +370 -0
- package/dist/apply.runtime-ghlh-P6X.js +211 -0
- package/dist/archive-Tr0wIUO-.js +532 -0
- package/dist/arg-split-Dtda0YDl.js +38 -0
- package/dist/artifacts-C_4LekPC.js +39 -0
- package/dist/audit-BOPSQQtd.js +54 -0
- package/dist/audit-C5kdrCi_.js +788 -0
- package/dist/audit-channel.allow-from.runtime-B7BHNblL.js +17 -0
- package/dist/audit-channel.collect.runtime-CjAbXFBV.js +521 -0
- package/dist/audit-channel.discord.runtime-BBY6S9lg.js +5 -0
- package/dist/audit-channel.telegram.runtime-SJnxOJH2.js +8 -0
- package/dist/audit-channel.zalouser.runtime-SGRWvHxT.js +5 -0
- package/dist/audit-extra.async-DY8v7LXH.js +817 -0
- package/dist/audit-fs-oDMUa5N_.js +375 -0
- package/dist/audit-membership-runtime-BPjFryEx.js +261 -0
- package/dist/audit.deep.runtime-WFf-TpsD.js +31 -0
- package/dist/audit.nondeep.runtime-B4BaEaRU.js +842 -0
- package/dist/audit.runtime-rFjCrods.js +74 -0
- package/dist/auth-O6LQFLHJ.js +416 -0
- package/dist/auth-choice-DIBaxmAQ.js +219 -0
- package/dist/auth-choice-PrbpIjyg.js +610 -0
- package/dist/auth-choice-legacy-Clyw2lVc.js +17 -0
- package/dist/auth-choice-options-ohUw8QR-.js +127 -0
- package/dist/auth-choice-prompt-Cm0s-9Du.js +215 -0
- package/dist/auth-choice-prompt-DI-Xl1Nv.js +36 -0
- package/dist/auth-choice-rKBOd02a.js +64 -0
- package/dist/auth-choice.apply-helpers-BibBSEl9.js +66 -0
- package/dist/auth-choice.plugin-providers.runtime-gqF9NO7_.js +219 -0
- package/dist/auth-health-TWboMYA5.js +166 -0
- package/dist/auth-mode-policy-DywddkT-.js +18 -0
- package/dist/auth-profiles-CWEIQV77.js +1047 -0
- package/dist/auth-profiles.runtime-B98lwopF.js +48 -0
- package/dist/avatar-policy-Ds9e6uHI.js +67 -0
- package/dist/axios-xDDnM0KG.js +12831 -0
- package/dist/backup-create-B6JAR6jJ.js +461 -0
- package/dist/banner-bez5CpOK.js +351 -0
- package/dist/base-session-key-Cf2rkwag.js +14 -0
- package/dist/bindings-BV4AtNSY.js +21 -0
- package/dist/bindings-kjwuC11Q.js +69 -0
- package/dist/bluebubbles-C1M3Geg0.js +87 -0
- package/dist/bluebubbles-DRW3JdOY.js +603 -0
- package/dist/bluebubbles-dEl4QpYz.js +37 -0
- package/dist/bonjour-discovery-C2oY96BG.js +376 -0
- package/dist/boolean-DKtCJu_W.js +29 -0
- package/dist/boolean-param-xAGXUSSN.js +13 -0
- package/dist/boundary-file-read-BP6VMpqH.js +106 -0
- package/dist/boundary-path-B3FFLYNx.js +557 -0
- package/dist/brave-CkimJe4j.js +405 -0
- package/dist/brew-DSwWqzLd.js +44 -0
- package/dist/browser-cli-D3kBUBNc.js +1502 -0
- package/dist/bundled/boot-md/handler.js +381 -0
- package/dist/bundled/bootstrap-extra-files/handler.js +56 -0
- package/dist/bundled/command-logger/handler.js +62 -0
- package/dist/bundled/session-memory/handler.js +401 -0
- package/dist/call-BDvaXe4i.js +44 -0
- package/dist/call-BmLt3xO1.js +639 -0
- package/dist/catalog-BwAYUfL7.js +240 -0
- package/dist/channel-BBCuV5OT.js +4945 -0
- package/dist/channel-BDBXuqeg.js +321 -0
- package/dist/channel-C8h1Irxm.js +1284 -0
- package/dist/channel-CbGpFzo4.js +1602 -0
- package/dist/channel-Ci3K8fI9.js +1006 -0
- package/dist/channel-DGT5N1v7.js +1077 -0
- package/dist/channel-account-context-Bwa-YH_o.js +104 -0
- package/dist/channel-actions-DU2CR3xW.js +37 -0
- package/dist/channel-activity-B8aReQoE.js +35 -0
- package/dist/channel-config-3Uv6ve2_.js +115 -0
- package/dist/channel-config-helpers-CieQWILI.js +377 -0
- package/dist/channel-config-schema-DEVsCZpj.js +1 -0
- package/dist/channel-feedback-G6zh8efr.js +245 -0
- package/dist/channel-inbound-DwzVf2PK.js +395 -0
- package/dist/channel-lifecycle-CpU1dRbh.js +354 -0
- package/dist/channel-options-DJaIP4Dv.js +38 -0
- package/dist/channel-pairing-D54mn51y.js +66 -0
- package/dist/channel-plugin-common-BhTxCE5t.js +1 -0
- package/dist/channel-plugin-ids-CFeS3qir.js +26 -0
- package/dist/channel-plugin-resolution-DUngfdFj.js +112 -0
- package/dist/channel-policy-C4GKHvhz.js +1 -0
- package/dist/channel-reply-pipeline-CPTuaW8n.js +15 -0
- package/dist/channel-send-result-By8EpCPw.js +40 -0
- package/dist/channel-setup-Ck35g7zI.js +49 -0
- package/dist/channel-shared-LkXtTPXk.js +308 -0
- package/dist/channel-summary-CdYLGMVt.js +137 -0
- package/dist/channel-summary-D33z52ft.js +41 -0
- package/dist/channel-targets-DfnKGXez.js +87 -0
- package/dist/channel.runtime-DAyBR2A5.js +324 -0
- package/dist/channel.runtime-DVq5tC2D.js +35 -0
- package/dist/channel.runtime-DaLTDGtF.js +288 -0
- package/dist/channel.runtime-FKfTev2g.js +512 -0
- package/dist/channel.runtime-owqedh1t.js +268 -0
- package/dist/channel.runtime-wOTeiifp.js +230 -0
- package/dist/channels-CIHgkPea.js +408 -0
- package/dist/channels-ZXK6Jiuk.js +1393 -0
- package/dist/channels-cli-Bj6qSlkE.js +412 -0
- package/dist/channels-status-issues-C_U44M8Y.js +16 -0
- package/dist/chat-type-C-n03mQY.js +10 -0
- package/dist/clack-prompter-DuzDnaLi.js +112 -0
- package/dist/clawbot-cli-YNPuwmTB.js +218 -0
- package/dist/cli/daemon-cli.js +88 -0
- package/dist/cli-CW46WAZn.js +254 -0
- package/dist/cli-name-Daok7A7-.js +25 -0
- package/dist/cli-runtime-aAVwbEYy.js +7 -0
- package/dist/cli-utils-Np4NAAtt.js +39 -0
- package/dist/command-format-CYK9XiUC.js +16 -0
- package/dist/command-format-g8YUHNir.js +2 -0
- package/dist/command-gating-BQXGSqc9.js +40 -0
- package/dist/command-options-5coRiipK.js +25 -0
- package/dist/command-poll-backoff-CpkSns-6.js +56 -0
- package/dist/command-poll-backoff.runtime-YT6EGcLN.js +7 -0
- package/dist/command-registry-BI2MOs89.js +242 -0
- package/dist/command-registry-BMsxnuoC.js +14 -0
- package/dist/command-secret-gateway-ChXyZwos.js +211 -0
- package/dist/command-secret-targets-COcwhn-D.js +88 -0
- package/dist/command-secret-targets-CQJT3viO.js +3 -0
- package/dist/commands-Bb9xUwz9.js +42 -0
- package/dist/commands-core-C1usZXC2.js +4923 -0
- package/dist/commands-core.runtime-OTZivlO2.js +232 -0
- package/dist/commands-registry-ChCep1KJ.js +295 -0
- package/dist/commands-registry.data-XyUTELK9.js +904 -0
- package/dist/commands-registry.runtime-m5WTxFtv.js +25 -0
- package/dist/commands-status.runtime-C8_hpNgj.js +211 -0
- package/dist/commands.runtime-BZPnQKcW.js +232 -0
- package/dist/common-CUBlLRXB.js +457 -0
- package/dist/compact.runtime-Djmzpbn6.js +216 -0
- package/dist/completion-cli-D8tLgE5W.js +445 -0
- package/dist/completion-cli-Dz89naVA.js +17 -0
- package/dist/config-6sZwvXJD.js +88 -0
- package/dist/config-B7tPwoHZ.js +38 -0
- package/dist/config-DdDLrP_v.js +273 -0
- package/dist/config-cli-C10R8azD.js +945 -0
- package/dist/config-guard-B1c73BYQ.js +126 -0
- package/dist/config-helpers-3u5wfLBu.js +117 -0
- package/dist/config-pn7LKJdW.js +23 -0
- package/dist/config-presence-BmUF_5K9.js +79 -0
- package/dist/config-regex-CvZFnWkO.js +39 -0
- package/dist/config-runtime-CstET7fq.js +142 -0
- package/dist/config-schema-5YkIW1xw.js +270 -0
- package/dist/config-schema-B1UGMwZ8.js +31 -0
- package/dist/config-schema-DzlnsY3D.js +33 -0
- package/dist/config-state-CE0CGjey.js +288 -0
- package/dist/config-validation-CkVqgkHr.js +272 -0
- package/dist/config-value-DgJrpclm.js +25 -0
- package/dist/configure-DMkp7Sr4.js +1126 -0
- package/dist/configure-DOrQthLy.js +344 -0
- package/dist/connection-auth-BSQJeDOU.js +30 -0
- package/dist/constants-C_Scc680.js +71 -0
- package/dist/control-ui-assets-DjqeIg6A.js +232 -0
- package/dist/control-ui-shared-DP000Pxd.js +29 -0
- package/dist/conversation-runtime-1O0Aaolb.js +1458 -0
- package/dist/core-C7aHA4Aq.js +187 -0
- package/dist/core-command-descriptors-DCUYAEZd.js +96 -0
- package/dist/credentials-BPwBlm1X.js +265 -0
- package/dist/cron-cli-N2Hw_02d.js +579 -0
- package/dist/daemon-cli-DgfaF9xx.js +354 -0
- package/dist/daemon-install-CbclJo5M.js +134 -0
- package/dist/daemon-install-plan.shared-DK6BHlWI.js +222 -0
- package/dist/daemon-runtime-CbClrCwc.js +12 -0
- package/dist/dangerous-config-flags-BJtLWIk7.js +15 -0
- package/dist/dangerous-name-matching-DZa_t0RM.js +44 -0
- package/dist/dangerous-tools-yGPDFTHh.js +27 -0
- package/dist/date-time-DCAyaBop.js +118 -0
- package/dist/dedupe-Cgnk5BbX.js +55 -0
- package/dist/defaults-CEdZhIIb.js +6 -0
- package/dist/delegate-D4ql5N70.js +43 -0
- package/dist/deliver-B004w1Mv.js +212 -0
- package/dist/deliver-runtime-IYvc0giI.js +211 -0
- package/dist/delivery-queue-B19wDCjT.js +3 -0
- package/dist/delivery-queue-DrrqB4Hi.js +299 -0
- package/dist/device-auth-GEXe9vqR.js +15 -0
- package/dist/device-bootstrap-CwwokLEY.js +96 -0
- package/dist/device-bootstrap-Dbhe6oe8.js +1 -0
- package/dist/device-metadata-normalization-BDSQ_eA7.js +21 -0
- package/dist/device-pairing-cFWbBray.js +553 -0
- package/dist/devices-cli-DzycjFzS.js +366 -0
- package/dist/diagnostic-DqJXx_4Q.js +310 -0
- package/dist/diagnostic-events-ktCoG8Br.js +48 -0
- package/dist/diagnostics-CMhyGsPu.js +33 -0
- package/dist/diagnostics-DpLHpQ9c.js +14 -0
- package/dist/directive-handling.fast-lane-toP_ri_H.js +273 -0
- package/dist/directive-handling.impl-BRARyrsT.js +638 -0
- package/dist/directive-handling.impl-CUB4MOnK.js +214 -0
- package/dist/directive-handling.levels-8vnMeuGX.js +2 -0
- package/dist/directive-handling.levels-CoruY1AA.js +13 -0
- package/dist/directive-handling.persist.runtime-78Du6PgL.js +170 -0
- package/dist/directive-handling.shared-DCGUCHjn.js +147 -0
- package/dist/directory-cli-DVsDcgIU.js +437 -0
- package/dist/directory-config-helpers-CURJ8mj7.js +129 -0
- package/dist/directory-runtime-DhC8QkMq.js +19 -0
- package/dist/directory.static-DQaG9ohH.js +44 -0
- package/dist/discord-CYj8s73O.js +214 -0
- package/dist/discord-L9zvSHVn.js +635 -0
- package/dist/discord-core-5tkl-BzP.js +1 -0
- package/dist/dm-policy-shared-6bCJzHOS.js +188 -0
- package/dist/dns-cli-BMvHy265.js +223 -0
- package/dist/docker-XFNiArwM.js +1254 -0
- package/dist/docs-cli-BTaH94wD.js +176 -0
- package/dist/doctor-completion-DKx5m2UC.js +90 -0
- package/dist/doctor-config-preflight-BzQgc3_t.js +40 -0
- package/dist/doctor-config-preflight-DxVCut8L.js +150 -0
- package/dist/doctor-state-migrations-CTF66iAy.js +732 -0
- package/dist/doctor-state-migrations-D0VP4dUh.js +212 -0
- package/dist/entry-status-B2OWAf0s.js +172 -0
- package/dist/entry.js +210 -0
- package/dist/env-BP70DGuy.js +30 -0
- package/dist/env-overrides-JneV60sd.js +434 -0
- package/dist/env-overrides.runtime-DLrwions.js +18 -0
- package/dist/env-substitution-D6t_sLS_.js +136 -0
- package/dist/errors-BxyFnvP3.js +58 -0
- package/dist/exec-Dmex2w_d.js +310 -0
- package/dist/exec-approvals-BJhuySBz.js +386 -0
- package/dist/exec-approvals-allowlist-B_wPddCb.js +384 -0
- package/dist/exec-approvals-cli-C2dwhSkX.js +427 -0
- package/dist/exec-safe-bin-runtime-policy-BZkObC8r.js +89 -0
- package/dist/exec-safety-CaaBy-Zw.js +24 -0
- package/dist/extension-shared-5txN7IXK.js +74 -0
- package/dist/extensionAPI.js +218 -0
- package/dist/extensions/amazon-bedrock/index.js +231 -0
- package/dist/extensions/anthropic/index.js +330 -0
- package/dist/extensions/bluebubbles/index.js +224 -0
- package/dist/extensions/bluebubbles/setup-entry.js +289 -0
- package/dist/extensions/brave/index.js +23 -0
- package/dist/extensions/byteplus/index.js +112 -0
- package/dist/extensions/chutes/index.js +221 -0
- package/dist/extensions/cloudflare-ai-gateway/index.js +218 -0
- package/dist/extensions/copilot-proxy/index.js +125 -0
- package/dist/extensions/device-pair/index.js +1040 -0
- package/dist/extensions/discord/index.js +215 -0
- package/dist/extensions/discord/setup-entry.js +215 -0
- package/dist/extensions/elevenlabs/index.js +223 -0
- package/dist/extensions/fal/index.js +112 -0
- package/dist/extensions/feishu/index.js +227 -0
- package/dist/extensions/feishu/setup-entry.js +112 -0
- package/dist/extensions/firecrawl/index.js +211 -0
- package/dist/extensions/github-copilot/index.js +490 -0
- package/dist/extensions/google/index.js +211 -0
- package/dist/extensions/huggingface/index.js +108 -0
- package/dist/extensions/imessage/index.js +223 -0
- package/dist/extensions/imessage/setup-entry.js +220 -0
- package/dist/extensions/irc/index.js +220 -0
- package/dist/extensions/irc/setup-entry.js +222 -0
- package/dist/extensions/kilocode/index.js +282 -0
- package/dist/extensions/kimi-coding/index.js +148 -0
- package/dist/extensions/line/index.js +57 -0
- package/dist/extensions/line/setup-entry.js +49 -0
- package/dist/extensions/llm-task/index.js +157 -0
- package/dist/extensions/lobster/index.js +261 -0
- package/dist/extensions/mattermost/index.js +220 -0
- package/dist/extensions/mattermost/setup-entry.js +222 -0
- package/dist/extensions/memory-core/index.js +36 -0
- package/dist/extensions/microsoft/index.js +223 -0
- package/dist/extensions/minimax/index.js +437 -0
- package/dist/extensions/mistral/index.js +149 -0
- package/dist/extensions/modelstudio/index.js +144 -0
- package/dist/extensions/moonshot/index.js +211 -0
- package/dist/extensions/nextcloud-talk/index.js +221 -0
- package/dist/extensions/nextcloud-talk/setup-entry.js +223 -0
- package/dist/extensions/nvidia/index.js +29 -0
- package/dist/extensions/ollama/index.js +118 -0
- package/dist/extensions/open-prose/index.js +10 -0
- package/dist/extensions/openai/index.js +677 -0
- package/dist/extensions/opencode/index.js +116 -0
- package/dist/extensions/opencode-go/index.js +114 -0
- package/dist/extensions/openrouter/index.js +398 -0
- package/dist/extensions/openshell/index.js +923 -0
- package/dist/extensions/perplexity/index.js +23 -0
- package/dist/extensions/phone-control/index.js +276 -0
- package/dist/extensions/qianfan/index.js +114 -0
- package/dist/extensions/qwen-portal-auth/index.js +350 -0
- package/dist/extensions/sglang/index.js +285 -0
- package/dist/extensions/signal/index.js +218 -0
- package/dist/extensions/signal/setup-entry.js +218 -0
- package/dist/extensions/slack/index.js +222 -0
- package/dist/extensions/slack/setup-entry.js +220 -0
- package/dist/extensions/synology-chat/index.js +56 -0
- package/dist/extensions/synology-chat/setup-entry.js +58 -0
- package/dist/extensions/synthetic/index.js +112 -0
- package/dist/extensions/talk-voice/index.js +197 -0
- package/dist/extensions/tavily/index.js +211 -0
- package/dist/extensions/telegram/index.js +221 -0
- package/dist/extensions/telegram/setup-entry.js +221 -0
- package/dist/extensions/thread-ownership/index.js +70 -0
- package/dist/extensions/together/index.js +113 -0
- package/dist/extensions/venice/index.js +132 -0
- package/dist/extensions/vercel-ai-gateway/index.js +86 -0
- package/dist/extensions/vllm/index.js +285 -0
- package/dist/extensions/voice-call/index.js +5715 -0
- package/dist/extensions/volcengine/index.js +112 -0
- package/dist/extensions/xai/index.js +211 -0
- package/dist/extensions/xiaomi/index.js +115 -0
- package/dist/extensions/zai/index.js +559 -0
- package/dist/extensions/zalo/index.js +225 -0
- package/dist/extensions/zalo/setup-entry.js +226 -0
- package/dist/external-content-BUdUOqkv.js +238 -0
- package/dist/feishu-CgbwAF0e.js +2664 -0
- package/dist/feishu-Dh5fEbh5.js +59127 -0
- package/dist/fetch-guard-DIyN1HW5.js +165 -0
- package/dist/fetch-timeout-C5xpMuGd.js +36 -0
- package/dist/file-identity-Cw0fQxYY.js +11 -0
- package/dist/file-lock-WbEmczmY.js +107 -0
- package/dist/filter-oMGaNOM1.js +20 -0
- package/dist/format-DH8ysi7s.js +19 -0
- package/dist/format-datetime-BGS6tLDE.js +73 -0
- package/dist/format-duration-CO0BGWB0.js +57 -0
- package/dist/format-relative-C3nDxnXz.js +54 -0
- package/dist/frontmatter-S5vS-I4a.js +309 -0
- package/dist/fs-safe-D3qzH-ab.js +731 -0
- package/dist/gateway-cli-PQNp7o0j.js +28378 -0
- package/dist/gateway-install-token-DV5KjD4F.js +164 -0
- package/dist/gateway-rpc-C0Ey-rik.js +26 -0
- package/dist/gateway-runtime-ih2e7a2K.js +42 -0
- package/dist/gaxios-fetch-compat-KX6bsqFm.js +165 -0
- package/dist/gemini-auth-B5ljg7jr.js +29 -0
- package/dist/git-commit-BIdLubm5.js +2 -0
- package/dist/git-commit-OvUvjri2.js +177 -0
- package/dist/github-copilot-auth-Ccm-cBwy.js +104 -0
- package/dist/global-singleton-4KwY5RvX.js +13 -0
- package/dist/globals-41sdSaKv.js +38 -0
- package/dist/gmail-setup-utils-BX68dZla.js +419 -0
- package/dist/group-access-DJZrYPx1.js +113 -0
- package/dist/group-keys-BD_IYSMs.js +44 -0
- package/dist/group-policy-CWFxv3iB.js +201 -0
- package/dist/group-policy-warnings-Ddu6lBkh.js +175 -0
- package/dist/health-Bu1sbyYy.js +573 -0
- package/dist/health-Cbxc9Bn3.js +59 -0
- package/dist/health-format-B5XfOTuJ.js +26 -0
- package/dist/heartbeat-7aHh0m3d.js +169 -0
- package/dist/heartbeat-summary-Das49TYq.js +57 -0
- package/dist/help-CcbF7-ha.js +81 -0
- package/dist/help-format-Dv45FpYu.js +15 -0
- package/dist/helpers-DJ-5HEbE.js +24 -0
- package/dist/helpers-MxyaLZUk.js +32 -0
- package/dist/history-CHjo8B5W.js +102 -0
- package/dist/hook-runtime-BnNBi_q4.js +1 -0
- package/dist/hooks-cli-DUYK4RM1.js +1102 -0
- package/dist/hooks-policy-BL6HDLUn.js +20 -0
- package/dist/hooks-status-gzNmo3li.js +78 -0
- package/dist/host-env-security-BogNN146.js +223 -0
- package/dist/http-body-CCiSfloA.js +237 -0
- package/dist/http-registry-WFFbLYRd.js +153 -0
- package/dist/identity-DovQV4zD.js +112 -0
- package/dist/identity-cyBYcoXS.js +84 -0
- package/dist/identity-file-EndG1nfc.js +60 -0
- package/dist/image-generation-CNKc-mFK.js +441 -0
- package/dist/image-kJ7Tbov4.js +211 -0
- package/dist/image-ops-j01UkxEv.js +371 -0
- package/dist/imessage-B5pSMT47.js +219 -0
- package/dist/imessage-CoIuY1Ro.js +1451 -0
- package/dist/imessage-Cqjsq4VW.js +190 -0
- package/dist/imessage-core-CsYJuaRZ.js +1 -0
- package/dist/inbound-envelope-4P3IIJc3.js +61 -0
- package/dist/inbound-reply-dispatch-i2Vekqyy.js +72 -0
- package/dist/includes-7XyL3p1c.js +188 -0
- package/dist/includes-scan-y-rS6tTw.js +55 -0
- package/dist/index.js +57 -0
- package/dist/infra/warning-filter.js +2 -0
- package/dist/inspect-CcxlJ1ba.js +279 -0
- package/dist/install-safe-path-Rwbw1XCZ.js +62 -0
- package/dist/installs-iHi2aSjM.js +532 -0
- package/dist/interactive-F7iY0yED.js +8 -0
- package/dist/interactive-runtime-OweOj_Vv.js +90 -0
- package/dist/internal-hooks-0uipqzRY.js +156 -0
- package/dist/io-BX49DsSJ.js +35 -0
- package/dist/io-jOnQRia2.js +7178 -0
- package/dist/ip-C8vmzVu0.js +203 -0
- package/dist/ipv4-DAmsJVOV.js +82 -0
- package/dist/irc-AZ-Ec8be.js +12 -0
- package/dist/irc-CCSRuEC2.js +660 -0
- package/dist/is-main-YViS6wOn.js +27 -0
- package/dist/issue-format-CBEXVico.js +31 -0
- package/dist/issue-format-D3HehoKZ.js +4 -0
- package/dist/json-file-C2zjA0Gv.js +23 -0
- package/dist/json-files-WW-H_psG.js +60 -0
- package/dist/json-pointer-f9dEnBoR.js +43 -0
- package/dist/json-store-O1LwpnBH.js +37 -0
- package/dist/kb-cli-DMZs6PCu.js +65 -0
- package/dist/keyed-async-queue-CPUWV5Pm.js +32 -0
- package/dist/kill-tree-CbjXBw3z.js +149 -0
- package/dist/kilocode-shared-DS7_0IMs.js +29 -0
- package/dist/launchd-tyqGVx9U.js +491 -0
- package/dist/lazy-runtime-BcXbyAaC.js +1 -0
- package/dist/lazy-runtime-bWkd2cs3.js +29 -0
- package/dist/legacy-names-CUNZ4vHN.js +7 -0
- package/dist/legacy-web-search-BgZjNG2h.js +222 -0
- package/dist/lib-CERS7N4b.js +503 -0
- package/dist/lib-PPICrHv1.js +1938 -0
- package/dist/library-CZ461krl.js +211 -0
- package/dist/lifecycle-core-Dnxnw0oy.js +382 -0
- package/dist/line/accounts.js +10 -0
- package/dist/line/send.js +39 -0
- package/dist/line/template-messages.js +2 -0
- package/dist/line-CJSvwApm.js +1 -0
- package/dist/line-N9vL-2JB.js +688 -0
- package/dist/line-core-BOIxkjgu.js +1 -0
- package/dist/links-Bilm-v0z.js +13 -0
- package/dist/llm-slug-generator-BuAuQ5Ft.js +68 -0
- package/dist/llm-slug-generator.js +212 -0
- package/dist/llm-task-Dx8ymRFr.js +1 -0
- package/dist/local-roots-DAzCjWbC.js +34 -0
- package/dist/location-DefAH9WS.js +42 -0
- package/dist/logger-CoEtkjhn.js +550 -0
- package/dist/logger-Cqy7-Maj.js +70 -0
- package/dist/logging-B2wMcpWV.js +13 -0
- package/dist/logging-Bz1qZDPg.js +16 -0
- package/dist/logging-CArEWRgI.js +36 -0
- package/dist/logging-CbTTfADU.js +1 -0
- package/dist/logs-cli-BSjKwaur.js +261 -0
- package/dist/magic-string.es-DJPWMt-n.js +1011 -0
- package/dist/main-session-DKr0lBVk.js +36 -0
- package/dist/manager-ChTGDe87.js +2005 -0
- package/dist/manager-DuwFn87U.js +4226 -0
- package/dist/manager-runtime-E16jsvRe.js +59 -0
- package/dist/manager.runtime-F9F1eFiB.js +827 -0
- package/dist/manifest-registry-B90TyTWl.js +1350 -0
- package/dist/map-size-CMTQVKUV.js +15 -0
- package/dist/markdown-to-line-BWwaRx5F.js +640 -0
- package/dist/mask-api-key-CprzEe7l.js +10 -0
- package/dist/matrix-DzvdUw97.js +228 -0
- package/dist/matrix-migration-snapshot-adoDbNii.js +702 -0
- package/dist/mattermost-DO0BCfF3.js +1 -0
- package/dist/mattermost-SjOt4QDb.js +15 -0
- package/dist/mcp-cli-BC_VPl_o.js +94 -0
- package/dist/mcp-config-Coky4zS4.js +108 -0
- package/dist/media-limits-Cuvmmhop.js +14 -0
- package/dist/media-understanding-DD2uMjK8.js +48 -0
- package/dist/media-understanding.runtime-Kbb2bRmk.js +216 -0
- package/dist/memory-DBjQ0TPd.js +1 -0
- package/dist/memory-cli-Cm4Df0hJ.js +215 -0
- package/dist/memory-cli-yzqneSF8.js +541 -0
- package/dist/memory-search-Das1tiuB.js +204 -0
- package/dist/memory-search-DxmSTjHq.js +18 -0
- package/dist/mention-gating-B_q-EHFx.js +25 -0
- package/dist/mentions-Bxys_va0.js +154 -0
- package/dist/message-channel-Cy-gN4K2.js +106 -0
- package/dist/message-hook-mappers-BBTV3JRQ.js +249 -0
- package/dist/method-scopes-DgypDW23.js +2649 -0
- package/dist/mime-C4vVTBso.js +150 -0
- package/dist/minimal-C5yUxtHy.js +2120 -0
- package/dist/model-auth-B__TJTPw.js +309 -0
- package/dist/model-auth-env-CF9ts7Th.js +111 -0
- package/dist/model-catalog.runtime-CWh17vcc.js +211 -0
- package/dist/model-id-normalization-Y-MIsyK_.js +16 -0
- package/dist/model-input-BB2wSAHb.js +20 -0
- package/dist/model-overrides-sIzKU2wo.js +84 -0
- package/dist/model-param-b-DIFEhICm.js +15 -0
- package/dist/model-picker-CAPjetT3.js +400 -0
- package/dist/model-picker-DEw9viWc.js +215 -0
- package/dist/model-picker.runtime-ixYl7lB5.js +224 -0
- package/dist/model-selection-BTpJnslv.js +437 -0
- package/dist/model-selection-Ci9cPkL2.js +765 -0
- package/dist/model-suppression.runtime-D8cIb6Y5.js +216 -0
- package/dist/models-BQtc3khN.js +226 -0
- package/dist/models-CQgBV5dW.js +2536 -0
- package/dist/models-cli-DbQ-QpQk.js +418 -0
- package/dist/models-config-D2xK-G6c.js +211 -0
- package/dist/models-config.providers.discovery-BaIk1NKL.js +141 -0
- package/dist/models-config.runtime-Cf7q9uAQ.js +211 -0
- package/dist/monitor-B5QmKaD7.js +3272 -0
- package/dist/monitor-CL5OYLih.js +878 -0
- package/dist/monitor-CNZxrM4d.js +3145 -0
- package/dist/monitor-CyQVZdDh.js +223 -0
- package/dist/multimodal-DC43jYNv.js +75 -0
- package/dist/mutable-allowlist-detectors-C6EAzWYE.js +62 -0
- package/dist/net-DlJFp95v.js +270 -0
- package/dist/network-mode-DOgvmom4.js +17 -0
- package/dist/nextcloud-talk-ChMP88s-.js +12 -0
- package/dist/nextcloud-talk-CwnkUy8E.js +1 -0
- package/dist/node-cli-BZDC7rXg.js +2484 -0
- package/dist/node-command-policy-Bg2g6Xjp.js +192 -0
- package/dist/node-commands-B6W6Eo0b.js +11 -0
- package/dist/node-require-BgDD9bTi.js +14 -0
- package/dist/node-resolve-BunMro3f.js +69 -0
- package/dist/node-service-CEZZaqba.js +65 -0
- package/dist/node-startup-env-Gz8ZQniA.js +50 -0
- package/dist/nodes-cli-B4Jr9vct.js +1330 -0
- package/dist/nodes-screen-CQ7IvP62.js +401 -0
- package/dist/normalize-secret-input-_PgpexOG.js +32 -0
- package/dist/note-dfjacCV8.js +109 -0
- package/dist/npm-pack-install-CYNRv-vM.js +574 -0
- package/dist/npm-resolution-Ml2aA6Nu.js +60 -0
- package/dist/oauth.runtime-DA_48MPQ.js +687 -0
- package/dist/oauth.runtime-DS1ry5__.js +318 -0
- package/dist/oauth.runtime-qCkidk8J.js +180 -0
- package/dist/ollama-defaults-asNuGW4_.js +4 -0
- package/dist/onboard-BM6gO6Uw.js +589 -0
- package/dist/onboard-D9IU-7uw.js +48 -0
- package/dist/onboard-DQaHGPRm.js +25 -0
- package/dist/onboard-channels-BdQtLjYb.js +300 -0
- package/dist/onboard-channels-DIVUygs5.js +1257 -0
- package/dist/onboard-config-DFKb-0sE.js +29 -0
- package/dist/onboard-config-DYykzJhx.js +2 -0
- package/dist/onboard-custom-CDP4w1AT.js +216 -0
- package/dist/onboard-custom-DhJN13UV.js +644 -0
- package/dist/onboard-helpers-B7XTd4Pw.js +335 -0
- package/dist/onboard-helpers-BUKtx5Bq.js +54 -0
- package/dist/onboard-hooks-BHSSLAhI.js +73 -0
- package/dist/onboard-remote-BOzEPdHA.js +59 -0
- package/dist/onboard-remote-DVza19_k.js +182 -0
- package/dist/onboard-search-CrS-n9_3.js +446 -0
- package/dist/onboard-skills-BojzIPvk.js +133 -0
- package/dist/onboard-skills-D7HyCVjz.js +69 -0
- package/dist/openai-codex-provider.runtime-BFsopDHI.js +2 -0
- package/dist/openai-defaults-B7FUywsh.js +10 -0
- package/dist/openclaw-exec-env-AcZ9we1N.js +14 -0
- package/dist/openclaw-root-TUHYdr9B.js +88 -0
- package/dist/openclaw-tools.runtime-draZJo5r.js +211 -0
- package/dist/outbound-media-69yrWRDt.js +11 -0
- package/dist/outbound-runtime-ic_7ulJJ.js +1 -0
- package/dist/pairing-challenge-CNrPmmi9.js +48 -0
- package/dist/pairing-cli-BohXW2BK.js +150 -0
- package/dist/pairing-labels-CNKCSmBK.js +7 -0
- package/dist/pairing-message-CBv2njJT.js +4 -0
- package/dist/pairing-store-C4lsd4pO.js +590 -0
- package/dist/pairing-token-gKj4SNFJ.js +55 -0
- package/dist/parse-duration-BBGYkY0S.js +41 -0
- package/dist/parse-finite-number-CP4MQF_w.js +30 -0
- package/dist/parse-log-line-CVh9zu3Q.js +43 -0
- package/dist/parse-port-COyt3COn.js +8 -0
- package/dist/path-alias-guards-ZTKqurNH.js +40 -0
- package/dist/path-env-CPkz6U0Y.js +87 -0
- package/dist/paths-CTjJI9l0.js +179 -0
- package/dist/paths-GHJ97ebE.js +268 -0
- package/dist/paths-nCHyK08H.js +56 -0
- package/dist/perplexity-Beshd9zu.js +422 -0
- package/dist/persistent-dedupe-bjKjVI5u.js +116 -0
- package/dist/pi-embedded-CSQySvOV.js +168518 -0
- package/dist/pi-model-discovery-CuX5CDyZ.js +125 -0
- package/dist/pi-model-discovery-runtime-DNsMrX1n.js +44 -0
- package/dist/pi-tools.before-tool-call.runtime-DxVqzMVf.js +387 -0
- package/dist/platform-launcher-CqGy6UhP.js +83 -0
- package/dist/plugin-entry-CwuwM1jC.js +17 -0
- package/dist/plugin-install-JJwfOXtg.js +216 -0
- package/dist/plugin-install-plan-cixz1_W4.js +49 -0
- package/dist/plugin-install-vkpI1UNd.js +184 -0
- package/dist/plugin-registry-C3j_DUnj.js +51 -0
- package/dist/plugin-registry-DB_yxabS.js +213 -0
- package/dist/plugin-sdk/account-helpers.js +3 -0
- package/dist/plugin-sdk/account-id.js +2 -0
- package/dist/plugin-sdk/account-resolution.js +216 -0
- package/dist/plugin-sdk/acp-runtime.js +46 -0
- package/dist/plugin-sdk/agent-runtime.js +215 -0
- package/dist/plugin-sdk/allow-from.js +17 -0
- package/dist/plugin-sdk/allowlist-config-edit.js +2 -0
- package/dist/plugin-sdk/bluebubbles.js +232 -0
- package/dist/plugin-sdk/boolean-param.js +2 -0
- package/dist/plugin-sdk/channel-actions.js +16 -0
- package/dist/plugin-sdk/channel-config-helpers.js +15 -0
- package/dist/plugin-sdk/channel-config-schema.js +5 -0
- package/dist/plugin-sdk/channel-contract.js +1 -0
- package/dist/plugin-sdk/channel-feedback.js +4 -0
- package/dist/plugin-sdk/channel-inbound.js +53 -0
- package/dist/plugin-sdk/channel-lifecycle.js +2 -0
- package/dist/plugin-sdk/channel-pairing.js +2 -0
- package/dist/plugin-sdk/channel-policy.js +19 -0
- package/dist/plugin-sdk/channel-reply-pipeline.js +23 -0
- package/dist/plugin-sdk/channel-runtime.js +33 -0
- package/dist/plugin-sdk/channel-send-result.js +2 -0
- package/dist/plugin-sdk/channel-setup.js +24 -0
- package/dist/plugin-sdk/channel-targets.js +3 -0
- package/dist/plugin-sdk/cli-runtime.js +5 -0
- package/dist/plugin-sdk/command-auth.js +212 -0
- package/dist/plugin-sdk/compat.js +59 -0
- package/dist/plugin-sdk/config-runtime.js +51 -0
- package/dist/plugin-sdk/conversation-runtime.js +55 -0
- package/dist/plugin-sdk/core.js +40 -0
- package/dist/plugin-sdk/device-bootstrap.js +6 -0
- package/dist/plugin-sdk/diagnostics-otel.js +7 -0
- package/dist/plugin-sdk/diffs.js +3 -0
- package/dist/plugin-sdk/directory-runtime.js +5 -0
- package/dist/plugin-sdk/discord-core.js +26 -0
- package/dist/plugin-sdk/discord.js +219 -0
- package/dist/plugin-sdk/extension-shared.js +15 -0
- package/dist/plugin-sdk/feishu.js +101 -0
- package/dist/plugin-sdk/gateway-runtime.js +46 -0
- package/dist/plugin-sdk/googlechat.js +93 -0
- package/dist/plugin-sdk/group-access.js +2 -0
- package/dist/plugin-sdk/hook-runtime.js +12 -0
- package/dist/plugin-sdk/image-generation.js +51 -0
- package/dist/plugin-sdk/imessage-core.js +214 -0
- package/dist/plugin-sdk/imessage.js +223 -0
- package/dist/plugin-sdk/index.js +55 -0
- package/dist/plugin-sdk/infra-runtime.js +223 -0
- package/dist/plugin-sdk/interactive-runtime.js +3 -0
- package/dist/plugin-sdk/irc.js +232 -0
- package/dist/plugin-sdk/json-store.js +9 -0
- package/dist/plugin-sdk/keyed-async-queue.js +2 -0
- package/dist/plugin-sdk/lazy-runtime.js +2 -0
- package/dist/plugin-sdk/line-core.js +29 -0
- package/dist/plugin-sdk/line.js +22 -0
- package/dist/plugin-sdk/llm-task.js +7 -0
- package/dist/plugin-sdk/matrix-runtime-heavy.js +223 -0
- package/dist/plugin-sdk/matrix-runtime-shared.js +2 -0
- package/dist/plugin-sdk/matrix.js +84 -0
- package/dist/plugin-sdk/mattermost.js +233 -0
- package/dist/plugin-sdk/media-runtime.js +212 -0
- package/dist/plugin-sdk/media-understanding-runtime.js +211 -0
- package/dist/plugin-sdk/media-understanding.js +15 -0
- package/dist/plugin-sdk/memory-core.js +2 -0
- package/dist/plugin-sdk/memory-lancedb.js +2 -0
- package/dist/plugin-sdk/msteams.js +244 -0
- package/dist/plugin-sdk/nextcloud-talk.js +231 -0
- package/dist/plugin-sdk/nostr.js +50 -0
- package/dist/plugin-sdk/ollama-setup.js +33 -0
- package/dist/plugin-sdk/outbound-runtime.js +23 -0
- package/dist/plugin-sdk/plugin-entry.js +3 -0
- package/dist/plugin-sdk/plugin-runtime.js +211 -0
- package/dist/plugin-sdk/process-runtime.js +12 -0
- package/dist/plugin-sdk/provider-auth-api-key.js +53 -0
- package/dist/plugin-sdk/provider-auth-login.js +2 -0
- package/dist/plugin-sdk/provider-auth.js +37 -0
- package/dist/plugin-sdk/provider-catalog.js +2 -0
- package/dist/plugin-sdk/provider-env-vars.js +2 -0
- package/dist/plugin-sdk/provider-google.js +3 -0
- package/dist/plugin-sdk/provider-models.js +27 -0
- package/dist/plugin-sdk/provider-onboard.js +20 -0
- package/dist/plugin-sdk/provider-setup.js +58 -0
- package/dist/plugin-sdk/provider-stream.js +211 -0
- package/dist/plugin-sdk/provider-usage.js +18 -0
- package/dist/plugin-sdk/provider-web-search.js +23 -0
- package/dist/plugin-sdk/provider-zai-endpoint.js +3 -0
- package/dist/plugin-sdk/reply-history.js +23 -0
- package/dist/plugin-sdk/reply-payload.js +2 -0
- package/dist/plugin-sdk/reply-runtime.js +211 -0
- package/dist/plugin-sdk/request-url.js +2 -0
- package/dist/plugin-sdk/routing.js +25 -0
- package/dist/plugin-sdk/runtime-env.js +15 -0
- package/dist/plugin-sdk/runtime-store.js +2 -0
- package/dist/plugin-sdk/runtime.js +15 -0
- package/dist/plugin-sdk/sandbox.js +66 -0
- package/dist/plugin-sdk/secret-input.js +3 -0
- package/dist/plugin-sdk/security-runtime.js +18 -0
- package/dist/plugin-sdk/self-hosted-provider-setup.js +33 -0
- package/dist/plugin-sdk/setup-adapter-runtime.js +2 -0
- package/dist/plugin-sdk/setup-runtime.js +17 -0
- package/dist/plugin-sdk/setup-tools.js +21 -0
- package/dist/plugin-sdk/setup.js +26 -0
- package/dist/plugin-sdk/signal.js +220 -0
- package/dist/plugin-sdk/slack-core.js +22 -0
- package/dist/plugin-sdk/slack.js +223 -0
- package/dist/plugin-sdk/speech-runtime.js +213 -0
- package/dist/plugin-sdk/speech.js +212 -0
- package/dist/plugin-sdk/ssrf-runtime.js +5 -0
- package/dist/plugin-sdk/state-paths.js +3 -0
- package/dist/plugin-sdk/status-helpers.js +9 -0
- package/dist/plugin-sdk/telegram-core.js +23 -0
- package/dist/plugin-sdk/telegram.js +224 -0
- package/dist/plugin-sdk/testing.js +13174 -0
- package/dist/plugin-sdk/text-runtime.js +45 -0
- package/dist/plugin-sdk/thread-bindings-runtime.js +2 -0
- package/dist/plugin-sdk/thread-ownership.js +2 -0
- package/dist/plugin-sdk/tlon.js +57 -0
- package/dist/plugin-sdk/tool-send.js +2 -0
- package/dist/plugin-sdk/twitch.js +46 -0
- package/dist/plugin-sdk/voice-call.js +213 -0
- package/dist/plugin-sdk/web-media.js +28 -0
- package/dist/plugin-sdk/webhook-ingress.js +7 -0
- package/dist/plugin-sdk/webhook-path.js +2 -0
- package/dist/plugin-sdk/whatsapp-core.js +219 -0
- package/dist/plugin-sdk/whatsapp-shared.js +18 -0
- package/dist/plugin-sdk/windows-spawn.js +2 -0
- package/dist/plugin-sdk/zalo.js +239 -0
- package/dist/plugin-sdk/zalouser.js +240 -0
- package/dist/plugins/build-smoke-entry.js +211 -0
- package/dist/plugins/runtime/index.js +229 -0
- package/dist/plugins-1Z50ecJ6.js +1 -0
- package/dist/plugins-C6fKmNuA.js +7 -0
- package/dist/plugins-cli-BkgQkGaU.js +1192 -0
- package/dist/policy-CpkbSAfm.js +60 -0
- package/dist/polls-B2VH7SN9.js +35 -0
- package/dist/ports-BjWuIIQw.js +262 -0
- package/dist/ports-DFiK_Jc-.js +385 -0
- package/dist/ports-lsof-DtJqhFOr.js +25 -0
- package/dist/ports-probe-BQqp8l8E.js +14 -0
- package/dist/preflight-audio.runtime-Fi9mofpp.js +216 -0
- package/dist/probe-BM9sbCgS.js +20 -0
- package/dist/probe-DLBOZftS.js +134 -0
- package/dist/probe-auth-Bjp3G4CI.js +48 -0
- package/dist/probe-auth-DMSPTRRk.js +45 -0
- package/dist/process-runtime-C7el-Ri4.js +1 -0
- package/dist/process-scoped-map-C4gOa-gv.js +61 -0
- package/dist/profile-utils-BcMYGFPT.js +15 -0
- package/dist/profiles-D17eMKQZ.js +683 -0
- package/dist/program-Ch-76sgl.js +155 -0
- package/dist/program-context-BMWNUfqL.js +10 -0
- package/dist/program-context-CD_RvRYh.js +2 -0
- package/dist/progress-D1r9bZU1.js +132 -0
- package/dist/prompt-select-styled-NUKYS9QR.js +4879 -0
- package/dist/prompt-style-BvciNCqy.js +7 -0
- package/dist/prompts-NtuylUyl.js +9 -0
- package/dist/prototype-keys-Cm_8mWvq.js +11 -0
- package/dist/provider-api-key-auth-BE0taXiB.js +108 -0
- package/dist/provider-api-key-auth.runtime-jDZZUAMX.js +34 -0
- package/dist/provider-auth-Bw8x1a3o.js +58 -0
- package/dist/provider-auth-api-key-BrQYvdxi.js +1 -0
- package/dist/provider-auth-choice-BYbPq0eC.js +128 -0
- package/dist/provider-auth-choice-helpers-Bj1GkOSn.js +48 -0
- package/dist/provider-auth-choice-preference-tKq5gaJL.js +192 -0
- package/dist/provider-auth-choice.runtime-DegPpvRJ.js +223 -0
- package/dist/provider-auth-choices-QSilukI1.js +58 -0
- package/dist/provider-auth-guidance-gninjjq8.js +34 -0
- package/dist/provider-auth-helpers-B0dS-1WK.js +86 -0
- package/dist/provider-auth-input-BftBdgvW.js +112 -0
- package/dist/provider-auth-login-D0n0lMuc.js +8 -0
- package/dist/provider-auth-login.runtime-LvuBkQrc.js +243 -0
- package/dist/provider-auth-mode-sTdccIKL.js +20 -0
- package/dist/provider-auth-ref-BS3gwrNr.js +168 -0
- package/dist/provider-auth-ref-BmEcEN7K.js +3 -0
- package/dist/provider-catalog--18-pW5t.js +11 -0
- package/dist/provider-catalog-2P2hel74.js +48 -0
- package/dist/provider-catalog-B0FqWSwe.js +48 -0
- package/dist/provider-catalog-BvORKzzD.js +91 -0
- package/dist/provider-catalog-C34j1_or.js +26 -0
- package/dist/provider-catalog-C5vmXjmb.js +11 -0
- package/dist/provider-catalog-CBufm2Dr.js +36 -0
- package/dist/provider-catalog-D7QvsUXS.js +12 -0
- package/dist/provider-catalog-DKy_dzQZ.js +41 -0
- package/dist/provider-env-vars-CsQlY7bF.js +110 -0
- package/dist/provider-id-BpXo5t6v.js +31 -0
- package/dist/provider-model-allowlist-4HSOnlX-.js +24 -0
- package/dist/provider-model-primary-NJ-xlhec.js +53 -0
- package/dist/provider-models-C2EjYMwW.js +2416 -0
- package/dist/provider-oauth-flow-BQN6F6EC.js +33 -0
- package/dist/provider-ollama-setup-DhQvDwAj.js +309 -0
- package/dist/provider-onboard-CjOfyeQG.js +1 -0
- package/dist/provider-onboarding-config-DOZ3pFA6.js +165 -0
- package/dist/provider-openai-codex-oauth-tls-Bo8U4D3E.js +101 -0
- package/dist/provider-runtime.runtime-DnP2jpoM.js +211 -0
- package/dist/provider-self-hosted-setup-CUrmsugW.js +182 -0
- package/dist/provider-usage-ClDVmkhl.js +633 -0
- package/dist/provider-usage-DIC6cn-3.js +211 -0
- package/dist/provider-web-search-NzK8ep1E.js +507 -0
- package/dist/provider-wizard-C6jCuyQe.js +236 -0
- package/dist/provider-zai-endpoint-DeDABzT4.js +106 -0
- package/dist/proxy-H5O2p6AP.js +121 -0
- package/dist/proxy-env-DG2u55RW.js +40 -0
- package/dist/push-apns-D4zD2tmP.js +1050 -0
- package/dist/pw-ai-BuPUVeUK.js +1876 -0
- package/dist/qmd-manager-BpygGMW9.js +1571 -0
- package/dist/qr-cli-DnWHXcxh.js +370 -0
- package/dist/qr-cli-yaZ0FZ6z.js +213 -0
- package/dist/query-expansion-Do45hILP.js +1114 -0
- package/dist/reactions-BcC_XZqD.js +281 -0
- package/dist/read-only-account-inspect-DPJzadPo.js +42 -0
- package/dist/read-only-account-inspect.discord.runtime-CW9DDKH8.js +216 -0
- package/dist/read-only-account-inspect.slack.runtime-BcXBPyh3.js +216 -0
- package/dist/read-only-account-inspect.telegram.runtime-Y7h0Jbdj.js +216 -0
- package/dist/redact-BDinS1q9.js +102 -0
- package/dist/redact-identifier-FUiWQxv5.js +13 -0
- package/dist/redact-snapshot-DBPmeYy2.js +2654 -0
- package/dist/ref-contract-CCBBbf1r.js +53 -0
- package/dist/register-CppP7Ddc.js +43 -0
- package/dist/register.agent-BOD5ROGQ.js +546 -0
- package/dist/register.backup-Y2VGqcRu.js +269 -0
- package/dist/register.configure-1qiTINph.js +354 -0
- package/dist/register.maintenance-shn-zigv.js +694 -0
- package/dist/register.message-mR4CLSoo.js +812 -0
- package/dist/register.onboard-CkDryVid.js +298 -0
- package/dist/register.setup-B0xW5olD.js +318 -0
- package/dist/register.status-health-sessions-CuhWc03j.js +604 -0
- package/dist/register.subclis-BazXM5TW.js +315 -0
- package/dist/register.subclis-C2d8UDhH.js +13 -0
- package/dist/registry-C3q59Qj0.js +55 -0
- package/dist/registry-CPsHw6xU.js +219 -0
- package/dist/registry-CxgtJ09C.js +28 -0
- package/dist/registry-rgYi7KoO.js +160 -0
- package/dist/repair-qXnOAvDy.js +105 -0
- package/dist/replies-EiwmmZ_W.js +122 -0
- package/dist/reply-history-CVCD5oE9.js +1 -0
- package/dist/reply-payload-DBGc074f.js +232 -0
- package/dist/report-cli-DB1jQx32.js +42 -0
- package/dist/request-url-BKfWAQx8.js +10 -0
- package/dist/resolve-Ckjd8TAk.js +14 -0
- package/dist/resolve-T2q_0ARF.js +619 -0
- package/dist/resolve-route-vEY3ONZ2.js +466 -0
- package/dist/resolve-utils-CbqJY2bs.js +102 -0
- package/dist/response-generator-VdoCcQ3y.js +153 -0
- package/dist/restart-stale-pids-CLGiqU2E.js +187 -0
- package/dist/retry-D15TD1S3.js +168 -0
- package/dist/root-help-B9Aou4ho.js +32 -0
- package/dist/routes-TpLEcKO8.js +7084 -0
- package/dist/routing-Y3m0o-kB.js +26 -0
- package/dist/rpc-C6MN-nVc.js +67 -0
- package/dist/run-command-DRKv5Lj6.js +32 -0
- package/dist/run-main-YZSMdx0B.js +424 -0
- package/dist/run-with-concurrency-BrSjWzpg.js +41 -0
- package/dist/runtime-B66W9flm.js +43 -0
- package/dist/runtime-C9VaVKYZ.js +2338 -0
- package/dist/runtime-CT2LIJZu.js +91 -0
- package/dist/runtime-CqDQ81eY.js +143 -0
- package/dist/runtime-CuvWMN7E.js +89 -0
- package/dist/runtime-D4_OpzA1.js +5 -0
- package/dist/runtime-DP-4DZja.js +5 -0
- package/dist/runtime-Dl17x_cV.js +1 -0
- package/dist/runtime-Z35JoYPC.js +30 -0
- package/dist/runtime-api-D79M0lQN.js +1 -0
- package/dist/runtime-api-y3zfnQGK.js +39 -0
- package/dist/runtime-discord-ops.runtime-Bg5h5v9-.js +234 -0
- package/dist/runtime-env-a_iwdJIv.js +1 -0
- package/dist/runtime-forwarders-DtMc8rBP.js +44 -0
- package/dist/runtime-group-policy-B7irU4eu.js +59 -0
- package/dist/runtime-guard-y62lPDGY.js +58 -0
- package/dist/runtime-parse-CeqXmZHJ.js +84 -0
- package/dist/runtime-paths-CstaCCMi.js +334 -0
- package/dist/runtime-slack-ops.runtime-BumgKDhS.js +226 -0
- package/dist/runtime-status-CgL02wYX.js +15 -0
- package/dist/runtime-store-Bt3Sdbrn.js +22 -0
- package/dist/runtime-telegram-ops.runtime-rSLQ3KrE.js +233 -0
- package/dist/runtime-whatsapp-boundary-xZem0NyQ.js +364 -0
- package/dist/safe-open-sync-Bt9R1Mnf.js +83 -0
- package/dist/safe-regex-tLlDZYfM.js +244 -0
- package/dist/safe-text-B_CQuica.js +16 -0
- package/dist/sandbox-CUUouiKs.js +2795 -0
- package/dist/sandbox-cli-BN8y0Get.js +499 -0
- package/dist/sandbox-paths-fqp_TZdO.js +144 -0
- package/dist/sandbox-qSs4h3sk.js +1 -0
- package/dist/sanitize-env-vars-vNSNqm0y.js +74 -0
- package/dist/scan-paths-BJmvUZ1E.js +28 -0
- package/dist/search-manager-DWhFgwyp.js +17 -0
- package/dist/search-manager-r8Cw4ZRv.js +392 -0
- package/dist/secret-equal-ObQfyZGa.js +9 -0
- package/dist/secret-file-Ch0yuOXR.js +11 -0
- package/dist/secret-file-DYJtH6kf.js +92 -0
- package/dist/secret-input-4REZ4sHo.js +35 -0
- package/dist/secrets-cli-D1df8b0o.js +2304 -0
- package/dist/secure-random-Cs8tw_HQ.js +10 -0
- package/dist/security-cli-V66ESmdT.js +676 -0
- package/dist/security-runtime-BuEhpJVE.js +23 -0
- package/dist/send-3tabvle6.js +100 -0
- package/dist/send-CC5J3tyW.js +1026 -0
- package/dist/send-deps-CrFMNvqO.js +19 -0
- package/dist/send-i2-mdtiE.js +250 -0
- package/dist/server-BTOjmlyi.js +116 -0
- package/dist/server-middleware-CCqKhKUb.js +106 -0
- package/dist/server-node-events-D6y22Tt8.js +611 -0
- package/dist/server-startup-matrix-migration-DHWSoS73.js +1595 -0
- package/dist/service-Bxc9uL2e.js +774 -0
- package/dist/service-CBLajPZL.js +21 -0
- package/dist/session-cost-usage-BmbaBvk4.js +212 -0
- package/dist/session-cost-usage-C30Jl2SI.js +615 -0
- package/dist/session-fork.runtime-BZfcC1Nc.js +51 -0
- package/dist/session-key-gFFk3uv9.js +216 -0
- package/dist/session-write-lock-DNKvpjKf.js +324 -0
- package/dist/sessions-BIH_j_XS.js +222 -0
- package/dist/sessions-D5dWcxC_.js +212 -0
- package/dist/sessions-DaSBVNwD.js +669 -0
- package/dist/setup-C2XF1YH3.js +397 -0
- package/dist/setup-CN-teRpz.js +8 -0
- package/dist/setup-adapter-runtime-Bjv2adwG.js +1 -0
- package/dist/setup-binary-BOJA7zdN.js +30 -0
- package/dist/setup-browser-BhNPCUtK.js +71 -0
- package/dist/setup-core-BsG09DZH.js +149 -0
- package/dist/setup-core-D-O1GQax.js +162 -0
- package/dist/setup-core-Dtm54Rcq.js +510 -0
- package/dist/setup-entry-B1mTa7bU.js +10 -0
- package/dist/setup-entry-CTMgw-K5.js +13 -0
- package/dist/setup-entry-Cmd_cufO.js +13 -0
- package/dist/setup-entry-CybgA3zP.js +12 -0
- package/dist/setup-entry-DED_hL6i.js +12 -0
- package/dist/setup-entry-WCq9VMWx.js +14 -0
- package/dist/setup-group-access-BtPApRvE.js +70 -0
- package/dist/setup-helpers-B62Ecg9r.js +362 -0
- package/dist/setup-surface-B7A7qowY.js +452 -0
- package/dist/setup-surface-BBYJVRXc.js +380 -0
- package/dist/setup-surface-CFUz_BJi.js +298 -0
- package/dist/setup-tools-BPiMjAN7.js +1 -0
- package/dist/setup-wizard-helpers-COZ1UAdX.js +770 -0
- package/dist/setup-wizard-proxy-Slwi-1gX.js +116 -0
- package/dist/setup.finalize-B8O01nge.js +633 -0
- package/dist/setup.gateway-config-BPDIFk__.js +288 -0
- package/dist/setup.secret-input-BL-bqJpt.js +25 -0
- package/dist/shared-AygSbeCK.js +50 -0
- package/dist/shared-BHqDLkMG.js +127 -0
- package/dist/shared-BPtG8PgB.js +70 -0
- package/dist/shared-BU0QgVMZ.js +36 -0
- package/dist/shared-Bzr2UyEm.js +351 -0
- package/dist/shared-C_XXbGIF.js +87 -0
- package/dist/shared-Diw3KzwZ.js +82 -0
- package/dist/shared-DngjQumT.js +196 -0
- package/dist/shared-DzH3zmAy.js +64 -0
- package/dist/shared-LeP8iUTz.js +54 -0
- package/dist/shell-argv-DWV43Vya.js +72 -0
- package/dist/shell-env-cD92jEyV.js +181 -0
- package/dist/signal-BQd9f9dF.js +315 -0
- package/dist/signal-Ca7y47bM.js +46 -0
- package/dist/signal-Did9U_fa.js +214 -0
- package/dist/signal-cli-install-DxoL8CgF.js +188 -0
- package/dist/skill-commands-CiSwTFBQ.js +652 -0
- package/dist/skill-commands.runtime-CEwlWT4j.js +34 -0
- package/dist/skill-scanner-DG7MT7pu.js +354 -0
- package/dist/skills-BC8GJ9Rp.js +22 -0
- package/dist/skills-CCgKs_NJ.js +863 -0
- package/dist/skills-cli-dhYXJCuL.js +339 -0
- package/dist/skills-install-DiriUXJd.js +763 -0
- package/dist/skills-status-BmQTn4jL.js +23 -0
- package/dist/skills-status-a9b899Y3.js +169 -0
- package/dist/slack-CXgv7nu7.js +730 -0
- package/dist/slack-CcSByPzI.js +217 -0
- package/dist/slack-CtcCh0Lj.js +24537 -0
- package/dist/slack-core-DcsbATUs.js +1 -0
- package/dist/slash-commands.runtime-kO8EUKYW.js +228 -0
- package/dist/slash-dispatch.runtime-Bu2yMeFy.js +238 -0
- package/dist/slash-skill-commands.runtime-wwX3tF84.js +216 -0
- package/dist/speech-bSreRuDH.js +1 -0
- package/dist/speech-runtime-y1FcnGVA.js +1 -0
- package/dist/src-CmXHIz5f.js +846 -0
- package/dist/ssh-config-ChqR6ijV.js +77 -0
- package/dist/ssh-tunnel-Cz51VBAt.js +159 -0
- package/dist/ssh-tunnel-DWze2IQS.js +16 -0
- package/dist/ssrf-Dk9XaoKN.js +220 -0
- package/dist/ssrf-policy-Dk6oMa20.js +69 -0
- package/dist/ssrf-runtime-C-mAQLVA.js +1 -0
- package/dist/stagger-DU7FjHYo.js +54 -0
- package/dist/state-paths-DJIGEFq_.js +1 -0
- package/dist/status-69r8-Zey.js +75 -0
- package/dist/status-BdLTvZOL.js +44 -0
- package/dist/status-Bt7DQmRI.js +1665 -0
- package/dist/status-CoUFSBgt.js +202 -0
- package/dist/status-DbI3Kbh5.js +235 -0
- package/dist/status-DeKlzu_o.js +212 -0
- package/dist/status-Haie42Fc.js +606 -0
- package/dist/status-helpers-Cda-rGLX.js +101 -0
- package/dist/status-json-DS1M_MWJ.js +322 -0
- package/dist/status.link-channel-Cb8bZ_Od.js +40 -0
- package/dist/status.scan.deps.runtime-7_6VUs50.js +77 -0
- package/dist/status.scan.runtime-DtR8BIE9.js +14 -0
- package/dist/status.summary-l_Bi1buR.js +600 -0
- package/dist/status.summary.runtime-Cng6MzRU.js +151 -0
- package/dist/status.update-DtbnnPKx.js +79 -0
- package/dist/store-CvL8MPei.js +1446 -0
- package/dist/store.runtime-hgnvmZgO.js +43 -0
- package/dist/string-normalization-CvzuCAZv.js +19 -0
- package/dist/string-sample-BOLqzr4Y.js +11 -0
- package/dist/subagent-orphan-recovery-si1z2iBu.js +407 -0
- package/dist/subagent-registry-runtime-CXUDI8gL.js +211 -0
- package/dist/subcli-descriptors-CY_nHzpZ.js +151 -0
- package/dist/subsystem-CUp-6QQf.js +421 -0
- package/dist/synology-chat-CdejNfs0.js +12 -0
- package/dist/system-cli-DkOaXHkQ.js +99 -0
- package/dist/system-events-mAu6Ap6K.js +75 -0
- package/dist/system-message-DA9eUYzB.js +16 -0
- package/dist/system-run-command-Cxq2F1MB.js +258 -0
- package/dist/systemd-CrxZBFae.js +557 -0
- package/dist/systemd-hints-y-zJ9aTm.js +315 -0
- package/dist/systemd-linger-BdklDcLg.js +16 -0
- package/dist/systemd-linger-DLrbG9_d.js +68 -0
- package/dist/table-DFMOhmNZ.js +305 -0
- package/dist/tailnet-ofqBrXzu.js +38 -0
- package/dist/tailscale-Cbsx-2HB.js +254 -0
- package/dist/target-errors-ksphhzJg.js +26 -0
- package/dist/target-registry-krAVlXi_.js +1321 -0
- package/dist/telegram/audit.js +2 -0
- package/dist/telegram/token.js +211 -0
- package/dist/telegram-BjDUP22F.js +10910 -0
- package/dist/telegram-DMiNSGAJ.js +575 -0
- package/dist/telegram-Dt11B3JL.js +218 -0
- package/dist/telegram-core-B4Jo-uko.js +1 -0
- package/dist/template-messages-kh7VfgOb.js +214 -0
- package/dist/text-chunking-CUf5WgqG.js +19 -0
- package/dist/text-format-sFXlJfHH.js +8 -0
- package/dist/text-runtime-C_Roi_Je.js +1418 -0
- package/dist/theme-B5HDbQfl.js +2 -0
- package/dist/theme-CdOoMzRk.js +34 -0
- package/dist/thinking-BBD_0HSp.js +68 -0
- package/dist/thinking.shared-CncvRHts.js +246 -0
- package/dist/thread-bindings-messages-Cdo8jSa9.js +229 -0
- package/dist/thread-bindings-policy-DMjOaNyR.js +119 -0
- package/dist/thread-bindings-runtime-Ckwk3Uuz.js +1 -0
- package/dist/threading-helpers-Cq55SUtb.js +14 -0
- package/dist/timeouts-BwR1sGom.js +72 -0
- package/dist/tmp-openclaw-dir-idKIOMmb.js +102 -0
- package/dist/token-Bgv8XEsC.js +50 -0
- package/dist/tool-catalog-BV6FcEWS.js +337 -0
- package/dist/tool-policy-match-CHqTCSdK.js +46 -0
- package/dist/tool-send-9LXKcrda.js +16 -0
- package/dist/topology-cli-BhUXVViF.js +43 -0
- package/dist/transcript-events-B1V6z5ct.js +29 -0
- package/dist/tui-DDJMGCFK.js +3838 -0
- package/dist/tui-cli-ByN-ZH6y.js +237 -0
- package/dist/typebox-D0SHDJST.js +175 -0
- package/dist/types-BCKGVVld.js +83 -0
- package/dist/types-CtpUGsDP.js +30 -0
- package/dist/types.secrets-BWSeXrF4.js +80 -0
- package/dist/types.tools-BBO8HCi6.js +22 -0
- package/dist/typing-DG_YqWJ7.js +224 -0
- package/dist/unhandled-rejections-CDJ8dOVP.js +170 -0
- package/dist/unhandled-rejections-O6cVOz2D.js +4 -0
- package/dist/update-Br8U-txJ.js +1039 -0
- package/dist/update-check-C3TeQaWg.js +464 -0
- package/dist/update-cli-XHfIntD0.js +1625 -0
- package/dist/update-offset-store-36vzzZXw.js +211 -0
- package/dist/upsert-with-lock-Bb96JHpb.js +34 -0
- package/dist/url-userinfo-Db63ng4y.js +14 -0
- package/dist/utils-Bxk6BLTg.js +236 -0
- package/dist/utils-vDeUf98G.js +7 -0
- package/dist/version-DCY9_obP.js +64 -0
- package/dist/version-DRF-wKTV.js +2 -0
- package/dist/voice-call-D4fgwZNO.js +1 -0
- package/dist/warning-filter-CgvLQB4Y.js +56 -0
- package/dist/web-media-BfBb8i48.js +1 -0
- package/dist/web-media-CtU6jM5V.js +498 -0
- package/dist/webhook-ingress-CupqYpKM.js +338 -0
- package/dist/webhook-memory-guards-BHrFZ4yq.js +129 -0
- package/dist/webhook-path-BGFZ55ML.js +22 -0
- package/dist/webhook-shared-Cvk3b0ac.js +349 -0
- package/dist/webhooks-cli-vOAoBF9b.js +357 -0
- package/dist/whatsapp-D5nD0rGG.js +58 -0
- package/dist/whatsapp-DXbWlm3A.js +82 -0
- package/dist/whatsapp-core-C2WGMsaY.js +89451 -0
- package/dist/whatsapp-heartbeat-CSWnPQ7q.js +84 -0
- package/dist/whatsapp-shared-BmHKqTtR.js +95 -0
- package/dist/widearea-dns-CXimgJzu.js +125 -0
- package/dist/windows-argv-IXrdWrJj.js +145 -0
- package/dist/windows-spawn-vMJGZo89.js +154 -0
- package/dist/with-timeout-2AKTISee.js +58 -0
- package/dist/workspace-BH7CXmrr.js +479 -0
- package/dist/workspace-dirs-_O4V3xCR.js +13 -0
- package/dist/workspace-v5XppK5M.js +302 -0
- package/dist/ws-By-QcLjg.js +11 -0
- package/dist/wsl-BV3Cb66X.js +57 -0
- package/dist/zalo-CHQzsLhE.js +301 -0
- package/dist/zalo-CcJ3J9f2.js +13 -0
- package/dist/zod-schema.agent-runtime-T_EC_6fg.js +600 -0
- package/dist/zod-schema.core-BdgRr-F1.js +545 -0
- package/dist/zod-schema.providers-core-Dgq7MTqU.js +1613 -0
- package/docs/.i18n/README.md +31 -0
- package/docs/.i18n/glossary.ja-JP.json +14 -0
- package/docs/.i18n/glossary.zh-CN.json +242 -0
- package/docs/.i18n/ja-JP.tm.jsonl +0 -0
- package/docs/assets/install-script.svg +1 -0
- package/docs/assets/macos-onboarding/01-macos-warning.jpeg +0 -0
- package/docs/assets/macos-onboarding/02-local-networks.jpeg +0 -0
- package/docs/assets/macos-onboarding/03-security-notice.png +0 -0
- package/docs/assets/macos-onboarding/04-choose-gateway.png +0 -0
- package/docs/assets/macos-onboarding/05-permissions.png +0 -0
- package/docs/assets/openclaw-logo-text-dark.png +0 -0
- package/docs/assets/openclaw-logo-text-dark.svg +418 -0
- package/docs/assets/openclaw-logo-text.png +0 -0
- package/docs/assets/openclaw-logo-text.svg +418 -0
- package/docs/assets/pixel-lobster.svg +60 -0
- package/docs/assets/showcase/agents-ui.jpg +0 -0
- package/docs/assets/showcase/bambu-cli.png +0 -0
- package/docs/assets/showcase/codexmonitor.png +0 -0
- package/docs/assets/showcase/gohome-grafana.png +0 -0
- package/docs/assets/showcase/ios-testflight.jpg +0 -0
- package/docs/assets/showcase/oura-health.png +0 -0
- package/docs/assets/showcase/padel-cli.svg +11 -0
- package/docs/assets/showcase/padel-screenshot.jpg +0 -0
- package/docs/assets/showcase/papla-tts.jpg +0 -0
- package/docs/assets/showcase/pr-review-telegram.jpg +0 -0
- package/docs/assets/showcase/roborock-screenshot.jpg +0 -0
- package/docs/assets/showcase/roborock-status.svg +13 -0
- package/docs/assets/showcase/roof-camera-sky.jpg +0 -0
- package/docs/assets/showcase/snag.png +0 -0
- package/docs/assets/showcase/tesco-shop.jpg +0 -0
- package/docs/assets/showcase/wienerlinien.png +0 -0
- package/docs/assets/showcase/wine-cellar-skill.jpg +0 -0
- package/docs/assets/showcase/winix-air-purifier.jpg +0 -0
- package/docs/assets/showcase/xuezh-pronunciation.jpeg +0 -0
- package/docs/assets/sponsors/blacksmith.svg +14 -0
- package/docs/assets/sponsors/convex.svg +16 -0
- package/docs/assets/sponsors/openai.svg +3 -0
- package/docs/assets/sponsors/vercel.svg +5 -0
- package/docs/auth-credential-semantics.md +53 -0
- package/docs/automation/auth-monitoring.md +44 -0
- package/docs/automation/cron-jobs.md +727 -0
- package/docs/automation/cron-vs-heartbeat.md +286 -0
- package/docs/automation/gmail-pubsub.md +256 -0
- package/docs/automation/hooks.md +1049 -0
- package/docs/automation/poll.md +86 -0
- package/docs/automation/standing-orders.md +251 -0
- package/docs/automation/troubleshooting.md +122 -0
- package/docs/automation/webhook.md +217 -0
- package/docs/brave-search.md +93 -0
- package/docs/channels/bluebubbles.md +347 -0
- package/docs/channels/broadcast-groups.md +442 -0
- package/docs/channels/channel-routing.md +139 -0
- package/docs/channels/discord.md +1229 -0
- package/docs/channels/feishu.md +747 -0
- package/docs/channels/googlechat.md +261 -0
- package/docs/channels/group-messages.md +84 -0
- package/docs/channels/groups.md +379 -0
- package/docs/channels/imessage.md +367 -0
- package/docs/channels/index.md +47 -0
- package/docs/channels/irc.md +242 -0
- package/docs/channels/line.md +194 -0
- package/docs/channels/location.md +56 -0
- package/docs/channels/matrix.md +677 -0
- package/docs/channels/mattermost.md +427 -0
- package/docs/channels/msteams.md +780 -0
- package/docs/channels/nextcloud-talk.md +138 -0
- package/docs/channels/nostr.md +242 -0
- package/docs/channels/pairing.md +114 -0
- package/docs/channels/signal.md +329 -0
- package/docs/channels/slack.md +603 -0
- package/docs/channels/synology-chat.md +132 -0
- package/docs/channels/telegram.md +987 -0
- package/docs/channels/tlon.md +276 -0
- package/docs/channels/troubleshooting.md +118 -0
- package/docs/channels/twitch.md +379 -0
- package/docs/channels/whatsapp.md +460 -0
- package/docs/channels/zalo.md +243 -0
- package/docs/channels/zalouser.md +181 -0
- package/docs/ci.md +55 -0
- package/docs/cli/acp.md +288 -0
- package/docs/cli/agent.md +29 -0
- package/docs/cli/agents.md +123 -0
- package/docs/cli/approvals.md +50 -0
- package/docs/cli/backup.md +76 -0
- package/docs/cli/browser.md +106 -0
- package/docs/cli/channels.md +102 -0
- package/docs/cli/clawbot.md +21 -0
- package/docs/cli/completion.md +35 -0
- package/docs/cli/config.md +295 -0
- package/docs/cli/configure.md +36 -0
- package/docs/cli/cron.md +77 -0
- package/docs/cli/daemon.md +53 -0
- package/docs/cli/dashboard.md +22 -0
- package/docs/cli/devices.md +139 -0
- package/docs/cli/directory.md +63 -0
- package/docs/cli/dns.md +23 -0
- package/docs/cli/docs.md +15 -0
- package/docs/cli/doctor.md +48 -0
- package/docs/cli/gateway.md +235 -0
- package/docs/cli/health.md +21 -0
- package/docs/cli/hooks.md +318 -0
- package/docs/cli/index.md +1147 -0
- package/docs/cli/logs.md +28 -0
- package/docs/cli/memory.md +66 -0
- package/docs/cli/message.md +278 -0
- package/docs/cli/models.md +81 -0
- package/docs/cli/node.md +127 -0
- package/docs/cli/nodes.md +75 -0
- package/docs/cli/onboard.md +157 -0
- package/docs/cli/pairing.md +32 -0
- package/docs/cli/plugins.md +186 -0
- package/docs/cli/qr.md +46 -0
- package/docs/cli/reset.md +20 -0
- package/docs/cli/sandbox.md +197 -0
- package/docs/cli/secrets.md +188 -0
- package/docs/cli/security.md +79 -0
- package/docs/cli/sessions.md +110 -0
- package/docs/cli/setup.md +29 -0
- package/docs/cli/skills.md +26 -0
- package/docs/cli/status.md +30 -0
- package/docs/cli/system.md +60 -0
- package/docs/cli/tui.md +30 -0
- package/docs/cli/uninstall.md +20 -0
- package/docs/cli/update.md +103 -0
- package/docs/cli/voicecall.md +34 -0
- package/docs/cli/webhooks.md +25 -0
- package/docs/concepts/agent-loop.md +148 -0
- package/docs/concepts/agent-workspace.md +236 -0
- package/docs/concepts/agent.md +122 -0
- package/docs/concepts/architecture.md +137 -0
- package/docs/concepts/compaction.md +123 -0
- package/docs/concepts/context-engine.md +268 -0
- package/docs/concepts/context.md +172 -0
- package/docs/concepts/delegate-architecture.md +296 -0
- package/docs/concepts/features.md +73 -0
- package/docs/concepts/markdown-formatting.md +130 -0
- package/docs/concepts/memory.md +108 -0
- package/docs/concepts/messages.md +154 -0
- package/docs/concepts/model-failover.md +152 -0
- package/docs/concepts/model-providers.md +607 -0
- package/docs/concepts/models.md +225 -0
- package/docs/concepts/multi-agent.md +552 -0
- package/docs/concepts/oauth.md +158 -0
- package/docs/concepts/presence.md +102 -0
- package/docs/concepts/queue.md +89 -0
- package/docs/concepts/retry.md +69 -0
- package/docs/concepts/session-pruning.md +121 -0
- package/docs/concepts/session-tool.md +242 -0
- package/docs/concepts/session.md +310 -0
- package/docs/concepts/streaming.md +155 -0
- package/docs/concepts/system-prompt.md +132 -0
- package/docs/concepts/timezone.md +91 -0
- package/docs/concepts/typebox.md +291 -0
- package/docs/concepts/typing-indicators.md +68 -0
- package/docs/concepts/usage-tracking.md +35 -0
- package/docs/date-time.md +128 -0
- package/docs/debug/node-issue.md +85 -0
- package/docs/diagnostics/flags.md +91 -0
- package/docs/docs.json +2061 -0
- package/docs/gateway/authentication.md +179 -0
- package/docs/gateway/background-process.md +97 -0
- package/docs/gateway/bonjour.md +177 -0
- package/docs/gateway/bridge-protocol.md +91 -0
- package/docs/gateway/cli-backends.md +225 -0
- package/docs/gateway/configuration-examples.md +651 -0
- package/docs/gateway/configuration-reference.md +3123 -0
- package/docs/gateway/configuration.md +633 -0
- package/docs/gateway/discovery.md +123 -0
- package/docs/gateway/doctor.md +362 -0
- package/docs/gateway/gateway-lock.md +34 -0
- package/docs/gateway/health.md +44 -0
- package/docs/gateway/heartbeat.md +393 -0
- package/docs/gateway/index.md +261 -0
- package/docs/gateway/local-models.md +152 -0
- package/docs/gateway/logging.md +113 -0
- package/docs/gateway/multiple-gateways.md +112 -0
- package/docs/gateway/network-model.md +22 -0
- package/docs/gateway/openai-http-api.md +132 -0
- package/docs/gateway/openresponses-http-api.md +295 -0
- package/docs/gateway/openshell.md +307 -0
- package/docs/gateway/pairing.md +99 -0
- package/docs/gateway/protocol.md +267 -0
- package/docs/gateway/remote-gateway-readme.md +158 -0
- package/docs/gateway/remote.md +153 -0
- package/docs/gateway/sandbox-vs-tool-policy-vs-elevated.md +134 -0
- package/docs/gateway/sandboxing.md +469 -0
- package/docs/gateway/secrets-plan-contract.md +116 -0
- package/docs/gateway/secrets.md +503 -0
- package/docs/gateway/security/index.md +1213 -0
- package/docs/gateway/tailscale.md +132 -0
- package/docs/gateway/tools-invoke-http-api.md +110 -0
- package/docs/gateway/troubleshooting.md +378 -0
- package/docs/gateway/trusted-proxy-auth.md +330 -0
- package/docs/help/debugging.md +168 -0
- package/docs/help/environment.md +163 -0
- package/docs/help/faq.md +2999 -0
- package/docs/help/index.md +28 -0
- package/docs/help/scripts.md +28 -0
- package/docs/help/testing.md +524 -0
- package/docs/help/troubleshooting.md +297 -0
- package/docs/images/configure-model-picker-unsearchable.png +0 -0
- package/docs/images/feishu-step2-create-app.png +0 -0
- package/docs/images/feishu-step3-credentials.png +0 -0
- package/docs/images/feishu-step4-permissions.png +0 -0
- package/docs/images/feishu-step5-bot-capability.png +0 -0
- package/docs/images/feishu-step6-event-subscription.png +0 -0
- package/docs/images/feishu-verification-token.png +0 -0
- package/docs/images/groups-flow.svg +52 -0
- package/docs/images/mobile-ui-screenshot.png +0 -0
- package/docs/index.md +196 -0
- package/docs/install/ansible.md +230 -0
- package/docs/install/azure.md +311 -0
- package/docs/install/bun.md +55 -0
- package/docs/install/development-channels.md +120 -0
- package/docs/install/digitalocean.md +129 -0
- package/docs/install/docker-vm-runtime.md +142 -0
- package/docs/install/docker.md +375 -0
- package/docs/install/exe-dev.md +126 -0
- package/docs/install/fly.md +501 -0
- package/docs/install/gcp.md +402 -0
- package/docs/install/hetzner.md +251 -0
- package/docs/install/index.md +183 -0
- package/docs/install/installer.md +415 -0
- package/docs/install/kubernetes.md +191 -0
- package/docs/install/macos-vm.md +281 -0
- package/docs/install/migrating-matrix.md +346 -0
- package/docs/install/migrating.md +110 -0
- package/docs/install/nix.md +89 -0
- package/docs/install/node.md +138 -0
- package/docs/install/northflank.mdx +54 -0
- package/docs/install/oracle.md +156 -0
- package/docs/install/podman.md +133 -0
- package/docs/install/railway.mdx +100 -0
- package/docs/install/raspberry-pi.md +159 -0
- package/docs/install/render.mdx +169 -0
- package/docs/install/uninstall.md +128 -0
- package/docs/install/updating.md +128 -0
- package/docs/ja-JP/index.md +186 -0
- package/docs/ja-JP/start/getting-started.md +125 -0
- package/docs/ja-JP/start/wizard.md +77 -0
- package/docs/logging.md +352 -0
- package/docs/nav-tabs-underline.js +100 -0
- package/docs/network.md +54 -0
- package/docs/nodes/audio.md +187 -0
- package/docs/nodes/camera.md +162 -0
- package/docs/nodes/images.md +72 -0
- package/docs/nodes/index.md +393 -0
- package/docs/nodes/location-command.md +98 -0
- package/docs/nodes/media-understanding.md +394 -0
- package/docs/nodes/talk.md +92 -0
- package/docs/nodes/troubleshooting.md +114 -0
- package/docs/nodes/voicewake.md +66 -0
- package/docs/perplexity.md +174 -0
- package/docs/pi-dev.md +80 -0
- package/docs/pi.md +567 -0
- package/docs/platforms/android.md +168 -0
- package/docs/platforms/digitalocean.md +266 -0
- package/docs/platforms/index.md +54 -0
- package/docs/platforms/ios.md +220 -0
- package/docs/platforms/linux.md +94 -0
- package/docs/platforms/mac/bundled-gateway.md +73 -0
- package/docs/platforms/mac/canvas.md +125 -0
- package/docs/platforms/mac/child-process.md +69 -0
- package/docs/platforms/mac/dev-setup.md +104 -0
- package/docs/platforms/mac/health.md +34 -0
- package/docs/platforms/mac/icon.md +31 -0
- package/docs/platforms/mac/logging.md +57 -0
- package/docs/platforms/mac/menu-bar.md +81 -0
- package/docs/platforms/mac/peekaboo.md +65 -0
- package/docs/platforms/mac/permissions.md +50 -0
- package/docs/platforms/mac/remote.md +84 -0
- package/docs/platforms/mac/signing.md +47 -0
- package/docs/platforms/mac/skills.md +33 -0
- package/docs/platforms/mac/voice-overlay.md +60 -0
- package/docs/platforms/mac/voicewake.md +67 -0
- package/docs/platforms/mac/webchat.md +43 -0
- package/docs/platforms/mac/xpc.md +61 -0
- package/docs/platforms/macos.md +226 -0
- package/docs/platforms/oracle.md +303 -0
- package/docs/platforms/raspberry-pi.md +412 -0
- package/docs/platforms/windows.md +241 -0
- package/docs/plugins/agent-tools.md +10 -0
- package/docs/plugins/architecture.md +1363 -0
- package/docs/plugins/building-extensions.md +10 -0
- package/docs/plugins/building-plugins.md +376 -0
- package/docs/plugins/bundles.md +181 -0
- package/docs/plugins/community.md +141 -0
- package/docs/plugins/manifest.md +145 -0
- package/docs/plugins/sdk-migration.md +169 -0
- package/docs/plugins/voice-call.md +380 -0
- package/docs/plugins/zalouser.md +77 -0
- package/docs/prose.md +134 -0
- package/docs/providers/anthropic.md +259 -0
- package/docs/providers/bedrock.md +176 -0
- package/docs/providers/claude-max-api-proxy.md +154 -0
- package/docs/providers/cloudflare-ai-gateway.md +71 -0
- package/docs/providers/deepgram.md +93 -0
- package/docs/providers/github-copilot.md +72 -0
- package/docs/providers/glm.md +43 -0
- package/docs/providers/google.md +78 -0
- package/docs/providers/groq.md +96 -0
- package/docs/providers/huggingface.md +209 -0
- package/docs/providers/index.md +69 -0
- package/docs/providers/kilocode.md +74 -0
- package/docs/providers/litellm.md +154 -0
- package/docs/providers/minimax.md +224 -0
- package/docs/providers/mistral.md +54 -0
- package/docs/providers/models.md +45 -0
- package/docs/providers/modelstudio.md +66 -0
- package/docs/providers/moonshot.md +175 -0
- package/docs/providers/nvidia.md +55 -0
- package/docs/providers/ollama.md +352 -0
- package/docs/providers/openai.md +303 -0
- package/docs/providers/opencode-go.md +45 -0
- package/docs/providers/opencode.md +64 -0
- package/docs/providers/openrouter.md +37 -0
- package/docs/providers/perplexity-provider.md +62 -0
- package/docs/providers/qianfan.md +38 -0
- package/docs/providers/qwen.md +53 -0
- package/docs/providers/sglang.md +104 -0
- package/docs/providers/synthetic.md +99 -0
- package/docs/providers/together.md +66 -0
- package/docs/providers/venice.md +282 -0
- package/docs/providers/vercel-ai-gateway.md +60 -0
- package/docs/providers/vllm.md +92 -0
- package/docs/providers/volcengine.md +74 -0
- package/docs/providers/xai.md +60 -0
- package/docs/providers/xiaomi.md +86 -0
- package/docs/providers/zai.md +46 -0
- package/docs/reference/AGENTS.default.md +126 -0
- package/docs/reference/RELEASING.md +42 -0
- package/docs/reference/api-usage-costs.md +144 -0
- package/docs/reference/credits.md +30 -0
- package/docs/reference/device-models.md +47 -0
- package/docs/reference/memory-config.md +711 -0
- package/docs/reference/prompt-caching.md +185 -0
- package/docs/reference/rpc.md +43 -0
- package/docs/reference/secretref-credential-surface.md +140 -0
- package/docs/reference/secretref-user-supplied-credentials-matrix.json +563 -0
- package/docs/reference/session-management-compaction.md +324 -0
- package/docs/reference/templates/AGENTS.dev.md +83 -0
- package/docs/reference/templates/AGENTS.md +219 -0
- package/docs/reference/templates/BOOT.md +11 -0
- package/docs/reference/templates/BOOTSTRAP.md +62 -0
- package/docs/reference/templates/HEARTBEAT.md +14 -0
- package/docs/reference/templates/IDENTITY.dev.md +47 -0
- package/docs/reference/templates/IDENTITY.md +29 -0
- package/docs/reference/templates/SOUL.dev.md +76 -0
- package/docs/reference/templates/SOUL.md +43 -0
- package/docs/reference/templates/TOOLS.dev.md +24 -0
- package/docs/reference/templates/TOOLS.md +47 -0
- package/docs/reference/templates/USER.dev.md +18 -0
- package/docs/reference/templates/USER.md +23 -0
- package/docs/reference/test.md +90 -0
- package/docs/reference/token-use.md +175 -0
- package/docs/reference/transcript-hygiene.md +151 -0
- package/docs/reference/wizard.md +235 -0
- package/docs/security/CONTRIBUTING-THREAT-MODEL.md +98 -0
- package/docs/security/THREAT-MODEL-ATLAS.md +611 -0
- package/docs/security/formal-verification.md +167 -0
- package/docs/start/bootstrapping.md +41 -0
- package/docs/start/docs-directory.md +66 -0
- package/docs/start/getting-started.md +116 -0
- package/docs/start/hubs.md +198 -0
- package/docs/start/lore.md +219 -0
- package/docs/start/onboarding-overview.md +67 -0
- package/docs/start/onboarding.md +91 -0
- package/docs/start/openclaw.md +216 -0
- package/docs/start/quickstart.md +22 -0
- package/docs/start/setup.md +164 -0
- package/docs/start/showcase.md +418 -0
- package/docs/start/wizard-cli-automation.md +215 -0
- package/docs/start/wizard-cli-reference.md +299 -0
- package/docs/start/wizard.md +125 -0
- package/docs/style.css +37 -0
- package/docs/tools/acp-agents.md +623 -0
- package/docs/tools/agent-send.md +100 -0
- package/docs/tools/apply-patch.md +51 -0
- package/docs/tools/brave-search.md +93 -0
- package/docs/tools/browser-linux-troubleshooting.md +138 -0
- package/docs/tools/browser-login.md +73 -0
- package/docs/tools/browser-wsl2-windows-remote-cdp-troubleshooting.md +211 -0
- package/docs/tools/browser.md +731 -0
- package/docs/tools/btw.md +142 -0
- package/docs/tools/capability-cookbook.md +119 -0
- package/docs/tools/clawhub.md +257 -0
- package/docs/tools/creating-skills.md +117 -0
- package/docs/tools/diffs.md +386 -0
- package/docs/tools/elevated.md +114 -0
- package/docs/tools/exec-approvals.md +400 -0
- package/docs/tools/exec.md +204 -0
- package/docs/tools/firecrawl.md +140 -0
- package/docs/tools/index.md +137 -0
- package/docs/tools/llm-task.md +119 -0
- package/docs/tools/lobster.md +340 -0
- package/docs/tools/loop-detection.md +100 -0
- package/docs/tools/multi-agent-sandbox-tools.md +364 -0
- package/docs/tools/pdf.md +156 -0
- package/docs/tools/perplexity-search.md +174 -0
- package/docs/tools/plugin.md +251 -0
- package/docs/tools/reactions.md +64 -0
- package/docs/tools/skills-config.md +86 -0
- package/docs/tools/skills.md +306 -0
- package/docs/tools/slash-commands.md +294 -0
- package/docs/tools/subagents.md +295 -0
- package/docs/tools/tavily.md +125 -0
- package/docs/tools/thinking.md +96 -0
- package/docs/tools/tts.md +406 -0
- package/docs/tools/web.md +516 -0
- package/docs/tts.md +406 -0
- package/docs/vps.md +112 -0
- package/docs/web/control-ui.md +275 -0
- package/docs/web/dashboard.md +54 -0
- package/docs/web/index.md +120 -0
- package/docs/web/tui.md +170 -0
- package/docs/web/webchat.md +61 -0
- package/docs/whatsapp-openclaw-ai-zh.jpg +0 -0
- package/docs/whatsapp-openclaw.jpg +0 -0
- package/docs/zh-CN/AGENTS.md +61 -0
- package/docs/zh-CN/automation/auth-monitoring.md +47 -0
- package/docs/zh-CN/automation/cron-jobs.md +435 -0
- package/docs/zh-CN/automation/cron-vs-heartbeat.md +286 -0
- package/docs/zh-CN/automation/gmail-pubsub.md +249 -0
- package/docs/zh-CN/automation/hooks.md +1051 -0
- package/docs/zh-CN/automation/poll.md +76 -0
- package/docs/zh-CN/automation/troubleshooting.md +8 -0
- package/docs/zh-CN/automation/webhook.md +163 -0
- package/docs/zh-CN/brave-search.md +60 -0
- package/docs/zh-CN/channels/bluebubbles.md +354 -0
- package/docs/zh-CN/channels/broadcast-groups.md +449 -0
- package/docs/zh-CN/channels/channel-routing.md +117 -0
- package/docs/zh-CN/channels/discord.md +468 -0
- package/docs/zh-CN/channels/feishu.md +728 -0
- package/docs/zh-CN/channels/googlechat.md +257 -0
- package/docs/zh-CN/channels/grammy.md +38 -0
- package/docs/zh-CN/channels/group-messages.md +91 -0
- package/docs/zh-CN/channels/groups.md +379 -0
- package/docs/zh-CN/channels/imessage.md +302 -0
- package/docs/zh-CN/channels/index.md +53 -0
- package/docs/zh-CN/channels/line.md +180 -0
- package/docs/zh-CN/channels/location.md +63 -0
- package/docs/zh-CN/channels/matrix.md +221 -0
- package/docs/zh-CN/channels/mattermost.md +144 -0
- package/docs/zh-CN/channels/msteams.md +775 -0
- package/docs/zh-CN/channels/nextcloud-talk.md +142 -0
- package/docs/zh-CN/channels/nostr.md +249 -0
- package/docs/zh-CN/channels/pairing.md +89 -0
- package/docs/zh-CN/channels/signal.md +209 -0
- package/docs/zh-CN/channels/slack.md +531 -0
- package/docs/zh-CN/channels/synology-chat.md +138 -0
- package/docs/zh-CN/channels/telegram.md +751 -0
- package/docs/zh-CN/channels/tlon.md +136 -0
- package/docs/zh-CN/channels/troubleshooting.md +36 -0
- package/docs/zh-CN/channels/twitch.md +385 -0
- package/docs/zh-CN/channels/whatsapp.md +411 -0
- package/docs/zh-CN/channels/zalo.md +196 -0
- package/docs/zh-CN/channels/zalouser.md +147 -0
- package/docs/zh-CN/cli/acp.md +173 -0
- package/docs/zh-CN/cli/agent.md +30 -0
- package/docs/zh-CN/cli/agents.md +82 -0
- package/docs/zh-CN/cli/approvals.md +57 -0
- package/docs/zh-CN/cli/browser.md +114 -0
- package/docs/zh-CN/cli/channels.md +86 -0
- package/docs/zh-CN/cli/config.md +57 -0
- package/docs/zh-CN/cli/configure.md +38 -0
- package/docs/zh-CN/cli/cron.md +43 -0
- package/docs/zh-CN/cli/dashboard.md +23 -0
- package/docs/zh-CN/cli/devices.md +74 -0
- package/docs/zh-CN/cli/directory.md +70 -0
- package/docs/zh-CN/cli/dns.md +30 -0
- package/docs/zh-CN/cli/docs.md +22 -0
- package/docs/zh-CN/cli/doctor.md +48 -0
- package/docs/zh-CN/cli/gateway.md +206 -0
- package/docs/zh-CN/cli/health.md +28 -0
- package/docs/zh-CN/cli/hooks.md +298 -0
- package/docs/zh-CN/cli/index.md +1143 -0
- package/docs/zh-CN/cli/logs.md +31 -0
- package/docs/zh-CN/cli/memory.md +52 -0
- package/docs/zh-CN/cli/message.md +246 -0
- package/docs/zh-CN/cli/models.md +85 -0
- package/docs/zh-CN/cli/node.md +115 -0
- package/docs/zh-CN/cli/nodes.md +80 -0
- package/docs/zh-CN/cli/onboard.md +164 -0
- package/docs/zh-CN/cli/pairing.md +28 -0
- package/docs/zh-CN/cli/plugins.md +66 -0
- package/docs/zh-CN/cli/reset.md +24 -0
- package/docs/zh-CN/cli/sandbox.md +158 -0
- package/docs/zh-CN/cli/security.md +33 -0
- package/docs/zh-CN/cli/sessions.md +23 -0
- package/docs/zh-CN/cli/setup.md +36 -0
- package/docs/zh-CN/cli/skills.md +33 -0
- package/docs/zh-CN/cli/status.md +33 -0
- package/docs/zh-CN/cli/system.md +63 -0
- package/docs/zh-CN/cli/tui.md +30 -0
- package/docs/zh-CN/cli/uninstall.md +24 -0
- package/docs/zh-CN/cli/update.md +101 -0
- package/docs/zh-CN/cli/voicecall.md +41 -0
- package/docs/zh-CN/cli/webhooks.md +32 -0
- package/docs/zh-CN/concepts/agent-loop.md +146 -0
- package/docs/zh-CN/concepts/agent-workspace.md +219 -0
- package/docs/zh-CN/concepts/agent.md +115 -0
- package/docs/zh-CN/concepts/architecture.md +123 -0
- package/docs/zh-CN/concepts/compaction.md +67 -0
- package/docs/zh-CN/concepts/context.md +168 -0
- package/docs/zh-CN/concepts/features.md +59 -0
- package/docs/zh-CN/concepts/markdown-formatting.md +117 -0
- package/docs/zh-CN/concepts/memory.md +412 -0
- package/docs/zh-CN/concepts/messages.md +141 -0
- package/docs/zh-CN/concepts/model-failover.md +145 -0
- package/docs/zh-CN/concepts/model-providers.md +606 -0
- package/docs/zh-CN/concepts/models.md +225 -0
- package/docs/zh-CN/concepts/multi-agent.md +372 -0
- package/docs/zh-CN/concepts/oauth.md +164 -0
- package/docs/zh-CN/concepts/presence.md +99 -0
- package/docs/zh-CN/concepts/queue.md +94 -0
- package/docs/zh-CN/concepts/retry.md +76 -0
- package/docs/zh-CN/concepts/session-pruning.md +129 -0
- package/docs/zh-CN/concepts/session-tool.md +200 -0
- package/docs/zh-CN/concepts/session.md +166 -0
- package/docs/zh-CN/concepts/streaming.md +133 -0
- package/docs/zh-CN/concepts/system-prompt.md +101 -0
- package/docs/zh-CN/concepts/timezone.md +96 -0
- package/docs/zh-CN/concepts/typebox.md +284 -0
- package/docs/zh-CN/concepts/typing-indicators.md +74 -0
- package/docs/zh-CN/concepts/usage-tracking.md +42 -0
- package/docs/zh-CN/date-time.md +129 -0
- package/docs/zh-CN/debug/node-issue.md +90 -0
- package/docs/zh-CN/diagnostics/flags.md +98 -0
- package/docs/zh-CN/gateway/authentication.md +184 -0
- package/docs/zh-CN/gateway/background-process.md +100 -0
- package/docs/zh-CN/gateway/bonjour.md +174 -0
- package/docs/zh-CN/gateway/bridge-protocol.md +86 -0
- package/docs/zh-CN/gateway/cli-backends.md +213 -0
- package/docs/zh-CN/gateway/configuration-examples.md +587 -0
- package/docs/zh-CN/gateway/configuration-reference.md +3103 -0
- package/docs/zh-CN/gateway/configuration.md +640 -0
- package/docs/zh-CN/gateway/discovery.md +123 -0
- package/docs/zh-CN/gateway/doctor.md +238 -0
- package/docs/zh-CN/gateway/gateway-lock.md +41 -0
- package/docs/zh-CN/gateway/health.md +42 -0
- package/docs/zh-CN/gateway/heartbeat.md +274 -0
- package/docs/zh-CN/gateway/index.md +335 -0
- package/docs/zh-CN/gateway/local-models.md +159 -0
- package/docs/zh-CN/gateway/logging.md +114 -0
- package/docs/zh-CN/gateway/multiple-gateways.md +119 -0
- package/docs/zh-CN/gateway/network-model.md +23 -0
- package/docs/zh-CN/gateway/openai-http-api.md +125 -0
- package/docs/zh-CN/gateway/openresponses-http-api.md +317 -0
- package/docs/zh-CN/gateway/pairing.md +99 -0
- package/docs/zh-CN/gateway/protocol.md +220 -0
- package/docs/zh-CN/gateway/remote-gateway-readme.md +164 -0
- package/docs/zh-CN/gateway/remote.md +133 -0
- package/docs/zh-CN/gateway/sandbox-vs-tool-policy-vs-elevated.md +135 -0
- package/docs/zh-CN/gateway/sandboxing.md +188 -0
- package/docs/zh-CN/gateway/security/index.md +777 -0
- package/docs/zh-CN/gateway/tailscale.md +124 -0
- package/docs/zh-CN/gateway/tools-invoke-http-api.md +92 -0
- package/docs/zh-CN/gateway/troubleshooting.md +771 -0
- package/docs/zh-CN/help/debugging.md +160 -0
- package/docs/zh-CN/help/environment.md +88 -0
- package/docs/zh-CN/help/faq.md +2640 -0
- package/docs/zh-CN/help/index.md +28 -0
- package/docs/zh-CN/help/scripts.md +35 -0
- package/docs/zh-CN/help/testing.md +375 -0
- package/docs/zh-CN/help/troubleshooting.md +104 -0
- package/docs/zh-CN/index.md +186 -0
- package/docs/zh-CN/install/ansible.md +215 -0
- package/docs/zh-CN/install/bun.md +65 -0
- package/docs/zh-CN/install/development-channels.md +81 -0
- package/docs/zh-CN/install/docker.md +532 -0
- package/docs/zh-CN/install/exe-dev.md +133 -0
- package/docs/zh-CN/install/fly.md +490 -0
- package/docs/zh-CN/install/gcp.md +510 -0
- package/docs/zh-CN/install/hetzner.md +337 -0
- package/docs/zh-CN/install/index.md +235 -0
- package/docs/zh-CN/install/installer.md +422 -0
- package/docs/zh-CN/install/macos-vm.md +288 -0
- package/docs/zh-CN/install/migrating.md +199 -0
- package/docs/zh-CN/install/nix.md +99 -0
- package/docs/zh-CN/install/node.md +8 -0
- package/docs/zh-CN/install/northflank.mdx +60 -0
- package/docs/zh-CN/install/railway.mdx +106 -0
- package/docs/zh-CN/install/render.mdx +169 -0
- package/docs/zh-CN/install/uninstall.md +135 -0
- package/docs/zh-CN/install/updating.md +233 -0
- package/docs/zh-CN/logging.md +329 -0
- package/docs/zh-CN/network.md +59 -0
- package/docs/zh-CN/nodes/audio.md +120 -0
- package/docs/zh-CN/nodes/camera.md +162 -0
- package/docs/zh-CN/nodes/images.md +79 -0
- package/docs/zh-CN/nodes/index.md +348 -0
- package/docs/zh-CN/nodes/location-command.md +120 -0
- package/docs/zh-CN/nodes/media-understanding.md +380 -0
- package/docs/zh-CN/nodes/talk.md +97 -0
- package/docs/zh-CN/nodes/troubleshooting.md +8 -0
- package/docs/zh-CN/nodes/voicewake.md +72 -0
- package/docs/zh-CN/perplexity.md +102 -0
- package/docs/zh-CN/pi-dev.md +77 -0
- package/docs/zh-CN/pi.md +619 -0
- package/docs/zh-CN/platforms/android.md +155 -0
- package/docs/zh-CN/platforms/digitalocean.md +273 -0
- package/docs/zh-CN/platforms/index.md +60 -0
- package/docs/zh-CN/platforms/ios.md +114 -0
- package/docs/zh-CN/platforms/linux.md +100 -0
- package/docs/zh-CN/platforms/mac/bundled-gateway.md +75 -0
- package/docs/zh-CN/platforms/mac/canvas.md +128 -0
- package/docs/zh-CN/platforms/mac/child-process.md +73 -0
- package/docs/zh-CN/platforms/mac/dev-setup.md +109 -0
- package/docs/zh-CN/platforms/mac/health.md +41 -0
- package/docs/zh-CN/platforms/mac/icon.md +38 -0
- package/docs/zh-CN/platforms/mac/logging.md +64 -0
- package/docs/zh-CN/platforms/mac/menu-bar.md +88 -0
- package/docs/zh-CN/platforms/mac/peekaboo.md +62 -0
- package/docs/zh-CN/platforms/mac/permissions.md +46 -0
- package/docs/zh-CN/platforms/mac/remote.md +90 -0
- package/docs/zh-CN/platforms/mac/signing.md +54 -0
- package/docs/zh-CN/platforms/mac/skills.md +40 -0
- package/docs/zh-CN/platforms/mac/voice-overlay.md +67 -0
- package/docs/zh-CN/platforms/mac/voicewake.md +74 -0
- package/docs/zh-CN/platforms/mac/webchat.md +43 -0
- package/docs/zh-CN/platforms/mac/xpc.md +68 -0
- package/docs/zh-CN/platforms/macos.md +193 -0
- package/docs/zh-CN/platforms/oracle.md +310 -0
- package/docs/zh-CN/platforms/raspberry-pi.md +416 -0
- package/docs/zh-CN/platforms/windows.md +247 -0
- package/docs/zh-CN/plugins/agent-tools.md +99 -0
- package/docs/zh-CN/plugins/manifest.md +68 -0
- package/docs/zh-CN/plugins/voice-call.md +250 -0
- package/docs/zh-CN/plugins/zalouser.md +88 -0
- package/docs/zh-CN/prose.md +141 -0
- package/docs/zh-CN/providers/anthropic.md +265 -0
- package/docs/zh-CN/providers/bedrock.md +170 -0
- package/docs/zh-CN/providers/claude-max-api-proxy.md +155 -0
- package/docs/zh-CN/providers/cloudflare-ai-gateway.md +78 -0
- package/docs/zh-CN/providers/deepgram.md +97 -0
- package/docs/zh-CN/providers/github-copilot.md +67 -0
- package/docs/zh-CN/providers/glm.md +50 -0
- package/docs/zh-CN/providers/huggingface.md +216 -0
- package/docs/zh-CN/providers/index.md +69 -0
- package/docs/zh-CN/providers/kilocode.md +80 -0
- package/docs/zh-CN/providers/litellm.md +160 -0
- package/docs/zh-CN/providers/minimax.md +222 -0
- package/docs/zh-CN/providers/mistral.md +61 -0
- package/docs/zh-CN/providers/models.md +51 -0
- package/docs/zh-CN/providers/moonshot.md +182 -0
- package/docs/zh-CN/providers/nvidia.md +62 -0
- package/docs/zh-CN/providers/ollama.md +359 -0
- package/docs/zh-CN/providers/openai.md +308 -0
- package/docs/zh-CN/providers/opencode-go.md +52 -0
- package/docs/zh-CN/providers/opencode.md +71 -0
- package/docs/zh-CN/providers/openrouter.md +44 -0
- package/docs/zh-CN/providers/qianfan.md +45 -0
- package/docs/zh-CN/providers/qwen.md +55 -0
- package/docs/zh-CN/providers/sglang.md +111 -0
- package/docs/zh-CN/providers/synthetic.md +106 -0
- package/docs/zh-CN/providers/together.md +72 -0
- package/docs/zh-CN/providers/venice.md +289 -0
- package/docs/zh-CN/providers/vercel-ai-gateway.md +66 -0
- package/docs/zh-CN/providers/xiaomi.md +93 -0
- package/docs/zh-CN/providers/zai.md +53 -0
- package/docs/zh-CN/reference/AGENTS.default.md +131 -0
- package/docs/zh-CN/reference/RELEASING.md +48 -0
- package/docs/zh-CN/reference/api-usage-costs.md +141 -0
- package/docs/zh-CN/reference/credits.md +34 -0
- package/docs/zh-CN/reference/device-models.md +54 -0
- package/docs/zh-CN/reference/rpc.md +48 -0
- package/docs/zh-CN/reference/session-management-compaction.md +287 -0
- package/docs/zh-CN/reference/templates/AGENTS.dev.md +89 -0
- package/docs/zh-CN/reference/templates/AGENTS.md +225 -0
- package/docs/zh-CN/reference/templates/BOOT.md +17 -0
- package/docs/zh-CN/reference/templates/BOOTSTRAP.md +68 -0
- package/docs/zh-CN/reference/templates/HEARTBEAT.md +18 -0
- package/docs/zh-CN/reference/templates/IDENTITY.dev.md +54 -0
- package/docs/zh-CN/reference/templates/IDENTITY.md +36 -0
- package/docs/zh-CN/reference/templates/SOUL.dev.md +83 -0
- package/docs/zh-CN/reference/templates/SOUL.md +49 -0
- package/docs/zh-CN/reference/templates/TOOLS.dev.md +31 -0
- package/docs/zh-CN/reference/templates/TOOLS.md +53 -0
- package/docs/zh-CN/reference/templates/USER.dev.md +25 -0
- package/docs/zh-CN/reference/templates/USER.md +30 -0
- package/docs/zh-CN/reference/test.md +57 -0
- package/docs/zh-CN/reference/token-use.md +119 -0
- package/docs/zh-CN/reference/transcript-hygiene.md +109 -0
- package/docs/zh-CN/reference/wizard.md +242 -0
- package/docs/zh-CN/security/formal-verification.md +171 -0
- package/docs/zh-CN/start/bootstrapping.md +9 -0
- package/docs/zh-CN/start/docs-directory.md +70 -0
- package/docs/zh-CN/start/getting-started.md +143 -0
- package/docs/zh-CN/start/hubs.md +194 -0
- package/docs/zh-CN/start/lore.md +226 -0
- package/docs/zh-CN/start/onboarding-overview.md +58 -0
- package/docs/zh-CN/start/onboarding.md +105 -0
- package/docs/zh-CN/start/openclaw.md +248 -0
- package/docs/zh-CN/start/quickstart.md +88 -0
- package/docs/zh-CN/start/setup.md +153 -0
- package/docs/zh-CN/start/showcase.md +423 -0
- package/docs/zh-CN/start/wizard-cli-automation.md +222 -0
- package/docs/zh-CN/start/wizard-cli-reference.md +306 -0
- package/docs/zh-CN/start/wizard.md +132 -0
- package/docs/zh-CN/tools/agent-send.md +59 -0
- package/docs/zh-CN/tools/apply-patch.md +57 -0
- package/docs/zh-CN/tools/browser-linux-troubleshooting.md +144 -0
- package/docs/zh-CN/tools/browser-login.md +75 -0
- package/docs/zh-CN/tools/browser.md +553 -0
- package/docs/zh-CN/tools/chrome-extension.md +183 -0
- package/docs/zh-CN/tools/clawhub.md +209 -0
- package/docs/zh-CN/tools/creating-skills.md +61 -0
- package/docs/zh-CN/tools/elevated.md +64 -0
- package/docs/zh-CN/tools/exec-approvals.md +234 -0
- package/docs/zh-CN/tools/exec.md +169 -0
- package/docs/zh-CN/tools/firecrawl.md +68 -0
- package/docs/zh-CN/tools/index.md +515 -0
- package/docs/zh-CN/tools/llm-task.md +117 -0
- package/docs/zh-CN/tools/lobster.md +349 -0
- package/docs/zh-CN/tools/multi-agent-sandbox-tools.md +401 -0
- package/docs/zh-CN/tools/plugin.md +1612 -0
- package/docs/zh-CN/tools/reactions.md +29 -0
- package/docs/zh-CN/tools/skills-config.md +78 -0
- package/docs/zh-CN/tools/skills.md +279 -0
- package/docs/zh-CN/tools/slash-commands.md +205 -0
- package/docs/zh-CN/tools/subagents.md +167 -0
- package/docs/zh-CN/tools/thinking.md +80 -0
- package/docs/zh-CN/tools/web.md +289 -0
- package/docs/zh-CN/tts.md +375 -0
- package/docs/zh-CN/vps.md +47 -0
- package/docs/zh-CN/web/control-ui.md +191 -0
- package/docs/zh-CN/web/dashboard.md +53 -0
- package/docs/zh-CN/web/index.md +118 -0
- package/docs/zh-CN/web/tui.md +166 -0
- package/docs/zh-CN/web/webchat.md +56 -0
- package/openclaw.mjs +135 -0
- package/package.json +835 -0
- package/skills/1password/SKILL.md +70 -0
- package/skills/1password/references/cli-examples.md +29 -0
- package/skills/1password/references/get-started.md +17 -0
- package/skills/apple-notes/SKILL.md +77 -0
- package/skills/apple-reminders/SKILL.md +118 -0
- package/skills/bear-notes/SKILL.md +107 -0
- package/skills/blogwatcher/SKILL.md +69 -0
- package/skills/blucli/SKILL.md +47 -0
- package/skills/bluebubbles/SKILL.md +131 -0
- package/skills/camsnap/SKILL.md +45 -0
- package/skills/canvas/SKILL.md +198 -0
- package/skills/clawhub/SKILL.md +77 -0
- package/skills/coding-agent/SKILL.md +295 -0
- package/skills/discord/SKILL.md +197 -0
- package/skills/doubao-code/SKILL.md +43 -0
- package/skills/eightctl/SKILL.md +50 -0
- package/skills/gemini/SKILL.md +43 -0
- package/skills/gh-issues/SKILL.md +865 -0
- package/skills/gifgrep/SKILL.md +79 -0
- package/skills/github/SKILL.md +163 -0
- package/skills/gog/SKILL.md +116 -0
- package/skills/goplaces/SKILL.md +52 -0
- package/skills/healthcheck/SKILL.md +245 -0
- package/skills/himalaya/SKILL.md +257 -0
- package/skills/himalaya/references/configuration.md +184 -0
- package/skills/himalaya/references/message-composition.md +199 -0
- package/skills/imsg/SKILL.md +122 -0
- package/skills/kimi-code/SKILL.md +42 -0
- package/skills/mcporter/SKILL.md +61 -0
- package/skills/model-usage/SKILL.md +69 -0
- package/skills/model-usage/references/codexbar-cli.md +33 -0
- package/skills/model-usage/scripts/model_usage.py +320 -0
- package/skills/model-usage/scripts/test_model_usage.py +40 -0
- package/skills/nano-pdf/SKILL.md +38 -0
- package/skills/node-connect/SKILL.md +142 -0
- package/skills/notion/SKILL.md +174 -0
- package/skills/obsidian/SKILL.md +81 -0
- package/skills/openai-image-gen/SKILL.md +92 -0
- package/skills/openai-image-gen/scripts/gen.py +328 -0
- package/skills/openai-image-gen/scripts/test_gen.py +140 -0
- package/skills/openai-whisper/SKILL.md +38 -0
- package/skills/openai-whisper-api/SKILL.md +52 -0
- package/skills/openai-whisper-api/scripts/transcribe.sh +85 -0
- package/skills/openhue/SKILL.md +112 -0
- package/skills/oracle/SKILL.md +125 -0
- package/skills/ordercli/SKILL.md +78 -0
- package/skills/peekaboo/SKILL.md +190 -0
- package/skills/sag/SKILL.md +87 -0
- package/skills/session-logs/SKILL.md +115 -0
- package/skills/sherpa-onnx-tts/SKILL.md +103 -0
- package/skills/sherpa-onnx-tts/bin/sherpa-onnx-tts +178 -0
- package/skills/skill-creator/SKILL.md +372 -0
- package/skills/skill-creator/license.txt +202 -0
- package/skills/skill-creator/scripts/init_skill.py +378 -0
- package/skills/skill-creator/scripts/package_skill.py +139 -0
- package/skills/skill-creator/scripts/quick_validate.py +159 -0
- package/skills/skill-creator/scripts/test_package_skill.py +160 -0
- package/skills/skill-creator/scripts/test_quick_validate.py +72 -0
- package/skills/slack/SKILL.md +144 -0
- package/skills/songsee/SKILL.md +49 -0
- package/skills/sonoscli/SKILL.md +65 -0
- package/skills/spotify-player/SKILL.md +64 -0
- package/skills/summarize/SKILL.md +87 -0
- package/skills/things-mac/SKILL.md +86 -0
- package/skills/tmux/SKILL.md +153 -0
- package/skills/tmux/scripts/find-sessions.sh +112 -0
- package/skills/tmux/scripts/wait-for-text.sh +83 -0
- package/skills/trello/SKILL.md +95 -0
- package/skills/video-frames/SKILL.md +46 -0
- package/skills/video-frames/scripts/frame.sh +81 -0
- package/skills/voice-call/SKILL.md +45 -0
- package/skills/wacli/SKILL.md +72 -0
- package/skills/weather/SKILL.md +112 -0
- package/skills/xurl/SKILL.md +461 -0
|
@@ -0,0 +1,2795 @@
|
|
|
1
|
+
import { n as resolvePreferredOpenClawTmpDir } from "./tmp-openclaw-dir-idKIOMmb.js";
|
|
2
|
+
import { n as defaultRuntime } from "./runtime-CT2LIJZu.js";
|
|
3
|
+
import { w as sliceUtf16Safe, y as resolveUserPath } from "./utils-Bxk6BLTg.js";
|
|
4
|
+
import { s as isPathInside } from "./boundary-path-B3FFLYNx.js";
|
|
5
|
+
import { n as openBoundaryFile } from "./boundary-file-read-BP6VMpqH.js";
|
|
6
|
+
import { a as DEFAULT_IDENTITY_FILENAME, c as DEFAULT_SOUL_FILENAME, d as ensureAgentWorkspace, i as DEFAULT_HEARTBEAT_FILENAME, l as DEFAULT_TOOLS_FILENAME, n as DEFAULT_AGENT_WORKSPACE_DIR, r as DEFAULT_BOOTSTRAP_FILENAME, t as DEFAULT_AGENTS_FILENAME, u as DEFAULT_USER_FILENAME } from "./workspace-BH7CXmrr.js";
|
|
7
|
+
import { v as resolveSessionAgentId } from "./agent-scope-DPP4Z_UU.js";
|
|
8
|
+
import { s as loadConfig } from "./io-jOnQRia2.js";
|
|
9
|
+
import { t as formatCliCommand } from "./command-format-CYK9XiUC.js";
|
|
10
|
+
import { r as isLoopbackHost } from "./net-DlJFp95v.js";
|
|
11
|
+
import { n as resolveAgentMainSessionKey, t as canonicalizeMainSessionAlias } from "./main-session-DKr0lBVk.js";
|
|
12
|
+
import { C as updateRegistry, E as resolveSandboxConfigForAgent, F as SANDBOX_AGENT_WORKSPACE_MOUNT, I as SANDBOX_BROWSER_SECURITY_HASH_EPOCH, O as isToolAllowed, S as updateBrowserRegistry, T as resolveSandboxBrowserDockerCreateConfig, U as expandToolGroups, _ as slugifySessionKey, a as execDockerRaw, b as removeBrowserRegistryEntry, c as readDockerPort, d as validateNetworkMode, f as resolveSandboxHostPathViaExistingAncestor, g as resolveSandboxWorkspaceDir, h as resolveSandboxScopeKey, i as execDocker, k as resolveSandboxToolPolicyForAgent, l as appendWorkspaceMountArgs, m as resolveSandboxAgentId, n as dockerContainerState, o as readDockerContainerEnvVar, p as splitSandboxBindSpec, r as ensureSandboxContainer, s as readDockerContainerLabel, t as buildSandboxCreateArgs, v as readBrowserRegistry, w as computeSandboxBrowserConfigHash, x as removeRegistryEntry, y as readRegistry } from "./docker-XFNiArwM.js";
|
|
13
|
+
import { t as PATH_ALIAS_POLICIES } from "./path-alias-guards-ZTKqurNH.js";
|
|
14
|
+
import { i as resolveSandboxPath, n as assertSandboxPath, r as resolveSandboxInputPath } from "./sandbox-paths-fqp_TZdO.js";
|
|
15
|
+
import { c as syncSkillsToWorkspace } from "./skills-CCgKs_NJ.js";
|
|
16
|
+
import { G as resolveBrowserControlAuth, H as deleteBridgeAuthForPort, U as setBridgeAuthForPort, W as ensureBrowserControlAuth, b as createBrowserRouteContext, t as registerBrowserRoutes } from "./routes-TpLEcKO8.js";
|
|
17
|
+
import { f as DEFAULT_OPENCLAW_BROWSER_COLOR, l as deriveDefaultBrowserCdpPortRange, p as DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME, r as resolveProfile } from "./config-DdDLrP_v.js";
|
|
18
|
+
import { t as parseSshTarget } from "./ssh-tunnel-Cz51VBAt.js";
|
|
19
|
+
import { n as installBrowserCommonMiddleware, t as installBrowserAuthMiddleware } from "./server-middleware-CCqKhKUb.js";
|
|
20
|
+
import fs, { existsSync, statSync } from "node:fs";
|
|
21
|
+
import path from "node:path";
|
|
22
|
+
import { spawn } from "node:child_process";
|
|
23
|
+
import os, { homedir } from "node:os";
|
|
24
|
+
import fs$1 from "node:fs/promises";
|
|
25
|
+
import crypto from "node:crypto";
|
|
26
|
+
import express from "express";
|
|
27
|
+
//#region src/agents/sandbox/runtime-status.ts
|
|
28
|
+
function shouldSandboxSession(cfg, sessionKey, mainSessionKey) {
|
|
29
|
+
if (cfg.mode === "off") return false;
|
|
30
|
+
if (cfg.mode === "all") return true;
|
|
31
|
+
return sessionKey.trim() !== mainSessionKey.trim();
|
|
32
|
+
}
|
|
33
|
+
function resolveMainSessionKeyForSandbox(params) {
|
|
34
|
+
if (params.cfg?.session?.scope === "global") return "global";
|
|
35
|
+
return resolveAgentMainSessionKey({
|
|
36
|
+
cfg: params.cfg,
|
|
37
|
+
agentId: params.agentId
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function resolveComparableSessionKeyForSandbox(params) {
|
|
41
|
+
return canonicalizeMainSessionAlias({
|
|
42
|
+
cfg: params.cfg,
|
|
43
|
+
agentId: params.agentId,
|
|
44
|
+
sessionKey: params.sessionKey
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function resolveSandboxRuntimeStatus(params) {
|
|
48
|
+
const sessionKey = params.sessionKey?.trim() ?? "";
|
|
49
|
+
const agentId = resolveSessionAgentId({
|
|
50
|
+
sessionKey,
|
|
51
|
+
config: params.cfg
|
|
52
|
+
});
|
|
53
|
+
const cfg = params.cfg;
|
|
54
|
+
const sandboxCfg = resolveSandboxConfigForAgent(cfg, agentId);
|
|
55
|
+
const mainSessionKey = resolveMainSessionKeyForSandbox({
|
|
56
|
+
cfg,
|
|
57
|
+
agentId
|
|
58
|
+
});
|
|
59
|
+
const sandboxed = sessionKey ? shouldSandboxSession(sandboxCfg, resolveComparableSessionKeyForSandbox({
|
|
60
|
+
cfg,
|
|
61
|
+
agentId,
|
|
62
|
+
sessionKey
|
|
63
|
+
}), mainSessionKey) : false;
|
|
64
|
+
return {
|
|
65
|
+
agentId,
|
|
66
|
+
sessionKey,
|
|
67
|
+
mainSessionKey,
|
|
68
|
+
mode: sandboxCfg.mode,
|
|
69
|
+
sandboxed,
|
|
70
|
+
toolPolicy: resolveSandboxToolPolicyForAgent(cfg, agentId)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function formatSandboxToolPolicyBlockedMessage(params) {
|
|
74
|
+
const tool = params.toolName.trim().toLowerCase();
|
|
75
|
+
if (!tool) return;
|
|
76
|
+
const runtime = resolveSandboxRuntimeStatus({
|
|
77
|
+
cfg: params.cfg,
|
|
78
|
+
sessionKey: params.sessionKey
|
|
79
|
+
});
|
|
80
|
+
if (!runtime.sandboxed) return;
|
|
81
|
+
const deny = new Set(expandToolGroups(runtime.toolPolicy.deny));
|
|
82
|
+
const allow = expandToolGroups(runtime.toolPolicy.allow);
|
|
83
|
+
const allowSet = allow.length > 0 ? new Set(allow) : null;
|
|
84
|
+
const blockedByDeny = deny.has(tool);
|
|
85
|
+
const blockedByAllow = allowSet ? !allowSet.has(tool) : false;
|
|
86
|
+
if (!blockedByDeny && !blockedByAllow) return;
|
|
87
|
+
const reasons = [];
|
|
88
|
+
const fixes = [];
|
|
89
|
+
if (blockedByDeny) {
|
|
90
|
+
reasons.push("deny list");
|
|
91
|
+
fixes.push(`Remove "${tool}" from ${runtime.toolPolicy.sources.deny.key}.`);
|
|
92
|
+
}
|
|
93
|
+
if (blockedByAllow) {
|
|
94
|
+
reasons.push("allow list");
|
|
95
|
+
fixes.push(`Add "${tool}" to ${runtime.toolPolicy.sources.allow.key} (or set it to [] to allow all).`);
|
|
96
|
+
}
|
|
97
|
+
const lines = [];
|
|
98
|
+
lines.push(`Tool "${tool}" blocked by sandbox tool policy (mode=${runtime.mode}).`);
|
|
99
|
+
lines.push(`Session: ${runtime.sessionKey || "(unknown)"}`);
|
|
100
|
+
lines.push(`Reason: ${reasons.join(" + ")}`);
|
|
101
|
+
lines.push("Fix:");
|
|
102
|
+
lines.push(`- agents.defaults.sandbox.mode=off (disable sandbox)`);
|
|
103
|
+
for (const fix of fixes) lines.push(`- ${fix}`);
|
|
104
|
+
if (runtime.mode === "non-main") lines.push(`- Use main session key (direct): ${runtime.mainSessionKey}`);
|
|
105
|
+
lines.push(`- See: ${formatCliCommand(`openclaw sandbox explain --session ${runtime.sessionKey}`)}`);
|
|
106
|
+
return lines.join("\n");
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/agents/bash-tools.shared.ts
|
|
110
|
+
const CHUNK_LIMIT = 8 * 1024;
|
|
111
|
+
function buildSandboxEnv(params) {
|
|
112
|
+
const env = {
|
|
113
|
+
PATH: params.defaultPath,
|
|
114
|
+
HOME: params.containerWorkdir
|
|
115
|
+
};
|
|
116
|
+
for (const [key, value] of Object.entries(params.sandboxEnv ?? {})) env[key] = value;
|
|
117
|
+
for (const [key, value] of Object.entries(params.paramsEnv ?? {})) env[key] = value;
|
|
118
|
+
return env;
|
|
119
|
+
}
|
|
120
|
+
function coerceEnv(env) {
|
|
121
|
+
const record = {};
|
|
122
|
+
if (!env) return record;
|
|
123
|
+
for (const [key, value] of Object.entries(env)) if (typeof value === "string") record[key] = value;
|
|
124
|
+
return record;
|
|
125
|
+
}
|
|
126
|
+
function buildDockerExecArgs(params) {
|
|
127
|
+
const args = ["exec", "-i"];
|
|
128
|
+
if (params.tty) args.push("-t");
|
|
129
|
+
if (params.workdir) args.push("-w", params.workdir);
|
|
130
|
+
for (const [key, value] of Object.entries(params.env)) {
|
|
131
|
+
if (key === "PATH") continue;
|
|
132
|
+
args.push("-e", `${key}=${value}`);
|
|
133
|
+
}
|
|
134
|
+
const hasCustomPath = typeof params.env.PATH === "string" && params.env.PATH.length > 0;
|
|
135
|
+
if (hasCustomPath) args.push("-e", `OPENCLAW_PREPEND_PATH=${params.env.PATH}`);
|
|
136
|
+
const pathExport = hasCustomPath ? "export PATH=\"${OPENCLAW_PREPEND_PATH}:$PATH\"; unset OPENCLAW_PREPEND_PATH; " : "";
|
|
137
|
+
args.push(params.containerName, "/bin/sh", "-lc", `${pathExport}${params.command}`);
|
|
138
|
+
return args;
|
|
139
|
+
}
|
|
140
|
+
async function resolveSandboxWorkdir(params) {
|
|
141
|
+
const fallback = params.sandbox.workspaceDir;
|
|
142
|
+
const candidateWorkdir = mapContainerWorkdirToHost({
|
|
143
|
+
workdir: params.workdir,
|
|
144
|
+
sandbox: params.sandbox
|
|
145
|
+
}) ?? params.workdir;
|
|
146
|
+
try {
|
|
147
|
+
const resolved = await assertSandboxPath({
|
|
148
|
+
filePath: candidateWorkdir,
|
|
149
|
+
cwd: process.cwd(),
|
|
150
|
+
root: params.sandbox.workspaceDir
|
|
151
|
+
});
|
|
152
|
+
if (!(await fs$1.stat(resolved.resolved)).isDirectory()) throw new Error("workdir is not a directory");
|
|
153
|
+
const relative = resolved.relative ? resolved.relative.split(path.sep).join(path.posix.sep) : "";
|
|
154
|
+
const containerWorkdir = relative ? path.posix.join(params.sandbox.containerWorkdir, relative) : params.sandbox.containerWorkdir;
|
|
155
|
+
return {
|
|
156
|
+
hostWorkdir: resolved.resolved,
|
|
157
|
+
containerWorkdir
|
|
158
|
+
};
|
|
159
|
+
} catch {
|
|
160
|
+
params.warnings.push(`Warning: workdir "${params.workdir}" is unavailable; using "${fallback}".`);
|
|
161
|
+
return {
|
|
162
|
+
hostWorkdir: fallback,
|
|
163
|
+
containerWorkdir: params.sandbox.containerWorkdir
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function mapContainerWorkdirToHost(params) {
|
|
168
|
+
const workdir = normalizeContainerPath$2(params.workdir);
|
|
169
|
+
const containerRoot = normalizeContainerPath$2(params.sandbox.containerWorkdir);
|
|
170
|
+
if (containerRoot === ".") return;
|
|
171
|
+
if (workdir === containerRoot) return path.resolve(params.sandbox.workspaceDir);
|
|
172
|
+
if (!workdir.startsWith(`${containerRoot}/`)) return;
|
|
173
|
+
const rel = workdir.slice(containerRoot.length + 1).split("/").filter(Boolean);
|
|
174
|
+
return path.resolve(params.sandbox.workspaceDir, ...rel);
|
|
175
|
+
}
|
|
176
|
+
function normalizeContainerPath$2(input) {
|
|
177
|
+
const normalized = input.trim().replace(/\\/g, "/");
|
|
178
|
+
if (!normalized) return ".";
|
|
179
|
+
return path.posix.normalize(normalized);
|
|
180
|
+
}
|
|
181
|
+
function resolveWorkdir(workdir, warnings) {
|
|
182
|
+
const fallback = safeCwd() ?? homedir();
|
|
183
|
+
try {
|
|
184
|
+
if (statSync(workdir).isDirectory()) return workdir;
|
|
185
|
+
} catch {}
|
|
186
|
+
warnings.push(`Warning: workdir "${workdir}" is unavailable; using "${fallback}".`);
|
|
187
|
+
return fallback;
|
|
188
|
+
}
|
|
189
|
+
function safeCwd() {
|
|
190
|
+
try {
|
|
191
|
+
const cwd = process.cwd();
|
|
192
|
+
return existsSync(cwd) ? cwd : null;
|
|
193
|
+
} catch {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Clamp a number within min/max bounds, using defaultValue if undefined or NaN.
|
|
199
|
+
*/
|
|
200
|
+
function clampWithDefault(value, defaultValue, min, max) {
|
|
201
|
+
if (value === void 0 || Number.isNaN(value)) return defaultValue;
|
|
202
|
+
return Math.min(Math.max(value, min), max);
|
|
203
|
+
}
|
|
204
|
+
function readEnvInt(key) {
|
|
205
|
+
const raw = process.env[key];
|
|
206
|
+
if (!raw) return;
|
|
207
|
+
const parsed = Number.parseInt(raw, 10);
|
|
208
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
209
|
+
}
|
|
210
|
+
function chunkString(input, limit = CHUNK_LIMIT) {
|
|
211
|
+
const chunks = [];
|
|
212
|
+
for (let i = 0; i < input.length; i += limit) chunks.push(input.slice(i, i + limit));
|
|
213
|
+
return chunks;
|
|
214
|
+
}
|
|
215
|
+
function truncateMiddle(str, max) {
|
|
216
|
+
if (str.length <= max) return str;
|
|
217
|
+
const half = Math.floor((max - 3) / 2);
|
|
218
|
+
return `${sliceUtf16Safe(str, 0, half)}...${sliceUtf16Safe(str, -half)}`;
|
|
219
|
+
}
|
|
220
|
+
function sliceLogLines(text, offset, limit) {
|
|
221
|
+
if (!text) return {
|
|
222
|
+
slice: "",
|
|
223
|
+
totalLines: 0,
|
|
224
|
+
totalChars: 0
|
|
225
|
+
};
|
|
226
|
+
const lines = text.replace(/\r\n/g, "\n").split("\n");
|
|
227
|
+
if (lines.length > 0 && lines[lines.length - 1] === "") lines.pop();
|
|
228
|
+
const totalLines = lines.length;
|
|
229
|
+
const totalChars = text.length;
|
|
230
|
+
let start = typeof offset === "number" && Number.isFinite(offset) ? Math.max(0, Math.floor(offset)) : 0;
|
|
231
|
+
if (limit !== void 0 && offset === void 0) {
|
|
232
|
+
const tailCount = Math.max(0, Math.floor(limit));
|
|
233
|
+
start = Math.max(totalLines - tailCount, 0);
|
|
234
|
+
}
|
|
235
|
+
const end = typeof limit === "number" && Number.isFinite(limit) ? start + Math.max(0, Math.floor(limit)) : void 0;
|
|
236
|
+
return {
|
|
237
|
+
slice: lines.slice(start, end).join("\n"),
|
|
238
|
+
totalLines,
|
|
239
|
+
totalChars
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function deriveSessionName(command) {
|
|
243
|
+
const tokens = tokenizeCommand(command);
|
|
244
|
+
if (tokens.length === 0) return;
|
|
245
|
+
const verb = tokens[0];
|
|
246
|
+
let target = tokens.slice(1).find((t) => !t.startsWith("-"));
|
|
247
|
+
if (!target) target = tokens[1];
|
|
248
|
+
if (!target) return verb;
|
|
249
|
+
const cleaned = truncateMiddle(stripQuotes(target), 48);
|
|
250
|
+
return `${stripQuotes(verb)} ${cleaned}`;
|
|
251
|
+
}
|
|
252
|
+
function tokenizeCommand(command) {
|
|
253
|
+
return (command.match(/(?:[^\s"']+|"(?:\\.|[^"])*"|'(?:\\.|[^'])*')+/g) ?? []).map((token) => stripQuotes(token)).filter(Boolean);
|
|
254
|
+
}
|
|
255
|
+
function stripQuotes(value) {
|
|
256
|
+
const trimmed = value.trim();
|
|
257
|
+
if (trimmed.startsWith("\"") && trimmed.endsWith("\"") || trimmed.startsWith("'") && trimmed.endsWith("'")) return trimmed.slice(1, -1);
|
|
258
|
+
return trimmed;
|
|
259
|
+
}
|
|
260
|
+
function pad(str, width) {
|
|
261
|
+
if (str.length >= width) return str;
|
|
262
|
+
return str + " ".repeat(width - str.length);
|
|
263
|
+
}
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/agents/sandbox/docker-backend.ts
|
|
266
|
+
async function createDockerSandboxBackend(params) {
|
|
267
|
+
return createDockerSandboxBackendHandle({
|
|
268
|
+
containerName: await ensureSandboxContainer({
|
|
269
|
+
sessionKey: params.sessionKey,
|
|
270
|
+
workspaceDir: params.workspaceDir,
|
|
271
|
+
agentWorkspaceDir: params.agentWorkspaceDir,
|
|
272
|
+
cfg: params.cfg
|
|
273
|
+
}),
|
|
274
|
+
workdir: params.cfg.docker.workdir,
|
|
275
|
+
env: params.cfg.docker.env,
|
|
276
|
+
image: params.cfg.docker.image
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
function createDockerSandboxBackendHandle(params) {
|
|
280
|
+
return {
|
|
281
|
+
id: "docker",
|
|
282
|
+
runtimeId: params.containerName,
|
|
283
|
+
runtimeLabel: params.containerName,
|
|
284
|
+
workdir: params.workdir,
|
|
285
|
+
env: params.env,
|
|
286
|
+
configLabel: params.image,
|
|
287
|
+
configLabelKind: "Image",
|
|
288
|
+
capabilities: { browser: true },
|
|
289
|
+
async buildExecSpec({ command, workdir, env, usePty }) {
|
|
290
|
+
return {
|
|
291
|
+
argv: ["docker", ...buildDockerExecArgs({
|
|
292
|
+
containerName: params.containerName,
|
|
293
|
+
command,
|
|
294
|
+
workdir: workdir ?? params.workdir,
|
|
295
|
+
env,
|
|
296
|
+
tty: usePty
|
|
297
|
+
})],
|
|
298
|
+
env: process.env,
|
|
299
|
+
stdinMode: usePty ? "pipe-open" : "pipe-closed"
|
|
300
|
+
};
|
|
301
|
+
},
|
|
302
|
+
runShellCommand(command) {
|
|
303
|
+
return runDockerSandboxShellCommand({
|
|
304
|
+
containerName: params.containerName,
|
|
305
|
+
...command
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
function runDockerSandboxShellCommand(params) {
|
|
311
|
+
const dockerArgs = [
|
|
312
|
+
"exec",
|
|
313
|
+
"-i",
|
|
314
|
+
params.containerName,
|
|
315
|
+
"sh",
|
|
316
|
+
"-c",
|
|
317
|
+
params.script,
|
|
318
|
+
"moltbot-sandbox-fs"
|
|
319
|
+
];
|
|
320
|
+
if (params.args?.length) dockerArgs.push(...params.args);
|
|
321
|
+
return execDockerRaw(dockerArgs, {
|
|
322
|
+
input: params.stdin,
|
|
323
|
+
allowFailure: params.allowFailure,
|
|
324
|
+
signal: params.signal
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
const dockerSandboxBackendManager = {
|
|
328
|
+
async describeRuntime({ entry, config, agentId }) {
|
|
329
|
+
const state = await dockerContainerState(entry.containerName);
|
|
330
|
+
let actualConfigLabel = entry.image;
|
|
331
|
+
if (state.exists) try {
|
|
332
|
+
const result = await execDocker([
|
|
333
|
+
"inspect",
|
|
334
|
+
"-f",
|
|
335
|
+
"{{.Config.Image}}",
|
|
336
|
+
entry.containerName
|
|
337
|
+
], { allowFailure: true });
|
|
338
|
+
if (result.code === 0) actualConfigLabel = result.stdout.trim() || actualConfigLabel;
|
|
339
|
+
} catch {}
|
|
340
|
+
const configuredImage = resolveSandboxConfigForAgent(config, agentId).docker.image;
|
|
341
|
+
return {
|
|
342
|
+
running: state.running,
|
|
343
|
+
actualConfigLabel,
|
|
344
|
+
configLabelMatch: actualConfigLabel === configuredImage
|
|
345
|
+
};
|
|
346
|
+
},
|
|
347
|
+
async removeRuntime({ entry }) {
|
|
348
|
+
try {
|
|
349
|
+
await execDocker([
|
|
350
|
+
"rm",
|
|
351
|
+
"-f",
|
|
352
|
+
entry.containerName
|
|
353
|
+
], { allowFailure: true });
|
|
354
|
+
} catch {}
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
//#endregion
|
|
358
|
+
//#region src/agents/sandbox/fs-bridge-mutation-helper.ts
|
|
359
|
+
const SANDBOX_PINNED_MUTATION_PYTHON = [
|
|
360
|
+
"import errno",
|
|
361
|
+
"import os",
|
|
362
|
+
"import secrets",
|
|
363
|
+
"import stat",
|
|
364
|
+
"import sys",
|
|
365
|
+
"",
|
|
366
|
+
"operation = sys.argv[1]",
|
|
367
|
+
"",
|
|
368
|
+
"DIR_FLAGS = os.O_RDONLY",
|
|
369
|
+
"if hasattr(os, 'O_DIRECTORY'):",
|
|
370
|
+
" DIR_FLAGS |= os.O_DIRECTORY",
|
|
371
|
+
"if hasattr(os, 'O_NOFOLLOW'):",
|
|
372
|
+
" DIR_FLAGS |= os.O_NOFOLLOW",
|
|
373
|
+
"",
|
|
374
|
+
"READ_FLAGS = os.O_RDONLY",
|
|
375
|
+
"if hasattr(os, 'O_NOFOLLOW'):",
|
|
376
|
+
" READ_FLAGS |= os.O_NOFOLLOW",
|
|
377
|
+
"",
|
|
378
|
+
"WRITE_FLAGS = os.O_WRONLY | os.O_CREAT | os.O_EXCL",
|
|
379
|
+
"if hasattr(os, 'O_NOFOLLOW'):",
|
|
380
|
+
" WRITE_FLAGS |= os.O_NOFOLLOW",
|
|
381
|
+
"",
|
|
382
|
+
"def split_relative(path_value):",
|
|
383
|
+
" segments = []",
|
|
384
|
+
" for segment in path_value.split('/'):",
|
|
385
|
+
" if not segment or segment == '.':",
|
|
386
|
+
" continue",
|
|
387
|
+
" if segment == '..':",
|
|
388
|
+
" raise OSError(errno.EPERM, 'path traversal is not allowed', segment)",
|
|
389
|
+
" segments.append(segment)",
|
|
390
|
+
" return segments",
|
|
391
|
+
"",
|
|
392
|
+
"def open_dir(path_value, dir_fd=None):",
|
|
393
|
+
" return os.open(path_value, DIR_FLAGS, dir_fd=dir_fd)",
|
|
394
|
+
"",
|
|
395
|
+
"def walk_dir(root_fd, rel_path, mkdir_enabled):",
|
|
396
|
+
" current_fd = os.dup(root_fd)",
|
|
397
|
+
" try:",
|
|
398
|
+
" for segment in split_relative(rel_path):",
|
|
399
|
+
" try:",
|
|
400
|
+
" next_fd = open_dir(segment, dir_fd=current_fd)",
|
|
401
|
+
" except FileNotFoundError:",
|
|
402
|
+
" if not mkdir_enabled:",
|
|
403
|
+
" raise",
|
|
404
|
+
" os.mkdir(segment, 0o777, dir_fd=current_fd)",
|
|
405
|
+
" next_fd = open_dir(segment, dir_fd=current_fd)",
|
|
406
|
+
" os.close(current_fd)",
|
|
407
|
+
" current_fd = next_fd",
|
|
408
|
+
" return current_fd",
|
|
409
|
+
" except Exception:",
|
|
410
|
+
" os.close(current_fd)",
|
|
411
|
+
" raise",
|
|
412
|
+
"",
|
|
413
|
+
"def create_temp_file(parent_fd, basename):",
|
|
414
|
+
" prefix = '.openclaw-write-' + basename + '.'",
|
|
415
|
+
" for _ in range(128):",
|
|
416
|
+
" candidate = prefix + secrets.token_hex(6)",
|
|
417
|
+
" try:",
|
|
418
|
+
" fd = os.open(candidate, WRITE_FLAGS, 0o600, dir_fd=parent_fd)",
|
|
419
|
+
" return candidate, fd",
|
|
420
|
+
" except FileExistsError:",
|
|
421
|
+
" continue",
|
|
422
|
+
" raise RuntimeError('failed to allocate sandbox temp file')",
|
|
423
|
+
"",
|
|
424
|
+
"def create_temp_dir(parent_fd, basename, mode):",
|
|
425
|
+
" prefix = '.openclaw-move-' + basename + '.'",
|
|
426
|
+
" for _ in range(128):",
|
|
427
|
+
" candidate = prefix + secrets.token_hex(6)",
|
|
428
|
+
" try:",
|
|
429
|
+
" os.mkdir(candidate, mode, dir_fd=parent_fd)",
|
|
430
|
+
" return candidate",
|
|
431
|
+
" except FileExistsError:",
|
|
432
|
+
" continue",
|
|
433
|
+
" raise RuntimeError('failed to allocate sandbox temp directory')",
|
|
434
|
+
"",
|
|
435
|
+
"def write_atomic(parent_fd, basename, stdin_buffer):",
|
|
436
|
+
" temp_fd = None",
|
|
437
|
+
" temp_name = None",
|
|
438
|
+
" try:",
|
|
439
|
+
" temp_name, temp_fd = create_temp_file(parent_fd, basename)",
|
|
440
|
+
" while True:",
|
|
441
|
+
" chunk = stdin_buffer.read(65536)",
|
|
442
|
+
" if not chunk:",
|
|
443
|
+
" break",
|
|
444
|
+
" os.write(temp_fd, chunk)",
|
|
445
|
+
" os.fsync(temp_fd)",
|
|
446
|
+
" os.close(temp_fd)",
|
|
447
|
+
" temp_fd = None",
|
|
448
|
+
" os.replace(temp_name, basename, src_dir_fd=parent_fd, dst_dir_fd=parent_fd)",
|
|
449
|
+
" temp_name = None",
|
|
450
|
+
" os.fsync(parent_fd)",
|
|
451
|
+
" finally:",
|
|
452
|
+
" if temp_fd is not None:",
|
|
453
|
+
" os.close(temp_fd)",
|
|
454
|
+
" if temp_name is not None:",
|
|
455
|
+
" try:",
|
|
456
|
+
" os.unlink(temp_name, dir_fd=parent_fd)",
|
|
457
|
+
" except FileNotFoundError:",
|
|
458
|
+
" pass",
|
|
459
|
+
"",
|
|
460
|
+
"def remove_tree(parent_fd, basename):",
|
|
461
|
+
" entry_stat = os.lstat(basename, dir_fd=parent_fd)",
|
|
462
|
+
" if not stat.S_ISDIR(entry_stat.st_mode) or stat.S_ISLNK(entry_stat.st_mode):",
|
|
463
|
+
" os.unlink(basename, dir_fd=parent_fd)",
|
|
464
|
+
" return",
|
|
465
|
+
" dir_fd = open_dir(basename, dir_fd=parent_fd)",
|
|
466
|
+
" try:",
|
|
467
|
+
" for child in os.listdir(dir_fd):",
|
|
468
|
+
" remove_tree(dir_fd, child)",
|
|
469
|
+
" finally:",
|
|
470
|
+
" os.close(dir_fd)",
|
|
471
|
+
" os.rmdir(basename, dir_fd=parent_fd)",
|
|
472
|
+
"",
|
|
473
|
+
"def move_entry(src_parent_fd, src_basename, dst_parent_fd, dst_basename):",
|
|
474
|
+
" try:",
|
|
475
|
+
" os.rename(src_basename, dst_basename, src_dir_fd=src_parent_fd, dst_dir_fd=dst_parent_fd)",
|
|
476
|
+
" os.fsync(dst_parent_fd)",
|
|
477
|
+
" os.fsync(src_parent_fd)",
|
|
478
|
+
" return",
|
|
479
|
+
" except OSError as err:",
|
|
480
|
+
" if err.errno != errno.EXDEV:",
|
|
481
|
+
" raise",
|
|
482
|
+
" src_stat = os.lstat(src_basename, dir_fd=src_parent_fd)",
|
|
483
|
+
" if stat.S_ISDIR(src_stat.st_mode) and not stat.S_ISLNK(src_stat.st_mode):",
|
|
484
|
+
" temp_dir_name = create_temp_dir(dst_parent_fd, dst_basename, stat.S_IMODE(src_stat.st_mode) or 0o755)",
|
|
485
|
+
" temp_dir_fd = open_dir(temp_dir_name, dir_fd=dst_parent_fd)",
|
|
486
|
+
" src_dir_fd = open_dir(src_basename, dir_fd=src_parent_fd)",
|
|
487
|
+
" try:",
|
|
488
|
+
" for child in os.listdir(src_dir_fd):",
|
|
489
|
+
" move_entry(src_dir_fd, child, temp_dir_fd, child)",
|
|
490
|
+
" finally:",
|
|
491
|
+
" os.close(src_dir_fd)",
|
|
492
|
+
" os.close(temp_dir_fd)",
|
|
493
|
+
" os.rename(temp_dir_name, dst_basename, src_dir_fd=dst_parent_fd, dst_dir_fd=dst_parent_fd)",
|
|
494
|
+
" os.rmdir(src_basename, dir_fd=src_parent_fd)",
|
|
495
|
+
" os.fsync(dst_parent_fd)",
|
|
496
|
+
" os.fsync(src_parent_fd)",
|
|
497
|
+
" return",
|
|
498
|
+
" if stat.S_ISLNK(src_stat.st_mode):",
|
|
499
|
+
" link_target = os.readlink(src_basename, dir_fd=src_parent_fd)",
|
|
500
|
+
" try:",
|
|
501
|
+
" os.unlink(dst_basename, dir_fd=dst_parent_fd)",
|
|
502
|
+
" except FileNotFoundError:",
|
|
503
|
+
" pass",
|
|
504
|
+
" os.symlink(link_target, dst_basename, dir_fd=dst_parent_fd)",
|
|
505
|
+
" os.unlink(src_basename, dir_fd=src_parent_fd)",
|
|
506
|
+
" os.fsync(dst_parent_fd)",
|
|
507
|
+
" os.fsync(src_parent_fd)",
|
|
508
|
+
" return",
|
|
509
|
+
" src_fd = os.open(src_basename, READ_FLAGS, dir_fd=src_parent_fd)",
|
|
510
|
+
" temp_fd = None",
|
|
511
|
+
" temp_name = None",
|
|
512
|
+
" try:",
|
|
513
|
+
" temp_name, temp_fd = create_temp_file(dst_parent_fd, dst_basename)",
|
|
514
|
+
" while True:",
|
|
515
|
+
" chunk = os.read(src_fd, 65536)",
|
|
516
|
+
" if not chunk:",
|
|
517
|
+
" break",
|
|
518
|
+
" os.write(temp_fd, chunk)",
|
|
519
|
+
" try:",
|
|
520
|
+
" os.fchmod(temp_fd, stat.S_IMODE(src_stat.st_mode))",
|
|
521
|
+
" except AttributeError:",
|
|
522
|
+
" pass",
|
|
523
|
+
" os.fsync(temp_fd)",
|
|
524
|
+
" os.close(temp_fd)",
|
|
525
|
+
" temp_fd = None",
|
|
526
|
+
" os.replace(temp_name, dst_basename, src_dir_fd=dst_parent_fd, dst_dir_fd=dst_parent_fd)",
|
|
527
|
+
" temp_name = None",
|
|
528
|
+
" os.unlink(src_basename, dir_fd=src_parent_fd)",
|
|
529
|
+
" os.fsync(dst_parent_fd)",
|
|
530
|
+
" os.fsync(src_parent_fd)",
|
|
531
|
+
" finally:",
|
|
532
|
+
" if temp_fd is not None:",
|
|
533
|
+
" os.close(temp_fd)",
|
|
534
|
+
" if temp_name is not None:",
|
|
535
|
+
" try:",
|
|
536
|
+
" os.unlink(temp_name, dir_fd=dst_parent_fd)",
|
|
537
|
+
" except FileNotFoundError:",
|
|
538
|
+
" pass",
|
|
539
|
+
" os.close(src_fd)",
|
|
540
|
+
"",
|
|
541
|
+
"if operation == 'write':",
|
|
542
|
+
" root_fd = open_dir(sys.argv[2])",
|
|
543
|
+
" parent_fd = None",
|
|
544
|
+
" try:",
|
|
545
|
+
" parent_fd = walk_dir(root_fd, sys.argv[3], sys.argv[5] == '1')",
|
|
546
|
+
" write_atomic(parent_fd, sys.argv[4], sys.stdin.buffer)",
|
|
547
|
+
" finally:",
|
|
548
|
+
" if parent_fd is not None:",
|
|
549
|
+
" os.close(parent_fd)",
|
|
550
|
+
" os.close(root_fd)",
|
|
551
|
+
"elif operation == 'mkdirp':",
|
|
552
|
+
" root_fd = open_dir(sys.argv[2])",
|
|
553
|
+
" target_fd = None",
|
|
554
|
+
" try:",
|
|
555
|
+
" target_fd = walk_dir(root_fd, sys.argv[3], True)",
|
|
556
|
+
" os.fsync(target_fd)",
|
|
557
|
+
" finally:",
|
|
558
|
+
" if target_fd is not None:",
|
|
559
|
+
" os.close(target_fd)",
|
|
560
|
+
" os.close(root_fd)",
|
|
561
|
+
"elif operation == 'remove':",
|
|
562
|
+
" root_fd = open_dir(sys.argv[2])",
|
|
563
|
+
" parent_fd = None",
|
|
564
|
+
" try:",
|
|
565
|
+
" parent_fd = walk_dir(root_fd, sys.argv[3], False)",
|
|
566
|
+
" try:",
|
|
567
|
+
" if sys.argv[5] == '1':",
|
|
568
|
+
" remove_tree(parent_fd, sys.argv[4])",
|
|
569
|
+
" else:",
|
|
570
|
+
" entry_stat = os.lstat(sys.argv[4], dir_fd=parent_fd)",
|
|
571
|
+
" if stat.S_ISDIR(entry_stat.st_mode) and not stat.S_ISLNK(entry_stat.st_mode):",
|
|
572
|
+
" os.rmdir(sys.argv[4], dir_fd=parent_fd)",
|
|
573
|
+
" else:",
|
|
574
|
+
" os.unlink(sys.argv[4], dir_fd=parent_fd)",
|
|
575
|
+
" os.fsync(parent_fd)",
|
|
576
|
+
" except FileNotFoundError:",
|
|
577
|
+
" if sys.argv[6] != '1':",
|
|
578
|
+
" raise",
|
|
579
|
+
" finally:",
|
|
580
|
+
" if parent_fd is not None:",
|
|
581
|
+
" os.close(parent_fd)",
|
|
582
|
+
" os.close(root_fd)",
|
|
583
|
+
"elif operation == 'rename':",
|
|
584
|
+
" src_root_fd = open_dir(sys.argv[2])",
|
|
585
|
+
" dst_root_fd = open_dir(sys.argv[5])",
|
|
586
|
+
" src_parent_fd = None",
|
|
587
|
+
" dst_parent_fd = None",
|
|
588
|
+
" try:",
|
|
589
|
+
" src_parent_fd = walk_dir(src_root_fd, sys.argv[3], False)",
|
|
590
|
+
" dst_parent_fd = walk_dir(dst_root_fd, sys.argv[6], sys.argv[8] == '1')",
|
|
591
|
+
" move_entry(src_parent_fd, sys.argv[4], dst_parent_fd, sys.argv[7])",
|
|
592
|
+
" finally:",
|
|
593
|
+
" if src_parent_fd is not None:",
|
|
594
|
+
" os.close(src_parent_fd)",
|
|
595
|
+
" if dst_parent_fd is not None:",
|
|
596
|
+
" os.close(dst_parent_fd)",
|
|
597
|
+
" os.close(src_root_fd)",
|
|
598
|
+
" os.close(dst_root_fd)",
|
|
599
|
+
"else:",
|
|
600
|
+
" raise RuntimeError('unknown sandbox mutation operation: ' + operation)"
|
|
601
|
+
].join("\n");
|
|
602
|
+
function buildPinnedMutationPlan(params) {
|
|
603
|
+
return {
|
|
604
|
+
checks: params.checks,
|
|
605
|
+
recheckBeforeCommand: true,
|
|
606
|
+
script: [
|
|
607
|
+
"set -eu",
|
|
608
|
+
"python3 /dev/fd/3 \"$@\" 3<<'PY'",
|
|
609
|
+
SANDBOX_PINNED_MUTATION_PYTHON,
|
|
610
|
+
"PY"
|
|
611
|
+
].join("\n"),
|
|
612
|
+
args: params.args
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
function buildPinnedWritePlan(params) {
|
|
616
|
+
return buildPinnedMutationPlan({
|
|
617
|
+
checks: [params.check],
|
|
618
|
+
args: [
|
|
619
|
+
"write",
|
|
620
|
+
params.pinned.mountRootPath,
|
|
621
|
+
params.pinned.relativeParentPath,
|
|
622
|
+
params.pinned.basename,
|
|
623
|
+
params.mkdir ? "1" : "0"
|
|
624
|
+
]
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
function buildPinnedMkdirpPlan(params) {
|
|
628
|
+
return buildPinnedMutationPlan({
|
|
629
|
+
checks: [params.check],
|
|
630
|
+
args: [
|
|
631
|
+
"mkdirp",
|
|
632
|
+
params.pinned.mountRootPath,
|
|
633
|
+
params.pinned.relativePath
|
|
634
|
+
]
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
function buildPinnedRemovePlan(params) {
|
|
638
|
+
return buildPinnedMutationPlan({
|
|
639
|
+
checks: [{
|
|
640
|
+
target: params.check.target,
|
|
641
|
+
options: {
|
|
642
|
+
...params.check.options,
|
|
643
|
+
aliasPolicy: PATH_ALIAS_POLICIES.unlinkTarget
|
|
644
|
+
}
|
|
645
|
+
}],
|
|
646
|
+
args: [
|
|
647
|
+
"remove",
|
|
648
|
+
params.pinned.mountRootPath,
|
|
649
|
+
params.pinned.relativeParentPath,
|
|
650
|
+
params.pinned.basename,
|
|
651
|
+
params.recursive ? "1" : "0",
|
|
652
|
+
params.force === false ? "0" : "1"
|
|
653
|
+
]
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
function buildPinnedRenamePlan(params) {
|
|
657
|
+
return buildPinnedMutationPlan({
|
|
658
|
+
checks: [{
|
|
659
|
+
target: params.fromCheck.target,
|
|
660
|
+
options: {
|
|
661
|
+
...params.fromCheck.options,
|
|
662
|
+
aliasPolicy: PATH_ALIAS_POLICIES.unlinkTarget
|
|
663
|
+
}
|
|
664
|
+
}, params.toCheck],
|
|
665
|
+
args: [
|
|
666
|
+
"rename",
|
|
667
|
+
params.from.mountRootPath,
|
|
668
|
+
params.from.relativeParentPath,
|
|
669
|
+
params.from.basename,
|
|
670
|
+
params.to.mountRootPath,
|
|
671
|
+
params.to.relativeParentPath,
|
|
672
|
+
params.to.basename,
|
|
673
|
+
"1"
|
|
674
|
+
]
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
//#endregion
|
|
678
|
+
//#region src/agents/sandbox/path-utils.ts
|
|
679
|
+
function normalizeContainerPath$1(value) {
|
|
680
|
+
const normalized = path.posix.normalize(value);
|
|
681
|
+
return normalized === "." ? "/" : normalized;
|
|
682
|
+
}
|
|
683
|
+
function isPathInsideContainerRoot(root, target) {
|
|
684
|
+
const normalizedRoot = normalizeContainerPath$1(root);
|
|
685
|
+
const normalizedTarget = normalizeContainerPath$1(target);
|
|
686
|
+
if (normalizedRoot === "/") return true;
|
|
687
|
+
return normalizedTarget === normalizedRoot || normalizedTarget.startsWith(`${normalizedRoot}/`);
|
|
688
|
+
}
|
|
689
|
+
//#endregion
|
|
690
|
+
//#region src/agents/sandbox/remote-fs-bridge.ts
|
|
691
|
+
function createRemoteShellSandboxFsBridge(params) {
|
|
692
|
+
return new RemoteShellSandboxFsBridge(params.sandbox, params.runtime);
|
|
693
|
+
}
|
|
694
|
+
var RemoteShellSandboxFsBridge = class {
|
|
695
|
+
constructor(sandbox, runtime) {
|
|
696
|
+
this.sandbox = sandbox;
|
|
697
|
+
this.runtime = runtime;
|
|
698
|
+
}
|
|
699
|
+
resolvePath(params) {
|
|
700
|
+
const target = this.resolveTarget(params);
|
|
701
|
+
return {
|
|
702
|
+
relativePath: target.relativePath,
|
|
703
|
+
containerPath: target.containerPath
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
async readFile(params) {
|
|
707
|
+
const target = this.resolveTarget(params);
|
|
708
|
+
const canonical = await this.resolveCanonicalPath({
|
|
709
|
+
containerPath: target.containerPath,
|
|
710
|
+
action: "read files",
|
|
711
|
+
signal: params.signal
|
|
712
|
+
});
|
|
713
|
+
await this.assertNoHardlinkedFile({
|
|
714
|
+
containerPath: canonical,
|
|
715
|
+
action: "read files",
|
|
716
|
+
signal: params.signal
|
|
717
|
+
});
|
|
718
|
+
return (await this.runRemoteScript({
|
|
719
|
+
script: "set -eu\ncat -- \"$1\"",
|
|
720
|
+
args: [canonical],
|
|
721
|
+
signal: params.signal
|
|
722
|
+
})).stdout;
|
|
723
|
+
}
|
|
724
|
+
async writeFile(params) {
|
|
725
|
+
const target = this.resolveTarget(params);
|
|
726
|
+
this.ensureWritable(target, "write files");
|
|
727
|
+
const pinned = await this.resolvePinnedParent({
|
|
728
|
+
containerPath: target.containerPath,
|
|
729
|
+
action: "write files",
|
|
730
|
+
requireWritable: true
|
|
731
|
+
});
|
|
732
|
+
await this.assertNoHardlinkedFile({
|
|
733
|
+
containerPath: target.containerPath,
|
|
734
|
+
action: "write files",
|
|
735
|
+
signal: params.signal
|
|
736
|
+
});
|
|
737
|
+
const buffer = Buffer.isBuffer(params.data) ? params.data : Buffer.from(params.data, params.encoding ?? "utf8");
|
|
738
|
+
await this.runMutation({
|
|
739
|
+
args: [
|
|
740
|
+
"write",
|
|
741
|
+
pinned.mountRootPath,
|
|
742
|
+
pinned.relativeParentPath,
|
|
743
|
+
pinned.basename,
|
|
744
|
+
params.mkdir !== false ? "1" : "0"
|
|
745
|
+
],
|
|
746
|
+
stdin: buffer,
|
|
747
|
+
signal: params.signal
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
async mkdirp(params) {
|
|
751
|
+
const target = this.resolveTarget(params);
|
|
752
|
+
this.ensureWritable(target, "create directories");
|
|
753
|
+
const relativePath = path.posix.relative(target.mountRootPath, target.containerPath);
|
|
754
|
+
if (relativePath.startsWith("..") || path.posix.isAbsolute(relativePath)) throw new Error(`Sandbox path escapes allowed mounts; cannot create directories: ${target.containerPath}`);
|
|
755
|
+
await this.runMutation({
|
|
756
|
+
args: [
|
|
757
|
+
"mkdirp",
|
|
758
|
+
target.mountRootPath,
|
|
759
|
+
relativePath === "." ? "" : relativePath
|
|
760
|
+
],
|
|
761
|
+
signal: params.signal
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
async remove(params) {
|
|
765
|
+
const target = this.resolveTarget(params);
|
|
766
|
+
this.ensureWritable(target, "remove files");
|
|
767
|
+
if (!await this.remotePathExists(target.containerPath, params.signal)) {
|
|
768
|
+
if (params.force === false) throw new Error(`Sandbox path not found; cannot remove files: ${target.containerPath}`);
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
const pinned = await this.resolvePinnedParent({
|
|
772
|
+
containerPath: target.containerPath,
|
|
773
|
+
action: "remove files",
|
|
774
|
+
requireWritable: true,
|
|
775
|
+
allowFinalSymlinkForUnlink: true
|
|
776
|
+
});
|
|
777
|
+
await this.runMutation({
|
|
778
|
+
args: [
|
|
779
|
+
"remove",
|
|
780
|
+
pinned.mountRootPath,
|
|
781
|
+
pinned.relativeParentPath,
|
|
782
|
+
pinned.basename,
|
|
783
|
+
params.recursive ? "1" : "0",
|
|
784
|
+
params.force === false ? "0" : "1"
|
|
785
|
+
],
|
|
786
|
+
signal: params.signal,
|
|
787
|
+
allowFailure: params.force !== false
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
async rename(params) {
|
|
791
|
+
const from = this.resolveTarget({
|
|
792
|
+
filePath: params.from,
|
|
793
|
+
cwd: params.cwd
|
|
794
|
+
});
|
|
795
|
+
const to = this.resolveTarget({
|
|
796
|
+
filePath: params.to,
|
|
797
|
+
cwd: params.cwd
|
|
798
|
+
});
|
|
799
|
+
this.ensureWritable(from, "rename files");
|
|
800
|
+
this.ensureWritable(to, "rename files");
|
|
801
|
+
const fromPinned = await this.resolvePinnedParent({
|
|
802
|
+
containerPath: from.containerPath,
|
|
803
|
+
action: "rename files",
|
|
804
|
+
requireWritable: true,
|
|
805
|
+
allowFinalSymlinkForUnlink: true
|
|
806
|
+
});
|
|
807
|
+
const toPinned = await this.resolvePinnedParent({
|
|
808
|
+
containerPath: to.containerPath,
|
|
809
|
+
action: "rename files",
|
|
810
|
+
requireWritable: true
|
|
811
|
+
});
|
|
812
|
+
await this.runMutation({
|
|
813
|
+
args: [
|
|
814
|
+
"rename",
|
|
815
|
+
fromPinned.mountRootPath,
|
|
816
|
+
fromPinned.relativeParentPath,
|
|
817
|
+
fromPinned.basename,
|
|
818
|
+
toPinned.mountRootPath,
|
|
819
|
+
toPinned.relativeParentPath,
|
|
820
|
+
toPinned.basename,
|
|
821
|
+
"1"
|
|
822
|
+
],
|
|
823
|
+
signal: params.signal
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
async stat(params) {
|
|
827
|
+
const target = this.resolveTarget(params);
|
|
828
|
+
if (!await this.remotePathExists(target.containerPath, params.signal)) return null;
|
|
829
|
+
const canonical = await this.resolveCanonicalPath({
|
|
830
|
+
containerPath: target.containerPath,
|
|
831
|
+
action: "stat files",
|
|
832
|
+
signal: params.signal
|
|
833
|
+
});
|
|
834
|
+
await this.assertNoHardlinkedFile({
|
|
835
|
+
containerPath: canonical,
|
|
836
|
+
action: "stat files",
|
|
837
|
+
signal: params.signal
|
|
838
|
+
});
|
|
839
|
+
const [kindRaw = "", sizeRaw = "0", mtimeRaw = "0"] = (await this.runRemoteScript({
|
|
840
|
+
script: "set -eu\nstat -c \"%F|%s|%Y\" -- \"$1\"",
|
|
841
|
+
args: [canonical],
|
|
842
|
+
signal: params.signal
|
|
843
|
+
})).stdout.toString("utf8").trim().split("|");
|
|
844
|
+
return {
|
|
845
|
+
type: kindRaw === "directory" ? "directory" : kindRaw === "regular file" ? "file" : "other",
|
|
846
|
+
size: Number(sizeRaw),
|
|
847
|
+
mtimeMs: Number(mtimeRaw) * 1e3
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
getMounts() {
|
|
851
|
+
const mounts = [{
|
|
852
|
+
containerRoot: normalizeContainerPath(this.runtime.remoteWorkspaceDir),
|
|
853
|
+
writable: this.sandbox.workspaceAccess === "rw",
|
|
854
|
+
source: "workspace"
|
|
855
|
+
}];
|
|
856
|
+
if (this.sandbox.workspaceAccess !== "none" && path.resolve(this.sandbox.agentWorkspaceDir) !== path.resolve(this.sandbox.workspaceDir)) mounts.push({
|
|
857
|
+
containerRoot: normalizeContainerPath(this.runtime.remoteAgentWorkspaceDir),
|
|
858
|
+
writable: this.sandbox.workspaceAccess === "rw",
|
|
859
|
+
source: "agent"
|
|
860
|
+
});
|
|
861
|
+
return mounts;
|
|
862
|
+
}
|
|
863
|
+
resolveTarget(params) {
|
|
864
|
+
const workspaceRoot = path.resolve(this.sandbox.workspaceDir);
|
|
865
|
+
const agentRoot = path.resolve(this.sandbox.agentWorkspaceDir);
|
|
866
|
+
const workspaceContainerRoot = normalizeContainerPath(this.runtime.remoteWorkspaceDir);
|
|
867
|
+
const agentContainerRoot = normalizeContainerPath(this.runtime.remoteAgentWorkspaceDir);
|
|
868
|
+
const mounts = this.getMounts();
|
|
869
|
+
const input = params.filePath.trim();
|
|
870
|
+
const inputPosix = input.replace(/\\/g, "/");
|
|
871
|
+
const maybeContainerMount = path.posix.isAbsolute(inputPosix) ? this.resolveMountByContainerPath(mounts, normalizeContainerPath(inputPosix)) : null;
|
|
872
|
+
if (maybeContainerMount) return this.toResolvedPath({
|
|
873
|
+
mount: maybeContainerMount,
|
|
874
|
+
containerPath: normalizeContainerPath(inputPosix)
|
|
875
|
+
});
|
|
876
|
+
const hostCwd = params.cwd ? path.resolve(params.cwd) : workspaceRoot;
|
|
877
|
+
const hostCandidate = path.isAbsolute(input) ? path.resolve(input) : path.resolve(hostCwd, input);
|
|
878
|
+
if (isPathInside(workspaceRoot, hostCandidate)) {
|
|
879
|
+
const relative = toPosixRelative(workspaceRoot, hostCandidate);
|
|
880
|
+
return this.toResolvedPath({
|
|
881
|
+
mount: mounts[0],
|
|
882
|
+
containerPath: relative ? path.posix.join(workspaceContainerRoot, relative) : workspaceContainerRoot
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
if (mounts[1] && isPathInside(agentRoot, hostCandidate)) {
|
|
886
|
+
const relative = toPosixRelative(agentRoot, hostCandidate);
|
|
887
|
+
return this.toResolvedPath({
|
|
888
|
+
mount: mounts[1],
|
|
889
|
+
containerPath: relative ? path.posix.join(agentContainerRoot, relative) : agentContainerRoot
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
if (params.cwd) {
|
|
893
|
+
const cwdPosix = params.cwd.replace(/\\/g, "/");
|
|
894
|
+
if (path.posix.isAbsolute(cwdPosix)) {
|
|
895
|
+
const cwdContainer = normalizeContainerPath(cwdPosix);
|
|
896
|
+
const cwdMount = this.resolveMountByContainerPath(mounts, cwdContainer);
|
|
897
|
+
if (cwdMount) return this.toResolvedPath({
|
|
898
|
+
mount: cwdMount,
|
|
899
|
+
containerPath: normalizeContainerPath(path.posix.resolve(cwdContainer, inputPosix))
|
|
900
|
+
});
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
throw new Error(`Sandbox path escapes allowed mounts; cannot access: ${params.filePath}`);
|
|
904
|
+
}
|
|
905
|
+
toResolvedPath(params) {
|
|
906
|
+
const relative = path.posix.relative(params.mount.containerRoot, params.containerPath);
|
|
907
|
+
if (relative.startsWith("..") || path.posix.isAbsolute(relative)) throw new Error(`Sandbox path escapes allowed mounts; cannot access: ${params.containerPath}`);
|
|
908
|
+
return {
|
|
909
|
+
relativePath: params.mount.source === "workspace" ? relative === "." ? "" : relative : relative === "." ? params.mount.containerRoot : `${params.mount.containerRoot}/${relative}`,
|
|
910
|
+
containerPath: params.containerPath,
|
|
911
|
+
writable: params.mount.writable,
|
|
912
|
+
mountRootPath: params.mount.containerRoot,
|
|
913
|
+
source: params.mount.source
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
resolveMountByContainerPath(mounts, containerPath) {
|
|
917
|
+
const ordered = [...mounts].toSorted((a, b) => b.containerRoot.length - a.containerRoot.length);
|
|
918
|
+
for (const mount of ordered) if (isPathInsideContainerRoot(mount.containerRoot, containerPath)) return mount;
|
|
919
|
+
return null;
|
|
920
|
+
}
|
|
921
|
+
ensureWritable(target, action) {
|
|
922
|
+
if (this.sandbox.workspaceAccess !== "rw" || !target.writable) throw new Error(`Sandbox path is read-only; cannot ${action}: ${target.containerPath}`);
|
|
923
|
+
}
|
|
924
|
+
async remotePathExists(containerPath, signal) {
|
|
925
|
+
return (await this.runRemoteScript({
|
|
926
|
+
script: "if [ -e \"$1\" ] || [ -L \"$1\" ]; then printf \"1\\n\"; else printf \"0\\n\"; fi",
|
|
927
|
+
args: [containerPath],
|
|
928
|
+
signal
|
|
929
|
+
})).stdout.toString("utf8").trim() === "1";
|
|
930
|
+
}
|
|
931
|
+
async resolveCanonicalPath(params) {
|
|
932
|
+
const script = [
|
|
933
|
+
"set -eu",
|
|
934
|
+
"target=\"$1\"",
|
|
935
|
+
"allow_final=\"$2\"",
|
|
936
|
+
"suffix=\"\"",
|
|
937
|
+
"probe=\"$target\"",
|
|
938
|
+
"if [ \"$allow_final\" = \"1\" ] && [ -L \"$target\" ]; then probe=$(dirname -- \"$target\"); fi",
|
|
939
|
+
"cursor=\"$probe\"",
|
|
940
|
+
"while [ ! -e \"$cursor\" ] && [ ! -L \"$cursor\" ]; do",
|
|
941
|
+
" parent=$(dirname -- \"$cursor\")",
|
|
942
|
+
" if [ \"$parent\" = \"$cursor\" ]; then break; fi",
|
|
943
|
+
" base=$(basename -- \"$cursor\")",
|
|
944
|
+
" suffix=\"/$base$suffix\"",
|
|
945
|
+
" cursor=\"$parent\"",
|
|
946
|
+
"done",
|
|
947
|
+
"canonical=$(readlink -f -- \"$cursor\")",
|
|
948
|
+
"printf \"%s%s\\n\" \"$canonical\" \"$suffix\""
|
|
949
|
+
].join("\n");
|
|
950
|
+
const canonical = normalizeContainerPath((await this.runRemoteScript({
|
|
951
|
+
script,
|
|
952
|
+
args: [params.containerPath, params.allowFinalSymlinkForUnlink ? "1" : "0"],
|
|
953
|
+
signal: params.signal
|
|
954
|
+
})).stdout.toString("utf8").trim());
|
|
955
|
+
if (!this.resolveMountByContainerPath(this.getMounts(), canonical)) throw new Error(`Sandbox path escapes allowed mounts; cannot ${params.action}: ${params.containerPath}`);
|
|
956
|
+
return canonical;
|
|
957
|
+
}
|
|
958
|
+
async assertNoHardlinkedFile(params) {
|
|
959
|
+
const output = (await this.runRemoteScript({
|
|
960
|
+
script: [
|
|
961
|
+
"if [ ! -e \"$1\" ] && [ ! -L \"$1\" ]; then exit 0; fi",
|
|
962
|
+
"stats=$(stat -c \"%F|%h\" -- \"$1\")",
|
|
963
|
+
"printf \"%s\\n\" \"$stats\""
|
|
964
|
+
].join("\n"),
|
|
965
|
+
args: [params.containerPath],
|
|
966
|
+
signal: params.signal,
|
|
967
|
+
allowFailure: true
|
|
968
|
+
})).stdout.toString("utf8").trim();
|
|
969
|
+
if (!output) return;
|
|
970
|
+
const [kind = "", linksRaw = "1"] = output.split("|");
|
|
971
|
+
if (kind === "regular file" && Number(linksRaw) > 1) throw new Error(`Hardlinked path is not allowed under sandbox mount root: ${params.containerPath}`);
|
|
972
|
+
}
|
|
973
|
+
async resolvePinnedParent(params) {
|
|
974
|
+
const basename = path.posix.basename(params.containerPath);
|
|
975
|
+
if (!basename || basename === "." || basename === "/") throw new Error(`Invalid sandbox entry target: ${params.containerPath}`);
|
|
976
|
+
const canonicalParent = await this.resolveCanonicalPath({
|
|
977
|
+
containerPath: normalizeContainerPath(path.posix.dirname(params.containerPath)),
|
|
978
|
+
action: params.action,
|
|
979
|
+
allowFinalSymlinkForUnlink: params.allowFinalSymlinkForUnlink
|
|
980
|
+
});
|
|
981
|
+
const mount = this.resolveMountByContainerPath(this.getMounts(), canonicalParent);
|
|
982
|
+
if (!mount) throw new Error(`Sandbox path escapes allowed mounts; cannot ${params.action}: ${params.containerPath}`);
|
|
983
|
+
if (params.requireWritable && !mount.writable) throw new Error(`Sandbox path is read-only; cannot ${params.action}: ${params.containerPath}`);
|
|
984
|
+
const relativeParentPath = path.posix.relative(mount.containerRoot, canonicalParent);
|
|
985
|
+
if (relativeParentPath.startsWith("..") || path.posix.isAbsolute(relativeParentPath)) throw new Error(`Sandbox path escapes allowed mounts; cannot ${params.action}: ${params.containerPath}`);
|
|
986
|
+
return {
|
|
987
|
+
mountRootPath: mount.containerRoot,
|
|
988
|
+
relativeParentPath: relativeParentPath === "." ? "" : relativeParentPath,
|
|
989
|
+
basename
|
|
990
|
+
};
|
|
991
|
+
}
|
|
992
|
+
async runMutation(params) {
|
|
993
|
+
await this.runRemoteScript({
|
|
994
|
+
script: [
|
|
995
|
+
"set -eu",
|
|
996
|
+
"python3 /dev/fd/3 \"$@\" 3<<'PY'",
|
|
997
|
+
SANDBOX_PINNED_MUTATION_PYTHON,
|
|
998
|
+
"PY"
|
|
999
|
+
].join("\n"),
|
|
1000
|
+
args: params.args,
|
|
1001
|
+
stdin: params.stdin,
|
|
1002
|
+
signal: params.signal,
|
|
1003
|
+
allowFailure: params.allowFailure
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
async runRemoteScript(params) {
|
|
1007
|
+
return await this.runtime.runRemoteShellScript({
|
|
1008
|
+
script: params.script,
|
|
1009
|
+
args: params.args,
|
|
1010
|
+
stdin: params.stdin,
|
|
1011
|
+
signal: params.signal,
|
|
1012
|
+
allowFailure: params.allowFailure
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
};
|
|
1016
|
+
function normalizeContainerPath(value) {
|
|
1017
|
+
const normalized = normalizeContainerPath$1(value.trim() || "/");
|
|
1018
|
+
return normalized.startsWith("/") ? normalized : `/${normalized}`;
|
|
1019
|
+
}
|
|
1020
|
+
function toPosixRelative(root, candidate) {
|
|
1021
|
+
return path.relative(root, candidate).split(path.sep).filter(Boolean).join(path.posix.sep);
|
|
1022
|
+
}
|
|
1023
|
+
//#endregion
|
|
1024
|
+
//#region src/agents/sandbox/ssh.ts
|
|
1025
|
+
function normalizeInlineSshMaterial(contents, filename) {
|
|
1026
|
+
const normalizedEscapedNewlines = contents.replace(/^\uFEFF/, "").replace(/\r\n?/g, "\n").replace(/\\r\\n/g, "\\n").replace(/\\r/g, "\\n");
|
|
1027
|
+
const expanded = filename === "identity" || filename === "certificate.pub" ? normalizedEscapedNewlines.replace(/\\n/g, "\n") : normalizedEscapedNewlines;
|
|
1028
|
+
return expanded.endsWith("\n") ? expanded : `${expanded}\n`;
|
|
1029
|
+
}
|
|
1030
|
+
function buildSshFailureMessage(stderr, exitCode) {
|
|
1031
|
+
const trimmed = stderr.trim();
|
|
1032
|
+
if (trimmed.includes("error in libcrypto") && (trimmed.includes("Load key \"") || trimmed.includes("Permission denied (publickey)"))) return `${trimmed}\nSSH sandbox failed to load the configured identity. The private key contents may be malformed (for example CRLF or escaped newlines). Prefer identityFile when possible.`;
|
|
1033
|
+
return trimmed || (exitCode !== void 0 ? `ssh exited with code ${exitCode}` : "ssh exited with a non-zero status");
|
|
1034
|
+
}
|
|
1035
|
+
function shellEscape(value) {
|
|
1036
|
+
return `'${value.replaceAll("'", `'"'"'`)}'`;
|
|
1037
|
+
}
|
|
1038
|
+
function buildRemoteCommand(argv) {
|
|
1039
|
+
return argv.map((entry) => shellEscape(entry)).join(" ");
|
|
1040
|
+
}
|
|
1041
|
+
function buildExecRemoteCommand(params) {
|
|
1042
|
+
const body = params.workdir ? `cd ${shellEscape(params.workdir)} && ${params.command}` : params.command;
|
|
1043
|
+
return buildRemoteCommand(Object.keys(params.env).length > 0 ? [
|
|
1044
|
+
"env",
|
|
1045
|
+
...Object.entries(params.env).map(([key, value]) => `${key}=${value}`),
|
|
1046
|
+
"/bin/sh",
|
|
1047
|
+
"-c",
|
|
1048
|
+
body
|
|
1049
|
+
] : [
|
|
1050
|
+
"/bin/sh",
|
|
1051
|
+
"-c",
|
|
1052
|
+
body
|
|
1053
|
+
]);
|
|
1054
|
+
}
|
|
1055
|
+
function buildSshSandboxArgv(params) {
|
|
1056
|
+
return [
|
|
1057
|
+
params.session.command,
|
|
1058
|
+
"-F",
|
|
1059
|
+
params.session.configPath,
|
|
1060
|
+
...params.tty ? [
|
|
1061
|
+
"-tt",
|
|
1062
|
+
"-o",
|
|
1063
|
+
"RequestTTY=force",
|
|
1064
|
+
"-o",
|
|
1065
|
+
"SetEnv=TERM=xterm-256color"
|
|
1066
|
+
] : [
|
|
1067
|
+
"-T",
|
|
1068
|
+
"-o",
|
|
1069
|
+
"RequestTTY=no"
|
|
1070
|
+
],
|
|
1071
|
+
params.session.host,
|
|
1072
|
+
params.remoteCommand
|
|
1073
|
+
];
|
|
1074
|
+
}
|
|
1075
|
+
async function createSshSandboxSessionFromConfigText(params) {
|
|
1076
|
+
const host = params.host?.trim() || parseSshConfigHost(params.configText);
|
|
1077
|
+
if (!host) throw new Error("Failed to parse SSH config output.");
|
|
1078
|
+
const configDir = await fs$1.mkdtemp(path.join(resolveSshTmpRoot(), "openclaw-sandbox-ssh-"));
|
|
1079
|
+
const configPath = path.join(configDir, "config");
|
|
1080
|
+
await fs$1.writeFile(configPath, params.configText, {
|
|
1081
|
+
encoding: "utf8",
|
|
1082
|
+
mode: 384
|
|
1083
|
+
});
|
|
1084
|
+
await fs$1.chmod(configPath, 384);
|
|
1085
|
+
return {
|
|
1086
|
+
command: params.command?.trim() || "ssh",
|
|
1087
|
+
configPath,
|
|
1088
|
+
host
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
async function createSshSandboxSessionFromSettings(settings) {
|
|
1092
|
+
const parsed = parseSshTarget(settings.target);
|
|
1093
|
+
if (!parsed) throw new Error(`Invalid sandbox SSH target: ${settings.target}`);
|
|
1094
|
+
const configDir = await fs$1.mkdtemp(path.join(resolveSshTmpRoot(), "openclaw-sandbox-ssh-"));
|
|
1095
|
+
try {
|
|
1096
|
+
const materializedIdentity = settings.identityData ? await writeSecretMaterial(configDir, "identity", settings.identityData) : void 0;
|
|
1097
|
+
const materializedCertificate = settings.certificateData ? await writeSecretMaterial(configDir, "certificate.pub", settings.certificateData) : void 0;
|
|
1098
|
+
const materializedKnownHosts = settings.knownHostsData ? await writeSecretMaterial(configDir, "known_hosts", settings.knownHostsData) : void 0;
|
|
1099
|
+
const identityFile = materializedIdentity ?? resolveOptionalLocalPath(settings.identityFile);
|
|
1100
|
+
const certificateFile = materializedCertificate ?? resolveOptionalLocalPath(settings.certificateFile);
|
|
1101
|
+
const knownHostsFile = materializedKnownHosts ?? resolveOptionalLocalPath(settings.knownHostsFile);
|
|
1102
|
+
const hostAlias = "openclaw-sandbox";
|
|
1103
|
+
const configPath = path.join(configDir, "config");
|
|
1104
|
+
const lines = [
|
|
1105
|
+
`Host ${hostAlias}`,
|
|
1106
|
+
` HostName ${parsed.host}`,
|
|
1107
|
+
` Port ${parsed.port}`,
|
|
1108
|
+
" BatchMode yes",
|
|
1109
|
+
" ConnectTimeout 5",
|
|
1110
|
+
" ServerAliveInterval 15",
|
|
1111
|
+
" ServerAliveCountMax 3",
|
|
1112
|
+
` StrictHostKeyChecking ${settings.strictHostKeyChecking ? "yes" : "no"}`,
|
|
1113
|
+
` UpdateHostKeys ${settings.updateHostKeys ? "yes" : "no"}`
|
|
1114
|
+
];
|
|
1115
|
+
if (parsed.user) lines.push(` User ${parsed.user}`);
|
|
1116
|
+
if (knownHostsFile) lines.push(` UserKnownHostsFile ${knownHostsFile}`);
|
|
1117
|
+
else if (!settings.strictHostKeyChecking) lines.push(" UserKnownHostsFile /dev/null");
|
|
1118
|
+
if (identityFile) lines.push(` IdentityFile ${identityFile}`);
|
|
1119
|
+
if (certificateFile) lines.push(` CertificateFile ${certificateFile}`);
|
|
1120
|
+
if (identityFile || certificateFile) lines.push(" IdentitiesOnly yes");
|
|
1121
|
+
await fs$1.writeFile(configPath, `${lines.join("\n")}\n`, {
|
|
1122
|
+
encoding: "utf8",
|
|
1123
|
+
mode: 384
|
|
1124
|
+
});
|
|
1125
|
+
await fs$1.chmod(configPath, 384);
|
|
1126
|
+
return {
|
|
1127
|
+
command: settings.command.trim() || "ssh",
|
|
1128
|
+
configPath,
|
|
1129
|
+
host: hostAlias
|
|
1130
|
+
};
|
|
1131
|
+
} catch (error) {
|
|
1132
|
+
await fs$1.rm(configDir, {
|
|
1133
|
+
recursive: true,
|
|
1134
|
+
force: true
|
|
1135
|
+
});
|
|
1136
|
+
throw error;
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
async function disposeSshSandboxSession(session) {
|
|
1140
|
+
await fs$1.rm(path.dirname(session.configPath), {
|
|
1141
|
+
recursive: true,
|
|
1142
|
+
force: true
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
async function runSshSandboxCommand(params) {
|
|
1146
|
+
const argv = buildSshSandboxArgv({
|
|
1147
|
+
session: params.session,
|
|
1148
|
+
remoteCommand: params.remoteCommand,
|
|
1149
|
+
tty: params.tty
|
|
1150
|
+
});
|
|
1151
|
+
return await new Promise((resolve, reject) => {
|
|
1152
|
+
const child = spawn(argv[0], argv.slice(1), {
|
|
1153
|
+
stdio: [
|
|
1154
|
+
"pipe",
|
|
1155
|
+
"pipe",
|
|
1156
|
+
"pipe"
|
|
1157
|
+
],
|
|
1158
|
+
env: process.env,
|
|
1159
|
+
signal: params.signal
|
|
1160
|
+
});
|
|
1161
|
+
const stdoutChunks = [];
|
|
1162
|
+
const stderrChunks = [];
|
|
1163
|
+
child.stdout.on("data", (chunk) => stdoutChunks.push(Buffer.from(chunk)));
|
|
1164
|
+
child.stderr.on("data", (chunk) => stderrChunks.push(Buffer.from(chunk)));
|
|
1165
|
+
child.on("error", reject);
|
|
1166
|
+
child.on("close", (code) => {
|
|
1167
|
+
const stdout = Buffer.concat(stdoutChunks);
|
|
1168
|
+
const stderr = Buffer.concat(stderrChunks);
|
|
1169
|
+
const exitCode = code ?? 0;
|
|
1170
|
+
if (exitCode !== 0 && !params.allowFailure) {
|
|
1171
|
+
reject(Object.assign(new Error(buildSshFailureMessage(stderr.toString("utf8"), exitCode)), {
|
|
1172
|
+
code: exitCode,
|
|
1173
|
+
stdout,
|
|
1174
|
+
stderr
|
|
1175
|
+
}));
|
|
1176
|
+
return;
|
|
1177
|
+
}
|
|
1178
|
+
resolve({
|
|
1179
|
+
stdout,
|
|
1180
|
+
stderr,
|
|
1181
|
+
code: exitCode
|
|
1182
|
+
});
|
|
1183
|
+
});
|
|
1184
|
+
if (params.stdin !== void 0) {
|
|
1185
|
+
child.stdin.end(params.stdin);
|
|
1186
|
+
return;
|
|
1187
|
+
}
|
|
1188
|
+
child.stdin.end();
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
async function uploadDirectoryToSshTarget(params) {
|
|
1192
|
+
const remoteCommand = buildRemoteCommand([
|
|
1193
|
+
"/bin/sh",
|
|
1194
|
+
"-c",
|
|
1195
|
+
"mkdir -p -- \"$1\" && tar -xf - -C \"$1\"",
|
|
1196
|
+
"openclaw-sandbox-upload",
|
|
1197
|
+
params.remoteDir
|
|
1198
|
+
]);
|
|
1199
|
+
const sshArgv = buildSshSandboxArgv({
|
|
1200
|
+
session: params.session,
|
|
1201
|
+
remoteCommand
|
|
1202
|
+
});
|
|
1203
|
+
await new Promise((resolve, reject) => {
|
|
1204
|
+
const tar = spawn("tar", [
|
|
1205
|
+
"-C",
|
|
1206
|
+
params.localDir,
|
|
1207
|
+
"-cf",
|
|
1208
|
+
"-",
|
|
1209
|
+
"."
|
|
1210
|
+
], {
|
|
1211
|
+
stdio: [
|
|
1212
|
+
"ignore",
|
|
1213
|
+
"pipe",
|
|
1214
|
+
"pipe"
|
|
1215
|
+
],
|
|
1216
|
+
signal: params.signal
|
|
1217
|
+
});
|
|
1218
|
+
const ssh = spawn(sshArgv[0], sshArgv.slice(1), {
|
|
1219
|
+
stdio: [
|
|
1220
|
+
"pipe",
|
|
1221
|
+
"pipe",
|
|
1222
|
+
"pipe"
|
|
1223
|
+
],
|
|
1224
|
+
env: process.env,
|
|
1225
|
+
signal: params.signal
|
|
1226
|
+
});
|
|
1227
|
+
const tarStderr = [];
|
|
1228
|
+
const sshStdout = [];
|
|
1229
|
+
const sshStderr = [];
|
|
1230
|
+
let tarClosed = false;
|
|
1231
|
+
let sshClosed = false;
|
|
1232
|
+
let tarCode = 0;
|
|
1233
|
+
let sshCode = 0;
|
|
1234
|
+
tar.stderr.on("data", (chunk) => tarStderr.push(Buffer.from(chunk)));
|
|
1235
|
+
ssh.stdout.on("data", (chunk) => sshStdout.push(Buffer.from(chunk)));
|
|
1236
|
+
ssh.stderr.on("data", (chunk) => sshStderr.push(Buffer.from(chunk)));
|
|
1237
|
+
const fail = (error) => {
|
|
1238
|
+
tar.kill("SIGKILL");
|
|
1239
|
+
ssh.kill("SIGKILL");
|
|
1240
|
+
reject(error);
|
|
1241
|
+
};
|
|
1242
|
+
tar.on("error", fail);
|
|
1243
|
+
ssh.on("error", fail);
|
|
1244
|
+
tar.stdout.pipe(ssh.stdin);
|
|
1245
|
+
tar.on("close", (code) => {
|
|
1246
|
+
tarClosed = true;
|
|
1247
|
+
tarCode = code ?? 0;
|
|
1248
|
+
maybeResolve();
|
|
1249
|
+
});
|
|
1250
|
+
ssh.on("close", (code) => {
|
|
1251
|
+
sshClosed = true;
|
|
1252
|
+
sshCode = code ?? 0;
|
|
1253
|
+
maybeResolve();
|
|
1254
|
+
});
|
|
1255
|
+
function maybeResolve() {
|
|
1256
|
+
if (!tarClosed || !sshClosed) return;
|
|
1257
|
+
if (tarCode !== 0) {
|
|
1258
|
+
reject(new Error(Buffer.concat(tarStderr).toString("utf8").trim() || `tar exited with code ${tarCode}`));
|
|
1259
|
+
return;
|
|
1260
|
+
}
|
|
1261
|
+
if (sshCode !== 0) {
|
|
1262
|
+
reject(new Error(Buffer.concat(sshStderr).toString("utf8").trim() || `ssh exited with code ${sshCode}`));
|
|
1263
|
+
return;
|
|
1264
|
+
}
|
|
1265
|
+
resolve();
|
|
1266
|
+
}
|
|
1267
|
+
});
|
|
1268
|
+
}
|
|
1269
|
+
function parseSshConfigHost(configText) {
|
|
1270
|
+
return configText.match(/^\s*Host\s+(\S+)/m)?.[1]?.trim() || null;
|
|
1271
|
+
}
|
|
1272
|
+
function resolveSshTmpRoot() {
|
|
1273
|
+
return path.resolve(resolvePreferredOpenClawTmpDir() ?? os.tmpdir());
|
|
1274
|
+
}
|
|
1275
|
+
function resolveOptionalLocalPath(value) {
|
|
1276
|
+
const trimmed = value?.trim();
|
|
1277
|
+
return trimmed ? resolveUserPath(trimmed) : void 0;
|
|
1278
|
+
}
|
|
1279
|
+
async function writeSecretMaterial(dir, filename, contents) {
|
|
1280
|
+
const pathname = path.join(dir, filename);
|
|
1281
|
+
await fs$1.writeFile(pathname, normalizeInlineSshMaterial(contents, filename), {
|
|
1282
|
+
encoding: "utf8",
|
|
1283
|
+
mode: 384
|
|
1284
|
+
});
|
|
1285
|
+
await fs$1.chmod(pathname, 384);
|
|
1286
|
+
return pathname;
|
|
1287
|
+
}
|
|
1288
|
+
//#endregion
|
|
1289
|
+
//#region src/agents/sandbox/ssh-backend.ts
|
|
1290
|
+
const sshSandboxBackendManager = {
|
|
1291
|
+
async describeRuntime({ entry, config, agentId }) {
|
|
1292
|
+
const cfg = resolveSandboxConfigForAgent(config, agentId);
|
|
1293
|
+
if (cfg.backend !== "ssh" || !cfg.ssh.target) return {
|
|
1294
|
+
running: false,
|
|
1295
|
+
actualConfigLabel: cfg.ssh.target,
|
|
1296
|
+
configLabelMatch: false
|
|
1297
|
+
};
|
|
1298
|
+
const runtimePaths = resolveSshRuntimePaths(cfg.ssh.workspaceRoot, entry.sessionKey);
|
|
1299
|
+
const session = await createSshSandboxSessionFromSettings({
|
|
1300
|
+
...cfg.ssh,
|
|
1301
|
+
target: cfg.ssh.target
|
|
1302
|
+
});
|
|
1303
|
+
try {
|
|
1304
|
+
return {
|
|
1305
|
+
running: (await runSshSandboxCommand({
|
|
1306
|
+
session,
|
|
1307
|
+
remoteCommand: buildRemoteCommand([
|
|
1308
|
+
"/bin/sh",
|
|
1309
|
+
"-c",
|
|
1310
|
+
"if [ -d \"$1\" ]; then printf \"1\\n\"; else printf \"0\\n\"; fi",
|
|
1311
|
+
"openclaw-sandbox-check",
|
|
1312
|
+
runtimePaths.runtimeRootDir
|
|
1313
|
+
])
|
|
1314
|
+
})).stdout.toString("utf8").trim() === "1",
|
|
1315
|
+
actualConfigLabel: cfg.ssh.target,
|
|
1316
|
+
configLabelMatch: entry.image === cfg.ssh.target
|
|
1317
|
+
};
|
|
1318
|
+
} finally {
|
|
1319
|
+
await disposeSshSandboxSession(session);
|
|
1320
|
+
}
|
|
1321
|
+
},
|
|
1322
|
+
async removeRuntime({ entry, config, agentId }) {
|
|
1323
|
+
const cfg = resolveSandboxConfigForAgent(config, agentId);
|
|
1324
|
+
if (cfg.backend !== "ssh" || !cfg.ssh.target) return;
|
|
1325
|
+
const runtimePaths = resolveSshRuntimePaths(cfg.ssh.workspaceRoot, entry.sessionKey);
|
|
1326
|
+
const session = await createSshSandboxSessionFromSettings({
|
|
1327
|
+
...cfg.ssh,
|
|
1328
|
+
target: cfg.ssh.target
|
|
1329
|
+
});
|
|
1330
|
+
try {
|
|
1331
|
+
await runSshSandboxCommand({
|
|
1332
|
+
session,
|
|
1333
|
+
remoteCommand: buildRemoteCommand([
|
|
1334
|
+
"/bin/sh",
|
|
1335
|
+
"-c",
|
|
1336
|
+
"rm -rf -- \"$1\"",
|
|
1337
|
+
"openclaw-sandbox-remove",
|
|
1338
|
+
runtimePaths.runtimeRootDir
|
|
1339
|
+
]),
|
|
1340
|
+
allowFailure: true
|
|
1341
|
+
});
|
|
1342
|
+
} finally {
|
|
1343
|
+
await disposeSshSandboxSession(session);
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
async function createSshSandboxBackend(params) {
|
|
1348
|
+
if ((params.cfg.docker.binds?.length ?? 0) > 0) throw new Error("SSH sandbox backend does not support sandbox.docker.binds.");
|
|
1349
|
+
const target = params.cfg.ssh.target;
|
|
1350
|
+
if (!target) throw new Error("Sandbox backend \"ssh\" requires agents.defaults.sandbox.ssh.target.");
|
|
1351
|
+
return new SshSandboxBackendImpl({
|
|
1352
|
+
createParams: params,
|
|
1353
|
+
target,
|
|
1354
|
+
runtimePaths: resolveSshRuntimePaths(params.cfg.ssh.workspaceRoot, params.scopeKey)
|
|
1355
|
+
}).asHandle();
|
|
1356
|
+
}
|
|
1357
|
+
var SshSandboxBackendImpl = class {
|
|
1358
|
+
constructor(params) {
|
|
1359
|
+
this.params = params;
|
|
1360
|
+
this.ensurePromise = null;
|
|
1361
|
+
}
|
|
1362
|
+
asHandle() {
|
|
1363
|
+
return {
|
|
1364
|
+
id: "ssh",
|
|
1365
|
+
runtimeId: this.params.runtimePaths.runtimeId,
|
|
1366
|
+
runtimeLabel: this.params.runtimePaths.runtimeId,
|
|
1367
|
+
workdir: this.params.runtimePaths.remoteWorkspaceDir,
|
|
1368
|
+
env: this.params.createParams.cfg.docker.env,
|
|
1369
|
+
configLabel: this.params.target,
|
|
1370
|
+
configLabelKind: "Target",
|
|
1371
|
+
remoteWorkspaceDir: this.params.runtimePaths.remoteWorkspaceDir,
|
|
1372
|
+
remoteAgentWorkspaceDir: this.params.runtimePaths.remoteAgentWorkspaceDir,
|
|
1373
|
+
buildExecSpec: async ({ command, workdir, env, usePty }) => {
|
|
1374
|
+
await this.ensureRuntime();
|
|
1375
|
+
const sshSession = await this.createSession();
|
|
1376
|
+
return {
|
|
1377
|
+
argv: buildSshSandboxArgv({
|
|
1378
|
+
session: sshSession,
|
|
1379
|
+
remoteCommand: buildExecRemoteCommand({
|
|
1380
|
+
command,
|
|
1381
|
+
workdir: workdir ?? this.params.runtimePaths.remoteWorkspaceDir,
|
|
1382
|
+
env
|
|
1383
|
+
}),
|
|
1384
|
+
tty: usePty
|
|
1385
|
+
}),
|
|
1386
|
+
env: process.env,
|
|
1387
|
+
stdinMode: "pipe-open",
|
|
1388
|
+
finalizeToken: { sshSession }
|
|
1389
|
+
};
|
|
1390
|
+
},
|
|
1391
|
+
finalizeExec: async ({ token }) => {
|
|
1392
|
+
const sshSession = token?.sshSession;
|
|
1393
|
+
if (sshSession) await disposeSshSandboxSession(sshSession);
|
|
1394
|
+
},
|
|
1395
|
+
runShellCommand: async (command) => await this.runRemoteShellScript(command),
|
|
1396
|
+
createFsBridge: ({ sandbox }) => createRemoteShellSandboxFsBridge({
|
|
1397
|
+
sandbox,
|
|
1398
|
+
runtime: this.asHandle()
|
|
1399
|
+
}),
|
|
1400
|
+
runRemoteShellScript: async (command) => await this.runRemoteShellScript(command)
|
|
1401
|
+
};
|
|
1402
|
+
}
|
|
1403
|
+
async createSession() {
|
|
1404
|
+
return await createSshSandboxSessionFromSettings({
|
|
1405
|
+
...this.params.createParams.cfg.ssh,
|
|
1406
|
+
target: this.params.target
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1409
|
+
async ensureRuntime() {
|
|
1410
|
+
if (this.ensurePromise) return await this.ensurePromise;
|
|
1411
|
+
this.ensurePromise = this.ensureRuntimeInner();
|
|
1412
|
+
try {
|
|
1413
|
+
await this.ensurePromise;
|
|
1414
|
+
} catch (error) {
|
|
1415
|
+
this.ensurePromise = null;
|
|
1416
|
+
throw error;
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
async ensureRuntimeInner() {
|
|
1420
|
+
const session = await this.createSession();
|
|
1421
|
+
try {
|
|
1422
|
+
if ((await runSshSandboxCommand({
|
|
1423
|
+
session,
|
|
1424
|
+
remoteCommand: buildRemoteCommand([
|
|
1425
|
+
"/bin/sh",
|
|
1426
|
+
"-c",
|
|
1427
|
+
"if [ -d \"$1\" ]; then printf \"1\\n\"; else printf \"0\\n\"; fi",
|
|
1428
|
+
"openclaw-sandbox-check",
|
|
1429
|
+
this.params.runtimePaths.runtimeRootDir
|
|
1430
|
+
])
|
|
1431
|
+
})).stdout.toString("utf8").trim() === "1") return;
|
|
1432
|
+
await this.replaceRemoteDirectoryFromLocal(session, this.params.createParams.workspaceDir, this.params.runtimePaths.remoteWorkspaceDir);
|
|
1433
|
+
if (this.params.createParams.cfg.workspaceAccess !== "none" && path.resolve(this.params.createParams.agentWorkspaceDir) !== path.resolve(this.params.createParams.workspaceDir)) await this.replaceRemoteDirectoryFromLocal(session, this.params.createParams.agentWorkspaceDir, this.params.runtimePaths.remoteAgentWorkspaceDir);
|
|
1434
|
+
} finally {
|
|
1435
|
+
await disposeSshSandboxSession(session);
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
async replaceRemoteDirectoryFromLocal(session, localDir, remoteDir) {
|
|
1439
|
+
await runSshSandboxCommand({
|
|
1440
|
+
session,
|
|
1441
|
+
remoteCommand: buildRemoteCommand([
|
|
1442
|
+
"/bin/sh",
|
|
1443
|
+
"-c",
|
|
1444
|
+
"mkdir -p -- \"$1\" && find \"$1\" -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +",
|
|
1445
|
+
"openclaw-sandbox-clear",
|
|
1446
|
+
remoteDir
|
|
1447
|
+
])
|
|
1448
|
+
});
|
|
1449
|
+
await uploadDirectoryToSshTarget({
|
|
1450
|
+
session,
|
|
1451
|
+
localDir,
|
|
1452
|
+
remoteDir
|
|
1453
|
+
});
|
|
1454
|
+
}
|
|
1455
|
+
async runRemoteShellScript(params) {
|
|
1456
|
+
await this.ensureRuntime();
|
|
1457
|
+
const session = await this.createSession();
|
|
1458
|
+
try {
|
|
1459
|
+
return await runSshSandboxCommand({
|
|
1460
|
+
session,
|
|
1461
|
+
remoteCommand: buildRemoteCommand([
|
|
1462
|
+
"/bin/sh",
|
|
1463
|
+
"-c",
|
|
1464
|
+
params.script,
|
|
1465
|
+
"openclaw-sandbox-fs",
|
|
1466
|
+
...params.args ?? []
|
|
1467
|
+
]),
|
|
1468
|
+
stdin: params.stdin,
|
|
1469
|
+
allowFailure: params.allowFailure,
|
|
1470
|
+
signal: params.signal
|
|
1471
|
+
});
|
|
1472
|
+
} finally {
|
|
1473
|
+
await disposeSshSandboxSession(session);
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
};
|
|
1477
|
+
function resolveSshRuntimePaths(workspaceRoot, scopeKey) {
|
|
1478
|
+
const runtimeId = buildSshSandboxRuntimeId(scopeKey);
|
|
1479
|
+
const runtimeRootDir = path.posix.join(workspaceRoot, runtimeId);
|
|
1480
|
+
return {
|
|
1481
|
+
runtimeId,
|
|
1482
|
+
runtimeRootDir,
|
|
1483
|
+
remoteWorkspaceDir: path.posix.join(runtimeRootDir, "workspace"),
|
|
1484
|
+
remoteAgentWorkspaceDir: path.posix.join(runtimeRootDir, "agent")
|
|
1485
|
+
};
|
|
1486
|
+
}
|
|
1487
|
+
function buildSshSandboxRuntimeId(scopeKey) {
|
|
1488
|
+
const trimmed = scopeKey.trim() || "session";
|
|
1489
|
+
const safe = trimmed.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 32);
|
|
1490
|
+
const hash = Array.from(trimmed).reduce((acc, char) => (acc * 33 ^ char.charCodeAt(0)) >>> 0, 5381);
|
|
1491
|
+
return `openclaw-ssh-${safe || "session"}-${hash.toString(16).slice(0, 8)}`;
|
|
1492
|
+
}
|
|
1493
|
+
//#endregion
|
|
1494
|
+
//#region src/agents/sandbox/backend.ts
|
|
1495
|
+
const SANDBOX_BACKEND_FACTORIES = /* @__PURE__ */ new Map();
|
|
1496
|
+
function normalizeSandboxBackendId(id) {
|
|
1497
|
+
const normalized = id.trim().toLowerCase();
|
|
1498
|
+
if (!normalized) throw new Error("Sandbox backend id must not be empty.");
|
|
1499
|
+
return normalized;
|
|
1500
|
+
}
|
|
1501
|
+
function registerSandboxBackend(id, registration) {
|
|
1502
|
+
const normalizedId = normalizeSandboxBackendId(id);
|
|
1503
|
+
const resolved = typeof registration === "function" ? { factory: registration } : registration;
|
|
1504
|
+
const previous = SANDBOX_BACKEND_FACTORIES.get(normalizedId);
|
|
1505
|
+
SANDBOX_BACKEND_FACTORIES.set(normalizedId, resolved);
|
|
1506
|
+
return () => {
|
|
1507
|
+
if (previous) {
|
|
1508
|
+
SANDBOX_BACKEND_FACTORIES.set(normalizedId, previous);
|
|
1509
|
+
return;
|
|
1510
|
+
}
|
|
1511
|
+
SANDBOX_BACKEND_FACTORIES.delete(normalizedId);
|
|
1512
|
+
};
|
|
1513
|
+
}
|
|
1514
|
+
function getSandboxBackendFactory(id) {
|
|
1515
|
+
return SANDBOX_BACKEND_FACTORIES.get(normalizeSandboxBackendId(id))?.factory ?? null;
|
|
1516
|
+
}
|
|
1517
|
+
function getSandboxBackendManager(id) {
|
|
1518
|
+
return SANDBOX_BACKEND_FACTORIES.get(normalizeSandboxBackendId(id))?.manager ?? null;
|
|
1519
|
+
}
|
|
1520
|
+
function requireSandboxBackendFactory(id) {
|
|
1521
|
+
const factory = getSandboxBackendFactory(id);
|
|
1522
|
+
if (factory) return factory;
|
|
1523
|
+
throw new Error([`Sandbox backend "${id}" is not registered.`, "Load the plugin that provides it, or set agents.defaults.sandbox.backend=docker."].join("\n"));
|
|
1524
|
+
}
|
|
1525
|
+
registerSandboxBackend("docker", {
|
|
1526
|
+
factory: createDockerSandboxBackend,
|
|
1527
|
+
manager: dockerSandboxBackendManager
|
|
1528
|
+
});
|
|
1529
|
+
registerSandboxBackend("ssh", {
|
|
1530
|
+
factory: createSshSandboxBackend,
|
|
1531
|
+
manager: sshSandboxBackendManager
|
|
1532
|
+
});
|
|
1533
|
+
//#endregion
|
|
1534
|
+
//#region src/browser/bridge-server.ts
|
|
1535
|
+
function buildNoVncBootstrapHtml(params) {
|
|
1536
|
+
const hash = new URLSearchParams({
|
|
1537
|
+
autoconnect: "1",
|
|
1538
|
+
resize: "remote"
|
|
1539
|
+
});
|
|
1540
|
+
if (params.password?.trim()) hash.set("password", params.password);
|
|
1541
|
+
const targetUrl = `http://127.0.0.1:${params.noVncPort}/vnc.html#${hash.toString()}`;
|
|
1542
|
+
return `<!doctype html>
|
|
1543
|
+
<html lang="en">
|
|
1544
|
+
<head>
|
|
1545
|
+
<meta charset="utf-8" />
|
|
1546
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
1547
|
+
<meta name="referrer" content="no-referrer" />
|
|
1548
|
+
<title>OpenClaw noVNC Observer</title>
|
|
1549
|
+
</head>
|
|
1550
|
+
<body>
|
|
1551
|
+
<p>Opening sandbox observer...</p>
|
|
1552
|
+
<script>
|
|
1553
|
+
const target = ${JSON.stringify(targetUrl)};
|
|
1554
|
+
window.location.replace(target);
|
|
1555
|
+
<\/script>
|
|
1556
|
+
</body>
|
|
1557
|
+
</html>`;
|
|
1558
|
+
}
|
|
1559
|
+
async function startBrowserBridgeServer(params) {
|
|
1560
|
+
const host = params.host ?? "127.0.0.1";
|
|
1561
|
+
if (!isLoopbackHost(host)) throw new Error(`bridge server must bind to loopback host (got ${host})`);
|
|
1562
|
+
const port = params.port ?? 0;
|
|
1563
|
+
const app = express();
|
|
1564
|
+
installBrowserCommonMiddleware(app);
|
|
1565
|
+
if (params.resolveSandboxNoVncToken) app.get("/sandbox/novnc", (req, res) => {
|
|
1566
|
+
res.setHeader("Cache-Control", "no-store, no-cache, must-revalidate, proxy-revalidate");
|
|
1567
|
+
res.setHeader("Pragma", "no-cache");
|
|
1568
|
+
res.setHeader("Expires", "0");
|
|
1569
|
+
res.setHeader("Referrer-Policy", "no-referrer");
|
|
1570
|
+
const rawToken = typeof req.query?.token === "string" ? req.query.token.trim() : "";
|
|
1571
|
+
if (!rawToken) {
|
|
1572
|
+
res.status(400).send("Missing token");
|
|
1573
|
+
return;
|
|
1574
|
+
}
|
|
1575
|
+
const resolved = params.resolveSandboxNoVncToken?.(rawToken);
|
|
1576
|
+
if (!resolved) {
|
|
1577
|
+
res.status(404).send("Invalid or expired token");
|
|
1578
|
+
return;
|
|
1579
|
+
}
|
|
1580
|
+
res.type("html").status(200).send(buildNoVncBootstrapHtml(resolved));
|
|
1581
|
+
});
|
|
1582
|
+
const authToken = params.authToken?.trim() || void 0;
|
|
1583
|
+
const authPassword = params.authPassword?.trim() || void 0;
|
|
1584
|
+
if (!authToken && !authPassword) throw new Error("bridge server requires auth (authToken/authPassword missing)");
|
|
1585
|
+
installBrowserAuthMiddleware(app, {
|
|
1586
|
+
token: authToken,
|
|
1587
|
+
password: authPassword
|
|
1588
|
+
});
|
|
1589
|
+
const state = {
|
|
1590
|
+
server: null,
|
|
1591
|
+
port,
|
|
1592
|
+
resolved: params.resolved,
|
|
1593
|
+
profiles: /* @__PURE__ */ new Map()
|
|
1594
|
+
};
|
|
1595
|
+
registerBrowserRoutes(app, createBrowserRouteContext({
|
|
1596
|
+
getState: () => state,
|
|
1597
|
+
onEnsureAttachTarget: params.onEnsureAttachTarget
|
|
1598
|
+
}));
|
|
1599
|
+
const server = await new Promise((resolve, reject) => {
|
|
1600
|
+
const s = app.listen(port, host, () => resolve(s));
|
|
1601
|
+
s.once("error", reject);
|
|
1602
|
+
});
|
|
1603
|
+
const resolvedPort = server.address()?.port ?? port;
|
|
1604
|
+
state.server = server;
|
|
1605
|
+
state.port = resolvedPort;
|
|
1606
|
+
state.resolved.controlPort = resolvedPort;
|
|
1607
|
+
setBridgeAuthForPort(resolvedPort, {
|
|
1608
|
+
token: authToken,
|
|
1609
|
+
password: authPassword
|
|
1610
|
+
});
|
|
1611
|
+
return {
|
|
1612
|
+
server,
|
|
1613
|
+
port: resolvedPort,
|
|
1614
|
+
baseUrl: `http://${host}:${resolvedPort}`,
|
|
1615
|
+
state
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1618
|
+
async function stopBrowserBridgeServer(server) {
|
|
1619
|
+
try {
|
|
1620
|
+
const address = server.address();
|
|
1621
|
+
if (address?.port) deleteBridgeAuthForPort(address.port);
|
|
1622
|
+
} catch {}
|
|
1623
|
+
await new Promise((resolve) => {
|
|
1624
|
+
server.close(() => resolve());
|
|
1625
|
+
});
|
|
1626
|
+
}
|
|
1627
|
+
//#endregion
|
|
1628
|
+
//#region src/agents/sandbox/browser-bridges.ts
|
|
1629
|
+
const BROWSER_BRIDGES = /* @__PURE__ */ new Map();
|
|
1630
|
+
//#endregion
|
|
1631
|
+
//#region src/agents/sandbox/novnc-auth.ts
|
|
1632
|
+
const NOVNC_PASSWORD_ENV_KEY = "OPENCLAW_BROWSER_NOVNC_PASSWORD";
|
|
1633
|
+
const NOVNC_TOKEN_TTL_MS = 60 * 1e3;
|
|
1634
|
+
const NOVNC_PASSWORD_LENGTH = 8;
|
|
1635
|
+
const NOVNC_PASSWORD_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
1636
|
+
const NO_VNC_OBSERVER_TOKENS = /* @__PURE__ */ new Map();
|
|
1637
|
+
function pruneExpiredNoVncObserverTokens(now) {
|
|
1638
|
+
for (const [token, entry] of NO_VNC_OBSERVER_TOKENS) if (entry.expiresAt <= now) NO_VNC_OBSERVER_TOKENS.delete(token);
|
|
1639
|
+
}
|
|
1640
|
+
function isNoVncEnabled(params) {
|
|
1641
|
+
return params.enableNoVnc && !params.headless;
|
|
1642
|
+
}
|
|
1643
|
+
function generateNoVncPassword() {
|
|
1644
|
+
let out = "";
|
|
1645
|
+
for (let i = 0; i < NOVNC_PASSWORD_LENGTH; i += 1) out += NOVNC_PASSWORD_ALPHABET[crypto.randomInt(0, 62)];
|
|
1646
|
+
return out;
|
|
1647
|
+
}
|
|
1648
|
+
function issueNoVncObserverToken(params) {
|
|
1649
|
+
const now = params.nowMs ?? Date.now();
|
|
1650
|
+
pruneExpiredNoVncObserverTokens(now);
|
|
1651
|
+
const token = crypto.randomBytes(24).toString("hex");
|
|
1652
|
+
NO_VNC_OBSERVER_TOKENS.set(token, {
|
|
1653
|
+
noVncPort: params.noVncPort,
|
|
1654
|
+
password: params.password?.trim() || void 0,
|
|
1655
|
+
expiresAt: now + Math.max(1, params.ttlMs ?? NOVNC_TOKEN_TTL_MS)
|
|
1656
|
+
});
|
|
1657
|
+
return token;
|
|
1658
|
+
}
|
|
1659
|
+
function consumeNoVncObserverToken(token, nowMs) {
|
|
1660
|
+
const now = nowMs ?? Date.now();
|
|
1661
|
+
pruneExpiredNoVncObserverTokens(now);
|
|
1662
|
+
const normalized = token.trim();
|
|
1663
|
+
if (!normalized) return null;
|
|
1664
|
+
const entry = NO_VNC_OBSERVER_TOKENS.get(normalized);
|
|
1665
|
+
if (!entry) return null;
|
|
1666
|
+
NO_VNC_OBSERVER_TOKENS.delete(normalized);
|
|
1667
|
+
if (entry.expiresAt <= now) return null;
|
|
1668
|
+
return {
|
|
1669
|
+
noVncPort: entry.noVncPort,
|
|
1670
|
+
password: entry.password
|
|
1671
|
+
};
|
|
1672
|
+
}
|
|
1673
|
+
function buildNoVncObserverTokenUrl(baseUrl, token) {
|
|
1674
|
+
return `${baseUrl}/sandbox/novnc?${new URLSearchParams({ token }).toString()}`;
|
|
1675
|
+
}
|
|
1676
|
+
//#endregion
|
|
1677
|
+
//#region src/agents/sandbox/browser.ts
|
|
1678
|
+
const HOT_BROWSER_WINDOW_MS = 300 * 1e3;
|
|
1679
|
+
const CDP_SOURCE_RANGE_ENV_KEY = "OPENCLAW_BROWSER_CDP_SOURCE_RANGE";
|
|
1680
|
+
async function waitForSandboxCdp(params) {
|
|
1681
|
+
const deadline = Date.now() + Math.max(0, params.timeoutMs);
|
|
1682
|
+
const url = `http://127.0.0.1:${params.cdpPort}/json/version`;
|
|
1683
|
+
while (Date.now() < deadline) {
|
|
1684
|
+
try {
|
|
1685
|
+
const ctrl = new AbortController();
|
|
1686
|
+
const t = setTimeout(ctrl.abort.bind(ctrl), 1e3);
|
|
1687
|
+
try {
|
|
1688
|
+
if ((await fetch(url, { signal: ctrl.signal })).ok) return true;
|
|
1689
|
+
} finally {
|
|
1690
|
+
clearTimeout(t);
|
|
1691
|
+
}
|
|
1692
|
+
} catch {}
|
|
1693
|
+
await new Promise((r) => setTimeout(r, 150));
|
|
1694
|
+
}
|
|
1695
|
+
return false;
|
|
1696
|
+
}
|
|
1697
|
+
function buildSandboxBrowserResolvedConfig(params) {
|
|
1698
|
+
const cdpHost = "127.0.0.1";
|
|
1699
|
+
const cdpPortRange = deriveDefaultBrowserCdpPortRange(params.controlPort);
|
|
1700
|
+
return {
|
|
1701
|
+
enabled: true,
|
|
1702
|
+
evaluateEnabled: params.evaluateEnabled,
|
|
1703
|
+
controlPort: params.controlPort,
|
|
1704
|
+
cdpProtocol: "http",
|
|
1705
|
+
cdpHost,
|
|
1706
|
+
cdpIsLoopback: true,
|
|
1707
|
+
cdpPortRangeStart: cdpPortRange.start,
|
|
1708
|
+
cdpPortRangeEnd: cdpPortRange.end,
|
|
1709
|
+
remoteCdpTimeoutMs: 1500,
|
|
1710
|
+
remoteCdpHandshakeTimeoutMs: 3e3,
|
|
1711
|
+
color: DEFAULT_OPENCLAW_BROWSER_COLOR,
|
|
1712
|
+
executablePath: void 0,
|
|
1713
|
+
headless: params.headless,
|
|
1714
|
+
noSandbox: false,
|
|
1715
|
+
attachOnly: true,
|
|
1716
|
+
defaultProfile: DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME,
|
|
1717
|
+
extraArgs: [],
|
|
1718
|
+
profiles: { [DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME]: {
|
|
1719
|
+
cdpPort: params.cdpPort,
|
|
1720
|
+
color: DEFAULT_OPENCLAW_BROWSER_COLOR
|
|
1721
|
+
} }
|
|
1722
|
+
};
|
|
1723
|
+
}
|
|
1724
|
+
async function ensureSandboxBrowserImage(image) {
|
|
1725
|
+
if ((await execDocker([
|
|
1726
|
+
"image",
|
|
1727
|
+
"inspect",
|
|
1728
|
+
image
|
|
1729
|
+
], { allowFailure: true })).code === 0) return;
|
|
1730
|
+
throw new Error(`Sandbox browser image not found: ${image}. Build it with scripts/sandbox-browser-setup.sh.`);
|
|
1731
|
+
}
|
|
1732
|
+
async function ensureDockerNetwork(network, opts) {
|
|
1733
|
+
validateNetworkMode(network, { allowContainerNamespaceJoin: opts?.allowContainerNamespaceJoin === true });
|
|
1734
|
+
const normalized = network.trim().toLowerCase();
|
|
1735
|
+
if (!normalized || normalized === "bridge" || normalized === "none") return;
|
|
1736
|
+
if ((await execDocker([
|
|
1737
|
+
"network",
|
|
1738
|
+
"inspect",
|
|
1739
|
+
network
|
|
1740
|
+
], { allowFailure: true })).code === 0) return;
|
|
1741
|
+
await execDocker([
|
|
1742
|
+
"network",
|
|
1743
|
+
"create",
|
|
1744
|
+
"--driver",
|
|
1745
|
+
"bridge",
|
|
1746
|
+
network
|
|
1747
|
+
]);
|
|
1748
|
+
}
|
|
1749
|
+
async function ensureSandboxBrowser(params) {
|
|
1750
|
+
if (!params.cfg.browser.enabled) return null;
|
|
1751
|
+
if (!isToolAllowed(params.cfg.tools, "browser")) return null;
|
|
1752
|
+
const slug = params.cfg.scope === "shared" ? "shared" : slugifySessionKey(params.scopeKey);
|
|
1753
|
+
const containerName = `${params.cfg.browser.containerPrefix}${slug}`.slice(0, 63);
|
|
1754
|
+
const state = await dockerContainerState(containerName);
|
|
1755
|
+
const browserImage = params.cfg.browser.image ?? "openclaw-sandbox-browser:bookworm-slim";
|
|
1756
|
+
const cdpSourceRange = params.cfg.browser.cdpSourceRange?.trim() || void 0;
|
|
1757
|
+
const browserDockerCfg = resolveSandboxBrowserDockerCreateConfig({
|
|
1758
|
+
docker: params.cfg.docker,
|
|
1759
|
+
browser: {
|
|
1760
|
+
...params.cfg.browser,
|
|
1761
|
+
image: browserImage
|
|
1762
|
+
}
|
|
1763
|
+
});
|
|
1764
|
+
const expectedHash = computeSandboxBrowserConfigHash({
|
|
1765
|
+
docker: browserDockerCfg,
|
|
1766
|
+
browser: {
|
|
1767
|
+
cdpPort: params.cfg.browser.cdpPort,
|
|
1768
|
+
vncPort: params.cfg.browser.vncPort,
|
|
1769
|
+
noVncPort: params.cfg.browser.noVncPort,
|
|
1770
|
+
headless: params.cfg.browser.headless,
|
|
1771
|
+
enableNoVnc: params.cfg.browser.enableNoVnc,
|
|
1772
|
+
cdpSourceRange
|
|
1773
|
+
},
|
|
1774
|
+
securityEpoch: SANDBOX_BROWSER_SECURITY_HASH_EPOCH,
|
|
1775
|
+
workspaceAccess: params.cfg.workspaceAccess,
|
|
1776
|
+
workspaceDir: params.workspaceDir,
|
|
1777
|
+
agentWorkspaceDir: params.agentWorkspaceDir
|
|
1778
|
+
});
|
|
1779
|
+
const now = Date.now();
|
|
1780
|
+
let hasContainer = state.exists;
|
|
1781
|
+
let running = state.running;
|
|
1782
|
+
let currentHash = null;
|
|
1783
|
+
let hashMismatch = false;
|
|
1784
|
+
const noVncEnabled = isNoVncEnabled(params.cfg.browser);
|
|
1785
|
+
let noVncPassword;
|
|
1786
|
+
if (hasContainer) {
|
|
1787
|
+
if (noVncEnabled) noVncPassword = await readDockerContainerEnvVar(containerName, "OPENCLAW_BROWSER_NOVNC_PASSWORD") ?? void 0;
|
|
1788
|
+
const registryEntry = (await readBrowserRegistry()).entries.find((entry) => entry.containerName === containerName);
|
|
1789
|
+
currentHash = await readDockerContainerLabel(containerName, "openclaw.configHash");
|
|
1790
|
+
hashMismatch = !currentHash || currentHash !== expectedHash;
|
|
1791
|
+
if (!currentHash) {
|
|
1792
|
+
currentHash = registryEntry?.configHash ?? null;
|
|
1793
|
+
hashMismatch = !currentHash || currentHash !== expectedHash;
|
|
1794
|
+
}
|
|
1795
|
+
if (hashMismatch) {
|
|
1796
|
+
const lastUsedAtMs = registryEntry?.lastUsedAtMs;
|
|
1797
|
+
if (running && (typeof lastUsedAtMs !== "number" || now - lastUsedAtMs < HOT_BROWSER_WINDOW_MS)) {
|
|
1798
|
+
const hint = (() => {
|
|
1799
|
+
if (params.cfg.scope === "session") return `openclaw sandbox recreate --browser --session ${params.scopeKey}`;
|
|
1800
|
+
if (params.cfg.scope === "agent") return `openclaw sandbox recreate --browser --agent ${resolveSandboxAgentId(params.scopeKey) ?? "main"}`;
|
|
1801
|
+
return "openclaw sandbox recreate --browser --all";
|
|
1802
|
+
})();
|
|
1803
|
+
defaultRuntime.log(`Sandbox browser config changed for ${containerName} (recently used). Recreate to apply: ${hint}`);
|
|
1804
|
+
} else {
|
|
1805
|
+
await execDocker([
|
|
1806
|
+
"rm",
|
|
1807
|
+
"-f",
|
|
1808
|
+
containerName
|
|
1809
|
+
], { allowFailure: true });
|
|
1810
|
+
hasContainer = false;
|
|
1811
|
+
running = false;
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
if (!hasContainer) {
|
|
1816
|
+
if (noVncEnabled) noVncPassword = generateNoVncPassword();
|
|
1817
|
+
await ensureDockerNetwork(browserDockerCfg.network, { allowContainerNamespaceJoin: browserDockerCfg.dangerouslyAllowContainerNamespaceJoin === true });
|
|
1818
|
+
await ensureSandboxBrowserImage(browserImage);
|
|
1819
|
+
const args = buildSandboxCreateArgs({
|
|
1820
|
+
name: containerName,
|
|
1821
|
+
cfg: browserDockerCfg,
|
|
1822
|
+
scopeKey: params.scopeKey,
|
|
1823
|
+
labels: {
|
|
1824
|
+
"openclaw.sandboxBrowser": "1",
|
|
1825
|
+
"openclaw.browserConfigEpoch": SANDBOX_BROWSER_SECURITY_HASH_EPOCH
|
|
1826
|
+
},
|
|
1827
|
+
configHash: expectedHash,
|
|
1828
|
+
includeBinds: false,
|
|
1829
|
+
bindSourceRoots: [params.workspaceDir, params.agentWorkspaceDir]
|
|
1830
|
+
});
|
|
1831
|
+
appendWorkspaceMountArgs({
|
|
1832
|
+
args,
|
|
1833
|
+
workspaceDir: params.workspaceDir,
|
|
1834
|
+
agentWorkspaceDir: params.agentWorkspaceDir,
|
|
1835
|
+
workdir: params.cfg.docker.workdir,
|
|
1836
|
+
workspaceAccess: params.cfg.workspaceAccess
|
|
1837
|
+
});
|
|
1838
|
+
if (browserDockerCfg.binds?.length) for (const bind of browserDockerCfg.binds) args.push("-v", bind);
|
|
1839
|
+
args.push("-p", `127.0.0.1::${params.cfg.browser.cdpPort}`);
|
|
1840
|
+
if (noVncEnabled) args.push("-p", `127.0.0.1::${params.cfg.browser.noVncPort}`);
|
|
1841
|
+
args.push("-e", `OPENCLAW_BROWSER_HEADLESS=${params.cfg.browser.headless ? "1" : "0"}`);
|
|
1842
|
+
args.push("-e", `OPENCLAW_BROWSER_ENABLE_NOVNC=${params.cfg.browser.enableNoVnc ? "1" : "0"}`);
|
|
1843
|
+
args.push("-e", `OPENCLAW_BROWSER_CDP_PORT=${params.cfg.browser.cdpPort}`);
|
|
1844
|
+
if (cdpSourceRange) args.push("-e", `${CDP_SOURCE_RANGE_ENV_KEY}=${cdpSourceRange}`);
|
|
1845
|
+
args.push("-e", `OPENCLAW_BROWSER_VNC_PORT=${params.cfg.browser.vncPort}`);
|
|
1846
|
+
args.push("-e", `OPENCLAW_BROWSER_NOVNC_PORT=${params.cfg.browser.noVncPort}`);
|
|
1847
|
+
args.push("-e", "OPENCLAW_BROWSER_NO_SANDBOX=1");
|
|
1848
|
+
if (noVncEnabled && noVncPassword) args.push("-e", `${NOVNC_PASSWORD_ENV_KEY}=${noVncPassword}`);
|
|
1849
|
+
args.push(browserImage);
|
|
1850
|
+
await execDocker(args);
|
|
1851
|
+
await execDocker(["start", containerName]);
|
|
1852
|
+
} else if (!running) await execDocker(["start", containerName]);
|
|
1853
|
+
const mappedCdp = await readDockerPort(containerName, params.cfg.browser.cdpPort);
|
|
1854
|
+
if (!mappedCdp) throw new Error(`Failed to resolve CDP port mapping for ${containerName}.`);
|
|
1855
|
+
const mappedNoVnc = noVncEnabled ? await readDockerPort(containerName, params.cfg.browser.noVncPort) : null;
|
|
1856
|
+
if (noVncEnabled && !noVncPassword) noVncPassword = await readDockerContainerEnvVar(containerName, "OPENCLAW_BROWSER_NOVNC_PASSWORD") ?? void 0;
|
|
1857
|
+
const existing = BROWSER_BRIDGES.get(params.scopeKey);
|
|
1858
|
+
const existingProfile = existing ? resolveProfile(existing.bridge.state.resolved, DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME) : null;
|
|
1859
|
+
let desiredAuthToken = params.bridgeAuth?.token?.trim() || void 0;
|
|
1860
|
+
let desiredAuthPassword = params.bridgeAuth?.password?.trim() || void 0;
|
|
1861
|
+
if (!desiredAuthToken && !desiredAuthPassword) {
|
|
1862
|
+
desiredAuthToken = existing?.authToken;
|
|
1863
|
+
desiredAuthPassword = existing?.authPassword;
|
|
1864
|
+
if (!desiredAuthToken && !desiredAuthPassword) desiredAuthToken = crypto.randomBytes(24).toString("hex");
|
|
1865
|
+
}
|
|
1866
|
+
const shouldReuse = existing && existing.containerName === containerName && existingProfile?.cdpPort === mappedCdp;
|
|
1867
|
+
const authMatches = !existing || existing.authToken === desiredAuthToken && existing.authPassword === desiredAuthPassword;
|
|
1868
|
+
if (existing && !shouldReuse) {
|
|
1869
|
+
await stopBrowserBridgeServer(existing.bridge.server).catch(() => void 0);
|
|
1870
|
+
BROWSER_BRIDGES.delete(params.scopeKey);
|
|
1871
|
+
}
|
|
1872
|
+
if (existing && shouldReuse && !authMatches) {
|
|
1873
|
+
await stopBrowserBridgeServer(existing.bridge.server).catch(() => void 0);
|
|
1874
|
+
BROWSER_BRIDGES.delete(params.scopeKey);
|
|
1875
|
+
}
|
|
1876
|
+
const bridge = (() => {
|
|
1877
|
+
if (shouldReuse && authMatches && existing) return existing.bridge;
|
|
1878
|
+
return null;
|
|
1879
|
+
})();
|
|
1880
|
+
const ensureBridge = async () => {
|
|
1881
|
+
if (bridge) return bridge;
|
|
1882
|
+
const onEnsureAttachTarget = params.cfg.browser.autoStart ? async () => {
|
|
1883
|
+
const state = await dockerContainerState(containerName);
|
|
1884
|
+
if (state.exists && !state.running) await execDocker(["start", containerName]);
|
|
1885
|
+
if (!await waitForSandboxCdp({
|
|
1886
|
+
cdpPort: mappedCdp,
|
|
1887
|
+
timeoutMs: params.cfg.browser.autoStartTimeoutMs
|
|
1888
|
+
})) throw new Error(`Sandbox browser CDP did not become reachable on 127.0.0.1:${mappedCdp} within ${params.cfg.browser.autoStartTimeoutMs}ms.`);
|
|
1889
|
+
} : void 0;
|
|
1890
|
+
return await startBrowserBridgeServer({
|
|
1891
|
+
resolved: buildSandboxBrowserResolvedConfig({
|
|
1892
|
+
controlPort: 0,
|
|
1893
|
+
cdpPort: mappedCdp,
|
|
1894
|
+
headless: params.cfg.browser.headless,
|
|
1895
|
+
evaluateEnabled: params.evaluateEnabled ?? true
|
|
1896
|
+
}),
|
|
1897
|
+
authToken: desiredAuthToken,
|
|
1898
|
+
authPassword: desiredAuthPassword,
|
|
1899
|
+
onEnsureAttachTarget,
|
|
1900
|
+
resolveSandboxNoVncToken: consumeNoVncObserverToken
|
|
1901
|
+
});
|
|
1902
|
+
};
|
|
1903
|
+
const resolvedBridge = await ensureBridge();
|
|
1904
|
+
if (!shouldReuse || !authMatches) BROWSER_BRIDGES.set(params.scopeKey, {
|
|
1905
|
+
bridge: resolvedBridge,
|
|
1906
|
+
containerName,
|
|
1907
|
+
authToken: desiredAuthToken,
|
|
1908
|
+
authPassword: desiredAuthPassword
|
|
1909
|
+
});
|
|
1910
|
+
await updateBrowserRegistry({
|
|
1911
|
+
containerName,
|
|
1912
|
+
sessionKey: params.scopeKey,
|
|
1913
|
+
createdAtMs: now,
|
|
1914
|
+
lastUsedAtMs: now,
|
|
1915
|
+
image: browserImage,
|
|
1916
|
+
configHash: hashMismatch && running ? currentHash ?? void 0 : expectedHash,
|
|
1917
|
+
cdpPort: mappedCdp,
|
|
1918
|
+
noVncPort: mappedNoVnc ?? void 0
|
|
1919
|
+
});
|
|
1920
|
+
const noVncUrl = mappedNoVnc && noVncEnabled ? (() => {
|
|
1921
|
+
const token = issueNoVncObserverToken({
|
|
1922
|
+
noVncPort: mappedNoVnc,
|
|
1923
|
+
password: noVncPassword
|
|
1924
|
+
});
|
|
1925
|
+
return buildNoVncObserverTokenUrl(resolvedBridge.baseUrl, token);
|
|
1926
|
+
})() : void 0;
|
|
1927
|
+
return {
|
|
1928
|
+
bridgeUrl: resolvedBridge.baseUrl,
|
|
1929
|
+
noVncUrl,
|
|
1930
|
+
containerName
|
|
1931
|
+
};
|
|
1932
|
+
}
|
|
1933
|
+
//#endregion
|
|
1934
|
+
//#region src/agents/sandbox/fs-bridge-path-safety.ts
|
|
1935
|
+
var SandboxFsPathGuard = class {
|
|
1936
|
+
constructor(params) {
|
|
1937
|
+
this.mountsByContainer = params.mountsByContainer;
|
|
1938
|
+
this.runCommand = params.runCommand;
|
|
1939
|
+
}
|
|
1940
|
+
async assertPathChecks(checks) {
|
|
1941
|
+
for (const check of checks) await this.assertPathSafety(check.target, check.options);
|
|
1942
|
+
}
|
|
1943
|
+
async assertPathSafety(target, options) {
|
|
1944
|
+
const guarded = await this.openBoundaryWithinRequiredMount(target, options.action, {
|
|
1945
|
+
aliasPolicy: options.aliasPolicy,
|
|
1946
|
+
allowedType: options.allowedType
|
|
1947
|
+
});
|
|
1948
|
+
await this.assertGuardedPathSafety(target, options, guarded);
|
|
1949
|
+
}
|
|
1950
|
+
async openReadableFile(target) {
|
|
1951
|
+
const opened = await this.openBoundaryWithinRequiredMount(target, "read files");
|
|
1952
|
+
if (!opened.ok) throw opened.error instanceof Error ? opened.error : /* @__PURE__ */ new Error(`Sandbox boundary checks failed; cannot read files: ${target.containerPath}`);
|
|
1953
|
+
return opened;
|
|
1954
|
+
}
|
|
1955
|
+
resolveRequiredMount(containerPath, action) {
|
|
1956
|
+
const lexicalMount = this.resolveMountByContainerPath(containerPath);
|
|
1957
|
+
if (!lexicalMount) throw new Error(`Sandbox path escapes allowed mounts; cannot ${action}: ${containerPath}`);
|
|
1958
|
+
return lexicalMount;
|
|
1959
|
+
}
|
|
1960
|
+
finalizePinnedEntry(params) {
|
|
1961
|
+
const relativeParentPath = path.posix.relative(params.mount.containerRoot, params.parentPath);
|
|
1962
|
+
if (relativeParentPath.startsWith("..") || path.posix.isAbsolute(relativeParentPath)) throw new Error(`Sandbox path escapes allowed mounts; cannot ${params.action}: ${params.targetPath}`);
|
|
1963
|
+
return {
|
|
1964
|
+
mountRootPath: params.mount.containerRoot,
|
|
1965
|
+
relativeParentPath: relativeParentPath === "." ? "" : relativeParentPath,
|
|
1966
|
+
basename: params.basename
|
|
1967
|
+
};
|
|
1968
|
+
}
|
|
1969
|
+
async assertGuardedPathSafety(target, options, guarded) {
|
|
1970
|
+
if (!guarded.ok) {
|
|
1971
|
+
if (guarded.reason !== "path") {
|
|
1972
|
+
if (!(options.allowedType === "directory" && this.pathIsExistingDirectory(target.hostPath))) throw guarded.error instanceof Error ? guarded.error : /* @__PURE__ */ new Error(`Sandbox boundary checks failed; cannot ${options.action}: ${target.containerPath}`);
|
|
1973
|
+
}
|
|
1974
|
+
} else fs.closeSync(guarded.fd);
|
|
1975
|
+
const canonicalContainerPath = await this.resolveCanonicalContainerPath({
|
|
1976
|
+
containerPath: target.containerPath,
|
|
1977
|
+
allowFinalSymlinkForUnlink: options.aliasPolicy?.allowFinalSymlinkForUnlink === true
|
|
1978
|
+
});
|
|
1979
|
+
const canonicalMount = this.resolveRequiredMount(canonicalContainerPath, options.action);
|
|
1980
|
+
if (options.requireWritable && !canonicalMount.writable) throw new Error(`Sandbox path is read-only; cannot ${options.action}: ${target.containerPath}`);
|
|
1981
|
+
}
|
|
1982
|
+
async openBoundaryWithinRequiredMount(target, action, options) {
|
|
1983
|
+
const lexicalMount = this.resolveRequiredMount(target.containerPath, action);
|
|
1984
|
+
return await openBoundaryFile({
|
|
1985
|
+
absolutePath: target.hostPath,
|
|
1986
|
+
rootPath: lexicalMount.hostRoot,
|
|
1987
|
+
boundaryLabel: "sandbox mount root",
|
|
1988
|
+
aliasPolicy: options?.aliasPolicy,
|
|
1989
|
+
allowedType: options?.allowedType
|
|
1990
|
+
});
|
|
1991
|
+
}
|
|
1992
|
+
resolvePinnedEntry(target, action) {
|
|
1993
|
+
const basename = path.posix.basename(target.containerPath);
|
|
1994
|
+
if (!basename || basename === "." || basename === "/") throw new Error(`Invalid sandbox entry target: ${target.containerPath}`);
|
|
1995
|
+
const parentPath = normalizeContainerPath$1(path.posix.dirname(target.containerPath));
|
|
1996
|
+
const mount = this.resolveRequiredMount(parentPath, action);
|
|
1997
|
+
return this.finalizePinnedEntry({
|
|
1998
|
+
mount,
|
|
1999
|
+
parentPath,
|
|
2000
|
+
basename,
|
|
2001
|
+
targetPath: target.containerPath,
|
|
2002
|
+
action
|
|
2003
|
+
});
|
|
2004
|
+
}
|
|
2005
|
+
async resolveAnchoredSandboxEntry(target, action) {
|
|
2006
|
+
const basename = path.posix.basename(target.containerPath);
|
|
2007
|
+
if (!basename || basename === "." || basename === "/") throw new Error(`Invalid sandbox entry target: ${target.containerPath}`);
|
|
2008
|
+
const parentPath = normalizeContainerPath$1(path.posix.dirname(target.containerPath));
|
|
2009
|
+
const canonicalParentPath = await this.resolveCanonicalContainerPath({
|
|
2010
|
+
containerPath: parentPath,
|
|
2011
|
+
allowFinalSymlinkForUnlink: false
|
|
2012
|
+
});
|
|
2013
|
+
this.resolveRequiredMount(canonicalParentPath, action);
|
|
2014
|
+
return {
|
|
2015
|
+
canonicalParentPath,
|
|
2016
|
+
basename
|
|
2017
|
+
};
|
|
2018
|
+
}
|
|
2019
|
+
async resolveAnchoredPinnedEntry(target, action) {
|
|
2020
|
+
const anchoredTarget = await this.resolveAnchoredSandboxEntry(target, action);
|
|
2021
|
+
const mount = this.resolveRequiredMount(anchoredTarget.canonicalParentPath, action);
|
|
2022
|
+
return this.finalizePinnedEntry({
|
|
2023
|
+
mount,
|
|
2024
|
+
parentPath: anchoredTarget.canonicalParentPath,
|
|
2025
|
+
basename: anchoredTarget.basename,
|
|
2026
|
+
targetPath: target.containerPath,
|
|
2027
|
+
action
|
|
2028
|
+
});
|
|
2029
|
+
}
|
|
2030
|
+
resolvePinnedDirectoryEntry(target, action) {
|
|
2031
|
+
const mount = this.resolveRequiredMount(target.containerPath, action);
|
|
2032
|
+
const relativePath = path.posix.relative(mount.containerRoot, target.containerPath);
|
|
2033
|
+
if (relativePath.startsWith("..") || path.posix.isAbsolute(relativePath)) throw new Error(`Sandbox path escapes allowed mounts; cannot ${action}: ${target.containerPath}`);
|
|
2034
|
+
return {
|
|
2035
|
+
mountRootPath: mount.containerRoot,
|
|
2036
|
+
relativePath: relativePath === "." ? "" : relativePath
|
|
2037
|
+
};
|
|
2038
|
+
}
|
|
2039
|
+
pathIsExistingDirectory(hostPath) {
|
|
2040
|
+
try {
|
|
2041
|
+
return fs.statSync(hostPath).isDirectory();
|
|
2042
|
+
} catch {
|
|
2043
|
+
return false;
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
resolveMountByContainerPath(containerPath) {
|
|
2047
|
+
const normalized = normalizeContainerPath$1(containerPath);
|
|
2048
|
+
for (const mount of this.mountsByContainer) if (isPathInsideContainerRoot(normalizeContainerPath$1(mount.containerRoot), normalized)) return mount;
|
|
2049
|
+
return null;
|
|
2050
|
+
}
|
|
2051
|
+
async resolveCanonicalContainerPath(params) {
|
|
2052
|
+
const script = [
|
|
2053
|
+
"set -eu",
|
|
2054
|
+
"target=\"$1\"",
|
|
2055
|
+
"allow_final=\"$2\"",
|
|
2056
|
+
"suffix=\"\"",
|
|
2057
|
+
"probe=\"$target\"",
|
|
2058
|
+
"if [ \"$allow_final\" = \"1\" ] && [ -L \"$target\" ]; then probe=$(dirname -- \"$target\"); fi",
|
|
2059
|
+
"cursor=\"$probe\"",
|
|
2060
|
+
"while [ ! -e \"$cursor\" ] && [ ! -L \"$cursor\" ]; do",
|
|
2061
|
+
" parent=$(dirname -- \"$cursor\")",
|
|
2062
|
+
" if [ \"$parent\" = \"$cursor\" ]; then break; fi",
|
|
2063
|
+
" base=$(basename -- \"$cursor\")",
|
|
2064
|
+
" suffix=\"/$base$suffix\"",
|
|
2065
|
+
" cursor=\"$parent\"",
|
|
2066
|
+
"done",
|
|
2067
|
+
"canonical=$(readlink -f -- \"$cursor\")",
|
|
2068
|
+
"printf \"%s%s\\n\" \"$canonical\" \"$suffix\""
|
|
2069
|
+
].join("\n");
|
|
2070
|
+
const canonical = (await this.runCommand(script, { args: [params.containerPath, params.allowFinalSymlinkForUnlink ? "1" : "0"] })).stdout.toString("utf8").trim();
|
|
2071
|
+
if (!canonical.startsWith("/")) throw new Error(`Failed to resolve canonical sandbox path: ${params.containerPath}`);
|
|
2072
|
+
return normalizeContainerPath$1(canonical);
|
|
2073
|
+
}
|
|
2074
|
+
};
|
|
2075
|
+
//#endregion
|
|
2076
|
+
//#region src/agents/sandbox/fs-bridge-shell-command-plans.ts
|
|
2077
|
+
function buildStatPlan(target, anchoredTarget) {
|
|
2078
|
+
return {
|
|
2079
|
+
checks: [{
|
|
2080
|
+
target,
|
|
2081
|
+
options: { action: "stat files" }
|
|
2082
|
+
}],
|
|
2083
|
+
script: "set -eu\ncd -- \"$1\"\nstat -c \"%F|%s|%Y\" -- \"$2\"",
|
|
2084
|
+
args: [anchoredTarget.canonicalParentPath, anchoredTarget.basename],
|
|
2085
|
+
allowFailure: true
|
|
2086
|
+
};
|
|
2087
|
+
}
|
|
2088
|
+
//#endregion
|
|
2089
|
+
//#region src/agents/sandbox/fs-paths.ts
|
|
2090
|
+
function parseSandboxBindMount(spec) {
|
|
2091
|
+
const trimmed = spec.trim();
|
|
2092
|
+
if (!trimmed) return null;
|
|
2093
|
+
const parsed = splitSandboxBindSpec(trimmed);
|
|
2094
|
+
if (!parsed) return null;
|
|
2095
|
+
const hostToken = parsed.host.trim();
|
|
2096
|
+
const containerToken = parsed.container.trim();
|
|
2097
|
+
if (!hostToken || !containerToken || !path.posix.isAbsolute(containerToken)) return null;
|
|
2098
|
+
const optionsToken = parsed.options.trim().toLowerCase();
|
|
2099
|
+
const writable = !(optionsToken ? optionsToken.split(",").map((entry) => entry.trim()).filter(Boolean) : []).includes("ro");
|
|
2100
|
+
return {
|
|
2101
|
+
hostRoot: path.resolve(hostToken),
|
|
2102
|
+
containerRoot: normalizeContainerPath$1(containerToken),
|
|
2103
|
+
writable
|
|
2104
|
+
};
|
|
2105
|
+
}
|
|
2106
|
+
function buildSandboxFsMounts(sandbox) {
|
|
2107
|
+
const mounts = [{
|
|
2108
|
+
hostRoot: path.resolve(sandbox.workspaceDir),
|
|
2109
|
+
containerRoot: normalizeContainerPath$1(sandbox.containerWorkdir),
|
|
2110
|
+
writable: sandbox.workspaceAccess === "rw",
|
|
2111
|
+
source: "workspace"
|
|
2112
|
+
}];
|
|
2113
|
+
if (sandbox.workspaceAccess !== "none" && path.resolve(sandbox.agentWorkspaceDir) !== path.resolve(sandbox.workspaceDir)) mounts.push({
|
|
2114
|
+
hostRoot: path.resolve(sandbox.agentWorkspaceDir),
|
|
2115
|
+
containerRoot: SANDBOX_AGENT_WORKSPACE_MOUNT,
|
|
2116
|
+
writable: sandbox.workspaceAccess === "rw",
|
|
2117
|
+
source: "agent"
|
|
2118
|
+
});
|
|
2119
|
+
for (const bind of sandbox.docker.binds ?? []) {
|
|
2120
|
+
const parsed = parseSandboxBindMount(bind);
|
|
2121
|
+
if (!parsed) continue;
|
|
2122
|
+
mounts.push({
|
|
2123
|
+
hostRoot: parsed.hostRoot,
|
|
2124
|
+
containerRoot: parsed.containerRoot,
|
|
2125
|
+
writable: parsed.writable,
|
|
2126
|
+
source: "bind"
|
|
2127
|
+
});
|
|
2128
|
+
}
|
|
2129
|
+
return dedupeMounts(mounts);
|
|
2130
|
+
}
|
|
2131
|
+
function resolveSandboxFsPathWithMounts(params) {
|
|
2132
|
+
const mountsByContainer = [...params.mounts].toSorted(compareMountsByContainerPath);
|
|
2133
|
+
const mountsByHost = [...params.mounts].toSorted(compareMountsByHostPath);
|
|
2134
|
+
const input = params.filePath;
|
|
2135
|
+
const inputPosix = normalizePosixInput(input);
|
|
2136
|
+
if (path.posix.isAbsolute(inputPosix)) {
|
|
2137
|
+
const containerMount = findMountByContainerPath(mountsByContainer, inputPosix);
|
|
2138
|
+
if (containerMount) {
|
|
2139
|
+
const rel = path.posix.relative(containerMount.containerRoot, inputPosix);
|
|
2140
|
+
return {
|
|
2141
|
+
hostPath: rel ? path.resolve(containerMount.hostRoot, ...toHostSegments(rel)) : containerMount.hostRoot,
|
|
2142
|
+
containerPath: rel ? path.posix.join(containerMount.containerRoot, rel) : containerMount.containerRoot,
|
|
2143
|
+
relativePath: toDisplayRelative({
|
|
2144
|
+
containerPath: rel ? path.posix.join(containerMount.containerRoot, rel) : containerMount.containerRoot,
|
|
2145
|
+
defaultContainerRoot: params.defaultContainerRoot
|
|
2146
|
+
}),
|
|
2147
|
+
writable: containerMount.writable
|
|
2148
|
+
};
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
const hostResolved = resolveSandboxInputPath(input, params.cwd);
|
|
2152
|
+
const hostMount = findMountByHostPath(mountsByHost, hostResolved);
|
|
2153
|
+
if (hostMount) {
|
|
2154
|
+
const relHost = path.relative(hostMount.hostRoot, hostResolved);
|
|
2155
|
+
const relPosix = relHost ? relHost.split(path.sep).join(path.posix.sep) : "";
|
|
2156
|
+
const containerPath = relPosix ? path.posix.join(hostMount.containerRoot, relPosix) : hostMount.containerRoot;
|
|
2157
|
+
return {
|
|
2158
|
+
hostPath: hostResolved,
|
|
2159
|
+
containerPath,
|
|
2160
|
+
relativePath: toDisplayRelative({
|
|
2161
|
+
containerPath,
|
|
2162
|
+
defaultContainerRoot: params.defaultContainerRoot
|
|
2163
|
+
}),
|
|
2164
|
+
writable: hostMount.writable
|
|
2165
|
+
};
|
|
2166
|
+
}
|
|
2167
|
+
resolveSandboxPath({
|
|
2168
|
+
filePath: input,
|
|
2169
|
+
cwd: params.cwd,
|
|
2170
|
+
root: params.defaultWorkspaceRoot
|
|
2171
|
+
});
|
|
2172
|
+
throw new Error(`Path escapes sandbox root (${params.defaultWorkspaceRoot}): ${input}`);
|
|
2173
|
+
}
|
|
2174
|
+
function compareMountsByContainerPath(a, b) {
|
|
2175
|
+
const byLength = b.containerRoot.length - a.containerRoot.length;
|
|
2176
|
+
if (byLength !== 0) return byLength;
|
|
2177
|
+
return mountSourcePriority(b.source) - mountSourcePriority(a.source);
|
|
2178
|
+
}
|
|
2179
|
+
function compareMountsByHostPath(a, b) {
|
|
2180
|
+
const byLength = b.hostRoot.length - a.hostRoot.length;
|
|
2181
|
+
if (byLength !== 0) return byLength;
|
|
2182
|
+
return mountSourcePriority(b.source) - mountSourcePriority(a.source);
|
|
2183
|
+
}
|
|
2184
|
+
function mountSourcePriority(source) {
|
|
2185
|
+
if (source === "bind") return 2;
|
|
2186
|
+
if (source === "agent") return 1;
|
|
2187
|
+
return 0;
|
|
2188
|
+
}
|
|
2189
|
+
function dedupeMounts(mounts) {
|
|
2190
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2191
|
+
const deduped = [];
|
|
2192
|
+
for (const mount of mounts) {
|
|
2193
|
+
const key = `${mount.hostRoot}=>${mount.containerRoot}`;
|
|
2194
|
+
if (seen.has(key)) continue;
|
|
2195
|
+
seen.add(key);
|
|
2196
|
+
deduped.push(mount);
|
|
2197
|
+
}
|
|
2198
|
+
return deduped;
|
|
2199
|
+
}
|
|
2200
|
+
function findMountByContainerPath(mounts, target) {
|
|
2201
|
+
for (const mount of mounts) if (isPathInsideContainerRoot(mount.containerRoot, target)) return mount;
|
|
2202
|
+
return null;
|
|
2203
|
+
}
|
|
2204
|
+
function findMountByHostPath(mounts, target) {
|
|
2205
|
+
for (const mount of mounts) if (isPathInsideHost(mount.hostRoot, target)) return mount;
|
|
2206
|
+
return null;
|
|
2207
|
+
}
|
|
2208
|
+
function isPathInsideHost(root, target) {
|
|
2209
|
+
const canonicalRoot = resolveSandboxHostPathViaExistingAncestor(path.resolve(root));
|
|
2210
|
+
const resolvedTarget = path.resolve(target);
|
|
2211
|
+
const canonicalTargetParent = resolveSandboxHostPathViaExistingAncestor(path.dirname(resolvedTarget));
|
|
2212
|
+
const canonicalTarget = path.resolve(canonicalTargetParent, path.basename(resolvedTarget));
|
|
2213
|
+
const rel = path.relative(canonicalRoot, canonicalTarget);
|
|
2214
|
+
if (!rel) return true;
|
|
2215
|
+
return !(rel.startsWith("..") || path.isAbsolute(rel));
|
|
2216
|
+
}
|
|
2217
|
+
function toHostSegments(relativePosix) {
|
|
2218
|
+
return relativePosix.split("/").filter(Boolean);
|
|
2219
|
+
}
|
|
2220
|
+
function toDisplayRelative(params) {
|
|
2221
|
+
const rel = path.posix.relative(params.defaultContainerRoot, params.containerPath);
|
|
2222
|
+
if (!rel) return "";
|
|
2223
|
+
if (!rel.startsWith("..") && !path.posix.isAbsolute(rel)) return rel;
|
|
2224
|
+
return params.containerPath;
|
|
2225
|
+
}
|
|
2226
|
+
function normalizePosixInput(value) {
|
|
2227
|
+
return value.replace(/\\/g, "/").trim();
|
|
2228
|
+
}
|
|
2229
|
+
//#endregion
|
|
2230
|
+
//#region src/agents/sandbox/fs-bridge.ts
|
|
2231
|
+
function createSandboxFsBridge(params) {
|
|
2232
|
+
return new SandboxFsBridgeImpl(params.sandbox);
|
|
2233
|
+
}
|
|
2234
|
+
var SandboxFsBridgeImpl = class {
|
|
2235
|
+
constructor(sandbox) {
|
|
2236
|
+
this.sandbox = sandbox;
|
|
2237
|
+
this.mounts = buildSandboxFsMounts(sandbox);
|
|
2238
|
+
this.pathGuard = new SandboxFsPathGuard({
|
|
2239
|
+
mountsByContainer: [...this.mounts].toSorted((a, b) => b.containerRoot.length - a.containerRoot.length),
|
|
2240
|
+
runCommand: (script, options) => this.runCommand(script, options)
|
|
2241
|
+
});
|
|
2242
|
+
}
|
|
2243
|
+
resolvePath(params) {
|
|
2244
|
+
const target = this.resolveResolvedPath(params);
|
|
2245
|
+
return {
|
|
2246
|
+
hostPath: target.hostPath,
|
|
2247
|
+
relativePath: target.relativePath,
|
|
2248
|
+
containerPath: target.containerPath
|
|
2249
|
+
};
|
|
2250
|
+
}
|
|
2251
|
+
async readFile(params) {
|
|
2252
|
+
const target = this.resolveResolvedPath(params);
|
|
2253
|
+
return this.readPinnedFile(target);
|
|
2254
|
+
}
|
|
2255
|
+
async writeFile(params) {
|
|
2256
|
+
const target = this.resolveResolvedPath(params);
|
|
2257
|
+
this.ensureWriteAccess(target, "write files");
|
|
2258
|
+
const writeCheck = {
|
|
2259
|
+
target,
|
|
2260
|
+
options: {
|
|
2261
|
+
action: "write files",
|
|
2262
|
+
requireWritable: true
|
|
2263
|
+
}
|
|
2264
|
+
};
|
|
2265
|
+
await this.pathGuard.assertPathSafety(target, writeCheck.options);
|
|
2266
|
+
const buffer = Buffer.isBuffer(params.data) ? params.data : Buffer.from(params.data, params.encoding ?? "utf8");
|
|
2267
|
+
const pinnedWriteTarget = await this.pathGuard.resolveAnchoredPinnedEntry(target, "write files");
|
|
2268
|
+
await this.runCheckedCommand({
|
|
2269
|
+
...buildPinnedWritePlan({
|
|
2270
|
+
check: writeCheck,
|
|
2271
|
+
pinned: pinnedWriteTarget,
|
|
2272
|
+
mkdir: params.mkdir !== false
|
|
2273
|
+
}),
|
|
2274
|
+
stdin: buffer,
|
|
2275
|
+
signal: params.signal
|
|
2276
|
+
});
|
|
2277
|
+
}
|
|
2278
|
+
async mkdirp(params) {
|
|
2279
|
+
const target = this.resolveResolvedPath(params);
|
|
2280
|
+
this.ensureWriteAccess(target, "create directories");
|
|
2281
|
+
const mkdirCheck = {
|
|
2282
|
+
target,
|
|
2283
|
+
options: {
|
|
2284
|
+
action: "create directories",
|
|
2285
|
+
requireWritable: true,
|
|
2286
|
+
allowedType: "directory"
|
|
2287
|
+
}
|
|
2288
|
+
};
|
|
2289
|
+
await this.runCheckedCommand({
|
|
2290
|
+
...buildPinnedMkdirpPlan({
|
|
2291
|
+
check: mkdirCheck,
|
|
2292
|
+
pinned: this.pathGuard.resolvePinnedDirectoryEntry(target, "create directories")
|
|
2293
|
+
}),
|
|
2294
|
+
signal: params.signal
|
|
2295
|
+
});
|
|
2296
|
+
}
|
|
2297
|
+
async remove(params) {
|
|
2298
|
+
const target = this.resolveResolvedPath(params);
|
|
2299
|
+
this.ensureWriteAccess(target, "remove files");
|
|
2300
|
+
const removeCheck = {
|
|
2301
|
+
target,
|
|
2302
|
+
options: {
|
|
2303
|
+
action: "remove files",
|
|
2304
|
+
requireWritable: true
|
|
2305
|
+
}
|
|
2306
|
+
};
|
|
2307
|
+
await this.runCheckedCommand({
|
|
2308
|
+
...buildPinnedRemovePlan({
|
|
2309
|
+
check: removeCheck,
|
|
2310
|
+
pinned: this.pathGuard.resolvePinnedEntry(target, "remove files"),
|
|
2311
|
+
recursive: params.recursive,
|
|
2312
|
+
force: params.force
|
|
2313
|
+
}),
|
|
2314
|
+
signal: params.signal
|
|
2315
|
+
});
|
|
2316
|
+
}
|
|
2317
|
+
async rename(params) {
|
|
2318
|
+
const from = this.resolveResolvedPath({
|
|
2319
|
+
filePath: params.from,
|
|
2320
|
+
cwd: params.cwd
|
|
2321
|
+
});
|
|
2322
|
+
const to = this.resolveResolvedPath({
|
|
2323
|
+
filePath: params.to,
|
|
2324
|
+
cwd: params.cwd
|
|
2325
|
+
});
|
|
2326
|
+
this.ensureWriteAccess(from, "rename files");
|
|
2327
|
+
this.ensureWriteAccess(to, "rename files");
|
|
2328
|
+
const fromCheck = {
|
|
2329
|
+
target: from,
|
|
2330
|
+
options: {
|
|
2331
|
+
action: "rename files",
|
|
2332
|
+
requireWritable: true
|
|
2333
|
+
}
|
|
2334
|
+
};
|
|
2335
|
+
const toCheck = {
|
|
2336
|
+
target: to,
|
|
2337
|
+
options: {
|
|
2338
|
+
action: "rename files",
|
|
2339
|
+
requireWritable: true
|
|
2340
|
+
}
|
|
2341
|
+
};
|
|
2342
|
+
await this.runCheckedCommand({
|
|
2343
|
+
...buildPinnedRenamePlan({
|
|
2344
|
+
fromCheck,
|
|
2345
|
+
toCheck,
|
|
2346
|
+
from: this.pathGuard.resolvePinnedEntry(from, "rename files"),
|
|
2347
|
+
to: this.pathGuard.resolvePinnedEntry(to, "rename files")
|
|
2348
|
+
}),
|
|
2349
|
+
signal: params.signal
|
|
2350
|
+
});
|
|
2351
|
+
}
|
|
2352
|
+
async stat(params) {
|
|
2353
|
+
const target = this.resolveResolvedPath(params);
|
|
2354
|
+
const anchoredTarget = await this.pathGuard.resolveAnchoredSandboxEntry(target, "stat files");
|
|
2355
|
+
const result = await this.runPlannedCommand(buildStatPlan(target, anchoredTarget), params.signal);
|
|
2356
|
+
if (result.code !== 0) {
|
|
2357
|
+
const stderr = result.stderr.toString("utf8");
|
|
2358
|
+
if (stderr.includes("No such file or directory")) return null;
|
|
2359
|
+
const message = stderr.trim() || `stat failed with code ${result.code}`;
|
|
2360
|
+
throw new Error(`stat failed for ${target.containerPath}: ${message}`);
|
|
2361
|
+
}
|
|
2362
|
+
const [typeRaw, sizeRaw, mtimeRaw] = result.stdout.toString("utf8").trim().split("|");
|
|
2363
|
+
const size = Number.parseInt(sizeRaw ?? "0", 10);
|
|
2364
|
+
const mtime = Number.parseInt(mtimeRaw ?? "0", 10) * 1e3;
|
|
2365
|
+
return {
|
|
2366
|
+
type: coerceStatType(typeRaw),
|
|
2367
|
+
size: Number.isFinite(size) ? size : 0,
|
|
2368
|
+
mtimeMs: Number.isFinite(mtime) ? mtime : 0
|
|
2369
|
+
};
|
|
2370
|
+
}
|
|
2371
|
+
async runCommand(script, options = {}) {
|
|
2372
|
+
const backend = this.sandbox.backend;
|
|
2373
|
+
if (backend) return await backend.runShellCommand({
|
|
2374
|
+
script,
|
|
2375
|
+
args: options.args,
|
|
2376
|
+
stdin: options.stdin,
|
|
2377
|
+
allowFailure: options.allowFailure,
|
|
2378
|
+
signal: options.signal
|
|
2379
|
+
});
|
|
2380
|
+
return await runDockerSandboxShellCommand({
|
|
2381
|
+
containerName: this.sandbox.containerName,
|
|
2382
|
+
script,
|
|
2383
|
+
args: options.args,
|
|
2384
|
+
stdin: options.stdin,
|
|
2385
|
+
allowFailure: options.allowFailure,
|
|
2386
|
+
signal: options.signal
|
|
2387
|
+
});
|
|
2388
|
+
}
|
|
2389
|
+
async readPinnedFile(target) {
|
|
2390
|
+
const opened = await this.pathGuard.openReadableFile(target);
|
|
2391
|
+
try {
|
|
2392
|
+
return fs.readFileSync(opened.fd);
|
|
2393
|
+
} finally {
|
|
2394
|
+
fs.closeSync(opened.fd);
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
async runCheckedCommand(plan) {
|
|
2398
|
+
await this.pathGuard.assertPathChecks(plan.checks);
|
|
2399
|
+
if (plan.recheckBeforeCommand) await this.pathGuard.assertPathChecks(plan.checks);
|
|
2400
|
+
return await this.runCommand(plan.script, {
|
|
2401
|
+
args: plan.args,
|
|
2402
|
+
stdin: plan.stdin,
|
|
2403
|
+
allowFailure: plan.allowFailure,
|
|
2404
|
+
signal: plan.signal
|
|
2405
|
+
});
|
|
2406
|
+
}
|
|
2407
|
+
async runPlannedCommand(plan, signal) {
|
|
2408
|
+
return await this.runCheckedCommand({
|
|
2409
|
+
...plan,
|
|
2410
|
+
signal
|
|
2411
|
+
});
|
|
2412
|
+
}
|
|
2413
|
+
ensureWriteAccess(target, action) {
|
|
2414
|
+
if (!allowsWrites(this.sandbox.workspaceAccess) || !target.writable) throw new Error(`Sandbox path is read-only; cannot ${action}: ${target.containerPath}`);
|
|
2415
|
+
}
|
|
2416
|
+
resolveResolvedPath(params) {
|
|
2417
|
+
return resolveSandboxFsPathWithMounts({
|
|
2418
|
+
filePath: params.filePath,
|
|
2419
|
+
cwd: params.cwd ?? this.sandbox.workspaceDir,
|
|
2420
|
+
defaultWorkspaceRoot: this.sandbox.workspaceDir,
|
|
2421
|
+
defaultContainerRoot: this.sandbox.containerWorkdir,
|
|
2422
|
+
mounts: this.mounts
|
|
2423
|
+
});
|
|
2424
|
+
}
|
|
2425
|
+
};
|
|
2426
|
+
function allowsWrites(access) {
|
|
2427
|
+
return access === "rw";
|
|
2428
|
+
}
|
|
2429
|
+
function coerceStatType(typeRaw) {
|
|
2430
|
+
if (!typeRaw) return "other";
|
|
2431
|
+
const normalized = typeRaw.trim().toLowerCase();
|
|
2432
|
+
if (normalized.includes("directory")) return "directory";
|
|
2433
|
+
if (normalized.includes("file")) return "file";
|
|
2434
|
+
return "other";
|
|
2435
|
+
}
|
|
2436
|
+
//#endregion
|
|
2437
|
+
//#region src/agents/sandbox/prune.ts
|
|
2438
|
+
let lastPruneAtMs = 0;
|
|
2439
|
+
function shouldPruneSandboxEntry(cfg, now, entry) {
|
|
2440
|
+
const idleHours = cfg.prune.idleHours;
|
|
2441
|
+
const maxAgeDays = cfg.prune.maxAgeDays;
|
|
2442
|
+
if (idleHours === 0 && maxAgeDays === 0) return false;
|
|
2443
|
+
const idleMs = now - entry.lastUsedAtMs;
|
|
2444
|
+
const ageMs = now - entry.createdAtMs;
|
|
2445
|
+
return idleHours > 0 && idleMs > idleHours * 60 * 60 * 1e3 || maxAgeDays > 0 && ageMs > maxAgeDays * 24 * 60 * 60 * 1e3;
|
|
2446
|
+
}
|
|
2447
|
+
async function pruneSandboxRegistryEntries(params) {
|
|
2448
|
+
const now = Date.now();
|
|
2449
|
+
if (params.cfg.prune.idleHours === 0 && params.cfg.prune.maxAgeDays === 0) return;
|
|
2450
|
+
const registry = await params.read();
|
|
2451
|
+
for (const entry of registry.entries) {
|
|
2452
|
+
if (!shouldPruneSandboxEntry(params.cfg, now, entry)) continue;
|
|
2453
|
+
try {
|
|
2454
|
+
await params.removeRuntime(entry);
|
|
2455
|
+
} catch {} finally {
|
|
2456
|
+
await params.remove(entry.containerName);
|
|
2457
|
+
await params.onRemoved?.(entry);
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2461
|
+
async function pruneSandboxContainers(cfg) {
|
|
2462
|
+
const config = loadConfig();
|
|
2463
|
+
await pruneSandboxRegistryEntries({
|
|
2464
|
+
cfg,
|
|
2465
|
+
read: readRegistry,
|
|
2466
|
+
remove: removeRegistryEntry,
|
|
2467
|
+
removeRuntime: async (entry) => {
|
|
2468
|
+
await getSandboxBackendManager(entry.backendId ?? "docker")?.removeRuntime({
|
|
2469
|
+
entry,
|
|
2470
|
+
config
|
|
2471
|
+
});
|
|
2472
|
+
}
|
|
2473
|
+
});
|
|
2474
|
+
}
|
|
2475
|
+
async function pruneSandboxBrowsers(cfg) {
|
|
2476
|
+
const config = loadConfig();
|
|
2477
|
+
await pruneSandboxRegistryEntries({
|
|
2478
|
+
cfg,
|
|
2479
|
+
read: readBrowserRegistry,
|
|
2480
|
+
remove: removeBrowserRegistryEntry,
|
|
2481
|
+
removeRuntime: async (entry) => {
|
|
2482
|
+
await dockerSandboxBackendManager.removeRuntime({
|
|
2483
|
+
entry: {
|
|
2484
|
+
...entry,
|
|
2485
|
+
backendId: "docker",
|
|
2486
|
+
runtimeLabel: entry.containerName,
|
|
2487
|
+
configLabelKind: "Image"
|
|
2488
|
+
},
|
|
2489
|
+
config
|
|
2490
|
+
});
|
|
2491
|
+
},
|
|
2492
|
+
onRemoved: async (entry) => {
|
|
2493
|
+
const bridge = BROWSER_BRIDGES.get(entry.sessionKey);
|
|
2494
|
+
if (bridge?.containerName === entry.containerName) {
|
|
2495
|
+
await stopBrowserBridgeServer(bridge.bridge.server).catch(() => void 0);
|
|
2496
|
+
BROWSER_BRIDGES.delete(entry.sessionKey);
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
});
|
|
2500
|
+
}
|
|
2501
|
+
async function maybePruneSandboxes(cfg) {
|
|
2502
|
+
const now = Date.now();
|
|
2503
|
+
if (now - lastPruneAtMs < 300 * 1e3) return;
|
|
2504
|
+
lastPruneAtMs = now;
|
|
2505
|
+
try {
|
|
2506
|
+
await pruneSandboxContainers(cfg);
|
|
2507
|
+
await pruneSandboxBrowsers(cfg);
|
|
2508
|
+
} catch (error) {
|
|
2509
|
+
const message = error instanceof Error ? error.message : typeof error === "string" ? error : JSON.stringify(error);
|
|
2510
|
+
defaultRuntime.error?.(`Sandbox prune failed: ${message ?? "unknown error"}`);
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
//#endregion
|
|
2514
|
+
//#region src/agents/sandbox/workspace.ts
|
|
2515
|
+
async function ensureSandboxWorkspace(workspaceDir, seedFrom, skipBootstrap) {
|
|
2516
|
+
await fs$1.mkdir(workspaceDir, { recursive: true });
|
|
2517
|
+
if (seedFrom) {
|
|
2518
|
+
const seed = resolveUserPath(seedFrom);
|
|
2519
|
+
const files = [
|
|
2520
|
+
DEFAULT_AGENTS_FILENAME,
|
|
2521
|
+
DEFAULT_SOUL_FILENAME,
|
|
2522
|
+
DEFAULT_TOOLS_FILENAME,
|
|
2523
|
+
DEFAULT_IDENTITY_FILENAME,
|
|
2524
|
+
DEFAULT_USER_FILENAME,
|
|
2525
|
+
DEFAULT_BOOTSTRAP_FILENAME,
|
|
2526
|
+
DEFAULT_HEARTBEAT_FILENAME
|
|
2527
|
+
];
|
|
2528
|
+
for (const name of files) {
|
|
2529
|
+
const src = path.join(seed, name);
|
|
2530
|
+
const dest = path.join(workspaceDir, name);
|
|
2531
|
+
try {
|
|
2532
|
+
await fs$1.access(dest);
|
|
2533
|
+
} catch {
|
|
2534
|
+
try {
|
|
2535
|
+
const opened = await openBoundaryFile({
|
|
2536
|
+
absolutePath: src,
|
|
2537
|
+
rootPath: seed,
|
|
2538
|
+
boundaryLabel: "sandbox seed workspace"
|
|
2539
|
+
});
|
|
2540
|
+
if (!opened.ok) continue;
|
|
2541
|
+
try {
|
|
2542
|
+
const content = fs.readFileSync(opened.fd, "utf-8");
|
|
2543
|
+
await fs$1.writeFile(dest, content, {
|
|
2544
|
+
encoding: "utf-8",
|
|
2545
|
+
flag: "wx"
|
|
2546
|
+
});
|
|
2547
|
+
} finally {
|
|
2548
|
+
fs.closeSync(opened.fd);
|
|
2549
|
+
}
|
|
2550
|
+
} catch {}
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
await ensureAgentWorkspace({
|
|
2555
|
+
dir: workspaceDir,
|
|
2556
|
+
ensureBootstrapFiles: !skipBootstrap
|
|
2557
|
+
});
|
|
2558
|
+
}
|
|
2559
|
+
//#endregion
|
|
2560
|
+
//#region src/agents/sandbox/context.ts
|
|
2561
|
+
async function ensureSandboxWorkspaceLayout(params) {
|
|
2562
|
+
const { cfg, rawSessionKey } = params;
|
|
2563
|
+
const agentWorkspaceDir = resolveUserPath(params.workspaceDir?.trim() || DEFAULT_AGENT_WORKSPACE_DIR);
|
|
2564
|
+
const workspaceRoot = resolveUserPath(cfg.workspaceRoot);
|
|
2565
|
+
const scopeKey = resolveSandboxScopeKey(cfg.scope, rawSessionKey);
|
|
2566
|
+
const sandboxWorkspaceDir = cfg.scope === "shared" ? workspaceRoot : resolveSandboxWorkspaceDir(workspaceRoot, scopeKey);
|
|
2567
|
+
const workspaceDir = cfg.workspaceAccess === "rw" ? agentWorkspaceDir : sandboxWorkspaceDir;
|
|
2568
|
+
if (workspaceDir === sandboxWorkspaceDir) {
|
|
2569
|
+
await ensureSandboxWorkspace(sandboxWorkspaceDir, agentWorkspaceDir, params.config?.agents?.defaults?.skipBootstrap);
|
|
2570
|
+
if (cfg.workspaceAccess !== "rw") try {
|
|
2571
|
+
await syncSkillsToWorkspace({
|
|
2572
|
+
sourceWorkspaceDir: agentWorkspaceDir,
|
|
2573
|
+
targetWorkspaceDir: sandboxWorkspaceDir,
|
|
2574
|
+
config: params.config
|
|
2575
|
+
});
|
|
2576
|
+
} catch (error) {
|
|
2577
|
+
const message = error instanceof Error ? error.message : JSON.stringify(error);
|
|
2578
|
+
defaultRuntime.error?.(`Sandbox skill sync failed: ${message}`);
|
|
2579
|
+
}
|
|
2580
|
+
} else await fs$1.mkdir(workspaceDir, { recursive: true });
|
|
2581
|
+
return {
|
|
2582
|
+
agentWorkspaceDir,
|
|
2583
|
+
scopeKey,
|
|
2584
|
+
sandboxWorkspaceDir,
|
|
2585
|
+
workspaceDir
|
|
2586
|
+
};
|
|
2587
|
+
}
|
|
2588
|
+
async function resolveSandboxDockerUser(params) {
|
|
2589
|
+
if (params.docker.user?.trim()) return params.docker;
|
|
2590
|
+
const stat = params.stat ?? ((workspaceDir) => fs$1.stat(workspaceDir));
|
|
2591
|
+
try {
|
|
2592
|
+
const workspaceStat = await stat(params.workspaceDir);
|
|
2593
|
+
const uid = Number.isInteger(workspaceStat.uid) ? workspaceStat.uid : null;
|
|
2594
|
+
const gid = Number.isInteger(workspaceStat.gid) ? workspaceStat.gid : null;
|
|
2595
|
+
if (uid === null || gid === null || uid < 0 || gid < 0) return params.docker;
|
|
2596
|
+
return {
|
|
2597
|
+
...params.docker,
|
|
2598
|
+
user: `${uid}:${gid}`
|
|
2599
|
+
};
|
|
2600
|
+
} catch {
|
|
2601
|
+
return params.docker;
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
function resolveSandboxSession(params) {
|
|
2605
|
+
const rawSessionKey = params.sessionKey?.trim();
|
|
2606
|
+
if (!rawSessionKey) return null;
|
|
2607
|
+
const runtime = resolveSandboxRuntimeStatus({
|
|
2608
|
+
cfg: params.config,
|
|
2609
|
+
sessionKey: rawSessionKey
|
|
2610
|
+
});
|
|
2611
|
+
if (!runtime.sandboxed) return null;
|
|
2612
|
+
return {
|
|
2613
|
+
rawSessionKey,
|
|
2614
|
+
runtime,
|
|
2615
|
+
cfg: resolveSandboxConfigForAgent(params.config, runtime.agentId)
|
|
2616
|
+
};
|
|
2617
|
+
}
|
|
2618
|
+
async function resolveSandboxContext(params) {
|
|
2619
|
+
const resolved = resolveSandboxSession(params);
|
|
2620
|
+
if (!resolved) return null;
|
|
2621
|
+
const { rawSessionKey, cfg } = resolved;
|
|
2622
|
+
await maybePruneSandboxes(cfg);
|
|
2623
|
+
const { agentWorkspaceDir, scopeKey, workspaceDir } = await ensureSandboxWorkspaceLayout({
|
|
2624
|
+
cfg,
|
|
2625
|
+
rawSessionKey,
|
|
2626
|
+
config: params.config,
|
|
2627
|
+
workspaceDir: params.workspaceDir
|
|
2628
|
+
});
|
|
2629
|
+
const docker = await resolveSandboxDockerUser({
|
|
2630
|
+
docker: cfg.docker,
|
|
2631
|
+
workspaceDir
|
|
2632
|
+
});
|
|
2633
|
+
const resolvedCfg = docker === cfg.docker ? cfg : {
|
|
2634
|
+
...cfg,
|
|
2635
|
+
docker
|
|
2636
|
+
};
|
|
2637
|
+
const backend = await requireSandboxBackendFactory(resolvedCfg.backend)({
|
|
2638
|
+
sessionKey: rawSessionKey,
|
|
2639
|
+
scopeKey,
|
|
2640
|
+
workspaceDir,
|
|
2641
|
+
agentWorkspaceDir,
|
|
2642
|
+
cfg: resolvedCfg
|
|
2643
|
+
});
|
|
2644
|
+
await updateRegistry({
|
|
2645
|
+
containerName: backend.runtimeId,
|
|
2646
|
+
backendId: backend.id,
|
|
2647
|
+
runtimeLabel: backend.runtimeLabel,
|
|
2648
|
+
sessionKey: scopeKey,
|
|
2649
|
+
createdAtMs: Date.now(),
|
|
2650
|
+
lastUsedAtMs: Date.now(),
|
|
2651
|
+
image: backend.configLabel ?? resolvedCfg.docker.image,
|
|
2652
|
+
configLabelKind: backend.configLabelKind ?? "Image"
|
|
2653
|
+
});
|
|
2654
|
+
const evaluateEnabled = params.config?.browser?.evaluateEnabled ?? true;
|
|
2655
|
+
const bridgeAuth = cfg.browser.enabled ? await (async () => {
|
|
2656
|
+
const cfgForAuth = params.config ?? loadConfig();
|
|
2657
|
+
let browserAuth = resolveBrowserControlAuth(cfgForAuth);
|
|
2658
|
+
try {
|
|
2659
|
+
browserAuth = (await ensureBrowserControlAuth({ cfg: cfgForAuth })).auth;
|
|
2660
|
+
} catch (error) {
|
|
2661
|
+
const message = error instanceof Error ? error.message : JSON.stringify(error);
|
|
2662
|
+
defaultRuntime.error?.(`Sandbox browser auth ensure failed: ${message}`);
|
|
2663
|
+
}
|
|
2664
|
+
return browserAuth;
|
|
2665
|
+
})() : void 0;
|
|
2666
|
+
if (resolvedCfg.browser.enabled && backend.capabilities?.browser !== true) throw new Error(`Sandbox backend "${resolvedCfg.backend}" does not support browser sandboxes yet.`);
|
|
2667
|
+
const browser = resolvedCfg.browser.enabled && backend.capabilities?.browser === true ? await ensureSandboxBrowser({
|
|
2668
|
+
scopeKey,
|
|
2669
|
+
workspaceDir,
|
|
2670
|
+
agentWorkspaceDir,
|
|
2671
|
+
cfg: resolvedCfg,
|
|
2672
|
+
evaluateEnabled,
|
|
2673
|
+
bridgeAuth
|
|
2674
|
+
}) : null;
|
|
2675
|
+
const sandboxContext = {
|
|
2676
|
+
enabled: true,
|
|
2677
|
+
backendId: backend.id,
|
|
2678
|
+
sessionKey: rawSessionKey,
|
|
2679
|
+
workspaceDir,
|
|
2680
|
+
agentWorkspaceDir,
|
|
2681
|
+
workspaceAccess: resolvedCfg.workspaceAccess,
|
|
2682
|
+
runtimeId: backend.runtimeId,
|
|
2683
|
+
runtimeLabel: backend.runtimeLabel,
|
|
2684
|
+
containerName: backend.runtimeId,
|
|
2685
|
+
containerWorkdir: backend.workdir,
|
|
2686
|
+
docker: resolvedCfg.docker,
|
|
2687
|
+
tools: resolvedCfg.tools,
|
|
2688
|
+
browserAllowHostControl: resolvedCfg.browser.allowHostControl,
|
|
2689
|
+
browser: browser ?? void 0,
|
|
2690
|
+
backend
|
|
2691
|
+
};
|
|
2692
|
+
sandboxContext.fsBridge = backend.createFsBridge?.({ sandbox: sandboxContext }) ?? createSandboxFsBridge({ sandbox: sandboxContext });
|
|
2693
|
+
return sandboxContext;
|
|
2694
|
+
}
|
|
2695
|
+
async function ensureSandboxWorkspaceForSession(params) {
|
|
2696
|
+
const resolved = resolveSandboxSession(params);
|
|
2697
|
+
if (!resolved) return null;
|
|
2698
|
+
const { rawSessionKey, cfg } = resolved;
|
|
2699
|
+
const { workspaceDir } = await ensureSandboxWorkspaceLayout({
|
|
2700
|
+
cfg,
|
|
2701
|
+
rawSessionKey,
|
|
2702
|
+
config: params.config,
|
|
2703
|
+
workspaceDir: params.workspaceDir
|
|
2704
|
+
});
|
|
2705
|
+
return {
|
|
2706
|
+
workspaceDir,
|
|
2707
|
+
containerWorkdir: cfg.docker.workdir
|
|
2708
|
+
};
|
|
2709
|
+
}
|
|
2710
|
+
//#endregion
|
|
2711
|
+
//#region src/agents/sandbox/manage.ts
|
|
2712
|
+
async function listSandboxContainers() {
|
|
2713
|
+
const config = loadConfig();
|
|
2714
|
+
const registry = await readRegistry();
|
|
2715
|
+
const results = [];
|
|
2716
|
+
for (const entry of registry.entries) {
|
|
2717
|
+
const manager = getSandboxBackendManager(entry.backendId ?? "docker");
|
|
2718
|
+
if (!manager) {
|
|
2719
|
+
results.push({
|
|
2720
|
+
...entry,
|
|
2721
|
+
running: false,
|
|
2722
|
+
imageMatch: true
|
|
2723
|
+
});
|
|
2724
|
+
continue;
|
|
2725
|
+
}
|
|
2726
|
+
const agentId = resolveSandboxAgentId(entry.sessionKey);
|
|
2727
|
+
const runtime = await manager.describeRuntime({
|
|
2728
|
+
entry,
|
|
2729
|
+
config,
|
|
2730
|
+
agentId
|
|
2731
|
+
});
|
|
2732
|
+
results.push({
|
|
2733
|
+
...entry,
|
|
2734
|
+
image: runtime.actualConfigLabel ?? entry.image,
|
|
2735
|
+
running: runtime.running,
|
|
2736
|
+
imageMatch: runtime.configLabelMatch
|
|
2737
|
+
});
|
|
2738
|
+
}
|
|
2739
|
+
return results;
|
|
2740
|
+
}
|
|
2741
|
+
async function listSandboxBrowsers() {
|
|
2742
|
+
const config = loadConfig();
|
|
2743
|
+
const registry = await readBrowserRegistry();
|
|
2744
|
+
const results = [];
|
|
2745
|
+
for (const entry of registry.entries) {
|
|
2746
|
+
const agentId = resolveSandboxAgentId(entry.sessionKey);
|
|
2747
|
+
const runtime = await dockerSandboxBackendManager.describeRuntime({
|
|
2748
|
+
entry: {
|
|
2749
|
+
...entry,
|
|
2750
|
+
backendId: "docker",
|
|
2751
|
+
runtimeLabel: entry.containerName,
|
|
2752
|
+
configLabelKind: "Image"
|
|
2753
|
+
},
|
|
2754
|
+
config,
|
|
2755
|
+
agentId
|
|
2756
|
+
});
|
|
2757
|
+
results.push({
|
|
2758
|
+
...entry,
|
|
2759
|
+
image: runtime.actualConfigLabel ?? entry.image,
|
|
2760
|
+
running: runtime.running,
|
|
2761
|
+
imageMatch: runtime.configLabelMatch
|
|
2762
|
+
});
|
|
2763
|
+
}
|
|
2764
|
+
return results;
|
|
2765
|
+
}
|
|
2766
|
+
async function removeSandboxContainer(containerName) {
|
|
2767
|
+
const config = loadConfig();
|
|
2768
|
+
const entry = (await readRegistry()).entries.find((item) => item.containerName === containerName);
|
|
2769
|
+
if (entry) await getSandboxBackendManager(entry.backendId ?? "docker")?.removeRuntime({
|
|
2770
|
+
entry,
|
|
2771
|
+
config,
|
|
2772
|
+
agentId: resolveSandboxAgentId(entry.sessionKey)
|
|
2773
|
+
});
|
|
2774
|
+
await removeRegistryEntry(containerName);
|
|
2775
|
+
}
|
|
2776
|
+
async function removeSandboxBrowserContainer(containerName) {
|
|
2777
|
+
const config = loadConfig();
|
|
2778
|
+
const entry = (await readBrowserRegistry()).entries.find((item) => item.containerName === containerName);
|
|
2779
|
+
if (entry) await dockerSandboxBackendManager.removeRuntime({
|
|
2780
|
+
entry: {
|
|
2781
|
+
...entry,
|
|
2782
|
+
backendId: "docker",
|
|
2783
|
+
runtimeLabel: entry.containerName,
|
|
2784
|
+
configLabelKind: "Image"
|
|
2785
|
+
},
|
|
2786
|
+
config
|
|
2787
|
+
});
|
|
2788
|
+
await removeBrowserRegistryEntry(containerName);
|
|
2789
|
+
for (const [sessionKey, bridge] of BROWSER_BRIDGES.entries()) if (bridge.containerName === containerName) {
|
|
2790
|
+
await stopBrowserBridgeServer(bridge.bridge.server).catch(() => void 0);
|
|
2791
|
+
BROWSER_BRIDGES.delete(sessionKey);
|
|
2792
|
+
}
|
|
2793
|
+
}
|
|
2794
|
+
//#endregion
|
|
2795
|
+
export { resolveWorkdir as A, chunkString as C, pad as D, deriveSessionName as E, truncateMiddle as M, formatSandboxToolPolicyBlockedMessage as N, readEnvInt as O, resolveSandboxRuntimeStatus as P, buildSandboxEnv as S, coerceEnv as T, runSshSandboxCommand as _, ensureSandboxWorkspaceForSession as a, createRemoteShellSandboxFsBridge as b, getSandboxBackendManager as c, buildExecRemoteCommand as d, buildRemoteCommand as f, disposeSshSandboxSession as g, createSshSandboxSessionFromSettings as h, removeSandboxContainer as i, sliceLogLines as j, resolveSandboxWorkdir as k, registerSandboxBackend as l, createSshSandboxSessionFromConfigText as m, listSandboxContainers as n, resolveSandboxContext as o, buildSshSandboxArgv as p, removeSandboxBrowserContainer as r, getSandboxBackendFactory as s, listSandboxBrowsers as t, requireSandboxBackendFactory as u, shellEscape as v, clampWithDefault as w, buildDockerExecArgs as x, uploadDirectoryToSshTarget as y };
|