synurex 2026.2.19-1

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