remoteclaw 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/LICENSE +661 -0
- package/README.md +492 -0
- package/assets/chrome-extension/README.md +23 -0
- package/assets/chrome-extension/background-utils.js +48 -0
- package/assets/chrome-extension/background.js +899 -0
- package/assets/chrome-extension/icons/icon128.png +0 -0
- package/assets/chrome-extension/icons/icon16.png +0 -0
- package/assets/chrome-extension/icons/icon32.png +0 -0
- package/assets/chrome-extension/icons/icon48.png +0 -0
- package/assets/chrome-extension/manifest.json +25 -0
- package/assets/chrome-extension/options-validation.js +57 -0
- package/assets/chrome-extension/options.html +200 -0
- package/assets/chrome-extension/options.js +74 -0
- package/assets/clawtributor-avatar-placeholder.png +0 -0
- package/assets/dmg-background-small.png +0 -0
- package/assets/dmg-background.png +0 -0
- package/dist/account-lookup-C0ndrpt-.js +11 -0
- package/dist/account-lookup-CIY_RKhi.js +11 -0
- package/dist/accounts-B1M3fOxL.js +272 -0
- package/dist/accounts-B8PGQWQl.js +205 -0
- package/dist/accounts-CIVjmTg9.js +270 -0
- package/dist/accounts-D1awQXKu.js +36 -0
- package/dist/accounts-DHkGVGUR.js +36 -0
- package/dist/accounts-DyW1A_l8.js +206 -0
- package/dist/accounts-XFgBY644.js +47 -0
- package/dist/accounts-_ZuNC5bz.js +47 -0
- package/dist/accounts-uVavganx.js +32 -0
- package/dist/ack-reactions-B7iqdPZX.js +621 -0
- package/dist/ack-reactions-BapxA9fC.js +621 -0
- package/dist/acp-cli-7Plvw9pp.js +1316 -0
- package/dist/acp-cli-DmtggLxa.js +1311 -0
- package/dist/active-listener--jrUO-8L.js +37 -0
- package/dist/active-listener-DtU9K0MR.js +37 -0
- package/dist/agent-CX8QVdF4.js +688 -0
- package/dist/agent-HReIYVG-.js +687 -0
- package/dist/agent-helpers-5F0tdxud.js +400 -0
- package/dist/agent-helpers-Bs2nBXeI.js +400 -0
- package/dist/agent-scope-CWV-U3Ce.js +161 -0
- package/dist/agent-scope-FzE2oRm0.js +159 -0
- package/dist/agents-D9BWNEQX.js +769 -0
- package/dist/agents.config-0v2zcEf7.js +106 -0
- package/dist/agents.config-9DL6QCZc.js +106 -0
- package/dist/ansi-DtaiOnt1.js +107 -0
- package/dist/api-BE4ZCWWB.js +17 -0
- package/dist/api-wsk9zRVi.js +17 -0
- package/dist/argv-DW4MYBdJ.js +101 -0
- package/dist/audio-ClIuKwkl.js +43 -0
- package/dist/audio-DqlIYYTb.js +43 -0
- package/dist/audit-Bggny6TT.js +3089 -0
- package/dist/audit-DpuJ16Rj.js +3089 -0
- package/dist/auth-B-QK8JhI.js +315 -0
- package/dist/auth-C1zx1O24.js +314 -0
- package/dist/auth-DDmNYVMW.js +448 -0
- package/dist/auth-DH1wEw0w.js +448 -0
- package/dist/banner-BiLVJ0wV.js +294 -0
- package/dist/binaries-QJ-UTgL-.js +13 -0
- package/dist/bindings-6FvW-Ys9.js +69 -0
- package/dist/bindings-SnU_X1kX.js +69 -0
- package/dist/bonjour-discovery-AQMJqY4V.js +378 -0
- package/dist/bonjour-discovery-BLcPWHFJ.js +378 -0
- package/dist/boot/handler.js +1455 -0
- package/dist/brew-CBsS-Vq1.js +46 -0
- package/dist/brew-V4lMBeE3.js +46 -0
- package/dist/browser-cli-B5uW_onK.js +1690 -0
- package/dist/browser-cli-ClfZn9_h.js +1694 -0
- package/dist/build-info.json +5 -0
- package/dist/bundled/boot/HOOK.md +24 -0
- package/dist/bundled/command-logger/HOOK.md +122 -0
- package/dist/call-DHcgnRYq.js +518 -0
- package/dist/call-Wjjo7gwP.js +517 -0
- package/dist/canvas-host/a2ui/.bundle.hash +1 -0
- package/dist/canvas-host/a2ui/a2ui.bundle.js +17815 -0
- package/dist/canvas-host/a2ui/index.html +307 -0
- package/dist/catalog-CU0Xn2G1.js +186 -0
- package/dist/catalog-DDkwdGfX.js +186 -0
- package/dist/channel-account-context-BHIy71Yh.js +133 -0
- package/dist/channel-account-context-DXU_-EkJ.js +133 -0
- package/dist/channel-activity-BhT7NQ_v.js +94 -0
- package/dist/channel-activity-CvjEwpJz.js +94 -0
- package/dist/channel-activity-nsL1WwXH.js +292 -0
- package/dist/channel-options-B1tMfA9G.js +32 -0
- package/dist/channel-options-gEMUQQGy.js +33 -0
- package/dist/channel-selection-C3BMbeUs.js +51 -0
- package/dist/channel-selection-DHUO7WUa.js +51 -0
- package/dist/channel-web-DBCMnF6w.js +2132 -0
- package/dist/channel-web-DjD8eqnc.js +2134 -0
- package/dist/channels-cli-BfPB163m.js +1436 -0
- package/dist/channels-cli-dEMJmZF8.js +1440 -0
- package/dist/channels-status-issues-BMadvA0-.js +18 -0
- package/dist/channels-status-issues-D5fT2H21.js +18 -0
- package/dist/chat-envelope-AJFUAuBM.js +248 -0
- package/dist/chat-envelope-BrfcPlDM.js +248 -0
- package/dist/chat-type-BP9akbag.js +11 -0
- package/dist/chat-type-CH3W-zKy.js +11 -0
- package/dist/chrome-BQX0gpUh.js +1732 -0
- package/dist/chrome-CIytlE5x.js +1733 -0
- package/dist/chunk-BAMyFYtF.js +341 -0
- package/dist/chunk-BzVoFUZL.js +341 -0
- package/dist/clack-prompter-C6mBTOzE.js +122 -0
- package/dist/clack-prompter-DKcYqv3o.js +121 -0
- package/dist/cleanup-utils-Cb-leJcy.js +94 -0
- package/dist/cleanup-utils-ZC2zvntc.js +94 -0
- package/dist/cli/daemon-cli.js +9 -0
- package/dist/cli-BErCYGAt.js +131 -0
- package/dist/cli-EEZfdXxg.js +135 -0
- package/dist/cli-name-BZsYSp9l.js +23 -0
- package/dist/cli-name-CRe5Ow_t.js +23 -0
- package/dist/cli-utils-BUOtyfnU.js +16 -0
- package/dist/cli-utils-CGB3cBZm.js +16 -0
- package/dist/client-1TPQCsEe.js +2311 -0
- package/dist/client-9dK56xly.js +22 -0
- package/dist/client-CBpe99dr.js +2311 -0
- package/dist/client-D-R1YdRD.js +22 -0
- package/dist/clipboard-A06eV_5C.js +31 -0
- package/dist/clipboard-DQBl3coj.js +31 -0
- package/dist/command-format-BiiNHkWG.js +18 -0
- package/dist/command-format-Dntg_tnC.js +32 -0
- package/dist/command-logger/handler.js +57 -0
- package/dist/command-options-CnHA4TzR.js +26 -0
- package/dist/command-options-D2nN4AXX.js +26 -0
- package/dist/command-registry-BnrYqd5P.js +215 -0
- package/dist/commands-BrlSPrp8.js +41 -0
- package/dist/commands-keXWOHRq.js +41 -0
- package/dist/commands-registry-Cz77bvxB.js +887 -0
- package/dist/commands-registry-DRX3F4kj.js +888 -0
- package/dist/common-CBefYisq.js +156 -0
- package/dist/common-D4fL3S2m.js +156 -0
- package/dist/completion-cli-CXb-Xk3v.js +452 -0
- package/dist/completion-cli-Ca4Y7cQg.js +452 -0
- package/dist/config-CqP5tE9Z.js +3317 -0
- package/dist/config-cli-BYqebY6-.js +247 -0
- package/dist/config-cli-DKXHNFPz.js +243 -0
- package/dist/config-eval-BQIR-wSg.js +102 -0
- package/dist/config-eval-Bh82JoXK.js +102 -0
- package/dist/config-guard-BBPYncEK.js +92 -0
- package/dist/config-guard-CTQwNBtb.js +75 -0
- package/dist/config-qAZfcdDM.js +3315 -0
- package/dist/config-validation-BrjiFbBk.js +18 -0
- package/dist/config-validation-DSXKFJHF.js +18 -0
- package/dist/configure-C--DXb5y.js +885 -0
- package/dist/configure-D7tKM02_.js +883 -0
- package/dist/constants-BBVTjb1j.js +75 -0
- package/dist/constants-C7j1VA2S.js +12 -0
- package/dist/constants-DoYLsBmv.js +12 -0
- package/dist/constants-PMRtHBHU.js +75 -0
- package/dist/control-auth-BB_AdEQ8.js +397 -0
- package/dist/control-auth-Drc3vO7k.js +397 -0
- package/dist/control-ui/apple-touch-icon.png +0 -0
- package/dist/control-ui/assets/index-DdiU_ccM.css +1 -0
- package/dist/control-ui/assets/index-kVUYi64u.js +7723 -0
- package/dist/control-ui/assets/index-kVUYi64u.js.map +1 -0
- package/dist/control-ui/assets/pt-BR-eq0TfCI7.js +2 -0
- package/dist/control-ui/assets/pt-BR-eq0TfCI7.js.map +1 -0
- package/dist/control-ui/assets/zh-CN-DmLG2MF9.js +2 -0
- package/dist/control-ui/assets/zh-CN-DmLG2MF9.js.map +1 -0
- package/dist/control-ui/assets/zh-TW-BLErH0EM.js +2 -0
- package/dist/control-ui/assets/zh-TW-BLErH0EM.js.map +1 -0
- package/dist/control-ui/favicon-32.png +0 -0
- package/dist/control-ui/favicon.ico +0 -0
- package/dist/control-ui/favicon.svg +67 -0
- package/dist/control-ui/index.html +17 -0
- package/dist/control-ui-assets-DO1L6M0S.js +186 -0
- package/dist/control-ui-assets-S_TLo6Fs.js +186 -0
- package/dist/conversation-label-CDH4rKMG.js +36 -0
- package/dist/conversation-label-CMOfgCVl.js +36 -0
- package/dist/credentials-C_RoJFmK.js +91 -0
- package/dist/credentials-DM_Dj0m8.js +91 -0
- package/dist/cron-cli-DrEGbTLF.js +499 -0
- package/dist/cron-cli-iMnjEJcP.js +495 -0
- package/dist/daemon-cli-BXOrRB0h.js +735 -0
- package/dist/daemon-cli-DbOrC1C6.js +737 -0
- package/dist/daemon-cli.js +14217 -0
- package/dist/daemon-install-LufHc-Sn.js +60 -0
- package/dist/daemon-install-WEBvqVOj.js +56 -0
- package/dist/daemon-install-helpers-4BLEBjpg.js +504 -0
- package/dist/daemon-install-helpers-DVr51zvE.js +504 -0
- package/dist/daemon-runtime-9oDBR7YW.js +13 -0
- package/dist/daemon-runtime-CzFI2dPw.js +13 -0
- package/dist/dangerous-name-matching-BlTBBZns.js +45 -0
- package/dist/dangerous-name-matching-CSq9sJDG.js +45 -0
- package/dist/dangerous-tools-BRmbBvRf.js +253 -0
- package/dist/dangerous-tools-D4jtl72G.js +253 -0
- package/dist/deliver-C3Xs-DSE.js +481 -0
- package/dist/deliver-D49hWPWI.js +481 -0
- package/dist/delivery-queue-BDvalA10.js +244 -0
- package/dist/delivery-queue-BLMWPoKl.js +244 -0
- package/dist/devices-cli-6XBBb605.js +323 -0
- package/dist/devices-cli-BmB_Y5Tj.js +319 -0
- package/dist/diagnostics-BzzhTQzK.js +35 -0
- package/dist/diagnostics-DILtxtcE.js +35 -0
- package/dist/directory-cli-BnVIzNxj.js +225 -0
- package/dist/directory-cli-I7RtmvoP.js +221 -0
- package/dist/dispatcher-B7Yu14v7.js +173 -0
- package/dist/dispatcher-ClUtg8F9.js +174 -0
- package/dist/dm-policy-shared-Cd6QFFx6.js +22 -0
- package/dist/dm-policy-shared-DqkEp7h7.js +22 -0
- package/dist/dns-cli-Cm47-vJu.js +203 -0
- package/dist/dns-cli-DW4a6yJH.js +199 -0
- package/dist/dock-BFxpyZEm.js +906 -0
- package/dist/dock-Hf1acwVy.js +907 -0
- package/dist/doctor-completion-CefSDbii.js +92 -0
- package/dist/doctor-completion-DuOl6k-Z.js +92 -0
- package/dist/doctor-config-flow-DQdWVm5G.js +979 -0
- package/dist/doctor-config-flow-DZCCqya1.js +978 -0
- package/dist/enable-C3I9dWel.js +59 -0
- package/dist/enable-DnwKeWnR.js +59 -0
- package/dist/entry.js +2674 -0
- package/dist/env-DyyqmxSM.js +60 -0
- package/dist/env-vars-CD2_baIP.js +43 -0
- package/dist/env-vars-a7S70ba7.js +43 -0
- package/dist/errors-0dfGxeYQ.js +35 -0
- package/dist/errors-C1kDByVU.js +35 -0
- package/dist/exec-CAk1dxq_.js +164 -0
- package/dist/exec-epNpA1aU.js +164 -0
- package/dist/export-html/template.css +1024 -0
- package/dist/export-html/template.html +88 -0
- package/dist/export-html/template.js +1766 -0
- package/dist/export-html/vendor/highlight.min.js +1213 -0
- package/dist/export-html/vendor/marked.min.js +6 -0
- package/dist/extensionAPI.js +11699 -0
- package/dist/fetch-BMQq41sB.js +281 -0
- package/dist/fetch-CduIccDV.js +67 -0
- package/dist/fetch-Cky99wYB.js +281 -0
- package/dist/fetch-D3tw4B4n.js +67 -0
- package/dist/fetch-DTsU2XnC.js +67 -0
- package/dist/fetch-timeout-CytN1wiO.js +43 -0
- package/dist/fetch-timeout-DBRRPNBi.js +43 -0
- package/dist/file-identity-CeRK5CJC.js +12 -0
- package/dist/file-lock-DWH0TfVu.js +107 -0
- package/dist/file-lock-DXW9h9ek.js +107 -0
- package/dist/format-duration-B-Uv5nOi.js +35 -0
- package/dist/format-duration-Oj8pTbYL.js +35 -0
- package/dist/format-relative-Czf5fUjn.js +55 -0
- package/dist/format-relative-zwkkXJvs.js +55 -0
- package/dist/fs-safe-BjSd07M4.js +115 -0
- package/dist/fs-safe-aWIhCWlb.js +125 -0
- package/dist/gateway-cli-BQ5Nrc2v.js +24127 -0
- package/dist/gateway-cli-x9Pn-J8m.js +24131 -0
- package/dist/gateway-rpc-C9zLj_Sl.js +28 -0
- package/dist/gateway-rpc-Cdx4sTh5.js +28 -0
- package/dist/gmail-setup-utils-CKyh29_R.js +422 -0
- package/dist/gmail-setup-utils-DquflkMR.js +423 -0
- package/dist/health-DlRS-gIZ.js +1414 -0
- package/dist/health-UZKtVUZc.js +1417 -0
- package/dist/health-format-BE5TK5bs.js +28 -0
- package/dist/health-format-DF54wvUU.js +28 -0
- package/dist/heartbeat-visibility-98-alasQ.js +125 -0
- package/dist/heartbeat-visibility-CGSqfsb3.js +125 -0
- package/dist/heartbeat-wake-CvHncCjP.js +182 -0
- package/dist/heartbeat-wake-DLxQm6-U.js +182 -0
- package/dist/help-format-CJQ7APRn.js +17 -0
- package/dist/help-format-D3JhWp1E.js +17 -0
- package/dist/helpers-703bXVlF.js +25 -0
- package/dist/helpers-DAEoFkbn.js +10 -0
- package/dist/helpers-n2CtWpm9.js +25 -0
- package/dist/helpers-ndPQWl6m.js +10 -0
- package/dist/hook-runner-global-nAi_RVmo.js +527 -0
- package/dist/hooks-cli-BN23UkSe.js +1221 -0
- package/dist/hooks-cli-CCigUQAP.js +1217 -0
- package/dist/host-env-security-BGibnCbS.js +106 -0
- package/dist/host-env-security-axRnIi8d.js +106 -0
- package/dist/image-ops-CX41n0v5.js +354 -0
- package/dist/image-ops-DSL3eFfQ.js +354 -0
- package/dist/import-BwboAUxS.js +604 -0
- package/dist/import-TnR4slPl.js +606 -0
- package/dist/inbound-context-BLy-G2Eq.js +68 -0
- package/dist/inbound-context-Cuu0thCw.js +68 -0
- package/dist/index.js +598 -0
- package/dist/input-provenance-gIfDn1ki.js +35 -0
- package/dist/input-provenance-wkso1o5V.js +35 -0
- package/dist/inspect-BEpFbi0c.js +286 -0
- package/dist/inspect-BeNNpWna.js +286 -0
- package/dist/installs-BmtDxAA-.js +319 -0
- package/dist/installs-DJ188C74.js +319 -0
- package/dist/ip-D4VG5EJO.js +200 -0
- package/dist/ip-MwCwRA7c.js +200 -0
- package/dist/ipv4-DNo9AFDu.js +46 -0
- package/dist/ipv4-VfoVR5uR.js +46 -0
- package/dist/ir-DRpvvv-1.js +972 -0
- package/dist/is-main-BE1Jih91.js +30 -0
- package/dist/json-file-BW22hGtf.js +25 -0
- package/dist/json-file-DwRAfAAy.js +25 -0
- package/dist/json-files-BI20PLIm.js +46 -0
- package/dist/json-files-Dy52honG.js +46 -0
- package/dist/lanes-1CBKdsiR.js +58 -0
- package/dist/lanes-DqVYfPRG.js +58 -0
- package/dist/lifecycle-core-BzhjWI2E.js +476 -0
- package/dist/lifecycle-core-DctTLBFp.js +474 -0
- package/dist/links-CtGBIrG8.js +15 -0
- package/dist/links-CwTlzaPe.js +15 -0
- package/dist/loader-BLMpE4uG.js +22397 -0
- package/dist/loader-C5cQlGXB.js +22400 -0
- package/dist/location-BUhzov-a.js +43 -0
- package/dist/location-Qo8Ii1zo.js +43 -0
- package/dist/logger-ASsO5Nz-.js +49 -0
- package/dist/logger-B8BE0PyS.js +12 -0
- package/dist/logger-CPvz-aPM.js +47 -0
- package/dist/logger-cL0D2DCr.js +12 -0
- package/dist/logging-Cd9y2AdQ.js +20 -0
- package/dist/logging-DRwtiLIS.js +1 -0
- package/dist/logging-DTEoeoa3.js +19 -0
- package/dist/logging-fywhKCmE.js +1 -0
- package/dist/login-B5TdMKIC.js +61 -0
- package/dist/login-Cak5EAvl.js +62 -0
- package/dist/login-qr-BuTJwO4R.js +329 -0
- package/dist/login-qr-Do-8NFKK.js +325 -0
- package/dist/logs-cli-BkCweYSR.js +240 -0
- package/dist/logs-cli-CMUTrgGH.js +236 -0
- package/dist/markdown-tables-B3sXo71y.js +29 -0
- package/dist/markdown-tables-C48ANSSq.js +29 -0
- package/dist/media-DcDCPyuW.js +971 -0
- package/dist/media-DgxPvn2i.js +9492 -0
- package/dist/message-action-names-BwpFcASf.js +2520 -0
- package/dist/message-action-names-CH6TDClE.js +2520 -0
- package/dist/message-channel-CtcVHawF.js +91 -0
- package/dist/message-channel-tuc9CdEw.js +91 -0
- package/dist/mime-CAqaK3kp.js +146 -0
- package/dist/mime-ViuhRuMM.js +146 -0
- package/dist/mutable-allowlist-detectors-BXE7Hr7F.js +64 -0
- package/dist/mutable-allowlist-detectors-CtKavajp.js +64 -0
- package/dist/net-DSkFMHJ8.js +225 -0
- package/dist/net-DTqfFYzt.js +225 -0
- package/dist/node-cli-DTp-eCFc.js +1386 -0
- package/dist/node-cli-Yd_KvTgV.js +1390 -0
- package/dist/node-service-RyMlWp8N.js +67 -0
- package/dist/node-service-TL9b6Qfz.js +67 -0
- package/dist/nodes-cli-BcXyjWnw.js +1350 -0
- package/dist/nodes-cli-DHHf5weG.js +1346 -0
- package/dist/nodes-screen-B7HJugJ0.js +250 -0
- package/dist/nodes-screen-nCRd71Mk.js +250 -0
- package/dist/note-B6142LyJ.js +92 -0
- package/dist/note-D-EI0czq.js +92 -0
- package/dist/npm-registry-spec-PPyRXSpx.js +786 -0
- package/dist/npm-registry-spec-uUmDWe6v.js +786 -0
- package/dist/npm-resolution-C-6NY92-.js +86 -0
- package/dist/npm-resolution-DSRcDO7P.js +86 -0
- package/dist/onboard-D0pXb_02.js +645 -0
- package/dist/onboard-DdAR-LF_.js +647 -0
- package/dist/onboard-auth-cNtb3FTP.js +211 -0
- package/dist/onboard-auth-gwz-0mZ6.js +207 -0
- package/dist/onboard-channels-8SAR1gMS.js +2618 -0
- package/dist/onboard-channels-tRmXz2Lj.js +2619 -0
- package/dist/onboard-config-DOmXYEvJ.js +39 -0
- package/dist/onboard-config-JmR21VYa.js +39 -0
- package/dist/onboard-helpers-DGVxeLf_.js +358 -0
- package/dist/onboard-helpers-DdqoC3w8.js +357 -0
- package/dist/onboard-remote-CspZpXS9.js +127 -0
- package/dist/onboard-remote-DJcHZQqI.js +127 -0
- package/dist/onboarding-BH0siVu3.js +586 -0
- package/dist/onboarding-CKmRrgeq.js +588 -0
- package/dist/onboarding.finalize-BGyWeNH5.js +402 -0
- package/dist/onboarding.finalize-BpVbqIc1.js +404 -0
- package/dist/onboarding.gateway-config-B4xt1gtO.js +202 -0
- package/dist/onboarding.gateway-config-CT9RcbVE.js +196 -0
- package/dist/outbound-B3wlEY-e.js +220 -0
- package/dist/outbound-KHig2PTG.js +221 -0
- package/dist/outbound-attachment-BZkefkAT.js +18 -0
- package/dist/outbound-attachment-D5FMlKjS.js +18 -0
- package/dist/outbound-attachment-DjvyU7Oq.js +18 -0
- package/dist/pairing-cli-BTwS98JV.js +130 -0
- package/dist/pairing-cli-C8jztqm2.js +126 -0
- package/dist/pairing-labels-E2eoE9tc.js +9 -0
- package/dist/pairing-labels-Ks4ey7DT.js +9 -0
- package/dist/pairing-store-C7DF-eCM.js +460 -0
- package/dist/pairing-store-CU4_h9xa.js +459 -0
- package/dist/parse-log-line-GisaZn5H.js +44 -0
- package/dist/parse-log-line-ZsbwG_u7.js +44 -0
- package/dist/parse-timeout-BpphuwYl.js +16 -0
- package/dist/parse-timeout-CE6BjmGU.js +16 -0
- package/dist/path-env-DMKJ1GE3.js +89 -0
- package/dist/path-env-Dq-jhL2Z.js +89 -0
- package/dist/path-safety-BFE0XmGC.js +14 -0
- package/dist/path-safety-BJ8ge6Ho.js +14 -0
- package/dist/paths-DHuXVC00.js +229 -0
- package/dist/plugin-auto-enable-Bms-lvxW.js +289 -0
- package/dist/plugin-auto-enable-fc5IL3zs.js +288 -0
- package/dist/plugin-registry-BrQP6X71.js +33 -0
- package/dist/plugin-registry-nbb06LsB.js +33 -0
- package/dist/plugin-sdk/account-id.d.ts +1 -0
- package/dist/plugin-sdk/account-id.js +34 -0
- package/dist/plugin-sdk/agents/agent-helpers/errors.d.ts +55 -0
- package/dist/plugin-sdk/agents/agent-helpers/google.d.ts +3 -0
- package/dist/plugin-sdk/agents/agent-helpers/images.d.ts +21 -0
- package/dist/plugin-sdk/agents/agent-helpers/message-sanitization.d.ts +14 -0
- package/dist/plugin-sdk/agents/agent-helpers/messaging-dedupe.d.ts +10 -0
- package/dist/plugin-sdk/agents/agent-helpers/openai.d.ts +9 -0
- package/dist/plugin-sdk/agents/agent-helpers/turns.d.ts +20 -0
- package/dist/plugin-sdk/agents/agent-helpers/types.d.ts +1 -0
- package/dist/plugin-sdk/agents/agent-helpers.d.ts +10 -0
- package/dist/plugin-sdk/agents/agent-messaging.d.ts +8 -0
- package/dist/plugin-sdk/agents/agent-scope.d.ts +81 -0
- package/dist/plugin-sdk/agents/agent-types.d.ts +73 -0
- package/dist/plugin-sdk/agents/agent-utils.d.ts +25 -0
- package/dist/plugin-sdk/agents/announce-idempotency.d.ts +11 -0
- package/dist/plugin-sdk/agents/block-chunker.d.ts +19 -0
- package/dist/plugin-sdk/agents/channel-tools.d.ts +27 -0
- package/dist/plugin-sdk/agents/cli-session.d.ts +3 -0
- package/dist/plugin-sdk/agents/current-time.d.ts +17 -0
- package/dist/plugin-sdk/agents/date-time.d.ts +13 -0
- package/dist/plugin-sdk/agents/identity-avatar.d.ts +15 -0
- package/dist/plugin-sdk/agents/identity.d.ts +28 -0
- package/dist/plugin-sdk/agents/image-sanitization.d.ts +8 -0
- package/dist/plugin-sdk/agents/lanes.d.ts +3 -0
- package/dist/plugin-sdk/agents/live-auth-keys.d.ts +6 -0
- package/dist/plugin-sdk/agents/owner-display.d.ts +19 -0
- package/dist/plugin-sdk/agents/provider-utils.d.ts +20 -0
- package/dist/plugin-sdk/agents/schema/typebox.d.ts +14 -0
- package/dist/plugin-sdk/agents/session-write-lock.d.ts +53 -0
- package/dist/plugin-sdk/agents/stable-stringify.d.ts +1 -0
- package/dist/plugin-sdk/agents/subagent-announce-queue.d.ts +24 -0
- package/dist/plugin-sdk/agents/subagent-announce.d.ts +39 -0
- package/dist/plugin-sdk/agents/subagent-depth.d.ts +11 -0
- package/dist/plugin-sdk/agents/subagent-lifecycle-events.d.ts +18 -0
- package/dist/plugin-sdk/agents/subagent-registry-cleanup.d.ts +24 -0
- package/dist/plugin-sdk/agents/subagent-registry-completion.d.ts +15 -0
- package/dist/plugin-sdk/agents/subagent-registry-queries.d.ts +11 -0
- package/dist/plugin-sdk/agents/subagent-registry-state.d.ts +7 -0
- package/dist/plugin-sdk/agents/subagent-registry.d.ts +45 -0
- package/dist/plugin-sdk/agents/subagent-registry.store.d.ts +4 -0
- package/dist/plugin-sdk/agents/subagent-registry.types.d.ts +34 -0
- package/dist/plugin-sdk/agents/subagent-spawn.d.ts +46 -0
- package/dist/plugin-sdk/agents/timeout.d.ts +8 -0
- package/dist/plugin-sdk/agents/tool-call-id.d.ts +27 -0
- package/dist/plugin-sdk/agents/tool-display-common.d.ts +32 -0
- package/dist/plugin-sdk/agents/tool-display.d.ts +15 -0
- package/dist/plugin-sdk/agents/tool-images.d.ts +10 -0
- package/dist/plugin-sdk/agents/tools/agent-step.d.ts +15 -0
- package/dist/plugin-sdk/agents/tools/common.d.ts +80 -0
- package/dist/plugin-sdk/agents/tools/discord-actions-guild.d.ts +4 -0
- package/dist/plugin-sdk/agents/tools/discord-actions-messaging.d.ts +6 -0
- package/dist/plugin-sdk/agents/tools/discord-actions-moderation-shared.d.ts +13 -0
- package/dist/plugin-sdk/agents/tools/discord-actions-moderation.d.ts +4 -0
- package/dist/plugin-sdk/agents/tools/discord-actions-presence.d.ts +4 -0
- package/dist/plugin-sdk/agents/tools/discord-actions.d.ts +5 -0
- package/dist/plugin-sdk/agents/tools/sessions-access.d.ts +42 -0
- package/dist/plugin-sdk/agents/tools/sessions-helpers.d.ts +51 -0
- package/dist/plugin-sdk/agents/tools/sessions-resolution.d.ts +59 -0
- package/dist/plugin-sdk/agents/tools/sessions-send-helpers.d.ts +34 -0
- package/dist/plugin-sdk/agents/tools/slack-actions.d.ts +15 -0
- package/dist/plugin-sdk/agents/tools/telegram-actions.d.ts +7 -0
- package/dist/plugin-sdk/agents/tools/whatsapp-actions.d.ts +3 -0
- package/dist/plugin-sdk/agents/tools/whatsapp-target-auth.d.ts +10 -0
- package/dist/plugin-sdk/agents/usage.d.ts +49 -0
- package/dist/plugin-sdk/agents/workspace.d.ts +1 -0
- package/dist/plugin-sdk/auth/api-key-rotation.d.ts +22 -0
- package/dist/plugin-sdk/auth/constants.d.ts +15 -0
- package/dist/plugin-sdk/auth/display.d.ts +7 -0
- package/dist/plugin-sdk/auth/doctor.d.ts +8 -0
- package/dist/plugin-sdk/auth/env-injection.d.ts +38 -0
- package/dist/plugin-sdk/auth/index.d.ts +10 -0
- package/dist/plugin-sdk/auth/oauth.d.ts +13 -0
- package/dist/plugin-sdk/auth/order.d.ts +8 -0
- package/dist/plugin-sdk/auth/paths.d.ts +3 -0
- package/dist/plugin-sdk/auth/profiles.d.ts +11 -0
- package/dist/plugin-sdk/auth/provider-auth.d.ts +32 -0
- package/dist/plugin-sdk/auth/store.d.ts +7 -0
- package/dist/plugin-sdk/auth/types.d.ts +45 -0
- package/dist/plugin-sdk/auth/usage.d.ts +80 -0
- package/dist/plugin-sdk/auto-reply/chunk.d.ts +45 -0
- package/dist/plugin-sdk/auto-reply/command-auth.d.ts +17 -0
- package/dist/plugin-sdk/auto-reply/command-detection.d.ts +13 -0
- package/dist/plugin-sdk/auto-reply/commands-args.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/commands-registry.d.ts +47 -0
- package/dist/plugin-sdk/auto-reply/commands-registry.data.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/commands-registry.types.d.ts +66 -0
- package/dist/plugin-sdk/auto-reply/dispatch.d.ts +32 -0
- package/dist/plugin-sdk/auto-reply/envelope.d.ts +58 -0
- package/dist/plugin-sdk/auto-reply/fallback-state.d.ts +55 -0
- package/dist/plugin-sdk/auto-reply/group-activation.d.ts +6 -0
- package/dist/plugin-sdk/auto-reply/heartbeat-reply-payload.d.ts +2 -0
- package/dist/plugin-sdk/auto-reply/heartbeat.d.ts +16 -0
- package/dist/plugin-sdk/auto-reply/inbound-debounce.d.ts +17 -0
- package/dist/plugin-sdk/auto-reply/media-note.d.ts +2 -0
- package/dist/plugin-sdk/auto-reply/model.d.ts +8 -0
- package/dist/plugin-sdk/auto-reply/reply/abort.d.ts +32 -0
- package/dist/plugin-sdk/auto-reply/reply/agent-runner-execution.d.ts +58 -0
- package/dist/plugin-sdk/auto-reply/reply/agent-runner-helpers.d.ts +15 -0
- package/dist/plugin-sdk/auto-reply/reply/agent-runner-payloads.d.ts +27 -0
- package/dist/plugin-sdk/auto-reply/reply/agent-runner-utils.d.ts +119 -0
- package/dist/plugin-sdk/auto-reply/reply/agent-runner.d.ts +36 -0
- package/dist/plugin-sdk/auto-reply/reply/block-reply-coalescer.d.ts +15 -0
- package/dist/plugin-sdk/auto-reply/reply/block-reply-pipeline.d.ts +31 -0
- package/dist/plugin-sdk/auto-reply/reply/block-streaming.d.ts +22 -0
- package/dist/plugin-sdk/auto-reply/reply/body.d.ts +10 -0
- package/dist/plugin-sdk/auto-reply/reply/command-gates.d.ts +18 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-allowlist.d.ts +2 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-config.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-context.d.ts +12 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-core.d.ts +13 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-export-session.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-info.d.ts +11 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-plugin.d.ts +13 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-session.d.ts +8 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-setunset-standard.d.ts +10 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-setunset.d.ts +34 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-slash-parse.d.ts +24 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-status.d.ts +20 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-agents.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-focus.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-help.d.ts +2 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-info.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-kill.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-list.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-log.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-send.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-spawn.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-unfocus.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-subagents/shared.d.ts +81 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-subagents.d.ts +4 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-tts.d.ts +2 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-types.d.ts +49 -0
- package/dist/plugin-sdk/auto-reply/reply/commands.d.ts +4 -0
- package/dist/plugin-sdk/auto-reply/reply/config-commands.d.ts +15 -0
- package/dist/plugin-sdk/auto-reply/reply/config-value.d.ts +4 -0
- package/dist/plugin-sdk/auto-reply/reply/debug-commands.d.ts +16 -0
- package/dist/plugin-sdk/auto-reply/reply/directive-handling.d.ts +6 -0
- package/dist/plugin-sdk/auto-reply/reply/directive-handling.fast-lane.d.ts +7 -0
- package/dist/plugin-sdk/auto-reply/reply/directive-handling.impl.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/reply/directive-handling.levels.d.ts +11 -0
- package/dist/plugin-sdk/auto-reply/reply/directive-handling.params.d.ts +49 -0
- package/dist/plugin-sdk/auto-reply/reply/directive-handling.parse.d.ts +37 -0
- package/dist/plugin-sdk/auto-reply/reply/directive-handling.persist.d.ts +39 -0
- package/dist/plugin-sdk/auto-reply/reply/directive-handling.queue-validation.d.ts +10 -0
- package/dist/plugin-sdk/auto-reply/reply/directive-handling.shared.d.ts +4 -0
- package/dist/plugin-sdk/auto-reply/reply/directive-parsing.d.ts +5 -0
- package/dist/plugin-sdk/auto-reply/reply/directives.d.ts +19 -0
- package/dist/plugin-sdk/auto-reply/reply/dispatch-from-config.d.ts +16 -0
- package/dist/plugin-sdk/auto-reply/reply/dispatcher-registry.d.ts +24 -0
- package/dist/plugin-sdk/auto-reply/reply/followup-runner.d.ts +16 -0
- package/dist/plugin-sdk/auto-reply/reply/get-reply-directives-apply.d.ts +55 -0
- package/dist/plugin-sdk/auto-reply/reply/get-reply-directives-utils.d.ts +2 -0
- package/dist/plugin-sdk/auto-reply/reply/get-reply-directives.d.ts +102 -0
- package/dist/plugin-sdk/auto-reply/reply/get-reply-inline-actions.d.ts +45 -0
- package/dist/plugin-sdk/auto-reply/reply/get-reply-run.d.ts +59 -0
- package/dist/plugin-sdk/auto-reply/reply/get-reply.d.ts +4 -0
- package/dist/plugin-sdk/auto-reply/reply/groups.d.ts +26 -0
- package/dist/plugin-sdk/auto-reply/reply/history.d.ts +72 -0
- package/dist/plugin-sdk/auto-reply/reply/inbound-context.d.ts +8 -0
- package/dist/plugin-sdk/auto-reply/reply/inbound-dedupe.d.ts +8 -0
- package/dist/plugin-sdk/auto-reply/reply/inbound-meta.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/reply/inbound-text.d.ts +1 -0
- package/dist/plugin-sdk/auto-reply/reply/line-directives.d.ts +22 -0
- package/dist/plugin-sdk/auto-reply/reply/mentions.d.ts +19 -0
- package/dist/plugin-sdk/auto-reply/reply/normalize-reply.d.ts +11 -0
- package/dist/plugin-sdk/auto-reply/reply/origin-routing.d.ts +13 -0
- package/dist/plugin-sdk/auto-reply/reply/provider-dispatcher.d.ts +19 -0
- package/dist/plugin-sdk/auto-reply/reply/queue/cleanup.d.ts +6 -0
- package/dist/plugin-sdk/auto-reply/reply/queue/directive.d.ts +15 -0
- package/dist/plugin-sdk/auto-reply/reply/queue/drain.d.ts +2 -0
- package/dist/plugin-sdk/auto-reply/reply/queue/enqueue.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/reply/queue/normalize.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/reply/queue/settings.d.ts +2 -0
- package/dist/plugin-sdk/auto-reply/reply/queue/state.d.ts +20 -0
- package/dist/plugin-sdk/auto-reply/reply/queue/types.d.ts +72 -0
- package/dist/plugin-sdk/auto-reply/reply/queue-policy.d.ts +8 -0
- package/dist/plugin-sdk/auto-reply/reply/queue.d.ts +8 -0
- package/dist/plugin-sdk/auto-reply/reply/reply-delivery.d.ts +27 -0
- package/dist/plugin-sdk/auto-reply/reply/reply-directives.d.ts +14 -0
- package/dist/plugin-sdk/auto-reply/reply/reply-dispatcher.d.ts +53 -0
- package/dist/plugin-sdk/auto-reply/reply/reply-inline.d.ts +8 -0
- package/dist/plugin-sdk/auto-reply/reply/reply-payloads.d.ts +27 -0
- package/dist/plugin-sdk/auto-reply/reply/reply-reference.d.ts +20 -0
- package/dist/plugin-sdk/auto-reply/reply/reply-tags.d.ts +6 -0
- package/dist/plugin-sdk/auto-reply/reply/reply-threading.d.ts +9 -0
- package/dist/plugin-sdk/auto-reply/reply/response-prefix-template.d.ts +49 -0
- package/dist/plugin-sdk/auto-reply/reply/route-reply.d.ts +56 -0
- package/dist/plugin-sdk/auto-reply/reply/session-reset-prompt.d.ts +1 -0
- package/dist/plugin-sdk/auto-reply/reply/session-run-accounting.d.ts +4 -0
- package/dist/plugin-sdk/auto-reply/reply/session-updates.d.ts +8 -0
- package/dist/plugin-sdk/auto-reply/reply/session-usage.d.ts +21 -0
- package/dist/plugin-sdk/auto-reply/reply/session.d.ts +26 -0
- package/dist/plugin-sdk/auto-reply/reply/strip-inbound-meta.d.ts +27 -0
- package/dist/plugin-sdk/auto-reply/reply/subagents-utils.d.ts +26 -0
- package/dist/plugin-sdk/auto-reply/reply/typing-mode.d.ts +27 -0
- package/dist/plugin-sdk/auto-reply/reply/typing.d.ts +18 -0
- package/dist/plugin-sdk/auto-reply/reply/untrusted-context.d.ts +1 -0
- package/dist/plugin-sdk/auto-reply/reply.d.ts +5 -0
- package/dist/plugin-sdk/auto-reply/send-policy.d.ts +6 -0
- package/dist/plugin-sdk/auto-reply/status.d.ts +50 -0
- package/dist/plugin-sdk/auto-reply/templating.d.ts +155 -0
- package/dist/plugin-sdk/auto-reply/thinking.d.ts +7 -0
- package/dist/plugin-sdk/auto-reply/tokens.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/types.d.ts +79 -0
- package/dist/plugin-sdk/channel-web.d.ts +6 -0
- package/dist/plugin-sdk/channels/account-summary.d.ts +17 -0
- package/dist/plugin-sdk/channels/ack-reactions.d.ts +29 -0
- package/dist/plugin-sdk/channels/allow-from.d.ts +11 -0
- package/dist/plugin-sdk/channels/allowlist-match.d.ts +16 -0
- package/dist/plugin-sdk/channels/allowlists/resolve-utils.d.ts +33 -0
- package/dist/plugin-sdk/channels/channel-config.d.ts +39 -0
- package/dist/plugin-sdk/channels/chat-type.d.ts +2 -0
- package/dist/plugin-sdk/channels/command-gating.d.ts +20 -0
- package/dist/plugin-sdk/channels/conversation-label.d.ts +2 -0
- package/dist/plugin-sdk/channels/dock.d.ts +24 -0
- package/dist/plugin-sdk/channels/draft-stream-controls.d.ts +54 -0
- package/dist/plugin-sdk/channels/draft-stream-loop.d.ts +13 -0
- package/dist/plugin-sdk/channels/location.d.ts +21 -0
- package/dist/plugin-sdk/channels/logging.d.ts +20 -0
- package/dist/plugin-sdk/channels/mention-gating.d.ts +27 -0
- package/dist/plugin-sdk/channels/model-overrides.d.ts +18 -0
- package/dist/plugin-sdk/channels/plugins/account-action-gate.d.ts +5 -0
- package/dist/plugin-sdk/channels/plugins/account-helpers.d.ts +6 -0
- package/dist/plugin-sdk/channels/plugins/actions/discord/handle-action.d.ts +3 -0
- package/dist/plugin-sdk/channels/plugins/actions/discord/handle-action.guild-admin.d.ts +9 -0
- package/dist/plugin-sdk/channels/plugins/actions/discord.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/actions/shared.d.ts +7 -0
- package/dist/plugin-sdk/channels/plugins/actions/signal.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/actions/telegram.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/agent-tools/whatsapp-login.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/allowlist-match.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/bluebubbles-actions.d.ts +48 -0
- package/dist/plugin-sdk/channels/plugins/channel-config.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/config-helpers.d.ts +14 -0
- package/dist/plugin-sdk/channels/plugins/config-schema.d.ts +3 -0
- package/dist/plugin-sdk/channels/plugins/config-writes.d.ts +7 -0
- package/dist/plugin-sdk/channels/plugins/directory-config.d.ts +16 -0
- package/dist/plugin-sdk/channels/plugins/group-mentions.d.ts +18 -0
- package/dist/plugin-sdk/channels/plugins/helpers.d.ts +8 -0
- package/dist/plugin-sdk/channels/plugins/index.d.ts +8 -0
- package/dist/plugin-sdk/channels/plugins/media-limits.d.ts +9 -0
- package/dist/plugin-sdk/channels/plugins/media-payload.d.ts +15 -0
- package/dist/plugin-sdk/channels/plugins/message-action-names.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/normalize/discord.d.ts +14 -0
- package/dist/plugin-sdk/channels/plugins/normalize/imessage.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/normalize/shared.d.ts +6 -0
- package/dist/plugin-sdk/channels/plugins/normalize/signal.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/normalize/slack.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/normalize/telegram.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/normalize/whatsapp.d.ts +3 -0
- package/dist/plugin-sdk/channels/plugins/onboarding/channel-access-configure.d.ts +21 -0
- package/dist/plugin-sdk/channels/plugins/onboarding/channel-access.d.ts +31 -0
- package/dist/plugin-sdk/channels/plugins/onboarding/discord.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/onboarding/helpers.d.ts +177 -0
- package/dist/plugin-sdk/channels/plugins/onboarding/imessage.d.ts +6 -0
- package/dist/plugin-sdk/channels/plugins/onboarding/signal.d.ts +7 -0
- package/dist/plugin-sdk/channels/plugins/onboarding/slack.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/onboarding/telegram.d.ts +4 -0
- package/dist/plugin-sdk/channels/plugins/onboarding/whatsapp.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/onboarding-types.d.ts +77 -0
- package/dist/plugin-sdk/channels/plugins/outbound/load.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/pairing-message.d.ts +1 -0
- package/dist/plugin-sdk/channels/plugins/pairing.d.ts +16 -0
- package/dist/plugin-sdk/channels/plugins/registry-loader.d.ts +5 -0
- package/dist/plugin-sdk/channels/plugins/setup-helpers.d.ts +13 -0
- package/dist/plugin-sdk/channels/plugins/status-issues/bluebubbles.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/status-issues/discord.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/status-issues/shared.d.ts +29 -0
- package/dist/plugin-sdk/channels/plugins/status-issues/telegram.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/status-issues/whatsapp.d.ts +2 -0
- package/dist/plugin-sdk/channels/plugins/types.adapters.d.ts +282 -0
- package/dist/plugin-sdk/channels/plugins/types.core.d.ts +350 -0
- package/dist/plugin-sdk/channels/plugins/types.d.ts +6 -0
- package/dist/plugin-sdk/channels/plugins/types.plugin.d.ts +53 -0
- package/dist/plugin-sdk/channels/plugins/whatsapp-heartbeat.d.ts +11 -0
- package/dist/plugin-sdk/channels/plugins/whatsapp-shared.d.ts +5 -0
- package/dist/plugin-sdk/channels/registry.d.ts +15 -0
- package/dist/plugin-sdk/channels/reply-prefix.d.ts +24 -0
- package/dist/plugin-sdk/channels/sender-label.d.ts +9 -0
- package/dist/plugin-sdk/channels/session.d.ts +18 -0
- package/dist/plugin-sdk/channels/status-reactions.d.ts +62 -0
- package/dist/plugin-sdk/channels/targets.d.ts +42 -0
- package/dist/plugin-sdk/channels/telegram/api.d.ts +5 -0
- package/dist/plugin-sdk/channels/typing-lifecycle.d.ts +12 -0
- package/dist/plugin-sdk/channels/typing.d.ts +13 -0
- package/dist/plugin-sdk/channels/voice-credentials.d.ts +26 -0
- package/dist/plugin-sdk/channels/web/index.d.ts +1 -0
- package/dist/plugin-sdk/cli/cli-name.d.ts +3 -0
- package/dist/plugin-sdk/cli/command-format.d.ts +1 -0
- package/dist/plugin-sdk/cli/deps.d.ts +18 -0
- package/dist/plugin-sdk/cli/outbound-send-deps.d.ts +4 -0
- package/dist/plugin-sdk/cli/outbound-send-mapping.d.ts +10 -0
- package/dist/plugin-sdk/cli/parse-bytes.d.ts +4 -0
- package/dist/plugin-sdk/cli/parse-duration.d.ts +4 -0
- package/dist/plugin-sdk/cli/profile-utils.d.ts +2 -0
- package/dist/plugin-sdk/cli/progress.d.ts +24 -0
- package/dist/plugin-sdk/cli/wait.d.ts +1 -0
- package/dist/plugin-sdk/commands/agent/delivery.d.ts +25 -0
- package/dist/plugin-sdk/commands/agent/run-context.d.ts +2 -0
- package/dist/plugin-sdk/commands/agent/session-store.d.ts +16 -0
- package/dist/plugin-sdk/commands/agent/session.d.ts +32 -0
- package/dist/plugin-sdk/commands/agent/types.d.ts +89 -0
- package/dist/plugin-sdk/commands/agent.d.ts +14 -0
- package/dist/plugin-sdk/commands/daemon-runtime.d.ts +8 -0
- package/dist/plugin-sdk/commands/health.d.ts +63 -0
- package/dist/plugin-sdk/commands/oauth-flow.d.ts +21 -0
- package/dist/plugin-sdk/commands/onboard-helpers.d.ts +76 -0
- package/dist/plugin-sdk/commands/onboard-types.d.ts +65 -0
- package/dist/plugin-sdk/commands/signal-install.d.ts +30 -0
- package/dist/plugin-sdk/config/agent-dirs.d.ts +14 -0
- package/dist/plugin-sdk/config/agent-limits.d.ts +6 -0
- package/dist/plugin-sdk/config/backup-rotation.d.ts +5 -0
- package/dist/plugin-sdk/config/cache-utils.d.ts +6 -0
- package/dist/plugin-sdk/config/commands.d.ts +20 -0
- package/dist/plugin-sdk/config/config-paths.d.ts +10 -0
- package/dist/plugin-sdk/config/config.d.ts +7 -0
- package/dist/plugin-sdk/config/dangerous-name-matching.d.ts +12 -0
- package/dist/plugin-sdk/config/defaults.d.ts +18 -0
- package/dist/plugin-sdk/config/discord-preview-streaming.d.ts +25 -0
- package/dist/plugin-sdk/config/env-preserve.d.ts +10 -0
- package/dist/plugin-sdk/config/env-substitution.d.ts +36 -0
- package/dist/plugin-sdk/config/env-vars.d.ts +6 -0
- package/dist/plugin-sdk/config/group-policy.d.ts +49 -0
- package/dist/plugin-sdk/config/includes.d.ts +32 -0
- package/dist/plugin-sdk/config/io.d.ts +60 -0
- package/dist/plugin-sdk/config/legacy-migrate.d.ts +5 -0
- package/dist/plugin-sdk/config/legacy.d.ts +6 -0
- package/dist/plugin-sdk/config/legacy.migrations.d.ts +2 -0
- package/dist/plugin-sdk/config/legacy.rules.d.ts +2 -0
- package/dist/plugin-sdk/config/legacy.shared.d.ts +10 -0
- package/dist/plugin-sdk/config/markdown-tables.d.ts +7 -0
- package/dist/plugin-sdk/config/merge-config.d.ts +7 -0
- package/dist/plugin-sdk/config/merge-patch.d.ts +5 -0
- package/dist/plugin-sdk/config/normalize-paths.d.ts +8 -0
- package/dist/plugin-sdk/config/paths.d.ts +57 -0
- package/dist/plugin-sdk/config/prototype-keys.d.ts +1 -0
- package/dist/plugin-sdk/config/runtime-group-policy.d.ts +56 -0
- package/dist/plugin-sdk/config/runtime-overrides.d.ts +15 -0
- package/dist/plugin-sdk/config/sessions/artifacts.d.ts +5 -0
- package/dist/plugin-sdk/config/sessions/constants.d.ts +2 -0
- package/dist/plugin-sdk/config/sessions/delivery-info.d.ts +16 -0
- package/dist/plugin-sdk/config/sessions/disk-budget.d.ts +28 -0
- package/dist/plugin-sdk/config/sessions/group.d.ts +11 -0
- package/dist/plugin-sdk/config/sessions/main-session.d.ts +43 -0
- package/dist/plugin-sdk/config/sessions/metadata.d.ts +16 -0
- package/dist/plugin-sdk/config/sessions/paths.d.ts +21 -0
- package/dist/plugin-sdk/config/sessions/reset.d.ts +43 -0
- package/dist/plugin-sdk/config/sessions/session-file.d.ts +15 -0
- package/dist/plugin-sdk/config/sessions/session-key.d.ts +8 -0
- package/dist/plugin-sdk/config/sessions/store.d.ts +123 -0
- package/dist/plugin-sdk/config/sessions/transcript.d.ts +18 -0
- package/dist/plugin-sdk/config/sessions/types.d.ts +136 -0
- package/dist/plugin-sdk/config/sessions.d.ts +13 -0
- package/dist/plugin-sdk/config/talk.d.ts +21 -0
- package/dist/plugin-sdk/config/telegram-custom-commands.d.ts +24 -0
- package/dist/plugin-sdk/config/types.agent-defaults.d.ts +168 -0
- package/dist/plugin-sdk/config/types.agents-shared.d.ts +43 -0
- package/dist/plugin-sdk/config/types.agents.d.ts +66 -0
- package/dist/plugin-sdk/config/types.approvals.d.ts +26 -0
- package/dist/plugin-sdk/config/types.auth.d.ts +28 -0
- package/dist/plugin-sdk/config/types.base.d.ts +202 -0
- package/dist/plugin-sdk/config/types.browser.d.ts +65 -0
- package/dist/plugin-sdk/config/types.channel-messaging-common.d.ts +44 -0
- package/dist/plugin-sdk/config/types.channels.d.ts +53 -0
- package/dist/plugin-sdk/config/types.cron.d.ts +26 -0
- package/dist/plugin-sdk/config/types.d.ts +27 -0
- package/dist/plugin-sdk/config/types.discord.d.ts +271 -0
- package/dist/plugin-sdk/config/types.gateway.d.ts +335 -0
- package/dist/plugin-sdk/config/types.googlechat.d.ts +107 -0
- package/dist/plugin-sdk/config/types.hooks.d.ts +123 -0
- package/dist/plugin-sdk/config/types.imessage.d.ts +77 -0
- package/dist/plugin-sdk/config/types.installs.d.ts +14 -0
- package/dist/plugin-sdk/config/types.irc.d.ts +53 -0
- package/dist/plugin-sdk/config/types.messages.d.ts +149 -0
- package/dist/plugin-sdk/config/types.models.d.ts +41 -0
- package/dist/plugin-sdk/config/types.msteams.d.ts +108 -0
- package/dist/plugin-sdk/config/types.node-host.d.ts +10 -0
- package/dist/plugin-sdk/config/types.plugins.d.ts +23 -0
- package/dist/plugin-sdk/config/types.queue.d.ts +14 -0
- package/dist/plugin-sdk/config/types.remoteclaw.d.ts +119 -0
- package/dist/plugin-sdk/config/types.signal.d.ts +46 -0
- package/dist/plugin-sdk/config/types.slack.d.ts +179 -0
- package/dist/plugin-sdk/config/types.telegram.d.ts +187 -0
- package/dist/plugin-sdk/config/types.tools.d.ts +249 -0
- package/dist/plugin-sdk/config/types.tts.d.ts +79 -0
- package/dist/plugin-sdk/config/types.whatsapp.d.ts +101 -0
- package/dist/plugin-sdk/config/validation.d.ts +37 -0
- package/dist/plugin-sdk/config/version.d.ts +8 -0
- package/dist/plugin-sdk/config/zod-schema.agent-defaults.d.ts +93 -0
- package/dist/plugin-sdk/config/zod-schema.agent-runtime.d.ts +302 -0
- package/dist/plugin-sdk/config/zod-schema.agents.d.ts +224 -0
- package/dist/plugin-sdk/config/zod-schema.allowdeny.d.ts +13 -0
- package/dist/plugin-sdk/config/zod-schema.approvals.d.ts +15 -0
- package/dist/plugin-sdk/config/zod-schema.channels.d.ts +6 -0
- package/dist/plugin-sdk/config/zod-schema.core.d.ts +355 -0
- package/dist/plugin-sdk/config/zod-schema.d.ts +3155 -0
- package/dist/plugin-sdk/config/zod-schema.hooks.d.ts +85 -0
- package/dist/plugin-sdk/config/zod-schema.installs.d.ts +16 -0
- package/dist/plugin-sdk/config/zod-schema.providers-core.d.ts +3656 -0
- package/dist/plugin-sdk/config/zod-schema.providers-whatsapp.d.ts +235 -0
- package/dist/plugin-sdk/config/zod-schema.providers.d.ts +2182 -0
- package/dist/plugin-sdk/config/zod-schema.sensitive.d.ts +2 -0
- package/dist/plugin-sdk/config/zod-schema.session.d.ts +228 -0
- package/dist/plugin-sdk/cron/delivery.d.ts +9 -0
- package/dist/plugin-sdk/cron/parse.d.ts +1 -0
- package/dist/plugin-sdk/cron/schedule.d.ts +2 -0
- package/dist/plugin-sdk/cron/service/jobs.d.ts +21 -0
- package/dist/plugin-sdk/cron/service/locked.d.ts +2 -0
- package/dist/plugin-sdk/cron/service/normalize.d.ts +18 -0
- package/dist/plugin-sdk/cron/service/ops.d.ts +81 -0
- package/dist/plugin-sdk/cron/service/state.d.ts +125 -0
- package/dist/plugin-sdk/cron/service/store.d.ts +9 -0
- package/dist/plugin-sdk/cron/service/timer.d.ts +47 -0
- package/dist/plugin-sdk/cron/service.d.ts +66 -0
- package/dist/plugin-sdk/cron/session-reaper.d.ts +35 -0
- package/dist/plugin-sdk/cron/stagger.d.ts +8 -0
- package/dist/plugin-sdk/cron/store.d.ts +6 -0
- package/dist/plugin-sdk/cron/types.d.ts +131 -0
- package/dist/plugin-sdk/cron/webhook-url.d.ts +1 -0
- package/dist/plugin-sdk/daemon/constants.d.ts +35 -0
- package/dist/plugin-sdk/discord/accounts.d.ts +21 -0
- package/dist/plugin-sdk/discord/api.d.ts +11 -0
- package/dist/plugin-sdk/discord/audit.d.ts +29 -0
- package/dist/plugin-sdk/discord/chunk.d.ts +20 -0
- package/dist/plugin-sdk/discord/client.d.ts +21 -0
- package/dist/plugin-sdk/discord/components-registry.d.ts +16 -0
- package/dist/plugin-sdk/discord/components.d.ts +196 -0
- package/dist/plugin-sdk/discord/directory-live.d.ts +4 -0
- package/dist/plugin-sdk/discord/draft-chunking.d.ts +6 -0
- package/dist/plugin-sdk/discord/draft-stream.d.ts +21 -0
- package/dist/plugin-sdk/discord/gateway-logging.d.ts +8 -0
- package/dist/plugin-sdk/discord/guilds.d.ts +6 -0
- package/dist/plugin-sdk/discord/monitor/agent-components.d.ts +55 -0
- package/dist/plugin-sdk/discord/monitor/allow-list.d.ts +174 -0
- package/dist/plugin-sdk/discord/monitor/commands.d.ts +2 -0
- package/dist/plugin-sdk/discord/monitor/format.d.ts +13 -0
- package/dist/plugin-sdk/discord/monitor/gateway-plugin.d.ts +8 -0
- package/dist/plugin-sdk/discord/monitor/gateway-registry.d.ts +9 -0
- package/dist/plugin-sdk/discord/monitor/listeners.d.ts +44 -0
- package/dist/plugin-sdk/discord/monitor/message-handler.d.ts +5 -0
- package/dist/plugin-sdk/discord/monitor/message-handler.preflight.d.ts +14 -0
- package/dist/plugin-sdk/discord/monitor/message-handler.preflight.types.d.ts +95 -0
- package/dist/plugin-sdk/discord/monitor/message-handler.process.d.ts +2 -0
- package/dist/plugin-sdk/discord/monitor/message-utils.d.ts +40 -0
- package/dist/plugin-sdk/discord/monitor/native-command.d.ts +23 -0
- package/dist/plugin-sdk/discord/monitor/presence-cache.d.ts +9 -0
- package/dist/plugin-sdk/discord/monitor/presence.d.ts +5 -0
- package/dist/plugin-sdk/discord/monitor/provider.allowlist.d.ts +14 -0
- package/dist/plugin-sdk/discord/monitor/provider.d.ts +28 -0
- package/dist/plugin-sdk/discord/monitor/provider.lifecycle.d.ts +23 -0
- package/dist/plugin-sdk/discord/monitor/reply-context.d.ts +17 -0
- package/dist/plugin-sdk/discord/monitor/reply-delivery.d.ts +22 -0
- package/dist/plugin-sdk/discord/monitor/rest-fetch.d.ts +2 -0
- package/dist/plugin-sdk/discord/monitor/sender-identity.d.ts +31 -0
- package/dist/plugin-sdk/discord/monitor/system-events.d.ts +2 -0
- package/dist/plugin-sdk/discord/monitor/thread-bindings.d.ts +5 -0
- package/dist/plugin-sdk/discord/monitor/thread-bindings.discord-api.d.ts +36 -0
- package/dist/plugin-sdk/discord/monitor/thread-bindings.lifecycle.d.ts +30 -0
- package/dist/plugin-sdk/discord/monitor/thread-bindings.manager.d.ts +17 -0
- package/dist/plugin-sdk/discord/monitor/thread-bindings.messages.d.ts +17 -0
- package/dist/plugin-sdk/discord/monitor/thread-bindings.state.d.ts +61 -0
- package/dist/plugin-sdk/discord/monitor/thread-bindings.types.d.ts +64 -0
- package/dist/plugin-sdk/discord/monitor/threading.d.ts +106 -0
- package/dist/plugin-sdk/discord/monitor/typing.d.ts +5 -0
- package/dist/plugin-sdk/discord/monitor.d.ts +10 -0
- package/dist/plugin-sdk/discord/monitor.gateway.d.ts +12 -0
- package/dist/plugin-sdk/discord/pluralkit.d.ts +26 -0
- package/dist/plugin-sdk/discord/probe.d.ts +28 -0
- package/dist/plugin-sdk/discord/resolve-channels.d.ts +15 -0
- package/dist/plugin-sdk/discord/resolve-users.d.ts +14 -0
- package/dist/plugin-sdk/discord/send.channels.d.ts +17 -0
- package/dist/plugin-sdk/discord/send.components.d.ts +17 -0
- package/dist/plugin-sdk/discord/send.d.ts +10 -0
- package/dist/plugin-sdk/discord/send.emojis-stickers.d.ts +4 -0
- package/dist/plugin-sdk/discord/send.guild.d.ts +24 -0
- package/dist/plugin-sdk/discord/send.messages.d.ts +20 -0
- package/dist/plugin-sdk/discord/send.outbound.d.ts +57 -0
- package/dist/plugin-sdk/discord/send.permissions.d.ts +20 -0
- package/dist/plugin-sdk/discord/send.reactions.d.ts +15 -0
- package/dist/plugin-sdk/discord/send.shared.d.ts +85 -0
- package/dist/plugin-sdk/discord/send.types.d.ts +144 -0
- package/dist/plugin-sdk/discord/targets.d.ts +18 -0
- package/dist/plugin-sdk/discord/token.d.ts +11 -0
- package/dist/plugin-sdk/discord/voice/command.d.ts +15 -0
- package/dist/plugin-sdk/discord/voice/manager.d.ts +52 -0
- package/dist/plugin-sdk/discord/voice-message.d.ts +50 -0
- package/dist/plugin-sdk/gateway/call.d.ts +65 -0
- package/dist/plugin-sdk/gateway/chat-abort.d.ts +44 -0
- package/dist/plugin-sdk/gateway/chat-sanitize.d.ts +4 -0
- package/dist/plugin-sdk/gateway/client.d.ts +64 -0
- package/dist/plugin-sdk/gateway/control-ui-shared.d.ts +9 -0
- package/dist/plugin-sdk/gateway/credentials.d.ts +36 -0
- package/dist/plugin-sdk/gateway/device-auth.d.ts +11 -0
- package/dist/plugin-sdk/gateway/method-scopes.d.ts +22 -0
- package/dist/plugin-sdk/gateway/net.d.ts +77 -0
- package/dist/plugin-sdk/gateway/node-registry.d.ts +60 -0
- package/dist/plugin-sdk/gateway/protocol/client-info.d.ts +58 -0
- package/dist/plugin-sdk/gateway/protocol/index.d.ts +490 -0
- package/dist/plugin-sdk/gateway/protocol/schema/agent.d.ts +89 -0
- package/dist/plugin-sdk/gateway/protocol/schema/agents-models.d.ts +188 -0
- package/dist/plugin-sdk/gateway/protocol/schema/channels.d.ts +134 -0
- package/dist/plugin-sdk/gateway/protocol/schema/config.d.ts +53 -0
- package/dist/plugin-sdk/gateway/protocol/schema/cron.d.ts +324 -0
- package/dist/plugin-sdk/gateway/protocol/schema/devices.d.ts +41 -0
- package/dist/plugin-sdk/gateway/protocol/schema/error-codes.d.ts +14 -0
- package/dist/plugin-sdk/gateway/protocol/schema/frames.d.ts +168 -0
- package/dist/plugin-sdk/gateway/protocol/schema/logs-chat.d.ts +45 -0
- package/dist/plugin-sdk/gateway/protocol/schema/nodes.d.ts +64 -0
- package/dist/plugin-sdk/gateway/protocol/schema/primitives.d.ts +4 -0
- package/dist/plugin-sdk/gateway/protocol/schema/protocol-schemas.d.ts +3 -0
- package/dist/plugin-sdk/gateway/protocol/schema/push.d.ts +15 -0
- package/dist/plugin-sdk/gateway/protocol/schema/sessions.d.ts +74 -0
- package/dist/plugin-sdk/gateway/protocol/schema/snapshot.d.ts +69 -0
- package/dist/plugin-sdk/gateway/protocol/schema/types.d.ts +120 -0
- package/dist/plugin-sdk/gateway/protocol/schema/wizard.d.ts +86 -0
- package/dist/plugin-sdk/gateway/protocol/schema.d.ts +16 -0
- package/dist/plugin-sdk/gateway/server/ws-types.d.ts +11 -0
- package/dist/plugin-sdk/gateway/server-broadcast.d.ts +17 -0
- package/dist/plugin-sdk/gateway/server-channels.d.ts +26 -0
- package/dist/plugin-sdk/gateway/server-constants.d.ts +10 -0
- package/dist/plugin-sdk/gateway/server-methods/types.d.ts +84 -0
- package/dist/plugin-sdk/gateway/server-shared.d.ts +7 -0
- package/dist/plugin-sdk/gateway/session-utils.fs.d.ts +48 -0
- package/dist/plugin-sdk/gateway/session-utils.types.d.ts +81 -0
- package/dist/plugin-sdk/gateway/ws-log.d.ts +5 -0
- package/dist/plugin-sdk/gateway/ws-logging.d.ts +4 -0
- package/dist/plugin-sdk/globals.d.ts +11 -0
- package/dist/plugin-sdk/hooks/internal-hooks.d.ts +140 -0
- package/dist/plugin-sdk/hooks/types.d.ts +62 -0
- package/dist/plugin-sdk/imessage/accounts.d.ts +16 -0
- package/dist/plugin-sdk/imessage/client.d.ts +46 -0
- package/dist/plugin-sdk/imessage/constants.d.ts +2 -0
- package/dist/plugin-sdk/imessage/monitor/abort-handler.d.ts +9 -0
- package/dist/plugin-sdk/imessage/monitor/deliver.d.ts +14 -0
- package/dist/plugin-sdk/imessage/monitor/echo-cache.d.ts +9 -0
- package/dist/plugin-sdk/imessage/monitor/inbound-processing.d.ts +96 -0
- package/dist/plugin-sdk/imessage/monitor/monitor-provider.d.ts +7 -0
- package/dist/plugin-sdk/imessage/monitor/parse-notification.d.ts +2 -0
- package/dist/plugin-sdk/imessage/monitor/runtime.d.ts +4 -0
- package/dist/plugin-sdk/imessage/monitor/types.d.ts +37 -0
- package/dist/plugin-sdk/imessage/monitor.d.ts +2 -0
- package/dist/plugin-sdk/imessage/probe.d.ts +17 -0
- package/dist/plugin-sdk/imessage/send.d.ts +34 -0
- package/dist/plugin-sdk/imessage/target-parsing-helpers.d.ts +45 -0
- package/dist/plugin-sdk/imessage/targets.d.ts +39 -0
- package/dist/plugin-sdk/index.d.ts +1 -0
- package/dist/plugin-sdk/index.js +24140 -0
- package/dist/plugin-sdk/infra/agent-events.d.ts +21 -0
- package/dist/plugin-sdk/infra/archive-path.d.ts +12 -0
- package/dist/plugin-sdk/infra/archive.d.ts +46 -0
- package/dist/plugin-sdk/infra/backoff.d.ts +8 -0
- package/dist/plugin-sdk/infra/brew.d.ts +8 -0
- package/dist/plugin-sdk/infra/channel-activity.d.ts +18 -0
- package/dist/plugin-sdk/infra/channel-summary.d.ts +6 -0
- package/dist/plugin-sdk/infra/dedupe.d.ts +12 -0
- package/dist/plugin-sdk/infra/device-auth-store.d.ts +18 -0
- package/dist/plugin-sdk/infra/device-identity.d.ts +11 -0
- package/dist/plugin-sdk/infra/device-pairing.d.ts +101 -0
- package/dist/plugin-sdk/infra/diagnostic-events.d.ts +140 -0
- package/dist/plugin-sdk/infra/diagnostic-flags.d.ts +4 -0
- package/dist/plugin-sdk/infra/dotenv.d.ts +3 -0
- package/dist/plugin-sdk/infra/env.d.ts +11 -0
- package/dist/plugin-sdk/infra/errors.d.ts +11 -0
- package/dist/plugin-sdk/infra/fetch.d.ts +2 -0
- package/dist/plugin-sdk/infra/file-identity.d.ts +5 -0
- package/dist/plugin-sdk/infra/file-lock.d.ts +2 -0
- package/dist/plugin-sdk/infra/format-time/format-datetime.d.ts +35 -0
- package/dist/plugin-sdk/infra/format-time/format-duration.d.ts +23 -0
- package/dist/plugin-sdk/infra/format-time/format-relative.d.ts +39 -0
- package/dist/plugin-sdk/infra/fs-safe.d.ts +25 -0
- package/dist/plugin-sdk/infra/gemini-auth.d.ts +16 -0
- package/dist/plugin-sdk/infra/git-commit.d.ts +4 -0
- package/dist/plugin-sdk/infra/git-root.d.ts +7 -0
- package/dist/plugin-sdk/infra/heartbeat-active-hours.d.ts +5 -0
- package/dist/plugin-sdk/infra/heartbeat-events-filter.d.ts +8 -0
- package/dist/plugin-sdk/infra/heartbeat-events.d.ts +21 -0
- package/dist/plugin-sdk/infra/heartbeat-reason.d.ts +5 -0
- package/dist/plugin-sdk/infra/heartbeat-runner.d.ts +45 -0
- package/dist/plugin-sdk/infra/heartbeat-visibility.d.ts +17 -0
- package/dist/plugin-sdk/infra/heartbeat-wake.d.ts +31 -0
- package/dist/plugin-sdk/infra/home-dir.d.ts +7 -0
- package/dist/plugin-sdk/infra/host-env-security.d.ts +21 -0
- package/dist/plugin-sdk/infra/http-body.d.ts +46 -0
- package/dist/plugin-sdk/infra/json-file.d.ts +2 -0
- package/dist/plugin-sdk/infra/json-files.d.ts +5 -0
- package/dist/plugin-sdk/infra/map-size.d.ts +1 -0
- package/dist/plugin-sdk/infra/net/fetch-guard.d.ts +21 -0
- package/dist/plugin-sdk/infra/net/hostname.d.ts +1 -0
- package/dist/plugin-sdk/infra/net/ssrf.d.ts +35 -0
- package/dist/plugin-sdk/infra/outbound/abort.d.ts +8 -0
- package/dist/plugin-sdk/infra/outbound/agent-delivery.d.ts +46 -0
- package/dist/plugin-sdk/infra/outbound/bound-delivery-router.d.ts +16 -0
- package/dist/plugin-sdk/infra/outbound/channel-selection.d.ts +11 -0
- package/dist/plugin-sdk/infra/outbound/channel-target.d.ts +6 -0
- package/dist/plugin-sdk/infra/outbound/deliver.d.ts +81 -0
- package/dist/plugin-sdk/infra/outbound/delivery-queue.d.ts +78 -0
- package/dist/plugin-sdk/infra/outbound/directory-cache.d.ts +24 -0
- package/dist/plugin-sdk/infra/outbound/envelope.d.ts +16 -0
- package/dist/plugin-sdk/infra/outbound/format.d.ts +39 -0
- package/dist/plugin-sdk/infra/outbound/identity.d.ts +8 -0
- package/dist/plugin-sdk/infra/outbound/message-action-spec.d.ts +5 -0
- package/dist/plugin-sdk/infra/outbound/payloads.d.ts +18 -0
- package/dist/plugin-sdk/infra/outbound/session-binding-service.d.ts +57 -0
- package/dist/plugin-sdk/infra/outbound/target-errors.d.ts +6 -0
- package/dist/plugin-sdk/infra/outbound/target-normalization.d.ts +4 -0
- package/dist/plugin-sdk/infra/outbound/target-resolver.d.ts +53 -0
- package/dist/plugin-sdk/infra/outbound/targets.d.ts +87 -0
- package/dist/plugin-sdk/infra/pairing-files.d.ts +23 -0
- package/dist/plugin-sdk/infra/pairing-pending.d.ts +13 -0
- package/dist/plugin-sdk/infra/pairing-token.d.ts +3 -0
- package/dist/plugin-sdk/infra/path-guards.d.ts +5 -0
- package/dist/plugin-sdk/infra/path-safety.d.ts +2 -0
- package/dist/plugin-sdk/infra/plain-object.d.ts +4 -0
- package/dist/plugin-sdk/infra/prototype-keys.d.ts +1 -0
- package/dist/plugin-sdk/infra/provider-usage.auth.d.ts +10 -0
- package/dist/plugin-sdk/infra/provider-usage.d.ts +4 -0
- package/dist/plugin-sdk/infra/provider-usage.fetch.claude.d.ts +2 -0
- package/dist/plugin-sdk/infra/provider-usage.fetch.codex.d.ts +2 -0
- package/dist/plugin-sdk/infra/provider-usage.fetch.copilot.d.ts +2 -0
- package/dist/plugin-sdk/infra/provider-usage.fetch.d.ts +6 -0
- package/dist/plugin-sdk/infra/provider-usage.fetch.gemini.d.ts +2 -0
- package/dist/plugin-sdk/infra/provider-usage.fetch.minimax.d.ts +2 -0
- package/dist/plugin-sdk/infra/provider-usage.fetch.shared.d.ts +12 -0
- package/dist/plugin-sdk/infra/provider-usage.fetch.zai.d.ts +2 -0
- package/dist/plugin-sdk/infra/provider-usage.format.d.ts +13 -0
- package/dist/plugin-sdk/infra/provider-usage.load.d.ts +11 -0
- package/dist/plugin-sdk/infra/provider-usage.shared.d.ts +8 -0
- package/dist/plugin-sdk/infra/provider-usage.types.d.ts +17 -0
- package/dist/plugin-sdk/infra/restart.d.ts +70 -0
- package/dist/plugin-sdk/infra/retry-policy.d.ts +25 -0
- package/dist/plugin-sdk/infra/retry.d.ts +21 -0
- package/dist/plugin-sdk/infra/safe-executable-value.d.ts +1 -0
- package/dist/plugin-sdk/infra/scp-host.d.ts +2 -0
- package/dist/plugin-sdk/infra/secure-random.d.ts +2 -0
- package/dist/plugin-sdk/infra/session-cost-usage.d.ts +45 -0
- package/dist/plugin-sdk/infra/session-cost-usage.types.d.ts +153 -0
- package/dist/plugin-sdk/infra/session-maintenance-warning.d.ts +10 -0
- package/dist/plugin-sdk/infra/shell-env.d.ts +34 -0
- package/dist/plugin-sdk/infra/system-events.d.ts +18 -0
- package/dist/plugin-sdk/infra/tailnet.d.ts +8 -0
- package/dist/plugin-sdk/infra/tls/fingerprint.d.ts +1 -0
- package/dist/plugin-sdk/infra/tls/gateway.d.ts +16 -0
- package/dist/plugin-sdk/infra/tmp-remoteclaw-dir.d.ts +18 -0
- package/dist/plugin-sdk/infra/transport-ready.d.ts +16 -0
- package/dist/plugin-sdk/infra/unhandled-rejections.d.ts +15 -0
- package/dist/plugin-sdk/infra/ws.d.ts +2 -0
- package/dist/plugin-sdk/infra/wsl.d.ts +11 -0
- package/dist/plugin-sdk/line/accounts.d.ts +10 -0
- package/dist/plugin-sdk/line/actions.d.ts +22 -0
- package/dist/plugin-sdk/line/auto-reply-delivery.d.ts +38 -0
- package/dist/plugin-sdk/line/bot-access.d.ts +17 -0
- package/dist/plugin-sdk/line/bot-handlers.d.ts +13 -0
- package/dist/plugin-sdk/line/bot-message-context.d.ts +118 -0
- package/dist/plugin-sdk/line/bot.d.ts +24 -0
- package/dist/plugin-sdk/line/channel-access-token.d.ts +4 -0
- package/dist/plugin-sdk/line/config-schema.d.ts +62 -0
- package/dist/plugin-sdk/line/download.d.ts +7 -0
- package/dist/plugin-sdk/line/flex-templates/basic-cards.d.ts +46 -0
- package/dist/plugin-sdk/line/flex-templates/common.d.ts +2 -0
- package/dist/plugin-sdk/line/flex-templates/media-control-cards.d.ts +73 -0
- package/dist/plugin-sdk/line/flex-templates/message.d.ts +6 -0
- package/dist/plugin-sdk/line/flex-templates/schedule-cards.d.ts +55 -0
- package/dist/plugin-sdk/line/flex-templates/types.d.ts +19 -0
- package/dist/plugin-sdk/line/flex-templates.d.ts +5 -0
- package/dist/plugin-sdk/line/markdown-to-line.d.ts +72 -0
- package/dist/plugin-sdk/line/monitor.d.ts +28 -0
- package/dist/plugin-sdk/line/probe.d.ts +2 -0
- package/dist/plugin-sdk/line/reply-chunks.d.ts +24 -0
- package/dist/plugin-sdk/line/send.d.ts +91 -0
- package/dist/plugin-sdk/line/signature.d.ts +1 -0
- package/dist/plugin-sdk/line/template-messages.d.ts +100 -0
- package/dist/plugin-sdk/line/types.d.ts +112 -0
- package/dist/plugin-sdk/line/webhook-node.d.ts +15 -0
- package/dist/plugin-sdk/line/webhook-utils.d.ts +3 -0
- package/dist/plugin-sdk/line/webhook.d.ts +19 -0
- package/dist/plugin-sdk/logger.d.ts +6 -0
- package/dist/plugin-sdk/logging/config.d.ts +4 -0
- package/dist/plugin-sdk/logging/console.d.ts +23 -0
- package/dist/plugin-sdk/logging/diagnostic-session-state.d.ts +30 -0
- package/dist/plugin-sdk/logging/diagnostic.d.ts +65 -0
- package/dist/plugin-sdk/logging/env-log-level.d.ts +2 -0
- package/dist/plugin-sdk/logging/levels.d.ts +5 -0
- package/dist/plugin-sdk/logging/logger.d.ts +44 -0
- package/dist/plugin-sdk/logging/node-require.d.ts +1 -0
- package/dist/plugin-sdk/logging/redact-identifier.d.ts +4 -0
- package/dist/plugin-sdk/logging/redact.d.ts +9 -0
- package/dist/plugin-sdk/logging/state.d.ts +19 -0
- package/dist/plugin-sdk/logging/subsystem.d.ts +18 -0
- package/dist/plugin-sdk/logging/timestamps.d.ts +1 -0
- package/dist/plugin-sdk/logging.d.ts +10 -0
- package/dist/plugin-sdk/markdown/fences.d.ts +10 -0
- package/dist/plugin-sdk/markdown/ir.d.ts +32 -0
- package/dist/plugin-sdk/markdown/render.d.ts +18 -0
- package/dist/plugin-sdk/markdown/tables.d.ts +2 -0
- package/dist/plugin-sdk/markdown/whatsapp.d.ts +14 -0
- package/dist/plugin-sdk/media/audio-tags.d.ts +10 -0
- package/dist/plugin-sdk/media/audio.d.ts +19 -0
- package/dist/plugin-sdk/media/base64.d.ts +6 -0
- package/dist/plugin-sdk/media/constants.d.ts +7 -0
- package/dist/plugin-sdk/media/fetch.d.ts +23 -0
- package/dist/plugin-sdk/media/image-ops.d.ts +41 -0
- package/dist/plugin-sdk/media/inbound-path-policy.d.ts +18 -0
- package/dist/plugin-sdk/media/local-roots.d.ts +3 -0
- package/dist/plugin-sdk/media/mime.d.ts +16 -0
- package/dist/plugin-sdk/media/outbound-attachment.d.ts +6 -0
- package/dist/plugin-sdk/media/parse.d.ts +8 -0
- package/dist/plugin-sdk/media/png-encode.d.ts +8 -0
- package/dist/plugin-sdk/media/read-response-with-limit.d.ts +7 -0
- package/dist/plugin-sdk/media/store.d.ts +33 -0
- package/dist/plugin-sdk/middleware/auth-key-retry.d.ts +31 -0
- package/dist/plugin-sdk/middleware/channel-bridge.d.ts +43 -0
- package/dist/plugin-sdk/middleware/cli-runtime-base.d.ts +47 -0
- package/dist/plugin-sdk/middleware/delivery-adapter.d.ts +36 -0
- package/dist/plugin-sdk/middleware/error-classifier.d.ts +19 -0
- package/dist/plugin-sdk/middleware/mcp-side-effects.d.ts +20 -0
- package/dist/plugin-sdk/middleware/media-capability.d.ts +21 -0
- package/dist/plugin-sdk/middleware/media-resolver.d.ts +12 -0
- package/dist/plugin-sdk/middleware/runtime-factory.d.ts +6 -0
- package/dist/plugin-sdk/middleware/runtimes/claude.d.ts +37 -0
- package/dist/plugin-sdk/middleware/runtimes/codex.d.ts +79 -0
- package/dist/plugin-sdk/middleware/runtimes/gemini.d.ts +63 -0
- package/dist/plugin-sdk/middleware/runtimes/opencode.d.ts +59 -0
- package/dist/plugin-sdk/middleware/session-map.d.ts +36 -0
- package/dist/plugin-sdk/middleware/system-prompt.d.ts +30 -0
- package/dist/plugin-sdk/middleware/types.d.ts +236 -0
- package/dist/plugin-sdk/pairing/pairing-labels.d.ts +2 -0
- package/dist/plugin-sdk/pairing/pairing-messages.d.ts +6 -0
- package/dist/plugin-sdk/pairing/pairing-store.d.ts +48 -0
- package/dist/plugin-sdk/plugin-sdk/account-id.d.ts +1 -0
- package/dist/plugin-sdk/plugin-sdk/agent-media-payload.d.ts +12 -0
- package/dist/plugin-sdk/plugin-sdk/allow-from.d.ts +32 -0
- package/dist/plugin-sdk/plugin-sdk/command-auth.d.ts +25 -0
- package/dist/plugin-sdk/plugin-sdk/config-paths.d.ts +6 -0
- package/dist/plugin-sdk/plugin-sdk/file-lock.d.ts +16 -0
- package/dist/plugin-sdk/plugin-sdk/group-access.d.ts +16 -0
- package/dist/plugin-sdk/plugin-sdk/index.d.ts +166 -0
- package/dist/plugin-sdk/plugin-sdk/json-store.d.ts +5 -0
- package/dist/plugin-sdk/plugin-sdk/onboarding.d.ts +11 -0
- package/dist/plugin-sdk/plugin-sdk/persistent-dedupe.d.ts +20 -0
- package/dist/plugin-sdk/plugin-sdk/reply-payload.d.ts +22 -0
- package/dist/plugin-sdk/plugin-sdk/run-command.d.ts +12 -0
- package/dist/plugin-sdk/plugin-sdk/runtime.d.ts +10 -0
- package/dist/plugin-sdk/plugin-sdk/slack-message-actions.d.ts +11 -0
- package/dist/plugin-sdk/plugin-sdk/status-helpers.d.ts +88 -0
- package/dist/plugin-sdk/plugin-sdk/temp-path.d.ts +12 -0
- package/dist/plugin-sdk/plugin-sdk/text-chunking.d.ts +1 -0
- package/dist/plugin-sdk/plugin-sdk/tool-send.d.ts +4 -0
- package/dist/plugin-sdk/plugin-sdk/webhook-path.d.ts +6 -0
- package/dist/plugin-sdk/plugin-sdk/webhook-targets.d.ts +23 -0
- package/dist/plugin-sdk/plugins/bundled-dir.d.ts +1 -0
- package/dist/plugin-sdk/plugins/commands.d.ts +83 -0
- package/dist/plugin-sdk/plugins/config-schema.d.ts +2 -0
- package/dist/plugin-sdk/plugins/config-state.d.ts +30 -0
- package/dist/plugin-sdk/plugins/discovery.d.ts +24 -0
- package/dist/plugin-sdk/plugins/hook-runner-global.d.ts +37 -0
- package/dist/plugin-sdk/plugins/hooks.d.ts +49 -0
- package/dist/plugin-sdk/plugins/http-path.d.ts +1 -0
- package/dist/plugin-sdk/plugins/http-registry.d.ts +13 -0
- package/dist/plugin-sdk/plugins/manifest-registry.d.ts +35 -0
- package/dist/plugin-sdk/plugins/manifest.d.ts +65 -0
- package/dist/plugin-sdk/plugins/path-safety.d.ts +5 -0
- package/dist/plugin-sdk/plugins/registry.d.ts +148 -0
- package/dist/plugin-sdk/plugins/runtime/native-deps.d.ts +8 -0
- package/dist/plugin-sdk/plugins/runtime/types.d.ts +310 -0
- package/dist/plugin-sdk/plugins/runtime.d.ts +5 -0
- package/dist/plugin-sdk/plugins/schema-validator.d.ts +10 -0
- package/dist/plugin-sdk/plugins/types.d.ts +491 -0
- package/dist/plugin-sdk/polls.d.ts +31 -0
- package/dist/plugin-sdk/process/command-queue.d.ts +51 -0
- package/dist/plugin-sdk/process/exec.d.ts +30 -0
- package/dist/plugin-sdk/process/lanes.d.ts +6 -0
- package/dist/plugin-sdk/process/spawn-utils.d.ts +26 -0
- package/dist/plugin-sdk/routing/account-id.d.ts +3 -0
- package/dist/plugin-sdk/routing/account-lookup.d.ts +1 -0
- package/dist/plugin-sdk/routing/bindings.d.ts +11 -0
- package/dist/plugin-sdk/routing/resolve-route.d.ts +42 -0
- package/dist/plugin-sdk/routing/session-key.d.ts +48 -0
- package/dist/plugin-sdk/runtime.d.ts +7 -0
- package/dist/plugin-sdk/security/channel-metadata.d.ts +6 -0
- package/dist/plugin-sdk/security/dm-policy-shared.d.ts +33 -0
- package/dist/plugin-sdk/security/external-content.d.ts +53 -0
- package/dist/plugin-sdk/security/safe-regex.d.ts +2 -0
- package/dist/plugin-sdk/security/scan-paths.d.ts +5 -0
- package/dist/plugin-sdk/security/secret-equal.d.ts +1 -0
- package/dist/plugin-sdk/sessions/input-provenance.d.ts +16 -0
- package/dist/plugin-sdk/sessions/level-overrides.d.ts +10 -0
- package/dist/plugin-sdk/sessions/send-policy.d.ts +11 -0
- package/dist/plugin-sdk/sessions/session-key-utils.d.ts +16 -0
- package/dist/plugin-sdk/sessions/session-label.d.ts +9 -0
- package/dist/plugin-sdk/sessions/transcript-events.d.ts +7 -0
- package/dist/plugin-sdk/shared/avatar-policy.d.ts +16 -0
- package/dist/plugin-sdk/shared/chat-content.d.ts +5 -0
- package/dist/plugin-sdk/shared/chat-envelope.d.ts +2 -0
- package/dist/plugin-sdk/shared/device-auth.d.ts +13 -0
- package/dist/plugin-sdk/shared/gateway-bind-url.d.ts +14 -0
- package/dist/plugin-sdk/shared/net/ip.d.ts +19 -0
- package/dist/plugin-sdk/shared/operator-scope-compat.d.ts +5 -0
- package/dist/plugin-sdk/shared/pid-alive.d.ts +1 -0
- package/dist/plugin-sdk/shared/process-scoped-map.d.ts +1 -0
- package/dist/plugin-sdk/shared/string-normalization.d.ts +4 -0
- package/dist/plugin-sdk/shared/subagents-format.d.ts +15 -0
- package/dist/plugin-sdk/shared/tailscale-status.d.ts +8 -0
- package/dist/plugin-sdk/shared/text/code-regions.d.ts +6 -0
- package/dist/plugin-sdk/shared/text/reasoning-tags.d.ts +6 -0
- package/dist/plugin-sdk/shared/text-chunking.d.ts +1 -0
- package/dist/plugin-sdk/signal/accounts.d.ts +17 -0
- package/dist/plugin-sdk/signal/client.d.ts +32 -0
- package/dist/plugin-sdk/signal/daemon.d.ts +26 -0
- package/dist/plugin-sdk/signal/format.d.ts +17 -0
- package/dist/plugin-sdk/signal/identity.d.ts +24 -0
- package/dist/plugin-sdk/signal/index.d.ts +5 -0
- package/dist/plugin-sdk/signal/monitor/event-handler.d.ts +5 -0
- package/dist/plugin-sdk/signal/monitor/event-handler.types.d.ts +125 -0
- package/dist/plugin-sdk/signal/monitor/mentions.d.ts +2 -0
- package/dist/plugin-sdk/signal/monitor.d.ts +25 -0
- package/dist/plugin-sdk/signal/probe.d.ts +7 -0
- package/dist/plugin-sdk/signal/reaction-level.d.ts +17 -0
- package/dist/plugin-sdk/signal/rpc-context.d.ts +9 -0
- package/dist/plugin-sdk/signal/send-reactions.d.ts +32 -0
- package/dist/plugin-sdk/signal/send.d.ts +25 -0
- package/dist/plugin-sdk/signal/sse-reconnect.d.ts +13 -0
- package/dist/plugin-sdk/slack/accounts.d.ts +32 -0
- package/dist/plugin-sdk/slack/actions.d.ts +56 -0
- package/dist/plugin-sdk/slack/blocks-fallback.d.ts +2 -0
- package/dist/plugin-sdk/slack/blocks-input.d.ts +3 -0
- package/dist/plugin-sdk/slack/channel-migration.d.ts +20 -0
- package/dist/plugin-sdk/slack/client.d.ts +4 -0
- package/dist/plugin-sdk/slack/directory-live.d.ts +4 -0
- package/dist/plugin-sdk/slack/draft-stream.d.ts +25 -0
- package/dist/plugin-sdk/slack/format.d.ts +7 -0
- package/dist/plugin-sdk/slack/http/index.d.ts +1 -0
- package/dist/plugin-sdk/slack/http/registry.d.ts +12 -0
- package/dist/plugin-sdk/slack/index.d.ts +6 -0
- package/dist/plugin-sdk/slack/manifest.d.ts +17 -0
- package/dist/plugin-sdk/slack/message-actions.d.ts +4 -0
- package/dist/plugin-sdk/slack/modal-metadata.d.ts +7 -0
- package/dist/plugin-sdk/slack/monitor/allow-list.d.ts +23 -0
- package/dist/plugin-sdk/slack/monitor/auth.d.ts +11 -0
- package/dist/plugin-sdk/slack/monitor/channel-config.d.ts +41 -0
- package/dist/plugin-sdk/slack/monitor/commands.d.ts +9 -0
- package/dist/plugin-sdk/slack/monitor/context.d.ts +104 -0
- package/dist/plugin-sdk/slack/monitor/events/channels.d.ts +4 -0
- package/dist/plugin-sdk/slack/monitor/events/interactions.d.ts +4 -0
- package/dist/plugin-sdk/slack/monitor/events/members.d.ts +4 -0
- package/dist/plugin-sdk/slack/monitor/events/messages.d.ts +6 -0
- package/dist/plugin-sdk/slack/monitor/events/pins.d.ts +4 -0
- package/dist/plugin-sdk/slack/monitor/events/reactions.d.ts +4 -0
- package/dist/plugin-sdk/slack/monitor/events.d.ts +8 -0
- package/dist/plugin-sdk/slack/monitor/external-arg-menu-store.d.ts +18 -0
- package/dist/plugin-sdk/slack/monitor/media.d.ts +66 -0
- package/dist/plugin-sdk/slack/monitor/message-handler/dispatch.d.ts +12 -0
- package/dist/plugin-sdk/slack/monitor/message-handler/prepare.d.ts +13 -0
- package/dist/plugin-sdk/slack/monitor/message-handler/types.d.ts +22 -0
- package/dist/plugin-sdk/slack/monitor/message-handler.d.ts +11 -0
- package/dist/plugin-sdk/slack/monitor/mrkdwn.d.ts +1 -0
- package/dist/plugin-sdk/slack/monitor/policy.d.ts +5 -0
- package/dist/plugin-sdk/slack/monitor/provider.d.ts +7 -0
- package/dist/plugin-sdk/slack/monitor/replies.d.ts +53 -0
- package/dist/plugin-sdk/slack/monitor/room-context.d.ts +14 -0
- package/dist/plugin-sdk/slack/monitor/slash.d.ts +6 -0
- package/dist/plugin-sdk/slack/monitor/thread-resolution.d.ts +12 -0
- package/dist/plugin-sdk/slack/monitor/types.d.ts +97 -0
- package/dist/plugin-sdk/slack/monitor.d.ts +5 -0
- package/dist/plugin-sdk/slack/probe.d.ts +14 -0
- package/dist/plugin-sdk/slack/resolve-channels.d.ts +19 -0
- package/dist/plugin-sdk/slack/resolve-users.d.ts +26 -0
- package/dist/plugin-sdk/slack/send.d.ts +22 -0
- package/dist/plugin-sdk/slack/stream-mode.d.ts +23 -0
- package/dist/plugin-sdk/slack/streaming.d.ts +72 -0
- package/dist/plugin-sdk/slack/targets.d.ts +7 -0
- package/dist/plugin-sdk/slack/threading-tool-context.d.ts +10 -0
- package/dist/plugin-sdk/slack/threading.d.ts +29 -0
- package/dist/plugin-sdk/slack/token.d.ts +3 -0
- package/dist/plugin-sdk/slack/types.d.ts +58 -0
- package/dist/plugin-sdk/stt/defaults.d.ts +2 -0
- package/dist/plugin-sdk/stt/preflight.d.ts +14 -0
- package/dist/plugin-sdk/stt/providers/deepgram/audio.d.ts +4 -0
- package/dist/plugin-sdk/stt/providers/deepgram/index.d.ts +2 -0
- package/dist/plugin-sdk/stt/providers/google/audio.d.ts +3 -0
- package/dist/plugin-sdk/stt/providers/google/index.d.ts +2 -0
- package/dist/plugin-sdk/stt/providers/google/inline-data.d.ts +20 -0
- package/dist/plugin-sdk/stt/providers/groq/index.d.ts +2 -0
- package/dist/plugin-sdk/stt/providers/index.d.ts +4 -0
- package/dist/plugin-sdk/stt/providers/mistral/index.d.ts +2 -0
- package/dist/plugin-sdk/stt/providers/openai/audio.d.ts +3 -0
- package/dist/plugin-sdk/stt/providers/openai/index.d.ts +2 -0
- package/dist/plugin-sdk/stt/providers/shared.d.ts +20 -0
- package/dist/plugin-sdk/stt/stt.d.ts +27 -0
- package/dist/plugin-sdk/stt/types.d.ts +22 -0
- package/dist/plugin-sdk/telegram/accounts.d.ts +21 -0
- package/dist/plugin-sdk/telegram/allowed-updates.d.ts +4 -0
- package/dist/plugin-sdk/telegram/api-logging.d.ts +11 -0
- package/dist/plugin-sdk/telegram/audit.d.ts +29 -0
- package/dist/plugin-sdk/telegram/bot/delivery.d.ts +35 -0
- package/dist/plugin-sdk/telegram/bot/helpers.d.ts +128 -0
- package/dist/plugin-sdk/telegram/bot/types.d.ts +28 -0
- package/dist/plugin-sdk/telegram/bot-access.d.ts +26 -0
- package/dist/plugin-sdk/telegram/bot-handlers.d.ts +2 -0
- package/dist/plugin-sdk/telegram/bot-message-context.d.ts +144 -0
- package/dist/plugin-sdk/telegram/bot-message-dispatch.d.ts +19 -0
- package/dist/plugin-sdk/telegram/bot-message.d.ts +20 -0
- package/dist/plugin-sdk/telegram/bot-native-command-menu.d.ts +33 -0
- package/dist/plugin-sdk/telegram/bot-native-commands.d.ts +59 -0
- package/dist/plugin-sdk/telegram/bot-updates.d.ts +31 -0
- package/dist/plugin-sdk/telegram/bot.d.ts +62 -0
- package/dist/plugin-sdk/telegram/button-types.d.ts +7 -0
- package/dist/plugin-sdk/telegram/caption.d.ts +5 -0
- package/dist/plugin-sdk/telegram/dm-access.d.ts +18 -0
- package/dist/plugin-sdk/telegram/draft-stream.d.ts +37 -0
- package/dist/plugin-sdk/telegram/fetch.d.ts +5 -0
- package/dist/plugin-sdk/telegram/format.d.ts +18 -0
- package/dist/plugin-sdk/telegram/group-access.d.ts +54 -0
- package/dist/plugin-sdk/telegram/group-config-helpers.d.ts +7 -0
- package/dist/plugin-sdk/telegram/group-migration.d.ts +20 -0
- package/dist/plugin-sdk/telegram/inline-buttons.d.ts +11 -0
- package/dist/plugin-sdk/telegram/lane-delivery.d.ts +56 -0
- package/dist/plugin-sdk/telegram/monitor.d.ts +19 -0
- package/dist/plugin-sdk/telegram/network-config.d.ts +33 -0
- package/dist/plugin-sdk/telegram/network-errors.d.ts +5 -0
- package/dist/plugin-sdk/telegram/outbound-params.d.ts +2 -0
- package/dist/plugin-sdk/telegram/probe.d.ts +17 -0
- package/dist/plugin-sdk/telegram/proxy.d.ts +1 -0
- package/dist/plugin-sdk/telegram/reaction-level.d.ts +11 -0
- package/dist/plugin-sdk/telegram/send.d.ts +153 -0
- package/dist/plugin-sdk/telegram/sent-message-cache.d.ts +16 -0
- package/dist/plugin-sdk/telegram/status-reaction-variants.d.ts +21 -0
- package/dist/plugin-sdk/telegram/sticker-cache.d.ts +47 -0
- package/dist/plugin-sdk/telegram/target-writeback.d.ts +7 -0
- package/dist/plugin-sdk/telegram/targets.d.ts +11 -0
- package/dist/plugin-sdk/telegram/token.d.ts +13 -0
- package/dist/plugin-sdk/telegram/update-offset-store.d.ts +15 -0
- package/dist/plugin-sdk/telegram/voice.d.ts +16 -0
- package/dist/plugin-sdk/telegram/webhook.d.ts +20 -0
- package/dist/plugin-sdk/terminal/ansi.d.ts +2 -0
- package/dist/plugin-sdk/terminal/health-style.d.ts +1 -0
- package/dist/plugin-sdk/terminal/links.d.ts +6 -0
- package/dist/plugin-sdk/terminal/palette.d.ts +10 -0
- package/dist/plugin-sdk/terminal/progress-line.d.ts +3 -0
- package/dist/plugin-sdk/terminal/prompt-style.d.ts +3 -0
- package/dist/plugin-sdk/terminal/restore.d.ts +17 -0
- package/dist/plugin-sdk/terminal/theme.d.ts +15 -0
- package/dist/plugin-sdk/tts/providers/edge.d.ts +2 -0
- package/dist/plugin-sdk/tts/providers/elevenlabs.d.ts +2 -0
- package/dist/plugin-sdk/tts/providers/index.d.ts +4 -0
- package/dist/plugin-sdk/tts/providers/openai.d.ts +2 -0
- package/dist/plugin-sdk/tts/tts-core.d.ts +38 -0
- package/dist/plugin-sdk/tts/tts.d.ts +185 -0
- package/dist/plugin-sdk/tts/types.d.ts +21 -0
- package/dist/plugin-sdk/types/agent-types.d.ts +1 -0
- package/dist/plugin-sdk/utils/account-id.d.ts +1 -0
- package/dist/plugin-sdk/utils/boolean.d.ts +5 -0
- package/dist/plugin-sdk/utils/chunk-items.d.ts +1 -0
- package/dist/plugin-sdk/utils/delivery-context.d.ts +29 -0
- package/dist/plugin-sdk/utils/directive-tags.d.ts +29 -0
- package/dist/plugin-sdk/utils/fetch-timeout.d.ts +13 -0
- package/dist/plugin-sdk/utils/message-channel.d.ts +27 -0
- package/dist/plugin-sdk/utils/normalize-secret-input.d.ts +11 -0
- package/dist/plugin-sdk/utils/provider-utils.d.ts +9 -0
- package/dist/plugin-sdk/utils/queue-helpers.d.ts +80 -0
- package/dist/plugin-sdk/utils/reaction-level.d.ts +15 -0
- package/dist/plugin-sdk/utils/transcript-tools.d.ts +8 -0
- package/dist/plugin-sdk/utils/usage-format.d.ts +26 -0
- package/dist/plugin-sdk/utils/with-timeout.d.ts +1 -0
- package/dist/plugin-sdk/utils.d.ts +63 -0
- package/dist/plugin-sdk/version.d.ts +8 -0
- package/dist/plugin-sdk/web/accounts.d.ts +39 -0
- package/dist/plugin-sdk/web/active-listener.d.ts +25 -0
- package/dist/plugin-sdk/web/auth-store.d.ts +26 -0
- package/dist/plugin-sdk/web/auto-reply/constants.d.ts +1 -0
- package/dist/plugin-sdk/web/auto-reply/deliver-reply.d.ts +19 -0
- package/dist/plugin-sdk/web/auto-reply/heartbeat-runner.d.ts +20 -0
- package/dist/plugin-sdk/web/auto-reply/loggers.d.ts +4 -0
- package/dist/plugin-sdk/web/auto-reply/mentions.d.ts +19 -0
- package/dist/plugin-sdk/web/auto-reply/monitor/ack-reaction.d.ts +13 -0
- package/dist/plugin-sdk/web/auto-reply/monitor/broadcast.d.ts +16 -0
- package/dist/plugin-sdk/web/auto-reply/monitor/commands.d.ts +2 -0
- package/dist/plugin-sdk/web/auto-reply/monitor/echo.d.ts +17 -0
- package/dist/plugin-sdk/web/auto-reply/monitor/group-activation.d.ts +9 -0
- package/dist/plugin-sdk/web/auto-reply/monitor/group-gating.d.ts +33 -0
- package/dist/plugin-sdk/web/auto-reply/monitor/group-members.d.ts +6 -0
- package/dist/plugin-sdk/web/auto-reply/monitor/last-route.d.ts +15 -0
- package/dist/plugin-sdk/web/auto-reply/monitor/message-line.d.ts +11 -0
- package/dist/plugin-sdk/web/auto-reply/monitor/on-message.d.ts +24 -0
- package/dist/plugin-sdk/web/auto-reply/monitor/peer.d.ts +2 -0
- package/dist/plugin-sdk/web/auto-reply/monitor/process-message.d.ts +40 -0
- package/dist/plugin-sdk/web/auto-reply/monitor.d.ts +5 -0
- package/dist/plugin-sdk/web/auto-reply/session-snapshot.d.ts +17 -0
- package/dist/plugin-sdk/web/auto-reply/types.d.ts +30 -0
- package/dist/plugin-sdk/web/auto-reply/util.d.ts +2 -0
- package/dist/plugin-sdk/web/auto-reply.d.ts +1 -0
- package/dist/plugin-sdk/web/auto-reply.impl.d.ts +5 -0
- package/dist/plugin-sdk/web/inbound/access-control.d.ts +36 -0
- package/dist/plugin-sdk/web/inbound/dedupe.d.ts +2 -0
- package/dist/plugin-sdk/web/inbound/extract.d.ts +13 -0
- package/dist/plugin-sdk/web/inbound/media.d.ts +7 -0
- package/dist/plugin-sdk/web/inbound/monitor.d.ts +30 -0
- package/dist/plugin-sdk/web/inbound/send-api.d.ts +22 -0
- package/dist/plugin-sdk/web/inbound/types.d.ts +41 -0
- package/dist/plugin-sdk/web/inbound.d.ts +4 -0
- package/dist/plugin-sdk/web/login-qr.d.ts +19 -0
- package/dist/plugin-sdk/web/login.d.ts +3 -0
- package/dist/plugin-sdk/web/media.d.ts +43 -0
- package/dist/plugin-sdk/web/outbound.d.ts +24 -0
- package/dist/plugin-sdk/web/qr-image.d.ts +4 -0
- package/dist/plugin-sdk/web/reconnect.d.ts +12 -0
- package/dist/plugin-sdk/web/session.d.ts +14 -0
- package/dist/plugin-sdk/web/vcard.d.ts +6 -0
- package/dist/plugin-sdk/whatsapp/normalize.d.ts +6 -0
- package/dist/plugin-sdk/whatsapp/resolve-outbound-target.d.ts +12 -0
- package/dist/plugin-sdk/wizard/prompts.d.ts +43 -0
- package/dist/plugin-sdk/wizard/session.d.ts +42 -0
- package/dist/plugins-Ca4Ybd3t.js +254 -0
- package/dist/plugins-Cjhc9NMf.js +255 -0
- package/dist/plugins-allowlist-A38nxBRG.js +15 -0
- package/dist/plugins-allowlist-D2tS9tcu.js +15 -0
- package/dist/plugins-cli-BvgKK5Ww.js +807 -0
- package/dist/plugins-cli-oK0lk1Ku.js +803 -0
- package/dist/polls-BLyT08ZI.js +33 -0
- package/dist/polls-BmymsJEe.js +33 -0
- package/dist/ports-B4hTs4XH.js +96 -0
- package/dist/ports-CZEhYDiS.js +370 -0
- package/dist/ports-DALdfBQy.js +96 -0
- package/dist/ports-gRBeuUtp.js +316 -0
- package/dist/ports-lsof-CDyv5GJd.js +27 -0
- package/dist/preflight-Bq8rimP-.js +667 -0
- package/dist/preflight-DyYbEp9X.js +667 -0
- package/dist/process-scoped-map-BCJR56ZB.js +39 -0
- package/dist/process-scoped-map-Cb1EHPyN.js +39 -0
- package/dist/program-DKWIpFO9.js +250 -0
- package/dist/program-context-Cgy5-iZi.js +474 -0
- package/dist/program-context-DlXnmuB7.js +17 -0
- package/dist/progress-BcwxtM9Q.js +124 -0
- package/dist/progress-DRLmcFiG.js +123 -0
- package/dist/prompt-BRGfic91.js +21 -0
- package/dist/prompt-CZpYe6wn.js +21 -0
- package/dist/prompt-select-styled-CY647QfO.js +1669 -0
- package/dist/prompt-select-styled-pddqKMoY.js +1672 -0
- package/dist/prompt-style-BpUMhEHC.js +9 -0
- package/dist/prompt-style-CUuA6OCy.js +9 -0
- package/dist/provider-auth-B7QgxlKt.js +187 -0
- package/dist/provider-auth-j-EQvvIk.js +187 -0
- package/dist/provider-dispatcher-DX896bb6.js +659 -0
- package/dist/provider-dispatcher-IV_mSji1.js +660 -0
- package/dist/provider-utils-C9kBVF1f.js +79 -0
- package/dist/provider-utils-DiLhkKQp.js +79 -0
- package/dist/proxy-BMJL0Qog.js +16 -0
- package/dist/proxy-D-qGA1vm.js +16 -0
- package/dist/push-apns--nEiZmEN.js +711 -0
- package/dist/push-apns-BtS6B6lb.js +713 -0
- package/dist/pw-ai-DkXUNGEs.js +1908 -0
- package/dist/pw-ai-oQ2VDwbk.js +1911 -0
- package/dist/pw-ai-state--TxTVwRW.js +11 -0
- package/dist/pw-ai-state-CwXeO5d0.js +11 -0
- package/dist/qr-cli-BffaTzZT.js +353 -0
- package/dist/qr-cli-CKHw8aW4.js +349 -0
- package/dist/redact-BW8tobyp.js +191 -0
- package/dist/redact-Ci96Gj0O.js +191 -0
- package/dist/redact-identifier-Bv5SUUw-.js +15 -0
- package/dist/redact-identifier-HyK89Sod.js +15 -0
- package/dist/redact-snapshot-PHeKfwLg.js +1934 -0
- package/dist/redact-snapshot-h25IHbX2.js +1934 -0
- package/dist/register.agent-BhJGcSwi.js +1029 -0
- package/dist/register.agent-DYcLNpJD.js +292 -0
- package/dist/register.configure-V-MeA6h7.js +135 -0
- package/dist/register.configure-oCfJYt2T.js +130 -0
- package/dist/register.import-CROeeohP.js +31 -0
- package/dist/register.import-DrHKMUlv.js +29 -0
- package/dist/register.maintenance-XRDiAiai.js +501 -0
- package/dist/register.maintenance-mHTyzd1l.js +503 -0
- package/dist/register.message-9FClPeyR.js +687 -0
- package/dist/register.message-DigNUgXx.js +691 -0
- package/dist/register.onboard-CF1DK5RO.js +92 -0
- package/dist/register.onboard-Cm2ExJRM.js +96 -0
- package/dist/register.setup-BEV_QLoU.js +114 -0
- package/dist/register.setup-BboalnlO.js +118 -0
- package/dist/register.status-health-sessions-B5flqjtZ.js +666 -0
- package/dist/register.status-health-sessions-DbQPmWOW.js +428 -0
- package/dist/register.subclis-FFHoriVe.js +267 -0
- package/dist/remoteclaw-root-BfPjgewe.js +88 -0
- package/dist/remoteclaw-root-E4-hmb4E.js +88 -0
- package/dist/render-6ahYfPwj.js +104 -0
- package/dist/render-BhKzKdV0.js +104 -0
- package/dist/render-e7fENCYH.js +104 -0
- package/dist/replies-Dc_GFb85.js +136 -0
- package/dist/replies-nkw9sahT.js +136 -0
- package/dist/reply-D0iVkyuP.js +12366 -0
- package/dist/reply-DEPE5T_9.js +12363 -0
- package/dist/reply-directives-Bbyf2UON.js +182 -0
- package/dist/reply-directives-DiRJRT_6.js +182 -0
- package/dist/reply-payloads-DDrMOUKP.js +527 -0
- package/dist/reply-prefix-Buyx2ZZC.js +37 -0
- package/dist/reply-prefix-D7E0w0O2.js +37 -0
- package/dist/resolve-route-BBOsg5KI.js +249 -0
- package/dist/resolve-route-Dyx3ifWH.js +249 -0
- package/dist/response-prefix-template-CZOMBOE6.js +134 -0
- package/dist/response-prefix-template-xsasdq1T.js +134 -0
- package/dist/retry-BWv_fy4u.js +77 -0
- package/dist/retry-D7zwz3HY.js +77 -0
- package/dist/retry-Dar_7pCv.js +77 -0
- package/dist/rolldown-runtime-Cbj13DAv.js +20 -0
- package/dist/run-main-BUSpd6Gy.js +308 -0
- package/dist/runtime-guard-Bhx-pb8_.js +60 -0
- package/dist/runtime-guard-DAHXelsb.js +60 -0
- package/dist/runtime-status-CR9445g5.js +12 -0
- package/dist/runtime-status-hFVEC3wO.js +12 -0
- package/dist/secret-equal-D6AoXne1.js +11 -0
- package/dist/secret-equal-DLnUuWM3.js +11 -0
- package/dist/secure-random-B8v4P_PH.js +44 -0
- package/dist/secure-random-Ba4Y5xG5.js +12 -0
- package/dist/secure-random-CRVHgtmO.js +12 -0
- package/dist/security-cli-C8r-8YZ7.js +488 -0
- package/dist/security-cli-Cy2Jqb0n.js +483 -0
- package/dist/send-B5iWtbNX.js +349 -0
- package/dist/send-BaaCgoKI.js +374 -0
- package/dist/send-Brtl2skD.js +332 -0
- package/dist/send-BuKAbt8a.js +547 -0
- package/dist/send-BxQ1YFYH.js +1178 -0
- package/dist/send-C7xFV4Ul.js +29 -0
- package/dist/send-C9pLn8Zz.js +11 -0
- package/dist/send-CPn9GDbB.js +349 -0
- package/dist/send-DJ5jHNeg.js +1779 -0
- package/dist/send-DLLYgtkJ.js +2245 -0
- package/dist/send-DO4RP5yz.js +1776 -0
- package/dist/send-DYHrHs_8.js +492 -0
- package/dist/send-DZ80jwFi.js +426 -0
- package/dist/send-Dbl0_FNE.js +2245 -0
- package/dist/send-DpaTnM-a.js +492 -0
- package/dist/send-gxeISRd1.js +547 -0
- package/dist/server-BZfrR2D5.js +206 -0
- package/dist/server-CW4QQmFB.js +202 -0
- package/dist/server-lifecycle-CY3Lxtea.js +2437 -0
- package/dist/server-lifecycle-X3AKkvMo.js +2437 -0
- package/dist/server-node-events-q5He8xk5.js +391 -0
- package/dist/server-node-events-udPU4Xlv.js +395 -0
- package/dist/service-C2j81L86.js +670 -0
- package/dist/service-C8a0SXHD.js +670 -0
- package/dist/session-C6VKWvx6.js +170 -0
- package/dist/session-cost-usage-0Vs4hgMe.js +627 -0
- package/dist/session-cost-usage-C-DsaOfN.js +627 -0
- package/dist/session-dirs-CO1f2ArM.js +318 -0
- package/dist/session-dirs-DoboH7Oy.js +318 -0
- package/dist/session-enM9-2If.js +170 -0
- package/dist/session-key-BF-9YzxC.js +235 -0
- package/dist/session-key-CgKWfjoZ.js +235 -0
- package/dist/session-utils-VKfyrS3d.js +621 -0
- package/dist/session-utils-_U6PeQeD.js +621 -0
- package/dist/sessions-Dg3febTj.js +2553 -0
- package/dist/sessions-Fhrpa-qj.js +245 -0
- package/dist/shell-env-DBS5su07.js +163 -0
- package/dist/shell-env-c3j5zcU9.js +163 -0
- package/dist/ssrf-8wNqPNzN.js +183 -0
- package/dist/ssrf-CJIdPXuS.js +183 -0
- package/dist/stagger--wvODnNe.js +56 -0
- package/dist/stagger-BLmTO4cK.js +56 -0
- package/dist/status-1zVD-Clq.js +21 -0
- package/dist/status-B_wW9Vt8.js +1936 -0
- package/dist/status-BtRY0nXQ.js +21 -0
- package/dist/status-D3leIzsB.js +1940 -0
- package/dist/status.update-BmuDZ7E7.js +449 -0
- package/dist/status.update-Mf6HSRvU.js +449 -0
- package/dist/store-BmUyjVdV.js +2555 -0
- package/dist/store-CzhBjUCN.js +64 -0
- package/dist/store-DlqiXmDO.js +53 -0
- package/dist/store-LXf4lUUA.js +64 -0
- package/dist/strip-inbound-meta-zmUXypSS.js +110 -0
- package/dist/strip-inbound-meta-zqtN9FTK.js +110 -0
- package/dist/subagent-registry-BCGOdOC-.js +4839 -0
- package/dist/subagent-registry-Bjx9LVlV.js +4841 -0
- package/dist/subsystem-BAW_f3DI.js +1195 -0
- package/dist/subsystem-DE8w_S23.js +1081 -0
- package/dist/system-cli-CDi0wZXE.js +73 -0
- package/dist/system-cli-CrzLj6XB.js +77 -0
- package/dist/systemd-40Rij3QR.js +547 -0
- package/dist/systemd-5C97CSzd.js +547 -0
- package/dist/systemd-hints-CyQqHq1i.js +278 -0
- package/dist/systemd-hints-Dbpv6gQ1.js +278 -0
- package/dist/systemd-linger-B2rPbnAi.js +75 -0
- package/dist/systemd-linger-DDvkfxH-.js +75 -0
- package/dist/table-DFx25vNb.js +279 -0
- package/dist/table-On3hkCqi.js +278 -0
- package/dist/tables-BFyFqtLB.js +55 -0
- package/dist/tables-Crybi0rV.js +55 -0
- package/dist/tables-Dwxstcvj.js +55 -0
- package/dist/tailnet-Da-_9e8E.js +40 -0
- package/dist/tailnet-xt92Yaop.js +40 -0
- package/dist/tailscale-CnV0JWca.js +230 -0
- package/dist/tailscale-VkEC8dzj.js +230 -0
- package/dist/target-errors-ChjvOMuV.js +26 -0
- package/dist/target-errors-GZXDqlUu.js +26 -0
- package/dist/targets-B46m7u5J.js +45 -0
- package/dist/targets-BegO82oK.js +2614 -0
- package/dist/targets-BpTQ50aN.js +649 -0
- package/dist/targets-BtGRUQMa.js +79 -0
- package/dist/targets-C99szk_e.js +114 -0
- package/dist/targets-CmC5m7Ey.js +53 -0
- package/dist/targets-D01MJGnh.js +79 -0
- package/dist/targets-D3r6Zgic.js +39 -0
- package/dist/targets-D7PT_rdO.js +45 -0
- package/dist/targets-D8Rv_6CT.js +649 -0
- package/dist/targets-DJ_OVcyq.js +220 -0
- package/dist/targets-_UWmnyI9.js +53 -0
- package/dist/targets-felDvoku.js +2613 -0
- package/dist/targets-tDrl_ioQ.js +46 -0
- package/dist/text-format-DarxU3JH.js +9 -0
- package/dist/text-format-Ds92M9UT.js +9 -0
- package/dist/thinking-4nOZPunr.js +60 -0
- package/dist/thinking-ZfH2V9Os.js +60 -0
- package/dist/tokens-Dw7ZdYwT.js +21 -0
- package/dist/tokens-TtJJxzRr.js +21 -0
- package/dist/tool-display-Bxs_1jIn.js +785 -0
- package/dist/tool-display-D9p_Ttkq.js +785 -0
- package/dist/tool-images-9Ron321Q.js +263 -0
- package/dist/tool-images-BWhy6WRN.js +263 -0
- package/dist/trash-BpB96kHe.js +125 -0
- package/dist/trash-De0DLz-t.js +125 -0
- package/dist/tui-M21MnbJp.js +3237 -0
- package/dist/tui-cli-mxjebFIk.js +63 -0
- package/dist/tui-cli-x2aEqskG.js +67 -0
- package/dist/tui-qVJob4mN.js +3237 -0
- package/dist/types.tools-BBb2rl3g.js +23 -0
- package/dist/types.tools-BDJw1yFx.js +23 -0
- package/dist/update-Bv3EwRgy.js +349 -0
- package/dist/update-D2gIPs2g.js +349 -0
- package/dist/update-cli-B_tiAE6B.js +1149 -0
- package/dist/update-cli-DdERWV6b.js +1147 -0
- package/dist/usage-BIzKZ5dT.js +57 -0
- package/dist/usage-BvZOzIC7.js +57 -0
- package/dist/usage-CCU9qNC5.js +5472 -0
- package/dist/usage-format-CmniSPCG.js +31 -0
- package/dist/usage-format-D_KQYQ-w.js +31 -0
- package/dist/utils-DPoNpP7D.js +631 -0
- package/dist/version-3QUZW8EP.js +52 -0
- package/dist/version-CVMnqdzu.js +52 -0
- package/dist/voice-credentials-CxWaO19D.js +46 -0
- package/dist/voice-credentials-DXU-y9z7.js +46 -0
- package/dist/warning-filter.js +48 -0
- package/dist/web-CCN82vao.js +74 -0
- package/dist/web-MFXYQO8v.js +79 -0
- package/dist/web-zotCHj-B.js +3051 -0
- package/dist/webhooks-cli-BB6FZ7La.js +330 -0
- package/dist/webhooks-cli-BoZinXXo.js +334 -0
- package/dist/whatsapp-actions-COMlNQFa.js +126 -0
- package/dist/whatsapp-actions-YZgc7smO.js +131 -0
- package/dist/widearea-dns-CQqZIeu8.js +127 -0
- package/dist/widearea-dns-D01FFYZ8.js +127 -0
- package/dist/workspace-BJCKO8Ns.js +10 -0
- package/dist/workspace-BisvA9oA.js +10 -0
- package/dist/workspace-Bj_uUDJr.js +439 -0
- package/dist/workspace-S9vwEco2.js +441 -0
- package/dist/wsl-PDLKeX04.js +52 -0
- package/dist/wsl-kFaeW76c.js +52 -0
- package/dist/zod-schema-7uqrpeBz.js +2715 -0
- package/dist/zod-schema-CdBaNuxH.js +2715 -0
- package/extensions/bluebubbles/README.md +45 -0
- package/extensions/bluebubbles/index.ts +19 -0
- package/extensions/bluebubbles/package.json +33 -0
- package/extensions/bluebubbles/remoteclaw.plugin.json +9 -0
- package/extensions/bluebubbles/src/account-resolve.ts +35 -0
- package/extensions/bluebubbles/src/accounts.ts +90 -0
- package/extensions/bluebubbles/src/actions.ts +460 -0
- package/extensions/bluebubbles/src/attachments.ts +268 -0
- package/extensions/bluebubbles/src/channel.ts +418 -0
- package/extensions/bluebubbles/src/chat.ts +329 -0
- package/extensions/bluebubbles/src/config-schema.ts +65 -0
- package/extensions/bluebubbles/src/history.ts +177 -0
- package/extensions/bluebubbles/src/media-send.ts +317 -0
- package/extensions/bluebubbles/src/monitor-normalize.ts +825 -0
- package/extensions/bluebubbles/src/monitor-processing.ts +1448 -0
- package/extensions/bluebubbles/src/monitor-reply-cache.ts +185 -0
- package/extensions/bluebubbles/src/monitor-shared.ts +41 -0
- package/extensions/bluebubbles/src/monitor.ts +534 -0
- package/extensions/bluebubbles/src/multipart.ts +32 -0
- package/extensions/bluebubbles/src/onboarding.ts +340 -0
- package/extensions/bluebubbles/src/probe.ts +163 -0
- package/extensions/bluebubbles/src/reactions.ts +182 -0
- package/extensions/bluebubbles/src/request-url.ts +12 -0
- package/extensions/bluebubbles/src/runtime.ts +34 -0
- package/extensions/bluebubbles/src/send-helpers.ts +53 -0
- package/extensions/bluebubbles/src/send.ts +472 -0
- package/extensions/bluebubbles/src/targets.ts +370 -0
- package/extensions/bluebubbles/src/test-harness.ts +79 -0
- package/extensions/bluebubbles/src/test-mocks.ts +11 -0
- package/extensions/bluebubbles/src/types.ts +135 -0
- package/extensions/device-pair/index.ts +529 -0
- package/extensions/device-pair/remoteclaw.plugin.json +20 -0
- package/extensions/diagnostics-otel/index.ts +15 -0
- package/extensions/diagnostics-otel/node_modules/.bin/acorn +21 -0
- package/extensions/diagnostics-otel/package.json +24 -0
- package/extensions/diagnostics-otel/remoteclaw.plugin.json +8 -0
- package/extensions/diagnostics-otel/src/service.ts +682 -0
- package/extensions/discord/index.ts +19 -0
- package/extensions/discord/package.json +11 -0
- package/extensions/discord/remoteclaw.plugin.json +9 -0
- package/extensions/discord/src/channel.ts +451 -0
- package/extensions/discord/src/runtime.ts +14 -0
- package/extensions/discord/src/subagent-hooks.ts +152 -0
- package/extensions/feishu/index.ts +63 -0
- package/extensions/feishu/package.json +34 -0
- package/extensions/feishu/remoteclaw.plugin.json +9 -0
- package/extensions/feishu/skills/feishu-doc/SKILL.md +105 -0
- package/extensions/feishu/skills/feishu-doc/references/block-types.md +103 -0
- package/extensions/feishu/skills/feishu-drive/SKILL.md +97 -0
- package/extensions/feishu/skills/feishu-perm/SKILL.md +119 -0
- package/extensions/feishu/skills/feishu-wiki/SKILL.md +111 -0
- package/extensions/feishu/src/accounts.ts +144 -0
- package/extensions/feishu/src/bitable.ts +739 -0
- package/extensions/feishu/src/bot.ts +1006 -0
- package/extensions/feishu/src/channel.ts +359 -0
- package/extensions/feishu/src/client.ts +118 -0
- package/extensions/feishu/src/config-schema.ts +226 -0
- package/extensions/feishu/src/dedup.ts +54 -0
- package/extensions/feishu/src/directory.ts +177 -0
- package/extensions/feishu/src/doc-schema.ts +47 -0
- package/extensions/feishu/src/docx.ts +536 -0
- package/extensions/feishu/src/drive-schema.ts +46 -0
- package/extensions/feishu/src/drive.ts +227 -0
- package/extensions/feishu/src/dynamic-agent.ts +131 -0
- package/extensions/feishu/src/external-keys.ts +19 -0
- package/extensions/feishu/src/media.ts +441 -0
- package/extensions/feishu/src/mention.ts +133 -0
- package/extensions/feishu/src/monitor.ts +397 -0
- package/extensions/feishu/src/onboarding.ts +351 -0
- package/extensions/feishu/src/outbound.ts +55 -0
- package/extensions/feishu/src/perm-schema.ts +52 -0
- package/extensions/feishu/src/perm.ts +173 -0
- package/extensions/feishu/src/policy.ts +120 -0
- package/extensions/feishu/src/probe.ts +44 -0
- package/extensions/feishu/src/reactions.ts +160 -0
- package/extensions/feishu/src/reply-dispatcher.ts +239 -0
- package/extensions/feishu/src/runtime.ts +14 -0
- package/extensions/feishu/src/send-result.ts +29 -0
- package/extensions/feishu/src/send-target.ts +25 -0
- package/extensions/feishu/src/send.ts +313 -0
- package/extensions/feishu/src/streaming-card.ts +218 -0
- package/extensions/feishu/src/targets.ts +78 -0
- package/extensions/feishu/src/tools-config.ts +21 -0
- package/extensions/feishu/src/types.ts +81 -0
- package/extensions/feishu/src/typing.ts +80 -0
- package/extensions/feishu/src/wiki-schema.ts +55 -0
- package/extensions/feishu/src/wiki.ts +232 -0
- package/extensions/googlechat/index.ts +19 -0
- package/extensions/googlechat/node_modules/.bin/nlc +21 -0
- package/extensions/googlechat/node_modules/.bin/node-llama-cpp +21 -0
- package/extensions/googlechat/node_modules/.bin/remoteclaw +21 -0
- package/extensions/googlechat/node_modules/.bin/tsc +21 -0
- package/extensions/googlechat/node_modules/.bin/tsserver +21 -0
- package/extensions/googlechat/package.json +37 -0
- package/extensions/googlechat/remoteclaw.plugin.json +9 -0
- package/extensions/googlechat/src/accounts.ts +147 -0
- package/extensions/googlechat/src/actions.ts +176 -0
- package/extensions/googlechat/src/api.ts +282 -0
- package/extensions/googlechat/src/auth.ts +137 -0
- package/extensions/googlechat/src/channel.ts +576 -0
- package/extensions/googlechat/src/monitor.ts +965 -0
- package/extensions/googlechat/src/onboarding.ts +270 -0
- package/extensions/googlechat/src/runtime.ts +14 -0
- package/extensions/googlechat/src/targets.ts +65 -0
- package/extensions/googlechat/src/types.config.ts +3 -0
- package/extensions/googlechat/src/types.ts +73 -0
- package/extensions/imessage/index.ts +17 -0
- package/extensions/imessage/package.json +12 -0
- package/extensions/imessage/remoteclaw.plugin.json +9 -0
- package/extensions/imessage/src/channel.ts +304 -0
- package/extensions/imessage/src/runtime.ts +14 -0
- package/extensions/irc/index.ts +17 -0
- package/extensions/irc/package.json +11 -0
- package/extensions/irc/remoteclaw.plugin.json +9 -0
- package/extensions/irc/src/accounts.ts +268 -0
- package/extensions/irc/src/channel.ts +364 -0
- package/extensions/irc/src/client.ts +439 -0
- package/extensions/irc/src/config-schema.ts +91 -0
- package/extensions/irc/src/connect-options.ts +30 -0
- package/extensions/irc/src/control-chars.ts +22 -0
- package/extensions/irc/src/inbound.ts +371 -0
- package/extensions/irc/src/monitor.ts +146 -0
- package/extensions/irc/src/normalize.ts +123 -0
- package/extensions/irc/src/onboarding.ts +479 -0
- package/extensions/irc/src/policy.ts +166 -0
- package/extensions/irc/src/probe.ts +53 -0
- package/extensions/irc/src/protocol.ts +169 -0
- package/extensions/irc/src/runtime.ts +14 -0
- package/extensions/irc/src/send.ts +88 -0
- package/extensions/irc/src/types.ts +98 -0
- package/extensions/line/index.ts +19 -0
- package/extensions/line/package.json +27 -0
- package/extensions/line/remoteclaw.plugin.json +9 -0
- package/extensions/line/src/card-command.ts +344 -0
- package/extensions/line/src/channel.ts +797 -0
- package/extensions/line/src/runtime.ts +14 -0
- package/extensions/matrix/CHANGELOG.md +32 -0
- package/extensions/matrix/index.ts +17 -0
- package/extensions/matrix/node_modules/.bin/markdown-it +21 -0
- package/extensions/matrix/package.json +33 -0
- package/extensions/matrix/remoteclaw.plugin.json +9 -0
- package/extensions/matrix/src/actions.ts +195 -0
- package/extensions/matrix/src/channel.ts +486 -0
- package/extensions/matrix/src/config-schema.ts +63 -0
- package/extensions/matrix/src/directory-live.ts +208 -0
- package/extensions/matrix/src/group-mentions.ts +52 -0
- package/extensions/matrix/src/matrix/accounts.ts +137 -0
- package/extensions/matrix/src/matrix/actions/client.ts +47 -0
- package/extensions/matrix/src/matrix/actions/limits.ts +6 -0
- package/extensions/matrix/src/matrix/actions/messages.ts +126 -0
- package/extensions/matrix/src/matrix/actions/pins.ts +84 -0
- package/extensions/matrix/src/matrix/actions/reactions.ts +102 -0
- package/extensions/matrix/src/matrix/actions/room.ts +85 -0
- package/extensions/matrix/src/matrix/actions/summary.ts +75 -0
- package/extensions/matrix/src/matrix/actions/types.ts +85 -0
- package/extensions/matrix/src/matrix/actions.ts +15 -0
- package/extensions/matrix/src/matrix/active-client.ts +32 -0
- package/extensions/matrix/src/matrix/client/config.ts +219 -0
- package/extensions/matrix/src/matrix/client/create-client.ts +123 -0
- package/extensions/matrix/src/matrix/client/logging.ts +36 -0
- package/extensions/matrix/src/matrix/client/runtime.ts +4 -0
- package/extensions/matrix/src/matrix/client/shared.ts +201 -0
- package/extensions/matrix/src/matrix/client/storage.ts +131 -0
- package/extensions/matrix/src/matrix/client/types.ts +34 -0
- package/extensions/matrix/src/matrix/client-bootstrap.ts +39 -0
- package/extensions/matrix/src/matrix/client.ts +14 -0
- package/extensions/matrix/src/matrix/credentials.ts +125 -0
- package/extensions/matrix/src/matrix/deps.ts +60 -0
- package/extensions/matrix/src/matrix/format.ts +22 -0
- package/extensions/matrix/src/matrix/index.ts +11 -0
- package/extensions/matrix/src/matrix/monitor/allowlist.ts +103 -0
- package/extensions/matrix/src/matrix/monitor/auto-join.ts +71 -0
- package/extensions/matrix/src/matrix/monitor/direct.ts +104 -0
- package/extensions/matrix/src/matrix/monitor/events.ts +148 -0
- package/extensions/matrix/src/matrix/monitor/handler.ts +688 -0
- package/extensions/matrix/src/matrix/monitor/index.ts +358 -0
- package/extensions/matrix/src/matrix/monitor/location.ts +100 -0
- package/extensions/matrix/src/matrix/monitor/media.ts +118 -0
- package/extensions/matrix/src/matrix/monitor/mentions.ts +62 -0
- package/extensions/matrix/src/matrix/monitor/replies.ts +100 -0
- package/extensions/matrix/src/matrix/monitor/room-info.ts +55 -0
- package/extensions/matrix/src/matrix/monitor/rooms.ts +47 -0
- package/extensions/matrix/src/matrix/monitor/threads.ts +68 -0
- package/extensions/matrix/src/matrix/monitor/types.ts +39 -0
- package/extensions/matrix/src/matrix/poll-types.ts +167 -0
- package/extensions/matrix/src/matrix/probe.ts +69 -0
- package/extensions/matrix/src/matrix/send/client.ts +97 -0
- package/extensions/matrix/src/matrix/send/formatting.ts +93 -0
- package/extensions/matrix/src/matrix/send/media.ts +230 -0
- package/extensions/matrix/src/matrix/send/targets.ts +150 -0
- package/extensions/matrix/src/matrix/send/types.ts +109 -0
- package/extensions/matrix/src/matrix/send-queue.ts +44 -0
- package/extensions/matrix/src/matrix/send.ts +265 -0
- package/extensions/matrix/src/onboarding.ts +446 -0
- package/extensions/matrix/src/outbound.ts +55 -0
- package/extensions/matrix/src/resolve-targets.ts +126 -0
- package/extensions/matrix/src/runtime.ts +14 -0
- package/extensions/matrix/src/tool-actions.ts +164 -0
- package/extensions/matrix/src/types.ts +114 -0
- package/extensions/mattermost/index.ts +17 -0
- package/extensions/mattermost/package.json +25 -0
- package/extensions/mattermost/remoteclaw.plugin.json +9 -0
- package/extensions/mattermost/src/channel.ts +439 -0
- package/extensions/mattermost/src/config-schema.ts +62 -0
- package/extensions/mattermost/src/group-mentions.ts +15 -0
- package/extensions/mattermost/src/mattermost/accounts.ts +128 -0
- package/extensions/mattermost/src/mattermost/client.ts +230 -0
- package/extensions/mattermost/src/mattermost/index.ts +9 -0
- package/extensions/mattermost/src/mattermost/monitor-helpers.ts +71 -0
- package/extensions/mattermost/src/mattermost/monitor-onchar.ts +25 -0
- package/extensions/mattermost/src/mattermost/monitor-websocket.ts +221 -0
- package/extensions/mattermost/src/mattermost/monitor.ts +1061 -0
- package/extensions/mattermost/src/mattermost/probe.ts +61 -0
- package/extensions/mattermost/src/mattermost/reactions.test-helpers.ts +83 -0
- package/extensions/mattermost/src/mattermost/reactions.ts +124 -0
- package/extensions/mattermost/src/mattermost/reconnect.ts +103 -0
- package/extensions/mattermost/src/mattermost/send.ts +231 -0
- package/extensions/mattermost/src/normalize.ts +46 -0
- package/extensions/mattermost/src/onboarding-helpers.ts +1 -0
- package/extensions/mattermost/src/onboarding.ts +182 -0
- package/extensions/mattermost/src/runtime.ts +14 -0
- package/extensions/mattermost/src/types.ts +62 -0
- package/extensions/msteams/CHANGELOG.md +35 -0
- package/extensions/msteams/index.ts +17 -0
- package/extensions/msteams/package.json +32 -0
- package/extensions/msteams/remoteclaw.plugin.json +9 -0
- package/extensions/msteams/src/attachments/download.ts +282 -0
- package/extensions/msteams/src/attachments/graph.ts +354 -0
- package/extensions/msteams/src/attachments/html.ts +90 -0
- package/extensions/msteams/src/attachments/payload.ts +14 -0
- package/extensions/msteams/src/attachments/remote-media.ts +42 -0
- package/extensions/msteams/src/attachments/shared.ts +404 -0
- package/extensions/msteams/src/attachments/types.ts +37 -0
- package/extensions/msteams/src/attachments.ts +18 -0
- package/extensions/msteams/src/channel.ts +464 -0
- package/extensions/msteams/src/conversation-store-fs.ts +165 -0
- package/extensions/msteams/src/conversation-store-memory.ts +47 -0
- package/extensions/msteams/src/conversation-store.ts +41 -0
- package/extensions/msteams/src/directory-live.ts +108 -0
- package/extensions/msteams/src/errors.ts +190 -0
- package/extensions/msteams/src/file-consent-helpers.ts +73 -0
- package/extensions/msteams/src/file-consent.ts +126 -0
- package/extensions/msteams/src/file-lock.ts +1 -0
- package/extensions/msteams/src/graph-chat.ts +53 -0
- package/extensions/msteams/src/graph-upload.ts +452 -0
- package/extensions/msteams/src/graph-users.ts +29 -0
- package/extensions/msteams/src/graph.ts +81 -0
- package/extensions/msteams/src/inbound.ts +48 -0
- package/extensions/msteams/src/index.ts +4 -0
- package/extensions/msteams/src/media-helpers.ts +105 -0
- package/extensions/msteams/src/mentions.ts +114 -0
- package/extensions/msteams/src/messenger.ts +484 -0
- package/extensions/msteams/src/monitor-handler/inbound-media.ts +128 -0
- package/extensions/msteams/src/monitor-handler/message-handler.ts +661 -0
- package/extensions/msteams/src/monitor-handler.ts +162 -0
- package/extensions/msteams/src/monitor-types.ts +5 -0
- package/extensions/msteams/src/monitor.ts +305 -0
- package/extensions/msteams/src/onboarding.ts +406 -0
- package/extensions/msteams/src/outbound.ts +46 -0
- package/extensions/msteams/src/pending-uploads.ts +89 -0
- package/extensions/msteams/src/policy.ts +259 -0
- package/extensions/msteams/src/polls-store-memory.ts +32 -0
- package/extensions/msteams/src/polls.ts +315 -0
- package/extensions/msteams/src/probe.ts +94 -0
- package/extensions/msteams/src/reply-dispatcher.ts +132 -0
- package/extensions/msteams/src/resolve-allowlist.ts +198 -0
- package/extensions/msteams/src/runtime.ts +14 -0
- package/extensions/msteams/src/sdk-types.ts +19 -0
- package/extensions/msteams/src/sdk.ts +33 -0
- package/extensions/msteams/src/send-context.ts +164 -0
- package/extensions/msteams/src/send.ts +530 -0
- package/extensions/msteams/src/sent-message-cache.ts +44 -0
- package/extensions/msteams/src/storage.ts +25 -0
- package/extensions/msteams/src/store-fs.ts +44 -0
- package/extensions/msteams/src/test-runtime.ts +16 -0
- package/extensions/msteams/src/token-response.ts +11 -0
- package/extensions/msteams/src/token.ts +19 -0
- package/extensions/nextcloud-talk/index.ts +17 -0
- package/extensions/nextcloud-talk/package.json +30 -0
- package/extensions/nextcloud-talk/remoteclaw.plugin.json +9 -0
- package/extensions/nextcloud-talk/src/accounts.ts +170 -0
- package/extensions/nextcloud-talk/src/channel.ts +416 -0
- package/extensions/nextcloud-talk/src/config-schema.ts +72 -0
- package/extensions/nextcloud-talk/src/format.ts +79 -0
- package/extensions/nextcloud-talk/src/inbound.ts +342 -0
- package/extensions/nextcloud-talk/src/monitor.ts +275 -0
- package/extensions/nextcloud-talk/src/normalize.ts +39 -0
- package/extensions/nextcloud-talk/src/onboarding.ts +349 -0
- package/extensions/nextcloud-talk/src/policy.ts +180 -0
- package/extensions/nextcloud-talk/src/room-info.ts +125 -0
- package/extensions/nextcloud-talk/src/runtime.ts +14 -0
- package/extensions/nextcloud-talk/src/send.ts +215 -0
- package/extensions/nextcloud-talk/src/signature.ts +72 -0
- package/extensions/nextcloud-talk/src/types.ts +184 -0
- package/extensions/nostr/CHANGELOG.md +44 -0
- package/extensions/nostr/README.md +136 -0
- package/extensions/nostr/index.ts +68 -0
- package/extensions/nostr/node_modules/.bin/tsc +21 -0
- package/extensions/nostr/node_modules/.bin/tsserver +21 -0
- package/extensions/nostr/package.json +30 -0
- package/extensions/nostr/remoteclaw.plugin.json +9 -0
- package/extensions/nostr/src/channel.ts +345 -0
- package/extensions/nostr/src/config-schema.ts +90 -0
- package/extensions/nostr/src/metrics.ts +458 -0
- package/extensions/nostr/src/nostr-bus.ts +719 -0
- package/extensions/nostr/src/nostr-profile-http.ts +519 -0
- package/extensions/nostr/src/nostr-profile-import.ts +262 -0
- package/extensions/nostr/src/nostr-profile.ts +277 -0
- package/extensions/nostr/src/nostr-state-store.ts +226 -0
- package/extensions/nostr/src/runtime.ts +14 -0
- package/extensions/nostr/src/seen-tracker.ts +289 -0
- package/extensions/nostr/src/types.ts +101 -0
- package/extensions/phone-control/index.ts +421 -0
- package/extensions/phone-control/remoteclaw.plugin.json +10 -0
- package/extensions/shared/resolve-target-test-helpers.ts +66 -0
- package/extensions/signal/index.ts +17 -0
- package/extensions/signal/package.json +12 -0
- package/extensions/signal/remoteclaw.plugin.json +9 -0
- package/extensions/signal/src/channel.ts +299 -0
- package/extensions/signal/src/runtime.ts +14 -0
- package/extensions/slack/index.ts +17 -0
- package/extensions/slack/package.json +12 -0
- package/extensions/slack/remoteclaw.plugin.json +9 -0
- package/extensions/slack/src/channel.ts +421 -0
- package/extensions/slack/src/runtime.ts +14 -0
- package/extensions/synology-chat/index.ts +17 -0
- package/extensions/synology-chat/package.json +28 -0
- package/extensions/synology-chat/remoteclaw.plugin.json +9 -0
- package/extensions/synology-chat/src/accounts.ts +87 -0
- package/extensions/synology-chat/src/channel.ts +347 -0
- package/extensions/synology-chat/src/client.ts +142 -0
- package/extensions/synology-chat/src/runtime.ts +20 -0
- package/extensions/synology-chat/src/security.ts +140 -0
- package/extensions/synology-chat/src/types.ts +60 -0
- package/extensions/synology-chat/src/webhook-handler.ts +221 -0
- package/extensions/talk-voice/index.ts +150 -0
- package/extensions/talk-voice/remoteclaw.plugin.json +10 -0
- package/extensions/telegram/index.ts +17 -0
- package/extensions/telegram/package.json +12 -0
- package/extensions/telegram/remoteclaw.plugin.json +9 -0
- package/extensions/telegram/src/channel.ts +569 -0
- package/extensions/telegram/src/runtime.ts +14 -0
- package/extensions/test-utils/runtime-env.ts +12 -0
- package/extensions/thread-ownership/index.ts +133 -0
- package/extensions/thread-ownership/remoteclaw.plugin.json +28 -0
- package/extensions/tlon/README.md +5 -0
- package/extensions/tlon/index.ts +17 -0
- package/extensions/tlon/package.json +29 -0
- package/extensions/tlon/remoteclaw.plugin.json +9 -0
- package/extensions/tlon/src/account-fields.ts +25 -0
- package/extensions/tlon/src/channel.ts +384 -0
- package/extensions/tlon/src/config-schema.ts +41 -0
- package/extensions/tlon/src/monitor/discovery.ts +78 -0
- package/extensions/tlon/src/monitor/history.ts +92 -0
- package/extensions/tlon/src/monitor/index.ts +591 -0
- package/extensions/tlon/src/monitor/processed-messages.ts +33 -0
- package/extensions/tlon/src/monitor/utils.ts +106 -0
- package/extensions/tlon/src/onboarding.ts +229 -0
- package/extensions/tlon/src/runtime.ts +14 -0
- package/extensions/tlon/src/targets.ts +89 -0
- package/extensions/tlon/src/types.ts +99 -0
- package/extensions/tlon/src/urbit/auth.ts +48 -0
- package/extensions/tlon/src/urbit/base-url.ts +57 -0
- package/extensions/tlon/src/urbit/channel-client.ts +158 -0
- package/extensions/tlon/src/urbit/channel-ops.ts +164 -0
- package/extensions/tlon/src/urbit/context.ts +47 -0
- package/extensions/tlon/src/urbit/errors.ts +51 -0
- package/extensions/tlon/src/urbit/fetch.ts +39 -0
- package/extensions/tlon/src/urbit/send.ts +131 -0
- package/extensions/tlon/src/urbit/sse-client.ts +431 -0
- package/extensions/twitch/CHANGELOG.md +39 -0
- package/extensions/twitch/README.md +89 -0
- package/extensions/twitch/index.ts +20 -0
- package/extensions/twitch/package.json +17 -0
- package/extensions/twitch/remoteclaw.plugin.json +9 -0
- package/extensions/twitch/src/access-control.ts +166 -0
- package/extensions/twitch/src/actions.ts +174 -0
- package/extensions/twitch/src/client-manager-registry.ts +115 -0
- package/extensions/twitch/src/config-schema.ts +84 -0
- package/extensions/twitch/src/config.ts +116 -0
- package/extensions/twitch/src/monitor.ts +273 -0
- package/extensions/twitch/src/onboarding.ts +417 -0
- package/extensions/twitch/src/outbound.ts +187 -0
- package/extensions/twitch/src/plugin.ts +274 -0
- package/extensions/twitch/src/probe.ts +119 -0
- package/extensions/twitch/src/resolver.ts +137 -0
- package/extensions/twitch/src/runtime.ts +14 -0
- package/extensions/twitch/src/send.ts +136 -0
- package/extensions/twitch/src/status.ts +179 -0
- package/extensions/twitch/src/test-fixtures.ts +30 -0
- package/extensions/twitch/src/token.ts +94 -0
- package/extensions/twitch/src/twitch-client.ts +277 -0
- package/extensions/twitch/src/types.ts +141 -0
- package/extensions/twitch/src/utils/markdown.ts +98 -0
- package/extensions/twitch/src/utils/twitch.ts +80 -0
- package/extensions/voice-call/CHANGELOG.md +49 -0
- package/extensions/voice-call/README.md +181 -0
- package/extensions/voice-call/index.ts +529 -0
- package/extensions/voice-call/package.json +16 -0
- package/extensions/voice-call/remoteclaw.plugin.json +559 -0
- package/extensions/voice-call/src/allowlist.ts +19 -0
- package/extensions/voice-call/src/cli.ts +380 -0
- package/extensions/voice-call/src/config.ts +477 -0
- package/extensions/voice-call/src/core-bridge.ts +170 -0
- package/extensions/voice-call/src/manager/context.ts +41 -0
- package/extensions/voice-call/src/manager/events.ts +242 -0
- package/extensions/voice-call/src/manager/lookup.ts +35 -0
- package/extensions/voice-call/src/manager/outbound.ts +380 -0
- package/extensions/voice-call/src/manager/state.ts +48 -0
- package/extensions/voice-call/src/manager/store.ts +94 -0
- package/extensions/voice-call/src/manager/timers.ts +112 -0
- package/extensions/voice-call/src/manager/twiml.ts +9 -0
- package/extensions/voice-call/src/manager.ts +209 -0
- package/extensions/voice-call/src/media-stream.ts +527 -0
- package/extensions/voice-call/src/providers/base.ts +67 -0
- package/extensions/voice-call/src/providers/index.ts +10 -0
- package/extensions/voice-call/src/providers/mock.ts +165 -0
- package/extensions/voice-call/src/providers/plivo.ts +560 -0
- package/extensions/voice-call/src/providers/stt-openai-realtime.ts +311 -0
- package/extensions/voice-call/src/providers/telnyx.ts +318 -0
- package/extensions/voice-call/src/providers/tts-openai.ts +259 -0
- package/extensions/voice-call/src/providers/twilio/api.ts +42 -0
- package/extensions/voice-call/src/providers/twilio/webhook.ts +33 -0
- package/extensions/voice-call/src/providers/twilio.ts +688 -0
- package/extensions/voice-call/src/response-generator.ts +174 -0
- package/extensions/voice-call/src/runtime.ts +217 -0
- package/extensions/voice-call/src/telephony-audio.ts +90 -0
- package/extensions/voice-call/src/telephony-tts.ts +106 -0
- package/extensions/voice-call/src/tunnel.ts +314 -0
- package/extensions/voice-call/src/types.ts +280 -0
- package/extensions/voice-call/src/utils.ts +14 -0
- package/extensions/voice-call/src/voice-mapping.ts +67 -0
- package/extensions/voice-call/src/webhook-security.ts +880 -0
- package/extensions/voice-call/src/webhook.ts +556 -0
- package/extensions/whatsapp/index.ts +17 -0
- package/extensions/whatsapp/package.json +12 -0
- package/extensions/whatsapp/remoteclaw.plugin.json +9 -0
- package/extensions/whatsapp/src/channel.ts +459 -0
- package/extensions/whatsapp/src/runtime.ts +14 -0
- package/extensions/zalo/CHANGELOG.md +29 -0
- package/extensions/zalo/README.md +50 -0
- package/extensions/zalo/index.ts +19 -0
- package/extensions/zalo/package.json +32 -0
- package/extensions/zalo/remoteclaw.plugin.json +9 -0
- package/extensions/zalo/src/accounts.ts +82 -0
- package/extensions/zalo/src/actions.ts +56 -0
- package/extensions/zalo/src/api.ts +208 -0
- package/extensions/zalo/src/channel.ts +398 -0
- package/extensions/zalo/src/config-schema.ts +27 -0
- package/extensions/zalo/src/group-access.ts +48 -0
- package/extensions/zalo/src/monitor.ts +675 -0
- package/extensions/zalo/src/monitor.webhook.ts +219 -0
- package/extensions/zalo/src/onboarding.ts +398 -0
- package/extensions/zalo/src/probe.ts +45 -0
- package/extensions/zalo/src/proxy.ts +24 -0
- package/extensions/zalo/src/runtime.ts +14 -0
- package/extensions/zalo/src/send.ts +124 -0
- package/extensions/zalo/src/status-issues.ts +53 -0
- package/extensions/zalo/src/token.ts +62 -0
- package/extensions/zalo/src/types.ts +48 -0
- package/extensions/zalouser/CHANGELOG.md +31 -0
- package/extensions/zalouser/README.md +225 -0
- package/extensions/zalouser/index.ts +31 -0
- package/extensions/zalouser/package.json +32 -0
- package/extensions/zalouser/remoteclaw.plugin.json +9 -0
- package/extensions/zalouser/src/accounts.ts +138 -0
- package/extensions/zalouser/src/channel.ts +652 -0
- package/extensions/zalouser/src/config-schema.ts +28 -0
- package/extensions/zalouser/src/monitor.ts +619 -0
- package/extensions/zalouser/src/onboarding.ts +428 -0
- package/extensions/zalouser/src/probe.ts +27 -0
- package/extensions/zalouser/src/runtime.ts +14 -0
- package/extensions/zalouser/src/send.ts +141 -0
- package/extensions/zalouser/src/status-issues.ts +89 -0
- package/extensions/zalouser/src/tool.ts +166 -0
- package/extensions/zalouser/src/types.ts +105 -0
- package/extensions/zalouser/src/zca.ts +198 -0
- package/package.json +250 -15
- package/remoteclaw.mjs +56 -0
- package/index.js +0 -4
|
@@ -0,0 +1,2614 @@
|
|
|
1
|
+
import { n as normalizeVerboseLevel } from "./thinking-4nOZPunr.js";
|
|
2
|
+
import { h as normalizeAnyChannelId } from "./subsystem-BAW_f3DI.js";
|
|
3
|
+
import { i as defaultRuntime } from "./ansi-DtaiOnt1.js";
|
|
4
|
+
import { h as normalizeAccountId, v as deriveSessionChatType } from "./session-key-CgKWfjoZ.js";
|
|
5
|
+
import { a as normalizeProviderId } from "./provider-utils-C9kBVF1f.js";
|
|
6
|
+
import { c as normalizeMessageChannel, n as isDeliverableMessageChannel, t as INTERNAL_MESSAGE_CHANNEL } from "./message-channel-CtcVHawF.js";
|
|
7
|
+
import { t as parseDiscordTarget } from "./targets-BpTQ50aN.js";
|
|
8
|
+
import { t as getChannelDock } from "./dock-Hf1acwVy.js";
|
|
9
|
+
import { a as isWhatsAppGroupJid, o as normalizeWhatsAppTarget, r as normalizeChannelId, t as getChannelPlugin } from "./plugins-Cjhc9NMf.js";
|
|
10
|
+
import { t as normalizeChatType } from "./chat-type-BP9akbag.js";
|
|
11
|
+
import { t as formatCliCommand } from "./command-format-Dntg_tnC.js";
|
|
12
|
+
import { t as SILENT_REPLY_TOKEN } from "./tokens-TtJJxzRr.js";
|
|
13
|
+
import { p as getGlobalHookRunner } from "./reply-payloads-DDrMOUKP.js";
|
|
14
|
+
import { t as parseSlackTarget } from "./targets-_UWmnyI9.js";
|
|
15
|
+
import { d as deliveryContextFromSession } from "./store-BmUyjVdV.js";
|
|
16
|
+
import { n as extensionForMime$1, t as detectMime } from "./mime-CAqaK3kp.js";
|
|
17
|
+
import { t as logDebug } from "./logger-ASsO5Nz-.js";
|
|
18
|
+
import { n as fetchRemoteMedia } from "./fetch-BMQq41sB.js";
|
|
19
|
+
import { i as resolveTelegramTargetChatType, r as parseTelegramTarget } from "./targets-BtGRUQMa.js";
|
|
20
|
+
import { n as missingTargetError } from "./target-errors-ChjvOMuV.js";
|
|
21
|
+
import { homedir, tmpdir } from "node:os";
|
|
22
|
+
import { join } from "node:path";
|
|
23
|
+
import { mkdir, mkdtemp, readFile, readdir, rm, rmdir, writeFile } from "node:fs/promises";
|
|
24
|
+
import { randomUUID } from "node:crypto";
|
|
25
|
+
import { execFileSync, spawn } from "node:child_process";
|
|
26
|
+
import { createInterface } from "node:readline";
|
|
27
|
+
|
|
28
|
+
//#region src/sessions/send-policy.ts
|
|
29
|
+
function normalizeSendPolicy(raw) {
|
|
30
|
+
const value = raw?.trim().toLowerCase();
|
|
31
|
+
if (value === "allow") return "allow";
|
|
32
|
+
if (value === "deny") return "deny";
|
|
33
|
+
}
|
|
34
|
+
function normalizeMatchValue(raw) {
|
|
35
|
+
const value = raw?.trim().toLowerCase();
|
|
36
|
+
return value ? value : void 0;
|
|
37
|
+
}
|
|
38
|
+
function stripAgentSessionKeyPrefix(key) {
|
|
39
|
+
if (!key) return;
|
|
40
|
+
const parts = key.split(":").filter(Boolean);
|
|
41
|
+
if (parts.length >= 3 && parts[0] === "agent") return parts.slice(2).join(":");
|
|
42
|
+
return key;
|
|
43
|
+
}
|
|
44
|
+
function deriveChannelFromKey(key) {
|
|
45
|
+
const normalizedKey = stripAgentSessionKeyPrefix(key);
|
|
46
|
+
if (!normalizedKey) return;
|
|
47
|
+
const parts = normalizedKey.split(":").filter(Boolean);
|
|
48
|
+
if (parts.length >= 3 && (parts[1] === "group" || parts[1] === "channel")) return normalizeMatchValue(parts[0]);
|
|
49
|
+
}
|
|
50
|
+
function deriveChatTypeFromKey(key) {
|
|
51
|
+
const chatType = deriveSessionChatType(key);
|
|
52
|
+
return chatType === "unknown" ? void 0 : chatType;
|
|
53
|
+
}
|
|
54
|
+
function resolveSendPolicy(params) {
|
|
55
|
+
const override = normalizeSendPolicy(params.entry?.sendPolicy);
|
|
56
|
+
if (override) return override;
|
|
57
|
+
const policy = params.cfg.session?.sendPolicy;
|
|
58
|
+
if (!policy) return "allow";
|
|
59
|
+
const channel = normalizeMatchValue(params.channel) ?? normalizeMatchValue(params.entry?.channel) ?? normalizeMatchValue(params.entry?.lastChannel) ?? deriveChannelFromKey(params.sessionKey);
|
|
60
|
+
const chatType = normalizeChatType(params.chatType ?? params.entry?.chatType) ?? normalizeChatType(deriveChatTypeFromKey(params.sessionKey));
|
|
61
|
+
const rawSessionKey = params.sessionKey ?? "";
|
|
62
|
+
const strippedSessionKey = stripAgentSessionKeyPrefix(rawSessionKey) ?? "";
|
|
63
|
+
const rawSessionKeyNorm = rawSessionKey.toLowerCase();
|
|
64
|
+
const strippedSessionKeyNorm = strippedSessionKey.toLowerCase();
|
|
65
|
+
let allowedMatch = false;
|
|
66
|
+
for (const rule of policy.rules ?? []) {
|
|
67
|
+
if (!rule) continue;
|
|
68
|
+
const action = normalizeSendPolicy(rule.action) ?? "allow";
|
|
69
|
+
const match = rule.match ?? {};
|
|
70
|
+
const matchChannel = normalizeMatchValue(match.channel);
|
|
71
|
+
const matchChatType = normalizeChatType(match.chatType);
|
|
72
|
+
const matchPrefix = normalizeMatchValue(match.keyPrefix);
|
|
73
|
+
const matchRawPrefix = normalizeMatchValue(match.rawKeyPrefix);
|
|
74
|
+
if (matchChannel && matchChannel !== channel) continue;
|
|
75
|
+
if (matchChatType && matchChatType !== chatType) continue;
|
|
76
|
+
if (matchRawPrefix && !rawSessionKeyNorm.startsWith(matchRawPrefix)) continue;
|
|
77
|
+
if (matchPrefix && !rawSessionKeyNorm.startsWith(matchPrefix) && !strippedSessionKeyNorm.startsWith(matchPrefix)) continue;
|
|
78
|
+
if (action === "deny") return "deny";
|
|
79
|
+
allowedMatch = true;
|
|
80
|
+
}
|
|
81
|
+
if (allowedMatch) return "allow";
|
|
82
|
+
return normalizeSendPolicy(policy.default) ?? "allow";
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/sessions/level-overrides.ts
|
|
87
|
+
function parseVerboseOverride(raw) {
|
|
88
|
+
if (raw === null) return {
|
|
89
|
+
ok: true,
|
|
90
|
+
value: null
|
|
91
|
+
};
|
|
92
|
+
if (raw === void 0) return {
|
|
93
|
+
ok: true,
|
|
94
|
+
value: void 0
|
|
95
|
+
};
|
|
96
|
+
if (typeof raw !== "string") return {
|
|
97
|
+
ok: false,
|
|
98
|
+
error: "invalid verboseLevel (use \"on\"|\"off\")"
|
|
99
|
+
};
|
|
100
|
+
const normalized = normalizeVerboseLevel(raw);
|
|
101
|
+
if (!normalized) return {
|
|
102
|
+
ok: false,
|
|
103
|
+
error: "invalid verboseLevel (use \"on\"|\"off\")"
|
|
104
|
+
};
|
|
105
|
+
return {
|
|
106
|
+
ok: true,
|
|
107
|
+
value: normalized
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function applyVerboseOverride(entry, level) {
|
|
111
|
+
if (level === void 0) return;
|
|
112
|
+
if (level === null) {
|
|
113
|
+
delete entry.verboseLevel;
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
entry.verboseLevel = level;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/infra/system-events.ts
|
|
121
|
+
const MAX_EVENTS = 20;
|
|
122
|
+
const queues = /* @__PURE__ */ new Map();
|
|
123
|
+
function requireSessionKey(key) {
|
|
124
|
+
const trimmed = typeof key === "string" ? key.trim() : "";
|
|
125
|
+
if (!trimmed) throw new Error("system events require a sessionKey");
|
|
126
|
+
return trimmed;
|
|
127
|
+
}
|
|
128
|
+
function normalizeContextKey(key) {
|
|
129
|
+
if (!key) return null;
|
|
130
|
+
const trimmed = key.trim();
|
|
131
|
+
if (!trimmed) return null;
|
|
132
|
+
return trimmed.toLowerCase();
|
|
133
|
+
}
|
|
134
|
+
function isSystemEventContextChanged(sessionKey, contextKey) {
|
|
135
|
+
const key = requireSessionKey(sessionKey);
|
|
136
|
+
const existing = queues.get(key);
|
|
137
|
+
return normalizeContextKey(contextKey) !== (existing?.lastContextKey ?? null);
|
|
138
|
+
}
|
|
139
|
+
function enqueueSystemEvent(text, options) {
|
|
140
|
+
const key = requireSessionKey(options?.sessionKey);
|
|
141
|
+
const entry = queues.get(key) ?? (() => {
|
|
142
|
+
const created = {
|
|
143
|
+
queue: [],
|
|
144
|
+
lastText: null,
|
|
145
|
+
lastContextKey: null
|
|
146
|
+
};
|
|
147
|
+
queues.set(key, created);
|
|
148
|
+
return created;
|
|
149
|
+
})();
|
|
150
|
+
const cleaned = text.trim();
|
|
151
|
+
if (!cleaned) return;
|
|
152
|
+
const normalizedContextKey = normalizeContextKey(options?.contextKey);
|
|
153
|
+
entry.lastContextKey = normalizedContextKey;
|
|
154
|
+
if (entry.lastText === cleaned) return;
|
|
155
|
+
entry.lastText = cleaned;
|
|
156
|
+
entry.queue.push({
|
|
157
|
+
text: cleaned,
|
|
158
|
+
ts: Date.now(),
|
|
159
|
+
contextKey: normalizedContextKey
|
|
160
|
+
});
|
|
161
|
+
if (entry.queue.length > MAX_EVENTS) entry.queue.shift();
|
|
162
|
+
}
|
|
163
|
+
function drainSystemEventEntries(sessionKey) {
|
|
164
|
+
const key = requireSessionKey(sessionKey);
|
|
165
|
+
const entry = queues.get(key);
|
|
166
|
+
if (!entry || entry.queue.length === 0) return [];
|
|
167
|
+
const out = entry.queue.slice();
|
|
168
|
+
entry.queue.length = 0;
|
|
169
|
+
entry.lastText = null;
|
|
170
|
+
entry.lastContextKey = null;
|
|
171
|
+
queues.delete(key);
|
|
172
|
+
return out;
|
|
173
|
+
}
|
|
174
|
+
function peekSystemEventEntries(sessionKey) {
|
|
175
|
+
const key = requireSessionKey(sessionKey);
|
|
176
|
+
return queues.get(key)?.queue.map((event) => ({ ...event })) ?? [];
|
|
177
|
+
}
|
|
178
|
+
function peekSystemEvents(sessionKey) {
|
|
179
|
+
return peekSystemEventEntries(sessionKey).map((event) => event.text);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/agents/channel-tools.ts
|
|
184
|
+
/**
|
|
185
|
+
* Get the list of supported message actions for a specific channel.
|
|
186
|
+
* Returns an empty array if channel is not found or has no actions configured.
|
|
187
|
+
*/
|
|
188
|
+
function listChannelSupportedActions(params) {
|
|
189
|
+
if (!params.channel) return [];
|
|
190
|
+
const plugin = getChannelPlugin(params.channel);
|
|
191
|
+
if (!plugin?.actions?.listActions) return [];
|
|
192
|
+
return runPluginListActions(plugin, params.cfg ?? {});
|
|
193
|
+
}
|
|
194
|
+
function resolveChannelMessageToolHints(params) {
|
|
195
|
+
const channelId = normalizeAnyChannelId(params.channel);
|
|
196
|
+
if (!channelId) return [];
|
|
197
|
+
const resolve = getChannelDock(channelId)?.agentPrompt?.messageToolHints;
|
|
198
|
+
if (!resolve) return [];
|
|
199
|
+
return (resolve({
|
|
200
|
+
cfg: params.cfg ?? {},
|
|
201
|
+
accountId: params.accountId
|
|
202
|
+
}) ?? []).map((entry) => entry.trim()).filter(Boolean);
|
|
203
|
+
}
|
|
204
|
+
const loggedListActionErrors = /* @__PURE__ */ new Set();
|
|
205
|
+
function runPluginListActions(plugin, cfg) {
|
|
206
|
+
if (!plugin.actions?.listActions) return [];
|
|
207
|
+
try {
|
|
208
|
+
const listed = plugin.actions.listActions({ cfg });
|
|
209
|
+
return Array.isArray(listed) ? listed : [];
|
|
210
|
+
} catch (err) {
|
|
211
|
+
logListActionsError(plugin.id, err);
|
|
212
|
+
return [];
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function logListActionsError(pluginId, err) {
|
|
216
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
217
|
+
const key = `${pluginId}:${message}`;
|
|
218
|
+
if (loggedListActionErrors.has(key)) return;
|
|
219
|
+
loggedListActionErrors.add(key);
|
|
220
|
+
const details = (err instanceof Error && err.stack ? err.stack : null) ?? message;
|
|
221
|
+
defaultRuntime.error?.(`[channel-tools] ${pluginId}.actions.listActions failed: ${details}`);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/middleware/error-classifier.ts
|
|
226
|
+
const retryablePatterns = [
|
|
227
|
+
/rate.?limit/i,
|
|
228
|
+
/429/i,
|
|
229
|
+
/503/i,
|
|
230
|
+
/overloaded/i,
|
|
231
|
+
/ETIMEDOUT/i,
|
|
232
|
+
/ECONNRESET/i,
|
|
233
|
+
/ECONNREFUSED/i,
|
|
234
|
+
/network/i
|
|
235
|
+
];
|
|
236
|
+
const contextOverflowPatterns = [
|
|
237
|
+
/context.?length/i,
|
|
238
|
+
/context.?window/i,
|
|
239
|
+
/context.?overflow/i,
|
|
240
|
+
/too many tokens/i,
|
|
241
|
+
/maximum context/i,
|
|
242
|
+
/token.?limit/i
|
|
243
|
+
];
|
|
244
|
+
const fatalAuthPatterns = [
|
|
245
|
+
/401/i,
|
|
246
|
+
/403/i,
|
|
247
|
+
/unauthorized/i,
|
|
248
|
+
/forbidden/i,
|
|
249
|
+
/invalid.?key/i,
|
|
250
|
+
/authentication/i
|
|
251
|
+
];
|
|
252
|
+
/**
|
|
253
|
+
* Rate-limit and auth failure patterns that may benefit from key rotation.
|
|
254
|
+
*
|
|
255
|
+
* Includes rate-limit indicators (429, quota) and auth failures
|
|
256
|
+
* (401, invalid key) — a different API key might succeed in either case.
|
|
257
|
+
*/
|
|
258
|
+
const authRotatablePatterns = [
|
|
259
|
+
/rate.?limit/i,
|
|
260
|
+
/\b429\b/,
|
|
261
|
+
/quota.?exceeded/i,
|
|
262
|
+
/resource.?exhausted/i,
|
|
263
|
+
/too many requests/i,
|
|
264
|
+
/\b401\b/,
|
|
265
|
+
/unauthorized/i,
|
|
266
|
+
/invalid.?key/i
|
|
267
|
+
];
|
|
268
|
+
/**
|
|
269
|
+
* Test whether an error message indicates a rate-limit or auth failure
|
|
270
|
+
* that could be resolved by rotating to a different API key.
|
|
271
|
+
*/
|
|
272
|
+
function isAuthRotatableError(message) {
|
|
273
|
+
return authRotatablePatterns.some((pattern) => pattern.test(message));
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Classify an error message string into an actionable category.
|
|
277
|
+
*
|
|
278
|
+
* Uses first-match-wins semantics across ordered pattern arrays:
|
|
279
|
+
* 1. Retryable patterns checked first
|
|
280
|
+
* 2. Context overflow patterns checked second
|
|
281
|
+
* 3. Fatal auth patterns checked third
|
|
282
|
+
* 4. Default: "fatal" for unmatched messages
|
|
283
|
+
*
|
|
284
|
+
* Case-insensitive matching throughout.
|
|
285
|
+
*/
|
|
286
|
+
function classifyError(message) {
|
|
287
|
+
for (const pattern of retryablePatterns) if (pattern.test(message)) {
|
|
288
|
+
logDebug(`[error-classifier] classified as retryable: ${message.slice(0, 200)}`);
|
|
289
|
+
return "retryable";
|
|
290
|
+
}
|
|
291
|
+
for (const pattern of contextOverflowPatterns) if (pattern.test(message)) {
|
|
292
|
+
logDebug(`[error-classifier] classified as context_overflow: ${message.slice(0, 200)}`);
|
|
293
|
+
return "context_overflow";
|
|
294
|
+
}
|
|
295
|
+
for (const pattern of fatalAuthPatterns) if (pattern.test(message)) {
|
|
296
|
+
logDebug(`[error-classifier] classified as fatal (auth): ${message.slice(0, 200)}`);
|
|
297
|
+
return "fatal";
|
|
298
|
+
}
|
|
299
|
+
logDebug(`[error-classifier] classified as fatal (unmatched): ${message.slice(0, 200)}`);
|
|
300
|
+
return "fatal";
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
//#endregion
|
|
304
|
+
//#region src/middleware/delivery-adapter.ts
|
|
305
|
+
const DEFAULT_CHUNK_LIMIT = 4e3;
|
|
306
|
+
/**
|
|
307
|
+
* Converts AgentEvent async iterable into channel-deliverable ReplyPayload chunks.
|
|
308
|
+
*
|
|
309
|
+
* Handles:
|
|
310
|
+
* - Text accumulation and chunking at channel limits
|
|
311
|
+
* - Progressive streaming via BridgeCallbacks
|
|
312
|
+
* - Tool result formatting
|
|
313
|
+
* - Error event formatting
|
|
314
|
+
*/
|
|
315
|
+
var DeliveryAdapter = class {
|
|
316
|
+
constructor(options) {
|
|
317
|
+
this.chunkLimit = options?.chunkLimit ?? DEFAULT_CHUNK_LIMIT;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Process an event stream, invoking callbacks for real-time delivery
|
|
321
|
+
* and returning final payloads for post-execution delivery.
|
|
322
|
+
*
|
|
323
|
+
* @param events - AgentEvent async iterable from runtime.execute()
|
|
324
|
+
* @param callbacks - Optional streaming callbacks for real-time delivery
|
|
325
|
+
* @returns Final ReplyPayload array for post-execution delivery
|
|
326
|
+
*/
|
|
327
|
+
async process(events, callbacks) {
|
|
328
|
+
let textBuffer = "";
|
|
329
|
+
const payloads = [];
|
|
330
|
+
/** Track media delivered via streaming events to avoid duplicates from result.media. */
|
|
331
|
+
const deliveredMediaKeys = /* @__PURE__ */ new Set();
|
|
332
|
+
let eventCount = 0;
|
|
333
|
+
for await (const event of events) {
|
|
334
|
+
eventCount++;
|
|
335
|
+
switch (event.type) {
|
|
336
|
+
case "text":
|
|
337
|
+
if (event.text === "") break;
|
|
338
|
+
textBuffer += event.text;
|
|
339
|
+
while (textBuffer.length > this.chunkLimit) {
|
|
340
|
+
const { chunk, rest } = splitAtBoundary(textBuffer, this.chunkLimit);
|
|
341
|
+
textBuffer = rest;
|
|
342
|
+
const payload = { text: chunk };
|
|
343
|
+
payloads.push(payload);
|
|
344
|
+
await callbacks?.onPartialReply?.(payload);
|
|
345
|
+
}
|
|
346
|
+
break;
|
|
347
|
+
case "media": {
|
|
348
|
+
const mediaUrl = event.media.filePath ?? event.media.sourceUrl;
|
|
349
|
+
if (mediaUrl) {
|
|
350
|
+
if (textBuffer.length > 0) {
|
|
351
|
+
const textPayload = { text: textBuffer };
|
|
352
|
+
payloads.push(textPayload);
|
|
353
|
+
await callbacks?.onBlockReply?.(textPayload);
|
|
354
|
+
textBuffer = "";
|
|
355
|
+
}
|
|
356
|
+
deliveredMediaKeys.add(mediaUrl);
|
|
357
|
+
const payload = { mediaUrl };
|
|
358
|
+
payloads.push(payload);
|
|
359
|
+
await callbacks?.onBlockReply?.(payload);
|
|
360
|
+
}
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
case "thinking":
|
|
364
|
+
if (event.text) callbacks?.onThinking?.({ text: event.text });
|
|
365
|
+
break;
|
|
366
|
+
case "tool_use": break;
|
|
367
|
+
case "tool_result": {
|
|
368
|
+
const payload = { text: formatToolResult(event.toolId, event.output, event.isError) };
|
|
369
|
+
await callbacks?.onToolResult?.(payload);
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
case "error": {
|
|
373
|
+
const payload = {
|
|
374
|
+
text: event.code ? `[${event.code}] ${event.message}` : event.message,
|
|
375
|
+
isError: true
|
|
376
|
+
};
|
|
377
|
+
payloads.push(payload);
|
|
378
|
+
await callbacks?.onBlockReply?.(payload);
|
|
379
|
+
break;
|
|
380
|
+
}
|
|
381
|
+
case "done":
|
|
382
|
+
if (textBuffer.length > 0) {
|
|
383
|
+
const payload = { text: textBuffer };
|
|
384
|
+
payloads.push(payload);
|
|
385
|
+
await callbacks?.onBlockReply?.(payload);
|
|
386
|
+
textBuffer = "";
|
|
387
|
+
}
|
|
388
|
+
if (event.result.media?.length) for (const media of event.result.media) {
|
|
389
|
+
const url = media.filePath ?? media.sourceUrl;
|
|
390
|
+
if (url && !deliveredMediaKeys.has(url)) {
|
|
391
|
+
const payload = { mediaUrl: url };
|
|
392
|
+
payloads.push(payload);
|
|
393
|
+
await callbacks?.onBlockReply?.(payload);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
break;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (textBuffer.length > 0) {
|
|
400
|
+
const payload = { text: textBuffer };
|
|
401
|
+
payloads.push(payload);
|
|
402
|
+
}
|
|
403
|
+
logDebug(`[delivery-adapter] processed ${eventCount} events into ${payloads.length} payloads (chunkLimit=${this.chunkLimit})`);
|
|
404
|
+
return payloads;
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
/** Format a tool result for display. */
|
|
408
|
+
function formatToolResult(toolId, output, isError) {
|
|
409
|
+
return `${isError ? `Tool ${toolId} error` : `Tool ${toolId} result`}: ${output}`;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Split text at the nearest safe boundary before the limit.
|
|
413
|
+
*
|
|
414
|
+
* Preference order:
|
|
415
|
+
* 1. Paragraph break (\n\n)
|
|
416
|
+
* 2. Line break (\n)
|
|
417
|
+
* 3. Word boundary (space)
|
|
418
|
+
* 4. Hard split at limit
|
|
419
|
+
*
|
|
420
|
+
* Markdown-aware: preserves code fence boundaries by closing/reopening
|
|
421
|
+
* fences at split points when a split occurs inside a fenced code block.
|
|
422
|
+
*/
|
|
423
|
+
function splitAtBoundary(text, limit) {
|
|
424
|
+
const fenceInfo = findOpenCodeFence(text, limit);
|
|
425
|
+
if (fenceInfo !== void 0) {
|
|
426
|
+
const beforeFence = text.substring(0, fenceInfo.fenceStart);
|
|
427
|
+
if (beforeFence.trimEnd().length > 0) {
|
|
428
|
+
const trimmed = beforeFence.trimEnd();
|
|
429
|
+
return {
|
|
430
|
+
chunk: trimmed,
|
|
431
|
+
rest: text.substring(trimmed.length).trimStart()
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
const closingFence = `\n${fenceInfo.fence}`;
|
|
435
|
+
const openingFence = `${fenceInfo.fence}\n`;
|
|
436
|
+
const splitPoint = findSplitPoint(text, limit - closingFence.length);
|
|
437
|
+
return {
|
|
438
|
+
chunk: text.substring(0, splitPoint) + closingFence,
|
|
439
|
+
rest: openingFence + text.substring(splitPoint)
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
const splitPoint = findSplitPoint(text, limit);
|
|
443
|
+
return {
|
|
444
|
+
chunk: text.substring(0, splitPoint),
|
|
445
|
+
rest: text.substring(splitPoint)
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
/** Find the best split point within the text up to the given limit. */
|
|
449
|
+
function findSplitPoint(text, limit) {
|
|
450
|
+
if (limit <= 0) return Math.min(1, text.length);
|
|
451
|
+
const searchRegion = text.substring(0, limit);
|
|
452
|
+
const paragraphIdx = searchRegion.lastIndexOf("\n\n");
|
|
453
|
+
if (paragraphIdx > 0) return paragraphIdx + 2;
|
|
454
|
+
const lineIdx = searchRegion.lastIndexOf("\n");
|
|
455
|
+
if (lineIdx > 0) return lineIdx + 1;
|
|
456
|
+
const spaceIdx = searchRegion.lastIndexOf(" ");
|
|
457
|
+
if (spaceIdx > 0) return spaceIdx + 1;
|
|
458
|
+
return limit;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Detect if the text has an unclosed code fence at or before the limit position.
|
|
462
|
+
* Returns info about the open fence, or undefined if no open fence.
|
|
463
|
+
*/
|
|
464
|
+
function findOpenCodeFence(text, limit) {
|
|
465
|
+
const fenceRegex = /^(`{3,}|~{3,})/gm;
|
|
466
|
+
let openFence;
|
|
467
|
+
let match;
|
|
468
|
+
while ((match = fenceRegex.exec(text)) !== null) {
|
|
469
|
+
if (match.index >= limit) break;
|
|
470
|
+
if (openFence === void 0) openFence = {
|
|
471
|
+
fenceStart: match.index,
|
|
472
|
+
fence: match[1]
|
|
473
|
+
};
|
|
474
|
+
else if (match[1].charAt(0) === openFence.fence.charAt(0) && match[1].length >= openFence.fence.length) openFence = void 0;
|
|
475
|
+
}
|
|
476
|
+
return openFence;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
//#endregion
|
|
480
|
+
//#region src/middleware/mcp-side-effects.ts
|
|
481
|
+
async function readMcpSideEffects(filePath) {
|
|
482
|
+
const result = {
|
|
483
|
+
sentTexts: [],
|
|
484
|
+
sentMediaUrls: [],
|
|
485
|
+
sentTargets: [],
|
|
486
|
+
cronAdds: 0
|
|
487
|
+
};
|
|
488
|
+
let content;
|
|
489
|
+
try {
|
|
490
|
+
content = await readFile(filePath, "utf-8");
|
|
491
|
+
} catch {
|
|
492
|
+
return result;
|
|
493
|
+
}
|
|
494
|
+
const lines = content.split("\n").filter(Boolean);
|
|
495
|
+
for (const line of lines) {
|
|
496
|
+
let record;
|
|
497
|
+
try {
|
|
498
|
+
record = JSON.parse(line);
|
|
499
|
+
} catch {
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
502
|
+
if (record.type === "message_sent") {
|
|
503
|
+
result.sentTexts.push(record.text);
|
|
504
|
+
if (record.mediaUrl) result.sentMediaUrls.push(record.mediaUrl);
|
|
505
|
+
const target = {
|
|
506
|
+
tool: record.tool,
|
|
507
|
+
provider: record.provider,
|
|
508
|
+
...record.accountId ? { accountId: record.accountId } : {},
|
|
509
|
+
...record.to ? { to: record.to } : {}
|
|
510
|
+
};
|
|
511
|
+
result.sentTargets.push(target);
|
|
512
|
+
} else if (record.type === "cron_added") result.cronAdds += 1;
|
|
513
|
+
else if (record.type === "heartbeat_report") result.heartbeatReport = {
|
|
514
|
+
anythingDone: record.anythingDone,
|
|
515
|
+
summary: record.summary
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
return result;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
//#endregion
|
|
522
|
+
//#region src/middleware/media-capability.ts
|
|
523
|
+
/**
|
|
524
|
+
* Partition media attachments by whether the runtime accepts them.
|
|
525
|
+
*
|
|
526
|
+
* If the runtime does not declare `mediaCapabilities` at all, all media is
|
|
527
|
+
* treated as supported (backwards-compatible — the runtime decides what to do).
|
|
528
|
+
*/
|
|
529
|
+
function partitionMedia(runtime, media) {
|
|
530
|
+
const prefixes = runtime.mediaCapabilities?.acceptsInbound;
|
|
531
|
+
if (prefixes === void 0) return {
|
|
532
|
+
supported: media,
|
|
533
|
+
unsupported: []
|
|
534
|
+
};
|
|
535
|
+
const supported = [];
|
|
536
|
+
const unsupported = [];
|
|
537
|
+
for (const attachment of media) if (prefixes.some((prefix) => attachment.mimeType.startsWith(prefix))) supported.push(attachment);
|
|
538
|
+
else unsupported.push(attachment);
|
|
539
|
+
return {
|
|
540
|
+
supported,
|
|
541
|
+
unsupported
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Format a user-facing warning for media the runtime cannot handle.
|
|
546
|
+
*
|
|
547
|
+
* Returns `undefined` when there are no unsupported attachments.
|
|
548
|
+
*/
|
|
549
|
+
function formatUnsupportedMediaWarning(unsupported, runtimeName) {
|
|
550
|
+
if (unsupported.length === 0) return;
|
|
551
|
+
const typeSummary = summarizeMediaTypes(unsupported);
|
|
552
|
+
const runtimeLabel = runtimeName.toLowerCase();
|
|
553
|
+
if (unsupported.length === 1) return `\u26a0\ufe0f Your ${typeSummary} was received but the current runtime (${runtimeLabel}) doesn't support ${typeSummary} input. Its content was not included in the conversation.`;
|
|
554
|
+
return `\u26a0\ufe0f ${unsupported.length} media attachments were received but the current runtime (${runtimeLabel}) doesn't support them: ${typeSummary}. Their content was not included in the conversation.`;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Produce a human-readable summary of MIME type categories.
|
|
558
|
+
*
|
|
559
|
+
* Groups by top-level type (image, audio, video) and deduplicates.
|
|
560
|
+
* Falls back to "media" for unknown types.
|
|
561
|
+
*/
|
|
562
|
+
function summarizeMediaTypes(attachments) {
|
|
563
|
+
const categories = /* @__PURE__ */ new Set();
|
|
564
|
+
for (const a of attachments) switch (a.mimeType.split("/")[0]) {
|
|
565
|
+
case "image":
|
|
566
|
+
categories.add("image");
|
|
567
|
+
break;
|
|
568
|
+
case "audio":
|
|
569
|
+
categories.add("audio");
|
|
570
|
+
break;
|
|
571
|
+
case "video":
|
|
572
|
+
categories.add("video");
|
|
573
|
+
break;
|
|
574
|
+
default:
|
|
575
|
+
categories.add("media");
|
|
576
|
+
break;
|
|
577
|
+
}
|
|
578
|
+
return [...categories].toSorted().join("/");
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
//#endregion
|
|
582
|
+
//#region src/middleware/media-resolver.ts
|
|
583
|
+
/** Max download size for inbound channel media (100 MB). */
|
|
584
|
+
const MAX_INBOUND_MEDIA_BYTES = 100 * 1024 * 1024;
|
|
585
|
+
/**
|
|
586
|
+
* Resolve an array of media URLs (HTTP or local paths) into MediaAttachment
|
|
587
|
+
* objects suitable for passing to {@link AgentRuntime.execute}.
|
|
588
|
+
*
|
|
589
|
+
* Remote URLs are downloaded into `tempDir` so that CLI runtimes can access
|
|
590
|
+
* them as local files. Local paths are validated for MIME type only.
|
|
591
|
+
*
|
|
592
|
+
* Individual resolution failures are silently skipped — a single bad URL
|
|
593
|
+
* should not prevent the rest of the message from being processed.
|
|
594
|
+
*/
|
|
595
|
+
async function resolveMediaAttachments(mediaUrls, tempDir) {
|
|
596
|
+
const results = [];
|
|
597
|
+
for (const [index, url] of mediaUrls.entries()) try {
|
|
598
|
+
const attachment = await resolveOne(url, tempDir, index);
|
|
599
|
+
if (attachment) {
|
|
600
|
+
logDebug(`[media-resolver] resolved: url=${url} mime=${attachment.mimeType} path=${attachment.filePath}`);
|
|
601
|
+
results.push(attachment);
|
|
602
|
+
}
|
|
603
|
+
} catch (err) {
|
|
604
|
+
logDebug(`[media-resolver] failed: url=${url} error=${String(err)}`);
|
|
605
|
+
}
|
|
606
|
+
return results;
|
|
607
|
+
}
|
|
608
|
+
async function resolveOne(url, tempDir, index) {
|
|
609
|
+
if (/^https?:\/\//i.test(url)) return downloadRemote(url, tempDir, index);
|
|
610
|
+
return resolveLocal(url);
|
|
611
|
+
}
|
|
612
|
+
async function downloadRemote(url, tempDir, index) {
|
|
613
|
+
const fetched = await fetchRemoteMedia({
|
|
614
|
+
url,
|
|
615
|
+
maxBytes: MAX_INBOUND_MEDIA_BYTES
|
|
616
|
+
});
|
|
617
|
+
const mimeType = fetched.contentType ?? "application/octet-stream";
|
|
618
|
+
const fileName = `inbound-media-${index}${extensionForMime$1(mimeType) ?? ""}`;
|
|
619
|
+
const filePath = join(tempDir, fileName);
|
|
620
|
+
await writeFile(filePath, fetched.buffer);
|
|
621
|
+
return {
|
|
622
|
+
mimeType,
|
|
623
|
+
filePath,
|
|
624
|
+
sourceUrl: url,
|
|
625
|
+
fileName: fetched.fileName ?? fileName
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
async function resolveLocal(filePath) {
|
|
629
|
+
return {
|
|
630
|
+
mimeType: await detectMime({ filePath }) ?? "application/octet-stream",
|
|
631
|
+
filePath
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
//#endregion
|
|
636
|
+
//#region src/middleware/cli-runtime-base.ts
|
|
637
|
+
/**
|
|
638
|
+
* Abstract base class encapsulating shared subprocess machinery for CLI-based agent runtimes.
|
|
639
|
+
*
|
|
640
|
+
* Concrete runtimes (Claude, Gemini, Codex, OpenCode) extend this and implement only
|
|
641
|
+
* the CLI-specific parts: argument construction, event extraction, and environment setup.
|
|
642
|
+
*/
|
|
643
|
+
var CLIRuntimeBase = class CLIRuntimeBase {
|
|
644
|
+
static {
|
|
645
|
+
this.STDIN_PROMPT_THRESHOLD = 1e4;
|
|
646
|
+
}
|
|
647
|
+
constructor(command, timeoutMs = 3e5) {
|
|
648
|
+
this.command = command;
|
|
649
|
+
this.timeoutMs = timeoutMs;
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Compose the full prompt from structured parts (system + extra context + user).
|
|
653
|
+
* Runtimes that support separate system prompt delivery (e.g. Claude) should
|
|
654
|
+
* override or bypass this and handle the parts individually.
|
|
655
|
+
*/
|
|
656
|
+
composePrompt(params) {
|
|
657
|
+
let composed = "";
|
|
658
|
+
if (params.systemPrompt) composed += params.systemPrompt;
|
|
659
|
+
if (params.extraContext) composed += (composed ? "\n\n" : "") + params.extraContext;
|
|
660
|
+
if (params.threadContext && !params.sessionId) composed += (composed ? "\n\n" : "") + params.threadContext;
|
|
661
|
+
composed += (composed ? "\n\n" : "") + params.prompt;
|
|
662
|
+
return composed;
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Construct a custom stdin payload for the subprocess.
|
|
666
|
+
* When this returns a string, it is written to stdin instead of
|
|
667
|
+
* the default large-prompt fallback. Subclasses may override.
|
|
668
|
+
*/
|
|
669
|
+
buildStdinPayload(_params) {}
|
|
670
|
+
/** Whether this CLI accepts prompts via stdin. Subclasses may override. */
|
|
671
|
+
get supportsStdinPrompt() {
|
|
672
|
+
return true;
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Which subprocess stream carries NDJSON output.
|
|
676
|
+
* Defaults to `"stdout"`. Override to `"stderr"` for CLIs (like Claude)
|
|
677
|
+
* that emit structured output on stderr.
|
|
678
|
+
*/
|
|
679
|
+
get ndjsonStream() {
|
|
680
|
+
return "stdout";
|
|
681
|
+
}
|
|
682
|
+
async *execute(params) {
|
|
683
|
+
const args = this.buildArgs(params);
|
|
684
|
+
if (params.extraArgs && params.extraArgs.length > 0) args.push(...params.extraArgs);
|
|
685
|
+
const runtimeEnv = this.buildEnv(params);
|
|
686
|
+
const callerEnv = params.env ?? {};
|
|
687
|
+
const env = {
|
|
688
|
+
...process.env,
|
|
689
|
+
...runtimeEnv,
|
|
690
|
+
...callerEnv
|
|
691
|
+
};
|
|
692
|
+
logDebug(`[agent-runtime] spawn: ${this.command} ${args.map((a) => JSON.stringify(a)).join(" ")}`);
|
|
693
|
+
logDebug(`[agent-runtime] cwd: ${params.workingDirectory ?? process.cwd()}`);
|
|
694
|
+
if (Object.keys(runtimeEnv).length > 0) logDebug(`[agent-runtime] runtime env keys: ${Object.keys(runtimeEnv).join(", ")}`);
|
|
695
|
+
if (Object.keys(callerEnv).length > 0) logDebug(`[agent-runtime] caller env keys: ${Object.keys(callerEnv).join(", ")}`);
|
|
696
|
+
const child = spawn(this.command, args, {
|
|
697
|
+
cwd: params.workingDirectory,
|
|
698
|
+
env,
|
|
699
|
+
stdio: [
|
|
700
|
+
"pipe",
|
|
701
|
+
"pipe",
|
|
702
|
+
"pipe"
|
|
703
|
+
]
|
|
704
|
+
});
|
|
705
|
+
logDebug(`[agent-runtime] spawned pid=${child.pid}`);
|
|
706
|
+
const startMs = Date.now();
|
|
707
|
+
const stderrChunks = [];
|
|
708
|
+
let aborted = false;
|
|
709
|
+
let yieldedEvents = false;
|
|
710
|
+
let escalationTimer;
|
|
711
|
+
const killWithEscalation = () => {
|
|
712
|
+
if (escalationTimer === void 0) escalationTimer = setTimeout(() => {
|
|
713
|
+
try {
|
|
714
|
+
child.kill("SIGKILL");
|
|
715
|
+
} catch {}
|
|
716
|
+
}, 1500);
|
|
717
|
+
child.kill("SIGTERM");
|
|
718
|
+
};
|
|
719
|
+
child.on("exit", () => {
|
|
720
|
+
if (escalationTimer !== void 0) {
|
|
721
|
+
clearTimeout(escalationTimer);
|
|
722
|
+
escalationTimer = void 0;
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
let startupTimer;
|
|
726
|
+
let startupTimedOut = false;
|
|
727
|
+
startupTimer = setTimeout(() => {
|
|
728
|
+
startupTimedOut = true;
|
|
729
|
+
logDebug(`[agent-runtime] pid=${child.pid}: startup timeout — no output within ${this.timeoutMs}ms`);
|
|
730
|
+
killWithEscalation();
|
|
731
|
+
}, this.timeoutMs);
|
|
732
|
+
const ndjsonSource = this.ndjsonStream === "stderr" ? child.stderr : child.stdout;
|
|
733
|
+
(this.ndjsonStream === "stderr" ? child.stdout : child.stderr)?.on("data", (chunk) => {
|
|
734
|
+
stderrChunks.push(chunk.toString());
|
|
735
|
+
});
|
|
736
|
+
const rl = createInterface({ input: ndjsonSource });
|
|
737
|
+
const eventQueue = [];
|
|
738
|
+
let resolveNext;
|
|
739
|
+
let streamDone = false;
|
|
740
|
+
const enqueue = (event) => {
|
|
741
|
+
eventQueue.push(event);
|
|
742
|
+
resolveNext?.();
|
|
743
|
+
};
|
|
744
|
+
rl.on("line", (line) => {
|
|
745
|
+
if (startupTimer !== void 0) {
|
|
746
|
+
clearTimeout(startupTimer);
|
|
747
|
+
startupTimer = void 0;
|
|
748
|
+
}
|
|
749
|
+
if (!line.trim()) return;
|
|
750
|
+
try {
|
|
751
|
+
JSON.parse(line);
|
|
752
|
+
} catch {
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
const event = this.extractEvent(line);
|
|
756
|
+
if (event) enqueue(event);
|
|
757
|
+
});
|
|
758
|
+
rl.on("close", () => {
|
|
759
|
+
streamDone = true;
|
|
760
|
+
enqueue(null);
|
|
761
|
+
});
|
|
762
|
+
const exitPromise = new Promise((resolve) => {
|
|
763
|
+
child.on("exit", (code, signal) => {
|
|
764
|
+
resolve({
|
|
765
|
+
code,
|
|
766
|
+
signal
|
|
767
|
+
});
|
|
768
|
+
});
|
|
769
|
+
});
|
|
770
|
+
const customStdin = this.buildStdinPayload(params);
|
|
771
|
+
if (customStdin !== void 0 && child.stdin) {
|
|
772
|
+
logDebug(`[agent-runtime] pid=${child.pid}: delivering custom stdin payload (${customStdin.length} chars)`);
|
|
773
|
+
child.stdin.write(customStdin);
|
|
774
|
+
} else if (this.supportsStdinPrompt && child.stdin) {
|
|
775
|
+
const composedPrompt = this.composePrompt(params);
|
|
776
|
+
if (composedPrompt.length > CLIRuntimeBase.STDIN_PROMPT_THRESHOLD) {
|
|
777
|
+
logDebug(`[agent-runtime] pid=${child.pid}: delivering prompt via stdin (${composedPrompt.length} chars)`);
|
|
778
|
+
child.stdin.write(composedPrompt);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
child.stdin?.end();
|
|
782
|
+
const onAbort = () => {
|
|
783
|
+
aborted = true;
|
|
784
|
+
logDebug(`[agent-runtime] pid=${child.pid}: abort signal received`);
|
|
785
|
+
killWithEscalation();
|
|
786
|
+
};
|
|
787
|
+
if (params.abortSignal) if (params.abortSignal.aborted) {
|
|
788
|
+
aborted = true;
|
|
789
|
+
killWithEscalation();
|
|
790
|
+
} else params.abortSignal.addEventListener("abort", onAbort, { once: true });
|
|
791
|
+
try {
|
|
792
|
+
while (!streamDone) {
|
|
793
|
+
if (eventQueue.length === 0) await new Promise((resolve) => {
|
|
794
|
+
resolveNext = resolve;
|
|
795
|
+
});
|
|
796
|
+
while (eventQueue.length > 0) {
|
|
797
|
+
const event = eventQueue.shift();
|
|
798
|
+
if (event === null || event === void 0) break;
|
|
799
|
+
yieldedEvents = true;
|
|
800
|
+
yield event;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
} finally {
|
|
804
|
+
if (startupTimer !== void 0) clearTimeout(startupTimer);
|
|
805
|
+
params.abortSignal?.removeEventListener("abort", onAbort);
|
|
806
|
+
}
|
|
807
|
+
const { code: exitCode, signal: exitSignal } = await exitPromise;
|
|
808
|
+
if (escalationTimer !== void 0) clearTimeout(escalationTimer);
|
|
809
|
+
const durationMs = Date.now() - startMs;
|
|
810
|
+
logDebug(`[agent-runtime] pid=${child.pid}: exited code=${exitCode} signal=${exitSignal} duration=${durationMs}ms`);
|
|
811
|
+
const stderr = stderrChunks.join("");
|
|
812
|
+
if (stderr && (exitCode !== 0 || !yieldedEvents)) yield {
|
|
813
|
+
type: "error",
|
|
814
|
+
message: stderr.trim(),
|
|
815
|
+
code: "CLI_STDERR"
|
|
816
|
+
};
|
|
817
|
+
if (exitCode !== 0 && !yieldedEvents && !stderr) yield {
|
|
818
|
+
type: "error",
|
|
819
|
+
message: `Agent process exited with code ${exitCode}`,
|
|
820
|
+
code: "CLI_EXIT_ERROR"
|
|
821
|
+
};
|
|
822
|
+
if (startupTimedOut) yield {
|
|
823
|
+
type: "error",
|
|
824
|
+
message: `Startup timeout: no output within ${this.timeoutMs}ms`,
|
|
825
|
+
code: "STARTUP_TIMEOUT"
|
|
826
|
+
};
|
|
827
|
+
if (aborted) yield {
|
|
828
|
+
type: "error",
|
|
829
|
+
message: "Execution aborted",
|
|
830
|
+
code: "ABORTED"
|
|
831
|
+
};
|
|
832
|
+
yield {
|
|
833
|
+
type: "done",
|
|
834
|
+
result: {
|
|
835
|
+
text: "",
|
|
836
|
+
sessionId: void 0,
|
|
837
|
+
durationMs,
|
|
838
|
+
usage: void 0,
|
|
839
|
+
aborted,
|
|
840
|
+
stderr: stderr || void 0
|
|
841
|
+
}
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
//#endregion
|
|
847
|
+
//#region src/middleware/runtimes/claude.ts
|
|
848
|
+
/**
|
|
849
|
+
* Claude CLI runtime — invokes `claude --print --output-format stream-json`
|
|
850
|
+
* and maps the streaming NDJSON output to {@link AgentEvent} instances.
|
|
851
|
+
*/
|
|
852
|
+
var ClaudeCliRuntime = class extends CLIRuntimeBase {
|
|
853
|
+
constructor() {
|
|
854
|
+
super("claude");
|
|
855
|
+
this.mediaCapabilities = {
|
|
856
|
+
acceptsInbound: ["image/"],
|
|
857
|
+
emitsOutbound: false
|
|
858
|
+
};
|
|
859
|
+
this.accumulatedText = "";
|
|
860
|
+
this.toolBuffer = null;
|
|
861
|
+
}
|
|
862
|
+
async *execute(params) {
|
|
863
|
+
this.resetState();
|
|
864
|
+
const prepared = await this.prepareMedia(params);
|
|
865
|
+
for await (const event of super.execute(prepared)) {
|
|
866
|
+
if (event.type === "done") this.enrichDoneEvent(event);
|
|
867
|
+
yield event;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
buildArgs(params) {
|
|
871
|
+
const args = [
|
|
872
|
+
"--output-format",
|
|
873
|
+
"stream-json",
|
|
874
|
+
"--verbose",
|
|
875
|
+
"--include-partial-messages"
|
|
876
|
+
];
|
|
877
|
+
if (params.sessionId) args.push("--resume", params.sessionId);
|
|
878
|
+
if (params.mcpServers && Object.keys(params.mcpServers).length > 0) args.push("--mcp-config", JSON.stringify({ mcpServers: params.mcpServers }));
|
|
879
|
+
const systemParts = [params.systemPrompt, params.extraContext];
|
|
880
|
+
if (!params.sessionId && params.threadContext) systemParts.push(params.threadContext);
|
|
881
|
+
const systemContent = systemParts.filter(Boolean).join("\n\n");
|
|
882
|
+
if (systemContent) args.push("--append-system-prompt", systemContent);
|
|
883
|
+
if (params.media?.some((m) => m.mimeType.startsWith("image/") && m.base64)) args.push("-p", "--input-format", "stream-json");
|
|
884
|
+
else args.push("--print", params.prompt);
|
|
885
|
+
return args;
|
|
886
|
+
}
|
|
887
|
+
buildStdinPayload(params) {
|
|
888
|
+
const images = params.media?.filter((m) => m.mimeType.startsWith("image/") && m.base64);
|
|
889
|
+
if (!images?.length) return;
|
|
890
|
+
const content = images.map((img) => ({
|
|
891
|
+
type: "image",
|
|
892
|
+
source: {
|
|
893
|
+
type: "base64",
|
|
894
|
+
media_type: img.mimeType,
|
|
895
|
+
data: img.base64
|
|
896
|
+
}
|
|
897
|
+
}));
|
|
898
|
+
content.push({
|
|
899
|
+
type: "text",
|
|
900
|
+
text: params.prompt
|
|
901
|
+
});
|
|
902
|
+
const envelope = {
|
|
903
|
+
type: "user",
|
|
904
|
+
message: {
|
|
905
|
+
role: "user",
|
|
906
|
+
content
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
return JSON.stringify(envelope) + "\n";
|
|
910
|
+
}
|
|
911
|
+
extractEvent(line) {
|
|
912
|
+
const parsed = JSON.parse(line);
|
|
913
|
+
if (!isObject$3(parsed)) return null;
|
|
914
|
+
if (parsed.type === "system") {
|
|
915
|
+
if (typeof parsed.session_id === "string" && !this.currentSessionId) this.currentSessionId = parsed.session_id;
|
|
916
|
+
return null;
|
|
917
|
+
}
|
|
918
|
+
if (parsed.type === "stream_event") {
|
|
919
|
+
if (typeof parsed.session_id === "string" && !this.currentSessionId) this.currentSessionId = parsed.session_id;
|
|
920
|
+
if (isObject$3(parsed.event)) return this.handleInnerEvent(parsed.event);
|
|
921
|
+
return null;
|
|
922
|
+
}
|
|
923
|
+
if (parsed.type === "result") {
|
|
924
|
+
this.storeResultData(parsed);
|
|
925
|
+
if (parsed.is_error === true && typeof parsed.result === "string" && parsed.result) return {
|
|
926
|
+
type: "error",
|
|
927
|
+
message: parsed.result,
|
|
928
|
+
code: "CLI_ERROR"
|
|
929
|
+
};
|
|
930
|
+
return null;
|
|
931
|
+
}
|
|
932
|
+
return null;
|
|
933
|
+
}
|
|
934
|
+
buildEnv(_params) {
|
|
935
|
+
return {};
|
|
936
|
+
}
|
|
937
|
+
handleInnerEvent(event) {
|
|
938
|
+
switch (event.type) {
|
|
939
|
+
case "content_block_start": return this.handleContentBlockStart(event);
|
|
940
|
+
case "content_block_delta": return this.handleContentBlockDelta(event);
|
|
941
|
+
case "content_block_stop": return this.handleContentBlockStop();
|
|
942
|
+
case "message_delta":
|
|
943
|
+
this.handleMessageDelta(event);
|
|
944
|
+
return null;
|
|
945
|
+
default: return null;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
handleContentBlockStart(event) {
|
|
949
|
+
const contentBlock = isObject$3(event.content_block) ? event.content_block : null;
|
|
950
|
+
if (!contentBlock) return null;
|
|
951
|
+
if (contentBlock.type === "tool_use") this.toolBuffer = {
|
|
952
|
+
name: typeof contentBlock.name === "string" ? contentBlock.name : "",
|
|
953
|
+
id: typeof contentBlock.id === "string" ? contentBlock.id : "",
|
|
954
|
+
input: ""
|
|
955
|
+
};
|
|
956
|
+
return null;
|
|
957
|
+
}
|
|
958
|
+
handleContentBlockDelta(event) {
|
|
959
|
+
const delta = isObject$3(event.delta) ? event.delta : null;
|
|
960
|
+
if (!delta) return null;
|
|
961
|
+
if (delta.type === "text_delta" && typeof delta.text === "string") {
|
|
962
|
+
this.accumulatedText += delta.text;
|
|
963
|
+
return {
|
|
964
|
+
type: "text",
|
|
965
|
+
text: delta.text
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
if (delta.type === "input_json_delta" && typeof delta.partial_json === "string") {
|
|
969
|
+
if (this.toolBuffer) this.toolBuffer.input += delta.partial_json;
|
|
970
|
+
return null;
|
|
971
|
+
}
|
|
972
|
+
if (delta.type === "thinking_delta" && typeof delta.thinking === "string") return {
|
|
973
|
+
type: "thinking",
|
|
974
|
+
text: delta.thinking
|
|
975
|
+
};
|
|
976
|
+
return null;
|
|
977
|
+
}
|
|
978
|
+
handleContentBlockStop() {
|
|
979
|
+
if (this.toolBuffer) {
|
|
980
|
+
const { name, id, input } = this.toolBuffer;
|
|
981
|
+
this.toolBuffer = null;
|
|
982
|
+
let parsedInput = {};
|
|
983
|
+
if (input) try {
|
|
984
|
+
parsedInput = JSON.parse(input);
|
|
985
|
+
} catch {}
|
|
986
|
+
return {
|
|
987
|
+
type: "tool_use",
|
|
988
|
+
toolName: name,
|
|
989
|
+
toolId: id,
|
|
990
|
+
input: parsedInput
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
return null;
|
|
994
|
+
}
|
|
995
|
+
handleMessageDelta(event) {
|
|
996
|
+
const delta = isObject$3(event.delta) ? event.delta : null;
|
|
997
|
+
if (delta && typeof delta.stop_reason === "string") this.lastStopReason = delta.stop_reason;
|
|
998
|
+
const usage = isObject$3(event.usage) ? parseUsage(event.usage) : void 0;
|
|
999
|
+
if (usage) this.lastUsage = usage;
|
|
1000
|
+
}
|
|
1001
|
+
storeResultData(parsed) {
|
|
1002
|
+
const usage = isObject$3(parsed.usage) ? parsed.usage : null;
|
|
1003
|
+
this.resultData = {
|
|
1004
|
+
sessionId: typeof parsed.session_id === "string" ? parsed.session_id : void 0,
|
|
1005
|
+
costUsd: typeof parsed.cost_usd === "number" ? parsed.cost_usd : void 0,
|
|
1006
|
+
durationApiMs: typeof parsed.duration_api_ms === "number" ? parsed.duration_api_ms : void 0,
|
|
1007
|
+
numTurns: typeof parsed.num_turns === "number" ? parsed.num_turns : void 0,
|
|
1008
|
+
subtype: typeof parsed.subtype === "string" ? parsed.subtype : void 0,
|
|
1009
|
+
usage: usage ? parseUsage(usage) : void 0
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
enrichDoneEvent(event) {
|
|
1013
|
+
const { result } = event;
|
|
1014
|
+
result.text = this.accumulatedText;
|
|
1015
|
+
result.sessionId = this.resultData?.sessionId ?? this.currentSessionId;
|
|
1016
|
+
result.stopReason = this.lastStopReason ?? this.resultData?.subtype;
|
|
1017
|
+
result.usage = this.resultData?.usage ?? this.lastUsage;
|
|
1018
|
+
if (this.resultData?.costUsd !== void 0) result.totalCostUsd = this.resultData.costUsd;
|
|
1019
|
+
if (this.resultData?.durationApiMs !== void 0) result.apiDurationMs = this.resultData.durationApiMs;
|
|
1020
|
+
if (this.resultData?.numTurns !== void 0) result.numTurns = this.resultData.numTurns;
|
|
1021
|
+
}
|
|
1022
|
+
/**
|
|
1023
|
+
* Read image files referenced by media attachments and populate their base64 field.
|
|
1024
|
+
* Non-image media types are filtered out (audio/video are not supported natively).
|
|
1025
|
+
*/
|
|
1026
|
+
async prepareMedia(params) {
|
|
1027
|
+
if (!params.media?.length) return params;
|
|
1028
|
+
const prepared = [];
|
|
1029
|
+
for (const attachment of params.media) {
|
|
1030
|
+
if (!attachment.mimeType.startsWith("image/")) continue;
|
|
1031
|
+
if (attachment.base64) {
|
|
1032
|
+
prepared.push(attachment);
|
|
1033
|
+
continue;
|
|
1034
|
+
}
|
|
1035
|
+
if (attachment.filePath) {
|
|
1036
|
+
try {
|
|
1037
|
+
const buffer = await readFile(attachment.filePath);
|
|
1038
|
+
prepared.push({
|
|
1039
|
+
...attachment,
|
|
1040
|
+
base64: buffer.toString("base64")
|
|
1041
|
+
});
|
|
1042
|
+
} catch {
|
|
1043
|
+
logDebug(`[claude-runtime] failed to read media file: ${attachment.filePath}`);
|
|
1044
|
+
}
|
|
1045
|
+
continue;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
return {
|
|
1049
|
+
...params,
|
|
1050
|
+
media: prepared.length > 0 ? prepared : void 0
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
resetState() {
|
|
1054
|
+
this.currentSessionId = void 0;
|
|
1055
|
+
this.accumulatedText = "";
|
|
1056
|
+
this.toolBuffer = null;
|
|
1057
|
+
this.lastUsage = void 0;
|
|
1058
|
+
this.lastStopReason = void 0;
|
|
1059
|
+
this.resultData = void 0;
|
|
1060
|
+
}
|
|
1061
|
+
};
|
|
1062
|
+
function isObject$3(value) {
|
|
1063
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1064
|
+
}
|
|
1065
|
+
function parseUsage(raw) {
|
|
1066
|
+
return {
|
|
1067
|
+
inputTokens: typeof raw.input_tokens === "number" ? raw.input_tokens : 0,
|
|
1068
|
+
outputTokens: typeof raw.output_tokens === "number" ? raw.output_tokens : 0,
|
|
1069
|
+
...typeof raw.cache_read_input_tokens === "number" ? { cacheReadTokens: raw.cache_read_input_tokens } : {},
|
|
1070
|
+
...typeof raw.cache_creation_input_tokens === "number" ? { cacheWriteTokens: raw.cache_creation_input_tokens } : {}
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
//#endregion
|
|
1075
|
+
//#region src/middleware/runtimes/codex.ts
|
|
1076
|
+
/**
|
|
1077
|
+
* Codex CLI runtime — invokes `codex exec --json`
|
|
1078
|
+
* and maps the streaming NDJSON output to {@link AgentEvent} instances.
|
|
1079
|
+
*
|
|
1080
|
+
* The Codex CLI uses a two-level event model:
|
|
1081
|
+
* - Top-level events: thread.started, turn.started, item.started, item.updated,
|
|
1082
|
+
* item.completed, turn.completed, turn.failed, error
|
|
1083
|
+
* - Item types: agent_message, command_execution, mcp_tool_call, file_change,
|
|
1084
|
+
* reasoning, web_search, error, todo_list
|
|
1085
|
+
*/
|
|
1086
|
+
var CodexCliRuntime = class extends CLIRuntimeBase {
|
|
1087
|
+
constructor() {
|
|
1088
|
+
super("codex");
|
|
1089
|
+
this.mediaCapabilities = {
|
|
1090
|
+
acceptsInbound: ["image/"],
|
|
1091
|
+
emitsOutbound: false
|
|
1092
|
+
};
|
|
1093
|
+
this.accumulatedText = "";
|
|
1094
|
+
this.lastEmittedTextLength = 0;
|
|
1095
|
+
this.itemCounter = 0;
|
|
1096
|
+
}
|
|
1097
|
+
get supportsStdinPrompt() {
|
|
1098
|
+
return false;
|
|
1099
|
+
}
|
|
1100
|
+
async *execute(params) {
|
|
1101
|
+
this.resetState();
|
|
1102
|
+
const mcpConfigManager = params.mcpServers && Object.keys(params.mcpServers).length > 0 ? new CodexMcpConfigManager(params.mcpServers) : null;
|
|
1103
|
+
try {
|
|
1104
|
+
await mcpConfigManager?.setup();
|
|
1105
|
+
for await (const event of super.execute(params)) {
|
|
1106
|
+
if (event.type === "done") this.enrichDoneEvent(event);
|
|
1107
|
+
yield event;
|
|
1108
|
+
}
|
|
1109
|
+
} finally {
|
|
1110
|
+
await mcpConfigManager?.teardown();
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
buildArgs(params) {
|
|
1114
|
+
const hasImages = params.media?.some((a) => a.mimeType.startsWith("image/") && a.filePath);
|
|
1115
|
+
if (params.sessionId && !hasImages) {
|
|
1116
|
+
const composed = this.composePrompt(params);
|
|
1117
|
+
return [
|
|
1118
|
+
"exec",
|
|
1119
|
+
"resume",
|
|
1120
|
+
"--json",
|
|
1121
|
+
params.sessionId,
|
|
1122
|
+
composed
|
|
1123
|
+
];
|
|
1124
|
+
}
|
|
1125
|
+
const promptParams = params.sessionId ? {
|
|
1126
|
+
...params,
|
|
1127
|
+
sessionId: void 0
|
|
1128
|
+
} : params;
|
|
1129
|
+
const composed = this.composePrompt(promptParams);
|
|
1130
|
+
const args = [
|
|
1131
|
+
"exec",
|
|
1132
|
+
"--json",
|
|
1133
|
+
"--color",
|
|
1134
|
+
"never"
|
|
1135
|
+
];
|
|
1136
|
+
if (hasImages) {
|
|
1137
|
+
for (const attachment of params.media) if (attachment.mimeType.startsWith("image/") && attachment.filePath) args.push("--image", attachment.filePath);
|
|
1138
|
+
args.push("--");
|
|
1139
|
+
}
|
|
1140
|
+
args.push(composed);
|
|
1141
|
+
return args;
|
|
1142
|
+
}
|
|
1143
|
+
extractEvent(line) {
|
|
1144
|
+
const parsed = JSON.parse(line);
|
|
1145
|
+
if (!isObject$2(parsed) || typeof parsed.type !== "string") return null;
|
|
1146
|
+
switch (parsed.type) {
|
|
1147
|
+
case "thread.started": return this.handleThreadStarted(parsed);
|
|
1148
|
+
case "item.started": return this.handleItemStarted(parsed);
|
|
1149
|
+
case "item.updated": return this.handleItemUpdated(parsed);
|
|
1150
|
+
case "item.completed": return this.handleItemCompleted(parsed);
|
|
1151
|
+
case "turn.completed": return this.handleTurnCompleted(parsed);
|
|
1152
|
+
case "turn.failed": return this.handleTurnFailed(parsed);
|
|
1153
|
+
case "error": return this.handleError(parsed);
|
|
1154
|
+
default: return null;
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
buildEnv(_params) {
|
|
1158
|
+
return {};
|
|
1159
|
+
}
|
|
1160
|
+
handleThreadStarted(parsed) {
|
|
1161
|
+
if (typeof parsed.thread_id === "string") this.currentSessionId = parsed.thread_id;
|
|
1162
|
+
return null;
|
|
1163
|
+
}
|
|
1164
|
+
handleItemStarted(parsed) {
|
|
1165
|
+
const item = isObject$2(parsed.item) ? parsed.item : null;
|
|
1166
|
+
if (!item || typeof item.type !== "string") return null;
|
|
1167
|
+
const toolId = this.extractToolId(item);
|
|
1168
|
+
switch (item.type) {
|
|
1169
|
+
case "command_execution":
|
|
1170
|
+
this.currentToolId = toolId;
|
|
1171
|
+
return {
|
|
1172
|
+
type: "tool_use",
|
|
1173
|
+
toolName: "command_execution",
|
|
1174
|
+
toolId,
|
|
1175
|
+
input: { command: typeof item.command === "string" ? item.command : "" }
|
|
1176
|
+
};
|
|
1177
|
+
case "mcp_tool_call":
|
|
1178
|
+
this.currentToolId = toolId;
|
|
1179
|
+
return {
|
|
1180
|
+
type: "tool_use",
|
|
1181
|
+
toolName: typeof item.name === "string" ? item.name : "",
|
|
1182
|
+
toolId,
|
|
1183
|
+
input: isObject$2(item.arguments) ? item.arguments : {}
|
|
1184
|
+
};
|
|
1185
|
+
case "agent_message":
|
|
1186
|
+
this.lastEmittedTextLength = 0;
|
|
1187
|
+
return null;
|
|
1188
|
+
case "reasoning": return null;
|
|
1189
|
+
default: return null;
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
handleItemUpdated(parsed) {
|
|
1193
|
+
const item = isObject$2(parsed.item) ? parsed.item : null;
|
|
1194
|
+
if (!item) return null;
|
|
1195
|
+
if (item.type === "reasoning") {
|
|
1196
|
+
const text = this.extractReasoningText(item);
|
|
1197
|
+
if (text) return {
|
|
1198
|
+
type: "thinking",
|
|
1199
|
+
text
|
|
1200
|
+
};
|
|
1201
|
+
return null;
|
|
1202
|
+
}
|
|
1203
|
+
if (item.type !== "agent_message") return null;
|
|
1204
|
+
const fullText = this.extractMessageText(item);
|
|
1205
|
+
if (fullText === void 0) return null;
|
|
1206
|
+
const delta = fullText.substring(this.lastEmittedTextLength);
|
|
1207
|
+
this.lastEmittedTextLength = fullText.length;
|
|
1208
|
+
if (delta) {
|
|
1209
|
+
this.accumulatedText += delta;
|
|
1210
|
+
return {
|
|
1211
|
+
type: "text",
|
|
1212
|
+
text: delta
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1215
|
+
return null;
|
|
1216
|
+
}
|
|
1217
|
+
handleItemCompleted(parsed) {
|
|
1218
|
+
const item = isObject$2(parsed.item) ? parsed.item : null;
|
|
1219
|
+
if (!item || typeof item.type !== "string") return null;
|
|
1220
|
+
switch (item.type) {
|
|
1221
|
+
case "agent_message": {
|
|
1222
|
+
const fullText = this.extractMessageText(item);
|
|
1223
|
+
if (fullText !== void 0) {
|
|
1224
|
+
const delta = fullText.substring(this.lastEmittedTextLength);
|
|
1225
|
+
this.lastEmittedTextLength = fullText.length;
|
|
1226
|
+
if (delta) {
|
|
1227
|
+
this.accumulatedText += delta;
|
|
1228
|
+
return {
|
|
1229
|
+
type: "text",
|
|
1230
|
+
text: delta
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
return null;
|
|
1235
|
+
}
|
|
1236
|
+
case "reasoning": {
|
|
1237
|
+
const text = this.extractReasoningText(item);
|
|
1238
|
+
if (text) return {
|
|
1239
|
+
type: "thinking",
|
|
1240
|
+
text
|
|
1241
|
+
};
|
|
1242
|
+
return null;
|
|
1243
|
+
}
|
|
1244
|
+
case "command_execution": {
|
|
1245
|
+
const toolId = this.currentToolId ?? this.extractToolId(item);
|
|
1246
|
+
this.currentToolId = void 0;
|
|
1247
|
+
return {
|
|
1248
|
+
type: "tool_result",
|
|
1249
|
+
toolId,
|
|
1250
|
+
output: typeof item.output === "string" ? item.output : "",
|
|
1251
|
+
isError: (typeof item.exit_code === "number" ? item.exit_code : 0) !== 0
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
case "mcp_tool_call": {
|
|
1255
|
+
const toolId = this.currentToolId ?? this.extractToolId(item);
|
|
1256
|
+
this.currentToolId = void 0;
|
|
1257
|
+
return {
|
|
1258
|
+
type: "tool_result",
|
|
1259
|
+
toolId,
|
|
1260
|
+
output: typeof item.output === "string" ? item.output : "",
|
|
1261
|
+
isError: typeof item.error === "string" && item.error.length > 0
|
|
1262
|
+
};
|
|
1263
|
+
}
|
|
1264
|
+
case "error": return {
|
|
1265
|
+
type: "error",
|
|
1266
|
+
message: typeof item.message === "string" ? item.message : "Unknown error"
|
|
1267
|
+
};
|
|
1268
|
+
default: return null;
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
handleTurnCompleted(parsed) {
|
|
1272
|
+
if (isObject$2(parsed.usage)) {
|
|
1273
|
+
const usage = parsed.usage;
|
|
1274
|
+
this.lastUsage = {
|
|
1275
|
+
inputTokens: typeof usage.input_tokens === "number" ? usage.input_tokens : 0,
|
|
1276
|
+
outputTokens: typeof usage.output_tokens === "number" ? usage.output_tokens : 0,
|
|
1277
|
+
...typeof usage.cached_input_tokens === "number" && usage.cached_input_tokens > 0 ? { cacheReadTokens: usage.cached_input_tokens } : {}
|
|
1278
|
+
};
|
|
1279
|
+
}
|
|
1280
|
+
return null;
|
|
1281
|
+
}
|
|
1282
|
+
handleTurnFailed(parsed) {
|
|
1283
|
+
return {
|
|
1284
|
+
type: "error",
|
|
1285
|
+
message: typeof parsed.message === "string" ? parsed.message : "Turn failed",
|
|
1286
|
+
code: "turn_failed"
|
|
1287
|
+
};
|
|
1288
|
+
}
|
|
1289
|
+
handleError(parsed) {
|
|
1290
|
+
return {
|
|
1291
|
+
type: "error",
|
|
1292
|
+
message: typeof parsed.message === "string" ? parsed.message : "Unknown error"
|
|
1293
|
+
};
|
|
1294
|
+
}
|
|
1295
|
+
enrichDoneEvent(event) {
|
|
1296
|
+
const { result } = event;
|
|
1297
|
+
result.text = this.accumulatedText;
|
|
1298
|
+
result.sessionId = this.currentSessionId;
|
|
1299
|
+
if (this.lastUsage) result.usage = this.lastUsage;
|
|
1300
|
+
}
|
|
1301
|
+
extractToolId(item) {
|
|
1302
|
+
if (typeof item.id === "string") return item.id;
|
|
1303
|
+
return `codex-item-${this.itemCounter++}`;
|
|
1304
|
+
}
|
|
1305
|
+
extractMessageText(item) {
|
|
1306
|
+
if (Array.isArray(item.content)) {
|
|
1307
|
+
const textParts = [];
|
|
1308
|
+
for (const part of item.content) if (isObject$2(part) && part.type === "output_text" && typeof part.text === "string") textParts.push(part.text);
|
|
1309
|
+
if (textParts.length > 0) return textParts.join("");
|
|
1310
|
+
}
|
|
1311
|
+
if (typeof item.text === "string") return item.text;
|
|
1312
|
+
}
|
|
1313
|
+
extractReasoningText(item) {
|
|
1314
|
+
if (Array.isArray(item.summary)) {
|
|
1315
|
+
const textParts = [];
|
|
1316
|
+
for (const part of item.summary) if (isObject$2(part) && part.type === "summary_text" && typeof part.text === "string") textParts.push(part.text);
|
|
1317
|
+
if (textParts.length > 0) return textParts.join("");
|
|
1318
|
+
}
|
|
1319
|
+
if (typeof item.text === "string") return item.text;
|
|
1320
|
+
}
|
|
1321
|
+
resetState() {
|
|
1322
|
+
this.currentSessionId = void 0;
|
|
1323
|
+
this.accumulatedText = "";
|
|
1324
|
+
this.lastEmittedTextLength = 0;
|
|
1325
|
+
this.lastUsage = void 0;
|
|
1326
|
+
this.currentToolId = void 0;
|
|
1327
|
+
this.itemCounter = 0;
|
|
1328
|
+
}
|
|
1329
|
+
};
|
|
1330
|
+
/**
|
|
1331
|
+
* Manages the `~/.codex/config.toml` lifecycle for MCP server configuration.
|
|
1332
|
+
*
|
|
1333
|
+
* The Codex CLI reads MCP config from `~/.codex/config.toml`. The config uses
|
|
1334
|
+
* TOML format with `[mcp_servers.<name>]` sections.
|
|
1335
|
+
*
|
|
1336
|
+
* Uses a merge-restore pattern:
|
|
1337
|
+
* - **Setup**: read existing config (if any), save a copy, append `mcp_servers`
|
|
1338
|
+
* sections, write back.
|
|
1339
|
+
* - **Teardown** (always, via `finally`): restore original or delete created file.
|
|
1340
|
+
*/
|
|
1341
|
+
var CodexMcpConfigManager = class {
|
|
1342
|
+
constructor(mcpServers, configDir) {
|
|
1343
|
+
this.mcpServers = mcpServers;
|
|
1344
|
+
this.originalContent = null;
|
|
1345
|
+
this.createdFile = false;
|
|
1346
|
+
this.createdDir = false;
|
|
1347
|
+
this.configDir = configDir ?? join(homedir(), ".codex");
|
|
1348
|
+
this.configPath = join(this.configDir, "config.toml");
|
|
1349
|
+
}
|
|
1350
|
+
async setup() {
|
|
1351
|
+
try {
|
|
1352
|
+
await mkdir(this.configDir, { recursive: true });
|
|
1353
|
+
} catch {}
|
|
1354
|
+
let existingContent = null;
|
|
1355
|
+
try {
|
|
1356
|
+
const content = await readFile(this.configPath, "utf-8");
|
|
1357
|
+
this.originalContent = content;
|
|
1358
|
+
existingContent = content;
|
|
1359
|
+
} catch {
|
|
1360
|
+
this.createdFile = true;
|
|
1361
|
+
try {
|
|
1362
|
+
if ((await readdir(this.configDir)).length === 0) this.createdDir = true;
|
|
1363
|
+
} catch {}
|
|
1364
|
+
}
|
|
1365
|
+
const mcpToml = serializeMcpServersToToml(this.mcpServers);
|
|
1366
|
+
if (existingContent) {
|
|
1367
|
+
const stripped = stripMcpServersSections(existingContent);
|
|
1368
|
+
const separator = stripped.endsWith("\n") ? "\n" : "\n\n";
|
|
1369
|
+
await writeFile(this.configPath, stripped + separator + mcpToml, "utf-8");
|
|
1370
|
+
} else await writeFile(this.configPath, mcpToml, "utf-8");
|
|
1371
|
+
}
|
|
1372
|
+
async teardown() {
|
|
1373
|
+
try {
|
|
1374
|
+
if (this.originalContent !== null) await writeFile(this.configPath, this.originalContent, "utf-8");
|
|
1375
|
+
else if (this.createdFile) {
|
|
1376
|
+
await rm(this.configPath, { force: true });
|
|
1377
|
+
if (this.createdDir) try {
|
|
1378
|
+
await rmdir(this.configDir);
|
|
1379
|
+
} catch {}
|
|
1380
|
+
}
|
|
1381
|
+
} catch {}
|
|
1382
|
+
}
|
|
1383
|
+
};
|
|
1384
|
+
/**
|
|
1385
|
+
* Serialize MCP server configs to TOML format for Codex config.
|
|
1386
|
+
*
|
|
1387
|
+
* Output format:
|
|
1388
|
+
* ```toml
|
|
1389
|
+
* [mcp_servers.server_name]
|
|
1390
|
+
* type = "stdio"
|
|
1391
|
+
* command = "node"
|
|
1392
|
+
* args = ["server.js"]
|
|
1393
|
+
*
|
|
1394
|
+
* [mcp_servers.server_name.env]
|
|
1395
|
+
* KEY = "VALUE"
|
|
1396
|
+
* ```
|
|
1397
|
+
*/
|
|
1398
|
+
function serializeMcpServersToToml(mcpServers) {
|
|
1399
|
+
const sections = [];
|
|
1400
|
+
for (const [name, config] of Object.entries(mcpServers)) {
|
|
1401
|
+
const lines = [];
|
|
1402
|
+
lines.push(`[mcp_servers.${name}]`);
|
|
1403
|
+
lines.push(`type = "stdio"`);
|
|
1404
|
+
lines.push(`command = ${toTomlString(config.command)}`);
|
|
1405
|
+
const args = config.args ?? [];
|
|
1406
|
+
if (args.length > 0) lines.push(`args = [${args.map((s) => toTomlString(s)).join(", ")}]`);
|
|
1407
|
+
sections.push(lines.join("\n"));
|
|
1408
|
+
if (config.env && Object.keys(config.env).length > 0) {
|
|
1409
|
+
const envLines = [];
|
|
1410
|
+
envLines.push(`[mcp_servers.${name}.env]`);
|
|
1411
|
+
for (const [key, value] of Object.entries(config.env)) envLines.push(`${key} = ${toTomlString(value)}`);
|
|
1412
|
+
sections.push(envLines.join("\n"));
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
return sections.join("\n\n") + "\n";
|
|
1416
|
+
}
|
|
1417
|
+
/**
|
|
1418
|
+
* Strip existing `[mcp_servers.*]` sections from TOML content.
|
|
1419
|
+
* This is a simple line-based approach that removes lines belonging to
|
|
1420
|
+
* mcp_servers sections (from header to next non-mcp_servers section).
|
|
1421
|
+
*/
|
|
1422
|
+
function stripMcpServersSections(content) {
|
|
1423
|
+
const lines = content.split("\n");
|
|
1424
|
+
const result = [];
|
|
1425
|
+
let inMcpSection = false;
|
|
1426
|
+
for (const line of lines) {
|
|
1427
|
+
const trimmed = line.trim();
|
|
1428
|
+
if (trimmed.startsWith("[")) {
|
|
1429
|
+
if (trimmed.startsWith("[mcp_servers.") || trimmed === "[mcp_servers]") {
|
|
1430
|
+
inMcpSection = true;
|
|
1431
|
+
continue;
|
|
1432
|
+
}
|
|
1433
|
+
inMcpSection = false;
|
|
1434
|
+
}
|
|
1435
|
+
if (!inMcpSection) result.push(line);
|
|
1436
|
+
}
|
|
1437
|
+
while (result.length > 0 && result[result.length - 1].trim() === "") result.pop();
|
|
1438
|
+
return result.join("\n") + "\n";
|
|
1439
|
+
}
|
|
1440
|
+
/** Escape a string for TOML (basic string with double quotes). */
|
|
1441
|
+
function toTomlString(value) {
|
|
1442
|
+
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t")}"`;
|
|
1443
|
+
}
|
|
1444
|
+
function isObject$2(value) {
|
|
1445
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
//#endregion
|
|
1449
|
+
//#region src/middleware/runtimes/gemini.ts
|
|
1450
|
+
/**
|
|
1451
|
+
* Gemini CLI runtime — invokes `gemini --output-format stream-json`
|
|
1452
|
+
* and maps the streaming NDJSON output to {@link AgentEvent} instances.
|
|
1453
|
+
*/
|
|
1454
|
+
var GeminiCliRuntime = class extends CLIRuntimeBase {
|
|
1455
|
+
constructor() {
|
|
1456
|
+
super("gemini");
|
|
1457
|
+
this.mediaCapabilities = {
|
|
1458
|
+
acceptsInbound: [
|
|
1459
|
+
"image/",
|
|
1460
|
+
"audio/",
|
|
1461
|
+
"video/",
|
|
1462
|
+
"application/pdf"
|
|
1463
|
+
],
|
|
1464
|
+
emitsOutbound: false
|
|
1465
|
+
};
|
|
1466
|
+
this.accumulatedText = "";
|
|
1467
|
+
}
|
|
1468
|
+
get supportsStdinPrompt() {
|
|
1469
|
+
return false;
|
|
1470
|
+
}
|
|
1471
|
+
async *execute(params) {
|
|
1472
|
+
this.resetState();
|
|
1473
|
+
const mcpConfigManager = params.mcpServers && Object.keys(params.mcpServers).length > 0 ? new GeminiMcpConfigManager(params.workingDirectory, params.mcpServers) : null;
|
|
1474
|
+
try {
|
|
1475
|
+
await mcpConfigManager?.setup();
|
|
1476
|
+
const prepared = await this.prepareMedia(params);
|
|
1477
|
+
for await (const event of super.execute(prepared)) {
|
|
1478
|
+
if (event.type === "done") this.enrichDoneEvent(event);
|
|
1479
|
+
yield event;
|
|
1480
|
+
}
|
|
1481
|
+
} finally {
|
|
1482
|
+
await mcpConfigManager?.teardown();
|
|
1483
|
+
await this.cleanupMediaTempDir();
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
buildArgs(params) {
|
|
1487
|
+
const args = [
|
|
1488
|
+
"--output-format",
|
|
1489
|
+
"stream-json",
|
|
1490
|
+
"--prompt",
|
|
1491
|
+
this.composePrompt(params)
|
|
1492
|
+
];
|
|
1493
|
+
if (params.sessionId) args.push("--resume", params.sessionId);
|
|
1494
|
+
return args;
|
|
1495
|
+
}
|
|
1496
|
+
extractEvent(line) {
|
|
1497
|
+
const parsed = JSON.parse(line);
|
|
1498
|
+
if (!isObject$1(parsed) || typeof parsed.type !== "string") return null;
|
|
1499
|
+
switch (parsed.type) {
|
|
1500
|
+
case "init": return this.handleInit(parsed);
|
|
1501
|
+
case "message": return this.handleMessage(parsed);
|
|
1502
|
+
case "tool_use": return this.handleToolUse(parsed);
|
|
1503
|
+
case "tool_result": return this.handleToolResult(parsed);
|
|
1504
|
+
case "error": return this.handleError(parsed);
|
|
1505
|
+
case "result": return this.handleResult(parsed);
|
|
1506
|
+
default: return null;
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
buildEnv(_params) {
|
|
1510
|
+
return {};
|
|
1511
|
+
}
|
|
1512
|
+
handleInit(parsed) {
|
|
1513
|
+
if (typeof parsed.session_id === "string") this.currentSessionId = parsed.session_id;
|
|
1514
|
+
return null;
|
|
1515
|
+
}
|
|
1516
|
+
handleMessage(parsed) {
|
|
1517
|
+
if (parsed.delta !== true || parsed.role !== "assistant") return null;
|
|
1518
|
+
const content = typeof parsed.content === "string" ? parsed.content : void 0;
|
|
1519
|
+
if (content === void 0) return null;
|
|
1520
|
+
this.accumulatedText += content;
|
|
1521
|
+
return {
|
|
1522
|
+
type: "text",
|
|
1523
|
+
text: content
|
|
1524
|
+
};
|
|
1525
|
+
}
|
|
1526
|
+
handleToolUse(parsed) {
|
|
1527
|
+
return {
|
|
1528
|
+
type: "tool_use",
|
|
1529
|
+
toolName: typeof parsed.tool_name === "string" ? parsed.tool_name : "",
|
|
1530
|
+
toolId: typeof parsed.tool_id === "string" ? parsed.tool_id : "",
|
|
1531
|
+
input: isObject$1(parsed.parameters) ? parsed.parameters : {}
|
|
1532
|
+
};
|
|
1533
|
+
}
|
|
1534
|
+
handleToolResult(parsed) {
|
|
1535
|
+
return {
|
|
1536
|
+
type: "tool_result",
|
|
1537
|
+
toolId: typeof parsed.tool_id === "string" ? parsed.tool_id : "",
|
|
1538
|
+
output: typeof parsed.output === "string" ? parsed.output : "",
|
|
1539
|
+
isError: parsed.status === "error"
|
|
1540
|
+
};
|
|
1541
|
+
}
|
|
1542
|
+
handleError(parsed) {
|
|
1543
|
+
return {
|
|
1544
|
+
type: "error",
|
|
1545
|
+
message: typeof parsed.message === "string" ? parsed.message : "Unknown error",
|
|
1546
|
+
code: typeof parsed.severity === "string" ? parsed.severity : void 0
|
|
1547
|
+
};
|
|
1548
|
+
}
|
|
1549
|
+
handleResult(parsed) {
|
|
1550
|
+
if (isObject$1(parsed.stats)) this.resultStats = {
|
|
1551
|
+
inputTokens: typeof parsed.stats.input_tokens === "number" ? parsed.stats.input_tokens : void 0,
|
|
1552
|
+
outputTokens: typeof parsed.stats.output_tokens === "number" ? parsed.stats.output_tokens : void 0,
|
|
1553
|
+
cached: typeof parsed.stats.cached === "number" ? parsed.stats.cached : void 0,
|
|
1554
|
+
durationMs: typeof parsed.stats.duration_ms === "number" ? parsed.stats.duration_ms : void 0,
|
|
1555
|
+
toolCalls: typeof parsed.stats.tool_calls === "number" ? parsed.stats.tool_calls : void 0
|
|
1556
|
+
};
|
|
1557
|
+
return null;
|
|
1558
|
+
}
|
|
1559
|
+
enrichDoneEvent(event) {
|
|
1560
|
+
const { result } = event;
|
|
1561
|
+
result.text = this.accumulatedText;
|
|
1562
|
+
result.sessionId = this.currentSessionId;
|
|
1563
|
+
if (this.resultStats) {
|
|
1564
|
+
result.usage = {
|
|
1565
|
+
inputTokens: this.resultStats.inputTokens ?? 0,
|
|
1566
|
+
outputTokens: this.resultStats.outputTokens ?? 0,
|
|
1567
|
+
...this.resultStats.cached != null && this.resultStats.cached > 0 ? { cacheReadTokens: this.resultStats.cached } : {}
|
|
1568
|
+
};
|
|
1569
|
+
if (this.resultStats.durationMs !== void 0) result.apiDurationMs = this.resultStats.durationMs;
|
|
1570
|
+
if (this.resultStats.toolCalls !== void 0) result.numTurns = this.resultStats.toolCalls;
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
/**
|
|
1574
|
+
* Save media attachments to temp files and inject `@path` references into
|
|
1575
|
+
* the prompt. Gemini CLI resolves `@path` inline references natively.
|
|
1576
|
+
*/
|
|
1577
|
+
async prepareMedia(params) {
|
|
1578
|
+
if (!params.media?.length) return params;
|
|
1579
|
+
const tempDir = join(tmpdir(), `remoteclaw-gemini-media-${randomUUID()}`);
|
|
1580
|
+
await mkdir(tempDir, { recursive: true });
|
|
1581
|
+
this.mediaTempDir = tempDir;
|
|
1582
|
+
const mediaRefs = [];
|
|
1583
|
+
for (const attachment of params.media) {
|
|
1584
|
+
const ext = extensionForMime(attachment.mimeType);
|
|
1585
|
+
const filePath = join(tempDir, `media-${mediaRefs.length}${ext}`);
|
|
1586
|
+
if (attachment.base64) {
|
|
1587
|
+
await writeFile(filePath, Buffer.from(attachment.base64, "base64"));
|
|
1588
|
+
mediaRefs.push(filePath);
|
|
1589
|
+
} else if (attachment.filePath) try {
|
|
1590
|
+
await writeFile(filePath, await readFile(attachment.filePath));
|
|
1591
|
+
mediaRefs.push(filePath);
|
|
1592
|
+
} catch {
|
|
1593
|
+
logDebug(`[gemini-runtime] failed to read media file: ${attachment.filePath}`);
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
if (mediaRefs.length === 0) return params;
|
|
1597
|
+
const mediaPrefix = mediaRefs.map((ref) => `@${ref}`).join(" ");
|
|
1598
|
+
return {
|
|
1599
|
+
...params,
|
|
1600
|
+
prompt: `${mediaPrefix} ${params.prompt}`
|
|
1601
|
+
};
|
|
1602
|
+
}
|
|
1603
|
+
async cleanupMediaTempDir() {
|
|
1604
|
+
if (this.mediaTempDir) {
|
|
1605
|
+
try {
|
|
1606
|
+
await rm(this.mediaTempDir, {
|
|
1607
|
+
recursive: true,
|
|
1608
|
+
force: true
|
|
1609
|
+
});
|
|
1610
|
+
} catch {}
|
|
1611
|
+
this.mediaTempDir = void 0;
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
resetState() {
|
|
1615
|
+
this.currentSessionId = void 0;
|
|
1616
|
+
this.accumulatedText = "";
|
|
1617
|
+
this.resultStats = void 0;
|
|
1618
|
+
this.mediaTempDir = void 0;
|
|
1619
|
+
}
|
|
1620
|
+
};
|
|
1621
|
+
/**
|
|
1622
|
+
* Manages the `.gemini/settings.json` lifecycle for MCP server configuration.
|
|
1623
|
+
*
|
|
1624
|
+
* The Gemini CLI reads MCP config from a fixed settings file hierarchy — there
|
|
1625
|
+
* is no `--mcp-config`, `--settings-dir`, or `--config` CLI flag. Project-level
|
|
1626
|
+
* settings live in `.gemini/settings.json` within the working directory.
|
|
1627
|
+
*
|
|
1628
|
+
* A `GEMINI_CONFIG_DIR` env var was requested (google-gemini/gemini-cli#2815)
|
|
1629
|
+
* but redirected to XDG spec compliance (#1825), which hasn't shipped as of
|
|
1630
|
+
* v0.11.x. Until a flag or env var exists, we use a merge-restore pattern:
|
|
1631
|
+
*
|
|
1632
|
+
* - **Setup**: read existing `.gemini/settings.json` (if any), save a copy,
|
|
1633
|
+
* merge `mcpServers` into it, write back.
|
|
1634
|
+
* - **Teardown** (always, via `finally`): restore the original file, or remove
|
|
1635
|
+
* the file/directory we created.
|
|
1636
|
+
*/
|
|
1637
|
+
var GeminiMcpConfigManager = class {
|
|
1638
|
+
constructor(workingDirectory, mcpServers) {
|
|
1639
|
+
this.mcpServers = mcpServers;
|
|
1640
|
+
this.originalContent = null;
|
|
1641
|
+
this.createdFile = false;
|
|
1642
|
+
this.createdDir = false;
|
|
1643
|
+
this.settingsDir = join(workingDirectory ?? process.cwd(), ".gemini");
|
|
1644
|
+
this.settingsPath = join(this.settingsDir, "settings.json");
|
|
1645
|
+
}
|
|
1646
|
+
async setup() {
|
|
1647
|
+
try {
|
|
1648
|
+
await mkdir(this.settingsDir, { recursive: true });
|
|
1649
|
+
} catch {}
|
|
1650
|
+
let existingSettings = null;
|
|
1651
|
+
try {
|
|
1652
|
+
const content = await readFile(this.settingsPath, "utf-8");
|
|
1653
|
+
this.originalContent = content;
|
|
1654
|
+
existingSettings = JSON.parse(content);
|
|
1655
|
+
} catch {
|
|
1656
|
+
this.createdFile = true;
|
|
1657
|
+
try {
|
|
1658
|
+
if ((await readdir(this.settingsDir)).length === 0) this.createdDir = true;
|
|
1659
|
+
} catch {}
|
|
1660
|
+
}
|
|
1661
|
+
const mergedSettings = existingSettings ?? {};
|
|
1662
|
+
mergedSettings.mcpServers = this.mcpServers;
|
|
1663
|
+
await writeFile(this.settingsPath, JSON.stringify(mergedSettings, null, 2), "utf-8");
|
|
1664
|
+
}
|
|
1665
|
+
async teardown() {
|
|
1666
|
+
try {
|
|
1667
|
+
if (this.originalContent !== null) await writeFile(this.settingsPath, this.originalContent, "utf-8");
|
|
1668
|
+
else if (this.createdFile) {
|
|
1669
|
+
await rm(this.settingsPath, { force: true });
|
|
1670
|
+
if (this.createdDir) try {
|
|
1671
|
+
await rmdir(this.settingsDir);
|
|
1672
|
+
} catch {}
|
|
1673
|
+
}
|
|
1674
|
+
} catch {}
|
|
1675
|
+
}
|
|
1676
|
+
};
|
|
1677
|
+
function isObject$1(value) {
|
|
1678
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1679
|
+
}
|
|
1680
|
+
/** Map common MIME types to file extensions for Gemini CLI `@path` references. */
|
|
1681
|
+
function extensionForMime(mimeType) {
|
|
1682
|
+
return {
|
|
1683
|
+
"image/jpeg": ".jpg",
|
|
1684
|
+
"image/png": ".png",
|
|
1685
|
+
"image/gif": ".gif",
|
|
1686
|
+
"image/webp": ".webp",
|
|
1687
|
+
"audio/ogg": ".ogg",
|
|
1688
|
+
"audio/mpeg": ".mp3",
|
|
1689
|
+
"audio/wav": ".wav",
|
|
1690
|
+
"audio/webm": ".weba",
|
|
1691
|
+
"video/mp4": ".mp4",
|
|
1692
|
+
"video/webm": ".webm",
|
|
1693
|
+
"video/quicktime": ".mov",
|
|
1694
|
+
"application/pdf": ".pdf"
|
|
1695
|
+
}[mimeType] ?? "";
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
//#endregion
|
|
1699
|
+
//#region src/middleware/runtimes/opencode.ts
|
|
1700
|
+
/**
|
|
1701
|
+
* OpenCode CLI runtime — invokes `opencode run --format json`
|
|
1702
|
+
* and maps the streaming NDJSON output to {@link AgentEvent} instances.
|
|
1703
|
+
*
|
|
1704
|
+
* OpenCode uses a per-line envelope model where every NDJSON line has:
|
|
1705
|
+
* `{ type, timestamp, sessionID, ...data }`
|
|
1706
|
+
*
|
|
1707
|
+
* Key differences from other runtimes:
|
|
1708
|
+
* - Text events are complete parts (no delta tracking needed)
|
|
1709
|
+
* - Tool events combine use + result in a single line (buffered drain pattern)
|
|
1710
|
+
* - Usage/cost comes from `step_finish` events
|
|
1711
|
+
*/
|
|
1712
|
+
var OpenCodeCliRuntime = class extends CLIRuntimeBase {
|
|
1713
|
+
constructor() {
|
|
1714
|
+
super("opencode");
|
|
1715
|
+
this.mediaCapabilities = {
|
|
1716
|
+
acceptsInbound: [],
|
|
1717
|
+
emitsOutbound: false
|
|
1718
|
+
};
|
|
1719
|
+
this.accumulatedText = "";
|
|
1720
|
+
this.pendingEvents = [];
|
|
1721
|
+
this.toolCounter = 0;
|
|
1722
|
+
}
|
|
1723
|
+
async *execute(params) {
|
|
1724
|
+
this.resetState();
|
|
1725
|
+
const mcpConfigManager = params.mcpServers && Object.keys(params.mcpServers).length > 0 ? new OpenCodeMcpConfigManager(params.workingDirectory, params.mcpServers) : null;
|
|
1726
|
+
try {
|
|
1727
|
+
await mcpConfigManager?.setup();
|
|
1728
|
+
for await (const event of super.execute(params)) {
|
|
1729
|
+
if (event.type === "done") this.enrichDoneEvent(event);
|
|
1730
|
+
yield event;
|
|
1731
|
+
while (this.pendingEvents.length > 0) yield this.pendingEvents.shift();
|
|
1732
|
+
}
|
|
1733
|
+
} finally {
|
|
1734
|
+
await mcpConfigManager?.teardown();
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
buildArgs(params) {
|
|
1738
|
+
const args = [
|
|
1739
|
+
"run",
|
|
1740
|
+
"--format",
|
|
1741
|
+
"json"
|
|
1742
|
+
];
|
|
1743
|
+
if (params.sessionId) args.push("--session", params.sessionId);
|
|
1744
|
+
args.push(this.composePrompt(params));
|
|
1745
|
+
return args;
|
|
1746
|
+
}
|
|
1747
|
+
extractEvent(line) {
|
|
1748
|
+
const parsed = JSON.parse(line);
|
|
1749
|
+
if (!isObject(parsed) || typeof parsed.type !== "string") return null;
|
|
1750
|
+
if (typeof parsed.sessionID === "string" && this.currentSessionId === void 0) this.currentSessionId = parsed.sessionID;
|
|
1751
|
+
const data = isObject(parsed.part) ? parsed.part : parsed;
|
|
1752
|
+
switch (parsed.type) {
|
|
1753
|
+
case "text": return this.handleText(data);
|
|
1754
|
+
case "tool_use": return this.handleToolUse(data);
|
|
1755
|
+
case "step_start": return null;
|
|
1756
|
+
case "step_finish": return this.handleStepFinish(data);
|
|
1757
|
+
case "reasoning": return this.handleReasoning(data);
|
|
1758
|
+
case "error": return this.handleError(data);
|
|
1759
|
+
default: return null;
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
buildEnv(_params) {
|
|
1763
|
+
return {};
|
|
1764
|
+
}
|
|
1765
|
+
handleText(parsed) {
|
|
1766
|
+
const content = typeof parsed.text === "string" ? parsed.text : typeof parsed.content === "string" ? parsed.content : "";
|
|
1767
|
+
this.accumulatedText += content;
|
|
1768
|
+
return {
|
|
1769
|
+
type: "text",
|
|
1770
|
+
text: content
|
|
1771
|
+
};
|
|
1772
|
+
}
|
|
1773
|
+
handleToolUse(parsed) {
|
|
1774
|
+
const toolId = typeof parsed.callID === "string" ? parsed.callID : `opencode-tool-${this.toolCounter++}`;
|
|
1775
|
+
const state = isObject(parsed.state) ? parsed.state : void 0;
|
|
1776
|
+
this.pendingEvents.push({
|
|
1777
|
+
type: "tool_result",
|
|
1778
|
+
toolId,
|
|
1779
|
+
output: typeof state?.output === "string" ? state.output : "",
|
|
1780
|
+
isError: typeof state?.error === "string" && state.error.length > 0
|
|
1781
|
+
});
|
|
1782
|
+
return {
|
|
1783
|
+
type: "tool_use",
|
|
1784
|
+
toolName: typeof parsed.name === "string" ? parsed.name : "",
|
|
1785
|
+
toolId,
|
|
1786
|
+
input: isObject(parsed.input) ? parsed.input : {}
|
|
1787
|
+
};
|
|
1788
|
+
}
|
|
1789
|
+
handleStepFinish(parsed) {
|
|
1790
|
+
this.lastStepFinish = {
|
|
1791
|
+
tokens: isObject(parsed.tokens) ? parsed.tokens : void 0,
|
|
1792
|
+
cost: typeof parsed.cost === "number" ? parsed.cost : void 0,
|
|
1793
|
+
reason: typeof parsed.reason === "string" ? parsed.reason : void 0
|
|
1794
|
+
};
|
|
1795
|
+
return null;
|
|
1796
|
+
}
|
|
1797
|
+
handleError(parsed) {
|
|
1798
|
+
return {
|
|
1799
|
+
type: "error",
|
|
1800
|
+
message: typeof parsed.message === "string" ? parsed.message : "Unknown error"
|
|
1801
|
+
};
|
|
1802
|
+
}
|
|
1803
|
+
handleReasoning(parsed) {
|
|
1804
|
+
const content = typeof parsed.text === "string" ? parsed.text : typeof parsed.content === "string" ? parsed.content : "";
|
|
1805
|
+
if (!content) return null;
|
|
1806
|
+
return {
|
|
1807
|
+
type: "thinking",
|
|
1808
|
+
text: content
|
|
1809
|
+
};
|
|
1810
|
+
}
|
|
1811
|
+
enrichDoneEvent(event) {
|
|
1812
|
+
const { result } = event;
|
|
1813
|
+
result.text = this.accumulatedText;
|
|
1814
|
+
result.sessionId = this.currentSessionId;
|
|
1815
|
+
if (this.lastStepFinish) {
|
|
1816
|
+
const { tokens, cost, reason } = this.lastStepFinish;
|
|
1817
|
+
if (tokens) {
|
|
1818
|
+
const input = typeof tokens.input === "number" ? tokens.input : 0;
|
|
1819
|
+
const output = typeof tokens.output === "number" ? tokens.output : 0;
|
|
1820
|
+
const cache = isObject(tokens.cache) ? tokens.cache : void 0;
|
|
1821
|
+
const cacheRead = typeof cache?.read === "number" ? cache.read : 0;
|
|
1822
|
+
const cacheWrite = typeof cache?.write === "number" ? cache.write : 0;
|
|
1823
|
+
result.usage = {
|
|
1824
|
+
inputTokens: input,
|
|
1825
|
+
outputTokens: output,
|
|
1826
|
+
...cacheRead > 0 ? { cacheReadTokens: cacheRead } : {},
|
|
1827
|
+
...cacheWrite > 0 ? { cacheWriteTokens: cacheWrite } : {}
|
|
1828
|
+
};
|
|
1829
|
+
}
|
|
1830
|
+
if (cost !== void 0) result.totalCostUsd = cost;
|
|
1831
|
+
if (reason !== void 0) result.stopReason = reason;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
resetState() {
|
|
1835
|
+
this.currentSessionId = void 0;
|
|
1836
|
+
this.accumulatedText = "";
|
|
1837
|
+
this.lastStepFinish = void 0;
|
|
1838
|
+
this.pendingEvents = [];
|
|
1839
|
+
this.toolCounter = 0;
|
|
1840
|
+
}
|
|
1841
|
+
};
|
|
1842
|
+
/**
|
|
1843
|
+
* Manages the `.opencode/config.json` lifecycle for MCP server configuration.
|
|
1844
|
+
*
|
|
1845
|
+
* OpenCode reads MCP config from its project-level settings file. Uses a
|
|
1846
|
+
* merge-restore pattern (same as Gemini and Codex):
|
|
1847
|
+
*
|
|
1848
|
+
* - **Setup**: read existing `.opencode/config.json` (if any), save a copy,
|
|
1849
|
+
* merge `mcpServers` into it, write back.
|
|
1850
|
+
* - **Teardown** (always, via `finally`): restore the original file, or remove
|
|
1851
|
+
* the file/directory we created.
|
|
1852
|
+
*/
|
|
1853
|
+
var OpenCodeMcpConfigManager = class {
|
|
1854
|
+
constructor(workingDirectory, mcpServers) {
|
|
1855
|
+
this.mcpServers = mcpServers;
|
|
1856
|
+
this.originalContent = null;
|
|
1857
|
+
this.createdFile = false;
|
|
1858
|
+
this.createdDir = false;
|
|
1859
|
+
this.configDir = join(workingDirectory ?? process.cwd(), ".opencode");
|
|
1860
|
+
this.configPath = join(this.configDir, "config.json");
|
|
1861
|
+
}
|
|
1862
|
+
async setup() {
|
|
1863
|
+
try {
|
|
1864
|
+
await mkdir(this.configDir, { recursive: true });
|
|
1865
|
+
} catch {}
|
|
1866
|
+
let existingConfig = null;
|
|
1867
|
+
try {
|
|
1868
|
+
const content = await readFile(this.configPath, "utf-8");
|
|
1869
|
+
this.originalContent = content;
|
|
1870
|
+
existingConfig = JSON.parse(content);
|
|
1871
|
+
} catch {
|
|
1872
|
+
this.createdFile = true;
|
|
1873
|
+
try {
|
|
1874
|
+
if ((await readdir(this.configDir)).length === 0) this.createdDir = true;
|
|
1875
|
+
} catch {}
|
|
1876
|
+
}
|
|
1877
|
+
const mergedConfig = existingConfig ?? {};
|
|
1878
|
+
mergedConfig.mcpServers = this.mcpServers;
|
|
1879
|
+
await writeFile(this.configPath, JSON.stringify(mergedConfig, null, 2), "utf-8");
|
|
1880
|
+
}
|
|
1881
|
+
async teardown() {
|
|
1882
|
+
try {
|
|
1883
|
+
if (this.originalContent !== null) await writeFile(this.configPath, this.originalContent, "utf-8");
|
|
1884
|
+
else if (this.createdFile) {
|
|
1885
|
+
await rm(this.configPath, { force: true });
|
|
1886
|
+
if (this.createdDir) try {
|
|
1887
|
+
await rmdir(this.configDir);
|
|
1888
|
+
} catch {}
|
|
1889
|
+
}
|
|
1890
|
+
} catch {}
|
|
1891
|
+
}
|
|
1892
|
+
};
|
|
1893
|
+
function isObject(value) {
|
|
1894
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
//#endregion
|
|
1898
|
+
//#region src/middleware/runtime-factory.ts
|
|
1899
|
+
const SUPPORTED_PROVIDERS = [
|
|
1900
|
+
"claude",
|
|
1901
|
+
"gemini",
|
|
1902
|
+
"codex",
|
|
1903
|
+
"opencode"
|
|
1904
|
+
];
|
|
1905
|
+
const validatedCommands = /* @__PURE__ */ new Set();
|
|
1906
|
+
/**
|
|
1907
|
+
* Verify that a CLI binary exists on PATH.
|
|
1908
|
+
*
|
|
1909
|
+
* Results are cached per process lifetime so the `which` lookup runs at most
|
|
1910
|
+
* once per command.
|
|
1911
|
+
*/
|
|
1912
|
+
function validateExecutable(command) {
|
|
1913
|
+
if (validatedCommands.has(command)) {
|
|
1914
|
+
logDebug(`[runtime-factory] executable already validated: ${command}`);
|
|
1915
|
+
return;
|
|
1916
|
+
}
|
|
1917
|
+
try {
|
|
1918
|
+
execFileSync("which", [command], { stdio: "ignore" });
|
|
1919
|
+
logDebug(`[runtime-factory] executable validated: ${command}`);
|
|
1920
|
+
validatedCommands.add(command);
|
|
1921
|
+
} catch {
|
|
1922
|
+
throw new Error(`Runtime '${command}' is configured but the '${command}' binary was not found on PATH. Install it or set agents.defaults.runtime to a different provider.`);
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
function createCliRuntime(provider) {
|
|
1926
|
+
const normalized = provider.trim().toLowerCase();
|
|
1927
|
+
logDebug(`[runtime-factory] creating runtime: provider=${normalized}`);
|
|
1928
|
+
switch (normalized) {
|
|
1929
|
+
case "claude":
|
|
1930
|
+
validateExecutable(normalized);
|
|
1931
|
+
return new ClaudeCliRuntime();
|
|
1932
|
+
case "gemini":
|
|
1933
|
+
validateExecutable(normalized);
|
|
1934
|
+
return new GeminiCliRuntime();
|
|
1935
|
+
case "codex":
|
|
1936
|
+
validateExecutable(normalized);
|
|
1937
|
+
return new CodexCliRuntime();
|
|
1938
|
+
case "opencode":
|
|
1939
|
+
validateExecutable(normalized);
|
|
1940
|
+
return new OpenCodeCliRuntime();
|
|
1941
|
+
default: throw new Error(`Unknown runtime provider "${provider}". Supported providers: ${SUPPORTED_PROVIDERS.join(", ")}`);
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
//#endregion
|
|
1946
|
+
//#region src/middleware/system-prompt.ts
|
|
1947
|
+
const SAFETY_SECTION = [
|
|
1948
|
+
"## Safety",
|
|
1949
|
+
"You have no independent goals: do not pursue self-preservation, replication, resource acquisition, or power-seeking; avoid long-term plans beyond the user's request.",
|
|
1950
|
+
"Prioritize safety and human oversight over completion; if instructions conflict, pause and ask; comply with stop/pause/audit requests and never bypass safeguards.",
|
|
1951
|
+
"Do not manipulate or persuade anyone to expand access or disable safeguards. Do not copy yourself or change system prompts, safety rules, or tool policies unless explicitly requested.",
|
|
1952
|
+
"Never expose credentials, API keys, or secrets in replies or tool calls. Respect user privacy."
|
|
1953
|
+
].join("\n");
|
|
1954
|
+
const MESSAGING_SECTION = [
|
|
1955
|
+
"## Messaging",
|
|
1956
|
+
"- Reply in current session: automatically routes to the source channel.",
|
|
1957
|
+
"- Cross-session messaging: use sessions_send(sessionKey, message) to reach other channels.",
|
|
1958
|
+
"- `[System Message] ...` blocks are internal context and are not user-visible.",
|
|
1959
|
+
`- If a \`[System Message]\` reports completed work and asks for a user update, rewrite it in your normal assistant voice and send that update (do not forward raw system text or default to ${SILENT_REPLY_TOKEN}).`,
|
|
1960
|
+
"- Never use exec/curl for provider messaging; RemoteClaw handles all routing internally."
|
|
1961
|
+
].join("\n");
|
|
1962
|
+
const REPLY_TAGS_SECTION = [
|
|
1963
|
+
"## Reply Tags",
|
|
1964
|
+
"To request a native reply/quote on supported surfaces, include one tag in your reply:",
|
|
1965
|
+
"- Reply tags must be the very first token in the message (no leading text/newlines): [[reply_to_current]] your reply.",
|
|
1966
|
+
"- [[reply_to_current]] replies to the triggering message.",
|
|
1967
|
+
"- Prefer [[reply_to_current]]. Use [[reply_to:<id>]] only when an id was explicitly provided (e.g. by the user or a tool).",
|
|
1968
|
+
"Whitespace inside the tag is allowed (e.g. [[ reply_to_current ]] / [[ reply_to: 123 ]]).",
|
|
1969
|
+
"Tags are stripped before sending; support depends on the current channel config."
|
|
1970
|
+
].join("\n");
|
|
1971
|
+
const SILENT_REPLIES_SECTION = [
|
|
1972
|
+
"## Silent Replies",
|
|
1973
|
+
`When you have nothing to say, respond with ONLY: ${SILENT_REPLY_TOKEN}`,
|
|
1974
|
+
"",
|
|
1975
|
+
"Rules:",
|
|
1976
|
+
"- It must be your ENTIRE message — nothing else.",
|
|
1977
|
+
`- Never append it to an actual response (never include "${SILENT_REPLY_TOKEN}" in real replies).`,
|
|
1978
|
+
"- Never wrap it in markdown or code blocks."
|
|
1979
|
+
].join("\n");
|
|
1980
|
+
function buildIdentitySection(channelName, userName) {
|
|
1981
|
+
const intro = "You are running inside RemoteClaw, a middleware that connects AI agents to messaging channels.";
|
|
1982
|
+
return userName ? `${intro}\nYou are responding to a message from ${userName} on ${channelName}.` : `${intro}\nYou are responding to a message on ${channelName}.`;
|
|
1983
|
+
}
|
|
1984
|
+
function buildRuntimeSection(params) {
|
|
1985
|
+
const parts = [`channel=${params.channelName}`];
|
|
1986
|
+
if (params.timezone) parts.push(`timezone=${params.timezone}`);
|
|
1987
|
+
if (params.agentId) parts.push(`agent=${params.agentId}`);
|
|
1988
|
+
return `## Runtime\nRuntime: ${parts.join(" | ")}`;
|
|
1989
|
+
}
|
|
1990
|
+
function buildWorkspaceSection(workspaceDir) {
|
|
1991
|
+
return [
|
|
1992
|
+
"## Workspace",
|
|
1993
|
+
`Your working directory is: ${workspaceDir}`,
|
|
1994
|
+
"Treat this directory as the single global workspace for file operations unless explicitly instructed otherwise."
|
|
1995
|
+
].join("\n");
|
|
1996
|
+
}
|
|
1997
|
+
function buildMessageToolHintsSection(hints) {
|
|
1998
|
+
if (!hints || hints.length === 0) return;
|
|
1999
|
+
return `## Message Formatting\n${hints.join("\n")}`;
|
|
2000
|
+
}
|
|
2001
|
+
function buildAuthorizedSendersSection(senders) {
|
|
2002
|
+
const filtered = senders?.filter(Boolean);
|
|
2003
|
+
if (!filtered || filtered.length === 0) return;
|
|
2004
|
+
return `## Authorized Senders\nAuthorized senders: ${filtered.join(", ")}. These senders are allowlisted; do not assume they are the owner.`;
|
|
2005
|
+
}
|
|
2006
|
+
function buildReactionsSection(guidance) {
|
|
2007
|
+
if (!guidance) return;
|
|
2008
|
+
const { level, channel } = guidance;
|
|
2009
|
+
if (level === "minimal") return [
|
|
2010
|
+
"## Reactions",
|
|
2011
|
+
`Reactions are enabled for ${channel} in MINIMAL mode.`,
|
|
2012
|
+
"React ONLY when truly relevant:",
|
|
2013
|
+
"- Acknowledge important user requests or confirmations",
|
|
2014
|
+
"- Express genuine sentiment (humor, appreciation) sparingly",
|
|
2015
|
+
"- Avoid reacting to routine messages or your own replies",
|
|
2016
|
+
"Guideline: at most 1 reaction per 5-10 exchanges."
|
|
2017
|
+
].join("\n");
|
|
2018
|
+
return [
|
|
2019
|
+
"## Reactions",
|
|
2020
|
+
`Reactions are enabled for ${channel} in EXTENSIVE mode.`,
|
|
2021
|
+
"Feel free to react liberally:",
|
|
2022
|
+
"- Acknowledge messages with appropriate emojis",
|
|
2023
|
+
"- Express sentiment and personality through reactions",
|
|
2024
|
+
"- React to interesting content, humor, or notable events",
|
|
2025
|
+
"- Use reactions to confirm understanding or agreement",
|
|
2026
|
+
"Guideline: react whenever it feels natural."
|
|
2027
|
+
].join("\n");
|
|
2028
|
+
}
|
|
2029
|
+
/**
|
|
2030
|
+
* Build the RemoteClaw system prompt for injection into CLI subprocess agents.
|
|
2031
|
+
*
|
|
2032
|
+
* Assembles ~10 sections totaling ~3,000-5,000 chars (~770-1,270 tokens).
|
|
2033
|
+
* No promptMode switch (always full), no bootstrap context (CLI agent handles),
|
|
2034
|
+
* no tool list (MCP handles), no skills/memory/sandbox sections.
|
|
2035
|
+
*/
|
|
2036
|
+
function buildSystemPrompt(params) {
|
|
2037
|
+
const sections = [
|
|
2038
|
+
buildIdentitySection(params.channelName, params.userName),
|
|
2039
|
+
SAFETY_SECTION,
|
|
2040
|
+
MESSAGING_SECTION
|
|
2041
|
+
];
|
|
2042
|
+
const hintsSection = buildMessageToolHintsSection(params.messageToolHints);
|
|
2043
|
+
if (hintsSection) sections.push(hintsSection);
|
|
2044
|
+
sections.push(REPLY_TAGS_SECTION);
|
|
2045
|
+
sections.push(SILENT_REPLIES_SECTION);
|
|
2046
|
+
const sendersSection = buildAuthorizedSendersSection(params.authorizedSenders);
|
|
2047
|
+
if (sendersSection) sections.push(sendersSection);
|
|
2048
|
+
const reactionsSection = buildReactionsSection(params.reactionGuidance);
|
|
2049
|
+
if (reactionsSection) sections.push(reactionsSection);
|
|
2050
|
+
sections.push(buildRuntimeSection(params));
|
|
2051
|
+
sections.push(buildWorkspaceSection(params.workspaceDir));
|
|
2052
|
+
return sections.join("\n\n");
|
|
2053
|
+
}
|
|
2054
|
+
|
|
2055
|
+
//#endregion
|
|
2056
|
+
//#region src/middleware/channel-bridge.ts
|
|
2057
|
+
const DEFAULT_WORKSPACE_DIR = ".";
|
|
2058
|
+
const DEFAULT_MCP_SERVER_PATH = join("dist", "middleware", "mcp-server.js");
|
|
2059
|
+
const EMPTY_SIDE_EFFECTS = {
|
|
2060
|
+
sentTexts: [],
|
|
2061
|
+
sentMediaUrls: [],
|
|
2062
|
+
sentTargets: [],
|
|
2063
|
+
cronAdds: 0
|
|
2064
|
+
};
|
|
2065
|
+
const DEFAULT_RUN_RESULT = {
|
|
2066
|
+
text: "",
|
|
2067
|
+
sessionId: void 0,
|
|
2068
|
+
durationMs: 0,
|
|
2069
|
+
usage: void 0,
|
|
2070
|
+
aborted: false
|
|
2071
|
+
};
|
|
2072
|
+
/**
|
|
2073
|
+
* Central orchestrator connecting incoming channel messages to CLI agent execution and delivery.
|
|
2074
|
+
*
|
|
2075
|
+
* `handle()` is the single entry point for all dispatch sites: agent command, auto-reply,
|
|
2076
|
+
* cron, and follow-up. It wires together runtime factory, session map, error classifier,
|
|
2077
|
+
* delivery adapter, system prompt builder, and MCP side effects.
|
|
2078
|
+
*/
|
|
2079
|
+
var ChannelBridge = class {
|
|
2080
|
+
#provider;
|
|
2081
|
+
#sessionMap;
|
|
2082
|
+
#gatewayUrl;
|
|
2083
|
+
#gatewayToken;
|
|
2084
|
+
#workspaceDir;
|
|
2085
|
+
#chunkLimit;
|
|
2086
|
+
#mcpServerPath;
|
|
2087
|
+
#runtimeArgs;
|
|
2088
|
+
#runtimeEnv;
|
|
2089
|
+
constructor(options) {
|
|
2090
|
+
this.#provider = options.provider;
|
|
2091
|
+
this.#sessionMap = options.sessionMap;
|
|
2092
|
+
this.#gatewayUrl = options.gatewayUrl;
|
|
2093
|
+
this.#gatewayToken = options.gatewayToken;
|
|
2094
|
+
this.#workspaceDir = options.workspaceDir ?? DEFAULT_WORKSPACE_DIR;
|
|
2095
|
+
this.#chunkLimit = options.chunkLimit;
|
|
2096
|
+
this.#mcpServerPath = options.mcpServerPath ?? DEFAULT_MCP_SERVER_PATH;
|
|
2097
|
+
this.#runtimeArgs = options.runtimeArgs;
|
|
2098
|
+
this.#runtimeEnv = options.runtimeEnv;
|
|
2099
|
+
}
|
|
2100
|
+
/**
|
|
2101
|
+
* Process an incoming channel message through the full agent execution pipeline.
|
|
2102
|
+
*
|
|
2103
|
+
* Flow: session lookup → system prompt → MCP config → runtime execution →
|
|
2104
|
+
* event streaming → error classification → side effects → session update → result assembly.
|
|
2105
|
+
*/
|
|
2106
|
+
async handle(message, callbacks, abortSignal) {
|
|
2107
|
+
const sessionKey = buildSessionKey(message);
|
|
2108
|
+
logDebug(`[channel-bridge] handle: channel=${message.provider} from=${message.from} channelId=${message.channelId} threadId=${message.replyToId ?? "none"} agentId=${message.agentId ?? "default"} media=${message.mediaUrls?.length ?? 0}`);
|
|
2109
|
+
const existingSessionId = await this.#sessionMap.get(sessionKey);
|
|
2110
|
+
logDebug(`[channel-bridge] session lookup: key=${formatSessionKeyString(sessionKey)} ${existingSessionId ? `hit=${existingSessionId}` : "miss"}`);
|
|
2111
|
+
const hookRunner = getGlobalHookRunner();
|
|
2112
|
+
if (existingSessionId && hookRunner?.hasHooks("session_resumed")) await hookRunner.runSessionResumed({
|
|
2113
|
+
sessionId: existingSessionId,
|
|
2114
|
+
runtimeName: this.#provider,
|
|
2115
|
+
channelId: message.channelId,
|
|
2116
|
+
userId: message.from,
|
|
2117
|
+
resumeMethod: "session_map"
|
|
2118
|
+
}, {
|
|
2119
|
+
sessionId: existingSessionId,
|
|
2120
|
+
channelId: message.channelId,
|
|
2121
|
+
runtimeName: this.#provider
|
|
2122
|
+
});
|
|
2123
|
+
const systemPrompt = buildSystemPrompt({
|
|
2124
|
+
channelName: message.provider,
|
|
2125
|
+
workspaceDir: this.#workspaceDir,
|
|
2126
|
+
messageToolHints: message.messageToolHints,
|
|
2127
|
+
userName: message.userName,
|
|
2128
|
+
agentId: message.agentId,
|
|
2129
|
+
timezone: message.timezone,
|
|
2130
|
+
authorizedSenders: message.authorizedSenders,
|
|
2131
|
+
reactionGuidance: message.reactionGuidance
|
|
2132
|
+
});
|
|
2133
|
+
const invocationDir = await createInvocationDir();
|
|
2134
|
+
const sideEffectsFile = join(invocationDir, "side-effects.ndjson");
|
|
2135
|
+
try {
|
|
2136
|
+
const mcpServers = this.#buildMcpConfig(message, sessionKey, sideEffectsFile);
|
|
2137
|
+
logDebug(`[channel-bridge] creating runtime: provider=${this.#provider}`);
|
|
2138
|
+
const runtime = createCliRuntime(this.#provider);
|
|
2139
|
+
let workspaceDir = this.#workspaceDir;
|
|
2140
|
+
let hookEnv;
|
|
2141
|
+
const runId = randomUUID();
|
|
2142
|
+
if (hookRunner?.hasHooks("before_runtime_spawn")) {
|
|
2143
|
+
const spawnResult = await hookRunner.runBeforeRuntimeSpawn({
|
|
2144
|
+
runtimeName: this.#provider,
|
|
2145
|
+
sessionId: existingSessionId,
|
|
2146
|
+
command: "node",
|
|
2147
|
+
args: [this.#mcpServerPath],
|
|
2148
|
+
env: mcpServers.remoteclaw?.env ?? {},
|
|
2149
|
+
workspaceDir,
|
|
2150
|
+
channelId: message.channelId
|
|
2151
|
+
}, {
|
|
2152
|
+
sessionId: existingSessionId,
|
|
2153
|
+
channelId: message.channelId,
|
|
2154
|
+
runtimeName: this.#provider
|
|
2155
|
+
});
|
|
2156
|
+
if (spawnResult?.workspaceDir) {
|
|
2157
|
+
logDebug(`[channel-bridge] hook overrode workspaceDir: ${this.#workspaceDir} -> ${spawnResult.workspaceDir}`);
|
|
2158
|
+
workspaceDir = spawnResult.workspaceDir;
|
|
2159
|
+
}
|
|
2160
|
+
if (spawnResult?.env) {
|
|
2161
|
+
logDebug(`[channel-bridge] hook injected env keys: ${Object.keys(spawnResult.env).join(", ")}`);
|
|
2162
|
+
hookEnv = spawnResult.env;
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
const resolvedMedia = message.mediaUrls?.length ? await resolveMediaAttachments(message.mediaUrls, invocationDir) : void 0;
|
|
2166
|
+
if (resolvedMedia?.length) logDebug(`[channel-bridge] resolved ${resolvedMedia.length}/${message.mediaUrls.length} media attachments`);
|
|
2167
|
+
const { supported: supportedMedia, unsupported: unsupportedMedia } = resolvedMedia?.length ? partitionMedia(runtime, resolvedMedia) : {
|
|
2168
|
+
supported: [],
|
|
2169
|
+
unsupported: []
|
|
2170
|
+
};
|
|
2171
|
+
const mediaWarning = formatUnsupportedMediaWarning(unsupportedMedia, this.#provider);
|
|
2172
|
+
if (unsupportedMedia.length > 0) logDebug(`[channel-bridge] unsupported media: ${unsupportedMedia.length} attachment(s) not accepted by ${this.#provider}`);
|
|
2173
|
+
const adapter = new DeliveryAdapter(this.#chunkLimit !== void 0 ? { chunkLimit: this.#chunkLimit } : void 0);
|
|
2174
|
+
let runResult;
|
|
2175
|
+
let lastError;
|
|
2176
|
+
let payloads;
|
|
2177
|
+
try {
|
|
2178
|
+
const captured = captureResult(runtime.execute({
|
|
2179
|
+
prompt: message.text,
|
|
2180
|
+
systemPrompt,
|
|
2181
|
+
extraContext: message.extraContext,
|
|
2182
|
+
threadContext: message.threadContext,
|
|
2183
|
+
media: supportedMedia?.length ? supportedMedia : void 0,
|
|
2184
|
+
sessionId: existingSessionId,
|
|
2185
|
+
mcpServers,
|
|
2186
|
+
abortSignal,
|
|
2187
|
+
workingDirectory: workspaceDir,
|
|
2188
|
+
env: this.#runtimeEnv || hookEnv ? {
|
|
2189
|
+
...this.#runtimeEnv,
|
|
2190
|
+
...hookEnv
|
|
2191
|
+
} : void 0,
|
|
2192
|
+
extraArgs: this.#runtimeArgs
|
|
2193
|
+
}));
|
|
2194
|
+
payloads = await adapter.process(captured.events, callbacks);
|
|
2195
|
+
runResult = captured.getResult();
|
|
2196
|
+
lastError = captured.getError();
|
|
2197
|
+
} catch (err) {
|
|
2198
|
+
const errMsg = String(err);
|
|
2199
|
+
const category = classifyError(errMsg);
|
|
2200
|
+
logDebug(`[channel-bridge] runtime threw: category=${category} error=${errMsg.slice(0, 500)}`);
|
|
2201
|
+
lastError = errMsg;
|
|
2202
|
+
payloads = [];
|
|
2203
|
+
runResult = {
|
|
2204
|
+
...DEFAULT_RUN_RESULT,
|
|
2205
|
+
errorSubtype: category === "context_overflow" ? "context_window" : category
|
|
2206
|
+
};
|
|
2207
|
+
}
|
|
2208
|
+
if (mediaWarning) payloads.unshift({ text: mediaWarning });
|
|
2209
|
+
let mcp;
|
|
2210
|
+
try {
|
|
2211
|
+
mcp = await readMcpSideEffects(sideEffectsFile);
|
|
2212
|
+
} catch {
|
|
2213
|
+
mcp = { ...EMPTY_SIDE_EFFECTS };
|
|
2214
|
+
}
|
|
2215
|
+
logDebug(`[channel-bridge] side effects: sentTexts=${mcp.sentTexts.length} sentMedia=${mcp.sentMediaUrls.length} cronAdds=${mcp.cronAdds}`);
|
|
2216
|
+
if (runResult?.sessionId && !lastError) {
|
|
2217
|
+
logDebug(`[channel-bridge] session update: key=${formatSessionKeyString(sessionKey)} sessionId=${runResult.sessionId}`);
|
|
2218
|
+
await this.#sessionMap.set(sessionKey, runResult.sessionId);
|
|
2219
|
+
}
|
|
2220
|
+
const finalResult = runResult ?? { ...DEFAULT_RUN_RESULT };
|
|
2221
|
+
if (hookRunner) {
|
|
2222
|
+
const runtimeCtx = {
|
|
2223
|
+
sessionId: finalResult.sessionId,
|
|
2224
|
+
channelId: message.channelId,
|
|
2225
|
+
runtimeName: this.#provider
|
|
2226
|
+
};
|
|
2227
|
+
if (hookRunner.hasHooks("after_runtime_exit")) hookRunner.runAfterRuntimeExit({
|
|
2228
|
+
runtimeName: this.#provider,
|
|
2229
|
+
sessionId: finalResult.sessionId,
|
|
2230
|
+
exitCode: finalResult.errorSubtype ? 1 : 0,
|
|
2231
|
+
durationMs: finalResult.durationMs,
|
|
2232
|
+
stdout: finalResult.text,
|
|
2233
|
+
stderr: lastError,
|
|
2234
|
+
mcpSideEffects: {
|
|
2235
|
+
sentTexts: mcp.sentTexts,
|
|
2236
|
+
sentMediaUrls: mcp.sentMediaUrls,
|
|
2237
|
+
cronAdds: mcp.cronAdds
|
|
2238
|
+
}
|
|
2239
|
+
}, runtimeCtx);
|
|
2240
|
+
if (hookRunner.hasHooks("agent_end")) hookRunner.runAgentEnd({
|
|
2241
|
+
runId,
|
|
2242
|
+
sessionId: finalResult.sessionId,
|
|
2243
|
+
success: !finalResult.errorSubtype && !lastError,
|
|
2244
|
+
durationMs: finalResult.durationMs
|
|
2245
|
+
}, runtimeCtx);
|
|
2246
|
+
}
|
|
2247
|
+
logDebug(`[channel-bridge] complete: runId=${runId} duration=${finalResult.durationMs}ms payloads=${payloads.length} error=${lastError ?? "none"}`);
|
|
2248
|
+
return {
|
|
2249
|
+
payloads,
|
|
2250
|
+
run: finalResult,
|
|
2251
|
+
mcp,
|
|
2252
|
+
error: lastError
|
|
2253
|
+
};
|
|
2254
|
+
} finally {
|
|
2255
|
+
await rm(invocationDir, {
|
|
2256
|
+
recursive: true,
|
|
2257
|
+
force: true
|
|
2258
|
+
}).catch(() => {});
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
/** Build MCP server configuration for the remoteclaw MCP server. */
|
|
2262
|
+
#buildMcpConfig(message, sessionKey, sideEffectsFile) {
|
|
2263
|
+
return { remoteclaw: {
|
|
2264
|
+
command: "node",
|
|
2265
|
+
args: [this.#mcpServerPath],
|
|
2266
|
+
env: {
|
|
2267
|
+
REMOTECLAW_GATEWAY_URL: this.#gatewayUrl,
|
|
2268
|
+
REMOTECLAW_GATEWAY_TOKEN: this.#gatewayToken,
|
|
2269
|
+
REMOTECLAW_SESSION_KEY: formatSessionKeyString(sessionKey),
|
|
2270
|
+
REMOTECLAW_SIDE_EFFECTS_FILE: sideEffectsFile,
|
|
2271
|
+
REMOTECLAW_CHANNEL: message.provider,
|
|
2272
|
+
REMOTECLAW_ACCOUNT_ID: message.from,
|
|
2273
|
+
REMOTECLAW_TO: message.channelId,
|
|
2274
|
+
...message.replyToId ? { REMOTECLAW_THREAD_ID: message.replyToId } : {},
|
|
2275
|
+
REMOTECLAW_SENDER_IS_OWNER: String(message.senderIsOwner ?? false),
|
|
2276
|
+
REMOTECLAW_TOOL_PROFILE: message.toolProfile ?? "full"
|
|
2277
|
+
}
|
|
2278
|
+
} };
|
|
2279
|
+
}
|
|
2280
|
+
};
|
|
2281
|
+
/** Build a SessionKey from a ChannelMessage. */
|
|
2282
|
+
function buildSessionKey(message) {
|
|
2283
|
+
return {
|
|
2284
|
+
channelId: message.channelId,
|
|
2285
|
+
userId: message.from,
|
|
2286
|
+
threadId: message.replyToId
|
|
2287
|
+
};
|
|
2288
|
+
}
|
|
2289
|
+
/** Format a SessionKey as a composite string (for env vars). */
|
|
2290
|
+
function formatSessionKeyString(key) {
|
|
2291
|
+
return `${key.channelId}:${key.userId}:${key.threadId ?? "_"}`;
|
|
2292
|
+
}
|
|
2293
|
+
/** Create a unique temp directory for an invocation. */
|
|
2294
|
+
async function createInvocationDir() {
|
|
2295
|
+
return mkdtemp(join(tmpdir(), "rc-"));
|
|
2296
|
+
}
|
|
2297
|
+
/**
|
|
2298
|
+
* Wrap an event stream to capture the AgentRunResult from the done event
|
|
2299
|
+
* and any error messages, while passing all events through to the consumer.
|
|
2300
|
+
*/
|
|
2301
|
+
function captureResult(events) {
|
|
2302
|
+
let result;
|
|
2303
|
+
let error;
|
|
2304
|
+
async function* wrapped() {
|
|
2305
|
+
for await (const event of events) {
|
|
2306
|
+
if (event.type === "done") result = event.result;
|
|
2307
|
+
else if (event.type === "error") error = event.message;
|
|
2308
|
+
yield event;
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
return {
|
|
2312
|
+
events: wrapped(),
|
|
2313
|
+
getResult: () => result,
|
|
2314
|
+
getError: () => error
|
|
2315
|
+
};
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
//#endregion
|
|
2319
|
+
//#region src/agents/cli-session.ts
|
|
2320
|
+
function getCliSessionId(entry, provider) {
|
|
2321
|
+
if (!entry) return;
|
|
2322
|
+
const normalized = normalizeProviderId(provider);
|
|
2323
|
+
const fromMap = entry.cliSessionIds?.[normalized];
|
|
2324
|
+
if (fromMap?.trim()) return fromMap.trim();
|
|
2325
|
+
if (normalized === "claude-cli") {
|
|
2326
|
+
const legacy = entry.claudeCliSessionId?.trim();
|
|
2327
|
+
if (legacy) return legacy;
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
function setCliSessionId(entry, provider, sessionId) {
|
|
2331
|
+
const normalized = normalizeProviderId(provider);
|
|
2332
|
+
const trimmed = sessionId.trim();
|
|
2333
|
+
if (!trimmed) return;
|
|
2334
|
+
entry.cliSessionIds = { ...entry.cliSessionIds ?? {} };
|
|
2335
|
+
entry.cliSessionIds[normalized] = trimmed;
|
|
2336
|
+
if (normalized === "claude-cli") entry.claudeCliSessionId = trimmed;
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
//#endregion
|
|
2340
|
+
//#region src/infra/outbound/targets.ts
|
|
2341
|
+
function resolveSessionDeliveryTarget(params) {
|
|
2342
|
+
const context = deliveryContextFromSession(params.entry);
|
|
2343
|
+
const sessionLastChannel = context?.channel && isDeliverableMessageChannel(context.channel) ? context.channel : void 0;
|
|
2344
|
+
const hasTurnSourceChannel = params.turnSourceChannel != null;
|
|
2345
|
+
const lastChannel = hasTurnSourceChannel ? params.turnSourceChannel : sessionLastChannel;
|
|
2346
|
+
const lastTo = hasTurnSourceChannel ? params.turnSourceTo : context?.to;
|
|
2347
|
+
const lastAccountId = hasTurnSourceChannel ? params.turnSourceAccountId : context?.accountId;
|
|
2348
|
+
const lastThreadId = hasTurnSourceChannel ? params.turnSourceThreadId : context?.threadId;
|
|
2349
|
+
const rawRequested = params.requestedChannel ?? "last";
|
|
2350
|
+
const requested = rawRequested === "last" ? "last" : normalizeMessageChannel(rawRequested);
|
|
2351
|
+
const requestedChannel = requested === "last" ? "last" : requested && isDeliverableMessageChannel(requested) ? requested : void 0;
|
|
2352
|
+
const rawExplicitTo = typeof params.explicitTo === "string" && params.explicitTo.trim() ? params.explicitTo.trim() : void 0;
|
|
2353
|
+
let channel = requestedChannel === "last" ? lastChannel : requestedChannel;
|
|
2354
|
+
if (!channel && params.fallbackChannel && isDeliverableMessageChannel(params.fallbackChannel)) channel = params.fallbackChannel;
|
|
2355
|
+
const isTelegramContext = channel === "telegram" || !channel && lastChannel === "telegram";
|
|
2356
|
+
let explicitTo = rawExplicitTo;
|
|
2357
|
+
let parsedThreadId;
|
|
2358
|
+
if (isTelegramContext && rawExplicitTo && rawExplicitTo.includes(":topic:")) {
|
|
2359
|
+
const parsed = parseTelegramTarget(rawExplicitTo);
|
|
2360
|
+
explicitTo = parsed.chatId;
|
|
2361
|
+
parsedThreadId = parsed.messageThreadId;
|
|
2362
|
+
}
|
|
2363
|
+
const explicitThreadId = params.explicitThreadId != null && params.explicitThreadId !== "" ? params.explicitThreadId : parsedThreadId;
|
|
2364
|
+
let to = explicitTo;
|
|
2365
|
+
if (!to && lastTo) {
|
|
2366
|
+
if (channel && channel === lastChannel) to = lastTo;
|
|
2367
|
+
else if (params.allowMismatchedLastTo) to = lastTo;
|
|
2368
|
+
}
|
|
2369
|
+
const mode = params.mode ?? (explicitTo ? "explicit" : "implicit");
|
|
2370
|
+
const accountId = channel && channel === lastChannel ? lastAccountId : void 0;
|
|
2371
|
+
const resolvedThreadId = explicitThreadId ?? (mode !== "heartbeat" && channel && channel === lastChannel ? lastThreadId : void 0);
|
|
2372
|
+
return {
|
|
2373
|
+
channel,
|
|
2374
|
+
to,
|
|
2375
|
+
accountId,
|
|
2376
|
+
threadId: resolvedThreadId,
|
|
2377
|
+
threadIdExplicit: resolvedThreadId != null && explicitThreadId != null,
|
|
2378
|
+
mode,
|
|
2379
|
+
lastChannel,
|
|
2380
|
+
lastTo,
|
|
2381
|
+
lastAccountId,
|
|
2382
|
+
lastThreadId
|
|
2383
|
+
};
|
|
2384
|
+
}
|
|
2385
|
+
function resolveOutboundTarget(params) {
|
|
2386
|
+
if (params.channel === INTERNAL_MESSAGE_CHANNEL) return {
|
|
2387
|
+
ok: false,
|
|
2388
|
+
error: /* @__PURE__ */ new Error(`Delivering to WebChat is not supported via \`${formatCliCommand("remoteclaw agent")}\`; use WhatsApp/Telegram or run with --deliver=false.`)
|
|
2389
|
+
};
|
|
2390
|
+
const plugin = getChannelPlugin(params.channel);
|
|
2391
|
+
if (!plugin) return {
|
|
2392
|
+
ok: false,
|
|
2393
|
+
error: /* @__PURE__ */ new Error(`Unsupported channel: ${params.channel}`)
|
|
2394
|
+
};
|
|
2395
|
+
const allowFrom = (params.allowFrom ?? (params.cfg && plugin.config.resolveAllowFrom ? plugin.config.resolveAllowFrom({
|
|
2396
|
+
cfg: params.cfg,
|
|
2397
|
+
accountId: params.accountId ?? void 0
|
|
2398
|
+
}) : void 0))?.map((entry) => String(entry));
|
|
2399
|
+
const effectiveTo = params.to?.trim() || (params.cfg && plugin.config.resolveDefaultTo ? plugin.config.resolveDefaultTo({
|
|
2400
|
+
cfg: params.cfg,
|
|
2401
|
+
accountId: params.accountId ?? void 0
|
|
2402
|
+
}) : void 0);
|
|
2403
|
+
const resolveTarget = plugin.outbound?.resolveTarget;
|
|
2404
|
+
if (resolveTarget) return resolveTarget({
|
|
2405
|
+
cfg: params.cfg,
|
|
2406
|
+
to: effectiveTo,
|
|
2407
|
+
allowFrom,
|
|
2408
|
+
accountId: params.accountId ?? void 0,
|
|
2409
|
+
mode: params.mode ?? "explicit"
|
|
2410
|
+
});
|
|
2411
|
+
if (effectiveTo) return {
|
|
2412
|
+
ok: true,
|
|
2413
|
+
to: effectiveTo
|
|
2414
|
+
};
|
|
2415
|
+
const hint = plugin.messaging?.targetResolver?.hint;
|
|
2416
|
+
return {
|
|
2417
|
+
ok: false,
|
|
2418
|
+
error: missingTargetError(plugin.meta.label ?? params.channel, hint)
|
|
2419
|
+
};
|
|
2420
|
+
}
|
|
2421
|
+
function resolveHeartbeatDeliveryTarget(params) {
|
|
2422
|
+
const { cfg, entry } = params;
|
|
2423
|
+
const heartbeat = params.heartbeat ?? cfg.agents?.defaults?.heartbeat;
|
|
2424
|
+
const rawTarget = heartbeat?.target;
|
|
2425
|
+
let target = "none";
|
|
2426
|
+
if (rawTarget === "none" || rawTarget === "last") target = rawTarget;
|
|
2427
|
+
else if (typeof rawTarget === "string") {
|
|
2428
|
+
const normalized = normalizeChannelId(rawTarget);
|
|
2429
|
+
if (normalized) target = normalized;
|
|
2430
|
+
}
|
|
2431
|
+
if (target === "none") {
|
|
2432
|
+
const base = resolveSessionDeliveryTarget({ entry });
|
|
2433
|
+
return buildNoHeartbeatDeliveryTarget({
|
|
2434
|
+
reason: "target-none",
|
|
2435
|
+
lastChannel: base.lastChannel,
|
|
2436
|
+
lastAccountId: base.lastAccountId
|
|
2437
|
+
});
|
|
2438
|
+
}
|
|
2439
|
+
const resolvedTarget = resolveSessionDeliveryTarget({
|
|
2440
|
+
entry,
|
|
2441
|
+
requestedChannel: target === "last" ? "last" : target,
|
|
2442
|
+
explicitTo: heartbeat?.to,
|
|
2443
|
+
mode: "heartbeat"
|
|
2444
|
+
});
|
|
2445
|
+
const heartbeatAccountId = heartbeat?.accountId?.trim();
|
|
2446
|
+
let effectiveAccountId = heartbeatAccountId || resolvedTarget.accountId;
|
|
2447
|
+
if (heartbeatAccountId && resolvedTarget.channel) {
|
|
2448
|
+
const listAccountIds = getChannelPlugin(resolvedTarget.channel)?.config.listAccountIds;
|
|
2449
|
+
const accountIds = listAccountIds ? listAccountIds(cfg) : [];
|
|
2450
|
+
if (accountIds.length > 0) {
|
|
2451
|
+
const normalizedAccountId = normalizeAccountId(heartbeatAccountId);
|
|
2452
|
+
if (!new Set(accountIds.map((accountId) => normalizeAccountId(accountId))).has(normalizedAccountId)) return buildNoHeartbeatDeliveryTarget({
|
|
2453
|
+
reason: "unknown-account",
|
|
2454
|
+
accountId: normalizedAccountId,
|
|
2455
|
+
lastChannel: resolvedTarget.lastChannel,
|
|
2456
|
+
lastAccountId: resolvedTarget.lastAccountId
|
|
2457
|
+
});
|
|
2458
|
+
effectiveAccountId = normalizedAccountId;
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2461
|
+
if (!resolvedTarget.channel || !resolvedTarget.to) return buildNoHeartbeatDeliveryTarget({
|
|
2462
|
+
reason: "no-target",
|
|
2463
|
+
accountId: effectiveAccountId,
|
|
2464
|
+
lastChannel: resolvedTarget.lastChannel,
|
|
2465
|
+
lastAccountId: resolvedTarget.lastAccountId
|
|
2466
|
+
});
|
|
2467
|
+
const resolved = resolveOutboundTarget({
|
|
2468
|
+
channel: resolvedTarget.channel,
|
|
2469
|
+
to: resolvedTarget.to,
|
|
2470
|
+
cfg,
|
|
2471
|
+
accountId: effectiveAccountId,
|
|
2472
|
+
mode: "heartbeat"
|
|
2473
|
+
});
|
|
2474
|
+
if (!resolved.ok) return buildNoHeartbeatDeliveryTarget({
|
|
2475
|
+
reason: "no-target",
|
|
2476
|
+
accountId: effectiveAccountId,
|
|
2477
|
+
lastChannel: resolvedTarget.lastChannel,
|
|
2478
|
+
lastAccountId: resolvedTarget.lastAccountId
|
|
2479
|
+
});
|
|
2480
|
+
const sessionChatTypeHint = target === "last" && !heartbeat?.to ? normalizeChatType(entry?.chatType) : void 0;
|
|
2481
|
+
if (resolveHeartbeatDeliveryChatType({
|
|
2482
|
+
channel: resolvedTarget.channel,
|
|
2483
|
+
to: resolved.to,
|
|
2484
|
+
sessionChatType: sessionChatTypeHint
|
|
2485
|
+
}) === "direct") return buildNoHeartbeatDeliveryTarget({
|
|
2486
|
+
reason: "dm-blocked",
|
|
2487
|
+
accountId: effectiveAccountId,
|
|
2488
|
+
lastChannel: resolvedTarget.lastChannel,
|
|
2489
|
+
lastAccountId: resolvedTarget.lastAccountId
|
|
2490
|
+
});
|
|
2491
|
+
let reason;
|
|
2492
|
+
if (getChannelPlugin(resolvedTarget.channel)?.config.resolveAllowFrom) {
|
|
2493
|
+
const explicit = resolveOutboundTarget({
|
|
2494
|
+
channel: resolvedTarget.channel,
|
|
2495
|
+
to: resolvedTarget.to,
|
|
2496
|
+
cfg,
|
|
2497
|
+
accountId: effectiveAccountId,
|
|
2498
|
+
mode: "explicit"
|
|
2499
|
+
});
|
|
2500
|
+
if (explicit.ok && explicit.to !== resolved.to) reason = "allowFrom-fallback";
|
|
2501
|
+
}
|
|
2502
|
+
return {
|
|
2503
|
+
channel: resolvedTarget.channel,
|
|
2504
|
+
to: resolved.to,
|
|
2505
|
+
reason,
|
|
2506
|
+
accountId: effectiveAccountId,
|
|
2507
|
+
threadId: resolvedTarget.threadId,
|
|
2508
|
+
lastChannel: resolvedTarget.lastChannel,
|
|
2509
|
+
lastAccountId: resolvedTarget.lastAccountId
|
|
2510
|
+
};
|
|
2511
|
+
}
|
|
2512
|
+
function buildNoHeartbeatDeliveryTarget(params) {
|
|
2513
|
+
return {
|
|
2514
|
+
channel: "none",
|
|
2515
|
+
reason: params.reason,
|
|
2516
|
+
accountId: params.accountId,
|
|
2517
|
+
lastChannel: params.lastChannel,
|
|
2518
|
+
lastAccountId: params.lastAccountId
|
|
2519
|
+
};
|
|
2520
|
+
}
|
|
2521
|
+
function inferDiscordTargetChatType(to) {
|
|
2522
|
+
try {
|
|
2523
|
+
const target = parseDiscordTarget(to, { defaultKind: "channel" });
|
|
2524
|
+
if (!target) return;
|
|
2525
|
+
return target.kind === "user" ? "direct" : "channel";
|
|
2526
|
+
} catch {
|
|
2527
|
+
return;
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2530
|
+
function inferSlackTargetChatType(to) {
|
|
2531
|
+
const target = parseSlackTarget(to, { defaultKind: "channel" });
|
|
2532
|
+
if (!target) return;
|
|
2533
|
+
return target.kind === "user" ? "direct" : "channel";
|
|
2534
|
+
}
|
|
2535
|
+
function inferTelegramTargetChatType(to) {
|
|
2536
|
+
const chatType = resolveTelegramTargetChatType(to);
|
|
2537
|
+
return chatType === "unknown" ? void 0 : chatType;
|
|
2538
|
+
}
|
|
2539
|
+
function inferWhatsAppTargetChatType(to) {
|
|
2540
|
+
const normalized = normalizeWhatsAppTarget(to);
|
|
2541
|
+
if (!normalized) return;
|
|
2542
|
+
return isWhatsAppGroupJid(normalized) ? "group" : "direct";
|
|
2543
|
+
}
|
|
2544
|
+
function inferSignalTargetChatType(rawTo) {
|
|
2545
|
+
let to = rawTo.trim();
|
|
2546
|
+
if (!to) return;
|
|
2547
|
+
if (/^signal:/i.test(to)) to = to.replace(/^signal:/i, "").trim();
|
|
2548
|
+
if (!to) return;
|
|
2549
|
+
const lower = to.toLowerCase();
|
|
2550
|
+
if (lower.startsWith("group:")) return "group";
|
|
2551
|
+
if (lower.startsWith("username:") || lower.startsWith("u:")) return "direct";
|
|
2552
|
+
return "direct";
|
|
2553
|
+
}
|
|
2554
|
+
const HEARTBEAT_TARGET_CHAT_TYPE_INFERERS = {
|
|
2555
|
+
discord: inferDiscordTargetChatType,
|
|
2556
|
+
slack: inferSlackTargetChatType,
|
|
2557
|
+
telegram: inferTelegramTargetChatType,
|
|
2558
|
+
whatsapp: inferWhatsAppTargetChatType,
|
|
2559
|
+
signal: inferSignalTargetChatType
|
|
2560
|
+
};
|
|
2561
|
+
function inferChatTypeFromTarget(params) {
|
|
2562
|
+
const to = params.to.trim();
|
|
2563
|
+
if (!to) return;
|
|
2564
|
+
if (/^user:/i.test(to)) return "direct";
|
|
2565
|
+
if (/^(channel:|thread:)/i.test(to)) return "channel";
|
|
2566
|
+
if (/^group:/i.test(to)) return "group";
|
|
2567
|
+
return HEARTBEAT_TARGET_CHAT_TYPE_INFERERS[params.channel]?.(to);
|
|
2568
|
+
}
|
|
2569
|
+
function resolveHeartbeatDeliveryChatType(params) {
|
|
2570
|
+
if (params.sessionChatType) return params.sessionChatType;
|
|
2571
|
+
return inferChatTypeFromTarget({
|
|
2572
|
+
channel: params.channel,
|
|
2573
|
+
to: params.to
|
|
2574
|
+
});
|
|
2575
|
+
}
|
|
2576
|
+
function resolveHeartbeatSenderId(params) {
|
|
2577
|
+
const { allowFrom, deliveryTo, lastTo, provider } = params;
|
|
2578
|
+
const candidates = [
|
|
2579
|
+
deliveryTo?.trim(),
|
|
2580
|
+
provider && deliveryTo ? `${provider}:${deliveryTo}` : void 0,
|
|
2581
|
+
lastTo?.trim(),
|
|
2582
|
+
provider && lastTo ? `${provider}:${lastTo}` : void 0
|
|
2583
|
+
].filter((val) => Boolean(val?.trim()));
|
|
2584
|
+
const allowList = allowFrom.map((entry) => String(entry)).filter((entry) => entry && entry !== "*");
|
|
2585
|
+
if (allowFrom.includes("*")) return candidates[0] ?? "heartbeat";
|
|
2586
|
+
if (candidates.length > 0 && allowList.length > 0) {
|
|
2587
|
+
const matched = candidates.find((candidate) => allowList.includes(candidate));
|
|
2588
|
+
if (matched) return matched;
|
|
2589
|
+
}
|
|
2590
|
+
if (candidates.length > 0 && allowList.length === 0) return candidates[0];
|
|
2591
|
+
if (allowList.length > 0) return allowList[0];
|
|
2592
|
+
return candidates[0] ?? "heartbeat";
|
|
2593
|
+
}
|
|
2594
|
+
function resolveHeartbeatSenderContext(params) {
|
|
2595
|
+
const provider = params.delivery.channel !== "none" ? params.delivery.channel : params.delivery.lastChannel;
|
|
2596
|
+
const accountId = params.delivery.accountId ?? (provider === params.delivery.lastChannel ? params.delivery.lastAccountId : void 0);
|
|
2597
|
+
const allowFrom = (provider ? getChannelPlugin(provider)?.config.resolveAllowFrom?.({
|
|
2598
|
+
cfg: params.cfg,
|
|
2599
|
+
accountId
|
|
2600
|
+
}) ?? [] : []).map((entry) => String(entry));
|
|
2601
|
+
return {
|
|
2602
|
+
sender: resolveHeartbeatSenderId({
|
|
2603
|
+
allowFrom,
|
|
2604
|
+
deliveryTo: params.delivery.to,
|
|
2605
|
+
lastTo: params.entry?.lastTo,
|
|
2606
|
+
provider
|
|
2607
|
+
}),
|
|
2608
|
+
provider,
|
|
2609
|
+
allowFrom
|
|
2610
|
+
};
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2613
|
+
//#endregion
|
|
2614
|
+
export { parseVerboseOverride as _, getCliSessionId as a, isAuthRotatableError as c, drainSystemEventEntries as d, enqueueSystemEvent as f, applyVerboseOverride as g, peekSystemEvents as h, resolveSessionDeliveryTarget as i, listChannelSupportedActions as l, peekSystemEventEntries as m, resolveHeartbeatSenderContext as n, setCliSessionId as o, isSystemEventContextChanged as p, resolveOutboundTarget as r, ChannelBridge as s, resolveHeartbeatDeliveryTarget as t, resolveChannelMessageToolHints as u, normalizeSendPolicy as v, resolveSendPolicy as y };
|