@spacebar_ai/moldclaw-core 2026.3.43 → 2026.3.44
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/dist/accounts-5qY-dKca.d.ts +103 -0
- package/dist/accounts-SqdHz2ZP.js +114 -0
- package/dist/acp-cli-E6bcNqiE.js +2093 -0
- package/dist/actions.runtime-BU_XMuLk.js +119 -0
- package/dist/actions.runtime-CY5h8lqH.js +133 -0
- package/dist/agent-scope-lZlwP1At.js +208 -0
- package/dist/agents-C4SkadR1.js +853 -0
- package/dist/agents-RfwqGCzE.js +222 -0
- package/dist/agents.config-CX9CPNfP.js +17 -0
- package/dist/agents.config-DF9Zwn9n.js +121 -0
- package/dist/allow-list-3WSjz1zl.js +81 -0
- package/dist/allowlist-DNbDjFjw.js +142 -0
- package/dist/api-BEOpJ7dR.js +117 -0
- package/dist/audit-CpJz_eu6.js +787 -0
- package/dist/audit-CpfSjvyo.js +54 -0
- package/dist/audit-channel.collect.runtime-BeGotloZ.js +605 -0
- package/dist/audit-channel.runtime-BJDZ7ETt.js +121 -0
- package/dist/audit-extra.async-C2G0mqmk.js +813 -0
- package/dist/audit-membership-runtime-B1FqJsPV.js +162 -0
- package/dist/audit.deep.runtime-DyL9O_sU.js +25 -0
- package/dist/audit.nondeep.runtime-C6jFgJfH.js +832 -0
- package/dist/audit.runtime-Dnlsn23e.js +118 -0
- package/dist/auth-Ch3Rchm4.js +101 -0
- package/dist/auth-choice-CEFSlnLT.js +122 -0
- package/dist/auth-choice-CVCef-eU.js +268 -0
- package/dist/auth-choice-Cez-pXrg.js +507 -0
- package/dist/auth-choice-options-DO78mvPe.js +123 -0
- package/dist/auth-choice-prompt-CUkC7Mmb.js +36 -0
- package/dist/auth-choice-prompt-DCuQRiVl.js +115 -0
- package/dist/auth-choice.apply-helpers-BhbNIV8X.js +66 -0
- package/dist/auth-choice.plugin-providers.runtime-4BhqvEw_.js +119 -0
- package/dist/auth-profiles-smABVXzp.js +128040 -0
- package/dist/auth-profiles.runtime-Cr-ojtTc.js +116 -0
- package/dist/banner-CojBHPWr.js +342 -0
- package/dist/bluebubbles-BnLsj2Fy.d.ts +6 -0
- package/dist/bluebubbles-CVk7M3Bl.js +64 -0
- package/dist/bot-DdyrB2z9.d.ts +478 -0
- package/dist/brave-w4Fo8WZ3.js +24 -0
- package/dist/browser-cli-DWFs3P_i.js +1494 -0
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.d.ts +1 -1
- package/dist/bundled/boot-md/handler.js +35 -35
- package/dist/bundled/bootstrap-extra-files/handler.d.ts +1 -1
- package/dist/bundled/bootstrap-extra-files/handler.js +1 -1
- package/dist/bundled/command-logger/handler.d.ts +1 -1
- package/dist/bundled/session-memory/handler.d.ts +1 -1
- package/dist/bundled/session-memory/handler.js +36 -36
- package/dist/call-Do7wTSr7.js +39 -0
- package/dist/call-gdDAt07d.js +640 -0
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/channel-B26pkce0.js +214 -0
- package/dist/channel-BJHp0AQC.js +352 -0
- package/dist/channel-BKFOv51P.js +4681 -0
- package/dist/channel-BNgpOY8v.js +538 -0
- package/dist/channel-BcQAAo2P.js +226 -0
- package/dist/channel-BvNdnhbx.js +1598 -0
- package/dist/channel-C1Rda3Jd.js +306 -0
- package/dist/channel-C87DG-F7.js +803 -0
- package/dist/channel-CIip0kvZ.js +619 -0
- package/dist/channel-CTPxoT_E2.js +316 -0
- package/dist/channel-CklaCzUG.js +562 -0
- package/dist/channel-CoJnAdLs.js +920 -0
- package/dist/channel-D3tafL1_.js +949 -0
- package/dist/channel-DFMrP2uu.js +542 -0
- package/dist/channel-DMd5cJQe.js +397 -0
- package/dist/channel-Dm34kxAJ.js +207 -0
- package/dist/channel-DmwF9udn.js +1321 -0
- package/dist/channel-account-context-Bjur9nlh.js +103 -0
- package/dist/channel-bGnST659.js +943 -0
- package/dist/channel-hIgbkTZf.js +575 -0
- package/dist/channel-m_TGrDKo.js +497 -0
- package/dist/channel-options-DoUPBMa8.js +50 -0
- package/dist/channel-plugin-ids-TZIY4hFs.js +26 -0
- package/dist/channel-summary-qD54bOBO.js +111 -0
- package/dist/channel.runtime-B0H04Dkk.js +199 -0
- package/dist/channel.runtime-BU1f3NkV.js +418 -0
- package/dist/channel.runtime-Bj1sfLep.js +4011 -0
- package/dist/channel.runtime-BtPAAJc3.js +870 -0
- package/dist/channel.runtime-Bx-10m_j.js +171 -0
- package/dist/channel.runtime-CI_TBywQ.js +179 -0
- package/dist/channel.runtime-CSLj14-Z.js +182 -0
- package/dist/channel.runtime-D-lTSYAd.js +404 -0
- package/dist/channel.runtime-DJqIOSji.js +127 -0
- package/dist/channel.runtime-Ec8aQ9V2.js +241 -0
- package/dist/channel.runtime-ax5a1jBm.js +218 -0
- package/dist/channel.setup-B-ncdYLT.js +9 -0
- package/dist/channel.setup-BY4bh5dm.js +9 -0
- package/dist/channel.setup-BovsdMnL.js +57 -0
- package/dist/channel.setup-CXzXA25h.js +6 -0
- package/dist/channel.setup-DcZUEufN.js +8 -0
- package/dist/channel.setup-E6zceRsE.js +8 -0
- package/dist/channel.setup-Pc7nGbdX.js +11 -0
- package/dist/channels/plugins/actions/discord.d.ts +2 -2
- package/dist/channels/plugins/actions/discord.js +35 -35
- package/dist/channels/plugins/actions/signal.d.ts +1 -1
- package/dist/channels/plugins/actions/signal.js +35 -35
- package/dist/channels/plugins/actions/telegram.d.ts +2 -2
- package/dist/channels/plugins/actions/telegram.js +35 -35
- package/dist/channels/plugins/agent-tools/whatsapp-login.d.ts +3 -3
- package/dist/channels/plugins/agent-tools/whatsapp-login.js +35 -35
- package/dist/channels-CPtE5ND6.js +404 -0
- package/dist/channels-Cj8ZolHI.js +1118 -0
- package/dist/channels-cli-D2sKrntt.js +291 -0
- package/dist/channels-status-issues-CzIHODg2.js +16 -0
- package/dist/clawbot-cli-BcwEDmUn.js +118 -0
- package/dist/cleanup-utils-D0L17RsX.js +96 -0
- package/dist/cli/daemon-cli.js +1 -1
- package/dist/cli-BvGVPKnD.js +154 -0
- package/dist/command-registry-CADQzTAg.js +14 -0
- package/dist/command-registry-ktiJNAJd.js +242 -0
- package/dist/command-secret-gateway-CXp10RTM.js +111 -0
- package/dist/compact.runtime-DyKL-Iar.js +116 -0
- package/dist/completion-cli-Bz4STrpt.js +17 -0
- package/dist/completion-cli-pVda2OFb.js +445 -0
- package/dist/config-BbvDRSYp.js +31 -0
- package/dist/config-CwBv71QC.js +44 -0
- package/dist/config-cli-Y0uXHbOw.js +678 -0
- package/dist/config-guard-BpW5g7JE.js +118 -0
- package/dist/config-validation-B-vLIsbo.js +262 -0
- package/dist/config-value-DT3-5958.js +132 -0
- package/dist/configure-B9U-jCqP.js +1100 -0
- package/dist/configure-BJ3Wrs5b.js +243 -0
- package/dist/control-ui-assets-C1YDYi82.js +232 -0
- package/dist/control-ui-shared-Dm5Dh0Lo.js +29 -0
- package/dist/core-BwKq3krw.js +150 -0
- package/dist/core-hjBwfDsW.d.ts +87 -0
- package/dist/cron-cli-DTDgfoMh.js +639 -0
- package/dist/daemon-cli-C-dkAXR1.js +339 -0
- package/dist/daemon-install-Oy0Q5pMF.js +180 -0
- package/dist/deliver-DNGnDqF9.js +111 -0
- package/dist/deliver-runtime-CCNZIhET.js +111 -0
- package/dist/device-id-cli-XvwZbIyC.js +52 -0
- package/dist/device-identity-IG5DngWM.js +365 -0
- package/dist/devices-cli-DIsxj4xp.js +342 -0
- package/dist/diagnostic-DTPopFvh.js +310 -0
- package/dist/directory-cli-DTSY3Ktr.js +311 -0
- package/dist/directory-config-helpers-DpFcAbmo.d.ts +38 -0
- package/dist/directory.static-CBRAUwUW.js +44 -0
- package/dist/discord-CrgxhEWw.js +114 -0
- package/dist/discovery-DrG7wmAR.js +48 -0
- package/dist/dm-policy-shared-DKoGdUpY.d.ts +95 -0
- package/dist/dns-cli-BJiz6CLK.js +217 -0
- package/dist/docs-cli-Dq2Yi5qO.js +174 -0
- package/dist/doctor-completion-D3GeVcFP.js +90 -0
- package/dist/doctor-config-flow-B1cMjr8h.js +112 -0
- package/dist/doctor-config-flow-BUe7JpV3.js +2437 -0
- package/dist/enable-Bc8bCuVe.js +24 -0
- package/dist/entry.js +4 -4
- package/dist/exec-approvals-cli-kLAev6bP.js +421 -0
- package/dist/extensions/acpx/index.d.ts +1 -1
- package/dist/extensions/amazon-bedrock/index.d.ts +1 -1
- package/dist/extensions/amazon-bedrock/index.js +4 -4
- package/dist/extensions/anthropic/index.d.ts +1 -1
- package/dist/extensions/anthropic/index.js +35 -35
- package/dist/extensions/bluebubbles/index.d.ts +1 -1
- package/dist/extensions/bluebubbles/index.js +39 -39
- package/dist/extensions/bluebubbles/setup-entry.d.ts +2 -2
- package/dist/extensions/bluebubbles/setup-entry.js +39 -39
- package/dist/extensions/brave/index.d.ts +1 -1
- package/dist/extensions/brave/index.js +5 -5
- package/dist/extensions/byteplus/index.d.ts +1 -1
- package/dist/extensions/byteplus/index.js +35 -35
- package/dist/extensions/cloudflare-ai-gateway/index.d.ts +1 -1
- package/dist/extensions/cloudflare-ai-gateway/index.js +36 -36
- package/dist/extensions/copilot-proxy/index.d.ts +1 -1
- package/dist/extensions/copilot-proxy/index.js +4 -4
- package/dist/extensions/device-pair/index.d.ts +1 -1
- package/dist/extensions/device-pair/index.js +4 -4
- package/dist/extensions/diagnostics-otel/index.d.ts +1 -1
- package/dist/extensions/diagnostics-otel/index.js +4 -4
- package/dist/extensions/diffs/index.d.ts +1 -1
- package/dist/extensions/discord/index.d.ts +1 -1
- package/dist/extensions/discord/index.js +40 -40
- package/dist/extensions/discord/setup-entry.d.ts +1 -1
- package/dist/extensions/discord/setup-entry.js +38 -38
- package/dist/extensions/elevenlabs/index.d.ts +1 -1
- package/dist/extensions/elevenlabs/index.js +35 -35
- package/dist/extensions/feishu/index.d.ts +2 -2
- package/dist/extensions/feishu/index.js +40 -40
- package/dist/extensions/feishu/setup-entry.d.ts +2 -2
- package/dist/extensions/feishu/setup-entry.js +37 -37
- package/dist/extensions/firecrawl/index.d.ts +1 -1
- package/dist/extensions/firecrawl/index.js +35 -35
- package/dist/extensions/github-copilot/index.d.ts +1 -1
- package/dist/extensions/github-copilot/index.js +35 -35
- package/dist/extensions/google/index.d.ts +1 -1
- package/dist/extensions/google/index.js +35 -35
- package/dist/extensions/googlechat/index.d.ts +1 -1
- package/dist/extensions/googlechat/index.js +38 -38
- package/dist/extensions/googlechat/setup-entry.d.ts +1 -1
- package/dist/extensions/googlechat/setup-entry.js +38 -38
- package/dist/extensions/huggingface/index.d.ts +1 -1
- package/dist/extensions/huggingface/index.js +35 -35
- package/dist/extensions/imessage/index.d.ts +1 -1
- package/dist/extensions/imessage/index.js +39 -39
- package/dist/extensions/imessage/setup-entry.d.ts +1 -1
- package/dist/extensions/imessage/setup-entry.js +39 -39
- package/dist/extensions/irc/index.d.ts +1 -1
- package/dist/extensions/irc/index.js +38 -38
- package/dist/extensions/irc/setup-entry.d.ts +2 -2
- package/dist/extensions/irc/setup-entry.js +38 -38
- package/dist/extensions/kakao-talkchannel/index.d.ts +1 -1
- package/dist/extensions/kakao-talkchannel/index.js +4 -4
- package/dist/extensions/kilocode/index.d.ts +1 -1
- package/dist/extensions/kilocode/index.js +35 -35
- package/dist/extensions/kimi-coding/index.d.ts +1 -1
- package/dist/extensions/kimi-coding/index.js +35 -35
- package/dist/extensions/line/index.d.ts +1 -1
- package/dist/extensions/line/index.js +37 -37
- package/dist/extensions/line/setup-entry.d.ts +1 -1
- package/dist/extensions/line/setup-entry.js +37 -37
- package/dist/extensions/llm-task/index.d.ts +1 -1
- package/dist/extensions/llm-task/index.js +35 -35
- package/dist/extensions/lobster/index.d.ts +1 -1
- package/dist/extensions/lobster/index.js +4 -4
- package/dist/extensions/matrix/index.d.ts +1 -1
- package/dist/extensions/matrix/index.js +40 -40
- package/dist/extensions/matrix/setup-entry.d.ts +2 -2
- package/dist/extensions/matrix/setup-entry.js +40 -40
- package/dist/extensions/mattermost/index.d.ts +1 -1
- package/dist/extensions/mattermost/index.js +37 -37
- package/dist/extensions/mattermost/setup-entry.d.ts +2 -2
- package/dist/extensions/mattermost/setup-entry.js +37 -37
- package/dist/extensions/memory-core/index.d.ts +1 -1
- package/dist/extensions/memory-core/index.js +4 -4
- package/dist/extensions/memory-lancedb/index.d.ts +1 -1
- package/dist/extensions/memory-lancedb/index.js +4 -4
- package/dist/extensions/microsoft/index.d.ts +1 -1
- package/dist/extensions/microsoft/index.js +35 -35
- package/dist/extensions/minimax/index.d.ts +1 -1
- package/dist/extensions/minimax/index.js +35 -35
- package/dist/extensions/mistral/index.d.ts +1 -1
- package/dist/extensions/mistral/index.js +35 -35
- package/dist/extensions/modelstudio/index.d.ts +1 -1
- package/dist/extensions/modelstudio/index.js +35 -35
- package/dist/extensions/moonshot/index.d.ts +1 -1
- package/dist/extensions/moonshot/index.js +35 -35
- package/dist/extensions/msteams/index.d.ts +1 -1
- package/dist/extensions/msteams/index.js +40 -40
- package/dist/extensions/msteams/setup-entry.d.ts +1 -1
- package/dist/extensions/msteams/setup-entry.js +40 -40
- package/dist/extensions/nextcloud-talk/index.d.ts +1 -1
- package/dist/extensions/nextcloud-talk/index.js +37 -37
- package/dist/extensions/nextcloud-talk/setup-entry.d.ts +2 -2
- package/dist/extensions/nextcloud-talk/setup-entry.js +37 -37
- package/dist/extensions/nostr/index.d.ts +1 -1
- package/dist/extensions/nostr/index.js +37 -37
- package/dist/extensions/nostr/setup-entry.d.ts +1 -1
- package/dist/extensions/nostr/setup-entry.js +37 -37
- package/dist/extensions/nvidia/index.d.ts +1 -1
- package/dist/extensions/nvidia/index.js +4 -4
- package/dist/extensions/ollama/index.d.ts +1 -1
- package/dist/extensions/ollama/index.js +7 -7
- package/dist/extensions/open-prose/index.d.ts +1 -1
- package/dist/extensions/open-prose/index.js +4 -4
- package/dist/extensions/openai/index.d.ts +1 -1
- package/dist/extensions/openai/index.js +35 -35
- package/dist/extensions/opencode/index.d.ts +1 -1
- package/dist/extensions/opencode/index.js +35 -35
- package/dist/extensions/opencode-go/index.d.ts +1 -1
- package/dist/extensions/opencode-go/index.js +35 -35
- package/dist/extensions/openrouter/index.d.ts +1 -1
- package/dist/extensions/openrouter/index.js +35 -35
- package/dist/extensions/openshell/index.d.ts +1 -1
- package/dist/extensions/openshell/index.js +35 -35
- package/dist/extensions/perplexity/index.d.ts +1 -1
- package/dist/extensions/perplexity/index.js +5 -5
- package/dist/extensions/phone-control/index.d.ts +1 -1
- package/dist/extensions/phone-control/index.js +4 -4
- package/dist/extensions/qianfan/index.d.ts +1 -1
- package/dist/extensions/qianfan/index.js +35 -35
- package/dist/extensions/qwen-portal-auth/index.d.ts +1 -1
- package/dist/extensions/qwen-portal-auth/index.js +35 -35
- package/dist/extensions/sglang/index.d.ts +1 -1
- package/dist/extensions/sglang/index.js +35 -35
- package/dist/extensions/signal/index.d.ts +1 -1
- package/dist/extensions/signal/index.js +38 -38
- package/dist/extensions/signal/setup-entry.d.ts +1 -1
- package/dist/extensions/signal/setup-entry.js +38 -38
- package/dist/extensions/slack/index.d.ts +1 -1
- package/dist/extensions/slack/index.js +39 -39
- package/dist/extensions/slack/setup-entry.d.ts +1 -1
- package/dist/extensions/slack/setup-entry.js +38 -38
- package/dist/extensions/synology-chat/index.d.ts +1 -1
- package/dist/extensions/synology-chat/index.js +37 -37
- package/dist/extensions/synology-chat/setup-entry.d.ts +1 -1
- package/dist/extensions/synology-chat/setup-entry.js +37 -37
- package/dist/extensions/synthetic/index.d.ts +1 -1
- package/dist/extensions/synthetic/index.js +35 -35
- package/dist/extensions/talk-voice/index.d.ts +1 -1
- package/dist/extensions/talk-voice/index.js +35 -35
- package/dist/extensions/telegram/index.d.ts +1 -1
- package/dist/extensions/telegram/index.js +38 -38
- package/dist/extensions/telegram/setup-entry.d.ts +1 -1
- package/dist/extensions/telegram/setup-entry.js +37 -37
- package/dist/extensions/thread-ownership/index.d.ts +1 -1
- package/dist/extensions/thread-ownership/index.js +4 -4
- package/dist/extensions/tlon/index.d.ts +1 -1
- package/dist/extensions/tlon/index.js +37 -37
- package/dist/extensions/tlon/setup-entry.d.ts +1 -1
- package/dist/extensions/tlon/setup-entry.js +37 -37
- package/dist/extensions/together/index.d.ts +1 -1
- package/dist/extensions/together/index.js +35 -35
- package/dist/extensions/twitch/index.d.ts +2 -2
- package/dist/extensions/twitch/index.js +37 -37
- package/dist/extensions/venice/index.d.ts +1 -1
- package/dist/extensions/venice/index.js +35 -35
- package/dist/extensions/vercel-ai-gateway/index.d.ts +1 -1
- package/dist/extensions/vercel-ai-gateway/index.js +36 -36
- package/dist/extensions/vllm/index.d.ts +1 -1
- package/dist/extensions/vllm/index.js +35 -35
- package/dist/extensions/voice-call/index.d.ts +1 -1
- package/dist/extensions/voice-call/index.js +35 -35
- package/dist/extensions/volcengine/index.d.ts +1 -1
- package/dist/extensions/volcengine/index.js +35 -35
- package/dist/extensions/whatsapp/index.d.ts +1 -1
- package/dist/extensions/whatsapp/index.js +38 -38
- package/dist/extensions/whatsapp/setup-entry.d.ts +1 -1
- package/dist/extensions/whatsapp/setup-entry.js +38 -38
- package/dist/extensions/xai/index.d.ts +1 -1
- package/dist/extensions/xai/index.js +35 -35
- package/dist/extensions/xiaomi/index.d.ts +1 -1
- package/dist/extensions/xiaomi/index.js +35 -35
- package/dist/extensions/zai/index.d.ts +1 -1
- package/dist/extensions/zai/index.js +35 -35
- package/dist/extensions/zalo/index.d.ts +1 -1
- package/dist/extensions/zalo/index.js +39 -39
- package/dist/extensions/zalo/setup-entry.d.ts +1 -1
- package/dist/extensions/zalo/setup-entry.js +39 -39
- package/dist/extensions/zalouser/index.d.ts +1 -1
- package/dist/extensions/zalouser/index.js +40 -40
- package/dist/extensions/zalouser/setup-entry.d.ts +1 -1
- package/dist/extensions/zalouser/setup-entry.js +40 -40
- package/dist/feishu-fIcnHDTd.d.ts +36 -0
- package/dist/gateway-cli-0c-8h93_.js +26437 -0
- package/dist/gateway-install-token-1PwJvrBY.js +163 -0
- package/dist/gateway-rpc-C0Vk51W7.js +26 -0
- package/dist/gateway-runtime-CBm3CCoA.js +69 -0
- package/dist/git-commit-BTWXFY41.js +177 -0
- package/dist/git-commit-D6GTN5Yt.js +2 -0
- package/dist/googlechat-BQr4xgoZ.js +307 -0
- package/dist/googlechat-BvwsCVKl.d.ts +12 -0
- package/dist/group-access-DpiQnd-G.d.ts +61 -0
- package/dist/health-6yZQGADY.js +113 -0
- package/dist/health-C9DYGyRe.js +570 -0
- package/dist/heartbeat-summary-Dct2lqJj.js +57 -0
- package/dist/help-CtwSApfq.js +81 -0
- package/dist/hooks-9gokOxZ5.d.ts +6 -0
- package/dist/hooks-cli-BegKzHZT.js +1000 -0
- package/dist/hooks-status-Bm_pGORf.js +78 -0
- package/dist/http-registry-D-S6a1Na.d.ts +20 -0
- package/dist/identity-file-Diub2a0t.js +60 -0
- package/dist/image-generation-CbIVzmAR.d.ts +9 -0
- package/dist/imessage-Bgok9kfl.js +31 -0
- package/dist/imessage-VIHePprL.js +115 -0
- package/dist/inbound-reply-dispatch-B53GAGWq.js +71 -0
- package/dist/inbound-reply-dispatch-n7U3qg15.d.ts +72 -0
- package/dist/index.js +2 -2
- package/dist/install-target-oz1pjfHH.js +574 -0
- package/dist/installs-CUFm5V8a.js +532 -0
- package/dist/io-BaBxjB1v.js +9739 -0
- package/dist/io-CgHb1Jld.js +29 -0
- package/dist/irc-CaRKzGvW.js +672 -0
- package/dist/library-C5SNBCMb.js +112 -0
- package/dist/lifecycle-core-Dn8PK6nk.js +382 -0
- package/dist/line/accounts.d.ts +2 -2
- package/dist/line/send.d.ts +1 -1
- package/dist/line/send.js +7 -7
- package/dist/line/template-messages.d.ts +1 -1
- package/dist/line-B5QFpgN_.d.ts +75 -0
- package/dist/line-fePrrQOD.js +530 -0
- package/dist/llm-slug-generator-hKae3XDA.js +67 -0
- package/dist/llm-slug-generator.d.ts +1 -1
- package/dist/llm-slug-generator.js +36 -36
- package/dist/logging-CdisccbY.js +13 -0
- package/dist/logging-LKQSgX1d.js +30 -0
- package/dist/login-qr-C1YWh4nE.js +233 -0
- package/dist/login-qr-WFluMDMb.js +112 -0
- package/dist/logs-cli-CNzOvZ2d.js +256 -0
- package/dist/manager-runtime-DgMhLTkR.js +111 -0
- package/dist/manager.runtime-hUWgpPt2.js +715 -0
- package/dist/manifest-registry-CS_p1OBQ.js +1329 -0
- package/dist/matrix-43_RGLZN.d.ts +68 -0
- package/dist/matrix-CCFxHfxa.js +1269 -0
- package/dist/matrix-DWs_qIkJ.js +1495 -0
- package/dist/mcp-cli-Ci2jvv3s.js +87 -0
- package/dist/media-understanding.runtime-Cdr6iTW6.js +116 -0
- package/dist/memory-cli-LZbyF0Iu.js +111 -0
- package/dist/memory-search-BHhETk6u.js +17 -0
- package/dist/memory-search-tTD5o_rU.js +204 -0
- package/dist/method-scopes-B2ZKSsxQ.js +2452 -0
- package/dist/model-auth-markers-LqZ4qhrZ.d.ts +20 -0
- package/dist/model-picker-CTR5mo4v.js +112 -0
- package/dist/model-picker-DG4z_dBs.js +390 -0
- package/dist/model-picker.runtime-DMQ9Pj9_.js +125 -0
- package/dist/model-selection-bBBxfXdb.js +653 -0
- package/dist/model-suppression.runtime-BVG75tZ7.js +116 -0
- package/dist/models-BjkVLfgw.js +2514 -0
- package/dist/models-ZO01Q4cx.js +118 -0
- package/dist/models-cli-DemdF-bm.js +309 -0
- package/dist/models-config-B2Jja8ua.js +111 -0
- package/dist/models-config.providers.discovery-puxTsH39.d.ts +18 -0
- package/dist/moldclaw-root-Cb6HRlUO.js +92 -0
- package/dist/monitor-BP4idxJD.js +782 -0
- package/dist/monitor-B_eP8Eim.js +772 -0
- package/dist/monitor-CRHYNl5J.js +3468 -0
- package/dist/monitor-Ci1Xg4g3.js +113 -0
- package/dist/monitor-DEodDl3z.js +6823 -0
- package/dist/monitor-DJlNKuMz.js +115 -0
- package/dist/monitor-DvFwDS9w.js +3076 -0
- package/dist/monitor-shared--cEjSf8s.js +444 -0
- package/dist/msteams-CV2a8uE8.js +852 -0
- package/dist/node-cli-Of2g7DSd.js +2503 -0
- package/dist/node-resolve-BYC2FbO2.js +835 -0
- package/dist/nodes-cli-CPHM6Upj.js +1380 -0
- package/dist/nostr-BFKRoOlz.d.ts +7 -0
- package/dist/nostr-lHpcBzz4.js +8744 -0
- package/dist/npm-resolution-kqHN85wB.js +60 -0
- package/dist/oauth-env-CLG8KOrz.js +10 -0
- package/dist/onboard-BON0C360.js +48 -0
- package/dist/onboard-CRkIBgOI.js +589 -0
- package/dist/onboard-DsKI17iq.js +25 -0
- package/dist/onboard-channels-BY3IbBBf.js +1241 -0
- package/dist/onboard-channels-CLKdRxvW.js +205 -0
- package/dist/onboard-custom-BjPrMo_R.js +571 -0
- package/dist/onboard-custom-DqcPiZBN.js +114 -0
- package/dist/onboard-helpers-BkrOY5OE.js +113 -0
- package/dist/onboard-helpers-DiSRTpZC.js +335 -0
- package/dist/onboard-hooks-pzEPZAvl.js +72 -0
- package/dist/onboard-remote-ChyLC6Dk.js +181 -0
- package/dist/onboard-remote-DHmK9ntl.js +117 -0
- package/dist/onboard-search-BgA3jEMW.js +302 -0
- package/dist/onboard-skills-BMo_NvnW.js +133 -0
- package/dist/onboard-skills-Bba-Z2p8.js +117 -0
- package/dist/outbound-media-BHD4aJEX.d.ts +11 -0
- package/dist/outbound-media-DSno0N82.js +11 -0
- package/dist/pairing-access-CzHpaM0R.d.ts +21 -0
- package/dist/pairing-cli-CmklqK0q.js +217 -0
- package/dist/perplexity-CXwMDD3u.js +24 -0
- package/dist/persistent-dedupe-B9vrAf8t.d.ts +26 -0
- package/dist/pi-model-discovery-runtime-BrK7tcaO.js +111 -0
- package/dist/pi-tools.before-tool-call.runtime-C5yLUogH.js +381 -0
- package/dist/plugin-install-C4AWJIFP.js +117 -0
- package/dist/plugin-install-CB3J1hfV.js +184 -0
- package/dist/plugin-install-plan-7itZiegi.js +49 -0
- package/dist/plugin-registry-DX_GFoiz.js +113 -0
- package/dist/plugin-registry-e3cxTtvb.js +49 -0
- package/dist/plugin-sdk/account-resolution.js +35 -35
- package/dist/plugin-sdk/acp-runtime.js +35 -35
- package/dist/plugin-sdk/agent-runtime.js +35 -35
- package/dist/plugin-sdk/bluebubbles.js +37 -37
- package/dist/plugin-sdk/channel-config-helpers.js +35 -35
- package/dist/plugin-sdk/channel-policy.js +35 -35
- package/dist/plugin-sdk/channel-runtime.js +35 -35
- package/dist/plugin-sdk/compat.js +36 -36
- package/dist/plugin-sdk/config-runtime.js +35 -35
- package/dist/plugin-sdk/conversation-runtime.js +35 -35
- package/dist/plugin-sdk/copilot-proxy.js +4 -4
- package/dist/plugin-sdk/core.js +4 -4
- package/dist/plugin-sdk/device-pair.js +4 -4
- package/dist/plugin-sdk/discord.js +35 -35
- package/dist/plugin-sdk/feishu.js +35 -35
- package/dist/plugin-sdk/gateway-runtime.js +10 -10
- package/dist/plugin-sdk/googlechat.js +37 -37
- package/dist/plugin-sdk/image-generation-runtime.js +35 -35
- package/dist/plugin-sdk/image-generation.js +35 -35
- package/dist/plugin-sdk/imessage.js +36 -36
- package/dist/plugin-sdk/index.js +35 -35
- package/dist/plugin-sdk/infra-runtime.js +35 -35
- package/dist/plugin-sdk/irc.js +37 -37
- package/dist/plugin-sdk/line.js +36 -36
- package/dist/plugin-sdk/llm-task.js +35 -35
- package/dist/plugin-sdk/lobster.js +4 -4
- package/dist/plugin-sdk/matrix.js +37 -37
- package/dist/plugin-sdk/mattermost.js +36 -36
- package/dist/plugin-sdk/media-runtime.js +35 -35
- package/dist/plugin-sdk/media-understanding-runtime.js +35 -35
- package/dist/plugin-sdk/media-understanding.js +35 -35
- package/dist/plugin-sdk/memory-lancedb.js +4 -4
- package/dist/plugin-sdk/minimax-portal-auth.js +4 -4
- package/dist/plugin-sdk/msteams.js +38 -38
- package/dist/plugin-sdk/nextcloud-talk.js +36 -36
- package/dist/plugin-sdk/nostr.js +36 -36
- package/dist/plugin-sdk/ollama-setup.js +9 -9
- package/dist/plugin-sdk/open-prose.js +4 -4
- package/dist/plugin-sdk/phone-control.js +4 -4
- package/dist/plugin-sdk/plugin-runtime.js +35 -35
- package/dist/plugin-sdk/provider-auth.js +35 -35
- package/dist/plugin-sdk/provider-models.js +5 -5
- package/dist/plugin-sdk/provider-onboard.js +4 -4
- package/dist/plugin-sdk/provider-setup.js +39 -39
- package/dist/plugin-sdk/provider-stream.js +4 -4
- package/dist/plugin-sdk/provider-usage.js +4 -4
- package/dist/plugin-sdk/qwen-portal-auth.js +35 -35
- package/dist/plugin-sdk/reply-history.js +35 -35
- package/dist/plugin-sdk/reply-runtime.js +35 -35
- package/dist/plugin-sdk/routing.js +3 -3
- package/dist/plugin-sdk/sandbox.js +35 -35
- package/dist/plugin-sdk/security-runtime.js +35 -35
- package/dist/plugin-sdk/self-hosted-provider-setup.js +37 -37
- package/dist/plugin-sdk/setup.js +35 -35
- package/dist/plugin-sdk/signal.js +35 -35
- package/dist/plugin-sdk/slack.js +35 -35
- package/dist/plugin-sdk/speech-runtime.js +35 -35
- package/dist/plugin-sdk/speech.js +35 -35
- package/dist/plugin-sdk/src/secrets/secure-file-store.d.ts +26 -0
- package/dist/plugin-sdk/src/subscription/provider.d.ts +5 -3
- package/dist/plugin-sdk/synology-chat.js +36 -36
- package/dist/plugin-sdk/talk-voice.js +4 -4
- package/dist/plugin-sdk/telegram.js +35 -35
- package/dist/plugin-sdk/text-runtime.js +7 -7
- package/dist/plugin-sdk/thread-ownership.js +4 -4
- package/dist/plugin-sdk/tlon.js +36 -36
- package/dist/plugin-sdk/twitch.js +35 -35
- package/dist/plugin-sdk/voice-call.js +35 -35
- package/dist/plugin-sdk/whatsapp.js +35 -35
- package/dist/plugin-sdk/zalo.js +38 -38
- package/dist/plugin-sdk/zalouser.js +38 -38
- package/dist/plugins/runtime/index.d.ts +1 -1
- package/dist/plugins/runtime/index.js +35 -35
- package/dist/plugins-DF5FaTO0.js +111 -0
- package/dist/plugins-cli-CvTJemqC.js +917 -0
- package/dist/policy-CNXISK_a.js +143 -0
- package/dist/preflight-audio.runtime-RP000oxo.js +116 -0
- package/dist/probe-BkM5pykD.js +21 -0
- package/dist/probe-DKbRTJv5.js +1793 -0
- package/dist/probe-DkrfRsjU.js +47 -0
- package/dist/probe-DpcJ0WeP.js +129 -0
- package/dist/probe-auth-BcNjX8hy.js +40 -0
- package/dist/probe-auth-DhuAb8ls.js +48 -0
- package/dist/probe-wciBj-aL.js +6329 -0
- package/dist/program-C8-p0mW5.js +253 -0
- package/dist/prompt-select-styled-DH0pVoc0.js +2673 -0
- package/dist/provider-api-key-auth.runtime-CAFeIQ1u.js +121 -0
- package/dist/provider-auth-choice-CB_HzdTl.js +126 -0
- package/dist/provider-auth-choice-helpers-hzDkh3f1.js +48 -0
- package/dist/provider-auth-choice-preference-BHCXvNSE.js +189 -0
- package/dist/provider-auth-choice.runtime-Dx4ms2C5.js +123 -0
- package/dist/provider-auth-choices-0KaDNPBQ.js +57 -0
- package/dist/provider-auth-guidance-BaAUiNr_.js +34 -0
- package/dist/provider-auth-result-Bto1bYtS.d.ts +18 -0
- package/dist/provider-models-DxOmeToO.d.ts +867 -0
- package/dist/provider-models-xnyxy6mO.js +2113 -0
- package/dist/provider-ollama-setup-DBYK__ov.d.ts +32 -0
- package/dist/provider-ollama-setup-QzgCxj44.js +314 -0
- package/dist/provider-onboard-B9ionepI.js +139 -0
- package/dist/provider-onboard-CURxJ_UX.d.ts +40 -0
- package/dist/provider-runtime.runtime-4xwmsl5L.js +111 -0
- package/dist/provider-self-hosted-setup-BHd24EDG.js +182 -0
- package/dist/provider-self-hosted-setup-qeY8BYSy.d.ts +61 -0
- package/dist/provider-stream-Chz_EFw3.js +512 -0
- package/dist/provider-usage-C11Q7UwS.js +111 -0
- package/dist/provider-usage-kxemdMp2.js +633 -0
- package/dist/provider-wizard-CanJoxNC.js +152 -0
- package/dist/push-apns-Dsajnm8C.js +1038 -0
- package/dist/pw-ai-DUe4BbH2.js +1867 -0
- package/dist/qmd-manager-CAAFp7qK.js +1570 -0
- package/dist/qr-cli-Bu2jqTPY.js +113 -0
- package/dist/qr-cli-Bu9Z-X48.js +369 -0
- package/dist/reactions-Cpfum4iU.js +281 -0
- package/dist/read-only-account-inspect.discord.runtime-BK0LaMgC.js +116 -0
- package/dist/read-only-account-inspect.slack.runtime-DgKiC5wT.js +116 -0
- package/dist/read-only-account-inspect.telegram.runtime-mxfgFVOU.js +116 -0
- package/dist/redact-snapshot-DD8A4tdd.js +2663 -0
- package/dist/register.agent-DU4FtrU2.js +439 -0
- package/dist/register.backup-8nOYtJqg.js +625 -0
- package/dist/register.configure-DmtecqIH.js +252 -0
- package/dist/register.maintenance-Dir3ulKP.js +574 -0
- package/dist/register.message-Cfl-f3Ju.js +709 -0
- package/dist/register.onboard-Bv7WVzEi.js +192 -0
- package/dist/register.setup-BIyeI8RY.js +212 -0
- package/dist/register.status-health-sessions-C69WQcF4.js +498 -0
- package/dist/register.subclis-B_4KCgTd.js +315 -0
- package/dist/register.subclis-BeXsmgBL.js +13 -0
- package/dist/replies-DdcFUmki.js +110 -0
- package/dist/resolve-channels-DRZqPV5o.js +226 -0
- package/dist/resolve-channels-DxW1kqxA.js +262 -0
- package/dist/resolve-route-DdX-HBVt.js +538 -0
- package/dist/resolve-users-rgCQvkLs.js +143 -0
- package/dist/root-help-QAkoA7GD.js +32 -0
- package/dist/routes-CcJNnwTF.js +7097 -0
- package/dist/rpc-DDUAlBbH.js +67 -0
- package/dist/run-main-D9ci5pn7.js +424 -0
- package/dist/runtime-Bitmi8Er.d.ts +26 -0
- package/dist/runtime-discord-ops.runtime-T4sf7aRB.js +9078 -0
- package/dist/runtime-slack-ops.runtime-BQpP48mC.js +4556 -0
- package/dist/runtime-telegram-ops.runtime-cVO5dqOp.js +133 -0
- package/dist/runtime-whatsapp-login.runtime-DtNx0dSY.js +114 -0
- package/dist/runtime-whatsapp-outbound.runtime-Bw47QbFK.js +117 -0
- package/dist/sandbox-cli-DsFwjbjC.js +535 -0
- package/dist/search-manager-BRAK8fEe.js +16 -0
- package/dist/search-manager-BS5Db0A6.js +386 -0
- package/dist/secrets-cli-D3J46TJp.js +2070 -0
- package/dist/security-cli-B866M9cB.js +575 -0
- package/dist/send-B1pX9_Oc.js +283 -0
- package/dist/send-B2RrLg83.js +100 -0
- package/dist/send-DFnV__Aq.js +1025 -0
- package/dist/send-DZIH6CJt.js +629 -0
- package/dist/send-sl9WnKbW.js +631 -0
- package/dist/server-node-events-BT6egg20.js +506 -0
- package/dist/server-zI_K-D05.js +107 -0
- package/dist/sessions-C8kiAcoJ.js +112 -0
- package/dist/sessions-DLBpp52_.js +218 -0
- package/dist/setup-C7eOzMiC.js +387 -0
- package/dist/setup-CFIMq-Pz.d.ts +37 -0
- package/dist/setup-binary-CcAv8NXz.js +406 -0
- package/dist/setup-browser-C4eRV3h6.js +70 -0
- package/dist/setup-core-BnR486P-.js +143 -0
- package/dist/setup-core-CIswIiu5.js +166 -0
- package/dist/setup-core-CcbcrXXg.js +47 -0
- package/dist/setup-core-nZSw5BSv.js +205 -0
- package/dist/setup-surface-C5iSpT4M.js +490 -0
- package/dist/setup-wizard-helpers-r0J6l8ST.d.ts +203 -0
- package/dist/setup.finalize-adiRfo0U.js +522 -0
- package/dist/setup.gateway-config-BwFWKDfT.js +343 -0
- package/dist/shared-12TimyeF.js +182 -0
- package/dist/shared-9EWO34-k.js +298 -0
- package/dist/shared-B4vUbaRR.js +75 -0
- package/dist/shared-bNWpW3Dd.js +96 -0
- package/dist/shared-lU1y5dvS.js +102 -0
- package/dist/signal-DBlETRu9.js +114 -0
- package/dist/skills-Bio8GwTE.js +20 -0
- package/dist/skills-DE_MXFSN.js +853 -0
- package/dist/skills-cli-BGuW-tKw.js +292 -0
- package/dist/skills-install--rnorIoJ.js +763 -0
- package/dist/skills-status-B08PtBc_.js +21 -0
- package/dist/skills-status-CzM008aB.js +169 -0
- package/dist/slack-C4T53Nc-.js +114 -0
- package/dist/slash-commands.runtime-B7fsD8Be.js +128 -0
- package/dist/slash-dispatch.runtime-t0PAX4vQ.js +141 -0
- package/dist/slash-skill-commands.runtime-DIhPnEfR.js +116 -0
- package/dist/src-DrDirlvw.js +1701 -0
- package/dist/status-Bld14WSA.js +131 -0
- package/dist/status-CgeO4RuH.js +43 -0
- package/dist/status-HlvixAOq.js +606 -0
- package/dist/status-Rom_Lf3c.js +1599 -0
- package/dist/status-TwbMH6Am.js +126 -0
- package/dist/status-json-DMW7cmuK.js +288 -0
- package/dist/status.link-channel-V4LkB6Gq.js +143 -0
- package/dist/status.scan.deps.runtime-BE3X-dcP.js +126 -0
- package/dist/status.scan.runtime-BxVY4mty.js +119 -0
- package/dist/status.summary-CzLM0vVr.js +592 -0
- package/dist/status.summary.runtime-BSBnHZ1Q.js +118 -0
- package/dist/status.update-BxblMS7P.js +77 -0
- package/dist/subagent-orphan-recovery-BpRPryEj.js +307 -0
- package/dist/subagent-registry-runtime-DYYU5p3X.js +111 -0
- package/dist/subscription-CpFdxuFS.js +33 -0
- package/dist/subscription-DaA1urx-.js +102 -0
- package/dist/subscription-cli-Bvto9EmO.js +134 -0
- package/dist/synology-chat-3nwk-Nj0.js +297 -0
- package/dist/system-cli-BvNps8sl.js +94 -0
- package/dist/telegram/audit.d.ts +1 -1
- package/dist/telegram/audit.js +1 -1
- package/dist/telegram/token.d.ts +1 -1
- package/dist/telegram/token.js +35 -35
- package/dist/telegram-RtKXoEsF.js +114 -0
- package/dist/text-chunking-BD5mQe2R.js +84 -0
- package/dist/text-chunking-DDUU_vAF.d.ts +79 -0
- package/dist/tlon-z-kYmJE-.js +433 -0
- package/dist/tui-cli-CzSK08Rh.js +137 -0
- package/dist/tui-wV7R1Tlc.js +3834 -0
- package/dist/types-2H_e7eWT.d.ts +45 -0
- package/dist/types-ZKnGUchG.d.ts +22692 -0
- package/dist/types.base-BFiQZ4J9.d.ts +188 -0
- package/dist/ui-BWVHreeR.js +31 -0
- package/dist/update-D1Wgh1Tj.js +1036 -0
- package/dist/update-cli-CZh99uyY.js +1503 -0
- package/dist/update-offset-store-D5xTdUr0.js +112 -0
- package/dist/update-runner-GbKfoCHs.js +1496 -0
- package/dist/upsert-with-lock-BZU7Le8n.js +33 -0
- package/dist/usage-Czgwvg0h.js +115 -0
- package/dist/web-CMczmL90.js +112 -0
- package/dist/web-shared-B5Q0mIJq.d.ts +45 -0
- package/dist/webhook-request-guards-CsKDhZJr.d.ts +76 -0
- package/dist/webhook-targets-BSmFtesN.js +181 -0
- package/dist/webhook-targets-CjxuEE9C.d.ts +106 -0
- package/dist/webhooks-cli-Wl9y6AWW.js +350 -0
- package/dist/whatsapp-VzRW8MdR.js +114 -0
- package/dist/whatsapp-actions-Cg1Wxv8W.js +167 -0
- package/dist/workspace-DJ_S272u.js +484 -0
- package/dist/workspace-DbZSqjw0.js +289 -0
- package/dist/workspace-cli-D93DLmAh.js +154 -0
- package/dist/workspace-dirs-CGeIPpGN.js +2003 -0
- package/dist/zalo-CK2dlGmu.d.ts +9 -0
- package/dist/zalo-Db7s2boL.js +415 -0
- package/dist/zalouser-Jh5YTJX3.js +30911 -0
- package/extensions/discord/src/monitor/allow-list.ts +8 -1
- package/extensions/discord/src/monitor/message-handler.preflight.ts +4 -1
- package/package.json +1 -1
- package/dist/accounts-CS8U4v8C.js +0 -114
- package/dist/accounts-gLr-Udmt.d.ts +0 -103
- package/dist/acp-cli-BGT0jXcC.js +0 -2093
- package/dist/actions.runtime-BfckTw6c.js +0 -119
- package/dist/actions.runtime-Cl9mBfqH.js +0 -133
- package/dist/agent-scope-C-YmLnnb.js +0 -208
- package/dist/agents-CydD54p8.js +0 -222
- package/dist/agents-DpQsZO6O.js +0 -853
- package/dist/agents.config-XU7IsYE-.js +0 -121
- package/dist/agents.config-ssoQXuvF.js +0 -17
- package/dist/allow-list-Cfn6lmMK.js +0 -81
- package/dist/allowlist-CCYXVpM9.js +0 -142
- package/dist/api-BoXoFKxy.js +0 -117
- package/dist/audit-Bv05N5o9.js +0 -787
- package/dist/audit-CIWW1Aqm.js +0 -54
- package/dist/audit-channel.collect.runtime-Bi7yrdcO.js +0 -605
- package/dist/audit-channel.runtime-C_NDweiW.js +0 -121
- package/dist/audit-extra.async-Dp7OKSXg.js +0 -813
- package/dist/audit-membership-runtime-B8FQ6VtN.js +0 -162
- package/dist/audit.deep.runtime-CXhobL6b.js +0 -25
- package/dist/audit.nondeep.runtime-CrEm3T16.js +0 -832
- package/dist/audit.runtime-CJPKj1Zg.js +0 -118
- package/dist/auth-Byfp0flq.js +0 -101
- package/dist/auth-choice-BgOjdeXN.js +0 -507
- package/dist/auth-choice-CD1Heq0M.js +0 -122
- package/dist/auth-choice-ePNfg0iQ.js +0 -268
- package/dist/auth-choice-options-BlewQWI0.js +0 -123
- package/dist/auth-choice-prompt-BP2b6aXz.js +0 -36
- package/dist/auth-choice-prompt-Cmwl4n97.js +0 -115
- package/dist/auth-choice.apply-helpers-Dq-nxuuX.js +0 -66
- package/dist/auth-choice.plugin-providers.runtime-B23kOUzQ.js +0 -119
- package/dist/auth-profiles-1kPLbBwI.js +0 -127823
- package/dist/auth-profiles.runtime-DAfSjku1.js +0 -116
- package/dist/banner-DeOsobLO.js +0 -342
- package/dist/bluebubbles-BsLGedBM.js +0 -64
- package/dist/bluebubbles-U2sAfO4_.d.ts +0 -6
- package/dist/bot-DW12K3bO.d.ts +0 -478
- package/dist/brave-BoWimrLe.js +0 -24
- package/dist/browser-cli-D_S3wEYE.js +0 -1494
- package/dist/call-ByEzDJ1_.js +0 -640
- package/dist/call-CHCWVg-O.js +0 -39
- package/dist/channel-3VC0oOMu.js +0 -214
- package/dist/channel-B9fCBPiS.js +0 -207
- package/dist/channel-B9q775cM.js +0 -562
- package/dist/channel-BG3UK54j.js +0 -803
- package/dist/channel-BRQAdMML.js +0 -352
- package/dist/channel-BmlLp933.js +0 -1321
- package/dist/channel-By6KvdTG.js +0 -920
- package/dist/channel-C8rRsdf6.js +0 -226
- package/dist/channel-CLEDBbXE.js +0 -943
- package/dist/channel-CMvBAG7o.js +0 -306
- package/dist/channel-CmlxxjHY.js +0 -1598
- package/dist/channel-CqG6_xN0.js +0 -949
- package/dist/channel-DNueHKs92.js +0 -316
- package/dist/channel-DUtyN7BX.js +0 -4681
- package/dist/channel-DWD6GrfZ.js +0 -538
- package/dist/channel-DaRYMYzj.js +0 -619
- package/dist/channel-Dj6BgLp8.js +0 -575
- package/dist/channel-account-context-Ba3u5D21.js +0 -103
- package/dist/channel-crabk6Em.js +0 -542
- package/dist/channel-i8uqQaK2.js +0 -497
- package/dist/channel-options-xljvwHS2.js +0 -50
- package/dist/channel-plugin-ids-DAgknSG4.js +0 -26
- package/dist/channel-summary-dHTMCG75.js +0 -111
- package/dist/channel-xVWQ96Ni.js +0 -397
- package/dist/channel.runtime-B6PoZ4BV.js +0 -182
- package/dist/channel.runtime-BPZmo57e.js +0 -404
- package/dist/channel.runtime-B_1uGR-U.js +0 -199
- package/dist/channel.runtime-BiXnPU0d.js +0 -218
- package/dist/channel.runtime-BpvDc9sv.js +0 -870
- package/dist/channel.runtime-CUua3W80.js +0 -418
- package/dist/channel.runtime-CaCBTd0A.js +0 -179
- package/dist/channel.runtime-D0FfYvUj.js +0 -4011
- package/dist/channel.runtime-DhoJtpvJ.js +0 -241
- package/dist/channel.runtime-Kj9EXNE0.js +0 -127
- package/dist/channel.runtime-r4tPuPyh.js +0 -171
- package/dist/channel.setup-B7d_grfe.js +0 -6
- package/dist/channel.setup-C0vu1fhi.js +0 -9
- package/dist/channel.setup-CAI0FNHj.js +0 -11
- package/dist/channel.setup-CkDVwv5R.js +0 -57
- package/dist/channel.setup-Cpd00YqQ.js +0 -8
- package/dist/channel.setup-DbBz1-WT.js +0 -9
- package/dist/channel.setup-GZnAvD9g.js +0 -8
- package/dist/channels-5H484RSw.js +0 -1118
- package/dist/channels-BnPudfyx.js +0 -404
- package/dist/channels-cli-WIC-QeH_.js +0 -291
- package/dist/channels-status-issues-RDmzovJU.js +0 -16
- package/dist/clawbot-cli-BgutNwf8.js +0 -118
- package/dist/cleanup-utils-DBl1Aij1.js +0 -96
- package/dist/cli-1P7u6zqu.js +0 -154
- package/dist/command-registry-B8jovrws.js +0 -232
- package/dist/command-registry-DtDl1FVm.js +0 -14
- package/dist/command-secret-gateway-BgUo3FxJ.js +0 -111
- package/dist/compact.runtime-CXbXM0AU.js +0 -116
- package/dist/completion-cli-Cik_owAE.js +0 -17
- package/dist/completion-cli-RU3P2RSl.js +0 -445
- package/dist/config-5HUpB1L1.js +0 -31
- package/dist/config-cli-QHaUHoZI.js +0 -433
- package/dist/config-guard-C9Sn3pE-.js +0 -118
- package/dist/config-sW57gztj.js +0 -44
- package/dist/config-validation-5LkjIKNt.js +0 -262
- package/dist/config-value-CtTWALxG.js +0 -132
- package/dist/configure-BmR2TPLf.js +0 -243
- package/dist/configure-DaLN-5xM.js +0 -1100
- package/dist/control-ui-assets-CH3MYmAo.js +0 -232
- package/dist/control-ui-shared-CA77PTml.js +0 -29
- package/dist/core-CvDzLs7B.js +0 -150
- package/dist/core-dPA4nFkn.d.ts +0 -87
- package/dist/cron-cli-tguLpzyq.js +0 -639
- package/dist/daemon-cli-ptosOkL8.js +0 -339
- package/dist/daemon-install-DzU4EnVa.js +0 -180
- package/dist/deliver-DwxFoHM3.js +0 -111
- package/dist/deliver-runtime-DOdDyaPI.js +0 -111
- package/dist/device-id-cli-GopvlxxZ.js +0 -52
- package/dist/device-identity-CRfhC3_s.js +0 -365
- package/dist/devices-cli-ain7ESqU.js +0 -342
- package/dist/diagnostic-D96Xaqrj.js +0 -310
- package/dist/directory-cli-fh1UxGgY.js +0 -311
- package/dist/directory-config-helpers-CpU1oflo.d.ts +0 -38
- package/dist/directory.static-CKjJUNGl.js +0 -44
- package/dist/discord-CflhwDEM.js +0 -114
- package/dist/discovery-x0ZqY4AB.js +0 -48
- package/dist/dm-policy-shared-73A52W6E.d.ts +0 -95
- package/dist/dns-cli-DCHyKjGf.js +0 -217
- package/dist/docs-cli-D3OoqYSP.js +0 -174
- package/dist/doctor-completion-Bq2eP87s.js +0 -90
- package/dist/doctor-config-flow-D8XRG9Ku.js +0 -2437
- package/dist/doctor-config-flow-DGiF1HGc.js +0 -112
- package/dist/enable-0QSF4YGH.js +0 -24
- package/dist/exec-approvals-cli-Bncym0Gd.js +0 -421
- package/dist/feishu-B5JDcyF9.d.ts +0 -36
- package/dist/gateway-cli-DYscsmA-.js +0 -26437
- package/dist/gateway-install-token-CNv17ac9.js +0 -163
- package/dist/gateway-rpc-BGC1Rxvg.js +0 -26
- package/dist/gateway-runtime-D89mSQPB.js +0 -69
- package/dist/git-commit-CeLH5Ozm.js +0 -2
- package/dist/git-commit-DUKRiCP-.js +0 -177
- package/dist/googlechat-BgXeXjd1.js +0 -307
- package/dist/googlechat-De-T7C31.d.ts +0 -12
- package/dist/group-access-Deh1tVNr.d.ts +0 -61
- package/dist/health-BEjzWwaB.js +0 -570
- package/dist/health-FjqrWQL6.js +0 -113
- package/dist/heartbeat-summary-CfdSA9M1.js +0 -57
- package/dist/help-BZeVprq1.js +0 -81
- package/dist/hooks-B5pYs_d7.d.ts +0 -6
- package/dist/hooks-cli-B7uGJs2O.js +0 -1000
- package/dist/hooks-status-CfceaUSg.js +0 -78
- package/dist/http-registry-C-KXqwnj.d.ts +0 -20
- package/dist/identity-file-sshkKKIr.js +0 -60
- package/dist/image-generation-CafM5hZh.d.ts +0 -9
- package/dist/imessage-BcV3WGx_.js +0 -31
- package/dist/imessage-Dhje7Ty-.js +0 -115
- package/dist/inbound-reply-dispatch-C73_7SOl.js +0 -71
- package/dist/inbound-reply-dispatch-DmL0KWLe.d.ts +0 -72
- package/dist/install-target-D7NRhfzc.js +0 -574
- package/dist/installs-Bj6jblqc.js +0 -532
- package/dist/io-CMfWWPXQ.js +0 -9738
- package/dist/io-CV844hAM.js +0 -29
- package/dist/irc-DKi1fDYI.js +0 -672
- package/dist/library-rygTG3oA.js +0 -112
- package/dist/lifecycle-core-BPlvShWY.js +0 -382
- package/dist/line-CGsemKWJ.js +0 -530
- package/dist/line-CKU3ER-n.d.ts +0 -75
- package/dist/llm-slug-generator-DlhVyMqT.js +0 -67
- package/dist/logging-5wu9k6w4.js +0 -30
- package/dist/logging-CxP9suT8.js +0 -13
- package/dist/login-qr-BcDsiwHs.js +0 -233
- package/dist/login-qr-Y8pJ5yV4.js +0 -112
- package/dist/logs-cli-XI9oVXpH.js +0 -256
- package/dist/manager-runtime-DkIlXBhD.js +0 -111
- package/dist/manager.runtime-Q0q2rJCC.js +0 -715
- package/dist/manifest-registry-DAd0SRAP.js +0 -1329
- package/dist/matrix-BI0DBBrG.js +0 -1495
- package/dist/matrix-DiABGjJR.js +0 -1269
- package/dist/matrix-fC6NrFM5.d.ts +0 -68
- package/dist/mcp-cli-BOyn_DLL.js +0 -87
- package/dist/media-understanding.runtime-DjUa7Dka.js +0 -116
- package/dist/memory-cli-CJd_vl-Y.js +0 -111
- package/dist/memory-search-CEEItIFR.js +0 -17
- package/dist/memory-search-Cv1SBrn7.js +0 -204
- package/dist/method-scopes-CQE7-bZ-.js +0 -2452
- package/dist/model-auth-markers-B1bbs9Qd.d.ts +0 -20
- package/dist/model-picker-D6_89XHg.js +0 -112
- package/dist/model-picker-Svaw-APs.js +0 -390
- package/dist/model-picker.runtime-Chi9nV7A.js +0 -125
- package/dist/model-selection-hL8i1Jbs.js +0 -653
- package/dist/model-suppression.runtime-DjWJZ0X-.js +0 -116
- package/dist/models-7qj1dG_W.js +0 -118
- package/dist/models-BPOB_xJF.js +0 -2514
- package/dist/models-cli-DdlOVUjS.js +0 -309
- package/dist/models-config-CBqUS-jX.js +0 -111
- package/dist/models-config.providers.discovery-BKB5JH9M.d.ts +0 -18
- package/dist/moldclaw-root-D6PbhbZk.js +0 -88
- package/dist/monitor-BPYhkEqF.js +0 -782
- package/dist/monitor-BuTcQ24j.js +0 -3468
- package/dist/monitor-CuXvNhFh.js +0 -113
- package/dist/monitor-D-TqSIHF.js +0 -6823
- package/dist/monitor-DRSgo9u2.js +0 -3076
- package/dist/monitor-DcHch39z.js +0 -772
- package/dist/monitor-DsHBMrXp.js +0 -115
- package/dist/monitor-shared-CL8T4gt1.js +0 -444
- package/dist/msteams-7FMwTvQG.js +0 -852
- package/dist/node-cli-BCjaSCZM.js +0 -2503
- package/dist/node-resolve-D5Hvcgyx.js +0 -835
- package/dist/nodes-cli-Dd_SNbkt.js +0 -1380
- package/dist/nostr-D8scBiYq.d.ts +0 -7
- package/dist/nostr-DBTFTxKs.js +0 -8744
- package/dist/npm-resolution-CYfb3MHG.js +0 -60
- package/dist/oauth-env-zPt5RywA.js +0 -10
- package/dist/onboard-BEFQQeig.js +0 -25
- package/dist/onboard-CJHNyxJh.js +0 -48
- package/dist/onboard-D_3UeLEN.js +0 -589
- package/dist/onboard-channels-B_JL0Djc.js +0 -1241
- package/dist/onboard-channels-CqZzHt2C.js +0 -205
- package/dist/onboard-custom-CER3Ggbq.js +0 -571
- package/dist/onboard-custom-bNRdGECb.js +0 -114
- package/dist/onboard-helpers-BK0Hsb7Y.js +0 -335
- package/dist/onboard-helpers-CXZ5RPoR.js +0 -113
- package/dist/onboard-hooks-1NsxEDjH.js +0 -72
- package/dist/onboard-remote-DuKhC_7W.js +0 -117
- package/dist/onboard-remote-OwRcDuB3.js +0 -181
- package/dist/onboard-search-Cy8dOq2W.js +0 -302
- package/dist/onboard-skills-D5phRa6r.js +0 -117
- package/dist/onboard-skills-c9qWCNe9.js +0 -133
- package/dist/outbound-media-CgNYEQWb.d.ts +0 -11
- package/dist/outbound-media-DYRO2vTD.js +0 -11
- package/dist/pairing-access-Dsiu5Mvl.d.ts +0 -21
- package/dist/pairing-cli-BOnv0TYn.js +0 -217
- package/dist/perplexity-EZwC3y2b.js +0 -24
- package/dist/persistent-dedupe-DMLOqJ23.d.ts +0 -26
- package/dist/pi-model-discovery-runtime-BToY3A6K.js +0 -111
- package/dist/pi-tools.before-tool-call.runtime-D_acPtld.js +0 -381
- package/dist/plugin-install-CgJpSjYd.js +0 -184
- package/dist/plugin-install-Cl1A4EF6.js +0 -117
- package/dist/plugin-install-plan-Dc2Z4DeU.js +0 -49
- package/dist/plugin-registry-B1UaWrQD.js +0 -49
- package/dist/plugin-registry-Cy8biwnn.js +0 -113
- package/dist/plugins-CXwvg50F.js +0 -111
- package/dist/plugins-cli-Uvzp2aYV.js +0 -917
- package/dist/policy-DsMBbEe7.js +0 -143
- package/dist/preflight-audio.runtime-hWsZIYvc.js +0 -116
- package/dist/probe-CNsSf1Uf.js +0 -6329
- package/dist/probe-CqOIrPhb.js +0 -47
- package/dist/probe-DH6gDw-h.js +0 -129
- package/dist/probe-DM16PLf4.js +0 -21
- package/dist/probe-DvAEEWYr.js +0 -1793
- package/dist/probe-auth-COfgCble.js +0 -48
- package/dist/probe-auth-I_5TX1Eh.js +0 -40
- package/dist/program-Dz80sgTU.js +0 -253
- package/dist/prompt-select-styled-wQehwFxK.js +0 -2673
- package/dist/provider-api-key-auth.runtime-BR9GU4ya.js +0 -121
- package/dist/provider-auth-choice-CdhA84kr.js +0 -126
- package/dist/provider-auth-choice-helpers-kabp_0zA.js +0 -48
- package/dist/provider-auth-choice-preference-se3zAM_2.js +0 -189
- package/dist/provider-auth-choice.runtime-BMc8-xNQ.js +0 -123
- package/dist/provider-auth-choices-CYsCViGi.js +0 -57
- package/dist/provider-auth-guidance-CMjUWlNf.js +0 -34
- package/dist/provider-auth-result-Cw6qIhO-.d.ts +0 -18
- package/dist/provider-models-BCId_Lfu.js +0 -2113
- package/dist/provider-models-Ok-DrSiY.d.ts +0 -867
- package/dist/provider-ollama-setup-B6XJZ0So.js +0 -314
- package/dist/provider-ollama-setup-lGDdTl0b.d.ts +0 -32
- package/dist/provider-onboard-CSPi7jOK.d.ts +0 -40
- package/dist/provider-onboard-Ca0TaNud.js +0 -139
- package/dist/provider-runtime.runtime-DwwkHw_7.js +0 -111
- package/dist/provider-self-hosted-setup-BEKLVGpj.js +0 -182
- package/dist/provider-self-hosted-setup-Df91By-J.d.ts +0 -61
- package/dist/provider-stream-DrUD69ai.js +0 -512
- package/dist/provider-usage-BgKHCnjr.js +0 -111
- package/dist/provider-usage-D8EZpFz9.js +0 -633
- package/dist/provider-wizard-DMdb-zj_.js +0 -152
- package/dist/push-apns-BPH6d4VV.js +0 -1038
- package/dist/pw-ai-DttfldtL.js +0 -1867
- package/dist/qmd-manager-CybcDUfk.js +0 -1570
- package/dist/qr-cli-8NcmJ8Ft.js +0 -369
- package/dist/qr-cli-DWe0Our3.js +0 -113
- package/dist/reactions-D6N0LR16.js +0 -281
- package/dist/read-only-account-inspect.discord.runtime-CqUWTRfl.js +0 -116
- package/dist/read-only-account-inspect.slack.runtime-9-jpln3q.js +0 -116
- package/dist/read-only-account-inspect.telegram.runtime-EKPI1D7n.js +0 -116
- package/dist/redact-snapshot-DwJEIVk9.js +0 -2663
- package/dist/register.agent-D3YdDirP.js +0 -439
- package/dist/register.backup-dR27qCuo.js +0 -625
- package/dist/register.configure-BjFhkkka.js +0 -252
- package/dist/register.maintenance-DiMQJIOa.js +0 -574
- package/dist/register.message-CdZsKYH1.js +0 -709
- package/dist/register.onboard-B0rV1eaO.js +0 -192
- package/dist/register.setup-wKMvohzo.js +0 -212
- package/dist/register.status-health-sessions-BJ68m6pt.js +0 -498
- package/dist/register.subclis-CnnrWt2a.js +0 -315
- package/dist/register.subclis-lSvTkC6z.js +0 -13
- package/dist/replies-BABt9b48.js +0 -110
- package/dist/resolve-channels-BqZFl2Ux.js +0 -262
- package/dist/resolve-channels-DjQLXb7B.js +0 -226
- package/dist/resolve-route-CSHDsa_m.js +0 -538
- package/dist/resolve-users-BG6HaSR5.js +0 -143
- package/dist/root-help-ohmaCyC_.js +0 -32
- package/dist/routes-4k2kpvoT.js +0 -7097
- package/dist/rpc-Cnwn4Q6L.js +0 -67
- package/dist/run-main-VYlacKA0.js +0 -424
- package/dist/runtime-D61jzMiI.d.ts +0 -26
- package/dist/runtime-discord-ops.runtime-DafrU-rI.js +0 -9078
- package/dist/runtime-slack-ops.runtime-CdXBKXwd.js +0 -4556
- package/dist/runtime-telegram-ops.runtime-B12sF7gE.js +0 -133
- package/dist/runtime-whatsapp-login.runtime-CqEudH37.js +0 -114
- package/dist/runtime-whatsapp-outbound.runtime-D5m2qyn-.js +0 -117
- package/dist/sandbox-cli-CHJiEWXB.js +0 -535
- package/dist/search-manager-BtNC3-i_.js +0 -16
- package/dist/search-manager-C7J7B3_a.js +0 -386
- package/dist/secrets-cli-C6yIWBbN.js +0 -2070
- package/dist/security-cli-BVu9BkjD.js +0 -575
- package/dist/send-BSreC7rr.js +0 -631
- package/dist/send-BsLHQG_B.js +0 -1025
- package/dist/send-BuNhp8PH.js +0 -283
- package/dist/send-DOCswVar.js +0 -100
- package/dist/send-Dl0LLErk.js +0 -629
- package/dist/server-node-events-Bq2067EG.js +0 -506
- package/dist/server-y38L7N5H.js +0 -107
- package/dist/sessions-BV8gXURR.js +0 -112
- package/dist/sessions-dl1Kc-Ci.js +0 -218
- package/dist/setup-BSPXdMuK.d.ts +0 -37
- package/dist/setup-DGszQH0_.js +0 -387
- package/dist/setup-binary-C17YnmA8.js +0 -406
- package/dist/setup-browser-CPx-nEsr.js +0 -70
- package/dist/setup-core-BByHN1ME.js +0 -143
- package/dist/setup-core-C0KPlBmL.js +0 -47
- package/dist/setup-core-Cq37G6of.js +0 -166
- package/dist/setup-core-uO84_Y75.js +0 -205
- package/dist/setup-surface-BEMi7Rmb.js +0 -490
- package/dist/setup-wizard-helpers-Ck9wDR0b.d.ts +0 -203
- package/dist/setup.finalize-BzPBa8zW.js +0 -522
- package/dist/setup.gateway-config-DdwkF-8e.js +0 -343
- package/dist/shared-BCw4SKjB.js +0 -96
- package/dist/shared-CjNzsULP.js +0 -75
- package/dist/shared-Cu1BE7ZE.js +0 -298
- package/dist/shared-DSClmyUn.js +0 -182
- package/dist/shared-DyJdGH6y.js +0 -102
- package/dist/signal-Dyv4NZsB.js +0 -114
- package/dist/skills-CbB5b27M.js +0 -853
- package/dist/skills-CnfI7Szw.js +0 -20
- package/dist/skills-cli-CavB1f_3.js +0 -292
- package/dist/skills-install-B1OBdgd0.js +0 -763
- package/dist/skills-status-B3gAmIbW.js +0 -169
- package/dist/skills-status-DrHhFgU9.js +0 -21
- package/dist/slack-BRzqnoAz.js +0 -114
- package/dist/slash-commands.runtime-BK88kgds.js +0 -128
- package/dist/slash-dispatch.runtime-COGywwJE.js +0 -141
- package/dist/slash-skill-commands.runtime-Ti4brxgh.js +0 -116
- package/dist/src-DUR6OQxI.js +0 -1701
- package/dist/status-C6dgQY9a.js +0 -131
- package/dist/status-CNK0Q7QH.js +0 -606
- package/dist/status-DBcX0DSC.js +0 -43
- package/dist/status-DKgFgbwv.js +0 -1599
- package/dist/status-Wn5lhNAc.js +0 -126
- package/dist/status-json-D2EkWqAl.js +0 -288
- package/dist/status.link-channel-D3ULIdEa.js +0 -143
- package/dist/status.scan.deps.runtime-BsjWTAm4.js +0 -126
- package/dist/status.scan.runtime-D4HbzROD.js +0 -119
- package/dist/status.summary-C3YxPrDK.js +0 -592
- package/dist/status.summary.runtime-DAkXPSaK.js +0 -118
- package/dist/status.update-B4NnN9P1.js +0 -77
- package/dist/subagent-orphan-recovery-QiQEBv36.js +0 -307
- package/dist/subagent-registry-runtime-BJatPQFK.js +0 -111
- package/dist/subscription-BhZORXN9.js +0 -100
- package/dist/subscription-QEUjQRMv.js +0 -33
- package/dist/subscription-cli-HrULlAgc.js +0 -134
- package/dist/synology-chat-DB76GWMN.js +0 -297
- package/dist/system-cli-D8jDwWuL.js +0 -94
- package/dist/telegram-BHiiqKkQ.js +0 -114
- package/dist/text-chunking-Baonm9Lu.js +0 -84
- package/dist/text-chunking-DzB11ONk.d.ts +0 -79
- package/dist/tlon-DLESxNgD.js +0 -433
- package/dist/tui-C75zi2Cl.js +0 -3834
- package/dist/tui-cli-DFwx5e6i.js +0 -137
- package/dist/types-BKldC9YN.d.ts +0 -22692
- package/dist/types-MeyueBE0.d.ts +0 -45
- package/dist/types.base-Cw0-zIvE.d.ts +0 -188
- package/dist/ui-B55NOIB6.js +0 -31
- package/dist/update--ojavYQ4.js +0 -1036
- package/dist/update-cli-Cvj5aWYM.js +0 -1503
- package/dist/update-offset-store-upatuWwX.js +0 -112
- package/dist/update-runner-DHkY_-76.js +0 -1496
- package/dist/upsert-with-lock-C171GLaR.js +0 -33
- package/dist/usage-N3bxnbmt.js +0 -115
- package/dist/web-RdvT7gKa.js +0 -112
- package/dist/web-shared-C2qHVxw1.d.ts +0 -45
- package/dist/webhook-request-guards-CosLyl01.d.ts +0 -76
- package/dist/webhook-targets-Bfnag-du.js +0 -181
- package/dist/webhook-targets-DP_EkQa4.d.ts +0 -106
- package/dist/webhooks-cli-ZpnXrq7G.js +0 -350
- package/dist/whatsapp-DNTAyZHt.js +0 -114
- package/dist/whatsapp-actions-o1zKQzKZ.js +0 -167
- package/dist/workspace-CpWi5wPr.js +0 -479
- package/dist/workspace-Ii7aRS7c.js +0 -289
- package/dist/workspace-dirs-x10McA9t.js +0 -2003
- package/dist/zalo-C9OQRYRw.d.ts +0 -9
- package/dist/zalo-zm_bYCKg.js +0 -415
- package/dist/zalouser-CvVEUvc5.js +0 -30911
- /package/dist/{account-id-B3YSn4hl.d.ts → account-id-B8ce6G_4.d.ts} +0 -0
- /package/dist/{acpx-CnNv70m2.d.ts → acpx-Ci50I9T2.d.ts} +0 -0
- /package/dist/{agent-media-payload-DE2pEcsz.d.ts → agent-media-payload-en-gS5p6.d.ts} +0 -0
- /package/dist/{allow-from-DPpHnT2A.d.ts → allow-from-cMeQ47Ot.d.ts} +0 -0
- /package/dist/{allowlist-resolution-CLFiZ6nE.d.ts → allowlist-resolution-DoAWbfXV.d.ts} +0 -0
- /package/dist/{bluebubbles-Duhu-Jer.d.ts → bluebubbles-C6yYmUl0.d.ts} +0 -0
- /package/dist/{boolean-param-BhFjB3gp.d.ts → boolean-param-CdO2TFTk.d.ts} +0 -0
- /package/dist/{channel-config-schema-DnnVMdjR.d.ts → channel-config-schema-Chp38wel.d.ts} +0 -0
- /package/dist/{channel-policy-Baq-Z06b.d.ts → channel-policy-g2h6AbYQ.d.ts} +0 -0
- /package/dist/{chat-type-DpiBgwuG.d.ts → chat-type-BLt59pPT.d.ts} +0 -0
- /package/dist/{command-format-vi4xq8e8.d.ts → command-format-BDJC05Jp.d.ts} +0 -0
- /package/dist/{diffs-DK7fVSDo.d.ts → diffs-D_iNKCyn.d.ts} +0 -0
- /package/dist/{directory-runtime-BTLPaysA.d.ts → directory-runtime-DhMex6HY.d.ts} +0 -0
- /package/dist/{exec-C01wtBHu.d.ts → exec-pjfUY4KM.d.ts} +0 -0
- /package/dist/{gaxios-fetch-compat-wZ38b3w3.js → gaxios-fetch-compat-B_vtINdV.js} +0 -0
- /package/dist/{history-CwXuP2TW.d.ts → history-aqSS5VGQ.d.ts} +0 -0
- /package/dist/{inbound-envelope-SggrBs9m.d.ts → inbound-envelope-C5hWuZod.d.ts} +0 -0
- /package/dist/{index-apAZHsDo.d.ts → index-DXVQFYGX.d.ts} +0 -0
- /package/dist/{json-store-r75IZGk9.d.ts → json-store-UnqQ5aV3.d.ts} +0 -0
- /package/dist/{keyed-async-queue-DHIr7yNe.d.ts → keyed-async-queue-guucpLw3.d.ts} +0 -0
- /package/dist/{links-HeQ3r_L0.d.ts → links-Bar0meEK.d.ts} +0 -0
- /package/dist/{markdown-to-line-CDb4Jy3V.d.ts → markdown-to-line-D8uH_KOj.d.ts} +0 -0
- /package/dist/{mattermost-DtCsxpgg.d.ts → mattermost-xl7jAFJL.d.ts} +0 -0
- /package/dist/{net-BATPDwdQ.d.ts → net-rGOKGds6.d.ts} +0 -0
- /package/dist/{nextcloud-talk-Bb2wHOwp.d.ts → nextcloud-talk-De2CZ9dV.d.ts} +0 -0
- /package/dist/{oauth-utils-u567CLT0.d.ts → oauth-utils-DzN1AlEH.d.ts} +0 -0
- /package/dist/{parse-finite-number-l3tNlrZh.d.ts → parse-finite-number-odgyqhi0.d.ts} +0 -0
- /package/dist/{provider-usage.types-C6061OVN.d.ts → provider-usage.types-EDE9o-H_.d.ts} +0 -0
- /package/dist/{reply-history-BDsFnZFl.d.ts → reply-history-CVuU31xe.d.ts} +0 -0
- /package/dist/{reply-payload-CCvM4W9u.d.ts → reply-payload-CHkpBYwL.d.ts} +0 -0
- /package/dist/{request-url-C54l4-xC.d.ts → request-url-DHisbiHY.d.ts} +0 -0
- /package/dist/{run-command-D3RqWcHu.d.ts → run-command-y0Cndsb1.d.ts} +0 -0
- /package/dist/{secret-input-schema-BLBt-NAP.d.ts → secret-input-schema-b1vpYDQN.d.ts} +0 -0
- /package/dist/{session-key-BQ2-bR-9.d.ts → session-key-DTHQl57f.d.ts} +0 -0
- /package/dist/{ssh-config-C4mcH9Ly.js → ssh-config-hEHBfU2_.js} +0 -0
- /package/dist/{testing-DLkhGsoz.d.ts → testing-DszuZXgK.d.ts} +0 -0
- /package/dist/{thinking-DRkjX18p.d.ts → thinking-IwXTGSeT.d.ts} +0 -0
- /package/dist/{tool-send-CMMD1uDu.d.ts → tool-send-DWHRmKpz.d.ts} +0 -0
- /package/dist/{vllm-defaults-CcGuf4hL.d.ts → vllm-defaults-CrxZgE6-.d.ts} +0 -0
- /package/dist/{wait-Daog8bxM.d.ts → wait-wDWw_MTI.d.ts} +0 -0
- /package/dist/{webhook-memory-guards-C5MrExwT.d.ts → webhook-memory-guards-DreORuJy.d.ts} +0 -0
- /package/dist/{windows-spawn-j2l-dqu8.d.ts → windows-spawn-BIzH92x2.d.ts} +0 -0
- /package/dist/{zod-schema.agent-runtime-krMrBnIn.d.ts → zod-schema.agent-runtime-CP2rmis3.d.ts} +0 -0
- /package/dist/{zod-schema.core-BNDieZDZ.d.ts → zod-schema.core-Foi1tYwi.d.ts} +0 -0
|
@@ -0,0 +1,2003 @@
|
|
|
1
|
+
import { r as STATE_DIR } from "./paths-D6AgsMTU.js";
|
|
2
|
+
import { n as defaultRuntime } from "./runtime-_tQz41uA.js";
|
|
3
|
+
import { t as createSubsystemLogger } from "./subsystem-CPmDTJ2P.js";
|
|
4
|
+
import { n as markmoldClawExecEnv } from "./moldclaw-exec-env-ZDcTcMZI.js";
|
|
5
|
+
import { D as isPlainObject, y as resolveUserPath } from "./utils-C7ykRPCQ.js";
|
|
6
|
+
import { i as resolveAgentConfig, m as resolveDefaultAgentId, p as resolveAgentWorkspaceDir } from "./agent-scope-lZlwP1At.js";
|
|
7
|
+
import { c as normalizeAgentId, u as resolveAgentIdFromSessionKey } from "./session-key-UoG7Kfw5.js";
|
|
8
|
+
import { o as resolvePathViaExistingAncestorSync } from "./boundary-file-read-tPYh_8fH.js";
|
|
9
|
+
import { l as normalizeSecretInputString } from "./types.secrets-Ca-9L8vU.js";
|
|
10
|
+
import { t as getBlockedNetworkModeReason } from "./network-mode-BtWXzwYn.js";
|
|
11
|
+
import { l as CHANNEL_IDS, s as normalizeChannelId } from "./registry-C1pRrsQl.js";
|
|
12
|
+
import { n as getProcessStartTime, r as isPidAlive, t as resolveProcessScopedMap } from "./process-scoped-map-BHiqAIVX.js";
|
|
13
|
+
import { t as formatCliCommand } from "./command-format-C_z0Ru-7.js";
|
|
14
|
+
import { t as sanitizeEnvVars } from "./sanitize-env-vars-LzjaOgVf.js";
|
|
15
|
+
import { n as materializeWindowsSpawnProgram, r as resolveWindowsSpawnProgram } from "./windows-spawn-Du1a57S-.js";
|
|
16
|
+
import { r as writeJsonAtomic } from "./json-files-B9YQFF4Z.js";
|
|
17
|
+
import fs from "node:fs";
|
|
18
|
+
import path, { posix } from "node:path";
|
|
19
|
+
import { spawn } from "node:child_process";
|
|
20
|
+
import fs$1 from "node:fs/promises";
|
|
21
|
+
import crypto from "node:crypto";
|
|
22
|
+
//#region src/agents/sandbox/constants.ts
|
|
23
|
+
const DEFAULT_SANDBOX_WORKSPACE_ROOT = path.join(STATE_DIR, "sandboxes");
|
|
24
|
+
const DEFAULT_SANDBOX_IMAGE = "moldclaw-sandbox:bookworm-slim";
|
|
25
|
+
const DEFAULT_TOOL_ALLOW = [
|
|
26
|
+
"exec",
|
|
27
|
+
"process",
|
|
28
|
+
"read",
|
|
29
|
+
"write",
|
|
30
|
+
"edit",
|
|
31
|
+
"apply_patch",
|
|
32
|
+
"image",
|
|
33
|
+
"sessions_list",
|
|
34
|
+
"sessions_history",
|
|
35
|
+
"sessions_send",
|
|
36
|
+
"sessions_spawn",
|
|
37
|
+
"sessions_yield",
|
|
38
|
+
"subagents",
|
|
39
|
+
"session_status"
|
|
40
|
+
];
|
|
41
|
+
const DEFAULT_TOOL_DENY = [
|
|
42
|
+
"browser",
|
|
43
|
+
"canvas",
|
|
44
|
+
"nodes",
|
|
45
|
+
"cron",
|
|
46
|
+
"gateway",
|
|
47
|
+
...CHANNEL_IDS
|
|
48
|
+
];
|
|
49
|
+
const DEFAULT_SANDBOX_BROWSER_IMAGE = "moldclaw-sandbox-browser:bookworm-slim";
|
|
50
|
+
const DEFAULT_SANDBOX_COMMON_IMAGE = "moldclaw-sandbox-common:bookworm-slim";
|
|
51
|
+
const SANDBOX_BROWSER_SECURITY_HASH_EPOCH = "2026-02-28-no-sandbox-env";
|
|
52
|
+
const SANDBOX_AGENT_WORKSPACE_MOUNT = "/agent";
|
|
53
|
+
const SANDBOX_STATE_DIR = path.join(STATE_DIR, "sandbox");
|
|
54
|
+
const SANDBOX_REGISTRY_PATH = path.join(SANDBOX_STATE_DIR, "containers.json");
|
|
55
|
+
const SANDBOX_BROWSER_REGISTRY_PATH = path.join(SANDBOX_STATE_DIR, "browsers.json");
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/agents/glob-pattern.ts
|
|
58
|
+
function escapeRegex(value) {
|
|
59
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
60
|
+
}
|
|
61
|
+
function compileGlobPattern(params) {
|
|
62
|
+
const normalized = params.normalize(params.raw);
|
|
63
|
+
if (!normalized) return {
|
|
64
|
+
kind: "exact",
|
|
65
|
+
value: ""
|
|
66
|
+
};
|
|
67
|
+
if (normalized === "*") return { kind: "all" };
|
|
68
|
+
if (!normalized.includes("*")) return {
|
|
69
|
+
kind: "exact",
|
|
70
|
+
value: normalized
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
kind: "regex",
|
|
74
|
+
value: new RegExp(`^${escapeRegex(normalized).replaceAll("\\*", ".*")}$`)
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function compileGlobPatterns(params) {
|
|
78
|
+
if (!Array.isArray(params.raw)) return [];
|
|
79
|
+
return params.raw.map((raw) => compileGlobPattern({
|
|
80
|
+
raw,
|
|
81
|
+
normalize: params.normalize
|
|
82
|
+
})).filter((pattern) => pattern.kind !== "exact" || pattern.value);
|
|
83
|
+
}
|
|
84
|
+
function matchesAnyGlobPattern(value, patterns) {
|
|
85
|
+
for (const pattern of patterns) {
|
|
86
|
+
if (pattern.kind === "all") return true;
|
|
87
|
+
if (pattern.kind === "exact" && value === pattern.value) return true;
|
|
88
|
+
if (pattern.kind === "regex" && pattern.value.test(value)) return true;
|
|
89
|
+
}
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/agents/tool-catalog.ts
|
|
94
|
+
const CORE_TOOL_SECTION_ORDER = [
|
|
95
|
+
{
|
|
96
|
+
id: "fs",
|
|
97
|
+
label: "Files"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "runtime",
|
|
101
|
+
label: "Runtime"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: "web",
|
|
105
|
+
label: "Web"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: "memory",
|
|
109
|
+
label: "Memory"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: "sessions",
|
|
113
|
+
label: "Sessions"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: "ui",
|
|
117
|
+
label: "UI"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "messaging",
|
|
121
|
+
label: "Messaging"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
id: "automation",
|
|
125
|
+
label: "Automation"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: "nodes",
|
|
129
|
+
label: "Nodes"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: "agents",
|
|
133
|
+
label: "Agents"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "media",
|
|
137
|
+
label: "Media"
|
|
138
|
+
}
|
|
139
|
+
];
|
|
140
|
+
const CORE_TOOL_DEFINITIONS = [
|
|
141
|
+
{
|
|
142
|
+
id: "read",
|
|
143
|
+
label: "read",
|
|
144
|
+
description: "Read file contents",
|
|
145
|
+
sectionId: "fs",
|
|
146
|
+
profiles: ["coding"]
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
id: "write",
|
|
150
|
+
label: "write",
|
|
151
|
+
description: "Create or overwrite files",
|
|
152
|
+
sectionId: "fs",
|
|
153
|
+
profiles: ["coding"]
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
id: "edit",
|
|
157
|
+
label: "edit",
|
|
158
|
+
description: "Make precise edits",
|
|
159
|
+
sectionId: "fs",
|
|
160
|
+
profiles: ["coding"]
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
id: "apply_patch",
|
|
164
|
+
label: "apply_patch",
|
|
165
|
+
description: "Patch files (OpenAI)",
|
|
166
|
+
sectionId: "fs",
|
|
167
|
+
profiles: ["coding"]
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: "exec",
|
|
171
|
+
label: "exec",
|
|
172
|
+
description: "Run shell commands",
|
|
173
|
+
sectionId: "runtime",
|
|
174
|
+
profiles: ["coding"]
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: "process",
|
|
178
|
+
label: "process",
|
|
179
|
+
description: "Manage background processes",
|
|
180
|
+
sectionId: "runtime",
|
|
181
|
+
profiles: ["coding"]
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
id: "web_search",
|
|
185
|
+
label: "web_search",
|
|
186
|
+
description: "Search the web",
|
|
187
|
+
sectionId: "web",
|
|
188
|
+
profiles: ["coding"],
|
|
189
|
+
includeInmoldClawGroup: true
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
id: "web_fetch",
|
|
193
|
+
label: "web_fetch",
|
|
194
|
+
description: "Fetch web content",
|
|
195
|
+
sectionId: "web",
|
|
196
|
+
profiles: ["coding"],
|
|
197
|
+
includeInmoldClawGroup: true
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
id: "memory_search",
|
|
201
|
+
label: "memory_search",
|
|
202
|
+
description: "Semantic search",
|
|
203
|
+
sectionId: "memory",
|
|
204
|
+
profiles: ["coding"],
|
|
205
|
+
includeInmoldClawGroup: true
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
id: "memory_get",
|
|
209
|
+
label: "memory_get",
|
|
210
|
+
description: "Read memory files",
|
|
211
|
+
sectionId: "memory",
|
|
212
|
+
profiles: ["coding"],
|
|
213
|
+
includeInmoldClawGroup: true
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
id: "sessions_list",
|
|
217
|
+
label: "sessions_list",
|
|
218
|
+
description: "List sessions",
|
|
219
|
+
sectionId: "sessions",
|
|
220
|
+
profiles: ["coding", "messaging"],
|
|
221
|
+
includeInmoldClawGroup: true
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
id: "sessions_history",
|
|
225
|
+
label: "sessions_history",
|
|
226
|
+
description: "Session history",
|
|
227
|
+
sectionId: "sessions",
|
|
228
|
+
profiles: ["coding", "messaging"],
|
|
229
|
+
includeInmoldClawGroup: true
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
id: "sessions_send",
|
|
233
|
+
label: "sessions_send",
|
|
234
|
+
description: "Send to session",
|
|
235
|
+
sectionId: "sessions",
|
|
236
|
+
profiles: ["coding", "messaging"],
|
|
237
|
+
includeInmoldClawGroup: true
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
id: "sessions_spawn",
|
|
241
|
+
label: "sessions_spawn",
|
|
242
|
+
description: "Spawn sub-agent",
|
|
243
|
+
sectionId: "sessions",
|
|
244
|
+
profiles: ["coding"],
|
|
245
|
+
includeInmoldClawGroup: true
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
id: "sessions_yield",
|
|
249
|
+
label: "sessions_yield",
|
|
250
|
+
description: "End turn to receive sub-agent results",
|
|
251
|
+
sectionId: "sessions",
|
|
252
|
+
profiles: ["coding"],
|
|
253
|
+
includeInmoldClawGroup: true
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
id: "subagents",
|
|
257
|
+
label: "subagents",
|
|
258
|
+
description: "Manage sub-agents",
|
|
259
|
+
sectionId: "sessions",
|
|
260
|
+
profiles: ["coding"],
|
|
261
|
+
includeInmoldClawGroup: true
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
id: "session_status",
|
|
265
|
+
label: "session_status",
|
|
266
|
+
description: "Session status",
|
|
267
|
+
sectionId: "sessions",
|
|
268
|
+
profiles: [
|
|
269
|
+
"minimal",
|
|
270
|
+
"coding",
|
|
271
|
+
"messaging"
|
|
272
|
+
],
|
|
273
|
+
includeInmoldClawGroup: true
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
id: "browser",
|
|
277
|
+
label: "browser",
|
|
278
|
+
description: "Control web browser",
|
|
279
|
+
sectionId: "ui",
|
|
280
|
+
profiles: [],
|
|
281
|
+
includeInmoldClawGroup: true
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
id: "canvas",
|
|
285
|
+
label: "canvas",
|
|
286
|
+
description: "Control canvases",
|
|
287
|
+
sectionId: "ui",
|
|
288
|
+
profiles: [],
|
|
289
|
+
includeInmoldClawGroup: true
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
id: "message",
|
|
293
|
+
label: "message",
|
|
294
|
+
description: "Send messages",
|
|
295
|
+
sectionId: "messaging",
|
|
296
|
+
profiles: ["messaging"],
|
|
297
|
+
includeInmoldClawGroup: true
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
id: "cron",
|
|
301
|
+
label: "cron",
|
|
302
|
+
description: "Schedule tasks",
|
|
303
|
+
sectionId: "automation",
|
|
304
|
+
profiles: ["coding"],
|
|
305
|
+
includeInmoldClawGroup: true
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
id: "gateway",
|
|
309
|
+
label: "gateway",
|
|
310
|
+
description: "Gateway control",
|
|
311
|
+
sectionId: "automation",
|
|
312
|
+
profiles: [],
|
|
313
|
+
includeInmoldClawGroup: true
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
id: "nodes",
|
|
317
|
+
label: "nodes",
|
|
318
|
+
description: "Nodes + devices",
|
|
319
|
+
sectionId: "nodes",
|
|
320
|
+
profiles: [],
|
|
321
|
+
includeInmoldClawGroup: true
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
id: "agents_list",
|
|
325
|
+
label: "agents_list",
|
|
326
|
+
description: "List agents",
|
|
327
|
+
sectionId: "agents",
|
|
328
|
+
profiles: [],
|
|
329
|
+
includeInmoldClawGroup: true
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
id: "image",
|
|
333
|
+
label: "image",
|
|
334
|
+
description: "Image understanding",
|
|
335
|
+
sectionId: "media",
|
|
336
|
+
profiles: ["coding"],
|
|
337
|
+
includeInmoldClawGroup: true
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
id: "image_generate",
|
|
341
|
+
label: "image_generate",
|
|
342
|
+
description: "Image generation",
|
|
343
|
+
sectionId: "media",
|
|
344
|
+
profiles: ["coding"],
|
|
345
|
+
includeInmoldClawGroup: true
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
id: "tts",
|
|
349
|
+
label: "tts",
|
|
350
|
+
description: "Text-to-speech conversion",
|
|
351
|
+
sectionId: "media",
|
|
352
|
+
profiles: [],
|
|
353
|
+
includeInmoldClawGroup: true
|
|
354
|
+
}
|
|
355
|
+
];
|
|
356
|
+
const CORE_TOOL_BY_ID = new Map(CORE_TOOL_DEFINITIONS.map((tool) => [tool.id, tool]));
|
|
357
|
+
function listCoreToolIdsForProfile(profile) {
|
|
358
|
+
return CORE_TOOL_DEFINITIONS.filter((tool) => tool.profiles.includes(profile)).map((tool) => tool.id);
|
|
359
|
+
}
|
|
360
|
+
const CORE_TOOL_PROFILES = {
|
|
361
|
+
minimal: { allow: listCoreToolIdsForProfile("minimal") },
|
|
362
|
+
coding: { allow: listCoreToolIdsForProfile("coding") },
|
|
363
|
+
messaging: { allow: listCoreToolIdsForProfile("messaging") },
|
|
364
|
+
full: {}
|
|
365
|
+
};
|
|
366
|
+
function buildCoreToolGroupMap() {
|
|
367
|
+
const sectionToolMap = /* @__PURE__ */ new Map();
|
|
368
|
+
for (const tool of CORE_TOOL_DEFINITIONS) {
|
|
369
|
+
const groupId = `group:${tool.sectionId}`;
|
|
370
|
+
const list = sectionToolMap.get(groupId) ?? [];
|
|
371
|
+
list.push(tool.id);
|
|
372
|
+
sectionToolMap.set(groupId, list);
|
|
373
|
+
}
|
|
374
|
+
const moldclawTools = CORE_TOOL_DEFINITIONS.filter((tool) => tool.includeInmoldClawGroup).map((tool) => tool.id);
|
|
375
|
+
return {
|
|
376
|
+
"group:moldclaw": moldclawTools,
|
|
377
|
+
...Object.fromEntries(sectionToolMap.entries())
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
const CORE_TOOL_GROUPS = buildCoreToolGroupMap();
|
|
381
|
+
const PROFILE_OPTIONS = [
|
|
382
|
+
{
|
|
383
|
+
id: "minimal",
|
|
384
|
+
label: "Minimal"
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
id: "coding",
|
|
388
|
+
label: "Coding"
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
id: "messaging",
|
|
392
|
+
label: "Messaging"
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
id: "full",
|
|
396
|
+
label: "Full"
|
|
397
|
+
}
|
|
398
|
+
];
|
|
399
|
+
function resolveCoreToolProfilePolicy(profile) {
|
|
400
|
+
if (!profile) return;
|
|
401
|
+
const resolved = CORE_TOOL_PROFILES[profile];
|
|
402
|
+
if (!resolved) return;
|
|
403
|
+
if (!resolved.allow && !resolved.deny) return;
|
|
404
|
+
return {
|
|
405
|
+
allow: resolved.allow ? [...resolved.allow] : void 0,
|
|
406
|
+
deny: resolved.deny ? [...resolved.deny] : void 0
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
function listCoreToolSections() {
|
|
410
|
+
return CORE_TOOL_SECTION_ORDER.map((section) => ({
|
|
411
|
+
id: section.id,
|
|
412
|
+
label: section.label,
|
|
413
|
+
tools: CORE_TOOL_DEFINITIONS.filter((tool) => tool.sectionId === section.id).map((tool) => ({
|
|
414
|
+
id: tool.id,
|
|
415
|
+
label: tool.label,
|
|
416
|
+
description: tool.description
|
|
417
|
+
}))
|
|
418
|
+
})).filter((section) => section.tools.length > 0);
|
|
419
|
+
}
|
|
420
|
+
function resolveCoreToolProfiles(toolId) {
|
|
421
|
+
const tool = CORE_TOOL_BY_ID.get(toolId);
|
|
422
|
+
if (!tool) return [];
|
|
423
|
+
return [...tool.profiles];
|
|
424
|
+
}
|
|
425
|
+
function isKnownCoreToolId(toolId) {
|
|
426
|
+
return CORE_TOOL_BY_ID.has(toolId);
|
|
427
|
+
}
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region src/agents/tool-policy-shared.ts
|
|
430
|
+
const TOOL_NAME_ALIASES = {
|
|
431
|
+
bash: "exec",
|
|
432
|
+
"apply-patch": "apply_patch"
|
|
433
|
+
};
|
|
434
|
+
const TOOL_GROUPS = { ...CORE_TOOL_GROUPS };
|
|
435
|
+
function normalizeToolName(name) {
|
|
436
|
+
const normalized = name.trim().toLowerCase();
|
|
437
|
+
return TOOL_NAME_ALIASES[normalized] ?? normalized;
|
|
438
|
+
}
|
|
439
|
+
function normalizeToolList(list) {
|
|
440
|
+
if (!list) return [];
|
|
441
|
+
return list.map(normalizeToolName).filter(Boolean);
|
|
442
|
+
}
|
|
443
|
+
function expandToolGroups(list) {
|
|
444
|
+
const normalized = normalizeToolList(list);
|
|
445
|
+
const expanded = [];
|
|
446
|
+
for (const value of normalized) {
|
|
447
|
+
const group = TOOL_GROUPS[value];
|
|
448
|
+
if (group) {
|
|
449
|
+
expanded.push(...group);
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
expanded.push(value);
|
|
453
|
+
}
|
|
454
|
+
return Array.from(new Set(expanded));
|
|
455
|
+
}
|
|
456
|
+
function resolveToolProfilePolicy(profile) {
|
|
457
|
+
return resolveCoreToolProfilePolicy(profile);
|
|
458
|
+
}
|
|
459
|
+
//#endregion
|
|
460
|
+
//#region src/agents/tool-policy.ts
|
|
461
|
+
function wrapOwnerOnlyToolExecution(tool, senderIsOwner) {
|
|
462
|
+
if (tool.ownerOnly !== true || senderIsOwner || !tool.execute) return tool;
|
|
463
|
+
return {
|
|
464
|
+
...tool,
|
|
465
|
+
execute: async () => {
|
|
466
|
+
throw new Error("Tool restricted to owner senders.");
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
const OWNER_ONLY_TOOL_NAME_FALLBACKS = new Set([
|
|
471
|
+
"whatsapp_login",
|
|
472
|
+
"cron",
|
|
473
|
+
"gateway",
|
|
474
|
+
"nodes"
|
|
475
|
+
]);
|
|
476
|
+
function isOwnerOnlyToolName(name) {
|
|
477
|
+
return OWNER_ONLY_TOOL_NAME_FALLBACKS.has(normalizeToolName(name));
|
|
478
|
+
}
|
|
479
|
+
function isOwnerOnlyTool(tool) {
|
|
480
|
+
return tool.ownerOnly === true || isOwnerOnlyToolName(tool.name);
|
|
481
|
+
}
|
|
482
|
+
function applyOwnerOnlyToolPolicy(tools, senderIsOwner) {
|
|
483
|
+
const withGuard = tools.map((tool) => {
|
|
484
|
+
if (!isOwnerOnlyTool(tool)) return tool;
|
|
485
|
+
return wrapOwnerOnlyToolExecution(tool, senderIsOwner);
|
|
486
|
+
});
|
|
487
|
+
if (senderIsOwner) return withGuard;
|
|
488
|
+
return withGuard.filter((tool) => !isOwnerOnlyTool(tool));
|
|
489
|
+
}
|
|
490
|
+
function collectExplicitAllowlist(policies) {
|
|
491
|
+
const entries = [];
|
|
492
|
+
for (const policy of policies) {
|
|
493
|
+
if (!policy?.allow) continue;
|
|
494
|
+
for (const value of policy.allow) {
|
|
495
|
+
if (typeof value !== "string") continue;
|
|
496
|
+
const trimmed = value.trim();
|
|
497
|
+
if (trimmed) entries.push(trimmed);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
return entries;
|
|
501
|
+
}
|
|
502
|
+
function buildPluginToolGroups(params) {
|
|
503
|
+
const all = [];
|
|
504
|
+
const byPlugin = /* @__PURE__ */ new Map();
|
|
505
|
+
for (const tool of params.tools) {
|
|
506
|
+
const meta = params.toolMeta(tool);
|
|
507
|
+
if (!meta) continue;
|
|
508
|
+
const name = normalizeToolName(tool.name);
|
|
509
|
+
all.push(name);
|
|
510
|
+
const pluginId = meta.pluginId.toLowerCase();
|
|
511
|
+
const list = byPlugin.get(pluginId) ?? [];
|
|
512
|
+
list.push(name);
|
|
513
|
+
byPlugin.set(pluginId, list);
|
|
514
|
+
}
|
|
515
|
+
return {
|
|
516
|
+
all,
|
|
517
|
+
byPlugin
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
function expandPluginGroups(list, groups) {
|
|
521
|
+
if (!list || list.length === 0) return list;
|
|
522
|
+
const expanded = [];
|
|
523
|
+
for (const entry of list) {
|
|
524
|
+
const normalized = normalizeToolName(entry);
|
|
525
|
+
if (normalized === "group:plugins") {
|
|
526
|
+
if (groups.all.length > 0) expanded.push(...groups.all);
|
|
527
|
+
else expanded.push(normalized);
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
530
|
+
const tools = groups.byPlugin.get(normalized);
|
|
531
|
+
if (tools && tools.length > 0) {
|
|
532
|
+
expanded.push(...tools);
|
|
533
|
+
continue;
|
|
534
|
+
}
|
|
535
|
+
expanded.push(normalized);
|
|
536
|
+
}
|
|
537
|
+
return Array.from(new Set(expanded));
|
|
538
|
+
}
|
|
539
|
+
function expandPolicyWithPluginGroups(policy, groups) {
|
|
540
|
+
if (!policy) return;
|
|
541
|
+
return {
|
|
542
|
+
allow: expandPluginGroups(policy.allow, groups),
|
|
543
|
+
deny: expandPluginGroups(policy.deny, groups)
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
function stripPluginOnlyAllowlist(policy, groups, coreTools) {
|
|
547
|
+
if (!policy?.allow || policy.allow.length === 0) return {
|
|
548
|
+
policy,
|
|
549
|
+
unknownAllowlist: [],
|
|
550
|
+
strippedAllowlist: false
|
|
551
|
+
};
|
|
552
|
+
const normalized = normalizeToolList(policy.allow);
|
|
553
|
+
if (normalized.length === 0) return {
|
|
554
|
+
policy,
|
|
555
|
+
unknownAllowlist: [],
|
|
556
|
+
strippedAllowlist: false
|
|
557
|
+
};
|
|
558
|
+
const pluginIds = new Set(groups.byPlugin.keys());
|
|
559
|
+
const pluginTools = new Set(groups.all);
|
|
560
|
+
const unknownAllowlist = [];
|
|
561
|
+
let hasCoreEntry = false;
|
|
562
|
+
for (const entry of normalized) {
|
|
563
|
+
if (entry === "*") {
|
|
564
|
+
hasCoreEntry = true;
|
|
565
|
+
continue;
|
|
566
|
+
}
|
|
567
|
+
const isPluginEntry = entry === "group:plugins" || pluginIds.has(entry) || pluginTools.has(entry);
|
|
568
|
+
const isCoreEntry = expandToolGroups([entry]).some((tool) => coreTools.has(tool));
|
|
569
|
+
if (isCoreEntry) hasCoreEntry = true;
|
|
570
|
+
if (!isCoreEntry && !isPluginEntry) unknownAllowlist.push(entry);
|
|
571
|
+
}
|
|
572
|
+
const strippedAllowlist = !hasCoreEntry;
|
|
573
|
+
if (strippedAllowlist) {}
|
|
574
|
+
return {
|
|
575
|
+
policy: strippedAllowlist ? {
|
|
576
|
+
...policy,
|
|
577
|
+
allow: void 0
|
|
578
|
+
} : policy,
|
|
579
|
+
unknownAllowlist: Array.from(new Set(unknownAllowlist)),
|
|
580
|
+
strippedAllowlist
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
function mergeAlsoAllowPolicy(policy, alsoAllow) {
|
|
584
|
+
if (!policy?.allow || !Array.isArray(alsoAllow) || alsoAllow.length === 0) return policy;
|
|
585
|
+
return {
|
|
586
|
+
...policy,
|
|
587
|
+
allow: Array.from(new Set([...policy.allow, ...alsoAllow]))
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
//#endregion
|
|
591
|
+
//#region src/agents/sandbox/tool-policy.ts
|
|
592
|
+
function normalizeGlob(value) {
|
|
593
|
+
return value.trim().toLowerCase();
|
|
594
|
+
}
|
|
595
|
+
function isToolAllowed(policy, name) {
|
|
596
|
+
const normalized = normalizeGlob(name);
|
|
597
|
+
if (matchesAnyGlobPattern(normalized, compileGlobPatterns({
|
|
598
|
+
raw: expandToolGroups(policy.deny ?? []),
|
|
599
|
+
normalize: normalizeGlob
|
|
600
|
+
}))) return false;
|
|
601
|
+
const allow = compileGlobPatterns({
|
|
602
|
+
raw: expandToolGroups(policy.allow ?? []),
|
|
603
|
+
normalize: normalizeGlob
|
|
604
|
+
});
|
|
605
|
+
if (allow.length === 0) return true;
|
|
606
|
+
return matchesAnyGlobPattern(normalized, allow);
|
|
607
|
+
}
|
|
608
|
+
function resolveSandboxToolPolicyForAgent(cfg, agentId) {
|
|
609
|
+
const agentConfig = cfg && agentId ? resolveAgentConfig(cfg, agentId) : void 0;
|
|
610
|
+
const agentAllow = agentConfig?.tools?.sandbox?.tools?.allow;
|
|
611
|
+
const agentDeny = agentConfig?.tools?.sandbox?.tools?.deny;
|
|
612
|
+
const globalAllow = cfg?.tools?.sandbox?.tools?.allow;
|
|
613
|
+
const globalDeny = cfg?.tools?.sandbox?.tools?.deny;
|
|
614
|
+
const allowSource = Array.isArray(agentAllow) ? {
|
|
615
|
+
source: "agent",
|
|
616
|
+
key: "agents.list[].tools.sandbox.tools.allow"
|
|
617
|
+
} : Array.isArray(globalAllow) ? {
|
|
618
|
+
source: "global",
|
|
619
|
+
key: "tools.sandbox.tools.allow"
|
|
620
|
+
} : {
|
|
621
|
+
source: "default",
|
|
622
|
+
key: "tools.sandbox.tools.allow"
|
|
623
|
+
};
|
|
624
|
+
const denySource = Array.isArray(agentDeny) ? {
|
|
625
|
+
source: "agent",
|
|
626
|
+
key: "agents.list[].tools.sandbox.tools.deny"
|
|
627
|
+
} : Array.isArray(globalDeny) ? {
|
|
628
|
+
source: "global",
|
|
629
|
+
key: "tools.sandbox.tools.deny"
|
|
630
|
+
} : {
|
|
631
|
+
source: "default",
|
|
632
|
+
key: "tools.sandbox.tools.deny"
|
|
633
|
+
};
|
|
634
|
+
const deny = Array.isArray(agentDeny) ? agentDeny : Array.isArray(globalDeny) ? globalDeny : [...DEFAULT_TOOL_DENY];
|
|
635
|
+
const allow = Array.isArray(agentAllow) ? agentAllow : Array.isArray(globalAllow) ? globalAllow : [...DEFAULT_TOOL_ALLOW];
|
|
636
|
+
const expandedDeny = expandToolGroups(deny);
|
|
637
|
+
let expandedAllow = expandToolGroups(allow);
|
|
638
|
+
if (expandedAllow.length > 0 && !expandedDeny.map((v) => v.toLowerCase()).includes("image") && !expandedAllow.map((v) => v.toLowerCase()).includes("image")) expandedAllow = [...expandedAllow, "image"];
|
|
639
|
+
return {
|
|
640
|
+
allow: expandedAllow,
|
|
641
|
+
deny: expandedDeny,
|
|
642
|
+
sources: {
|
|
643
|
+
allow: allowSource,
|
|
644
|
+
deny: denySource
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
//#endregion
|
|
649
|
+
//#region src/agents/sandbox/config.ts
|
|
650
|
+
const DANGEROUS_SANDBOX_DOCKER_BOOLEAN_KEYS = [
|
|
651
|
+
"dangerouslyAllowReservedContainerTargets",
|
|
652
|
+
"dangerouslyAllowExternalBindSources",
|
|
653
|
+
"dangerouslyAllowContainerNamespaceJoin"
|
|
654
|
+
];
|
|
655
|
+
const DEFAULT_SANDBOX_SSH_COMMAND = "ssh";
|
|
656
|
+
const DEFAULT_SANDBOX_SSH_WORKSPACE_ROOT = "/tmp/moldclaw-sandboxes";
|
|
657
|
+
function resolveDangerousSandboxDockerBooleans(agentDocker, globalDocker) {
|
|
658
|
+
const resolved = {};
|
|
659
|
+
for (const key of DANGEROUS_SANDBOX_DOCKER_BOOLEAN_KEYS) resolved[key] = agentDocker?.[key] ?? globalDocker?.[key];
|
|
660
|
+
return resolved;
|
|
661
|
+
}
|
|
662
|
+
function resolveSandboxBrowserDockerCreateConfig(params) {
|
|
663
|
+
const browserNetwork = params.browser.network.trim();
|
|
664
|
+
const base = {
|
|
665
|
+
...params.docker,
|
|
666
|
+
network: browserNetwork || "moldclaw-sandbox-browser",
|
|
667
|
+
image: params.browser.image
|
|
668
|
+
};
|
|
669
|
+
return params.browser.binds !== void 0 ? {
|
|
670
|
+
...base,
|
|
671
|
+
binds: params.browser.binds
|
|
672
|
+
} : base;
|
|
673
|
+
}
|
|
674
|
+
function resolveSandboxScope(params) {
|
|
675
|
+
if (params.scope) return params.scope;
|
|
676
|
+
if (typeof params.perSession === "boolean") return params.perSession ? "session" : "shared";
|
|
677
|
+
return "agent";
|
|
678
|
+
}
|
|
679
|
+
function resolveSandboxDockerConfig(params) {
|
|
680
|
+
const agentDocker = params.scope === "shared" ? void 0 : params.agentDocker;
|
|
681
|
+
const globalDocker = params.globalDocker;
|
|
682
|
+
const env = agentDocker?.env ? {
|
|
683
|
+
...globalDocker?.env ?? { LANG: "C.UTF-8" },
|
|
684
|
+
...agentDocker.env
|
|
685
|
+
} : globalDocker?.env ?? { LANG: "C.UTF-8" };
|
|
686
|
+
const ulimits = agentDocker?.ulimits ? {
|
|
687
|
+
...globalDocker?.ulimits,
|
|
688
|
+
...agentDocker.ulimits
|
|
689
|
+
} : globalDocker?.ulimits;
|
|
690
|
+
const binds = [...globalDocker?.binds ?? [], ...agentDocker?.binds ?? []];
|
|
691
|
+
return {
|
|
692
|
+
image: agentDocker?.image ?? globalDocker?.image ?? "moldclaw-sandbox:bookworm-slim",
|
|
693
|
+
containerPrefix: agentDocker?.containerPrefix ?? globalDocker?.containerPrefix ?? "moldclaw-sbx-",
|
|
694
|
+
workdir: agentDocker?.workdir ?? globalDocker?.workdir ?? "/workspace",
|
|
695
|
+
readOnlyRoot: agentDocker?.readOnlyRoot ?? globalDocker?.readOnlyRoot ?? true,
|
|
696
|
+
tmpfs: agentDocker?.tmpfs ?? globalDocker?.tmpfs ?? [
|
|
697
|
+
"/tmp",
|
|
698
|
+
"/var/tmp",
|
|
699
|
+
"/run"
|
|
700
|
+
],
|
|
701
|
+
network: agentDocker?.network ?? globalDocker?.network ?? "none",
|
|
702
|
+
user: agentDocker?.user ?? globalDocker?.user,
|
|
703
|
+
capDrop: agentDocker?.capDrop ?? globalDocker?.capDrop ?? ["ALL"],
|
|
704
|
+
env,
|
|
705
|
+
setupCommand: agentDocker?.setupCommand ?? globalDocker?.setupCommand,
|
|
706
|
+
pidsLimit: agentDocker?.pidsLimit ?? globalDocker?.pidsLimit,
|
|
707
|
+
memory: agentDocker?.memory ?? globalDocker?.memory,
|
|
708
|
+
memorySwap: agentDocker?.memorySwap ?? globalDocker?.memorySwap,
|
|
709
|
+
cpus: agentDocker?.cpus ?? globalDocker?.cpus,
|
|
710
|
+
ulimits,
|
|
711
|
+
seccompProfile: agentDocker?.seccompProfile ?? globalDocker?.seccompProfile,
|
|
712
|
+
apparmorProfile: agentDocker?.apparmorProfile ?? globalDocker?.apparmorProfile,
|
|
713
|
+
dns: agentDocker?.dns ?? globalDocker?.dns,
|
|
714
|
+
extraHosts: agentDocker?.extraHosts ?? globalDocker?.extraHosts,
|
|
715
|
+
binds: binds.length ? binds : void 0,
|
|
716
|
+
...resolveDangerousSandboxDockerBooleans(agentDocker, globalDocker)
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
function resolveSandboxBrowserConfig(params) {
|
|
720
|
+
const agentBrowser = params.scope === "shared" ? void 0 : params.agentBrowser;
|
|
721
|
+
const globalBrowser = params.globalBrowser;
|
|
722
|
+
const binds = [...globalBrowser?.binds ?? [], ...agentBrowser?.binds ?? []];
|
|
723
|
+
const bindsConfigured = globalBrowser?.binds !== void 0 || agentBrowser?.binds !== void 0;
|
|
724
|
+
return {
|
|
725
|
+
enabled: agentBrowser?.enabled ?? globalBrowser?.enabled ?? false,
|
|
726
|
+
image: agentBrowser?.image ?? globalBrowser?.image ?? "moldclaw-sandbox-browser:bookworm-slim",
|
|
727
|
+
containerPrefix: agentBrowser?.containerPrefix ?? globalBrowser?.containerPrefix ?? "moldclaw-sbx-browser-",
|
|
728
|
+
network: agentBrowser?.network ?? globalBrowser?.network ?? "moldclaw-sandbox-browser",
|
|
729
|
+
cdpPort: agentBrowser?.cdpPort ?? globalBrowser?.cdpPort ?? 9222,
|
|
730
|
+
cdpSourceRange: agentBrowser?.cdpSourceRange ?? globalBrowser?.cdpSourceRange,
|
|
731
|
+
vncPort: agentBrowser?.vncPort ?? globalBrowser?.vncPort ?? 5900,
|
|
732
|
+
noVncPort: agentBrowser?.noVncPort ?? globalBrowser?.noVncPort ?? 6080,
|
|
733
|
+
headless: agentBrowser?.headless ?? globalBrowser?.headless ?? false,
|
|
734
|
+
enableNoVnc: agentBrowser?.enableNoVnc ?? globalBrowser?.enableNoVnc ?? true,
|
|
735
|
+
allowHostControl: agentBrowser?.allowHostControl ?? globalBrowser?.allowHostControl ?? false,
|
|
736
|
+
autoStart: agentBrowser?.autoStart ?? globalBrowser?.autoStart ?? true,
|
|
737
|
+
autoStartTimeoutMs: agentBrowser?.autoStartTimeoutMs ?? globalBrowser?.autoStartTimeoutMs ?? 12e3,
|
|
738
|
+
binds: bindsConfigured ? binds : void 0
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
function resolveSandboxPruneConfig(params) {
|
|
742
|
+
const agentPrune = params.scope === "shared" ? void 0 : params.agentPrune;
|
|
743
|
+
const globalPrune = params.globalPrune;
|
|
744
|
+
return {
|
|
745
|
+
idleHours: agentPrune?.idleHours ?? globalPrune?.idleHours ?? 24,
|
|
746
|
+
maxAgeDays: agentPrune?.maxAgeDays ?? globalPrune?.maxAgeDays ?? 7
|
|
747
|
+
};
|
|
748
|
+
}
|
|
749
|
+
function normalizeOptionalString(value) {
|
|
750
|
+
const trimmed = value?.trim();
|
|
751
|
+
return trimmed ? trimmed : void 0;
|
|
752
|
+
}
|
|
753
|
+
function normalizeRemoteRoot(value, fallback) {
|
|
754
|
+
const normalized = normalizeOptionalString(value) ?? fallback;
|
|
755
|
+
const posix = normalized.replaceAll("\\", "/");
|
|
756
|
+
if (!posix.startsWith("/")) throw new Error(`Sandbox SSH workspaceRoot must be an absolute POSIX path: ${normalized}`);
|
|
757
|
+
return posix.replace(/\/+$/g, "") || "/";
|
|
758
|
+
}
|
|
759
|
+
function resolveSandboxSshConfig(params) {
|
|
760
|
+
const agentSsh = params.scope === "shared" ? void 0 : params.agentSsh;
|
|
761
|
+
const globalSsh = params.globalSsh;
|
|
762
|
+
return {
|
|
763
|
+
target: normalizeOptionalString(agentSsh?.target ?? globalSsh?.target),
|
|
764
|
+
command: normalizeOptionalString(agentSsh?.command ?? globalSsh?.command) ?? DEFAULT_SANDBOX_SSH_COMMAND,
|
|
765
|
+
workspaceRoot: normalizeRemoteRoot(agentSsh?.workspaceRoot ?? globalSsh?.workspaceRoot, DEFAULT_SANDBOX_SSH_WORKSPACE_ROOT),
|
|
766
|
+
strictHostKeyChecking: agentSsh?.strictHostKeyChecking ?? globalSsh?.strictHostKeyChecking ?? true,
|
|
767
|
+
updateHostKeys: agentSsh?.updateHostKeys ?? globalSsh?.updateHostKeys ?? true,
|
|
768
|
+
identityFile: normalizeOptionalString(agentSsh?.identityFile ?? globalSsh?.identityFile),
|
|
769
|
+
certificateFile: normalizeOptionalString(agentSsh?.certificateFile ?? globalSsh?.certificateFile),
|
|
770
|
+
knownHostsFile: normalizeOptionalString(agentSsh?.knownHostsFile ?? globalSsh?.knownHostsFile),
|
|
771
|
+
identityData: normalizeSecretInputString(agentSsh?.identityData ?? globalSsh?.identityData),
|
|
772
|
+
certificateData: normalizeSecretInputString(agentSsh?.certificateData ?? globalSsh?.certificateData),
|
|
773
|
+
knownHostsData: normalizeSecretInputString(agentSsh?.knownHostsData ?? globalSsh?.knownHostsData)
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
function resolveSandboxConfigForAgent(cfg, agentId) {
|
|
777
|
+
const agent = cfg?.agents?.defaults?.sandbox;
|
|
778
|
+
let agentSandbox;
|
|
779
|
+
const agentConfig = cfg && agentId ? resolveAgentConfig(cfg, agentId) : void 0;
|
|
780
|
+
if (agentConfig?.sandbox) agentSandbox = agentConfig.sandbox;
|
|
781
|
+
const scope = resolveSandboxScope({
|
|
782
|
+
scope: agentSandbox?.scope ?? agent?.scope,
|
|
783
|
+
perSession: agentSandbox?.perSession ?? agent?.perSession
|
|
784
|
+
});
|
|
785
|
+
const toolPolicy = resolveSandboxToolPolicyForAgent(cfg, agentId);
|
|
786
|
+
return {
|
|
787
|
+
mode: agentSandbox?.mode ?? agent?.mode ?? "off",
|
|
788
|
+
backend: agentSandbox?.backend?.trim() || agent?.backend?.trim() || "docker",
|
|
789
|
+
scope,
|
|
790
|
+
workspaceAccess: agentSandbox?.workspaceAccess ?? agent?.workspaceAccess ?? "none",
|
|
791
|
+
workspaceRoot: agentSandbox?.workspaceRoot ?? agent?.workspaceRoot ?? DEFAULT_SANDBOX_WORKSPACE_ROOT,
|
|
792
|
+
docker: resolveSandboxDockerConfig({
|
|
793
|
+
scope,
|
|
794
|
+
globalDocker: agent?.docker,
|
|
795
|
+
agentDocker: agentSandbox?.docker
|
|
796
|
+
}),
|
|
797
|
+
ssh: resolveSandboxSshConfig({
|
|
798
|
+
scope,
|
|
799
|
+
globalSsh: agent?.ssh,
|
|
800
|
+
agentSsh: agentSandbox?.ssh
|
|
801
|
+
}),
|
|
802
|
+
browser: resolveSandboxBrowserConfig({
|
|
803
|
+
scope,
|
|
804
|
+
globalBrowser: agent?.browser,
|
|
805
|
+
agentBrowser: agentSandbox?.browser
|
|
806
|
+
}),
|
|
807
|
+
tools: {
|
|
808
|
+
allow: toolPolicy.allow,
|
|
809
|
+
deny: toolPolicy.deny
|
|
810
|
+
},
|
|
811
|
+
prune: resolveSandboxPruneConfig({
|
|
812
|
+
scope,
|
|
813
|
+
globalPrune: agent?.prune,
|
|
814
|
+
agentPrune: agentSandbox?.prune
|
|
815
|
+
})
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
//#endregion
|
|
819
|
+
//#region src/agents/sandbox/hash.ts
|
|
820
|
+
function hashTextSha256(value) {
|
|
821
|
+
return crypto.createHash("sha256").update(value).digest("hex");
|
|
822
|
+
}
|
|
823
|
+
//#endregion
|
|
824
|
+
//#region src/agents/sandbox/config-hash.ts
|
|
825
|
+
function normalizeForHash(value) {
|
|
826
|
+
if (value === void 0) return;
|
|
827
|
+
if (Array.isArray(value)) return value.map(normalizeForHash).filter((item) => item !== void 0);
|
|
828
|
+
if (value && typeof value === "object") {
|
|
829
|
+
const entries = Object.entries(value).toSorted(([a], [b]) => a.localeCompare(b));
|
|
830
|
+
const normalized = {};
|
|
831
|
+
for (const [key, entryValue] of entries) {
|
|
832
|
+
const next = normalizeForHash(entryValue);
|
|
833
|
+
if (next !== void 0) normalized[key] = next;
|
|
834
|
+
}
|
|
835
|
+
return normalized;
|
|
836
|
+
}
|
|
837
|
+
return value;
|
|
838
|
+
}
|
|
839
|
+
function computeSandboxConfigHash(input) {
|
|
840
|
+
return computeHash(input);
|
|
841
|
+
}
|
|
842
|
+
function computeSandboxBrowserConfigHash(input) {
|
|
843
|
+
return computeHash(input);
|
|
844
|
+
}
|
|
845
|
+
function computeHash(input) {
|
|
846
|
+
const payload = normalizeForHash(input);
|
|
847
|
+
return hashTextSha256(JSON.stringify(payload));
|
|
848
|
+
}
|
|
849
|
+
//#endregion
|
|
850
|
+
//#region src/agents/session-write-lock.ts
|
|
851
|
+
function isValidLockNumber(value) {
|
|
852
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0;
|
|
853
|
+
}
|
|
854
|
+
const CLEANUP_SIGNALS = [
|
|
855
|
+
"SIGINT",
|
|
856
|
+
"SIGTERM",
|
|
857
|
+
"SIGQUIT",
|
|
858
|
+
"SIGABRT"
|
|
859
|
+
];
|
|
860
|
+
const CLEANUP_STATE_KEY = Symbol.for("moldclaw.sessionWriteLockCleanupState");
|
|
861
|
+
const HELD_LOCKS_KEY = Symbol.for("moldclaw.sessionWriteLockHeldLocks");
|
|
862
|
+
const WATCHDOG_STATE_KEY = Symbol.for("moldclaw.sessionWriteLockWatchdogState");
|
|
863
|
+
const DEFAULT_STALE_MS = 1800 * 1e3;
|
|
864
|
+
const DEFAULT_MAX_HOLD_MS = 300 * 1e3;
|
|
865
|
+
const DEFAULT_WATCHDOG_INTERVAL_MS = 6e4;
|
|
866
|
+
const DEFAULT_TIMEOUT_GRACE_MS = 120 * 1e3;
|
|
867
|
+
const MAX_LOCK_HOLD_MS = 2147e6;
|
|
868
|
+
const HELD_LOCKS = resolveProcessScopedMap(HELD_LOCKS_KEY);
|
|
869
|
+
function resolveCleanupState() {
|
|
870
|
+
const proc = process;
|
|
871
|
+
if (!proc[CLEANUP_STATE_KEY]) proc[CLEANUP_STATE_KEY] = {
|
|
872
|
+
registered: false,
|
|
873
|
+
cleanupHandlers: /* @__PURE__ */ new Map()
|
|
874
|
+
};
|
|
875
|
+
return proc[CLEANUP_STATE_KEY];
|
|
876
|
+
}
|
|
877
|
+
function resolveWatchdogState() {
|
|
878
|
+
const proc = process;
|
|
879
|
+
if (!proc[WATCHDOG_STATE_KEY]) proc[WATCHDOG_STATE_KEY] = {
|
|
880
|
+
started: false,
|
|
881
|
+
intervalMs: DEFAULT_WATCHDOG_INTERVAL_MS
|
|
882
|
+
};
|
|
883
|
+
return proc[WATCHDOG_STATE_KEY];
|
|
884
|
+
}
|
|
885
|
+
function resolvePositiveMs(value, fallback, opts = {}) {
|
|
886
|
+
if (typeof value !== "number" || Number.isNaN(value) || value <= 0) return fallback;
|
|
887
|
+
if (value === Number.POSITIVE_INFINITY) return opts.allowInfinity ? value : fallback;
|
|
888
|
+
if (!Number.isFinite(value)) return fallback;
|
|
889
|
+
return value;
|
|
890
|
+
}
|
|
891
|
+
function resolveSessionLockMaxHoldFromTimeout(params) {
|
|
892
|
+
const minMs = resolvePositiveMs(params.minMs, DEFAULT_MAX_HOLD_MS);
|
|
893
|
+
const timeoutMs = resolvePositiveMs(params.timeoutMs, minMs, { allowInfinity: true });
|
|
894
|
+
if (timeoutMs === Number.POSITIVE_INFINITY) return MAX_LOCK_HOLD_MS;
|
|
895
|
+
const graceMs = resolvePositiveMs(params.graceMs, DEFAULT_TIMEOUT_GRACE_MS);
|
|
896
|
+
return Math.min(MAX_LOCK_HOLD_MS, Math.max(minMs, timeoutMs + graceMs));
|
|
897
|
+
}
|
|
898
|
+
async function releaseHeldLock(normalizedSessionFile, held, opts = {}) {
|
|
899
|
+
if (HELD_LOCKS.get(normalizedSessionFile) !== held) return false;
|
|
900
|
+
if (opts.force) held.count = 0;
|
|
901
|
+
else {
|
|
902
|
+
held.count -= 1;
|
|
903
|
+
if (held.count > 0) return false;
|
|
904
|
+
}
|
|
905
|
+
if (held.releasePromise) {
|
|
906
|
+
await held.releasePromise.catch(() => void 0);
|
|
907
|
+
return true;
|
|
908
|
+
}
|
|
909
|
+
HELD_LOCKS.delete(normalizedSessionFile);
|
|
910
|
+
held.releasePromise = (async () => {
|
|
911
|
+
try {
|
|
912
|
+
await held.handle.close();
|
|
913
|
+
} catch {}
|
|
914
|
+
try {
|
|
915
|
+
await fs$1.rm(held.lockPath, { force: true });
|
|
916
|
+
} catch {}
|
|
917
|
+
})();
|
|
918
|
+
try {
|
|
919
|
+
await held.releasePromise;
|
|
920
|
+
return true;
|
|
921
|
+
} finally {
|
|
922
|
+
held.releasePromise = void 0;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Synchronously release all held locks.
|
|
927
|
+
* Used during process exit when async operations aren't reliable.
|
|
928
|
+
*/
|
|
929
|
+
function releaseAllLocksSync() {
|
|
930
|
+
for (const [sessionFile, held] of HELD_LOCKS) {
|
|
931
|
+
try {
|
|
932
|
+
if (typeof held.handle.close === "function") held.handle.close().catch(() => {});
|
|
933
|
+
} catch {}
|
|
934
|
+
try {
|
|
935
|
+
fs.rmSync(held.lockPath, { force: true });
|
|
936
|
+
} catch {}
|
|
937
|
+
HELD_LOCKS.delete(sessionFile);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
async function runLockWatchdogCheck(nowMs = Date.now()) {
|
|
941
|
+
let released = 0;
|
|
942
|
+
for (const [sessionFile, held] of HELD_LOCKS.entries()) {
|
|
943
|
+
const heldForMs = nowMs - held.acquiredAt;
|
|
944
|
+
if (heldForMs <= held.maxHoldMs) continue;
|
|
945
|
+
console.warn(`[session-write-lock] releasing lock held for ${heldForMs}ms (max=${held.maxHoldMs}ms): ${held.lockPath}`);
|
|
946
|
+
if (await releaseHeldLock(sessionFile, held, { force: true })) released += 1;
|
|
947
|
+
}
|
|
948
|
+
return released;
|
|
949
|
+
}
|
|
950
|
+
function ensureWatchdogStarted(intervalMs) {
|
|
951
|
+
const watchdogState = resolveWatchdogState();
|
|
952
|
+
if (watchdogState.started) return;
|
|
953
|
+
watchdogState.started = true;
|
|
954
|
+
watchdogState.intervalMs = intervalMs;
|
|
955
|
+
watchdogState.timer = setInterval(() => {
|
|
956
|
+
runLockWatchdogCheck().catch(() => {});
|
|
957
|
+
}, intervalMs);
|
|
958
|
+
watchdogState.timer.unref?.();
|
|
959
|
+
}
|
|
960
|
+
function handleTerminationSignal(signal) {
|
|
961
|
+
releaseAllLocksSync();
|
|
962
|
+
const cleanupState = resolveCleanupState();
|
|
963
|
+
if (process.listenerCount(signal) === 1) {
|
|
964
|
+
const handler = cleanupState.cleanupHandlers.get(signal);
|
|
965
|
+
if (handler) {
|
|
966
|
+
process.off(signal, handler);
|
|
967
|
+
cleanupState.cleanupHandlers.delete(signal);
|
|
968
|
+
}
|
|
969
|
+
try {
|
|
970
|
+
process.kill(process.pid, signal);
|
|
971
|
+
} catch {}
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
function registerCleanupHandlers() {
|
|
975
|
+
const cleanupState = resolveCleanupState();
|
|
976
|
+
if (!cleanupState.registered) {
|
|
977
|
+
cleanupState.registered = true;
|
|
978
|
+
process.on("exit", () => {
|
|
979
|
+
releaseAllLocksSync();
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
ensureWatchdogStarted(DEFAULT_WATCHDOG_INTERVAL_MS);
|
|
983
|
+
for (const signal of CLEANUP_SIGNALS) {
|
|
984
|
+
if (cleanupState.cleanupHandlers.has(signal)) continue;
|
|
985
|
+
try {
|
|
986
|
+
const handler = () => handleTerminationSignal(signal);
|
|
987
|
+
cleanupState.cleanupHandlers.set(signal, handler);
|
|
988
|
+
process.on(signal, handler);
|
|
989
|
+
} catch {}
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
async function readLockPayload(lockPath) {
|
|
993
|
+
try {
|
|
994
|
+
const raw = await fs$1.readFile(lockPath, "utf8");
|
|
995
|
+
const parsed = JSON.parse(raw);
|
|
996
|
+
const payload = {};
|
|
997
|
+
if (isValidLockNumber(parsed.pid) && parsed.pid > 0) payload.pid = parsed.pid;
|
|
998
|
+
if (typeof parsed.createdAt === "string") payload.createdAt = parsed.createdAt;
|
|
999
|
+
if (isValidLockNumber(parsed.starttime)) payload.starttime = parsed.starttime;
|
|
1000
|
+
return payload;
|
|
1001
|
+
} catch {
|
|
1002
|
+
return null;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
function inspectLockPayload(payload, staleMs, nowMs) {
|
|
1006
|
+
const pid = isValidLockNumber(payload?.pid) && payload.pid > 0 ? payload.pid : null;
|
|
1007
|
+
const pidAlive = pid !== null ? isPidAlive(pid) : false;
|
|
1008
|
+
const createdAt = typeof payload?.createdAt === "string" ? payload.createdAt : null;
|
|
1009
|
+
const createdAtMs = createdAt ? Date.parse(createdAt) : NaN;
|
|
1010
|
+
const ageMs = Number.isFinite(createdAtMs) ? Math.max(0, nowMs - createdAtMs) : null;
|
|
1011
|
+
const storedStarttime = isValidLockNumber(payload?.starttime) ? payload.starttime : null;
|
|
1012
|
+
const pidRecycled = pidAlive && pid !== null && storedStarttime !== null ? (() => {
|
|
1013
|
+
const currentStarttime = getProcessStartTime(pid);
|
|
1014
|
+
return currentStarttime !== null && currentStarttime !== storedStarttime;
|
|
1015
|
+
})() : false;
|
|
1016
|
+
const staleReasons = [];
|
|
1017
|
+
if (pid === null) staleReasons.push("missing-pid");
|
|
1018
|
+
else if (!pidAlive) staleReasons.push("dead-pid");
|
|
1019
|
+
else if (pidRecycled) staleReasons.push("recycled-pid");
|
|
1020
|
+
if (ageMs === null) staleReasons.push("invalid-createdAt");
|
|
1021
|
+
else if (ageMs > staleMs) staleReasons.push("too-old");
|
|
1022
|
+
return {
|
|
1023
|
+
pid,
|
|
1024
|
+
pidAlive,
|
|
1025
|
+
createdAt,
|
|
1026
|
+
ageMs,
|
|
1027
|
+
stale: staleReasons.length > 0,
|
|
1028
|
+
staleReasons
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
function lockInspectionNeedsMtimeStaleFallback(details) {
|
|
1032
|
+
return details.stale && details.staleReasons.every((reason) => reason === "missing-pid" || reason === "invalid-createdAt");
|
|
1033
|
+
}
|
|
1034
|
+
async function shouldReclaimContendedLockFile(lockPath, details, staleMs, nowMs) {
|
|
1035
|
+
if (!details.stale) return false;
|
|
1036
|
+
if (!lockInspectionNeedsMtimeStaleFallback(details)) return true;
|
|
1037
|
+
try {
|
|
1038
|
+
const stat = await fs$1.stat(lockPath);
|
|
1039
|
+
return Math.max(0, nowMs - stat.mtimeMs) > staleMs;
|
|
1040
|
+
} catch (error) {
|
|
1041
|
+
return error?.code !== "ENOENT";
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
function shouldTreatAsOrphanSelfLock(params) {
|
|
1045
|
+
if ((isValidLockNumber(params.payload?.pid) ? params.payload.pid : null) !== process.pid) return false;
|
|
1046
|
+
if (isValidLockNumber(params.payload?.starttime)) return false;
|
|
1047
|
+
return !HELD_LOCKS.has(params.normalizedSessionFile);
|
|
1048
|
+
}
|
|
1049
|
+
async function cleanStaleLockFiles(params) {
|
|
1050
|
+
const sessionsDir = path.resolve(params.sessionsDir);
|
|
1051
|
+
const staleMs = resolvePositiveMs(params.staleMs, DEFAULT_STALE_MS);
|
|
1052
|
+
const removeStale = params.removeStale !== false;
|
|
1053
|
+
const nowMs = params.nowMs ?? Date.now();
|
|
1054
|
+
let entries = [];
|
|
1055
|
+
try {
|
|
1056
|
+
entries = await fs$1.readdir(sessionsDir, { withFileTypes: true });
|
|
1057
|
+
} catch (err) {
|
|
1058
|
+
if (err.code === "ENOENT") return {
|
|
1059
|
+
locks: [],
|
|
1060
|
+
cleaned: []
|
|
1061
|
+
};
|
|
1062
|
+
throw err;
|
|
1063
|
+
}
|
|
1064
|
+
const locks = [];
|
|
1065
|
+
const cleaned = [];
|
|
1066
|
+
const lockEntries = entries.filter((entry) => entry.name.endsWith(".jsonl.lock")).toSorted((a, b) => a.name.localeCompare(b.name));
|
|
1067
|
+
for (const entry of lockEntries) {
|
|
1068
|
+
const lockPath = path.join(sessionsDir, entry.name);
|
|
1069
|
+
const lockInfo = {
|
|
1070
|
+
lockPath,
|
|
1071
|
+
...inspectLockPayload(await readLockPayload(lockPath), staleMs, nowMs),
|
|
1072
|
+
removed: false
|
|
1073
|
+
};
|
|
1074
|
+
if (lockInfo.stale && removeStale) {
|
|
1075
|
+
await fs$1.rm(lockPath, { force: true });
|
|
1076
|
+
lockInfo.removed = true;
|
|
1077
|
+
cleaned.push(lockInfo);
|
|
1078
|
+
params.log?.warn?.(`removed stale session lock: ${lockPath} (${lockInfo.staleReasons.join(", ") || "unknown"})`);
|
|
1079
|
+
}
|
|
1080
|
+
locks.push(lockInfo);
|
|
1081
|
+
}
|
|
1082
|
+
return {
|
|
1083
|
+
locks,
|
|
1084
|
+
cleaned
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
async function acquireSessionWriteLock(params) {
|
|
1088
|
+
registerCleanupHandlers();
|
|
1089
|
+
const timeoutMs = resolvePositiveMs(params.timeoutMs, 1e4, { allowInfinity: true });
|
|
1090
|
+
const staleMs = resolvePositiveMs(params.staleMs, DEFAULT_STALE_MS);
|
|
1091
|
+
const maxHoldMs = resolvePositiveMs(params.maxHoldMs, DEFAULT_MAX_HOLD_MS);
|
|
1092
|
+
const sessionFile = path.resolve(params.sessionFile);
|
|
1093
|
+
const sessionDir = path.dirname(sessionFile);
|
|
1094
|
+
await fs$1.mkdir(sessionDir, { recursive: true });
|
|
1095
|
+
let normalizedDir = sessionDir;
|
|
1096
|
+
try {
|
|
1097
|
+
normalizedDir = await fs$1.realpath(sessionDir);
|
|
1098
|
+
} catch {}
|
|
1099
|
+
const normalizedSessionFile = path.join(normalizedDir, path.basename(sessionFile));
|
|
1100
|
+
const lockPath = `${normalizedSessionFile}.lock`;
|
|
1101
|
+
const allowReentrant = params.allowReentrant ?? true;
|
|
1102
|
+
const held = HELD_LOCKS.get(normalizedSessionFile);
|
|
1103
|
+
if (allowReentrant && held) {
|
|
1104
|
+
held.count += 1;
|
|
1105
|
+
return { release: async () => {
|
|
1106
|
+
await releaseHeldLock(normalizedSessionFile, held);
|
|
1107
|
+
} };
|
|
1108
|
+
}
|
|
1109
|
+
const startedAt = Date.now();
|
|
1110
|
+
let attempt = 0;
|
|
1111
|
+
while (Date.now() - startedAt < timeoutMs) {
|
|
1112
|
+
attempt += 1;
|
|
1113
|
+
let handle = null;
|
|
1114
|
+
try {
|
|
1115
|
+
handle = await fs$1.open(lockPath, "wx");
|
|
1116
|
+
const createdAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1117
|
+
const starttime = getProcessStartTime(process.pid);
|
|
1118
|
+
const lockPayload = {
|
|
1119
|
+
pid: process.pid,
|
|
1120
|
+
createdAt
|
|
1121
|
+
};
|
|
1122
|
+
if (starttime !== null) lockPayload.starttime = starttime;
|
|
1123
|
+
await handle.writeFile(JSON.stringify(lockPayload, null, 2), "utf8");
|
|
1124
|
+
const createdHeld = {
|
|
1125
|
+
count: 1,
|
|
1126
|
+
handle,
|
|
1127
|
+
lockPath,
|
|
1128
|
+
acquiredAt: Date.now(),
|
|
1129
|
+
maxHoldMs
|
|
1130
|
+
};
|
|
1131
|
+
HELD_LOCKS.set(normalizedSessionFile, createdHeld);
|
|
1132
|
+
return { release: async () => {
|
|
1133
|
+
await releaseHeldLock(normalizedSessionFile, createdHeld);
|
|
1134
|
+
} };
|
|
1135
|
+
} catch (err) {
|
|
1136
|
+
if (handle) {
|
|
1137
|
+
try {
|
|
1138
|
+
await handle.close();
|
|
1139
|
+
} catch {}
|
|
1140
|
+
try {
|
|
1141
|
+
await fs$1.rm(lockPath, { force: true });
|
|
1142
|
+
} catch {}
|
|
1143
|
+
}
|
|
1144
|
+
if (err.code !== "EEXIST") throw err;
|
|
1145
|
+
const payload = await readLockPayload(lockPath);
|
|
1146
|
+
const nowMs = Date.now();
|
|
1147
|
+
const inspected = inspectLockPayload(payload, staleMs, nowMs);
|
|
1148
|
+
if (await shouldReclaimContendedLockFile(lockPath, shouldTreatAsOrphanSelfLock({
|
|
1149
|
+
payload,
|
|
1150
|
+
normalizedSessionFile
|
|
1151
|
+
}) ? {
|
|
1152
|
+
...inspected,
|
|
1153
|
+
stale: true,
|
|
1154
|
+
staleReasons: inspected.staleReasons.includes("orphan-self-pid") ? inspected.staleReasons : [...inspected.staleReasons, "orphan-self-pid"]
|
|
1155
|
+
} : inspected, staleMs, nowMs)) {
|
|
1156
|
+
await fs$1.rm(lockPath, { force: true });
|
|
1157
|
+
continue;
|
|
1158
|
+
}
|
|
1159
|
+
const delay = Math.min(1e3, 50 * attempt);
|
|
1160
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
const payload = await readLockPayload(lockPath);
|
|
1164
|
+
const owner = typeof payload?.pid === "number" ? `pid=${payload.pid}` : "unknown";
|
|
1165
|
+
throw new Error(`session file locked (timeout ${timeoutMs}ms): ${owner} ${lockPath}`);
|
|
1166
|
+
}
|
|
1167
|
+
[...CLEANUP_SIGNALS];
|
|
1168
|
+
//#endregion
|
|
1169
|
+
//#region src/agents/sandbox/registry.ts
|
|
1170
|
+
function isRecord(value) {
|
|
1171
|
+
return Boolean(value) && typeof value === "object";
|
|
1172
|
+
}
|
|
1173
|
+
function isRegistryEntry(value) {
|
|
1174
|
+
return isRecord(value) && typeof value.containerName === "string";
|
|
1175
|
+
}
|
|
1176
|
+
function normalizeSandboxRegistryEntry(entry) {
|
|
1177
|
+
return {
|
|
1178
|
+
...entry,
|
|
1179
|
+
backendId: entry.backendId?.trim() || "docker",
|
|
1180
|
+
runtimeLabel: entry.runtimeLabel?.trim() || entry.containerName,
|
|
1181
|
+
configLabelKind: entry.configLabelKind?.trim() || "Image"
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
function isRegistryFile(value) {
|
|
1185
|
+
if (!isRecord(value)) return false;
|
|
1186
|
+
const maybeEntries = value.entries;
|
|
1187
|
+
return Array.isArray(maybeEntries) && maybeEntries.every(isRegistryEntry);
|
|
1188
|
+
}
|
|
1189
|
+
async function withRegistryLock(registryPath, fn) {
|
|
1190
|
+
const lock = await acquireSessionWriteLock({
|
|
1191
|
+
sessionFile: registryPath,
|
|
1192
|
+
allowReentrant: false
|
|
1193
|
+
});
|
|
1194
|
+
try {
|
|
1195
|
+
return await fn();
|
|
1196
|
+
} finally {
|
|
1197
|
+
await lock.release();
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
async function readRegistryFromFile(registryPath, mode) {
|
|
1201
|
+
try {
|
|
1202
|
+
const raw = await fs$1.readFile(registryPath, "utf-8");
|
|
1203
|
+
const parsed = JSON.parse(raw);
|
|
1204
|
+
if (isRegistryFile(parsed)) return parsed;
|
|
1205
|
+
if (mode === "fallback") return { entries: [] };
|
|
1206
|
+
throw new Error(`Invalid sandbox registry format: ${registryPath}`);
|
|
1207
|
+
} catch (error) {
|
|
1208
|
+
if (error?.code === "ENOENT") return { entries: [] };
|
|
1209
|
+
if (mode === "fallback") return { entries: [] };
|
|
1210
|
+
if (error instanceof Error) throw error;
|
|
1211
|
+
throw new Error(`Failed to read sandbox registry file: ${registryPath}`, { cause: error });
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
async function writeRegistryFile(registryPath, registry) {
|
|
1215
|
+
await writeJsonAtomic(registryPath, registry, { trailingNewline: true });
|
|
1216
|
+
}
|
|
1217
|
+
async function readRegistry() {
|
|
1218
|
+
return { entries: (await readRegistryFromFile(SANDBOX_REGISTRY_PATH, "fallback")).entries.map((entry) => normalizeSandboxRegistryEntry(entry)) };
|
|
1219
|
+
}
|
|
1220
|
+
function upsertEntry(entries, entry) {
|
|
1221
|
+
const existing = entries.find((item) => item.containerName === entry.containerName);
|
|
1222
|
+
const next = entries.filter((item) => item.containerName !== entry.containerName);
|
|
1223
|
+
next.push({
|
|
1224
|
+
...entry,
|
|
1225
|
+
backendId: entry.backendId ?? existing?.backendId,
|
|
1226
|
+
runtimeLabel: entry.runtimeLabel ?? existing?.runtimeLabel,
|
|
1227
|
+
createdAtMs: existing?.createdAtMs ?? entry.createdAtMs,
|
|
1228
|
+
image: existing?.image ?? entry.image,
|
|
1229
|
+
configLabelKind: entry.configLabelKind ?? existing?.configLabelKind,
|
|
1230
|
+
configHash: entry.configHash ?? existing?.configHash
|
|
1231
|
+
});
|
|
1232
|
+
return next;
|
|
1233
|
+
}
|
|
1234
|
+
function removeEntry(entries, containerName) {
|
|
1235
|
+
return entries.filter((entry) => entry.containerName !== containerName);
|
|
1236
|
+
}
|
|
1237
|
+
async function withRegistryMutation(registryPath, mutate) {
|
|
1238
|
+
await withRegistryLock(registryPath, async () => {
|
|
1239
|
+
const next = mutate((await readRegistryFromFile(registryPath, "strict")).entries);
|
|
1240
|
+
if (next === null) return;
|
|
1241
|
+
await writeRegistryFile(registryPath, { entries: next });
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
async function updateRegistry(entry) {
|
|
1245
|
+
await withRegistryMutation(SANDBOX_REGISTRY_PATH, (entries) => upsertEntry(entries, entry));
|
|
1246
|
+
}
|
|
1247
|
+
async function removeRegistryEntry(containerName) {
|
|
1248
|
+
await withRegistryMutation(SANDBOX_REGISTRY_PATH, (entries) => {
|
|
1249
|
+
const next = removeEntry(entries, containerName);
|
|
1250
|
+
if (next.length === entries.length) return null;
|
|
1251
|
+
return next;
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1254
|
+
async function readBrowserRegistry() {
|
|
1255
|
+
return await readRegistryFromFile(SANDBOX_BROWSER_REGISTRY_PATH, "fallback");
|
|
1256
|
+
}
|
|
1257
|
+
async function updateBrowserRegistry(entry) {
|
|
1258
|
+
await withRegistryMutation(SANDBOX_BROWSER_REGISTRY_PATH, (entries) => upsertEntry(entries, entry));
|
|
1259
|
+
}
|
|
1260
|
+
async function removeBrowserRegistryEntry(containerName) {
|
|
1261
|
+
await withRegistryMutation(SANDBOX_BROWSER_REGISTRY_PATH, (entries) => {
|
|
1262
|
+
const next = removeEntry(entries, containerName);
|
|
1263
|
+
if (next.length === entries.length) return null;
|
|
1264
|
+
return next;
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
//#endregion
|
|
1268
|
+
//#region src/agents/sandbox/shared.ts
|
|
1269
|
+
function slugifySessionKey(value) {
|
|
1270
|
+
const trimmed = value.trim() || "session";
|
|
1271
|
+
const hash = hashTextSha256(trimmed).slice(0, 8);
|
|
1272
|
+
return `${trimmed.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 32) || "session"}-${hash}`;
|
|
1273
|
+
}
|
|
1274
|
+
function resolveSandboxWorkspaceDir(root, sessionKey) {
|
|
1275
|
+
const resolvedRoot = resolveUserPath(root);
|
|
1276
|
+
const slug = slugifySessionKey(sessionKey);
|
|
1277
|
+
return path.join(resolvedRoot, slug);
|
|
1278
|
+
}
|
|
1279
|
+
function resolveSandboxScopeKey(scope, sessionKey) {
|
|
1280
|
+
const trimmed = sessionKey.trim() || "main";
|
|
1281
|
+
if (scope === "shared") return "shared";
|
|
1282
|
+
if (scope === "session") return trimmed;
|
|
1283
|
+
return `agent:${resolveAgentIdFromSessionKey(trimmed)}`;
|
|
1284
|
+
}
|
|
1285
|
+
function resolveSandboxAgentId(scopeKey) {
|
|
1286
|
+
const trimmed = scopeKey.trim();
|
|
1287
|
+
if (!trimmed || trimmed === "shared") return;
|
|
1288
|
+
const parts = trimmed.split(":").filter(Boolean);
|
|
1289
|
+
if (parts[0] === "agent" && parts[1]) return normalizeAgentId(parts[1]);
|
|
1290
|
+
return resolveAgentIdFromSessionKey(trimmed);
|
|
1291
|
+
}
|
|
1292
|
+
//#endregion
|
|
1293
|
+
//#region src/agents/sandbox/bind-spec.ts
|
|
1294
|
+
function splitSandboxBindSpec(spec) {
|
|
1295
|
+
const separator = getHostContainerSeparatorIndex(spec);
|
|
1296
|
+
if (separator === -1) return null;
|
|
1297
|
+
const host = spec.slice(0, separator);
|
|
1298
|
+
const rest = spec.slice(separator + 1);
|
|
1299
|
+
const optionsStart = rest.indexOf(":");
|
|
1300
|
+
if (optionsStart === -1) return {
|
|
1301
|
+
host,
|
|
1302
|
+
container: rest,
|
|
1303
|
+
options: ""
|
|
1304
|
+
};
|
|
1305
|
+
return {
|
|
1306
|
+
host,
|
|
1307
|
+
container: rest.slice(0, optionsStart),
|
|
1308
|
+
options: rest.slice(optionsStart + 1)
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
function getHostContainerSeparatorIndex(spec) {
|
|
1312
|
+
const hasDriveLetterPrefix = /^[A-Za-z]:[\\/]/.test(spec);
|
|
1313
|
+
for (let i = hasDriveLetterPrefix ? 2 : 0; i < spec.length; i += 1) if (spec[i] === ":") return i;
|
|
1314
|
+
return -1;
|
|
1315
|
+
}
|
|
1316
|
+
//#endregion
|
|
1317
|
+
//#region src/agents/sandbox/host-paths.ts
|
|
1318
|
+
function stripWindowsNamespacePrefix(input) {
|
|
1319
|
+
if (input.startsWith("\\\\?\\")) {
|
|
1320
|
+
const withoutPrefix = input.slice(4);
|
|
1321
|
+
if (withoutPrefix.toUpperCase().startsWith("UNC\\")) return `\\\\${withoutPrefix.slice(4)}`;
|
|
1322
|
+
return withoutPrefix;
|
|
1323
|
+
}
|
|
1324
|
+
if (input.startsWith("//?/")) {
|
|
1325
|
+
const withoutPrefix = input.slice(4);
|
|
1326
|
+
if (withoutPrefix.toUpperCase().startsWith("UNC/")) return `//${withoutPrefix.slice(4)}`;
|
|
1327
|
+
return withoutPrefix;
|
|
1328
|
+
}
|
|
1329
|
+
return input;
|
|
1330
|
+
}
|
|
1331
|
+
/**
|
|
1332
|
+
* Normalize a POSIX host path: resolve `.`, `..`, collapse `//`, strip trailing `/`.
|
|
1333
|
+
*/
|
|
1334
|
+
function normalizeSandboxHostPath(raw) {
|
|
1335
|
+
const trimmed = stripWindowsNamespacePrefix(raw.trim());
|
|
1336
|
+
if (!trimmed) return "/";
|
|
1337
|
+
return posix.normalize(trimmed.replaceAll("\\", "/")).replace(/\/+$/, "") || "/";
|
|
1338
|
+
}
|
|
1339
|
+
/**
|
|
1340
|
+
* Resolve a path through the deepest existing ancestor so parent symlinks are honored
|
|
1341
|
+
* even when the final source leaf does not exist yet.
|
|
1342
|
+
*/
|
|
1343
|
+
function resolveSandboxHostPathViaExistingAncestor(sourcePath) {
|
|
1344
|
+
if (!sourcePath.startsWith("/")) return sourcePath;
|
|
1345
|
+
return normalizeSandboxHostPath(resolvePathViaExistingAncestorSync(sourcePath));
|
|
1346
|
+
}
|
|
1347
|
+
//#endregion
|
|
1348
|
+
//#region src/agents/sandbox/validate-sandbox-security.ts
|
|
1349
|
+
/**
|
|
1350
|
+
* Sandbox security validation — blocks dangerous Docker configurations.
|
|
1351
|
+
*
|
|
1352
|
+
* Threat model: local-trusted config, but protect against foot-guns and config injection.
|
|
1353
|
+
* Enforced at runtime when creating sandbox containers.
|
|
1354
|
+
*/
|
|
1355
|
+
const BLOCKED_HOST_PATHS = [
|
|
1356
|
+
"/etc",
|
|
1357
|
+
"/private/etc",
|
|
1358
|
+
"/proc",
|
|
1359
|
+
"/sys",
|
|
1360
|
+
"/dev",
|
|
1361
|
+
"/root",
|
|
1362
|
+
"/boot",
|
|
1363
|
+
"/run",
|
|
1364
|
+
"/var/run",
|
|
1365
|
+
"/private/var/run",
|
|
1366
|
+
"/var/run/docker.sock",
|
|
1367
|
+
"/private/var/run/docker.sock",
|
|
1368
|
+
"/run/docker.sock"
|
|
1369
|
+
];
|
|
1370
|
+
const BLOCKED_SECCOMP_PROFILES = new Set(["unconfined"]);
|
|
1371
|
+
const BLOCKED_APPARMOR_PROFILES = new Set(["unconfined"]);
|
|
1372
|
+
const RESERVED_CONTAINER_TARGET_PATHS = ["/workspace", SANDBOX_AGENT_WORKSPACE_MOUNT];
|
|
1373
|
+
function parseBindSpec(bind) {
|
|
1374
|
+
const trimmed = bind.trim();
|
|
1375
|
+
const parsed = splitSandboxBindSpec(trimmed);
|
|
1376
|
+
if (!parsed) return {
|
|
1377
|
+
source: trimmed,
|
|
1378
|
+
target: ""
|
|
1379
|
+
};
|
|
1380
|
+
return {
|
|
1381
|
+
source: parsed.host,
|
|
1382
|
+
target: parsed.container
|
|
1383
|
+
};
|
|
1384
|
+
}
|
|
1385
|
+
/**
|
|
1386
|
+
* Parse the host/source path from a Docker bind mount string.
|
|
1387
|
+
* Format: `source:target[:mode]`
|
|
1388
|
+
*/
|
|
1389
|
+
function parseBindSourcePath(bind) {
|
|
1390
|
+
return parseBindSpec(bind).source.trim();
|
|
1391
|
+
}
|
|
1392
|
+
function parseBindTargetPath(bind) {
|
|
1393
|
+
return parseBindSpec(bind).target.trim();
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* Normalize a POSIX path: resolve `.`, `..`, collapse `//`, strip trailing `/`.
|
|
1397
|
+
*/
|
|
1398
|
+
function normalizeHostPath(raw) {
|
|
1399
|
+
return normalizeSandboxHostPath(raw);
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* String-only blocked-path check (no filesystem I/O).
|
|
1403
|
+
* Blocks:
|
|
1404
|
+
* - binds that target blocked paths (equal or under)
|
|
1405
|
+
* - binds that cover the system root (mounting "/" is never safe)
|
|
1406
|
+
* - non-absolute source paths (relative / volume names) because they are hard to validate safely
|
|
1407
|
+
*/
|
|
1408
|
+
function getBlockedBindReason(bind) {
|
|
1409
|
+
const sourceRaw = parseBindSourcePath(bind);
|
|
1410
|
+
if (!sourceRaw.startsWith("/")) return {
|
|
1411
|
+
kind: "non_absolute",
|
|
1412
|
+
sourcePath: sourceRaw
|
|
1413
|
+
};
|
|
1414
|
+
return getBlockedReasonForSourcePath(normalizeHostPath(sourceRaw));
|
|
1415
|
+
}
|
|
1416
|
+
function getBlockedReasonForSourcePath(sourceNormalized) {
|
|
1417
|
+
if (sourceNormalized === "/") return {
|
|
1418
|
+
kind: "covers",
|
|
1419
|
+
blockedPath: "/"
|
|
1420
|
+
};
|
|
1421
|
+
for (const blocked of BLOCKED_HOST_PATHS) if (sourceNormalized === blocked || sourceNormalized.startsWith(blocked + "/")) return {
|
|
1422
|
+
kind: "targets",
|
|
1423
|
+
blockedPath: blocked
|
|
1424
|
+
};
|
|
1425
|
+
return null;
|
|
1426
|
+
}
|
|
1427
|
+
function normalizeAllowedRoots(roots) {
|
|
1428
|
+
if (!roots?.length) return [];
|
|
1429
|
+
const normalized = roots.map((entry) => entry.trim()).filter((entry) => entry.startsWith("/")).map(normalizeHostPath);
|
|
1430
|
+
const expanded = /* @__PURE__ */ new Set();
|
|
1431
|
+
for (const root of normalized) {
|
|
1432
|
+
expanded.add(root);
|
|
1433
|
+
const real = resolveSandboxHostPathViaExistingAncestor(root);
|
|
1434
|
+
if (real !== root) expanded.add(real);
|
|
1435
|
+
}
|
|
1436
|
+
return [...expanded];
|
|
1437
|
+
}
|
|
1438
|
+
function isPathInsidePosix(root, target) {
|
|
1439
|
+
if (root === "/") return true;
|
|
1440
|
+
return target === root || target.startsWith(`${root}/`);
|
|
1441
|
+
}
|
|
1442
|
+
function getOutsideAllowedRootsReason(sourceNormalized, allowedRoots) {
|
|
1443
|
+
if (allowedRoots.length === 0) return null;
|
|
1444
|
+
for (const root of allowedRoots) if (isPathInsidePosix(root, sourceNormalized)) return null;
|
|
1445
|
+
return {
|
|
1446
|
+
kind: "outside_allowed_roots",
|
|
1447
|
+
sourcePath: sourceNormalized,
|
|
1448
|
+
allowedRoots
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
function getReservedTargetReason(bind) {
|
|
1452
|
+
const targetRaw = parseBindTargetPath(bind);
|
|
1453
|
+
if (!targetRaw || !targetRaw.startsWith("/")) return null;
|
|
1454
|
+
const target = normalizeHostPath(targetRaw);
|
|
1455
|
+
for (const reserved of RESERVED_CONTAINER_TARGET_PATHS) if (isPathInsidePosix(reserved, target)) return {
|
|
1456
|
+
kind: "reserved_target",
|
|
1457
|
+
targetPath: target,
|
|
1458
|
+
reservedPath: reserved
|
|
1459
|
+
};
|
|
1460
|
+
return null;
|
|
1461
|
+
}
|
|
1462
|
+
function enforceSourcePathPolicy(params) {
|
|
1463
|
+
const blockedReason = getBlockedReasonForSourcePath(params.sourcePath);
|
|
1464
|
+
if (blockedReason) throw formatBindBlockedError({
|
|
1465
|
+
bind: params.bind,
|
|
1466
|
+
reason: blockedReason
|
|
1467
|
+
});
|
|
1468
|
+
if (params.allowSourcesOutsideAllowedRoots) return;
|
|
1469
|
+
const allowedReason = getOutsideAllowedRootsReason(params.sourcePath, params.allowedRoots);
|
|
1470
|
+
if (allowedReason) throw formatBindBlockedError({
|
|
1471
|
+
bind: params.bind,
|
|
1472
|
+
reason: allowedReason
|
|
1473
|
+
});
|
|
1474
|
+
}
|
|
1475
|
+
function formatBindBlockedError(params) {
|
|
1476
|
+
if (params.reason.kind === "non_absolute") return /* @__PURE__ */ new Error(`Sandbox security: bind mount "${params.bind}" uses a non-absolute source path "${params.reason.sourcePath}". Only absolute POSIX paths are supported for sandbox binds.`);
|
|
1477
|
+
if (params.reason.kind === "outside_allowed_roots") return /* @__PURE__ */ new Error(`Sandbox security: bind mount "${params.bind}" source "${params.reason.sourcePath}" is outside allowed roots (${params.reason.allowedRoots.join(", ")}). Use a dangerous override only when you fully trust this runtime.`);
|
|
1478
|
+
if (params.reason.kind === "reserved_target") return /* @__PURE__ */ new Error(`Sandbox security: bind mount "${params.bind}" targets reserved container path "${params.reason.reservedPath}" (resolved target: "${params.reason.targetPath}"). This can shadow moldClaw sandbox mounts. Use a dangerous override only when you fully trust this runtime.`);
|
|
1479
|
+
const verb = params.reason.kind === "covers" ? "covers" : "targets";
|
|
1480
|
+
return /* @__PURE__ */ new Error(`Sandbox security: bind mount "${params.bind}" ${verb} blocked path "${params.reason.blockedPath}". Mounting system directories (or Docker socket paths) into sandbox containers is not allowed. Use project-specific paths instead (e.g. /home/user/myproject).`);
|
|
1481
|
+
}
|
|
1482
|
+
/**
|
|
1483
|
+
* Validate bind mounts — throws if any source path is dangerous.
|
|
1484
|
+
* Includes a symlink/realpath pass via existing ancestors so non-existent leaf
|
|
1485
|
+
* paths cannot bypass source-root and blocked-path checks.
|
|
1486
|
+
*/
|
|
1487
|
+
function validateBindMounts(binds, options) {
|
|
1488
|
+
if (!binds?.length) return;
|
|
1489
|
+
const allowedRoots = normalizeAllowedRoots(options?.allowedSourceRoots);
|
|
1490
|
+
for (const rawBind of binds) {
|
|
1491
|
+
const bind = rawBind.trim();
|
|
1492
|
+
if (!bind) continue;
|
|
1493
|
+
const blocked = getBlockedBindReason(bind);
|
|
1494
|
+
if (blocked) throw formatBindBlockedError({
|
|
1495
|
+
bind,
|
|
1496
|
+
reason: blocked
|
|
1497
|
+
});
|
|
1498
|
+
if (!options?.allowReservedContainerTargets) {
|
|
1499
|
+
const reservedTarget = getReservedTargetReason(bind);
|
|
1500
|
+
if (reservedTarget) throw formatBindBlockedError({
|
|
1501
|
+
bind,
|
|
1502
|
+
reason: reservedTarget
|
|
1503
|
+
});
|
|
1504
|
+
}
|
|
1505
|
+
const sourceNormalized = normalizeHostPath(parseBindSourcePath(bind));
|
|
1506
|
+
enforceSourcePathPolicy({
|
|
1507
|
+
bind,
|
|
1508
|
+
sourcePath: sourceNormalized,
|
|
1509
|
+
allowedRoots,
|
|
1510
|
+
allowSourcesOutsideAllowedRoots: options?.allowSourcesOutsideAllowedRoots === true
|
|
1511
|
+
});
|
|
1512
|
+
enforceSourcePathPolicy({
|
|
1513
|
+
bind,
|
|
1514
|
+
sourcePath: resolveSandboxHostPathViaExistingAncestor(sourceNormalized),
|
|
1515
|
+
allowedRoots,
|
|
1516
|
+
allowSourcesOutsideAllowedRoots: options?.allowSourcesOutsideAllowedRoots === true
|
|
1517
|
+
});
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
function validateNetworkMode(network, options) {
|
|
1521
|
+
const blockedReason = getBlockedNetworkModeReason({
|
|
1522
|
+
network,
|
|
1523
|
+
allowContainerNamespaceJoin: options?.allowContainerNamespaceJoin
|
|
1524
|
+
});
|
|
1525
|
+
if (blockedReason === "host") throw new Error(`Sandbox security: network mode "${network}" is blocked. Network "host" mode bypasses container network isolation. Use "bridge" or "none" instead.`);
|
|
1526
|
+
if (blockedReason === "container_namespace_join") throw new Error(`Sandbox security: network mode "${network}" is blocked by default. Network "container:*" joins another container namespace and bypasses sandbox network isolation. Use a custom bridge network, or set dangerouslyAllowContainerNamespaceJoin=true only when you fully trust this runtime.`);
|
|
1527
|
+
}
|
|
1528
|
+
function validateSeccompProfile(profile) {
|
|
1529
|
+
if (profile && BLOCKED_SECCOMP_PROFILES.has(profile.trim().toLowerCase())) throw new Error(`Sandbox security: seccomp profile "${profile}" is blocked. Disabling seccomp removes syscall filtering and weakens sandbox isolation. Use a custom seccomp profile file or omit this setting.`);
|
|
1530
|
+
}
|
|
1531
|
+
function validateApparmorProfile(profile) {
|
|
1532
|
+
if (profile && BLOCKED_APPARMOR_PROFILES.has(profile.trim().toLowerCase())) throw new Error(`Sandbox security: apparmor profile "${profile}" is blocked. Disabling AppArmor removes mandatory access controls and weakens sandbox isolation. Use a named AppArmor profile or omit this setting.`);
|
|
1533
|
+
}
|
|
1534
|
+
function validateSandboxSecurity(cfg) {
|
|
1535
|
+
validateBindMounts(cfg.binds, cfg);
|
|
1536
|
+
validateNetworkMode(cfg.network, { allowContainerNamespaceJoin: cfg.dangerouslyAllowContainerNamespaceJoin === true });
|
|
1537
|
+
validateSeccompProfile(cfg.seccompProfile);
|
|
1538
|
+
validateApparmorProfile(cfg.apparmorProfile);
|
|
1539
|
+
}
|
|
1540
|
+
//#endregion
|
|
1541
|
+
//#region src/agents/sandbox/workspace-mounts.ts
|
|
1542
|
+
function mainWorkspaceMountSuffix(access) {
|
|
1543
|
+
return access === "rw" ? "" : ":ro";
|
|
1544
|
+
}
|
|
1545
|
+
function agentWorkspaceMountSuffix(access) {
|
|
1546
|
+
return access === "ro" ? ":ro" : "";
|
|
1547
|
+
}
|
|
1548
|
+
function appendWorkspaceMountArgs(params) {
|
|
1549
|
+
const { args, workspaceDir, agentWorkspaceDir, workdir, workspaceAccess } = params;
|
|
1550
|
+
args.push("-v", `${workspaceDir}:${workdir}${mainWorkspaceMountSuffix(workspaceAccess)}`);
|
|
1551
|
+
if (workspaceAccess !== "none" && workspaceDir !== agentWorkspaceDir) args.push("-v", `${agentWorkspaceDir}:${SANDBOX_AGENT_WORKSPACE_MOUNT}${agentWorkspaceMountSuffix(workspaceAccess)}`);
|
|
1552
|
+
}
|
|
1553
|
+
//#endregion
|
|
1554
|
+
//#region src/agents/sandbox/docker.ts
|
|
1555
|
+
function createAbortError() {
|
|
1556
|
+
const err = /* @__PURE__ */ new Error("Aborted");
|
|
1557
|
+
err.name = "AbortError";
|
|
1558
|
+
return err;
|
|
1559
|
+
}
|
|
1560
|
+
const DEFAULT_DOCKER_SPAWN_RUNTIME = {
|
|
1561
|
+
platform: process.platform,
|
|
1562
|
+
env: process.env,
|
|
1563
|
+
execPath: process.execPath
|
|
1564
|
+
};
|
|
1565
|
+
function resolveDockerSpawnInvocation(args, runtime = DEFAULT_DOCKER_SPAWN_RUNTIME) {
|
|
1566
|
+
const resolved = materializeWindowsSpawnProgram(resolveWindowsSpawnProgram({
|
|
1567
|
+
command: "docker",
|
|
1568
|
+
platform: runtime.platform,
|
|
1569
|
+
env: runtime.env,
|
|
1570
|
+
execPath: runtime.execPath,
|
|
1571
|
+
packageName: "docker",
|
|
1572
|
+
allowShellFallback: false
|
|
1573
|
+
}), args);
|
|
1574
|
+
return {
|
|
1575
|
+
command: resolved.command,
|
|
1576
|
+
args: resolved.argv,
|
|
1577
|
+
shell: resolved.shell,
|
|
1578
|
+
windowsHide: resolved.windowsHide
|
|
1579
|
+
};
|
|
1580
|
+
}
|
|
1581
|
+
function execDockerRaw(args, opts) {
|
|
1582
|
+
return new Promise((resolve, reject) => {
|
|
1583
|
+
const spawnInvocation = resolveDockerSpawnInvocation(args);
|
|
1584
|
+
const child = spawn(spawnInvocation.command, spawnInvocation.args, {
|
|
1585
|
+
stdio: [
|
|
1586
|
+
"pipe",
|
|
1587
|
+
"pipe",
|
|
1588
|
+
"pipe"
|
|
1589
|
+
],
|
|
1590
|
+
shell: spawnInvocation.shell,
|
|
1591
|
+
windowsHide: spawnInvocation.windowsHide
|
|
1592
|
+
});
|
|
1593
|
+
const stdoutChunks = [];
|
|
1594
|
+
const stderrChunks = [];
|
|
1595
|
+
let aborted = false;
|
|
1596
|
+
const signal = opts?.signal;
|
|
1597
|
+
const handleAbort = () => {
|
|
1598
|
+
if (aborted) return;
|
|
1599
|
+
aborted = true;
|
|
1600
|
+
child.kill("SIGTERM");
|
|
1601
|
+
};
|
|
1602
|
+
if (signal) if (signal.aborted) handleAbort();
|
|
1603
|
+
else signal.addEventListener("abort", handleAbort);
|
|
1604
|
+
child.stdout?.on("data", (chunk) => {
|
|
1605
|
+
stdoutChunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
1606
|
+
});
|
|
1607
|
+
child.stderr?.on("data", (chunk) => {
|
|
1608
|
+
stderrChunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
1609
|
+
});
|
|
1610
|
+
child.on("error", (error) => {
|
|
1611
|
+
if (signal) signal.removeEventListener("abort", handleAbort);
|
|
1612
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
1613
|
+
reject(Object.assign(/* @__PURE__ */ new Error("Sandbox mode requires Docker, but the \"docker\" command was not found in PATH. Install Docker (and ensure \"docker\" is available), or set `agents.defaults.sandbox.mode=off` to disable sandboxing."), {
|
|
1614
|
+
code: "INVALID_CONFIG",
|
|
1615
|
+
cause: error
|
|
1616
|
+
}));
|
|
1617
|
+
return;
|
|
1618
|
+
}
|
|
1619
|
+
reject(error);
|
|
1620
|
+
});
|
|
1621
|
+
child.on("close", (code) => {
|
|
1622
|
+
if (signal) signal.removeEventListener("abort", handleAbort);
|
|
1623
|
+
const stdout = Buffer.concat(stdoutChunks);
|
|
1624
|
+
const stderr = Buffer.concat(stderrChunks);
|
|
1625
|
+
if (aborted || signal?.aborted) {
|
|
1626
|
+
reject(createAbortError());
|
|
1627
|
+
return;
|
|
1628
|
+
}
|
|
1629
|
+
const exitCode = code ?? 0;
|
|
1630
|
+
if (exitCode !== 0 && !opts?.allowFailure) {
|
|
1631
|
+
const message = stderr.length > 0 ? stderr.toString("utf8").trim() : "";
|
|
1632
|
+
reject(Object.assign(new Error(message || `docker ${args.join(" ")} failed`), {
|
|
1633
|
+
code: exitCode,
|
|
1634
|
+
stdout,
|
|
1635
|
+
stderr
|
|
1636
|
+
}));
|
|
1637
|
+
return;
|
|
1638
|
+
}
|
|
1639
|
+
resolve({
|
|
1640
|
+
stdout,
|
|
1641
|
+
stderr,
|
|
1642
|
+
code: exitCode
|
|
1643
|
+
});
|
|
1644
|
+
});
|
|
1645
|
+
const stdin = child.stdin;
|
|
1646
|
+
if (stdin) if (opts?.input !== void 0) stdin.end(opts.input);
|
|
1647
|
+
else stdin.end();
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
const log = createSubsystemLogger("docker");
|
|
1651
|
+
const HOT_CONTAINER_WINDOW_MS = 300 * 1e3;
|
|
1652
|
+
async function execDocker(args, opts) {
|
|
1653
|
+
const result = await execDockerRaw(args, opts);
|
|
1654
|
+
return {
|
|
1655
|
+
stdout: result.stdout.toString("utf8"),
|
|
1656
|
+
stderr: result.stderr.toString("utf8"),
|
|
1657
|
+
code: result.code
|
|
1658
|
+
};
|
|
1659
|
+
}
|
|
1660
|
+
async function readDockerContainerLabel(containerName, label) {
|
|
1661
|
+
const result = await execDocker([
|
|
1662
|
+
"inspect",
|
|
1663
|
+
"-f",
|
|
1664
|
+
`{{ index .Config.Labels "${label}" }}`,
|
|
1665
|
+
containerName
|
|
1666
|
+
], { allowFailure: true });
|
|
1667
|
+
if (result.code !== 0) return null;
|
|
1668
|
+
const raw = result.stdout.trim();
|
|
1669
|
+
if (!raw || raw === "<no value>") return null;
|
|
1670
|
+
return raw;
|
|
1671
|
+
}
|
|
1672
|
+
async function readDockerContainerEnvVar(containerName, envVar) {
|
|
1673
|
+
const result = await execDocker([
|
|
1674
|
+
"inspect",
|
|
1675
|
+
"-f",
|
|
1676
|
+
"{{range .Config.Env}}{{println .}}{{end}}",
|
|
1677
|
+
containerName
|
|
1678
|
+
], { allowFailure: true });
|
|
1679
|
+
if (result.code !== 0) return null;
|
|
1680
|
+
for (const line of result.stdout.split(/\r?\n/)) if (line.startsWith(`${envVar}=`)) return line.slice(envVar.length + 1);
|
|
1681
|
+
return null;
|
|
1682
|
+
}
|
|
1683
|
+
async function readDockerPort(containerName, port) {
|
|
1684
|
+
const result = await execDocker([
|
|
1685
|
+
"port",
|
|
1686
|
+
containerName,
|
|
1687
|
+
`${port}/tcp`
|
|
1688
|
+
], { allowFailure: true });
|
|
1689
|
+
if (result.code !== 0) return null;
|
|
1690
|
+
const match = (result.stdout.trim().split(/\r?\n/)[0] ?? "").match(/:(\d+)\s*$/);
|
|
1691
|
+
if (!match) return null;
|
|
1692
|
+
const mapped = Number.parseInt(match[1] ?? "", 10);
|
|
1693
|
+
return Number.isFinite(mapped) ? mapped : null;
|
|
1694
|
+
}
|
|
1695
|
+
async function dockerImageExists(image) {
|
|
1696
|
+
const result = await execDocker([
|
|
1697
|
+
"image",
|
|
1698
|
+
"inspect",
|
|
1699
|
+
image
|
|
1700
|
+
], { allowFailure: true });
|
|
1701
|
+
if (result.code === 0) return true;
|
|
1702
|
+
const stderr = result.stderr.trim();
|
|
1703
|
+
if (stderr.includes("No such image")) return false;
|
|
1704
|
+
throw new Error(`Failed to inspect sandbox image: ${stderr}`);
|
|
1705
|
+
}
|
|
1706
|
+
async function ensureDockerImage(image) {
|
|
1707
|
+
if (await dockerImageExists(image)) return;
|
|
1708
|
+
if (image === "moldclaw-sandbox:bookworm-slim") {
|
|
1709
|
+
await execDocker(["pull", "debian:bookworm-slim"]);
|
|
1710
|
+
await execDocker([
|
|
1711
|
+
"tag",
|
|
1712
|
+
"debian:bookworm-slim",
|
|
1713
|
+
DEFAULT_SANDBOX_IMAGE
|
|
1714
|
+
]);
|
|
1715
|
+
return;
|
|
1716
|
+
}
|
|
1717
|
+
throw new Error(`Sandbox image not found: ${image}. Build or pull it first.`);
|
|
1718
|
+
}
|
|
1719
|
+
async function dockerContainerState(name) {
|
|
1720
|
+
const result = await execDocker([
|
|
1721
|
+
"inspect",
|
|
1722
|
+
"-f",
|
|
1723
|
+
"{{.State.Running}}",
|
|
1724
|
+
name
|
|
1725
|
+
], { allowFailure: true });
|
|
1726
|
+
if (result.code !== 0) return {
|
|
1727
|
+
exists: false,
|
|
1728
|
+
running: false
|
|
1729
|
+
};
|
|
1730
|
+
return {
|
|
1731
|
+
exists: true,
|
|
1732
|
+
running: result.stdout.trim() === "true"
|
|
1733
|
+
};
|
|
1734
|
+
}
|
|
1735
|
+
function normalizeDockerLimit(value) {
|
|
1736
|
+
if (value === void 0 || value === null) return;
|
|
1737
|
+
if (typeof value === "number") return Number.isFinite(value) ? String(value) : void 0;
|
|
1738
|
+
const trimmed = value.trim();
|
|
1739
|
+
return trimmed ? trimmed : void 0;
|
|
1740
|
+
}
|
|
1741
|
+
function formatUlimitValue(name, value) {
|
|
1742
|
+
if (!name.trim()) return null;
|
|
1743
|
+
if (typeof value === "number" || typeof value === "string") {
|
|
1744
|
+
const raw = String(value).trim();
|
|
1745
|
+
return raw ? `${name}=${raw}` : null;
|
|
1746
|
+
}
|
|
1747
|
+
const soft = typeof value.soft === "number" ? Math.max(0, value.soft) : void 0;
|
|
1748
|
+
const hard = typeof value.hard === "number" ? Math.max(0, value.hard) : void 0;
|
|
1749
|
+
if (soft === void 0 && hard === void 0) return null;
|
|
1750
|
+
if (soft === void 0) return `${name}=${hard}`;
|
|
1751
|
+
if (hard === void 0) return `${name}=${soft}`;
|
|
1752
|
+
return `${name}=${soft}:${hard}`;
|
|
1753
|
+
}
|
|
1754
|
+
function buildSandboxCreateArgs(params) {
|
|
1755
|
+
validateSandboxSecurity({
|
|
1756
|
+
...params.cfg,
|
|
1757
|
+
allowedSourceRoots: params.bindSourceRoots,
|
|
1758
|
+
allowSourcesOutsideAllowedRoots: params.allowSourcesOutsideAllowedRoots ?? params.cfg.dangerouslyAllowExternalBindSources === true,
|
|
1759
|
+
allowReservedContainerTargets: params.allowReservedContainerTargets ?? params.cfg.dangerouslyAllowReservedContainerTargets === true,
|
|
1760
|
+
dangerouslyAllowContainerNamespaceJoin: params.allowContainerNamespaceJoin ?? params.cfg.dangerouslyAllowContainerNamespaceJoin === true
|
|
1761
|
+
});
|
|
1762
|
+
const createdAtMs = params.createdAtMs ?? Date.now();
|
|
1763
|
+
const args = [
|
|
1764
|
+
"create",
|
|
1765
|
+
"--name",
|
|
1766
|
+
params.name
|
|
1767
|
+
];
|
|
1768
|
+
args.push("--label", "moldclaw.sandbox=1");
|
|
1769
|
+
args.push("--label", `moldclaw.sessionKey=${params.scopeKey}`);
|
|
1770
|
+
args.push("--label", `moldclaw.createdAtMs=${createdAtMs}`);
|
|
1771
|
+
if (params.configHash) args.push("--label", `moldclaw.configHash=${params.configHash}`);
|
|
1772
|
+
for (const [key, value] of Object.entries(params.labels ?? {})) if (key && value) args.push("--label", `${key}=${value}`);
|
|
1773
|
+
if (params.cfg.readOnlyRoot) args.push("--read-only");
|
|
1774
|
+
for (const entry of params.cfg.tmpfs) args.push("--tmpfs", entry);
|
|
1775
|
+
if (params.cfg.network) args.push("--network", params.cfg.network);
|
|
1776
|
+
if (params.cfg.user) args.push("--user", params.cfg.user);
|
|
1777
|
+
const envSanitization = sanitizeEnvVars(params.cfg.env ?? {}, params.envSanitizationOptions);
|
|
1778
|
+
if (envSanitization.blocked.length > 0) log.warn(`Blocked sensitive environment variables: ${envSanitization.blocked.join(", ")}`);
|
|
1779
|
+
if (envSanitization.warnings.length > 0) log.warn(`Suspicious environment variables: ${envSanitization.warnings.join(", ")}`);
|
|
1780
|
+
for (const [key, value] of Object.entries(markmoldClawExecEnv(envSanitization.allowed))) args.push("--env", `${key}=${value}`);
|
|
1781
|
+
for (const cap of params.cfg.capDrop) args.push("--cap-drop", cap);
|
|
1782
|
+
args.push("--security-opt", "no-new-privileges");
|
|
1783
|
+
if (params.cfg.seccompProfile) args.push("--security-opt", `seccomp=${params.cfg.seccompProfile}`);
|
|
1784
|
+
if (params.cfg.apparmorProfile) args.push("--security-opt", `apparmor=${params.cfg.apparmorProfile}`);
|
|
1785
|
+
for (const entry of params.cfg.dns ?? []) if (entry.trim()) args.push("--dns", entry);
|
|
1786
|
+
for (const entry of params.cfg.extraHosts ?? []) if (entry.trim()) args.push("--add-host", entry);
|
|
1787
|
+
if (typeof params.cfg.pidsLimit === "number" && params.cfg.pidsLimit > 0) args.push("--pids-limit", String(params.cfg.pidsLimit));
|
|
1788
|
+
const memory = normalizeDockerLimit(params.cfg.memory);
|
|
1789
|
+
if (memory) args.push("--memory", memory);
|
|
1790
|
+
const memorySwap = normalizeDockerLimit(params.cfg.memorySwap);
|
|
1791
|
+
if (memorySwap) args.push("--memory-swap", memorySwap);
|
|
1792
|
+
if (typeof params.cfg.cpus === "number" && params.cfg.cpus > 0) args.push("--cpus", String(params.cfg.cpus));
|
|
1793
|
+
for (const [name, value] of Object.entries(params.cfg.ulimits ?? {})) {
|
|
1794
|
+
const formatted = formatUlimitValue(name, value);
|
|
1795
|
+
if (formatted) args.push("--ulimit", formatted);
|
|
1796
|
+
}
|
|
1797
|
+
if (params.includeBinds !== false && params.cfg.binds?.length) for (const bind of params.cfg.binds) args.push("-v", bind);
|
|
1798
|
+
return args;
|
|
1799
|
+
}
|
|
1800
|
+
function appendCustomBinds(args, cfg) {
|
|
1801
|
+
if (!cfg.binds?.length) return;
|
|
1802
|
+
for (const bind of cfg.binds) args.push("-v", bind);
|
|
1803
|
+
}
|
|
1804
|
+
async function createSandboxContainer(params) {
|
|
1805
|
+
const { name, cfg, workspaceDir, scopeKey } = params;
|
|
1806
|
+
await ensureDockerImage(cfg.image);
|
|
1807
|
+
const args = buildSandboxCreateArgs({
|
|
1808
|
+
name,
|
|
1809
|
+
cfg,
|
|
1810
|
+
scopeKey,
|
|
1811
|
+
configHash: params.configHash,
|
|
1812
|
+
includeBinds: false,
|
|
1813
|
+
bindSourceRoots: [workspaceDir, params.agentWorkspaceDir]
|
|
1814
|
+
});
|
|
1815
|
+
args.push("--workdir", cfg.workdir);
|
|
1816
|
+
appendWorkspaceMountArgs({
|
|
1817
|
+
args,
|
|
1818
|
+
workspaceDir,
|
|
1819
|
+
agentWorkspaceDir: params.agentWorkspaceDir,
|
|
1820
|
+
workdir: cfg.workdir,
|
|
1821
|
+
workspaceAccess: params.workspaceAccess
|
|
1822
|
+
});
|
|
1823
|
+
appendCustomBinds(args, cfg);
|
|
1824
|
+
args.push(cfg.image, "sleep", "infinity");
|
|
1825
|
+
await execDocker(args);
|
|
1826
|
+
await execDocker(["start", name]);
|
|
1827
|
+
if (cfg.setupCommand?.trim()) await execDocker([
|
|
1828
|
+
"exec",
|
|
1829
|
+
"-i",
|
|
1830
|
+
name,
|
|
1831
|
+
"/bin/sh",
|
|
1832
|
+
"-lc",
|
|
1833
|
+
cfg.setupCommand
|
|
1834
|
+
]);
|
|
1835
|
+
}
|
|
1836
|
+
async function readContainerConfigHash(containerName) {
|
|
1837
|
+
return await readDockerContainerLabel(containerName, "moldclaw.configHash");
|
|
1838
|
+
}
|
|
1839
|
+
function formatSandboxRecreateHint(params) {
|
|
1840
|
+
if (params.scope === "session") return formatCliCommand(`moldclaw sandbox recreate --session ${params.sessionKey}`);
|
|
1841
|
+
if (params.scope === "agent") return formatCliCommand(`moldclaw sandbox recreate --agent ${resolveSandboxAgentId(params.sessionKey) ?? "main"}`);
|
|
1842
|
+
return formatCliCommand("moldclaw sandbox recreate --all");
|
|
1843
|
+
}
|
|
1844
|
+
async function ensureSandboxContainer(params) {
|
|
1845
|
+
const scopeKey = resolveSandboxScopeKey(params.cfg.scope, params.sessionKey);
|
|
1846
|
+
const slug = params.cfg.scope === "shared" ? "shared" : slugifySessionKey(scopeKey);
|
|
1847
|
+
const containerName = `${params.cfg.docker.containerPrefix}${slug}`.slice(0, 63);
|
|
1848
|
+
const expectedHash = computeSandboxConfigHash({
|
|
1849
|
+
docker: params.cfg.docker,
|
|
1850
|
+
workspaceAccess: params.cfg.workspaceAccess,
|
|
1851
|
+
workspaceDir: params.workspaceDir,
|
|
1852
|
+
agentWorkspaceDir: params.agentWorkspaceDir
|
|
1853
|
+
});
|
|
1854
|
+
const now = Date.now();
|
|
1855
|
+
const state = await dockerContainerState(containerName);
|
|
1856
|
+
let hasContainer = state.exists;
|
|
1857
|
+
let running = state.running;
|
|
1858
|
+
let currentHash = null;
|
|
1859
|
+
let hashMismatch = false;
|
|
1860
|
+
let registryEntry;
|
|
1861
|
+
if (hasContainer) {
|
|
1862
|
+
registryEntry = (await readRegistry()).entries.find((entry) => entry.containerName === containerName);
|
|
1863
|
+
currentHash = await readContainerConfigHash(containerName);
|
|
1864
|
+
if (!currentHash) currentHash = registryEntry?.configHash ?? null;
|
|
1865
|
+
hashMismatch = !currentHash || currentHash !== expectedHash;
|
|
1866
|
+
if (hashMismatch) {
|
|
1867
|
+
const lastUsedAtMs = registryEntry?.lastUsedAtMs;
|
|
1868
|
+
if (running && (typeof lastUsedAtMs !== "number" || now - lastUsedAtMs < HOT_CONTAINER_WINDOW_MS)) {
|
|
1869
|
+
const hint = formatSandboxRecreateHint({
|
|
1870
|
+
scope: params.cfg.scope,
|
|
1871
|
+
sessionKey: scopeKey
|
|
1872
|
+
});
|
|
1873
|
+
defaultRuntime.log(`Sandbox config changed for ${containerName} (recently used). Recreate to apply: ${hint}`);
|
|
1874
|
+
} else {
|
|
1875
|
+
await execDocker([
|
|
1876
|
+
"rm",
|
|
1877
|
+
"-f",
|
|
1878
|
+
containerName
|
|
1879
|
+
], { allowFailure: true });
|
|
1880
|
+
hasContainer = false;
|
|
1881
|
+
running = false;
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
if (!hasContainer) await createSandboxContainer({
|
|
1886
|
+
name: containerName,
|
|
1887
|
+
cfg: params.cfg.docker,
|
|
1888
|
+
workspaceDir: params.workspaceDir,
|
|
1889
|
+
workspaceAccess: params.cfg.workspaceAccess,
|
|
1890
|
+
agentWorkspaceDir: params.agentWorkspaceDir,
|
|
1891
|
+
scopeKey,
|
|
1892
|
+
configHash: expectedHash
|
|
1893
|
+
});
|
|
1894
|
+
else if (!running) await execDocker(["start", containerName]);
|
|
1895
|
+
await updateRegistry({
|
|
1896
|
+
containerName,
|
|
1897
|
+
backendId: "docker",
|
|
1898
|
+
runtimeLabel: containerName,
|
|
1899
|
+
sessionKey: scopeKey,
|
|
1900
|
+
createdAtMs: now,
|
|
1901
|
+
lastUsedAtMs: now,
|
|
1902
|
+
image: params.cfg.docker.image,
|
|
1903
|
+
configLabelKind: "Image",
|
|
1904
|
+
configHash: hashMismatch && running ? currentHash ?? void 0 : expectedHash
|
|
1905
|
+
});
|
|
1906
|
+
return containerName;
|
|
1907
|
+
}
|
|
1908
|
+
//#endregion
|
|
1909
|
+
//#region src/config/commands.ts
|
|
1910
|
+
function resolveAutoDefault(providerId) {
|
|
1911
|
+
const id = normalizeChannelId(providerId);
|
|
1912
|
+
if (!id) return false;
|
|
1913
|
+
if (id === "discord" || id === "telegram") return true;
|
|
1914
|
+
if (id === "slack") return false;
|
|
1915
|
+
return false;
|
|
1916
|
+
}
|
|
1917
|
+
function resolveNativeSkillsEnabled(params) {
|
|
1918
|
+
return resolveNativeCommandSetting(params);
|
|
1919
|
+
}
|
|
1920
|
+
function resolveNativeCommandsEnabled(params) {
|
|
1921
|
+
return resolveNativeCommandSetting(params);
|
|
1922
|
+
}
|
|
1923
|
+
function resolveNativeCommandSetting(params) {
|
|
1924
|
+
const { providerId, providerSetting, globalSetting } = params;
|
|
1925
|
+
const setting = providerSetting === void 0 ? globalSetting : providerSetting;
|
|
1926
|
+
if (setting === true) return true;
|
|
1927
|
+
if (setting === false) return false;
|
|
1928
|
+
return resolveAutoDefault(providerId);
|
|
1929
|
+
}
|
|
1930
|
+
function isNativeCommandsExplicitlyDisabled(params) {
|
|
1931
|
+
const { providerSetting, globalSetting } = params;
|
|
1932
|
+
if (providerSetting === false) return true;
|
|
1933
|
+
if (providerSetting === void 0) return globalSetting === false;
|
|
1934
|
+
return false;
|
|
1935
|
+
}
|
|
1936
|
+
function getOwnCommandFlagValue(config, key) {
|
|
1937
|
+
const { commands } = config ?? {};
|
|
1938
|
+
if (!isPlainObject(commands) || !Object.hasOwn(commands, key)) return;
|
|
1939
|
+
return commands[key];
|
|
1940
|
+
}
|
|
1941
|
+
function isCommandFlagEnabled(config, key) {
|
|
1942
|
+
return getOwnCommandFlagValue(config, key) === true;
|
|
1943
|
+
}
|
|
1944
|
+
function isRestartEnabled(config) {
|
|
1945
|
+
return getOwnCommandFlagValue(config, "restart") !== false;
|
|
1946
|
+
}
|
|
1947
|
+
//#endregion
|
|
1948
|
+
//#region src/agents/sandbox-tool-policy.ts
|
|
1949
|
+
function unionAllow(base, extra) {
|
|
1950
|
+
if (!Array.isArray(extra) || extra.length === 0) return base;
|
|
1951
|
+
if (!Array.isArray(base) || base.length === 0) return Array.from(new Set(["*", ...extra]));
|
|
1952
|
+
return Array.from(new Set([...base, ...extra]));
|
|
1953
|
+
}
|
|
1954
|
+
function pickSandboxToolPolicy(config) {
|
|
1955
|
+
if (!config) return;
|
|
1956
|
+
const allow = Array.isArray(config.allow) ? unionAllow(config.allow, config.alsoAllow) : Array.isArray(config.alsoAllow) && config.alsoAllow.length > 0 ? unionAllow(void 0, config.alsoAllow) : void 0;
|
|
1957
|
+
const deny = Array.isArray(config.deny) ? config.deny : void 0;
|
|
1958
|
+
if (!allow && !deny) return;
|
|
1959
|
+
return {
|
|
1960
|
+
allow,
|
|
1961
|
+
deny
|
|
1962
|
+
};
|
|
1963
|
+
}
|
|
1964
|
+
//#endregion
|
|
1965
|
+
//#region src/agents/tool-policy-match.ts
|
|
1966
|
+
function makeToolPolicyMatcher(policy) {
|
|
1967
|
+
const deny = compileGlobPatterns({
|
|
1968
|
+
raw: expandToolGroups(policy.deny ?? []),
|
|
1969
|
+
normalize: normalizeToolName
|
|
1970
|
+
});
|
|
1971
|
+
const allow = compileGlobPatterns({
|
|
1972
|
+
raw: expandToolGroups(policy.allow ?? []),
|
|
1973
|
+
normalize: normalizeToolName
|
|
1974
|
+
});
|
|
1975
|
+
return (name) => {
|
|
1976
|
+
const normalized = normalizeToolName(name);
|
|
1977
|
+
if (matchesAnyGlobPattern(normalized, deny)) return false;
|
|
1978
|
+
if (allow.length === 0) return true;
|
|
1979
|
+
if (matchesAnyGlobPattern(normalized, allow)) return true;
|
|
1980
|
+
if (normalized === "apply_patch" && matchesAnyGlobPattern("exec", allow)) return true;
|
|
1981
|
+
return false;
|
|
1982
|
+
};
|
|
1983
|
+
}
|
|
1984
|
+
function isToolAllowedByPolicyName(name, policy) {
|
|
1985
|
+
if (!policy) return true;
|
|
1986
|
+
return makeToolPolicyMatcher(policy)(name);
|
|
1987
|
+
}
|
|
1988
|
+
function isToolAllowedByPolicies(name, policies) {
|
|
1989
|
+
return policies.every((policy) => isToolAllowedByPolicyName(name, policy));
|
|
1990
|
+
}
|
|
1991
|
+
//#endregion
|
|
1992
|
+
//#region src/agents/workspace-dirs.ts
|
|
1993
|
+
function listAgentWorkspaceDirs(cfg) {
|
|
1994
|
+
const dirs = /* @__PURE__ */ new Set();
|
|
1995
|
+
const list = cfg.agents?.list;
|
|
1996
|
+
if (Array.isArray(list)) {
|
|
1997
|
+
for (const entry of list) if (entry && typeof entry === "object" && typeof entry.id === "string") dirs.add(resolveAgentWorkspaceDir(cfg, entry.id));
|
|
1998
|
+
}
|
|
1999
|
+
dirs.add(resolveAgentWorkspaceDir(cfg, resolveDefaultAgentId(cfg)));
|
|
2000
|
+
return [...dirs];
|
|
2001
|
+
}
|
|
2002
|
+
//#endregion
|
|
2003
|
+
export { listCoreToolSections as $, removeRegistryEntry as A, isToolAllowed as B, resolveSandboxAgentId as C, readBrowserRegistry as D, slugifySessionKey as E, resolveSessionLockMaxHoldFromTimeout as F, expandPolicyWithPluginGroups as G, applyOwnerOnlyToolPolicy as H, computeSandboxBrowserConfigHash as I, expandToolGroups as J, mergeAlsoAllowPolicy as K, resolveSandboxBrowserDockerCreateConfig as L, updateRegistry as M, acquireSessionWriteLock as N, readRegistry as O, cleanStaleLockFiles as P, isKnownCoreToolId as Q, resolveSandboxConfigForAgent as R, splitSandboxBindSpec as S, resolveSandboxWorkspaceDir as T, buildPluginToolGroups as U, resolveSandboxToolPolicyForAgent as V, collectExplicitAllowlist as W, resolveToolProfilePolicy as X, normalizeToolName as Y, PROFILE_OPTIONS as Z, readDockerPort as _, isCommandFlagEnabled as a, DEFAULT_SANDBOX_IMAGE as at, validateNetworkMode as b, resolveNativeCommandsEnabled as c, dockerContainerState as d, resolveCoreToolProfiles as et, ensureSandboxContainer as f, readDockerContainerLabel as g, readDockerContainerEnvVar as h, pickSandboxToolPolicy as i, DEFAULT_SANDBOX_COMMON_IMAGE as it, updateBrowserRegistry as j, removeBrowserRegistryEntry as k, resolveNativeSkillsEnabled as l, execDockerRaw as m, isToolAllowedByPolicies as n, matchesAnyGlobPattern as nt, isNativeCommandsExplicitlyDisabled as o, SANDBOX_AGENT_WORKSPACE_MOUNT as ot, execDocker as p, stripPluginOnlyAllowlist as q, isToolAllowedByPolicyName as r, DEFAULT_SANDBOX_BROWSER_IMAGE as rt, isRestartEnabled as s, SANDBOX_BROWSER_SECURITY_HASH_EPOCH as st, listAgentWorkspaceDirs as t, compileGlobPatterns as tt, buildSandboxCreateArgs as u, appendWorkspaceMountArgs as v, resolveSandboxScopeKey as w, resolveSandboxHostPathViaExistingAncestor as x, getBlockedBindReason as y, resolveSandboxScope as z };
|