@spacebar_ai/moldclaw-core 2026.3.41 → 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/docs/reference/templates/AGENTS.dev.md +83 -0
- package/docs/reference/templates/AGENTS.md +219 -0
- package/docs/reference/templates/BOOT.md +11 -0
- package/docs/reference/templates/BOOTSTRAP.md +62 -0
- package/docs/reference/templates/HEARTBEAT.md +12 -0
- package/docs/reference/templates/IDENTITY.dev.md +47 -0
- package/docs/reference/templates/IDENTITY.md +29 -0
- package/docs/reference/templates/SOUL.dev.md +76 -0
- package/docs/reference/templates/SOUL.md +43 -0
- package/docs/reference/templates/TOOLS.dev.md +24 -0
- package/docs/reference/templates/TOOLS.md +47 -0
- package/docs/reference/templates/USER.dev.md +18 -0
- package/docs/reference/templates/USER.md +23 -0
- package/extensions/discord/src/monitor/allow-list.ts +8 -1
- package/extensions/discord/src/monitor/message-handler.preflight.ts +4 -1
- package/package.json +2 -1
- package/dist/accounts-CDr-lDaV.d.ts +0 -103
- package/dist/accounts-CS8U4v8C.js +0 -114
- 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-CnT9wiS4.d.ts +0 -6
- package/dist/bot-CuzVYwa_.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-jm751KJ9.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-Coivm0Mt.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-DKzsSLlO.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-C1dM8pl2.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-CNZQb1jd.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-06OUQvAV.d.ts +0 -6
- package/dist/hooks-cli-B7uGJs2O.js +0 -1000
- package/dist/hooks-status-CfceaUSg.js +0 -78
- package/dist/http-registry-DYskWhOr.d.ts +0 -20
- package/dist/identity-file-sshkKKIr.js +0 -60
- package/dist/image-generation-D4o3j8o6.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-D6_HNqH8.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-B8gTtl3Y.d.ts +0 -75
- package/dist/line-CGsemKWJ.js +0 -530
- 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-D2JoHzb4.d.ts +0 -68
- package/dist/matrix-DiABGjJR.js +0 -1269
- 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-BFoM4IPf.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-Dc905FWG.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-DBTFTxKs.js +0 -8744
- package/dist/nostr-DLqaIuZx.d.ts +0 -7
- 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-CXKqTh2X.d.ts +0 -11
- package/dist/outbound-media-DYRO2vTD.js +0 -11
- package/dist/pairing-access-BwJu1mkk.d.ts +0 -21
- package/dist/pairing-cli-BOnv0TYn.js +0 -217
- package/dist/perplexity-EZwC3y2b.js +0 -24
- package/dist/persistent-dedupe-hNES5tS1.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-5xgWoVGi.d.ts +0 -18
- package/dist/provider-models-BCId_Lfu.js +0 -2113
- package/dist/provider-models-D-eFl9oH.d.ts +0 -867
- package/dist/provider-ollama-setup-B6XJZ0So.js +0 -314
- package/dist/provider-ollama-setup-BF1vhob8.d.ts +0 -32
- package/dist/provider-onboard-BjXHP3IZ.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-BQ5BIlpi.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-Cy8pqYUB.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-DGszQH0_.js +0 -387
- package/dist/setup-DR5rRw9y.d.ts +0 -37
- 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-BtuGx_gN.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-Y3dPBOuZ.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-BBJ3Qz7j.d.ts +0 -45
- package/dist/types-Ckufs_BY.d.ts +0 -22692
- 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-HSGD3yGt.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-Di17rt8e.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-BN3VCrRY.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
package/dist/acp-cli-BGT0jXcC.js
DELETED
|
@@ -1,2093 +0,0 @@
|
|
|
1
|
-
import "./redact-fatrROh9.js";
|
|
2
|
-
import "./errors-DOJWZqNo.js";
|
|
3
|
-
import { t as isMainModule } from "./is-main-DRn0Pf7d.js";
|
|
4
|
-
import "./unhandled-rejections-CTvNvnT0.js";
|
|
5
|
-
import "./logger-BFfIIIKH.js";
|
|
6
|
-
import "./paths-D6AgsMTU.js";
|
|
7
|
-
import "./tmp-moldclaw-dir-DWF-d8qD.js";
|
|
8
|
-
import { r as theme } from "./theme-BSXzMzAA.js";
|
|
9
|
-
import "./globals-DESrFYmC.js";
|
|
10
|
-
import { n as defaultRuntime } from "./runtime-_tQz41uA.js";
|
|
11
|
-
import "./ansi-BPhP6LBZ.js";
|
|
12
|
-
import "./subsystem-CPmDTJ2P.js";
|
|
13
|
-
import "./boolean-B6zcAynR.js";
|
|
14
|
-
import "./env-D42cffog.js";
|
|
15
|
-
import "./warning-filter-B1UOeM0G.js";
|
|
16
|
-
import { S as shortenHomePath } from "./utils-C7ykRPCQ.js";
|
|
17
|
-
import { t as formatDocsLink } from "./links-BcahUP5U.js";
|
|
18
|
-
import { n as inheritOptionFromParent } from "./command-options-DYaIHwsu.js";
|
|
19
|
-
import "./setup-binary-C17YnmA8.js";
|
|
20
|
-
import { En as listThinkingLevels } from "./auth-profiles-1kPLbBwI.js";
|
|
21
|
-
import "./model-selection-hL8i1Jbs.js";
|
|
22
|
-
import "./agent-scope-C-YmLnnb.js";
|
|
23
|
-
import "./boundary-file-read-tPYh_8fH.js";
|
|
24
|
-
import "./logger-BGzLUitz.js";
|
|
25
|
-
import "./exec-CvEtXqTZ.js";
|
|
26
|
-
import "./workspace-CpWi5wPr.js";
|
|
27
|
-
import { c as loadConfig } from "./io-CMfWWPXQ.js";
|
|
28
|
-
import "./host-env-security-DQ2i_W12.js";
|
|
29
|
-
import "./safe-text-Cnulee_z.js";
|
|
30
|
-
import { n as VERSION } from "./version-T8nMYUnU.js";
|
|
31
|
-
import "./env-substitution-68cyvF5h.js";
|
|
32
|
-
import "./config-state-h5jUoHya.js";
|
|
33
|
-
import "./network-mode-BtWXzwYn.js";
|
|
34
|
-
import "./registry-C1pRrsQl.js";
|
|
35
|
-
import "./manifest-registry-DAd0SRAP.js";
|
|
36
|
-
import "./ip-C4YAIpr4.js";
|
|
37
|
-
import "./zod-schema.core-DvwgNmpd.js";
|
|
38
|
-
import "./config-sW57gztj.js";
|
|
39
|
-
import "./audit-fs-CMb-YUHX.js";
|
|
40
|
-
import "./resolve-PSlwZjg3.js";
|
|
41
|
-
import "./provider-web-search-CcUC9ktE.js";
|
|
42
|
-
import "./text-runtime-Cfq-Uyx0.js";
|
|
43
|
-
import { Q as isKnownCoreToolId } from "./workspace-dirs-x10McA9t.js";
|
|
44
|
-
import "./config-BwkGZjD5.js";
|
|
45
|
-
import "./tailnet-fFTz5Twr.js";
|
|
46
|
-
import "./net-K181nxTH.js";
|
|
47
|
-
import "./credentials-D-5Pb-aZ.js";
|
|
48
|
-
import "./routes-4k2kpvoT.js";
|
|
49
|
-
import "./frontmatter-Cgg0ICvh.js";
|
|
50
|
-
import "./env-overrides-DBQl3LRc.js";
|
|
51
|
-
import "./path-alias-guards-BtSO7sk7.js";
|
|
52
|
-
import "./skills-CbB5b27M.js";
|
|
53
|
-
import { n as materializeWindowsSpawnProgram, r as resolveWindowsSpawnProgram } from "./windows-spawn-Du1a57S-.js";
|
|
54
|
-
import "./ports-Ca74cFb2.js";
|
|
55
|
-
import "./ports-lsof-CoiADo0p.js";
|
|
56
|
-
import "./ssh-tunnel-DsY-9yao.js";
|
|
57
|
-
import "./image-ops-Ck_D_vpe.js";
|
|
58
|
-
import "./fs-safe-CRXFoBmh.js";
|
|
59
|
-
import "./mime-DGFQe4XX.js";
|
|
60
|
-
import "./server-middleware-Djfoa1s0.js";
|
|
61
|
-
import { _ as GATEWAY_CLIENT_MODES, v as GATEWAY_CLIENT_NAMES } from "./message-channel-DFE4FuE_.js";
|
|
62
|
-
import "./resolve-route-CSHDsa_m.js";
|
|
63
|
-
import "./internal-hooks-83AcmxP3.js";
|
|
64
|
-
import "./lazy-runtime-BoGB4usD.js";
|
|
65
|
-
import "./config-schema-BNU4GQh_.js";
|
|
66
|
-
import { u as GatewayClient } from "./method-scopes-CQE7-bZ-.js";
|
|
67
|
-
import "./session-cost-usage-DWgQk6XT.js";
|
|
68
|
-
import "./paths-ApLcu1Uu.js";
|
|
69
|
-
import "./routing-DQ-fpTaA.js";
|
|
70
|
-
import "./send-BuNhp8PH.js";
|
|
71
|
-
import "./node-resolve-D5Hvcgyx.js";
|
|
72
|
-
import "./provider-stream-DrUD69ai.js";
|
|
73
|
-
import "./identity-file-sshkKKIr.js";
|
|
74
|
-
import "./provider-models-BCId_Lfu.js";
|
|
75
|
-
import "./secret-file-p1IhQzwJ.js";
|
|
76
|
-
import "./logging-Dy7UYzIN.js";
|
|
77
|
-
import "./runtime-env-BlEtPF6b.js";
|
|
78
|
-
import { f as listKnownProviderAuthEnvVarNames, m as omitEnvKeysCaseInsensitive } from "./registry-BFMbkmgR.js";
|
|
79
|
-
import "./provider-onboard-Ca0TaNud.js";
|
|
80
|
-
import "./model-definitions-Cyyzm6Kr.js";
|
|
81
|
-
import "./usage-N3bxnbmt.js";
|
|
82
|
-
import "./device-identity-CRfhC3_s.js";
|
|
83
|
-
import "./auth-Byfp0flq.js";
|
|
84
|
-
import "./subscription-BhZORXN9.js";
|
|
85
|
-
import "./diagnostic-D96Xaqrj.js";
|
|
86
|
-
import "./message-hook-mappers-CeiHXgSQ.js";
|
|
87
|
-
import "./json-store--7cBPxTG.js";
|
|
88
|
-
import { t as buildGatewayConnectionDetails } from "./call-ByEzDJ1_.js";
|
|
89
|
-
import "./multimodal-BJBBn_4F.js";
|
|
90
|
-
import "./memory-search-Cv1SBrn7.js";
|
|
91
|
-
import "./query-expansion-D_Mm5Hhi.js";
|
|
92
|
-
import "./search-manager-C7J7B3_a.js";
|
|
93
|
-
import "./core-CvDzLs7B.js";
|
|
94
|
-
import "./issue-format-B0SI57Es.js";
|
|
95
|
-
import "./logging-CxP9suT8.js";
|
|
96
|
-
import "./note-dOl5kPAy.js";
|
|
97
|
-
import "./state-paths-DsMoTg25.js";
|
|
98
|
-
import "./config-value-CtTWALxG.js";
|
|
99
|
-
import "./command-secret-targets-BFF4x_RB.js";
|
|
100
|
-
import "./brave-BoWimrLe.js";
|
|
101
|
-
import "./provider-usage-D8EZpFz9.js";
|
|
102
|
-
import "./perplexity-EZwC3y2b.js";
|
|
103
|
-
import "./restart-stale-pids-CPF1_61W.js";
|
|
104
|
-
import "./delivery-queue-BOf5wYIc.js";
|
|
105
|
-
import "./pairing-token-bu1e6z6X.js";
|
|
106
|
-
import "./accounts-J2OhhhQi.js";
|
|
107
|
-
import "./process-runtime-D27SftX_.js";
|
|
108
|
-
import "./audit-CIWW1Aqm.js";
|
|
109
|
-
import "./cli-runtime-DTCHPjCi.js";
|
|
110
|
-
import "./cli-utils-BCuSS4l6.js";
|
|
111
|
-
import "./help-format-BFzPm_8V.js";
|
|
112
|
-
import "./progress-Cwq59vgZ.js";
|
|
113
|
-
import { n as resolveGatewayConnectionAuth } from "./gateway-runtime-D89mSQPB.js";
|
|
114
|
-
import { t as ensuremoldClawCliOnPath } from "./path-env-DnnsnURr.js";
|
|
115
|
-
import { t as DANGEROUS_ACP_TOOLS } from "./dangerous-tools-DZGG7YEe.js";
|
|
116
|
-
import { t as readSecretFromFile } from "./secret-file-Dx1hdWXq.js";
|
|
117
|
-
import { fileURLToPath } from "node:url";
|
|
118
|
-
import fs from "node:fs";
|
|
119
|
-
import path from "node:path";
|
|
120
|
-
import { spawn } from "node:child_process";
|
|
121
|
-
import os, { homedir } from "node:os";
|
|
122
|
-
import { randomUUID } from "node:crypto";
|
|
123
|
-
import { Readable, Writable } from "node:stream";
|
|
124
|
-
import * as readline$1 from "node:readline";
|
|
125
|
-
import { AgentSideConnection, ClientSideConnection, PROTOCOL_VERSION, ndJsonStream } from "@agentclientprotocol/sdk";
|
|
126
|
-
//#region src/acp/client.ts
|
|
127
|
-
const SAFE_AUTO_APPROVE_TOOL_IDS = new Set([
|
|
128
|
-
"read",
|
|
129
|
-
"search",
|
|
130
|
-
"web_search",
|
|
131
|
-
"memory_search"
|
|
132
|
-
]);
|
|
133
|
-
const TRUSTED_SAFE_TOOL_ALIASES = new Set(["search"]);
|
|
134
|
-
const READ_TOOL_PATH_KEYS = [
|
|
135
|
-
"path",
|
|
136
|
-
"file_path",
|
|
137
|
-
"filePath"
|
|
138
|
-
];
|
|
139
|
-
const TOOL_NAME_MAX_LENGTH = 128;
|
|
140
|
-
const TOOL_NAME_PATTERN = /^[a-z0-9._-]+$/;
|
|
141
|
-
const TOOL_KIND_BY_ID = new Map([
|
|
142
|
-
["read", "read"],
|
|
143
|
-
["search", "search"],
|
|
144
|
-
["web_search", "search"],
|
|
145
|
-
["memory_search", "search"]
|
|
146
|
-
]);
|
|
147
|
-
function asRecord$1(value) {
|
|
148
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
149
|
-
}
|
|
150
|
-
function readFirstStringValue(source, keys) {
|
|
151
|
-
if (!source) return;
|
|
152
|
-
for (const key of keys) {
|
|
153
|
-
const value = source[key];
|
|
154
|
-
if (typeof value === "string" && value.trim()) return value.trim();
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function normalizeToolName(value) {
|
|
158
|
-
const normalized = value.trim().toLowerCase();
|
|
159
|
-
if (!normalized || normalized.length > TOOL_NAME_MAX_LENGTH) return;
|
|
160
|
-
if (!TOOL_NAME_PATTERN.test(normalized)) return;
|
|
161
|
-
return normalized;
|
|
162
|
-
}
|
|
163
|
-
function parseToolNameFromTitle(title) {
|
|
164
|
-
if (!title) return;
|
|
165
|
-
const head = title.split(":", 1)[0]?.trim();
|
|
166
|
-
if (!head) return;
|
|
167
|
-
return normalizeToolName(head);
|
|
168
|
-
}
|
|
169
|
-
function resolveToolKindForPermission(toolName) {
|
|
170
|
-
if (!toolName) return;
|
|
171
|
-
return TOOL_KIND_BY_ID.get(toolName) ?? "other";
|
|
172
|
-
}
|
|
173
|
-
function resolveToolNameForPermission(params) {
|
|
174
|
-
const toolCall = params.toolCall;
|
|
175
|
-
const toolMeta = asRecord$1(toolCall?._meta);
|
|
176
|
-
const rawInput = asRecord$1(toolCall?.rawInput);
|
|
177
|
-
const fromMeta = readFirstStringValue(toolMeta, [
|
|
178
|
-
"toolName",
|
|
179
|
-
"tool_name",
|
|
180
|
-
"name"
|
|
181
|
-
]);
|
|
182
|
-
const fromRawInput = readFirstStringValue(rawInput, [
|
|
183
|
-
"tool",
|
|
184
|
-
"toolName",
|
|
185
|
-
"tool_name",
|
|
186
|
-
"name"
|
|
187
|
-
]);
|
|
188
|
-
const fromTitle = parseToolNameFromTitle(toolCall?.title);
|
|
189
|
-
const metaName = fromMeta ? normalizeToolName(fromMeta) : void 0;
|
|
190
|
-
const rawInputName = fromRawInput ? normalizeToolName(fromRawInput) : void 0;
|
|
191
|
-
const titleName = fromTitle;
|
|
192
|
-
if (fromMeta && !metaName || fromRawInput && !rawInputName) return;
|
|
193
|
-
if (metaName && titleName && metaName !== titleName) return;
|
|
194
|
-
if (rawInputName && metaName && rawInputName !== metaName) return;
|
|
195
|
-
if (rawInputName && titleName && rawInputName !== titleName) return;
|
|
196
|
-
return metaName ?? titleName ?? rawInputName;
|
|
197
|
-
}
|
|
198
|
-
function extractPathFromToolTitle(toolTitle, toolName) {
|
|
199
|
-
if (!toolTitle) return;
|
|
200
|
-
const separator = toolTitle.indexOf(":");
|
|
201
|
-
if (separator < 0) return;
|
|
202
|
-
const tail = toolTitle.slice(separator + 1).trim();
|
|
203
|
-
if (!tail) return;
|
|
204
|
-
const keyedMatch = tail.match(/(?:^|,\s*)(?:path|file_path|filePath)\s*:\s*([^,]+)/);
|
|
205
|
-
if (keyedMatch?.[1]) return keyedMatch[1].trim();
|
|
206
|
-
if (toolName === "read") return tail;
|
|
207
|
-
}
|
|
208
|
-
function resolveToolPathCandidate(params, toolName, toolTitle) {
|
|
209
|
-
const fromRawInput = readFirstStringValue(asRecord$1(params.toolCall?.rawInput), READ_TOOL_PATH_KEYS);
|
|
210
|
-
const fromTitle = extractPathFromToolTitle(toolTitle, toolName);
|
|
211
|
-
return fromRawInput ?? fromTitle;
|
|
212
|
-
}
|
|
213
|
-
function resolveAbsoluteScopedPath(value, cwd) {
|
|
214
|
-
let candidate = value.trim();
|
|
215
|
-
if (!candidate) return;
|
|
216
|
-
if (candidate.startsWith("file://")) try {
|
|
217
|
-
const parsed = new URL(candidate);
|
|
218
|
-
candidate = decodeURIComponent(parsed.pathname || "");
|
|
219
|
-
} catch {
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
if (candidate === "~") candidate = homedir();
|
|
223
|
-
else if (candidate.startsWith("~/")) candidate = path.join(homedir(), candidate.slice(2));
|
|
224
|
-
return path.isAbsolute(candidate) ? path.normalize(candidate) : path.resolve(cwd, candidate);
|
|
225
|
-
}
|
|
226
|
-
function isPathWithinRoot(candidatePath, root) {
|
|
227
|
-
const relative = path.relative(root, candidatePath);
|
|
228
|
-
return relative === "" || !relative.startsWith("..") && !path.isAbsolute(relative);
|
|
229
|
-
}
|
|
230
|
-
function isReadToolCallScopedToCwd(params, toolName, toolTitle, cwd) {
|
|
231
|
-
if (toolName !== "read") return false;
|
|
232
|
-
const rawPath = resolveToolPathCandidate(params, toolName, toolTitle);
|
|
233
|
-
if (!rawPath) return false;
|
|
234
|
-
const absolutePath = resolveAbsoluteScopedPath(rawPath, cwd);
|
|
235
|
-
if (!absolutePath) return false;
|
|
236
|
-
return isPathWithinRoot(absolutePath, path.resolve(cwd));
|
|
237
|
-
}
|
|
238
|
-
function shouldAutoApproveToolCall(params, toolName, toolTitle, cwd) {
|
|
239
|
-
const isTrustedToolId = typeof toolName === "string" && (isKnownCoreToolId(toolName) || TRUSTED_SAFE_TOOL_ALIASES.has(toolName));
|
|
240
|
-
if (!toolName || !isTrustedToolId || !SAFE_AUTO_APPROVE_TOOL_IDS.has(toolName)) return false;
|
|
241
|
-
if (toolName === "read") return isReadToolCallScopedToCwd(params, toolName, toolTitle, cwd);
|
|
242
|
-
return true;
|
|
243
|
-
}
|
|
244
|
-
function pickOption(options, kinds) {
|
|
245
|
-
for (const kind of kinds) {
|
|
246
|
-
const match = options.find((option) => option.kind === kind);
|
|
247
|
-
if (match) return match;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
function selectedPermission(optionId) {
|
|
251
|
-
return { outcome: {
|
|
252
|
-
outcome: "selected",
|
|
253
|
-
optionId
|
|
254
|
-
} };
|
|
255
|
-
}
|
|
256
|
-
function cancelledPermission() {
|
|
257
|
-
return { outcome: { outcome: "cancelled" } };
|
|
258
|
-
}
|
|
259
|
-
function promptUserPermission(toolName, toolTitle) {
|
|
260
|
-
if (!process.stdin.isTTY || !process.stderr.isTTY) {
|
|
261
|
-
console.error(`[permission denied] ${toolName ?? "unknown"}: non-interactive terminal`);
|
|
262
|
-
return Promise.resolve(false);
|
|
263
|
-
}
|
|
264
|
-
return new Promise((resolve) => {
|
|
265
|
-
let settled = false;
|
|
266
|
-
const rl = readline$1.createInterface({
|
|
267
|
-
input: process.stdin,
|
|
268
|
-
output: process.stderr
|
|
269
|
-
});
|
|
270
|
-
const finish = (approved) => {
|
|
271
|
-
if (settled) return;
|
|
272
|
-
settled = true;
|
|
273
|
-
clearTimeout(timeout);
|
|
274
|
-
rl.close();
|
|
275
|
-
resolve(approved);
|
|
276
|
-
};
|
|
277
|
-
const timeout = setTimeout(() => {
|
|
278
|
-
console.error(`\n[permission timeout] denied: ${toolName ?? "unknown"}`);
|
|
279
|
-
finish(false);
|
|
280
|
-
}, 3e4);
|
|
281
|
-
const label = toolTitle ? toolName ? `${toolTitle} (${toolName})` : toolTitle : toolName ?? "unknown tool";
|
|
282
|
-
rl.question(`\n[permission] Allow "${label}"? (y/N) `, (answer) => {
|
|
283
|
-
const approved = answer.trim().toLowerCase() === "y";
|
|
284
|
-
console.error(`[permission ${approved ? "approved" : "denied"}] ${toolName ?? "unknown"}`);
|
|
285
|
-
finish(approved);
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
async function resolvePermissionRequest(params, deps = {}) {
|
|
290
|
-
const log = deps.log ?? ((line) => console.error(line));
|
|
291
|
-
const prompt = deps.prompt ?? promptUserPermission;
|
|
292
|
-
const cwd = deps.cwd ?? process.cwd();
|
|
293
|
-
const options = params.options ?? [];
|
|
294
|
-
const toolTitle = params.toolCall?.title ?? "tool";
|
|
295
|
-
const toolName = resolveToolNameForPermission(params);
|
|
296
|
-
const toolKind = resolveToolKindForPermission(toolName);
|
|
297
|
-
if (options.length === 0) {
|
|
298
|
-
log(`[permission cancelled] ${toolName ?? "unknown"}: no options available`);
|
|
299
|
-
return cancelledPermission();
|
|
300
|
-
}
|
|
301
|
-
const allowOption = pickOption(options, ["allow_once", "allow_always"]);
|
|
302
|
-
const rejectOption = pickOption(options, ["reject_once", "reject_always"]);
|
|
303
|
-
const autoApproveAllowed = shouldAutoApproveToolCall(params, toolName, toolTitle, cwd);
|
|
304
|
-
if (!(!toolName || !autoApproveAllowed || DANGEROUS_ACP_TOOLS.has(toolName))) {
|
|
305
|
-
const option = allowOption ?? options[0];
|
|
306
|
-
if (!option) {
|
|
307
|
-
log(`[permission cancelled] ${toolName}: no selectable options`);
|
|
308
|
-
return cancelledPermission();
|
|
309
|
-
}
|
|
310
|
-
log(`[permission auto-approved] ${toolName} (${toolKind ?? "unknown"})`);
|
|
311
|
-
return selectedPermission(option.optionId);
|
|
312
|
-
}
|
|
313
|
-
log(`\n[permission requested] ${toolTitle}${toolName ? ` (${toolName})` : ""}${toolKind ? ` [${toolKind}]` : ""}`);
|
|
314
|
-
const approved = await prompt(toolName, toolTitle);
|
|
315
|
-
if (approved && allowOption) return selectedPermission(allowOption.optionId);
|
|
316
|
-
if (!approved && rejectOption) return selectedPermission(rejectOption.optionId);
|
|
317
|
-
log(`[permission cancelled] ${toolName ?? "unknown"}: missing ${approved ? "allow" : "reject"} option`);
|
|
318
|
-
return cancelledPermission();
|
|
319
|
-
}
|
|
320
|
-
function toArgs(value) {
|
|
321
|
-
if (!value) return [];
|
|
322
|
-
return Array.isArray(value) ? value : [value];
|
|
323
|
-
}
|
|
324
|
-
function buildServerArgs(opts) {
|
|
325
|
-
const args = ["acp", ...toArgs(opts.serverArgs)];
|
|
326
|
-
if (opts.serverVerbose && !args.includes("--verbose") && !args.includes("-v")) args.push("--verbose");
|
|
327
|
-
return args;
|
|
328
|
-
}
|
|
329
|
-
function resolveAcpClientSpawnEnv(baseEnv = process.env, options = {}) {
|
|
330
|
-
const env = omitEnvKeysCaseInsensitive(baseEnv, options.stripKeys ?? []);
|
|
331
|
-
env.MOLDCLAW_SHELL = "acp-client";
|
|
332
|
-
return env;
|
|
333
|
-
}
|
|
334
|
-
function shouldStripProviderAuthEnvVarsForAcpServer(params = {}) {
|
|
335
|
-
const serverCommand = params.serverCommand?.trim();
|
|
336
|
-
if (!serverCommand) return true;
|
|
337
|
-
const defaultServerCommand = params.defaultServerCommand?.trim();
|
|
338
|
-
if (!defaultServerCommand || serverCommand !== defaultServerCommand) return false;
|
|
339
|
-
const serverArgs = params.serverArgs ?? [];
|
|
340
|
-
const defaultServerArgs = params.defaultServerArgs ?? [];
|
|
341
|
-
return serverArgs.length === defaultServerArgs.length && serverArgs.every((arg, index) => arg === defaultServerArgs[index]);
|
|
342
|
-
}
|
|
343
|
-
function buildAcpClientStripKeys(params) {
|
|
344
|
-
const stripKeys = new Set(params.activeSkillEnvKeys ?? []);
|
|
345
|
-
if (params.stripProviderAuthEnvVars) for (const key of listKnownProviderAuthEnvVarNames()) stripKeys.add(key);
|
|
346
|
-
return stripKeys;
|
|
347
|
-
}
|
|
348
|
-
const DEFAULT_ACP_SPAWN_RUNTIME = {
|
|
349
|
-
platform: process.platform,
|
|
350
|
-
env: process.env,
|
|
351
|
-
execPath: process.execPath
|
|
352
|
-
};
|
|
353
|
-
function resolveAcpClientSpawnInvocation(params, runtime = DEFAULT_ACP_SPAWN_RUNTIME) {
|
|
354
|
-
const resolved = materializeWindowsSpawnProgram(resolveWindowsSpawnProgram({
|
|
355
|
-
command: params.serverCommand,
|
|
356
|
-
platform: runtime.platform,
|
|
357
|
-
env: runtime.env,
|
|
358
|
-
execPath: runtime.execPath,
|
|
359
|
-
packageName: "moldclaw",
|
|
360
|
-
allowShellFallback: true
|
|
361
|
-
}), params.serverArgs);
|
|
362
|
-
return {
|
|
363
|
-
command: resolved.command,
|
|
364
|
-
args: resolved.argv,
|
|
365
|
-
shell: resolved.shell,
|
|
366
|
-
windowsHide: resolved.windowsHide
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
function resolveSelfEntryPath() {
|
|
370
|
-
try {
|
|
371
|
-
const here = fileURLToPath(import.meta.url);
|
|
372
|
-
const candidate = path.resolve(path.dirname(here), "..", "entry.js");
|
|
373
|
-
if (fs.existsSync(candidate)) return candidate;
|
|
374
|
-
} catch {}
|
|
375
|
-
const argv1 = process.argv[1]?.trim();
|
|
376
|
-
if (argv1) return path.isAbsolute(argv1) ? argv1 : path.resolve(process.cwd(), argv1);
|
|
377
|
-
return null;
|
|
378
|
-
}
|
|
379
|
-
function printSessionUpdate(notification) {
|
|
380
|
-
const update = notification.update;
|
|
381
|
-
if (!("sessionUpdate" in update)) return;
|
|
382
|
-
switch (update.sessionUpdate) {
|
|
383
|
-
case "agent_message_chunk":
|
|
384
|
-
if (update.content?.type === "text") process.stdout.write(update.content.text);
|
|
385
|
-
return;
|
|
386
|
-
case "tool_call":
|
|
387
|
-
console.log(`\n[tool] ${update.title} (${update.status})`);
|
|
388
|
-
return;
|
|
389
|
-
case "tool_call_update":
|
|
390
|
-
if (update.status) console.log(`[tool update] ${update.toolCallId}: ${update.status}`);
|
|
391
|
-
return;
|
|
392
|
-
case "available_commands_update": {
|
|
393
|
-
const names = update.availableCommands?.map((cmd) => `/${cmd.name}`).join(" ");
|
|
394
|
-
if (names) console.log(`\n[commands] ${names}`);
|
|
395
|
-
return;
|
|
396
|
-
}
|
|
397
|
-
default: return;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
async function createAcpClient(opts = {}) {
|
|
401
|
-
const cwd = opts.cwd ?? process.cwd();
|
|
402
|
-
const log = Boolean(opts.verbose) ? (msg) => console.error(`[acp-client] ${msg}`) : () => {};
|
|
403
|
-
ensuremoldClawCliOnPath();
|
|
404
|
-
const serverArgs = buildServerArgs(opts);
|
|
405
|
-
const entryPath = resolveSelfEntryPath();
|
|
406
|
-
const defaultServerCommand = entryPath ? process.execPath : "moldclaw";
|
|
407
|
-
const defaultServerArgs = entryPath ? [entryPath, ...serverArgs] : serverArgs;
|
|
408
|
-
const serverCommand = opts.serverCommand ?? defaultServerCommand;
|
|
409
|
-
const effectiveArgs = opts.serverCommand || !entryPath ? serverArgs : defaultServerArgs;
|
|
410
|
-
const { getActiveSkillEnvKeys } = await import("./env-overrides.runtime-BqDmxinL.js");
|
|
411
|
-
const stripKeys = buildAcpClientStripKeys({
|
|
412
|
-
stripProviderAuthEnvVars: shouldStripProviderAuthEnvVarsForAcpServer({
|
|
413
|
-
serverCommand,
|
|
414
|
-
serverArgs: effectiveArgs,
|
|
415
|
-
defaultServerCommand,
|
|
416
|
-
defaultServerArgs
|
|
417
|
-
}),
|
|
418
|
-
activeSkillEnvKeys: getActiveSkillEnvKeys()
|
|
419
|
-
});
|
|
420
|
-
const spawnEnv = resolveAcpClientSpawnEnv(process.env, { stripKeys });
|
|
421
|
-
const spawnInvocation = resolveAcpClientSpawnInvocation({
|
|
422
|
-
serverCommand,
|
|
423
|
-
serverArgs: effectiveArgs
|
|
424
|
-
}, {
|
|
425
|
-
platform: process.platform,
|
|
426
|
-
env: spawnEnv,
|
|
427
|
-
execPath: process.execPath
|
|
428
|
-
});
|
|
429
|
-
log(`spawning: ${spawnInvocation.command} ${spawnInvocation.args.join(" ")}`);
|
|
430
|
-
const agent = spawn(spawnInvocation.command, spawnInvocation.args, {
|
|
431
|
-
stdio: [
|
|
432
|
-
"pipe",
|
|
433
|
-
"pipe",
|
|
434
|
-
"inherit"
|
|
435
|
-
],
|
|
436
|
-
cwd,
|
|
437
|
-
env: spawnEnv,
|
|
438
|
-
shell: spawnInvocation.shell,
|
|
439
|
-
windowsHide: spawnInvocation.windowsHide
|
|
440
|
-
});
|
|
441
|
-
if (!agent.stdin || !agent.stdout) throw new Error("Failed to create ACP stdio pipes");
|
|
442
|
-
const client = new ClientSideConnection(() => ({
|
|
443
|
-
sessionUpdate: async (params) => {
|
|
444
|
-
printSessionUpdate(params);
|
|
445
|
-
},
|
|
446
|
-
requestPermission: async (params) => {
|
|
447
|
-
return resolvePermissionRequest(params, { cwd });
|
|
448
|
-
}
|
|
449
|
-
}), ndJsonStream(Writable.toWeb(agent.stdin), Readable.toWeb(agent.stdout)));
|
|
450
|
-
log("initializing");
|
|
451
|
-
await client.initialize({
|
|
452
|
-
protocolVersion: PROTOCOL_VERSION,
|
|
453
|
-
clientCapabilities: {
|
|
454
|
-
fs: {
|
|
455
|
-
readTextFile: true,
|
|
456
|
-
writeTextFile: true
|
|
457
|
-
},
|
|
458
|
-
terminal: true
|
|
459
|
-
},
|
|
460
|
-
clientInfo: {
|
|
461
|
-
name: "moldclaw-acp-client",
|
|
462
|
-
version: "1.0.0"
|
|
463
|
-
}
|
|
464
|
-
});
|
|
465
|
-
log("creating session");
|
|
466
|
-
return {
|
|
467
|
-
client,
|
|
468
|
-
agent,
|
|
469
|
-
sessionId: (await client.newSession({
|
|
470
|
-
cwd,
|
|
471
|
-
mcpServers: []
|
|
472
|
-
})).sessionId
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
async function runAcpClientInteractive(opts = {}) {
|
|
476
|
-
const { client, agent, sessionId } = await createAcpClient(opts);
|
|
477
|
-
const rl = readline$1.createInterface({
|
|
478
|
-
input: process.stdin,
|
|
479
|
-
output: process.stdout
|
|
480
|
-
});
|
|
481
|
-
console.log("moldClaw ACP client");
|
|
482
|
-
console.log(`Session: ${sessionId}`);
|
|
483
|
-
console.log("Type a prompt, or \"exit\" to quit.\n");
|
|
484
|
-
const prompt = () => {
|
|
485
|
-
rl.question("> ", async (input) => {
|
|
486
|
-
const text = input.trim();
|
|
487
|
-
if (!text) {
|
|
488
|
-
prompt();
|
|
489
|
-
return;
|
|
490
|
-
}
|
|
491
|
-
if (text === "exit" || text === "quit") {
|
|
492
|
-
agent.kill();
|
|
493
|
-
rl.close();
|
|
494
|
-
process.exit(0);
|
|
495
|
-
}
|
|
496
|
-
try {
|
|
497
|
-
const response = await client.prompt({
|
|
498
|
-
sessionId,
|
|
499
|
-
prompt: [{
|
|
500
|
-
type: "text",
|
|
501
|
-
text
|
|
502
|
-
}]
|
|
503
|
-
});
|
|
504
|
-
console.log(`\n[${response.stopReason}]\n`);
|
|
505
|
-
} catch (err) {
|
|
506
|
-
console.error(`\n[error] ${String(err)}\n`);
|
|
507
|
-
}
|
|
508
|
-
prompt();
|
|
509
|
-
});
|
|
510
|
-
};
|
|
511
|
-
prompt();
|
|
512
|
-
agent.on("exit", (code) => {
|
|
513
|
-
console.log(`\nAgent exited with code ${code ?? 0}`);
|
|
514
|
-
rl.close();
|
|
515
|
-
process.exit(code ?? 0);
|
|
516
|
-
});
|
|
517
|
-
}
|
|
518
|
-
//#endregion
|
|
519
|
-
//#region src/infra/fixed-window-rate-limit.ts
|
|
520
|
-
function createFixedWindowRateLimiter(params) {
|
|
521
|
-
const maxRequests = Math.max(1, Math.floor(params.maxRequests));
|
|
522
|
-
const windowMs = Math.max(1, Math.floor(params.windowMs));
|
|
523
|
-
const now = params.now ?? Date.now;
|
|
524
|
-
let count = 0;
|
|
525
|
-
let windowStartMs = 0;
|
|
526
|
-
return {
|
|
527
|
-
consume() {
|
|
528
|
-
const nowMs = now();
|
|
529
|
-
if (nowMs - windowStartMs >= windowMs) {
|
|
530
|
-
windowStartMs = nowMs;
|
|
531
|
-
count = 0;
|
|
532
|
-
}
|
|
533
|
-
if (count >= maxRequests) return {
|
|
534
|
-
allowed: false,
|
|
535
|
-
retryAfterMs: Math.max(0, windowStartMs + windowMs - nowMs),
|
|
536
|
-
remaining: 0
|
|
537
|
-
};
|
|
538
|
-
count += 1;
|
|
539
|
-
return {
|
|
540
|
-
allowed: true,
|
|
541
|
-
retryAfterMs: 0,
|
|
542
|
-
remaining: Math.max(0, maxRequests - count)
|
|
543
|
-
};
|
|
544
|
-
},
|
|
545
|
-
reset() {
|
|
546
|
-
count = 0;
|
|
547
|
-
windowStartMs = 0;
|
|
548
|
-
}
|
|
549
|
-
};
|
|
550
|
-
}
|
|
551
|
-
//#endregion
|
|
552
|
-
//#region src/acp/commands.ts
|
|
553
|
-
function getAvailableCommands() {
|
|
554
|
-
return [
|
|
555
|
-
{
|
|
556
|
-
name: "help",
|
|
557
|
-
description: "Show help and common commands."
|
|
558
|
-
},
|
|
559
|
-
{
|
|
560
|
-
name: "commands",
|
|
561
|
-
description: "List available commands."
|
|
562
|
-
},
|
|
563
|
-
{
|
|
564
|
-
name: "status",
|
|
565
|
-
description: "Show current status."
|
|
566
|
-
},
|
|
567
|
-
{
|
|
568
|
-
name: "context",
|
|
569
|
-
description: "Explain context usage (list|detail|json).",
|
|
570
|
-
input: { hint: "list | detail | json" }
|
|
571
|
-
},
|
|
572
|
-
{
|
|
573
|
-
name: "whoami",
|
|
574
|
-
description: "Show sender id (alias: /id)."
|
|
575
|
-
},
|
|
576
|
-
{
|
|
577
|
-
name: "id",
|
|
578
|
-
description: "Alias for /whoami."
|
|
579
|
-
},
|
|
580
|
-
{
|
|
581
|
-
name: "subagents",
|
|
582
|
-
description: "List or manage sub-agents."
|
|
583
|
-
},
|
|
584
|
-
{
|
|
585
|
-
name: "config",
|
|
586
|
-
description: "Read or write config (owner-only)."
|
|
587
|
-
},
|
|
588
|
-
{
|
|
589
|
-
name: "debug",
|
|
590
|
-
description: "Set runtime-only overrides (owner-only)."
|
|
591
|
-
},
|
|
592
|
-
{
|
|
593
|
-
name: "usage",
|
|
594
|
-
description: "Toggle usage footer (off|tokens|full)."
|
|
595
|
-
},
|
|
596
|
-
{
|
|
597
|
-
name: "stop",
|
|
598
|
-
description: "Stop the current run."
|
|
599
|
-
},
|
|
600
|
-
{
|
|
601
|
-
name: "restart",
|
|
602
|
-
description: "Restart the gateway (if enabled)."
|
|
603
|
-
},
|
|
604
|
-
{
|
|
605
|
-
name: "dock-telegram",
|
|
606
|
-
description: "Route replies to Telegram."
|
|
607
|
-
},
|
|
608
|
-
{
|
|
609
|
-
name: "dock-discord",
|
|
610
|
-
description: "Route replies to Discord."
|
|
611
|
-
},
|
|
612
|
-
{
|
|
613
|
-
name: "dock-slack",
|
|
614
|
-
description: "Route replies to Slack."
|
|
615
|
-
},
|
|
616
|
-
{
|
|
617
|
-
name: "activation",
|
|
618
|
-
description: "Set group activation (mention|always)."
|
|
619
|
-
},
|
|
620
|
-
{
|
|
621
|
-
name: "send",
|
|
622
|
-
description: "Set send mode (on|off|inherit)."
|
|
623
|
-
},
|
|
624
|
-
{
|
|
625
|
-
name: "reset",
|
|
626
|
-
description: "Reset the session (/new)."
|
|
627
|
-
},
|
|
628
|
-
{
|
|
629
|
-
name: "new",
|
|
630
|
-
description: "Reset the session (/reset)."
|
|
631
|
-
},
|
|
632
|
-
{
|
|
633
|
-
name: "think",
|
|
634
|
-
description: "Set thinking level (off|minimal|low|medium|high|xhigh)."
|
|
635
|
-
},
|
|
636
|
-
{
|
|
637
|
-
name: "verbose",
|
|
638
|
-
description: "Set verbose mode (on|full|off)."
|
|
639
|
-
},
|
|
640
|
-
{
|
|
641
|
-
name: "reasoning",
|
|
642
|
-
description: "Toggle reasoning output (on|off|stream)."
|
|
643
|
-
},
|
|
644
|
-
{
|
|
645
|
-
name: "elevated",
|
|
646
|
-
description: "Toggle elevated mode (on|off)."
|
|
647
|
-
},
|
|
648
|
-
{
|
|
649
|
-
name: "model",
|
|
650
|
-
description: "Select a model (list|status|<name>)."
|
|
651
|
-
},
|
|
652
|
-
{
|
|
653
|
-
name: "queue",
|
|
654
|
-
description: "Adjust queue mode and options."
|
|
655
|
-
},
|
|
656
|
-
{
|
|
657
|
-
name: "bash",
|
|
658
|
-
description: "Run a host command (if enabled)."
|
|
659
|
-
},
|
|
660
|
-
{
|
|
661
|
-
name: "compact",
|
|
662
|
-
description: "Compact the session history."
|
|
663
|
-
}
|
|
664
|
-
];
|
|
665
|
-
}
|
|
666
|
-
//#endregion
|
|
667
|
-
//#region src/acp/event-mapper.ts
|
|
668
|
-
const TOOL_LOCATION_PATH_KEYS = [
|
|
669
|
-
"path",
|
|
670
|
-
"filePath",
|
|
671
|
-
"file_path",
|
|
672
|
-
"targetPath",
|
|
673
|
-
"target_path",
|
|
674
|
-
"targetFile",
|
|
675
|
-
"target_file",
|
|
676
|
-
"sourcePath",
|
|
677
|
-
"source_path",
|
|
678
|
-
"destinationPath",
|
|
679
|
-
"destination_path",
|
|
680
|
-
"oldPath",
|
|
681
|
-
"old_path",
|
|
682
|
-
"newPath",
|
|
683
|
-
"new_path",
|
|
684
|
-
"outputPath",
|
|
685
|
-
"output_path",
|
|
686
|
-
"inputPath",
|
|
687
|
-
"input_path"
|
|
688
|
-
];
|
|
689
|
-
const TOOL_LOCATION_LINE_KEYS = [
|
|
690
|
-
"line",
|
|
691
|
-
"lineNumber",
|
|
692
|
-
"line_number",
|
|
693
|
-
"startLine",
|
|
694
|
-
"start_line"
|
|
695
|
-
];
|
|
696
|
-
const TOOL_RESULT_PATH_MARKER_RE = /^(?:FILE|MEDIA):(.+)$/gm;
|
|
697
|
-
const TOOL_LOCATION_MAX_DEPTH = 4;
|
|
698
|
-
const TOOL_LOCATION_MAX_NODES = 100;
|
|
699
|
-
const INLINE_CONTROL_ESCAPE_MAP = {
|
|
700
|
-
"\0": "\\0",
|
|
701
|
-
"\r": "\\r",
|
|
702
|
-
"\n": "\\n",
|
|
703
|
-
" ": "\\t",
|
|
704
|
-
"\v": "\\v",
|
|
705
|
-
"\f": "\\f",
|
|
706
|
-
"\u2028": "\\u2028",
|
|
707
|
-
"\u2029": "\\u2029"
|
|
708
|
-
};
|
|
709
|
-
function escapeInlineControlChars(value) {
|
|
710
|
-
let escaped = "";
|
|
711
|
-
for (const char of value) {
|
|
712
|
-
const codePoint = char.codePointAt(0);
|
|
713
|
-
if (codePoint === void 0) {
|
|
714
|
-
escaped += char;
|
|
715
|
-
continue;
|
|
716
|
-
}
|
|
717
|
-
if (!(codePoint <= 31 || codePoint >= 127 && codePoint <= 159 || codePoint === 8232 || codePoint === 8233)) {
|
|
718
|
-
escaped += char;
|
|
719
|
-
continue;
|
|
720
|
-
}
|
|
721
|
-
const mapped = INLINE_CONTROL_ESCAPE_MAP[char];
|
|
722
|
-
if (mapped) {
|
|
723
|
-
escaped += mapped;
|
|
724
|
-
continue;
|
|
725
|
-
}
|
|
726
|
-
escaped += codePoint <= 255 ? `\\x${codePoint.toString(16).padStart(2, "0")}` : `\\u${codePoint.toString(16).padStart(4, "0")}`;
|
|
727
|
-
}
|
|
728
|
-
return escaped;
|
|
729
|
-
}
|
|
730
|
-
function escapeResourceTitle(value) {
|
|
731
|
-
return escapeInlineControlChars(value).replace(/[()[\]]/g, (char) => `\\${char}`);
|
|
732
|
-
}
|
|
733
|
-
function asRecord(value) {
|
|
734
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
735
|
-
}
|
|
736
|
-
function normalizeToolLocationPath(value) {
|
|
737
|
-
const trimmed = value.trim();
|
|
738
|
-
if (!trimmed || trimmed.length > 4096 || trimmed.includes("\0") || trimmed.includes("\r") || trimmed.includes("\n")) return;
|
|
739
|
-
if (/^https?:\/\//i.test(trimmed)) return;
|
|
740
|
-
if (/^file:\/\//i.test(trimmed)) try {
|
|
741
|
-
const parsed = new URL(trimmed);
|
|
742
|
-
return decodeURIComponent(parsed.pathname || "") || void 0;
|
|
743
|
-
} catch {
|
|
744
|
-
return;
|
|
745
|
-
}
|
|
746
|
-
return trimmed;
|
|
747
|
-
}
|
|
748
|
-
function normalizeToolLocationLine(value) {
|
|
749
|
-
if (typeof value !== "number" || !Number.isFinite(value)) return;
|
|
750
|
-
const line = Math.floor(value);
|
|
751
|
-
return line > 0 ? line : void 0;
|
|
752
|
-
}
|
|
753
|
-
function extractToolLocationLine(record) {
|
|
754
|
-
for (const key of TOOL_LOCATION_LINE_KEYS) {
|
|
755
|
-
const line = normalizeToolLocationLine(record[key]);
|
|
756
|
-
if (line !== void 0) return line;
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
function addToolLocation(locations, rawPath, line) {
|
|
760
|
-
const path = normalizeToolLocationPath(rawPath);
|
|
761
|
-
if (!path) return;
|
|
762
|
-
for (const [existingKey, existing] of locations.entries()) {
|
|
763
|
-
if (existing.path !== path) continue;
|
|
764
|
-
if (line === void 0 || existing.line === line) return;
|
|
765
|
-
if (existing.line === void 0) locations.delete(existingKey);
|
|
766
|
-
}
|
|
767
|
-
const locationKey = `${path}:${line ?? ""}`;
|
|
768
|
-
if (locations.has(locationKey)) return;
|
|
769
|
-
locations.set(locationKey, line ? {
|
|
770
|
-
path,
|
|
771
|
-
line
|
|
772
|
-
} : { path });
|
|
773
|
-
}
|
|
774
|
-
function collectLocationsFromTextMarkers(text, locations) {
|
|
775
|
-
for (const match of text.matchAll(TOOL_RESULT_PATH_MARKER_RE)) {
|
|
776
|
-
const candidate = match[1]?.trim();
|
|
777
|
-
if (candidate) addToolLocation(locations, candidate);
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
function collectToolLocations(value, locations, state, depth) {
|
|
781
|
-
if (state.visited >= TOOL_LOCATION_MAX_NODES || depth > TOOL_LOCATION_MAX_DEPTH) return;
|
|
782
|
-
state.visited += 1;
|
|
783
|
-
if (typeof value === "string") {
|
|
784
|
-
collectLocationsFromTextMarkers(value, locations);
|
|
785
|
-
return;
|
|
786
|
-
}
|
|
787
|
-
if (!value || typeof value !== "object") return;
|
|
788
|
-
if (Array.isArray(value)) {
|
|
789
|
-
for (const item of value) {
|
|
790
|
-
collectToolLocations(item, locations, state, depth + 1);
|
|
791
|
-
if (state.visited >= TOOL_LOCATION_MAX_NODES) return;
|
|
792
|
-
}
|
|
793
|
-
return;
|
|
794
|
-
}
|
|
795
|
-
const record = value;
|
|
796
|
-
const line = extractToolLocationLine(record);
|
|
797
|
-
for (const key of TOOL_LOCATION_PATH_KEYS) {
|
|
798
|
-
const rawPath = record[key];
|
|
799
|
-
if (typeof rawPath === "string") addToolLocation(locations, rawPath, line);
|
|
800
|
-
}
|
|
801
|
-
const content = Array.isArray(record.content) ? record.content : void 0;
|
|
802
|
-
if (content) for (const block of content) {
|
|
803
|
-
const entry = asRecord(block);
|
|
804
|
-
if (entry?.type === "text" && typeof entry.text === "string") collectLocationsFromTextMarkers(entry.text, locations);
|
|
805
|
-
}
|
|
806
|
-
for (const [key, nested] of Object.entries(record)) {
|
|
807
|
-
if (key === "content") continue;
|
|
808
|
-
collectToolLocations(nested, locations, state, depth + 1);
|
|
809
|
-
if (state.visited >= TOOL_LOCATION_MAX_NODES) return;
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
function extractTextFromPrompt(prompt, maxBytes) {
|
|
813
|
-
const parts = [];
|
|
814
|
-
let totalBytes = 0;
|
|
815
|
-
for (const block of prompt) {
|
|
816
|
-
let blockText;
|
|
817
|
-
if (block.type === "text") blockText = block.text;
|
|
818
|
-
else if (block.type === "resource") {
|
|
819
|
-
const resource = block.resource;
|
|
820
|
-
if (resource?.text) blockText = resource.text;
|
|
821
|
-
} else if (block.type === "resource_link") {
|
|
822
|
-
const title = block.title ? ` (${escapeResourceTitle(block.title)})` : "";
|
|
823
|
-
const uri = block.uri ? escapeInlineControlChars(block.uri) : "";
|
|
824
|
-
blockText = uri ? `[Resource link${title}] ${uri}` : `[Resource link${title}]`;
|
|
825
|
-
}
|
|
826
|
-
if (blockText !== void 0) {
|
|
827
|
-
if (maxBytes !== void 0) {
|
|
828
|
-
const separatorBytes = parts.length > 0 ? 1 : 0;
|
|
829
|
-
totalBytes += separatorBytes + Buffer.byteLength(blockText, "utf-8");
|
|
830
|
-
if (totalBytes > maxBytes) throw new Error(`Prompt exceeds maximum allowed size of ${maxBytes} bytes`);
|
|
831
|
-
}
|
|
832
|
-
parts.push(blockText);
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
return parts.join("\n");
|
|
836
|
-
}
|
|
837
|
-
function extractAttachmentsFromPrompt(prompt) {
|
|
838
|
-
const attachments = [];
|
|
839
|
-
for (const block of prompt) {
|
|
840
|
-
if (block.type !== "image") continue;
|
|
841
|
-
const image = block;
|
|
842
|
-
if (!image.data || !image.mimeType) continue;
|
|
843
|
-
attachments.push({
|
|
844
|
-
type: "image",
|
|
845
|
-
mimeType: image.mimeType,
|
|
846
|
-
content: image.data
|
|
847
|
-
});
|
|
848
|
-
}
|
|
849
|
-
return attachments;
|
|
850
|
-
}
|
|
851
|
-
function formatToolTitle(name, args) {
|
|
852
|
-
const base = name ?? "tool";
|
|
853
|
-
if (!args || Object.keys(args).length === 0) return base;
|
|
854
|
-
return `${base}: ${Object.entries(args).map(([key, value]) => {
|
|
855
|
-
const raw = typeof value === "string" ? value : JSON.stringify(value);
|
|
856
|
-
return `${key}: ${raw.length > 100 ? `${raw.slice(0, 100)}...` : raw}`;
|
|
857
|
-
}).join(", ")}`;
|
|
858
|
-
}
|
|
859
|
-
function inferToolKind(name) {
|
|
860
|
-
if (!name) return "other";
|
|
861
|
-
const normalized = name.toLowerCase();
|
|
862
|
-
if (normalized.includes("read")) return "read";
|
|
863
|
-
if (normalized.includes("write") || normalized.includes("edit")) return "edit";
|
|
864
|
-
if (normalized.includes("delete") || normalized.includes("remove")) return "delete";
|
|
865
|
-
if (normalized.includes("move") || normalized.includes("rename")) return "move";
|
|
866
|
-
if (normalized.includes("search") || normalized.includes("find")) return "search";
|
|
867
|
-
if (normalized.includes("exec") || normalized.includes("run") || normalized.includes("bash")) return "execute";
|
|
868
|
-
if (normalized.includes("fetch") || normalized.includes("http")) return "fetch";
|
|
869
|
-
return "other";
|
|
870
|
-
}
|
|
871
|
-
function extractToolCallContent(value) {
|
|
872
|
-
if (typeof value === "string") return value.trim() ? [{
|
|
873
|
-
type: "content",
|
|
874
|
-
content: {
|
|
875
|
-
type: "text",
|
|
876
|
-
text: value
|
|
877
|
-
}
|
|
878
|
-
}] : void 0;
|
|
879
|
-
const record = asRecord(value);
|
|
880
|
-
if (!record) return;
|
|
881
|
-
const contents = [];
|
|
882
|
-
const blocks = Array.isArray(record.content) ? record.content : [];
|
|
883
|
-
for (const block of blocks) {
|
|
884
|
-
const entry = asRecord(block);
|
|
885
|
-
if (entry?.type === "text" && typeof entry.text === "string" && entry.text.trim()) contents.push({
|
|
886
|
-
type: "content",
|
|
887
|
-
content: {
|
|
888
|
-
type: "text",
|
|
889
|
-
text: entry.text
|
|
890
|
-
}
|
|
891
|
-
});
|
|
892
|
-
}
|
|
893
|
-
if (contents.length > 0) return contents;
|
|
894
|
-
const fallbackText = typeof record.text === "string" ? record.text : typeof record.message === "string" ? record.message : typeof record.error === "string" ? record.error : void 0;
|
|
895
|
-
if (!fallbackText?.trim()) return;
|
|
896
|
-
return [{
|
|
897
|
-
type: "content",
|
|
898
|
-
content: {
|
|
899
|
-
type: "text",
|
|
900
|
-
text: fallbackText
|
|
901
|
-
}
|
|
902
|
-
}];
|
|
903
|
-
}
|
|
904
|
-
function extractToolCallLocations(...values) {
|
|
905
|
-
const locations = /* @__PURE__ */ new Map();
|
|
906
|
-
for (const value of values) collectToolLocations(value, locations, { visited: 0 }, 0);
|
|
907
|
-
return locations.size > 0 ? [...locations.values()] : void 0;
|
|
908
|
-
}
|
|
909
|
-
//#endregion
|
|
910
|
-
//#region src/acp/meta.ts
|
|
911
|
-
function readString(meta, keys) {
|
|
912
|
-
if (!meta) return;
|
|
913
|
-
for (const key of keys) {
|
|
914
|
-
const value = meta[key];
|
|
915
|
-
if (typeof value === "string" && value.trim()) return value.trim();
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
function readBool(meta, keys) {
|
|
919
|
-
if (!meta) return;
|
|
920
|
-
for (const key of keys) {
|
|
921
|
-
const value = meta[key];
|
|
922
|
-
if (typeof value === "boolean") return value;
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
function readNumber(meta, keys) {
|
|
926
|
-
if (!meta) return;
|
|
927
|
-
for (const key of keys) {
|
|
928
|
-
const value = meta[key];
|
|
929
|
-
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
//#endregion
|
|
933
|
-
//#region src/acp/session-mapper.ts
|
|
934
|
-
function parseSessionMeta(meta) {
|
|
935
|
-
if (!meta || typeof meta !== "object") return {};
|
|
936
|
-
const record = meta;
|
|
937
|
-
return {
|
|
938
|
-
sessionKey: readString(record, [
|
|
939
|
-
"sessionKey",
|
|
940
|
-
"session",
|
|
941
|
-
"key"
|
|
942
|
-
]),
|
|
943
|
-
sessionLabel: readString(record, ["sessionLabel", "label"]),
|
|
944
|
-
resetSession: readBool(record, ["resetSession", "reset"]),
|
|
945
|
-
requireExisting: readBool(record, ["requireExistingSession", "requireExisting"]),
|
|
946
|
-
prefixCwd: readBool(record, ["prefixCwd"])
|
|
947
|
-
};
|
|
948
|
-
}
|
|
949
|
-
async function resolveSessionKey(params) {
|
|
950
|
-
const requestedLabel = params.meta.sessionLabel ?? params.opts.defaultSessionLabel;
|
|
951
|
-
const requestedKey = params.meta.sessionKey ?? params.opts.defaultSessionKey;
|
|
952
|
-
const requireExisting = params.meta.requireExisting ?? params.opts.requireExistingSession ?? false;
|
|
953
|
-
if (params.meta.sessionLabel) {
|
|
954
|
-
const resolved = await params.gateway.request("sessions.resolve", { label: params.meta.sessionLabel });
|
|
955
|
-
if (!resolved?.key) throw new Error(`Unable to resolve session label: ${params.meta.sessionLabel}`);
|
|
956
|
-
return resolved.key;
|
|
957
|
-
}
|
|
958
|
-
if (params.meta.sessionKey) {
|
|
959
|
-
if (!requireExisting) return params.meta.sessionKey;
|
|
960
|
-
const resolved = await params.gateway.request("sessions.resolve", { key: params.meta.sessionKey });
|
|
961
|
-
if (!resolved?.key) throw new Error(`Session key not found: ${params.meta.sessionKey}`);
|
|
962
|
-
return resolved.key;
|
|
963
|
-
}
|
|
964
|
-
if (requestedLabel) {
|
|
965
|
-
const resolved = await params.gateway.request("sessions.resolve", { label: requestedLabel });
|
|
966
|
-
if (!resolved?.key) throw new Error(`Unable to resolve session label: ${requestedLabel}`);
|
|
967
|
-
return resolved.key;
|
|
968
|
-
}
|
|
969
|
-
if (requestedKey) {
|
|
970
|
-
if (!requireExisting) return requestedKey;
|
|
971
|
-
const resolved = await params.gateway.request("sessions.resolve", { key: requestedKey });
|
|
972
|
-
if (!resolved?.key) throw new Error(`Session key not found: ${requestedKey}`);
|
|
973
|
-
return resolved.key;
|
|
974
|
-
}
|
|
975
|
-
return params.fallbackKey;
|
|
976
|
-
}
|
|
977
|
-
async function resetSessionIfNeeded(params) {
|
|
978
|
-
if (!(params.meta.resetSession ?? params.opts.resetSession ?? false)) return;
|
|
979
|
-
await params.gateway.request("sessions.reset", { key: params.sessionKey });
|
|
980
|
-
}
|
|
981
|
-
//#endregion
|
|
982
|
-
//#region src/acp/session.ts
|
|
983
|
-
const DEFAULT_MAX_SESSIONS = 5e3;
|
|
984
|
-
const DEFAULT_IDLE_TTL_MS = 1440 * 60 * 1e3;
|
|
985
|
-
function createInMemorySessionStore(options = {}) {
|
|
986
|
-
const maxSessions = Math.max(1, options.maxSessions ?? DEFAULT_MAX_SESSIONS);
|
|
987
|
-
const idleTtlMs = Math.max(1e3, options.idleTtlMs ?? DEFAULT_IDLE_TTL_MS);
|
|
988
|
-
const now = options.now ?? Date.now;
|
|
989
|
-
const sessions = /* @__PURE__ */ new Map();
|
|
990
|
-
const runIdToSessionId = /* @__PURE__ */ new Map();
|
|
991
|
-
const touchSession = (session, nowMs) => {
|
|
992
|
-
session.lastTouchedAt = nowMs;
|
|
993
|
-
};
|
|
994
|
-
const removeSession = (sessionId) => {
|
|
995
|
-
const session = sessions.get(sessionId);
|
|
996
|
-
if (!session) return false;
|
|
997
|
-
if (session.activeRunId) runIdToSessionId.delete(session.activeRunId);
|
|
998
|
-
session.abortController?.abort();
|
|
999
|
-
sessions.delete(sessionId);
|
|
1000
|
-
return true;
|
|
1001
|
-
};
|
|
1002
|
-
const reapIdleSessions = (nowMs) => {
|
|
1003
|
-
const idleBefore = nowMs - idleTtlMs;
|
|
1004
|
-
for (const [sessionId, session] of sessions.entries()) {
|
|
1005
|
-
if (session.activeRunId || session.abortController) continue;
|
|
1006
|
-
if (session.lastTouchedAt > idleBefore) continue;
|
|
1007
|
-
removeSession(sessionId);
|
|
1008
|
-
}
|
|
1009
|
-
};
|
|
1010
|
-
const evictOldestIdleSession = () => {
|
|
1011
|
-
let oldestSessionId = null;
|
|
1012
|
-
let oldestLastTouchedAt = Number.POSITIVE_INFINITY;
|
|
1013
|
-
for (const [sessionId, session] of sessions.entries()) {
|
|
1014
|
-
if (session.activeRunId || session.abortController) continue;
|
|
1015
|
-
if (session.lastTouchedAt >= oldestLastTouchedAt) continue;
|
|
1016
|
-
oldestLastTouchedAt = session.lastTouchedAt;
|
|
1017
|
-
oldestSessionId = sessionId;
|
|
1018
|
-
}
|
|
1019
|
-
if (!oldestSessionId) return false;
|
|
1020
|
-
return removeSession(oldestSessionId);
|
|
1021
|
-
};
|
|
1022
|
-
const createSession = (params) => {
|
|
1023
|
-
const nowMs = now();
|
|
1024
|
-
const sessionId = params.sessionId ?? randomUUID();
|
|
1025
|
-
const existingSession = sessions.get(sessionId);
|
|
1026
|
-
if (existingSession) {
|
|
1027
|
-
existingSession.sessionKey = params.sessionKey;
|
|
1028
|
-
existingSession.cwd = params.cwd;
|
|
1029
|
-
touchSession(existingSession, nowMs);
|
|
1030
|
-
return existingSession;
|
|
1031
|
-
}
|
|
1032
|
-
reapIdleSessions(nowMs);
|
|
1033
|
-
if (sessions.size >= maxSessions && !evictOldestIdleSession()) throw new Error(`ACP session limit reached (max ${maxSessions}). Close idle ACP clients and retry.`);
|
|
1034
|
-
const session = {
|
|
1035
|
-
sessionId,
|
|
1036
|
-
sessionKey: params.sessionKey,
|
|
1037
|
-
cwd: params.cwd,
|
|
1038
|
-
createdAt: nowMs,
|
|
1039
|
-
lastTouchedAt: nowMs,
|
|
1040
|
-
abortController: null,
|
|
1041
|
-
activeRunId: null
|
|
1042
|
-
};
|
|
1043
|
-
sessions.set(sessionId, session);
|
|
1044
|
-
return session;
|
|
1045
|
-
};
|
|
1046
|
-
const hasSession = (sessionId) => sessions.has(sessionId);
|
|
1047
|
-
const getSession = (sessionId) => {
|
|
1048
|
-
const session = sessions.get(sessionId);
|
|
1049
|
-
if (session) touchSession(session, now());
|
|
1050
|
-
return session;
|
|
1051
|
-
};
|
|
1052
|
-
const getSessionByRunId = (runId) => {
|
|
1053
|
-
const sessionId = runIdToSessionId.get(runId);
|
|
1054
|
-
if (!sessionId) return;
|
|
1055
|
-
const session = sessions.get(sessionId);
|
|
1056
|
-
if (session) touchSession(session, now());
|
|
1057
|
-
return session;
|
|
1058
|
-
};
|
|
1059
|
-
const setActiveRun = (sessionId, runId, abortController) => {
|
|
1060
|
-
const session = sessions.get(sessionId);
|
|
1061
|
-
if (!session) return;
|
|
1062
|
-
session.activeRunId = runId;
|
|
1063
|
-
session.abortController = abortController;
|
|
1064
|
-
runIdToSessionId.set(runId, sessionId);
|
|
1065
|
-
touchSession(session, now());
|
|
1066
|
-
};
|
|
1067
|
-
const clearActiveRun = (sessionId) => {
|
|
1068
|
-
const session = sessions.get(sessionId);
|
|
1069
|
-
if (!session) return;
|
|
1070
|
-
if (session.activeRunId) runIdToSessionId.delete(session.activeRunId);
|
|
1071
|
-
session.activeRunId = null;
|
|
1072
|
-
session.abortController = null;
|
|
1073
|
-
touchSession(session, now());
|
|
1074
|
-
};
|
|
1075
|
-
const cancelActiveRun = (sessionId) => {
|
|
1076
|
-
const session = sessions.get(sessionId);
|
|
1077
|
-
if (!session?.abortController) return false;
|
|
1078
|
-
session.abortController.abort();
|
|
1079
|
-
if (session.activeRunId) runIdToSessionId.delete(session.activeRunId);
|
|
1080
|
-
session.abortController = null;
|
|
1081
|
-
session.activeRunId = null;
|
|
1082
|
-
touchSession(session, now());
|
|
1083
|
-
return true;
|
|
1084
|
-
};
|
|
1085
|
-
const clearAllSessionsForTest = () => {
|
|
1086
|
-
for (const session of sessions.values()) session.abortController?.abort();
|
|
1087
|
-
sessions.clear();
|
|
1088
|
-
runIdToSessionId.clear();
|
|
1089
|
-
};
|
|
1090
|
-
return {
|
|
1091
|
-
createSession,
|
|
1092
|
-
hasSession,
|
|
1093
|
-
getSession,
|
|
1094
|
-
getSessionByRunId,
|
|
1095
|
-
setActiveRun,
|
|
1096
|
-
clearActiveRun,
|
|
1097
|
-
cancelActiveRun,
|
|
1098
|
-
clearAllSessionsForTest
|
|
1099
|
-
};
|
|
1100
|
-
}
|
|
1101
|
-
const defaultAcpSessionStore = createInMemorySessionStore();
|
|
1102
|
-
//#endregion
|
|
1103
|
-
//#region src/acp/types.ts
|
|
1104
|
-
const ACP_PROVENANCE_MODE_VALUES = [
|
|
1105
|
-
"off",
|
|
1106
|
-
"meta",
|
|
1107
|
-
"meta+receipt"
|
|
1108
|
-
];
|
|
1109
|
-
function normalizeAcpProvenanceMode(value) {
|
|
1110
|
-
if (!value) return;
|
|
1111
|
-
const normalized = value.trim().toLowerCase();
|
|
1112
|
-
return ACP_PROVENANCE_MODE_VALUES.includes(normalized) ? normalized : void 0;
|
|
1113
|
-
}
|
|
1114
|
-
const ACP_AGENT_INFO = {
|
|
1115
|
-
name: "moldclaw-acp",
|
|
1116
|
-
title: "moldClaw ACP Gateway",
|
|
1117
|
-
version: VERSION
|
|
1118
|
-
};
|
|
1119
|
-
//#endregion
|
|
1120
|
-
//#region src/acp/translator.ts
|
|
1121
|
-
const MAX_PROMPT_BYTES = 2 * 1024 * 1024;
|
|
1122
|
-
const ACP_THOUGHT_LEVEL_CONFIG_ID = "thought_level";
|
|
1123
|
-
const ACP_FAST_MODE_CONFIG_ID = "fast_mode";
|
|
1124
|
-
const ACP_VERBOSE_LEVEL_CONFIG_ID = "verbose_level";
|
|
1125
|
-
const ACP_REASONING_LEVEL_CONFIG_ID = "reasoning_level";
|
|
1126
|
-
const ACP_RESPONSE_USAGE_CONFIG_ID = "response_usage";
|
|
1127
|
-
const ACP_ELEVATED_LEVEL_CONFIG_ID = "elevated_level";
|
|
1128
|
-
const ACP_LOAD_SESSION_REPLAY_LIMIT = 1e6;
|
|
1129
|
-
const SESSION_CREATE_RATE_LIMIT_DEFAULT_MAX_REQUESTS = 120;
|
|
1130
|
-
const SESSION_CREATE_RATE_LIMIT_DEFAULT_WINDOW_MS = 1e4;
|
|
1131
|
-
function formatThinkingLevelName(level) {
|
|
1132
|
-
switch (level) {
|
|
1133
|
-
case "xhigh": return "Extra High";
|
|
1134
|
-
case "adaptive": return "Adaptive";
|
|
1135
|
-
default: return level.length > 0 ? `${level[0].toUpperCase()}${level.slice(1)}` : "Unknown";
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
function buildThinkingModeDescription(level) {
|
|
1139
|
-
if (level === "adaptive") return "Use the Gateway session default thought level.";
|
|
1140
|
-
}
|
|
1141
|
-
function formatConfigValueName(value) {
|
|
1142
|
-
switch (value) {
|
|
1143
|
-
case "xhigh": return "Extra High";
|
|
1144
|
-
default: return value.length > 0 ? `${value[0].toUpperCase()}${value.slice(1)}` : "Unknown";
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
function buildSelectConfigOption(params) {
|
|
1148
|
-
return {
|
|
1149
|
-
type: "select",
|
|
1150
|
-
id: params.id,
|
|
1151
|
-
name: params.name,
|
|
1152
|
-
category: params.category,
|
|
1153
|
-
description: params.description,
|
|
1154
|
-
currentValue: params.currentValue,
|
|
1155
|
-
options: params.values.map((value) => ({
|
|
1156
|
-
value,
|
|
1157
|
-
name: formatConfigValueName(value)
|
|
1158
|
-
}))
|
|
1159
|
-
};
|
|
1160
|
-
}
|
|
1161
|
-
function buildSessionPresentation(params) {
|
|
1162
|
-
const row = {
|
|
1163
|
-
...params.row,
|
|
1164
|
-
...params.overrides
|
|
1165
|
-
};
|
|
1166
|
-
const availableLevelIds = [...listThinkingLevels(row.modelProvider, row.model)];
|
|
1167
|
-
const currentModeId = row.thinkingLevel?.trim() || "adaptive";
|
|
1168
|
-
if (!availableLevelIds.includes(currentModeId)) availableLevelIds.push(currentModeId);
|
|
1169
|
-
const modes = {
|
|
1170
|
-
currentModeId,
|
|
1171
|
-
availableModes: availableLevelIds.map((level) => ({
|
|
1172
|
-
id: level,
|
|
1173
|
-
name: formatThinkingLevelName(level),
|
|
1174
|
-
description: buildThinkingModeDescription(level)
|
|
1175
|
-
}))
|
|
1176
|
-
};
|
|
1177
|
-
return {
|
|
1178
|
-
configOptions: [
|
|
1179
|
-
buildSelectConfigOption({
|
|
1180
|
-
id: ACP_THOUGHT_LEVEL_CONFIG_ID,
|
|
1181
|
-
name: "Thought level",
|
|
1182
|
-
category: "thought_level",
|
|
1183
|
-
description: "Controls how much deliberate reasoning moldClaw requests from the Gateway model.",
|
|
1184
|
-
currentValue: currentModeId,
|
|
1185
|
-
values: availableLevelIds
|
|
1186
|
-
}),
|
|
1187
|
-
buildSelectConfigOption({
|
|
1188
|
-
id: ACP_FAST_MODE_CONFIG_ID,
|
|
1189
|
-
name: "Fast mode",
|
|
1190
|
-
description: "Controls whether OpenAI sessions use the Gateway fast-mode profile.",
|
|
1191
|
-
currentValue: row.fastMode ? "on" : "off",
|
|
1192
|
-
values: ["off", "on"]
|
|
1193
|
-
}),
|
|
1194
|
-
buildSelectConfigOption({
|
|
1195
|
-
id: ACP_VERBOSE_LEVEL_CONFIG_ID,
|
|
1196
|
-
name: "Tool verbosity",
|
|
1197
|
-
description: "Controls how much tool progress and output detail moldClaw keeps enabled for the session.",
|
|
1198
|
-
currentValue: row.verboseLevel?.trim() || "off",
|
|
1199
|
-
values: [
|
|
1200
|
-
"off",
|
|
1201
|
-
"on",
|
|
1202
|
-
"full"
|
|
1203
|
-
]
|
|
1204
|
-
}),
|
|
1205
|
-
buildSelectConfigOption({
|
|
1206
|
-
id: ACP_REASONING_LEVEL_CONFIG_ID,
|
|
1207
|
-
name: "Reasoning stream",
|
|
1208
|
-
description: "Controls whether reasoning-capable models emit reasoning text for the session.",
|
|
1209
|
-
currentValue: row.reasoningLevel?.trim() || "off",
|
|
1210
|
-
values: [
|
|
1211
|
-
"off",
|
|
1212
|
-
"on",
|
|
1213
|
-
"stream"
|
|
1214
|
-
]
|
|
1215
|
-
}),
|
|
1216
|
-
buildSelectConfigOption({
|
|
1217
|
-
id: ACP_RESPONSE_USAGE_CONFIG_ID,
|
|
1218
|
-
name: "Usage detail",
|
|
1219
|
-
description: "Controls how much usage information moldClaw attaches to responses for the session.",
|
|
1220
|
-
currentValue: row.responseUsage?.trim() || "off",
|
|
1221
|
-
values: [
|
|
1222
|
-
"off",
|
|
1223
|
-
"tokens",
|
|
1224
|
-
"full"
|
|
1225
|
-
]
|
|
1226
|
-
}),
|
|
1227
|
-
buildSelectConfigOption({
|
|
1228
|
-
id: ACP_ELEVATED_LEVEL_CONFIG_ID,
|
|
1229
|
-
name: "Elevated actions",
|
|
1230
|
-
description: "Controls how aggressively the session allows elevated execution behavior.",
|
|
1231
|
-
currentValue: row.elevatedLevel?.trim() || "off",
|
|
1232
|
-
values: [
|
|
1233
|
-
"off",
|
|
1234
|
-
"on",
|
|
1235
|
-
"ask",
|
|
1236
|
-
"full"
|
|
1237
|
-
]
|
|
1238
|
-
})
|
|
1239
|
-
],
|
|
1240
|
-
modes
|
|
1241
|
-
};
|
|
1242
|
-
}
|
|
1243
|
-
function extractReplayText(content) {
|
|
1244
|
-
if (typeof content === "string") return content.length > 0 ? content : void 0;
|
|
1245
|
-
if (!Array.isArray(content)) return;
|
|
1246
|
-
const text = content.map((block) => {
|
|
1247
|
-
if (!block || typeof block !== "object" || Array.isArray(block)) return "";
|
|
1248
|
-
const typedBlock = block;
|
|
1249
|
-
return typedBlock.type === "text" && typeof typedBlock.text === "string" ? typedBlock.text : "";
|
|
1250
|
-
}).join("");
|
|
1251
|
-
return text.length > 0 ? text : void 0;
|
|
1252
|
-
}
|
|
1253
|
-
function buildSessionMetadata(params) {
|
|
1254
|
-
return {
|
|
1255
|
-
title: params.row?.derivedTitle?.trim() || params.row?.displayName?.trim() || params.row?.label?.trim() || params.sessionKey,
|
|
1256
|
-
updatedAt: typeof params.row?.updatedAt === "number" && Number.isFinite(params.row.updatedAt) ? new Date(params.row.updatedAt).toISOString() : null
|
|
1257
|
-
};
|
|
1258
|
-
}
|
|
1259
|
-
function buildSessionUsageSnapshot(row) {
|
|
1260
|
-
const totalTokens = row?.totalTokens;
|
|
1261
|
-
const contextTokens = row?.contextTokens;
|
|
1262
|
-
if (row?.totalTokensFresh !== true || typeof totalTokens !== "number" || !Number.isFinite(totalTokens) || typeof contextTokens !== "number" || !Number.isFinite(contextTokens) || contextTokens <= 0) return;
|
|
1263
|
-
const size = Math.max(0, Math.floor(contextTokens));
|
|
1264
|
-
return {
|
|
1265
|
-
size,
|
|
1266
|
-
used: Math.max(0, Math.min(Math.floor(totalTokens), size))
|
|
1267
|
-
};
|
|
1268
|
-
}
|
|
1269
|
-
function buildSystemInputProvenance(originSessionId) {
|
|
1270
|
-
return {
|
|
1271
|
-
kind: "external_user",
|
|
1272
|
-
originSessionId,
|
|
1273
|
-
sourceChannel: "acp",
|
|
1274
|
-
sourceTool: "moldclaw_acp"
|
|
1275
|
-
};
|
|
1276
|
-
}
|
|
1277
|
-
function buildSystemProvenanceReceipt(params) {
|
|
1278
|
-
return [
|
|
1279
|
-
"[Source Receipt]",
|
|
1280
|
-
"bridge=moldclaw-acp",
|
|
1281
|
-
`originHost=${os.hostname()}`,
|
|
1282
|
-
`originCwd=${shortenHomePath(params.cwd)}`,
|
|
1283
|
-
`acpSessionId=${params.sessionId}`,
|
|
1284
|
-
`originSessionId=${params.sessionId}`,
|
|
1285
|
-
`targetSession=${params.sessionKey}`,
|
|
1286
|
-
"[/Source Receipt]"
|
|
1287
|
-
].join("\n");
|
|
1288
|
-
}
|
|
1289
|
-
var AcpGatewayAgent = class {
|
|
1290
|
-
constructor(connection, gateway, opts = {}) {
|
|
1291
|
-
this.pendingPrompts = /* @__PURE__ */ new Map();
|
|
1292
|
-
this.connection = connection;
|
|
1293
|
-
this.gateway = gateway;
|
|
1294
|
-
this.opts = opts;
|
|
1295
|
-
this.log = opts.verbose ? (msg) => process.stderr.write(`[acp] ${msg}\n`) : () => {};
|
|
1296
|
-
this.sessionStore = opts.sessionStore ?? defaultAcpSessionStore;
|
|
1297
|
-
this.sessionCreateRateLimiter = createFixedWindowRateLimiter({
|
|
1298
|
-
maxRequests: Math.max(1, opts.sessionCreateRateLimit?.maxRequests ?? SESSION_CREATE_RATE_LIMIT_DEFAULT_MAX_REQUESTS),
|
|
1299
|
-
windowMs: Math.max(1e3, opts.sessionCreateRateLimit?.windowMs ?? SESSION_CREATE_RATE_LIMIT_DEFAULT_WINDOW_MS)
|
|
1300
|
-
});
|
|
1301
|
-
}
|
|
1302
|
-
start() {
|
|
1303
|
-
this.log("ready");
|
|
1304
|
-
}
|
|
1305
|
-
handleGatewayReconnect() {
|
|
1306
|
-
this.log("gateway reconnected");
|
|
1307
|
-
}
|
|
1308
|
-
handleGatewayDisconnect(reason) {
|
|
1309
|
-
this.log(`gateway disconnected: ${reason}`);
|
|
1310
|
-
for (const pending of this.pendingPrompts.values()) {
|
|
1311
|
-
pending.reject(/* @__PURE__ */ new Error(`Gateway disconnected: ${reason}`));
|
|
1312
|
-
this.sessionStore.clearActiveRun(pending.sessionId);
|
|
1313
|
-
}
|
|
1314
|
-
this.pendingPrompts.clear();
|
|
1315
|
-
}
|
|
1316
|
-
async handleGatewayEvent(evt) {
|
|
1317
|
-
if (evt.event === "chat") {
|
|
1318
|
-
await this.handleChatEvent(evt);
|
|
1319
|
-
return;
|
|
1320
|
-
}
|
|
1321
|
-
if (evt.event === "agent") await this.handleAgentEvent(evt);
|
|
1322
|
-
}
|
|
1323
|
-
async initialize(_params) {
|
|
1324
|
-
return {
|
|
1325
|
-
protocolVersion: PROTOCOL_VERSION,
|
|
1326
|
-
agentCapabilities: {
|
|
1327
|
-
loadSession: true,
|
|
1328
|
-
promptCapabilities: {
|
|
1329
|
-
image: true,
|
|
1330
|
-
audio: false,
|
|
1331
|
-
embeddedContext: true
|
|
1332
|
-
},
|
|
1333
|
-
mcpCapabilities: {
|
|
1334
|
-
http: false,
|
|
1335
|
-
sse: false
|
|
1336
|
-
},
|
|
1337
|
-
sessionCapabilities: { list: {} }
|
|
1338
|
-
},
|
|
1339
|
-
agentInfo: ACP_AGENT_INFO,
|
|
1340
|
-
authMethods: []
|
|
1341
|
-
};
|
|
1342
|
-
}
|
|
1343
|
-
async newSession(params) {
|
|
1344
|
-
this.assertSupportedSessionSetup(params.mcpServers);
|
|
1345
|
-
this.enforceSessionCreateRateLimit("newSession");
|
|
1346
|
-
const sessionId = randomUUID();
|
|
1347
|
-
const meta = parseSessionMeta(params._meta);
|
|
1348
|
-
const sessionKey = await this.resolveSessionKeyFromMeta({
|
|
1349
|
-
meta,
|
|
1350
|
-
fallbackKey: `acp:${sessionId}`
|
|
1351
|
-
});
|
|
1352
|
-
const session = this.sessionStore.createSession({
|
|
1353
|
-
sessionId,
|
|
1354
|
-
sessionKey,
|
|
1355
|
-
cwd: params.cwd
|
|
1356
|
-
});
|
|
1357
|
-
this.log(`newSession: ${session.sessionId} -> ${session.sessionKey}`);
|
|
1358
|
-
const sessionSnapshot = await this.getSessionSnapshot(session.sessionKey);
|
|
1359
|
-
await this.sendSessionSnapshotUpdate(session.sessionId, sessionSnapshot, { includeControls: false });
|
|
1360
|
-
await this.sendAvailableCommands(session.sessionId);
|
|
1361
|
-
const { configOptions, modes } = sessionSnapshot;
|
|
1362
|
-
return {
|
|
1363
|
-
sessionId: session.sessionId,
|
|
1364
|
-
configOptions,
|
|
1365
|
-
modes
|
|
1366
|
-
};
|
|
1367
|
-
}
|
|
1368
|
-
async loadSession(params) {
|
|
1369
|
-
this.assertSupportedSessionSetup(params.mcpServers);
|
|
1370
|
-
if (!this.sessionStore.hasSession(params.sessionId)) this.enforceSessionCreateRateLimit("loadSession");
|
|
1371
|
-
const meta = parseSessionMeta(params._meta);
|
|
1372
|
-
const sessionKey = await this.resolveSessionKeyFromMeta({
|
|
1373
|
-
meta,
|
|
1374
|
-
fallbackKey: params.sessionId
|
|
1375
|
-
});
|
|
1376
|
-
const session = this.sessionStore.createSession({
|
|
1377
|
-
sessionId: params.sessionId,
|
|
1378
|
-
sessionKey,
|
|
1379
|
-
cwd: params.cwd
|
|
1380
|
-
});
|
|
1381
|
-
this.log(`loadSession: ${session.sessionId} -> ${session.sessionKey}`);
|
|
1382
|
-
const [sessionSnapshot, transcript] = await Promise.all([this.getSessionSnapshot(session.sessionKey), this.getSessionTranscript(session.sessionKey).catch((err) => {
|
|
1383
|
-
this.log(`session transcript fallback for ${session.sessionKey}: ${String(err)}`);
|
|
1384
|
-
return [];
|
|
1385
|
-
})]);
|
|
1386
|
-
await this.replaySessionTranscript(session.sessionId, transcript);
|
|
1387
|
-
await this.sendSessionSnapshotUpdate(session.sessionId, sessionSnapshot, { includeControls: false });
|
|
1388
|
-
await this.sendAvailableCommands(session.sessionId);
|
|
1389
|
-
const { configOptions, modes } = sessionSnapshot;
|
|
1390
|
-
return {
|
|
1391
|
-
configOptions,
|
|
1392
|
-
modes
|
|
1393
|
-
};
|
|
1394
|
-
}
|
|
1395
|
-
async unstable_listSessions(params) {
|
|
1396
|
-
const limit = readNumber(params._meta, ["limit"]) ?? 100;
|
|
1397
|
-
const result = await this.gateway.request("sessions.list", { limit });
|
|
1398
|
-
const cwd = params.cwd ?? process.cwd();
|
|
1399
|
-
return {
|
|
1400
|
-
sessions: result.sessions.map((session) => ({
|
|
1401
|
-
sessionId: session.key,
|
|
1402
|
-
cwd,
|
|
1403
|
-
title: session.displayName ?? session.label ?? session.key,
|
|
1404
|
-
updatedAt: session.updatedAt ? new Date(session.updatedAt).toISOString() : void 0,
|
|
1405
|
-
_meta: {
|
|
1406
|
-
sessionKey: session.key,
|
|
1407
|
-
kind: session.kind,
|
|
1408
|
-
channel: session.channel
|
|
1409
|
-
}
|
|
1410
|
-
})),
|
|
1411
|
-
nextCursor: null
|
|
1412
|
-
};
|
|
1413
|
-
}
|
|
1414
|
-
async authenticate(_params) {
|
|
1415
|
-
return {};
|
|
1416
|
-
}
|
|
1417
|
-
async setSessionMode(params) {
|
|
1418
|
-
const session = this.sessionStore.getSession(params.sessionId);
|
|
1419
|
-
if (!session) throw new Error(`Session ${params.sessionId} not found`);
|
|
1420
|
-
if (!params.modeId) return {};
|
|
1421
|
-
try {
|
|
1422
|
-
await this.gateway.request("sessions.patch", {
|
|
1423
|
-
key: session.sessionKey,
|
|
1424
|
-
thinkingLevel: params.modeId
|
|
1425
|
-
});
|
|
1426
|
-
this.log(`setSessionMode: ${session.sessionId} -> ${params.modeId}`);
|
|
1427
|
-
const sessionSnapshot = await this.getSessionSnapshot(session.sessionKey, { thinkingLevel: params.modeId });
|
|
1428
|
-
await this.sendSessionSnapshotUpdate(session.sessionId, sessionSnapshot, { includeControls: true });
|
|
1429
|
-
} catch (err) {
|
|
1430
|
-
this.log(`setSessionMode error: ${String(err)}`);
|
|
1431
|
-
throw err instanceof Error ? err : new Error(String(err));
|
|
1432
|
-
}
|
|
1433
|
-
return {};
|
|
1434
|
-
}
|
|
1435
|
-
async setSessionConfigOption(params) {
|
|
1436
|
-
const session = this.sessionStore.getSession(params.sessionId);
|
|
1437
|
-
if (!session) throw new Error(`Session ${params.sessionId} not found`);
|
|
1438
|
-
const sessionPatch = this.resolveSessionConfigPatch(params.configId, params.value);
|
|
1439
|
-
try {
|
|
1440
|
-
await this.gateway.request("sessions.patch", {
|
|
1441
|
-
key: session.sessionKey,
|
|
1442
|
-
...sessionPatch.patch
|
|
1443
|
-
});
|
|
1444
|
-
this.log(`setSessionConfigOption: ${session.sessionId} -> ${params.configId}=${params.value}`);
|
|
1445
|
-
const sessionSnapshot = await this.getSessionSnapshot(session.sessionKey, sessionPatch.overrides);
|
|
1446
|
-
await this.sendSessionSnapshotUpdate(session.sessionId, sessionSnapshot, { includeControls: true });
|
|
1447
|
-
return { configOptions: sessionSnapshot.configOptions };
|
|
1448
|
-
} catch (err) {
|
|
1449
|
-
this.log(`setSessionConfigOption error: ${String(err)}`);
|
|
1450
|
-
throw err instanceof Error ? err : new Error(String(err));
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
async prompt(params) {
|
|
1454
|
-
const session = this.sessionStore.getSession(params.sessionId);
|
|
1455
|
-
if (!session) throw new Error(`Session ${params.sessionId} not found`);
|
|
1456
|
-
if (session.abortController) this.sessionStore.cancelActiveRun(params.sessionId);
|
|
1457
|
-
const meta = parseSessionMeta(params._meta);
|
|
1458
|
-
const userText = extractTextFromPrompt(params.prompt, MAX_PROMPT_BYTES);
|
|
1459
|
-
const attachments = extractAttachmentsFromPrompt(params.prompt);
|
|
1460
|
-
const prefixCwd = meta.prefixCwd ?? this.opts.prefixCwd ?? true;
|
|
1461
|
-
const displayCwd = shortenHomePath(session.cwd);
|
|
1462
|
-
const message = prefixCwd ? `[Working directory: ${displayCwd}]\n\n${userText}` : userText;
|
|
1463
|
-
const provenanceMode = this.opts.provenanceMode ?? "off";
|
|
1464
|
-
const systemInputProvenance = provenanceMode === "off" ? void 0 : buildSystemInputProvenance(params.sessionId);
|
|
1465
|
-
const systemProvenanceReceipt = provenanceMode === "meta+receipt" ? buildSystemProvenanceReceipt({
|
|
1466
|
-
cwd: session.cwd,
|
|
1467
|
-
sessionId: params.sessionId,
|
|
1468
|
-
sessionKey: session.sessionKey
|
|
1469
|
-
}) : void 0;
|
|
1470
|
-
if (Buffer.byteLength(message, "utf-8") > MAX_PROMPT_BYTES) throw new Error(`Prompt exceeds maximum allowed size of ${MAX_PROMPT_BYTES} bytes`);
|
|
1471
|
-
const abortController = new AbortController();
|
|
1472
|
-
const runId = randomUUID();
|
|
1473
|
-
this.sessionStore.setActiveRun(params.sessionId, runId, abortController);
|
|
1474
|
-
return new Promise((resolve, reject) => {
|
|
1475
|
-
this.pendingPrompts.set(params.sessionId, {
|
|
1476
|
-
sessionId: params.sessionId,
|
|
1477
|
-
sessionKey: session.sessionKey,
|
|
1478
|
-
idempotencyKey: runId,
|
|
1479
|
-
resolve,
|
|
1480
|
-
reject
|
|
1481
|
-
});
|
|
1482
|
-
this.gateway.request("chat.send", {
|
|
1483
|
-
sessionKey: session.sessionKey,
|
|
1484
|
-
message,
|
|
1485
|
-
attachments: attachments.length > 0 ? attachments : void 0,
|
|
1486
|
-
idempotencyKey: runId,
|
|
1487
|
-
thinking: readString(params._meta, ["thinking", "thinkingLevel"]),
|
|
1488
|
-
deliver: readBool(params._meta, ["deliver"]),
|
|
1489
|
-
timeoutMs: readNumber(params._meta, ["timeoutMs"]),
|
|
1490
|
-
systemInputProvenance,
|
|
1491
|
-
systemProvenanceReceipt
|
|
1492
|
-
}, { expectFinal: true }).catch((err) => {
|
|
1493
|
-
this.pendingPrompts.delete(params.sessionId);
|
|
1494
|
-
this.sessionStore.clearActiveRun(params.sessionId);
|
|
1495
|
-
reject(err instanceof Error ? err : new Error(String(err)));
|
|
1496
|
-
});
|
|
1497
|
-
});
|
|
1498
|
-
}
|
|
1499
|
-
async cancel(params) {
|
|
1500
|
-
const session = this.sessionStore.getSession(params.sessionId);
|
|
1501
|
-
if (!session) return;
|
|
1502
|
-
const activeRunId = session.activeRunId;
|
|
1503
|
-
this.sessionStore.cancelActiveRun(params.sessionId);
|
|
1504
|
-
const pending = this.pendingPrompts.get(params.sessionId);
|
|
1505
|
-
const scopedRunId = activeRunId ?? pending?.idempotencyKey;
|
|
1506
|
-
if (!scopedRunId) return;
|
|
1507
|
-
try {
|
|
1508
|
-
await this.gateway.request("chat.abort", {
|
|
1509
|
-
sessionKey: session.sessionKey,
|
|
1510
|
-
runId: scopedRunId
|
|
1511
|
-
});
|
|
1512
|
-
} catch (err) {
|
|
1513
|
-
this.log(`cancel error: ${String(err)}`);
|
|
1514
|
-
}
|
|
1515
|
-
if (pending) {
|
|
1516
|
-
this.pendingPrompts.delete(params.sessionId);
|
|
1517
|
-
pending.resolve({ stopReason: "cancelled" });
|
|
1518
|
-
}
|
|
1519
|
-
}
|
|
1520
|
-
async resolveSessionKeyFromMeta(params) {
|
|
1521
|
-
const sessionKey = await resolveSessionKey({
|
|
1522
|
-
meta: params.meta,
|
|
1523
|
-
fallbackKey: params.fallbackKey,
|
|
1524
|
-
gateway: this.gateway,
|
|
1525
|
-
opts: this.opts
|
|
1526
|
-
});
|
|
1527
|
-
await resetSessionIfNeeded({
|
|
1528
|
-
meta: params.meta,
|
|
1529
|
-
sessionKey,
|
|
1530
|
-
gateway: this.gateway,
|
|
1531
|
-
opts: this.opts
|
|
1532
|
-
});
|
|
1533
|
-
return sessionKey;
|
|
1534
|
-
}
|
|
1535
|
-
async handleAgentEvent(evt) {
|
|
1536
|
-
const payload = evt.payload;
|
|
1537
|
-
if (!payload) return;
|
|
1538
|
-
const stream = payload.stream;
|
|
1539
|
-
const runId = payload.runId;
|
|
1540
|
-
const data = payload.data;
|
|
1541
|
-
const sessionKey = payload.sessionKey;
|
|
1542
|
-
if (!stream || !data || !sessionKey) return;
|
|
1543
|
-
if (stream !== "tool") return;
|
|
1544
|
-
const phase = data.phase;
|
|
1545
|
-
const name = data.name;
|
|
1546
|
-
const toolCallId = data.toolCallId;
|
|
1547
|
-
if (!toolCallId) return;
|
|
1548
|
-
const pending = this.findPendingBySessionKey(sessionKey, runId);
|
|
1549
|
-
if (!pending) return;
|
|
1550
|
-
if (phase === "start") {
|
|
1551
|
-
if (!pending.toolCalls) pending.toolCalls = /* @__PURE__ */ new Map();
|
|
1552
|
-
if (pending.toolCalls.has(toolCallId)) return;
|
|
1553
|
-
const args = data.args;
|
|
1554
|
-
const title = formatToolTitle(name, args);
|
|
1555
|
-
const kind = inferToolKind(name);
|
|
1556
|
-
const locations = extractToolCallLocations(args);
|
|
1557
|
-
pending.toolCalls.set(toolCallId, {
|
|
1558
|
-
title,
|
|
1559
|
-
kind,
|
|
1560
|
-
rawInput: args,
|
|
1561
|
-
locations
|
|
1562
|
-
});
|
|
1563
|
-
await this.connection.sessionUpdate({
|
|
1564
|
-
sessionId: pending.sessionId,
|
|
1565
|
-
update: {
|
|
1566
|
-
sessionUpdate: "tool_call",
|
|
1567
|
-
toolCallId,
|
|
1568
|
-
title,
|
|
1569
|
-
status: "in_progress",
|
|
1570
|
-
rawInput: args,
|
|
1571
|
-
kind,
|
|
1572
|
-
locations
|
|
1573
|
-
}
|
|
1574
|
-
});
|
|
1575
|
-
return;
|
|
1576
|
-
}
|
|
1577
|
-
if (phase === "update") {
|
|
1578
|
-
const toolState = pending.toolCalls?.get(toolCallId);
|
|
1579
|
-
const partialResult = data.partialResult;
|
|
1580
|
-
await this.connection.sessionUpdate({
|
|
1581
|
-
sessionId: pending.sessionId,
|
|
1582
|
-
update: {
|
|
1583
|
-
sessionUpdate: "tool_call_update",
|
|
1584
|
-
toolCallId,
|
|
1585
|
-
status: "in_progress",
|
|
1586
|
-
rawOutput: partialResult,
|
|
1587
|
-
content: extractToolCallContent(partialResult),
|
|
1588
|
-
locations: extractToolCallLocations(toolState?.locations, partialResult)
|
|
1589
|
-
}
|
|
1590
|
-
});
|
|
1591
|
-
return;
|
|
1592
|
-
}
|
|
1593
|
-
if (phase === "result") {
|
|
1594
|
-
const isError = Boolean(data.isError);
|
|
1595
|
-
const toolState = pending.toolCalls?.get(toolCallId);
|
|
1596
|
-
pending.toolCalls?.delete(toolCallId);
|
|
1597
|
-
await this.connection.sessionUpdate({
|
|
1598
|
-
sessionId: pending.sessionId,
|
|
1599
|
-
update: {
|
|
1600
|
-
sessionUpdate: "tool_call_update",
|
|
1601
|
-
toolCallId,
|
|
1602
|
-
status: isError ? "failed" : "completed",
|
|
1603
|
-
rawOutput: data.result,
|
|
1604
|
-
content: extractToolCallContent(data.result),
|
|
1605
|
-
locations: extractToolCallLocations(toolState?.locations, data.result)
|
|
1606
|
-
}
|
|
1607
|
-
});
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
async handleChatEvent(evt) {
|
|
1611
|
-
const payload = evt.payload;
|
|
1612
|
-
if (!payload) return;
|
|
1613
|
-
const sessionKey = payload.sessionKey;
|
|
1614
|
-
const state = payload.state;
|
|
1615
|
-
const runId = payload.runId;
|
|
1616
|
-
const messageData = payload.message;
|
|
1617
|
-
if (!sessionKey || !state) return;
|
|
1618
|
-
const pending = this.findPendingBySessionKey(sessionKey, runId);
|
|
1619
|
-
if (!pending) return;
|
|
1620
|
-
if (messageData && (state === "delta" || state === "final")) {
|
|
1621
|
-
await this.handleDeltaEvent(pending.sessionId, messageData);
|
|
1622
|
-
if (state === "delta") return;
|
|
1623
|
-
}
|
|
1624
|
-
if (state === "final") {
|
|
1625
|
-
const stopReason = payload.stopReason === "max_tokens" ? "max_tokens" : "end_turn";
|
|
1626
|
-
await this.finishPrompt(pending.sessionId, pending, stopReason);
|
|
1627
|
-
return;
|
|
1628
|
-
}
|
|
1629
|
-
if (state === "aborted") {
|
|
1630
|
-
await this.finishPrompt(pending.sessionId, pending, "cancelled");
|
|
1631
|
-
return;
|
|
1632
|
-
}
|
|
1633
|
-
if (state === "error") this.finishPrompt(pending.sessionId, pending, "end_turn");
|
|
1634
|
-
}
|
|
1635
|
-
async handleDeltaEvent(sessionId, messageData) {
|
|
1636
|
-
const fullText = messageData.content?.find((c) => c.type === "text")?.text ?? "";
|
|
1637
|
-
const pending = this.pendingPrompts.get(sessionId);
|
|
1638
|
-
if (!pending) return;
|
|
1639
|
-
const sentSoFar = pending.sentTextLength ?? 0;
|
|
1640
|
-
if (fullText.length <= sentSoFar) return;
|
|
1641
|
-
const newText = fullText.slice(sentSoFar);
|
|
1642
|
-
pending.sentTextLength = fullText.length;
|
|
1643
|
-
pending.sentText = fullText;
|
|
1644
|
-
await this.connection.sessionUpdate({
|
|
1645
|
-
sessionId,
|
|
1646
|
-
update: {
|
|
1647
|
-
sessionUpdate: "agent_message_chunk",
|
|
1648
|
-
content: {
|
|
1649
|
-
type: "text",
|
|
1650
|
-
text: newText
|
|
1651
|
-
}
|
|
1652
|
-
}
|
|
1653
|
-
});
|
|
1654
|
-
}
|
|
1655
|
-
async finishPrompt(sessionId, pending, stopReason) {
|
|
1656
|
-
this.pendingPrompts.delete(sessionId);
|
|
1657
|
-
this.sessionStore.clearActiveRun(sessionId);
|
|
1658
|
-
const sessionSnapshot = await this.getSessionSnapshot(pending.sessionKey);
|
|
1659
|
-
try {
|
|
1660
|
-
await this.sendSessionSnapshotUpdate(sessionId, sessionSnapshot, { includeControls: false });
|
|
1661
|
-
} catch (err) {
|
|
1662
|
-
this.log(`session snapshot update failed for ${sessionId}: ${String(err)}`);
|
|
1663
|
-
}
|
|
1664
|
-
pending.resolve({ stopReason });
|
|
1665
|
-
}
|
|
1666
|
-
findPendingBySessionKey(sessionKey, runId) {
|
|
1667
|
-
for (const pending of this.pendingPrompts.values()) {
|
|
1668
|
-
if (pending.sessionKey !== sessionKey) continue;
|
|
1669
|
-
if (runId && pending.idempotencyKey !== runId) continue;
|
|
1670
|
-
return pending;
|
|
1671
|
-
}
|
|
1672
|
-
}
|
|
1673
|
-
async sendAvailableCommands(sessionId) {
|
|
1674
|
-
await this.connection.sessionUpdate({
|
|
1675
|
-
sessionId,
|
|
1676
|
-
update: {
|
|
1677
|
-
sessionUpdate: "available_commands_update",
|
|
1678
|
-
availableCommands: getAvailableCommands()
|
|
1679
|
-
}
|
|
1680
|
-
});
|
|
1681
|
-
}
|
|
1682
|
-
async getSessionSnapshot(sessionKey, overrides) {
|
|
1683
|
-
try {
|
|
1684
|
-
const row = await this.getGatewaySessionRow(sessionKey);
|
|
1685
|
-
return {
|
|
1686
|
-
...buildSessionPresentation({
|
|
1687
|
-
row,
|
|
1688
|
-
overrides
|
|
1689
|
-
}),
|
|
1690
|
-
metadata: buildSessionMetadata({
|
|
1691
|
-
row,
|
|
1692
|
-
sessionKey
|
|
1693
|
-
}),
|
|
1694
|
-
usage: buildSessionUsageSnapshot(row)
|
|
1695
|
-
};
|
|
1696
|
-
} catch (err) {
|
|
1697
|
-
this.log(`session presentation fallback for ${sessionKey}: ${String(err)}`);
|
|
1698
|
-
return {
|
|
1699
|
-
...buildSessionPresentation({ overrides }),
|
|
1700
|
-
metadata: buildSessionMetadata({ sessionKey })
|
|
1701
|
-
};
|
|
1702
|
-
}
|
|
1703
|
-
}
|
|
1704
|
-
async getGatewaySessionRow(sessionKey) {
|
|
1705
|
-
const session = (await this.gateway.request("sessions.list", {
|
|
1706
|
-
limit: 200,
|
|
1707
|
-
search: sessionKey,
|
|
1708
|
-
includeDerivedTitles: true
|
|
1709
|
-
})).sessions.find((entry) => entry.key === sessionKey);
|
|
1710
|
-
if (!session) return;
|
|
1711
|
-
return {
|
|
1712
|
-
displayName: session.displayName,
|
|
1713
|
-
label: session.label,
|
|
1714
|
-
derivedTitle: session.derivedTitle,
|
|
1715
|
-
updatedAt: session.updatedAt,
|
|
1716
|
-
thinkingLevel: session.thinkingLevel,
|
|
1717
|
-
modelProvider: session.modelProvider,
|
|
1718
|
-
model: session.model,
|
|
1719
|
-
fastMode: session.fastMode,
|
|
1720
|
-
verboseLevel: session.verboseLevel,
|
|
1721
|
-
reasoningLevel: session.reasoningLevel,
|
|
1722
|
-
responseUsage: session.responseUsage,
|
|
1723
|
-
elevatedLevel: session.elevatedLevel,
|
|
1724
|
-
totalTokens: session.totalTokens,
|
|
1725
|
-
totalTokensFresh: session.totalTokensFresh,
|
|
1726
|
-
contextTokens: session.contextTokens
|
|
1727
|
-
};
|
|
1728
|
-
}
|
|
1729
|
-
resolveSessionConfigPatch(configId, value) {
|
|
1730
|
-
if (typeof value !== "string") throw new Error(`ACP bridge does not support non-string session config option values for "${configId}".`);
|
|
1731
|
-
switch (configId) {
|
|
1732
|
-
case ACP_THOUGHT_LEVEL_CONFIG_ID: return {
|
|
1733
|
-
patch: { thinkingLevel: value },
|
|
1734
|
-
overrides: { thinkingLevel: value }
|
|
1735
|
-
};
|
|
1736
|
-
case ACP_FAST_MODE_CONFIG_ID: return {
|
|
1737
|
-
patch: { fastMode: value === "on" },
|
|
1738
|
-
overrides: { fastMode: value === "on" }
|
|
1739
|
-
};
|
|
1740
|
-
case ACP_VERBOSE_LEVEL_CONFIG_ID: return {
|
|
1741
|
-
patch: { verboseLevel: value },
|
|
1742
|
-
overrides: { verboseLevel: value }
|
|
1743
|
-
};
|
|
1744
|
-
case ACP_REASONING_LEVEL_CONFIG_ID: return {
|
|
1745
|
-
patch: { reasoningLevel: value },
|
|
1746
|
-
overrides: { reasoningLevel: value }
|
|
1747
|
-
};
|
|
1748
|
-
case ACP_RESPONSE_USAGE_CONFIG_ID: return {
|
|
1749
|
-
patch: { responseUsage: value },
|
|
1750
|
-
overrides: { responseUsage: value }
|
|
1751
|
-
};
|
|
1752
|
-
case ACP_ELEVATED_LEVEL_CONFIG_ID: return {
|
|
1753
|
-
patch: { elevatedLevel: value },
|
|
1754
|
-
overrides: { elevatedLevel: value }
|
|
1755
|
-
};
|
|
1756
|
-
default: throw new Error(`ACP bridge mode does not support session config option "${configId}".`);
|
|
1757
|
-
}
|
|
1758
|
-
}
|
|
1759
|
-
async getSessionTranscript(sessionKey) {
|
|
1760
|
-
const result = await this.gateway.request("sessions.get", {
|
|
1761
|
-
key: sessionKey,
|
|
1762
|
-
limit: ACP_LOAD_SESSION_REPLAY_LIMIT
|
|
1763
|
-
});
|
|
1764
|
-
if (!Array.isArray(result.messages)) return [];
|
|
1765
|
-
return result.messages;
|
|
1766
|
-
}
|
|
1767
|
-
async replaySessionTranscript(sessionId, transcript) {
|
|
1768
|
-
for (const message of transcript) {
|
|
1769
|
-
const role = typeof message.role === "string" ? message.role : "";
|
|
1770
|
-
if (role !== "user" && role !== "assistant") continue;
|
|
1771
|
-
const text = extractReplayText(message.content);
|
|
1772
|
-
if (!text) continue;
|
|
1773
|
-
await this.connection.sessionUpdate({
|
|
1774
|
-
sessionId,
|
|
1775
|
-
update: {
|
|
1776
|
-
sessionUpdate: role === "user" ? "user_message_chunk" : "agent_message_chunk",
|
|
1777
|
-
content: {
|
|
1778
|
-
type: "text",
|
|
1779
|
-
text
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
});
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1785
|
-
async sendSessionSnapshotUpdate(sessionId, sessionSnapshot, options) {
|
|
1786
|
-
if (options.includeControls) {
|
|
1787
|
-
await this.connection.sessionUpdate({
|
|
1788
|
-
sessionId,
|
|
1789
|
-
update: {
|
|
1790
|
-
sessionUpdate: "current_mode_update",
|
|
1791
|
-
currentModeId: sessionSnapshot.modes.currentModeId
|
|
1792
|
-
}
|
|
1793
|
-
});
|
|
1794
|
-
await this.connection.sessionUpdate({
|
|
1795
|
-
sessionId,
|
|
1796
|
-
update: {
|
|
1797
|
-
sessionUpdate: "config_option_update",
|
|
1798
|
-
configOptions: sessionSnapshot.configOptions
|
|
1799
|
-
}
|
|
1800
|
-
});
|
|
1801
|
-
}
|
|
1802
|
-
if (sessionSnapshot.metadata) await this.connection.sessionUpdate({
|
|
1803
|
-
sessionId,
|
|
1804
|
-
update: {
|
|
1805
|
-
sessionUpdate: "session_info_update",
|
|
1806
|
-
...sessionSnapshot.metadata
|
|
1807
|
-
}
|
|
1808
|
-
});
|
|
1809
|
-
if (sessionSnapshot.usage) await this.connection.sessionUpdate({
|
|
1810
|
-
sessionId,
|
|
1811
|
-
update: {
|
|
1812
|
-
sessionUpdate: "usage_update",
|
|
1813
|
-
used: sessionSnapshot.usage.used,
|
|
1814
|
-
size: sessionSnapshot.usage.size,
|
|
1815
|
-
_meta: {
|
|
1816
|
-
source: "gateway-session-store",
|
|
1817
|
-
approximate: true
|
|
1818
|
-
}
|
|
1819
|
-
}
|
|
1820
|
-
});
|
|
1821
|
-
}
|
|
1822
|
-
assertSupportedSessionSetup(mcpServers) {
|
|
1823
|
-
if (mcpServers.length === 0) return;
|
|
1824
|
-
throw new Error("ACP bridge mode does not support per-session MCP servers. Configure MCP on the moldClaw gateway or agent instead.");
|
|
1825
|
-
}
|
|
1826
|
-
enforceSessionCreateRateLimit(method) {
|
|
1827
|
-
const budget = this.sessionCreateRateLimiter.consume();
|
|
1828
|
-
if (budget.allowed) return;
|
|
1829
|
-
throw new Error(`ACP session creation rate limit exceeded for ${method}; retry after ${Math.ceil(budget.retryAfterMs / 1e3)}s.`);
|
|
1830
|
-
}
|
|
1831
|
-
};
|
|
1832
|
-
//#endregion
|
|
1833
|
-
//#region src/acp/server.ts
|
|
1834
|
-
async function serveAcpGateway(opts = {}) {
|
|
1835
|
-
const cfg = loadConfig();
|
|
1836
|
-
const connection = buildGatewayConnectionDetails({
|
|
1837
|
-
config: cfg,
|
|
1838
|
-
url: opts.gatewayUrl
|
|
1839
|
-
});
|
|
1840
|
-
const gatewayUrlOverrideSource = connection.urlSource === "cli --url" ? "cli" : connection.urlSource === "env MOLDCLAW_GATEWAY_URL" ? "env" : void 0;
|
|
1841
|
-
const creds = await resolveGatewayConnectionAuth({
|
|
1842
|
-
config: cfg,
|
|
1843
|
-
explicitAuth: {
|
|
1844
|
-
token: opts.gatewayToken,
|
|
1845
|
-
password: opts.gatewayPassword
|
|
1846
|
-
},
|
|
1847
|
-
env: process.env,
|
|
1848
|
-
urlOverride: gatewayUrlOverrideSource ? connection.url : void 0,
|
|
1849
|
-
urlOverrideSource: gatewayUrlOverrideSource
|
|
1850
|
-
});
|
|
1851
|
-
let agent = null;
|
|
1852
|
-
let onClosed;
|
|
1853
|
-
const closed = new Promise((resolve) => {
|
|
1854
|
-
onClosed = resolve;
|
|
1855
|
-
});
|
|
1856
|
-
let stopped = false;
|
|
1857
|
-
let onGatewayReadyResolve;
|
|
1858
|
-
let onGatewayReadyReject;
|
|
1859
|
-
let gatewayReadySettled = false;
|
|
1860
|
-
const gatewayReady = new Promise((resolve, reject) => {
|
|
1861
|
-
onGatewayReadyResolve = resolve;
|
|
1862
|
-
onGatewayReadyReject = reject;
|
|
1863
|
-
});
|
|
1864
|
-
const resolveGatewayReady = () => {
|
|
1865
|
-
if (gatewayReadySettled) return;
|
|
1866
|
-
gatewayReadySettled = true;
|
|
1867
|
-
onGatewayReadyResolve();
|
|
1868
|
-
};
|
|
1869
|
-
const rejectGatewayReady = (err) => {
|
|
1870
|
-
if (gatewayReadySettled) return;
|
|
1871
|
-
gatewayReadySettled = true;
|
|
1872
|
-
onGatewayReadyReject(err instanceof Error ? err : new Error(String(err)));
|
|
1873
|
-
};
|
|
1874
|
-
const gateway = new GatewayClient({
|
|
1875
|
-
url: connection.url,
|
|
1876
|
-
token: creds.token,
|
|
1877
|
-
password: creds.password,
|
|
1878
|
-
clientName: GATEWAY_CLIENT_NAMES.CLI,
|
|
1879
|
-
clientDisplayName: "ACP",
|
|
1880
|
-
clientVersion: "acp",
|
|
1881
|
-
mode: GATEWAY_CLIENT_MODES.CLI,
|
|
1882
|
-
onEvent: (evt) => {
|
|
1883
|
-
agent?.handleGatewayEvent(evt);
|
|
1884
|
-
},
|
|
1885
|
-
onHelloOk: () => {
|
|
1886
|
-
resolveGatewayReady();
|
|
1887
|
-
agent?.handleGatewayReconnect();
|
|
1888
|
-
},
|
|
1889
|
-
onConnectError: (err) => {
|
|
1890
|
-
rejectGatewayReady(err);
|
|
1891
|
-
},
|
|
1892
|
-
onClose: (code, reason) => {
|
|
1893
|
-
if (!stopped) rejectGatewayReady(/* @__PURE__ */ new Error(`gateway closed before ready (${code}): ${reason}`));
|
|
1894
|
-
agent?.handleGatewayDisconnect(`${code}: ${reason}`);
|
|
1895
|
-
if (stopped) onClosed();
|
|
1896
|
-
}
|
|
1897
|
-
});
|
|
1898
|
-
const shutdown = () => {
|
|
1899
|
-
if (stopped) return;
|
|
1900
|
-
stopped = true;
|
|
1901
|
-
resolveGatewayReady();
|
|
1902
|
-
gateway.stop();
|
|
1903
|
-
onClosed();
|
|
1904
|
-
};
|
|
1905
|
-
process.once("SIGINT", shutdown);
|
|
1906
|
-
process.once("SIGTERM", shutdown);
|
|
1907
|
-
gateway.start();
|
|
1908
|
-
await gatewayReady.catch((err) => {
|
|
1909
|
-
shutdown();
|
|
1910
|
-
throw err;
|
|
1911
|
-
});
|
|
1912
|
-
if (stopped) return closed;
|
|
1913
|
-
new AgentSideConnection((conn) => {
|
|
1914
|
-
agent = new AcpGatewayAgent(conn, gateway, opts);
|
|
1915
|
-
agent.start();
|
|
1916
|
-
return agent;
|
|
1917
|
-
}, ndJsonStream(Writable.toWeb(process.stdout), Readable.toWeb(process.stdin)));
|
|
1918
|
-
return closed;
|
|
1919
|
-
}
|
|
1920
|
-
function parseArgs(args) {
|
|
1921
|
-
const opts = {};
|
|
1922
|
-
let tokenFile;
|
|
1923
|
-
let passwordFile;
|
|
1924
|
-
for (let i = 0; i < args.length; i += 1) {
|
|
1925
|
-
const arg = args[i];
|
|
1926
|
-
if (arg === "--url" || arg === "--gateway-url") {
|
|
1927
|
-
opts.gatewayUrl = args[i + 1];
|
|
1928
|
-
i += 1;
|
|
1929
|
-
continue;
|
|
1930
|
-
}
|
|
1931
|
-
if (arg === "--token" || arg === "--gateway-token") {
|
|
1932
|
-
opts.gatewayToken = args[i + 1];
|
|
1933
|
-
i += 1;
|
|
1934
|
-
continue;
|
|
1935
|
-
}
|
|
1936
|
-
if (arg === "--token-file" || arg === "--gateway-token-file") {
|
|
1937
|
-
tokenFile = args[i + 1];
|
|
1938
|
-
i += 1;
|
|
1939
|
-
continue;
|
|
1940
|
-
}
|
|
1941
|
-
if (arg === "--password" || arg === "--gateway-password") {
|
|
1942
|
-
opts.gatewayPassword = args[i + 1];
|
|
1943
|
-
i += 1;
|
|
1944
|
-
continue;
|
|
1945
|
-
}
|
|
1946
|
-
if (arg === "--password-file" || arg === "--gateway-password-file") {
|
|
1947
|
-
passwordFile = args[i + 1];
|
|
1948
|
-
i += 1;
|
|
1949
|
-
continue;
|
|
1950
|
-
}
|
|
1951
|
-
if (arg === "--session") {
|
|
1952
|
-
opts.defaultSessionKey = args[i + 1];
|
|
1953
|
-
i += 1;
|
|
1954
|
-
continue;
|
|
1955
|
-
}
|
|
1956
|
-
if (arg === "--session-label") {
|
|
1957
|
-
opts.defaultSessionLabel = args[i + 1];
|
|
1958
|
-
i += 1;
|
|
1959
|
-
continue;
|
|
1960
|
-
}
|
|
1961
|
-
if (arg === "--require-existing") {
|
|
1962
|
-
opts.requireExistingSession = true;
|
|
1963
|
-
continue;
|
|
1964
|
-
}
|
|
1965
|
-
if (arg === "--reset-session") {
|
|
1966
|
-
opts.resetSession = true;
|
|
1967
|
-
continue;
|
|
1968
|
-
}
|
|
1969
|
-
if (arg === "--no-prefix-cwd") {
|
|
1970
|
-
opts.prefixCwd = false;
|
|
1971
|
-
continue;
|
|
1972
|
-
}
|
|
1973
|
-
if (arg === "--provenance") {
|
|
1974
|
-
const provenanceMode = normalizeAcpProvenanceMode(args[i + 1]);
|
|
1975
|
-
if (!provenanceMode) throw new Error("Invalid --provenance value. Use off, meta, or meta+receipt.");
|
|
1976
|
-
opts.provenanceMode = provenanceMode;
|
|
1977
|
-
i += 1;
|
|
1978
|
-
continue;
|
|
1979
|
-
}
|
|
1980
|
-
if (arg === "--verbose" || arg === "-v") {
|
|
1981
|
-
opts.verbose = true;
|
|
1982
|
-
continue;
|
|
1983
|
-
}
|
|
1984
|
-
if (arg === "--help" || arg === "-h") {
|
|
1985
|
-
printHelp();
|
|
1986
|
-
process.exit(0);
|
|
1987
|
-
}
|
|
1988
|
-
}
|
|
1989
|
-
if (opts.gatewayToken?.trim() && tokenFile?.trim()) throw new Error("Use either --token or --token-file.");
|
|
1990
|
-
if (opts.gatewayPassword?.trim() && passwordFile?.trim()) throw new Error("Use either --password or --password-file.");
|
|
1991
|
-
if (tokenFile?.trim()) opts.gatewayToken = readSecretFromFile(tokenFile, "Gateway token");
|
|
1992
|
-
if (passwordFile?.trim()) opts.gatewayPassword = readSecretFromFile(passwordFile, "Gateway password");
|
|
1993
|
-
return opts;
|
|
1994
|
-
}
|
|
1995
|
-
function printHelp() {
|
|
1996
|
-
console.log(`Usage: moldclaw acp [options]
|
|
1997
|
-
|
|
1998
|
-
Gateway-backed ACP server for IDE integration.
|
|
1999
|
-
|
|
2000
|
-
Options:
|
|
2001
|
-
--url <url> Gateway WebSocket URL
|
|
2002
|
-
--token <token> Gateway auth token
|
|
2003
|
-
--token-file <path> Read gateway auth token from file
|
|
2004
|
-
--password <password> Gateway auth password
|
|
2005
|
-
--password-file <path> Read gateway auth password from file
|
|
2006
|
-
--session <key> Default session key (e.g. "agent:main:main")
|
|
2007
|
-
--session-label <label> Default session label to resolve
|
|
2008
|
-
--require-existing Fail if the session key/label does not exist
|
|
2009
|
-
--reset-session Reset the session key before first use
|
|
2010
|
-
--no-prefix-cwd Do not prefix prompts with the working directory
|
|
2011
|
-
--provenance <mode> ACP provenance mode: off, meta, or meta+receipt
|
|
2012
|
-
--verbose, -v Verbose logging to stderr
|
|
2013
|
-
--help, -h Show this help message
|
|
2014
|
-
`);
|
|
2015
|
-
}
|
|
2016
|
-
if (isMainModule({ currentFile: fileURLToPath(import.meta.url) })) {
|
|
2017
|
-
const argv = process.argv.slice(2);
|
|
2018
|
-
if (argv.includes("--token") || argv.includes("--gateway-token")) console.error("Warning: --token can be exposed via process listings. Prefer --token-file or MOLDCLAW_GATEWAY_TOKEN.");
|
|
2019
|
-
if (argv.includes("--password") || argv.includes("--gateway-password")) console.error("Warning: --password can be exposed via process listings. Prefer --password-file or MOLDCLAW_GATEWAY_PASSWORD.");
|
|
2020
|
-
serveAcpGateway(parseArgs(argv)).catch((err) => {
|
|
2021
|
-
console.error(String(err));
|
|
2022
|
-
process.exit(1);
|
|
2023
|
-
});
|
|
2024
|
-
}
|
|
2025
|
-
//#endregion
|
|
2026
|
-
//#region src/cli/acp-cli.ts
|
|
2027
|
-
function resolveSecretOption(params) {
|
|
2028
|
-
const direct = params.direct?.trim();
|
|
2029
|
-
const file = params.file?.trim();
|
|
2030
|
-
if (direct && file) throw new Error(`Use either ${params.directFlag} or ${params.fileFlag} for ${params.label}.`);
|
|
2031
|
-
if (file) return readSecretFromFile(file, params.label);
|
|
2032
|
-
return direct || void 0;
|
|
2033
|
-
}
|
|
2034
|
-
function warnSecretCliFlag(flag) {
|
|
2035
|
-
defaultRuntime.error(`Warning: ${flag} can be exposed via process listings. Prefer ${flag}-file or environment variables.`);
|
|
2036
|
-
}
|
|
2037
|
-
function registerAcpCli(program) {
|
|
2038
|
-
const acp = program.command("acp").description("Run an ACP bridge backed by the Gateway");
|
|
2039
|
-
acp.option("--url <url>", "Gateway WebSocket URL (defaults to gateway.remote.url when configured)").option("--token <token>", "Gateway token (if required)").option("--token-file <path>", "Read gateway token from file").option("--password <password>", "Gateway password (if required)").option("--password-file <path>", "Read gateway password from file").option("--session <key>", "Default session key (e.g. agent:main:main)").option("--session-label <label>", "Default session label to resolve").option("--require-existing", "Fail if the session key/label does not exist", false).option("--reset-session", "Reset the session key before first use", false).option("--no-prefix-cwd", "Do not prefix prompts with the working directory", false).option("--provenance <mode>", "ACP provenance mode: off, meta, or meta+receipt").option("-v, --verbose", "Verbose logging to stderr", false).addHelpText("after", () => `\n${theme.muted("Docs:")} ${formatDocsLink("/cli/acp", "docs.moldclaw.ai/cli/acp")}\n`).action(async (opts) => {
|
|
2040
|
-
try {
|
|
2041
|
-
const gatewayToken = resolveSecretOption({
|
|
2042
|
-
direct: opts.token,
|
|
2043
|
-
file: opts.tokenFile,
|
|
2044
|
-
directFlag: "--token",
|
|
2045
|
-
fileFlag: "--token-file",
|
|
2046
|
-
label: "Gateway token"
|
|
2047
|
-
});
|
|
2048
|
-
const gatewayPassword = resolveSecretOption({
|
|
2049
|
-
direct: opts.password,
|
|
2050
|
-
file: opts.passwordFile,
|
|
2051
|
-
directFlag: "--password",
|
|
2052
|
-
fileFlag: "--password-file",
|
|
2053
|
-
label: "Gateway password"
|
|
2054
|
-
});
|
|
2055
|
-
if (opts.token) warnSecretCliFlag("--token");
|
|
2056
|
-
if (opts.password) warnSecretCliFlag("--password");
|
|
2057
|
-
const provenanceMode = normalizeAcpProvenanceMode(opts.provenance);
|
|
2058
|
-
if (opts.provenance && !provenanceMode) throw new Error("Invalid --provenance value. Use off, meta, or meta+receipt.");
|
|
2059
|
-
await serveAcpGateway({
|
|
2060
|
-
gatewayUrl: opts.url,
|
|
2061
|
-
gatewayToken,
|
|
2062
|
-
gatewayPassword,
|
|
2063
|
-
defaultSessionKey: opts.session,
|
|
2064
|
-
defaultSessionLabel: opts.sessionLabel,
|
|
2065
|
-
requireExistingSession: Boolean(opts.requireExisting),
|
|
2066
|
-
resetSession: Boolean(opts.resetSession),
|
|
2067
|
-
prefixCwd: !opts.noPrefixCwd,
|
|
2068
|
-
provenanceMode,
|
|
2069
|
-
verbose: Boolean(opts.verbose)
|
|
2070
|
-
});
|
|
2071
|
-
} catch (err) {
|
|
2072
|
-
defaultRuntime.error(String(err));
|
|
2073
|
-
defaultRuntime.exit(1);
|
|
2074
|
-
}
|
|
2075
|
-
});
|
|
2076
|
-
acp.command("client").description("Run an interactive ACP client against the local ACP bridge").option("--cwd <dir>", "Working directory for the ACP session").option("--server <command>", "ACP server command (default: moldclaw)").option("--server-args <args...>", "Extra arguments for the ACP server").option("--server-verbose", "Enable verbose logging on the ACP server", false).option("-v, --verbose", "Verbose client logging", false).action(async (opts, command) => {
|
|
2077
|
-
const inheritedVerbose = inheritOptionFromParent(command, "verbose");
|
|
2078
|
-
try {
|
|
2079
|
-
await runAcpClientInteractive({
|
|
2080
|
-
cwd: opts.cwd,
|
|
2081
|
-
serverCommand: opts.server,
|
|
2082
|
-
serverArgs: opts.serverArgs,
|
|
2083
|
-
serverVerbose: Boolean(opts.serverVerbose),
|
|
2084
|
-
verbose: Boolean(opts.verbose || inheritedVerbose)
|
|
2085
|
-
});
|
|
2086
|
-
} catch (err) {
|
|
2087
|
-
defaultRuntime.error(String(err));
|
|
2088
|
-
defaultRuntime.exit(1);
|
|
2089
|
-
}
|
|
2090
|
-
});
|
|
2091
|
-
}
|
|
2092
|
-
//#endregion
|
|
2093
|
-
export { registerAcpCli };
|