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.
Files changed (2113) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +661 -0
  3. package/README.md +492 -0
  4. package/assets/chrome-extension/README.md +23 -0
  5. package/assets/chrome-extension/background-utils.js +48 -0
  6. package/assets/chrome-extension/background.js +899 -0
  7. package/assets/chrome-extension/icons/icon128.png +0 -0
  8. package/assets/chrome-extension/icons/icon16.png +0 -0
  9. package/assets/chrome-extension/icons/icon32.png +0 -0
  10. package/assets/chrome-extension/icons/icon48.png +0 -0
  11. package/assets/chrome-extension/manifest.json +25 -0
  12. package/assets/chrome-extension/options-validation.js +57 -0
  13. package/assets/chrome-extension/options.html +200 -0
  14. package/assets/chrome-extension/options.js +74 -0
  15. package/assets/clawtributor-avatar-placeholder.png +0 -0
  16. package/assets/dmg-background-small.png +0 -0
  17. package/assets/dmg-background.png +0 -0
  18. package/dist/account-lookup-C0ndrpt-.js +11 -0
  19. package/dist/account-lookup-CIY_RKhi.js +11 -0
  20. package/dist/accounts-B1M3fOxL.js +272 -0
  21. package/dist/accounts-B8PGQWQl.js +205 -0
  22. package/dist/accounts-CIVjmTg9.js +270 -0
  23. package/dist/accounts-D1awQXKu.js +36 -0
  24. package/dist/accounts-DHkGVGUR.js +36 -0
  25. package/dist/accounts-DyW1A_l8.js +206 -0
  26. package/dist/accounts-XFgBY644.js +47 -0
  27. package/dist/accounts-_ZuNC5bz.js +47 -0
  28. package/dist/accounts-uVavganx.js +32 -0
  29. package/dist/ack-reactions-B7iqdPZX.js +621 -0
  30. package/dist/ack-reactions-BapxA9fC.js +621 -0
  31. package/dist/acp-cli-7Plvw9pp.js +1316 -0
  32. package/dist/acp-cli-DmtggLxa.js +1311 -0
  33. package/dist/active-listener--jrUO-8L.js +37 -0
  34. package/dist/active-listener-DtU9K0MR.js +37 -0
  35. package/dist/agent-CX8QVdF4.js +688 -0
  36. package/dist/agent-HReIYVG-.js +687 -0
  37. package/dist/agent-helpers-5F0tdxud.js +400 -0
  38. package/dist/agent-helpers-Bs2nBXeI.js +400 -0
  39. package/dist/agent-scope-CWV-U3Ce.js +161 -0
  40. package/dist/agent-scope-FzE2oRm0.js +159 -0
  41. package/dist/agents-D9BWNEQX.js +769 -0
  42. package/dist/agents.config-0v2zcEf7.js +106 -0
  43. package/dist/agents.config-9DL6QCZc.js +106 -0
  44. package/dist/ansi-DtaiOnt1.js +107 -0
  45. package/dist/api-BE4ZCWWB.js +17 -0
  46. package/dist/api-wsk9zRVi.js +17 -0
  47. package/dist/argv-DW4MYBdJ.js +101 -0
  48. package/dist/audio-ClIuKwkl.js +43 -0
  49. package/dist/audio-DqlIYYTb.js +43 -0
  50. package/dist/audit-Bggny6TT.js +3089 -0
  51. package/dist/audit-DpuJ16Rj.js +3089 -0
  52. package/dist/auth-B-QK8JhI.js +315 -0
  53. package/dist/auth-C1zx1O24.js +314 -0
  54. package/dist/auth-DDmNYVMW.js +448 -0
  55. package/dist/auth-DH1wEw0w.js +448 -0
  56. package/dist/banner-BiLVJ0wV.js +294 -0
  57. package/dist/binaries-QJ-UTgL-.js +13 -0
  58. package/dist/bindings-6FvW-Ys9.js +69 -0
  59. package/dist/bindings-SnU_X1kX.js +69 -0
  60. package/dist/bonjour-discovery-AQMJqY4V.js +378 -0
  61. package/dist/bonjour-discovery-BLcPWHFJ.js +378 -0
  62. package/dist/boot/handler.js +1455 -0
  63. package/dist/brew-CBsS-Vq1.js +46 -0
  64. package/dist/brew-V4lMBeE3.js +46 -0
  65. package/dist/browser-cli-B5uW_onK.js +1690 -0
  66. package/dist/browser-cli-ClfZn9_h.js +1694 -0
  67. package/dist/build-info.json +5 -0
  68. package/dist/bundled/boot/HOOK.md +24 -0
  69. package/dist/bundled/command-logger/HOOK.md +122 -0
  70. package/dist/call-DHcgnRYq.js +518 -0
  71. package/dist/call-Wjjo7gwP.js +517 -0
  72. package/dist/canvas-host/a2ui/.bundle.hash +1 -0
  73. package/dist/canvas-host/a2ui/a2ui.bundle.js +17815 -0
  74. package/dist/canvas-host/a2ui/index.html +307 -0
  75. package/dist/catalog-CU0Xn2G1.js +186 -0
  76. package/dist/catalog-DDkwdGfX.js +186 -0
  77. package/dist/channel-account-context-BHIy71Yh.js +133 -0
  78. package/dist/channel-account-context-DXU_-EkJ.js +133 -0
  79. package/dist/channel-activity-BhT7NQ_v.js +94 -0
  80. package/dist/channel-activity-CvjEwpJz.js +94 -0
  81. package/dist/channel-activity-nsL1WwXH.js +292 -0
  82. package/dist/channel-options-B1tMfA9G.js +32 -0
  83. package/dist/channel-options-gEMUQQGy.js +33 -0
  84. package/dist/channel-selection-C3BMbeUs.js +51 -0
  85. package/dist/channel-selection-DHUO7WUa.js +51 -0
  86. package/dist/channel-web-DBCMnF6w.js +2132 -0
  87. package/dist/channel-web-DjD8eqnc.js +2134 -0
  88. package/dist/channels-cli-BfPB163m.js +1436 -0
  89. package/dist/channels-cli-dEMJmZF8.js +1440 -0
  90. package/dist/channels-status-issues-BMadvA0-.js +18 -0
  91. package/dist/channels-status-issues-D5fT2H21.js +18 -0
  92. package/dist/chat-envelope-AJFUAuBM.js +248 -0
  93. package/dist/chat-envelope-BrfcPlDM.js +248 -0
  94. package/dist/chat-type-BP9akbag.js +11 -0
  95. package/dist/chat-type-CH3W-zKy.js +11 -0
  96. package/dist/chrome-BQX0gpUh.js +1732 -0
  97. package/dist/chrome-CIytlE5x.js +1733 -0
  98. package/dist/chunk-BAMyFYtF.js +341 -0
  99. package/dist/chunk-BzVoFUZL.js +341 -0
  100. package/dist/clack-prompter-C6mBTOzE.js +122 -0
  101. package/dist/clack-prompter-DKcYqv3o.js +121 -0
  102. package/dist/cleanup-utils-Cb-leJcy.js +94 -0
  103. package/dist/cleanup-utils-ZC2zvntc.js +94 -0
  104. package/dist/cli/daemon-cli.js +9 -0
  105. package/dist/cli-BErCYGAt.js +131 -0
  106. package/dist/cli-EEZfdXxg.js +135 -0
  107. package/dist/cli-name-BZsYSp9l.js +23 -0
  108. package/dist/cli-name-CRe5Ow_t.js +23 -0
  109. package/dist/cli-utils-BUOtyfnU.js +16 -0
  110. package/dist/cli-utils-CGB3cBZm.js +16 -0
  111. package/dist/client-1TPQCsEe.js +2311 -0
  112. package/dist/client-9dK56xly.js +22 -0
  113. package/dist/client-CBpe99dr.js +2311 -0
  114. package/dist/client-D-R1YdRD.js +22 -0
  115. package/dist/clipboard-A06eV_5C.js +31 -0
  116. package/dist/clipboard-DQBl3coj.js +31 -0
  117. package/dist/command-format-BiiNHkWG.js +18 -0
  118. package/dist/command-format-Dntg_tnC.js +32 -0
  119. package/dist/command-logger/handler.js +57 -0
  120. package/dist/command-options-CnHA4TzR.js +26 -0
  121. package/dist/command-options-D2nN4AXX.js +26 -0
  122. package/dist/command-registry-BnrYqd5P.js +215 -0
  123. package/dist/commands-BrlSPrp8.js +41 -0
  124. package/dist/commands-keXWOHRq.js +41 -0
  125. package/dist/commands-registry-Cz77bvxB.js +887 -0
  126. package/dist/commands-registry-DRX3F4kj.js +888 -0
  127. package/dist/common-CBefYisq.js +156 -0
  128. package/dist/common-D4fL3S2m.js +156 -0
  129. package/dist/completion-cli-CXb-Xk3v.js +452 -0
  130. package/dist/completion-cli-Ca4Y7cQg.js +452 -0
  131. package/dist/config-CqP5tE9Z.js +3317 -0
  132. package/dist/config-cli-BYqebY6-.js +247 -0
  133. package/dist/config-cli-DKXHNFPz.js +243 -0
  134. package/dist/config-eval-BQIR-wSg.js +102 -0
  135. package/dist/config-eval-Bh82JoXK.js +102 -0
  136. package/dist/config-guard-BBPYncEK.js +92 -0
  137. package/dist/config-guard-CTQwNBtb.js +75 -0
  138. package/dist/config-qAZfcdDM.js +3315 -0
  139. package/dist/config-validation-BrjiFbBk.js +18 -0
  140. package/dist/config-validation-DSXKFJHF.js +18 -0
  141. package/dist/configure-C--DXb5y.js +885 -0
  142. package/dist/configure-D7tKM02_.js +883 -0
  143. package/dist/constants-BBVTjb1j.js +75 -0
  144. package/dist/constants-C7j1VA2S.js +12 -0
  145. package/dist/constants-DoYLsBmv.js +12 -0
  146. package/dist/constants-PMRtHBHU.js +75 -0
  147. package/dist/control-auth-BB_AdEQ8.js +397 -0
  148. package/dist/control-auth-Drc3vO7k.js +397 -0
  149. package/dist/control-ui/apple-touch-icon.png +0 -0
  150. package/dist/control-ui/assets/index-DdiU_ccM.css +1 -0
  151. package/dist/control-ui/assets/index-kVUYi64u.js +7723 -0
  152. package/dist/control-ui/assets/index-kVUYi64u.js.map +1 -0
  153. package/dist/control-ui/assets/pt-BR-eq0TfCI7.js +2 -0
  154. package/dist/control-ui/assets/pt-BR-eq0TfCI7.js.map +1 -0
  155. package/dist/control-ui/assets/zh-CN-DmLG2MF9.js +2 -0
  156. package/dist/control-ui/assets/zh-CN-DmLG2MF9.js.map +1 -0
  157. package/dist/control-ui/assets/zh-TW-BLErH0EM.js +2 -0
  158. package/dist/control-ui/assets/zh-TW-BLErH0EM.js.map +1 -0
  159. package/dist/control-ui/favicon-32.png +0 -0
  160. package/dist/control-ui/favicon.ico +0 -0
  161. package/dist/control-ui/favicon.svg +67 -0
  162. package/dist/control-ui/index.html +17 -0
  163. package/dist/control-ui-assets-DO1L6M0S.js +186 -0
  164. package/dist/control-ui-assets-S_TLo6Fs.js +186 -0
  165. package/dist/conversation-label-CDH4rKMG.js +36 -0
  166. package/dist/conversation-label-CMOfgCVl.js +36 -0
  167. package/dist/credentials-C_RoJFmK.js +91 -0
  168. package/dist/credentials-DM_Dj0m8.js +91 -0
  169. package/dist/cron-cli-DrEGbTLF.js +499 -0
  170. package/dist/cron-cli-iMnjEJcP.js +495 -0
  171. package/dist/daemon-cli-BXOrRB0h.js +735 -0
  172. package/dist/daemon-cli-DbOrC1C6.js +737 -0
  173. package/dist/daemon-cli.js +14217 -0
  174. package/dist/daemon-install-LufHc-Sn.js +60 -0
  175. package/dist/daemon-install-WEBvqVOj.js +56 -0
  176. package/dist/daemon-install-helpers-4BLEBjpg.js +504 -0
  177. package/dist/daemon-install-helpers-DVr51zvE.js +504 -0
  178. package/dist/daemon-runtime-9oDBR7YW.js +13 -0
  179. package/dist/daemon-runtime-CzFI2dPw.js +13 -0
  180. package/dist/dangerous-name-matching-BlTBBZns.js +45 -0
  181. package/dist/dangerous-name-matching-CSq9sJDG.js +45 -0
  182. package/dist/dangerous-tools-BRmbBvRf.js +253 -0
  183. package/dist/dangerous-tools-D4jtl72G.js +253 -0
  184. package/dist/deliver-C3Xs-DSE.js +481 -0
  185. package/dist/deliver-D49hWPWI.js +481 -0
  186. package/dist/delivery-queue-BDvalA10.js +244 -0
  187. package/dist/delivery-queue-BLMWPoKl.js +244 -0
  188. package/dist/devices-cli-6XBBb605.js +323 -0
  189. package/dist/devices-cli-BmB_Y5Tj.js +319 -0
  190. package/dist/diagnostics-BzzhTQzK.js +35 -0
  191. package/dist/diagnostics-DILtxtcE.js +35 -0
  192. package/dist/directory-cli-BnVIzNxj.js +225 -0
  193. package/dist/directory-cli-I7RtmvoP.js +221 -0
  194. package/dist/dispatcher-B7Yu14v7.js +173 -0
  195. package/dist/dispatcher-ClUtg8F9.js +174 -0
  196. package/dist/dm-policy-shared-Cd6QFFx6.js +22 -0
  197. package/dist/dm-policy-shared-DqkEp7h7.js +22 -0
  198. package/dist/dns-cli-Cm47-vJu.js +203 -0
  199. package/dist/dns-cli-DW4a6yJH.js +199 -0
  200. package/dist/dock-BFxpyZEm.js +906 -0
  201. package/dist/dock-Hf1acwVy.js +907 -0
  202. package/dist/doctor-completion-CefSDbii.js +92 -0
  203. package/dist/doctor-completion-DuOl6k-Z.js +92 -0
  204. package/dist/doctor-config-flow-DQdWVm5G.js +979 -0
  205. package/dist/doctor-config-flow-DZCCqya1.js +978 -0
  206. package/dist/enable-C3I9dWel.js +59 -0
  207. package/dist/enable-DnwKeWnR.js +59 -0
  208. package/dist/entry.js +2674 -0
  209. package/dist/env-DyyqmxSM.js +60 -0
  210. package/dist/env-vars-CD2_baIP.js +43 -0
  211. package/dist/env-vars-a7S70ba7.js +43 -0
  212. package/dist/errors-0dfGxeYQ.js +35 -0
  213. package/dist/errors-C1kDByVU.js +35 -0
  214. package/dist/exec-CAk1dxq_.js +164 -0
  215. package/dist/exec-epNpA1aU.js +164 -0
  216. package/dist/export-html/template.css +1024 -0
  217. package/dist/export-html/template.html +88 -0
  218. package/dist/export-html/template.js +1766 -0
  219. package/dist/export-html/vendor/highlight.min.js +1213 -0
  220. package/dist/export-html/vendor/marked.min.js +6 -0
  221. package/dist/extensionAPI.js +11699 -0
  222. package/dist/fetch-BMQq41sB.js +281 -0
  223. package/dist/fetch-CduIccDV.js +67 -0
  224. package/dist/fetch-Cky99wYB.js +281 -0
  225. package/dist/fetch-D3tw4B4n.js +67 -0
  226. package/dist/fetch-DTsU2XnC.js +67 -0
  227. package/dist/fetch-timeout-CytN1wiO.js +43 -0
  228. package/dist/fetch-timeout-DBRRPNBi.js +43 -0
  229. package/dist/file-identity-CeRK5CJC.js +12 -0
  230. package/dist/file-lock-DWH0TfVu.js +107 -0
  231. package/dist/file-lock-DXW9h9ek.js +107 -0
  232. package/dist/format-duration-B-Uv5nOi.js +35 -0
  233. package/dist/format-duration-Oj8pTbYL.js +35 -0
  234. package/dist/format-relative-Czf5fUjn.js +55 -0
  235. package/dist/format-relative-zwkkXJvs.js +55 -0
  236. package/dist/fs-safe-BjSd07M4.js +115 -0
  237. package/dist/fs-safe-aWIhCWlb.js +125 -0
  238. package/dist/gateway-cli-BQ5Nrc2v.js +24127 -0
  239. package/dist/gateway-cli-x9Pn-J8m.js +24131 -0
  240. package/dist/gateway-rpc-C9zLj_Sl.js +28 -0
  241. package/dist/gateway-rpc-Cdx4sTh5.js +28 -0
  242. package/dist/gmail-setup-utils-CKyh29_R.js +422 -0
  243. package/dist/gmail-setup-utils-DquflkMR.js +423 -0
  244. package/dist/health-DlRS-gIZ.js +1414 -0
  245. package/dist/health-UZKtVUZc.js +1417 -0
  246. package/dist/health-format-BE5TK5bs.js +28 -0
  247. package/dist/health-format-DF54wvUU.js +28 -0
  248. package/dist/heartbeat-visibility-98-alasQ.js +125 -0
  249. package/dist/heartbeat-visibility-CGSqfsb3.js +125 -0
  250. package/dist/heartbeat-wake-CvHncCjP.js +182 -0
  251. package/dist/heartbeat-wake-DLxQm6-U.js +182 -0
  252. package/dist/help-format-CJQ7APRn.js +17 -0
  253. package/dist/help-format-D3JhWp1E.js +17 -0
  254. package/dist/helpers-703bXVlF.js +25 -0
  255. package/dist/helpers-DAEoFkbn.js +10 -0
  256. package/dist/helpers-n2CtWpm9.js +25 -0
  257. package/dist/helpers-ndPQWl6m.js +10 -0
  258. package/dist/hook-runner-global-nAi_RVmo.js +527 -0
  259. package/dist/hooks-cli-BN23UkSe.js +1221 -0
  260. package/dist/hooks-cli-CCigUQAP.js +1217 -0
  261. package/dist/host-env-security-BGibnCbS.js +106 -0
  262. package/dist/host-env-security-axRnIi8d.js +106 -0
  263. package/dist/image-ops-CX41n0v5.js +354 -0
  264. package/dist/image-ops-DSL3eFfQ.js +354 -0
  265. package/dist/import-BwboAUxS.js +604 -0
  266. package/dist/import-TnR4slPl.js +606 -0
  267. package/dist/inbound-context-BLy-G2Eq.js +68 -0
  268. package/dist/inbound-context-Cuu0thCw.js +68 -0
  269. package/dist/index.js +598 -0
  270. package/dist/input-provenance-gIfDn1ki.js +35 -0
  271. package/dist/input-provenance-wkso1o5V.js +35 -0
  272. package/dist/inspect-BEpFbi0c.js +286 -0
  273. package/dist/inspect-BeNNpWna.js +286 -0
  274. package/dist/installs-BmtDxAA-.js +319 -0
  275. package/dist/installs-DJ188C74.js +319 -0
  276. package/dist/ip-D4VG5EJO.js +200 -0
  277. package/dist/ip-MwCwRA7c.js +200 -0
  278. package/dist/ipv4-DNo9AFDu.js +46 -0
  279. package/dist/ipv4-VfoVR5uR.js +46 -0
  280. package/dist/ir-DRpvvv-1.js +972 -0
  281. package/dist/is-main-BE1Jih91.js +30 -0
  282. package/dist/json-file-BW22hGtf.js +25 -0
  283. package/dist/json-file-DwRAfAAy.js +25 -0
  284. package/dist/json-files-BI20PLIm.js +46 -0
  285. package/dist/json-files-Dy52honG.js +46 -0
  286. package/dist/lanes-1CBKdsiR.js +58 -0
  287. package/dist/lanes-DqVYfPRG.js +58 -0
  288. package/dist/lifecycle-core-BzhjWI2E.js +476 -0
  289. package/dist/lifecycle-core-DctTLBFp.js +474 -0
  290. package/dist/links-CtGBIrG8.js +15 -0
  291. package/dist/links-CwTlzaPe.js +15 -0
  292. package/dist/loader-BLMpE4uG.js +22397 -0
  293. package/dist/loader-C5cQlGXB.js +22400 -0
  294. package/dist/location-BUhzov-a.js +43 -0
  295. package/dist/location-Qo8Ii1zo.js +43 -0
  296. package/dist/logger-ASsO5Nz-.js +49 -0
  297. package/dist/logger-B8BE0PyS.js +12 -0
  298. package/dist/logger-CPvz-aPM.js +47 -0
  299. package/dist/logger-cL0D2DCr.js +12 -0
  300. package/dist/logging-Cd9y2AdQ.js +20 -0
  301. package/dist/logging-DRwtiLIS.js +1 -0
  302. package/dist/logging-DTEoeoa3.js +19 -0
  303. package/dist/logging-fywhKCmE.js +1 -0
  304. package/dist/login-B5TdMKIC.js +61 -0
  305. package/dist/login-Cak5EAvl.js +62 -0
  306. package/dist/login-qr-BuTJwO4R.js +329 -0
  307. package/dist/login-qr-Do-8NFKK.js +325 -0
  308. package/dist/logs-cli-BkCweYSR.js +240 -0
  309. package/dist/logs-cli-CMUTrgGH.js +236 -0
  310. package/dist/markdown-tables-B3sXo71y.js +29 -0
  311. package/dist/markdown-tables-C48ANSSq.js +29 -0
  312. package/dist/media-DcDCPyuW.js +971 -0
  313. package/dist/media-DgxPvn2i.js +9492 -0
  314. package/dist/message-action-names-BwpFcASf.js +2520 -0
  315. package/dist/message-action-names-CH6TDClE.js +2520 -0
  316. package/dist/message-channel-CtcVHawF.js +91 -0
  317. package/dist/message-channel-tuc9CdEw.js +91 -0
  318. package/dist/mime-CAqaK3kp.js +146 -0
  319. package/dist/mime-ViuhRuMM.js +146 -0
  320. package/dist/mutable-allowlist-detectors-BXE7Hr7F.js +64 -0
  321. package/dist/mutable-allowlist-detectors-CtKavajp.js +64 -0
  322. package/dist/net-DSkFMHJ8.js +225 -0
  323. package/dist/net-DTqfFYzt.js +225 -0
  324. package/dist/node-cli-DTp-eCFc.js +1386 -0
  325. package/dist/node-cli-Yd_KvTgV.js +1390 -0
  326. package/dist/node-service-RyMlWp8N.js +67 -0
  327. package/dist/node-service-TL9b6Qfz.js +67 -0
  328. package/dist/nodes-cli-BcXyjWnw.js +1350 -0
  329. package/dist/nodes-cli-DHHf5weG.js +1346 -0
  330. package/dist/nodes-screen-B7HJugJ0.js +250 -0
  331. package/dist/nodes-screen-nCRd71Mk.js +250 -0
  332. package/dist/note-B6142LyJ.js +92 -0
  333. package/dist/note-D-EI0czq.js +92 -0
  334. package/dist/npm-registry-spec-PPyRXSpx.js +786 -0
  335. package/dist/npm-registry-spec-uUmDWe6v.js +786 -0
  336. package/dist/npm-resolution-C-6NY92-.js +86 -0
  337. package/dist/npm-resolution-DSRcDO7P.js +86 -0
  338. package/dist/onboard-D0pXb_02.js +645 -0
  339. package/dist/onboard-DdAR-LF_.js +647 -0
  340. package/dist/onboard-auth-cNtb3FTP.js +211 -0
  341. package/dist/onboard-auth-gwz-0mZ6.js +207 -0
  342. package/dist/onboard-channels-8SAR1gMS.js +2618 -0
  343. package/dist/onboard-channels-tRmXz2Lj.js +2619 -0
  344. package/dist/onboard-config-DOmXYEvJ.js +39 -0
  345. package/dist/onboard-config-JmR21VYa.js +39 -0
  346. package/dist/onboard-helpers-DGVxeLf_.js +358 -0
  347. package/dist/onboard-helpers-DdqoC3w8.js +357 -0
  348. package/dist/onboard-remote-CspZpXS9.js +127 -0
  349. package/dist/onboard-remote-DJcHZQqI.js +127 -0
  350. package/dist/onboarding-BH0siVu3.js +586 -0
  351. package/dist/onboarding-CKmRrgeq.js +588 -0
  352. package/dist/onboarding.finalize-BGyWeNH5.js +402 -0
  353. package/dist/onboarding.finalize-BpVbqIc1.js +404 -0
  354. package/dist/onboarding.gateway-config-B4xt1gtO.js +202 -0
  355. package/dist/onboarding.gateway-config-CT9RcbVE.js +196 -0
  356. package/dist/outbound-B3wlEY-e.js +220 -0
  357. package/dist/outbound-KHig2PTG.js +221 -0
  358. package/dist/outbound-attachment-BZkefkAT.js +18 -0
  359. package/dist/outbound-attachment-D5FMlKjS.js +18 -0
  360. package/dist/outbound-attachment-DjvyU7Oq.js +18 -0
  361. package/dist/pairing-cli-BTwS98JV.js +130 -0
  362. package/dist/pairing-cli-C8jztqm2.js +126 -0
  363. package/dist/pairing-labels-E2eoE9tc.js +9 -0
  364. package/dist/pairing-labels-Ks4ey7DT.js +9 -0
  365. package/dist/pairing-store-C7DF-eCM.js +460 -0
  366. package/dist/pairing-store-CU4_h9xa.js +459 -0
  367. package/dist/parse-log-line-GisaZn5H.js +44 -0
  368. package/dist/parse-log-line-ZsbwG_u7.js +44 -0
  369. package/dist/parse-timeout-BpphuwYl.js +16 -0
  370. package/dist/parse-timeout-CE6BjmGU.js +16 -0
  371. package/dist/path-env-DMKJ1GE3.js +89 -0
  372. package/dist/path-env-Dq-jhL2Z.js +89 -0
  373. package/dist/path-safety-BFE0XmGC.js +14 -0
  374. package/dist/path-safety-BJ8ge6Ho.js +14 -0
  375. package/dist/paths-DHuXVC00.js +229 -0
  376. package/dist/plugin-auto-enable-Bms-lvxW.js +289 -0
  377. package/dist/plugin-auto-enable-fc5IL3zs.js +288 -0
  378. package/dist/plugin-registry-BrQP6X71.js +33 -0
  379. package/dist/plugin-registry-nbb06LsB.js +33 -0
  380. package/dist/plugin-sdk/account-id.d.ts +1 -0
  381. package/dist/plugin-sdk/account-id.js +34 -0
  382. package/dist/plugin-sdk/agents/agent-helpers/errors.d.ts +55 -0
  383. package/dist/plugin-sdk/agents/agent-helpers/google.d.ts +3 -0
  384. package/dist/plugin-sdk/agents/agent-helpers/images.d.ts +21 -0
  385. package/dist/plugin-sdk/agents/agent-helpers/message-sanitization.d.ts +14 -0
  386. package/dist/plugin-sdk/agents/agent-helpers/messaging-dedupe.d.ts +10 -0
  387. package/dist/plugin-sdk/agents/agent-helpers/openai.d.ts +9 -0
  388. package/dist/plugin-sdk/agents/agent-helpers/turns.d.ts +20 -0
  389. package/dist/plugin-sdk/agents/agent-helpers/types.d.ts +1 -0
  390. package/dist/plugin-sdk/agents/agent-helpers.d.ts +10 -0
  391. package/dist/plugin-sdk/agents/agent-messaging.d.ts +8 -0
  392. package/dist/plugin-sdk/agents/agent-scope.d.ts +81 -0
  393. package/dist/plugin-sdk/agents/agent-types.d.ts +73 -0
  394. package/dist/plugin-sdk/agents/agent-utils.d.ts +25 -0
  395. package/dist/plugin-sdk/agents/announce-idempotency.d.ts +11 -0
  396. package/dist/plugin-sdk/agents/block-chunker.d.ts +19 -0
  397. package/dist/plugin-sdk/agents/channel-tools.d.ts +27 -0
  398. package/dist/plugin-sdk/agents/cli-session.d.ts +3 -0
  399. package/dist/plugin-sdk/agents/current-time.d.ts +17 -0
  400. package/dist/plugin-sdk/agents/date-time.d.ts +13 -0
  401. package/dist/plugin-sdk/agents/identity-avatar.d.ts +15 -0
  402. package/dist/plugin-sdk/agents/identity.d.ts +28 -0
  403. package/dist/plugin-sdk/agents/image-sanitization.d.ts +8 -0
  404. package/dist/plugin-sdk/agents/lanes.d.ts +3 -0
  405. package/dist/plugin-sdk/agents/live-auth-keys.d.ts +6 -0
  406. package/dist/plugin-sdk/agents/owner-display.d.ts +19 -0
  407. package/dist/plugin-sdk/agents/provider-utils.d.ts +20 -0
  408. package/dist/plugin-sdk/agents/schema/typebox.d.ts +14 -0
  409. package/dist/plugin-sdk/agents/session-write-lock.d.ts +53 -0
  410. package/dist/plugin-sdk/agents/stable-stringify.d.ts +1 -0
  411. package/dist/plugin-sdk/agents/subagent-announce-queue.d.ts +24 -0
  412. package/dist/plugin-sdk/agents/subagent-announce.d.ts +39 -0
  413. package/dist/plugin-sdk/agents/subagent-depth.d.ts +11 -0
  414. package/dist/plugin-sdk/agents/subagent-lifecycle-events.d.ts +18 -0
  415. package/dist/plugin-sdk/agents/subagent-registry-cleanup.d.ts +24 -0
  416. package/dist/plugin-sdk/agents/subagent-registry-completion.d.ts +15 -0
  417. package/dist/plugin-sdk/agents/subagent-registry-queries.d.ts +11 -0
  418. package/dist/plugin-sdk/agents/subagent-registry-state.d.ts +7 -0
  419. package/dist/plugin-sdk/agents/subagent-registry.d.ts +45 -0
  420. package/dist/plugin-sdk/agents/subagent-registry.store.d.ts +4 -0
  421. package/dist/plugin-sdk/agents/subagent-registry.types.d.ts +34 -0
  422. package/dist/plugin-sdk/agents/subagent-spawn.d.ts +46 -0
  423. package/dist/plugin-sdk/agents/timeout.d.ts +8 -0
  424. package/dist/plugin-sdk/agents/tool-call-id.d.ts +27 -0
  425. package/dist/plugin-sdk/agents/tool-display-common.d.ts +32 -0
  426. package/dist/plugin-sdk/agents/tool-display.d.ts +15 -0
  427. package/dist/plugin-sdk/agents/tool-images.d.ts +10 -0
  428. package/dist/plugin-sdk/agents/tools/agent-step.d.ts +15 -0
  429. package/dist/plugin-sdk/agents/tools/common.d.ts +80 -0
  430. package/dist/plugin-sdk/agents/tools/discord-actions-guild.d.ts +4 -0
  431. package/dist/plugin-sdk/agents/tools/discord-actions-messaging.d.ts +6 -0
  432. package/dist/plugin-sdk/agents/tools/discord-actions-moderation-shared.d.ts +13 -0
  433. package/dist/plugin-sdk/agents/tools/discord-actions-moderation.d.ts +4 -0
  434. package/dist/plugin-sdk/agents/tools/discord-actions-presence.d.ts +4 -0
  435. package/dist/plugin-sdk/agents/tools/discord-actions.d.ts +5 -0
  436. package/dist/plugin-sdk/agents/tools/sessions-access.d.ts +42 -0
  437. package/dist/plugin-sdk/agents/tools/sessions-helpers.d.ts +51 -0
  438. package/dist/plugin-sdk/agents/tools/sessions-resolution.d.ts +59 -0
  439. package/dist/plugin-sdk/agents/tools/sessions-send-helpers.d.ts +34 -0
  440. package/dist/plugin-sdk/agents/tools/slack-actions.d.ts +15 -0
  441. package/dist/plugin-sdk/agents/tools/telegram-actions.d.ts +7 -0
  442. package/dist/plugin-sdk/agents/tools/whatsapp-actions.d.ts +3 -0
  443. package/dist/plugin-sdk/agents/tools/whatsapp-target-auth.d.ts +10 -0
  444. package/dist/plugin-sdk/agents/usage.d.ts +49 -0
  445. package/dist/plugin-sdk/agents/workspace.d.ts +1 -0
  446. package/dist/plugin-sdk/auth/api-key-rotation.d.ts +22 -0
  447. package/dist/plugin-sdk/auth/constants.d.ts +15 -0
  448. package/dist/plugin-sdk/auth/display.d.ts +7 -0
  449. package/dist/plugin-sdk/auth/doctor.d.ts +8 -0
  450. package/dist/plugin-sdk/auth/env-injection.d.ts +38 -0
  451. package/dist/plugin-sdk/auth/index.d.ts +10 -0
  452. package/dist/plugin-sdk/auth/oauth.d.ts +13 -0
  453. package/dist/plugin-sdk/auth/order.d.ts +8 -0
  454. package/dist/plugin-sdk/auth/paths.d.ts +3 -0
  455. package/dist/plugin-sdk/auth/profiles.d.ts +11 -0
  456. package/dist/plugin-sdk/auth/provider-auth.d.ts +32 -0
  457. package/dist/plugin-sdk/auth/store.d.ts +7 -0
  458. package/dist/plugin-sdk/auth/types.d.ts +45 -0
  459. package/dist/plugin-sdk/auth/usage.d.ts +80 -0
  460. package/dist/plugin-sdk/auto-reply/chunk.d.ts +45 -0
  461. package/dist/plugin-sdk/auto-reply/command-auth.d.ts +17 -0
  462. package/dist/plugin-sdk/auto-reply/command-detection.d.ts +13 -0
  463. package/dist/plugin-sdk/auto-reply/commands-args.d.ts +3 -0
  464. package/dist/plugin-sdk/auto-reply/commands-registry.d.ts +47 -0
  465. package/dist/plugin-sdk/auto-reply/commands-registry.data.d.ts +3 -0
  466. package/dist/plugin-sdk/auto-reply/commands-registry.types.d.ts +66 -0
  467. package/dist/plugin-sdk/auto-reply/dispatch.d.ts +32 -0
  468. package/dist/plugin-sdk/auto-reply/envelope.d.ts +58 -0
  469. package/dist/plugin-sdk/auto-reply/fallback-state.d.ts +55 -0
  470. package/dist/plugin-sdk/auto-reply/group-activation.d.ts +6 -0
  471. package/dist/plugin-sdk/auto-reply/heartbeat-reply-payload.d.ts +2 -0
  472. package/dist/plugin-sdk/auto-reply/heartbeat.d.ts +16 -0
  473. package/dist/plugin-sdk/auto-reply/inbound-debounce.d.ts +17 -0
  474. package/dist/plugin-sdk/auto-reply/media-note.d.ts +2 -0
  475. package/dist/plugin-sdk/auto-reply/model.d.ts +8 -0
  476. package/dist/plugin-sdk/auto-reply/reply/abort.d.ts +32 -0
  477. package/dist/plugin-sdk/auto-reply/reply/agent-runner-execution.d.ts +58 -0
  478. package/dist/plugin-sdk/auto-reply/reply/agent-runner-helpers.d.ts +15 -0
  479. package/dist/plugin-sdk/auto-reply/reply/agent-runner-payloads.d.ts +27 -0
  480. package/dist/plugin-sdk/auto-reply/reply/agent-runner-utils.d.ts +119 -0
  481. package/dist/plugin-sdk/auto-reply/reply/agent-runner.d.ts +36 -0
  482. package/dist/plugin-sdk/auto-reply/reply/block-reply-coalescer.d.ts +15 -0
  483. package/dist/plugin-sdk/auto-reply/reply/block-reply-pipeline.d.ts +31 -0
  484. package/dist/plugin-sdk/auto-reply/reply/block-streaming.d.ts +22 -0
  485. package/dist/plugin-sdk/auto-reply/reply/body.d.ts +10 -0
  486. package/dist/plugin-sdk/auto-reply/reply/command-gates.d.ts +18 -0
  487. package/dist/plugin-sdk/auto-reply/reply/commands-allowlist.d.ts +2 -0
  488. package/dist/plugin-sdk/auto-reply/reply/commands-config.d.ts +3 -0
  489. package/dist/plugin-sdk/auto-reply/reply/commands-context.d.ts +12 -0
  490. package/dist/plugin-sdk/auto-reply/reply/commands-core.d.ts +13 -0
  491. package/dist/plugin-sdk/auto-reply/reply/commands-export-session.d.ts +3 -0
  492. package/dist/plugin-sdk/auto-reply/reply/commands-info.d.ts +11 -0
  493. package/dist/plugin-sdk/auto-reply/reply/commands-plugin.d.ts +13 -0
  494. package/dist/plugin-sdk/auto-reply/reply/commands-session.d.ts +8 -0
  495. package/dist/plugin-sdk/auto-reply/reply/commands-setunset-standard.d.ts +10 -0
  496. package/dist/plugin-sdk/auto-reply/reply/commands-setunset.d.ts +34 -0
  497. package/dist/plugin-sdk/auto-reply/reply/commands-slash-parse.d.ts +24 -0
  498. package/dist/plugin-sdk/auto-reply/reply/commands-status.d.ts +20 -0
  499. package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-agents.d.ts +3 -0
  500. package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-focus.d.ts +3 -0
  501. package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-help.d.ts +2 -0
  502. package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-info.d.ts +3 -0
  503. package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-kill.d.ts +3 -0
  504. package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-list.d.ts +3 -0
  505. package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-log.d.ts +3 -0
  506. package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-send.d.ts +3 -0
  507. package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-spawn.d.ts +3 -0
  508. package/dist/plugin-sdk/auto-reply/reply/commands-subagents/action-unfocus.d.ts +3 -0
  509. package/dist/plugin-sdk/auto-reply/reply/commands-subagents/shared.d.ts +81 -0
  510. package/dist/plugin-sdk/auto-reply/reply/commands-subagents.d.ts +4 -0
  511. package/dist/plugin-sdk/auto-reply/reply/commands-tts.d.ts +2 -0
  512. package/dist/plugin-sdk/auto-reply/reply/commands-types.d.ts +49 -0
  513. package/dist/plugin-sdk/auto-reply/reply/commands.d.ts +4 -0
  514. package/dist/plugin-sdk/auto-reply/reply/config-commands.d.ts +15 -0
  515. package/dist/plugin-sdk/auto-reply/reply/config-value.d.ts +4 -0
  516. package/dist/plugin-sdk/auto-reply/reply/debug-commands.d.ts +16 -0
  517. package/dist/plugin-sdk/auto-reply/reply/directive-handling.d.ts +6 -0
  518. package/dist/plugin-sdk/auto-reply/reply/directive-handling.fast-lane.d.ts +7 -0
  519. package/dist/plugin-sdk/auto-reply/reply/directive-handling.impl.d.ts +3 -0
  520. package/dist/plugin-sdk/auto-reply/reply/directive-handling.levels.d.ts +11 -0
  521. package/dist/plugin-sdk/auto-reply/reply/directive-handling.params.d.ts +49 -0
  522. package/dist/plugin-sdk/auto-reply/reply/directive-handling.parse.d.ts +37 -0
  523. package/dist/plugin-sdk/auto-reply/reply/directive-handling.persist.d.ts +39 -0
  524. package/dist/plugin-sdk/auto-reply/reply/directive-handling.queue-validation.d.ts +10 -0
  525. package/dist/plugin-sdk/auto-reply/reply/directive-handling.shared.d.ts +4 -0
  526. package/dist/plugin-sdk/auto-reply/reply/directive-parsing.d.ts +5 -0
  527. package/dist/plugin-sdk/auto-reply/reply/directives.d.ts +19 -0
  528. package/dist/plugin-sdk/auto-reply/reply/dispatch-from-config.d.ts +16 -0
  529. package/dist/plugin-sdk/auto-reply/reply/dispatcher-registry.d.ts +24 -0
  530. package/dist/plugin-sdk/auto-reply/reply/followup-runner.d.ts +16 -0
  531. package/dist/plugin-sdk/auto-reply/reply/get-reply-directives-apply.d.ts +55 -0
  532. package/dist/plugin-sdk/auto-reply/reply/get-reply-directives-utils.d.ts +2 -0
  533. package/dist/plugin-sdk/auto-reply/reply/get-reply-directives.d.ts +102 -0
  534. package/dist/plugin-sdk/auto-reply/reply/get-reply-inline-actions.d.ts +45 -0
  535. package/dist/plugin-sdk/auto-reply/reply/get-reply-run.d.ts +59 -0
  536. package/dist/plugin-sdk/auto-reply/reply/get-reply.d.ts +4 -0
  537. package/dist/plugin-sdk/auto-reply/reply/groups.d.ts +26 -0
  538. package/dist/plugin-sdk/auto-reply/reply/history.d.ts +72 -0
  539. package/dist/plugin-sdk/auto-reply/reply/inbound-context.d.ts +8 -0
  540. package/dist/plugin-sdk/auto-reply/reply/inbound-dedupe.d.ts +8 -0
  541. package/dist/plugin-sdk/auto-reply/reply/inbound-meta.d.ts +3 -0
  542. package/dist/plugin-sdk/auto-reply/reply/inbound-text.d.ts +1 -0
  543. package/dist/plugin-sdk/auto-reply/reply/line-directives.d.ts +22 -0
  544. package/dist/plugin-sdk/auto-reply/reply/mentions.d.ts +19 -0
  545. package/dist/plugin-sdk/auto-reply/reply/normalize-reply.d.ts +11 -0
  546. package/dist/plugin-sdk/auto-reply/reply/origin-routing.d.ts +13 -0
  547. package/dist/plugin-sdk/auto-reply/reply/provider-dispatcher.d.ts +19 -0
  548. package/dist/plugin-sdk/auto-reply/reply/queue/cleanup.d.ts +6 -0
  549. package/dist/plugin-sdk/auto-reply/reply/queue/directive.d.ts +15 -0
  550. package/dist/plugin-sdk/auto-reply/reply/queue/drain.d.ts +2 -0
  551. package/dist/plugin-sdk/auto-reply/reply/queue/enqueue.d.ts +3 -0
  552. package/dist/plugin-sdk/auto-reply/reply/queue/normalize.d.ts +3 -0
  553. package/dist/plugin-sdk/auto-reply/reply/queue/settings.d.ts +2 -0
  554. package/dist/plugin-sdk/auto-reply/reply/queue/state.d.ts +20 -0
  555. package/dist/plugin-sdk/auto-reply/reply/queue/types.d.ts +72 -0
  556. package/dist/plugin-sdk/auto-reply/reply/queue-policy.d.ts +8 -0
  557. package/dist/plugin-sdk/auto-reply/reply/queue.d.ts +8 -0
  558. package/dist/plugin-sdk/auto-reply/reply/reply-delivery.d.ts +27 -0
  559. package/dist/plugin-sdk/auto-reply/reply/reply-directives.d.ts +14 -0
  560. package/dist/plugin-sdk/auto-reply/reply/reply-dispatcher.d.ts +53 -0
  561. package/dist/plugin-sdk/auto-reply/reply/reply-inline.d.ts +8 -0
  562. package/dist/plugin-sdk/auto-reply/reply/reply-payloads.d.ts +27 -0
  563. package/dist/plugin-sdk/auto-reply/reply/reply-reference.d.ts +20 -0
  564. package/dist/plugin-sdk/auto-reply/reply/reply-tags.d.ts +6 -0
  565. package/dist/plugin-sdk/auto-reply/reply/reply-threading.d.ts +9 -0
  566. package/dist/plugin-sdk/auto-reply/reply/response-prefix-template.d.ts +49 -0
  567. package/dist/plugin-sdk/auto-reply/reply/route-reply.d.ts +56 -0
  568. package/dist/plugin-sdk/auto-reply/reply/session-reset-prompt.d.ts +1 -0
  569. package/dist/plugin-sdk/auto-reply/reply/session-run-accounting.d.ts +4 -0
  570. package/dist/plugin-sdk/auto-reply/reply/session-updates.d.ts +8 -0
  571. package/dist/plugin-sdk/auto-reply/reply/session-usage.d.ts +21 -0
  572. package/dist/plugin-sdk/auto-reply/reply/session.d.ts +26 -0
  573. package/dist/plugin-sdk/auto-reply/reply/strip-inbound-meta.d.ts +27 -0
  574. package/dist/plugin-sdk/auto-reply/reply/subagents-utils.d.ts +26 -0
  575. package/dist/plugin-sdk/auto-reply/reply/typing-mode.d.ts +27 -0
  576. package/dist/plugin-sdk/auto-reply/reply/typing.d.ts +18 -0
  577. package/dist/plugin-sdk/auto-reply/reply/untrusted-context.d.ts +1 -0
  578. package/dist/plugin-sdk/auto-reply/reply.d.ts +5 -0
  579. package/dist/plugin-sdk/auto-reply/send-policy.d.ts +6 -0
  580. package/dist/plugin-sdk/auto-reply/status.d.ts +50 -0
  581. package/dist/plugin-sdk/auto-reply/templating.d.ts +155 -0
  582. package/dist/plugin-sdk/auto-reply/thinking.d.ts +7 -0
  583. package/dist/plugin-sdk/auto-reply/tokens.d.ts +3 -0
  584. package/dist/plugin-sdk/auto-reply/types.d.ts +79 -0
  585. package/dist/plugin-sdk/channel-web.d.ts +6 -0
  586. package/dist/plugin-sdk/channels/account-summary.d.ts +17 -0
  587. package/dist/plugin-sdk/channels/ack-reactions.d.ts +29 -0
  588. package/dist/plugin-sdk/channels/allow-from.d.ts +11 -0
  589. package/dist/plugin-sdk/channels/allowlist-match.d.ts +16 -0
  590. package/dist/plugin-sdk/channels/allowlists/resolve-utils.d.ts +33 -0
  591. package/dist/plugin-sdk/channels/channel-config.d.ts +39 -0
  592. package/dist/plugin-sdk/channels/chat-type.d.ts +2 -0
  593. package/dist/plugin-sdk/channels/command-gating.d.ts +20 -0
  594. package/dist/plugin-sdk/channels/conversation-label.d.ts +2 -0
  595. package/dist/plugin-sdk/channels/dock.d.ts +24 -0
  596. package/dist/plugin-sdk/channels/draft-stream-controls.d.ts +54 -0
  597. package/dist/plugin-sdk/channels/draft-stream-loop.d.ts +13 -0
  598. package/dist/plugin-sdk/channels/location.d.ts +21 -0
  599. package/dist/plugin-sdk/channels/logging.d.ts +20 -0
  600. package/dist/plugin-sdk/channels/mention-gating.d.ts +27 -0
  601. package/dist/plugin-sdk/channels/model-overrides.d.ts +18 -0
  602. package/dist/plugin-sdk/channels/plugins/account-action-gate.d.ts +5 -0
  603. package/dist/plugin-sdk/channels/plugins/account-helpers.d.ts +6 -0
  604. package/dist/plugin-sdk/channels/plugins/actions/discord/handle-action.d.ts +3 -0
  605. package/dist/plugin-sdk/channels/plugins/actions/discord/handle-action.guild-admin.d.ts +9 -0
  606. package/dist/plugin-sdk/channels/plugins/actions/discord.d.ts +2 -0
  607. package/dist/plugin-sdk/channels/plugins/actions/shared.d.ts +7 -0
  608. package/dist/plugin-sdk/channels/plugins/actions/signal.d.ts +2 -0
  609. package/dist/plugin-sdk/channels/plugins/actions/telegram.d.ts +2 -0
  610. package/dist/plugin-sdk/channels/plugins/agent-tools/whatsapp-login.d.ts +2 -0
  611. package/dist/plugin-sdk/channels/plugins/allowlist-match.d.ts +2 -0
  612. package/dist/plugin-sdk/channels/plugins/bluebubbles-actions.d.ts +48 -0
  613. package/dist/plugin-sdk/channels/plugins/channel-config.d.ts +2 -0
  614. package/dist/plugin-sdk/channels/plugins/config-helpers.d.ts +14 -0
  615. package/dist/plugin-sdk/channels/plugins/config-schema.d.ts +3 -0
  616. package/dist/plugin-sdk/channels/plugins/config-writes.d.ts +7 -0
  617. package/dist/plugin-sdk/channels/plugins/directory-config.d.ts +16 -0
  618. package/dist/plugin-sdk/channels/plugins/group-mentions.d.ts +18 -0
  619. package/dist/plugin-sdk/channels/plugins/helpers.d.ts +8 -0
  620. package/dist/plugin-sdk/channels/plugins/index.d.ts +8 -0
  621. package/dist/plugin-sdk/channels/plugins/media-limits.d.ts +9 -0
  622. package/dist/plugin-sdk/channels/plugins/media-payload.d.ts +15 -0
  623. package/dist/plugin-sdk/channels/plugins/message-action-names.d.ts +2 -0
  624. package/dist/plugin-sdk/channels/plugins/normalize/discord.d.ts +14 -0
  625. package/dist/plugin-sdk/channels/plugins/normalize/imessage.d.ts +2 -0
  626. package/dist/plugin-sdk/channels/plugins/normalize/shared.d.ts +6 -0
  627. package/dist/plugin-sdk/channels/plugins/normalize/signal.d.ts +2 -0
  628. package/dist/plugin-sdk/channels/plugins/normalize/slack.d.ts +2 -0
  629. package/dist/plugin-sdk/channels/plugins/normalize/telegram.d.ts +2 -0
  630. package/dist/plugin-sdk/channels/plugins/normalize/whatsapp.d.ts +3 -0
  631. package/dist/plugin-sdk/channels/plugins/onboarding/channel-access-configure.d.ts +21 -0
  632. package/dist/plugin-sdk/channels/plugins/onboarding/channel-access.d.ts +31 -0
  633. package/dist/plugin-sdk/channels/plugins/onboarding/discord.d.ts +2 -0
  634. package/dist/plugin-sdk/channels/plugins/onboarding/helpers.d.ts +177 -0
  635. package/dist/plugin-sdk/channels/plugins/onboarding/imessage.d.ts +6 -0
  636. package/dist/plugin-sdk/channels/plugins/onboarding/signal.d.ts +7 -0
  637. package/dist/plugin-sdk/channels/plugins/onboarding/slack.d.ts +2 -0
  638. package/dist/plugin-sdk/channels/plugins/onboarding/telegram.d.ts +4 -0
  639. package/dist/plugin-sdk/channels/plugins/onboarding/whatsapp.d.ts +2 -0
  640. package/dist/plugin-sdk/channels/plugins/onboarding-types.d.ts +77 -0
  641. package/dist/plugin-sdk/channels/plugins/outbound/load.d.ts +2 -0
  642. package/dist/plugin-sdk/channels/plugins/pairing-message.d.ts +1 -0
  643. package/dist/plugin-sdk/channels/plugins/pairing.d.ts +16 -0
  644. package/dist/plugin-sdk/channels/plugins/registry-loader.d.ts +5 -0
  645. package/dist/plugin-sdk/channels/plugins/setup-helpers.d.ts +13 -0
  646. package/dist/plugin-sdk/channels/plugins/status-issues/bluebubbles.d.ts +2 -0
  647. package/dist/plugin-sdk/channels/plugins/status-issues/discord.d.ts +2 -0
  648. package/dist/plugin-sdk/channels/plugins/status-issues/shared.d.ts +29 -0
  649. package/dist/plugin-sdk/channels/plugins/status-issues/telegram.d.ts +2 -0
  650. package/dist/plugin-sdk/channels/plugins/status-issues/whatsapp.d.ts +2 -0
  651. package/dist/plugin-sdk/channels/plugins/types.adapters.d.ts +282 -0
  652. package/dist/plugin-sdk/channels/plugins/types.core.d.ts +350 -0
  653. package/dist/plugin-sdk/channels/plugins/types.d.ts +6 -0
  654. package/dist/plugin-sdk/channels/plugins/types.plugin.d.ts +53 -0
  655. package/dist/plugin-sdk/channels/plugins/whatsapp-heartbeat.d.ts +11 -0
  656. package/dist/plugin-sdk/channels/plugins/whatsapp-shared.d.ts +5 -0
  657. package/dist/plugin-sdk/channels/registry.d.ts +15 -0
  658. package/dist/plugin-sdk/channels/reply-prefix.d.ts +24 -0
  659. package/dist/plugin-sdk/channels/sender-label.d.ts +9 -0
  660. package/dist/plugin-sdk/channels/session.d.ts +18 -0
  661. package/dist/plugin-sdk/channels/status-reactions.d.ts +62 -0
  662. package/dist/plugin-sdk/channels/targets.d.ts +42 -0
  663. package/dist/plugin-sdk/channels/telegram/api.d.ts +5 -0
  664. package/dist/plugin-sdk/channels/typing-lifecycle.d.ts +12 -0
  665. package/dist/plugin-sdk/channels/typing.d.ts +13 -0
  666. package/dist/plugin-sdk/channels/voice-credentials.d.ts +26 -0
  667. package/dist/plugin-sdk/channels/web/index.d.ts +1 -0
  668. package/dist/plugin-sdk/cli/cli-name.d.ts +3 -0
  669. package/dist/plugin-sdk/cli/command-format.d.ts +1 -0
  670. package/dist/plugin-sdk/cli/deps.d.ts +18 -0
  671. package/dist/plugin-sdk/cli/outbound-send-deps.d.ts +4 -0
  672. package/dist/plugin-sdk/cli/outbound-send-mapping.d.ts +10 -0
  673. package/dist/plugin-sdk/cli/parse-bytes.d.ts +4 -0
  674. package/dist/plugin-sdk/cli/parse-duration.d.ts +4 -0
  675. package/dist/plugin-sdk/cli/profile-utils.d.ts +2 -0
  676. package/dist/plugin-sdk/cli/progress.d.ts +24 -0
  677. package/dist/plugin-sdk/cli/wait.d.ts +1 -0
  678. package/dist/plugin-sdk/commands/agent/delivery.d.ts +25 -0
  679. package/dist/plugin-sdk/commands/agent/run-context.d.ts +2 -0
  680. package/dist/plugin-sdk/commands/agent/session-store.d.ts +16 -0
  681. package/dist/plugin-sdk/commands/agent/session.d.ts +32 -0
  682. package/dist/plugin-sdk/commands/agent/types.d.ts +89 -0
  683. package/dist/plugin-sdk/commands/agent.d.ts +14 -0
  684. package/dist/plugin-sdk/commands/daemon-runtime.d.ts +8 -0
  685. package/dist/plugin-sdk/commands/health.d.ts +63 -0
  686. package/dist/plugin-sdk/commands/oauth-flow.d.ts +21 -0
  687. package/dist/plugin-sdk/commands/onboard-helpers.d.ts +76 -0
  688. package/dist/plugin-sdk/commands/onboard-types.d.ts +65 -0
  689. package/dist/plugin-sdk/commands/signal-install.d.ts +30 -0
  690. package/dist/plugin-sdk/config/agent-dirs.d.ts +14 -0
  691. package/dist/plugin-sdk/config/agent-limits.d.ts +6 -0
  692. package/dist/plugin-sdk/config/backup-rotation.d.ts +5 -0
  693. package/dist/plugin-sdk/config/cache-utils.d.ts +6 -0
  694. package/dist/plugin-sdk/config/commands.d.ts +20 -0
  695. package/dist/plugin-sdk/config/config-paths.d.ts +10 -0
  696. package/dist/plugin-sdk/config/config.d.ts +7 -0
  697. package/dist/plugin-sdk/config/dangerous-name-matching.d.ts +12 -0
  698. package/dist/plugin-sdk/config/defaults.d.ts +18 -0
  699. package/dist/plugin-sdk/config/discord-preview-streaming.d.ts +25 -0
  700. package/dist/plugin-sdk/config/env-preserve.d.ts +10 -0
  701. package/dist/plugin-sdk/config/env-substitution.d.ts +36 -0
  702. package/dist/plugin-sdk/config/env-vars.d.ts +6 -0
  703. package/dist/plugin-sdk/config/group-policy.d.ts +49 -0
  704. package/dist/plugin-sdk/config/includes.d.ts +32 -0
  705. package/dist/plugin-sdk/config/io.d.ts +60 -0
  706. package/dist/plugin-sdk/config/legacy-migrate.d.ts +5 -0
  707. package/dist/plugin-sdk/config/legacy.d.ts +6 -0
  708. package/dist/plugin-sdk/config/legacy.migrations.d.ts +2 -0
  709. package/dist/plugin-sdk/config/legacy.rules.d.ts +2 -0
  710. package/dist/plugin-sdk/config/legacy.shared.d.ts +10 -0
  711. package/dist/plugin-sdk/config/markdown-tables.d.ts +7 -0
  712. package/dist/plugin-sdk/config/merge-config.d.ts +7 -0
  713. package/dist/plugin-sdk/config/merge-patch.d.ts +5 -0
  714. package/dist/plugin-sdk/config/normalize-paths.d.ts +8 -0
  715. package/dist/plugin-sdk/config/paths.d.ts +57 -0
  716. package/dist/plugin-sdk/config/prototype-keys.d.ts +1 -0
  717. package/dist/plugin-sdk/config/runtime-group-policy.d.ts +56 -0
  718. package/dist/plugin-sdk/config/runtime-overrides.d.ts +15 -0
  719. package/dist/plugin-sdk/config/sessions/artifacts.d.ts +5 -0
  720. package/dist/plugin-sdk/config/sessions/constants.d.ts +2 -0
  721. package/dist/plugin-sdk/config/sessions/delivery-info.d.ts +16 -0
  722. package/dist/plugin-sdk/config/sessions/disk-budget.d.ts +28 -0
  723. package/dist/plugin-sdk/config/sessions/group.d.ts +11 -0
  724. package/dist/plugin-sdk/config/sessions/main-session.d.ts +43 -0
  725. package/dist/plugin-sdk/config/sessions/metadata.d.ts +16 -0
  726. package/dist/plugin-sdk/config/sessions/paths.d.ts +21 -0
  727. package/dist/plugin-sdk/config/sessions/reset.d.ts +43 -0
  728. package/dist/plugin-sdk/config/sessions/session-file.d.ts +15 -0
  729. package/dist/plugin-sdk/config/sessions/session-key.d.ts +8 -0
  730. package/dist/plugin-sdk/config/sessions/store.d.ts +123 -0
  731. package/dist/plugin-sdk/config/sessions/transcript.d.ts +18 -0
  732. package/dist/plugin-sdk/config/sessions/types.d.ts +136 -0
  733. package/dist/plugin-sdk/config/sessions.d.ts +13 -0
  734. package/dist/plugin-sdk/config/talk.d.ts +21 -0
  735. package/dist/plugin-sdk/config/telegram-custom-commands.d.ts +24 -0
  736. package/dist/plugin-sdk/config/types.agent-defaults.d.ts +168 -0
  737. package/dist/plugin-sdk/config/types.agents-shared.d.ts +43 -0
  738. package/dist/plugin-sdk/config/types.agents.d.ts +66 -0
  739. package/dist/plugin-sdk/config/types.approvals.d.ts +26 -0
  740. package/dist/plugin-sdk/config/types.auth.d.ts +28 -0
  741. package/dist/plugin-sdk/config/types.base.d.ts +202 -0
  742. package/dist/plugin-sdk/config/types.browser.d.ts +65 -0
  743. package/dist/plugin-sdk/config/types.channel-messaging-common.d.ts +44 -0
  744. package/dist/plugin-sdk/config/types.channels.d.ts +53 -0
  745. package/dist/plugin-sdk/config/types.cron.d.ts +26 -0
  746. package/dist/plugin-sdk/config/types.d.ts +27 -0
  747. package/dist/plugin-sdk/config/types.discord.d.ts +271 -0
  748. package/dist/plugin-sdk/config/types.gateway.d.ts +335 -0
  749. package/dist/plugin-sdk/config/types.googlechat.d.ts +107 -0
  750. package/dist/plugin-sdk/config/types.hooks.d.ts +123 -0
  751. package/dist/plugin-sdk/config/types.imessage.d.ts +77 -0
  752. package/dist/plugin-sdk/config/types.installs.d.ts +14 -0
  753. package/dist/plugin-sdk/config/types.irc.d.ts +53 -0
  754. package/dist/plugin-sdk/config/types.messages.d.ts +149 -0
  755. package/dist/plugin-sdk/config/types.models.d.ts +41 -0
  756. package/dist/plugin-sdk/config/types.msteams.d.ts +108 -0
  757. package/dist/plugin-sdk/config/types.node-host.d.ts +10 -0
  758. package/dist/plugin-sdk/config/types.plugins.d.ts +23 -0
  759. package/dist/plugin-sdk/config/types.queue.d.ts +14 -0
  760. package/dist/plugin-sdk/config/types.remoteclaw.d.ts +119 -0
  761. package/dist/plugin-sdk/config/types.signal.d.ts +46 -0
  762. package/dist/plugin-sdk/config/types.slack.d.ts +179 -0
  763. package/dist/plugin-sdk/config/types.telegram.d.ts +187 -0
  764. package/dist/plugin-sdk/config/types.tools.d.ts +249 -0
  765. package/dist/plugin-sdk/config/types.tts.d.ts +79 -0
  766. package/dist/plugin-sdk/config/types.whatsapp.d.ts +101 -0
  767. package/dist/plugin-sdk/config/validation.d.ts +37 -0
  768. package/dist/plugin-sdk/config/version.d.ts +8 -0
  769. package/dist/plugin-sdk/config/zod-schema.agent-defaults.d.ts +93 -0
  770. package/dist/plugin-sdk/config/zod-schema.agent-runtime.d.ts +302 -0
  771. package/dist/plugin-sdk/config/zod-schema.agents.d.ts +224 -0
  772. package/dist/plugin-sdk/config/zod-schema.allowdeny.d.ts +13 -0
  773. package/dist/plugin-sdk/config/zod-schema.approvals.d.ts +15 -0
  774. package/dist/plugin-sdk/config/zod-schema.channels.d.ts +6 -0
  775. package/dist/plugin-sdk/config/zod-schema.core.d.ts +355 -0
  776. package/dist/plugin-sdk/config/zod-schema.d.ts +3155 -0
  777. package/dist/plugin-sdk/config/zod-schema.hooks.d.ts +85 -0
  778. package/dist/plugin-sdk/config/zod-schema.installs.d.ts +16 -0
  779. package/dist/plugin-sdk/config/zod-schema.providers-core.d.ts +3656 -0
  780. package/dist/plugin-sdk/config/zod-schema.providers-whatsapp.d.ts +235 -0
  781. package/dist/plugin-sdk/config/zod-schema.providers.d.ts +2182 -0
  782. package/dist/plugin-sdk/config/zod-schema.sensitive.d.ts +2 -0
  783. package/dist/plugin-sdk/config/zod-schema.session.d.ts +228 -0
  784. package/dist/plugin-sdk/cron/delivery.d.ts +9 -0
  785. package/dist/plugin-sdk/cron/parse.d.ts +1 -0
  786. package/dist/plugin-sdk/cron/schedule.d.ts +2 -0
  787. package/dist/plugin-sdk/cron/service/jobs.d.ts +21 -0
  788. package/dist/plugin-sdk/cron/service/locked.d.ts +2 -0
  789. package/dist/plugin-sdk/cron/service/normalize.d.ts +18 -0
  790. package/dist/plugin-sdk/cron/service/ops.d.ts +81 -0
  791. package/dist/plugin-sdk/cron/service/state.d.ts +125 -0
  792. package/dist/plugin-sdk/cron/service/store.d.ts +9 -0
  793. package/dist/plugin-sdk/cron/service/timer.d.ts +47 -0
  794. package/dist/plugin-sdk/cron/service.d.ts +66 -0
  795. package/dist/plugin-sdk/cron/session-reaper.d.ts +35 -0
  796. package/dist/plugin-sdk/cron/stagger.d.ts +8 -0
  797. package/dist/plugin-sdk/cron/store.d.ts +6 -0
  798. package/dist/plugin-sdk/cron/types.d.ts +131 -0
  799. package/dist/plugin-sdk/cron/webhook-url.d.ts +1 -0
  800. package/dist/plugin-sdk/daemon/constants.d.ts +35 -0
  801. package/dist/plugin-sdk/discord/accounts.d.ts +21 -0
  802. package/dist/plugin-sdk/discord/api.d.ts +11 -0
  803. package/dist/plugin-sdk/discord/audit.d.ts +29 -0
  804. package/dist/plugin-sdk/discord/chunk.d.ts +20 -0
  805. package/dist/plugin-sdk/discord/client.d.ts +21 -0
  806. package/dist/plugin-sdk/discord/components-registry.d.ts +16 -0
  807. package/dist/plugin-sdk/discord/components.d.ts +196 -0
  808. package/dist/plugin-sdk/discord/directory-live.d.ts +4 -0
  809. package/dist/plugin-sdk/discord/draft-chunking.d.ts +6 -0
  810. package/dist/plugin-sdk/discord/draft-stream.d.ts +21 -0
  811. package/dist/plugin-sdk/discord/gateway-logging.d.ts +8 -0
  812. package/dist/plugin-sdk/discord/guilds.d.ts +6 -0
  813. package/dist/plugin-sdk/discord/monitor/agent-components.d.ts +55 -0
  814. package/dist/plugin-sdk/discord/monitor/allow-list.d.ts +174 -0
  815. package/dist/plugin-sdk/discord/monitor/commands.d.ts +2 -0
  816. package/dist/plugin-sdk/discord/monitor/format.d.ts +13 -0
  817. package/dist/plugin-sdk/discord/monitor/gateway-plugin.d.ts +8 -0
  818. package/dist/plugin-sdk/discord/monitor/gateway-registry.d.ts +9 -0
  819. package/dist/plugin-sdk/discord/monitor/listeners.d.ts +44 -0
  820. package/dist/plugin-sdk/discord/monitor/message-handler.d.ts +5 -0
  821. package/dist/plugin-sdk/discord/monitor/message-handler.preflight.d.ts +14 -0
  822. package/dist/plugin-sdk/discord/monitor/message-handler.preflight.types.d.ts +95 -0
  823. package/dist/plugin-sdk/discord/monitor/message-handler.process.d.ts +2 -0
  824. package/dist/plugin-sdk/discord/monitor/message-utils.d.ts +40 -0
  825. package/dist/plugin-sdk/discord/monitor/native-command.d.ts +23 -0
  826. package/dist/plugin-sdk/discord/monitor/presence-cache.d.ts +9 -0
  827. package/dist/plugin-sdk/discord/monitor/presence.d.ts +5 -0
  828. package/dist/plugin-sdk/discord/monitor/provider.allowlist.d.ts +14 -0
  829. package/dist/plugin-sdk/discord/monitor/provider.d.ts +28 -0
  830. package/dist/plugin-sdk/discord/monitor/provider.lifecycle.d.ts +23 -0
  831. package/dist/plugin-sdk/discord/monitor/reply-context.d.ts +17 -0
  832. package/dist/plugin-sdk/discord/monitor/reply-delivery.d.ts +22 -0
  833. package/dist/plugin-sdk/discord/monitor/rest-fetch.d.ts +2 -0
  834. package/dist/plugin-sdk/discord/monitor/sender-identity.d.ts +31 -0
  835. package/dist/plugin-sdk/discord/monitor/system-events.d.ts +2 -0
  836. package/dist/plugin-sdk/discord/monitor/thread-bindings.d.ts +5 -0
  837. package/dist/plugin-sdk/discord/monitor/thread-bindings.discord-api.d.ts +36 -0
  838. package/dist/plugin-sdk/discord/monitor/thread-bindings.lifecycle.d.ts +30 -0
  839. package/dist/plugin-sdk/discord/monitor/thread-bindings.manager.d.ts +17 -0
  840. package/dist/plugin-sdk/discord/monitor/thread-bindings.messages.d.ts +17 -0
  841. package/dist/plugin-sdk/discord/monitor/thread-bindings.state.d.ts +61 -0
  842. package/dist/plugin-sdk/discord/monitor/thread-bindings.types.d.ts +64 -0
  843. package/dist/plugin-sdk/discord/monitor/threading.d.ts +106 -0
  844. package/dist/plugin-sdk/discord/monitor/typing.d.ts +5 -0
  845. package/dist/plugin-sdk/discord/monitor.d.ts +10 -0
  846. package/dist/plugin-sdk/discord/monitor.gateway.d.ts +12 -0
  847. package/dist/plugin-sdk/discord/pluralkit.d.ts +26 -0
  848. package/dist/plugin-sdk/discord/probe.d.ts +28 -0
  849. package/dist/plugin-sdk/discord/resolve-channels.d.ts +15 -0
  850. package/dist/plugin-sdk/discord/resolve-users.d.ts +14 -0
  851. package/dist/plugin-sdk/discord/send.channels.d.ts +17 -0
  852. package/dist/plugin-sdk/discord/send.components.d.ts +17 -0
  853. package/dist/plugin-sdk/discord/send.d.ts +10 -0
  854. package/dist/plugin-sdk/discord/send.emojis-stickers.d.ts +4 -0
  855. package/dist/plugin-sdk/discord/send.guild.d.ts +24 -0
  856. package/dist/plugin-sdk/discord/send.messages.d.ts +20 -0
  857. package/dist/plugin-sdk/discord/send.outbound.d.ts +57 -0
  858. package/dist/plugin-sdk/discord/send.permissions.d.ts +20 -0
  859. package/dist/plugin-sdk/discord/send.reactions.d.ts +15 -0
  860. package/dist/plugin-sdk/discord/send.shared.d.ts +85 -0
  861. package/dist/plugin-sdk/discord/send.types.d.ts +144 -0
  862. package/dist/plugin-sdk/discord/targets.d.ts +18 -0
  863. package/dist/plugin-sdk/discord/token.d.ts +11 -0
  864. package/dist/plugin-sdk/discord/voice/command.d.ts +15 -0
  865. package/dist/plugin-sdk/discord/voice/manager.d.ts +52 -0
  866. package/dist/plugin-sdk/discord/voice-message.d.ts +50 -0
  867. package/dist/plugin-sdk/gateway/call.d.ts +65 -0
  868. package/dist/plugin-sdk/gateway/chat-abort.d.ts +44 -0
  869. package/dist/plugin-sdk/gateway/chat-sanitize.d.ts +4 -0
  870. package/dist/plugin-sdk/gateway/client.d.ts +64 -0
  871. package/dist/plugin-sdk/gateway/control-ui-shared.d.ts +9 -0
  872. package/dist/plugin-sdk/gateway/credentials.d.ts +36 -0
  873. package/dist/plugin-sdk/gateway/device-auth.d.ts +11 -0
  874. package/dist/plugin-sdk/gateway/method-scopes.d.ts +22 -0
  875. package/dist/plugin-sdk/gateway/net.d.ts +77 -0
  876. package/dist/plugin-sdk/gateway/node-registry.d.ts +60 -0
  877. package/dist/plugin-sdk/gateway/protocol/client-info.d.ts +58 -0
  878. package/dist/plugin-sdk/gateway/protocol/index.d.ts +490 -0
  879. package/dist/plugin-sdk/gateway/protocol/schema/agent.d.ts +89 -0
  880. package/dist/plugin-sdk/gateway/protocol/schema/agents-models.d.ts +188 -0
  881. package/dist/plugin-sdk/gateway/protocol/schema/channels.d.ts +134 -0
  882. package/dist/plugin-sdk/gateway/protocol/schema/config.d.ts +53 -0
  883. package/dist/plugin-sdk/gateway/protocol/schema/cron.d.ts +324 -0
  884. package/dist/plugin-sdk/gateway/protocol/schema/devices.d.ts +41 -0
  885. package/dist/plugin-sdk/gateway/protocol/schema/error-codes.d.ts +14 -0
  886. package/dist/plugin-sdk/gateway/protocol/schema/frames.d.ts +168 -0
  887. package/dist/plugin-sdk/gateway/protocol/schema/logs-chat.d.ts +45 -0
  888. package/dist/plugin-sdk/gateway/protocol/schema/nodes.d.ts +64 -0
  889. package/dist/plugin-sdk/gateway/protocol/schema/primitives.d.ts +4 -0
  890. package/dist/plugin-sdk/gateway/protocol/schema/protocol-schemas.d.ts +3 -0
  891. package/dist/plugin-sdk/gateway/protocol/schema/push.d.ts +15 -0
  892. package/dist/plugin-sdk/gateway/protocol/schema/sessions.d.ts +74 -0
  893. package/dist/plugin-sdk/gateway/protocol/schema/snapshot.d.ts +69 -0
  894. package/dist/plugin-sdk/gateway/protocol/schema/types.d.ts +120 -0
  895. package/dist/plugin-sdk/gateway/protocol/schema/wizard.d.ts +86 -0
  896. package/dist/plugin-sdk/gateway/protocol/schema.d.ts +16 -0
  897. package/dist/plugin-sdk/gateway/server/ws-types.d.ts +11 -0
  898. package/dist/plugin-sdk/gateway/server-broadcast.d.ts +17 -0
  899. package/dist/plugin-sdk/gateway/server-channels.d.ts +26 -0
  900. package/dist/plugin-sdk/gateway/server-constants.d.ts +10 -0
  901. package/dist/plugin-sdk/gateway/server-methods/types.d.ts +84 -0
  902. package/dist/plugin-sdk/gateway/server-shared.d.ts +7 -0
  903. package/dist/plugin-sdk/gateway/session-utils.fs.d.ts +48 -0
  904. package/dist/plugin-sdk/gateway/session-utils.types.d.ts +81 -0
  905. package/dist/plugin-sdk/gateway/ws-log.d.ts +5 -0
  906. package/dist/plugin-sdk/gateway/ws-logging.d.ts +4 -0
  907. package/dist/plugin-sdk/globals.d.ts +11 -0
  908. package/dist/plugin-sdk/hooks/internal-hooks.d.ts +140 -0
  909. package/dist/plugin-sdk/hooks/types.d.ts +62 -0
  910. package/dist/plugin-sdk/imessage/accounts.d.ts +16 -0
  911. package/dist/plugin-sdk/imessage/client.d.ts +46 -0
  912. package/dist/plugin-sdk/imessage/constants.d.ts +2 -0
  913. package/dist/plugin-sdk/imessage/monitor/abort-handler.d.ts +9 -0
  914. package/dist/plugin-sdk/imessage/monitor/deliver.d.ts +14 -0
  915. package/dist/plugin-sdk/imessage/monitor/echo-cache.d.ts +9 -0
  916. package/dist/plugin-sdk/imessage/monitor/inbound-processing.d.ts +96 -0
  917. package/dist/plugin-sdk/imessage/monitor/monitor-provider.d.ts +7 -0
  918. package/dist/plugin-sdk/imessage/monitor/parse-notification.d.ts +2 -0
  919. package/dist/plugin-sdk/imessage/monitor/runtime.d.ts +4 -0
  920. package/dist/plugin-sdk/imessage/monitor/types.d.ts +37 -0
  921. package/dist/plugin-sdk/imessage/monitor.d.ts +2 -0
  922. package/dist/plugin-sdk/imessage/probe.d.ts +17 -0
  923. package/dist/plugin-sdk/imessage/send.d.ts +34 -0
  924. package/dist/plugin-sdk/imessage/target-parsing-helpers.d.ts +45 -0
  925. package/dist/plugin-sdk/imessage/targets.d.ts +39 -0
  926. package/dist/plugin-sdk/index.d.ts +1 -0
  927. package/dist/plugin-sdk/index.js +24140 -0
  928. package/dist/plugin-sdk/infra/agent-events.d.ts +21 -0
  929. package/dist/plugin-sdk/infra/archive-path.d.ts +12 -0
  930. package/dist/plugin-sdk/infra/archive.d.ts +46 -0
  931. package/dist/plugin-sdk/infra/backoff.d.ts +8 -0
  932. package/dist/plugin-sdk/infra/brew.d.ts +8 -0
  933. package/dist/plugin-sdk/infra/channel-activity.d.ts +18 -0
  934. package/dist/plugin-sdk/infra/channel-summary.d.ts +6 -0
  935. package/dist/plugin-sdk/infra/dedupe.d.ts +12 -0
  936. package/dist/plugin-sdk/infra/device-auth-store.d.ts +18 -0
  937. package/dist/plugin-sdk/infra/device-identity.d.ts +11 -0
  938. package/dist/plugin-sdk/infra/device-pairing.d.ts +101 -0
  939. package/dist/plugin-sdk/infra/diagnostic-events.d.ts +140 -0
  940. package/dist/plugin-sdk/infra/diagnostic-flags.d.ts +4 -0
  941. package/dist/plugin-sdk/infra/dotenv.d.ts +3 -0
  942. package/dist/plugin-sdk/infra/env.d.ts +11 -0
  943. package/dist/plugin-sdk/infra/errors.d.ts +11 -0
  944. package/dist/plugin-sdk/infra/fetch.d.ts +2 -0
  945. package/dist/plugin-sdk/infra/file-identity.d.ts +5 -0
  946. package/dist/plugin-sdk/infra/file-lock.d.ts +2 -0
  947. package/dist/plugin-sdk/infra/format-time/format-datetime.d.ts +35 -0
  948. package/dist/plugin-sdk/infra/format-time/format-duration.d.ts +23 -0
  949. package/dist/plugin-sdk/infra/format-time/format-relative.d.ts +39 -0
  950. package/dist/plugin-sdk/infra/fs-safe.d.ts +25 -0
  951. package/dist/plugin-sdk/infra/gemini-auth.d.ts +16 -0
  952. package/dist/plugin-sdk/infra/git-commit.d.ts +4 -0
  953. package/dist/plugin-sdk/infra/git-root.d.ts +7 -0
  954. package/dist/plugin-sdk/infra/heartbeat-active-hours.d.ts +5 -0
  955. package/dist/plugin-sdk/infra/heartbeat-events-filter.d.ts +8 -0
  956. package/dist/plugin-sdk/infra/heartbeat-events.d.ts +21 -0
  957. package/dist/plugin-sdk/infra/heartbeat-reason.d.ts +5 -0
  958. package/dist/plugin-sdk/infra/heartbeat-runner.d.ts +45 -0
  959. package/dist/plugin-sdk/infra/heartbeat-visibility.d.ts +17 -0
  960. package/dist/plugin-sdk/infra/heartbeat-wake.d.ts +31 -0
  961. package/dist/plugin-sdk/infra/home-dir.d.ts +7 -0
  962. package/dist/plugin-sdk/infra/host-env-security.d.ts +21 -0
  963. package/dist/plugin-sdk/infra/http-body.d.ts +46 -0
  964. package/dist/plugin-sdk/infra/json-file.d.ts +2 -0
  965. package/dist/plugin-sdk/infra/json-files.d.ts +5 -0
  966. package/dist/plugin-sdk/infra/map-size.d.ts +1 -0
  967. package/dist/plugin-sdk/infra/net/fetch-guard.d.ts +21 -0
  968. package/dist/plugin-sdk/infra/net/hostname.d.ts +1 -0
  969. package/dist/plugin-sdk/infra/net/ssrf.d.ts +35 -0
  970. package/dist/plugin-sdk/infra/outbound/abort.d.ts +8 -0
  971. package/dist/plugin-sdk/infra/outbound/agent-delivery.d.ts +46 -0
  972. package/dist/plugin-sdk/infra/outbound/bound-delivery-router.d.ts +16 -0
  973. package/dist/plugin-sdk/infra/outbound/channel-selection.d.ts +11 -0
  974. package/dist/plugin-sdk/infra/outbound/channel-target.d.ts +6 -0
  975. package/dist/plugin-sdk/infra/outbound/deliver.d.ts +81 -0
  976. package/dist/plugin-sdk/infra/outbound/delivery-queue.d.ts +78 -0
  977. package/dist/plugin-sdk/infra/outbound/directory-cache.d.ts +24 -0
  978. package/dist/plugin-sdk/infra/outbound/envelope.d.ts +16 -0
  979. package/dist/plugin-sdk/infra/outbound/format.d.ts +39 -0
  980. package/dist/plugin-sdk/infra/outbound/identity.d.ts +8 -0
  981. package/dist/plugin-sdk/infra/outbound/message-action-spec.d.ts +5 -0
  982. package/dist/plugin-sdk/infra/outbound/payloads.d.ts +18 -0
  983. package/dist/plugin-sdk/infra/outbound/session-binding-service.d.ts +57 -0
  984. package/dist/plugin-sdk/infra/outbound/target-errors.d.ts +6 -0
  985. package/dist/plugin-sdk/infra/outbound/target-normalization.d.ts +4 -0
  986. package/dist/plugin-sdk/infra/outbound/target-resolver.d.ts +53 -0
  987. package/dist/plugin-sdk/infra/outbound/targets.d.ts +87 -0
  988. package/dist/plugin-sdk/infra/pairing-files.d.ts +23 -0
  989. package/dist/plugin-sdk/infra/pairing-pending.d.ts +13 -0
  990. package/dist/plugin-sdk/infra/pairing-token.d.ts +3 -0
  991. package/dist/plugin-sdk/infra/path-guards.d.ts +5 -0
  992. package/dist/plugin-sdk/infra/path-safety.d.ts +2 -0
  993. package/dist/plugin-sdk/infra/plain-object.d.ts +4 -0
  994. package/dist/plugin-sdk/infra/prototype-keys.d.ts +1 -0
  995. package/dist/plugin-sdk/infra/provider-usage.auth.d.ts +10 -0
  996. package/dist/plugin-sdk/infra/provider-usage.d.ts +4 -0
  997. package/dist/plugin-sdk/infra/provider-usage.fetch.claude.d.ts +2 -0
  998. package/dist/plugin-sdk/infra/provider-usage.fetch.codex.d.ts +2 -0
  999. package/dist/plugin-sdk/infra/provider-usage.fetch.copilot.d.ts +2 -0
  1000. package/dist/plugin-sdk/infra/provider-usage.fetch.d.ts +6 -0
  1001. package/dist/plugin-sdk/infra/provider-usage.fetch.gemini.d.ts +2 -0
  1002. package/dist/plugin-sdk/infra/provider-usage.fetch.minimax.d.ts +2 -0
  1003. package/dist/plugin-sdk/infra/provider-usage.fetch.shared.d.ts +12 -0
  1004. package/dist/plugin-sdk/infra/provider-usage.fetch.zai.d.ts +2 -0
  1005. package/dist/plugin-sdk/infra/provider-usage.format.d.ts +13 -0
  1006. package/dist/plugin-sdk/infra/provider-usage.load.d.ts +11 -0
  1007. package/dist/plugin-sdk/infra/provider-usage.shared.d.ts +8 -0
  1008. package/dist/plugin-sdk/infra/provider-usage.types.d.ts +17 -0
  1009. package/dist/plugin-sdk/infra/restart.d.ts +70 -0
  1010. package/dist/plugin-sdk/infra/retry-policy.d.ts +25 -0
  1011. package/dist/plugin-sdk/infra/retry.d.ts +21 -0
  1012. package/dist/plugin-sdk/infra/safe-executable-value.d.ts +1 -0
  1013. package/dist/plugin-sdk/infra/scp-host.d.ts +2 -0
  1014. package/dist/plugin-sdk/infra/secure-random.d.ts +2 -0
  1015. package/dist/plugin-sdk/infra/session-cost-usage.d.ts +45 -0
  1016. package/dist/plugin-sdk/infra/session-cost-usage.types.d.ts +153 -0
  1017. package/dist/plugin-sdk/infra/session-maintenance-warning.d.ts +10 -0
  1018. package/dist/plugin-sdk/infra/shell-env.d.ts +34 -0
  1019. package/dist/plugin-sdk/infra/system-events.d.ts +18 -0
  1020. package/dist/plugin-sdk/infra/tailnet.d.ts +8 -0
  1021. package/dist/plugin-sdk/infra/tls/fingerprint.d.ts +1 -0
  1022. package/dist/plugin-sdk/infra/tls/gateway.d.ts +16 -0
  1023. package/dist/plugin-sdk/infra/tmp-remoteclaw-dir.d.ts +18 -0
  1024. package/dist/plugin-sdk/infra/transport-ready.d.ts +16 -0
  1025. package/dist/plugin-sdk/infra/unhandled-rejections.d.ts +15 -0
  1026. package/dist/plugin-sdk/infra/ws.d.ts +2 -0
  1027. package/dist/plugin-sdk/infra/wsl.d.ts +11 -0
  1028. package/dist/plugin-sdk/line/accounts.d.ts +10 -0
  1029. package/dist/plugin-sdk/line/actions.d.ts +22 -0
  1030. package/dist/plugin-sdk/line/auto-reply-delivery.d.ts +38 -0
  1031. package/dist/plugin-sdk/line/bot-access.d.ts +17 -0
  1032. package/dist/plugin-sdk/line/bot-handlers.d.ts +13 -0
  1033. package/dist/plugin-sdk/line/bot-message-context.d.ts +118 -0
  1034. package/dist/plugin-sdk/line/bot.d.ts +24 -0
  1035. package/dist/plugin-sdk/line/channel-access-token.d.ts +4 -0
  1036. package/dist/plugin-sdk/line/config-schema.d.ts +62 -0
  1037. package/dist/plugin-sdk/line/download.d.ts +7 -0
  1038. package/dist/plugin-sdk/line/flex-templates/basic-cards.d.ts +46 -0
  1039. package/dist/plugin-sdk/line/flex-templates/common.d.ts +2 -0
  1040. package/dist/plugin-sdk/line/flex-templates/media-control-cards.d.ts +73 -0
  1041. package/dist/plugin-sdk/line/flex-templates/message.d.ts +6 -0
  1042. package/dist/plugin-sdk/line/flex-templates/schedule-cards.d.ts +55 -0
  1043. package/dist/plugin-sdk/line/flex-templates/types.d.ts +19 -0
  1044. package/dist/plugin-sdk/line/flex-templates.d.ts +5 -0
  1045. package/dist/plugin-sdk/line/markdown-to-line.d.ts +72 -0
  1046. package/dist/plugin-sdk/line/monitor.d.ts +28 -0
  1047. package/dist/plugin-sdk/line/probe.d.ts +2 -0
  1048. package/dist/plugin-sdk/line/reply-chunks.d.ts +24 -0
  1049. package/dist/plugin-sdk/line/send.d.ts +91 -0
  1050. package/dist/plugin-sdk/line/signature.d.ts +1 -0
  1051. package/dist/plugin-sdk/line/template-messages.d.ts +100 -0
  1052. package/dist/plugin-sdk/line/types.d.ts +112 -0
  1053. package/dist/plugin-sdk/line/webhook-node.d.ts +15 -0
  1054. package/dist/plugin-sdk/line/webhook-utils.d.ts +3 -0
  1055. package/dist/plugin-sdk/line/webhook.d.ts +19 -0
  1056. package/dist/plugin-sdk/logger.d.ts +6 -0
  1057. package/dist/plugin-sdk/logging/config.d.ts +4 -0
  1058. package/dist/plugin-sdk/logging/console.d.ts +23 -0
  1059. package/dist/plugin-sdk/logging/diagnostic-session-state.d.ts +30 -0
  1060. package/dist/plugin-sdk/logging/diagnostic.d.ts +65 -0
  1061. package/dist/plugin-sdk/logging/env-log-level.d.ts +2 -0
  1062. package/dist/plugin-sdk/logging/levels.d.ts +5 -0
  1063. package/dist/plugin-sdk/logging/logger.d.ts +44 -0
  1064. package/dist/plugin-sdk/logging/node-require.d.ts +1 -0
  1065. package/dist/plugin-sdk/logging/redact-identifier.d.ts +4 -0
  1066. package/dist/plugin-sdk/logging/redact.d.ts +9 -0
  1067. package/dist/plugin-sdk/logging/state.d.ts +19 -0
  1068. package/dist/plugin-sdk/logging/subsystem.d.ts +18 -0
  1069. package/dist/plugin-sdk/logging/timestamps.d.ts +1 -0
  1070. package/dist/plugin-sdk/logging.d.ts +10 -0
  1071. package/dist/plugin-sdk/markdown/fences.d.ts +10 -0
  1072. package/dist/plugin-sdk/markdown/ir.d.ts +32 -0
  1073. package/dist/plugin-sdk/markdown/render.d.ts +18 -0
  1074. package/dist/plugin-sdk/markdown/tables.d.ts +2 -0
  1075. package/dist/plugin-sdk/markdown/whatsapp.d.ts +14 -0
  1076. package/dist/plugin-sdk/media/audio-tags.d.ts +10 -0
  1077. package/dist/plugin-sdk/media/audio.d.ts +19 -0
  1078. package/dist/plugin-sdk/media/base64.d.ts +6 -0
  1079. package/dist/plugin-sdk/media/constants.d.ts +7 -0
  1080. package/dist/plugin-sdk/media/fetch.d.ts +23 -0
  1081. package/dist/plugin-sdk/media/image-ops.d.ts +41 -0
  1082. package/dist/plugin-sdk/media/inbound-path-policy.d.ts +18 -0
  1083. package/dist/plugin-sdk/media/local-roots.d.ts +3 -0
  1084. package/dist/plugin-sdk/media/mime.d.ts +16 -0
  1085. package/dist/plugin-sdk/media/outbound-attachment.d.ts +6 -0
  1086. package/dist/plugin-sdk/media/parse.d.ts +8 -0
  1087. package/dist/plugin-sdk/media/png-encode.d.ts +8 -0
  1088. package/dist/plugin-sdk/media/read-response-with-limit.d.ts +7 -0
  1089. package/dist/plugin-sdk/media/store.d.ts +33 -0
  1090. package/dist/plugin-sdk/middleware/auth-key-retry.d.ts +31 -0
  1091. package/dist/plugin-sdk/middleware/channel-bridge.d.ts +43 -0
  1092. package/dist/plugin-sdk/middleware/cli-runtime-base.d.ts +47 -0
  1093. package/dist/plugin-sdk/middleware/delivery-adapter.d.ts +36 -0
  1094. package/dist/plugin-sdk/middleware/error-classifier.d.ts +19 -0
  1095. package/dist/plugin-sdk/middleware/mcp-side-effects.d.ts +20 -0
  1096. package/dist/plugin-sdk/middleware/media-capability.d.ts +21 -0
  1097. package/dist/plugin-sdk/middleware/media-resolver.d.ts +12 -0
  1098. package/dist/plugin-sdk/middleware/runtime-factory.d.ts +6 -0
  1099. package/dist/plugin-sdk/middleware/runtimes/claude.d.ts +37 -0
  1100. package/dist/plugin-sdk/middleware/runtimes/codex.d.ts +79 -0
  1101. package/dist/plugin-sdk/middleware/runtimes/gemini.d.ts +63 -0
  1102. package/dist/plugin-sdk/middleware/runtimes/opencode.d.ts +59 -0
  1103. package/dist/plugin-sdk/middleware/session-map.d.ts +36 -0
  1104. package/dist/plugin-sdk/middleware/system-prompt.d.ts +30 -0
  1105. package/dist/plugin-sdk/middleware/types.d.ts +236 -0
  1106. package/dist/plugin-sdk/pairing/pairing-labels.d.ts +2 -0
  1107. package/dist/plugin-sdk/pairing/pairing-messages.d.ts +6 -0
  1108. package/dist/plugin-sdk/pairing/pairing-store.d.ts +48 -0
  1109. package/dist/plugin-sdk/plugin-sdk/account-id.d.ts +1 -0
  1110. package/dist/plugin-sdk/plugin-sdk/agent-media-payload.d.ts +12 -0
  1111. package/dist/plugin-sdk/plugin-sdk/allow-from.d.ts +32 -0
  1112. package/dist/plugin-sdk/plugin-sdk/command-auth.d.ts +25 -0
  1113. package/dist/plugin-sdk/plugin-sdk/config-paths.d.ts +6 -0
  1114. package/dist/plugin-sdk/plugin-sdk/file-lock.d.ts +16 -0
  1115. package/dist/plugin-sdk/plugin-sdk/group-access.d.ts +16 -0
  1116. package/dist/plugin-sdk/plugin-sdk/index.d.ts +166 -0
  1117. package/dist/plugin-sdk/plugin-sdk/json-store.d.ts +5 -0
  1118. package/dist/plugin-sdk/plugin-sdk/onboarding.d.ts +11 -0
  1119. package/dist/plugin-sdk/plugin-sdk/persistent-dedupe.d.ts +20 -0
  1120. package/dist/plugin-sdk/plugin-sdk/reply-payload.d.ts +22 -0
  1121. package/dist/plugin-sdk/plugin-sdk/run-command.d.ts +12 -0
  1122. package/dist/plugin-sdk/plugin-sdk/runtime.d.ts +10 -0
  1123. package/dist/plugin-sdk/plugin-sdk/slack-message-actions.d.ts +11 -0
  1124. package/dist/plugin-sdk/plugin-sdk/status-helpers.d.ts +88 -0
  1125. package/dist/plugin-sdk/plugin-sdk/temp-path.d.ts +12 -0
  1126. package/dist/plugin-sdk/plugin-sdk/text-chunking.d.ts +1 -0
  1127. package/dist/plugin-sdk/plugin-sdk/tool-send.d.ts +4 -0
  1128. package/dist/plugin-sdk/plugin-sdk/webhook-path.d.ts +6 -0
  1129. package/dist/plugin-sdk/plugin-sdk/webhook-targets.d.ts +23 -0
  1130. package/dist/plugin-sdk/plugins/bundled-dir.d.ts +1 -0
  1131. package/dist/plugin-sdk/plugins/commands.d.ts +83 -0
  1132. package/dist/plugin-sdk/plugins/config-schema.d.ts +2 -0
  1133. package/dist/plugin-sdk/plugins/config-state.d.ts +30 -0
  1134. package/dist/plugin-sdk/plugins/discovery.d.ts +24 -0
  1135. package/dist/plugin-sdk/plugins/hook-runner-global.d.ts +37 -0
  1136. package/dist/plugin-sdk/plugins/hooks.d.ts +49 -0
  1137. package/dist/plugin-sdk/plugins/http-path.d.ts +1 -0
  1138. package/dist/plugin-sdk/plugins/http-registry.d.ts +13 -0
  1139. package/dist/plugin-sdk/plugins/manifest-registry.d.ts +35 -0
  1140. package/dist/plugin-sdk/plugins/manifest.d.ts +65 -0
  1141. package/dist/plugin-sdk/plugins/path-safety.d.ts +5 -0
  1142. package/dist/plugin-sdk/plugins/registry.d.ts +148 -0
  1143. package/dist/plugin-sdk/plugins/runtime/native-deps.d.ts +8 -0
  1144. package/dist/plugin-sdk/plugins/runtime/types.d.ts +310 -0
  1145. package/dist/plugin-sdk/plugins/runtime.d.ts +5 -0
  1146. package/dist/plugin-sdk/plugins/schema-validator.d.ts +10 -0
  1147. package/dist/plugin-sdk/plugins/types.d.ts +491 -0
  1148. package/dist/plugin-sdk/polls.d.ts +31 -0
  1149. package/dist/plugin-sdk/process/command-queue.d.ts +51 -0
  1150. package/dist/plugin-sdk/process/exec.d.ts +30 -0
  1151. package/dist/plugin-sdk/process/lanes.d.ts +6 -0
  1152. package/dist/plugin-sdk/process/spawn-utils.d.ts +26 -0
  1153. package/dist/plugin-sdk/routing/account-id.d.ts +3 -0
  1154. package/dist/plugin-sdk/routing/account-lookup.d.ts +1 -0
  1155. package/dist/plugin-sdk/routing/bindings.d.ts +11 -0
  1156. package/dist/plugin-sdk/routing/resolve-route.d.ts +42 -0
  1157. package/dist/plugin-sdk/routing/session-key.d.ts +48 -0
  1158. package/dist/plugin-sdk/runtime.d.ts +7 -0
  1159. package/dist/plugin-sdk/security/channel-metadata.d.ts +6 -0
  1160. package/dist/plugin-sdk/security/dm-policy-shared.d.ts +33 -0
  1161. package/dist/plugin-sdk/security/external-content.d.ts +53 -0
  1162. package/dist/plugin-sdk/security/safe-regex.d.ts +2 -0
  1163. package/dist/plugin-sdk/security/scan-paths.d.ts +5 -0
  1164. package/dist/plugin-sdk/security/secret-equal.d.ts +1 -0
  1165. package/dist/plugin-sdk/sessions/input-provenance.d.ts +16 -0
  1166. package/dist/plugin-sdk/sessions/level-overrides.d.ts +10 -0
  1167. package/dist/plugin-sdk/sessions/send-policy.d.ts +11 -0
  1168. package/dist/plugin-sdk/sessions/session-key-utils.d.ts +16 -0
  1169. package/dist/plugin-sdk/sessions/session-label.d.ts +9 -0
  1170. package/dist/plugin-sdk/sessions/transcript-events.d.ts +7 -0
  1171. package/dist/plugin-sdk/shared/avatar-policy.d.ts +16 -0
  1172. package/dist/plugin-sdk/shared/chat-content.d.ts +5 -0
  1173. package/dist/plugin-sdk/shared/chat-envelope.d.ts +2 -0
  1174. package/dist/plugin-sdk/shared/device-auth.d.ts +13 -0
  1175. package/dist/plugin-sdk/shared/gateway-bind-url.d.ts +14 -0
  1176. package/dist/plugin-sdk/shared/net/ip.d.ts +19 -0
  1177. package/dist/plugin-sdk/shared/operator-scope-compat.d.ts +5 -0
  1178. package/dist/plugin-sdk/shared/pid-alive.d.ts +1 -0
  1179. package/dist/plugin-sdk/shared/process-scoped-map.d.ts +1 -0
  1180. package/dist/plugin-sdk/shared/string-normalization.d.ts +4 -0
  1181. package/dist/plugin-sdk/shared/subagents-format.d.ts +15 -0
  1182. package/dist/plugin-sdk/shared/tailscale-status.d.ts +8 -0
  1183. package/dist/plugin-sdk/shared/text/code-regions.d.ts +6 -0
  1184. package/dist/plugin-sdk/shared/text/reasoning-tags.d.ts +6 -0
  1185. package/dist/plugin-sdk/shared/text-chunking.d.ts +1 -0
  1186. package/dist/plugin-sdk/signal/accounts.d.ts +17 -0
  1187. package/dist/plugin-sdk/signal/client.d.ts +32 -0
  1188. package/dist/plugin-sdk/signal/daemon.d.ts +26 -0
  1189. package/dist/plugin-sdk/signal/format.d.ts +17 -0
  1190. package/dist/plugin-sdk/signal/identity.d.ts +24 -0
  1191. package/dist/plugin-sdk/signal/index.d.ts +5 -0
  1192. package/dist/plugin-sdk/signal/monitor/event-handler.d.ts +5 -0
  1193. package/dist/plugin-sdk/signal/monitor/event-handler.types.d.ts +125 -0
  1194. package/dist/plugin-sdk/signal/monitor/mentions.d.ts +2 -0
  1195. package/dist/plugin-sdk/signal/monitor.d.ts +25 -0
  1196. package/dist/plugin-sdk/signal/probe.d.ts +7 -0
  1197. package/dist/plugin-sdk/signal/reaction-level.d.ts +17 -0
  1198. package/dist/plugin-sdk/signal/rpc-context.d.ts +9 -0
  1199. package/dist/plugin-sdk/signal/send-reactions.d.ts +32 -0
  1200. package/dist/plugin-sdk/signal/send.d.ts +25 -0
  1201. package/dist/plugin-sdk/signal/sse-reconnect.d.ts +13 -0
  1202. package/dist/plugin-sdk/slack/accounts.d.ts +32 -0
  1203. package/dist/plugin-sdk/slack/actions.d.ts +56 -0
  1204. package/dist/plugin-sdk/slack/blocks-fallback.d.ts +2 -0
  1205. package/dist/plugin-sdk/slack/blocks-input.d.ts +3 -0
  1206. package/dist/plugin-sdk/slack/channel-migration.d.ts +20 -0
  1207. package/dist/plugin-sdk/slack/client.d.ts +4 -0
  1208. package/dist/plugin-sdk/slack/directory-live.d.ts +4 -0
  1209. package/dist/plugin-sdk/slack/draft-stream.d.ts +25 -0
  1210. package/dist/plugin-sdk/slack/format.d.ts +7 -0
  1211. package/dist/plugin-sdk/slack/http/index.d.ts +1 -0
  1212. package/dist/plugin-sdk/slack/http/registry.d.ts +12 -0
  1213. package/dist/plugin-sdk/slack/index.d.ts +6 -0
  1214. package/dist/plugin-sdk/slack/manifest.d.ts +17 -0
  1215. package/dist/plugin-sdk/slack/message-actions.d.ts +4 -0
  1216. package/dist/plugin-sdk/slack/modal-metadata.d.ts +7 -0
  1217. package/dist/plugin-sdk/slack/monitor/allow-list.d.ts +23 -0
  1218. package/dist/plugin-sdk/slack/monitor/auth.d.ts +11 -0
  1219. package/dist/plugin-sdk/slack/monitor/channel-config.d.ts +41 -0
  1220. package/dist/plugin-sdk/slack/monitor/commands.d.ts +9 -0
  1221. package/dist/plugin-sdk/slack/monitor/context.d.ts +104 -0
  1222. package/dist/plugin-sdk/slack/monitor/events/channels.d.ts +4 -0
  1223. package/dist/plugin-sdk/slack/monitor/events/interactions.d.ts +4 -0
  1224. package/dist/plugin-sdk/slack/monitor/events/members.d.ts +4 -0
  1225. package/dist/plugin-sdk/slack/monitor/events/messages.d.ts +6 -0
  1226. package/dist/plugin-sdk/slack/monitor/events/pins.d.ts +4 -0
  1227. package/dist/plugin-sdk/slack/monitor/events/reactions.d.ts +4 -0
  1228. package/dist/plugin-sdk/slack/monitor/events.d.ts +8 -0
  1229. package/dist/plugin-sdk/slack/monitor/external-arg-menu-store.d.ts +18 -0
  1230. package/dist/plugin-sdk/slack/monitor/media.d.ts +66 -0
  1231. package/dist/plugin-sdk/slack/monitor/message-handler/dispatch.d.ts +12 -0
  1232. package/dist/plugin-sdk/slack/monitor/message-handler/prepare.d.ts +13 -0
  1233. package/dist/plugin-sdk/slack/monitor/message-handler/types.d.ts +22 -0
  1234. package/dist/plugin-sdk/slack/monitor/message-handler.d.ts +11 -0
  1235. package/dist/plugin-sdk/slack/monitor/mrkdwn.d.ts +1 -0
  1236. package/dist/plugin-sdk/slack/monitor/policy.d.ts +5 -0
  1237. package/dist/plugin-sdk/slack/monitor/provider.d.ts +7 -0
  1238. package/dist/plugin-sdk/slack/monitor/replies.d.ts +53 -0
  1239. package/dist/plugin-sdk/slack/monitor/room-context.d.ts +14 -0
  1240. package/dist/plugin-sdk/slack/monitor/slash.d.ts +6 -0
  1241. package/dist/plugin-sdk/slack/monitor/thread-resolution.d.ts +12 -0
  1242. package/dist/plugin-sdk/slack/monitor/types.d.ts +97 -0
  1243. package/dist/plugin-sdk/slack/monitor.d.ts +5 -0
  1244. package/dist/plugin-sdk/slack/probe.d.ts +14 -0
  1245. package/dist/plugin-sdk/slack/resolve-channels.d.ts +19 -0
  1246. package/dist/plugin-sdk/slack/resolve-users.d.ts +26 -0
  1247. package/dist/plugin-sdk/slack/send.d.ts +22 -0
  1248. package/dist/plugin-sdk/slack/stream-mode.d.ts +23 -0
  1249. package/dist/plugin-sdk/slack/streaming.d.ts +72 -0
  1250. package/dist/plugin-sdk/slack/targets.d.ts +7 -0
  1251. package/dist/plugin-sdk/slack/threading-tool-context.d.ts +10 -0
  1252. package/dist/plugin-sdk/slack/threading.d.ts +29 -0
  1253. package/dist/plugin-sdk/slack/token.d.ts +3 -0
  1254. package/dist/plugin-sdk/slack/types.d.ts +58 -0
  1255. package/dist/plugin-sdk/stt/defaults.d.ts +2 -0
  1256. package/dist/plugin-sdk/stt/preflight.d.ts +14 -0
  1257. package/dist/plugin-sdk/stt/providers/deepgram/audio.d.ts +4 -0
  1258. package/dist/plugin-sdk/stt/providers/deepgram/index.d.ts +2 -0
  1259. package/dist/plugin-sdk/stt/providers/google/audio.d.ts +3 -0
  1260. package/dist/plugin-sdk/stt/providers/google/index.d.ts +2 -0
  1261. package/dist/plugin-sdk/stt/providers/google/inline-data.d.ts +20 -0
  1262. package/dist/plugin-sdk/stt/providers/groq/index.d.ts +2 -0
  1263. package/dist/plugin-sdk/stt/providers/index.d.ts +4 -0
  1264. package/dist/plugin-sdk/stt/providers/mistral/index.d.ts +2 -0
  1265. package/dist/plugin-sdk/stt/providers/openai/audio.d.ts +3 -0
  1266. package/dist/plugin-sdk/stt/providers/openai/index.d.ts +2 -0
  1267. package/dist/plugin-sdk/stt/providers/shared.d.ts +20 -0
  1268. package/dist/plugin-sdk/stt/stt.d.ts +27 -0
  1269. package/dist/plugin-sdk/stt/types.d.ts +22 -0
  1270. package/dist/plugin-sdk/telegram/accounts.d.ts +21 -0
  1271. package/dist/plugin-sdk/telegram/allowed-updates.d.ts +4 -0
  1272. package/dist/plugin-sdk/telegram/api-logging.d.ts +11 -0
  1273. package/dist/plugin-sdk/telegram/audit.d.ts +29 -0
  1274. package/dist/plugin-sdk/telegram/bot/delivery.d.ts +35 -0
  1275. package/dist/plugin-sdk/telegram/bot/helpers.d.ts +128 -0
  1276. package/dist/plugin-sdk/telegram/bot/types.d.ts +28 -0
  1277. package/dist/plugin-sdk/telegram/bot-access.d.ts +26 -0
  1278. package/dist/plugin-sdk/telegram/bot-handlers.d.ts +2 -0
  1279. package/dist/plugin-sdk/telegram/bot-message-context.d.ts +144 -0
  1280. package/dist/plugin-sdk/telegram/bot-message-dispatch.d.ts +19 -0
  1281. package/dist/plugin-sdk/telegram/bot-message.d.ts +20 -0
  1282. package/dist/plugin-sdk/telegram/bot-native-command-menu.d.ts +33 -0
  1283. package/dist/plugin-sdk/telegram/bot-native-commands.d.ts +59 -0
  1284. package/dist/plugin-sdk/telegram/bot-updates.d.ts +31 -0
  1285. package/dist/plugin-sdk/telegram/bot.d.ts +62 -0
  1286. package/dist/plugin-sdk/telegram/button-types.d.ts +7 -0
  1287. package/dist/plugin-sdk/telegram/caption.d.ts +5 -0
  1288. package/dist/plugin-sdk/telegram/dm-access.d.ts +18 -0
  1289. package/dist/plugin-sdk/telegram/draft-stream.d.ts +37 -0
  1290. package/dist/plugin-sdk/telegram/fetch.d.ts +5 -0
  1291. package/dist/plugin-sdk/telegram/format.d.ts +18 -0
  1292. package/dist/plugin-sdk/telegram/group-access.d.ts +54 -0
  1293. package/dist/plugin-sdk/telegram/group-config-helpers.d.ts +7 -0
  1294. package/dist/plugin-sdk/telegram/group-migration.d.ts +20 -0
  1295. package/dist/plugin-sdk/telegram/inline-buttons.d.ts +11 -0
  1296. package/dist/plugin-sdk/telegram/lane-delivery.d.ts +56 -0
  1297. package/dist/plugin-sdk/telegram/monitor.d.ts +19 -0
  1298. package/dist/plugin-sdk/telegram/network-config.d.ts +33 -0
  1299. package/dist/plugin-sdk/telegram/network-errors.d.ts +5 -0
  1300. package/dist/plugin-sdk/telegram/outbound-params.d.ts +2 -0
  1301. package/dist/plugin-sdk/telegram/probe.d.ts +17 -0
  1302. package/dist/plugin-sdk/telegram/proxy.d.ts +1 -0
  1303. package/dist/plugin-sdk/telegram/reaction-level.d.ts +11 -0
  1304. package/dist/plugin-sdk/telegram/send.d.ts +153 -0
  1305. package/dist/plugin-sdk/telegram/sent-message-cache.d.ts +16 -0
  1306. package/dist/plugin-sdk/telegram/status-reaction-variants.d.ts +21 -0
  1307. package/dist/plugin-sdk/telegram/sticker-cache.d.ts +47 -0
  1308. package/dist/plugin-sdk/telegram/target-writeback.d.ts +7 -0
  1309. package/dist/plugin-sdk/telegram/targets.d.ts +11 -0
  1310. package/dist/plugin-sdk/telegram/token.d.ts +13 -0
  1311. package/dist/plugin-sdk/telegram/update-offset-store.d.ts +15 -0
  1312. package/dist/plugin-sdk/telegram/voice.d.ts +16 -0
  1313. package/dist/plugin-sdk/telegram/webhook.d.ts +20 -0
  1314. package/dist/plugin-sdk/terminal/ansi.d.ts +2 -0
  1315. package/dist/plugin-sdk/terminal/health-style.d.ts +1 -0
  1316. package/dist/plugin-sdk/terminal/links.d.ts +6 -0
  1317. package/dist/plugin-sdk/terminal/palette.d.ts +10 -0
  1318. package/dist/plugin-sdk/terminal/progress-line.d.ts +3 -0
  1319. package/dist/plugin-sdk/terminal/prompt-style.d.ts +3 -0
  1320. package/dist/plugin-sdk/terminal/restore.d.ts +17 -0
  1321. package/dist/plugin-sdk/terminal/theme.d.ts +15 -0
  1322. package/dist/plugin-sdk/tts/providers/edge.d.ts +2 -0
  1323. package/dist/plugin-sdk/tts/providers/elevenlabs.d.ts +2 -0
  1324. package/dist/plugin-sdk/tts/providers/index.d.ts +4 -0
  1325. package/dist/plugin-sdk/tts/providers/openai.d.ts +2 -0
  1326. package/dist/plugin-sdk/tts/tts-core.d.ts +38 -0
  1327. package/dist/plugin-sdk/tts/tts.d.ts +185 -0
  1328. package/dist/plugin-sdk/tts/types.d.ts +21 -0
  1329. package/dist/plugin-sdk/types/agent-types.d.ts +1 -0
  1330. package/dist/plugin-sdk/utils/account-id.d.ts +1 -0
  1331. package/dist/plugin-sdk/utils/boolean.d.ts +5 -0
  1332. package/dist/plugin-sdk/utils/chunk-items.d.ts +1 -0
  1333. package/dist/plugin-sdk/utils/delivery-context.d.ts +29 -0
  1334. package/dist/plugin-sdk/utils/directive-tags.d.ts +29 -0
  1335. package/dist/plugin-sdk/utils/fetch-timeout.d.ts +13 -0
  1336. package/dist/plugin-sdk/utils/message-channel.d.ts +27 -0
  1337. package/dist/plugin-sdk/utils/normalize-secret-input.d.ts +11 -0
  1338. package/dist/plugin-sdk/utils/provider-utils.d.ts +9 -0
  1339. package/dist/plugin-sdk/utils/queue-helpers.d.ts +80 -0
  1340. package/dist/plugin-sdk/utils/reaction-level.d.ts +15 -0
  1341. package/dist/plugin-sdk/utils/transcript-tools.d.ts +8 -0
  1342. package/dist/plugin-sdk/utils/usage-format.d.ts +26 -0
  1343. package/dist/plugin-sdk/utils/with-timeout.d.ts +1 -0
  1344. package/dist/plugin-sdk/utils.d.ts +63 -0
  1345. package/dist/plugin-sdk/version.d.ts +8 -0
  1346. package/dist/plugin-sdk/web/accounts.d.ts +39 -0
  1347. package/dist/plugin-sdk/web/active-listener.d.ts +25 -0
  1348. package/dist/plugin-sdk/web/auth-store.d.ts +26 -0
  1349. package/dist/plugin-sdk/web/auto-reply/constants.d.ts +1 -0
  1350. package/dist/plugin-sdk/web/auto-reply/deliver-reply.d.ts +19 -0
  1351. package/dist/plugin-sdk/web/auto-reply/heartbeat-runner.d.ts +20 -0
  1352. package/dist/plugin-sdk/web/auto-reply/loggers.d.ts +4 -0
  1353. package/dist/plugin-sdk/web/auto-reply/mentions.d.ts +19 -0
  1354. package/dist/plugin-sdk/web/auto-reply/monitor/ack-reaction.d.ts +13 -0
  1355. package/dist/plugin-sdk/web/auto-reply/monitor/broadcast.d.ts +16 -0
  1356. package/dist/plugin-sdk/web/auto-reply/monitor/commands.d.ts +2 -0
  1357. package/dist/plugin-sdk/web/auto-reply/monitor/echo.d.ts +17 -0
  1358. package/dist/plugin-sdk/web/auto-reply/monitor/group-activation.d.ts +9 -0
  1359. package/dist/plugin-sdk/web/auto-reply/monitor/group-gating.d.ts +33 -0
  1360. package/dist/plugin-sdk/web/auto-reply/monitor/group-members.d.ts +6 -0
  1361. package/dist/plugin-sdk/web/auto-reply/monitor/last-route.d.ts +15 -0
  1362. package/dist/plugin-sdk/web/auto-reply/monitor/message-line.d.ts +11 -0
  1363. package/dist/plugin-sdk/web/auto-reply/monitor/on-message.d.ts +24 -0
  1364. package/dist/plugin-sdk/web/auto-reply/monitor/peer.d.ts +2 -0
  1365. package/dist/plugin-sdk/web/auto-reply/monitor/process-message.d.ts +40 -0
  1366. package/dist/plugin-sdk/web/auto-reply/monitor.d.ts +5 -0
  1367. package/dist/plugin-sdk/web/auto-reply/session-snapshot.d.ts +17 -0
  1368. package/dist/plugin-sdk/web/auto-reply/types.d.ts +30 -0
  1369. package/dist/plugin-sdk/web/auto-reply/util.d.ts +2 -0
  1370. package/dist/plugin-sdk/web/auto-reply.d.ts +1 -0
  1371. package/dist/plugin-sdk/web/auto-reply.impl.d.ts +5 -0
  1372. package/dist/plugin-sdk/web/inbound/access-control.d.ts +36 -0
  1373. package/dist/plugin-sdk/web/inbound/dedupe.d.ts +2 -0
  1374. package/dist/plugin-sdk/web/inbound/extract.d.ts +13 -0
  1375. package/dist/plugin-sdk/web/inbound/media.d.ts +7 -0
  1376. package/dist/plugin-sdk/web/inbound/monitor.d.ts +30 -0
  1377. package/dist/plugin-sdk/web/inbound/send-api.d.ts +22 -0
  1378. package/dist/plugin-sdk/web/inbound/types.d.ts +41 -0
  1379. package/dist/plugin-sdk/web/inbound.d.ts +4 -0
  1380. package/dist/plugin-sdk/web/login-qr.d.ts +19 -0
  1381. package/dist/plugin-sdk/web/login.d.ts +3 -0
  1382. package/dist/plugin-sdk/web/media.d.ts +43 -0
  1383. package/dist/plugin-sdk/web/outbound.d.ts +24 -0
  1384. package/dist/plugin-sdk/web/qr-image.d.ts +4 -0
  1385. package/dist/plugin-sdk/web/reconnect.d.ts +12 -0
  1386. package/dist/plugin-sdk/web/session.d.ts +14 -0
  1387. package/dist/plugin-sdk/web/vcard.d.ts +6 -0
  1388. package/dist/plugin-sdk/whatsapp/normalize.d.ts +6 -0
  1389. package/dist/plugin-sdk/whatsapp/resolve-outbound-target.d.ts +12 -0
  1390. package/dist/plugin-sdk/wizard/prompts.d.ts +43 -0
  1391. package/dist/plugin-sdk/wizard/session.d.ts +42 -0
  1392. package/dist/plugins-Ca4Ybd3t.js +254 -0
  1393. package/dist/plugins-Cjhc9NMf.js +255 -0
  1394. package/dist/plugins-allowlist-A38nxBRG.js +15 -0
  1395. package/dist/plugins-allowlist-D2tS9tcu.js +15 -0
  1396. package/dist/plugins-cli-BvgKK5Ww.js +807 -0
  1397. package/dist/plugins-cli-oK0lk1Ku.js +803 -0
  1398. package/dist/polls-BLyT08ZI.js +33 -0
  1399. package/dist/polls-BmymsJEe.js +33 -0
  1400. package/dist/ports-B4hTs4XH.js +96 -0
  1401. package/dist/ports-CZEhYDiS.js +370 -0
  1402. package/dist/ports-DALdfBQy.js +96 -0
  1403. package/dist/ports-gRBeuUtp.js +316 -0
  1404. package/dist/ports-lsof-CDyv5GJd.js +27 -0
  1405. package/dist/preflight-Bq8rimP-.js +667 -0
  1406. package/dist/preflight-DyYbEp9X.js +667 -0
  1407. package/dist/process-scoped-map-BCJR56ZB.js +39 -0
  1408. package/dist/process-scoped-map-Cb1EHPyN.js +39 -0
  1409. package/dist/program-DKWIpFO9.js +250 -0
  1410. package/dist/program-context-Cgy5-iZi.js +474 -0
  1411. package/dist/program-context-DlXnmuB7.js +17 -0
  1412. package/dist/progress-BcwxtM9Q.js +124 -0
  1413. package/dist/progress-DRLmcFiG.js +123 -0
  1414. package/dist/prompt-BRGfic91.js +21 -0
  1415. package/dist/prompt-CZpYe6wn.js +21 -0
  1416. package/dist/prompt-select-styled-CY647QfO.js +1669 -0
  1417. package/dist/prompt-select-styled-pddqKMoY.js +1672 -0
  1418. package/dist/prompt-style-BpUMhEHC.js +9 -0
  1419. package/dist/prompt-style-CUuA6OCy.js +9 -0
  1420. package/dist/provider-auth-B7QgxlKt.js +187 -0
  1421. package/dist/provider-auth-j-EQvvIk.js +187 -0
  1422. package/dist/provider-dispatcher-DX896bb6.js +659 -0
  1423. package/dist/provider-dispatcher-IV_mSji1.js +660 -0
  1424. package/dist/provider-utils-C9kBVF1f.js +79 -0
  1425. package/dist/provider-utils-DiLhkKQp.js +79 -0
  1426. package/dist/proxy-BMJL0Qog.js +16 -0
  1427. package/dist/proxy-D-qGA1vm.js +16 -0
  1428. package/dist/push-apns--nEiZmEN.js +711 -0
  1429. package/dist/push-apns-BtS6B6lb.js +713 -0
  1430. package/dist/pw-ai-DkXUNGEs.js +1908 -0
  1431. package/dist/pw-ai-oQ2VDwbk.js +1911 -0
  1432. package/dist/pw-ai-state--TxTVwRW.js +11 -0
  1433. package/dist/pw-ai-state-CwXeO5d0.js +11 -0
  1434. package/dist/qr-cli-BffaTzZT.js +353 -0
  1435. package/dist/qr-cli-CKHw8aW4.js +349 -0
  1436. package/dist/redact-BW8tobyp.js +191 -0
  1437. package/dist/redact-Ci96Gj0O.js +191 -0
  1438. package/dist/redact-identifier-Bv5SUUw-.js +15 -0
  1439. package/dist/redact-identifier-HyK89Sod.js +15 -0
  1440. package/dist/redact-snapshot-PHeKfwLg.js +1934 -0
  1441. package/dist/redact-snapshot-h25IHbX2.js +1934 -0
  1442. package/dist/register.agent-BhJGcSwi.js +1029 -0
  1443. package/dist/register.agent-DYcLNpJD.js +292 -0
  1444. package/dist/register.configure-V-MeA6h7.js +135 -0
  1445. package/dist/register.configure-oCfJYt2T.js +130 -0
  1446. package/dist/register.import-CROeeohP.js +31 -0
  1447. package/dist/register.import-DrHKMUlv.js +29 -0
  1448. package/dist/register.maintenance-XRDiAiai.js +501 -0
  1449. package/dist/register.maintenance-mHTyzd1l.js +503 -0
  1450. package/dist/register.message-9FClPeyR.js +687 -0
  1451. package/dist/register.message-DigNUgXx.js +691 -0
  1452. package/dist/register.onboard-CF1DK5RO.js +92 -0
  1453. package/dist/register.onboard-Cm2ExJRM.js +96 -0
  1454. package/dist/register.setup-BEV_QLoU.js +114 -0
  1455. package/dist/register.setup-BboalnlO.js +118 -0
  1456. package/dist/register.status-health-sessions-B5flqjtZ.js +666 -0
  1457. package/dist/register.status-health-sessions-DbQPmWOW.js +428 -0
  1458. package/dist/register.subclis-FFHoriVe.js +267 -0
  1459. package/dist/remoteclaw-root-BfPjgewe.js +88 -0
  1460. package/dist/remoteclaw-root-E4-hmb4E.js +88 -0
  1461. package/dist/render-6ahYfPwj.js +104 -0
  1462. package/dist/render-BhKzKdV0.js +104 -0
  1463. package/dist/render-e7fENCYH.js +104 -0
  1464. package/dist/replies-Dc_GFb85.js +136 -0
  1465. package/dist/replies-nkw9sahT.js +136 -0
  1466. package/dist/reply-D0iVkyuP.js +12366 -0
  1467. package/dist/reply-DEPE5T_9.js +12363 -0
  1468. package/dist/reply-directives-Bbyf2UON.js +182 -0
  1469. package/dist/reply-directives-DiRJRT_6.js +182 -0
  1470. package/dist/reply-payloads-DDrMOUKP.js +527 -0
  1471. package/dist/reply-prefix-Buyx2ZZC.js +37 -0
  1472. package/dist/reply-prefix-D7E0w0O2.js +37 -0
  1473. package/dist/resolve-route-BBOsg5KI.js +249 -0
  1474. package/dist/resolve-route-Dyx3ifWH.js +249 -0
  1475. package/dist/response-prefix-template-CZOMBOE6.js +134 -0
  1476. package/dist/response-prefix-template-xsasdq1T.js +134 -0
  1477. package/dist/retry-BWv_fy4u.js +77 -0
  1478. package/dist/retry-D7zwz3HY.js +77 -0
  1479. package/dist/retry-Dar_7pCv.js +77 -0
  1480. package/dist/rolldown-runtime-Cbj13DAv.js +20 -0
  1481. package/dist/run-main-BUSpd6Gy.js +308 -0
  1482. package/dist/runtime-guard-Bhx-pb8_.js +60 -0
  1483. package/dist/runtime-guard-DAHXelsb.js +60 -0
  1484. package/dist/runtime-status-CR9445g5.js +12 -0
  1485. package/dist/runtime-status-hFVEC3wO.js +12 -0
  1486. package/dist/secret-equal-D6AoXne1.js +11 -0
  1487. package/dist/secret-equal-DLnUuWM3.js +11 -0
  1488. package/dist/secure-random-B8v4P_PH.js +44 -0
  1489. package/dist/secure-random-Ba4Y5xG5.js +12 -0
  1490. package/dist/secure-random-CRVHgtmO.js +12 -0
  1491. package/dist/security-cli-C8r-8YZ7.js +488 -0
  1492. package/dist/security-cli-Cy2Jqb0n.js +483 -0
  1493. package/dist/send-B5iWtbNX.js +349 -0
  1494. package/dist/send-BaaCgoKI.js +374 -0
  1495. package/dist/send-Brtl2skD.js +332 -0
  1496. package/dist/send-BuKAbt8a.js +547 -0
  1497. package/dist/send-BxQ1YFYH.js +1178 -0
  1498. package/dist/send-C7xFV4Ul.js +29 -0
  1499. package/dist/send-C9pLn8Zz.js +11 -0
  1500. package/dist/send-CPn9GDbB.js +349 -0
  1501. package/dist/send-DJ5jHNeg.js +1779 -0
  1502. package/dist/send-DLLYgtkJ.js +2245 -0
  1503. package/dist/send-DO4RP5yz.js +1776 -0
  1504. package/dist/send-DYHrHs_8.js +492 -0
  1505. package/dist/send-DZ80jwFi.js +426 -0
  1506. package/dist/send-Dbl0_FNE.js +2245 -0
  1507. package/dist/send-DpaTnM-a.js +492 -0
  1508. package/dist/send-gxeISRd1.js +547 -0
  1509. package/dist/server-BZfrR2D5.js +206 -0
  1510. package/dist/server-CW4QQmFB.js +202 -0
  1511. package/dist/server-lifecycle-CY3Lxtea.js +2437 -0
  1512. package/dist/server-lifecycle-X3AKkvMo.js +2437 -0
  1513. package/dist/server-node-events-q5He8xk5.js +391 -0
  1514. package/dist/server-node-events-udPU4Xlv.js +395 -0
  1515. package/dist/service-C2j81L86.js +670 -0
  1516. package/dist/service-C8a0SXHD.js +670 -0
  1517. package/dist/session-C6VKWvx6.js +170 -0
  1518. package/dist/session-cost-usage-0Vs4hgMe.js +627 -0
  1519. package/dist/session-cost-usage-C-DsaOfN.js +627 -0
  1520. package/dist/session-dirs-CO1f2ArM.js +318 -0
  1521. package/dist/session-dirs-DoboH7Oy.js +318 -0
  1522. package/dist/session-enM9-2If.js +170 -0
  1523. package/dist/session-key-BF-9YzxC.js +235 -0
  1524. package/dist/session-key-CgKWfjoZ.js +235 -0
  1525. package/dist/session-utils-VKfyrS3d.js +621 -0
  1526. package/dist/session-utils-_U6PeQeD.js +621 -0
  1527. package/dist/sessions-Dg3febTj.js +2553 -0
  1528. package/dist/sessions-Fhrpa-qj.js +245 -0
  1529. package/dist/shell-env-DBS5su07.js +163 -0
  1530. package/dist/shell-env-c3j5zcU9.js +163 -0
  1531. package/dist/ssrf-8wNqPNzN.js +183 -0
  1532. package/dist/ssrf-CJIdPXuS.js +183 -0
  1533. package/dist/stagger--wvODnNe.js +56 -0
  1534. package/dist/stagger-BLmTO4cK.js +56 -0
  1535. package/dist/status-1zVD-Clq.js +21 -0
  1536. package/dist/status-B_wW9Vt8.js +1936 -0
  1537. package/dist/status-BtRY0nXQ.js +21 -0
  1538. package/dist/status-D3leIzsB.js +1940 -0
  1539. package/dist/status.update-BmuDZ7E7.js +449 -0
  1540. package/dist/status.update-Mf6HSRvU.js +449 -0
  1541. package/dist/store-BmUyjVdV.js +2555 -0
  1542. package/dist/store-CzhBjUCN.js +64 -0
  1543. package/dist/store-DlqiXmDO.js +53 -0
  1544. package/dist/store-LXf4lUUA.js +64 -0
  1545. package/dist/strip-inbound-meta-zmUXypSS.js +110 -0
  1546. package/dist/strip-inbound-meta-zqtN9FTK.js +110 -0
  1547. package/dist/subagent-registry-BCGOdOC-.js +4839 -0
  1548. package/dist/subagent-registry-Bjx9LVlV.js +4841 -0
  1549. package/dist/subsystem-BAW_f3DI.js +1195 -0
  1550. package/dist/subsystem-DE8w_S23.js +1081 -0
  1551. package/dist/system-cli-CDi0wZXE.js +73 -0
  1552. package/dist/system-cli-CrzLj6XB.js +77 -0
  1553. package/dist/systemd-40Rij3QR.js +547 -0
  1554. package/dist/systemd-5C97CSzd.js +547 -0
  1555. package/dist/systemd-hints-CyQqHq1i.js +278 -0
  1556. package/dist/systemd-hints-Dbpv6gQ1.js +278 -0
  1557. package/dist/systemd-linger-B2rPbnAi.js +75 -0
  1558. package/dist/systemd-linger-DDvkfxH-.js +75 -0
  1559. package/dist/table-DFx25vNb.js +279 -0
  1560. package/dist/table-On3hkCqi.js +278 -0
  1561. package/dist/tables-BFyFqtLB.js +55 -0
  1562. package/dist/tables-Crybi0rV.js +55 -0
  1563. package/dist/tables-Dwxstcvj.js +55 -0
  1564. package/dist/tailnet-Da-_9e8E.js +40 -0
  1565. package/dist/tailnet-xt92Yaop.js +40 -0
  1566. package/dist/tailscale-CnV0JWca.js +230 -0
  1567. package/dist/tailscale-VkEC8dzj.js +230 -0
  1568. package/dist/target-errors-ChjvOMuV.js +26 -0
  1569. package/dist/target-errors-GZXDqlUu.js +26 -0
  1570. package/dist/targets-B46m7u5J.js +45 -0
  1571. package/dist/targets-BegO82oK.js +2614 -0
  1572. package/dist/targets-BpTQ50aN.js +649 -0
  1573. package/dist/targets-BtGRUQMa.js +79 -0
  1574. package/dist/targets-C99szk_e.js +114 -0
  1575. package/dist/targets-CmC5m7Ey.js +53 -0
  1576. package/dist/targets-D01MJGnh.js +79 -0
  1577. package/dist/targets-D3r6Zgic.js +39 -0
  1578. package/dist/targets-D7PT_rdO.js +45 -0
  1579. package/dist/targets-D8Rv_6CT.js +649 -0
  1580. package/dist/targets-DJ_OVcyq.js +220 -0
  1581. package/dist/targets-_UWmnyI9.js +53 -0
  1582. package/dist/targets-felDvoku.js +2613 -0
  1583. package/dist/targets-tDrl_ioQ.js +46 -0
  1584. package/dist/text-format-DarxU3JH.js +9 -0
  1585. package/dist/text-format-Ds92M9UT.js +9 -0
  1586. package/dist/thinking-4nOZPunr.js +60 -0
  1587. package/dist/thinking-ZfH2V9Os.js +60 -0
  1588. package/dist/tokens-Dw7ZdYwT.js +21 -0
  1589. package/dist/tokens-TtJJxzRr.js +21 -0
  1590. package/dist/tool-display-Bxs_1jIn.js +785 -0
  1591. package/dist/tool-display-D9p_Ttkq.js +785 -0
  1592. package/dist/tool-images-9Ron321Q.js +263 -0
  1593. package/dist/tool-images-BWhy6WRN.js +263 -0
  1594. package/dist/trash-BpB96kHe.js +125 -0
  1595. package/dist/trash-De0DLz-t.js +125 -0
  1596. package/dist/tui-M21MnbJp.js +3237 -0
  1597. package/dist/tui-cli-mxjebFIk.js +63 -0
  1598. package/dist/tui-cli-x2aEqskG.js +67 -0
  1599. package/dist/tui-qVJob4mN.js +3237 -0
  1600. package/dist/types.tools-BBb2rl3g.js +23 -0
  1601. package/dist/types.tools-BDJw1yFx.js +23 -0
  1602. package/dist/update-Bv3EwRgy.js +349 -0
  1603. package/dist/update-D2gIPs2g.js +349 -0
  1604. package/dist/update-cli-B_tiAE6B.js +1149 -0
  1605. package/dist/update-cli-DdERWV6b.js +1147 -0
  1606. package/dist/usage-BIzKZ5dT.js +57 -0
  1607. package/dist/usage-BvZOzIC7.js +57 -0
  1608. package/dist/usage-CCU9qNC5.js +5472 -0
  1609. package/dist/usage-format-CmniSPCG.js +31 -0
  1610. package/dist/usage-format-D_KQYQ-w.js +31 -0
  1611. package/dist/utils-DPoNpP7D.js +631 -0
  1612. package/dist/version-3QUZW8EP.js +52 -0
  1613. package/dist/version-CVMnqdzu.js +52 -0
  1614. package/dist/voice-credentials-CxWaO19D.js +46 -0
  1615. package/dist/voice-credentials-DXU-y9z7.js +46 -0
  1616. package/dist/warning-filter.js +48 -0
  1617. package/dist/web-CCN82vao.js +74 -0
  1618. package/dist/web-MFXYQO8v.js +79 -0
  1619. package/dist/web-zotCHj-B.js +3051 -0
  1620. package/dist/webhooks-cli-BB6FZ7La.js +330 -0
  1621. package/dist/webhooks-cli-BoZinXXo.js +334 -0
  1622. package/dist/whatsapp-actions-COMlNQFa.js +126 -0
  1623. package/dist/whatsapp-actions-YZgc7smO.js +131 -0
  1624. package/dist/widearea-dns-CQqZIeu8.js +127 -0
  1625. package/dist/widearea-dns-D01FFYZ8.js +127 -0
  1626. package/dist/workspace-BJCKO8Ns.js +10 -0
  1627. package/dist/workspace-BisvA9oA.js +10 -0
  1628. package/dist/workspace-Bj_uUDJr.js +439 -0
  1629. package/dist/workspace-S9vwEco2.js +441 -0
  1630. package/dist/wsl-PDLKeX04.js +52 -0
  1631. package/dist/wsl-kFaeW76c.js +52 -0
  1632. package/dist/zod-schema-7uqrpeBz.js +2715 -0
  1633. package/dist/zod-schema-CdBaNuxH.js +2715 -0
  1634. package/extensions/bluebubbles/README.md +45 -0
  1635. package/extensions/bluebubbles/index.ts +19 -0
  1636. package/extensions/bluebubbles/package.json +33 -0
  1637. package/extensions/bluebubbles/remoteclaw.plugin.json +9 -0
  1638. package/extensions/bluebubbles/src/account-resolve.ts +35 -0
  1639. package/extensions/bluebubbles/src/accounts.ts +90 -0
  1640. package/extensions/bluebubbles/src/actions.ts +460 -0
  1641. package/extensions/bluebubbles/src/attachments.ts +268 -0
  1642. package/extensions/bluebubbles/src/channel.ts +418 -0
  1643. package/extensions/bluebubbles/src/chat.ts +329 -0
  1644. package/extensions/bluebubbles/src/config-schema.ts +65 -0
  1645. package/extensions/bluebubbles/src/history.ts +177 -0
  1646. package/extensions/bluebubbles/src/media-send.ts +317 -0
  1647. package/extensions/bluebubbles/src/monitor-normalize.ts +825 -0
  1648. package/extensions/bluebubbles/src/monitor-processing.ts +1448 -0
  1649. package/extensions/bluebubbles/src/monitor-reply-cache.ts +185 -0
  1650. package/extensions/bluebubbles/src/monitor-shared.ts +41 -0
  1651. package/extensions/bluebubbles/src/monitor.ts +534 -0
  1652. package/extensions/bluebubbles/src/multipart.ts +32 -0
  1653. package/extensions/bluebubbles/src/onboarding.ts +340 -0
  1654. package/extensions/bluebubbles/src/probe.ts +163 -0
  1655. package/extensions/bluebubbles/src/reactions.ts +182 -0
  1656. package/extensions/bluebubbles/src/request-url.ts +12 -0
  1657. package/extensions/bluebubbles/src/runtime.ts +34 -0
  1658. package/extensions/bluebubbles/src/send-helpers.ts +53 -0
  1659. package/extensions/bluebubbles/src/send.ts +472 -0
  1660. package/extensions/bluebubbles/src/targets.ts +370 -0
  1661. package/extensions/bluebubbles/src/test-harness.ts +79 -0
  1662. package/extensions/bluebubbles/src/test-mocks.ts +11 -0
  1663. package/extensions/bluebubbles/src/types.ts +135 -0
  1664. package/extensions/device-pair/index.ts +529 -0
  1665. package/extensions/device-pair/remoteclaw.plugin.json +20 -0
  1666. package/extensions/diagnostics-otel/index.ts +15 -0
  1667. package/extensions/diagnostics-otel/node_modules/.bin/acorn +21 -0
  1668. package/extensions/diagnostics-otel/package.json +24 -0
  1669. package/extensions/diagnostics-otel/remoteclaw.plugin.json +8 -0
  1670. package/extensions/diagnostics-otel/src/service.ts +682 -0
  1671. package/extensions/discord/index.ts +19 -0
  1672. package/extensions/discord/package.json +11 -0
  1673. package/extensions/discord/remoteclaw.plugin.json +9 -0
  1674. package/extensions/discord/src/channel.ts +451 -0
  1675. package/extensions/discord/src/runtime.ts +14 -0
  1676. package/extensions/discord/src/subagent-hooks.ts +152 -0
  1677. package/extensions/feishu/index.ts +63 -0
  1678. package/extensions/feishu/package.json +34 -0
  1679. package/extensions/feishu/remoteclaw.plugin.json +9 -0
  1680. package/extensions/feishu/skills/feishu-doc/SKILL.md +105 -0
  1681. package/extensions/feishu/skills/feishu-doc/references/block-types.md +103 -0
  1682. package/extensions/feishu/skills/feishu-drive/SKILL.md +97 -0
  1683. package/extensions/feishu/skills/feishu-perm/SKILL.md +119 -0
  1684. package/extensions/feishu/skills/feishu-wiki/SKILL.md +111 -0
  1685. package/extensions/feishu/src/accounts.ts +144 -0
  1686. package/extensions/feishu/src/bitable.ts +739 -0
  1687. package/extensions/feishu/src/bot.ts +1006 -0
  1688. package/extensions/feishu/src/channel.ts +359 -0
  1689. package/extensions/feishu/src/client.ts +118 -0
  1690. package/extensions/feishu/src/config-schema.ts +226 -0
  1691. package/extensions/feishu/src/dedup.ts +54 -0
  1692. package/extensions/feishu/src/directory.ts +177 -0
  1693. package/extensions/feishu/src/doc-schema.ts +47 -0
  1694. package/extensions/feishu/src/docx.ts +536 -0
  1695. package/extensions/feishu/src/drive-schema.ts +46 -0
  1696. package/extensions/feishu/src/drive.ts +227 -0
  1697. package/extensions/feishu/src/dynamic-agent.ts +131 -0
  1698. package/extensions/feishu/src/external-keys.ts +19 -0
  1699. package/extensions/feishu/src/media.ts +441 -0
  1700. package/extensions/feishu/src/mention.ts +133 -0
  1701. package/extensions/feishu/src/monitor.ts +397 -0
  1702. package/extensions/feishu/src/onboarding.ts +351 -0
  1703. package/extensions/feishu/src/outbound.ts +55 -0
  1704. package/extensions/feishu/src/perm-schema.ts +52 -0
  1705. package/extensions/feishu/src/perm.ts +173 -0
  1706. package/extensions/feishu/src/policy.ts +120 -0
  1707. package/extensions/feishu/src/probe.ts +44 -0
  1708. package/extensions/feishu/src/reactions.ts +160 -0
  1709. package/extensions/feishu/src/reply-dispatcher.ts +239 -0
  1710. package/extensions/feishu/src/runtime.ts +14 -0
  1711. package/extensions/feishu/src/send-result.ts +29 -0
  1712. package/extensions/feishu/src/send-target.ts +25 -0
  1713. package/extensions/feishu/src/send.ts +313 -0
  1714. package/extensions/feishu/src/streaming-card.ts +218 -0
  1715. package/extensions/feishu/src/targets.ts +78 -0
  1716. package/extensions/feishu/src/tools-config.ts +21 -0
  1717. package/extensions/feishu/src/types.ts +81 -0
  1718. package/extensions/feishu/src/typing.ts +80 -0
  1719. package/extensions/feishu/src/wiki-schema.ts +55 -0
  1720. package/extensions/feishu/src/wiki.ts +232 -0
  1721. package/extensions/googlechat/index.ts +19 -0
  1722. package/extensions/googlechat/node_modules/.bin/nlc +21 -0
  1723. package/extensions/googlechat/node_modules/.bin/node-llama-cpp +21 -0
  1724. package/extensions/googlechat/node_modules/.bin/remoteclaw +21 -0
  1725. package/extensions/googlechat/node_modules/.bin/tsc +21 -0
  1726. package/extensions/googlechat/node_modules/.bin/tsserver +21 -0
  1727. package/extensions/googlechat/package.json +37 -0
  1728. package/extensions/googlechat/remoteclaw.plugin.json +9 -0
  1729. package/extensions/googlechat/src/accounts.ts +147 -0
  1730. package/extensions/googlechat/src/actions.ts +176 -0
  1731. package/extensions/googlechat/src/api.ts +282 -0
  1732. package/extensions/googlechat/src/auth.ts +137 -0
  1733. package/extensions/googlechat/src/channel.ts +576 -0
  1734. package/extensions/googlechat/src/monitor.ts +965 -0
  1735. package/extensions/googlechat/src/onboarding.ts +270 -0
  1736. package/extensions/googlechat/src/runtime.ts +14 -0
  1737. package/extensions/googlechat/src/targets.ts +65 -0
  1738. package/extensions/googlechat/src/types.config.ts +3 -0
  1739. package/extensions/googlechat/src/types.ts +73 -0
  1740. package/extensions/imessage/index.ts +17 -0
  1741. package/extensions/imessage/package.json +12 -0
  1742. package/extensions/imessage/remoteclaw.plugin.json +9 -0
  1743. package/extensions/imessage/src/channel.ts +304 -0
  1744. package/extensions/imessage/src/runtime.ts +14 -0
  1745. package/extensions/irc/index.ts +17 -0
  1746. package/extensions/irc/package.json +11 -0
  1747. package/extensions/irc/remoteclaw.plugin.json +9 -0
  1748. package/extensions/irc/src/accounts.ts +268 -0
  1749. package/extensions/irc/src/channel.ts +364 -0
  1750. package/extensions/irc/src/client.ts +439 -0
  1751. package/extensions/irc/src/config-schema.ts +91 -0
  1752. package/extensions/irc/src/connect-options.ts +30 -0
  1753. package/extensions/irc/src/control-chars.ts +22 -0
  1754. package/extensions/irc/src/inbound.ts +371 -0
  1755. package/extensions/irc/src/monitor.ts +146 -0
  1756. package/extensions/irc/src/normalize.ts +123 -0
  1757. package/extensions/irc/src/onboarding.ts +479 -0
  1758. package/extensions/irc/src/policy.ts +166 -0
  1759. package/extensions/irc/src/probe.ts +53 -0
  1760. package/extensions/irc/src/protocol.ts +169 -0
  1761. package/extensions/irc/src/runtime.ts +14 -0
  1762. package/extensions/irc/src/send.ts +88 -0
  1763. package/extensions/irc/src/types.ts +98 -0
  1764. package/extensions/line/index.ts +19 -0
  1765. package/extensions/line/package.json +27 -0
  1766. package/extensions/line/remoteclaw.plugin.json +9 -0
  1767. package/extensions/line/src/card-command.ts +344 -0
  1768. package/extensions/line/src/channel.ts +797 -0
  1769. package/extensions/line/src/runtime.ts +14 -0
  1770. package/extensions/matrix/CHANGELOG.md +32 -0
  1771. package/extensions/matrix/index.ts +17 -0
  1772. package/extensions/matrix/node_modules/.bin/markdown-it +21 -0
  1773. package/extensions/matrix/package.json +33 -0
  1774. package/extensions/matrix/remoteclaw.plugin.json +9 -0
  1775. package/extensions/matrix/src/actions.ts +195 -0
  1776. package/extensions/matrix/src/channel.ts +486 -0
  1777. package/extensions/matrix/src/config-schema.ts +63 -0
  1778. package/extensions/matrix/src/directory-live.ts +208 -0
  1779. package/extensions/matrix/src/group-mentions.ts +52 -0
  1780. package/extensions/matrix/src/matrix/accounts.ts +137 -0
  1781. package/extensions/matrix/src/matrix/actions/client.ts +47 -0
  1782. package/extensions/matrix/src/matrix/actions/limits.ts +6 -0
  1783. package/extensions/matrix/src/matrix/actions/messages.ts +126 -0
  1784. package/extensions/matrix/src/matrix/actions/pins.ts +84 -0
  1785. package/extensions/matrix/src/matrix/actions/reactions.ts +102 -0
  1786. package/extensions/matrix/src/matrix/actions/room.ts +85 -0
  1787. package/extensions/matrix/src/matrix/actions/summary.ts +75 -0
  1788. package/extensions/matrix/src/matrix/actions/types.ts +85 -0
  1789. package/extensions/matrix/src/matrix/actions.ts +15 -0
  1790. package/extensions/matrix/src/matrix/active-client.ts +32 -0
  1791. package/extensions/matrix/src/matrix/client/config.ts +219 -0
  1792. package/extensions/matrix/src/matrix/client/create-client.ts +123 -0
  1793. package/extensions/matrix/src/matrix/client/logging.ts +36 -0
  1794. package/extensions/matrix/src/matrix/client/runtime.ts +4 -0
  1795. package/extensions/matrix/src/matrix/client/shared.ts +201 -0
  1796. package/extensions/matrix/src/matrix/client/storage.ts +131 -0
  1797. package/extensions/matrix/src/matrix/client/types.ts +34 -0
  1798. package/extensions/matrix/src/matrix/client-bootstrap.ts +39 -0
  1799. package/extensions/matrix/src/matrix/client.ts +14 -0
  1800. package/extensions/matrix/src/matrix/credentials.ts +125 -0
  1801. package/extensions/matrix/src/matrix/deps.ts +60 -0
  1802. package/extensions/matrix/src/matrix/format.ts +22 -0
  1803. package/extensions/matrix/src/matrix/index.ts +11 -0
  1804. package/extensions/matrix/src/matrix/monitor/allowlist.ts +103 -0
  1805. package/extensions/matrix/src/matrix/monitor/auto-join.ts +71 -0
  1806. package/extensions/matrix/src/matrix/monitor/direct.ts +104 -0
  1807. package/extensions/matrix/src/matrix/monitor/events.ts +148 -0
  1808. package/extensions/matrix/src/matrix/monitor/handler.ts +688 -0
  1809. package/extensions/matrix/src/matrix/monitor/index.ts +358 -0
  1810. package/extensions/matrix/src/matrix/monitor/location.ts +100 -0
  1811. package/extensions/matrix/src/matrix/monitor/media.ts +118 -0
  1812. package/extensions/matrix/src/matrix/monitor/mentions.ts +62 -0
  1813. package/extensions/matrix/src/matrix/monitor/replies.ts +100 -0
  1814. package/extensions/matrix/src/matrix/monitor/room-info.ts +55 -0
  1815. package/extensions/matrix/src/matrix/monitor/rooms.ts +47 -0
  1816. package/extensions/matrix/src/matrix/monitor/threads.ts +68 -0
  1817. package/extensions/matrix/src/matrix/monitor/types.ts +39 -0
  1818. package/extensions/matrix/src/matrix/poll-types.ts +167 -0
  1819. package/extensions/matrix/src/matrix/probe.ts +69 -0
  1820. package/extensions/matrix/src/matrix/send/client.ts +97 -0
  1821. package/extensions/matrix/src/matrix/send/formatting.ts +93 -0
  1822. package/extensions/matrix/src/matrix/send/media.ts +230 -0
  1823. package/extensions/matrix/src/matrix/send/targets.ts +150 -0
  1824. package/extensions/matrix/src/matrix/send/types.ts +109 -0
  1825. package/extensions/matrix/src/matrix/send-queue.ts +44 -0
  1826. package/extensions/matrix/src/matrix/send.ts +265 -0
  1827. package/extensions/matrix/src/onboarding.ts +446 -0
  1828. package/extensions/matrix/src/outbound.ts +55 -0
  1829. package/extensions/matrix/src/resolve-targets.ts +126 -0
  1830. package/extensions/matrix/src/runtime.ts +14 -0
  1831. package/extensions/matrix/src/tool-actions.ts +164 -0
  1832. package/extensions/matrix/src/types.ts +114 -0
  1833. package/extensions/mattermost/index.ts +17 -0
  1834. package/extensions/mattermost/package.json +25 -0
  1835. package/extensions/mattermost/remoteclaw.plugin.json +9 -0
  1836. package/extensions/mattermost/src/channel.ts +439 -0
  1837. package/extensions/mattermost/src/config-schema.ts +62 -0
  1838. package/extensions/mattermost/src/group-mentions.ts +15 -0
  1839. package/extensions/mattermost/src/mattermost/accounts.ts +128 -0
  1840. package/extensions/mattermost/src/mattermost/client.ts +230 -0
  1841. package/extensions/mattermost/src/mattermost/index.ts +9 -0
  1842. package/extensions/mattermost/src/mattermost/monitor-helpers.ts +71 -0
  1843. package/extensions/mattermost/src/mattermost/monitor-onchar.ts +25 -0
  1844. package/extensions/mattermost/src/mattermost/monitor-websocket.ts +221 -0
  1845. package/extensions/mattermost/src/mattermost/monitor.ts +1061 -0
  1846. package/extensions/mattermost/src/mattermost/probe.ts +61 -0
  1847. package/extensions/mattermost/src/mattermost/reactions.test-helpers.ts +83 -0
  1848. package/extensions/mattermost/src/mattermost/reactions.ts +124 -0
  1849. package/extensions/mattermost/src/mattermost/reconnect.ts +103 -0
  1850. package/extensions/mattermost/src/mattermost/send.ts +231 -0
  1851. package/extensions/mattermost/src/normalize.ts +46 -0
  1852. package/extensions/mattermost/src/onboarding-helpers.ts +1 -0
  1853. package/extensions/mattermost/src/onboarding.ts +182 -0
  1854. package/extensions/mattermost/src/runtime.ts +14 -0
  1855. package/extensions/mattermost/src/types.ts +62 -0
  1856. package/extensions/msteams/CHANGELOG.md +35 -0
  1857. package/extensions/msteams/index.ts +17 -0
  1858. package/extensions/msteams/package.json +32 -0
  1859. package/extensions/msteams/remoteclaw.plugin.json +9 -0
  1860. package/extensions/msteams/src/attachments/download.ts +282 -0
  1861. package/extensions/msteams/src/attachments/graph.ts +354 -0
  1862. package/extensions/msteams/src/attachments/html.ts +90 -0
  1863. package/extensions/msteams/src/attachments/payload.ts +14 -0
  1864. package/extensions/msteams/src/attachments/remote-media.ts +42 -0
  1865. package/extensions/msteams/src/attachments/shared.ts +404 -0
  1866. package/extensions/msteams/src/attachments/types.ts +37 -0
  1867. package/extensions/msteams/src/attachments.ts +18 -0
  1868. package/extensions/msteams/src/channel.ts +464 -0
  1869. package/extensions/msteams/src/conversation-store-fs.ts +165 -0
  1870. package/extensions/msteams/src/conversation-store-memory.ts +47 -0
  1871. package/extensions/msteams/src/conversation-store.ts +41 -0
  1872. package/extensions/msteams/src/directory-live.ts +108 -0
  1873. package/extensions/msteams/src/errors.ts +190 -0
  1874. package/extensions/msteams/src/file-consent-helpers.ts +73 -0
  1875. package/extensions/msteams/src/file-consent.ts +126 -0
  1876. package/extensions/msteams/src/file-lock.ts +1 -0
  1877. package/extensions/msteams/src/graph-chat.ts +53 -0
  1878. package/extensions/msteams/src/graph-upload.ts +452 -0
  1879. package/extensions/msteams/src/graph-users.ts +29 -0
  1880. package/extensions/msteams/src/graph.ts +81 -0
  1881. package/extensions/msteams/src/inbound.ts +48 -0
  1882. package/extensions/msteams/src/index.ts +4 -0
  1883. package/extensions/msteams/src/media-helpers.ts +105 -0
  1884. package/extensions/msteams/src/mentions.ts +114 -0
  1885. package/extensions/msteams/src/messenger.ts +484 -0
  1886. package/extensions/msteams/src/monitor-handler/inbound-media.ts +128 -0
  1887. package/extensions/msteams/src/monitor-handler/message-handler.ts +661 -0
  1888. package/extensions/msteams/src/monitor-handler.ts +162 -0
  1889. package/extensions/msteams/src/monitor-types.ts +5 -0
  1890. package/extensions/msteams/src/monitor.ts +305 -0
  1891. package/extensions/msteams/src/onboarding.ts +406 -0
  1892. package/extensions/msteams/src/outbound.ts +46 -0
  1893. package/extensions/msteams/src/pending-uploads.ts +89 -0
  1894. package/extensions/msteams/src/policy.ts +259 -0
  1895. package/extensions/msteams/src/polls-store-memory.ts +32 -0
  1896. package/extensions/msteams/src/polls.ts +315 -0
  1897. package/extensions/msteams/src/probe.ts +94 -0
  1898. package/extensions/msteams/src/reply-dispatcher.ts +132 -0
  1899. package/extensions/msteams/src/resolve-allowlist.ts +198 -0
  1900. package/extensions/msteams/src/runtime.ts +14 -0
  1901. package/extensions/msteams/src/sdk-types.ts +19 -0
  1902. package/extensions/msteams/src/sdk.ts +33 -0
  1903. package/extensions/msteams/src/send-context.ts +164 -0
  1904. package/extensions/msteams/src/send.ts +530 -0
  1905. package/extensions/msteams/src/sent-message-cache.ts +44 -0
  1906. package/extensions/msteams/src/storage.ts +25 -0
  1907. package/extensions/msteams/src/store-fs.ts +44 -0
  1908. package/extensions/msteams/src/test-runtime.ts +16 -0
  1909. package/extensions/msteams/src/token-response.ts +11 -0
  1910. package/extensions/msteams/src/token.ts +19 -0
  1911. package/extensions/nextcloud-talk/index.ts +17 -0
  1912. package/extensions/nextcloud-talk/package.json +30 -0
  1913. package/extensions/nextcloud-talk/remoteclaw.plugin.json +9 -0
  1914. package/extensions/nextcloud-talk/src/accounts.ts +170 -0
  1915. package/extensions/nextcloud-talk/src/channel.ts +416 -0
  1916. package/extensions/nextcloud-talk/src/config-schema.ts +72 -0
  1917. package/extensions/nextcloud-talk/src/format.ts +79 -0
  1918. package/extensions/nextcloud-talk/src/inbound.ts +342 -0
  1919. package/extensions/nextcloud-talk/src/monitor.ts +275 -0
  1920. package/extensions/nextcloud-talk/src/normalize.ts +39 -0
  1921. package/extensions/nextcloud-talk/src/onboarding.ts +349 -0
  1922. package/extensions/nextcloud-talk/src/policy.ts +180 -0
  1923. package/extensions/nextcloud-talk/src/room-info.ts +125 -0
  1924. package/extensions/nextcloud-talk/src/runtime.ts +14 -0
  1925. package/extensions/nextcloud-talk/src/send.ts +215 -0
  1926. package/extensions/nextcloud-talk/src/signature.ts +72 -0
  1927. package/extensions/nextcloud-talk/src/types.ts +184 -0
  1928. package/extensions/nostr/CHANGELOG.md +44 -0
  1929. package/extensions/nostr/README.md +136 -0
  1930. package/extensions/nostr/index.ts +68 -0
  1931. package/extensions/nostr/node_modules/.bin/tsc +21 -0
  1932. package/extensions/nostr/node_modules/.bin/tsserver +21 -0
  1933. package/extensions/nostr/package.json +30 -0
  1934. package/extensions/nostr/remoteclaw.plugin.json +9 -0
  1935. package/extensions/nostr/src/channel.ts +345 -0
  1936. package/extensions/nostr/src/config-schema.ts +90 -0
  1937. package/extensions/nostr/src/metrics.ts +458 -0
  1938. package/extensions/nostr/src/nostr-bus.ts +719 -0
  1939. package/extensions/nostr/src/nostr-profile-http.ts +519 -0
  1940. package/extensions/nostr/src/nostr-profile-import.ts +262 -0
  1941. package/extensions/nostr/src/nostr-profile.ts +277 -0
  1942. package/extensions/nostr/src/nostr-state-store.ts +226 -0
  1943. package/extensions/nostr/src/runtime.ts +14 -0
  1944. package/extensions/nostr/src/seen-tracker.ts +289 -0
  1945. package/extensions/nostr/src/types.ts +101 -0
  1946. package/extensions/phone-control/index.ts +421 -0
  1947. package/extensions/phone-control/remoteclaw.plugin.json +10 -0
  1948. package/extensions/shared/resolve-target-test-helpers.ts +66 -0
  1949. package/extensions/signal/index.ts +17 -0
  1950. package/extensions/signal/package.json +12 -0
  1951. package/extensions/signal/remoteclaw.plugin.json +9 -0
  1952. package/extensions/signal/src/channel.ts +299 -0
  1953. package/extensions/signal/src/runtime.ts +14 -0
  1954. package/extensions/slack/index.ts +17 -0
  1955. package/extensions/slack/package.json +12 -0
  1956. package/extensions/slack/remoteclaw.plugin.json +9 -0
  1957. package/extensions/slack/src/channel.ts +421 -0
  1958. package/extensions/slack/src/runtime.ts +14 -0
  1959. package/extensions/synology-chat/index.ts +17 -0
  1960. package/extensions/synology-chat/package.json +28 -0
  1961. package/extensions/synology-chat/remoteclaw.plugin.json +9 -0
  1962. package/extensions/synology-chat/src/accounts.ts +87 -0
  1963. package/extensions/synology-chat/src/channel.ts +347 -0
  1964. package/extensions/synology-chat/src/client.ts +142 -0
  1965. package/extensions/synology-chat/src/runtime.ts +20 -0
  1966. package/extensions/synology-chat/src/security.ts +140 -0
  1967. package/extensions/synology-chat/src/types.ts +60 -0
  1968. package/extensions/synology-chat/src/webhook-handler.ts +221 -0
  1969. package/extensions/talk-voice/index.ts +150 -0
  1970. package/extensions/talk-voice/remoteclaw.plugin.json +10 -0
  1971. package/extensions/telegram/index.ts +17 -0
  1972. package/extensions/telegram/package.json +12 -0
  1973. package/extensions/telegram/remoteclaw.plugin.json +9 -0
  1974. package/extensions/telegram/src/channel.ts +569 -0
  1975. package/extensions/telegram/src/runtime.ts +14 -0
  1976. package/extensions/test-utils/runtime-env.ts +12 -0
  1977. package/extensions/thread-ownership/index.ts +133 -0
  1978. package/extensions/thread-ownership/remoteclaw.plugin.json +28 -0
  1979. package/extensions/tlon/README.md +5 -0
  1980. package/extensions/tlon/index.ts +17 -0
  1981. package/extensions/tlon/package.json +29 -0
  1982. package/extensions/tlon/remoteclaw.plugin.json +9 -0
  1983. package/extensions/tlon/src/account-fields.ts +25 -0
  1984. package/extensions/tlon/src/channel.ts +384 -0
  1985. package/extensions/tlon/src/config-schema.ts +41 -0
  1986. package/extensions/tlon/src/monitor/discovery.ts +78 -0
  1987. package/extensions/tlon/src/monitor/history.ts +92 -0
  1988. package/extensions/tlon/src/monitor/index.ts +591 -0
  1989. package/extensions/tlon/src/monitor/processed-messages.ts +33 -0
  1990. package/extensions/tlon/src/monitor/utils.ts +106 -0
  1991. package/extensions/tlon/src/onboarding.ts +229 -0
  1992. package/extensions/tlon/src/runtime.ts +14 -0
  1993. package/extensions/tlon/src/targets.ts +89 -0
  1994. package/extensions/tlon/src/types.ts +99 -0
  1995. package/extensions/tlon/src/urbit/auth.ts +48 -0
  1996. package/extensions/tlon/src/urbit/base-url.ts +57 -0
  1997. package/extensions/tlon/src/urbit/channel-client.ts +158 -0
  1998. package/extensions/tlon/src/urbit/channel-ops.ts +164 -0
  1999. package/extensions/tlon/src/urbit/context.ts +47 -0
  2000. package/extensions/tlon/src/urbit/errors.ts +51 -0
  2001. package/extensions/tlon/src/urbit/fetch.ts +39 -0
  2002. package/extensions/tlon/src/urbit/send.ts +131 -0
  2003. package/extensions/tlon/src/urbit/sse-client.ts +431 -0
  2004. package/extensions/twitch/CHANGELOG.md +39 -0
  2005. package/extensions/twitch/README.md +89 -0
  2006. package/extensions/twitch/index.ts +20 -0
  2007. package/extensions/twitch/package.json +17 -0
  2008. package/extensions/twitch/remoteclaw.plugin.json +9 -0
  2009. package/extensions/twitch/src/access-control.ts +166 -0
  2010. package/extensions/twitch/src/actions.ts +174 -0
  2011. package/extensions/twitch/src/client-manager-registry.ts +115 -0
  2012. package/extensions/twitch/src/config-schema.ts +84 -0
  2013. package/extensions/twitch/src/config.ts +116 -0
  2014. package/extensions/twitch/src/monitor.ts +273 -0
  2015. package/extensions/twitch/src/onboarding.ts +417 -0
  2016. package/extensions/twitch/src/outbound.ts +187 -0
  2017. package/extensions/twitch/src/plugin.ts +274 -0
  2018. package/extensions/twitch/src/probe.ts +119 -0
  2019. package/extensions/twitch/src/resolver.ts +137 -0
  2020. package/extensions/twitch/src/runtime.ts +14 -0
  2021. package/extensions/twitch/src/send.ts +136 -0
  2022. package/extensions/twitch/src/status.ts +179 -0
  2023. package/extensions/twitch/src/test-fixtures.ts +30 -0
  2024. package/extensions/twitch/src/token.ts +94 -0
  2025. package/extensions/twitch/src/twitch-client.ts +277 -0
  2026. package/extensions/twitch/src/types.ts +141 -0
  2027. package/extensions/twitch/src/utils/markdown.ts +98 -0
  2028. package/extensions/twitch/src/utils/twitch.ts +80 -0
  2029. package/extensions/voice-call/CHANGELOG.md +49 -0
  2030. package/extensions/voice-call/README.md +181 -0
  2031. package/extensions/voice-call/index.ts +529 -0
  2032. package/extensions/voice-call/package.json +16 -0
  2033. package/extensions/voice-call/remoteclaw.plugin.json +559 -0
  2034. package/extensions/voice-call/src/allowlist.ts +19 -0
  2035. package/extensions/voice-call/src/cli.ts +380 -0
  2036. package/extensions/voice-call/src/config.ts +477 -0
  2037. package/extensions/voice-call/src/core-bridge.ts +170 -0
  2038. package/extensions/voice-call/src/manager/context.ts +41 -0
  2039. package/extensions/voice-call/src/manager/events.ts +242 -0
  2040. package/extensions/voice-call/src/manager/lookup.ts +35 -0
  2041. package/extensions/voice-call/src/manager/outbound.ts +380 -0
  2042. package/extensions/voice-call/src/manager/state.ts +48 -0
  2043. package/extensions/voice-call/src/manager/store.ts +94 -0
  2044. package/extensions/voice-call/src/manager/timers.ts +112 -0
  2045. package/extensions/voice-call/src/manager/twiml.ts +9 -0
  2046. package/extensions/voice-call/src/manager.ts +209 -0
  2047. package/extensions/voice-call/src/media-stream.ts +527 -0
  2048. package/extensions/voice-call/src/providers/base.ts +67 -0
  2049. package/extensions/voice-call/src/providers/index.ts +10 -0
  2050. package/extensions/voice-call/src/providers/mock.ts +165 -0
  2051. package/extensions/voice-call/src/providers/plivo.ts +560 -0
  2052. package/extensions/voice-call/src/providers/stt-openai-realtime.ts +311 -0
  2053. package/extensions/voice-call/src/providers/telnyx.ts +318 -0
  2054. package/extensions/voice-call/src/providers/tts-openai.ts +259 -0
  2055. package/extensions/voice-call/src/providers/twilio/api.ts +42 -0
  2056. package/extensions/voice-call/src/providers/twilio/webhook.ts +33 -0
  2057. package/extensions/voice-call/src/providers/twilio.ts +688 -0
  2058. package/extensions/voice-call/src/response-generator.ts +174 -0
  2059. package/extensions/voice-call/src/runtime.ts +217 -0
  2060. package/extensions/voice-call/src/telephony-audio.ts +90 -0
  2061. package/extensions/voice-call/src/telephony-tts.ts +106 -0
  2062. package/extensions/voice-call/src/tunnel.ts +314 -0
  2063. package/extensions/voice-call/src/types.ts +280 -0
  2064. package/extensions/voice-call/src/utils.ts +14 -0
  2065. package/extensions/voice-call/src/voice-mapping.ts +67 -0
  2066. package/extensions/voice-call/src/webhook-security.ts +880 -0
  2067. package/extensions/voice-call/src/webhook.ts +556 -0
  2068. package/extensions/whatsapp/index.ts +17 -0
  2069. package/extensions/whatsapp/package.json +12 -0
  2070. package/extensions/whatsapp/remoteclaw.plugin.json +9 -0
  2071. package/extensions/whatsapp/src/channel.ts +459 -0
  2072. package/extensions/whatsapp/src/runtime.ts +14 -0
  2073. package/extensions/zalo/CHANGELOG.md +29 -0
  2074. package/extensions/zalo/README.md +50 -0
  2075. package/extensions/zalo/index.ts +19 -0
  2076. package/extensions/zalo/package.json +32 -0
  2077. package/extensions/zalo/remoteclaw.plugin.json +9 -0
  2078. package/extensions/zalo/src/accounts.ts +82 -0
  2079. package/extensions/zalo/src/actions.ts +56 -0
  2080. package/extensions/zalo/src/api.ts +208 -0
  2081. package/extensions/zalo/src/channel.ts +398 -0
  2082. package/extensions/zalo/src/config-schema.ts +27 -0
  2083. package/extensions/zalo/src/group-access.ts +48 -0
  2084. package/extensions/zalo/src/monitor.ts +675 -0
  2085. package/extensions/zalo/src/monitor.webhook.ts +219 -0
  2086. package/extensions/zalo/src/onboarding.ts +398 -0
  2087. package/extensions/zalo/src/probe.ts +45 -0
  2088. package/extensions/zalo/src/proxy.ts +24 -0
  2089. package/extensions/zalo/src/runtime.ts +14 -0
  2090. package/extensions/zalo/src/send.ts +124 -0
  2091. package/extensions/zalo/src/status-issues.ts +53 -0
  2092. package/extensions/zalo/src/token.ts +62 -0
  2093. package/extensions/zalo/src/types.ts +48 -0
  2094. package/extensions/zalouser/CHANGELOG.md +31 -0
  2095. package/extensions/zalouser/README.md +225 -0
  2096. package/extensions/zalouser/index.ts +31 -0
  2097. package/extensions/zalouser/package.json +32 -0
  2098. package/extensions/zalouser/remoteclaw.plugin.json +9 -0
  2099. package/extensions/zalouser/src/accounts.ts +138 -0
  2100. package/extensions/zalouser/src/channel.ts +652 -0
  2101. package/extensions/zalouser/src/config-schema.ts +28 -0
  2102. package/extensions/zalouser/src/monitor.ts +619 -0
  2103. package/extensions/zalouser/src/onboarding.ts +428 -0
  2104. package/extensions/zalouser/src/probe.ts +27 -0
  2105. package/extensions/zalouser/src/runtime.ts +14 -0
  2106. package/extensions/zalouser/src/send.ts +141 -0
  2107. package/extensions/zalouser/src/status-issues.ts +89 -0
  2108. package/extensions/zalouser/src/tool.ts +166 -0
  2109. package/extensions/zalouser/src/types.ts +105 -0
  2110. package/extensions/zalouser/src/zca.ts +198 -0
  2111. package/package.json +250 -15
  2112. package/remoteclaw.mjs +56 -0
  2113. 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 };