@captain-app/openclaw 2026.2.4

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 (1686) hide show
  1. package/CHANGELOG.md +1528 -0
  2. package/LICENSE +21 -0
  3. package/README-header.png +0 -0
  4. package/README.md +539 -0
  5. package/assets/avatar-placeholder.svg +19 -0
  6. package/assets/chrome-extension/README.md +22 -0
  7. package/assets/chrome-extension/background.js +438 -0
  8. package/assets/chrome-extension/icons/icon128.png +0 -0
  9. package/assets/chrome-extension/icons/icon16.png +0 -0
  10. package/assets/chrome-extension/icons/icon32.png +0 -0
  11. package/assets/chrome-extension/icons/icon48.png +0 -0
  12. package/assets/chrome-extension/manifest.json +25 -0
  13. package/assets/chrome-extension/options.html +196 -0
  14. package/assets/chrome-extension/options.js +59 -0
  15. package/assets/dmg-background-small.png +0 -0
  16. package/assets/dmg-background.png +0 -0
  17. package/dist/accounts-ClnuDahN.js +250 -0
  18. package/dist/accounts-DzBgAM3C.js +251 -0
  19. package/dist/acp-cli-BEDDkzXH.js +926 -0
  20. package/dist/acp-cli-CwV4mdnW.js +923 -0
  21. package/dist/agent-CArjbSeE.js +695 -0
  22. package/dist/agent-CB7x5HLT.js +695 -0
  23. package/dist/agent-scope-BbT4OG2N.js +545 -0
  24. package/dist/agent-scope-C_O6Vpl0.js +545 -0
  25. package/dist/agent-scope-Csu2B6AM.js +606 -0
  26. package/dist/archive-CWrnG1CH.js +85 -0
  27. package/dist/archive-ccN9aDgq.js +85 -0
  28. package/dist/audit-DXPkQ275.js +1686 -0
  29. package/dist/audit-eH7nwgsM.js +1686 -0
  30. package/dist/auth-health-Bj7Gjbv0.js +149 -0
  31. package/dist/auth-health-CjjJhHey.js +149 -0
  32. package/dist/auth-nnRYiqpH.js +192 -0
  33. package/dist/auth-profiles-DVLfuixr.js +2954 -0
  34. package/dist/auth-y1BLPUhX.js +192 -0
  35. package/dist/boolean-Wzu0-e0P.js +30 -0
  36. package/dist/brew-Cqi8b49_.js +46 -0
  37. package/dist/brew-DyBGNK8A.js +46 -0
  38. package/dist/build-info.json +5 -0
  39. package/dist/call-B7EveN4V.js +252 -0
  40. package/dist/call-vuUQIjOj.js +252 -0
  41. package/dist/canvas-host/a2ui/.bundle.hash +1 -0
  42. package/dist/canvas-host/a2ui/a2ui.bundle.js +17780 -0
  43. package/dist/canvas-host/a2ui/index.html +307 -0
  44. package/dist/channel-options-CJfmOkol.js +32 -0
  45. package/dist/channel-options-lFguMTz1.js +62 -0
  46. package/dist/channel-selection-BmND9mWj.js +51 -0
  47. package/dist/channel-selection-cGhL9G0c.js +51 -0
  48. package/dist/channel-summary-B4G513Eb.js +1154 -0
  49. package/dist/channel-summary-MCwBCa5y.js +1154 -0
  50. package/dist/channels-cli-C2Of1mZG.js +1411 -0
  51. package/dist/channels-cli-DFynrP1H.js +1413 -0
  52. package/dist/channels-status-issues-YohTjZ-I.js +18 -0
  53. package/dist/channels-status-issues-ZcR1U-m5.js +18 -0
  54. package/dist/chrome-B3IuUad-.js +1953 -0
  55. package/dist/chrome-BZ9K48w9.js +1973 -0
  56. package/dist/clack-prompter-B9yLhyOm.js +92 -0
  57. package/dist/clack-prompter-BybM9xdL.js +92 -0
  58. package/dist/cli/daemon-cli.js +2 -0
  59. package/dist/cli-BJZdJwug.js +89 -0
  60. package/dist/cli-BQSoKu3d.js +86 -0
  61. package/dist/cli-utils-CO4jEMn0.js +43 -0
  62. package/dist/cli-utils-gtE-0a0D.js +43 -0
  63. package/dist/client-DPqNOpK3.js +1609 -0
  64. package/dist/client-DySXIFCA.js +1609 -0
  65. package/dist/command-format-CFzL448l.js +52 -0
  66. package/dist/command-format-DELazozB.js +52 -0
  67. package/dist/command-format-ayFsmwwz.js +38 -0
  68. package/dist/command-options-CsjxK4cZ.js +33 -0
  69. package/dist/commands-BRe9VTyU.js +229 -0
  70. package/dist/completion-cli-DlkjK0iC.js +390 -0
  71. package/dist/completion-cli-E6Pt41AL.js +387 -0
  72. package/dist/config-BtSTwPcH.js +4882 -0
  73. package/dist/config-DfMIMT-f.js +4881 -0
  74. package/dist/config-_d7_WcRv.js +5623 -0
  75. package/dist/config-guard-wSnm-U8a.js +5628 -0
  76. package/dist/configure-CPHAFKlg.js +895 -0
  77. package/dist/configure-DK1XgXYx.js +894 -0
  78. package/dist/constants-CNTiY-ZN.js +65 -0
  79. package/dist/constants-hpmbslG7.js +65 -0
  80. package/dist/control-service-CqX5g_ko.js +61 -0
  81. package/dist/control-service-o6xe3hEb.js +61 -0
  82. package/dist/control-ui/apple-touch-icon.png +0 -0
  83. package/dist/control-ui/assets/index-RwcW4Xl0.css +1 -0
  84. package/dist/control-ui/assets/index-ryaCcbyp.js +4584 -0
  85. package/dist/control-ui/assets/index-ryaCcbyp.js.map +1 -0
  86. package/dist/control-ui/favicon-32.png +0 -0
  87. package/dist/control-ui/favicon.ico +0 -0
  88. package/dist/control-ui/favicon.svg +22 -0
  89. package/dist/control-ui/index.html +17 -0
  90. package/dist/cron-cli-BoSaDgvH.js +453 -0
  91. package/dist/cron-cli-qVandvsD.js +456 -0
  92. package/dist/daemon-cli-C4gGWa15.js +760 -0
  93. package/dist/daemon-cli-DV_X0Krf.js +761 -0
  94. package/dist/daemon-runtime-D5hbSrdO.js +460 -0
  95. package/dist/daemon-runtime-DXUfrXBC.js +460 -0
  96. package/dist/deliver-BxK5nI2P.js +2587 -0
  97. package/dist/deliver-Dwzg9LUd.js +2557 -0
  98. package/dist/deliver-qpYZp20m.js +2587 -0
  99. package/dist/deps-CUXtMV9d.js +27 -0
  100. package/dist/deps-WBvZpFV_.js +27 -0
  101. package/dist/devices-cli-B2s18Qrh.js +207 -0
  102. package/dist/devices-cli-D1UEtMUJ.js +204 -0
  103. package/dist/directory-cli-BXQbrkfM.js +247 -0
  104. package/dist/directory-cli-CqA7tRbq.js +244 -0
  105. package/dist/dispatcher-Dyv7T-1r.js +160 -0
  106. package/dist/dns-cli-CWxKD22D.js +198 -0
  107. package/dist/dns-cli-CzKr_Fxj.js +201 -0
  108. package/dist/docs-cli-BNyxUbWr.js +159 -0
  109. package/dist/docs-cli-DYpTbo3i.js +161 -0
  110. package/dist/doctor-C8fDYZLq.js +2583 -0
  111. package/dist/doctor-hYcqp7c0.js +2585 -0
  112. package/dist/entry.js +1326 -0
  113. package/dist/env-l7QVNj6j.js +32 -0
  114. package/dist/errors-CMCg46fK.js +1952 -0
  115. package/dist/exec-B8JKbXKW.js +246 -0
  116. package/dist/exec-BMnoMcZW.js +1099 -0
  117. package/dist/exec-HEWTMJ7j.js +246 -0
  118. package/dist/exec-approvals-DtrnHx6M.js +1026 -0
  119. package/dist/exec-approvals-Y42bE8ud.js +1026 -0
  120. package/dist/exec-approvals-cli-CIedYxP3.js +385 -0
  121. package/dist/exec-approvals-cli-xpbxnj4O.js +388 -0
  122. package/dist/extensionAPI.js +66572 -0
  123. package/dist/format-Dzy9uRLE.js +34 -0
  124. package/dist/format-sj0fELBK.js +34 -0
  125. package/dist/gateway-cli-5A-KNLEC.js +16635 -0
  126. package/dist/gateway-cli-B8kS4chb.js +16637 -0
  127. package/dist/gateway-rpc-15n38Ize.js +28 -0
  128. package/dist/gateway-rpc-TMVRgGfj.js +28 -0
  129. package/dist/github-copilot-auth-DVZj4Zgh.js +1104 -0
  130. package/dist/github-copilot-auth-DeGYyLY9.js +1104 -0
  131. package/dist/github-copilot-token-B3SA95yo.js +103 -0
  132. package/dist/github-copilot-token-C8XFYz0i.js +103 -0
  133. package/dist/github-copilot-token-CnxakiSC.js +103 -0
  134. package/dist/gmail-setup-utils-CWPC386a.js +428 -0
  135. package/dist/gmail-setup-utils-eJVB5Ewp.js +428 -0
  136. package/dist/health-format-B0tMTk3C.js +1189 -0
  137. package/dist/health-format-DaURVaUn.js +1188 -0
  138. package/dist/help-format-CEsRHU2f.js +17 -0
  139. package/dist/help-format-GuCWws6r.js +17 -0
  140. package/dist/helpers-BEJ-phFf.js +25 -0
  141. package/dist/helpers-BtbBZVKZ.js +10 -0
  142. package/dist/helpers-C12w9zxf.js +10 -0
  143. package/dist/helpers-CzjGJZmJ.js +25 -0
  144. package/dist/hooks/bundled/boot-md/HOOK.md +19 -0
  145. package/dist/hooks/bundled/command-logger/HOOK.md +122 -0
  146. package/dist/hooks/bundled/session-memory/HOOK.md +109 -0
  147. package/dist/hooks/bundled/soul-evil/HOOK.md +71 -0
  148. package/dist/hooks-cli-BZCMAnW2.js +1058 -0
  149. package/dist/hooks-cli-D0CEFg3P.js +1061 -0
  150. package/dist/hooks-status-Bn7_O8PM.js +443 -0
  151. package/dist/hooks-status-BrWVfIn0.js +443 -0
  152. package/dist/image-BS022pvv.js +1421 -0
  153. package/dist/image-BzJtY34J.js +629 -0
  154. package/dist/image-CBqmIbQQ.js +629 -0
  155. package/dist/index.js +5809 -0
  156. package/dist/installs-BP4K5L33.js +388 -0
  157. package/dist/installs-DOpTt7VZ.js +388 -0
  158. package/dist/is-main-B4o72sqg.js +25 -0
  159. package/dist/is-main-PYGa3tDA.js +25 -0
  160. package/dist/links-B4nk2iDf.js +15 -0
  161. package/dist/links-DwjRqxgR.js +15 -0
  162. package/dist/loader-Cn4EV_pf.js +63690 -0
  163. package/dist/logging-CS3tbYDj.js +15 -0
  164. package/dist/logging-CY-Q5cwf.js +1 -0
  165. package/dist/logging-DhiLkhLw.js +15 -0
  166. package/dist/logging-pqyrk15z.js +1 -0
  167. package/dist/login-qr-CD164Aw1.js +478 -0
  168. package/dist/login-qr-D7Zdgji2.js +478 -0
  169. package/dist/login-qr-YgILJ4VC.js +475 -0
  170. package/dist/logs-cli-BdS0Uv0I.js +227 -0
  171. package/dist/logs-cli-CqSN1GzB.js +230 -0
  172. package/dist/manager-CfGY5zND.js +2870 -0
  173. package/dist/manager-CjuBqFRL.js +2870 -0
  174. package/dist/manager-CoBEAQKm.js +2872 -0
  175. package/dist/manifest-registry-Bwjq9Iev.js +668 -0
  176. package/dist/manifest-registry-D2Yntqcb.js +668 -0
  177. package/dist/message-channel-Cjsiqxok.js +105 -0
  178. package/dist/message-channel-D6v_oPAg.js +105 -0
  179. package/dist/model-selection-Cv5Ox_tY.js +2956 -0
  180. package/dist/model-selection-Dr-5U5-l.js +2708 -0
  181. package/dist/models-cli-B39ckynD.js +2541 -0
  182. package/dist/models-cli-DoiYsBYw.js +2544 -0
  183. package/dist/net-CFCxaipF.js +137 -0
  184. package/dist/net-DKJPqXuW.js +137 -0
  185. package/dist/node-cli-C_FYF-RA.js +1456 -0
  186. package/dist/node-cli-DWPoNsQS.js +1459 -0
  187. package/dist/node-service-DcJREOww.js +67 -0
  188. package/dist/node-service-DuZ9Us9h.js +67 -0
  189. package/dist/nodes-cli-Elo6tlen.js +1210 -0
  190. package/dist/nodes-cli-zqryRUWB.js +1207 -0
  191. package/dist/nodes-screen-C4aCrxie.js +157 -0
  192. package/dist/nodes-screen-D4PSynkR.js +157 -0
  193. package/dist/note-CQhSvgQv.js +73 -0
  194. package/dist/note-_C44YfAQ.js +73 -0
  195. package/dist/onboard-channels-CHBDi-ZA.js +670 -0
  196. package/dist/onboard-channels-DOEKyxaL.js +670 -0
  197. package/dist/onboard-skills-BUTXREDZ.js +3327 -0
  198. package/dist/onboard-skills-CSLYZmZA.js +3327 -0
  199. package/dist/onboarding-CgKb8b39.js +3232 -0
  200. package/dist/openclaw-root-9ILYSmJ9.js +84 -0
  201. package/dist/openclaw-root-Cvotktkd.js +84 -0
  202. package/dist/pairing-cli-B4UGR2at.js +114 -0
  203. package/dist/pairing-cli-BWDDl8cf.js +117 -0
  204. package/dist/pairing-labels-ClZ-fTWT.js +9 -0
  205. package/dist/pairing-labels-Ds7BPOkj.js +9 -0
  206. package/dist/pairing-store-DDLNuzmx.js +391 -0
  207. package/dist/pairing-store-DRn08lZD.js +391 -0
  208. package/dist/parse-87ybtYW1.js +23 -0
  209. package/dist/parse-OCFfznr3.js +23 -0
  210. package/dist/parse-log-line-C9aL5PUL.js +44 -0
  211. package/dist/parse-log-line-DxRaGzQb.js +44 -0
  212. package/dist/parse-timeout-CFqNj7No.js +16 -0
  213. package/dist/parse-timeout-DV8NQQWk.js +16 -0
  214. package/dist/path-env-C7kiJUgG.js +77 -0
  215. package/dist/path-env-DEj4CiFN.js +77 -0
  216. package/dist/paths-B-q1nXdY.js +43 -0
  217. package/dist/paths-B1kfl4h5.js +164 -0
  218. package/dist/paths-B4kigINg.js +40 -0
  219. package/dist/paths-CHGbP1-A.js +43 -0
  220. package/dist/paths-scjhy7N2.js +180 -0
  221. package/dist/pi-embedded-helpers-C19wUpMB.js +8451 -0
  222. package/dist/pi-embedded-helpers-CT5VuLCb.js +1293 -0
  223. package/dist/pi-embedded-helpers-Dl8e5Rf8.js +1293 -0
  224. package/dist/pi-model-discovery-B6CsmK6Y.js +20 -0
  225. package/dist/pi-model-discovery-DsRqYJLy.js +20 -0
  226. package/dist/pi-model-discovery-EhM2JAQo.js +20 -0
  227. package/dist/pi-tools.policy-BvkSDFDN.js +229 -0
  228. package/dist/plugin-auto-enable-Bd_StZzz.js +461 -0
  229. package/dist/plugin-auto-enable-DBhXb_0x.js +461 -0
  230. package/dist/plugin-sdk/agent-scope-DdwUKIOe.js +606 -0
  231. package/dist/plugin-sdk/chrome-G8apFa5p.js +1953 -0
  232. package/dist/plugin-sdk/command-format-qUVxzqYm.js +52 -0
  233. package/dist/plugin-sdk/config-Cm1M7tgH.js +5623 -0
  234. package/dist/plugin-sdk/deliver-Cl8uowiO.js +2557 -0
  235. package/dist/plugin-sdk/exec-Cm9b2r9Q.js +1107 -0
  236. package/dist/plugin-sdk/github-copilot-token-BHNcM4_B.js +103 -0
  237. package/dist/plugin-sdk/image-7PgoS2VD.js +1421 -0
  238. package/dist/plugin-sdk/index.d.ts +8908 -0
  239. package/dist/plugin-sdk/index.js +70888 -0
  240. package/dist/plugin-sdk/login-qr-qTALvWi2.js +475 -0
  241. package/dist/plugin-sdk/manager-Cs3EQZCb.js +2870 -0
  242. package/dist/plugin-sdk/model-selection-BgC1E1a7.js +2708 -0
  243. package/dist/plugin-sdk/paths-BYpoyRv5.js +164 -0
  244. package/dist/plugin-sdk/paths-DNQE-bvr.js +40 -0
  245. package/dist/plugin-sdk/pi-embedded-helpers-5jNqW_dE.js +8755 -0
  246. package/dist/plugin-sdk/pi-model-discovery-BUGEht9A.js +20 -0
  247. package/dist/plugin-sdk/pw-ai-COTtei4a.js +1649 -0
  248. package/dist/plugin-sdk/qmd-manager-ClSwiAJl.js +615 -0
  249. package/dist/plugin-sdk/redact-2AzjOfk2.js +94 -0
  250. package/dist/plugin-sdk/rolldown-runtime-Cbj13DAv.js +20 -0
  251. package/dist/plugin-sdk/sqlite-gCW7MlLs.js +215 -0
  252. package/dist/plugin-sdk/transcript-events-DGF257vD.js +17 -0
  253. package/dist/plugins-C3Bm-HQV.js +494 -0
  254. package/dist/plugins-QJjTXliB.js +495 -0
  255. package/dist/plugins-cli-DTci0JQb.js +443 -0
  256. package/dist/plugins-cli-wJsN1HHK.js +440 -0
  257. package/dist/ports-CiW9dmMq.js +96 -0
  258. package/dist/program-BWpTHh1I.js +188 -0
  259. package/dist/progress-Bcjniu7m.js +133 -0
  260. package/dist/progress-CvaSPjS9.js +133 -0
  261. package/dist/prompt-style-CFsleyxV.js +9 -0
  262. package/dist/prompt-style-DYJdrXyV.js +9 -0
  263. package/dist/prompts-Bt9fwsg2.js +10 -0
  264. package/dist/prompts-CudpZgTI.js +10 -0
  265. package/dist/pw-ai-08F3GD-3.js +1649 -0
  266. package/dist/pw-ai-ZmHxHQnx.js +1651 -0
  267. package/dist/pw-ai-tNPuRNn3.js +1649 -0
  268. package/dist/qmd-manager-2r-4n3sP.js +617 -0
  269. package/dist/qmd-manager-CF52nuBg.js +615 -0
  270. package/dist/qmd-manager-HEm5H2mk.js +616 -0
  271. package/dist/redact-BICFkpn7.js +97 -0
  272. package/dist/redact-BIMJ3ntQ.js +94 -0
  273. package/dist/redact-KzWHRS5J.js +97 -0
  274. package/dist/register.subclis-D2K25c84.js +348 -0
  275. package/dist/register.subclis-Dd8LbOLi.js +342 -0
  276. package/dist/reply-5UNWRwMn.js +63693 -0
  277. package/dist/restart-sentinel-Cr0vUxB8.js +65 -0
  278. package/dist/restart-sentinel-DUemCjgU.js +65 -0
  279. package/dist/rolldown-runtime-Cbj13DAv.js +20 -0
  280. package/dist/routes-C6UpTPas.js +2410 -0
  281. package/dist/routes-ClNyEvlm.js +2410 -0
  282. package/dist/rpc-D0mf7DIw.js +95 -0
  283. package/dist/rpc-DYdOrgd9.js +95 -0
  284. package/dist/run-main-CojI7gWx.js +194 -0
  285. package/dist/runtime-guard-68M_evhb.js +60 -0
  286. package/dist/runtime-guard-DkjmhnBD.js +60 -0
  287. package/dist/sandbox-Ca81z3Tw.js +2924 -0
  288. package/dist/sandbox-cli-D75GApgp.js +459 -0
  289. package/dist/sandbox-cli-E4SJsC1C.js +462 -0
  290. package/dist/sandbox-knontqD9.js +2925 -0
  291. package/dist/security-cli-BLihvXO-.js +503 -0
  292. package/dist/security-cli-IGQCsK4g.js +506 -0
  293. package/dist/server-context-B9GX5GOI.js +740 -0
  294. package/dist/server-context-BFH7HB_M.js +740 -0
  295. package/dist/server-node-events-CTdHBiEA.js +218 -0
  296. package/dist/server-node-events-DAV14qPr.js +215 -0
  297. package/dist/service-BZNBq9hq.js +680 -0
  298. package/dist/service-C-BLXx9U.js +680 -0
  299. package/dist/service-audit-BfJv4NqZ.js +542 -0
  300. package/dist/service-audit-Bw3M2OEI.js +542 -0
  301. package/dist/shared-5SH-45AX.js +74 -0
  302. package/dist/shared-BxRm5uLU.js +74 -0
  303. package/dist/shared-C80Rmxsd.js +150 -0
  304. package/dist/shared-fGK6_D2v.js +150 -0
  305. package/dist/skills-Bhp0l6UK.js +693 -0
  306. package/dist/skills-Tky2kCMO.js +694 -0
  307. package/dist/skills-cli-6rCClAE4.js +287 -0
  308. package/dist/skills-cli-C4nLCrLw.js +290 -0
  309. package/dist/skills-status-CENcKr3I.js +187 -0
  310. package/dist/skills-status-DX1eUYvk.js +187 -0
  311. package/dist/sqlite-CmdZSZRx.js +197 -0
  312. package/dist/sqlite-Dnmf3LS7.js +215 -0
  313. package/dist/sqlite-QDf0yuU0.js +215 -0
  314. package/dist/status-BSfGAp2D.js +27 -0
  315. package/dist/status-Bp_2NMjt.js +27 -0
  316. package/dist/status-C0ANDr0T.js +3140 -0
  317. package/dist/status-CCHBIZnm.js +21 -0
  318. package/dist/status-Vuqbw2Bb.js +21 -0
  319. package/dist/status.update-BZW5r8Su.js +79 -0
  320. package/dist/status.update-BnD93_O8.js +79 -0
  321. package/dist/subsystem-CAq3uyo7.js +834 -0
  322. package/dist/system-cli-Bb9zmCO1.js +83 -0
  323. package/dist/system-cli-TIIQ04ls.js +80 -0
  324. package/dist/systemd-0Qa_nGqe.js +438 -0
  325. package/dist/systemd-Czb0Xsm7.js +438 -0
  326. package/dist/systemd-hints-CWoEOQRb.js +19 -0
  327. package/dist/systemd-hints-Cv3RN_mZ.js +19 -0
  328. package/dist/systemd-linger-CsdvcIoS.js +75 -0
  329. package/dist/systemd-linger-DKUFHcLn.js +75 -0
  330. package/dist/table-DNPESyNj.js +279 -0
  331. package/dist/table-DS4-gmkV.js +279 -0
  332. package/dist/tailnet-Bg_vE5qi.js +42 -0
  333. package/dist/tailnet-CrNWlQRJ.js +42 -0
  334. package/dist/tailscale-CBv58toW.js +252 -0
  335. package/dist/tailscale-DCnMs7_q.js +225 -0
  336. package/dist/tool-display-BEACy9rK.js +795 -0
  337. package/dist/tool-display-NYQnSpdo.js +795 -0
  338. package/dist/transcript-events-CsB1Saa6.js +17 -0
  339. package/dist/transcript-events-DDYvbmRV.js +17 -0
  340. package/dist/transcript-events-JLH5W4He.js +17 -0
  341. package/dist/tui--NY0rnjr.js +2542 -0
  342. package/dist/tui-DqJfGtvM.js +2543 -0
  343. package/dist/tui-cli-BuHNY6wF.js +54 -0
  344. package/dist/tui-cli-LMFV982e.js +57 -0
  345. package/dist/update-CRpHtCgz.js +317 -0
  346. package/dist/update-D3qruxhj.js +317 -0
  347. package/dist/update-cli-CFF-pslM.js +948 -0
  348. package/dist/update-cli-cn9pEMX7.js +951 -0
  349. package/dist/update-runner-CxGU142L.js +1221 -0
  350. package/dist/update-runner-DNobz_ft.js +1221 -0
  351. package/dist/utils-CKSrBNwq.js +192 -0
  352. package/dist/utils-DX85MiPR.js +188 -0
  353. package/dist/webhooks-cli-BGtt2HAR.js +312 -0
  354. package/dist/webhooks-cli-DHLZrEO_.js +309 -0
  355. package/dist/widearea-dns-BpG7ATO8.js +127 -0
  356. package/dist/widearea-dns-D4wkCJly.js +127 -0
  357. package/dist/ws-3zr8WUwL.js +13 -0
  358. package/dist/ws-log-BXcT2xQk.js +267 -0
  359. package/dist/ws-log-DbDIUsgz.js +267 -0
  360. package/dist/ws-lzrgabja.js +13 -0
  361. package/dist/wsl-D2O2qOrl.js +160 -0
  362. package/docs/.i18n/README.md +31 -0
  363. package/docs/.i18n/glossary.zh-CN.json +190 -0
  364. package/docs/.i18n/zh-CN.tm.jsonl +1329 -0
  365. package/docs/CNAME +1 -0
  366. package/docs/_config.yml +53 -0
  367. package/docs/_layouts/default.html +145 -0
  368. package/docs/assets/markdown.css +179 -0
  369. package/docs/assets/openclaw-logo-text-dark.png +0 -0
  370. package/docs/assets/openclaw-logo-text.png +0 -0
  371. package/docs/assets/pixel-lobster.svg +60 -0
  372. package/docs/assets/showcase/agents-ui.jpg +0 -0
  373. package/docs/assets/showcase/bambu-cli.png +0 -0
  374. package/docs/assets/showcase/codexmonitor.png +0 -0
  375. package/docs/assets/showcase/gohome-grafana.png +0 -0
  376. package/docs/assets/showcase/ios-testflight.jpg +0 -0
  377. package/docs/assets/showcase/oura-health.png +0 -0
  378. package/docs/assets/showcase/padel-cli.svg +11 -0
  379. package/docs/assets/showcase/padel-screenshot.jpg +0 -0
  380. package/docs/assets/showcase/papla-tts.jpg +0 -0
  381. package/docs/assets/showcase/pr-review-telegram.jpg +0 -0
  382. package/docs/assets/showcase/roborock-screenshot.jpg +0 -0
  383. package/docs/assets/showcase/roborock-status.svg +13 -0
  384. package/docs/assets/showcase/roof-camera-sky.jpg +0 -0
  385. package/docs/assets/showcase/snag.png +0 -0
  386. package/docs/assets/showcase/tesco-shop.jpg +0 -0
  387. package/docs/assets/showcase/wienerlinien.png +0 -0
  388. package/docs/assets/showcase/wine-cellar-skill.jpg +0 -0
  389. package/docs/assets/showcase/winix-air-purifier.jpg +0 -0
  390. package/docs/assets/showcase/xuezh-pronunciation.jpeg +0 -0
  391. package/docs/assets/terminal.css +473 -0
  392. package/docs/assets/theme.js +55 -0
  393. package/docs/automation/auth-monitoring.md +44 -0
  394. package/docs/automation/cron-jobs.md +468 -0
  395. package/docs/automation/cron-vs-heartbeat.md +282 -0
  396. package/docs/automation/gmail-pubsub.md +256 -0
  397. package/docs/automation/poll.md +69 -0
  398. package/docs/automation/webhook.md +163 -0
  399. package/docs/bedrock.md +176 -0
  400. package/docs/brave-search.md +41 -0
  401. package/docs/broadcast-groups.md +442 -0
  402. package/docs/channels/bluebubbles.md +338 -0
  403. package/docs/channels/discord.md +475 -0
  404. package/docs/channels/feishu.md +507 -0
  405. package/docs/channels/googlechat.md +250 -0
  406. package/docs/channels/grammy.md +31 -0
  407. package/docs/channels/imessage.md +299 -0
  408. package/docs/channels/index.md +46 -0
  409. package/docs/channels/line.md +186 -0
  410. package/docs/channels/location.md +56 -0
  411. package/docs/channels/matrix.md +233 -0
  412. package/docs/channels/mattermost.md +138 -0
  413. package/docs/channels/msteams.md +768 -0
  414. package/docs/channels/nextcloud-talk.md +136 -0
  415. package/docs/channels/nostr.md +233 -0
  416. package/docs/channels/signal.md +202 -0
  417. package/docs/channels/slack.md +548 -0
  418. package/docs/channels/telegram.md +750 -0
  419. package/docs/channels/tlon.md +132 -0
  420. package/docs/channels/troubleshooting.md +29 -0
  421. package/docs/channels/twitch.md +379 -0
  422. package/docs/channels/whatsapp.md +404 -0
  423. package/docs/channels/zalo.md +189 -0
  424. package/docs/channels/zalouser.md +140 -0
  425. package/docs/cli/acp.md +170 -0
  426. package/docs/cli/agent.md +24 -0
  427. package/docs/cli/agents.md +75 -0
  428. package/docs/cli/approvals.md +50 -0
  429. package/docs/cli/browser.md +107 -0
  430. package/docs/cli/channels.md +79 -0
  431. package/docs/cli/config.md +50 -0
  432. package/docs/cli/configure.md +33 -0
  433. package/docs/cli/cron.md +42 -0
  434. package/docs/cli/dashboard.md +16 -0
  435. package/docs/cli/devices.md +67 -0
  436. package/docs/cli/directory.md +63 -0
  437. package/docs/cli/dns.md +23 -0
  438. package/docs/cli/docs.md +15 -0
  439. package/docs/cli/doctor.md +41 -0
  440. package/docs/cli/gateway.md +199 -0
  441. package/docs/cli/health.md +21 -0
  442. package/docs/cli/hooks.md +304 -0
  443. package/docs/cli/index.md +1029 -0
  444. package/docs/cli/logs.md +24 -0
  445. package/docs/cli/memory.md +45 -0
  446. package/docs/cli/message.md +239 -0
  447. package/docs/cli/models.md +79 -0
  448. package/docs/cli/node.md +112 -0
  449. package/docs/cli/nodes.md +73 -0
  450. package/docs/cli/onboard.md +29 -0
  451. package/docs/cli/pairing.md +21 -0
  452. package/docs/cli/plugins.md +62 -0
  453. package/docs/cli/reset.md +17 -0
  454. package/docs/cli/sandbox.md +152 -0
  455. package/docs/cli/security.md +26 -0
  456. package/docs/cli/sessions.md +16 -0
  457. package/docs/cli/setup.md +29 -0
  458. package/docs/cli/skills.md +26 -0
  459. package/docs/cli/status.md +26 -0
  460. package/docs/cli/system.md +60 -0
  461. package/docs/cli/tui.md +23 -0
  462. package/docs/cli/uninstall.md +17 -0
  463. package/docs/cli/update.md +98 -0
  464. package/docs/cli/voicecall.md +34 -0
  465. package/docs/cli/webhooks.md +25 -0
  466. package/docs/concepts/agent-loop.md +146 -0
  467. package/docs/concepts/agent-workspace.md +233 -0
  468. package/docs/concepts/agent.md +123 -0
  469. package/docs/concepts/architecture.md +129 -0
  470. package/docs/concepts/channel-routing.md +114 -0
  471. package/docs/concepts/compaction.md +61 -0
  472. package/docs/concepts/context.md +161 -0
  473. package/docs/concepts/group-messages.md +84 -0
  474. package/docs/concepts/groups.md +373 -0
  475. package/docs/concepts/markdown-formatting.md +130 -0
  476. package/docs/concepts/memory.md +546 -0
  477. package/docs/concepts/messages.md +154 -0
  478. package/docs/concepts/model-failover.md +149 -0
  479. package/docs/concepts/model-providers.md +316 -0
  480. package/docs/concepts/models.md +208 -0
  481. package/docs/concepts/multi-agent.md +376 -0
  482. package/docs/concepts/oauth.md +145 -0
  483. package/docs/concepts/presence.md +102 -0
  484. package/docs/concepts/queue.md +89 -0
  485. package/docs/concepts/retry.md +69 -0
  486. package/docs/concepts/session-pruning.md +122 -0
  487. package/docs/concepts/session-tool.md +193 -0
  488. package/docs/concepts/session.md +188 -0
  489. package/docs/concepts/sessions.md +10 -0
  490. package/docs/concepts/streaming.md +135 -0
  491. package/docs/concepts/system-prompt.md +115 -0
  492. package/docs/concepts/timezone.md +91 -0
  493. package/docs/concepts/typebox.md +289 -0
  494. package/docs/concepts/typing-indicators.md +68 -0
  495. package/docs/concepts/usage-tracking.md +35 -0
  496. package/docs/date-time.md +128 -0
  497. package/docs/debug/node-issue.md +83 -0
  498. package/docs/debugging.md +162 -0
  499. package/docs/diagnostics/flags.md +91 -0
  500. package/docs/docs.json +1587 -0
  501. package/docs/environment.md +81 -0
  502. package/docs/experiments/onboarding-config-protocol.md +40 -0
  503. package/docs/experiments/plans/cron-add-hardening.md +63 -0
  504. package/docs/experiments/plans/group-policy-hardening.md +40 -0
  505. package/docs/experiments/plans/openresponses-gateway.md +123 -0
  506. package/docs/experiments/proposals/model-config.md +36 -0
  507. package/docs/experiments/research/memory.md +228 -0
  508. package/docs/gateway/authentication.md +145 -0
  509. package/docs/gateway/background-process.md +93 -0
  510. package/docs/gateway/bonjour.md +167 -0
  511. package/docs/gateway/bridge-protocol.md +89 -0
  512. package/docs/gateway/cli-backends.md +223 -0
  513. package/docs/gateway/configuration-examples.md +606 -0
  514. package/docs/gateway/configuration.md +3393 -0
  515. package/docs/gateway/discovery.md +116 -0
  516. package/docs/gateway/doctor.md +282 -0
  517. package/docs/gateway/gateway-lock.md +34 -0
  518. package/docs/gateway/health.md +35 -0
  519. package/docs/gateway/heartbeat.md +302 -0
  520. package/docs/gateway/index.md +328 -0
  521. package/docs/gateway/local-models.md +150 -0
  522. package/docs/gateway/logging.md +113 -0
  523. package/docs/gateway/multiple-gateways.md +112 -0
  524. package/docs/gateway/openai-http-api.md +118 -0
  525. package/docs/gateway/openresponses-http-api.md +317 -0
  526. package/docs/gateway/pairing.md +99 -0
  527. package/docs/gateway/protocol.md +221 -0
  528. package/docs/gateway/remote-gateway-readme.md +157 -0
  529. package/docs/gateway/remote.md +127 -0
  530. package/docs/gateway/sandbox-vs-tool-policy-vs-elevated.md +128 -0
  531. package/docs/gateway/sandboxing.md +193 -0
  532. package/docs/gateway/security/formal-verification.md +164 -0
  533. package/docs/gateway/security/index.md +825 -0
  534. package/docs/gateway/tailscale.md +127 -0
  535. package/docs/gateway/tools-invoke-http-api.md +85 -0
  536. package/docs/gateway/troubleshooting.md +767 -0
  537. package/docs/help/faq.md +2830 -0
  538. package/docs/help/index.md +21 -0
  539. package/docs/help/troubleshooting.md +98 -0
  540. package/docs/hooks/soul-evil.md +69 -0
  541. package/docs/hooks.md +913 -0
  542. package/docs/images/feishu-step2-create-app.png +0 -0
  543. package/docs/images/feishu-step3-credentials.png +0 -0
  544. package/docs/images/feishu-step4-permissions.png +0 -0
  545. package/docs/images/feishu-step5-bot-capability.png +0 -0
  546. package/docs/images/feishu-step6-event-subscription.png +0 -0
  547. package/docs/images/groups-flow.svg +52 -0
  548. package/docs/images/mobile-ui-screenshot.png +0 -0
  549. package/docs/index.md +258 -0
  550. package/docs/install/ansible.md +208 -0
  551. package/docs/install/bun.md +59 -0
  552. package/docs/install/development-channels.md +75 -0
  553. package/docs/install/docker.md +567 -0
  554. package/docs/install/index.md +185 -0
  555. package/docs/install/installer.md +123 -0
  556. package/docs/install/migrating.md +192 -0
  557. package/docs/install/nix.md +96 -0
  558. package/docs/install/node.md +78 -0
  559. package/docs/install/uninstall.md +128 -0
  560. package/docs/install/updating.md +228 -0
  561. package/docs/logging.md +350 -0
  562. package/docs/multi-agent-sandbox-tools.md +395 -0
  563. package/docs/network.md +54 -0
  564. package/docs/nodes/audio.md +114 -0
  565. package/docs/nodes/camera.md +156 -0
  566. package/docs/nodes/images.md +72 -0
  567. package/docs/nodes/index.md +341 -0
  568. package/docs/nodes/location-command.md +113 -0
  569. package/docs/nodes/media-understanding.md +379 -0
  570. package/docs/nodes/talk.md +90 -0
  571. package/docs/nodes/voicewake.md +65 -0
  572. package/docs/northflank.mdx +53 -0
  573. package/docs/perplexity.md +80 -0
  574. package/docs/pi-dev.md +70 -0
  575. package/docs/pi.md +612 -0
  576. package/docs/platforms/android.md +148 -0
  577. package/docs/platforms/digitalocean.md +262 -0
  578. package/docs/platforms/exe-dev.md +125 -0
  579. package/docs/platforms/fly.md +486 -0
  580. package/docs/platforms/gcp.md +503 -0
  581. package/docs/platforms/hetzner.md +330 -0
  582. package/docs/platforms/index.md +53 -0
  583. package/docs/platforms/ios.md +107 -0
  584. package/docs/platforms/linux.md +94 -0
  585. package/docs/platforms/mac/bundled-gateway.md +73 -0
  586. package/docs/platforms/mac/canvas.md +125 -0
  587. package/docs/platforms/mac/child-process.md +69 -0
  588. package/docs/platforms/mac/dev-setup.md +102 -0
  589. package/docs/platforms/mac/health.md +34 -0
  590. package/docs/platforms/mac/icon.md +31 -0
  591. package/docs/platforms/mac/logging.md +57 -0
  592. package/docs/platforms/mac/menu-bar.md +81 -0
  593. package/docs/platforms/mac/peekaboo.md +65 -0
  594. package/docs/platforms/mac/permissions.md +44 -0
  595. package/docs/platforms/mac/release.md +85 -0
  596. package/docs/platforms/mac/remote.md +83 -0
  597. package/docs/platforms/mac/signing.md +47 -0
  598. package/docs/platforms/mac/skills.md +33 -0
  599. package/docs/platforms/mac/voice-overlay.md +60 -0
  600. package/docs/platforms/mac/voicewake.md +67 -0
  601. package/docs/platforms/mac/webchat.md +41 -0
  602. package/docs/platforms/mac/xpc.md +61 -0
  603. package/docs/platforms/macos-vm.md +281 -0
  604. package/docs/platforms/macos.md +203 -0
  605. package/docs/platforms/oracle.md +303 -0
  606. package/docs/platforms/raspberry-pi.md +358 -0
  607. package/docs/platforms/windows.md +159 -0
  608. package/docs/plugin.md +664 -0
  609. package/docs/plugins/agent-tools.md +99 -0
  610. package/docs/plugins/manifest.md +71 -0
  611. package/docs/plugins/voice-call.md +284 -0
  612. package/docs/plugins/zalouser.md +81 -0
  613. package/docs/prose.md +134 -0
  614. package/docs/providers/anthropic.md +152 -0
  615. package/docs/providers/claude-max-api-proxy.md +148 -0
  616. package/docs/providers/cloudflare-ai-gateway.md +71 -0
  617. package/docs/providers/deepgram.md +93 -0
  618. package/docs/providers/github-copilot.md +72 -0
  619. package/docs/providers/glm.md +33 -0
  620. package/docs/providers/index.md +63 -0
  621. package/docs/providers/minimax.md +208 -0
  622. package/docs/providers/models.md +51 -0
  623. package/docs/providers/moonshot.md +142 -0
  624. package/docs/providers/ollama.md +223 -0
  625. package/docs/providers/openai.md +62 -0
  626. package/docs/providers/opencode.md +36 -0
  627. package/docs/providers/openrouter.md +37 -0
  628. package/docs/providers/qwen.md +53 -0
  629. package/docs/providers/synthetic.md +99 -0
  630. package/docs/providers/venice.md +267 -0
  631. package/docs/providers/vercel-ai-gateway.md +50 -0
  632. package/docs/providers/xiaomi.md +64 -0
  633. package/docs/providers/zai.md +36 -0
  634. package/docs/railway.mdx +99 -0
  635. package/docs/refactor/clawnet.md +417 -0
  636. package/docs/refactor/exec-host.md +316 -0
  637. package/docs/refactor/outbound-session-mirroring.md +85 -0
  638. package/docs/refactor/plugin-sdk.md +214 -0
  639. package/docs/refactor/strict-config.md +93 -0
  640. package/docs/reference/AGENTS.default.md +124 -0
  641. package/docs/reference/RELEASING.md +120 -0
  642. package/docs/reference/api-usage-costs.md +137 -0
  643. package/docs/reference/device-models.md +47 -0
  644. package/docs/reference/rpc.md +43 -0
  645. package/docs/reference/session-management-compaction.md +285 -0
  646. package/docs/reference/templates/AGENTS.dev.md +83 -0
  647. package/docs/reference/templates/AGENTS.md +218 -0
  648. package/docs/reference/templates/BOOT.md +10 -0
  649. package/docs/reference/templates/BOOTSTRAP.md +61 -0
  650. package/docs/reference/templates/HEARTBEAT.md +11 -0
  651. package/docs/reference/templates/IDENTITY.dev.md +47 -0
  652. package/docs/reference/templates/IDENTITY.md +27 -0
  653. package/docs/reference/templates/SOUL.dev.md +76 -0
  654. package/docs/reference/templates/SOUL.md +42 -0
  655. package/docs/reference/templates/TOOLS.dev.md +24 -0
  656. package/docs/reference/templates/TOOLS.md +46 -0
  657. package/docs/reference/templates/USER.dev.md +18 -0
  658. package/docs/reference/templates/USER.md +22 -0
  659. package/docs/reference/test.md +50 -0
  660. package/docs/reference/transcript-hygiene.md +129 -0
  661. package/docs/render.mdx +165 -0
  662. package/docs/scripts.md +28 -0
  663. package/docs/security/formal-verification.md +164 -0
  664. package/docs/start/getting-started.md +208 -0
  665. package/docs/start/hubs.md +185 -0
  666. package/docs/start/lore.md +219 -0
  667. package/docs/start/onboarding.md +110 -0
  668. package/docs/start/openclaw.md +241 -0
  669. package/docs/start/pairing.md +86 -0
  670. package/docs/start/setup.md +149 -0
  671. package/docs/start/showcase.md +416 -0
  672. package/docs/start/wizard.md +349 -0
  673. package/docs/testing.md +368 -0
  674. package/docs/token-use.md +112 -0
  675. package/docs/tools/agent-send.md +53 -0
  676. package/docs/tools/apply-patch.md +50 -0
  677. package/docs/tools/browser-linux-troubleshooting.md +139 -0
  678. package/docs/tools/browser-login.md +68 -0
  679. package/docs/tools/browser.md +576 -0
  680. package/docs/tools/chrome-extension.md +178 -0
  681. package/docs/tools/clawhub.md +257 -0
  682. package/docs/tools/creating-skills.md +54 -0
  683. package/docs/tools/elevated.md +57 -0
  684. package/docs/tools/exec-approvals.md +246 -0
  685. package/docs/tools/exec.md +179 -0
  686. package/docs/tools/firecrawl.md +61 -0
  687. package/docs/tools/index.md +509 -0
  688. package/docs/tools/llm-task.md +115 -0
  689. package/docs/tools/lobster.md +342 -0
  690. package/docs/tools/reactions.md +22 -0
  691. package/docs/tools/skills-config.md +76 -0
  692. package/docs/tools/skills.md +300 -0
  693. package/docs/tools/slash-commands.md +198 -0
  694. package/docs/tools/subagents.md +151 -0
  695. package/docs/tools/thinking.md +73 -0
  696. package/docs/tools/web.md +261 -0
  697. package/docs/tts.md +396 -0
  698. package/docs/tui.md +159 -0
  699. package/docs/vps.md +43 -0
  700. package/docs/web/control-ui.md +221 -0
  701. package/docs/web/dashboard.md +46 -0
  702. package/docs/web/index.md +116 -0
  703. package/docs/web/webchat.md +49 -0
  704. package/docs/whatsapp-openclaw-ai-zh.jpg +0 -0
  705. package/docs/whatsapp-openclaw.jpg +0 -0
  706. package/docs/zh-CN/AGENTS.md +59 -0
  707. package/docs/zh-CN/automation/auth-monitoring.md +47 -0
  708. package/docs/zh-CN/automation/cron-jobs.md +424 -0
  709. package/docs/zh-CN/automation/cron-vs-heartbeat.md +286 -0
  710. package/docs/zh-CN/automation/gmail-pubsub.md +249 -0
  711. package/docs/zh-CN/automation/poll.md +76 -0
  712. package/docs/zh-CN/automation/webhook.md +163 -0
  713. package/docs/zh-CN/bedrock.md +170 -0
  714. package/docs/zh-CN/brave-search.md +48 -0
  715. package/docs/zh-CN/broadcast-groups.md +449 -0
  716. package/docs/zh-CN/channels/bluebubbles.md +271 -0
  717. package/docs/zh-CN/channels/discord.md +468 -0
  718. package/docs/zh-CN/channels/feishu.md +513 -0
  719. package/docs/zh-CN/channels/googlechat.md +257 -0
  720. package/docs/zh-CN/channels/grammy.md +38 -0
  721. package/docs/zh-CN/channels/imessage.md +302 -0
  722. package/docs/zh-CN/channels/index.md +53 -0
  723. package/docs/zh-CN/channels/line.md +180 -0
  724. package/docs/zh-CN/channels/location.md +63 -0
  725. package/docs/zh-CN/channels/matrix.md +221 -0
  726. package/docs/zh-CN/channels/mattermost.md +144 -0
  727. package/docs/zh-CN/channels/msteams.md +775 -0
  728. package/docs/zh-CN/channels/nextcloud-talk.md +142 -0
  729. package/docs/zh-CN/channels/nostr.md +240 -0
  730. package/docs/zh-CN/channels/signal.md +209 -0
  731. package/docs/zh-CN/channels/slack.md +531 -0
  732. package/docs/zh-CN/channels/telegram.md +751 -0
  733. package/docs/zh-CN/channels/tlon.md +136 -0
  734. package/docs/zh-CN/channels/troubleshooting.md +36 -0
  735. package/docs/zh-CN/channels/twitch.md +385 -0
  736. package/docs/zh-CN/channels/whatsapp.md +411 -0
  737. package/docs/zh-CN/channels/zalo.md +196 -0
  738. package/docs/zh-CN/channels/zalouser.md +147 -0
  739. package/docs/zh-CN/cli/acp.md +173 -0
  740. package/docs/zh-CN/cli/agent.md +30 -0
  741. package/docs/zh-CN/cli/agents.md +82 -0
  742. package/docs/zh-CN/cli/approvals.md +57 -0
  743. package/docs/zh-CN/cli/browser.md +114 -0
  744. package/docs/zh-CN/cli/channels.md +86 -0
  745. package/docs/zh-CN/cli/config.md +57 -0
  746. package/docs/zh-CN/cli/configure.md +38 -0
  747. package/docs/zh-CN/cli/cron.md +43 -0
  748. package/docs/zh-CN/cli/dashboard.md +23 -0
  749. package/docs/zh-CN/cli/devices.md +74 -0
  750. package/docs/zh-CN/cli/directory.md +70 -0
  751. package/docs/zh-CN/cli/dns.md +30 -0
  752. package/docs/zh-CN/cli/docs.md +22 -0
  753. package/docs/zh-CN/cli/doctor.md +48 -0
  754. package/docs/zh-CN/cli/gateway.md +206 -0
  755. package/docs/zh-CN/cli/health.md +28 -0
  756. package/docs/zh-CN/cli/hooks.md +311 -0
  757. package/docs/zh-CN/cli/index.md +1032 -0
  758. package/docs/zh-CN/cli/logs.md +31 -0
  759. package/docs/zh-CN/cli/memory.md +52 -0
  760. package/docs/zh-CN/cli/message.md +246 -0
  761. package/docs/zh-CN/cli/models.md +85 -0
  762. package/docs/zh-CN/cli/node.md +115 -0
  763. package/docs/zh-CN/cli/nodes.md +80 -0
  764. package/docs/zh-CN/cli/onboard.md +36 -0
  765. package/docs/zh-CN/cli/pairing.md +28 -0
  766. package/docs/zh-CN/cli/plugins.md +66 -0
  767. package/docs/zh-CN/cli/reset.md +24 -0
  768. package/docs/zh-CN/cli/sandbox.md +158 -0
  769. package/docs/zh-CN/cli/security.md +33 -0
  770. package/docs/zh-CN/cli/sessions.md +23 -0
  771. package/docs/zh-CN/cli/setup.md +36 -0
  772. package/docs/zh-CN/cli/skills.md +33 -0
  773. package/docs/zh-CN/cli/status.md +33 -0
  774. package/docs/zh-CN/cli/system.md +63 -0
  775. package/docs/zh-CN/cli/tui.md +30 -0
  776. package/docs/zh-CN/cli/uninstall.md +24 -0
  777. package/docs/zh-CN/cli/update.md +101 -0
  778. package/docs/zh-CN/cli/voicecall.md +41 -0
  779. package/docs/zh-CN/cli/webhooks.md +32 -0
  780. package/docs/zh-CN/concepts/agent-loop.md +146 -0
  781. package/docs/zh-CN/concepts/agent-workspace.md +219 -0
  782. package/docs/zh-CN/concepts/agent.md +115 -0
  783. package/docs/zh-CN/concepts/architecture.md +123 -0
  784. package/docs/zh-CN/concepts/channel-routing.md +117 -0
  785. package/docs/zh-CN/concepts/compaction.md +67 -0
  786. package/docs/zh-CN/concepts/context.md +168 -0
  787. package/docs/zh-CN/concepts/group-messages.md +91 -0
  788. package/docs/zh-CN/concepts/groups.md +379 -0
  789. package/docs/zh-CN/concepts/markdown-formatting.md +117 -0
  790. package/docs/zh-CN/concepts/memory.md +412 -0
  791. package/docs/zh-CN/concepts/messages.md +141 -0
  792. package/docs/zh-CN/concepts/model-failover.md +145 -0
  793. package/docs/zh-CN/concepts/model-providers.md +320 -0
  794. package/docs/zh-CN/concepts/models.md +196 -0
  795. package/docs/zh-CN/concepts/multi-agent.md +372 -0
  796. package/docs/zh-CN/concepts/oauth.md +151 -0
  797. package/docs/zh-CN/concepts/presence.md +99 -0
  798. package/docs/zh-CN/concepts/queue.md +94 -0
  799. package/docs/zh-CN/concepts/retry.md +76 -0
  800. package/docs/zh-CN/concepts/session-pruning.md +129 -0
  801. package/docs/zh-CN/concepts/session-tool.md +200 -0
  802. package/docs/zh-CN/concepts/session.md +166 -0
  803. package/docs/zh-CN/concepts/sessions.md +17 -0
  804. package/docs/zh-CN/concepts/streaming.md +133 -0
  805. package/docs/zh-CN/concepts/system-prompt.md +101 -0
  806. package/docs/zh-CN/concepts/timezone.md +96 -0
  807. package/docs/zh-CN/concepts/typebox.md +284 -0
  808. package/docs/zh-CN/concepts/typing-indicators.md +74 -0
  809. package/docs/zh-CN/concepts/usage-tracking.md +42 -0
  810. package/docs/zh-CN/date-time.md +129 -0
  811. package/docs/zh-CN/debug/node-issue.md +90 -0
  812. package/docs/zh-CN/debugging.md +160 -0
  813. package/docs/zh-CN/diagnostics/flags.md +98 -0
  814. package/docs/zh-CN/environment.md +88 -0
  815. package/docs/zh-CN/experiments/onboarding-config-protocol.md +47 -0
  816. package/docs/zh-CN/experiments/plans/cron-add-hardening.md +70 -0
  817. package/docs/zh-CN/experiments/plans/group-policy-hardening.md +45 -0
  818. package/docs/zh-CN/experiments/plans/openresponses-gateway.md +121 -0
  819. package/docs/zh-CN/experiments/proposals/model-config.md +42 -0
  820. package/docs/zh-CN/experiments/research/memory.md +235 -0
  821. package/docs/zh-CN/gateway/authentication.md +142 -0
  822. package/docs/zh-CN/gateway/background-process.md +100 -0
  823. package/docs/zh-CN/gateway/bonjour.md +174 -0
  824. package/docs/zh-CN/gateway/bridge-protocol.md +86 -0
  825. package/docs/zh-CN/gateway/cli-backends.md +213 -0
  826. package/docs/zh-CN/gateway/configuration-examples.md +587 -0
  827. package/docs/zh-CN/gateway/configuration.md +3332 -0
  828. package/docs/zh-CN/gateway/discovery.md +123 -0
  829. package/docs/zh-CN/gateway/doctor.md +238 -0
  830. package/docs/zh-CN/gateway/gateway-lock.md +41 -0
  831. package/docs/zh-CN/gateway/health.md +42 -0
  832. package/docs/zh-CN/gateway/heartbeat.md +274 -0
  833. package/docs/zh-CN/gateway/index.md +335 -0
  834. package/docs/zh-CN/gateway/local-models.md +157 -0
  835. package/docs/zh-CN/gateway/logging.md +114 -0
  836. package/docs/zh-CN/gateway/multiple-gateways.md +119 -0
  837. package/docs/zh-CN/gateway/openai-http-api.md +125 -0
  838. package/docs/zh-CN/gateway/openresponses-http-api.md +317 -0
  839. package/docs/zh-CN/gateway/pairing.md +99 -0
  840. package/docs/zh-CN/gateway/protocol.md +220 -0
  841. package/docs/zh-CN/gateway/remote-gateway-readme.md +164 -0
  842. package/docs/zh-CN/gateway/remote.md +133 -0
  843. package/docs/zh-CN/gateway/sandbox-vs-tool-policy-vs-elevated.md +135 -0
  844. package/docs/zh-CN/gateway/sandboxing.md +188 -0
  845. package/docs/zh-CN/gateway/security/formal-verification.md +169 -0
  846. package/docs/zh-CN/gateway/security/index.md +777 -0
  847. package/docs/zh-CN/gateway/tailscale.md +124 -0
  848. package/docs/zh-CN/gateway/tools-invoke-http-api.md +92 -0
  849. package/docs/zh-CN/gateway/troubleshooting.md +771 -0
  850. package/docs/zh-CN/help/faq.md +2628 -0
  851. package/docs/zh-CN/help/index.md +28 -0
  852. package/docs/zh-CN/help/troubleshooting.md +104 -0
  853. package/docs/zh-CN/hooks/soul-evil.md +72 -0
  854. package/docs/zh-CN/hooks.md +919 -0
  855. package/docs/zh-CN/index.md +264 -0
  856. package/docs/zh-CN/install/ansible.md +215 -0
  857. package/docs/zh-CN/install/bun.md +65 -0
  858. package/docs/zh-CN/install/development-channels.md +81 -0
  859. package/docs/zh-CN/install/docker.md +532 -0
  860. package/docs/zh-CN/install/index.md +193 -0
  861. package/docs/zh-CN/install/installer.md +128 -0
  862. package/docs/zh-CN/install/migrating.md +199 -0
  863. package/docs/zh-CN/install/nix.md +99 -0
  864. package/docs/zh-CN/install/node.md +85 -0
  865. package/docs/zh-CN/install/uninstall.md +135 -0
  866. package/docs/zh-CN/install/updating.md +233 -0
  867. package/docs/zh-CN/logging.md +329 -0
  868. package/docs/zh-CN/multi-agent-sandbox-tools.md +401 -0
  869. package/docs/zh-CN/network.md +59 -0
  870. package/docs/zh-CN/nodes/audio.md +120 -0
  871. package/docs/zh-CN/nodes/camera.md +162 -0
  872. package/docs/zh-CN/nodes/images.md +79 -0
  873. package/docs/zh-CN/nodes/index.md +348 -0
  874. package/docs/zh-CN/nodes/location-command.md +120 -0
  875. package/docs/zh-CN/nodes/media-understanding.md +380 -0
  876. package/docs/zh-CN/nodes/talk.md +97 -0
  877. package/docs/zh-CN/nodes/voicewake.md +72 -0
  878. package/docs/zh-CN/northflank.mdx +60 -0
  879. package/docs/zh-CN/perplexity.md +84 -0
  880. package/docs/zh-CN/pi-dev.md +77 -0
  881. package/docs/zh-CN/pi.md +619 -0
  882. package/docs/zh-CN/platforms/android.md +155 -0
  883. package/docs/zh-CN/platforms/digitalocean.md +269 -0
  884. package/docs/zh-CN/platforms/exe-dev.md +127 -0
  885. package/docs/zh-CN/platforms/fly.md +490 -0
  886. package/docs/zh-CN/platforms/gcp.md +510 -0
  887. package/docs/zh-CN/platforms/hetzner.md +337 -0
  888. package/docs/zh-CN/platforms/index.md +60 -0
  889. package/docs/zh-CN/platforms/ios.md +114 -0
  890. package/docs/zh-CN/platforms/linux.md +101 -0
  891. package/docs/zh-CN/platforms/mac/bundled-gateway.md +75 -0
  892. package/docs/zh-CN/platforms/mac/canvas.md +128 -0
  893. package/docs/zh-CN/platforms/mac/child-process.md +73 -0
  894. package/docs/zh-CN/platforms/mac/dev-setup.md +109 -0
  895. package/docs/zh-CN/platforms/mac/health.md +41 -0
  896. package/docs/zh-CN/platforms/mac/icon.md +38 -0
  897. package/docs/zh-CN/platforms/mac/logging.md +64 -0
  898. package/docs/zh-CN/platforms/mac/menu-bar.md +88 -0
  899. package/docs/zh-CN/platforms/mac/peekaboo.md +62 -0
  900. package/docs/zh-CN/platforms/mac/permissions.md +46 -0
  901. package/docs/zh-CN/platforms/mac/release.md +92 -0
  902. package/docs/zh-CN/platforms/mac/remote.md +90 -0
  903. package/docs/zh-CN/platforms/mac/signing.md +54 -0
  904. package/docs/zh-CN/platforms/mac/skills.md +40 -0
  905. package/docs/zh-CN/platforms/mac/voice-overlay.md +67 -0
  906. package/docs/zh-CN/platforms/mac/voicewake.md +74 -0
  907. package/docs/zh-CN/platforms/mac/webchat.md +43 -0
  908. package/docs/zh-CN/platforms/mac/xpc.md +68 -0
  909. package/docs/zh-CN/platforms/macos-vm.md +288 -0
  910. package/docs/zh-CN/platforms/macos.md +193 -0
  911. package/docs/zh-CN/platforms/oracle.md +310 -0
  912. package/docs/zh-CN/platforms/raspberry-pi.md +365 -0
  913. package/docs/zh-CN/platforms/windows.md +156 -0
  914. package/docs/zh-CN/plugin.md +639 -0
  915. package/docs/zh-CN/plugins/agent-tools.md +99 -0
  916. package/docs/zh-CN/plugins/manifest.md +68 -0
  917. package/docs/zh-CN/plugins/voice-call.md +250 -0
  918. package/docs/zh-CN/plugins/zalouser.md +88 -0
  919. package/docs/zh-CN/prose.md +141 -0
  920. package/docs/zh-CN/providers/anthropic.md +159 -0
  921. package/docs/zh-CN/providers/claude-max-api-proxy.md +155 -0
  922. package/docs/zh-CN/providers/deepgram.md +97 -0
  923. package/docs/zh-CN/providers/github-copilot.md +67 -0
  924. package/docs/zh-CN/providers/glm.md +39 -0
  925. package/docs/zh-CN/providers/index.md +68 -0
  926. package/docs/zh-CN/providers/minimax.md +206 -0
  927. package/docs/zh-CN/providers/models.md +55 -0
  928. package/docs/zh-CN/providers/moonshot.md +145 -0
  929. package/docs/zh-CN/providers/ollama.md +230 -0
  930. package/docs/zh-CN/providers/openai.md +68 -0
  931. package/docs/zh-CN/providers/opencode.md +41 -0
  932. package/docs/zh-CN/providers/openrouter.md +43 -0
  933. package/docs/zh-CN/providers/qwen.md +55 -0
  934. package/docs/zh-CN/providers/synthetic.md +102 -0
  935. package/docs/zh-CN/providers/venice.md +274 -0
  936. package/docs/zh-CN/providers/vercel-ai-gateway.md +57 -0
  937. package/docs/zh-CN/providers/xiaomi.md +68 -0
  938. package/docs/zh-CN/providers/zai.md +41 -0
  939. package/docs/zh-CN/railway.mdx +106 -0
  940. package/docs/zh-CN/refactor/clawnet.md +424 -0
  941. package/docs/zh-CN/refactor/exec-host.md +323 -0
  942. package/docs/zh-CN/refactor/outbound-session-mirroring.md +92 -0
  943. package/docs/zh-CN/refactor/plugin-sdk.md +221 -0
  944. package/docs/zh-CN/refactor/strict-config.md +100 -0
  945. package/docs/zh-CN/reference/AGENTS.default.md +131 -0
  946. package/docs/zh-CN/reference/RELEASING.md +123 -0
  947. package/docs/zh-CN/reference/api-usage-costs.md +136 -0
  948. package/docs/zh-CN/reference/device-models.md +54 -0
  949. package/docs/zh-CN/reference/rpc.md +48 -0
  950. package/docs/zh-CN/reference/session-management-compaction.md +287 -0
  951. package/docs/zh-CN/reference/templates/AGENTS.dev.md +89 -0
  952. package/docs/zh-CN/reference/templates/AGENTS.md +225 -0
  953. package/docs/zh-CN/reference/templates/BOOT.md +17 -0
  954. package/docs/zh-CN/reference/templates/BOOTSTRAP.md +68 -0
  955. package/docs/zh-CN/reference/templates/HEARTBEAT.md +18 -0
  956. package/docs/zh-CN/reference/templates/IDENTITY.dev.md +54 -0
  957. package/docs/zh-CN/reference/templates/IDENTITY.md +35 -0
  958. package/docs/zh-CN/reference/templates/SOUL.dev.md +83 -0
  959. package/docs/zh-CN/reference/templates/SOUL.md +49 -0
  960. package/docs/zh-CN/reference/templates/TOOLS.dev.md +31 -0
  961. package/docs/zh-CN/reference/templates/TOOLS.md +53 -0
  962. package/docs/zh-CN/reference/templates/USER.dev.md +25 -0
  963. package/docs/zh-CN/reference/templates/USER.md +30 -0
  964. package/docs/zh-CN/reference/test.md +57 -0
  965. package/docs/zh-CN/reference/transcript-hygiene.md +109 -0
  966. package/docs/zh-CN/render.mdx +169 -0
  967. package/docs/zh-CN/scripts.md +35 -0
  968. package/docs/zh-CN/security/formal-verification.md +171 -0
  969. package/docs/zh-CN/start/getting-started.md +206 -0
  970. package/docs/zh-CN/start/hubs.md +191 -0
  971. package/docs/zh-CN/start/lore.md +226 -0
  972. package/docs/zh-CN/start/onboarding.md +105 -0
  973. package/docs/zh-CN/start/openclaw.md +248 -0
  974. package/docs/zh-CN/start/pairing.md +89 -0
  975. package/docs/zh-CN/start/setup.md +153 -0
  976. package/docs/zh-CN/start/showcase.md +423 -0
  977. package/docs/zh-CN/start/wizard.md +331 -0
  978. package/docs/zh-CN/testing.md +375 -0
  979. package/docs/zh-CN/token-use.md +119 -0
  980. package/docs/zh-CN/tools/agent-send.md +59 -0
  981. package/docs/zh-CN/tools/apply-patch.md +57 -0
  982. package/docs/zh-CN/tools/browser-linux-troubleshooting.md +144 -0
  983. package/docs/zh-CN/tools/browser-login.md +75 -0
  984. package/docs/zh-CN/tools/browser.md +553 -0
  985. package/docs/zh-CN/tools/chrome-extension.md +183 -0
  986. package/docs/zh-CN/tools/clawhub.md +209 -0
  987. package/docs/zh-CN/tools/creating-skills.md +61 -0
  988. package/docs/zh-CN/tools/elevated.md +64 -0
  989. package/docs/zh-CN/tools/exec-approvals.md +234 -0
  990. package/docs/zh-CN/tools/exec.md +169 -0
  991. package/docs/zh-CN/tools/firecrawl.md +68 -0
  992. package/docs/zh-CN/tools/index.md +515 -0
  993. package/docs/zh-CN/tools/llm-task.md +117 -0
  994. package/docs/zh-CN/tools/lobster.md +349 -0
  995. package/docs/zh-CN/tools/reactions.md +29 -0
  996. package/docs/zh-CN/tools/skills-config.md +78 -0
  997. package/docs/zh-CN/tools/skills.md +279 -0
  998. package/docs/zh-CN/tools/slash-commands.md +205 -0
  999. package/docs/zh-CN/tools/subagents.md +156 -0
  1000. package/docs/zh-CN/tools/thinking.md +80 -0
  1001. package/docs/zh-CN/tools/web.md +257 -0
  1002. package/docs/zh-CN/tts.md +375 -0
  1003. package/docs/zh-CN/tui.md +166 -0
  1004. package/docs/zh-CN/vps.md +47 -0
  1005. package/docs/zh-CN/web/control-ui.md +191 -0
  1006. package/docs/zh-CN/web/dashboard.md +53 -0
  1007. package/docs/zh-CN/web/index.md +118 -0
  1008. package/docs/zh-CN/web/webchat.md +56 -0
  1009. package/extensions/bluebubbles/README.md +45 -0
  1010. package/extensions/bluebubbles/index.ts +19 -0
  1011. package/extensions/bluebubbles/node_modules/.bin/openclaw +21 -0
  1012. package/extensions/bluebubbles/openclaw.plugin.json +9 -0
  1013. package/extensions/bluebubbles/package.json +36 -0
  1014. package/extensions/bluebubbles/src/accounts.ts +88 -0
  1015. package/extensions/bluebubbles/src/actions.test.ts +650 -0
  1016. package/extensions/bluebubbles/src/actions.ts +438 -0
  1017. package/extensions/bluebubbles/src/attachments.test.ts +345 -0
  1018. package/extensions/bluebubbles/src/attachments.ts +300 -0
  1019. package/extensions/bluebubbles/src/channel.ts +414 -0
  1020. package/extensions/bluebubbles/src/chat.test.ts +461 -0
  1021. package/extensions/bluebubbles/src/chat.ts +378 -0
  1022. package/extensions/bluebubbles/src/config-schema.ts +51 -0
  1023. package/extensions/bluebubbles/src/media-send.ts +174 -0
  1024. package/extensions/bluebubbles/src/monitor.test.ts +2342 -0
  1025. package/extensions/bluebubbles/src/monitor.ts +2490 -0
  1026. package/extensions/bluebubbles/src/onboarding.ts +352 -0
  1027. package/extensions/bluebubbles/src/probe.ts +135 -0
  1028. package/extensions/bluebubbles/src/reactions.test.ts +392 -0
  1029. package/extensions/bluebubbles/src/reactions.ts +188 -0
  1030. package/extensions/bluebubbles/src/runtime.ts +14 -0
  1031. package/extensions/bluebubbles/src/send.test.ts +808 -0
  1032. package/extensions/bluebubbles/src/send.ts +467 -0
  1033. package/extensions/bluebubbles/src/targets.test.ts +183 -0
  1034. package/extensions/bluebubbles/src/targets.ts +422 -0
  1035. package/extensions/bluebubbles/src/types.ts +127 -0
  1036. package/extensions/copilot-proxy/README.md +24 -0
  1037. package/extensions/copilot-proxy/index.ts +148 -0
  1038. package/extensions/copilot-proxy/node_modules/.bin/openclaw +21 -0
  1039. package/extensions/copilot-proxy/openclaw.plugin.json +9 -0
  1040. package/extensions/copilot-proxy/package.json +14 -0
  1041. package/extensions/diagnostics-otel/index.ts +15 -0
  1042. package/extensions/diagnostics-otel/node_modules/.bin/openclaw +21 -0
  1043. package/extensions/diagnostics-otel/openclaw.plugin.json +8 -0
  1044. package/extensions/diagnostics-otel/package.json +27 -0
  1045. package/extensions/diagnostics-otel/src/service.test.ts +226 -0
  1046. package/extensions/diagnostics-otel/src/service.ts +635 -0
  1047. package/extensions/discord/index.ts +17 -0
  1048. package/extensions/discord/node_modules/.bin/openclaw +21 -0
  1049. package/extensions/discord/openclaw.plugin.json +9 -0
  1050. package/extensions/discord/package.json +14 -0
  1051. package/extensions/discord/src/channel.ts +422 -0
  1052. package/extensions/discord/src/runtime.ts +14 -0
  1053. package/extensions/feishu/README.md +47 -0
  1054. package/extensions/feishu/index.ts +15 -0
  1055. package/extensions/feishu/node_modules/.bin/openclaw +21 -0
  1056. package/extensions/feishu/openclaw.plugin.json +9 -0
  1057. package/extensions/feishu/package.json +33 -0
  1058. package/extensions/feishu/src/channel.ts +276 -0
  1059. package/extensions/feishu/src/config-schema.ts +46 -0
  1060. package/extensions/feishu/src/onboarding.ts +278 -0
  1061. package/extensions/google-antigravity-auth/README.md +24 -0
  1062. package/extensions/google-antigravity-auth/index.ts +461 -0
  1063. package/extensions/google-antigravity-auth/node_modules/.bin/openclaw +21 -0
  1064. package/extensions/google-antigravity-auth/openclaw.plugin.json +9 -0
  1065. package/extensions/google-antigravity-auth/package.json +14 -0
  1066. package/extensions/google-gemini-cli-auth/README.md +35 -0
  1067. package/extensions/google-gemini-cli-auth/index.ts +88 -0
  1068. package/extensions/google-gemini-cli-auth/node_modules/.bin/openclaw +21 -0
  1069. package/extensions/google-gemini-cli-auth/oauth.test.ts +240 -0
  1070. package/extensions/google-gemini-cli-auth/oauth.ts +662 -0
  1071. package/extensions/google-gemini-cli-auth/openclaw.plugin.json +9 -0
  1072. package/extensions/google-gemini-cli-auth/package.json +14 -0
  1073. package/extensions/googlechat/index.ts +19 -0
  1074. package/extensions/googlechat/node_modules/.bin/openclaw +21 -0
  1075. package/extensions/googlechat/openclaw.plugin.json +9 -0
  1076. package/extensions/googlechat/package.json +39 -0
  1077. package/extensions/googlechat/src/accounts.ts +147 -0
  1078. package/extensions/googlechat/src/actions.ts +181 -0
  1079. package/extensions/googlechat/src/api.test.ts +61 -0
  1080. package/extensions/googlechat/src/api.ts +282 -0
  1081. package/extensions/googlechat/src/auth.ts +123 -0
  1082. package/extensions/googlechat/src/channel.ts +583 -0
  1083. package/extensions/googlechat/src/monitor.test.ts +22 -0
  1084. package/extensions/googlechat/src/monitor.ts +949 -0
  1085. package/extensions/googlechat/src/onboarding.ts +269 -0
  1086. package/extensions/googlechat/src/runtime.ts +14 -0
  1087. package/extensions/googlechat/src/targets.test.ts +32 -0
  1088. package/extensions/googlechat/src/targets.ts +65 -0
  1089. package/extensions/googlechat/src/types.config.ts +3 -0
  1090. package/extensions/googlechat/src/types.ts +73 -0
  1091. package/extensions/imessage/index.ts +17 -0
  1092. package/extensions/imessage/node_modules/.bin/openclaw +21 -0
  1093. package/extensions/imessage/openclaw.plugin.json +9 -0
  1094. package/extensions/imessage/package.json +14 -0
  1095. package/extensions/imessage/src/channel.ts +294 -0
  1096. package/extensions/imessage/src/runtime.ts +14 -0
  1097. package/extensions/line/index.ts +19 -0
  1098. package/extensions/line/node_modules/.bin/openclaw +21 -0
  1099. package/extensions/line/openclaw.plugin.json +9 -0
  1100. package/extensions/line/package.json +29 -0
  1101. package/extensions/line/src/card-command.ts +344 -0
  1102. package/extensions/line/src/channel.logout.test.ts +99 -0
  1103. package/extensions/line/src/channel.sendPayload.test.ts +306 -0
  1104. package/extensions/line/src/channel.ts +780 -0
  1105. package/extensions/line/src/runtime.ts +14 -0
  1106. package/extensions/llm-task/README.md +97 -0
  1107. package/extensions/llm-task/index.ts +6 -0
  1108. package/extensions/llm-task/node_modules/.bin/openclaw +21 -0
  1109. package/extensions/llm-task/openclaw.plugin.json +21 -0
  1110. package/extensions/llm-task/package.json +14 -0
  1111. package/extensions/llm-task/src/llm-task-tool.test.ts +138 -0
  1112. package/extensions/llm-task/src/llm-task-tool.ts +245 -0
  1113. package/extensions/lobster/README.md +75 -0
  1114. package/extensions/lobster/SKILL.md +97 -0
  1115. package/extensions/lobster/index.ts +14 -0
  1116. package/extensions/lobster/node_modules/.bin/openclaw +21 -0
  1117. package/extensions/lobster/openclaw.plugin.json +10 -0
  1118. package/extensions/lobster/package.json +14 -0
  1119. package/extensions/lobster/src/lobster-tool.test.ts +247 -0
  1120. package/extensions/lobster/src/lobster-tool.ts +328 -0
  1121. package/extensions/matrix/CHANGELOG.md +87 -0
  1122. package/extensions/matrix/index.ts +17 -0
  1123. package/extensions/matrix/node_modules/.bin/markdown-it +21 -0
  1124. package/extensions/matrix/node_modules/.bin/openclaw +21 -0
  1125. package/extensions/matrix/openclaw.plugin.json +9 -0
  1126. package/extensions/matrix/package.json +36 -0
  1127. package/extensions/matrix/src/actions.ts +195 -0
  1128. package/extensions/matrix/src/channel.directory.test.ts +64 -0
  1129. package/extensions/matrix/src/channel.ts +439 -0
  1130. package/extensions/matrix/src/config-schema.ts +62 -0
  1131. package/extensions/matrix/src/directory-live.ts +188 -0
  1132. package/extensions/matrix/src/group-mentions.ts +66 -0
  1133. package/extensions/matrix/src/matrix/accounts.test.ts +82 -0
  1134. package/extensions/matrix/src/matrix/accounts.ts +65 -0
  1135. package/extensions/matrix/src/matrix/actions/client.ts +57 -0
  1136. package/extensions/matrix/src/matrix/actions/messages.ts +128 -0
  1137. package/extensions/matrix/src/matrix/actions/pins.ts +76 -0
  1138. package/extensions/matrix/src/matrix/actions/reactions.ts +96 -0
  1139. package/extensions/matrix/src/matrix/actions/room.ts +85 -0
  1140. package/extensions/matrix/src/matrix/actions/summary.ts +75 -0
  1141. package/extensions/matrix/src/matrix/actions/types.ts +84 -0
  1142. package/extensions/matrix/src/matrix/actions.ts +15 -0
  1143. package/extensions/matrix/src/matrix/active-client.ts +11 -0
  1144. package/extensions/matrix/src/matrix/client/config.ts +160 -0
  1145. package/extensions/matrix/src/matrix/client/create-client.ts +123 -0
  1146. package/extensions/matrix/src/matrix/client/logging.ts +36 -0
  1147. package/extensions/matrix/src/matrix/client/runtime.ts +4 -0
  1148. package/extensions/matrix/src/matrix/client/shared.ts +170 -0
  1149. package/extensions/matrix/src/matrix/client/storage.ts +131 -0
  1150. package/extensions/matrix/src/matrix/client/types.ts +34 -0
  1151. package/extensions/matrix/src/matrix/client.test.ts +56 -0
  1152. package/extensions/matrix/src/matrix/client.ts +5 -0
  1153. package/extensions/matrix/src/matrix/credentials.ts +105 -0
  1154. package/extensions/matrix/src/matrix/deps.ts +60 -0
  1155. package/extensions/matrix/src/matrix/format.test.ts +33 -0
  1156. package/extensions/matrix/src/matrix/format.ts +22 -0
  1157. package/extensions/matrix/src/matrix/index.ts +11 -0
  1158. package/extensions/matrix/src/matrix/monitor/allowlist.test.ts +45 -0
  1159. package/extensions/matrix/src/matrix/monitor/allowlist.ts +103 -0
  1160. package/extensions/matrix/src/matrix/monitor/auto-join.ts +71 -0
  1161. package/extensions/matrix/src/matrix/monitor/direct.ts +104 -0
  1162. package/extensions/matrix/src/matrix/monitor/events.ts +101 -0
  1163. package/extensions/matrix/src/matrix/monitor/handler.ts +661 -0
  1164. package/extensions/matrix/src/matrix/monitor/index.ts +338 -0
  1165. package/extensions/matrix/src/matrix/monitor/location.ts +100 -0
  1166. package/extensions/matrix/src/matrix/monitor/media.test.ts +102 -0
  1167. package/extensions/matrix/src/matrix/monitor/media.ts +113 -0
  1168. package/extensions/matrix/src/matrix/monitor/mentions.ts +31 -0
  1169. package/extensions/matrix/src/matrix/monitor/replies.ts +97 -0
  1170. package/extensions/matrix/src/matrix/monitor/room-info.ts +55 -0
  1171. package/extensions/matrix/src/matrix/monitor/rooms.test.ts +39 -0
  1172. package/extensions/matrix/src/matrix/monitor/rooms.ts +47 -0
  1173. package/extensions/matrix/src/matrix/monitor/threads.ts +68 -0
  1174. package/extensions/matrix/src/matrix/monitor/types.ts +39 -0
  1175. package/extensions/matrix/src/matrix/poll-types.test.ts +21 -0
  1176. package/extensions/matrix/src/matrix/poll-types.ts +166 -0
  1177. package/extensions/matrix/src/matrix/probe.ts +70 -0
  1178. package/extensions/matrix/src/matrix/send/client.ts +66 -0
  1179. package/extensions/matrix/src/matrix/send/formatting.ts +89 -0
  1180. package/extensions/matrix/src/matrix/send/media.ts +229 -0
  1181. package/extensions/matrix/src/matrix/send/targets.test.ts +98 -0
  1182. package/extensions/matrix/src/matrix/send/targets.ts +136 -0
  1183. package/extensions/matrix/src/matrix/send/types.ts +109 -0
  1184. package/extensions/matrix/src/matrix/send.test.ts +171 -0
  1185. package/extensions/matrix/src/matrix/send.ts +260 -0
  1186. package/extensions/matrix/src/onboarding.ts +449 -0
  1187. package/extensions/matrix/src/outbound.ts +52 -0
  1188. package/extensions/matrix/src/resolve-targets.test.ts +48 -0
  1189. package/extensions/matrix/src/resolve-targets.ts +135 -0
  1190. package/extensions/matrix/src/runtime.ts +14 -0
  1191. package/extensions/matrix/src/tool-actions.ts +164 -0
  1192. package/extensions/matrix/src/types.ts +95 -0
  1193. package/extensions/mattermost/index.ts +17 -0
  1194. package/extensions/mattermost/node_modules/.bin/openclaw +21 -0
  1195. package/extensions/mattermost/openclaw.plugin.json +9 -0
  1196. package/extensions/mattermost/package.json +28 -0
  1197. package/extensions/mattermost/src/channel.test.ts +48 -0
  1198. package/extensions/mattermost/src/channel.ts +337 -0
  1199. package/extensions/mattermost/src/config-schema.ts +55 -0
  1200. package/extensions/mattermost/src/group-mentions.ts +15 -0
  1201. package/extensions/mattermost/src/mattermost/accounts.ts +128 -0
  1202. package/extensions/mattermost/src/mattermost/client.ts +220 -0
  1203. package/extensions/mattermost/src/mattermost/index.ts +9 -0
  1204. package/extensions/mattermost/src/mattermost/monitor-helpers.ts +166 -0
  1205. package/extensions/mattermost/src/mattermost/monitor.ts +987 -0
  1206. package/extensions/mattermost/src/mattermost/probe.ts +74 -0
  1207. package/extensions/mattermost/src/mattermost/send.ts +231 -0
  1208. package/extensions/mattermost/src/normalize.ts +46 -0
  1209. package/extensions/mattermost/src/onboarding-helpers.ts +44 -0
  1210. package/extensions/mattermost/src/onboarding.ts +186 -0
  1211. package/extensions/mattermost/src/runtime.ts +14 -0
  1212. package/extensions/mattermost/src/types.ts +50 -0
  1213. package/extensions/memory-core/index.ts +38 -0
  1214. package/extensions/memory-core/node_modules/.bin/openclaw +21 -0
  1215. package/extensions/memory-core/openclaw.plugin.json +9 -0
  1216. package/extensions/memory-core/package.json +17 -0
  1217. package/extensions/memory-lancedb/config.ts +139 -0
  1218. package/extensions/memory-lancedb/index.test.ts +295 -0
  1219. package/extensions/memory-lancedb/index.ts +608 -0
  1220. package/extensions/memory-lancedb/node_modules/.bin/openai +21 -0
  1221. package/extensions/memory-lancedb/node_modules/.bin/openclaw +21 -0
  1222. package/extensions/memory-lancedb/openclaw.plugin.json +60 -0
  1223. package/extensions/memory-lancedb/package.json +19 -0
  1224. package/extensions/minimax-portal-auth/README.md +33 -0
  1225. package/extensions/minimax-portal-auth/index.ts +155 -0
  1226. package/extensions/minimax-portal-auth/node_modules/.bin/openclaw +21 -0
  1227. package/extensions/minimax-portal-auth/oauth.ts +247 -0
  1228. package/extensions/minimax-portal-auth/openclaw.plugin.json +9 -0
  1229. package/extensions/minimax-portal-auth/package.json +14 -0
  1230. package/extensions/msteams/CHANGELOG.md +83 -0
  1231. package/extensions/msteams/index.ts +17 -0
  1232. package/extensions/msteams/node_modules/.bin/openclaw +21 -0
  1233. package/extensions/msteams/openclaw.plugin.json +9 -0
  1234. package/extensions/msteams/package.json +39 -0
  1235. package/extensions/msteams/src/attachments/download.ts +283 -0
  1236. package/extensions/msteams/src/attachments/graph.ts +353 -0
  1237. package/extensions/msteams/src/attachments/html.ts +90 -0
  1238. package/extensions/msteams/src/attachments/payload.ts +22 -0
  1239. package/extensions/msteams/src/attachments/shared.ts +291 -0
  1240. package/extensions/msteams/src/attachments/types.ts +37 -0
  1241. package/extensions/msteams/src/attachments.test.ts +459 -0
  1242. package/extensions/msteams/src/attachments.ts +18 -0
  1243. package/extensions/msteams/src/channel.directory.test.ts +48 -0
  1244. package/extensions/msteams/src/channel.ts +459 -0
  1245. package/extensions/msteams/src/conversation-store-fs.test.ts +88 -0
  1246. package/extensions/msteams/src/conversation-store-fs.ts +165 -0
  1247. package/extensions/msteams/src/conversation-store-memory.ts +47 -0
  1248. package/extensions/msteams/src/conversation-store.ts +41 -0
  1249. package/extensions/msteams/src/directory-live.ts +205 -0
  1250. package/extensions/msteams/src/errors.test.ts +45 -0
  1251. package/extensions/msteams/src/errors.ts +190 -0
  1252. package/extensions/msteams/src/file-consent-helpers.test.ts +243 -0
  1253. package/extensions/msteams/src/file-consent-helpers.ts +73 -0
  1254. package/extensions/msteams/src/file-consent.ts +126 -0
  1255. package/extensions/msteams/src/graph-chat.ts +53 -0
  1256. package/extensions/msteams/src/graph-upload.ts +453 -0
  1257. package/extensions/msteams/src/inbound.test.ts +66 -0
  1258. package/extensions/msteams/src/inbound.ts +48 -0
  1259. package/extensions/msteams/src/index.ts +4 -0
  1260. package/extensions/msteams/src/media-helpers.test.ts +189 -0
  1261. package/extensions/msteams/src/media-helpers.ts +86 -0
  1262. package/extensions/msteams/src/messenger.test.ts +248 -0
  1263. package/extensions/msteams/src/messenger.ts +495 -0
  1264. package/extensions/msteams/src/monitor-handler/inbound-media.ts +128 -0
  1265. package/extensions/msteams/src/monitor-handler/message-handler.ts +640 -0
  1266. package/extensions/msteams/src/monitor-handler.ts +162 -0
  1267. package/extensions/msteams/src/monitor-types.ts +5 -0
  1268. package/extensions/msteams/src/monitor.ts +295 -0
  1269. package/extensions/msteams/src/onboarding.ts +431 -0
  1270. package/extensions/msteams/src/outbound.ts +46 -0
  1271. package/extensions/msteams/src/pending-uploads.ts +89 -0
  1272. package/extensions/msteams/src/policy.test.ts +209 -0
  1273. package/extensions/msteams/src/policy.ts +273 -0
  1274. package/extensions/msteams/src/polls-store-memory.ts +32 -0
  1275. package/extensions/msteams/src/polls-store.test.ts +38 -0
  1276. package/extensions/msteams/src/polls.test.ts +72 -0
  1277. package/extensions/msteams/src/polls.ts +315 -0
  1278. package/extensions/msteams/src/probe.test.ts +58 -0
  1279. package/extensions/msteams/src/probe.ts +107 -0
  1280. package/extensions/msteams/src/reply-dispatcher.ts +130 -0
  1281. package/extensions/msteams/src/resolve-allowlist.ts +297 -0
  1282. package/extensions/msteams/src/runtime.ts +14 -0
  1283. package/extensions/msteams/src/sdk-types.ts +19 -0
  1284. package/extensions/msteams/src/sdk.ts +33 -0
  1285. package/extensions/msteams/src/send-context.ts +164 -0
  1286. package/extensions/msteams/src/send.ts +519 -0
  1287. package/extensions/msteams/src/sent-message-cache.test.ts +15 -0
  1288. package/extensions/msteams/src/sent-message-cache.ts +47 -0
  1289. package/extensions/msteams/src/storage.ts +25 -0
  1290. package/extensions/msteams/src/store-fs.ts +83 -0
  1291. package/extensions/msteams/src/token.ts +19 -0
  1292. package/extensions/nextcloud-talk/index.ts +17 -0
  1293. package/extensions/nextcloud-talk/node_modules/.bin/openclaw +21 -0
  1294. package/extensions/nextcloud-talk/openclaw.plugin.json +9 -0
  1295. package/extensions/nextcloud-talk/package.json +33 -0
  1296. package/extensions/nextcloud-talk/src/accounts.ts +174 -0
  1297. package/extensions/nextcloud-talk/src/channel.ts +409 -0
  1298. package/extensions/nextcloud-talk/src/config-schema.ts +78 -0
  1299. package/extensions/nextcloud-talk/src/format.ts +79 -0
  1300. package/extensions/nextcloud-talk/src/inbound.ts +317 -0
  1301. package/extensions/nextcloud-talk/src/monitor.ts +246 -0
  1302. package/extensions/nextcloud-talk/src/normalize.ts +39 -0
  1303. package/extensions/nextcloud-talk/src/onboarding.ts +343 -0
  1304. package/extensions/nextcloud-talk/src/policy.test.ts +33 -0
  1305. package/extensions/nextcloud-talk/src/policy.ts +180 -0
  1306. package/extensions/nextcloud-talk/src/room-info.ts +125 -0
  1307. package/extensions/nextcloud-talk/src/runtime.ts +14 -0
  1308. package/extensions/nextcloud-talk/src/send.ts +210 -0
  1309. package/extensions/nextcloud-talk/src/signature.ts +72 -0
  1310. package/extensions/nextcloud-talk/src/types.ts +179 -0
  1311. package/extensions/nostr/CHANGELOG.md +74 -0
  1312. package/extensions/nostr/README.md +136 -0
  1313. package/extensions/nostr/index.ts +68 -0
  1314. package/extensions/nostr/node_modules/.bin/openclaw +21 -0
  1315. package/extensions/nostr/openclaw.plugin.json +9 -0
  1316. package/extensions/nostr/package.json +34 -0
  1317. package/extensions/nostr/src/channel.test.ts +151 -0
  1318. package/extensions/nostr/src/channel.ts +353 -0
  1319. package/extensions/nostr/src/config-schema.ts +90 -0
  1320. package/extensions/nostr/src/metrics.ts +478 -0
  1321. package/extensions/nostr/src/nostr-bus.fuzz.test.ts +533 -0
  1322. package/extensions/nostr/src/nostr-bus.integration.test.ts +448 -0
  1323. package/extensions/nostr/src/nostr-bus.test.ts +199 -0
  1324. package/extensions/nostr/src/nostr-bus.ts +715 -0
  1325. package/extensions/nostr/src/nostr-profile-http.test.ts +378 -0
  1326. package/extensions/nostr/src/nostr-profile-http.ts +519 -0
  1327. package/extensions/nostr/src/nostr-profile-import.test.ts +119 -0
  1328. package/extensions/nostr/src/nostr-profile-import.ts +262 -0
  1329. package/extensions/nostr/src/nostr-profile.fuzz.test.ts +477 -0
  1330. package/extensions/nostr/src/nostr-profile.test.ts +410 -0
  1331. package/extensions/nostr/src/nostr-profile.ts +277 -0
  1332. package/extensions/nostr/src/nostr-state-store.test.ts +131 -0
  1333. package/extensions/nostr/src/nostr-state-store.ts +226 -0
  1334. package/extensions/nostr/src/runtime.ts +14 -0
  1335. package/extensions/nostr/src/seen-tracker.ts +303 -0
  1336. package/extensions/nostr/src/types.test.ts +157 -0
  1337. package/extensions/nostr/src/types.ts +101 -0
  1338. package/extensions/nostr/test/setup.ts +5 -0
  1339. package/extensions/open-prose/README.md +25 -0
  1340. package/extensions/open-prose/index.ts +5 -0
  1341. package/extensions/open-prose/node_modules/.bin/openclaw +21 -0
  1342. package/extensions/open-prose/openclaw.plugin.json +11 -0
  1343. package/extensions/open-prose/package.json +14 -0
  1344. package/extensions/open-prose/skills/prose/LICENSE +21 -0
  1345. package/extensions/open-prose/skills/prose/SKILL.md +323 -0
  1346. package/extensions/open-prose/skills/prose/alt-borges.md +141 -0
  1347. package/extensions/open-prose/skills/prose/alts/arabian-nights.md +358 -0
  1348. package/extensions/open-prose/skills/prose/alts/borges.md +360 -0
  1349. package/extensions/open-prose/skills/prose/alts/folk.md +322 -0
  1350. package/extensions/open-prose/skills/prose/alts/homer.md +346 -0
  1351. package/extensions/open-prose/skills/prose/alts/kafka.md +373 -0
  1352. package/extensions/open-prose/skills/prose/compiler.md +2971 -0
  1353. package/extensions/open-prose/skills/prose/examples/01-hello-world.prose +4 -0
  1354. package/extensions/open-prose/skills/prose/examples/02-research-and-summarize.prose +6 -0
  1355. package/extensions/open-prose/skills/prose/examples/03-code-review.prose +17 -0
  1356. package/extensions/open-prose/skills/prose/examples/04-write-and-refine.prose +14 -0
  1357. package/extensions/open-prose/skills/prose/examples/05-debug-issue.prose +20 -0
  1358. package/extensions/open-prose/skills/prose/examples/06-explain-codebase.prose +17 -0
  1359. package/extensions/open-prose/skills/prose/examples/07-refactor.prose +20 -0
  1360. package/extensions/open-prose/skills/prose/examples/08-blog-post.prose +20 -0
  1361. package/extensions/open-prose/skills/prose/examples/09-research-with-agents.prose +25 -0
  1362. package/extensions/open-prose/skills/prose/examples/10-code-review-agents.prose +32 -0
  1363. package/extensions/open-prose/skills/prose/examples/11-skills-and-imports.prose +27 -0
  1364. package/extensions/open-prose/skills/prose/examples/12-secure-agent-permissions.prose +43 -0
  1365. package/extensions/open-prose/skills/prose/examples/13-variables-and-context.prose +51 -0
  1366. package/extensions/open-prose/skills/prose/examples/14-composition-blocks.prose +48 -0
  1367. package/extensions/open-prose/skills/prose/examples/15-inline-sequences.prose +23 -0
  1368. package/extensions/open-prose/skills/prose/examples/16-parallel-reviews.prose +19 -0
  1369. package/extensions/open-prose/skills/prose/examples/17-parallel-research.prose +19 -0
  1370. package/extensions/open-prose/skills/prose/examples/18-mixed-parallel-sequential.prose +36 -0
  1371. package/extensions/open-prose/skills/prose/examples/19-advanced-parallel.prose +71 -0
  1372. package/extensions/open-prose/skills/prose/examples/20-fixed-loops.prose +20 -0
  1373. package/extensions/open-prose/skills/prose/examples/21-pipeline-operations.prose +35 -0
  1374. package/extensions/open-prose/skills/prose/examples/22-error-handling.prose +51 -0
  1375. package/extensions/open-prose/skills/prose/examples/23-retry-with-backoff.prose +63 -0
  1376. package/extensions/open-prose/skills/prose/examples/24-choice-blocks.prose +86 -0
  1377. package/extensions/open-prose/skills/prose/examples/25-conditionals.prose +114 -0
  1378. package/extensions/open-prose/skills/prose/examples/26-parameterized-blocks.prose +100 -0
  1379. package/extensions/open-prose/skills/prose/examples/27-string-interpolation.prose +105 -0
  1380. package/extensions/open-prose/skills/prose/examples/28-automated-pr-review.prose +37 -0
  1381. package/extensions/open-prose/skills/prose/examples/28-gas-town.prose +1572 -0
  1382. package/extensions/open-prose/skills/prose/examples/29-captains-chair.prose +218 -0
  1383. package/extensions/open-prose/skills/prose/examples/30-captains-chair-simple.prose +42 -0
  1384. package/extensions/open-prose/skills/prose/examples/31-captains-chair-with-memory.prose +145 -0
  1385. package/extensions/open-prose/skills/prose/examples/33-pr-review-autofix.prose +168 -0
  1386. package/extensions/open-prose/skills/prose/examples/34-content-pipeline.prose +204 -0
  1387. package/extensions/open-prose/skills/prose/examples/35-feature-factory.prose +296 -0
  1388. package/extensions/open-prose/skills/prose/examples/36-bug-hunter.prose +237 -0
  1389. package/extensions/open-prose/skills/prose/examples/37-the-forge.prose +1474 -0
  1390. package/extensions/open-prose/skills/prose/examples/38-skill-scan.prose +455 -0
  1391. package/extensions/open-prose/skills/prose/examples/39-architect-by-simulation.prose +277 -0
  1392. package/extensions/open-prose/skills/prose/examples/40-rlm-self-refine.prose +32 -0
  1393. package/extensions/open-prose/skills/prose/examples/41-rlm-divide-conquer.prose +38 -0
  1394. package/extensions/open-prose/skills/prose/examples/42-rlm-filter-recurse.prose +46 -0
  1395. package/extensions/open-prose/skills/prose/examples/43-rlm-pairwise.prose +50 -0
  1396. package/extensions/open-prose/skills/prose/examples/44-run-endpoint-ux-test.prose +261 -0
  1397. package/extensions/open-prose/skills/prose/examples/45-plugin-release.prose +159 -0
  1398. package/extensions/open-prose/skills/prose/examples/45-run-endpoint-ux-test-with-remediation.prose +637 -0
  1399. package/extensions/open-prose/skills/prose/examples/46-run-endpoint-ux-test-fast.prose +148 -0
  1400. package/extensions/open-prose/skills/prose/examples/46-workflow-crystallizer.prose +225 -0
  1401. package/extensions/open-prose/skills/prose/examples/47-language-self-improvement.prose +356 -0
  1402. package/extensions/open-prose/skills/prose/examples/48-habit-miner.prose +445 -0
  1403. package/extensions/open-prose/skills/prose/examples/49-prose-run-retrospective.prose +210 -0
  1404. package/extensions/open-prose/skills/prose/examples/README.md +391 -0
  1405. package/extensions/open-prose/skills/prose/examples/roadmap/README.md +22 -0
  1406. package/extensions/open-prose/skills/prose/examples/roadmap/iterative-refinement.prose +20 -0
  1407. package/extensions/open-prose/skills/prose/examples/roadmap/parallel-review.prose +18 -0
  1408. package/extensions/open-prose/skills/prose/examples/roadmap/simple-pipeline.prose +17 -0
  1409. package/extensions/open-prose/skills/prose/examples/roadmap/syntax/open-prose-syntax.prose +223 -0
  1410. package/extensions/open-prose/skills/prose/guidance/antipatterns.md +951 -0
  1411. package/extensions/open-prose/skills/prose/guidance/patterns.md +700 -0
  1412. package/extensions/open-prose/skills/prose/guidance/system-prompt.md +180 -0
  1413. package/extensions/open-prose/skills/prose/help.md +144 -0
  1414. package/extensions/open-prose/skills/prose/lib/README.md +108 -0
  1415. package/extensions/open-prose/skills/prose/lib/calibrator.prose +215 -0
  1416. package/extensions/open-prose/skills/prose/lib/cost-analyzer.prose +174 -0
  1417. package/extensions/open-prose/skills/prose/lib/error-forensics.prose +250 -0
  1418. package/extensions/open-prose/skills/prose/lib/inspector.prose +196 -0
  1419. package/extensions/open-prose/skills/prose/lib/profiler.prose +460 -0
  1420. package/extensions/open-prose/skills/prose/lib/program-improver.prose +275 -0
  1421. package/extensions/open-prose/skills/prose/lib/project-memory.prose +118 -0
  1422. package/extensions/open-prose/skills/prose/lib/user-memory.prose +93 -0
  1423. package/extensions/open-prose/skills/prose/lib/vm-improver.prose +243 -0
  1424. package/extensions/open-prose/skills/prose/primitives/session.md +593 -0
  1425. package/extensions/open-prose/skills/prose/prose.md +1237 -0
  1426. package/extensions/open-prose/skills/prose/state/filesystem.md +498 -0
  1427. package/extensions/open-prose/skills/prose/state/in-context.md +384 -0
  1428. package/extensions/open-prose/skills/prose/state/postgres.md +880 -0
  1429. package/extensions/open-prose/skills/prose/state/sqlite.md +574 -0
  1430. package/extensions/qwen-portal-auth/README.md +24 -0
  1431. package/extensions/qwen-portal-auth/index.ts +130 -0
  1432. package/extensions/qwen-portal-auth/oauth.ts +190 -0
  1433. package/extensions/qwen-portal-auth/openclaw.plugin.json +9 -0
  1434. package/extensions/signal/index.ts +17 -0
  1435. package/extensions/signal/node_modules/.bin/openclaw +21 -0
  1436. package/extensions/signal/openclaw.plugin.json +9 -0
  1437. package/extensions/signal/package.json +14 -0
  1438. package/extensions/signal/src/channel.ts +315 -0
  1439. package/extensions/signal/src/runtime.ts +14 -0
  1440. package/extensions/slack/index.ts +17 -0
  1441. package/extensions/slack/node_modules/.bin/openclaw +21 -0
  1442. package/extensions/slack/openclaw.plugin.json +9 -0
  1443. package/extensions/slack/package.json +14 -0
  1444. package/extensions/slack/src/channel.ts +604 -0
  1445. package/extensions/slack/src/runtime.ts +14 -0
  1446. package/extensions/telegram/index.ts +17 -0
  1447. package/extensions/telegram/node_modules/.bin/openclaw +21 -0
  1448. package/extensions/telegram/openclaw.plugin.json +9 -0
  1449. package/extensions/telegram/package.json +14 -0
  1450. package/extensions/telegram/src/channel.ts +482 -0
  1451. package/extensions/telegram/src/runtime.ts +14 -0
  1452. package/extensions/tlon/README.md +5 -0
  1453. package/extensions/tlon/index.ts +17 -0
  1454. package/extensions/tlon/node_modules/.bin/openclaw +21 -0
  1455. package/extensions/tlon/openclaw.plugin.json +9 -0
  1456. package/extensions/tlon/package.json +33 -0
  1457. package/extensions/tlon/src/channel.ts +392 -0
  1458. package/extensions/tlon/src/config-schema.test.ts +31 -0
  1459. package/extensions/tlon/src/config-schema.ts +43 -0
  1460. package/extensions/tlon/src/monitor/discovery.ts +76 -0
  1461. package/extensions/tlon/src/monitor/history.ts +90 -0
  1462. package/extensions/tlon/src/monitor/index.ts +553 -0
  1463. package/extensions/tlon/src/monitor/processed-messages.test.ts +23 -0
  1464. package/extensions/tlon/src/monitor/processed-messages.ts +46 -0
  1465. package/extensions/tlon/src/monitor/utils.ts +105 -0
  1466. package/extensions/tlon/src/onboarding.ts +214 -0
  1467. package/extensions/tlon/src/runtime.ts +14 -0
  1468. package/extensions/tlon/src/targets.ts +89 -0
  1469. package/extensions/tlon/src/types.ts +92 -0
  1470. package/extensions/tlon/src/urbit/auth.ts +18 -0
  1471. package/extensions/tlon/src/urbit/http-api.ts +38 -0
  1472. package/extensions/tlon/src/urbit/send.test.ts +38 -0
  1473. package/extensions/tlon/src/urbit/send.ts +131 -0
  1474. package/extensions/tlon/src/urbit/sse-client.test.ts +40 -0
  1475. package/extensions/tlon/src/urbit/sse-client.ts +395 -0
  1476. package/extensions/twitch/CHANGELOG.md +45 -0
  1477. package/extensions/twitch/README.md +89 -0
  1478. package/extensions/twitch/index.ts +20 -0
  1479. package/extensions/twitch/node_modules/.bin/openclaw +21 -0
  1480. package/extensions/twitch/openclaw.plugin.json +9 -0
  1481. package/extensions/twitch/package.json +20 -0
  1482. package/extensions/twitch/src/access-control.test.ts +489 -0
  1483. package/extensions/twitch/src/access-control.ts +166 -0
  1484. package/extensions/twitch/src/actions.ts +173 -0
  1485. package/extensions/twitch/src/client-manager-registry.ts +115 -0
  1486. package/extensions/twitch/src/config-schema.ts +82 -0
  1487. package/extensions/twitch/src/config.test.ts +87 -0
  1488. package/extensions/twitch/src/config.ts +116 -0
  1489. package/extensions/twitch/src/monitor.ts +261 -0
  1490. package/extensions/twitch/src/onboarding.test.ts +311 -0
  1491. package/extensions/twitch/src/onboarding.ts +417 -0
  1492. package/extensions/twitch/src/outbound.test.ts +373 -0
  1493. package/extensions/twitch/src/outbound.ts +184 -0
  1494. package/extensions/twitch/src/plugin.test.ts +39 -0
  1495. package/extensions/twitch/src/plugin.ts +274 -0
  1496. package/extensions/twitch/src/probe.test.ts +195 -0
  1497. package/extensions/twitch/src/probe.ts +120 -0
  1498. package/extensions/twitch/src/resolver.ts +137 -0
  1499. package/extensions/twitch/src/runtime.ts +14 -0
  1500. package/extensions/twitch/src/send.test.ts +289 -0
  1501. package/extensions/twitch/src/send.ts +136 -0
  1502. package/extensions/twitch/src/status.test.ts +270 -0
  1503. package/extensions/twitch/src/status.ts +178 -0
  1504. package/extensions/twitch/src/token.test.ts +171 -0
  1505. package/extensions/twitch/src/token.ts +91 -0
  1506. package/extensions/twitch/src/twitch-client.test.ts +589 -0
  1507. package/extensions/twitch/src/twitch-client.ts +277 -0
  1508. package/extensions/twitch/src/types.ts +141 -0
  1509. package/extensions/twitch/src/utils/markdown.ts +98 -0
  1510. package/extensions/twitch/src/utils/twitch.ts +78 -0
  1511. package/extensions/twitch/test/setup.ts +7 -0
  1512. package/extensions/voice-call/CHANGELOG.md +109 -0
  1513. package/extensions/voice-call/README.md +139 -0
  1514. package/extensions/voice-call/index.ts +493 -0
  1515. package/extensions/voice-call/node_modules/.bin/openclaw +21 -0
  1516. package/extensions/voice-call/openclaw.plugin.json +559 -0
  1517. package/extensions/voice-call/package.json +19 -0
  1518. package/extensions/voice-call/src/allowlist.ts +19 -0
  1519. package/extensions/voice-call/src/cli.ts +279 -0
  1520. package/extensions/voice-call/src/config.test.ts +234 -0
  1521. package/extensions/voice-call/src/config.ts +523 -0
  1522. package/extensions/voice-call/src/core-bridge.ts +159 -0
  1523. package/extensions/voice-call/src/manager/context.ts +21 -0
  1524. package/extensions/voice-call/src/manager/events.ts +188 -0
  1525. package/extensions/voice-call/src/manager/lookup.ts +35 -0
  1526. package/extensions/voice-call/src/manager/outbound.ts +275 -0
  1527. package/extensions/voice-call/src/manager/state.ts +48 -0
  1528. package/extensions/voice-call/src/manager/store.ts +91 -0
  1529. package/extensions/voice-call/src/manager/timers.ts +89 -0
  1530. package/extensions/voice-call/src/manager/twiml.ts +9 -0
  1531. package/extensions/voice-call/src/manager.test.ts +194 -0
  1532. package/extensions/voice-call/src/manager.ts +887 -0
  1533. package/extensions/voice-call/src/media-stream.test.ts +96 -0
  1534. package/extensions/voice-call/src/media-stream.ts +411 -0
  1535. package/extensions/voice-call/src/providers/base.ts +67 -0
  1536. package/extensions/voice-call/src/providers/index.ts +10 -0
  1537. package/extensions/voice-call/src/providers/mock.ts +165 -0
  1538. package/extensions/voice-call/src/providers/plivo.test.ts +27 -0
  1539. package/extensions/voice-call/src/providers/plivo.ts +515 -0
  1540. package/extensions/voice-call/src/providers/stt-openai-realtime.ts +311 -0
  1541. package/extensions/voice-call/src/providers/telnyx.ts +371 -0
  1542. package/extensions/voice-call/src/providers/tts-openai.ts +259 -0
  1543. package/extensions/voice-call/src/providers/twilio/api.ts +42 -0
  1544. package/extensions/voice-call/src/providers/twilio/webhook.ts +32 -0
  1545. package/extensions/voice-call/src/providers/twilio.test.ts +60 -0
  1546. package/extensions/voice-call/src/providers/twilio.ts +626 -0
  1547. package/extensions/voice-call/src/response-generator.ts +158 -0
  1548. package/extensions/voice-call/src/runtime.ts +212 -0
  1549. package/extensions/voice-call/src/telephony-audio.ts +90 -0
  1550. package/extensions/voice-call/src/telephony-tts.ts +104 -0
  1551. package/extensions/voice-call/src/tunnel.ts +314 -0
  1552. package/extensions/voice-call/src/types.ts +272 -0
  1553. package/extensions/voice-call/src/utils.ts +14 -0
  1554. package/extensions/voice-call/src/voice-mapping.ts +67 -0
  1555. package/extensions/voice-call/src/webhook-security.test.ts +377 -0
  1556. package/extensions/voice-call/src/webhook-security.ts +689 -0
  1557. package/extensions/voice-call/src/webhook.ts +491 -0
  1558. package/extensions/whatsapp/index.ts +17 -0
  1559. package/extensions/whatsapp/node_modules/.bin/openclaw +21 -0
  1560. package/extensions/whatsapp/openclaw.plugin.json +9 -0
  1561. package/extensions/whatsapp/package.json +14 -0
  1562. package/extensions/whatsapp/src/channel.ts +508 -0
  1563. package/extensions/whatsapp/src/runtime.ts +14 -0
  1564. package/extensions/zalo/CHANGELOG.md +89 -0
  1565. package/extensions/zalo/README.md +50 -0
  1566. package/extensions/zalo/index.ts +19 -0
  1567. package/extensions/zalo/node_modules/.bin/openclaw +21 -0
  1568. package/extensions/zalo/openclaw.plugin.json +9 -0
  1569. package/extensions/zalo/package.json +36 -0
  1570. package/extensions/zalo/src/accounts.ts +80 -0
  1571. package/extensions/zalo/src/actions.ts +67 -0
  1572. package/extensions/zalo/src/api.ts +208 -0
  1573. package/extensions/zalo/src/channel.directory.test.ts +43 -0
  1574. package/extensions/zalo/src/channel.ts +414 -0
  1575. package/extensions/zalo/src/config-schema.ts +24 -0
  1576. package/extensions/zalo/src/monitor.ts +753 -0
  1577. package/extensions/zalo/src/monitor.webhook.test.ts +73 -0
  1578. package/extensions/zalo/src/onboarding.ts +401 -0
  1579. package/extensions/zalo/src/probe.ts +46 -0
  1580. package/extensions/zalo/src/proxy.ts +21 -0
  1581. package/extensions/zalo/src/runtime.ts +14 -0
  1582. package/extensions/zalo/src/send.ts +124 -0
  1583. package/extensions/zalo/src/status-issues.ts +53 -0
  1584. package/extensions/zalo/src/token.ts +63 -0
  1585. package/extensions/zalo/src/types.ts +42 -0
  1586. package/extensions/zalouser/CHANGELOG.md +61 -0
  1587. package/extensions/zalouser/README.md +225 -0
  1588. package/extensions/zalouser/index.ts +31 -0
  1589. package/extensions/zalouser/node_modules/.bin/openclaw +21 -0
  1590. package/extensions/zalouser/openclaw.plugin.json +9 -0
  1591. package/extensions/zalouser/package.json +36 -0
  1592. package/extensions/zalouser/src/accounts.ts +135 -0
  1593. package/extensions/zalouser/src/channel.test.ts +18 -0
  1594. package/extensions/zalouser/src/channel.ts +686 -0
  1595. package/extensions/zalouser/src/config-schema.ts +27 -0
  1596. package/extensions/zalouser/src/monitor.ts +590 -0
  1597. package/extensions/zalouser/src/onboarding.ts +504 -0
  1598. package/extensions/zalouser/src/probe.ts +28 -0
  1599. package/extensions/zalouser/src/runtime.ts +14 -0
  1600. package/extensions/zalouser/src/send.ts +160 -0
  1601. package/extensions/zalouser/src/status-issues.test.ts +57 -0
  1602. package/extensions/zalouser/src/status-issues.ts +89 -0
  1603. package/extensions/zalouser/src/tool.ts +164 -0
  1604. package/extensions/zalouser/src/types.ts +108 -0
  1605. package/extensions/zalouser/src/zca.ts +202 -0
  1606. package/openclaw.mjs +14 -0
  1607. package/package.json +245 -0
  1608. package/skills/1password/SKILL.md +70 -0
  1609. package/skills/1password/references/cli-examples.md +29 -0
  1610. package/skills/1password/references/get-started.md +17 -0
  1611. package/skills/apple-notes/SKILL.md +77 -0
  1612. package/skills/apple-reminders/SKILL.md +96 -0
  1613. package/skills/bear-notes/SKILL.md +107 -0
  1614. package/skills/bird/SKILL.md +224 -0
  1615. package/skills/blogwatcher/SKILL.md +69 -0
  1616. package/skills/blucli/SKILL.md +47 -0
  1617. package/skills/bluebubbles/SKILL.md +131 -0
  1618. package/skills/camsnap/SKILL.md +45 -0
  1619. package/skills/canvas/SKILL.md +198 -0
  1620. package/skills/clawhub/SKILL.md +77 -0
  1621. package/skills/coding-agent/SKILL.md +284 -0
  1622. package/skills/discord/SKILL.md +578 -0
  1623. package/skills/eightctl/SKILL.md +50 -0
  1624. package/skills/food-order/SKILL.md +48 -0
  1625. package/skills/gemini/SKILL.md +43 -0
  1626. package/skills/ghostly-projects/SKILL.md +160 -0
  1627. package/skills/gifgrep/SKILL.md +79 -0
  1628. package/skills/github/SKILL.md +77 -0
  1629. package/skills/gog/SKILL.md +116 -0
  1630. package/skills/goplaces/SKILL.md +52 -0
  1631. package/skills/healthcheck/SKILL.md +245 -0
  1632. package/skills/himalaya/SKILL.md +257 -0
  1633. package/skills/himalaya/references/configuration.md +184 -0
  1634. package/skills/himalaya/references/message-composition.md +199 -0
  1635. package/skills/imsg/SKILL.md +74 -0
  1636. package/skills/linear/SKILL.md +111 -0
  1637. package/skills/linear/linear.sh +204 -0
  1638. package/skills/local-places/SERVER_README.md +101 -0
  1639. package/skills/local-places/SKILL.md +102 -0
  1640. package/skills/local-places/pyproject.toml +21 -0
  1641. package/skills/local-places/src/local_places/__init__.py +2 -0
  1642. package/skills/local-places/src/local_places/google_places.py +314 -0
  1643. package/skills/local-places/src/local_places/main.py +65 -0
  1644. package/skills/local-places/src/local_places/schemas.py +107 -0
  1645. package/skills/mcporter/SKILL.md +61 -0
  1646. package/skills/model-usage/SKILL.md +69 -0
  1647. package/skills/model-usage/references/codexbar-cli.md +33 -0
  1648. package/skills/model-usage/scripts/model_usage.py +310 -0
  1649. package/skills/nano-banana-pro/SKILL.md +58 -0
  1650. package/skills/nano-banana-pro/scripts/generate_image.py +184 -0
  1651. package/skills/nano-pdf/SKILL.md +38 -0
  1652. package/skills/notion/SKILL.md +172 -0
  1653. package/skills/obsidian/SKILL.md +81 -0
  1654. package/skills/openai-image-gen/SKILL.md +89 -0
  1655. package/skills/openai-image-gen/scripts/gen.py +240 -0
  1656. package/skills/openai-whisper/SKILL.md +38 -0
  1657. package/skills/openai-whisper-api/SKILL.md +52 -0
  1658. package/skills/openai-whisper-api/scripts/transcribe.sh +85 -0
  1659. package/skills/openhue/SKILL.md +51 -0
  1660. package/skills/oracle/SKILL.md +125 -0
  1661. package/skills/ordercli/SKILL.md +78 -0
  1662. package/skills/peekaboo/SKILL.md +190 -0
  1663. package/skills/sag/SKILL.md +87 -0
  1664. package/skills/session-logs/SKILL.md +115 -0
  1665. package/skills/sherpa-onnx-tts/SKILL.md +103 -0
  1666. package/skills/sherpa-onnx-tts/bin/sherpa-onnx-tts +178 -0
  1667. package/skills/skill-creator/SKILL.md +370 -0
  1668. package/skills/skill-creator/license.txt +202 -0
  1669. package/skills/skill-creator/scripts/init_skill.py +378 -0
  1670. package/skills/skill-creator/scripts/package_skill.py +111 -0
  1671. package/skills/skill-creator/scripts/quick_validate.py +101 -0
  1672. package/skills/slack/SKILL.md +144 -0
  1673. package/skills/songsee/SKILL.md +49 -0
  1674. package/skills/sonoscli/SKILL.md +46 -0
  1675. package/skills/spotify-player/SKILL.md +64 -0
  1676. package/skills/summarize/SKILL.md +87 -0
  1677. package/skills/things-mac/SKILL.md +86 -0
  1678. package/skills/tmux/SKILL.md +135 -0
  1679. package/skills/tmux/scripts/find-sessions.sh +112 -0
  1680. package/skills/tmux/scripts/wait-for-text.sh +83 -0
  1681. package/skills/trello/SKILL.md +95 -0
  1682. package/skills/video-frames/SKILL.md +46 -0
  1683. package/skills/video-frames/scripts/frame.sh +81 -0
  1684. package/skills/voice-call/SKILL.md +45 -0
  1685. package/skills/wacli/SKILL.md +72 -0
  1686. package/skills/weather/SKILL.md +54 -0
@@ -0,0 +1,2490 @@
1
+ import type { IncomingMessage, ServerResponse } from "node:http";
2
+ import type { OpenClawConfig } from "openclaw/plugin-sdk";
3
+ import {
4
+ logAckFailure,
5
+ logInboundDrop,
6
+ logTypingFailure,
7
+ resolveAckReaction,
8
+ resolveControlCommandGate,
9
+ } from "openclaw/plugin-sdk";
10
+ import type { ResolvedBlueBubblesAccount } from "./accounts.js";
11
+ import type { BlueBubblesAccountConfig, BlueBubblesAttachment } from "./types.js";
12
+ import { downloadBlueBubblesAttachment } from "./attachments.js";
13
+ import { markBlueBubblesChatRead, sendBlueBubblesTyping } from "./chat.js";
14
+ import { sendBlueBubblesMedia } from "./media-send.js";
15
+ import { fetchBlueBubblesServerInfo } from "./probe.js";
16
+ import { normalizeBlueBubblesReactionInput, sendBlueBubblesReaction } from "./reactions.js";
17
+ import { getBlueBubblesRuntime } from "./runtime.js";
18
+ import { resolveChatGuidForTarget, sendMessageBlueBubbles } from "./send.js";
19
+ import {
20
+ formatBlueBubblesChatTarget,
21
+ isAllowedBlueBubblesSender,
22
+ normalizeBlueBubblesHandle,
23
+ } from "./targets.js";
24
+
25
+ export type BlueBubblesRuntimeEnv = {
26
+ log?: (message: string) => void;
27
+ error?: (message: string) => void;
28
+ };
29
+
30
+ export type BlueBubblesMonitorOptions = {
31
+ account: ResolvedBlueBubblesAccount;
32
+ config: OpenClawConfig;
33
+ runtime: BlueBubblesRuntimeEnv;
34
+ abortSignal: AbortSignal;
35
+ statusSink?: (patch: { lastInboundAt?: number; lastOutboundAt?: number }) => void;
36
+ webhookPath?: string;
37
+ };
38
+
39
+ const DEFAULT_WEBHOOK_PATH = "/bluebubbles-webhook";
40
+ const DEFAULT_TEXT_LIMIT = 4000;
41
+ const invalidAckReactions = new Set<string>();
42
+
43
+ const REPLY_CACHE_MAX = 2000;
44
+ const REPLY_CACHE_TTL_MS = 6 * 60 * 60 * 1000;
45
+
46
+ type BlueBubblesReplyCacheEntry = {
47
+ accountId: string;
48
+ messageId: string;
49
+ shortId: string;
50
+ chatGuid?: string;
51
+ chatIdentifier?: string;
52
+ chatId?: number;
53
+ senderLabel?: string;
54
+ body?: string;
55
+ timestamp: number;
56
+ };
57
+
58
+ // Best-effort cache for resolving reply context when BlueBubbles webhooks omit sender/body.
59
+ const blueBubblesReplyCacheByMessageId = new Map<string, BlueBubblesReplyCacheEntry>();
60
+
61
+ // Bidirectional maps for short ID ↔ message GUID resolution (token savings optimization)
62
+ const blueBubblesShortIdToUuid = new Map<string, string>();
63
+ const blueBubblesUuidToShortId = new Map<string, string>();
64
+ let blueBubblesShortIdCounter = 0;
65
+
66
+ function trimOrUndefined(value?: string | null): string | undefined {
67
+ const trimmed = value?.trim();
68
+ return trimmed ? trimmed : undefined;
69
+ }
70
+
71
+ function generateShortId(): string {
72
+ blueBubblesShortIdCounter += 1;
73
+ return String(blueBubblesShortIdCounter);
74
+ }
75
+
76
+ function rememberBlueBubblesReplyCache(
77
+ entry: Omit<BlueBubblesReplyCacheEntry, "shortId">,
78
+ ): BlueBubblesReplyCacheEntry {
79
+ const messageId = entry.messageId.trim();
80
+ if (!messageId) {
81
+ return { ...entry, shortId: "" };
82
+ }
83
+
84
+ // Check if we already have a short ID for this GUID
85
+ let shortId = blueBubblesUuidToShortId.get(messageId);
86
+ if (!shortId) {
87
+ shortId = generateShortId();
88
+ blueBubblesShortIdToUuid.set(shortId, messageId);
89
+ blueBubblesUuidToShortId.set(messageId, shortId);
90
+ }
91
+
92
+ const fullEntry: BlueBubblesReplyCacheEntry = { ...entry, messageId, shortId };
93
+
94
+ // Refresh insertion order.
95
+ blueBubblesReplyCacheByMessageId.delete(messageId);
96
+ blueBubblesReplyCacheByMessageId.set(messageId, fullEntry);
97
+
98
+ // Opportunistic prune.
99
+ const cutoff = Date.now() - REPLY_CACHE_TTL_MS;
100
+ for (const [key, value] of blueBubblesReplyCacheByMessageId) {
101
+ if (value.timestamp < cutoff) {
102
+ blueBubblesReplyCacheByMessageId.delete(key);
103
+ // Clean up short ID mappings for expired entries
104
+ if (value.shortId) {
105
+ blueBubblesShortIdToUuid.delete(value.shortId);
106
+ blueBubblesUuidToShortId.delete(key);
107
+ }
108
+ continue;
109
+ }
110
+ break;
111
+ }
112
+ while (blueBubblesReplyCacheByMessageId.size > REPLY_CACHE_MAX) {
113
+ const oldest = blueBubblesReplyCacheByMessageId.keys().next().value as string | undefined;
114
+ if (!oldest) {
115
+ break;
116
+ }
117
+ const oldEntry = blueBubblesReplyCacheByMessageId.get(oldest);
118
+ blueBubblesReplyCacheByMessageId.delete(oldest);
119
+ // Clean up short ID mappings for evicted entries
120
+ if (oldEntry?.shortId) {
121
+ blueBubblesShortIdToUuid.delete(oldEntry.shortId);
122
+ blueBubblesUuidToShortId.delete(oldest);
123
+ }
124
+ }
125
+
126
+ return fullEntry;
127
+ }
128
+
129
+ /**
130
+ * Resolves a short message ID (e.g., "1", "2") to a full BlueBubbles GUID.
131
+ * Returns the input unchanged if it's already a GUID or not found in the mapping.
132
+ */
133
+ export function resolveBlueBubblesMessageId(
134
+ shortOrUuid: string,
135
+ opts?: { requireKnownShortId?: boolean },
136
+ ): string {
137
+ const trimmed = shortOrUuid.trim();
138
+ if (!trimmed) {
139
+ return trimmed;
140
+ }
141
+
142
+ // If it looks like a short ID (numeric), try to resolve it
143
+ if (/^\d+$/.test(trimmed)) {
144
+ const uuid = blueBubblesShortIdToUuid.get(trimmed);
145
+ if (uuid) {
146
+ return uuid;
147
+ }
148
+ if (opts?.requireKnownShortId) {
149
+ throw new Error(
150
+ `BlueBubbles short message id "${trimmed}" is no longer available. Use MessageSidFull.`,
151
+ );
152
+ }
153
+ }
154
+
155
+ // Return as-is (either already a UUID or not found)
156
+ return trimmed;
157
+ }
158
+
159
+ /**
160
+ * Resets the short ID state. Only use in tests.
161
+ * @internal
162
+ */
163
+ export function _resetBlueBubblesShortIdState(): void {
164
+ blueBubblesShortIdToUuid.clear();
165
+ blueBubblesUuidToShortId.clear();
166
+ blueBubblesReplyCacheByMessageId.clear();
167
+ blueBubblesShortIdCounter = 0;
168
+ }
169
+
170
+ /**
171
+ * Gets the short ID for a message GUID, if one exists.
172
+ */
173
+ function getShortIdForUuid(uuid: string): string | undefined {
174
+ return blueBubblesUuidToShortId.get(uuid.trim());
175
+ }
176
+
177
+ function resolveReplyContextFromCache(params: {
178
+ accountId: string;
179
+ replyToId: string;
180
+ chatGuid?: string;
181
+ chatIdentifier?: string;
182
+ chatId?: number;
183
+ }): BlueBubblesReplyCacheEntry | null {
184
+ const replyToId = params.replyToId.trim();
185
+ if (!replyToId) {
186
+ return null;
187
+ }
188
+
189
+ const cached = blueBubblesReplyCacheByMessageId.get(replyToId);
190
+ if (!cached) {
191
+ return null;
192
+ }
193
+ if (cached.accountId !== params.accountId) {
194
+ return null;
195
+ }
196
+
197
+ const cutoff = Date.now() - REPLY_CACHE_TTL_MS;
198
+ if (cached.timestamp < cutoff) {
199
+ blueBubblesReplyCacheByMessageId.delete(replyToId);
200
+ return null;
201
+ }
202
+
203
+ const chatGuid = trimOrUndefined(params.chatGuid);
204
+ const chatIdentifier = trimOrUndefined(params.chatIdentifier);
205
+ const cachedChatGuid = trimOrUndefined(cached.chatGuid);
206
+ const cachedChatIdentifier = trimOrUndefined(cached.chatIdentifier);
207
+ const chatId = typeof params.chatId === "number" ? params.chatId : undefined;
208
+ const cachedChatId = typeof cached.chatId === "number" ? cached.chatId : undefined;
209
+
210
+ // Avoid cross-chat collisions if we have identifiers.
211
+ if (chatGuid && cachedChatGuid && chatGuid !== cachedChatGuid) {
212
+ return null;
213
+ }
214
+ if (
215
+ !chatGuid &&
216
+ chatIdentifier &&
217
+ cachedChatIdentifier &&
218
+ chatIdentifier !== cachedChatIdentifier
219
+ ) {
220
+ return null;
221
+ }
222
+ if (!chatGuid && !chatIdentifier && chatId && cachedChatId && chatId !== cachedChatId) {
223
+ return null;
224
+ }
225
+
226
+ return cached;
227
+ }
228
+
229
+ type BlueBubblesCoreRuntime = ReturnType<typeof getBlueBubblesRuntime>;
230
+
231
+ function logVerbose(
232
+ core: BlueBubblesCoreRuntime,
233
+ runtime: BlueBubblesRuntimeEnv,
234
+ message: string,
235
+ ): void {
236
+ if (core.logging.shouldLogVerbose()) {
237
+ runtime.log?.(`[bluebubbles] ${message}`);
238
+ }
239
+ }
240
+
241
+ function logGroupAllowlistHint(params: {
242
+ runtime: BlueBubblesRuntimeEnv;
243
+ reason: string;
244
+ entry: string | null;
245
+ chatName?: string;
246
+ accountId?: string;
247
+ }): void {
248
+ const log = params.runtime.log ?? console.log;
249
+ const nameHint = params.chatName ? ` (group name: ${params.chatName})` : "";
250
+ const accountHint = params.accountId
251
+ ? ` (or channels.bluebubbles.accounts.${params.accountId}.groupAllowFrom)`
252
+ : "";
253
+ if (params.entry) {
254
+ log(
255
+ `[bluebubbles] group message blocked (${params.reason}). Allow this group by adding ` +
256
+ `"${params.entry}" to channels.bluebubbles.groupAllowFrom${nameHint}.`,
257
+ );
258
+ log(
259
+ `[bluebubbles] add to config: channels.bluebubbles.groupAllowFrom=["${params.entry}"]${accountHint}.`,
260
+ );
261
+ return;
262
+ }
263
+ log(
264
+ `[bluebubbles] group message blocked (${params.reason}). Allow groups by setting ` +
265
+ `channels.bluebubbles.groupPolicy="open" or adding a group id to ` +
266
+ `channels.bluebubbles.groupAllowFrom${accountHint}${nameHint}.`,
267
+ );
268
+ }
269
+
270
+ type WebhookTarget = {
271
+ account: ResolvedBlueBubblesAccount;
272
+ config: OpenClawConfig;
273
+ runtime: BlueBubblesRuntimeEnv;
274
+ core: BlueBubblesCoreRuntime;
275
+ path: string;
276
+ statusSink?: (patch: { lastInboundAt?: number; lastOutboundAt?: number }) => void;
277
+ };
278
+
279
+ /**
280
+ * Entry type for debouncing inbound messages.
281
+ * Captures the normalized message and its target for later combined processing.
282
+ */
283
+ type BlueBubblesDebounceEntry = {
284
+ message: NormalizedWebhookMessage;
285
+ target: WebhookTarget;
286
+ };
287
+
288
+ /**
289
+ * Default debounce window for inbound message coalescing (ms).
290
+ * This helps combine URL text + link preview balloon messages that BlueBubbles
291
+ * sends as separate webhook events when no explicit inbound debounce config exists.
292
+ */
293
+ const DEFAULT_INBOUND_DEBOUNCE_MS = 500;
294
+
295
+ /**
296
+ * Combines multiple debounced messages into a single message for processing.
297
+ * Used when multiple webhook events arrive within the debounce window.
298
+ */
299
+ function combineDebounceEntries(entries: BlueBubblesDebounceEntry[]): NormalizedWebhookMessage {
300
+ if (entries.length === 0) {
301
+ throw new Error("Cannot combine empty entries");
302
+ }
303
+ if (entries.length === 1) {
304
+ return entries[0].message;
305
+ }
306
+
307
+ // Use the first message as the base (typically the text message)
308
+ const first = entries[0].message;
309
+
310
+ // Combine text from all entries, filtering out duplicates and empty strings
311
+ const seenTexts = new Set<string>();
312
+ const textParts: string[] = [];
313
+
314
+ for (const entry of entries) {
315
+ const text = entry.message.text.trim();
316
+ if (!text) {
317
+ continue;
318
+ }
319
+ // Skip duplicate text (URL might be in both text message and balloon)
320
+ const normalizedText = text.toLowerCase();
321
+ if (seenTexts.has(normalizedText)) {
322
+ continue;
323
+ }
324
+ seenTexts.add(normalizedText);
325
+ textParts.push(text);
326
+ }
327
+
328
+ // Merge attachments from all entries
329
+ const allAttachments = entries.flatMap((e) => e.message.attachments ?? []);
330
+
331
+ // Use the latest timestamp
332
+ const timestamps = entries
333
+ .map((e) => e.message.timestamp)
334
+ .filter((t): t is number => typeof t === "number");
335
+ const latestTimestamp = timestamps.length > 0 ? Math.max(...timestamps) : first.timestamp;
336
+
337
+ // Collect all message IDs for reference
338
+ const messageIds = entries
339
+ .map((e) => e.message.messageId)
340
+ .filter((id): id is string => Boolean(id));
341
+
342
+ // Prefer reply context from any entry that has it
343
+ const entryWithReply = entries.find((e) => e.message.replyToId);
344
+
345
+ return {
346
+ ...first,
347
+ text: textParts.join(" "),
348
+ attachments: allAttachments.length > 0 ? allAttachments : first.attachments,
349
+ timestamp: latestTimestamp,
350
+ // Use first message's ID as primary (for reply reference), but we've coalesced others
351
+ messageId: messageIds[0] ?? first.messageId,
352
+ // Preserve reply context if present
353
+ replyToId: entryWithReply?.message.replyToId ?? first.replyToId,
354
+ replyToBody: entryWithReply?.message.replyToBody ?? first.replyToBody,
355
+ replyToSender: entryWithReply?.message.replyToSender ?? first.replyToSender,
356
+ // Clear balloonBundleId since we've combined (the combined message is no longer just a balloon)
357
+ balloonBundleId: undefined,
358
+ };
359
+ }
360
+
361
+ const webhookTargets = new Map<string, WebhookTarget[]>();
362
+
363
+ /**
364
+ * Maps webhook targets to their inbound debouncers.
365
+ * Each target gets its own debouncer keyed by a unique identifier.
366
+ */
367
+ const targetDebouncers = new Map<
368
+ WebhookTarget,
369
+ ReturnType<BlueBubblesCoreRuntime["channel"]["debounce"]["createInboundDebouncer"]>
370
+ >();
371
+
372
+ function resolveBlueBubblesDebounceMs(
373
+ config: OpenClawConfig,
374
+ core: BlueBubblesCoreRuntime,
375
+ ): number {
376
+ const inbound = config.messages?.inbound;
377
+ const hasExplicitDebounce =
378
+ typeof inbound?.debounceMs === "number" || typeof inbound?.byChannel?.bluebubbles === "number";
379
+ if (!hasExplicitDebounce) {
380
+ return DEFAULT_INBOUND_DEBOUNCE_MS;
381
+ }
382
+ return core.channel.debounce.resolveInboundDebounceMs({ cfg: config, channel: "bluebubbles" });
383
+ }
384
+
385
+ /**
386
+ * Creates or retrieves a debouncer for a webhook target.
387
+ */
388
+ function getOrCreateDebouncer(target: WebhookTarget) {
389
+ const existing = targetDebouncers.get(target);
390
+ if (existing) {
391
+ return existing;
392
+ }
393
+
394
+ const { account, config, runtime, core } = target;
395
+
396
+ const debouncer = core.channel.debounce.createInboundDebouncer<BlueBubblesDebounceEntry>({
397
+ debounceMs: resolveBlueBubblesDebounceMs(config, core),
398
+ buildKey: (entry) => {
399
+ const msg = entry.message;
400
+ // Prefer stable, shared identifiers to coalesce rapid-fire webhook events for the
401
+ // same message (e.g., text-only then text+attachment).
402
+ //
403
+ // For balloons (URL previews, stickers, etc), BlueBubbles often uses a different
404
+ // messageId than the originating text. When present, key by associatedMessageGuid
405
+ // to keep text + balloon coalescing working.
406
+ const balloonBundleId = msg.balloonBundleId?.trim();
407
+ const associatedMessageGuid = msg.associatedMessageGuid?.trim();
408
+ if (balloonBundleId && associatedMessageGuid) {
409
+ return `bluebubbles:${account.accountId}:balloon:${associatedMessageGuid}`;
410
+ }
411
+
412
+ const messageId = msg.messageId?.trim();
413
+ if (messageId) {
414
+ return `bluebubbles:${account.accountId}:msg:${messageId}`;
415
+ }
416
+
417
+ const chatKey =
418
+ msg.chatGuid?.trim() ??
419
+ msg.chatIdentifier?.trim() ??
420
+ (msg.chatId ? String(msg.chatId) : "dm");
421
+ return `bluebubbles:${account.accountId}:${chatKey}:${msg.senderId}`;
422
+ },
423
+ shouldDebounce: (entry) => {
424
+ const msg = entry.message;
425
+ // Skip debouncing for from-me messages (they're just cached, not processed)
426
+ if (msg.fromMe) {
427
+ return false;
428
+ }
429
+ // Skip debouncing for control commands - process immediately
430
+ if (core.channel.text.hasControlCommand(msg.text, config)) {
431
+ return false;
432
+ }
433
+ // Debounce all other messages to coalesce rapid-fire webhook events
434
+ // (e.g., text+image arriving as separate webhooks for the same messageId)
435
+ return true;
436
+ },
437
+ onFlush: async (entries) => {
438
+ if (entries.length === 0) {
439
+ return;
440
+ }
441
+
442
+ // Use target from first entry (all entries have same target due to key structure)
443
+ const flushTarget = entries[0].target;
444
+
445
+ if (entries.length === 1) {
446
+ // Single message - process normally
447
+ await processMessage(entries[0].message, flushTarget);
448
+ return;
449
+ }
450
+
451
+ // Multiple messages - combine and process
452
+ const combined = combineDebounceEntries(entries);
453
+
454
+ if (core.logging.shouldLogVerbose()) {
455
+ const count = entries.length;
456
+ const preview = combined.text.slice(0, 50);
457
+ runtime.log?.(
458
+ `[bluebubbles] coalesced ${count} messages: "${preview}${combined.text.length > 50 ? "..." : ""}"`,
459
+ );
460
+ }
461
+
462
+ await processMessage(combined, flushTarget);
463
+ },
464
+ onError: (err) => {
465
+ runtime.error?.(`[${account.accountId}] [bluebubbles] debounce flush failed: ${String(err)}`);
466
+ },
467
+ });
468
+
469
+ targetDebouncers.set(target, debouncer);
470
+ return debouncer;
471
+ }
472
+
473
+ /**
474
+ * Removes a debouncer for a target (called during unregistration).
475
+ */
476
+ function removeDebouncer(target: WebhookTarget): void {
477
+ targetDebouncers.delete(target);
478
+ }
479
+
480
+ function normalizeWebhookPath(raw: string): string {
481
+ const trimmed = raw.trim();
482
+ if (!trimmed) {
483
+ return "/";
484
+ }
485
+ const withSlash = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
486
+ if (withSlash.length > 1 && withSlash.endsWith("/")) {
487
+ return withSlash.slice(0, -1);
488
+ }
489
+ return withSlash;
490
+ }
491
+
492
+ export function registerBlueBubblesWebhookTarget(target: WebhookTarget): () => void {
493
+ const key = normalizeWebhookPath(target.path);
494
+ const normalizedTarget = { ...target, path: key };
495
+ const existing = webhookTargets.get(key) ?? [];
496
+ const next = [...existing, normalizedTarget];
497
+ webhookTargets.set(key, next);
498
+ return () => {
499
+ const updated = (webhookTargets.get(key) ?? []).filter((entry) => entry !== normalizedTarget);
500
+ if (updated.length > 0) {
501
+ webhookTargets.set(key, updated);
502
+ } else {
503
+ webhookTargets.delete(key);
504
+ }
505
+ // Clean up debouncer when target is unregistered
506
+ removeDebouncer(normalizedTarget);
507
+ };
508
+ }
509
+
510
+ async function readJsonBody(req: IncomingMessage, maxBytes: number) {
511
+ const chunks: Buffer[] = [];
512
+ let total = 0;
513
+ return await new Promise<{ ok: boolean; value?: unknown; error?: string }>((resolve) => {
514
+ req.on("data", (chunk: Buffer) => {
515
+ total += chunk.length;
516
+ if (total > maxBytes) {
517
+ resolve({ ok: false, error: "payload too large" });
518
+ req.destroy();
519
+ return;
520
+ }
521
+ chunks.push(chunk);
522
+ });
523
+ req.on("end", () => {
524
+ try {
525
+ const raw = Buffer.concat(chunks).toString("utf8");
526
+ if (!raw.trim()) {
527
+ resolve({ ok: false, error: "empty payload" });
528
+ return;
529
+ }
530
+ try {
531
+ resolve({ ok: true, value: JSON.parse(raw) as unknown });
532
+ return;
533
+ } catch {
534
+ const params = new URLSearchParams(raw);
535
+ const payload = params.get("payload") ?? params.get("data") ?? params.get("message");
536
+ if (payload) {
537
+ resolve({ ok: true, value: JSON.parse(payload) as unknown });
538
+ return;
539
+ }
540
+ throw new Error("invalid json");
541
+ }
542
+ } catch (err) {
543
+ resolve({ ok: false, error: err instanceof Error ? err.message : String(err) });
544
+ }
545
+ });
546
+ req.on("error", (err) => {
547
+ resolve({ ok: false, error: err instanceof Error ? err.message : String(err) });
548
+ });
549
+ });
550
+ }
551
+
552
+ function asRecord(value: unknown): Record<string, unknown> | null {
553
+ return value && typeof value === "object" && !Array.isArray(value)
554
+ ? (value as Record<string, unknown>)
555
+ : null;
556
+ }
557
+
558
+ function readString(record: Record<string, unknown> | null, key: string): string | undefined {
559
+ if (!record) {
560
+ return undefined;
561
+ }
562
+ const value = record[key];
563
+ return typeof value === "string" ? value : undefined;
564
+ }
565
+
566
+ function readNumber(record: Record<string, unknown> | null, key: string): number | undefined {
567
+ if (!record) {
568
+ return undefined;
569
+ }
570
+ const value = record[key];
571
+ return typeof value === "number" && Number.isFinite(value) ? value : undefined;
572
+ }
573
+
574
+ function readBoolean(record: Record<string, unknown> | null, key: string): boolean | undefined {
575
+ if (!record) {
576
+ return undefined;
577
+ }
578
+ const value = record[key];
579
+ return typeof value === "boolean" ? value : undefined;
580
+ }
581
+
582
+ function extractAttachments(message: Record<string, unknown>): BlueBubblesAttachment[] {
583
+ const raw = message["attachments"];
584
+ if (!Array.isArray(raw)) {
585
+ return [];
586
+ }
587
+ const out: BlueBubblesAttachment[] = [];
588
+ for (const entry of raw) {
589
+ const record = asRecord(entry);
590
+ if (!record) {
591
+ continue;
592
+ }
593
+ out.push({
594
+ guid: readString(record, "guid"),
595
+ uti: readString(record, "uti"),
596
+ mimeType: readString(record, "mimeType") ?? readString(record, "mime_type"),
597
+ transferName: readString(record, "transferName") ?? readString(record, "transfer_name"),
598
+ totalBytes: readNumberLike(record, "totalBytes") ?? readNumberLike(record, "total_bytes"),
599
+ height: readNumberLike(record, "height"),
600
+ width: readNumberLike(record, "width"),
601
+ originalROWID: readNumberLike(record, "originalROWID") ?? readNumberLike(record, "rowid"),
602
+ });
603
+ }
604
+ return out;
605
+ }
606
+
607
+ function buildAttachmentPlaceholder(attachments: BlueBubblesAttachment[]): string {
608
+ if (attachments.length === 0) {
609
+ return "";
610
+ }
611
+ const mimeTypes = attachments.map((entry) => entry.mimeType ?? "");
612
+ const allImages = mimeTypes.every((entry) => entry.startsWith("image/"));
613
+ const allVideos = mimeTypes.every((entry) => entry.startsWith("video/"));
614
+ const allAudio = mimeTypes.every((entry) => entry.startsWith("audio/"));
615
+ const tag = allImages
616
+ ? "<media:image>"
617
+ : allVideos
618
+ ? "<media:video>"
619
+ : allAudio
620
+ ? "<media:audio>"
621
+ : "<media:attachment>";
622
+ const label = allImages ? "image" : allVideos ? "video" : allAudio ? "audio" : "file";
623
+ const suffix = attachments.length === 1 ? label : `${label}s`;
624
+ return `${tag} (${attachments.length} ${suffix})`;
625
+ }
626
+
627
+ function buildMessagePlaceholder(message: NormalizedWebhookMessage): string {
628
+ const attachmentPlaceholder = buildAttachmentPlaceholder(message.attachments ?? []);
629
+ if (attachmentPlaceholder) {
630
+ return attachmentPlaceholder;
631
+ }
632
+ if (message.balloonBundleId) {
633
+ return "<media:sticker>";
634
+ }
635
+ return "";
636
+ }
637
+
638
+ // Returns inline reply tag like "[[reply_to:4]]" for prepending to message body
639
+ function formatReplyTag(message: { replyToId?: string; replyToShortId?: string }): string | null {
640
+ // Prefer short ID
641
+ const rawId = message.replyToShortId || message.replyToId;
642
+ if (!rawId) {
643
+ return null;
644
+ }
645
+ return `[[reply_to:${rawId}]]`;
646
+ }
647
+
648
+ function readNumberLike(record: Record<string, unknown> | null, key: string): number | undefined {
649
+ if (!record) {
650
+ return undefined;
651
+ }
652
+ const value = record[key];
653
+ if (typeof value === "number" && Number.isFinite(value)) {
654
+ return value;
655
+ }
656
+ if (typeof value === "string") {
657
+ const parsed = Number.parseFloat(value);
658
+ if (Number.isFinite(parsed)) {
659
+ return parsed;
660
+ }
661
+ }
662
+ return undefined;
663
+ }
664
+
665
+ function extractReplyMetadata(message: Record<string, unknown>): {
666
+ replyToId?: string;
667
+ replyToBody?: string;
668
+ replyToSender?: string;
669
+ } {
670
+ const replyRaw =
671
+ message["replyTo"] ??
672
+ message["reply_to"] ??
673
+ message["replyToMessage"] ??
674
+ message["reply_to_message"] ??
675
+ message["repliedMessage"] ??
676
+ message["quotedMessage"] ??
677
+ message["associatedMessage"] ??
678
+ message["reply"];
679
+ const replyRecord = asRecord(replyRaw);
680
+ const replyHandle =
681
+ asRecord(replyRecord?.["handle"]) ?? asRecord(replyRecord?.["sender"]) ?? null;
682
+ const replySenderRaw =
683
+ readString(replyHandle, "address") ??
684
+ readString(replyHandle, "handle") ??
685
+ readString(replyHandle, "id") ??
686
+ readString(replyRecord, "senderId") ??
687
+ readString(replyRecord, "sender") ??
688
+ readString(replyRecord, "from");
689
+ const normalizedSender = replySenderRaw
690
+ ? normalizeBlueBubblesHandle(replySenderRaw) || replySenderRaw.trim()
691
+ : undefined;
692
+
693
+ const replyToBody =
694
+ readString(replyRecord, "text") ??
695
+ readString(replyRecord, "body") ??
696
+ readString(replyRecord, "message") ??
697
+ readString(replyRecord, "subject") ??
698
+ undefined;
699
+
700
+ const directReplyId =
701
+ readString(message, "replyToMessageGuid") ??
702
+ readString(message, "replyToGuid") ??
703
+ readString(message, "replyGuid") ??
704
+ readString(message, "selectedMessageGuid") ??
705
+ readString(message, "selectedMessageId") ??
706
+ readString(message, "replyToMessageId") ??
707
+ readString(message, "replyId") ??
708
+ readString(replyRecord, "guid") ??
709
+ readString(replyRecord, "id") ??
710
+ readString(replyRecord, "messageId");
711
+
712
+ const associatedType =
713
+ readNumberLike(message, "associatedMessageType") ??
714
+ readNumberLike(message, "associated_message_type");
715
+ const associatedGuid =
716
+ readString(message, "associatedMessageGuid") ??
717
+ readString(message, "associated_message_guid") ??
718
+ readString(message, "associatedMessageId");
719
+ const isReactionAssociation =
720
+ typeof associatedType === "number" && REACTION_TYPE_MAP.has(associatedType);
721
+
722
+ const replyToId = directReplyId ?? (!isReactionAssociation ? associatedGuid : undefined);
723
+ const threadOriginatorGuid = readString(message, "threadOriginatorGuid");
724
+ const messageGuid = readString(message, "guid");
725
+ const fallbackReplyId =
726
+ !replyToId && threadOriginatorGuid && threadOriginatorGuid !== messageGuid
727
+ ? threadOriginatorGuid
728
+ : undefined;
729
+
730
+ return {
731
+ replyToId: (replyToId ?? fallbackReplyId)?.trim() || undefined,
732
+ replyToBody: replyToBody?.trim() || undefined,
733
+ replyToSender: normalizedSender || undefined,
734
+ };
735
+ }
736
+
737
+ function readFirstChatRecord(message: Record<string, unknown>): Record<string, unknown> | null {
738
+ const chats = message["chats"];
739
+ if (!Array.isArray(chats) || chats.length === 0) {
740
+ return null;
741
+ }
742
+ const first = chats[0];
743
+ return asRecord(first);
744
+ }
745
+
746
+ function normalizeParticipantEntry(entry: unknown): BlueBubblesParticipant | null {
747
+ if (typeof entry === "string" || typeof entry === "number") {
748
+ const raw = String(entry).trim();
749
+ if (!raw) {
750
+ return null;
751
+ }
752
+ const normalized = normalizeBlueBubblesHandle(raw) || raw;
753
+ return normalized ? { id: normalized } : null;
754
+ }
755
+ const record = asRecord(entry);
756
+ if (!record) {
757
+ return null;
758
+ }
759
+ const nestedHandle =
760
+ asRecord(record["handle"]) ?? asRecord(record["sender"]) ?? asRecord(record["contact"]) ?? null;
761
+ const idRaw =
762
+ readString(record, "address") ??
763
+ readString(record, "handle") ??
764
+ readString(record, "id") ??
765
+ readString(record, "phoneNumber") ??
766
+ readString(record, "phone_number") ??
767
+ readString(record, "email") ??
768
+ readString(nestedHandle, "address") ??
769
+ readString(nestedHandle, "handle") ??
770
+ readString(nestedHandle, "id");
771
+ const nameRaw =
772
+ readString(record, "displayName") ??
773
+ readString(record, "name") ??
774
+ readString(record, "title") ??
775
+ readString(nestedHandle, "displayName") ??
776
+ readString(nestedHandle, "name");
777
+ const normalizedId = idRaw ? normalizeBlueBubblesHandle(idRaw) || idRaw.trim() : "";
778
+ if (!normalizedId) {
779
+ return null;
780
+ }
781
+ const name = nameRaw?.trim() || undefined;
782
+ return { id: normalizedId, name };
783
+ }
784
+
785
+ function normalizeParticipantList(raw: unknown): BlueBubblesParticipant[] {
786
+ if (!Array.isArray(raw) || raw.length === 0) {
787
+ return [];
788
+ }
789
+ const seen = new Set<string>();
790
+ const output: BlueBubblesParticipant[] = [];
791
+ for (const entry of raw) {
792
+ const normalized = normalizeParticipantEntry(entry);
793
+ if (!normalized?.id) {
794
+ continue;
795
+ }
796
+ const key = normalized.id.toLowerCase();
797
+ if (seen.has(key)) {
798
+ continue;
799
+ }
800
+ seen.add(key);
801
+ output.push(normalized);
802
+ }
803
+ return output;
804
+ }
805
+
806
+ function formatGroupMembers(params: {
807
+ participants?: BlueBubblesParticipant[];
808
+ fallback?: BlueBubblesParticipant;
809
+ }): string | undefined {
810
+ const seen = new Set<string>();
811
+ const ordered: BlueBubblesParticipant[] = [];
812
+ for (const entry of params.participants ?? []) {
813
+ if (!entry?.id) {
814
+ continue;
815
+ }
816
+ const key = entry.id.toLowerCase();
817
+ if (seen.has(key)) {
818
+ continue;
819
+ }
820
+ seen.add(key);
821
+ ordered.push(entry);
822
+ }
823
+ if (ordered.length === 0 && params.fallback?.id) {
824
+ ordered.push(params.fallback);
825
+ }
826
+ if (ordered.length === 0) {
827
+ return undefined;
828
+ }
829
+ return ordered.map((entry) => (entry.name ? `${entry.name} (${entry.id})` : entry.id)).join(", ");
830
+ }
831
+
832
+ function resolveGroupFlagFromChatGuid(chatGuid?: string | null): boolean | undefined {
833
+ const guid = chatGuid?.trim();
834
+ if (!guid) {
835
+ return undefined;
836
+ }
837
+ const parts = guid.split(";");
838
+ if (parts.length >= 3) {
839
+ if (parts[1] === "+") {
840
+ return true;
841
+ }
842
+ if (parts[1] === "-") {
843
+ return false;
844
+ }
845
+ }
846
+ if (guid.includes(";+;")) {
847
+ return true;
848
+ }
849
+ if (guid.includes(";-;")) {
850
+ return false;
851
+ }
852
+ return undefined;
853
+ }
854
+
855
+ function extractChatIdentifierFromChatGuid(chatGuid?: string | null): string | undefined {
856
+ const guid = chatGuid?.trim();
857
+ if (!guid) {
858
+ return undefined;
859
+ }
860
+ const parts = guid.split(";");
861
+ if (parts.length < 3) {
862
+ return undefined;
863
+ }
864
+ const identifier = parts[2]?.trim();
865
+ return identifier || undefined;
866
+ }
867
+
868
+ function formatGroupAllowlistEntry(params: {
869
+ chatGuid?: string;
870
+ chatId?: number;
871
+ chatIdentifier?: string;
872
+ }): string | null {
873
+ const guid = params.chatGuid?.trim();
874
+ if (guid) {
875
+ return `chat_guid:${guid}`;
876
+ }
877
+ const chatId = params.chatId;
878
+ if (typeof chatId === "number" && Number.isFinite(chatId)) {
879
+ return `chat_id:${chatId}`;
880
+ }
881
+ const identifier = params.chatIdentifier?.trim();
882
+ if (identifier) {
883
+ return `chat_identifier:${identifier}`;
884
+ }
885
+ return null;
886
+ }
887
+
888
+ type BlueBubblesParticipant = {
889
+ id: string;
890
+ name?: string;
891
+ };
892
+
893
+ type NormalizedWebhookMessage = {
894
+ text: string;
895
+ senderId: string;
896
+ senderName?: string;
897
+ messageId?: string;
898
+ timestamp?: number;
899
+ isGroup: boolean;
900
+ chatId?: number;
901
+ chatGuid?: string;
902
+ chatIdentifier?: string;
903
+ chatName?: string;
904
+ fromMe?: boolean;
905
+ attachments?: BlueBubblesAttachment[];
906
+ balloonBundleId?: string;
907
+ associatedMessageGuid?: string;
908
+ associatedMessageType?: number;
909
+ associatedMessageEmoji?: string;
910
+ isTapback?: boolean;
911
+ participants?: BlueBubblesParticipant[];
912
+ replyToId?: string;
913
+ replyToBody?: string;
914
+ replyToSender?: string;
915
+ };
916
+
917
+ type NormalizedWebhookReaction = {
918
+ action: "added" | "removed";
919
+ emoji: string;
920
+ senderId: string;
921
+ senderName?: string;
922
+ messageId: string;
923
+ timestamp?: number;
924
+ isGroup: boolean;
925
+ chatId?: number;
926
+ chatGuid?: string;
927
+ chatIdentifier?: string;
928
+ chatName?: string;
929
+ fromMe?: boolean;
930
+ };
931
+
932
+ const REACTION_TYPE_MAP = new Map<number, { emoji: string; action: "added" | "removed" }>([
933
+ [2000, { emoji: "❤️", action: "added" }],
934
+ [2001, { emoji: "👍", action: "added" }],
935
+ [2002, { emoji: "👎", action: "added" }],
936
+ [2003, { emoji: "😂", action: "added" }],
937
+ [2004, { emoji: "‼️", action: "added" }],
938
+ [2005, { emoji: "❓", action: "added" }],
939
+ [3000, { emoji: "❤️", action: "removed" }],
940
+ [3001, { emoji: "👍", action: "removed" }],
941
+ [3002, { emoji: "👎", action: "removed" }],
942
+ [3003, { emoji: "😂", action: "removed" }],
943
+ [3004, { emoji: "‼️", action: "removed" }],
944
+ [3005, { emoji: "❓", action: "removed" }],
945
+ ]);
946
+
947
+ // Maps tapback text patterns (e.g., "Loved", "Liked") to emoji + action
948
+ const TAPBACK_TEXT_MAP = new Map<string, { emoji: string; action: "added" | "removed" }>([
949
+ ["loved", { emoji: "❤️", action: "added" }],
950
+ ["liked", { emoji: "👍", action: "added" }],
951
+ ["disliked", { emoji: "👎", action: "added" }],
952
+ ["laughed at", { emoji: "😂", action: "added" }],
953
+ ["emphasized", { emoji: "‼️", action: "added" }],
954
+ ["questioned", { emoji: "❓", action: "added" }],
955
+ // Removal patterns (e.g., "Removed a heart from")
956
+ ["removed a heart from", { emoji: "❤️", action: "removed" }],
957
+ ["removed a like from", { emoji: "👍", action: "removed" }],
958
+ ["removed a dislike from", { emoji: "👎", action: "removed" }],
959
+ ["removed a laugh from", { emoji: "😂", action: "removed" }],
960
+ ["removed an emphasis from", { emoji: "‼️", action: "removed" }],
961
+ ["removed a question from", { emoji: "❓", action: "removed" }],
962
+ ]);
963
+
964
+ const TAPBACK_EMOJI_REGEX =
965
+ /(?:\p{Regional_Indicator}{2})|(?:[0-9#*]\uFE0F?\u20E3)|(?:\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?(?:\p{Emoji_Modifier})?(?:\u200D\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?(?:\p{Emoji_Modifier})?)*)/u;
966
+
967
+ function extractFirstEmoji(text: string): string | null {
968
+ const match = text.match(TAPBACK_EMOJI_REGEX);
969
+ return match ? match[0] : null;
970
+ }
971
+
972
+ function extractQuotedTapbackText(text: string): string | null {
973
+ const match = text.match(/[“"]([^”"]+)[”"]/s);
974
+ return match ? match[1] : null;
975
+ }
976
+
977
+ function isTapbackAssociatedType(type: number | undefined): boolean {
978
+ return typeof type === "number" && Number.isFinite(type) && type >= 2000 && type < 4000;
979
+ }
980
+
981
+ function resolveTapbackActionHint(type: number | undefined): "added" | "removed" | undefined {
982
+ if (typeof type !== "number" || !Number.isFinite(type)) {
983
+ return undefined;
984
+ }
985
+ if (type >= 3000 && type < 4000) {
986
+ return "removed";
987
+ }
988
+ if (type >= 2000 && type < 3000) {
989
+ return "added";
990
+ }
991
+ return undefined;
992
+ }
993
+
994
+ function resolveTapbackContext(message: NormalizedWebhookMessage): {
995
+ emojiHint?: string;
996
+ actionHint?: "added" | "removed";
997
+ replyToId?: string;
998
+ } | null {
999
+ const associatedType = message.associatedMessageType;
1000
+ const hasTapbackType = isTapbackAssociatedType(associatedType);
1001
+ const hasTapbackMarker = Boolean(message.associatedMessageEmoji) || Boolean(message.isTapback);
1002
+ if (!hasTapbackType && !hasTapbackMarker) {
1003
+ return null;
1004
+ }
1005
+ const replyToId = message.associatedMessageGuid?.trim() || message.replyToId?.trim() || undefined;
1006
+ const actionHint = resolveTapbackActionHint(associatedType);
1007
+ const emojiHint =
1008
+ message.associatedMessageEmoji?.trim() || REACTION_TYPE_MAP.get(associatedType ?? -1)?.emoji;
1009
+ return { emojiHint, actionHint, replyToId };
1010
+ }
1011
+
1012
+ // Detects tapback text patterns like 'Loved "message"' and converts to structured format
1013
+ function parseTapbackText(params: {
1014
+ text: string;
1015
+ emojiHint?: string;
1016
+ actionHint?: "added" | "removed";
1017
+ requireQuoted?: boolean;
1018
+ }): {
1019
+ emoji: string;
1020
+ action: "added" | "removed";
1021
+ quotedText: string;
1022
+ } | null {
1023
+ const trimmed = params.text.trim();
1024
+ const lower = trimmed.toLowerCase();
1025
+ if (!trimmed) {
1026
+ return null;
1027
+ }
1028
+
1029
+ for (const [pattern, { emoji, action }] of TAPBACK_TEXT_MAP) {
1030
+ if (lower.startsWith(pattern)) {
1031
+ // Extract quoted text if present (e.g., 'Loved "hello"' -> "hello")
1032
+ const afterPattern = trimmed.slice(pattern.length).trim();
1033
+ if (params.requireQuoted) {
1034
+ const strictMatch = afterPattern.match(/^[“"](.+)[”"]$/s);
1035
+ if (!strictMatch) {
1036
+ return null;
1037
+ }
1038
+ return { emoji, action, quotedText: strictMatch[1] };
1039
+ }
1040
+ const quotedText =
1041
+ extractQuotedTapbackText(afterPattern) ?? extractQuotedTapbackText(trimmed) ?? afterPattern;
1042
+ return { emoji, action, quotedText };
1043
+ }
1044
+ }
1045
+
1046
+ if (lower.startsWith("reacted")) {
1047
+ const emoji = extractFirstEmoji(trimmed) ?? params.emojiHint;
1048
+ if (!emoji) {
1049
+ return null;
1050
+ }
1051
+ const quotedText = extractQuotedTapbackText(trimmed);
1052
+ if (params.requireQuoted && !quotedText) {
1053
+ return null;
1054
+ }
1055
+ const fallback = trimmed.slice("reacted".length).trim();
1056
+ return { emoji, action: params.actionHint ?? "added", quotedText: quotedText ?? fallback };
1057
+ }
1058
+
1059
+ if (lower.startsWith("removed")) {
1060
+ const emoji = extractFirstEmoji(trimmed) ?? params.emojiHint;
1061
+ if (!emoji) {
1062
+ return null;
1063
+ }
1064
+ const quotedText = extractQuotedTapbackText(trimmed);
1065
+ if (params.requireQuoted && !quotedText) {
1066
+ return null;
1067
+ }
1068
+ const fallback = trimmed.slice("removed".length).trim();
1069
+ return { emoji, action: params.actionHint ?? "removed", quotedText: quotedText ?? fallback };
1070
+ }
1071
+ return null;
1072
+ }
1073
+
1074
+ function maskSecret(value: string): string {
1075
+ if (value.length <= 6) {
1076
+ return "***";
1077
+ }
1078
+ return `${value.slice(0, 2)}***${value.slice(-2)}`;
1079
+ }
1080
+
1081
+ function resolveBlueBubblesAckReaction(params: {
1082
+ cfg: OpenClawConfig;
1083
+ agentId: string;
1084
+ core: BlueBubblesCoreRuntime;
1085
+ runtime: BlueBubblesRuntimeEnv;
1086
+ }): string | null {
1087
+ const raw = resolveAckReaction(params.cfg, params.agentId).trim();
1088
+ if (!raw) {
1089
+ return null;
1090
+ }
1091
+ try {
1092
+ normalizeBlueBubblesReactionInput(raw);
1093
+ return raw;
1094
+ } catch {
1095
+ const key = raw.toLowerCase();
1096
+ if (!invalidAckReactions.has(key)) {
1097
+ invalidAckReactions.add(key);
1098
+ logVerbose(
1099
+ params.core,
1100
+ params.runtime,
1101
+ `ack reaction skipped (unsupported for BlueBubbles): ${raw}`,
1102
+ );
1103
+ }
1104
+ return null;
1105
+ }
1106
+ }
1107
+
1108
+ function extractMessagePayload(payload: Record<string, unknown>): Record<string, unknown> | null {
1109
+ const dataRaw = payload.data ?? payload.payload ?? payload.event;
1110
+ const data =
1111
+ asRecord(dataRaw) ??
1112
+ (typeof dataRaw === "string" ? (asRecord(JSON.parse(dataRaw)) ?? null) : null);
1113
+ const messageRaw = payload.message ?? data?.message ?? data;
1114
+ const message =
1115
+ asRecord(messageRaw) ??
1116
+ (typeof messageRaw === "string" ? (asRecord(JSON.parse(messageRaw)) ?? null) : null);
1117
+ if (!message) {
1118
+ return null;
1119
+ }
1120
+ return message;
1121
+ }
1122
+
1123
+ function normalizeWebhookMessage(
1124
+ payload: Record<string, unknown>,
1125
+ ): NormalizedWebhookMessage | null {
1126
+ const message = extractMessagePayload(payload);
1127
+ if (!message) {
1128
+ return null;
1129
+ }
1130
+
1131
+ const text =
1132
+ readString(message, "text") ??
1133
+ readString(message, "body") ??
1134
+ readString(message, "subject") ??
1135
+ "";
1136
+
1137
+ const handleValue = message.handle ?? message.sender;
1138
+ const handle =
1139
+ asRecord(handleValue) ?? (typeof handleValue === "string" ? { address: handleValue } : null);
1140
+ const senderId =
1141
+ readString(handle, "address") ??
1142
+ readString(handle, "handle") ??
1143
+ readString(handle, "id") ??
1144
+ readString(message, "senderId") ??
1145
+ readString(message, "sender") ??
1146
+ readString(message, "from") ??
1147
+ "";
1148
+
1149
+ const senderName =
1150
+ readString(handle, "displayName") ??
1151
+ readString(handle, "name") ??
1152
+ readString(message, "senderName") ??
1153
+ undefined;
1154
+
1155
+ const chat = asRecord(message.chat) ?? asRecord(message.conversation) ?? null;
1156
+ const chatFromList = readFirstChatRecord(message);
1157
+ const chatGuid =
1158
+ readString(message, "chatGuid") ??
1159
+ readString(message, "chat_guid") ??
1160
+ readString(chat, "chatGuid") ??
1161
+ readString(chat, "chat_guid") ??
1162
+ readString(chat, "guid") ??
1163
+ readString(chatFromList, "chatGuid") ??
1164
+ readString(chatFromList, "chat_guid") ??
1165
+ readString(chatFromList, "guid");
1166
+ const chatIdentifier =
1167
+ readString(message, "chatIdentifier") ??
1168
+ readString(message, "chat_identifier") ??
1169
+ readString(chat, "chatIdentifier") ??
1170
+ readString(chat, "chat_identifier") ??
1171
+ readString(chat, "identifier") ??
1172
+ readString(chatFromList, "chatIdentifier") ??
1173
+ readString(chatFromList, "chat_identifier") ??
1174
+ readString(chatFromList, "identifier") ??
1175
+ extractChatIdentifierFromChatGuid(chatGuid);
1176
+ const chatId =
1177
+ readNumberLike(message, "chatId") ??
1178
+ readNumberLike(message, "chat_id") ??
1179
+ readNumberLike(chat, "chatId") ??
1180
+ readNumberLike(chat, "chat_id") ??
1181
+ readNumberLike(chat, "id") ??
1182
+ readNumberLike(chatFromList, "chatId") ??
1183
+ readNumberLike(chatFromList, "chat_id") ??
1184
+ readNumberLike(chatFromList, "id");
1185
+ const chatName =
1186
+ readString(message, "chatName") ??
1187
+ readString(chat, "displayName") ??
1188
+ readString(chat, "name") ??
1189
+ readString(chatFromList, "displayName") ??
1190
+ readString(chatFromList, "name") ??
1191
+ undefined;
1192
+
1193
+ const chatParticipants = chat ? chat["participants"] : undefined;
1194
+ const messageParticipants = message["participants"];
1195
+ const chatsParticipants = chatFromList ? chatFromList["participants"] : undefined;
1196
+ const participants = Array.isArray(chatParticipants)
1197
+ ? chatParticipants
1198
+ : Array.isArray(messageParticipants)
1199
+ ? messageParticipants
1200
+ : Array.isArray(chatsParticipants)
1201
+ ? chatsParticipants
1202
+ : [];
1203
+ const normalizedParticipants = normalizeParticipantList(participants);
1204
+ const participantsCount = participants.length;
1205
+ const groupFromChatGuid = resolveGroupFlagFromChatGuid(chatGuid);
1206
+ const explicitIsGroup =
1207
+ readBoolean(message, "isGroup") ??
1208
+ readBoolean(message, "is_group") ??
1209
+ readBoolean(chat, "isGroup") ??
1210
+ readBoolean(message, "group");
1211
+ const isGroup =
1212
+ typeof groupFromChatGuid === "boolean"
1213
+ ? groupFromChatGuid
1214
+ : (explicitIsGroup ?? participantsCount > 2);
1215
+
1216
+ const fromMe = readBoolean(message, "isFromMe") ?? readBoolean(message, "is_from_me");
1217
+ const messageId =
1218
+ readString(message, "guid") ??
1219
+ readString(message, "id") ??
1220
+ readString(message, "messageId") ??
1221
+ undefined;
1222
+ const balloonBundleId = readString(message, "balloonBundleId");
1223
+ const associatedMessageGuid =
1224
+ readString(message, "associatedMessageGuid") ??
1225
+ readString(message, "associated_message_guid") ??
1226
+ readString(message, "associatedMessageId") ??
1227
+ undefined;
1228
+ const associatedMessageType =
1229
+ readNumberLike(message, "associatedMessageType") ??
1230
+ readNumberLike(message, "associated_message_type");
1231
+ const associatedMessageEmoji =
1232
+ readString(message, "associatedMessageEmoji") ??
1233
+ readString(message, "associated_message_emoji") ??
1234
+ readString(message, "reactionEmoji") ??
1235
+ readString(message, "reaction_emoji") ??
1236
+ undefined;
1237
+ const isTapback =
1238
+ readBoolean(message, "isTapback") ??
1239
+ readBoolean(message, "is_tapback") ??
1240
+ readBoolean(message, "tapback") ??
1241
+ undefined;
1242
+
1243
+ const timestampRaw =
1244
+ readNumber(message, "date") ??
1245
+ readNumber(message, "dateCreated") ??
1246
+ readNumber(message, "timestamp");
1247
+ const timestamp =
1248
+ typeof timestampRaw === "number"
1249
+ ? timestampRaw > 1_000_000_000_000
1250
+ ? timestampRaw
1251
+ : timestampRaw * 1000
1252
+ : undefined;
1253
+
1254
+ const normalizedSender = normalizeBlueBubblesHandle(senderId);
1255
+ if (!normalizedSender) {
1256
+ return null;
1257
+ }
1258
+ const replyMetadata = extractReplyMetadata(message);
1259
+
1260
+ return {
1261
+ text,
1262
+ senderId: normalizedSender,
1263
+ senderName,
1264
+ messageId,
1265
+ timestamp,
1266
+ isGroup,
1267
+ chatId,
1268
+ chatGuid,
1269
+ chatIdentifier,
1270
+ chatName,
1271
+ fromMe,
1272
+ attachments: extractAttachments(message),
1273
+ balloonBundleId,
1274
+ associatedMessageGuid,
1275
+ associatedMessageType,
1276
+ associatedMessageEmoji,
1277
+ isTapback,
1278
+ participants: normalizedParticipants,
1279
+ replyToId: replyMetadata.replyToId,
1280
+ replyToBody: replyMetadata.replyToBody,
1281
+ replyToSender: replyMetadata.replyToSender,
1282
+ };
1283
+ }
1284
+
1285
+ function normalizeWebhookReaction(
1286
+ payload: Record<string, unknown>,
1287
+ ): NormalizedWebhookReaction | null {
1288
+ const message = extractMessagePayload(payload);
1289
+ if (!message) {
1290
+ return null;
1291
+ }
1292
+
1293
+ const associatedGuid =
1294
+ readString(message, "associatedMessageGuid") ??
1295
+ readString(message, "associated_message_guid") ??
1296
+ readString(message, "associatedMessageId");
1297
+ const associatedType =
1298
+ readNumberLike(message, "associatedMessageType") ??
1299
+ readNumberLike(message, "associated_message_type");
1300
+ if (!associatedGuid || associatedType === undefined) {
1301
+ return null;
1302
+ }
1303
+
1304
+ const mapping = REACTION_TYPE_MAP.get(associatedType);
1305
+ const associatedEmoji =
1306
+ readString(message, "associatedMessageEmoji") ??
1307
+ readString(message, "associated_message_emoji") ??
1308
+ readString(message, "reactionEmoji") ??
1309
+ readString(message, "reaction_emoji");
1310
+ const emoji = (associatedEmoji?.trim() || mapping?.emoji) ?? `reaction:${associatedType}`;
1311
+ const action = mapping?.action ?? resolveTapbackActionHint(associatedType) ?? "added";
1312
+
1313
+ const handleValue = message.handle ?? message.sender;
1314
+ const handle =
1315
+ asRecord(handleValue) ?? (typeof handleValue === "string" ? { address: handleValue } : null);
1316
+ const senderId =
1317
+ readString(handle, "address") ??
1318
+ readString(handle, "handle") ??
1319
+ readString(handle, "id") ??
1320
+ readString(message, "senderId") ??
1321
+ readString(message, "sender") ??
1322
+ readString(message, "from") ??
1323
+ "";
1324
+ const senderName =
1325
+ readString(handle, "displayName") ??
1326
+ readString(handle, "name") ??
1327
+ readString(message, "senderName") ??
1328
+ undefined;
1329
+
1330
+ const chat = asRecord(message.chat) ?? asRecord(message.conversation) ?? null;
1331
+ const chatFromList = readFirstChatRecord(message);
1332
+ const chatGuid =
1333
+ readString(message, "chatGuid") ??
1334
+ readString(message, "chat_guid") ??
1335
+ readString(chat, "chatGuid") ??
1336
+ readString(chat, "chat_guid") ??
1337
+ readString(chat, "guid") ??
1338
+ readString(chatFromList, "chatGuid") ??
1339
+ readString(chatFromList, "chat_guid") ??
1340
+ readString(chatFromList, "guid");
1341
+ const chatIdentifier =
1342
+ readString(message, "chatIdentifier") ??
1343
+ readString(message, "chat_identifier") ??
1344
+ readString(chat, "chatIdentifier") ??
1345
+ readString(chat, "chat_identifier") ??
1346
+ readString(chat, "identifier") ??
1347
+ readString(chatFromList, "chatIdentifier") ??
1348
+ readString(chatFromList, "chat_identifier") ??
1349
+ readString(chatFromList, "identifier") ??
1350
+ extractChatIdentifierFromChatGuid(chatGuid);
1351
+ const chatId =
1352
+ readNumberLike(message, "chatId") ??
1353
+ readNumberLike(message, "chat_id") ??
1354
+ readNumberLike(chat, "chatId") ??
1355
+ readNumberLike(chat, "chat_id") ??
1356
+ readNumberLike(chat, "id") ??
1357
+ readNumberLike(chatFromList, "chatId") ??
1358
+ readNumberLike(chatFromList, "chat_id") ??
1359
+ readNumberLike(chatFromList, "id");
1360
+ const chatName =
1361
+ readString(message, "chatName") ??
1362
+ readString(chat, "displayName") ??
1363
+ readString(chat, "name") ??
1364
+ readString(chatFromList, "displayName") ??
1365
+ readString(chatFromList, "name") ??
1366
+ undefined;
1367
+
1368
+ const chatParticipants = chat ? chat["participants"] : undefined;
1369
+ const messageParticipants = message["participants"];
1370
+ const chatsParticipants = chatFromList ? chatFromList["participants"] : undefined;
1371
+ const participants = Array.isArray(chatParticipants)
1372
+ ? chatParticipants
1373
+ : Array.isArray(messageParticipants)
1374
+ ? messageParticipants
1375
+ : Array.isArray(chatsParticipants)
1376
+ ? chatsParticipants
1377
+ : [];
1378
+ const participantsCount = participants.length;
1379
+ const groupFromChatGuid = resolveGroupFlagFromChatGuid(chatGuid);
1380
+ const explicitIsGroup =
1381
+ readBoolean(message, "isGroup") ??
1382
+ readBoolean(message, "is_group") ??
1383
+ readBoolean(chat, "isGroup") ??
1384
+ readBoolean(message, "group");
1385
+ const isGroup =
1386
+ typeof groupFromChatGuid === "boolean"
1387
+ ? groupFromChatGuid
1388
+ : (explicitIsGroup ?? participantsCount > 2);
1389
+
1390
+ const fromMe = readBoolean(message, "isFromMe") ?? readBoolean(message, "is_from_me");
1391
+ const timestampRaw =
1392
+ readNumberLike(message, "date") ??
1393
+ readNumberLike(message, "dateCreated") ??
1394
+ readNumberLike(message, "timestamp");
1395
+ const timestamp =
1396
+ typeof timestampRaw === "number"
1397
+ ? timestampRaw > 1_000_000_000_000
1398
+ ? timestampRaw
1399
+ : timestampRaw * 1000
1400
+ : undefined;
1401
+
1402
+ const normalizedSender = normalizeBlueBubblesHandle(senderId);
1403
+ if (!normalizedSender) {
1404
+ return null;
1405
+ }
1406
+
1407
+ return {
1408
+ action,
1409
+ emoji,
1410
+ senderId: normalizedSender,
1411
+ senderName,
1412
+ messageId: associatedGuid,
1413
+ timestamp,
1414
+ isGroup,
1415
+ chatId,
1416
+ chatGuid,
1417
+ chatIdentifier,
1418
+ chatName,
1419
+ fromMe,
1420
+ };
1421
+ }
1422
+
1423
+ export async function handleBlueBubblesWebhookRequest(
1424
+ req: IncomingMessage,
1425
+ res: ServerResponse,
1426
+ ): Promise<boolean> {
1427
+ const url = new URL(req.url ?? "/", "http://localhost");
1428
+ const path = normalizeWebhookPath(url.pathname);
1429
+ const targets = webhookTargets.get(path);
1430
+ if (!targets || targets.length === 0) {
1431
+ return false;
1432
+ }
1433
+
1434
+ if (req.method !== "POST") {
1435
+ res.statusCode = 405;
1436
+ res.setHeader("Allow", "POST");
1437
+ res.end("Method Not Allowed");
1438
+ return true;
1439
+ }
1440
+
1441
+ const body = await readJsonBody(req, 1024 * 1024);
1442
+ if (!body.ok) {
1443
+ res.statusCode = body.error === "payload too large" ? 413 : 400;
1444
+ res.end(body.error ?? "invalid payload");
1445
+ console.warn(`[bluebubbles] webhook rejected: ${body.error ?? "invalid payload"}`);
1446
+ return true;
1447
+ }
1448
+
1449
+ const payload = asRecord(body.value) ?? {};
1450
+ const firstTarget = targets[0];
1451
+ if (firstTarget) {
1452
+ logVerbose(
1453
+ firstTarget.core,
1454
+ firstTarget.runtime,
1455
+ `webhook received path=${path} keys=${Object.keys(payload).join(",") || "none"}`,
1456
+ );
1457
+ }
1458
+ const eventTypeRaw = payload.type;
1459
+ const eventType = typeof eventTypeRaw === "string" ? eventTypeRaw.trim() : "";
1460
+ const allowedEventTypes = new Set([
1461
+ "new-message",
1462
+ "updated-message",
1463
+ "message-reaction",
1464
+ "reaction",
1465
+ ]);
1466
+ if (eventType && !allowedEventTypes.has(eventType)) {
1467
+ res.statusCode = 200;
1468
+ res.end("ok");
1469
+ if (firstTarget) {
1470
+ logVerbose(firstTarget.core, firstTarget.runtime, `webhook ignored type=${eventType}`);
1471
+ }
1472
+ return true;
1473
+ }
1474
+ const reaction = normalizeWebhookReaction(payload);
1475
+ if (
1476
+ (eventType === "updated-message" ||
1477
+ eventType === "message-reaction" ||
1478
+ eventType === "reaction") &&
1479
+ !reaction
1480
+ ) {
1481
+ res.statusCode = 200;
1482
+ res.end("ok");
1483
+ if (firstTarget) {
1484
+ logVerbose(
1485
+ firstTarget.core,
1486
+ firstTarget.runtime,
1487
+ `webhook ignored ${eventType || "event"} without reaction`,
1488
+ );
1489
+ }
1490
+ return true;
1491
+ }
1492
+ const message = reaction ? null : normalizeWebhookMessage(payload);
1493
+ if (!message && !reaction) {
1494
+ res.statusCode = 400;
1495
+ res.end("invalid payload");
1496
+ console.warn("[bluebubbles] webhook rejected: unable to parse message payload");
1497
+ return true;
1498
+ }
1499
+
1500
+ const matching = targets.filter((target) => {
1501
+ const token = target.account.config.password?.trim();
1502
+ if (!token) {
1503
+ return true;
1504
+ }
1505
+ const guidParam = url.searchParams.get("guid") ?? url.searchParams.get("password");
1506
+ const headerToken =
1507
+ req.headers["x-guid"] ??
1508
+ req.headers["x-password"] ??
1509
+ req.headers["x-bluebubbles-guid"] ??
1510
+ req.headers["authorization"];
1511
+ const guid = (Array.isArray(headerToken) ? headerToken[0] : headerToken) ?? guidParam ?? "";
1512
+ if (guid && guid.trim() === token) {
1513
+ return true;
1514
+ }
1515
+ const remote = req.socket?.remoteAddress ?? "";
1516
+ if (remote === "127.0.0.1" || remote === "::1" || remote === "::ffff:127.0.0.1") {
1517
+ return true;
1518
+ }
1519
+ return false;
1520
+ });
1521
+
1522
+ if (matching.length === 0) {
1523
+ res.statusCode = 401;
1524
+ res.end("unauthorized");
1525
+ console.warn(
1526
+ `[bluebubbles] webhook rejected: unauthorized guid=${maskSecret(url.searchParams.get("guid") ?? url.searchParams.get("password") ?? "")}`,
1527
+ );
1528
+ return true;
1529
+ }
1530
+
1531
+ for (const target of matching) {
1532
+ target.statusSink?.({ lastInboundAt: Date.now() });
1533
+ if (reaction) {
1534
+ processReaction(reaction, target).catch((err) => {
1535
+ target.runtime.error?.(
1536
+ `[${target.account.accountId}] BlueBubbles reaction failed: ${String(err)}`,
1537
+ );
1538
+ });
1539
+ } else if (message) {
1540
+ // Route messages through debouncer to coalesce rapid-fire events
1541
+ // (e.g., text message + URL balloon arriving as separate webhooks)
1542
+ const debouncer = getOrCreateDebouncer(target);
1543
+ debouncer.enqueue({ message, target }).catch((err) => {
1544
+ target.runtime.error?.(
1545
+ `[${target.account.accountId}] BlueBubbles webhook failed: ${String(err)}`,
1546
+ );
1547
+ });
1548
+ }
1549
+ }
1550
+
1551
+ res.statusCode = 200;
1552
+ res.end("ok");
1553
+ if (reaction) {
1554
+ if (firstTarget) {
1555
+ logVerbose(
1556
+ firstTarget.core,
1557
+ firstTarget.runtime,
1558
+ `webhook accepted reaction sender=${reaction.senderId} msg=${reaction.messageId} action=${reaction.action}`,
1559
+ );
1560
+ }
1561
+ } else if (message) {
1562
+ if (firstTarget) {
1563
+ logVerbose(
1564
+ firstTarget.core,
1565
+ firstTarget.runtime,
1566
+ `webhook accepted sender=${message.senderId} group=${message.isGroup} chatGuid=${message.chatGuid ?? ""} chatId=${message.chatId ?? ""}`,
1567
+ );
1568
+ }
1569
+ }
1570
+ return true;
1571
+ }
1572
+
1573
+ async function processMessage(
1574
+ message: NormalizedWebhookMessage,
1575
+ target: WebhookTarget,
1576
+ ): Promise<void> {
1577
+ const { account, config, runtime, core, statusSink } = target;
1578
+
1579
+ const groupFlag = resolveGroupFlagFromChatGuid(message.chatGuid);
1580
+ const isGroup = typeof groupFlag === "boolean" ? groupFlag : message.isGroup;
1581
+
1582
+ const text = message.text.trim();
1583
+ const attachments = message.attachments ?? [];
1584
+ const placeholder = buildMessagePlaceholder(message);
1585
+ // Check if text is a tapback pattern (e.g., 'Loved "hello"') and transform to emoji format
1586
+ // For tapbacks, we'll append [[reply_to:N]] at the end; for regular messages, prepend it
1587
+ const tapbackContext = resolveTapbackContext(message);
1588
+ const tapbackParsed = parseTapbackText({
1589
+ text,
1590
+ emojiHint: tapbackContext?.emojiHint,
1591
+ actionHint: tapbackContext?.actionHint,
1592
+ requireQuoted: !tapbackContext,
1593
+ });
1594
+ const isTapbackMessage = Boolean(tapbackParsed);
1595
+ const rawBody = tapbackParsed
1596
+ ? tapbackParsed.action === "removed"
1597
+ ? `removed ${tapbackParsed.emoji} reaction`
1598
+ : `reacted with ${tapbackParsed.emoji}`
1599
+ : text || placeholder;
1600
+
1601
+ const cacheMessageId = message.messageId?.trim();
1602
+ let messageShortId: string | undefined;
1603
+ const cacheInboundMessage = () => {
1604
+ if (!cacheMessageId) {
1605
+ return;
1606
+ }
1607
+ const cacheEntry = rememberBlueBubblesReplyCache({
1608
+ accountId: account.accountId,
1609
+ messageId: cacheMessageId,
1610
+ chatGuid: message.chatGuid,
1611
+ chatIdentifier: message.chatIdentifier,
1612
+ chatId: message.chatId,
1613
+ senderLabel: message.fromMe ? "me" : message.senderId,
1614
+ body: rawBody,
1615
+ timestamp: message.timestamp ?? Date.now(),
1616
+ });
1617
+ messageShortId = cacheEntry.shortId;
1618
+ };
1619
+
1620
+ if (message.fromMe) {
1621
+ // Cache from-me messages so reply context can resolve sender/body.
1622
+ cacheInboundMessage();
1623
+ return;
1624
+ }
1625
+
1626
+ if (!rawBody) {
1627
+ logVerbose(core, runtime, `drop: empty text sender=${message.senderId}`);
1628
+ return;
1629
+ }
1630
+ logVerbose(
1631
+ core,
1632
+ runtime,
1633
+ `msg sender=${message.senderId} group=${isGroup} textLen=${text.length} attachments=${attachments.length} chatGuid=${message.chatGuid ?? ""} chatId=${message.chatId ?? ""}`,
1634
+ );
1635
+
1636
+ const dmPolicy = account.config.dmPolicy ?? "pairing";
1637
+ const groupPolicy = account.config.groupPolicy ?? "allowlist";
1638
+ const configAllowFrom = (account.config.allowFrom ?? []).map((entry) => String(entry));
1639
+ const configGroupAllowFrom = (account.config.groupAllowFrom ?? []).map((entry) => String(entry));
1640
+ const storeAllowFrom = await core.channel.pairing
1641
+ .readAllowFromStore("bluebubbles")
1642
+ .catch(() => []);
1643
+ const effectiveAllowFrom = [...configAllowFrom, ...storeAllowFrom]
1644
+ .map((entry) => String(entry).trim())
1645
+ .filter(Boolean);
1646
+ const effectiveGroupAllowFrom = [
1647
+ ...(configGroupAllowFrom.length > 0 ? configGroupAllowFrom : configAllowFrom),
1648
+ ...storeAllowFrom,
1649
+ ]
1650
+ .map((entry) => String(entry).trim())
1651
+ .filter(Boolean);
1652
+ const groupAllowEntry = formatGroupAllowlistEntry({
1653
+ chatGuid: message.chatGuid,
1654
+ chatId: message.chatId ?? undefined,
1655
+ chatIdentifier: message.chatIdentifier ?? undefined,
1656
+ });
1657
+ const groupName = message.chatName?.trim() || undefined;
1658
+
1659
+ if (isGroup) {
1660
+ if (groupPolicy === "disabled") {
1661
+ logVerbose(core, runtime, "Blocked BlueBubbles group message (groupPolicy=disabled)");
1662
+ logGroupAllowlistHint({
1663
+ runtime,
1664
+ reason: "groupPolicy=disabled",
1665
+ entry: groupAllowEntry,
1666
+ chatName: groupName,
1667
+ accountId: account.accountId,
1668
+ });
1669
+ return;
1670
+ }
1671
+ if (groupPolicy === "allowlist") {
1672
+ if (effectiveGroupAllowFrom.length === 0) {
1673
+ logVerbose(core, runtime, "Blocked BlueBubbles group message (no allowlist)");
1674
+ logGroupAllowlistHint({
1675
+ runtime,
1676
+ reason: "groupPolicy=allowlist (empty allowlist)",
1677
+ entry: groupAllowEntry,
1678
+ chatName: groupName,
1679
+ accountId: account.accountId,
1680
+ });
1681
+ return;
1682
+ }
1683
+ const allowed = isAllowedBlueBubblesSender({
1684
+ allowFrom: effectiveGroupAllowFrom,
1685
+ sender: message.senderId,
1686
+ chatId: message.chatId ?? undefined,
1687
+ chatGuid: message.chatGuid ?? undefined,
1688
+ chatIdentifier: message.chatIdentifier ?? undefined,
1689
+ });
1690
+ if (!allowed) {
1691
+ logVerbose(
1692
+ core,
1693
+ runtime,
1694
+ `Blocked BlueBubbles sender ${message.senderId} (not in groupAllowFrom)`,
1695
+ );
1696
+ logVerbose(
1697
+ core,
1698
+ runtime,
1699
+ `drop: group sender not allowed sender=${message.senderId} allowFrom=${effectiveGroupAllowFrom.join(",")}`,
1700
+ );
1701
+ logGroupAllowlistHint({
1702
+ runtime,
1703
+ reason: "groupPolicy=allowlist (not allowlisted)",
1704
+ entry: groupAllowEntry,
1705
+ chatName: groupName,
1706
+ accountId: account.accountId,
1707
+ });
1708
+ return;
1709
+ }
1710
+ }
1711
+ } else {
1712
+ if (dmPolicy === "disabled") {
1713
+ logVerbose(core, runtime, `Blocked BlueBubbles DM from ${message.senderId}`);
1714
+ logVerbose(core, runtime, `drop: dmPolicy disabled sender=${message.senderId}`);
1715
+ return;
1716
+ }
1717
+ if (dmPolicy !== "open") {
1718
+ const allowed = isAllowedBlueBubblesSender({
1719
+ allowFrom: effectiveAllowFrom,
1720
+ sender: message.senderId,
1721
+ chatId: message.chatId ?? undefined,
1722
+ chatGuid: message.chatGuid ?? undefined,
1723
+ chatIdentifier: message.chatIdentifier ?? undefined,
1724
+ });
1725
+ if (!allowed) {
1726
+ if (dmPolicy === "pairing") {
1727
+ const { code, created } = await core.channel.pairing.upsertPairingRequest({
1728
+ channel: "bluebubbles",
1729
+ id: message.senderId,
1730
+ meta: { name: message.senderName },
1731
+ });
1732
+ runtime.log?.(
1733
+ `[bluebubbles] pairing request sender=${message.senderId} created=${created}`,
1734
+ );
1735
+ if (created) {
1736
+ logVerbose(core, runtime, `bluebubbles pairing request sender=${message.senderId}`);
1737
+ try {
1738
+ await sendMessageBlueBubbles(
1739
+ message.senderId,
1740
+ core.channel.pairing.buildPairingReply({
1741
+ channel: "bluebubbles",
1742
+ idLine: `Your BlueBubbles sender id: ${message.senderId}`,
1743
+ code,
1744
+ }),
1745
+ { cfg: config, accountId: account.accountId },
1746
+ );
1747
+ statusSink?.({ lastOutboundAt: Date.now() });
1748
+ } catch (err) {
1749
+ logVerbose(
1750
+ core,
1751
+ runtime,
1752
+ `bluebubbles pairing reply failed for ${message.senderId}: ${String(err)}`,
1753
+ );
1754
+ runtime.error?.(
1755
+ `[bluebubbles] pairing reply failed sender=${message.senderId}: ${String(err)}`,
1756
+ );
1757
+ }
1758
+ }
1759
+ } else {
1760
+ logVerbose(
1761
+ core,
1762
+ runtime,
1763
+ `Blocked unauthorized BlueBubbles sender ${message.senderId} (dmPolicy=${dmPolicy})`,
1764
+ );
1765
+ logVerbose(
1766
+ core,
1767
+ runtime,
1768
+ `drop: dm sender not allowed sender=${message.senderId} allowFrom=${effectiveAllowFrom.join(",")}`,
1769
+ );
1770
+ }
1771
+ return;
1772
+ }
1773
+ }
1774
+ }
1775
+
1776
+ const chatId = message.chatId ?? undefined;
1777
+ const chatGuid = message.chatGuid ?? undefined;
1778
+ const chatIdentifier = message.chatIdentifier ?? undefined;
1779
+ const peerId = isGroup
1780
+ ? (chatGuid ?? chatIdentifier ?? (chatId ? String(chatId) : "group"))
1781
+ : message.senderId;
1782
+
1783
+ const route = core.channel.routing.resolveAgentRoute({
1784
+ cfg: config,
1785
+ channel: "bluebubbles",
1786
+ accountId: account.accountId,
1787
+ peer: {
1788
+ kind: isGroup ? "group" : "dm",
1789
+ id: peerId,
1790
+ },
1791
+ });
1792
+
1793
+ // Mention gating for group chats (parity with iMessage/WhatsApp)
1794
+ const messageText = text;
1795
+ const mentionRegexes = core.channel.mentions.buildMentionRegexes(config, route.agentId);
1796
+ const wasMentioned = isGroup
1797
+ ? core.channel.mentions.matchesMentionPatterns(messageText, mentionRegexes)
1798
+ : true;
1799
+ const canDetectMention = mentionRegexes.length > 0;
1800
+ const requireMention = core.channel.groups.resolveRequireMention({
1801
+ cfg: config,
1802
+ channel: "bluebubbles",
1803
+ groupId: peerId,
1804
+ accountId: account.accountId,
1805
+ });
1806
+
1807
+ // Command gating (parity with iMessage/WhatsApp)
1808
+ const useAccessGroups = config.commands?.useAccessGroups !== false;
1809
+ const hasControlCmd = core.channel.text.hasControlCommand(messageText, config);
1810
+ const ownerAllowedForCommands =
1811
+ effectiveAllowFrom.length > 0
1812
+ ? isAllowedBlueBubblesSender({
1813
+ allowFrom: effectiveAllowFrom,
1814
+ sender: message.senderId,
1815
+ chatId: message.chatId ?? undefined,
1816
+ chatGuid: message.chatGuid ?? undefined,
1817
+ chatIdentifier: message.chatIdentifier ?? undefined,
1818
+ })
1819
+ : false;
1820
+ const groupAllowedForCommands =
1821
+ effectiveGroupAllowFrom.length > 0
1822
+ ? isAllowedBlueBubblesSender({
1823
+ allowFrom: effectiveGroupAllowFrom,
1824
+ sender: message.senderId,
1825
+ chatId: message.chatId ?? undefined,
1826
+ chatGuid: message.chatGuid ?? undefined,
1827
+ chatIdentifier: message.chatIdentifier ?? undefined,
1828
+ })
1829
+ : false;
1830
+ const dmAuthorized = dmPolicy === "open" || ownerAllowedForCommands;
1831
+ const commandGate = resolveControlCommandGate({
1832
+ useAccessGroups,
1833
+ authorizers: [
1834
+ { configured: effectiveAllowFrom.length > 0, allowed: ownerAllowedForCommands },
1835
+ { configured: effectiveGroupAllowFrom.length > 0, allowed: groupAllowedForCommands },
1836
+ ],
1837
+ allowTextCommands: true,
1838
+ hasControlCommand: hasControlCmd,
1839
+ });
1840
+ const commandAuthorized = isGroup ? commandGate.commandAuthorized : dmAuthorized;
1841
+
1842
+ // Block control commands from unauthorized senders in groups
1843
+ if (isGroup && commandGate.shouldBlock) {
1844
+ logInboundDrop({
1845
+ log: (msg) => logVerbose(core, runtime, msg),
1846
+ channel: "bluebubbles",
1847
+ reason: "control command (unauthorized)",
1848
+ target: message.senderId,
1849
+ });
1850
+ return;
1851
+ }
1852
+
1853
+ // Allow control commands to bypass mention gating when authorized (parity with iMessage)
1854
+ const shouldBypassMention =
1855
+ isGroup && requireMention && !wasMentioned && commandAuthorized && hasControlCmd;
1856
+ const effectiveWasMentioned = wasMentioned || shouldBypassMention;
1857
+
1858
+ // Skip group messages that require mention but weren't mentioned
1859
+ if (isGroup && requireMention && canDetectMention && !wasMentioned && !shouldBypassMention) {
1860
+ logVerbose(core, runtime, `bluebubbles: skipping group message (no mention)`);
1861
+ return;
1862
+ }
1863
+
1864
+ // Cache allowed inbound messages so later replies can resolve sender/body without
1865
+ // surfacing dropped content (allowlist/mention/command gating).
1866
+ cacheInboundMessage();
1867
+
1868
+ const baseUrl = account.config.serverUrl?.trim();
1869
+ const password = account.config.password?.trim();
1870
+ const maxBytes =
1871
+ account.config.mediaMaxMb && account.config.mediaMaxMb > 0
1872
+ ? account.config.mediaMaxMb * 1024 * 1024
1873
+ : 8 * 1024 * 1024;
1874
+
1875
+ let mediaUrls: string[] = [];
1876
+ let mediaPaths: string[] = [];
1877
+ let mediaTypes: string[] = [];
1878
+ if (attachments.length > 0) {
1879
+ if (!baseUrl || !password) {
1880
+ logVerbose(core, runtime, "attachment download skipped (missing serverUrl/password)");
1881
+ } else {
1882
+ for (const attachment of attachments) {
1883
+ if (!attachment.guid) {
1884
+ continue;
1885
+ }
1886
+ if (attachment.totalBytes && attachment.totalBytes > maxBytes) {
1887
+ logVerbose(
1888
+ core,
1889
+ runtime,
1890
+ `attachment too large guid=${attachment.guid} bytes=${attachment.totalBytes}`,
1891
+ );
1892
+ continue;
1893
+ }
1894
+ try {
1895
+ const downloaded = await downloadBlueBubblesAttachment(attachment, {
1896
+ cfg: config,
1897
+ accountId: account.accountId,
1898
+ maxBytes,
1899
+ });
1900
+ const saved = await core.channel.media.saveMediaBuffer(
1901
+ downloaded.buffer,
1902
+ downloaded.contentType,
1903
+ "inbound",
1904
+ maxBytes,
1905
+ );
1906
+ mediaPaths.push(saved.path);
1907
+ mediaUrls.push(saved.path);
1908
+ if (saved.contentType) {
1909
+ mediaTypes.push(saved.contentType);
1910
+ }
1911
+ } catch (err) {
1912
+ logVerbose(
1913
+ core,
1914
+ runtime,
1915
+ `attachment download failed guid=${attachment.guid} err=${String(err)}`,
1916
+ );
1917
+ }
1918
+ }
1919
+ }
1920
+ }
1921
+ let replyToId = message.replyToId;
1922
+ let replyToBody = message.replyToBody;
1923
+ let replyToSender = message.replyToSender;
1924
+ let replyToShortId: string | undefined;
1925
+
1926
+ if (isTapbackMessage && tapbackContext?.replyToId) {
1927
+ replyToId = tapbackContext.replyToId;
1928
+ }
1929
+
1930
+ if (replyToId) {
1931
+ const cached = resolveReplyContextFromCache({
1932
+ accountId: account.accountId,
1933
+ replyToId,
1934
+ chatGuid: message.chatGuid,
1935
+ chatIdentifier: message.chatIdentifier,
1936
+ chatId: message.chatId,
1937
+ });
1938
+ if (cached) {
1939
+ if (!replyToBody && cached.body) {
1940
+ replyToBody = cached.body;
1941
+ }
1942
+ if (!replyToSender && cached.senderLabel) {
1943
+ replyToSender = cached.senderLabel;
1944
+ }
1945
+ replyToShortId = cached.shortId;
1946
+ if (core.logging.shouldLogVerbose()) {
1947
+ const preview = (cached.body ?? "").replace(/\s+/g, " ").slice(0, 120);
1948
+ logVerbose(
1949
+ core,
1950
+ runtime,
1951
+ `reply-context cache hit replyToId=${replyToId} sender=${replyToSender ?? ""} body="${preview}"`,
1952
+ );
1953
+ }
1954
+ }
1955
+ }
1956
+
1957
+ // If no cached short ID, try to get one from the UUID directly
1958
+ if (replyToId && !replyToShortId) {
1959
+ replyToShortId = getShortIdForUuid(replyToId);
1960
+ }
1961
+
1962
+ // Use inline [[reply_to:N]] tag format
1963
+ // For tapbacks/reactions: append at end (e.g., "reacted with ❤️ [[reply_to:4]]")
1964
+ // For regular replies: prepend at start (e.g., "[[reply_to:4]] Awesome")
1965
+ const replyTag = formatReplyTag({ replyToId, replyToShortId });
1966
+ const baseBody = replyTag
1967
+ ? isTapbackMessage
1968
+ ? `${rawBody} ${replyTag}`
1969
+ : `${replyTag} ${rawBody}`
1970
+ : rawBody;
1971
+ const fromLabel = isGroup ? undefined : message.senderName || `user:${message.senderId}`;
1972
+ const groupSubject = isGroup ? message.chatName?.trim() || undefined : undefined;
1973
+ const groupMembers = isGroup
1974
+ ? formatGroupMembers({
1975
+ participants: message.participants,
1976
+ fallback: message.senderId ? { id: message.senderId, name: message.senderName } : undefined,
1977
+ })
1978
+ : undefined;
1979
+ const storePath = core.channel.session.resolveStorePath(config.session?.store, {
1980
+ agentId: route.agentId,
1981
+ });
1982
+ const envelopeOptions = core.channel.reply.resolveEnvelopeFormatOptions(config);
1983
+ const previousTimestamp = core.channel.session.readSessionUpdatedAt({
1984
+ storePath,
1985
+ sessionKey: route.sessionKey,
1986
+ });
1987
+ const body = core.channel.reply.formatAgentEnvelope({
1988
+ channel: "BlueBubbles",
1989
+ from: fromLabel,
1990
+ timestamp: message.timestamp,
1991
+ previousTimestamp,
1992
+ envelope: envelopeOptions,
1993
+ body: baseBody,
1994
+ });
1995
+ let chatGuidForActions = chatGuid;
1996
+ if (!chatGuidForActions && baseUrl && password) {
1997
+ const target =
1998
+ isGroup && (chatId || chatIdentifier)
1999
+ ? chatId
2000
+ ? ({ kind: "chat_id", chatId } as const)
2001
+ : ({ kind: "chat_identifier", chatIdentifier: chatIdentifier ?? "" } as const)
2002
+ : ({ kind: "handle", address: message.senderId } as const);
2003
+ if (target.kind !== "chat_identifier" || target.chatIdentifier) {
2004
+ chatGuidForActions =
2005
+ (await resolveChatGuidForTarget({
2006
+ baseUrl,
2007
+ password,
2008
+ target,
2009
+ })) ?? undefined;
2010
+ }
2011
+ }
2012
+
2013
+ const ackReactionScope = config.messages?.ackReactionScope ?? "group-mentions";
2014
+ const removeAckAfterReply = config.messages?.removeAckAfterReply ?? false;
2015
+ const ackReactionValue = resolveBlueBubblesAckReaction({
2016
+ cfg: config,
2017
+ agentId: route.agentId,
2018
+ core,
2019
+ runtime,
2020
+ });
2021
+ const shouldAckReaction = () =>
2022
+ Boolean(
2023
+ ackReactionValue &&
2024
+ core.channel.reactions.shouldAckReaction({
2025
+ scope: ackReactionScope,
2026
+ isDirect: !isGroup,
2027
+ isGroup,
2028
+ isMentionableGroup: isGroup,
2029
+ requireMention: Boolean(requireMention),
2030
+ canDetectMention,
2031
+ effectiveWasMentioned,
2032
+ shouldBypassMention,
2033
+ }),
2034
+ );
2035
+ const ackMessageId = message.messageId?.trim() || "";
2036
+ const ackReactionPromise =
2037
+ shouldAckReaction() && ackMessageId && chatGuidForActions && ackReactionValue
2038
+ ? sendBlueBubblesReaction({
2039
+ chatGuid: chatGuidForActions,
2040
+ messageGuid: ackMessageId,
2041
+ emoji: ackReactionValue,
2042
+ opts: { cfg: config, accountId: account.accountId },
2043
+ }).then(
2044
+ () => true,
2045
+ (err) => {
2046
+ logVerbose(
2047
+ core,
2048
+ runtime,
2049
+ `ack reaction failed chatGuid=${chatGuidForActions} msg=${ackMessageId}: ${String(err)}`,
2050
+ );
2051
+ return false;
2052
+ },
2053
+ )
2054
+ : null;
2055
+
2056
+ // Respect sendReadReceipts config (parity with WhatsApp)
2057
+ const sendReadReceipts = account.config.sendReadReceipts !== false;
2058
+ if (chatGuidForActions && baseUrl && password && sendReadReceipts) {
2059
+ try {
2060
+ await markBlueBubblesChatRead(chatGuidForActions, {
2061
+ cfg: config,
2062
+ accountId: account.accountId,
2063
+ });
2064
+ logVerbose(core, runtime, `marked read chatGuid=${chatGuidForActions}`);
2065
+ } catch (err) {
2066
+ runtime.error?.(`[bluebubbles] mark read failed: ${String(err)}`);
2067
+ }
2068
+ } else if (!sendReadReceipts) {
2069
+ logVerbose(core, runtime, "mark read skipped (sendReadReceipts=false)");
2070
+ } else {
2071
+ logVerbose(core, runtime, "mark read skipped (missing chatGuid or credentials)");
2072
+ }
2073
+
2074
+ const outboundTarget = isGroup
2075
+ ? formatBlueBubblesChatTarget({
2076
+ chatId,
2077
+ chatGuid: chatGuidForActions ?? chatGuid,
2078
+ chatIdentifier,
2079
+ }) || peerId
2080
+ : chatGuidForActions
2081
+ ? formatBlueBubblesChatTarget({ chatGuid: chatGuidForActions })
2082
+ : message.senderId;
2083
+
2084
+ const maybeEnqueueOutboundMessageId = (messageId?: string, snippet?: string) => {
2085
+ const trimmed = messageId?.trim();
2086
+ if (!trimmed || trimmed === "ok" || trimmed === "unknown") {
2087
+ return;
2088
+ }
2089
+ // Cache outbound message to get short ID
2090
+ const cacheEntry = rememberBlueBubblesReplyCache({
2091
+ accountId: account.accountId,
2092
+ messageId: trimmed,
2093
+ chatGuid: chatGuidForActions ?? chatGuid,
2094
+ chatIdentifier,
2095
+ chatId,
2096
+ senderLabel: "me",
2097
+ body: snippet ?? "",
2098
+ timestamp: Date.now(),
2099
+ });
2100
+ const displayId = cacheEntry.shortId || trimmed;
2101
+ const preview = snippet ? ` "${snippet.slice(0, 12)}${snippet.length > 12 ? "…" : ""}"` : "";
2102
+ core.system.enqueueSystemEvent(`Assistant sent${preview} [message_id:${displayId}]`, {
2103
+ sessionKey: route.sessionKey,
2104
+ contextKey: `bluebubbles:outbound:${outboundTarget}:${trimmed}`,
2105
+ });
2106
+ };
2107
+
2108
+ const ctxPayload = {
2109
+ Body: body,
2110
+ BodyForAgent: body,
2111
+ RawBody: rawBody,
2112
+ CommandBody: rawBody,
2113
+ BodyForCommands: rawBody,
2114
+ MediaUrl: mediaUrls[0],
2115
+ MediaUrls: mediaUrls.length > 0 ? mediaUrls : undefined,
2116
+ MediaPath: mediaPaths[0],
2117
+ MediaPaths: mediaPaths.length > 0 ? mediaPaths : undefined,
2118
+ MediaType: mediaTypes[0],
2119
+ MediaTypes: mediaTypes.length > 0 ? mediaTypes : undefined,
2120
+ From: isGroup ? `group:${peerId}` : `bluebubbles:${message.senderId}`,
2121
+ To: `bluebubbles:${outboundTarget}`,
2122
+ SessionKey: route.sessionKey,
2123
+ AccountId: route.accountId,
2124
+ ChatType: isGroup ? "group" : "direct",
2125
+ ConversationLabel: fromLabel,
2126
+ // Use short ID for token savings (agent can use this to reference the message)
2127
+ ReplyToId: replyToShortId || replyToId,
2128
+ ReplyToIdFull: replyToId,
2129
+ ReplyToBody: replyToBody,
2130
+ ReplyToSender: replyToSender,
2131
+ GroupSubject: groupSubject,
2132
+ GroupMembers: groupMembers,
2133
+ SenderName: message.senderName || undefined,
2134
+ SenderId: message.senderId,
2135
+ Provider: "bluebubbles",
2136
+ Surface: "bluebubbles",
2137
+ // Use short ID for token savings (agent can use this to reference the message)
2138
+ MessageSid: messageShortId || message.messageId,
2139
+ MessageSidFull: message.messageId,
2140
+ Timestamp: message.timestamp,
2141
+ OriginatingChannel: "bluebubbles",
2142
+ OriginatingTo: `bluebubbles:${outboundTarget}`,
2143
+ WasMentioned: effectiveWasMentioned,
2144
+ CommandAuthorized: commandAuthorized,
2145
+ };
2146
+
2147
+ let sentMessage = false;
2148
+ let streamingActive = false;
2149
+ let typingRestartTimer: NodeJS.Timeout | undefined;
2150
+ const typingRestartDelayMs = 150;
2151
+ const clearTypingRestartTimer = () => {
2152
+ if (typingRestartTimer) {
2153
+ clearTimeout(typingRestartTimer);
2154
+ typingRestartTimer = undefined;
2155
+ }
2156
+ };
2157
+ const restartTypingSoon = () => {
2158
+ if (!streamingActive || !chatGuidForActions || !baseUrl || !password) {
2159
+ return;
2160
+ }
2161
+ clearTypingRestartTimer();
2162
+ typingRestartTimer = setTimeout(() => {
2163
+ typingRestartTimer = undefined;
2164
+ if (!streamingActive) {
2165
+ return;
2166
+ }
2167
+ sendBlueBubblesTyping(chatGuidForActions, true, {
2168
+ cfg: config,
2169
+ accountId: account.accountId,
2170
+ }).catch((err) => {
2171
+ runtime.error?.(`[bluebubbles] typing restart failed: ${String(err)}`);
2172
+ });
2173
+ }, typingRestartDelayMs);
2174
+ };
2175
+ try {
2176
+ await core.channel.reply.dispatchReplyWithBufferedBlockDispatcher({
2177
+ ctx: ctxPayload,
2178
+ cfg: config,
2179
+ dispatcherOptions: {
2180
+ deliver: async (payload, info) => {
2181
+ const rawReplyToId =
2182
+ typeof payload.replyToId === "string" ? payload.replyToId.trim() : "";
2183
+ // Resolve short ID (e.g., "5") to full UUID
2184
+ const replyToMessageGuid = rawReplyToId
2185
+ ? resolveBlueBubblesMessageId(rawReplyToId, { requireKnownShortId: true })
2186
+ : "";
2187
+ const mediaList = payload.mediaUrls?.length
2188
+ ? payload.mediaUrls
2189
+ : payload.mediaUrl
2190
+ ? [payload.mediaUrl]
2191
+ : [];
2192
+ if (mediaList.length > 0) {
2193
+ const tableMode = core.channel.text.resolveMarkdownTableMode({
2194
+ cfg: config,
2195
+ channel: "bluebubbles",
2196
+ accountId: account.accountId,
2197
+ });
2198
+ const text = core.channel.text.convertMarkdownTables(payload.text ?? "", tableMode);
2199
+ let first = true;
2200
+ for (const mediaUrl of mediaList) {
2201
+ const caption = first ? text : undefined;
2202
+ first = false;
2203
+ const result = await sendBlueBubblesMedia({
2204
+ cfg: config,
2205
+ to: outboundTarget,
2206
+ mediaUrl,
2207
+ caption: caption ?? undefined,
2208
+ replyToId: replyToMessageGuid || null,
2209
+ accountId: account.accountId,
2210
+ });
2211
+ const cachedBody = (caption ?? "").trim() || "<media:attachment>";
2212
+ maybeEnqueueOutboundMessageId(result.messageId, cachedBody);
2213
+ sentMessage = true;
2214
+ statusSink?.({ lastOutboundAt: Date.now() });
2215
+ if (info.kind === "block") {
2216
+ restartTypingSoon();
2217
+ }
2218
+ }
2219
+ return;
2220
+ }
2221
+
2222
+ const textLimit =
2223
+ account.config.textChunkLimit && account.config.textChunkLimit > 0
2224
+ ? account.config.textChunkLimit
2225
+ : DEFAULT_TEXT_LIMIT;
2226
+ const chunkMode = account.config.chunkMode ?? "length";
2227
+ const tableMode = core.channel.text.resolveMarkdownTableMode({
2228
+ cfg: config,
2229
+ channel: "bluebubbles",
2230
+ accountId: account.accountId,
2231
+ });
2232
+ const text = core.channel.text.convertMarkdownTables(payload.text ?? "", tableMode);
2233
+ const chunks =
2234
+ chunkMode === "newline"
2235
+ ? core.channel.text.chunkTextWithMode(text, textLimit, chunkMode)
2236
+ : core.channel.text.chunkMarkdownText(text, textLimit);
2237
+ if (!chunks.length && text) {
2238
+ chunks.push(text);
2239
+ }
2240
+ if (!chunks.length) {
2241
+ return;
2242
+ }
2243
+ for (let i = 0; i < chunks.length; i++) {
2244
+ const chunk = chunks[i];
2245
+ const result = await sendMessageBlueBubbles(outboundTarget, chunk, {
2246
+ cfg: config,
2247
+ accountId: account.accountId,
2248
+ replyToMessageGuid: replyToMessageGuid || undefined,
2249
+ });
2250
+ maybeEnqueueOutboundMessageId(result.messageId, chunk);
2251
+ sentMessage = true;
2252
+ statusSink?.({ lastOutboundAt: Date.now() });
2253
+ if (info.kind === "block") {
2254
+ restartTypingSoon();
2255
+ }
2256
+ }
2257
+ },
2258
+ onReplyStart: async () => {
2259
+ if (!chatGuidForActions) {
2260
+ return;
2261
+ }
2262
+ if (!baseUrl || !password) {
2263
+ return;
2264
+ }
2265
+ streamingActive = true;
2266
+ clearTypingRestartTimer();
2267
+ try {
2268
+ await sendBlueBubblesTyping(chatGuidForActions, true, {
2269
+ cfg: config,
2270
+ accountId: account.accountId,
2271
+ });
2272
+ } catch (err) {
2273
+ runtime.error?.(`[bluebubbles] typing start failed: ${String(err)}`);
2274
+ }
2275
+ },
2276
+ onIdle: async () => {
2277
+ if (!chatGuidForActions) {
2278
+ return;
2279
+ }
2280
+ if (!baseUrl || !password) {
2281
+ return;
2282
+ }
2283
+ // Intentionally no-op for block streaming. We stop typing in finally
2284
+ // after the run completes to avoid flicker between paragraph blocks.
2285
+ },
2286
+ onError: (err, info) => {
2287
+ runtime.error?.(`BlueBubbles ${info.kind} reply failed: ${String(err)}`);
2288
+ },
2289
+ },
2290
+ replyOptions: {
2291
+ disableBlockStreaming:
2292
+ typeof account.config.blockStreaming === "boolean"
2293
+ ? !account.config.blockStreaming
2294
+ : undefined,
2295
+ },
2296
+ });
2297
+ } finally {
2298
+ const shouldStopTyping =
2299
+ Boolean(chatGuidForActions && baseUrl && password) && (streamingActive || !sentMessage);
2300
+ streamingActive = false;
2301
+ clearTypingRestartTimer();
2302
+ if (sentMessage && chatGuidForActions && ackMessageId) {
2303
+ core.channel.reactions.removeAckReactionAfterReply({
2304
+ removeAfterReply: removeAckAfterReply,
2305
+ ackReactionPromise,
2306
+ ackReactionValue: ackReactionValue ?? null,
2307
+ remove: () =>
2308
+ sendBlueBubblesReaction({
2309
+ chatGuid: chatGuidForActions,
2310
+ messageGuid: ackMessageId,
2311
+ emoji: ackReactionValue ?? "",
2312
+ remove: true,
2313
+ opts: { cfg: config, accountId: account.accountId },
2314
+ }),
2315
+ onError: (err) => {
2316
+ logAckFailure({
2317
+ log: (msg) => logVerbose(core, runtime, msg),
2318
+ channel: "bluebubbles",
2319
+ target: `${chatGuidForActions}/${ackMessageId}`,
2320
+ error: err,
2321
+ });
2322
+ },
2323
+ });
2324
+ }
2325
+ if (shouldStopTyping) {
2326
+ // Stop typing after streaming completes to avoid a stuck indicator.
2327
+ sendBlueBubblesTyping(chatGuidForActions, false, {
2328
+ cfg: config,
2329
+ accountId: account.accountId,
2330
+ }).catch((err) => {
2331
+ logTypingFailure({
2332
+ log: (msg) => logVerbose(core, runtime, msg),
2333
+ channel: "bluebubbles",
2334
+ action: "stop",
2335
+ target: chatGuidForActions,
2336
+ error: err,
2337
+ });
2338
+ });
2339
+ }
2340
+ }
2341
+ }
2342
+
2343
+ async function processReaction(
2344
+ reaction: NormalizedWebhookReaction,
2345
+ target: WebhookTarget,
2346
+ ): Promise<void> {
2347
+ const { account, config, runtime, core } = target;
2348
+ if (reaction.fromMe) {
2349
+ return;
2350
+ }
2351
+
2352
+ const dmPolicy = account.config.dmPolicy ?? "pairing";
2353
+ const groupPolicy = account.config.groupPolicy ?? "allowlist";
2354
+ const configAllowFrom = (account.config.allowFrom ?? []).map((entry) => String(entry));
2355
+ const configGroupAllowFrom = (account.config.groupAllowFrom ?? []).map((entry) => String(entry));
2356
+ const storeAllowFrom = await core.channel.pairing
2357
+ .readAllowFromStore("bluebubbles")
2358
+ .catch(() => []);
2359
+ const effectiveAllowFrom = [...configAllowFrom, ...storeAllowFrom]
2360
+ .map((entry) => String(entry).trim())
2361
+ .filter(Boolean);
2362
+ const effectiveGroupAllowFrom = [
2363
+ ...(configGroupAllowFrom.length > 0 ? configGroupAllowFrom : configAllowFrom),
2364
+ ...storeAllowFrom,
2365
+ ]
2366
+ .map((entry) => String(entry).trim())
2367
+ .filter(Boolean);
2368
+
2369
+ if (reaction.isGroup) {
2370
+ if (groupPolicy === "disabled") {
2371
+ return;
2372
+ }
2373
+ if (groupPolicy === "allowlist") {
2374
+ if (effectiveGroupAllowFrom.length === 0) {
2375
+ return;
2376
+ }
2377
+ const allowed = isAllowedBlueBubblesSender({
2378
+ allowFrom: effectiveGroupAllowFrom,
2379
+ sender: reaction.senderId,
2380
+ chatId: reaction.chatId ?? undefined,
2381
+ chatGuid: reaction.chatGuid ?? undefined,
2382
+ chatIdentifier: reaction.chatIdentifier ?? undefined,
2383
+ });
2384
+ if (!allowed) {
2385
+ return;
2386
+ }
2387
+ }
2388
+ } else {
2389
+ if (dmPolicy === "disabled") {
2390
+ return;
2391
+ }
2392
+ if (dmPolicy !== "open") {
2393
+ const allowed = isAllowedBlueBubblesSender({
2394
+ allowFrom: effectiveAllowFrom,
2395
+ sender: reaction.senderId,
2396
+ chatId: reaction.chatId ?? undefined,
2397
+ chatGuid: reaction.chatGuid ?? undefined,
2398
+ chatIdentifier: reaction.chatIdentifier ?? undefined,
2399
+ });
2400
+ if (!allowed) {
2401
+ return;
2402
+ }
2403
+ }
2404
+ }
2405
+
2406
+ const chatId = reaction.chatId ?? undefined;
2407
+ const chatGuid = reaction.chatGuid ?? undefined;
2408
+ const chatIdentifier = reaction.chatIdentifier ?? undefined;
2409
+ const peerId = reaction.isGroup
2410
+ ? (chatGuid ?? chatIdentifier ?? (chatId ? String(chatId) : "group"))
2411
+ : reaction.senderId;
2412
+
2413
+ const route = core.channel.routing.resolveAgentRoute({
2414
+ cfg: config,
2415
+ channel: "bluebubbles",
2416
+ accountId: account.accountId,
2417
+ peer: {
2418
+ kind: reaction.isGroup ? "group" : "dm",
2419
+ id: peerId,
2420
+ },
2421
+ });
2422
+
2423
+ const senderLabel = reaction.senderName || reaction.senderId;
2424
+ const chatLabel = reaction.isGroup ? ` in group:${peerId}` : "";
2425
+ // Use short ID for token savings
2426
+ const messageDisplayId = getShortIdForUuid(reaction.messageId) || reaction.messageId;
2427
+ // Format: "Tyler reacted with ❤️ [[reply_to:5]]" or "Tyler removed ❤️ reaction [[reply_to:5]]"
2428
+ const text =
2429
+ reaction.action === "removed"
2430
+ ? `${senderLabel} removed ${reaction.emoji} reaction [[reply_to:${messageDisplayId}]]${chatLabel}`
2431
+ : `${senderLabel} reacted with ${reaction.emoji} [[reply_to:${messageDisplayId}]]${chatLabel}`;
2432
+ core.system.enqueueSystemEvent(text, {
2433
+ sessionKey: route.sessionKey,
2434
+ contextKey: `bluebubbles:reaction:${reaction.action}:${peerId}:${reaction.messageId}:${reaction.senderId}:${reaction.emoji}`,
2435
+ });
2436
+ logVerbose(core, runtime, `reaction event enqueued: ${text}`);
2437
+ }
2438
+
2439
+ export async function monitorBlueBubblesProvider(
2440
+ options: BlueBubblesMonitorOptions,
2441
+ ): Promise<void> {
2442
+ const { account, config, runtime, abortSignal, statusSink } = options;
2443
+ const core = getBlueBubblesRuntime();
2444
+ const path = options.webhookPath?.trim() || DEFAULT_WEBHOOK_PATH;
2445
+
2446
+ // Fetch and cache server info (for macOS version detection in action gating)
2447
+ const serverInfo = await fetchBlueBubblesServerInfo({
2448
+ baseUrl: account.baseUrl,
2449
+ password: account.config.password,
2450
+ accountId: account.accountId,
2451
+ timeoutMs: 5000,
2452
+ }).catch(() => null);
2453
+ if (serverInfo?.os_version) {
2454
+ runtime.log?.(`[${account.accountId}] BlueBubbles server macOS ${serverInfo.os_version}`);
2455
+ }
2456
+
2457
+ const unregister = registerBlueBubblesWebhookTarget({
2458
+ account,
2459
+ config,
2460
+ runtime,
2461
+ core,
2462
+ path,
2463
+ statusSink,
2464
+ });
2465
+
2466
+ return await new Promise((resolve) => {
2467
+ const stop = () => {
2468
+ unregister();
2469
+ resolve();
2470
+ };
2471
+
2472
+ if (abortSignal?.aborted) {
2473
+ stop();
2474
+ return;
2475
+ }
2476
+
2477
+ abortSignal?.addEventListener("abort", stop, { once: true });
2478
+ runtime.log?.(
2479
+ `[${account.accountId}] BlueBubbles webhook listening on ${normalizeWebhookPath(path)}`,
2480
+ );
2481
+ });
2482
+ }
2483
+
2484
+ export function resolveWebhookPathFromConfig(config?: BlueBubblesAccountConfig): string {
2485
+ const raw = config?.webhookPath?.trim();
2486
+ if (raw) {
2487
+ return normalizeWebhookPath(raw);
2488
+ }
2489
+ return DEFAULT_WEBHOOK_PATH;
2490
+ }