silentlake 2026.3.24

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 (1893) hide show
  1. package/CHANGELOG.md +4587 -0
  2. package/LICENSE +21 -0
  3. package/README.md +248 -0
  4. package/assets/avatar-placeholder.svg +19 -0
  5. package/assets/chrome-extension/icons/icon128.png +0 -0
  6. package/assets/chrome-extension/icons/icon16.png +0 -0
  7. package/assets/chrome-extension/icons/icon32.png +0 -0
  8. package/assets/chrome-extension/icons/icon48.png +0 -0
  9. package/assets/dmg-background-small.png +0 -0
  10. package/assets/dmg-background.png +0 -0
  11. package/assets/silentlake-banner.png +0 -0
  12. package/dist/APEv2Parser-BZv_dP9t.js +269 -0
  13. package/dist/APEv2Parser-CPzxFNBB.js +5 -0
  14. package/dist/AbstractID3Parser-mvDFcjYV.js +47 -0
  15. package/dist/AiffParser-BXQ9SRZk.js +145 -0
  16. package/dist/AsfParser-CmBDUlZE.js +631 -0
  17. package/dist/BasicParser-DhmXREDo.js +853 -0
  18. package/dist/DsdiffParser-CTKKGyZg.js +150 -0
  19. package/dist/DsfParser-Ds-YQe4Z.js +101 -0
  20. package/dist/FlacParser-B1XVPgXF.js +5 -0
  21. package/dist/FlacParser-DMPyL1y4.js +367 -0
  22. package/dist/ID3v1Parser-BICWWVDG.js +289 -0
  23. package/dist/ID3v2Parser-BmZHSUqs.js +650 -0
  24. package/dist/ID3v2Token-DeJf4tYQ.js +145 -0
  25. package/dist/MP4Parser-Cjf-Zs8T.js +1061 -0
  26. package/dist/MatroskaParser-DgBzBe8t.js +909 -0
  27. package/dist/MpegParser-D5swTpA1.js +744 -0
  28. package/dist/MusepackParser-D8EQXnpK.js +285 -0
  29. package/dist/OggParser-BcIYPHwP.js +390 -0
  30. package/dist/Util-D_zGsr97.js +170 -0
  31. package/dist/WavPackParser-hosU8gfo.js +166 -0
  32. package/dist/WaveParser-CA00FZrC.js +273 -0
  33. package/dist/abort-cutoff-CERmtgZI.js +56 -0
  34. package/dist/abort-cutoff.runtime-DZkGKKzv.js +61 -0
  35. package/dist/abort-signal-CsrBEr94.js +13 -0
  36. package/dist/account-helpers-D3c_eI7c.js +37 -0
  37. package/dist/account-helpers-ru3jdZSV.js +12 -0
  38. package/dist/account-id-DZnNZg8x.js +1 -0
  39. package/dist/account-id-ZCrgXl7Z.js +44 -0
  40. package/dist/account-lookup-nkoa-foB.js +10 -0
  41. package/dist/account-snapshot-fields-Cvq7803C.js +116 -0
  42. package/dist/account-summary-B5Xzvntm.js +36 -0
  43. package/dist/accounts-43SvCDEA.js +212 -0
  44. package/dist/accounts-CYgFhv2o.js +105 -0
  45. package/dist/accounts-ChlyF7cx.js +112 -0
  46. package/dist/ack-reactions-CNVwfOBj.js +43 -0
  47. package/dist/acp-cli-B4Rv7-xU.js +2033 -0
  48. package/dist/acp-runtime-BdLdT-QY.js +1 -0
  49. package/dist/actions.runtime-CqnQssoB.js +217 -0
  50. package/dist/actions.runtime-FLmCvVRd.js +236 -0
  51. package/dist/agent-CBOdzEvR.js +1 -0
  52. package/dist/agent-scope-BLhzf-o0.js +17 -0
  53. package/dist/agent-scope-DPP4Z_UU.js +193 -0
  54. package/dist/agents-D8pBK0II.js +855 -0
  55. package/dist/agents-Dihz1Ihx.js +323 -0
  56. package/dist/agents.config-C_lrnc9J.js +18 -0
  57. package/dist/agents.config-D1VqC78r.js +121 -0
  58. package/dist/allow-from-BPSBITdd.js +9 -0
  59. package/dist/allow-from-BwTLpvhp.js +20 -0
  60. package/dist/allow-from-C4iBpqFI.js +62 -0
  61. package/dist/allowlist-config-edit-CKbnMmwS.js +279 -0
  62. package/dist/allowlist-match-CYmPgg1K.js +63 -0
  63. package/dist/ansi-BEJF8NKS.js +54 -0
  64. package/dist/anthropic-vertex-provider-Dd5agCN9.js +60 -0
  65. package/dist/apply.runtime-DhKxNSJE.js +370 -0
  66. package/dist/apply.runtime-ghlh-P6X.js +211 -0
  67. package/dist/archive-Tr0wIUO-.js +532 -0
  68. package/dist/arg-split-Dtda0YDl.js +38 -0
  69. package/dist/artifacts-C_4LekPC.js +39 -0
  70. package/dist/audit-BOPSQQtd.js +54 -0
  71. package/dist/audit-C5kdrCi_.js +788 -0
  72. package/dist/audit-channel.allow-from.runtime-B7BHNblL.js +17 -0
  73. package/dist/audit-channel.collect.runtime-CjAbXFBV.js +521 -0
  74. package/dist/audit-channel.discord.runtime-BBY6S9lg.js +5 -0
  75. package/dist/audit-channel.telegram.runtime-SJnxOJH2.js +8 -0
  76. package/dist/audit-channel.zalouser.runtime-SGRWvHxT.js +5 -0
  77. package/dist/audit-extra.async-DY8v7LXH.js +817 -0
  78. package/dist/audit-fs-oDMUa5N_.js +375 -0
  79. package/dist/audit-membership-runtime-BPjFryEx.js +261 -0
  80. package/dist/audit.deep.runtime-WFf-TpsD.js +31 -0
  81. package/dist/audit.nondeep.runtime-B4BaEaRU.js +842 -0
  82. package/dist/audit.runtime-rFjCrods.js +74 -0
  83. package/dist/auth-O6LQFLHJ.js +416 -0
  84. package/dist/auth-choice-DIBaxmAQ.js +219 -0
  85. package/dist/auth-choice-PrbpIjyg.js +610 -0
  86. package/dist/auth-choice-legacy-Clyw2lVc.js +17 -0
  87. package/dist/auth-choice-options-ohUw8QR-.js +127 -0
  88. package/dist/auth-choice-prompt-Cm0s-9Du.js +215 -0
  89. package/dist/auth-choice-prompt-DI-Xl1Nv.js +36 -0
  90. package/dist/auth-choice-rKBOd02a.js +64 -0
  91. package/dist/auth-choice.apply-helpers-BibBSEl9.js +66 -0
  92. package/dist/auth-choice.plugin-providers.runtime-gqF9NO7_.js +219 -0
  93. package/dist/auth-health-TWboMYA5.js +166 -0
  94. package/dist/auth-mode-policy-DywddkT-.js +18 -0
  95. package/dist/auth-profiles-CWEIQV77.js +1047 -0
  96. package/dist/auth-profiles.runtime-B98lwopF.js +48 -0
  97. package/dist/avatar-policy-Ds9e6uHI.js +67 -0
  98. package/dist/axios-xDDnM0KG.js +12831 -0
  99. package/dist/backup-create-B6JAR6jJ.js +461 -0
  100. package/dist/banner-bez5CpOK.js +351 -0
  101. package/dist/base-session-key-Cf2rkwag.js +14 -0
  102. package/dist/bindings-BV4AtNSY.js +21 -0
  103. package/dist/bindings-kjwuC11Q.js +69 -0
  104. package/dist/bluebubbles-C1M3Geg0.js +87 -0
  105. package/dist/bluebubbles-DRW3JdOY.js +603 -0
  106. package/dist/bluebubbles-dEl4QpYz.js +37 -0
  107. package/dist/bonjour-discovery-C2oY96BG.js +376 -0
  108. package/dist/boolean-DKtCJu_W.js +29 -0
  109. package/dist/boolean-param-xAGXUSSN.js +13 -0
  110. package/dist/boundary-file-read-BP6VMpqH.js +106 -0
  111. package/dist/boundary-path-B3FFLYNx.js +557 -0
  112. package/dist/brave-CkimJe4j.js +405 -0
  113. package/dist/brew-DSwWqzLd.js +44 -0
  114. package/dist/browser-cli-D3kBUBNc.js +1502 -0
  115. package/dist/bundled/boot-md/handler.js +381 -0
  116. package/dist/bundled/bootstrap-extra-files/handler.js +56 -0
  117. package/dist/bundled/command-logger/handler.js +62 -0
  118. package/dist/bundled/session-memory/handler.js +401 -0
  119. package/dist/call-BDvaXe4i.js +44 -0
  120. package/dist/call-BmLt3xO1.js +639 -0
  121. package/dist/catalog-BwAYUfL7.js +240 -0
  122. package/dist/channel-BBCuV5OT.js +4945 -0
  123. package/dist/channel-BDBXuqeg.js +321 -0
  124. package/dist/channel-C8h1Irxm.js +1284 -0
  125. package/dist/channel-CbGpFzo4.js +1602 -0
  126. package/dist/channel-Ci3K8fI9.js +1006 -0
  127. package/dist/channel-DGT5N1v7.js +1077 -0
  128. package/dist/channel-account-context-Bwa-YH_o.js +104 -0
  129. package/dist/channel-actions-DU2CR3xW.js +37 -0
  130. package/dist/channel-activity-B8aReQoE.js +35 -0
  131. package/dist/channel-config-3Uv6ve2_.js +115 -0
  132. package/dist/channel-config-helpers-CieQWILI.js +377 -0
  133. package/dist/channel-config-schema-DEVsCZpj.js +1 -0
  134. package/dist/channel-feedback-G6zh8efr.js +245 -0
  135. package/dist/channel-inbound-DwzVf2PK.js +395 -0
  136. package/dist/channel-lifecycle-CpU1dRbh.js +354 -0
  137. package/dist/channel-options-DJaIP4Dv.js +38 -0
  138. package/dist/channel-pairing-D54mn51y.js +66 -0
  139. package/dist/channel-plugin-common-BhTxCE5t.js +1 -0
  140. package/dist/channel-plugin-ids-CFeS3qir.js +26 -0
  141. package/dist/channel-plugin-resolution-DUngfdFj.js +112 -0
  142. package/dist/channel-policy-C4GKHvhz.js +1 -0
  143. package/dist/channel-reply-pipeline-CPTuaW8n.js +15 -0
  144. package/dist/channel-send-result-By8EpCPw.js +40 -0
  145. package/dist/channel-setup-Ck35g7zI.js +49 -0
  146. package/dist/channel-shared-LkXtTPXk.js +308 -0
  147. package/dist/channel-summary-CdYLGMVt.js +137 -0
  148. package/dist/channel-summary-D33z52ft.js +41 -0
  149. package/dist/channel-targets-DfnKGXez.js +87 -0
  150. package/dist/channel.runtime-DAyBR2A5.js +324 -0
  151. package/dist/channel.runtime-DVq5tC2D.js +35 -0
  152. package/dist/channel.runtime-DaLTDGtF.js +288 -0
  153. package/dist/channel.runtime-FKfTev2g.js +512 -0
  154. package/dist/channel.runtime-owqedh1t.js +268 -0
  155. package/dist/channel.runtime-wOTeiifp.js +230 -0
  156. package/dist/channels-CIHgkPea.js +408 -0
  157. package/dist/channels-ZXK6Jiuk.js +1393 -0
  158. package/dist/channels-cli-Bj6qSlkE.js +412 -0
  159. package/dist/channels-status-issues-C_U44M8Y.js +16 -0
  160. package/dist/chat-type-C-n03mQY.js +10 -0
  161. package/dist/clack-prompter-DuzDnaLi.js +112 -0
  162. package/dist/clawbot-cli-YNPuwmTB.js +218 -0
  163. package/dist/cli/daemon-cli.js +88 -0
  164. package/dist/cli-CW46WAZn.js +254 -0
  165. package/dist/cli-name-Daok7A7-.js +25 -0
  166. package/dist/cli-runtime-aAVwbEYy.js +7 -0
  167. package/dist/cli-utils-Np4NAAtt.js +39 -0
  168. package/dist/command-format-CYK9XiUC.js +16 -0
  169. package/dist/command-format-g8YUHNir.js +2 -0
  170. package/dist/command-gating-BQXGSqc9.js +40 -0
  171. package/dist/command-options-5coRiipK.js +25 -0
  172. package/dist/command-poll-backoff-CpkSns-6.js +56 -0
  173. package/dist/command-poll-backoff.runtime-YT6EGcLN.js +7 -0
  174. package/dist/command-registry-BI2MOs89.js +242 -0
  175. package/dist/command-registry-BMsxnuoC.js +14 -0
  176. package/dist/command-secret-gateway-ChXyZwos.js +211 -0
  177. package/dist/command-secret-targets-COcwhn-D.js +88 -0
  178. package/dist/command-secret-targets-CQJT3viO.js +3 -0
  179. package/dist/commands-Bb9xUwz9.js +42 -0
  180. package/dist/commands-core-C1usZXC2.js +4923 -0
  181. package/dist/commands-core.runtime-OTZivlO2.js +232 -0
  182. package/dist/commands-registry-ChCep1KJ.js +295 -0
  183. package/dist/commands-registry.data-XyUTELK9.js +904 -0
  184. package/dist/commands-registry.runtime-m5WTxFtv.js +25 -0
  185. package/dist/commands-status.runtime-C8_hpNgj.js +211 -0
  186. package/dist/commands.runtime-BZPnQKcW.js +232 -0
  187. package/dist/common-CUBlLRXB.js +457 -0
  188. package/dist/compact.runtime-Djmzpbn6.js +216 -0
  189. package/dist/completion-cli-D8tLgE5W.js +445 -0
  190. package/dist/completion-cli-Dz89naVA.js +17 -0
  191. package/dist/config-6sZwvXJD.js +88 -0
  192. package/dist/config-B7tPwoHZ.js +38 -0
  193. package/dist/config-DdDLrP_v.js +273 -0
  194. package/dist/config-cli-C10R8azD.js +945 -0
  195. package/dist/config-guard-B1c73BYQ.js +126 -0
  196. package/dist/config-helpers-3u5wfLBu.js +117 -0
  197. package/dist/config-pn7LKJdW.js +23 -0
  198. package/dist/config-presence-BmUF_5K9.js +79 -0
  199. package/dist/config-regex-CvZFnWkO.js +39 -0
  200. package/dist/config-runtime-CstET7fq.js +142 -0
  201. package/dist/config-schema-5YkIW1xw.js +270 -0
  202. package/dist/config-schema-B1UGMwZ8.js +31 -0
  203. package/dist/config-schema-DzlnsY3D.js +33 -0
  204. package/dist/config-state-CE0CGjey.js +288 -0
  205. package/dist/config-validation-CkVqgkHr.js +272 -0
  206. package/dist/config-value-DgJrpclm.js +25 -0
  207. package/dist/configure-DMkp7Sr4.js +1126 -0
  208. package/dist/configure-DOrQthLy.js +344 -0
  209. package/dist/connection-auth-BSQJeDOU.js +30 -0
  210. package/dist/constants-C_Scc680.js +71 -0
  211. package/dist/control-ui-assets-DjqeIg6A.js +232 -0
  212. package/dist/control-ui-shared-DP000Pxd.js +29 -0
  213. package/dist/conversation-runtime-1O0Aaolb.js +1458 -0
  214. package/dist/core-C7aHA4Aq.js +187 -0
  215. package/dist/core-command-descriptors-DCUYAEZd.js +96 -0
  216. package/dist/credentials-BPwBlm1X.js +265 -0
  217. package/dist/cron-cli-N2Hw_02d.js +579 -0
  218. package/dist/daemon-cli-DgfaF9xx.js +354 -0
  219. package/dist/daemon-install-CbclJo5M.js +134 -0
  220. package/dist/daemon-install-plan.shared-DK6BHlWI.js +222 -0
  221. package/dist/daemon-runtime-CbClrCwc.js +12 -0
  222. package/dist/dangerous-config-flags-BJtLWIk7.js +15 -0
  223. package/dist/dangerous-name-matching-DZa_t0RM.js +44 -0
  224. package/dist/dangerous-tools-yGPDFTHh.js +27 -0
  225. package/dist/date-time-DCAyaBop.js +118 -0
  226. package/dist/dedupe-Cgnk5BbX.js +55 -0
  227. package/dist/defaults-CEdZhIIb.js +6 -0
  228. package/dist/delegate-D4ql5N70.js +43 -0
  229. package/dist/deliver-B004w1Mv.js +212 -0
  230. package/dist/deliver-runtime-IYvc0giI.js +211 -0
  231. package/dist/delivery-queue-B19wDCjT.js +3 -0
  232. package/dist/delivery-queue-DrrqB4Hi.js +299 -0
  233. package/dist/device-auth-GEXe9vqR.js +15 -0
  234. package/dist/device-bootstrap-CwwokLEY.js +96 -0
  235. package/dist/device-bootstrap-Dbhe6oe8.js +1 -0
  236. package/dist/device-metadata-normalization-BDSQ_eA7.js +21 -0
  237. package/dist/device-pairing-cFWbBray.js +553 -0
  238. package/dist/devices-cli-DzycjFzS.js +366 -0
  239. package/dist/diagnostic-DqJXx_4Q.js +310 -0
  240. package/dist/diagnostic-events-ktCoG8Br.js +48 -0
  241. package/dist/diagnostics-CMhyGsPu.js +33 -0
  242. package/dist/diagnostics-DpLHpQ9c.js +14 -0
  243. package/dist/directive-handling.fast-lane-toP_ri_H.js +273 -0
  244. package/dist/directive-handling.impl-BRARyrsT.js +638 -0
  245. package/dist/directive-handling.impl-CUB4MOnK.js +214 -0
  246. package/dist/directive-handling.levels-8vnMeuGX.js +2 -0
  247. package/dist/directive-handling.levels-CoruY1AA.js +13 -0
  248. package/dist/directive-handling.persist.runtime-78Du6PgL.js +170 -0
  249. package/dist/directive-handling.shared-DCGUCHjn.js +147 -0
  250. package/dist/directory-cli-DVsDcgIU.js +437 -0
  251. package/dist/directory-config-helpers-CURJ8mj7.js +129 -0
  252. package/dist/directory-runtime-DhC8QkMq.js +19 -0
  253. package/dist/directory.static-DQaG9ohH.js +44 -0
  254. package/dist/discord-CYj8s73O.js +214 -0
  255. package/dist/discord-L9zvSHVn.js +635 -0
  256. package/dist/discord-core-5tkl-BzP.js +1 -0
  257. package/dist/dm-policy-shared-6bCJzHOS.js +188 -0
  258. package/dist/dns-cli-BMvHy265.js +223 -0
  259. package/dist/docker-XFNiArwM.js +1254 -0
  260. package/dist/docs-cli-BTaH94wD.js +176 -0
  261. package/dist/doctor-completion-DKx5m2UC.js +90 -0
  262. package/dist/doctor-config-preflight-BzQgc3_t.js +40 -0
  263. package/dist/doctor-config-preflight-DxVCut8L.js +150 -0
  264. package/dist/doctor-state-migrations-CTF66iAy.js +732 -0
  265. package/dist/doctor-state-migrations-D0VP4dUh.js +212 -0
  266. package/dist/entry-status-B2OWAf0s.js +172 -0
  267. package/dist/entry.js +210 -0
  268. package/dist/env-BP70DGuy.js +30 -0
  269. package/dist/env-overrides-JneV60sd.js +434 -0
  270. package/dist/env-overrides.runtime-DLrwions.js +18 -0
  271. package/dist/env-substitution-D6t_sLS_.js +136 -0
  272. package/dist/errors-BxyFnvP3.js +58 -0
  273. package/dist/exec-Dmex2w_d.js +310 -0
  274. package/dist/exec-approvals-BJhuySBz.js +386 -0
  275. package/dist/exec-approvals-allowlist-B_wPddCb.js +384 -0
  276. package/dist/exec-approvals-cli-C2dwhSkX.js +427 -0
  277. package/dist/exec-safe-bin-runtime-policy-BZkObC8r.js +89 -0
  278. package/dist/exec-safety-CaaBy-Zw.js +24 -0
  279. package/dist/extension-shared-5txN7IXK.js +74 -0
  280. package/dist/extensionAPI.js +218 -0
  281. package/dist/extensions/amazon-bedrock/index.js +231 -0
  282. package/dist/extensions/anthropic/index.js +330 -0
  283. package/dist/extensions/bluebubbles/index.js +224 -0
  284. package/dist/extensions/bluebubbles/setup-entry.js +289 -0
  285. package/dist/extensions/brave/index.js +23 -0
  286. package/dist/extensions/byteplus/index.js +112 -0
  287. package/dist/extensions/chutes/index.js +221 -0
  288. package/dist/extensions/cloudflare-ai-gateway/index.js +218 -0
  289. package/dist/extensions/copilot-proxy/index.js +125 -0
  290. package/dist/extensions/device-pair/index.js +1040 -0
  291. package/dist/extensions/discord/index.js +215 -0
  292. package/dist/extensions/discord/setup-entry.js +215 -0
  293. package/dist/extensions/elevenlabs/index.js +223 -0
  294. package/dist/extensions/fal/index.js +112 -0
  295. package/dist/extensions/feishu/index.js +227 -0
  296. package/dist/extensions/feishu/setup-entry.js +112 -0
  297. package/dist/extensions/firecrawl/index.js +211 -0
  298. package/dist/extensions/github-copilot/index.js +490 -0
  299. package/dist/extensions/google/index.js +211 -0
  300. package/dist/extensions/huggingface/index.js +108 -0
  301. package/dist/extensions/imessage/index.js +223 -0
  302. package/dist/extensions/imessage/setup-entry.js +220 -0
  303. package/dist/extensions/irc/index.js +220 -0
  304. package/dist/extensions/irc/setup-entry.js +222 -0
  305. package/dist/extensions/kilocode/index.js +282 -0
  306. package/dist/extensions/kimi-coding/index.js +148 -0
  307. package/dist/extensions/line/index.js +57 -0
  308. package/dist/extensions/line/setup-entry.js +49 -0
  309. package/dist/extensions/llm-task/index.js +157 -0
  310. package/dist/extensions/lobster/index.js +261 -0
  311. package/dist/extensions/mattermost/index.js +220 -0
  312. package/dist/extensions/mattermost/setup-entry.js +222 -0
  313. package/dist/extensions/memory-core/index.js +36 -0
  314. package/dist/extensions/microsoft/index.js +223 -0
  315. package/dist/extensions/minimax/index.js +437 -0
  316. package/dist/extensions/mistral/index.js +149 -0
  317. package/dist/extensions/modelstudio/index.js +144 -0
  318. package/dist/extensions/moonshot/index.js +211 -0
  319. package/dist/extensions/nextcloud-talk/index.js +221 -0
  320. package/dist/extensions/nextcloud-talk/setup-entry.js +223 -0
  321. package/dist/extensions/nvidia/index.js +29 -0
  322. package/dist/extensions/ollama/index.js +118 -0
  323. package/dist/extensions/open-prose/index.js +10 -0
  324. package/dist/extensions/openai/index.js +677 -0
  325. package/dist/extensions/opencode/index.js +116 -0
  326. package/dist/extensions/opencode-go/index.js +114 -0
  327. package/dist/extensions/openrouter/index.js +398 -0
  328. package/dist/extensions/openshell/index.js +923 -0
  329. package/dist/extensions/perplexity/index.js +23 -0
  330. package/dist/extensions/phone-control/index.js +276 -0
  331. package/dist/extensions/qianfan/index.js +114 -0
  332. package/dist/extensions/qwen-portal-auth/index.js +350 -0
  333. package/dist/extensions/sglang/index.js +285 -0
  334. package/dist/extensions/signal/index.js +218 -0
  335. package/dist/extensions/signal/setup-entry.js +218 -0
  336. package/dist/extensions/slack/index.js +222 -0
  337. package/dist/extensions/slack/setup-entry.js +220 -0
  338. package/dist/extensions/synology-chat/index.js +56 -0
  339. package/dist/extensions/synology-chat/setup-entry.js +58 -0
  340. package/dist/extensions/synthetic/index.js +112 -0
  341. package/dist/extensions/talk-voice/index.js +197 -0
  342. package/dist/extensions/tavily/index.js +211 -0
  343. package/dist/extensions/telegram/index.js +221 -0
  344. package/dist/extensions/telegram/setup-entry.js +221 -0
  345. package/dist/extensions/thread-ownership/index.js +70 -0
  346. package/dist/extensions/together/index.js +113 -0
  347. package/dist/extensions/venice/index.js +132 -0
  348. package/dist/extensions/vercel-ai-gateway/index.js +86 -0
  349. package/dist/extensions/vllm/index.js +285 -0
  350. package/dist/extensions/voice-call/index.js +5715 -0
  351. package/dist/extensions/volcengine/index.js +112 -0
  352. package/dist/extensions/xai/index.js +211 -0
  353. package/dist/extensions/xiaomi/index.js +115 -0
  354. package/dist/extensions/zai/index.js +559 -0
  355. package/dist/extensions/zalo/index.js +225 -0
  356. package/dist/extensions/zalo/setup-entry.js +226 -0
  357. package/dist/external-content-BUdUOqkv.js +238 -0
  358. package/dist/feishu-CgbwAF0e.js +2664 -0
  359. package/dist/feishu-Dh5fEbh5.js +59127 -0
  360. package/dist/fetch-guard-DIyN1HW5.js +165 -0
  361. package/dist/fetch-timeout-C5xpMuGd.js +36 -0
  362. package/dist/file-identity-Cw0fQxYY.js +11 -0
  363. package/dist/file-lock-WbEmczmY.js +107 -0
  364. package/dist/filter-oMGaNOM1.js +20 -0
  365. package/dist/format-DH8ysi7s.js +19 -0
  366. package/dist/format-datetime-BGS6tLDE.js +73 -0
  367. package/dist/format-duration-CO0BGWB0.js +57 -0
  368. package/dist/format-relative-C3nDxnXz.js +54 -0
  369. package/dist/frontmatter-S5vS-I4a.js +309 -0
  370. package/dist/fs-safe-D3qzH-ab.js +731 -0
  371. package/dist/gateway-cli-PQNp7o0j.js +28378 -0
  372. package/dist/gateway-install-token-DV5KjD4F.js +164 -0
  373. package/dist/gateway-rpc-C0Ey-rik.js +26 -0
  374. package/dist/gateway-runtime-ih2e7a2K.js +42 -0
  375. package/dist/gaxios-fetch-compat-KX6bsqFm.js +165 -0
  376. package/dist/gemini-auth-B5ljg7jr.js +29 -0
  377. package/dist/git-commit-BIdLubm5.js +2 -0
  378. package/dist/git-commit-OvUvjri2.js +177 -0
  379. package/dist/github-copilot-auth-Ccm-cBwy.js +104 -0
  380. package/dist/global-singleton-4KwY5RvX.js +13 -0
  381. package/dist/globals-41sdSaKv.js +38 -0
  382. package/dist/gmail-setup-utils-BX68dZla.js +419 -0
  383. package/dist/group-access-DJZrYPx1.js +113 -0
  384. package/dist/group-keys-BD_IYSMs.js +44 -0
  385. package/dist/group-policy-CWFxv3iB.js +201 -0
  386. package/dist/group-policy-warnings-Ddu6lBkh.js +175 -0
  387. package/dist/health-Bu1sbyYy.js +573 -0
  388. package/dist/health-Cbxc9Bn3.js +59 -0
  389. package/dist/health-format-B5XfOTuJ.js +26 -0
  390. package/dist/heartbeat-7aHh0m3d.js +169 -0
  391. package/dist/heartbeat-summary-Das49TYq.js +57 -0
  392. package/dist/help-CcbF7-ha.js +81 -0
  393. package/dist/help-format-Dv45FpYu.js +15 -0
  394. package/dist/helpers-DJ-5HEbE.js +24 -0
  395. package/dist/helpers-MxyaLZUk.js +32 -0
  396. package/dist/history-CHjo8B5W.js +102 -0
  397. package/dist/hook-runtime-BnNBi_q4.js +1 -0
  398. package/dist/hooks-cli-DUYK4RM1.js +1102 -0
  399. package/dist/hooks-policy-BL6HDLUn.js +20 -0
  400. package/dist/hooks-status-gzNmo3li.js +78 -0
  401. package/dist/host-env-security-BogNN146.js +223 -0
  402. package/dist/http-body-CCiSfloA.js +237 -0
  403. package/dist/http-registry-WFFbLYRd.js +153 -0
  404. package/dist/identity-DovQV4zD.js +112 -0
  405. package/dist/identity-cyBYcoXS.js +84 -0
  406. package/dist/identity-file-EndG1nfc.js +60 -0
  407. package/dist/image-generation-CNKc-mFK.js +441 -0
  408. package/dist/image-kJ7Tbov4.js +211 -0
  409. package/dist/image-ops-j01UkxEv.js +371 -0
  410. package/dist/imessage-B5pSMT47.js +219 -0
  411. package/dist/imessage-CoIuY1Ro.js +1451 -0
  412. package/dist/imessage-Cqjsq4VW.js +190 -0
  413. package/dist/imessage-core-CsYJuaRZ.js +1 -0
  414. package/dist/inbound-envelope-4P3IIJc3.js +61 -0
  415. package/dist/inbound-reply-dispatch-i2Vekqyy.js +72 -0
  416. package/dist/includes-7XyL3p1c.js +188 -0
  417. package/dist/includes-scan-y-rS6tTw.js +55 -0
  418. package/dist/index.js +57 -0
  419. package/dist/infra/warning-filter.js +2 -0
  420. package/dist/inspect-CcxlJ1ba.js +279 -0
  421. package/dist/install-safe-path-Rwbw1XCZ.js +62 -0
  422. package/dist/installs-iHi2aSjM.js +532 -0
  423. package/dist/interactive-F7iY0yED.js +8 -0
  424. package/dist/interactive-runtime-OweOj_Vv.js +90 -0
  425. package/dist/internal-hooks-0uipqzRY.js +156 -0
  426. package/dist/io-BX49DsSJ.js +35 -0
  427. package/dist/io-jOnQRia2.js +7178 -0
  428. package/dist/ip-C8vmzVu0.js +203 -0
  429. package/dist/ipv4-DAmsJVOV.js +82 -0
  430. package/dist/irc-AZ-Ec8be.js +12 -0
  431. package/dist/irc-CCSRuEC2.js +660 -0
  432. package/dist/is-main-YViS6wOn.js +27 -0
  433. package/dist/issue-format-CBEXVico.js +31 -0
  434. package/dist/issue-format-D3HehoKZ.js +4 -0
  435. package/dist/json-file-C2zjA0Gv.js +23 -0
  436. package/dist/json-files-WW-H_psG.js +60 -0
  437. package/dist/json-pointer-f9dEnBoR.js +43 -0
  438. package/dist/json-store-O1LwpnBH.js +37 -0
  439. package/dist/kb-cli-DMZs6PCu.js +65 -0
  440. package/dist/keyed-async-queue-CPUWV5Pm.js +32 -0
  441. package/dist/kill-tree-CbjXBw3z.js +149 -0
  442. package/dist/kilocode-shared-DS7_0IMs.js +29 -0
  443. package/dist/launchd-tyqGVx9U.js +491 -0
  444. package/dist/lazy-runtime-BcXbyAaC.js +1 -0
  445. package/dist/lazy-runtime-bWkd2cs3.js +29 -0
  446. package/dist/legacy-names-CUNZ4vHN.js +7 -0
  447. package/dist/legacy-web-search-BgZjNG2h.js +222 -0
  448. package/dist/lib-CERS7N4b.js +503 -0
  449. package/dist/lib-PPICrHv1.js +1938 -0
  450. package/dist/library-CZ461krl.js +211 -0
  451. package/dist/lifecycle-core-Dnxnw0oy.js +382 -0
  452. package/dist/line/accounts.js +10 -0
  453. package/dist/line/send.js +39 -0
  454. package/dist/line/template-messages.js +2 -0
  455. package/dist/line-CJSvwApm.js +1 -0
  456. package/dist/line-N9vL-2JB.js +688 -0
  457. package/dist/line-core-BOIxkjgu.js +1 -0
  458. package/dist/links-Bilm-v0z.js +13 -0
  459. package/dist/llm-slug-generator-BuAuQ5Ft.js +68 -0
  460. package/dist/llm-slug-generator.js +212 -0
  461. package/dist/llm-task-Dx8ymRFr.js +1 -0
  462. package/dist/local-roots-DAzCjWbC.js +34 -0
  463. package/dist/location-DefAH9WS.js +42 -0
  464. package/dist/logger-CoEtkjhn.js +550 -0
  465. package/dist/logger-Cqy7-Maj.js +70 -0
  466. package/dist/logging-B2wMcpWV.js +13 -0
  467. package/dist/logging-Bz1qZDPg.js +16 -0
  468. package/dist/logging-CArEWRgI.js +36 -0
  469. package/dist/logging-CbTTfADU.js +1 -0
  470. package/dist/logs-cli-BSjKwaur.js +261 -0
  471. package/dist/magic-string.es-DJPWMt-n.js +1011 -0
  472. package/dist/main-session-DKr0lBVk.js +36 -0
  473. package/dist/manager-ChTGDe87.js +2005 -0
  474. package/dist/manager-DuwFn87U.js +4226 -0
  475. package/dist/manager-runtime-E16jsvRe.js +59 -0
  476. package/dist/manager.runtime-F9F1eFiB.js +827 -0
  477. package/dist/manifest-registry-B90TyTWl.js +1350 -0
  478. package/dist/map-size-CMTQVKUV.js +15 -0
  479. package/dist/markdown-to-line-BWwaRx5F.js +640 -0
  480. package/dist/mask-api-key-CprzEe7l.js +10 -0
  481. package/dist/matrix-DzvdUw97.js +228 -0
  482. package/dist/matrix-migration-snapshot-adoDbNii.js +702 -0
  483. package/dist/mattermost-DO0BCfF3.js +1 -0
  484. package/dist/mattermost-SjOt4QDb.js +15 -0
  485. package/dist/mcp-cli-BC_VPl_o.js +94 -0
  486. package/dist/mcp-config-Coky4zS4.js +108 -0
  487. package/dist/media-limits-Cuvmmhop.js +14 -0
  488. package/dist/media-understanding-DD2uMjK8.js +48 -0
  489. package/dist/media-understanding.runtime-Kbb2bRmk.js +216 -0
  490. package/dist/memory-DBjQ0TPd.js +1 -0
  491. package/dist/memory-cli-Cm4Df0hJ.js +215 -0
  492. package/dist/memory-cli-yzqneSF8.js +541 -0
  493. package/dist/memory-search-Das1tiuB.js +204 -0
  494. package/dist/memory-search-DxmSTjHq.js +18 -0
  495. package/dist/mention-gating-B_q-EHFx.js +25 -0
  496. package/dist/mentions-Bxys_va0.js +154 -0
  497. package/dist/message-channel-Cy-gN4K2.js +106 -0
  498. package/dist/message-hook-mappers-BBTV3JRQ.js +249 -0
  499. package/dist/method-scopes-DgypDW23.js +2649 -0
  500. package/dist/mime-C4vVTBso.js +150 -0
  501. package/dist/minimal-C5yUxtHy.js +2120 -0
  502. package/dist/model-auth-B__TJTPw.js +309 -0
  503. package/dist/model-auth-env-CF9ts7Th.js +111 -0
  504. package/dist/model-catalog.runtime-CWh17vcc.js +211 -0
  505. package/dist/model-id-normalization-Y-MIsyK_.js +16 -0
  506. package/dist/model-input-BB2wSAHb.js +20 -0
  507. package/dist/model-overrides-sIzKU2wo.js +84 -0
  508. package/dist/model-param-b-DIFEhICm.js +15 -0
  509. package/dist/model-picker-CAPjetT3.js +400 -0
  510. package/dist/model-picker-DEw9viWc.js +215 -0
  511. package/dist/model-picker.runtime-ixYl7lB5.js +224 -0
  512. package/dist/model-selection-BTpJnslv.js +437 -0
  513. package/dist/model-selection-Ci9cPkL2.js +765 -0
  514. package/dist/model-suppression.runtime-D8cIb6Y5.js +216 -0
  515. package/dist/models-BQtc3khN.js +226 -0
  516. package/dist/models-CQgBV5dW.js +2536 -0
  517. package/dist/models-cli-DbQ-QpQk.js +418 -0
  518. package/dist/models-config-D2xK-G6c.js +211 -0
  519. package/dist/models-config.providers.discovery-BaIk1NKL.js +141 -0
  520. package/dist/models-config.runtime-Cf7q9uAQ.js +211 -0
  521. package/dist/monitor-B5QmKaD7.js +3272 -0
  522. package/dist/monitor-CL5OYLih.js +878 -0
  523. package/dist/monitor-CNZxrM4d.js +3145 -0
  524. package/dist/monitor-CyQVZdDh.js +223 -0
  525. package/dist/multimodal-DC43jYNv.js +75 -0
  526. package/dist/mutable-allowlist-detectors-C6EAzWYE.js +62 -0
  527. package/dist/net-DlJFp95v.js +270 -0
  528. package/dist/network-mode-DOgvmom4.js +17 -0
  529. package/dist/nextcloud-talk-ChMP88s-.js +12 -0
  530. package/dist/nextcloud-talk-CwnkUy8E.js +1 -0
  531. package/dist/node-cli-BZDC7rXg.js +2484 -0
  532. package/dist/node-command-policy-Bg2g6Xjp.js +192 -0
  533. package/dist/node-commands-B6W6Eo0b.js +11 -0
  534. package/dist/node-require-BgDD9bTi.js +14 -0
  535. package/dist/node-resolve-BunMro3f.js +69 -0
  536. package/dist/node-service-CEZZaqba.js +65 -0
  537. package/dist/node-startup-env-Gz8ZQniA.js +50 -0
  538. package/dist/nodes-cli-B4Jr9vct.js +1330 -0
  539. package/dist/nodes-screen-CQ7IvP62.js +401 -0
  540. package/dist/normalize-secret-input-_PgpexOG.js +32 -0
  541. package/dist/note-dfjacCV8.js +109 -0
  542. package/dist/npm-pack-install-CYNRv-vM.js +574 -0
  543. package/dist/npm-resolution-Ml2aA6Nu.js +60 -0
  544. package/dist/oauth.runtime-DA_48MPQ.js +687 -0
  545. package/dist/oauth.runtime-DS1ry5__.js +318 -0
  546. package/dist/oauth.runtime-qCkidk8J.js +180 -0
  547. package/dist/ollama-defaults-asNuGW4_.js +4 -0
  548. package/dist/onboard-BM6gO6Uw.js +589 -0
  549. package/dist/onboard-D9IU-7uw.js +48 -0
  550. package/dist/onboard-DQaHGPRm.js +25 -0
  551. package/dist/onboard-channels-BdQtLjYb.js +300 -0
  552. package/dist/onboard-channels-DIVUygs5.js +1257 -0
  553. package/dist/onboard-config-DFKb-0sE.js +29 -0
  554. package/dist/onboard-config-DYykzJhx.js +2 -0
  555. package/dist/onboard-custom-CDP4w1AT.js +216 -0
  556. package/dist/onboard-custom-DhJN13UV.js +644 -0
  557. package/dist/onboard-helpers-B7XTd4Pw.js +335 -0
  558. package/dist/onboard-helpers-BUKtx5Bq.js +54 -0
  559. package/dist/onboard-hooks-BHSSLAhI.js +73 -0
  560. package/dist/onboard-remote-BOzEPdHA.js +59 -0
  561. package/dist/onboard-remote-DVza19_k.js +182 -0
  562. package/dist/onboard-search-CrS-n9_3.js +446 -0
  563. package/dist/onboard-skills-BojzIPvk.js +133 -0
  564. package/dist/onboard-skills-D7HyCVjz.js +69 -0
  565. package/dist/openai-codex-provider.runtime-BFsopDHI.js +2 -0
  566. package/dist/openai-defaults-B7FUywsh.js +10 -0
  567. package/dist/openclaw-exec-env-AcZ9we1N.js +14 -0
  568. package/dist/openclaw-root-TUHYdr9B.js +88 -0
  569. package/dist/openclaw-tools.runtime-draZJo5r.js +211 -0
  570. package/dist/outbound-media-69yrWRDt.js +11 -0
  571. package/dist/outbound-runtime-ic_7ulJJ.js +1 -0
  572. package/dist/pairing-challenge-CNrPmmi9.js +48 -0
  573. package/dist/pairing-cli-BohXW2BK.js +150 -0
  574. package/dist/pairing-labels-CNKCSmBK.js +7 -0
  575. package/dist/pairing-message-CBv2njJT.js +4 -0
  576. package/dist/pairing-store-C4lsd4pO.js +590 -0
  577. package/dist/pairing-token-gKj4SNFJ.js +55 -0
  578. package/dist/parse-duration-BBGYkY0S.js +41 -0
  579. package/dist/parse-finite-number-CP4MQF_w.js +30 -0
  580. package/dist/parse-log-line-CVh9zu3Q.js +43 -0
  581. package/dist/parse-port-COyt3COn.js +8 -0
  582. package/dist/path-alias-guards-ZTKqurNH.js +40 -0
  583. package/dist/path-env-CPkz6U0Y.js +87 -0
  584. package/dist/paths-CTjJI9l0.js +179 -0
  585. package/dist/paths-GHJ97ebE.js +268 -0
  586. package/dist/paths-nCHyK08H.js +56 -0
  587. package/dist/perplexity-Beshd9zu.js +422 -0
  588. package/dist/persistent-dedupe-bjKjVI5u.js +116 -0
  589. package/dist/pi-embedded-CSQySvOV.js +168518 -0
  590. package/dist/pi-model-discovery-CuX5CDyZ.js +125 -0
  591. package/dist/pi-model-discovery-runtime-DNsMrX1n.js +44 -0
  592. package/dist/pi-tools.before-tool-call.runtime-DxVqzMVf.js +387 -0
  593. package/dist/platform-launcher-CqGy6UhP.js +83 -0
  594. package/dist/plugin-entry-CwuwM1jC.js +17 -0
  595. package/dist/plugin-install-JJwfOXtg.js +216 -0
  596. package/dist/plugin-install-plan-cixz1_W4.js +49 -0
  597. package/dist/plugin-install-vkpI1UNd.js +184 -0
  598. package/dist/plugin-registry-C3j_DUnj.js +51 -0
  599. package/dist/plugin-registry-DB_yxabS.js +213 -0
  600. package/dist/plugin-sdk/account-helpers.js +3 -0
  601. package/dist/plugin-sdk/account-id.js +2 -0
  602. package/dist/plugin-sdk/account-resolution.js +216 -0
  603. package/dist/plugin-sdk/acp-runtime.js +46 -0
  604. package/dist/plugin-sdk/agent-runtime.js +215 -0
  605. package/dist/plugin-sdk/allow-from.js +17 -0
  606. package/dist/plugin-sdk/allowlist-config-edit.js +2 -0
  607. package/dist/plugin-sdk/bluebubbles.js +232 -0
  608. package/dist/plugin-sdk/boolean-param.js +2 -0
  609. package/dist/plugin-sdk/channel-actions.js +16 -0
  610. package/dist/plugin-sdk/channel-config-helpers.js +15 -0
  611. package/dist/plugin-sdk/channel-config-schema.js +5 -0
  612. package/dist/plugin-sdk/channel-contract.js +1 -0
  613. package/dist/plugin-sdk/channel-feedback.js +4 -0
  614. package/dist/plugin-sdk/channel-inbound.js +53 -0
  615. package/dist/plugin-sdk/channel-lifecycle.js +2 -0
  616. package/dist/plugin-sdk/channel-pairing.js +2 -0
  617. package/dist/plugin-sdk/channel-policy.js +19 -0
  618. package/dist/plugin-sdk/channel-reply-pipeline.js +23 -0
  619. package/dist/plugin-sdk/channel-runtime.js +33 -0
  620. package/dist/plugin-sdk/channel-send-result.js +2 -0
  621. package/dist/plugin-sdk/channel-setup.js +24 -0
  622. package/dist/plugin-sdk/channel-targets.js +3 -0
  623. package/dist/plugin-sdk/cli-runtime.js +5 -0
  624. package/dist/plugin-sdk/command-auth.js +212 -0
  625. package/dist/plugin-sdk/compat.js +59 -0
  626. package/dist/plugin-sdk/config-runtime.js +51 -0
  627. package/dist/plugin-sdk/conversation-runtime.js +55 -0
  628. package/dist/plugin-sdk/core.js +40 -0
  629. package/dist/plugin-sdk/device-bootstrap.js +6 -0
  630. package/dist/plugin-sdk/diagnostics-otel.js +7 -0
  631. package/dist/plugin-sdk/diffs.js +3 -0
  632. package/dist/plugin-sdk/directory-runtime.js +5 -0
  633. package/dist/plugin-sdk/discord-core.js +26 -0
  634. package/dist/plugin-sdk/discord.js +219 -0
  635. package/dist/plugin-sdk/extension-shared.js +15 -0
  636. package/dist/plugin-sdk/feishu.js +101 -0
  637. package/dist/plugin-sdk/gateway-runtime.js +46 -0
  638. package/dist/plugin-sdk/googlechat.js +93 -0
  639. package/dist/plugin-sdk/group-access.js +2 -0
  640. package/dist/plugin-sdk/hook-runtime.js +12 -0
  641. package/dist/plugin-sdk/image-generation.js +51 -0
  642. package/dist/plugin-sdk/imessage-core.js +214 -0
  643. package/dist/plugin-sdk/imessage.js +223 -0
  644. package/dist/plugin-sdk/index.js +55 -0
  645. package/dist/plugin-sdk/infra-runtime.js +223 -0
  646. package/dist/plugin-sdk/interactive-runtime.js +3 -0
  647. package/dist/plugin-sdk/irc.js +232 -0
  648. package/dist/plugin-sdk/json-store.js +9 -0
  649. package/dist/plugin-sdk/keyed-async-queue.js +2 -0
  650. package/dist/plugin-sdk/lazy-runtime.js +2 -0
  651. package/dist/plugin-sdk/line-core.js +29 -0
  652. package/dist/plugin-sdk/line.js +22 -0
  653. package/dist/plugin-sdk/llm-task.js +7 -0
  654. package/dist/plugin-sdk/matrix-runtime-heavy.js +223 -0
  655. package/dist/plugin-sdk/matrix-runtime-shared.js +2 -0
  656. package/dist/plugin-sdk/matrix.js +84 -0
  657. package/dist/plugin-sdk/mattermost.js +233 -0
  658. package/dist/plugin-sdk/media-runtime.js +212 -0
  659. package/dist/plugin-sdk/media-understanding-runtime.js +211 -0
  660. package/dist/plugin-sdk/media-understanding.js +15 -0
  661. package/dist/plugin-sdk/memory-core.js +2 -0
  662. package/dist/plugin-sdk/memory-lancedb.js +2 -0
  663. package/dist/plugin-sdk/msteams.js +244 -0
  664. package/dist/plugin-sdk/nextcloud-talk.js +231 -0
  665. package/dist/plugin-sdk/nostr.js +50 -0
  666. package/dist/plugin-sdk/ollama-setup.js +33 -0
  667. package/dist/plugin-sdk/outbound-runtime.js +23 -0
  668. package/dist/plugin-sdk/plugin-entry.js +3 -0
  669. package/dist/plugin-sdk/plugin-runtime.js +211 -0
  670. package/dist/plugin-sdk/process-runtime.js +12 -0
  671. package/dist/plugin-sdk/provider-auth-api-key.js +53 -0
  672. package/dist/plugin-sdk/provider-auth-login.js +2 -0
  673. package/dist/plugin-sdk/provider-auth.js +37 -0
  674. package/dist/plugin-sdk/provider-catalog.js +2 -0
  675. package/dist/plugin-sdk/provider-env-vars.js +2 -0
  676. package/dist/plugin-sdk/provider-google.js +3 -0
  677. package/dist/plugin-sdk/provider-models.js +27 -0
  678. package/dist/plugin-sdk/provider-onboard.js +20 -0
  679. package/dist/plugin-sdk/provider-setup.js +58 -0
  680. package/dist/plugin-sdk/provider-stream.js +211 -0
  681. package/dist/plugin-sdk/provider-usage.js +18 -0
  682. package/dist/plugin-sdk/provider-web-search.js +23 -0
  683. package/dist/plugin-sdk/provider-zai-endpoint.js +3 -0
  684. package/dist/plugin-sdk/reply-history.js +23 -0
  685. package/dist/plugin-sdk/reply-payload.js +2 -0
  686. package/dist/plugin-sdk/reply-runtime.js +211 -0
  687. package/dist/plugin-sdk/request-url.js +2 -0
  688. package/dist/plugin-sdk/routing.js +25 -0
  689. package/dist/plugin-sdk/runtime-env.js +15 -0
  690. package/dist/plugin-sdk/runtime-store.js +2 -0
  691. package/dist/plugin-sdk/runtime.js +15 -0
  692. package/dist/plugin-sdk/sandbox.js +66 -0
  693. package/dist/plugin-sdk/secret-input.js +3 -0
  694. package/dist/plugin-sdk/security-runtime.js +18 -0
  695. package/dist/plugin-sdk/self-hosted-provider-setup.js +33 -0
  696. package/dist/plugin-sdk/setup-adapter-runtime.js +2 -0
  697. package/dist/plugin-sdk/setup-runtime.js +17 -0
  698. package/dist/plugin-sdk/setup-tools.js +21 -0
  699. package/dist/plugin-sdk/setup.js +26 -0
  700. package/dist/plugin-sdk/signal.js +220 -0
  701. package/dist/plugin-sdk/slack-core.js +22 -0
  702. package/dist/plugin-sdk/slack.js +223 -0
  703. package/dist/plugin-sdk/speech-runtime.js +213 -0
  704. package/dist/plugin-sdk/speech.js +212 -0
  705. package/dist/plugin-sdk/ssrf-runtime.js +5 -0
  706. package/dist/plugin-sdk/state-paths.js +3 -0
  707. package/dist/plugin-sdk/status-helpers.js +9 -0
  708. package/dist/plugin-sdk/telegram-core.js +23 -0
  709. package/dist/plugin-sdk/telegram.js +224 -0
  710. package/dist/plugin-sdk/testing.js +13174 -0
  711. package/dist/plugin-sdk/text-runtime.js +45 -0
  712. package/dist/plugin-sdk/thread-bindings-runtime.js +2 -0
  713. package/dist/plugin-sdk/thread-ownership.js +2 -0
  714. package/dist/plugin-sdk/tlon.js +57 -0
  715. package/dist/plugin-sdk/tool-send.js +2 -0
  716. package/dist/plugin-sdk/twitch.js +46 -0
  717. package/dist/plugin-sdk/voice-call.js +213 -0
  718. package/dist/plugin-sdk/web-media.js +28 -0
  719. package/dist/plugin-sdk/webhook-ingress.js +7 -0
  720. package/dist/plugin-sdk/webhook-path.js +2 -0
  721. package/dist/plugin-sdk/whatsapp-core.js +219 -0
  722. package/dist/plugin-sdk/whatsapp-shared.js +18 -0
  723. package/dist/plugin-sdk/windows-spawn.js +2 -0
  724. package/dist/plugin-sdk/zalo.js +239 -0
  725. package/dist/plugin-sdk/zalouser.js +240 -0
  726. package/dist/plugins/build-smoke-entry.js +211 -0
  727. package/dist/plugins/runtime/index.js +229 -0
  728. package/dist/plugins-1Z50ecJ6.js +1 -0
  729. package/dist/plugins-C6fKmNuA.js +7 -0
  730. package/dist/plugins-cli-BkgQkGaU.js +1192 -0
  731. package/dist/policy-CpkbSAfm.js +60 -0
  732. package/dist/polls-B2VH7SN9.js +35 -0
  733. package/dist/ports-BjWuIIQw.js +262 -0
  734. package/dist/ports-DFiK_Jc-.js +385 -0
  735. package/dist/ports-lsof-DtJqhFOr.js +25 -0
  736. package/dist/ports-probe-BQqp8l8E.js +14 -0
  737. package/dist/preflight-audio.runtime-Fi9mofpp.js +216 -0
  738. package/dist/probe-BM9sbCgS.js +20 -0
  739. package/dist/probe-DLBOZftS.js +134 -0
  740. package/dist/probe-auth-Bjp3G4CI.js +48 -0
  741. package/dist/probe-auth-DMSPTRRk.js +45 -0
  742. package/dist/process-runtime-C7el-Ri4.js +1 -0
  743. package/dist/process-scoped-map-C4gOa-gv.js +61 -0
  744. package/dist/profile-utils-BcMYGFPT.js +15 -0
  745. package/dist/profiles-D17eMKQZ.js +683 -0
  746. package/dist/program-Ch-76sgl.js +155 -0
  747. package/dist/program-context-BMWNUfqL.js +10 -0
  748. package/dist/program-context-CD_RvRYh.js +2 -0
  749. package/dist/progress-D1r9bZU1.js +132 -0
  750. package/dist/prompt-select-styled-NUKYS9QR.js +4879 -0
  751. package/dist/prompt-style-BvciNCqy.js +7 -0
  752. package/dist/prompts-NtuylUyl.js +9 -0
  753. package/dist/prototype-keys-Cm_8mWvq.js +11 -0
  754. package/dist/provider-api-key-auth-BE0taXiB.js +108 -0
  755. package/dist/provider-api-key-auth.runtime-jDZZUAMX.js +34 -0
  756. package/dist/provider-auth-Bw8x1a3o.js +58 -0
  757. package/dist/provider-auth-api-key-BrQYvdxi.js +1 -0
  758. package/dist/provider-auth-choice-BYbPq0eC.js +128 -0
  759. package/dist/provider-auth-choice-helpers-Bj1GkOSn.js +48 -0
  760. package/dist/provider-auth-choice-preference-tKq5gaJL.js +192 -0
  761. package/dist/provider-auth-choice.runtime-DegPpvRJ.js +223 -0
  762. package/dist/provider-auth-choices-QSilukI1.js +58 -0
  763. package/dist/provider-auth-guidance-gninjjq8.js +34 -0
  764. package/dist/provider-auth-helpers-B0dS-1WK.js +86 -0
  765. package/dist/provider-auth-input-BftBdgvW.js +112 -0
  766. package/dist/provider-auth-login-D0n0lMuc.js +8 -0
  767. package/dist/provider-auth-login.runtime-LvuBkQrc.js +243 -0
  768. package/dist/provider-auth-mode-sTdccIKL.js +20 -0
  769. package/dist/provider-auth-ref-BS3gwrNr.js +168 -0
  770. package/dist/provider-auth-ref-BmEcEN7K.js +3 -0
  771. package/dist/provider-catalog--18-pW5t.js +11 -0
  772. package/dist/provider-catalog-2P2hel74.js +48 -0
  773. package/dist/provider-catalog-B0FqWSwe.js +48 -0
  774. package/dist/provider-catalog-BvORKzzD.js +91 -0
  775. package/dist/provider-catalog-C34j1_or.js +26 -0
  776. package/dist/provider-catalog-C5vmXjmb.js +11 -0
  777. package/dist/provider-catalog-CBufm2Dr.js +36 -0
  778. package/dist/provider-catalog-D7QvsUXS.js +12 -0
  779. package/dist/provider-catalog-DKy_dzQZ.js +41 -0
  780. package/dist/provider-env-vars-CsQlY7bF.js +110 -0
  781. package/dist/provider-id-BpXo5t6v.js +31 -0
  782. package/dist/provider-model-allowlist-4HSOnlX-.js +24 -0
  783. package/dist/provider-model-primary-NJ-xlhec.js +53 -0
  784. package/dist/provider-models-C2EjYMwW.js +2416 -0
  785. package/dist/provider-oauth-flow-BQN6F6EC.js +33 -0
  786. package/dist/provider-ollama-setup-DhQvDwAj.js +309 -0
  787. package/dist/provider-onboard-CjOfyeQG.js +1 -0
  788. package/dist/provider-onboarding-config-DOZ3pFA6.js +165 -0
  789. package/dist/provider-openai-codex-oauth-tls-Bo8U4D3E.js +101 -0
  790. package/dist/provider-runtime.runtime-DnP2jpoM.js +211 -0
  791. package/dist/provider-self-hosted-setup-CUrmsugW.js +182 -0
  792. package/dist/provider-usage-ClDVmkhl.js +633 -0
  793. package/dist/provider-usage-DIC6cn-3.js +211 -0
  794. package/dist/provider-web-search-NzK8ep1E.js +507 -0
  795. package/dist/provider-wizard-C6jCuyQe.js +236 -0
  796. package/dist/provider-zai-endpoint-DeDABzT4.js +106 -0
  797. package/dist/proxy-H5O2p6AP.js +121 -0
  798. package/dist/proxy-env-DG2u55RW.js +40 -0
  799. package/dist/push-apns-D4zD2tmP.js +1050 -0
  800. package/dist/pw-ai-BuPUVeUK.js +1876 -0
  801. package/dist/qmd-manager-BpygGMW9.js +1571 -0
  802. package/dist/qr-cli-DnWHXcxh.js +370 -0
  803. package/dist/qr-cli-yaZ0FZ6z.js +213 -0
  804. package/dist/query-expansion-Do45hILP.js +1114 -0
  805. package/dist/reactions-BcC_XZqD.js +281 -0
  806. package/dist/read-only-account-inspect-DPJzadPo.js +42 -0
  807. package/dist/read-only-account-inspect.discord.runtime-CW9DDKH8.js +216 -0
  808. package/dist/read-only-account-inspect.slack.runtime-BcXBPyh3.js +216 -0
  809. package/dist/read-only-account-inspect.telegram.runtime-Y7h0Jbdj.js +216 -0
  810. package/dist/redact-BDinS1q9.js +102 -0
  811. package/dist/redact-identifier-FUiWQxv5.js +13 -0
  812. package/dist/redact-snapshot-DBPmeYy2.js +2654 -0
  813. package/dist/ref-contract-CCBBbf1r.js +53 -0
  814. package/dist/register-CppP7Ddc.js +43 -0
  815. package/dist/register.agent-BOD5ROGQ.js +546 -0
  816. package/dist/register.backup-Y2VGqcRu.js +269 -0
  817. package/dist/register.configure-1qiTINph.js +354 -0
  818. package/dist/register.maintenance-shn-zigv.js +694 -0
  819. package/dist/register.message-mR4CLSoo.js +812 -0
  820. package/dist/register.onboard-CkDryVid.js +298 -0
  821. package/dist/register.setup-B0xW5olD.js +318 -0
  822. package/dist/register.status-health-sessions-CuhWc03j.js +604 -0
  823. package/dist/register.subclis-BazXM5TW.js +315 -0
  824. package/dist/register.subclis-C2d8UDhH.js +13 -0
  825. package/dist/registry-C3q59Qj0.js +55 -0
  826. package/dist/registry-CPsHw6xU.js +219 -0
  827. package/dist/registry-CxgtJ09C.js +28 -0
  828. package/dist/registry-rgYi7KoO.js +160 -0
  829. package/dist/repair-qXnOAvDy.js +105 -0
  830. package/dist/replies-EiwmmZ_W.js +122 -0
  831. package/dist/reply-history-CVCD5oE9.js +1 -0
  832. package/dist/reply-payload-DBGc074f.js +232 -0
  833. package/dist/report-cli-DB1jQx32.js +42 -0
  834. package/dist/request-url-BKfWAQx8.js +10 -0
  835. package/dist/resolve-Ckjd8TAk.js +14 -0
  836. package/dist/resolve-T2q_0ARF.js +619 -0
  837. package/dist/resolve-route-vEY3ONZ2.js +466 -0
  838. package/dist/resolve-utils-CbqJY2bs.js +102 -0
  839. package/dist/response-generator-VdoCcQ3y.js +153 -0
  840. package/dist/restart-stale-pids-CLGiqU2E.js +187 -0
  841. package/dist/retry-D15TD1S3.js +168 -0
  842. package/dist/root-help-B9Aou4ho.js +32 -0
  843. package/dist/routes-TpLEcKO8.js +7084 -0
  844. package/dist/routing-Y3m0o-kB.js +26 -0
  845. package/dist/rpc-C6MN-nVc.js +67 -0
  846. package/dist/run-command-DRKv5Lj6.js +32 -0
  847. package/dist/run-main-YZSMdx0B.js +424 -0
  848. package/dist/run-with-concurrency-BrSjWzpg.js +41 -0
  849. package/dist/runtime-B66W9flm.js +43 -0
  850. package/dist/runtime-C9VaVKYZ.js +2338 -0
  851. package/dist/runtime-CT2LIJZu.js +91 -0
  852. package/dist/runtime-CqDQ81eY.js +143 -0
  853. package/dist/runtime-CuvWMN7E.js +89 -0
  854. package/dist/runtime-D4_OpzA1.js +5 -0
  855. package/dist/runtime-DP-4DZja.js +5 -0
  856. package/dist/runtime-Dl17x_cV.js +1 -0
  857. package/dist/runtime-Z35JoYPC.js +30 -0
  858. package/dist/runtime-api-D79M0lQN.js +1 -0
  859. package/dist/runtime-api-y3zfnQGK.js +39 -0
  860. package/dist/runtime-discord-ops.runtime-Bg5h5v9-.js +234 -0
  861. package/dist/runtime-env-a_iwdJIv.js +1 -0
  862. package/dist/runtime-forwarders-DtMc8rBP.js +44 -0
  863. package/dist/runtime-group-policy-B7irU4eu.js +59 -0
  864. package/dist/runtime-guard-y62lPDGY.js +58 -0
  865. package/dist/runtime-parse-CeqXmZHJ.js +84 -0
  866. package/dist/runtime-paths-CstaCCMi.js +334 -0
  867. package/dist/runtime-slack-ops.runtime-BumgKDhS.js +226 -0
  868. package/dist/runtime-status-CgL02wYX.js +15 -0
  869. package/dist/runtime-store-Bt3Sdbrn.js +22 -0
  870. package/dist/runtime-telegram-ops.runtime-rSLQ3KrE.js +233 -0
  871. package/dist/runtime-whatsapp-boundary-xZem0NyQ.js +364 -0
  872. package/dist/safe-open-sync-Bt9R1Mnf.js +83 -0
  873. package/dist/safe-regex-tLlDZYfM.js +244 -0
  874. package/dist/safe-text-B_CQuica.js +16 -0
  875. package/dist/sandbox-CUUouiKs.js +2795 -0
  876. package/dist/sandbox-cli-BN8y0Get.js +499 -0
  877. package/dist/sandbox-paths-fqp_TZdO.js +144 -0
  878. package/dist/sandbox-qSs4h3sk.js +1 -0
  879. package/dist/sanitize-env-vars-vNSNqm0y.js +74 -0
  880. package/dist/scan-paths-BJmvUZ1E.js +28 -0
  881. package/dist/search-manager-DWhFgwyp.js +17 -0
  882. package/dist/search-manager-r8Cw4ZRv.js +392 -0
  883. package/dist/secret-equal-ObQfyZGa.js +9 -0
  884. package/dist/secret-file-Ch0yuOXR.js +11 -0
  885. package/dist/secret-file-DYJtH6kf.js +92 -0
  886. package/dist/secret-input-4REZ4sHo.js +35 -0
  887. package/dist/secrets-cli-D1df8b0o.js +2304 -0
  888. package/dist/secure-random-Cs8tw_HQ.js +10 -0
  889. package/dist/security-cli-V66ESmdT.js +676 -0
  890. package/dist/security-runtime-BuEhpJVE.js +23 -0
  891. package/dist/send-3tabvle6.js +100 -0
  892. package/dist/send-CC5J3tyW.js +1026 -0
  893. package/dist/send-deps-CrFMNvqO.js +19 -0
  894. package/dist/send-i2-mdtiE.js +250 -0
  895. package/dist/server-BTOjmlyi.js +116 -0
  896. package/dist/server-middleware-CCqKhKUb.js +106 -0
  897. package/dist/server-node-events-D6y22Tt8.js +611 -0
  898. package/dist/server-startup-matrix-migration-DHWSoS73.js +1595 -0
  899. package/dist/service-Bxc9uL2e.js +774 -0
  900. package/dist/service-CBLajPZL.js +21 -0
  901. package/dist/session-cost-usage-BmbaBvk4.js +212 -0
  902. package/dist/session-cost-usage-C30Jl2SI.js +615 -0
  903. package/dist/session-fork.runtime-BZfcC1Nc.js +51 -0
  904. package/dist/session-key-gFFk3uv9.js +216 -0
  905. package/dist/session-write-lock-DNKvpjKf.js +324 -0
  906. package/dist/sessions-BIH_j_XS.js +222 -0
  907. package/dist/sessions-D5dWcxC_.js +212 -0
  908. package/dist/sessions-DaSBVNwD.js +669 -0
  909. package/dist/setup-C2XF1YH3.js +397 -0
  910. package/dist/setup-CN-teRpz.js +8 -0
  911. package/dist/setup-adapter-runtime-Bjv2adwG.js +1 -0
  912. package/dist/setup-binary-BOJA7zdN.js +30 -0
  913. package/dist/setup-browser-BhNPCUtK.js +71 -0
  914. package/dist/setup-core-BsG09DZH.js +149 -0
  915. package/dist/setup-core-D-O1GQax.js +162 -0
  916. package/dist/setup-core-Dtm54Rcq.js +510 -0
  917. package/dist/setup-entry-B1mTa7bU.js +10 -0
  918. package/dist/setup-entry-CTMgw-K5.js +13 -0
  919. package/dist/setup-entry-Cmd_cufO.js +13 -0
  920. package/dist/setup-entry-CybgA3zP.js +12 -0
  921. package/dist/setup-entry-DED_hL6i.js +12 -0
  922. package/dist/setup-entry-WCq9VMWx.js +14 -0
  923. package/dist/setup-group-access-BtPApRvE.js +70 -0
  924. package/dist/setup-helpers-B62Ecg9r.js +362 -0
  925. package/dist/setup-surface-B7A7qowY.js +452 -0
  926. package/dist/setup-surface-BBYJVRXc.js +380 -0
  927. package/dist/setup-surface-CFUz_BJi.js +298 -0
  928. package/dist/setup-tools-BPiMjAN7.js +1 -0
  929. package/dist/setup-wizard-helpers-COZ1UAdX.js +770 -0
  930. package/dist/setup-wizard-proxy-Slwi-1gX.js +116 -0
  931. package/dist/setup.finalize-B8O01nge.js +633 -0
  932. package/dist/setup.gateway-config-BPDIFk__.js +288 -0
  933. package/dist/setup.secret-input-BL-bqJpt.js +25 -0
  934. package/dist/shared-AygSbeCK.js +50 -0
  935. package/dist/shared-BHqDLkMG.js +127 -0
  936. package/dist/shared-BPtG8PgB.js +70 -0
  937. package/dist/shared-BU0QgVMZ.js +36 -0
  938. package/dist/shared-Bzr2UyEm.js +351 -0
  939. package/dist/shared-C_XXbGIF.js +87 -0
  940. package/dist/shared-Diw3KzwZ.js +82 -0
  941. package/dist/shared-DngjQumT.js +196 -0
  942. package/dist/shared-DzH3zmAy.js +64 -0
  943. package/dist/shared-LeP8iUTz.js +54 -0
  944. package/dist/shell-argv-DWV43Vya.js +72 -0
  945. package/dist/shell-env-cD92jEyV.js +181 -0
  946. package/dist/signal-BQd9f9dF.js +315 -0
  947. package/dist/signal-Ca7y47bM.js +46 -0
  948. package/dist/signal-Did9U_fa.js +214 -0
  949. package/dist/signal-cli-install-DxoL8CgF.js +188 -0
  950. package/dist/skill-commands-CiSwTFBQ.js +652 -0
  951. package/dist/skill-commands.runtime-CEwlWT4j.js +34 -0
  952. package/dist/skill-scanner-DG7MT7pu.js +354 -0
  953. package/dist/skills-BC8GJ9Rp.js +22 -0
  954. package/dist/skills-CCgKs_NJ.js +863 -0
  955. package/dist/skills-cli-dhYXJCuL.js +339 -0
  956. package/dist/skills-install-DiriUXJd.js +763 -0
  957. package/dist/skills-status-BmQTn4jL.js +23 -0
  958. package/dist/skills-status-a9b899Y3.js +169 -0
  959. package/dist/slack-CXgv7nu7.js +730 -0
  960. package/dist/slack-CcSByPzI.js +217 -0
  961. package/dist/slack-CtcCh0Lj.js +24537 -0
  962. package/dist/slack-core-DcsbATUs.js +1 -0
  963. package/dist/slash-commands.runtime-kO8EUKYW.js +228 -0
  964. package/dist/slash-dispatch.runtime-Bu2yMeFy.js +238 -0
  965. package/dist/slash-skill-commands.runtime-wwX3tF84.js +216 -0
  966. package/dist/speech-bSreRuDH.js +1 -0
  967. package/dist/speech-runtime-y1FcnGVA.js +1 -0
  968. package/dist/src-CmXHIz5f.js +846 -0
  969. package/dist/ssh-config-ChqR6ijV.js +77 -0
  970. package/dist/ssh-tunnel-Cz51VBAt.js +159 -0
  971. package/dist/ssh-tunnel-DWze2IQS.js +16 -0
  972. package/dist/ssrf-Dk9XaoKN.js +220 -0
  973. package/dist/ssrf-policy-Dk6oMa20.js +69 -0
  974. package/dist/ssrf-runtime-C-mAQLVA.js +1 -0
  975. package/dist/stagger-DU7FjHYo.js +54 -0
  976. package/dist/state-paths-DJIGEFq_.js +1 -0
  977. package/dist/status-69r8-Zey.js +75 -0
  978. package/dist/status-BdLTvZOL.js +44 -0
  979. package/dist/status-Bt7DQmRI.js +1665 -0
  980. package/dist/status-CoUFSBgt.js +202 -0
  981. package/dist/status-DbI3Kbh5.js +235 -0
  982. package/dist/status-DeKlzu_o.js +212 -0
  983. package/dist/status-Haie42Fc.js +606 -0
  984. package/dist/status-helpers-Cda-rGLX.js +101 -0
  985. package/dist/status-json-DS1M_MWJ.js +322 -0
  986. package/dist/status.link-channel-Cb8bZ_Od.js +40 -0
  987. package/dist/status.scan.deps.runtime-7_6VUs50.js +77 -0
  988. package/dist/status.scan.runtime-DtR8BIE9.js +14 -0
  989. package/dist/status.summary-l_Bi1buR.js +600 -0
  990. package/dist/status.summary.runtime-Cng6MzRU.js +151 -0
  991. package/dist/status.update-DtbnnPKx.js +79 -0
  992. package/dist/store-CvL8MPei.js +1446 -0
  993. package/dist/store.runtime-hgnvmZgO.js +43 -0
  994. package/dist/string-normalization-CvzuCAZv.js +19 -0
  995. package/dist/string-sample-BOLqzr4Y.js +11 -0
  996. package/dist/subagent-orphan-recovery-si1z2iBu.js +407 -0
  997. package/dist/subagent-registry-runtime-CXUDI8gL.js +211 -0
  998. package/dist/subcli-descriptors-CY_nHzpZ.js +151 -0
  999. package/dist/subsystem-CUp-6QQf.js +421 -0
  1000. package/dist/synology-chat-CdejNfs0.js +12 -0
  1001. package/dist/system-cli-DkOaXHkQ.js +99 -0
  1002. package/dist/system-events-mAu6Ap6K.js +75 -0
  1003. package/dist/system-message-DA9eUYzB.js +16 -0
  1004. package/dist/system-run-command-Cxq2F1MB.js +258 -0
  1005. package/dist/systemd-CrxZBFae.js +557 -0
  1006. package/dist/systemd-hints-y-zJ9aTm.js +315 -0
  1007. package/dist/systemd-linger-BdklDcLg.js +16 -0
  1008. package/dist/systemd-linger-DLrbG9_d.js +68 -0
  1009. package/dist/table-DFMOhmNZ.js +305 -0
  1010. package/dist/tailnet-ofqBrXzu.js +38 -0
  1011. package/dist/tailscale-Cbsx-2HB.js +254 -0
  1012. package/dist/target-errors-ksphhzJg.js +26 -0
  1013. package/dist/target-registry-krAVlXi_.js +1321 -0
  1014. package/dist/telegram/audit.js +2 -0
  1015. package/dist/telegram/token.js +211 -0
  1016. package/dist/telegram-BjDUP22F.js +10910 -0
  1017. package/dist/telegram-DMiNSGAJ.js +575 -0
  1018. package/dist/telegram-Dt11B3JL.js +218 -0
  1019. package/dist/telegram-core-B4Jo-uko.js +1 -0
  1020. package/dist/template-messages-kh7VfgOb.js +214 -0
  1021. package/dist/text-chunking-CUf5WgqG.js +19 -0
  1022. package/dist/text-format-sFXlJfHH.js +8 -0
  1023. package/dist/text-runtime-C_Roi_Je.js +1418 -0
  1024. package/dist/theme-B5HDbQfl.js +2 -0
  1025. package/dist/theme-CdOoMzRk.js +34 -0
  1026. package/dist/thinking-BBD_0HSp.js +68 -0
  1027. package/dist/thinking.shared-CncvRHts.js +246 -0
  1028. package/dist/thread-bindings-messages-Cdo8jSa9.js +229 -0
  1029. package/dist/thread-bindings-policy-DMjOaNyR.js +119 -0
  1030. package/dist/thread-bindings-runtime-Ckwk3Uuz.js +1 -0
  1031. package/dist/threading-helpers-Cq55SUtb.js +14 -0
  1032. package/dist/timeouts-BwR1sGom.js +72 -0
  1033. package/dist/tmp-openclaw-dir-idKIOMmb.js +102 -0
  1034. package/dist/token-Bgv8XEsC.js +50 -0
  1035. package/dist/tool-catalog-BV6FcEWS.js +337 -0
  1036. package/dist/tool-policy-match-CHqTCSdK.js +46 -0
  1037. package/dist/tool-send-9LXKcrda.js +16 -0
  1038. package/dist/topology-cli-BhUXVViF.js +43 -0
  1039. package/dist/transcript-events-B1V6z5ct.js +29 -0
  1040. package/dist/tui-DDJMGCFK.js +3838 -0
  1041. package/dist/tui-cli-ByN-ZH6y.js +237 -0
  1042. package/dist/typebox-D0SHDJST.js +175 -0
  1043. package/dist/types-BCKGVVld.js +83 -0
  1044. package/dist/types-CtpUGsDP.js +30 -0
  1045. package/dist/types.secrets-BWSeXrF4.js +80 -0
  1046. package/dist/types.tools-BBO8HCi6.js +22 -0
  1047. package/dist/typing-DG_YqWJ7.js +224 -0
  1048. package/dist/unhandled-rejections-CDJ8dOVP.js +170 -0
  1049. package/dist/unhandled-rejections-O6cVOz2D.js +4 -0
  1050. package/dist/update-Br8U-txJ.js +1039 -0
  1051. package/dist/update-check-C3TeQaWg.js +464 -0
  1052. package/dist/update-cli-XHfIntD0.js +1625 -0
  1053. package/dist/update-offset-store-36vzzZXw.js +211 -0
  1054. package/dist/upsert-with-lock-Bb96JHpb.js +34 -0
  1055. package/dist/url-userinfo-Db63ng4y.js +14 -0
  1056. package/dist/utils-Bxk6BLTg.js +236 -0
  1057. package/dist/utils-vDeUf98G.js +7 -0
  1058. package/dist/version-DCY9_obP.js +64 -0
  1059. package/dist/version-DRF-wKTV.js +2 -0
  1060. package/dist/voice-call-D4fgwZNO.js +1 -0
  1061. package/dist/warning-filter-CgvLQB4Y.js +56 -0
  1062. package/dist/web-media-BfBb8i48.js +1 -0
  1063. package/dist/web-media-CtU6jM5V.js +498 -0
  1064. package/dist/webhook-ingress-CupqYpKM.js +338 -0
  1065. package/dist/webhook-memory-guards-BHrFZ4yq.js +129 -0
  1066. package/dist/webhook-path-BGFZ55ML.js +22 -0
  1067. package/dist/webhook-shared-Cvk3b0ac.js +349 -0
  1068. package/dist/webhooks-cli-vOAoBF9b.js +357 -0
  1069. package/dist/whatsapp-D5nD0rGG.js +58 -0
  1070. package/dist/whatsapp-DXbWlm3A.js +82 -0
  1071. package/dist/whatsapp-core-C2WGMsaY.js +89451 -0
  1072. package/dist/whatsapp-heartbeat-CSWnPQ7q.js +84 -0
  1073. package/dist/whatsapp-shared-BmHKqTtR.js +95 -0
  1074. package/dist/widearea-dns-CXimgJzu.js +125 -0
  1075. package/dist/windows-argv-IXrdWrJj.js +145 -0
  1076. package/dist/windows-spawn-vMJGZo89.js +154 -0
  1077. package/dist/with-timeout-2AKTISee.js +58 -0
  1078. package/dist/workspace-BH7CXmrr.js +479 -0
  1079. package/dist/workspace-dirs-_O4V3xCR.js +13 -0
  1080. package/dist/workspace-v5XppK5M.js +302 -0
  1081. package/dist/ws-By-QcLjg.js +11 -0
  1082. package/dist/wsl-BV3Cb66X.js +57 -0
  1083. package/dist/zalo-CHQzsLhE.js +301 -0
  1084. package/dist/zalo-CcJ3J9f2.js +13 -0
  1085. package/dist/zod-schema.agent-runtime-T_EC_6fg.js +600 -0
  1086. package/dist/zod-schema.core-BdgRr-F1.js +545 -0
  1087. package/dist/zod-schema.providers-core-Dgq7MTqU.js +1613 -0
  1088. package/docs/.i18n/README.md +31 -0
  1089. package/docs/.i18n/glossary.ja-JP.json +14 -0
  1090. package/docs/.i18n/glossary.zh-CN.json +242 -0
  1091. package/docs/.i18n/ja-JP.tm.jsonl +0 -0
  1092. package/docs/assets/install-script.svg +1 -0
  1093. package/docs/assets/macos-onboarding/01-macos-warning.jpeg +0 -0
  1094. package/docs/assets/macos-onboarding/02-local-networks.jpeg +0 -0
  1095. package/docs/assets/macos-onboarding/03-security-notice.png +0 -0
  1096. package/docs/assets/macos-onboarding/04-choose-gateway.png +0 -0
  1097. package/docs/assets/macos-onboarding/05-permissions.png +0 -0
  1098. package/docs/assets/openclaw-logo-text-dark.png +0 -0
  1099. package/docs/assets/openclaw-logo-text-dark.svg +418 -0
  1100. package/docs/assets/openclaw-logo-text.png +0 -0
  1101. package/docs/assets/openclaw-logo-text.svg +418 -0
  1102. package/docs/assets/pixel-lobster.svg +60 -0
  1103. package/docs/assets/showcase/agents-ui.jpg +0 -0
  1104. package/docs/assets/showcase/bambu-cli.png +0 -0
  1105. package/docs/assets/showcase/codexmonitor.png +0 -0
  1106. package/docs/assets/showcase/gohome-grafana.png +0 -0
  1107. package/docs/assets/showcase/ios-testflight.jpg +0 -0
  1108. package/docs/assets/showcase/oura-health.png +0 -0
  1109. package/docs/assets/showcase/padel-cli.svg +11 -0
  1110. package/docs/assets/showcase/padel-screenshot.jpg +0 -0
  1111. package/docs/assets/showcase/papla-tts.jpg +0 -0
  1112. package/docs/assets/showcase/pr-review-telegram.jpg +0 -0
  1113. package/docs/assets/showcase/roborock-screenshot.jpg +0 -0
  1114. package/docs/assets/showcase/roborock-status.svg +13 -0
  1115. package/docs/assets/showcase/roof-camera-sky.jpg +0 -0
  1116. package/docs/assets/showcase/snag.png +0 -0
  1117. package/docs/assets/showcase/tesco-shop.jpg +0 -0
  1118. package/docs/assets/showcase/wienerlinien.png +0 -0
  1119. package/docs/assets/showcase/wine-cellar-skill.jpg +0 -0
  1120. package/docs/assets/showcase/winix-air-purifier.jpg +0 -0
  1121. package/docs/assets/showcase/xuezh-pronunciation.jpeg +0 -0
  1122. package/docs/assets/sponsors/blacksmith.svg +14 -0
  1123. package/docs/assets/sponsors/convex.svg +16 -0
  1124. package/docs/assets/sponsors/openai.svg +3 -0
  1125. package/docs/assets/sponsors/vercel.svg +5 -0
  1126. package/docs/auth-credential-semantics.md +53 -0
  1127. package/docs/automation/auth-monitoring.md +44 -0
  1128. package/docs/automation/cron-jobs.md +727 -0
  1129. package/docs/automation/cron-vs-heartbeat.md +286 -0
  1130. package/docs/automation/gmail-pubsub.md +256 -0
  1131. package/docs/automation/hooks.md +1049 -0
  1132. package/docs/automation/poll.md +86 -0
  1133. package/docs/automation/standing-orders.md +251 -0
  1134. package/docs/automation/troubleshooting.md +122 -0
  1135. package/docs/automation/webhook.md +217 -0
  1136. package/docs/brave-search.md +93 -0
  1137. package/docs/channels/bluebubbles.md +347 -0
  1138. package/docs/channels/broadcast-groups.md +442 -0
  1139. package/docs/channels/channel-routing.md +139 -0
  1140. package/docs/channels/discord.md +1229 -0
  1141. package/docs/channels/feishu.md +747 -0
  1142. package/docs/channels/googlechat.md +261 -0
  1143. package/docs/channels/group-messages.md +84 -0
  1144. package/docs/channels/groups.md +379 -0
  1145. package/docs/channels/imessage.md +367 -0
  1146. package/docs/channels/index.md +47 -0
  1147. package/docs/channels/irc.md +242 -0
  1148. package/docs/channels/line.md +194 -0
  1149. package/docs/channels/location.md +56 -0
  1150. package/docs/channels/matrix.md +677 -0
  1151. package/docs/channels/mattermost.md +427 -0
  1152. package/docs/channels/msteams.md +780 -0
  1153. package/docs/channels/nextcloud-talk.md +138 -0
  1154. package/docs/channels/nostr.md +242 -0
  1155. package/docs/channels/pairing.md +114 -0
  1156. package/docs/channels/signal.md +329 -0
  1157. package/docs/channels/slack.md +603 -0
  1158. package/docs/channels/synology-chat.md +132 -0
  1159. package/docs/channels/telegram.md +987 -0
  1160. package/docs/channels/tlon.md +276 -0
  1161. package/docs/channels/troubleshooting.md +118 -0
  1162. package/docs/channels/twitch.md +379 -0
  1163. package/docs/channels/whatsapp.md +460 -0
  1164. package/docs/channels/zalo.md +243 -0
  1165. package/docs/channels/zalouser.md +181 -0
  1166. package/docs/ci.md +55 -0
  1167. package/docs/cli/acp.md +288 -0
  1168. package/docs/cli/agent.md +29 -0
  1169. package/docs/cli/agents.md +123 -0
  1170. package/docs/cli/approvals.md +50 -0
  1171. package/docs/cli/backup.md +76 -0
  1172. package/docs/cli/browser.md +106 -0
  1173. package/docs/cli/channels.md +102 -0
  1174. package/docs/cli/clawbot.md +21 -0
  1175. package/docs/cli/completion.md +35 -0
  1176. package/docs/cli/config.md +295 -0
  1177. package/docs/cli/configure.md +36 -0
  1178. package/docs/cli/cron.md +77 -0
  1179. package/docs/cli/daemon.md +53 -0
  1180. package/docs/cli/dashboard.md +22 -0
  1181. package/docs/cli/devices.md +139 -0
  1182. package/docs/cli/directory.md +63 -0
  1183. package/docs/cli/dns.md +23 -0
  1184. package/docs/cli/docs.md +15 -0
  1185. package/docs/cli/doctor.md +48 -0
  1186. package/docs/cli/gateway.md +235 -0
  1187. package/docs/cli/health.md +21 -0
  1188. package/docs/cli/hooks.md +318 -0
  1189. package/docs/cli/index.md +1147 -0
  1190. package/docs/cli/logs.md +28 -0
  1191. package/docs/cli/memory.md +66 -0
  1192. package/docs/cli/message.md +278 -0
  1193. package/docs/cli/models.md +81 -0
  1194. package/docs/cli/node.md +127 -0
  1195. package/docs/cli/nodes.md +75 -0
  1196. package/docs/cli/onboard.md +157 -0
  1197. package/docs/cli/pairing.md +32 -0
  1198. package/docs/cli/plugins.md +186 -0
  1199. package/docs/cli/qr.md +46 -0
  1200. package/docs/cli/reset.md +20 -0
  1201. package/docs/cli/sandbox.md +197 -0
  1202. package/docs/cli/secrets.md +188 -0
  1203. package/docs/cli/security.md +79 -0
  1204. package/docs/cli/sessions.md +110 -0
  1205. package/docs/cli/setup.md +29 -0
  1206. package/docs/cli/skills.md +26 -0
  1207. package/docs/cli/status.md +30 -0
  1208. package/docs/cli/system.md +60 -0
  1209. package/docs/cli/tui.md +30 -0
  1210. package/docs/cli/uninstall.md +20 -0
  1211. package/docs/cli/update.md +103 -0
  1212. package/docs/cli/voicecall.md +34 -0
  1213. package/docs/cli/webhooks.md +25 -0
  1214. package/docs/concepts/agent-loop.md +148 -0
  1215. package/docs/concepts/agent-workspace.md +236 -0
  1216. package/docs/concepts/agent.md +122 -0
  1217. package/docs/concepts/architecture.md +137 -0
  1218. package/docs/concepts/compaction.md +123 -0
  1219. package/docs/concepts/context-engine.md +268 -0
  1220. package/docs/concepts/context.md +172 -0
  1221. package/docs/concepts/delegate-architecture.md +296 -0
  1222. package/docs/concepts/features.md +73 -0
  1223. package/docs/concepts/markdown-formatting.md +130 -0
  1224. package/docs/concepts/memory.md +108 -0
  1225. package/docs/concepts/messages.md +154 -0
  1226. package/docs/concepts/model-failover.md +152 -0
  1227. package/docs/concepts/model-providers.md +607 -0
  1228. package/docs/concepts/models.md +225 -0
  1229. package/docs/concepts/multi-agent.md +552 -0
  1230. package/docs/concepts/oauth.md +158 -0
  1231. package/docs/concepts/presence.md +102 -0
  1232. package/docs/concepts/queue.md +89 -0
  1233. package/docs/concepts/retry.md +69 -0
  1234. package/docs/concepts/session-pruning.md +121 -0
  1235. package/docs/concepts/session-tool.md +242 -0
  1236. package/docs/concepts/session.md +310 -0
  1237. package/docs/concepts/streaming.md +155 -0
  1238. package/docs/concepts/system-prompt.md +132 -0
  1239. package/docs/concepts/timezone.md +91 -0
  1240. package/docs/concepts/typebox.md +291 -0
  1241. package/docs/concepts/typing-indicators.md +68 -0
  1242. package/docs/concepts/usage-tracking.md +35 -0
  1243. package/docs/date-time.md +128 -0
  1244. package/docs/debug/node-issue.md +85 -0
  1245. package/docs/diagnostics/flags.md +91 -0
  1246. package/docs/docs.json +2061 -0
  1247. package/docs/gateway/authentication.md +179 -0
  1248. package/docs/gateway/background-process.md +97 -0
  1249. package/docs/gateway/bonjour.md +177 -0
  1250. package/docs/gateway/bridge-protocol.md +91 -0
  1251. package/docs/gateway/cli-backends.md +225 -0
  1252. package/docs/gateway/configuration-examples.md +651 -0
  1253. package/docs/gateway/configuration-reference.md +3123 -0
  1254. package/docs/gateway/configuration.md +633 -0
  1255. package/docs/gateway/discovery.md +123 -0
  1256. package/docs/gateway/doctor.md +362 -0
  1257. package/docs/gateway/gateway-lock.md +34 -0
  1258. package/docs/gateway/health.md +44 -0
  1259. package/docs/gateway/heartbeat.md +393 -0
  1260. package/docs/gateway/index.md +261 -0
  1261. package/docs/gateway/local-models.md +152 -0
  1262. package/docs/gateway/logging.md +113 -0
  1263. package/docs/gateway/multiple-gateways.md +112 -0
  1264. package/docs/gateway/network-model.md +22 -0
  1265. package/docs/gateway/openai-http-api.md +132 -0
  1266. package/docs/gateway/openresponses-http-api.md +295 -0
  1267. package/docs/gateway/openshell.md +307 -0
  1268. package/docs/gateway/pairing.md +99 -0
  1269. package/docs/gateway/protocol.md +267 -0
  1270. package/docs/gateway/remote-gateway-readme.md +158 -0
  1271. package/docs/gateway/remote.md +153 -0
  1272. package/docs/gateway/sandbox-vs-tool-policy-vs-elevated.md +134 -0
  1273. package/docs/gateway/sandboxing.md +469 -0
  1274. package/docs/gateway/secrets-plan-contract.md +116 -0
  1275. package/docs/gateway/secrets.md +503 -0
  1276. package/docs/gateway/security/index.md +1213 -0
  1277. package/docs/gateway/tailscale.md +132 -0
  1278. package/docs/gateway/tools-invoke-http-api.md +110 -0
  1279. package/docs/gateway/troubleshooting.md +378 -0
  1280. package/docs/gateway/trusted-proxy-auth.md +330 -0
  1281. package/docs/help/debugging.md +168 -0
  1282. package/docs/help/environment.md +163 -0
  1283. package/docs/help/faq.md +2999 -0
  1284. package/docs/help/index.md +28 -0
  1285. package/docs/help/scripts.md +28 -0
  1286. package/docs/help/testing.md +524 -0
  1287. package/docs/help/troubleshooting.md +297 -0
  1288. package/docs/images/configure-model-picker-unsearchable.png +0 -0
  1289. package/docs/images/feishu-step2-create-app.png +0 -0
  1290. package/docs/images/feishu-step3-credentials.png +0 -0
  1291. package/docs/images/feishu-step4-permissions.png +0 -0
  1292. package/docs/images/feishu-step5-bot-capability.png +0 -0
  1293. package/docs/images/feishu-step6-event-subscription.png +0 -0
  1294. package/docs/images/feishu-verification-token.png +0 -0
  1295. package/docs/images/groups-flow.svg +52 -0
  1296. package/docs/images/mobile-ui-screenshot.png +0 -0
  1297. package/docs/index.md +196 -0
  1298. package/docs/install/ansible.md +230 -0
  1299. package/docs/install/azure.md +311 -0
  1300. package/docs/install/bun.md +55 -0
  1301. package/docs/install/development-channels.md +120 -0
  1302. package/docs/install/digitalocean.md +129 -0
  1303. package/docs/install/docker-vm-runtime.md +142 -0
  1304. package/docs/install/docker.md +375 -0
  1305. package/docs/install/exe-dev.md +126 -0
  1306. package/docs/install/fly.md +501 -0
  1307. package/docs/install/gcp.md +402 -0
  1308. package/docs/install/hetzner.md +251 -0
  1309. package/docs/install/index.md +183 -0
  1310. package/docs/install/installer.md +415 -0
  1311. package/docs/install/kubernetes.md +191 -0
  1312. package/docs/install/macos-vm.md +281 -0
  1313. package/docs/install/migrating-matrix.md +346 -0
  1314. package/docs/install/migrating.md +110 -0
  1315. package/docs/install/nix.md +89 -0
  1316. package/docs/install/node.md +138 -0
  1317. package/docs/install/northflank.mdx +54 -0
  1318. package/docs/install/oracle.md +156 -0
  1319. package/docs/install/podman.md +133 -0
  1320. package/docs/install/railway.mdx +100 -0
  1321. package/docs/install/raspberry-pi.md +159 -0
  1322. package/docs/install/render.mdx +169 -0
  1323. package/docs/install/uninstall.md +128 -0
  1324. package/docs/install/updating.md +128 -0
  1325. package/docs/ja-JP/index.md +186 -0
  1326. package/docs/ja-JP/start/getting-started.md +125 -0
  1327. package/docs/ja-JP/start/wizard.md +77 -0
  1328. package/docs/logging.md +352 -0
  1329. package/docs/nav-tabs-underline.js +100 -0
  1330. package/docs/network.md +54 -0
  1331. package/docs/nodes/audio.md +187 -0
  1332. package/docs/nodes/camera.md +162 -0
  1333. package/docs/nodes/images.md +72 -0
  1334. package/docs/nodes/index.md +393 -0
  1335. package/docs/nodes/location-command.md +98 -0
  1336. package/docs/nodes/media-understanding.md +394 -0
  1337. package/docs/nodes/talk.md +92 -0
  1338. package/docs/nodes/troubleshooting.md +114 -0
  1339. package/docs/nodes/voicewake.md +66 -0
  1340. package/docs/perplexity.md +174 -0
  1341. package/docs/pi-dev.md +80 -0
  1342. package/docs/pi.md +567 -0
  1343. package/docs/platforms/android.md +168 -0
  1344. package/docs/platforms/digitalocean.md +266 -0
  1345. package/docs/platforms/index.md +54 -0
  1346. package/docs/platforms/ios.md +220 -0
  1347. package/docs/platforms/linux.md +94 -0
  1348. package/docs/platforms/mac/bundled-gateway.md +73 -0
  1349. package/docs/platforms/mac/canvas.md +125 -0
  1350. package/docs/platforms/mac/child-process.md +69 -0
  1351. package/docs/platforms/mac/dev-setup.md +104 -0
  1352. package/docs/platforms/mac/health.md +34 -0
  1353. package/docs/platforms/mac/icon.md +31 -0
  1354. package/docs/platforms/mac/logging.md +57 -0
  1355. package/docs/platforms/mac/menu-bar.md +81 -0
  1356. package/docs/platforms/mac/peekaboo.md +65 -0
  1357. package/docs/platforms/mac/permissions.md +50 -0
  1358. package/docs/platforms/mac/remote.md +84 -0
  1359. package/docs/platforms/mac/signing.md +47 -0
  1360. package/docs/platforms/mac/skills.md +33 -0
  1361. package/docs/platforms/mac/voice-overlay.md +60 -0
  1362. package/docs/platforms/mac/voicewake.md +67 -0
  1363. package/docs/platforms/mac/webchat.md +43 -0
  1364. package/docs/platforms/mac/xpc.md +61 -0
  1365. package/docs/platforms/macos.md +226 -0
  1366. package/docs/platforms/oracle.md +303 -0
  1367. package/docs/platforms/raspberry-pi.md +412 -0
  1368. package/docs/platforms/windows.md +241 -0
  1369. package/docs/plugins/agent-tools.md +10 -0
  1370. package/docs/plugins/architecture.md +1363 -0
  1371. package/docs/plugins/building-extensions.md +10 -0
  1372. package/docs/plugins/building-plugins.md +376 -0
  1373. package/docs/plugins/bundles.md +181 -0
  1374. package/docs/plugins/community.md +141 -0
  1375. package/docs/plugins/manifest.md +145 -0
  1376. package/docs/plugins/sdk-migration.md +169 -0
  1377. package/docs/plugins/voice-call.md +380 -0
  1378. package/docs/plugins/zalouser.md +77 -0
  1379. package/docs/prose.md +134 -0
  1380. package/docs/providers/anthropic.md +259 -0
  1381. package/docs/providers/bedrock.md +176 -0
  1382. package/docs/providers/claude-max-api-proxy.md +154 -0
  1383. package/docs/providers/cloudflare-ai-gateway.md +71 -0
  1384. package/docs/providers/deepgram.md +93 -0
  1385. package/docs/providers/github-copilot.md +72 -0
  1386. package/docs/providers/glm.md +43 -0
  1387. package/docs/providers/google.md +78 -0
  1388. package/docs/providers/groq.md +96 -0
  1389. package/docs/providers/huggingface.md +209 -0
  1390. package/docs/providers/index.md +69 -0
  1391. package/docs/providers/kilocode.md +74 -0
  1392. package/docs/providers/litellm.md +154 -0
  1393. package/docs/providers/minimax.md +224 -0
  1394. package/docs/providers/mistral.md +54 -0
  1395. package/docs/providers/models.md +45 -0
  1396. package/docs/providers/modelstudio.md +66 -0
  1397. package/docs/providers/moonshot.md +175 -0
  1398. package/docs/providers/nvidia.md +55 -0
  1399. package/docs/providers/ollama.md +352 -0
  1400. package/docs/providers/openai.md +303 -0
  1401. package/docs/providers/opencode-go.md +45 -0
  1402. package/docs/providers/opencode.md +64 -0
  1403. package/docs/providers/openrouter.md +37 -0
  1404. package/docs/providers/perplexity-provider.md +62 -0
  1405. package/docs/providers/qianfan.md +38 -0
  1406. package/docs/providers/qwen.md +53 -0
  1407. package/docs/providers/sglang.md +104 -0
  1408. package/docs/providers/synthetic.md +99 -0
  1409. package/docs/providers/together.md +66 -0
  1410. package/docs/providers/venice.md +282 -0
  1411. package/docs/providers/vercel-ai-gateway.md +60 -0
  1412. package/docs/providers/vllm.md +92 -0
  1413. package/docs/providers/volcengine.md +74 -0
  1414. package/docs/providers/xai.md +60 -0
  1415. package/docs/providers/xiaomi.md +86 -0
  1416. package/docs/providers/zai.md +46 -0
  1417. package/docs/reference/AGENTS.default.md +126 -0
  1418. package/docs/reference/RELEASING.md +42 -0
  1419. package/docs/reference/api-usage-costs.md +144 -0
  1420. package/docs/reference/credits.md +30 -0
  1421. package/docs/reference/device-models.md +47 -0
  1422. package/docs/reference/memory-config.md +711 -0
  1423. package/docs/reference/prompt-caching.md +185 -0
  1424. package/docs/reference/rpc.md +43 -0
  1425. package/docs/reference/secretref-credential-surface.md +140 -0
  1426. package/docs/reference/secretref-user-supplied-credentials-matrix.json +563 -0
  1427. package/docs/reference/session-management-compaction.md +324 -0
  1428. package/docs/reference/templates/AGENTS.dev.md +83 -0
  1429. package/docs/reference/templates/AGENTS.md +219 -0
  1430. package/docs/reference/templates/BOOT.md +11 -0
  1431. package/docs/reference/templates/BOOTSTRAP.md +62 -0
  1432. package/docs/reference/templates/HEARTBEAT.md +14 -0
  1433. package/docs/reference/templates/IDENTITY.dev.md +47 -0
  1434. package/docs/reference/templates/IDENTITY.md +29 -0
  1435. package/docs/reference/templates/SOUL.dev.md +76 -0
  1436. package/docs/reference/templates/SOUL.md +43 -0
  1437. package/docs/reference/templates/TOOLS.dev.md +24 -0
  1438. package/docs/reference/templates/TOOLS.md +47 -0
  1439. package/docs/reference/templates/USER.dev.md +18 -0
  1440. package/docs/reference/templates/USER.md +23 -0
  1441. package/docs/reference/test.md +90 -0
  1442. package/docs/reference/token-use.md +175 -0
  1443. package/docs/reference/transcript-hygiene.md +151 -0
  1444. package/docs/reference/wizard.md +235 -0
  1445. package/docs/security/CONTRIBUTING-THREAT-MODEL.md +98 -0
  1446. package/docs/security/THREAT-MODEL-ATLAS.md +611 -0
  1447. package/docs/security/formal-verification.md +167 -0
  1448. package/docs/start/bootstrapping.md +41 -0
  1449. package/docs/start/docs-directory.md +66 -0
  1450. package/docs/start/getting-started.md +116 -0
  1451. package/docs/start/hubs.md +198 -0
  1452. package/docs/start/lore.md +219 -0
  1453. package/docs/start/onboarding-overview.md +67 -0
  1454. package/docs/start/onboarding.md +91 -0
  1455. package/docs/start/openclaw.md +216 -0
  1456. package/docs/start/quickstart.md +22 -0
  1457. package/docs/start/setup.md +164 -0
  1458. package/docs/start/showcase.md +418 -0
  1459. package/docs/start/wizard-cli-automation.md +215 -0
  1460. package/docs/start/wizard-cli-reference.md +299 -0
  1461. package/docs/start/wizard.md +125 -0
  1462. package/docs/style.css +37 -0
  1463. package/docs/tools/acp-agents.md +623 -0
  1464. package/docs/tools/agent-send.md +100 -0
  1465. package/docs/tools/apply-patch.md +51 -0
  1466. package/docs/tools/brave-search.md +93 -0
  1467. package/docs/tools/browser-linux-troubleshooting.md +138 -0
  1468. package/docs/tools/browser-login.md +73 -0
  1469. package/docs/tools/browser-wsl2-windows-remote-cdp-troubleshooting.md +211 -0
  1470. package/docs/tools/browser.md +731 -0
  1471. package/docs/tools/btw.md +142 -0
  1472. package/docs/tools/capability-cookbook.md +119 -0
  1473. package/docs/tools/clawhub.md +257 -0
  1474. package/docs/tools/creating-skills.md +117 -0
  1475. package/docs/tools/diffs.md +386 -0
  1476. package/docs/tools/elevated.md +114 -0
  1477. package/docs/tools/exec-approvals.md +400 -0
  1478. package/docs/tools/exec.md +204 -0
  1479. package/docs/tools/firecrawl.md +140 -0
  1480. package/docs/tools/index.md +137 -0
  1481. package/docs/tools/llm-task.md +119 -0
  1482. package/docs/tools/lobster.md +340 -0
  1483. package/docs/tools/loop-detection.md +100 -0
  1484. package/docs/tools/multi-agent-sandbox-tools.md +364 -0
  1485. package/docs/tools/pdf.md +156 -0
  1486. package/docs/tools/perplexity-search.md +174 -0
  1487. package/docs/tools/plugin.md +251 -0
  1488. package/docs/tools/reactions.md +64 -0
  1489. package/docs/tools/skills-config.md +86 -0
  1490. package/docs/tools/skills.md +306 -0
  1491. package/docs/tools/slash-commands.md +294 -0
  1492. package/docs/tools/subagents.md +295 -0
  1493. package/docs/tools/tavily.md +125 -0
  1494. package/docs/tools/thinking.md +96 -0
  1495. package/docs/tools/tts.md +406 -0
  1496. package/docs/tools/web.md +516 -0
  1497. package/docs/tts.md +406 -0
  1498. package/docs/vps.md +112 -0
  1499. package/docs/web/control-ui.md +275 -0
  1500. package/docs/web/dashboard.md +54 -0
  1501. package/docs/web/index.md +120 -0
  1502. package/docs/web/tui.md +170 -0
  1503. package/docs/web/webchat.md +61 -0
  1504. package/docs/whatsapp-openclaw-ai-zh.jpg +0 -0
  1505. package/docs/whatsapp-openclaw.jpg +0 -0
  1506. package/docs/zh-CN/AGENTS.md +61 -0
  1507. package/docs/zh-CN/automation/auth-monitoring.md +47 -0
  1508. package/docs/zh-CN/automation/cron-jobs.md +435 -0
  1509. package/docs/zh-CN/automation/cron-vs-heartbeat.md +286 -0
  1510. package/docs/zh-CN/automation/gmail-pubsub.md +249 -0
  1511. package/docs/zh-CN/automation/hooks.md +1051 -0
  1512. package/docs/zh-CN/automation/poll.md +76 -0
  1513. package/docs/zh-CN/automation/troubleshooting.md +8 -0
  1514. package/docs/zh-CN/automation/webhook.md +163 -0
  1515. package/docs/zh-CN/brave-search.md +60 -0
  1516. package/docs/zh-CN/channels/bluebubbles.md +354 -0
  1517. package/docs/zh-CN/channels/broadcast-groups.md +449 -0
  1518. package/docs/zh-CN/channels/channel-routing.md +117 -0
  1519. package/docs/zh-CN/channels/discord.md +468 -0
  1520. package/docs/zh-CN/channels/feishu.md +728 -0
  1521. package/docs/zh-CN/channels/googlechat.md +257 -0
  1522. package/docs/zh-CN/channels/grammy.md +38 -0
  1523. package/docs/zh-CN/channels/group-messages.md +91 -0
  1524. package/docs/zh-CN/channels/groups.md +379 -0
  1525. package/docs/zh-CN/channels/imessage.md +302 -0
  1526. package/docs/zh-CN/channels/index.md +53 -0
  1527. package/docs/zh-CN/channels/line.md +180 -0
  1528. package/docs/zh-CN/channels/location.md +63 -0
  1529. package/docs/zh-CN/channels/matrix.md +221 -0
  1530. package/docs/zh-CN/channels/mattermost.md +144 -0
  1531. package/docs/zh-CN/channels/msteams.md +775 -0
  1532. package/docs/zh-CN/channels/nextcloud-talk.md +142 -0
  1533. package/docs/zh-CN/channels/nostr.md +249 -0
  1534. package/docs/zh-CN/channels/pairing.md +89 -0
  1535. package/docs/zh-CN/channels/signal.md +209 -0
  1536. package/docs/zh-CN/channels/slack.md +531 -0
  1537. package/docs/zh-CN/channels/synology-chat.md +138 -0
  1538. package/docs/zh-CN/channels/telegram.md +751 -0
  1539. package/docs/zh-CN/channels/tlon.md +136 -0
  1540. package/docs/zh-CN/channels/troubleshooting.md +36 -0
  1541. package/docs/zh-CN/channels/twitch.md +385 -0
  1542. package/docs/zh-CN/channels/whatsapp.md +411 -0
  1543. package/docs/zh-CN/channels/zalo.md +196 -0
  1544. package/docs/zh-CN/channels/zalouser.md +147 -0
  1545. package/docs/zh-CN/cli/acp.md +173 -0
  1546. package/docs/zh-CN/cli/agent.md +30 -0
  1547. package/docs/zh-CN/cli/agents.md +82 -0
  1548. package/docs/zh-CN/cli/approvals.md +57 -0
  1549. package/docs/zh-CN/cli/browser.md +114 -0
  1550. package/docs/zh-CN/cli/channels.md +86 -0
  1551. package/docs/zh-CN/cli/config.md +57 -0
  1552. package/docs/zh-CN/cli/configure.md +38 -0
  1553. package/docs/zh-CN/cli/cron.md +43 -0
  1554. package/docs/zh-CN/cli/dashboard.md +23 -0
  1555. package/docs/zh-CN/cli/devices.md +74 -0
  1556. package/docs/zh-CN/cli/directory.md +70 -0
  1557. package/docs/zh-CN/cli/dns.md +30 -0
  1558. package/docs/zh-CN/cli/docs.md +22 -0
  1559. package/docs/zh-CN/cli/doctor.md +48 -0
  1560. package/docs/zh-CN/cli/gateway.md +206 -0
  1561. package/docs/zh-CN/cli/health.md +28 -0
  1562. package/docs/zh-CN/cli/hooks.md +298 -0
  1563. package/docs/zh-CN/cli/index.md +1143 -0
  1564. package/docs/zh-CN/cli/logs.md +31 -0
  1565. package/docs/zh-CN/cli/memory.md +52 -0
  1566. package/docs/zh-CN/cli/message.md +246 -0
  1567. package/docs/zh-CN/cli/models.md +85 -0
  1568. package/docs/zh-CN/cli/node.md +115 -0
  1569. package/docs/zh-CN/cli/nodes.md +80 -0
  1570. package/docs/zh-CN/cli/onboard.md +164 -0
  1571. package/docs/zh-CN/cli/pairing.md +28 -0
  1572. package/docs/zh-CN/cli/plugins.md +66 -0
  1573. package/docs/zh-CN/cli/reset.md +24 -0
  1574. package/docs/zh-CN/cli/sandbox.md +158 -0
  1575. package/docs/zh-CN/cli/security.md +33 -0
  1576. package/docs/zh-CN/cli/sessions.md +23 -0
  1577. package/docs/zh-CN/cli/setup.md +36 -0
  1578. package/docs/zh-CN/cli/skills.md +33 -0
  1579. package/docs/zh-CN/cli/status.md +33 -0
  1580. package/docs/zh-CN/cli/system.md +63 -0
  1581. package/docs/zh-CN/cli/tui.md +30 -0
  1582. package/docs/zh-CN/cli/uninstall.md +24 -0
  1583. package/docs/zh-CN/cli/update.md +101 -0
  1584. package/docs/zh-CN/cli/voicecall.md +41 -0
  1585. package/docs/zh-CN/cli/webhooks.md +32 -0
  1586. package/docs/zh-CN/concepts/agent-loop.md +146 -0
  1587. package/docs/zh-CN/concepts/agent-workspace.md +219 -0
  1588. package/docs/zh-CN/concepts/agent.md +115 -0
  1589. package/docs/zh-CN/concepts/architecture.md +123 -0
  1590. package/docs/zh-CN/concepts/compaction.md +67 -0
  1591. package/docs/zh-CN/concepts/context.md +168 -0
  1592. package/docs/zh-CN/concepts/features.md +59 -0
  1593. package/docs/zh-CN/concepts/markdown-formatting.md +117 -0
  1594. package/docs/zh-CN/concepts/memory.md +412 -0
  1595. package/docs/zh-CN/concepts/messages.md +141 -0
  1596. package/docs/zh-CN/concepts/model-failover.md +145 -0
  1597. package/docs/zh-CN/concepts/model-providers.md +606 -0
  1598. package/docs/zh-CN/concepts/models.md +225 -0
  1599. package/docs/zh-CN/concepts/multi-agent.md +372 -0
  1600. package/docs/zh-CN/concepts/oauth.md +164 -0
  1601. package/docs/zh-CN/concepts/presence.md +99 -0
  1602. package/docs/zh-CN/concepts/queue.md +94 -0
  1603. package/docs/zh-CN/concepts/retry.md +76 -0
  1604. package/docs/zh-CN/concepts/session-pruning.md +129 -0
  1605. package/docs/zh-CN/concepts/session-tool.md +200 -0
  1606. package/docs/zh-CN/concepts/session.md +166 -0
  1607. package/docs/zh-CN/concepts/streaming.md +133 -0
  1608. package/docs/zh-CN/concepts/system-prompt.md +101 -0
  1609. package/docs/zh-CN/concepts/timezone.md +96 -0
  1610. package/docs/zh-CN/concepts/typebox.md +284 -0
  1611. package/docs/zh-CN/concepts/typing-indicators.md +74 -0
  1612. package/docs/zh-CN/concepts/usage-tracking.md +42 -0
  1613. package/docs/zh-CN/date-time.md +129 -0
  1614. package/docs/zh-CN/debug/node-issue.md +90 -0
  1615. package/docs/zh-CN/diagnostics/flags.md +98 -0
  1616. package/docs/zh-CN/gateway/authentication.md +184 -0
  1617. package/docs/zh-CN/gateway/background-process.md +100 -0
  1618. package/docs/zh-CN/gateway/bonjour.md +174 -0
  1619. package/docs/zh-CN/gateway/bridge-protocol.md +86 -0
  1620. package/docs/zh-CN/gateway/cli-backends.md +213 -0
  1621. package/docs/zh-CN/gateway/configuration-examples.md +587 -0
  1622. package/docs/zh-CN/gateway/configuration-reference.md +3103 -0
  1623. package/docs/zh-CN/gateway/configuration.md +640 -0
  1624. package/docs/zh-CN/gateway/discovery.md +123 -0
  1625. package/docs/zh-CN/gateway/doctor.md +238 -0
  1626. package/docs/zh-CN/gateway/gateway-lock.md +41 -0
  1627. package/docs/zh-CN/gateway/health.md +42 -0
  1628. package/docs/zh-CN/gateway/heartbeat.md +274 -0
  1629. package/docs/zh-CN/gateway/index.md +335 -0
  1630. package/docs/zh-CN/gateway/local-models.md +159 -0
  1631. package/docs/zh-CN/gateway/logging.md +114 -0
  1632. package/docs/zh-CN/gateway/multiple-gateways.md +119 -0
  1633. package/docs/zh-CN/gateway/network-model.md +23 -0
  1634. package/docs/zh-CN/gateway/openai-http-api.md +125 -0
  1635. package/docs/zh-CN/gateway/openresponses-http-api.md +317 -0
  1636. package/docs/zh-CN/gateway/pairing.md +99 -0
  1637. package/docs/zh-CN/gateway/protocol.md +220 -0
  1638. package/docs/zh-CN/gateway/remote-gateway-readme.md +164 -0
  1639. package/docs/zh-CN/gateway/remote.md +133 -0
  1640. package/docs/zh-CN/gateway/sandbox-vs-tool-policy-vs-elevated.md +135 -0
  1641. package/docs/zh-CN/gateway/sandboxing.md +188 -0
  1642. package/docs/zh-CN/gateway/security/index.md +777 -0
  1643. package/docs/zh-CN/gateway/tailscale.md +124 -0
  1644. package/docs/zh-CN/gateway/tools-invoke-http-api.md +92 -0
  1645. package/docs/zh-CN/gateway/troubleshooting.md +771 -0
  1646. package/docs/zh-CN/help/debugging.md +160 -0
  1647. package/docs/zh-CN/help/environment.md +88 -0
  1648. package/docs/zh-CN/help/faq.md +2640 -0
  1649. package/docs/zh-CN/help/index.md +28 -0
  1650. package/docs/zh-CN/help/scripts.md +35 -0
  1651. package/docs/zh-CN/help/testing.md +375 -0
  1652. package/docs/zh-CN/help/troubleshooting.md +104 -0
  1653. package/docs/zh-CN/index.md +186 -0
  1654. package/docs/zh-CN/install/ansible.md +215 -0
  1655. package/docs/zh-CN/install/bun.md +65 -0
  1656. package/docs/zh-CN/install/development-channels.md +81 -0
  1657. package/docs/zh-CN/install/docker.md +532 -0
  1658. package/docs/zh-CN/install/exe-dev.md +133 -0
  1659. package/docs/zh-CN/install/fly.md +490 -0
  1660. package/docs/zh-CN/install/gcp.md +510 -0
  1661. package/docs/zh-CN/install/hetzner.md +337 -0
  1662. package/docs/zh-CN/install/index.md +235 -0
  1663. package/docs/zh-CN/install/installer.md +422 -0
  1664. package/docs/zh-CN/install/macos-vm.md +288 -0
  1665. package/docs/zh-CN/install/migrating.md +199 -0
  1666. package/docs/zh-CN/install/nix.md +99 -0
  1667. package/docs/zh-CN/install/node.md +8 -0
  1668. package/docs/zh-CN/install/northflank.mdx +60 -0
  1669. package/docs/zh-CN/install/railway.mdx +106 -0
  1670. package/docs/zh-CN/install/render.mdx +169 -0
  1671. package/docs/zh-CN/install/uninstall.md +135 -0
  1672. package/docs/zh-CN/install/updating.md +233 -0
  1673. package/docs/zh-CN/logging.md +329 -0
  1674. package/docs/zh-CN/network.md +59 -0
  1675. package/docs/zh-CN/nodes/audio.md +120 -0
  1676. package/docs/zh-CN/nodes/camera.md +162 -0
  1677. package/docs/zh-CN/nodes/images.md +79 -0
  1678. package/docs/zh-CN/nodes/index.md +348 -0
  1679. package/docs/zh-CN/nodes/location-command.md +120 -0
  1680. package/docs/zh-CN/nodes/media-understanding.md +380 -0
  1681. package/docs/zh-CN/nodes/talk.md +97 -0
  1682. package/docs/zh-CN/nodes/troubleshooting.md +8 -0
  1683. package/docs/zh-CN/nodes/voicewake.md +72 -0
  1684. package/docs/zh-CN/perplexity.md +102 -0
  1685. package/docs/zh-CN/pi-dev.md +77 -0
  1686. package/docs/zh-CN/pi.md +619 -0
  1687. package/docs/zh-CN/platforms/android.md +155 -0
  1688. package/docs/zh-CN/platforms/digitalocean.md +273 -0
  1689. package/docs/zh-CN/platforms/index.md +60 -0
  1690. package/docs/zh-CN/platforms/ios.md +114 -0
  1691. package/docs/zh-CN/platforms/linux.md +100 -0
  1692. package/docs/zh-CN/platforms/mac/bundled-gateway.md +75 -0
  1693. package/docs/zh-CN/platforms/mac/canvas.md +128 -0
  1694. package/docs/zh-CN/platforms/mac/child-process.md +73 -0
  1695. package/docs/zh-CN/platforms/mac/dev-setup.md +109 -0
  1696. package/docs/zh-CN/platforms/mac/health.md +41 -0
  1697. package/docs/zh-CN/platforms/mac/icon.md +38 -0
  1698. package/docs/zh-CN/platforms/mac/logging.md +64 -0
  1699. package/docs/zh-CN/platforms/mac/menu-bar.md +88 -0
  1700. package/docs/zh-CN/platforms/mac/peekaboo.md +62 -0
  1701. package/docs/zh-CN/platforms/mac/permissions.md +46 -0
  1702. package/docs/zh-CN/platforms/mac/remote.md +90 -0
  1703. package/docs/zh-CN/platforms/mac/signing.md +54 -0
  1704. package/docs/zh-CN/platforms/mac/skills.md +40 -0
  1705. package/docs/zh-CN/platforms/mac/voice-overlay.md +67 -0
  1706. package/docs/zh-CN/platforms/mac/voicewake.md +74 -0
  1707. package/docs/zh-CN/platforms/mac/webchat.md +43 -0
  1708. package/docs/zh-CN/platforms/mac/xpc.md +68 -0
  1709. package/docs/zh-CN/platforms/macos.md +193 -0
  1710. package/docs/zh-CN/platforms/oracle.md +310 -0
  1711. package/docs/zh-CN/platforms/raspberry-pi.md +416 -0
  1712. package/docs/zh-CN/platforms/windows.md +247 -0
  1713. package/docs/zh-CN/plugins/agent-tools.md +99 -0
  1714. package/docs/zh-CN/plugins/manifest.md +68 -0
  1715. package/docs/zh-CN/plugins/voice-call.md +250 -0
  1716. package/docs/zh-CN/plugins/zalouser.md +88 -0
  1717. package/docs/zh-CN/prose.md +141 -0
  1718. package/docs/zh-CN/providers/anthropic.md +265 -0
  1719. package/docs/zh-CN/providers/bedrock.md +170 -0
  1720. package/docs/zh-CN/providers/claude-max-api-proxy.md +155 -0
  1721. package/docs/zh-CN/providers/cloudflare-ai-gateway.md +78 -0
  1722. package/docs/zh-CN/providers/deepgram.md +97 -0
  1723. package/docs/zh-CN/providers/github-copilot.md +67 -0
  1724. package/docs/zh-CN/providers/glm.md +50 -0
  1725. package/docs/zh-CN/providers/huggingface.md +216 -0
  1726. package/docs/zh-CN/providers/index.md +69 -0
  1727. package/docs/zh-CN/providers/kilocode.md +80 -0
  1728. package/docs/zh-CN/providers/litellm.md +160 -0
  1729. package/docs/zh-CN/providers/minimax.md +222 -0
  1730. package/docs/zh-CN/providers/mistral.md +61 -0
  1731. package/docs/zh-CN/providers/models.md +51 -0
  1732. package/docs/zh-CN/providers/moonshot.md +182 -0
  1733. package/docs/zh-CN/providers/nvidia.md +62 -0
  1734. package/docs/zh-CN/providers/ollama.md +359 -0
  1735. package/docs/zh-CN/providers/openai.md +308 -0
  1736. package/docs/zh-CN/providers/opencode-go.md +52 -0
  1737. package/docs/zh-CN/providers/opencode.md +71 -0
  1738. package/docs/zh-CN/providers/openrouter.md +44 -0
  1739. package/docs/zh-CN/providers/qianfan.md +45 -0
  1740. package/docs/zh-CN/providers/qwen.md +55 -0
  1741. package/docs/zh-CN/providers/sglang.md +111 -0
  1742. package/docs/zh-CN/providers/synthetic.md +106 -0
  1743. package/docs/zh-CN/providers/together.md +72 -0
  1744. package/docs/zh-CN/providers/venice.md +289 -0
  1745. package/docs/zh-CN/providers/vercel-ai-gateway.md +66 -0
  1746. package/docs/zh-CN/providers/xiaomi.md +93 -0
  1747. package/docs/zh-CN/providers/zai.md +53 -0
  1748. package/docs/zh-CN/reference/AGENTS.default.md +131 -0
  1749. package/docs/zh-CN/reference/RELEASING.md +48 -0
  1750. package/docs/zh-CN/reference/api-usage-costs.md +141 -0
  1751. package/docs/zh-CN/reference/credits.md +34 -0
  1752. package/docs/zh-CN/reference/device-models.md +54 -0
  1753. package/docs/zh-CN/reference/rpc.md +48 -0
  1754. package/docs/zh-CN/reference/session-management-compaction.md +287 -0
  1755. package/docs/zh-CN/reference/templates/AGENTS.dev.md +89 -0
  1756. package/docs/zh-CN/reference/templates/AGENTS.md +225 -0
  1757. package/docs/zh-CN/reference/templates/BOOT.md +17 -0
  1758. package/docs/zh-CN/reference/templates/BOOTSTRAP.md +68 -0
  1759. package/docs/zh-CN/reference/templates/HEARTBEAT.md +18 -0
  1760. package/docs/zh-CN/reference/templates/IDENTITY.dev.md +54 -0
  1761. package/docs/zh-CN/reference/templates/IDENTITY.md +36 -0
  1762. package/docs/zh-CN/reference/templates/SOUL.dev.md +83 -0
  1763. package/docs/zh-CN/reference/templates/SOUL.md +49 -0
  1764. package/docs/zh-CN/reference/templates/TOOLS.dev.md +31 -0
  1765. package/docs/zh-CN/reference/templates/TOOLS.md +53 -0
  1766. package/docs/zh-CN/reference/templates/USER.dev.md +25 -0
  1767. package/docs/zh-CN/reference/templates/USER.md +30 -0
  1768. package/docs/zh-CN/reference/test.md +57 -0
  1769. package/docs/zh-CN/reference/token-use.md +119 -0
  1770. package/docs/zh-CN/reference/transcript-hygiene.md +109 -0
  1771. package/docs/zh-CN/reference/wizard.md +242 -0
  1772. package/docs/zh-CN/security/formal-verification.md +171 -0
  1773. package/docs/zh-CN/start/bootstrapping.md +9 -0
  1774. package/docs/zh-CN/start/docs-directory.md +70 -0
  1775. package/docs/zh-CN/start/getting-started.md +143 -0
  1776. package/docs/zh-CN/start/hubs.md +194 -0
  1777. package/docs/zh-CN/start/lore.md +226 -0
  1778. package/docs/zh-CN/start/onboarding-overview.md +58 -0
  1779. package/docs/zh-CN/start/onboarding.md +105 -0
  1780. package/docs/zh-CN/start/openclaw.md +248 -0
  1781. package/docs/zh-CN/start/quickstart.md +88 -0
  1782. package/docs/zh-CN/start/setup.md +153 -0
  1783. package/docs/zh-CN/start/showcase.md +423 -0
  1784. package/docs/zh-CN/start/wizard-cli-automation.md +222 -0
  1785. package/docs/zh-CN/start/wizard-cli-reference.md +306 -0
  1786. package/docs/zh-CN/start/wizard.md +132 -0
  1787. package/docs/zh-CN/tools/agent-send.md +59 -0
  1788. package/docs/zh-CN/tools/apply-patch.md +57 -0
  1789. package/docs/zh-CN/tools/browser-linux-troubleshooting.md +144 -0
  1790. package/docs/zh-CN/tools/browser-login.md +75 -0
  1791. package/docs/zh-CN/tools/browser.md +553 -0
  1792. package/docs/zh-CN/tools/chrome-extension.md +183 -0
  1793. package/docs/zh-CN/tools/clawhub.md +209 -0
  1794. package/docs/zh-CN/tools/creating-skills.md +61 -0
  1795. package/docs/zh-CN/tools/elevated.md +64 -0
  1796. package/docs/zh-CN/tools/exec-approvals.md +234 -0
  1797. package/docs/zh-CN/tools/exec.md +169 -0
  1798. package/docs/zh-CN/tools/firecrawl.md +68 -0
  1799. package/docs/zh-CN/tools/index.md +515 -0
  1800. package/docs/zh-CN/tools/llm-task.md +117 -0
  1801. package/docs/zh-CN/tools/lobster.md +349 -0
  1802. package/docs/zh-CN/tools/multi-agent-sandbox-tools.md +401 -0
  1803. package/docs/zh-CN/tools/plugin.md +1612 -0
  1804. package/docs/zh-CN/tools/reactions.md +29 -0
  1805. package/docs/zh-CN/tools/skills-config.md +78 -0
  1806. package/docs/zh-CN/tools/skills.md +279 -0
  1807. package/docs/zh-CN/tools/slash-commands.md +205 -0
  1808. package/docs/zh-CN/tools/subagents.md +167 -0
  1809. package/docs/zh-CN/tools/thinking.md +80 -0
  1810. package/docs/zh-CN/tools/web.md +289 -0
  1811. package/docs/zh-CN/tts.md +375 -0
  1812. package/docs/zh-CN/vps.md +47 -0
  1813. package/docs/zh-CN/web/control-ui.md +191 -0
  1814. package/docs/zh-CN/web/dashboard.md +53 -0
  1815. package/docs/zh-CN/web/index.md +118 -0
  1816. package/docs/zh-CN/web/tui.md +166 -0
  1817. package/docs/zh-CN/web/webchat.md +56 -0
  1818. package/openclaw.mjs +135 -0
  1819. package/package.json +835 -0
  1820. package/skills/1password/SKILL.md +70 -0
  1821. package/skills/1password/references/cli-examples.md +29 -0
  1822. package/skills/1password/references/get-started.md +17 -0
  1823. package/skills/apple-notes/SKILL.md +77 -0
  1824. package/skills/apple-reminders/SKILL.md +118 -0
  1825. package/skills/bear-notes/SKILL.md +107 -0
  1826. package/skills/blogwatcher/SKILL.md +69 -0
  1827. package/skills/blucli/SKILL.md +47 -0
  1828. package/skills/bluebubbles/SKILL.md +131 -0
  1829. package/skills/camsnap/SKILL.md +45 -0
  1830. package/skills/canvas/SKILL.md +198 -0
  1831. package/skills/clawhub/SKILL.md +77 -0
  1832. package/skills/coding-agent/SKILL.md +295 -0
  1833. package/skills/discord/SKILL.md +197 -0
  1834. package/skills/doubao-code/SKILL.md +43 -0
  1835. package/skills/eightctl/SKILL.md +50 -0
  1836. package/skills/gemini/SKILL.md +43 -0
  1837. package/skills/gh-issues/SKILL.md +865 -0
  1838. package/skills/gifgrep/SKILL.md +79 -0
  1839. package/skills/github/SKILL.md +163 -0
  1840. package/skills/gog/SKILL.md +116 -0
  1841. package/skills/goplaces/SKILL.md +52 -0
  1842. package/skills/healthcheck/SKILL.md +245 -0
  1843. package/skills/himalaya/SKILL.md +257 -0
  1844. package/skills/himalaya/references/configuration.md +184 -0
  1845. package/skills/himalaya/references/message-composition.md +199 -0
  1846. package/skills/imsg/SKILL.md +122 -0
  1847. package/skills/kimi-code/SKILL.md +42 -0
  1848. package/skills/mcporter/SKILL.md +61 -0
  1849. package/skills/model-usage/SKILL.md +69 -0
  1850. package/skills/model-usage/references/codexbar-cli.md +33 -0
  1851. package/skills/model-usage/scripts/model_usage.py +320 -0
  1852. package/skills/model-usage/scripts/test_model_usage.py +40 -0
  1853. package/skills/nano-pdf/SKILL.md +38 -0
  1854. package/skills/node-connect/SKILL.md +142 -0
  1855. package/skills/notion/SKILL.md +174 -0
  1856. package/skills/obsidian/SKILL.md +81 -0
  1857. package/skills/openai-image-gen/SKILL.md +92 -0
  1858. package/skills/openai-image-gen/scripts/gen.py +328 -0
  1859. package/skills/openai-image-gen/scripts/test_gen.py +140 -0
  1860. package/skills/openai-whisper/SKILL.md +38 -0
  1861. package/skills/openai-whisper-api/SKILL.md +52 -0
  1862. package/skills/openai-whisper-api/scripts/transcribe.sh +85 -0
  1863. package/skills/openhue/SKILL.md +112 -0
  1864. package/skills/oracle/SKILL.md +125 -0
  1865. package/skills/ordercli/SKILL.md +78 -0
  1866. package/skills/peekaboo/SKILL.md +190 -0
  1867. package/skills/sag/SKILL.md +87 -0
  1868. package/skills/session-logs/SKILL.md +115 -0
  1869. package/skills/sherpa-onnx-tts/SKILL.md +103 -0
  1870. package/skills/sherpa-onnx-tts/bin/sherpa-onnx-tts +178 -0
  1871. package/skills/skill-creator/SKILL.md +372 -0
  1872. package/skills/skill-creator/license.txt +202 -0
  1873. package/skills/skill-creator/scripts/init_skill.py +378 -0
  1874. package/skills/skill-creator/scripts/package_skill.py +139 -0
  1875. package/skills/skill-creator/scripts/quick_validate.py +159 -0
  1876. package/skills/skill-creator/scripts/test_package_skill.py +160 -0
  1877. package/skills/skill-creator/scripts/test_quick_validate.py +72 -0
  1878. package/skills/slack/SKILL.md +144 -0
  1879. package/skills/songsee/SKILL.md +49 -0
  1880. package/skills/sonoscli/SKILL.md +65 -0
  1881. package/skills/spotify-player/SKILL.md +64 -0
  1882. package/skills/summarize/SKILL.md +87 -0
  1883. package/skills/things-mac/SKILL.md +86 -0
  1884. package/skills/tmux/SKILL.md +153 -0
  1885. package/skills/tmux/scripts/find-sessions.sh +112 -0
  1886. package/skills/tmux/scripts/wait-for-text.sh +83 -0
  1887. package/skills/trello/SKILL.md +95 -0
  1888. package/skills/video-frames/SKILL.md +46 -0
  1889. package/skills/video-frames/scripts/frame.sh +81 -0
  1890. package/skills/voice-call/SKILL.md +45 -0
  1891. package/skills/wacli/SKILL.md +72 -0
  1892. package/skills/weather/SKILL.md +112 -0
  1893. package/skills/xurl/SKILL.md +461 -0
@@ -0,0 +1,3145 @@
1
+ import { c as normalizeResolvedSecretInputString, l as normalizeSecretInputString } from "./types.secrets-BWSeXrF4.js";
2
+ import { t as parseFiniteNumber } from "./parse-finite-number-CP4MQF_w.js";
3
+ import { t as resolveAckReaction } from "./identity-cyBYcoXS.js";
4
+ import { n as stripMarkdown } from "./markdown-to-line-BWwaRx5F.js";
5
+ import { d as mapAllowFromEntries } from "./channel-config-helpers-CieQWILI.js";
6
+ import { n as createChannelPairingController } from "./channel-pairing-D54mn51y.js";
7
+ import { n as resolveControlCommandGate } from "./command-gating-BQXGSqc9.js";
8
+ import { n as readStoreAllowFromForDmPolicy, o as resolveDmGroupAccessWithLists, t as DM_GROUP_ACCESS_REASON } from "./dm-policy-shared-6bCJzHOS.js";
9
+ import { d as resolveOutboundMediaUrls, h as sendMediaWithLeadingCaption, m as resolveTextChunksWithFallback } from "./reply-payload-DBGc074f.js";
10
+ import { t as resolveChannelMediaMaxBytes } from "./media-limits-Cuvmmhop.js";
11
+ import { c as evictOldHistoryKeys, u as recordPendingHistoryEntryIfEnabled } from "./history-CHjo8B5W.js";
12
+ import { n as logInboundDrop, r as logTypingFailure, t as logAckFailure } from "./logging-Bz1qZDPg.js";
13
+ import { t as createChannelReplyPipeline } from "./channel-reply-pipeline-CPTuaW8n.js";
14
+ import { t as resolveRequestUrl } from "./request-url-BKfWAQx8.js";
15
+ import { c as withResolvedWebhookRequestPipeline, g as readWebhookBodyOrReject, n as registerWebhookTargetWithPluginRoute, o as resolveWebhookTargetWithAuthOrRejectSync, p as createWebhookInFlightLimiter } from "./webhook-ingress-CupqYpKM.js";
16
+ import { t as normalizeWebhookPath } from "./webhook-path-BGFZ55ML.js";
17
+ import { _ as buildBlueBubblesApiUrl, f as parseBlueBubblesTarget, g as blueBubblesFetchWithTimeout, i as formatBlueBubblesChatTarget, l as normalizeBlueBubblesHandle, m as resolveBlueBubblesAccount, o as isAllowedBlueBubblesSender, r as extractHandleFromChatGuid } from "./webhook-shared-Cvk3b0ac.js";
18
+ import { a as getCachedBlueBubblesPrivateApiStatus, i as fetchBlueBubblesServerInfo, o as isBlueBubblesPrivateApiEnabled, r as warnBlueBubbles, s as isBlueBubblesPrivateApiStatusEnabled, t as getBlueBubblesRuntime } from "./runtime-CqDQ81eY.js";
19
+ import { fileURLToPath } from "node:url";
20
+ import { constants } from "node:fs";
21
+ import path from "node:path";
22
+ import os from "node:os";
23
+ import fs$1 from "node:fs/promises";
24
+ import crypto, { createHash, timingSafeEqual } from "node:crypto";
25
+ //#region extensions/bluebubbles/src/account-resolve.ts
26
+ function resolveBlueBubblesServerAccount(params) {
27
+ const account = resolveBlueBubblesAccount({
28
+ cfg: params.cfg ?? {},
29
+ accountId: params.accountId
30
+ });
31
+ const baseUrl = normalizeResolvedSecretInputString({
32
+ value: params.serverUrl,
33
+ path: "channels.bluebubbles.serverUrl"
34
+ }) || normalizeResolvedSecretInputString({
35
+ value: account.config.serverUrl,
36
+ path: `channels.bluebubbles.accounts.${account.accountId}.serverUrl`
37
+ });
38
+ const password = normalizeResolvedSecretInputString({
39
+ value: params.password,
40
+ path: "channels.bluebubbles.password"
41
+ }) || normalizeResolvedSecretInputString({
42
+ value: account.config.password,
43
+ path: `channels.bluebubbles.accounts.${account.accountId}.password`
44
+ });
45
+ if (!baseUrl) throw new Error("BlueBubbles serverUrl is required");
46
+ if (!password) throw new Error("BlueBubbles password is required");
47
+ return {
48
+ baseUrl,
49
+ password,
50
+ accountId: account.accountId,
51
+ allowPrivateNetwork: account.config.allowPrivateNetwork === true
52
+ };
53
+ }
54
+ //#endregion
55
+ //#region extensions/bluebubbles/src/multipart.ts
56
+ function concatUint8Arrays(parts) {
57
+ const totalLength = parts.reduce((acc, part) => acc + part.length, 0);
58
+ const body = new Uint8Array(totalLength);
59
+ let offset = 0;
60
+ for (const part of parts) {
61
+ body.set(part, offset);
62
+ offset += part.length;
63
+ }
64
+ return body;
65
+ }
66
+ async function postMultipartFormData(params) {
67
+ const body = Buffer.from(concatUint8Arrays(params.parts));
68
+ return await blueBubblesFetchWithTimeout(params.url, {
69
+ method: "POST",
70
+ headers: { "Content-Type": `multipart/form-data; boundary=${params.boundary}` },
71
+ body
72
+ }, params.timeoutMs);
73
+ }
74
+ async function assertMultipartActionOk(response, action) {
75
+ if (response.ok) return;
76
+ const errorText = await response.text().catch(() => "");
77
+ throw new Error(`BlueBubbles ${action} failed (${response.status}): ${errorText || "unknown"}`);
78
+ }
79
+ //#endregion
80
+ //#region extensions/bluebubbles/src/send-helpers.ts
81
+ function resolveBlueBubblesSendTarget(raw) {
82
+ const parsed = parseBlueBubblesTarget(raw);
83
+ if (parsed.kind === "handle") return {
84
+ kind: "handle",
85
+ address: normalizeBlueBubblesHandle(parsed.to),
86
+ service: parsed.service
87
+ };
88
+ if (parsed.kind === "chat_id") return {
89
+ kind: "chat_id",
90
+ chatId: parsed.chatId
91
+ };
92
+ if (parsed.kind === "chat_guid") return {
93
+ kind: "chat_guid",
94
+ chatGuid: parsed.chatGuid
95
+ };
96
+ return {
97
+ kind: "chat_identifier",
98
+ chatIdentifier: parsed.chatIdentifier
99
+ };
100
+ }
101
+ function extractBlueBubblesMessageId(payload) {
102
+ if (!payload || typeof payload !== "object") return "unknown";
103
+ const asRecord = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
104
+ const record = payload;
105
+ const roots = [
106
+ record,
107
+ asRecord(record.data),
108
+ asRecord(record.result),
109
+ asRecord(record.payload),
110
+ asRecord(record.message),
111
+ Array.isArray(record.data) ? asRecord(record.data[0]) : null
112
+ ];
113
+ for (const root of roots) {
114
+ if (!root) continue;
115
+ const candidates = [
116
+ root.message_id,
117
+ root.messageId,
118
+ root.messageGuid,
119
+ root.message_guid,
120
+ root.guid,
121
+ root.id,
122
+ root.uuid
123
+ ];
124
+ for (const candidate of candidates) {
125
+ if (typeof candidate === "string" && candidate.trim()) return candidate.trim();
126
+ if (typeof candidate === "number" && Number.isFinite(candidate)) return String(candidate);
127
+ }
128
+ }
129
+ return "unknown";
130
+ }
131
+ //#endregion
132
+ //#region extensions/bluebubbles/src/send.ts
133
+ /** Maps short effect names to full Apple effect IDs */
134
+ const EFFECT_MAP = {
135
+ slam: "com.apple.MobileSMS.expressivesend.impact",
136
+ loud: "com.apple.MobileSMS.expressivesend.loud",
137
+ gentle: "com.apple.MobileSMS.expressivesend.gentle",
138
+ invisible: "com.apple.MobileSMS.expressivesend.invisibleink",
139
+ "invisible-ink": "com.apple.MobileSMS.expressivesend.invisibleink",
140
+ "invisible ink": "com.apple.MobileSMS.expressivesend.invisibleink",
141
+ invisibleink: "com.apple.MobileSMS.expressivesend.invisibleink",
142
+ echo: "com.apple.messages.effect.CKEchoEffect",
143
+ spotlight: "com.apple.messages.effect.CKSpotlightEffect",
144
+ balloons: "com.apple.messages.effect.CKHappyBirthdayEffect",
145
+ confetti: "com.apple.messages.effect.CKConfettiEffect",
146
+ love: "com.apple.messages.effect.CKHeartEffect",
147
+ heart: "com.apple.messages.effect.CKHeartEffect",
148
+ hearts: "com.apple.messages.effect.CKHeartEffect",
149
+ lasers: "com.apple.messages.effect.CKLasersEffect",
150
+ fireworks: "com.apple.messages.effect.CKFireworksEffect",
151
+ celebration: "com.apple.messages.effect.CKSparklesEffect"
152
+ };
153
+ function resolveEffectId(raw) {
154
+ if (!raw) return;
155
+ const trimmed = raw.trim().toLowerCase();
156
+ if (EFFECT_MAP[trimmed]) return EFFECT_MAP[trimmed];
157
+ const normalized = trimmed.replace(/[\s_]+/g, "-");
158
+ if (EFFECT_MAP[normalized]) return EFFECT_MAP[normalized];
159
+ const compact = trimmed.replace(/[\s_-]+/g, "");
160
+ if (EFFECT_MAP[compact]) return EFFECT_MAP[compact];
161
+ return raw;
162
+ }
163
+ function resolvePrivateApiDecision(params) {
164
+ const { privateApiStatus, wantsReplyThread, wantsEffect } = params;
165
+ const needsPrivateApi = wantsReplyThread || wantsEffect;
166
+ const canUsePrivateApi = needsPrivateApi && isBlueBubblesPrivateApiStatusEnabled(privateApiStatus);
167
+ const throwEffectDisabledError = wantsEffect && privateApiStatus === false;
168
+ if (!needsPrivateApi || privateApiStatus !== null) return {
169
+ canUsePrivateApi,
170
+ throwEffectDisabledError
171
+ };
172
+ return {
173
+ canUsePrivateApi,
174
+ throwEffectDisabledError,
175
+ warningMessage: `Private API status unknown; sending without ${[wantsReplyThread ? "reply threading" : null, wantsEffect ? "message effects" : null].filter(Boolean).join(" + ")}. Run a status probe to restore private-api features.`
176
+ };
177
+ }
178
+ async function parseBlueBubblesMessageResponse(res) {
179
+ const body = await res.text();
180
+ if (!body) return { messageId: "ok" };
181
+ try {
182
+ return { messageId: extractBlueBubblesMessageId(JSON.parse(body)) };
183
+ } catch {
184
+ return { messageId: "ok" };
185
+ }
186
+ }
187
+ function extractChatGuid(chat) {
188
+ const candidates = [
189
+ chat.chatGuid,
190
+ chat.guid,
191
+ chat.chat_guid,
192
+ chat.identifier,
193
+ chat.chatIdentifier,
194
+ chat.chat_identifier
195
+ ];
196
+ for (const candidate of candidates) if (typeof candidate === "string" && candidate.trim()) return candidate.trim();
197
+ return null;
198
+ }
199
+ function extractChatId(chat) {
200
+ const candidates = [
201
+ chat.chatId,
202
+ chat.id,
203
+ chat.chat_id
204
+ ];
205
+ for (const candidate of candidates) if (typeof candidate === "number" && Number.isFinite(candidate)) return candidate;
206
+ return null;
207
+ }
208
+ function extractChatIdentifierFromChatGuid$1(chatGuid) {
209
+ const parts = chatGuid.split(";");
210
+ if (parts.length < 3) return null;
211
+ const identifier = parts[2]?.trim();
212
+ return identifier ? identifier : null;
213
+ }
214
+ function extractParticipantAddresses(chat) {
215
+ const raw = (Array.isArray(chat.participants) ? chat.participants : null) ?? (Array.isArray(chat.handles) ? chat.handles : null) ?? (Array.isArray(chat.participantHandles) ? chat.participantHandles : null);
216
+ if (!raw) return [];
217
+ const out = [];
218
+ for (const entry of raw) {
219
+ if (typeof entry === "string") {
220
+ out.push(entry);
221
+ continue;
222
+ }
223
+ if (entry && typeof entry === "object") {
224
+ const record = entry;
225
+ const candidate = typeof record.address === "string" && record.address || typeof record.handle === "string" && record.handle || typeof record.id === "string" && record.id || typeof record.identifier === "string" && record.identifier;
226
+ if (candidate) out.push(candidate);
227
+ }
228
+ }
229
+ return out;
230
+ }
231
+ async function queryChats(params) {
232
+ const res = await blueBubblesFetchWithTimeout(buildBlueBubblesApiUrl({
233
+ baseUrl: params.baseUrl,
234
+ path: "/api/v1/chat/query",
235
+ password: params.password
236
+ }), {
237
+ method: "POST",
238
+ headers: { "Content-Type": "application/json" },
239
+ body: JSON.stringify({
240
+ limit: params.limit,
241
+ offset: params.offset,
242
+ with: ["participants"]
243
+ })
244
+ }, params.timeoutMs);
245
+ if (!res.ok) return [];
246
+ const payload = await res.json().catch(() => null);
247
+ const data = payload && typeof payload.data !== "undefined" ? payload.data : null;
248
+ return Array.isArray(data) ? data : [];
249
+ }
250
+ async function resolveChatGuidForTarget(params) {
251
+ if (params.target.kind === "chat_guid") return params.target.chatGuid;
252
+ const normalizedHandle = params.target.kind === "handle" ? normalizeBlueBubblesHandle(params.target.address) : "";
253
+ const targetChatId = params.target.kind === "chat_id" ? params.target.chatId : null;
254
+ const targetChatIdentifier = params.target.kind === "chat_identifier" ? params.target.chatIdentifier : null;
255
+ const limit = 500;
256
+ let participantMatch = null;
257
+ for (let offset = 0; offset < 5e3; offset += limit) {
258
+ const chats = await queryChats({
259
+ baseUrl: params.baseUrl,
260
+ password: params.password,
261
+ timeoutMs: params.timeoutMs,
262
+ offset,
263
+ limit
264
+ });
265
+ if (chats.length === 0) break;
266
+ for (const chat of chats) {
267
+ if (targetChatId != null) {
268
+ const chatId = extractChatId(chat);
269
+ if (chatId != null && chatId === targetChatId) return extractChatGuid(chat);
270
+ }
271
+ if (targetChatIdentifier) {
272
+ const guid = extractChatGuid(chat);
273
+ if (guid) {
274
+ if (guid === targetChatIdentifier) return guid;
275
+ const guidIdentifier = extractChatIdentifierFromChatGuid$1(guid);
276
+ if (guidIdentifier && guidIdentifier === targetChatIdentifier) return guid;
277
+ }
278
+ const identifier = typeof chat.identifier === "string" ? chat.identifier : typeof chat.chatIdentifier === "string" ? chat.chatIdentifier : typeof chat.chat_identifier === "string" ? chat.chat_identifier : "";
279
+ if (identifier && identifier === targetChatIdentifier) return guid ?? extractChatGuid(chat);
280
+ }
281
+ if (normalizedHandle) {
282
+ const guid = extractChatGuid(chat);
283
+ const directHandle = guid ? extractHandleFromChatGuid(guid) : null;
284
+ if (directHandle && directHandle === normalizedHandle) return guid;
285
+ if (!participantMatch && guid) {
286
+ if (guid.includes(";-;")) {
287
+ if (extractParticipantAddresses(chat).map((entry) => normalizeBlueBubblesHandle(entry)).includes(normalizedHandle)) participantMatch = guid;
288
+ }
289
+ }
290
+ }
291
+ }
292
+ }
293
+ return participantMatch;
294
+ }
295
+ /**
296
+ * Creates a new DM chat for the given address and returns the chat GUID.
297
+ * Requires Private API to be enabled in BlueBubbles.
298
+ *
299
+ * If a `message` is provided it is sent as the initial message in the new chat;
300
+ * otherwise an empty-string message body is used (BlueBubbles still creates the
301
+ * chat but will not deliver a visible bubble).
302
+ */
303
+ async function createChatForHandle(params) {
304
+ const url = buildBlueBubblesApiUrl({
305
+ baseUrl: params.baseUrl,
306
+ path: "/api/v1/chat/new",
307
+ password: params.password
308
+ });
309
+ const payload = {
310
+ addresses: [params.address],
311
+ message: params.message ?? "",
312
+ tempGuid: `temp-${crypto.randomUUID()}`
313
+ };
314
+ const res = await blueBubblesFetchWithTimeout(url, {
315
+ method: "POST",
316
+ headers: { "Content-Type": "application/json" },
317
+ body: JSON.stringify(payload)
318
+ }, params.timeoutMs);
319
+ if (!res.ok) {
320
+ const errorText = await res.text();
321
+ if (res.status === 400 || res.status === 403 || errorText.toLowerCase().includes("private api")) throw new Error(`BlueBubbles send failed: Cannot create new chat - Private API must be enabled. Original error: ${errorText || res.status}`);
322
+ throw new Error(`BlueBubbles create chat failed (${res.status}): ${errorText || "unknown"}`);
323
+ }
324
+ const body = await res.text();
325
+ let messageId = "ok";
326
+ let chatGuid = null;
327
+ if (body) try {
328
+ const parsed = JSON.parse(body);
329
+ messageId = extractBlueBubblesMessageId(parsed);
330
+ const data = parsed.data;
331
+ if (data) {
332
+ chatGuid = typeof data.chatGuid === "string" && data.chatGuid || typeof data.guid === "string" && data.guid || null;
333
+ if (!chatGuid) {
334
+ const chats = data.chats ?? data.chat;
335
+ if (Array.isArray(chats) && chats.length > 0) {
336
+ const first = chats[0];
337
+ chatGuid = typeof first?.guid === "string" && first.guid || typeof first?.chatGuid === "string" && first.chatGuid || null;
338
+ } else if (chats && typeof chats === "object" && !Array.isArray(chats)) {
339
+ const chatObj = chats;
340
+ chatGuid = typeof chatObj.guid === "string" && chatObj.guid || typeof chatObj.chatGuid === "string" && chatObj.chatGuid || null;
341
+ }
342
+ }
343
+ }
344
+ } catch {}
345
+ return {
346
+ chatGuid,
347
+ messageId
348
+ };
349
+ }
350
+ /**
351
+ * Creates a new chat (DM) and sends an initial message.
352
+ * Requires Private API to be enabled in BlueBubbles.
353
+ */
354
+ async function createNewChatWithMessage(params) {
355
+ return { messageId: (await createChatForHandle({
356
+ baseUrl: params.baseUrl,
357
+ password: params.password,
358
+ address: params.address,
359
+ message: params.message,
360
+ timeoutMs: params.timeoutMs
361
+ })).messageId };
362
+ }
363
+ async function sendMessageBlueBubbles(to, text, opts = {}) {
364
+ const trimmedText = text ?? "";
365
+ if (!trimmedText.trim()) throw new Error("BlueBubbles send requires text");
366
+ const strippedText = stripMarkdown(trimmedText);
367
+ if (!strippedText.trim()) throw new Error("BlueBubbles send requires text (message was empty after markdown removal)");
368
+ const account = resolveBlueBubblesAccount({
369
+ cfg: opts.cfg ?? {},
370
+ accountId: opts.accountId
371
+ });
372
+ const baseUrl = normalizeSecretInputString(opts.serverUrl) || normalizeSecretInputString(account.config.serverUrl);
373
+ const password = normalizeSecretInputString(opts.password) || normalizeSecretInputString(account.config.password);
374
+ if (!baseUrl) throw new Error("BlueBubbles serverUrl is required");
375
+ if (!password) throw new Error("BlueBubbles password is required");
376
+ const privateApiStatus = getCachedBlueBubblesPrivateApiStatus(account.accountId);
377
+ const target = resolveBlueBubblesSendTarget(to);
378
+ const chatGuid = await resolveChatGuidForTarget({
379
+ baseUrl,
380
+ password,
381
+ timeoutMs: opts.timeoutMs,
382
+ target
383
+ });
384
+ if (!chatGuid) {
385
+ if (target.kind === "handle") return createNewChatWithMessage({
386
+ baseUrl,
387
+ password,
388
+ address: target.address,
389
+ message: strippedText,
390
+ timeoutMs: opts.timeoutMs
391
+ });
392
+ throw new Error("BlueBubbles send failed: chatGuid not found for target. Use a chat_guid target or ensure the chat exists.");
393
+ }
394
+ const effectId = resolveEffectId(opts.effectId);
395
+ const wantsReplyThread = Boolean(opts.replyToMessageGuid?.trim());
396
+ const privateApiDecision = resolvePrivateApiDecision({
397
+ privateApiStatus,
398
+ wantsReplyThread,
399
+ wantsEffect: Boolean(effectId)
400
+ });
401
+ if (privateApiDecision.throwEffectDisabledError) throw new Error("BlueBubbles send failed: reply/effect requires Private API, but it is disabled on the BlueBubbles server.");
402
+ if (privateApiDecision.warningMessage) warnBlueBubbles(privateApiDecision.warningMessage);
403
+ const payload = {
404
+ chatGuid,
405
+ tempGuid: crypto.randomUUID(),
406
+ message: strippedText
407
+ };
408
+ if (privateApiDecision.canUsePrivateApi) payload.method = "private-api";
409
+ if (wantsReplyThread && privateApiDecision.canUsePrivateApi) {
410
+ payload.selectedMessageGuid = opts.replyToMessageGuid;
411
+ payload.partIndex = typeof opts.replyToPartIndex === "number" ? opts.replyToPartIndex : 0;
412
+ }
413
+ if (effectId && privateApiDecision.canUsePrivateApi) payload.effectId = effectId;
414
+ const res = await blueBubblesFetchWithTimeout(buildBlueBubblesApiUrl({
415
+ baseUrl,
416
+ path: "/api/v1/message/text",
417
+ password
418
+ }), {
419
+ method: "POST",
420
+ headers: { "Content-Type": "application/json" },
421
+ body: JSON.stringify(payload)
422
+ }, opts.timeoutMs);
423
+ if (!res.ok) {
424
+ const errorText = await res.text();
425
+ throw new Error(`BlueBubbles send failed (${res.status}): ${errorText || "unknown"}`);
426
+ }
427
+ return parseBlueBubblesMessageResponse(res);
428
+ }
429
+ //#endregion
430
+ //#region extensions/bluebubbles/src/attachments.ts
431
+ const DEFAULT_ATTACHMENT_MAX_BYTES = 8 * 1024 * 1024;
432
+ const AUDIO_MIME_MP3 = new Set(["audio/mpeg", "audio/mp3"]);
433
+ const AUDIO_MIME_CAF = new Set(["audio/x-caf", "audio/caf"]);
434
+ function sanitizeFilename(input, fallback) {
435
+ const trimmed = input?.trim() ?? "";
436
+ return ((trimmed ? path.basename(trimmed) : "") || fallback).replace(/[\r\n"\\]/g, "_");
437
+ }
438
+ function ensureExtension(filename, extension, fallbackBase) {
439
+ const currentExt = path.extname(filename);
440
+ if (currentExt.toLowerCase() === extension) return filename;
441
+ return `${(currentExt ? filename.slice(0, -currentExt.length) : filename) || fallbackBase}${extension}`;
442
+ }
443
+ function resolveVoiceInfo(filename, contentType) {
444
+ const normalizedType = contentType?.trim().toLowerCase();
445
+ const extension = path.extname(filename).toLowerCase();
446
+ const isMp3 = extension === ".mp3" || (normalizedType ? AUDIO_MIME_MP3.has(normalizedType) : false);
447
+ const isCaf = extension === ".caf" || (normalizedType ? AUDIO_MIME_CAF.has(normalizedType) : false);
448
+ return {
449
+ isAudio: isMp3 || isCaf || Boolean(normalizedType?.startsWith("audio/")),
450
+ isMp3,
451
+ isCaf
452
+ };
453
+ }
454
+ function resolveAccount$3(params) {
455
+ return resolveBlueBubblesServerAccount(params);
456
+ }
457
+ function safeExtractHostname(url) {
458
+ try {
459
+ return new URL(url).hostname.trim() || void 0;
460
+ } catch {
461
+ return;
462
+ }
463
+ }
464
+ function readMediaFetchErrorCode(error) {
465
+ if (!error || typeof error !== "object") return;
466
+ const code = error.code;
467
+ return code === "max_bytes" || code === "http_error" || code === "fetch_failed" ? code : void 0;
468
+ }
469
+ async function downloadBlueBubblesAttachment(attachment, opts = {}) {
470
+ const guid = attachment.guid?.trim();
471
+ if (!guid) throw new Error("BlueBubbles attachment guid is required");
472
+ const { baseUrl, password, allowPrivateNetwork } = resolveAccount$3(opts);
473
+ const url = buildBlueBubblesApiUrl({
474
+ baseUrl,
475
+ path: `/api/v1/attachment/${encodeURIComponent(guid)}/download`,
476
+ password
477
+ });
478
+ const maxBytes = typeof opts.maxBytes === "number" ? opts.maxBytes : DEFAULT_ATTACHMENT_MAX_BYTES;
479
+ const trustedHostname = safeExtractHostname(baseUrl);
480
+ try {
481
+ const fetched = await getBlueBubblesRuntime().channel.media.fetchRemoteMedia({
482
+ url,
483
+ filePathHint: attachment.transferName ?? attachment.guid ?? "attachment",
484
+ maxBytes,
485
+ ssrfPolicy: allowPrivateNetwork ? { allowPrivateNetwork: true } : trustedHostname ? { allowedHostnames: [trustedHostname] } : void 0,
486
+ fetchImpl: async (input, init) => await blueBubblesFetchWithTimeout(resolveRequestUrl(input), {
487
+ ...init,
488
+ method: init?.method ?? "GET"
489
+ }, opts.timeoutMs)
490
+ });
491
+ return {
492
+ buffer: new Uint8Array(fetched.buffer),
493
+ contentType: fetched.contentType ?? attachment.mimeType ?? void 0
494
+ };
495
+ } catch (error) {
496
+ if (readMediaFetchErrorCode(error) === "max_bytes") throw new Error(`BlueBubbles attachment too large (limit ${maxBytes} bytes)`);
497
+ const text = error instanceof Error ? error.message : String(error);
498
+ throw new Error(`BlueBubbles attachment download failed: ${text}`);
499
+ }
500
+ }
501
+ /**
502
+ * Send an attachment via BlueBubbles API.
503
+ * Supports sending media files (images, videos, audio, documents) to a chat.
504
+ * When asVoice is true, expects MP3/CAF audio and marks it as an iMessage voice memo.
505
+ */
506
+ async function sendBlueBubblesAttachment(params) {
507
+ const { to, caption, replyToMessageGuid, replyToPartIndex, asVoice, opts = {} } = params;
508
+ let { buffer, filename, contentType } = params;
509
+ const wantsVoice = asVoice === true;
510
+ const fallbackName = wantsVoice ? "Audio Message" : "attachment";
511
+ filename = sanitizeFilename(filename, fallbackName);
512
+ contentType = contentType?.trim() || void 0;
513
+ const { baseUrl, password, accountId } = resolveAccount$3(opts);
514
+ const privateApiStatus = getCachedBlueBubblesPrivateApiStatus(accountId);
515
+ const privateApiEnabled = isBlueBubblesPrivateApiStatusEnabled(privateApiStatus);
516
+ const isAudioMessage = wantsVoice;
517
+ if (isAudioMessage) {
518
+ const voiceInfo = resolveVoiceInfo(filename, contentType);
519
+ if (!voiceInfo.isAudio) throw new Error("BlueBubbles voice messages require audio media (mp3 or caf).");
520
+ if (voiceInfo.isMp3) {
521
+ filename = ensureExtension(filename, ".mp3", fallbackName);
522
+ contentType = contentType ?? "audio/mpeg";
523
+ } else if (voiceInfo.isCaf) {
524
+ filename = ensureExtension(filename, ".caf", fallbackName);
525
+ contentType = contentType ?? "audio/x-caf";
526
+ } else throw new Error("BlueBubbles voice messages require mp3 or caf audio (convert before sending).");
527
+ }
528
+ const target = resolveBlueBubblesSendTarget(to);
529
+ let chatGuid = await resolveChatGuidForTarget({
530
+ baseUrl,
531
+ password,
532
+ timeoutMs: opts.timeoutMs,
533
+ target
534
+ });
535
+ if (!chatGuid) {
536
+ if (target.kind === "handle") {
537
+ chatGuid = (await createChatForHandle({
538
+ baseUrl,
539
+ password,
540
+ address: target.address,
541
+ timeoutMs: opts.timeoutMs
542
+ })).chatGuid;
543
+ if (!chatGuid) chatGuid = await resolveChatGuidForTarget({
544
+ baseUrl,
545
+ password,
546
+ timeoutMs: opts.timeoutMs,
547
+ target
548
+ });
549
+ }
550
+ if (!chatGuid) throw new Error("BlueBubbles attachment send failed: chatGuid not found for target. Use a chat_guid target or ensure the chat exists.");
551
+ }
552
+ const url = buildBlueBubblesApiUrl({
553
+ baseUrl,
554
+ path: "/api/v1/message/attachment",
555
+ password
556
+ });
557
+ const boundary = `----BlueBubblesFormBoundary${crypto.randomUUID().replace(/-/g, "")}`;
558
+ const parts = [];
559
+ const encoder = new TextEncoder();
560
+ const addField = (name, value) => {
561
+ parts.push(encoder.encode(`--${boundary}\r\n`));
562
+ parts.push(encoder.encode(`Content-Disposition: form-data; name="${name}"\r\n\r\n`));
563
+ parts.push(encoder.encode(`${value}\r\n`));
564
+ };
565
+ const addFile = (name, fileBuffer, fileName, mimeType) => {
566
+ parts.push(encoder.encode(`--${boundary}\r\n`));
567
+ parts.push(encoder.encode(`Content-Disposition: form-data; name="${name}"; filename="${fileName}"\r\n`));
568
+ parts.push(encoder.encode(`Content-Type: ${mimeType ?? "application/octet-stream"}\r\n\r\n`));
569
+ parts.push(fileBuffer);
570
+ parts.push(encoder.encode("\r\n"));
571
+ };
572
+ addFile("attachment", buffer, filename, contentType);
573
+ addField("chatGuid", chatGuid);
574
+ addField("name", filename);
575
+ addField("tempGuid", `temp-${Date.now()}-${crypto.randomUUID().slice(0, 8)}`);
576
+ if (privateApiEnabled) addField("method", "private-api");
577
+ if (isAudioMessage) addField("isAudioMessage", "true");
578
+ const trimmedReplyTo = replyToMessageGuid?.trim();
579
+ if (trimmedReplyTo && privateApiEnabled) {
580
+ addField("selectedMessageGuid", trimmedReplyTo);
581
+ addField("partIndex", typeof replyToPartIndex === "number" ? String(replyToPartIndex) : "0");
582
+ } else if (trimmedReplyTo && privateApiStatus === null) warnBlueBubbles("Private API status unknown; sending attachment without reply threading metadata. Run a status probe to restore private-api reply features.");
583
+ if (caption) {
584
+ addField("message", caption);
585
+ addField("text", caption);
586
+ addField("caption", caption);
587
+ }
588
+ parts.push(encoder.encode(`--${boundary}--\r\n`));
589
+ const res = await postMultipartFormData({
590
+ url,
591
+ boundary,
592
+ parts,
593
+ timeoutMs: opts.timeoutMs ?? 6e4
594
+ });
595
+ await assertMultipartActionOk(res, "attachment send");
596
+ const responseBody = await res.text();
597
+ if (!responseBody) return { messageId: "ok" };
598
+ try {
599
+ return { messageId: extractBlueBubblesMessageId(JSON.parse(responseBody)) };
600
+ } catch {
601
+ return { messageId: "ok" };
602
+ }
603
+ }
604
+ //#endregion
605
+ //#region extensions/bluebubbles/src/chat.ts
606
+ function resolveAccount$2(params) {
607
+ return resolveBlueBubblesServerAccount(params);
608
+ }
609
+ function assertPrivateApiEnabled(accountId, feature) {
610
+ if (getCachedBlueBubblesPrivateApiStatus(accountId) === false) throw new Error(`BlueBubbles ${feature} requires Private API, but it is disabled on the BlueBubbles server.`);
611
+ }
612
+ function resolvePartIndex(partIndex) {
613
+ return typeof partIndex === "number" ? partIndex : 0;
614
+ }
615
+ async function sendBlueBubblesChatEndpointRequest(params) {
616
+ const trimmed = params.chatGuid.trim();
617
+ if (!trimmed) return;
618
+ const { baseUrl, password, accountId } = resolveAccount$2(params.opts);
619
+ if (getCachedBlueBubblesPrivateApiStatus(accountId) === false) return;
620
+ await assertMultipartActionOk(await blueBubblesFetchWithTimeout(buildBlueBubblesApiUrl({
621
+ baseUrl,
622
+ path: `/api/v1/chat/${encodeURIComponent(trimmed)}/${params.endpoint}`,
623
+ password
624
+ }), { method: params.method }, params.opts.timeoutMs), params.action);
625
+ }
626
+ async function sendPrivateApiJsonRequest(params) {
627
+ const { baseUrl, password, accountId } = resolveAccount$2(params.opts);
628
+ assertPrivateApiEnabled(accountId, params.feature);
629
+ const url = buildBlueBubblesApiUrl({
630
+ baseUrl,
631
+ path: params.path,
632
+ password
633
+ });
634
+ const request = { method: params.method };
635
+ if (params.payload !== void 0) {
636
+ request.headers = { "Content-Type": "application/json" };
637
+ request.body = JSON.stringify(params.payload);
638
+ }
639
+ await assertMultipartActionOk(await blueBubblesFetchWithTimeout(url, request, params.opts.timeoutMs), params.action);
640
+ }
641
+ async function markBlueBubblesChatRead(chatGuid, opts = {}) {
642
+ await sendBlueBubblesChatEndpointRequest({
643
+ chatGuid,
644
+ opts,
645
+ endpoint: "read",
646
+ method: "POST",
647
+ action: "read"
648
+ });
649
+ }
650
+ async function sendBlueBubblesTyping(chatGuid, typing, opts = {}) {
651
+ await sendBlueBubblesChatEndpointRequest({
652
+ chatGuid,
653
+ opts,
654
+ endpoint: "typing",
655
+ method: typing ? "POST" : "DELETE",
656
+ action: "typing"
657
+ });
658
+ }
659
+ /**
660
+ * Edit a message via BlueBubbles API.
661
+ * Requires macOS 13 (Ventura) or higher with Private API enabled.
662
+ */
663
+ async function editBlueBubblesMessage(messageGuid, newText, opts = {}) {
664
+ const trimmedGuid = messageGuid.trim();
665
+ if (!trimmedGuid) throw new Error("BlueBubbles edit requires messageGuid");
666
+ const trimmedText = newText.trim();
667
+ if (!trimmedText) throw new Error("BlueBubbles edit requires newText");
668
+ await sendPrivateApiJsonRequest({
669
+ opts,
670
+ feature: "edit",
671
+ action: "edit",
672
+ method: "POST",
673
+ path: `/api/v1/message/${encodeURIComponent(trimmedGuid)}/edit`,
674
+ payload: {
675
+ editedMessage: trimmedText,
676
+ backwardsCompatibilityMessage: opts.backwardsCompatMessage ?? `Edited to: ${trimmedText}`,
677
+ partIndex: resolvePartIndex(opts.partIndex)
678
+ }
679
+ });
680
+ }
681
+ /**
682
+ * Unsend (retract) a message via BlueBubbles API.
683
+ * Requires macOS 13 (Ventura) or higher with Private API enabled.
684
+ */
685
+ async function unsendBlueBubblesMessage(messageGuid, opts = {}) {
686
+ const trimmedGuid = messageGuid.trim();
687
+ if (!trimmedGuid) throw new Error("BlueBubbles unsend requires messageGuid");
688
+ await sendPrivateApiJsonRequest({
689
+ opts,
690
+ feature: "unsend",
691
+ action: "unsend",
692
+ method: "POST",
693
+ path: `/api/v1/message/${encodeURIComponent(trimmedGuid)}/unsend`,
694
+ payload: { partIndex: resolvePartIndex(opts.partIndex) }
695
+ });
696
+ }
697
+ /**
698
+ * Rename a group chat via BlueBubbles API.
699
+ */
700
+ async function renameBlueBubblesChat(chatGuid, displayName, opts = {}) {
701
+ const trimmedGuid = chatGuid.trim();
702
+ if (!trimmedGuid) throw new Error("BlueBubbles rename requires chatGuid");
703
+ await sendPrivateApiJsonRequest({
704
+ opts,
705
+ feature: "renameGroup",
706
+ action: "rename",
707
+ method: "PUT",
708
+ path: `/api/v1/chat/${encodeURIComponent(trimmedGuid)}`,
709
+ payload: { displayName }
710
+ });
711
+ }
712
+ /**
713
+ * Add a participant to a group chat via BlueBubbles API.
714
+ */
715
+ async function addBlueBubblesParticipant(chatGuid, address, opts = {}) {
716
+ const trimmedGuid = chatGuid.trim();
717
+ if (!trimmedGuid) throw new Error("BlueBubbles addParticipant requires chatGuid");
718
+ const trimmedAddress = address.trim();
719
+ if (!trimmedAddress) throw new Error("BlueBubbles addParticipant requires address");
720
+ await sendPrivateApiJsonRequest({
721
+ opts,
722
+ feature: "addParticipant",
723
+ action: "addParticipant",
724
+ method: "POST",
725
+ path: `/api/v1/chat/${encodeURIComponent(trimmedGuid)}/participant`,
726
+ payload: { address: trimmedAddress }
727
+ });
728
+ }
729
+ /**
730
+ * Remove a participant from a group chat via BlueBubbles API.
731
+ */
732
+ async function removeBlueBubblesParticipant(chatGuid, address, opts = {}) {
733
+ const trimmedGuid = chatGuid.trim();
734
+ if (!trimmedGuid) throw new Error("BlueBubbles removeParticipant requires chatGuid");
735
+ const trimmedAddress = address.trim();
736
+ if (!trimmedAddress) throw new Error("BlueBubbles removeParticipant requires address");
737
+ await sendPrivateApiJsonRequest({
738
+ opts,
739
+ feature: "removeParticipant",
740
+ action: "removeParticipant",
741
+ method: "DELETE",
742
+ path: `/api/v1/chat/${encodeURIComponent(trimmedGuid)}/participant`,
743
+ payload: { address: trimmedAddress }
744
+ });
745
+ }
746
+ /**
747
+ * Leave a group chat via BlueBubbles API.
748
+ */
749
+ async function leaveBlueBubblesChat(chatGuid, opts = {}) {
750
+ const trimmedGuid = chatGuid.trim();
751
+ if (!trimmedGuid) throw new Error("BlueBubbles leaveChat requires chatGuid");
752
+ await sendPrivateApiJsonRequest({
753
+ opts,
754
+ feature: "leaveGroup",
755
+ action: "leaveChat",
756
+ method: "POST",
757
+ path: `/api/v1/chat/${encodeURIComponent(trimmedGuid)}/leave`
758
+ });
759
+ }
760
+ /**
761
+ * Set a group chat's icon/photo via BlueBubbles API.
762
+ * Requires Private API to be enabled.
763
+ */
764
+ async function setGroupIconBlueBubbles(chatGuid, buffer, filename, opts = {}) {
765
+ const trimmedGuid = chatGuid.trim();
766
+ if (!trimmedGuid) throw new Error("BlueBubbles setGroupIcon requires chatGuid");
767
+ if (!buffer || buffer.length === 0) throw new Error("BlueBubbles setGroupIcon requires image buffer");
768
+ const { baseUrl, password, accountId } = resolveAccount$2(opts);
769
+ assertPrivateApiEnabled(accountId, "setGroupIcon");
770
+ const url = buildBlueBubblesApiUrl({
771
+ baseUrl,
772
+ path: `/api/v1/chat/${encodeURIComponent(trimmedGuid)}/icon`,
773
+ password
774
+ });
775
+ const boundary = `----BlueBubblesFormBoundary${crypto.randomUUID().replace(/-/g, "")}`;
776
+ const parts = [];
777
+ const encoder = new TextEncoder();
778
+ const safeFilename = path.basename(filename).replace(/[\r\n"\\]/g, "_") || "icon.png";
779
+ parts.push(encoder.encode(`--${boundary}\r\n`));
780
+ parts.push(encoder.encode(`Content-Disposition: form-data; name="icon"; filename="${safeFilename}"\r\n`));
781
+ parts.push(encoder.encode(`Content-Type: ${opts.contentType ?? "application/octet-stream"}\r\n\r\n`));
782
+ parts.push(buffer);
783
+ parts.push(encoder.encode("\r\n"));
784
+ parts.push(encoder.encode(`--${boundary}--\r\n`));
785
+ await assertMultipartActionOk(await postMultipartFormData({
786
+ url,
787
+ boundary,
788
+ parts,
789
+ timeoutMs: opts.timeoutMs ?? 6e4
790
+ }), "setGroupIcon");
791
+ }
792
+ //#endregion
793
+ //#region extensions/bluebubbles/src/monitor-debounce.ts
794
+ /**
795
+ * Default debounce window for inbound message coalescing (ms).
796
+ * This helps combine URL text + link preview balloon messages that BlueBubbles
797
+ * sends as separate webhook events when no explicit inbound debounce config exists.
798
+ */
799
+ const DEFAULT_INBOUND_DEBOUNCE_MS = 500;
800
+ /**
801
+ * Combines multiple debounced messages into a single message for processing.
802
+ * Used when multiple webhook events arrive within the debounce window.
803
+ */
804
+ function combineDebounceEntries(entries) {
805
+ if (entries.length === 0) throw new Error("Cannot combine empty entries");
806
+ if (entries.length === 1) return entries[0].message;
807
+ const first = entries[0].message;
808
+ const seenTexts = /* @__PURE__ */ new Set();
809
+ const textParts = [];
810
+ for (const entry of entries) {
811
+ const text = entry.message.text.trim();
812
+ if (!text) continue;
813
+ const normalizedText = text.toLowerCase();
814
+ if (seenTexts.has(normalizedText)) continue;
815
+ seenTexts.add(normalizedText);
816
+ textParts.push(text);
817
+ }
818
+ const allAttachments = entries.flatMap((e) => e.message.attachments ?? []);
819
+ const timestamps = entries.map((e) => e.message.timestamp).filter((t) => typeof t === "number");
820
+ const latestTimestamp = timestamps.length > 0 ? Math.max(...timestamps) : first.timestamp;
821
+ const messageIds = entries.map((e) => e.message.messageId).filter((id) => Boolean(id));
822
+ const entryWithReply = entries.find((e) => e.message.replyToId);
823
+ return {
824
+ ...first,
825
+ text: textParts.join(" "),
826
+ attachments: allAttachments.length > 0 ? allAttachments : first.attachments,
827
+ timestamp: latestTimestamp,
828
+ messageId: messageIds[0] ?? first.messageId,
829
+ replyToId: entryWithReply?.message.replyToId ?? first.replyToId,
830
+ replyToBody: entryWithReply?.message.replyToBody ?? first.replyToBody,
831
+ replyToSender: entryWithReply?.message.replyToSender ?? first.replyToSender,
832
+ balloonBundleId: void 0
833
+ };
834
+ }
835
+ function resolveBlueBubblesDebounceMs(config, core) {
836
+ const inbound = config.messages?.inbound;
837
+ if (!(typeof inbound?.debounceMs === "number" || typeof inbound?.byChannel?.bluebubbles === "number")) return DEFAULT_INBOUND_DEBOUNCE_MS;
838
+ return core.channel.debounce.resolveInboundDebounceMs({
839
+ cfg: config,
840
+ channel: "bluebubbles"
841
+ });
842
+ }
843
+ function createBlueBubblesDebounceRegistry(params) {
844
+ const targetDebouncers = /* @__PURE__ */ new Map();
845
+ return {
846
+ getOrCreateDebouncer: (target) => {
847
+ const existing = targetDebouncers.get(target);
848
+ if (existing) return existing;
849
+ const { account, config, runtime, core } = target;
850
+ const debouncer = core.channel.debounce.createInboundDebouncer({
851
+ debounceMs: resolveBlueBubblesDebounceMs(config, core),
852
+ buildKey: (entry) => {
853
+ const msg = entry.message;
854
+ const balloonBundleId = msg.balloonBundleId?.trim();
855
+ const associatedMessageGuid = msg.associatedMessageGuid?.trim();
856
+ if (balloonBundleId && associatedMessageGuid) return `bluebubbles:${account.accountId}:balloon:${associatedMessageGuid}`;
857
+ const messageId = msg.messageId?.trim();
858
+ if (messageId) return `bluebubbles:${account.accountId}:msg:${messageId}`;
859
+ const chatKey = msg.chatGuid?.trim() ?? msg.chatIdentifier?.trim() ?? (msg.chatId ? String(msg.chatId) : "dm");
860
+ return `bluebubbles:${account.accountId}:${chatKey}:${msg.senderId}`;
861
+ },
862
+ shouldDebounce: (entry) => {
863
+ const msg = entry.message;
864
+ if (msg.fromMe) return false;
865
+ if (core.channel.text.hasControlCommand(msg.text, config)) return false;
866
+ return true;
867
+ },
868
+ onFlush: async (entries) => {
869
+ if (entries.length === 0) return;
870
+ const flushTarget = entries[0].target;
871
+ if (entries.length === 1) {
872
+ await params.processMessage(entries[0].message, flushTarget);
873
+ return;
874
+ }
875
+ const combined = combineDebounceEntries(entries);
876
+ if (core.logging.shouldLogVerbose()) {
877
+ const count = entries.length;
878
+ const preview = combined.text.slice(0, 50);
879
+ runtime.log?.(`[bluebubbles] coalesced ${count} messages: "${preview}${combined.text.length > 50 ? "..." : ""}"`);
880
+ }
881
+ await params.processMessage(combined, flushTarget);
882
+ },
883
+ onError: (err) => {
884
+ runtime.error?.(`[${account.accountId}] [bluebubbles] debounce flush failed: ${String(err)}`);
885
+ }
886
+ });
887
+ targetDebouncers.set(target, debouncer);
888
+ return debouncer;
889
+ },
890
+ removeDebouncer: (target) => {
891
+ targetDebouncers.delete(target);
892
+ }
893
+ };
894
+ }
895
+ //#endregion
896
+ //#region extensions/bluebubbles/src/monitor-normalize.ts
897
+ function asRecord$1(value) {
898
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
899
+ }
900
+ function readString(record, key) {
901
+ if (!record) return;
902
+ const value = record[key];
903
+ return typeof value === "string" ? value : void 0;
904
+ }
905
+ function readNumber(record, key) {
906
+ if (!record) return;
907
+ const value = record[key];
908
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
909
+ }
910
+ function readBoolean(record, key) {
911
+ if (!record) return;
912
+ const value = record[key];
913
+ return typeof value === "boolean" ? value : void 0;
914
+ }
915
+ function readNumberLike(record, key) {
916
+ if (!record) return;
917
+ return parseFiniteNumber(record[key]);
918
+ }
919
+ function extractAttachments(message) {
920
+ const raw = message["attachments"];
921
+ if (!Array.isArray(raw)) return [];
922
+ const out = [];
923
+ for (const entry of raw) {
924
+ const record = asRecord$1(entry);
925
+ if (!record) continue;
926
+ out.push({
927
+ guid: readString(record, "guid"),
928
+ uti: readString(record, "uti"),
929
+ mimeType: readString(record, "mimeType") ?? readString(record, "mime_type"),
930
+ transferName: readString(record, "transferName") ?? readString(record, "transfer_name"),
931
+ totalBytes: readNumberLike(record, "totalBytes") ?? readNumberLike(record, "total_bytes"),
932
+ height: readNumberLike(record, "height"),
933
+ width: readNumberLike(record, "width"),
934
+ originalROWID: readNumberLike(record, "originalROWID") ?? readNumberLike(record, "rowid")
935
+ });
936
+ }
937
+ return out;
938
+ }
939
+ function buildAttachmentPlaceholder(attachments) {
940
+ if (attachments.length === 0) return "";
941
+ const mimeTypes = attachments.map((entry) => entry.mimeType ?? "");
942
+ const allImages = mimeTypes.every((entry) => entry.startsWith("image/"));
943
+ const allVideos = mimeTypes.every((entry) => entry.startsWith("video/"));
944
+ const allAudio = mimeTypes.every((entry) => entry.startsWith("audio/"));
945
+ const tag = allImages ? "<media:image>" : allVideos ? "<media:video>" : allAudio ? "<media:audio>" : "<media:attachment>";
946
+ const label = allImages ? "image" : allVideos ? "video" : allAudio ? "audio" : "file";
947
+ const suffix = attachments.length === 1 ? label : `${label}s`;
948
+ return `${tag} (${attachments.length} ${suffix})`;
949
+ }
950
+ function buildMessagePlaceholder(message) {
951
+ const attachmentPlaceholder = buildAttachmentPlaceholder(message.attachments ?? []);
952
+ if (attachmentPlaceholder) return attachmentPlaceholder;
953
+ if (message.balloonBundleId) return "<media:sticker>";
954
+ return "";
955
+ }
956
+ function formatReplyTag(message) {
957
+ const rawId = message.replyToShortId || message.replyToId;
958
+ if (!rawId) return null;
959
+ return `[[reply_to:${rawId}]]`;
960
+ }
961
+ function extractReplyMetadata(message) {
962
+ const replyRecord = asRecord$1(message["replyTo"] ?? message["reply_to"] ?? message["replyToMessage"] ?? message["reply_to_message"] ?? message["repliedMessage"] ?? message["quotedMessage"] ?? message["associatedMessage"] ?? message["reply"]);
963
+ const replyHandle = asRecord$1(replyRecord?.["handle"]) ?? asRecord$1(replyRecord?.["sender"]) ?? null;
964
+ const replySenderRaw = readString(replyHandle, "address") ?? readString(replyHandle, "handle") ?? readString(replyHandle, "id") ?? readString(replyRecord, "senderId") ?? readString(replyRecord, "sender") ?? readString(replyRecord, "from");
965
+ const normalizedSender = replySenderRaw ? normalizeBlueBubblesHandle(replySenderRaw) || replySenderRaw.trim() : void 0;
966
+ const replyToBody = readString(replyRecord, "text") ?? readString(replyRecord, "body") ?? readString(replyRecord, "message") ?? readString(replyRecord, "subject") ?? void 0;
967
+ const directReplyId = readString(message, "replyToMessageGuid") ?? readString(message, "replyToGuid") ?? readString(message, "replyGuid") ?? readString(message, "selectedMessageGuid") ?? readString(message, "selectedMessageId") ?? readString(message, "replyToMessageId") ?? readString(message, "replyId") ?? readString(replyRecord, "guid") ?? readString(replyRecord, "id") ?? readString(replyRecord, "messageId");
968
+ const associatedType = readNumberLike(message, "associatedMessageType") ?? readNumberLike(message, "associated_message_type");
969
+ const associatedGuid = readString(message, "associatedMessageGuid") ?? readString(message, "associated_message_guid") ?? readString(message, "associatedMessageId");
970
+ const isReactionAssociation = typeof associatedType === "number" && REACTION_TYPE_MAP.has(associatedType);
971
+ const replyToId = directReplyId ?? (!isReactionAssociation ? associatedGuid : void 0);
972
+ const threadOriginatorGuid = readString(message, "threadOriginatorGuid");
973
+ const messageGuid = readString(message, "guid");
974
+ return {
975
+ replyToId: (replyToId ?? (!replyToId && threadOriginatorGuid && threadOriginatorGuid !== messageGuid ? threadOriginatorGuid : void 0))?.trim() || void 0,
976
+ replyToBody: replyToBody?.trim() || void 0,
977
+ replyToSender: normalizedSender || void 0
978
+ };
979
+ }
980
+ function readFirstChatRecord(message) {
981
+ const chats = message["chats"];
982
+ if (!Array.isArray(chats) || chats.length === 0) return null;
983
+ const first = chats[0];
984
+ return asRecord$1(first);
985
+ }
986
+ function extractSenderInfo(message) {
987
+ const handleValue = message.handle ?? message.sender;
988
+ const handle = asRecord$1(handleValue) ?? (typeof handleValue === "string" ? { address: handleValue } : null);
989
+ const senderId = (readString(handle, "address") ?? readString(handle, "handle") ?? readString(handle, "id") ?? readString(message, "senderId") ?? readString(message, "sender") ?? readString(message, "from") ?? "").trim();
990
+ const senderName = readString(handle, "displayName") ?? readString(handle, "name") ?? readString(message, "senderName") ?? void 0;
991
+ return {
992
+ senderId,
993
+ senderIdExplicit: Boolean(senderId),
994
+ senderName
995
+ };
996
+ }
997
+ function extractChatContext(message) {
998
+ const chat = asRecord$1(message.chat) ?? asRecord$1(message.conversation) ?? null;
999
+ const chatFromList = readFirstChatRecord(message);
1000
+ const chatGuid = readString(message, "chatGuid") ?? readString(message, "chat_guid") ?? readString(chat, "chatGuid") ?? readString(chat, "chat_guid") ?? readString(chat, "guid") ?? readString(chatFromList, "chatGuid") ?? readString(chatFromList, "chat_guid") ?? readString(chatFromList, "guid");
1001
+ const chatIdentifier = readString(message, "chatIdentifier") ?? readString(message, "chat_identifier") ?? readString(chat, "chatIdentifier") ?? readString(chat, "chat_identifier") ?? readString(chat, "identifier") ?? readString(chatFromList, "chatIdentifier") ?? readString(chatFromList, "chat_identifier") ?? readString(chatFromList, "identifier") ?? extractChatIdentifierFromChatGuid(chatGuid);
1002
+ const chatId = readNumberLike(message, "chatId") ?? readNumberLike(message, "chat_id") ?? readNumberLike(chat, "chatId") ?? readNumberLike(chat, "chat_id") ?? readNumberLike(chat, "id") ?? readNumberLike(chatFromList, "chatId") ?? readNumberLike(chatFromList, "chat_id") ?? readNumberLike(chatFromList, "id");
1003
+ const chatName = readString(message, "chatName") ?? readString(chat, "displayName") ?? readString(chat, "name") ?? readString(chatFromList, "displayName") ?? readString(chatFromList, "name") ?? void 0;
1004
+ const chatParticipants = chat ? chat["participants"] : void 0;
1005
+ const messageParticipants = message["participants"];
1006
+ const chatsParticipants = chatFromList ? chatFromList["participants"] : void 0;
1007
+ const participants = Array.isArray(chatParticipants) ? chatParticipants : Array.isArray(messageParticipants) ? messageParticipants : Array.isArray(chatsParticipants) ? chatsParticipants : [];
1008
+ const participantsCount = participants.length;
1009
+ const groupFromChatGuid = resolveGroupFlagFromChatGuid(chatGuid);
1010
+ const explicitIsGroup = readBoolean(message, "isGroup") ?? readBoolean(message, "is_group") ?? readBoolean(chat, "isGroup") ?? readBoolean(message, "group");
1011
+ return {
1012
+ chatGuid,
1013
+ chatIdentifier,
1014
+ chatId,
1015
+ chatName,
1016
+ isGroup: typeof groupFromChatGuid === "boolean" ? groupFromChatGuid : explicitIsGroup ?? participantsCount > 2,
1017
+ participants
1018
+ };
1019
+ }
1020
+ function normalizeParticipantEntry(entry) {
1021
+ if (typeof entry === "string" || typeof entry === "number") {
1022
+ const raw = String(entry).trim();
1023
+ if (!raw) return null;
1024
+ const normalized = normalizeBlueBubblesHandle(raw) || raw;
1025
+ return normalized ? { id: normalized } : null;
1026
+ }
1027
+ const record = asRecord$1(entry);
1028
+ if (!record) return null;
1029
+ const nestedHandle = asRecord$1(record["handle"]) ?? asRecord$1(record["sender"]) ?? asRecord$1(record["contact"]) ?? null;
1030
+ const idRaw = readString(record, "address") ?? readString(record, "handle") ?? readString(record, "id") ?? readString(record, "phoneNumber") ?? readString(record, "phone_number") ?? readString(record, "email") ?? readString(nestedHandle, "address") ?? readString(nestedHandle, "handle") ?? readString(nestedHandle, "id");
1031
+ const nameRaw = readString(record, "displayName") ?? readString(record, "name") ?? readString(record, "title") ?? readString(nestedHandle, "displayName") ?? readString(nestedHandle, "name");
1032
+ const normalizedId = idRaw ? normalizeBlueBubblesHandle(idRaw) || idRaw.trim() : "";
1033
+ if (!normalizedId) return null;
1034
+ return {
1035
+ id: normalizedId,
1036
+ name: nameRaw?.trim() || void 0
1037
+ };
1038
+ }
1039
+ function normalizeParticipantList(raw) {
1040
+ if (!Array.isArray(raw) || raw.length === 0) return [];
1041
+ const seen = /* @__PURE__ */ new Set();
1042
+ const output = [];
1043
+ for (const entry of raw) {
1044
+ const normalized = normalizeParticipantEntry(entry);
1045
+ if (!normalized?.id) continue;
1046
+ const key = normalized.id.toLowerCase();
1047
+ if (seen.has(key)) continue;
1048
+ seen.add(key);
1049
+ output.push(normalized);
1050
+ }
1051
+ return output;
1052
+ }
1053
+ function formatGroupMembers(params) {
1054
+ const seen = /* @__PURE__ */ new Set();
1055
+ const ordered = [];
1056
+ for (const entry of params.participants ?? []) {
1057
+ if (!entry?.id) continue;
1058
+ const key = entry.id.toLowerCase();
1059
+ if (seen.has(key)) continue;
1060
+ seen.add(key);
1061
+ ordered.push(entry);
1062
+ }
1063
+ if (ordered.length === 0 && params.fallback?.id) ordered.push(params.fallback);
1064
+ if (ordered.length === 0) return;
1065
+ return ordered.map((entry) => entry.name ? `${entry.name} (${entry.id})` : entry.id).join(", ");
1066
+ }
1067
+ function resolveGroupFlagFromChatGuid(chatGuid) {
1068
+ const guid = chatGuid?.trim();
1069
+ if (!guid) return;
1070
+ const parts = guid.split(";");
1071
+ if (parts.length >= 3) {
1072
+ if (parts[1] === "+") return true;
1073
+ if (parts[1] === "-") return false;
1074
+ }
1075
+ if (guid.includes(";+;")) return true;
1076
+ if (guid.includes(";-;")) return false;
1077
+ }
1078
+ function extractChatIdentifierFromChatGuid(chatGuid) {
1079
+ const guid = chatGuid?.trim();
1080
+ if (!guid) return;
1081
+ const parts = guid.split(";");
1082
+ if (parts.length < 3) return;
1083
+ return parts[2]?.trim() || void 0;
1084
+ }
1085
+ function formatGroupAllowlistEntry(params) {
1086
+ const guid = params.chatGuid?.trim();
1087
+ if (guid) return `chat_guid:${guid}`;
1088
+ const chatId = params.chatId;
1089
+ if (typeof chatId === "number" && Number.isFinite(chatId)) return `chat_id:${chatId}`;
1090
+ const identifier = params.chatIdentifier?.trim();
1091
+ if (identifier) return `chat_identifier:${identifier}`;
1092
+ return null;
1093
+ }
1094
+ const REACTION_TYPE_MAP = new Map([
1095
+ [2e3, {
1096
+ emoji: "❤️",
1097
+ action: "added"
1098
+ }],
1099
+ [2001, {
1100
+ emoji: "👍",
1101
+ action: "added"
1102
+ }],
1103
+ [2002, {
1104
+ emoji: "👎",
1105
+ action: "added"
1106
+ }],
1107
+ [2003, {
1108
+ emoji: "😂",
1109
+ action: "added"
1110
+ }],
1111
+ [2004, {
1112
+ emoji: "‼️",
1113
+ action: "added"
1114
+ }],
1115
+ [2005, {
1116
+ emoji: "❓",
1117
+ action: "added"
1118
+ }],
1119
+ [3e3, {
1120
+ emoji: "❤️",
1121
+ action: "removed"
1122
+ }],
1123
+ [3001, {
1124
+ emoji: "👍",
1125
+ action: "removed"
1126
+ }],
1127
+ [3002, {
1128
+ emoji: "👎",
1129
+ action: "removed"
1130
+ }],
1131
+ [3003, {
1132
+ emoji: "😂",
1133
+ action: "removed"
1134
+ }],
1135
+ [3004, {
1136
+ emoji: "‼️",
1137
+ action: "removed"
1138
+ }],
1139
+ [3005, {
1140
+ emoji: "❓",
1141
+ action: "removed"
1142
+ }]
1143
+ ]);
1144
+ const TAPBACK_TEXT_MAP = new Map([
1145
+ ["loved", {
1146
+ emoji: "❤️",
1147
+ action: "added"
1148
+ }],
1149
+ ["liked", {
1150
+ emoji: "👍",
1151
+ action: "added"
1152
+ }],
1153
+ ["disliked", {
1154
+ emoji: "👎",
1155
+ action: "added"
1156
+ }],
1157
+ ["laughed at", {
1158
+ emoji: "😂",
1159
+ action: "added"
1160
+ }],
1161
+ ["emphasized", {
1162
+ emoji: "‼️",
1163
+ action: "added"
1164
+ }],
1165
+ ["questioned", {
1166
+ emoji: "❓",
1167
+ action: "added"
1168
+ }],
1169
+ ["removed a heart from", {
1170
+ emoji: "❤️",
1171
+ action: "removed"
1172
+ }],
1173
+ ["removed a like from", {
1174
+ emoji: "👍",
1175
+ action: "removed"
1176
+ }],
1177
+ ["removed a dislike from", {
1178
+ emoji: "👎",
1179
+ action: "removed"
1180
+ }],
1181
+ ["removed a laugh from", {
1182
+ emoji: "😂",
1183
+ action: "removed"
1184
+ }],
1185
+ ["removed an emphasis from", {
1186
+ emoji: "‼️",
1187
+ action: "removed"
1188
+ }],
1189
+ ["removed a question from", {
1190
+ emoji: "❓",
1191
+ action: "removed"
1192
+ }]
1193
+ ]);
1194
+ const TAPBACK_EMOJI_REGEX = /(?:\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;
1195
+ function extractFirstEmoji(text) {
1196
+ const match = text.match(TAPBACK_EMOJI_REGEX);
1197
+ return match ? match[0] : null;
1198
+ }
1199
+ function extractQuotedTapbackText(text) {
1200
+ const match = text.match(/[“"]([^”"]+)[”"]/s);
1201
+ return match ? match[1] : null;
1202
+ }
1203
+ function isTapbackAssociatedType(type) {
1204
+ return typeof type === "number" && Number.isFinite(type) && type >= 2e3 && type < 4e3;
1205
+ }
1206
+ function resolveTapbackActionHint(type) {
1207
+ if (typeof type !== "number" || !Number.isFinite(type)) return;
1208
+ if (type >= 3e3 && type < 4e3) return "removed";
1209
+ if (type >= 2e3 && type < 3e3) return "added";
1210
+ }
1211
+ function resolveTapbackContext(message) {
1212
+ const associatedType = message.associatedMessageType;
1213
+ const hasTapbackType = isTapbackAssociatedType(associatedType);
1214
+ const hasTapbackMarker = Boolean(message.associatedMessageEmoji) || Boolean(message.isTapback);
1215
+ if (!hasTapbackType && !hasTapbackMarker) return null;
1216
+ const replyToId = message.associatedMessageGuid?.trim() || message.replyToId?.trim() || void 0;
1217
+ const actionHint = resolveTapbackActionHint(associatedType);
1218
+ return {
1219
+ emojiHint: message.associatedMessageEmoji?.trim() || REACTION_TYPE_MAP.get(associatedType ?? -1)?.emoji,
1220
+ actionHint,
1221
+ replyToId
1222
+ };
1223
+ }
1224
+ function parseTapbackText(params) {
1225
+ const trimmed = params.text.trim();
1226
+ const lower = trimmed.toLowerCase();
1227
+ if (!trimmed) return null;
1228
+ const parseLeadingReactionAction = (prefix, defaultAction) => {
1229
+ if (!lower.startsWith(prefix)) return null;
1230
+ const emoji = extractFirstEmoji(trimmed) ?? params.emojiHint;
1231
+ if (!emoji) return null;
1232
+ const quotedText = extractQuotedTapbackText(trimmed);
1233
+ if (params.requireQuoted && !quotedText) return null;
1234
+ const fallback = trimmed.slice(prefix.length).trim();
1235
+ return {
1236
+ emoji,
1237
+ action: params.actionHint ?? defaultAction,
1238
+ quotedText: quotedText ?? fallback
1239
+ };
1240
+ };
1241
+ for (const [pattern, { emoji, action }] of TAPBACK_TEXT_MAP) if (lower.startsWith(pattern)) {
1242
+ const afterPattern = trimmed.slice(pattern.length).trim();
1243
+ if (params.requireQuoted) {
1244
+ const strictMatch = afterPattern.match(/^[“"](.+)[”"]$/s);
1245
+ if (!strictMatch) return null;
1246
+ return {
1247
+ emoji,
1248
+ action,
1249
+ quotedText: strictMatch[1]
1250
+ };
1251
+ }
1252
+ return {
1253
+ emoji,
1254
+ action,
1255
+ quotedText: extractQuotedTapbackText(afterPattern) ?? extractQuotedTapbackText(trimmed) ?? afterPattern
1256
+ };
1257
+ }
1258
+ const reacted = parseLeadingReactionAction("reacted", "added");
1259
+ if (reacted) return reacted;
1260
+ const removed = parseLeadingReactionAction("removed", "removed");
1261
+ if (removed) return removed;
1262
+ return null;
1263
+ }
1264
+ function extractMessagePayload(payload) {
1265
+ const parseRecord = (value) => {
1266
+ const record = asRecord$1(value);
1267
+ if (record) return record;
1268
+ if (Array.isArray(value)) {
1269
+ for (const entry of value) {
1270
+ const parsedEntry = parseRecord(entry);
1271
+ if (parsedEntry) return parsedEntry;
1272
+ }
1273
+ return null;
1274
+ }
1275
+ if (typeof value !== "string") return null;
1276
+ const trimmed = value.trim();
1277
+ if (!trimmed) return null;
1278
+ try {
1279
+ return parseRecord(JSON.parse(trimmed));
1280
+ } catch {
1281
+ return null;
1282
+ }
1283
+ };
1284
+ const data = parseRecord(payload.data ?? payload.payload ?? payload.event);
1285
+ const message = parseRecord(payload.message ?? data?.message ?? data);
1286
+ if (message) return message;
1287
+ return null;
1288
+ }
1289
+ function normalizeWebhookMessage(payload) {
1290
+ const message = extractMessagePayload(payload);
1291
+ if (!message) return null;
1292
+ const text = readString(message, "text") ?? readString(message, "body") ?? readString(message, "subject") ?? "";
1293
+ const { senderId, senderIdExplicit, senderName } = extractSenderInfo(message);
1294
+ const { chatGuid, chatIdentifier, chatId, chatName, isGroup, participants } = extractChatContext(message);
1295
+ const normalizedParticipants = normalizeParticipantList(participants);
1296
+ const fromMe = readBoolean(message, "isFromMe") ?? readBoolean(message, "is_from_me");
1297
+ const messageId = readString(message, "guid") ?? readString(message, "id") ?? readString(message, "messageId") ?? void 0;
1298
+ const balloonBundleId = readString(message, "balloonBundleId");
1299
+ const associatedMessageGuid = readString(message, "associatedMessageGuid") ?? readString(message, "associated_message_guid") ?? readString(message, "associatedMessageId") ?? void 0;
1300
+ const associatedMessageType = readNumberLike(message, "associatedMessageType") ?? readNumberLike(message, "associated_message_type");
1301
+ const associatedMessageEmoji = readString(message, "associatedMessageEmoji") ?? readString(message, "associated_message_emoji") ?? readString(message, "reactionEmoji") ?? readString(message, "reaction_emoji") ?? void 0;
1302
+ const isTapback = readBoolean(message, "isTapback") ?? readBoolean(message, "is_tapback") ?? readBoolean(message, "tapback") ?? void 0;
1303
+ const timestampRaw = readNumber(message, "date") ?? readNumber(message, "dateCreated") ?? readNumber(message, "timestamp");
1304
+ const timestamp = typeof timestampRaw === "number" ? timestampRaw > 0xe8d4a51000 ? timestampRaw : timestampRaw * 1e3 : void 0;
1305
+ const senderFallbackFromChatGuid = !senderIdExplicit && !isGroup && chatGuid ? extractHandleFromChatGuid(chatGuid) : null;
1306
+ const normalizedSender = normalizeBlueBubblesHandle(senderId || senderFallbackFromChatGuid || "");
1307
+ if (!normalizedSender) return null;
1308
+ const replyMetadata = extractReplyMetadata(message);
1309
+ return {
1310
+ text,
1311
+ senderId: normalizedSender,
1312
+ senderIdExplicit,
1313
+ senderName,
1314
+ messageId,
1315
+ timestamp,
1316
+ isGroup,
1317
+ chatId,
1318
+ chatGuid,
1319
+ chatIdentifier,
1320
+ chatName,
1321
+ fromMe,
1322
+ attachments: extractAttachments(message),
1323
+ balloonBundleId,
1324
+ associatedMessageGuid,
1325
+ associatedMessageType,
1326
+ associatedMessageEmoji,
1327
+ isTapback,
1328
+ participants: normalizedParticipants,
1329
+ replyToId: replyMetadata.replyToId,
1330
+ replyToBody: replyMetadata.replyToBody,
1331
+ replyToSender: replyMetadata.replyToSender
1332
+ };
1333
+ }
1334
+ function normalizeWebhookReaction(payload) {
1335
+ const message = extractMessagePayload(payload);
1336
+ if (!message) return null;
1337
+ const associatedGuid = readString(message, "associatedMessageGuid") ?? readString(message, "associated_message_guid") ?? readString(message, "associatedMessageId");
1338
+ const associatedType = readNumberLike(message, "associatedMessageType") ?? readNumberLike(message, "associated_message_type");
1339
+ if (!associatedGuid || associatedType === void 0) return null;
1340
+ const mapping = REACTION_TYPE_MAP.get(associatedType);
1341
+ const emoji = ((readString(message, "associatedMessageEmoji") ?? readString(message, "associated_message_emoji") ?? readString(message, "reactionEmoji") ?? readString(message, "reaction_emoji"))?.trim() || mapping?.emoji) ?? `reaction:${associatedType}`;
1342
+ const action = mapping?.action ?? resolveTapbackActionHint(associatedType) ?? "added";
1343
+ const { senderId, senderIdExplicit, senderName } = extractSenderInfo(message);
1344
+ const { chatGuid, chatIdentifier, chatId, chatName, isGroup } = extractChatContext(message);
1345
+ const fromMe = readBoolean(message, "isFromMe") ?? readBoolean(message, "is_from_me");
1346
+ const timestampRaw = readNumberLike(message, "date") ?? readNumberLike(message, "dateCreated") ?? readNumberLike(message, "timestamp");
1347
+ const timestamp = typeof timestampRaw === "number" ? timestampRaw > 0xe8d4a51000 ? timestampRaw : timestampRaw * 1e3 : void 0;
1348
+ const senderFallbackFromChatGuid = !senderIdExplicit && !isGroup && chatGuid ? extractHandleFromChatGuid(chatGuid) : null;
1349
+ const normalizedSender = normalizeBlueBubblesHandle(senderId || senderFallbackFromChatGuid || "");
1350
+ if (!normalizedSender) return null;
1351
+ return {
1352
+ action,
1353
+ emoji,
1354
+ senderId: normalizedSender,
1355
+ senderIdExplicit,
1356
+ senderName,
1357
+ messageId: associatedGuid,
1358
+ timestamp,
1359
+ isGroup,
1360
+ chatId,
1361
+ chatGuid,
1362
+ chatIdentifier,
1363
+ chatName,
1364
+ fromMe
1365
+ };
1366
+ }
1367
+ //#endregion
1368
+ //#region extensions/bluebubbles/src/history.ts
1369
+ function resolveAccount$1(params) {
1370
+ return resolveBlueBubblesServerAccount(params);
1371
+ }
1372
+ const MAX_HISTORY_FETCH_LIMIT = 100;
1373
+ const HISTORY_SCAN_MULTIPLIER = 8;
1374
+ const MAX_HISTORY_SCAN_MESSAGES = 500;
1375
+ const MAX_HISTORY_BODY_CHARS = 2e3;
1376
+ function clampHistoryLimit(limit) {
1377
+ if (!Number.isFinite(limit)) return 0;
1378
+ const normalized = Math.floor(limit);
1379
+ if (normalized <= 0) return 0;
1380
+ return Math.min(normalized, MAX_HISTORY_FETCH_LIMIT);
1381
+ }
1382
+ function truncateHistoryBody$1(text) {
1383
+ if (text.length <= MAX_HISTORY_BODY_CHARS) return text;
1384
+ return `${text.slice(0, MAX_HISTORY_BODY_CHARS).trimEnd()}...`;
1385
+ }
1386
+ /**
1387
+ * Fetch message history from BlueBubbles API for a specific chat.
1388
+ * This provides the initial backfill for both group chats and DMs.
1389
+ */
1390
+ async function fetchBlueBubblesHistory(chatIdentifier, limit, opts = {}) {
1391
+ const effectiveLimit = clampHistoryLimit(limit);
1392
+ if (!chatIdentifier.trim() || effectiveLimit <= 0) return {
1393
+ entries: [],
1394
+ resolved: true
1395
+ };
1396
+ let baseUrl;
1397
+ let password;
1398
+ try {
1399
+ ({baseUrl, password} = resolveAccount$1(opts));
1400
+ } catch {
1401
+ return {
1402
+ entries: [],
1403
+ resolved: false
1404
+ };
1405
+ }
1406
+ const possiblePaths = [
1407
+ `/api/v1/chat/${encodeURIComponent(chatIdentifier)}/messages?limit=${effectiveLimit}&sort=DESC`,
1408
+ `/api/v1/messages?chatGuid=${encodeURIComponent(chatIdentifier)}&limit=${effectiveLimit}`,
1409
+ `/api/v1/chat/${encodeURIComponent(chatIdentifier)}/message?limit=${effectiveLimit}`
1410
+ ];
1411
+ for (const path of possiblePaths) try {
1412
+ const res = await blueBubblesFetchWithTimeout(buildBlueBubblesApiUrl({
1413
+ baseUrl,
1414
+ path,
1415
+ password
1416
+ }), { method: "GET" }, opts.timeoutMs ?? 1e4);
1417
+ if (!res.ok) continue;
1418
+ const data = await res.json().catch(() => null);
1419
+ if (!data) continue;
1420
+ let messages = [];
1421
+ if (Array.isArray(data)) messages = data;
1422
+ else if (data.data && Array.isArray(data.data)) messages = data.data;
1423
+ else if (data.messages && Array.isArray(data.messages)) messages = data.messages;
1424
+ else continue;
1425
+ const historyEntries = [];
1426
+ const maxScannedMessages = Math.min(Math.max(effectiveLimit * HISTORY_SCAN_MULTIPLIER, effectiveLimit), MAX_HISTORY_SCAN_MESSAGES);
1427
+ for (let i = 0; i < messages.length && i < maxScannedMessages; i++) {
1428
+ const msg = messages[i];
1429
+ const text = msg.text?.trim();
1430
+ if (!text) continue;
1431
+ const sender = msg.is_from_me ? "me" : msg.sender?.display_name || msg.sender?.address || msg.handle_id || "Unknown";
1432
+ const timestamp = msg.date_created || msg.date_delivered;
1433
+ historyEntries.push({
1434
+ sender,
1435
+ body: truncateHistoryBody$1(text),
1436
+ timestamp,
1437
+ messageId: msg.guid
1438
+ });
1439
+ }
1440
+ historyEntries.sort((a, b) => {
1441
+ return (a.timestamp || 0) - (b.timestamp || 0);
1442
+ });
1443
+ return {
1444
+ entries: historyEntries.slice(0, effectiveLimit),
1445
+ resolved: true
1446
+ };
1447
+ } catch (error) {
1448
+ continue;
1449
+ }
1450
+ return {
1451
+ entries: [],
1452
+ resolved: false
1453
+ };
1454
+ }
1455
+ //#endregion
1456
+ //#region extensions/bluebubbles/src/media-send.ts
1457
+ const HTTP_URL_RE = /^https?:\/\//i;
1458
+ const MB = 1024 * 1024;
1459
+ function assertMediaWithinLimit(sizeBytes, maxBytes) {
1460
+ if (typeof maxBytes !== "number" || maxBytes <= 0) return;
1461
+ if (sizeBytes <= maxBytes) return;
1462
+ const maxLabel = (maxBytes / MB).toFixed(0);
1463
+ const sizeLabel = (sizeBytes / MB).toFixed(2);
1464
+ throw new Error(`Media exceeds ${maxLabel}MB limit (got ${sizeLabel}MB)`);
1465
+ }
1466
+ function resolveLocalMediaPath(source) {
1467
+ if (!source.startsWith("file://")) return source;
1468
+ try {
1469
+ return fileURLToPath(source);
1470
+ } catch {
1471
+ throw new Error(`Invalid file:// URL: ${source}`);
1472
+ }
1473
+ }
1474
+ function expandHomePath(input) {
1475
+ if (input === "~") return os.homedir();
1476
+ if (input.startsWith("~/") || input.startsWith(`~${path.sep}`)) return path.join(os.homedir(), input.slice(2));
1477
+ return input;
1478
+ }
1479
+ function resolveConfiguredPath(input) {
1480
+ const trimmed = input.trim();
1481
+ if (!trimmed) throw new Error("Empty mediaLocalRoots entry is not allowed");
1482
+ if (trimmed.startsWith("file://")) {
1483
+ let parsed;
1484
+ try {
1485
+ parsed = fileURLToPath(trimmed);
1486
+ } catch {
1487
+ throw new Error(`Invalid file:// URL in mediaLocalRoots: ${input}`);
1488
+ }
1489
+ if (!path.isAbsolute(parsed)) throw new Error(`mediaLocalRoots entries must be absolute paths: ${input}`);
1490
+ return parsed;
1491
+ }
1492
+ const resolved = expandHomePath(trimmed);
1493
+ if (!path.isAbsolute(resolved)) throw new Error(`mediaLocalRoots entries must be absolute paths: ${input}`);
1494
+ return resolved;
1495
+ }
1496
+ function isPathInsideRoot(candidate, root) {
1497
+ const normalizedCandidate = path.normalize(candidate);
1498
+ const normalizedRoot = path.normalize(root);
1499
+ const rootWithSep = normalizedRoot.endsWith(path.sep) ? normalizedRoot : normalizedRoot + path.sep;
1500
+ if (process.platform === "win32") {
1501
+ const candidateLower = normalizedCandidate.toLowerCase();
1502
+ const rootLower = normalizedRoot.toLowerCase();
1503
+ const rootWithSepLower = rootWithSep.toLowerCase();
1504
+ return candidateLower === rootLower || candidateLower.startsWith(rootWithSepLower);
1505
+ }
1506
+ return normalizedCandidate === normalizedRoot || normalizedCandidate.startsWith(rootWithSep);
1507
+ }
1508
+ function resolveMediaLocalRoots(params) {
1509
+ return (resolveBlueBubblesAccount({
1510
+ cfg: params.cfg,
1511
+ accountId: params.accountId
1512
+ }).config.mediaLocalRoots ?? []).map((entry) => entry.trim()).filter((entry) => entry.length > 0);
1513
+ }
1514
+ async function assertLocalMediaPathAllowed(params) {
1515
+ if (params.localRoots.length === 0) throw new Error(`Local BlueBubbles media paths are disabled by default. Set channels.bluebubbles.mediaLocalRoots${params.accountId ? ` or channels.bluebubbles.accounts.${params.accountId}.mediaLocalRoots` : ""} to explicitly allow local file directories.`);
1516
+ const resolvedLocalPath = path.resolve(params.localPath);
1517
+ const supportsNoFollow = process.platform !== "win32" && "O_NOFOLLOW" in constants;
1518
+ const openFlags = constants.O_RDONLY | (supportsNoFollow ? constants.O_NOFOLLOW : 0);
1519
+ for (const rootEntry of params.localRoots) {
1520
+ const resolvedRootInput = resolveConfiguredPath(rootEntry);
1521
+ const relativeToRoot = path.relative(resolvedRootInput, resolvedLocalPath);
1522
+ if (relativeToRoot.startsWith("..") || path.isAbsolute(relativeToRoot) || relativeToRoot === "") continue;
1523
+ let rootReal;
1524
+ try {
1525
+ rootReal = await fs$1.realpath(resolvedRootInput);
1526
+ } catch {
1527
+ rootReal = path.resolve(resolvedRootInput);
1528
+ }
1529
+ const candidatePath = path.resolve(rootReal, relativeToRoot);
1530
+ if (!isPathInsideRoot(candidatePath, rootReal)) continue;
1531
+ let handle = null;
1532
+ try {
1533
+ handle = await fs$1.open(candidatePath, openFlags);
1534
+ const realPath = await fs$1.realpath(candidatePath);
1535
+ if (!isPathInsideRoot(realPath, rootReal)) continue;
1536
+ const stat = await handle.stat();
1537
+ if (!stat.isFile()) continue;
1538
+ const realStat = await fs$1.stat(realPath);
1539
+ if (stat.ino !== realStat.ino || stat.dev !== realStat.dev) continue;
1540
+ return {
1541
+ data: await handle.readFile(),
1542
+ realPath,
1543
+ sizeBytes: stat.size
1544
+ };
1545
+ } catch {
1546
+ continue;
1547
+ } finally {
1548
+ if (handle) await handle.close().catch(() => {});
1549
+ }
1550
+ }
1551
+ throw new Error(`Local media path is not under any configured mediaLocalRoots entry: ${params.localPath}`);
1552
+ }
1553
+ function resolveFilenameFromSource(source) {
1554
+ if (!source) return;
1555
+ if (source.startsWith("file://")) try {
1556
+ return path.basename(fileURLToPath(source)) || void 0;
1557
+ } catch {
1558
+ return;
1559
+ }
1560
+ if (HTTP_URL_RE.test(source)) try {
1561
+ return path.basename(new URL(source).pathname) || void 0;
1562
+ } catch {
1563
+ return;
1564
+ }
1565
+ return path.basename(source) || void 0;
1566
+ }
1567
+ async function sendBlueBubblesMedia(params) {
1568
+ const { cfg, to, mediaUrl, mediaPath, mediaBuffer, contentType, filename, caption, replyToId, accountId, asVoice } = params;
1569
+ const core = getBlueBubblesRuntime();
1570
+ const maxBytes = resolveChannelMediaMaxBytes({
1571
+ cfg,
1572
+ resolveChannelLimitMb: ({ cfg, accountId }) => cfg.channels?.bluebubbles?.accounts?.[accountId]?.mediaMaxMb ?? cfg.channels?.bluebubbles?.mediaMaxMb,
1573
+ accountId
1574
+ });
1575
+ const mediaLocalRoots = resolveMediaLocalRoots({
1576
+ cfg,
1577
+ accountId
1578
+ });
1579
+ let buffer;
1580
+ let resolvedContentType = contentType ?? void 0;
1581
+ let resolvedFilename = filename ?? void 0;
1582
+ if (mediaBuffer) {
1583
+ assertMediaWithinLimit(mediaBuffer.byteLength, maxBytes);
1584
+ buffer = mediaBuffer;
1585
+ if (!resolvedContentType) {
1586
+ const hint = mediaPath ?? mediaUrl;
1587
+ resolvedContentType = await core.media.detectMime({
1588
+ buffer: Buffer.isBuffer(mediaBuffer) ? mediaBuffer : Buffer.from(mediaBuffer),
1589
+ filePath: hint
1590
+ }) ?? void 0;
1591
+ }
1592
+ if (!resolvedFilename) resolvedFilename = resolveFilenameFromSource(mediaPath ?? mediaUrl);
1593
+ } else {
1594
+ const source = mediaPath ?? mediaUrl;
1595
+ if (!source) throw new Error("BlueBubbles media delivery requires mediaUrl, mediaPath, or mediaBuffer.");
1596
+ if (HTTP_URL_RE.test(source)) {
1597
+ const fetched = await core.channel.media.fetchRemoteMedia({
1598
+ url: source,
1599
+ maxBytes: typeof maxBytes === "number" && maxBytes > 0 ? maxBytes : void 0
1600
+ });
1601
+ buffer = fetched.buffer;
1602
+ resolvedContentType = resolvedContentType ?? fetched.contentType ?? void 0;
1603
+ resolvedFilename = resolvedFilename ?? fetched.fileName;
1604
+ } else {
1605
+ const localFile = await assertLocalMediaPathAllowed({
1606
+ localPath: expandHomePath(resolveLocalMediaPath(source)),
1607
+ localRoots: mediaLocalRoots,
1608
+ accountId
1609
+ });
1610
+ if (typeof maxBytes === "number" && maxBytes > 0) assertMediaWithinLimit(localFile.sizeBytes, maxBytes);
1611
+ const data = localFile.data;
1612
+ assertMediaWithinLimit(data.byteLength, maxBytes);
1613
+ buffer = new Uint8Array(data);
1614
+ if (!resolvedContentType) resolvedContentType = await core.media.detectMime({
1615
+ buffer: data,
1616
+ filePath: localFile.realPath
1617
+ }) ?? void 0;
1618
+ if (!resolvedFilename) resolvedFilename = resolveFilenameFromSource(localFile.realPath);
1619
+ }
1620
+ }
1621
+ const replyToMessageGuid = replyToId?.trim() ? resolveBlueBubblesMessageId(replyToId.trim(), { requireKnownShortId: true }) : void 0;
1622
+ const attachmentResult = await sendBlueBubblesAttachment({
1623
+ to,
1624
+ buffer,
1625
+ filename: resolvedFilename ?? "attachment",
1626
+ contentType: resolvedContentType ?? void 0,
1627
+ replyToMessageGuid,
1628
+ asVoice,
1629
+ opts: {
1630
+ cfg,
1631
+ accountId
1632
+ }
1633
+ });
1634
+ const trimmedCaption = caption?.trim();
1635
+ if (trimmedCaption) await sendMessageBlueBubbles(to, trimmedCaption, {
1636
+ cfg,
1637
+ accountId,
1638
+ replyToMessageGuid
1639
+ });
1640
+ return attachmentResult;
1641
+ }
1642
+ //#endregion
1643
+ //#region extensions/bluebubbles/src/monitor-reply-cache.ts
1644
+ const REPLY_CACHE_MAX = 2e3;
1645
+ const REPLY_CACHE_TTL_MS = 360 * 60 * 1e3;
1646
+ const blueBubblesReplyCacheByMessageId = /* @__PURE__ */ new Map();
1647
+ const blueBubblesShortIdToUuid = /* @__PURE__ */ new Map();
1648
+ const blueBubblesUuidToShortId = /* @__PURE__ */ new Map();
1649
+ let blueBubblesShortIdCounter = 0;
1650
+ function trimOrUndefined$2(value) {
1651
+ const trimmed = value?.trim();
1652
+ return trimmed ? trimmed : void 0;
1653
+ }
1654
+ function generateShortId() {
1655
+ blueBubblesShortIdCounter += 1;
1656
+ return String(blueBubblesShortIdCounter);
1657
+ }
1658
+ function rememberBlueBubblesReplyCache(entry) {
1659
+ const messageId = entry.messageId.trim();
1660
+ if (!messageId) return {
1661
+ ...entry,
1662
+ shortId: ""
1663
+ };
1664
+ let shortId = blueBubblesUuidToShortId.get(messageId);
1665
+ if (!shortId) {
1666
+ shortId = generateShortId();
1667
+ blueBubblesShortIdToUuid.set(shortId, messageId);
1668
+ blueBubblesUuidToShortId.set(messageId, shortId);
1669
+ }
1670
+ const fullEntry = {
1671
+ ...entry,
1672
+ messageId,
1673
+ shortId
1674
+ };
1675
+ blueBubblesReplyCacheByMessageId.delete(messageId);
1676
+ blueBubblesReplyCacheByMessageId.set(messageId, fullEntry);
1677
+ const cutoff = Date.now() - REPLY_CACHE_TTL_MS;
1678
+ for (const [key, value] of blueBubblesReplyCacheByMessageId) {
1679
+ if (value.timestamp < cutoff) {
1680
+ blueBubblesReplyCacheByMessageId.delete(key);
1681
+ if (value.shortId) {
1682
+ blueBubblesShortIdToUuid.delete(value.shortId);
1683
+ blueBubblesUuidToShortId.delete(key);
1684
+ }
1685
+ continue;
1686
+ }
1687
+ break;
1688
+ }
1689
+ while (blueBubblesReplyCacheByMessageId.size > REPLY_CACHE_MAX) {
1690
+ const oldest = blueBubblesReplyCacheByMessageId.keys().next().value;
1691
+ if (!oldest) break;
1692
+ const oldEntry = blueBubblesReplyCacheByMessageId.get(oldest);
1693
+ blueBubblesReplyCacheByMessageId.delete(oldest);
1694
+ if (oldEntry?.shortId) {
1695
+ blueBubblesShortIdToUuid.delete(oldEntry.shortId);
1696
+ blueBubblesUuidToShortId.delete(oldest);
1697
+ }
1698
+ }
1699
+ return fullEntry;
1700
+ }
1701
+ /**
1702
+ * Resolves a short message ID (e.g., "1", "2") to a full BlueBubbles GUID.
1703
+ * Returns the input unchanged if it's already a GUID or not found in the mapping.
1704
+ */
1705
+ function resolveBlueBubblesMessageId(shortOrUuid, opts) {
1706
+ const trimmed = shortOrUuid.trim();
1707
+ if (!trimmed) return trimmed;
1708
+ if (/^\d+$/.test(trimmed)) {
1709
+ const uuid = blueBubblesShortIdToUuid.get(trimmed);
1710
+ if (uuid) return uuid;
1711
+ if (opts?.requireKnownShortId) throw new Error(`BlueBubbles short message id "${trimmed}" is no longer available. Use MessageSidFull.`);
1712
+ }
1713
+ return trimmed;
1714
+ }
1715
+ /**
1716
+ * Gets the short ID for a message GUID, if one exists.
1717
+ */
1718
+ function getShortIdForUuid(uuid) {
1719
+ return blueBubblesUuidToShortId.get(uuid.trim());
1720
+ }
1721
+ function resolveReplyContextFromCache(params) {
1722
+ const replyToId = params.replyToId.trim();
1723
+ if (!replyToId) return null;
1724
+ const cached = blueBubblesReplyCacheByMessageId.get(replyToId);
1725
+ if (!cached) return null;
1726
+ if (cached.accountId !== params.accountId) return null;
1727
+ const cutoff = Date.now() - REPLY_CACHE_TTL_MS;
1728
+ if (cached.timestamp < cutoff) {
1729
+ blueBubblesReplyCacheByMessageId.delete(replyToId);
1730
+ return null;
1731
+ }
1732
+ const chatGuid = trimOrUndefined$2(params.chatGuid);
1733
+ const chatIdentifier = trimOrUndefined$2(params.chatIdentifier);
1734
+ const cachedChatGuid = trimOrUndefined$2(cached.chatGuid);
1735
+ const cachedChatIdentifier = trimOrUndefined$2(cached.chatIdentifier);
1736
+ const chatId = typeof params.chatId === "number" ? params.chatId : void 0;
1737
+ const cachedChatId = typeof cached.chatId === "number" ? cached.chatId : void 0;
1738
+ if (chatGuid && cachedChatGuid && chatGuid !== cachedChatGuid) return null;
1739
+ if (!chatGuid && chatIdentifier && cachedChatIdentifier && chatIdentifier !== cachedChatIdentifier) return null;
1740
+ if (!chatGuid && !chatIdentifier && chatId && cachedChatId && chatId !== cachedChatId) return null;
1741
+ return cached;
1742
+ }
1743
+ //#endregion
1744
+ //#region extensions/bluebubbles/src/monitor-self-chat-cache.ts
1745
+ const SELF_CHAT_TTL_MS = 1e4;
1746
+ const MAX_SELF_CHAT_CACHE_ENTRIES = 512;
1747
+ const CLEANUP_MIN_INTERVAL_MS = 1e3;
1748
+ const MAX_SELF_CHAT_BODY_CHARS = 32768;
1749
+ const cache = /* @__PURE__ */ new Map();
1750
+ let lastCleanupAt = 0;
1751
+ function normalizeBody(body) {
1752
+ if (!body) return null;
1753
+ const normalized = (body.length > MAX_SELF_CHAT_BODY_CHARS ? body.slice(0, MAX_SELF_CHAT_BODY_CHARS) : body).replace(/\r\n?/g, "\n").trim();
1754
+ return normalized ? normalized : null;
1755
+ }
1756
+ function isUsableTimestamp(timestamp) {
1757
+ return typeof timestamp === "number" && Number.isFinite(timestamp);
1758
+ }
1759
+ function digestText(text) {
1760
+ return createHash("sha256").update(text).digest("base64url");
1761
+ }
1762
+ function trimOrUndefined$1(value) {
1763
+ const trimmed = value?.trim();
1764
+ return trimmed ? trimmed : void 0;
1765
+ }
1766
+ function resolveCanonicalChatTarget(parts) {
1767
+ const handleFromGuid = parts.chatGuid ? extractHandleFromChatGuid(parts.chatGuid) : null;
1768
+ if (handleFromGuid) return handleFromGuid;
1769
+ const normalizedIdentifier = normalizeBlueBubblesHandle(parts.chatIdentifier ?? "");
1770
+ if (normalizedIdentifier) return normalizedIdentifier;
1771
+ return trimOrUndefined$1(parts.chatGuid) ?? trimOrUndefined$1(parts.chatIdentifier) ?? (typeof parts.chatId === "number" ? String(parts.chatId) : null);
1772
+ }
1773
+ function buildScope(parts) {
1774
+ const target = resolveCanonicalChatTarget(parts) ?? parts.senderId;
1775
+ return `${parts.accountId}:${target}`;
1776
+ }
1777
+ function cleanupExpired(now = Date.now()) {
1778
+ if (lastCleanupAt !== 0 && now >= lastCleanupAt && now - lastCleanupAt < CLEANUP_MIN_INTERVAL_MS) return;
1779
+ lastCleanupAt = now;
1780
+ for (const [key, seenAt] of cache.entries()) if (now - seenAt > SELF_CHAT_TTL_MS) cache.delete(key);
1781
+ }
1782
+ function enforceSizeCap() {
1783
+ while (cache.size > MAX_SELF_CHAT_CACHE_ENTRIES) {
1784
+ const oldestKey = cache.keys().next().value;
1785
+ if (typeof oldestKey !== "string") break;
1786
+ cache.delete(oldestKey);
1787
+ }
1788
+ }
1789
+ function buildKey(lookup) {
1790
+ const body = normalizeBody(lookup.body);
1791
+ if (!body || !isUsableTimestamp(lookup.timestamp)) return null;
1792
+ return `${buildScope(lookup)}:${lookup.timestamp}:${digestText(body)}`;
1793
+ }
1794
+ function rememberBlueBubblesSelfChatCopy(lookup) {
1795
+ cleanupExpired();
1796
+ const key = buildKey(lookup);
1797
+ if (!key) return;
1798
+ cache.set(key, Date.now());
1799
+ enforceSizeCap();
1800
+ }
1801
+ function hasBlueBubblesSelfChatCopy(lookup) {
1802
+ cleanupExpired();
1803
+ const key = buildKey(lookup);
1804
+ if (!key) return false;
1805
+ const seenAt = cache.get(key);
1806
+ return typeof seenAt === "number" && Date.now() - seenAt <= SELF_CHAT_TTL_MS;
1807
+ }
1808
+ //#endregion
1809
+ //#region extensions/bluebubbles/src/reactions.ts
1810
+ const REACTION_TYPES = new Set([
1811
+ "love",
1812
+ "like",
1813
+ "dislike",
1814
+ "laugh",
1815
+ "emphasize",
1816
+ "question"
1817
+ ]);
1818
+ const REACTION_ALIASES = new Map([
1819
+ ["heart", "love"],
1820
+ ["love", "love"],
1821
+ ["❤", "love"],
1822
+ ["❤️", "love"],
1823
+ ["red_heart", "love"],
1824
+ ["thumbs_up", "like"],
1825
+ ["thumbsup", "like"],
1826
+ ["thumbs-up", "like"],
1827
+ ["thumbsup", "like"],
1828
+ ["like", "like"],
1829
+ ["thumb", "like"],
1830
+ ["ok", "like"],
1831
+ ["thumbs_down", "dislike"],
1832
+ ["thumbsdown", "dislike"],
1833
+ ["thumbs-down", "dislike"],
1834
+ ["dislike", "dislike"],
1835
+ ["boo", "dislike"],
1836
+ ["no", "dislike"],
1837
+ ["haha", "laugh"],
1838
+ ["lol", "laugh"],
1839
+ ["lmao", "laugh"],
1840
+ ["rofl", "laugh"],
1841
+ ["😂", "laugh"],
1842
+ ["🤣", "laugh"],
1843
+ ["xd", "laugh"],
1844
+ ["laugh", "laugh"],
1845
+ ["emphasis", "emphasize"],
1846
+ ["emphasize", "emphasize"],
1847
+ ["exclaim", "emphasize"],
1848
+ ["!!", "emphasize"],
1849
+ ["‼", "emphasize"],
1850
+ ["‼️", "emphasize"],
1851
+ ["❗", "emphasize"],
1852
+ ["important", "emphasize"],
1853
+ ["bang", "emphasize"],
1854
+ ["question", "question"],
1855
+ ["?", "question"],
1856
+ ["❓", "question"],
1857
+ ["❔", "question"],
1858
+ ["ask", "question"],
1859
+ ["loved", "love"],
1860
+ ["liked", "like"],
1861
+ ["disliked", "dislike"],
1862
+ ["laughed", "laugh"],
1863
+ ["emphasized", "emphasize"],
1864
+ ["questioned", "question"],
1865
+ ["fire", "love"],
1866
+ ["🔥", "love"],
1867
+ ["wow", "emphasize"],
1868
+ ["!", "emphasize"],
1869
+ ["heart_eyes", "love"],
1870
+ ["smile", "laugh"],
1871
+ ["smiley", "laugh"],
1872
+ ["happy", "laugh"],
1873
+ ["joy", "laugh"]
1874
+ ]);
1875
+ const REACTION_EMOJIS = new Map([
1876
+ ["❤️", "love"],
1877
+ ["❤", "love"],
1878
+ ["♥️", "love"],
1879
+ ["♥", "love"],
1880
+ ["😍", "love"],
1881
+ ["💕", "love"],
1882
+ ["👍", "like"],
1883
+ ["👌", "like"],
1884
+ ["👎", "dislike"],
1885
+ ["🙅", "dislike"],
1886
+ ["😂", "laugh"],
1887
+ ["🤣", "laugh"],
1888
+ ["😆", "laugh"],
1889
+ ["😁", "laugh"],
1890
+ ["😹", "laugh"],
1891
+ ["‼️", "emphasize"],
1892
+ ["‼", "emphasize"],
1893
+ ["!!", "emphasize"],
1894
+ ["❗", "emphasize"],
1895
+ ["❕", "emphasize"],
1896
+ ["!", "emphasize"],
1897
+ ["❓", "question"],
1898
+ ["❔", "question"],
1899
+ ["?", "question"]
1900
+ ]);
1901
+ function resolveAccount(params) {
1902
+ return resolveBlueBubblesServerAccount(params);
1903
+ }
1904
+ function normalizeBlueBubblesReactionInput(emoji, remove) {
1905
+ const trimmed = emoji.trim();
1906
+ if (!trimmed) throw new Error("BlueBubbles reaction requires an emoji or name.");
1907
+ let raw = trimmed.toLowerCase();
1908
+ if (raw.startsWith("-")) raw = raw.slice(1);
1909
+ const aliased = REACTION_ALIASES.get(raw) ?? raw;
1910
+ const mapped = REACTION_EMOJIS.get(trimmed) ?? REACTION_EMOJIS.get(raw) ?? aliased;
1911
+ if (!REACTION_TYPES.has(mapped)) throw new Error(`Unsupported BlueBubbles reaction: ${trimmed}`);
1912
+ return remove ? `-${mapped}` : mapped;
1913
+ }
1914
+ async function sendBlueBubblesReaction(params) {
1915
+ const chatGuid = params.chatGuid.trim();
1916
+ const messageGuid = params.messageGuid.trim();
1917
+ if (!chatGuid) throw new Error("BlueBubbles reaction requires chatGuid.");
1918
+ if (!messageGuid) throw new Error("BlueBubbles reaction requires messageGuid.");
1919
+ const reaction = normalizeBlueBubblesReactionInput(params.emoji, params.remove);
1920
+ const { baseUrl, password, accountId } = resolveAccount(params.opts ?? {});
1921
+ if (getCachedBlueBubblesPrivateApiStatus(accountId) === false) throw new Error("BlueBubbles reaction requires Private API, but it is disabled on the BlueBubbles server.");
1922
+ const url = buildBlueBubblesApiUrl({
1923
+ baseUrl,
1924
+ path: "/api/v1/message/react",
1925
+ password
1926
+ });
1927
+ const payload = {
1928
+ chatGuid,
1929
+ selectedMessageGuid: messageGuid,
1930
+ reaction,
1931
+ partIndex: typeof params.partIndex === "number" ? params.partIndex : 0
1932
+ };
1933
+ const res = await blueBubblesFetchWithTimeout(url, {
1934
+ method: "POST",
1935
+ headers: { "Content-Type": "application/json" },
1936
+ body: JSON.stringify(payload)
1937
+ }, params.opts?.timeoutMs);
1938
+ if (!res.ok) {
1939
+ const errorText = await res.text();
1940
+ throw new Error(`BlueBubbles reaction failed (${res.status}): ${errorText || "unknown"}`);
1941
+ }
1942
+ }
1943
+ //#endregion
1944
+ //#region extensions/bluebubbles/src/monitor-processing.ts
1945
+ const DEFAULT_TEXT_LIMIT = 4e3;
1946
+ const invalidAckReactions = /* @__PURE__ */ new Set();
1947
+ const REPLY_DIRECTIVE_TAG_RE = /\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+)\s*\]\]/gi;
1948
+ const PENDING_OUTBOUND_MESSAGE_ID_TTL_MS = 120 * 1e3;
1949
+ const pendingOutboundMessageIds = [];
1950
+ let pendingOutboundMessageIdCounter = 0;
1951
+ function trimOrUndefined(value) {
1952
+ const trimmed = value?.trim();
1953
+ return trimmed ? trimmed : void 0;
1954
+ }
1955
+ function normalizeSnippet(value) {
1956
+ return stripMarkdown(value).replace(/\s+/g, " ").trim().toLowerCase();
1957
+ }
1958
+ function isBlueBubblesSelfChatMessage(message, isGroup) {
1959
+ if (isGroup || !message.senderIdExplicit) return false;
1960
+ const chatHandle = (message.chatGuid ? extractHandleFromChatGuid(message.chatGuid) : null) ?? normalizeBlueBubblesHandle(message.chatIdentifier ?? "");
1961
+ return Boolean(chatHandle) && chatHandle === message.senderId;
1962
+ }
1963
+ function prunePendingOutboundMessageIds(now = Date.now()) {
1964
+ const cutoff = now - PENDING_OUTBOUND_MESSAGE_ID_TTL_MS;
1965
+ for (let i = pendingOutboundMessageIds.length - 1; i >= 0; i--) if (pendingOutboundMessageIds[i].createdAt < cutoff) pendingOutboundMessageIds.splice(i, 1);
1966
+ }
1967
+ function rememberPendingOutboundMessageId(entry) {
1968
+ prunePendingOutboundMessageIds();
1969
+ pendingOutboundMessageIdCounter += 1;
1970
+ const snippetRaw = entry.snippet.trim();
1971
+ const snippetNorm = normalizeSnippet(snippetRaw);
1972
+ pendingOutboundMessageIds.push({
1973
+ id: pendingOutboundMessageIdCounter,
1974
+ accountId: entry.accountId,
1975
+ sessionKey: entry.sessionKey,
1976
+ outboundTarget: entry.outboundTarget,
1977
+ chatGuid: trimOrUndefined(entry.chatGuid),
1978
+ chatIdentifier: trimOrUndefined(entry.chatIdentifier),
1979
+ chatId: typeof entry.chatId === "number" ? entry.chatId : void 0,
1980
+ snippetRaw,
1981
+ snippetNorm,
1982
+ isMediaSnippet: snippetRaw.toLowerCase().startsWith("<media:"),
1983
+ createdAt: Date.now()
1984
+ });
1985
+ return pendingOutboundMessageIdCounter;
1986
+ }
1987
+ function forgetPendingOutboundMessageId(id) {
1988
+ const index = pendingOutboundMessageIds.findIndex((entry) => entry.id === id);
1989
+ if (index >= 0) pendingOutboundMessageIds.splice(index, 1);
1990
+ }
1991
+ function chatsMatch(left, right) {
1992
+ const leftGuid = trimOrUndefined(left.chatGuid);
1993
+ const rightGuid = trimOrUndefined(right.chatGuid);
1994
+ if (leftGuid && rightGuid) return leftGuid === rightGuid;
1995
+ const leftIdentifier = trimOrUndefined(left.chatIdentifier);
1996
+ const rightIdentifier = trimOrUndefined(right.chatIdentifier);
1997
+ if (leftIdentifier && rightIdentifier) return leftIdentifier === rightIdentifier;
1998
+ const leftChatId = typeof left.chatId === "number" ? left.chatId : void 0;
1999
+ const rightChatId = typeof right.chatId === "number" ? right.chatId : void 0;
2000
+ if (leftChatId !== void 0 && rightChatId !== void 0) return leftChatId === rightChatId;
2001
+ return false;
2002
+ }
2003
+ function consumePendingOutboundMessageId(params) {
2004
+ prunePendingOutboundMessageIds();
2005
+ const bodyNorm = normalizeSnippet(params.body);
2006
+ const isMediaBody = params.body.trim().toLowerCase().startsWith("<media:");
2007
+ for (let i = 0; i < pendingOutboundMessageIds.length; i++) {
2008
+ const entry = pendingOutboundMessageIds[i];
2009
+ if (entry.accountId !== params.accountId) continue;
2010
+ if (!chatsMatch(entry, params)) continue;
2011
+ if (entry.snippetNorm && entry.snippetNorm === bodyNorm) {
2012
+ pendingOutboundMessageIds.splice(i, 1);
2013
+ return entry;
2014
+ }
2015
+ if (entry.isMediaSnippet && isMediaBody) {
2016
+ pendingOutboundMessageIds.splice(i, 1);
2017
+ return entry;
2018
+ }
2019
+ }
2020
+ return null;
2021
+ }
2022
+ function logVerbose(core, runtime, message) {
2023
+ if (core.logging.shouldLogVerbose()) runtime.log?.(`[bluebubbles] ${message}`);
2024
+ }
2025
+ function logGroupAllowlistHint(params) {
2026
+ const log = params.runtime.log ?? console.log;
2027
+ const nameHint = params.chatName ? ` (group name: ${params.chatName})` : "";
2028
+ const accountHint = params.accountId ? ` (or channels.bluebubbles.accounts.${params.accountId}.groupAllowFrom)` : "";
2029
+ if (params.entry) {
2030
+ log(`[bluebubbles] group message blocked (${params.reason}). Allow this group by adding "${params.entry}" to channels.bluebubbles.groupAllowFrom${nameHint}.`);
2031
+ log(`[bluebubbles] add to config: channels.bluebubbles.groupAllowFrom=["${params.entry}"]${accountHint}.`);
2032
+ return;
2033
+ }
2034
+ log(`[bluebubbles] group message blocked (${params.reason}). Allow groups by setting channels.bluebubbles.groupPolicy="open" or adding a group id to channels.bluebubbles.groupAllowFrom${accountHint}${nameHint}.`);
2035
+ }
2036
+ function resolveBlueBubblesAckReaction(params) {
2037
+ const raw = resolveAckReaction(params.cfg, params.agentId).trim();
2038
+ if (!raw) return null;
2039
+ try {
2040
+ normalizeBlueBubblesReactionInput(raw);
2041
+ return raw;
2042
+ } catch {
2043
+ const key = raw.toLowerCase();
2044
+ if (!invalidAckReactions.has(key)) {
2045
+ invalidAckReactions.add(key);
2046
+ logVerbose(params.core, params.runtime, `ack reaction skipped (unsupported for BlueBubbles): ${raw}`);
2047
+ }
2048
+ return null;
2049
+ }
2050
+ }
2051
+ /**
2052
+ * In-memory rolling history map keyed by account + chat identifier.
2053
+ * Populated from incoming messages during the session.
2054
+ * API backfill is attempted until one fetch resolves (or retries are exhausted).
2055
+ */
2056
+ const chatHistories = /* @__PURE__ */ new Map();
2057
+ const historyBackfills = /* @__PURE__ */ new Map();
2058
+ const HISTORY_BACKFILL_BASE_DELAY_MS = 5e3;
2059
+ const HISTORY_BACKFILL_MAX_DELAY_MS = 120 * 1e3;
2060
+ const HISTORY_BACKFILL_MAX_ATTEMPTS = 6;
2061
+ const HISTORY_BACKFILL_RETRY_WINDOW_MS = 1800 * 1e3;
2062
+ const MAX_STORED_HISTORY_ENTRY_CHARS = 2e3;
2063
+ const MAX_INBOUND_HISTORY_ENTRY_CHARS = 1200;
2064
+ const MAX_INBOUND_HISTORY_TOTAL_CHARS = 12e3;
2065
+ function buildAccountScopedHistoryKey(accountId, historyIdentifier) {
2066
+ return `${accountId}\u0000${historyIdentifier}`;
2067
+ }
2068
+ function historyDedupKey(entry) {
2069
+ const messageId = entry.messageId?.trim();
2070
+ if (messageId) return `id:${messageId}`;
2071
+ return `fallback:${entry.sender}\u0000${entry.body}\u0000${entry.timestamp ?? ""}`;
2072
+ }
2073
+ function truncateHistoryBody(body, maxChars) {
2074
+ const trimmed = body.trim();
2075
+ if (!trimmed) return "";
2076
+ if (trimmed.length <= maxChars) return trimmed;
2077
+ return `${trimmed.slice(0, maxChars).trimEnd()}...`;
2078
+ }
2079
+ function mergeHistoryEntries(params) {
2080
+ if (params.limit <= 0) return [];
2081
+ const merged = [];
2082
+ const seen = /* @__PURE__ */ new Set();
2083
+ const appendUnique = (entry) => {
2084
+ const key = historyDedupKey(entry);
2085
+ if (seen.has(key)) return;
2086
+ seen.add(key);
2087
+ merged.push(entry);
2088
+ };
2089
+ for (const entry of params.apiEntries) appendUnique(entry);
2090
+ for (const entry of params.currentEntries) appendUnique(entry);
2091
+ if (merged.length <= params.limit) return merged;
2092
+ return merged.slice(merged.length - params.limit);
2093
+ }
2094
+ function pruneHistoryBackfillState() {
2095
+ for (const key of historyBackfills.keys()) if (!chatHistories.has(key)) historyBackfills.delete(key);
2096
+ }
2097
+ function markHistoryBackfillResolved(historyKey) {
2098
+ const state = historyBackfills.get(historyKey);
2099
+ if (state) {
2100
+ state.resolved = true;
2101
+ historyBackfills.set(historyKey, state);
2102
+ return;
2103
+ }
2104
+ historyBackfills.set(historyKey, {
2105
+ attempts: 0,
2106
+ firstAttemptAt: Date.now(),
2107
+ nextAttemptAt: Number.POSITIVE_INFINITY,
2108
+ resolved: true
2109
+ });
2110
+ }
2111
+ function planHistoryBackfillAttempt(historyKey, now) {
2112
+ const existing = historyBackfills.get(historyKey);
2113
+ if (existing?.resolved) return null;
2114
+ if (existing && now - existing.firstAttemptAt > HISTORY_BACKFILL_RETRY_WINDOW_MS) {
2115
+ markHistoryBackfillResolved(historyKey);
2116
+ return null;
2117
+ }
2118
+ if (existing && existing.attempts >= HISTORY_BACKFILL_MAX_ATTEMPTS) {
2119
+ markHistoryBackfillResolved(historyKey);
2120
+ return null;
2121
+ }
2122
+ if (existing && now < existing.nextAttemptAt) return null;
2123
+ const attempts = (existing?.attempts ?? 0) + 1;
2124
+ const state = {
2125
+ attempts,
2126
+ firstAttemptAt: existing?.firstAttemptAt ?? now,
2127
+ nextAttemptAt: now + Math.min(HISTORY_BACKFILL_BASE_DELAY_MS * 2 ** (attempts - 1), HISTORY_BACKFILL_MAX_DELAY_MS),
2128
+ resolved: false
2129
+ };
2130
+ historyBackfills.set(historyKey, state);
2131
+ return state;
2132
+ }
2133
+ function buildInboundHistorySnapshot(params) {
2134
+ if (params.limit <= 0 || params.entries.length === 0) return;
2135
+ const recent = params.entries.slice(-params.limit);
2136
+ const selected = [];
2137
+ let remainingChars = MAX_INBOUND_HISTORY_TOTAL_CHARS;
2138
+ for (let i = recent.length - 1; i >= 0; i--) {
2139
+ const entry = recent[i];
2140
+ const body = truncateHistoryBody(entry.body, MAX_INBOUND_HISTORY_ENTRY_CHARS);
2141
+ if (!body) continue;
2142
+ if (selected.length > 0 && body.length > remainingChars) break;
2143
+ selected.push({
2144
+ sender: entry.sender,
2145
+ body,
2146
+ timestamp: entry.timestamp
2147
+ });
2148
+ remainingChars -= body.length;
2149
+ if (remainingChars <= 0) break;
2150
+ }
2151
+ if (selected.length === 0) return;
2152
+ selected.reverse();
2153
+ return selected;
2154
+ }
2155
+ async function processMessage(message, target) {
2156
+ const { account, config, runtime, core, statusSink } = target;
2157
+ const pairing = createChannelPairingController({
2158
+ core,
2159
+ channel: "bluebubbles",
2160
+ accountId: account.accountId
2161
+ });
2162
+ const privateApiEnabled = isBlueBubblesPrivateApiEnabled(account.accountId);
2163
+ const groupFlag = resolveGroupFlagFromChatGuid(message.chatGuid);
2164
+ const isGroup = typeof groupFlag === "boolean" ? groupFlag : message.isGroup;
2165
+ const text = message.text.trim();
2166
+ const attachments = message.attachments ?? [];
2167
+ const placeholder = buildMessagePlaceholder(message);
2168
+ const tapbackContext = resolveTapbackContext(message);
2169
+ const tapbackParsed = parseTapbackText({
2170
+ text,
2171
+ emojiHint: tapbackContext?.emojiHint,
2172
+ actionHint: tapbackContext?.actionHint,
2173
+ requireQuoted: !tapbackContext
2174
+ });
2175
+ const isTapbackMessage = Boolean(tapbackParsed);
2176
+ const rawBody = tapbackParsed ? tapbackParsed.action === "removed" ? `removed ${tapbackParsed.emoji} reaction` : `reacted with ${tapbackParsed.emoji}` : text || placeholder;
2177
+ const isSelfChatMessage = isBlueBubblesSelfChatMessage(message, isGroup);
2178
+ const selfChatLookup = {
2179
+ accountId: account.accountId,
2180
+ chatGuid: message.chatGuid,
2181
+ chatIdentifier: message.chatIdentifier,
2182
+ chatId: message.chatId,
2183
+ senderId: message.senderId,
2184
+ body: rawBody,
2185
+ timestamp: message.timestamp
2186
+ };
2187
+ const cacheMessageId = message.messageId?.trim();
2188
+ const confirmedOutboundCacheEntry = cacheMessageId ? resolveReplyContextFromCache({
2189
+ accountId: account.accountId,
2190
+ replyToId: cacheMessageId,
2191
+ chatGuid: message.chatGuid,
2192
+ chatIdentifier: message.chatIdentifier,
2193
+ chatId: message.chatId
2194
+ }) : null;
2195
+ let messageShortId;
2196
+ const cacheInboundMessage = () => {
2197
+ if (!cacheMessageId) return;
2198
+ messageShortId = rememberBlueBubblesReplyCache({
2199
+ accountId: account.accountId,
2200
+ messageId: cacheMessageId,
2201
+ chatGuid: message.chatGuid,
2202
+ chatIdentifier: message.chatIdentifier,
2203
+ chatId: message.chatId,
2204
+ senderLabel: message.fromMe ? "me" : message.senderId,
2205
+ body: rawBody,
2206
+ timestamp: message.timestamp ?? Date.now()
2207
+ }).shortId;
2208
+ };
2209
+ if (message.fromMe) {
2210
+ cacheInboundMessage();
2211
+ const confirmedAssistantOutbound = confirmedOutboundCacheEntry?.senderLabel === "me" && normalizeSnippet(confirmedOutboundCacheEntry.body ?? "") === normalizeSnippet(rawBody);
2212
+ if (isSelfChatMessage && confirmedAssistantOutbound) rememberBlueBubblesSelfChatCopy(selfChatLookup);
2213
+ if (cacheMessageId) {
2214
+ const pending = consumePendingOutboundMessageId({
2215
+ accountId: account.accountId,
2216
+ chatGuid: message.chatGuid,
2217
+ chatIdentifier: message.chatIdentifier,
2218
+ chatId: message.chatId,
2219
+ body: rawBody
2220
+ });
2221
+ if (pending) {
2222
+ const displayId = getShortIdForUuid(cacheMessageId) || cacheMessageId;
2223
+ const previewSource = pending.snippetRaw || rawBody;
2224
+ const preview = previewSource ? ` "${previewSource.slice(0, 12)}${previewSource.length > 12 ? "…" : ""}"` : "";
2225
+ core.system.enqueueSystemEvent(`Assistant sent${preview} [message_id:${displayId}]`, {
2226
+ sessionKey: pending.sessionKey,
2227
+ contextKey: `bluebubbles:outbound:${pending.outboundTarget}:${cacheMessageId}`
2228
+ });
2229
+ }
2230
+ }
2231
+ return;
2232
+ }
2233
+ if (isSelfChatMessage && hasBlueBubblesSelfChatCopy(selfChatLookup)) {
2234
+ logVerbose(core, runtime, `drop: reflected self-chat duplicate sender=${message.senderId}`);
2235
+ return;
2236
+ }
2237
+ if (!rawBody) {
2238
+ logVerbose(core, runtime, `drop: empty text sender=${message.senderId}`);
2239
+ return;
2240
+ }
2241
+ logVerbose(core, runtime, `msg sender=${message.senderId} group=${isGroup} textLen=${text.length} attachments=${attachments.length} chatGuid=${message.chatGuid ?? ""} chatId=${message.chatId ?? ""}`);
2242
+ const dmPolicy = account.config.dmPolicy ?? "pairing";
2243
+ const groupPolicy = account.config.groupPolicy ?? "allowlist";
2244
+ const configuredAllowFrom = mapAllowFromEntries(account.config.allowFrom);
2245
+ const storeAllowFrom = await readStoreAllowFromForDmPolicy({
2246
+ provider: "bluebubbles",
2247
+ accountId: account.accountId,
2248
+ dmPolicy,
2249
+ readStore: pairing.readStoreForDmPolicy
2250
+ });
2251
+ const accessDecision = resolveDmGroupAccessWithLists({
2252
+ isGroup,
2253
+ dmPolicy,
2254
+ groupPolicy,
2255
+ allowFrom: configuredAllowFrom,
2256
+ groupAllowFrom: account.config.groupAllowFrom,
2257
+ storeAllowFrom,
2258
+ isSenderAllowed: (allowFrom) => isAllowedBlueBubblesSender({
2259
+ allowFrom,
2260
+ sender: message.senderId,
2261
+ chatId: message.chatId ?? void 0,
2262
+ chatGuid: message.chatGuid ?? void 0,
2263
+ chatIdentifier: message.chatIdentifier ?? void 0
2264
+ })
2265
+ });
2266
+ const effectiveAllowFrom = accessDecision.effectiveAllowFrom;
2267
+ const effectiveGroupAllowFrom = accessDecision.effectiveGroupAllowFrom;
2268
+ const groupAllowEntry = formatGroupAllowlistEntry({
2269
+ chatGuid: message.chatGuid,
2270
+ chatId: message.chatId ?? void 0,
2271
+ chatIdentifier: message.chatIdentifier ?? void 0
2272
+ });
2273
+ const groupName = message.chatName?.trim() || void 0;
2274
+ if (accessDecision.decision !== "allow") {
2275
+ if (isGroup) {
2276
+ if (accessDecision.reasonCode === DM_GROUP_ACCESS_REASON.GROUP_POLICY_DISABLED) {
2277
+ logVerbose(core, runtime, "Blocked BlueBubbles group message (groupPolicy=disabled)");
2278
+ logGroupAllowlistHint({
2279
+ runtime,
2280
+ reason: "groupPolicy=disabled",
2281
+ entry: groupAllowEntry,
2282
+ chatName: groupName,
2283
+ accountId: account.accountId
2284
+ });
2285
+ return;
2286
+ }
2287
+ if (accessDecision.reasonCode === DM_GROUP_ACCESS_REASON.GROUP_POLICY_EMPTY_ALLOWLIST) {
2288
+ logVerbose(core, runtime, "Blocked BlueBubbles group message (no allowlist)");
2289
+ logGroupAllowlistHint({
2290
+ runtime,
2291
+ reason: "groupPolicy=allowlist (empty allowlist)",
2292
+ entry: groupAllowEntry,
2293
+ chatName: groupName,
2294
+ accountId: account.accountId
2295
+ });
2296
+ return;
2297
+ }
2298
+ if (accessDecision.reasonCode === DM_GROUP_ACCESS_REASON.GROUP_POLICY_NOT_ALLOWLISTED) {
2299
+ logVerbose(core, runtime, `Blocked BlueBubbles sender ${message.senderId} (not in groupAllowFrom)`);
2300
+ logVerbose(core, runtime, `drop: group sender not allowed sender=${message.senderId} allowFrom=${effectiveGroupAllowFrom.join(",")}`);
2301
+ logGroupAllowlistHint({
2302
+ runtime,
2303
+ reason: "groupPolicy=allowlist (not allowlisted)",
2304
+ entry: groupAllowEntry,
2305
+ chatName: groupName,
2306
+ accountId: account.accountId
2307
+ });
2308
+ return;
2309
+ }
2310
+ return;
2311
+ }
2312
+ if (accessDecision.reasonCode === DM_GROUP_ACCESS_REASON.DM_POLICY_DISABLED) {
2313
+ logVerbose(core, runtime, `Blocked BlueBubbles DM from ${message.senderId}`);
2314
+ logVerbose(core, runtime, `drop: dmPolicy disabled sender=${message.senderId}`);
2315
+ return;
2316
+ }
2317
+ if (accessDecision.decision === "pairing") {
2318
+ await pairing.issueChallenge({
2319
+ senderId: message.senderId,
2320
+ senderIdLine: `Your BlueBubbles sender id: ${message.senderId}`,
2321
+ meta: { name: message.senderName },
2322
+ onCreated: () => {
2323
+ runtime.log?.(`[bluebubbles] pairing request sender=${message.senderId} created=true`);
2324
+ logVerbose(core, runtime, `bluebubbles pairing request sender=${message.senderId}`);
2325
+ },
2326
+ sendPairingReply: async (text) => {
2327
+ await sendMessageBlueBubbles(message.senderId, text, {
2328
+ cfg: config,
2329
+ accountId: account.accountId
2330
+ });
2331
+ statusSink?.({ lastOutboundAt: Date.now() });
2332
+ },
2333
+ onReplyError: (err) => {
2334
+ logVerbose(core, runtime, `bluebubbles pairing reply failed for ${message.senderId}: ${String(err)}`);
2335
+ runtime.error?.(`[bluebubbles] pairing reply failed sender=${message.senderId}: ${String(err)}`);
2336
+ }
2337
+ });
2338
+ return;
2339
+ }
2340
+ logVerbose(core, runtime, `Blocked unauthorized BlueBubbles sender ${message.senderId} (dmPolicy=${dmPolicy})`);
2341
+ logVerbose(core, runtime, `drop: dm sender not allowed sender=${message.senderId} allowFrom=${effectiveAllowFrom.join(",")}`);
2342
+ return;
2343
+ }
2344
+ const chatId = message.chatId ?? void 0;
2345
+ const chatGuid = message.chatGuid ?? void 0;
2346
+ const chatIdentifier = message.chatIdentifier ?? void 0;
2347
+ const peerId = isGroup ? chatGuid ?? chatIdentifier ?? (chatId ? String(chatId) : "group") : message.senderId;
2348
+ const route = core.channel.routing.resolveAgentRoute({
2349
+ cfg: config,
2350
+ channel: "bluebubbles",
2351
+ accountId: account.accountId,
2352
+ peer: {
2353
+ kind: isGroup ? "group" : "direct",
2354
+ id: peerId
2355
+ }
2356
+ });
2357
+ const messageText = text;
2358
+ const mentionRegexes = core.channel.mentions.buildMentionRegexes(config, route.agentId);
2359
+ const wasMentioned = isGroup ? core.channel.mentions.matchesMentionPatterns(messageText, mentionRegexes) : true;
2360
+ const canDetectMention = mentionRegexes.length > 0;
2361
+ const requireMention = core.channel.groups.resolveRequireMention({
2362
+ cfg: config,
2363
+ channel: "bluebubbles",
2364
+ groupId: peerId,
2365
+ accountId: account.accountId
2366
+ });
2367
+ const useAccessGroups = config.commands?.useAccessGroups !== false;
2368
+ const hasControlCmd = core.channel.text.hasControlCommand(messageText, config);
2369
+ const commandDmAllowFrom = isGroup ? configuredAllowFrom : effectiveAllowFrom;
2370
+ const ownerAllowedForCommands = commandDmAllowFrom.length > 0 ? isAllowedBlueBubblesSender({
2371
+ allowFrom: commandDmAllowFrom,
2372
+ sender: message.senderId,
2373
+ chatId: message.chatId ?? void 0,
2374
+ chatGuid: message.chatGuid ?? void 0,
2375
+ chatIdentifier: message.chatIdentifier ?? void 0
2376
+ }) : false;
2377
+ const groupAllowedForCommands = effectiveGroupAllowFrom.length > 0 ? isAllowedBlueBubblesSender({
2378
+ allowFrom: effectiveGroupAllowFrom,
2379
+ sender: message.senderId,
2380
+ chatId: message.chatId ?? void 0,
2381
+ chatGuid: message.chatGuid ?? void 0,
2382
+ chatIdentifier: message.chatIdentifier ?? void 0
2383
+ }) : false;
2384
+ const commandGate = resolveControlCommandGate({
2385
+ useAccessGroups,
2386
+ authorizers: [{
2387
+ configured: commandDmAllowFrom.length > 0,
2388
+ allowed: ownerAllowedForCommands
2389
+ }, {
2390
+ configured: effectiveGroupAllowFrom.length > 0,
2391
+ allowed: groupAllowedForCommands
2392
+ }],
2393
+ allowTextCommands: true,
2394
+ hasControlCommand: hasControlCmd
2395
+ });
2396
+ const commandAuthorized = commandGate.commandAuthorized;
2397
+ if (isGroup && commandGate.shouldBlock) {
2398
+ logInboundDrop({
2399
+ log: (msg) => logVerbose(core, runtime, msg),
2400
+ channel: "bluebubbles",
2401
+ reason: "control command (unauthorized)",
2402
+ target: message.senderId
2403
+ });
2404
+ return;
2405
+ }
2406
+ const shouldBypassMention = isGroup && requireMention && !wasMentioned && commandAuthorized && hasControlCmd;
2407
+ const effectiveWasMentioned = wasMentioned || shouldBypassMention;
2408
+ if (isGroup && requireMention && canDetectMention && !wasMentioned && !shouldBypassMention) {
2409
+ logVerbose(core, runtime, `bluebubbles: skipping group message (no mention)`);
2410
+ return;
2411
+ }
2412
+ cacheInboundMessage();
2413
+ const baseUrl = normalizeSecretInputString(account.config.serverUrl);
2414
+ const password = normalizeSecretInputString(account.config.password);
2415
+ const maxBytes = account.config.mediaMaxMb && account.config.mediaMaxMb > 0 ? account.config.mediaMaxMb * 1024 * 1024 : 8 * 1024 * 1024;
2416
+ let mediaUrls = [];
2417
+ let mediaPaths = [];
2418
+ let mediaTypes = [];
2419
+ if (attachments.length > 0) if (!baseUrl || !password) logVerbose(core, runtime, "attachment download skipped (missing serverUrl/password)");
2420
+ else for (const attachment of attachments) {
2421
+ if (!attachment.guid) continue;
2422
+ if (attachment.totalBytes && attachment.totalBytes > maxBytes) {
2423
+ logVerbose(core, runtime, `attachment too large guid=${attachment.guid} bytes=${attachment.totalBytes}`);
2424
+ continue;
2425
+ }
2426
+ try {
2427
+ const downloaded = await downloadBlueBubblesAttachment(attachment, {
2428
+ cfg: config,
2429
+ accountId: account.accountId,
2430
+ maxBytes
2431
+ });
2432
+ const saved = await core.channel.media.saveMediaBuffer(Buffer.from(downloaded.buffer), downloaded.contentType, "inbound", maxBytes);
2433
+ mediaPaths.push(saved.path);
2434
+ mediaUrls.push(saved.path);
2435
+ if (saved.contentType) mediaTypes.push(saved.contentType);
2436
+ } catch (err) {
2437
+ logVerbose(core, runtime, `attachment download failed guid=${attachment.guid} err=${String(err)}`);
2438
+ }
2439
+ }
2440
+ let replyToId = message.replyToId;
2441
+ let replyToBody = message.replyToBody;
2442
+ let replyToSender = message.replyToSender;
2443
+ let replyToShortId;
2444
+ if (isTapbackMessage && tapbackContext?.replyToId) replyToId = tapbackContext.replyToId;
2445
+ if (replyToId) {
2446
+ const cached = resolveReplyContextFromCache({
2447
+ accountId: account.accountId,
2448
+ replyToId,
2449
+ chatGuid: message.chatGuid,
2450
+ chatIdentifier: message.chatIdentifier,
2451
+ chatId: message.chatId
2452
+ });
2453
+ if (cached) {
2454
+ if (!replyToBody && cached.body) replyToBody = cached.body;
2455
+ if (!replyToSender && cached.senderLabel) replyToSender = cached.senderLabel;
2456
+ replyToShortId = cached.shortId;
2457
+ if (core.logging.shouldLogVerbose()) {
2458
+ const preview = (cached.body ?? "").replace(/\s+/g, " ").slice(0, 120);
2459
+ logVerbose(core, runtime, `reply-context cache hit replyToId=${replyToId} sender=${replyToSender ?? ""} body="${preview}"`);
2460
+ }
2461
+ }
2462
+ }
2463
+ if (replyToId && !replyToShortId) replyToShortId = getShortIdForUuid(replyToId);
2464
+ const replyTag = formatReplyTag({
2465
+ replyToId,
2466
+ replyToShortId
2467
+ });
2468
+ const baseBody = replyTag ? isTapbackMessage ? `${rawBody} ${replyTag}` : `${replyTag} ${rawBody}` : rawBody;
2469
+ const senderLabel = message.senderName || `user:${message.senderId}`;
2470
+ const fromLabel = isGroup ? `${message.chatName?.trim() || "Group"} id:${peerId}` : senderLabel !== message.senderId ? `${senderLabel} id:${message.senderId}` : senderLabel;
2471
+ const groupSubject = isGroup ? message.chatName?.trim() || void 0 : void 0;
2472
+ const groupMembers = isGroup ? formatGroupMembers({
2473
+ participants: message.participants,
2474
+ fallback: message.senderId ? {
2475
+ id: message.senderId,
2476
+ name: message.senderName
2477
+ } : void 0
2478
+ }) : void 0;
2479
+ const storePath = core.channel.session.resolveStorePath(config.session?.store, { agentId: route.agentId });
2480
+ const envelopeOptions = core.channel.reply.resolveEnvelopeFormatOptions(config);
2481
+ const previousTimestamp = core.channel.session.readSessionUpdatedAt({
2482
+ storePath,
2483
+ sessionKey: route.sessionKey
2484
+ });
2485
+ const body = core.channel.reply.formatInboundEnvelope({
2486
+ channel: "BlueBubbles",
2487
+ from: fromLabel,
2488
+ timestamp: message.timestamp,
2489
+ previousTimestamp,
2490
+ envelope: envelopeOptions,
2491
+ body: baseBody,
2492
+ chatType: isGroup ? "group" : "direct",
2493
+ sender: {
2494
+ name: message.senderName || void 0,
2495
+ id: message.senderId
2496
+ }
2497
+ });
2498
+ let chatGuidForActions = chatGuid;
2499
+ if (!chatGuidForActions && baseUrl && password) {
2500
+ const resolveTarget = isGroup && (chatId || chatIdentifier) ? chatId ? {
2501
+ kind: "chat_id",
2502
+ chatId
2503
+ } : {
2504
+ kind: "chat_identifier",
2505
+ chatIdentifier: chatIdentifier ?? ""
2506
+ } : {
2507
+ kind: "handle",
2508
+ address: message.senderId
2509
+ };
2510
+ if (resolveTarget.kind !== "chat_identifier" || resolveTarget.chatIdentifier) chatGuidForActions = await resolveChatGuidForTarget({
2511
+ baseUrl,
2512
+ password,
2513
+ target: resolveTarget
2514
+ }) ?? void 0;
2515
+ }
2516
+ const ackReactionScope = config.messages?.ackReactionScope ?? "group-mentions";
2517
+ const removeAckAfterReply = config.messages?.removeAckAfterReply ?? false;
2518
+ const ackReactionValue = resolveBlueBubblesAckReaction({
2519
+ cfg: config,
2520
+ agentId: route.agentId,
2521
+ core,
2522
+ runtime
2523
+ });
2524
+ const shouldAckReaction = () => Boolean(ackReactionValue && core.channel.reactions.shouldAckReaction({
2525
+ scope: ackReactionScope,
2526
+ isDirect: !isGroup,
2527
+ isGroup,
2528
+ isMentionableGroup: isGroup,
2529
+ requireMention: Boolean(requireMention),
2530
+ canDetectMention,
2531
+ effectiveWasMentioned,
2532
+ shouldBypassMention
2533
+ }));
2534
+ const ackMessageId = message.messageId?.trim() || "";
2535
+ const ackReactionPromise = shouldAckReaction() && ackMessageId && chatGuidForActions && ackReactionValue ? sendBlueBubblesReaction({
2536
+ chatGuid: chatGuidForActions,
2537
+ messageGuid: ackMessageId,
2538
+ emoji: ackReactionValue,
2539
+ opts: {
2540
+ cfg: config,
2541
+ accountId: account.accountId
2542
+ }
2543
+ }).then(() => true, (err) => {
2544
+ logVerbose(core, runtime, `ack reaction failed chatGuid=${chatGuidForActions} msg=${ackMessageId}: ${String(err)}`);
2545
+ return false;
2546
+ }) : null;
2547
+ const sendReadReceipts = account.config.sendReadReceipts !== false;
2548
+ if (chatGuidForActions && baseUrl && password && sendReadReceipts) try {
2549
+ await markBlueBubblesChatRead(chatGuidForActions, {
2550
+ cfg: config,
2551
+ accountId: account.accountId
2552
+ });
2553
+ logVerbose(core, runtime, `marked read chatGuid=${chatGuidForActions}`);
2554
+ } catch (err) {
2555
+ runtime.error?.(`[bluebubbles] mark read failed: ${String(err)}`);
2556
+ }
2557
+ else if (!sendReadReceipts) logVerbose(core, runtime, "mark read skipped (sendReadReceipts=false)");
2558
+ else logVerbose(core, runtime, "mark read skipped (missing chatGuid or credentials)");
2559
+ const outboundTarget = isGroup ? formatBlueBubblesChatTarget({
2560
+ chatId,
2561
+ chatGuid: chatGuidForActions ?? chatGuid,
2562
+ chatIdentifier
2563
+ }) || peerId : chatGuidForActions ? formatBlueBubblesChatTarget({ chatGuid: chatGuidForActions }) : message.senderId;
2564
+ const maybeEnqueueOutboundMessageId = (messageId, snippet) => {
2565
+ const trimmed = messageId?.trim();
2566
+ if (!trimmed || trimmed === "ok" || trimmed === "unknown") return false;
2567
+ const displayId = rememberBlueBubblesReplyCache({
2568
+ accountId: account.accountId,
2569
+ messageId: trimmed,
2570
+ chatGuid: chatGuidForActions ?? chatGuid,
2571
+ chatIdentifier,
2572
+ chatId,
2573
+ senderLabel: "me",
2574
+ body: snippet ?? "",
2575
+ timestamp: Date.now()
2576
+ }).shortId || trimmed;
2577
+ const preview = snippet ? ` "${snippet.slice(0, 12)}${snippet.length > 12 ? "…" : ""}"` : "";
2578
+ core.system.enqueueSystemEvent(`Assistant sent${preview} [message_id:${displayId}]`, {
2579
+ sessionKey: route.sessionKey,
2580
+ contextKey: `bluebubbles:outbound:${outboundTarget}:${trimmed}`
2581
+ });
2582
+ return true;
2583
+ };
2584
+ const sanitizeReplyDirectiveText = (value) => {
2585
+ if (privateApiEnabled) return value;
2586
+ return value.replace(REPLY_DIRECTIVE_TAG_RE, " ").replace(/[ \t]+/g, " ").trim();
2587
+ };
2588
+ const historyLimit = isGroup ? account.config.historyLimit ?? 0 : account.config.dmHistoryLimit ?? 0;
2589
+ const historyIdentifier = chatGuid || chatIdentifier || (chatId ? String(chatId) : null) || (isGroup ? null : message.senderId) || "";
2590
+ const historyKey = historyIdentifier ? buildAccountScopedHistoryKey(account.accountId, historyIdentifier) : "";
2591
+ if (historyKey && historyLimit > 0) {
2592
+ const nowMs = Date.now();
2593
+ const senderLabel = message.fromMe ? "me" : message.senderName || message.senderId;
2594
+ const normalizedHistoryBody = truncateHistoryBody(text, MAX_STORED_HISTORY_ENTRY_CHARS);
2595
+ const currentEntries = recordPendingHistoryEntryIfEnabled({
2596
+ historyMap: chatHistories,
2597
+ limit: historyLimit,
2598
+ historyKey,
2599
+ entry: normalizedHistoryBody ? {
2600
+ sender: senderLabel,
2601
+ body: normalizedHistoryBody,
2602
+ timestamp: message.timestamp ?? nowMs,
2603
+ messageId: message.messageId ?? void 0
2604
+ } : null
2605
+ });
2606
+ pruneHistoryBackfillState();
2607
+ const backfillAttempt = planHistoryBackfillAttempt(historyKey, nowMs);
2608
+ if (backfillAttempt) try {
2609
+ const backfillResult = await fetchBlueBubblesHistory(historyIdentifier, historyLimit, {
2610
+ cfg: config,
2611
+ accountId: account.accountId
2612
+ });
2613
+ if (backfillResult.resolved) markHistoryBackfillResolved(historyKey);
2614
+ if (backfillResult.entries.length > 0) {
2615
+ const apiEntries = [];
2616
+ for (const entry of backfillResult.entries) {
2617
+ const body = truncateHistoryBody(entry.body, MAX_STORED_HISTORY_ENTRY_CHARS);
2618
+ if (!body) continue;
2619
+ apiEntries.push({
2620
+ sender: entry.sender,
2621
+ body,
2622
+ timestamp: entry.timestamp,
2623
+ messageId: entry.messageId
2624
+ });
2625
+ }
2626
+ const merged = mergeHistoryEntries({
2627
+ apiEntries,
2628
+ currentEntries: currentEntries.length > 0 ? currentEntries : chatHistories.get(historyKey) ?? [],
2629
+ limit: historyLimit
2630
+ });
2631
+ if (chatHistories.has(historyKey)) chatHistories.delete(historyKey);
2632
+ chatHistories.set(historyKey, merged);
2633
+ evictOldHistoryKeys(chatHistories);
2634
+ logVerbose(core, runtime, `backfilled ${backfillResult.entries.length} history messages for ${isGroup ? "group" : "DM"}: ${historyIdentifier}`);
2635
+ } else if (!backfillResult.resolved) {
2636
+ const remainingAttempts = HISTORY_BACKFILL_MAX_ATTEMPTS - backfillAttempt.attempts;
2637
+ const nextBackoffMs = Math.max(backfillAttempt.nextAttemptAt - nowMs, 0);
2638
+ logVerbose(core, runtime, `history backfill unresolved for ${historyIdentifier}; retries left=${Math.max(remainingAttempts, 0)} next_in_ms=${nextBackoffMs}`);
2639
+ }
2640
+ } catch (err) {
2641
+ const remainingAttempts = HISTORY_BACKFILL_MAX_ATTEMPTS - backfillAttempt.attempts;
2642
+ const nextBackoffMs = Math.max(backfillAttempt.nextAttemptAt - nowMs, 0);
2643
+ logVerbose(core, runtime, `history backfill failed for ${historyIdentifier}: ${String(err)} (retries left=${Math.max(remainingAttempts, 0)} next_in_ms=${nextBackoffMs})`);
2644
+ }
2645
+ }
2646
+ let inboundHistory;
2647
+ if (historyKey && historyLimit > 0) {
2648
+ const entries = chatHistories.get(historyKey);
2649
+ if (entries && entries.length > 0) inboundHistory = buildInboundHistorySnapshot({
2650
+ entries,
2651
+ limit: historyLimit
2652
+ });
2653
+ }
2654
+ const commandBody = messageText.trim();
2655
+ const ctxPayload = core.channel.reply.finalizeInboundContext({
2656
+ Body: body,
2657
+ BodyForAgent: rawBody,
2658
+ InboundHistory: inboundHistory,
2659
+ RawBody: rawBody,
2660
+ CommandBody: commandBody,
2661
+ BodyForCommands: commandBody,
2662
+ MediaUrl: mediaUrls[0],
2663
+ MediaUrls: mediaUrls.length > 0 ? mediaUrls : void 0,
2664
+ MediaPath: mediaPaths[0],
2665
+ MediaPaths: mediaPaths.length > 0 ? mediaPaths : void 0,
2666
+ MediaType: mediaTypes[0],
2667
+ MediaTypes: mediaTypes.length > 0 ? mediaTypes : void 0,
2668
+ From: isGroup ? `group:${peerId}` : `bluebubbles:${message.senderId}`,
2669
+ To: `bluebubbles:${outboundTarget}`,
2670
+ SessionKey: route.sessionKey,
2671
+ AccountId: route.accountId,
2672
+ ChatType: isGroup ? "group" : "direct",
2673
+ ConversationLabel: fromLabel,
2674
+ ReplyToId: replyToShortId || replyToId,
2675
+ ReplyToIdFull: replyToId,
2676
+ ReplyToBody: replyToBody,
2677
+ ReplyToSender: replyToSender,
2678
+ GroupSubject: groupSubject,
2679
+ GroupMembers: groupMembers,
2680
+ SenderName: message.senderName || void 0,
2681
+ SenderId: message.senderId,
2682
+ Provider: "bluebubbles",
2683
+ Surface: "bluebubbles",
2684
+ MessageSid: messageShortId || message.messageId,
2685
+ MessageSidFull: message.messageId,
2686
+ Timestamp: message.timestamp,
2687
+ OriginatingChannel: "bluebubbles",
2688
+ OriginatingTo: `bluebubbles:${outboundTarget}`,
2689
+ WasMentioned: effectiveWasMentioned,
2690
+ CommandAuthorized: commandAuthorized
2691
+ });
2692
+ let sentMessage = false;
2693
+ let streamingActive = false;
2694
+ let typingRestartTimer;
2695
+ const typingRestartDelayMs = 150;
2696
+ const clearTypingRestartTimer = () => {
2697
+ if (typingRestartTimer) {
2698
+ clearTimeout(typingRestartTimer);
2699
+ typingRestartTimer = void 0;
2700
+ }
2701
+ };
2702
+ const restartTypingSoon = () => {
2703
+ if (!streamingActive || !chatGuidForActions || !baseUrl || !password) return;
2704
+ clearTypingRestartTimer();
2705
+ typingRestartTimer = setTimeout(() => {
2706
+ typingRestartTimer = void 0;
2707
+ if (!streamingActive) return;
2708
+ sendBlueBubblesTyping(chatGuidForActions, true, {
2709
+ cfg: config,
2710
+ accountId: account.accountId
2711
+ }).catch((err) => {
2712
+ runtime.error?.(`[bluebubbles] typing restart failed: ${String(err)}`);
2713
+ });
2714
+ }, typingRestartDelayMs);
2715
+ };
2716
+ try {
2717
+ const { onModelSelected, typingCallbacks, ...replyPipeline } = createChannelReplyPipeline({
2718
+ cfg: config,
2719
+ agentId: route.agentId,
2720
+ channel: "bluebubbles",
2721
+ accountId: account.accountId,
2722
+ typingCallbacks: {
2723
+ onReplyStart: async () => {
2724
+ if (!chatGuidForActions) return;
2725
+ if (!baseUrl || !password) return;
2726
+ streamingActive = true;
2727
+ clearTypingRestartTimer();
2728
+ try {
2729
+ await sendBlueBubblesTyping(chatGuidForActions, true, {
2730
+ cfg: config,
2731
+ accountId: account.accountId
2732
+ });
2733
+ } catch (err) {
2734
+ runtime.error?.(`[bluebubbles] typing start failed: ${String(err)}`);
2735
+ }
2736
+ },
2737
+ onIdle: () => {
2738
+ if (!chatGuidForActions) return;
2739
+ if (!baseUrl || !password) return;
2740
+ }
2741
+ }
2742
+ });
2743
+ await core.channel.reply.dispatchReplyWithBufferedBlockDispatcher({
2744
+ ctx: ctxPayload,
2745
+ cfg: config,
2746
+ dispatcherOptions: {
2747
+ ...replyPipeline,
2748
+ deliver: async (payload, info) => {
2749
+ const rawReplyToId = privateApiEnabled && typeof payload.replyToId === "string" ? payload.replyToId.trim() : "";
2750
+ const replyToMessageGuid = rawReplyToId ? resolveBlueBubblesMessageId(rawReplyToId, { requireKnownShortId: true }) : "";
2751
+ const mediaList = resolveOutboundMediaUrls(payload);
2752
+ if (mediaList.length > 0) {
2753
+ const tableMode = core.channel.text.resolveMarkdownTableMode({
2754
+ cfg: config,
2755
+ channel: "bluebubbles",
2756
+ accountId: account.accountId
2757
+ });
2758
+ await sendMediaWithLeadingCaption({
2759
+ mediaUrls: mediaList,
2760
+ caption: sanitizeReplyDirectiveText(core.channel.text.convertMarkdownTables(payload.text ?? "", tableMode)),
2761
+ send: async ({ mediaUrl, caption }) => {
2762
+ const cachedBody = (caption ?? "").trim() || "<media:attachment>";
2763
+ const pendingId = rememberPendingOutboundMessageId({
2764
+ accountId: account.accountId,
2765
+ sessionKey: route.sessionKey,
2766
+ outboundTarget,
2767
+ chatGuid: chatGuidForActions ?? chatGuid,
2768
+ chatIdentifier,
2769
+ chatId,
2770
+ snippet: cachedBody
2771
+ });
2772
+ let result;
2773
+ try {
2774
+ result = await sendBlueBubblesMedia({
2775
+ cfg: config,
2776
+ to: outboundTarget,
2777
+ mediaUrl,
2778
+ caption: caption ?? void 0,
2779
+ replyToId: replyToMessageGuid || null,
2780
+ accountId: account.accountId
2781
+ });
2782
+ } catch (err) {
2783
+ forgetPendingOutboundMessageId(pendingId);
2784
+ throw err;
2785
+ }
2786
+ if (maybeEnqueueOutboundMessageId(result.messageId, cachedBody)) forgetPendingOutboundMessageId(pendingId);
2787
+ sentMessage = true;
2788
+ statusSink?.({ lastOutboundAt: Date.now() });
2789
+ if (info.kind === "block") restartTypingSoon();
2790
+ }
2791
+ });
2792
+ return;
2793
+ }
2794
+ const textLimit = account.config.textChunkLimit && account.config.textChunkLimit > 0 ? account.config.textChunkLimit : DEFAULT_TEXT_LIMIT;
2795
+ const chunkMode = account.config.chunkMode ?? "length";
2796
+ const tableMode = core.channel.text.resolveMarkdownTableMode({
2797
+ cfg: config,
2798
+ channel: "bluebubbles",
2799
+ accountId: account.accountId
2800
+ });
2801
+ const text = sanitizeReplyDirectiveText(core.channel.text.convertMarkdownTables(payload.text ?? "", tableMode));
2802
+ const chunks = chunkMode === "newline" ? resolveTextChunksWithFallback(text, core.channel.text.chunkTextWithMode(text, textLimit, chunkMode)) : resolveTextChunksWithFallback(text, core.channel.text.chunkMarkdownText(text, textLimit));
2803
+ if (!chunks.length) return;
2804
+ for (const chunk of chunks) {
2805
+ const pendingId = rememberPendingOutboundMessageId({
2806
+ accountId: account.accountId,
2807
+ sessionKey: route.sessionKey,
2808
+ outboundTarget,
2809
+ chatGuid: chatGuidForActions ?? chatGuid,
2810
+ chatIdentifier,
2811
+ chatId,
2812
+ snippet: chunk
2813
+ });
2814
+ let result;
2815
+ try {
2816
+ result = await sendMessageBlueBubbles(outboundTarget, chunk, {
2817
+ cfg: config,
2818
+ accountId: account.accountId,
2819
+ replyToMessageGuid: replyToMessageGuid || void 0
2820
+ });
2821
+ } catch (err) {
2822
+ forgetPendingOutboundMessageId(pendingId);
2823
+ throw err;
2824
+ }
2825
+ if (maybeEnqueueOutboundMessageId(result.messageId, chunk)) forgetPendingOutboundMessageId(pendingId);
2826
+ sentMessage = true;
2827
+ statusSink?.({ lastOutboundAt: Date.now() });
2828
+ if (info.kind === "block") restartTypingSoon();
2829
+ }
2830
+ },
2831
+ onReplyStart: typingCallbacks?.onReplyStart,
2832
+ onIdle: typingCallbacks?.onIdle,
2833
+ onError: (err, info) => {
2834
+ runtime.error?.(`BlueBubbles ${info.kind} reply failed: ${String(err)}`);
2835
+ }
2836
+ },
2837
+ replyOptions: {
2838
+ onModelSelected,
2839
+ disableBlockStreaming: typeof account.config.blockStreaming === "boolean" ? !account.config.blockStreaming : void 0
2840
+ }
2841
+ });
2842
+ } finally {
2843
+ const shouldStopTyping = Boolean(chatGuidForActions && baseUrl && password) && (streamingActive || !sentMessage);
2844
+ streamingActive = false;
2845
+ clearTypingRestartTimer();
2846
+ if (sentMessage && chatGuidForActions && ackMessageId) core.channel.reactions.removeAckReactionAfterReply({
2847
+ removeAfterReply: removeAckAfterReply,
2848
+ ackReactionPromise,
2849
+ ackReactionValue: ackReactionValue ?? null,
2850
+ remove: () => sendBlueBubblesReaction({
2851
+ chatGuid: chatGuidForActions,
2852
+ messageGuid: ackMessageId,
2853
+ emoji: ackReactionValue ?? "",
2854
+ remove: true,
2855
+ opts: {
2856
+ cfg: config,
2857
+ accountId: account.accountId
2858
+ }
2859
+ }),
2860
+ onError: (err) => {
2861
+ logAckFailure({
2862
+ log: (msg) => logVerbose(core, runtime, msg),
2863
+ channel: "bluebubbles",
2864
+ target: `${chatGuidForActions}/${ackMessageId}`,
2865
+ error: err
2866
+ });
2867
+ }
2868
+ });
2869
+ if (shouldStopTyping && chatGuidForActions) sendBlueBubblesTyping(chatGuidForActions, false, {
2870
+ cfg: config,
2871
+ accountId: account.accountId
2872
+ }).catch((err) => {
2873
+ logTypingFailure({
2874
+ log: (msg) => logVerbose(core, runtime, msg),
2875
+ channel: "bluebubbles",
2876
+ action: "stop",
2877
+ target: chatGuidForActions,
2878
+ error: err
2879
+ });
2880
+ });
2881
+ }
2882
+ }
2883
+ async function processReaction(reaction, target) {
2884
+ const { account, config, runtime, core } = target;
2885
+ const pairing = createChannelPairingController({
2886
+ core,
2887
+ channel: "bluebubbles",
2888
+ accountId: account.accountId
2889
+ });
2890
+ if (reaction.fromMe) return;
2891
+ const dmPolicy = account.config.dmPolicy ?? "pairing";
2892
+ const groupPolicy = account.config.groupPolicy ?? "allowlist";
2893
+ const storeAllowFrom = await readStoreAllowFromForDmPolicy({
2894
+ provider: "bluebubbles",
2895
+ accountId: account.accountId,
2896
+ dmPolicy,
2897
+ readStore: pairing.readStoreForDmPolicy
2898
+ });
2899
+ if (resolveDmGroupAccessWithLists({
2900
+ isGroup: reaction.isGroup,
2901
+ dmPolicy,
2902
+ groupPolicy,
2903
+ allowFrom: account.config.allowFrom,
2904
+ groupAllowFrom: account.config.groupAllowFrom,
2905
+ storeAllowFrom,
2906
+ isSenderAllowed: (allowFrom) => isAllowedBlueBubblesSender({
2907
+ allowFrom,
2908
+ sender: reaction.senderId,
2909
+ chatId: reaction.chatId ?? void 0,
2910
+ chatGuid: reaction.chatGuid ?? void 0,
2911
+ chatIdentifier: reaction.chatIdentifier ?? void 0
2912
+ })
2913
+ }).decision !== "allow") return;
2914
+ const chatId = reaction.chatId ?? void 0;
2915
+ const chatGuid = reaction.chatGuid ?? void 0;
2916
+ const chatIdentifier = reaction.chatIdentifier ?? void 0;
2917
+ const peerId = reaction.isGroup ? chatGuid ?? chatIdentifier ?? (chatId ? String(chatId) : "group") : reaction.senderId;
2918
+ const route = core.channel.routing.resolveAgentRoute({
2919
+ cfg: config,
2920
+ channel: "bluebubbles",
2921
+ accountId: account.accountId,
2922
+ peer: {
2923
+ kind: reaction.isGroup ? "group" : "direct",
2924
+ id: peerId
2925
+ }
2926
+ });
2927
+ const senderLabel = reaction.senderName || reaction.senderId;
2928
+ const chatLabel = reaction.isGroup ? ` in group:${peerId}` : "";
2929
+ const messageDisplayId = getShortIdForUuid(reaction.messageId) || reaction.messageId;
2930
+ const text = reaction.action === "removed" ? `${senderLabel} removed ${reaction.emoji} reaction [[reply_to:${messageDisplayId}]]${chatLabel}` : `${senderLabel} reacted with ${reaction.emoji} [[reply_to:${messageDisplayId}]]${chatLabel}`;
2931
+ core.system.enqueueSystemEvent(text, {
2932
+ sessionKey: route.sessionKey,
2933
+ contextKey: `bluebubbles:reaction:${reaction.action}:${peerId}:${reaction.messageId}:${reaction.senderId}:${reaction.emoji}`
2934
+ });
2935
+ logVerbose(core, runtime, `reaction event enqueued: ${text}`);
2936
+ }
2937
+ //#endregion
2938
+ //#region extensions/bluebubbles/src/monitor.ts
2939
+ const webhookTargets = /* @__PURE__ */ new Map();
2940
+ const webhookInFlightLimiter = createWebhookInFlightLimiter();
2941
+ const debounceRegistry = createBlueBubblesDebounceRegistry({ processMessage });
2942
+ function registerBlueBubblesWebhookTarget(target) {
2943
+ const registered = registerWebhookTargetWithPluginRoute({
2944
+ targetsByPath: webhookTargets,
2945
+ target,
2946
+ route: {
2947
+ auth: "plugin",
2948
+ match: "exact",
2949
+ pluginId: "bluebubbles",
2950
+ source: "bluebubbles-webhook",
2951
+ accountId: target.account.accountId,
2952
+ log: target.runtime.log,
2953
+ handler: async (req, res) => {
2954
+ if (!await handleBlueBubblesWebhookRequest(req, res) && !res.headersSent) {
2955
+ res.statusCode = 404;
2956
+ res.setHeader("Content-Type", "text/plain; charset=utf-8");
2957
+ res.end("Not Found");
2958
+ }
2959
+ }
2960
+ }
2961
+ });
2962
+ return () => {
2963
+ registered.unregister();
2964
+ debounceRegistry.removeDebouncer(registered.target);
2965
+ };
2966
+ }
2967
+ function parseBlueBubblesWebhookPayload(rawBody) {
2968
+ const trimmed = rawBody.trim();
2969
+ if (!trimmed) return {
2970
+ ok: false,
2971
+ error: "empty payload"
2972
+ };
2973
+ try {
2974
+ return {
2975
+ ok: true,
2976
+ value: JSON.parse(trimmed)
2977
+ };
2978
+ } catch {
2979
+ const params = new URLSearchParams(rawBody);
2980
+ const payload = params.get("payload") ?? params.get("data") ?? params.get("message");
2981
+ if (!payload) return {
2982
+ ok: false,
2983
+ error: "invalid json"
2984
+ };
2985
+ try {
2986
+ return {
2987
+ ok: true,
2988
+ value: JSON.parse(payload)
2989
+ };
2990
+ } catch (error) {
2991
+ return {
2992
+ ok: false,
2993
+ error: error instanceof Error ? error.message : String(error)
2994
+ };
2995
+ }
2996
+ }
2997
+ }
2998
+ function asRecord(value) {
2999
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
3000
+ }
3001
+ function maskSecret(value) {
3002
+ if (value.length <= 6) return "***";
3003
+ return `${value.slice(0, 2)}***${value.slice(-2)}`;
3004
+ }
3005
+ function normalizeAuthToken(raw) {
3006
+ const value = raw.trim();
3007
+ if (!value) return "";
3008
+ if (value.toLowerCase().startsWith("bearer ")) return value.slice(7).trim();
3009
+ return value;
3010
+ }
3011
+ function safeEqualSecret(aRaw, bRaw) {
3012
+ const a = normalizeAuthToken(aRaw);
3013
+ const b = normalizeAuthToken(bRaw);
3014
+ if (!a || !b) return false;
3015
+ const bufA = Buffer.from(a, "utf8");
3016
+ const bufB = Buffer.from(b, "utf8");
3017
+ if (bufA.length !== bufB.length) return false;
3018
+ return timingSafeEqual(bufA, bufB);
3019
+ }
3020
+ async function handleBlueBubblesWebhookRequest(req, res) {
3021
+ return await withResolvedWebhookRequestPipeline({
3022
+ req,
3023
+ res,
3024
+ targetsByPath: webhookTargets,
3025
+ allowMethods: ["POST"],
3026
+ inFlightLimiter: webhookInFlightLimiter,
3027
+ handle: async ({ path, targets }) => {
3028
+ const url = new URL(req.url ?? "/", "http://localhost");
3029
+ const guidParam = url.searchParams.get("guid") ?? url.searchParams.get("password");
3030
+ const headerToken = req.headers["x-guid"] ?? req.headers["x-password"] ?? req.headers["x-bluebubbles-guid"] ?? req.headers["authorization"];
3031
+ const guid = (Array.isArray(headerToken) ? headerToken[0] : headerToken) ?? guidParam ?? "";
3032
+ const target = resolveWebhookTargetWithAuthOrRejectSync({
3033
+ targets,
3034
+ res,
3035
+ isMatch: (target) => {
3036
+ return safeEqualSecret(guid, target.account.config.password?.trim() ?? "");
3037
+ }
3038
+ });
3039
+ if (!target) {
3040
+ console.warn(`[bluebubbles] webhook rejected: status=${res.statusCode} path=${path} guid=${maskSecret(url.searchParams.get("guid") ?? url.searchParams.get("password") ?? "")}`);
3041
+ return true;
3042
+ }
3043
+ const body = await readWebhookBodyOrReject({
3044
+ req,
3045
+ res,
3046
+ profile: "post-auth",
3047
+ invalidBodyMessage: "invalid payload"
3048
+ });
3049
+ if (!body.ok) {
3050
+ console.warn(`[bluebubbles] webhook rejected: status=${res.statusCode}`);
3051
+ return true;
3052
+ }
3053
+ const parsed = parseBlueBubblesWebhookPayload(body.value);
3054
+ if (!parsed.ok) {
3055
+ res.statusCode = 400;
3056
+ res.end(parsed.error);
3057
+ console.warn(`[bluebubbles] webhook rejected: ${parsed.error}`);
3058
+ return true;
3059
+ }
3060
+ const payload = asRecord(parsed.value) ?? {};
3061
+ const firstTarget = targets[0];
3062
+ if (firstTarget) logVerbose(firstTarget.core, firstTarget.runtime, `webhook received path=${path} keys=${Object.keys(payload).join(",") || "none"}`);
3063
+ const eventTypeRaw = payload.type;
3064
+ const eventType = typeof eventTypeRaw === "string" ? eventTypeRaw.trim() : "";
3065
+ if (eventType && !new Set([
3066
+ "new-message",
3067
+ "updated-message",
3068
+ "message-reaction",
3069
+ "reaction"
3070
+ ]).has(eventType)) {
3071
+ res.statusCode = 200;
3072
+ res.end("ok");
3073
+ if (firstTarget) logVerbose(firstTarget.core, firstTarget.runtime, `webhook ignored type=${eventType}`);
3074
+ return true;
3075
+ }
3076
+ const reaction = normalizeWebhookReaction(payload);
3077
+ if ((eventType === "updated-message" || eventType === "message-reaction" || eventType === "reaction") && !reaction) {
3078
+ res.statusCode = 200;
3079
+ res.end("ok");
3080
+ if (firstTarget) logVerbose(firstTarget.core, firstTarget.runtime, `webhook ignored ${eventType || "event"} without reaction`);
3081
+ return true;
3082
+ }
3083
+ const message = reaction ? null : normalizeWebhookMessage(payload);
3084
+ if (!message && !reaction) {
3085
+ res.statusCode = 400;
3086
+ res.end("invalid payload");
3087
+ console.warn("[bluebubbles] webhook rejected: unable to parse message payload");
3088
+ return true;
3089
+ }
3090
+ target.statusSink?.({ lastInboundAt: Date.now() });
3091
+ if (reaction) processReaction(reaction, target).catch((err) => {
3092
+ target.runtime.error?.(`[${target.account.accountId}] BlueBubbles reaction failed: ${String(err)}`);
3093
+ });
3094
+ else if (message) debounceRegistry.getOrCreateDebouncer(target).enqueue({
3095
+ message,
3096
+ target
3097
+ }).catch((err) => {
3098
+ target.runtime.error?.(`[${target.account.accountId}] BlueBubbles webhook failed: ${String(err)}`);
3099
+ });
3100
+ res.statusCode = 200;
3101
+ res.end("ok");
3102
+ if (reaction) {
3103
+ if (firstTarget) logVerbose(firstTarget.core, firstTarget.runtime, `webhook accepted reaction sender=${reaction.senderId} msg=${reaction.messageId} action=${reaction.action}`);
3104
+ } else if (message) {
3105
+ if (firstTarget) logVerbose(firstTarget.core, firstTarget.runtime, `webhook accepted sender=${message.senderId} group=${message.isGroup} chatGuid=${message.chatGuid ?? ""} chatId=${message.chatId ?? ""}`);
3106
+ }
3107
+ return true;
3108
+ }
3109
+ });
3110
+ }
3111
+ async function monitorBlueBubblesProvider(options) {
3112
+ const { account, config, runtime, abortSignal, statusSink } = options;
3113
+ const core = getBlueBubblesRuntime();
3114
+ const path = options.webhookPath?.trim() || "/bluebubbles-webhook";
3115
+ const serverInfo = await fetchBlueBubblesServerInfo({
3116
+ baseUrl: account.baseUrl,
3117
+ password: account.config.password,
3118
+ accountId: account.accountId,
3119
+ timeoutMs: 5e3
3120
+ }).catch(() => null);
3121
+ if (serverInfo?.os_version) runtime.log?.(`[${account.accountId}] BlueBubbles server macOS ${serverInfo.os_version}`);
3122
+ if (typeof serverInfo?.private_api === "boolean") runtime.log?.(`[${account.accountId}] BlueBubbles Private API ${serverInfo.private_api ? "enabled" : "disabled"}`);
3123
+ const unregister = registerBlueBubblesWebhookTarget({
3124
+ account,
3125
+ config,
3126
+ runtime,
3127
+ core,
3128
+ path,
3129
+ statusSink
3130
+ });
3131
+ return await new Promise((resolve) => {
3132
+ const stop = () => {
3133
+ unregister();
3134
+ resolve();
3135
+ };
3136
+ if (abortSignal?.aborted) {
3137
+ stop();
3138
+ return;
3139
+ }
3140
+ abortSignal?.addEventListener("abort", stop, { once: true });
3141
+ runtime.log?.(`[${account.accountId}] BlueBubbles webhook listening on ${normalizeWebhookPath(path)}`);
3142
+ });
3143
+ }
3144
+ //#endregion
3145
+ export { addBlueBubblesParticipant as a, removeBlueBubblesParticipant as c, unsendBlueBubblesMessage as d, sendBlueBubblesAttachment as f, sendBlueBubblesMedia as i, renameBlueBubblesChat as l, sendMessageBlueBubbles as m, sendBlueBubblesReaction as n, editBlueBubblesMessage as o, resolveChatGuidForTarget as p, resolveBlueBubblesMessageId as r, leaveBlueBubblesChat as s, monitorBlueBubblesProvider as t, setGroupIconBlueBubbles as u };