@spinabot/brigade 1.7.0 → 1.9.0

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 (257) hide show
  1. package/README.md +19 -0
  2. package/dist/agents/agent-loop.d.ts +13 -0
  3. package/dist/agents/agent-loop.d.ts.map +1 -1
  4. package/dist/agents/agent-loop.js +5 -0
  5. package/dist/agents/agent-loop.js.map +1 -1
  6. package/dist/agents/channels/access-control/group-tool-policy.d.ts +73 -0
  7. package/dist/agents/channels/access-control/group-tool-policy.d.ts.map +1 -0
  8. package/dist/agents/channels/access-control/group-tool-policy.js +193 -0
  9. package/dist/agents/channels/access-control/group-tool-policy.js.map +1 -0
  10. package/dist/agents/channels/access-control/index.d.ts +1 -0
  11. package/dist/agents/channels/access-control/index.d.ts.map +1 -1
  12. package/dist/agents/channels/access-control/index.js +1 -0
  13. package/dist/agents/channels/access-control/index.js.map +1 -1
  14. package/dist/agents/channels/bluebubbles/account-config.d.ts +253 -0
  15. package/dist/agents/channels/bluebubbles/account-config.d.ts.map +1 -0
  16. package/dist/agents/channels/bluebubbles/account-config.js +486 -0
  17. package/dist/agents/channels/bluebubbles/account-config.js.map +1 -0
  18. package/dist/agents/channels/bluebubbles/account-registry.d.ts +33 -0
  19. package/dist/agents/channels/bluebubbles/account-registry.d.ts.map +1 -0
  20. package/dist/agents/channels/bluebubbles/account-registry.js +46 -0
  21. package/dist/agents/channels/bluebubbles/account-registry.js.map +1 -0
  22. package/dist/agents/channels/bluebubbles/adapter.d.ts +45 -0
  23. package/dist/agents/channels/bluebubbles/adapter.d.ts.map +1 -0
  24. package/dist/agents/channels/bluebubbles/adapter.js +366 -0
  25. package/dist/agents/channels/bluebubbles/adapter.js.map +1 -0
  26. package/dist/agents/channels/bluebubbles/catchup-cursor.d.ts +52 -0
  27. package/dist/agents/channels/bluebubbles/catchup-cursor.d.ts.map +1 -0
  28. package/dist/agents/channels/bluebubbles/catchup-cursor.js +118 -0
  29. package/dist/agents/channels/bluebubbles/catchup-cursor.js.map +1 -0
  30. package/dist/agents/channels/bluebubbles/catchup.d.ts +114 -0
  31. package/dist/agents/channels/bluebubbles/catchup.d.ts.map +1 -0
  32. package/dist/agents/channels/bluebubbles/catchup.js +220 -0
  33. package/dist/agents/channels/bluebubbles/catchup.js.map +1 -0
  34. package/dist/agents/channels/bluebubbles/chat.d.ts +75 -0
  35. package/dist/agents/channels/bluebubbles/chat.d.ts.map +1 -0
  36. package/dist/agents/channels/bluebubbles/chat.js +182 -0
  37. package/dist/agents/channels/bluebubbles/chat.js.map +1 -0
  38. package/dist/agents/channels/bluebubbles/connection.d.ts +95 -0
  39. package/dist/agents/channels/bluebubbles/connection.d.ts.map +1 -0
  40. package/dist/agents/channels/bluebubbles/connection.js +413 -0
  41. package/dist/agents/channels/bluebubbles/connection.js.map +1 -0
  42. package/dist/agents/channels/bluebubbles/contact-names.d.ts +79 -0
  43. package/dist/agents/channels/bluebubbles/contact-names.d.ts.map +1 -0
  44. package/dist/agents/channels/bluebubbles/contact-names.js +188 -0
  45. package/dist/agents/channels/bluebubbles/contact-names.js.map +1 -0
  46. package/dist/agents/channels/bluebubbles/debounce.d.ts +78 -0
  47. package/dist/agents/channels/bluebubbles/debounce.d.ts.map +1 -0
  48. package/dist/agents/channels/bluebubbles/debounce.js +173 -0
  49. package/dist/agents/channels/bluebubbles/debounce.js.map +1 -0
  50. package/dist/agents/channels/bluebubbles/dedupe.d.ts +25 -0
  51. package/dist/agents/channels/bluebubbles/dedupe.d.ts.map +1 -0
  52. package/dist/agents/channels/bluebubbles/dedupe.js +35 -0
  53. package/dist/agents/channels/bluebubbles/dedupe.js.map +1 -0
  54. package/dist/agents/channels/bluebubbles/effects.d.ts +17 -0
  55. package/dist/agents/channels/bluebubbles/effects.d.ts.map +1 -0
  56. package/dist/agents/channels/bluebubbles/effects.js +57 -0
  57. package/dist/agents/channels/bluebubbles/effects.js.map +1 -0
  58. package/dist/agents/channels/bluebubbles/history.d.ts +56 -0
  59. package/dist/agents/channels/bluebubbles/history.d.ts.map +1 -0
  60. package/dist/agents/channels/bluebubbles/history.js +140 -0
  61. package/dist/agents/channels/bluebubbles/history.js.map +1 -0
  62. package/dist/agents/channels/bluebubbles/index.d.ts +18 -0
  63. package/dist/agents/channels/bluebubbles/index.d.ts.map +1 -0
  64. package/dist/agents/channels/bluebubbles/index.js +18 -0
  65. package/dist/agents/channels/bluebubbles/index.js.map +1 -0
  66. package/dist/agents/channels/bluebubbles/media.d.ts +104 -0
  67. package/dist/agents/channels/bluebubbles/media.d.ts.map +1 -0
  68. package/dist/agents/channels/bluebubbles/media.js +222 -0
  69. package/dist/agents/channels/bluebubbles/media.js.map +1 -0
  70. package/dist/agents/channels/bluebubbles/messaging.d.ts +13 -0
  71. package/dist/agents/channels/bluebubbles/messaging.d.ts.map +1 -0
  72. package/dist/agents/channels/bluebubbles/messaging.js +36 -0
  73. package/dist/agents/channels/bluebubbles/messaging.js.map +1 -0
  74. package/dist/agents/channels/bluebubbles/module.d.ts +24 -0
  75. package/dist/agents/channels/bluebubbles/module.d.ts.map +1 -0
  76. package/dist/agents/channels/bluebubbles/module.js +52 -0
  77. package/dist/agents/channels/bluebubbles/module.js.map +1 -0
  78. package/dist/agents/channels/bluebubbles/normalize.d.ts +111 -0
  79. package/dist/agents/channels/bluebubbles/normalize.d.ts.map +1 -0
  80. package/dist/agents/channels/bluebubbles/normalize.js +239 -0
  81. package/dist/agents/channels/bluebubbles/normalize.js.map +1 -0
  82. package/dist/agents/channels/bluebubbles/plugin.d.ts +46 -0
  83. package/dist/agents/channels/bluebubbles/plugin.d.ts.map +1 -0
  84. package/dist/agents/channels/bluebubbles/plugin.js +242 -0
  85. package/dist/agents/channels/bluebubbles/plugin.js.map +1 -0
  86. package/dist/agents/channels/bluebubbles/probe.d.ts +79 -0
  87. package/dist/agents/channels/bluebubbles/probe.d.ts.map +1 -0
  88. package/dist/agents/channels/bluebubbles/probe.js +138 -0
  89. package/dist/agents/channels/bluebubbles/probe.js.map +1 -0
  90. package/dist/agents/channels/bluebubbles/reactions.d.ts +46 -0
  91. package/dist/agents/channels/bluebubbles/reactions.d.ts.map +1 -0
  92. package/dist/agents/channels/bluebubbles/reactions.js +207 -0
  93. package/dist/agents/channels/bluebubbles/reactions.js.map +1 -0
  94. package/dist/agents/channels/bluebubbles/send.d.ts +132 -0
  95. package/dist/agents/channels/bluebubbles/send.d.ts.map +1 -0
  96. package/dist/agents/channels/bluebubbles/send.js +327 -0
  97. package/dist/agents/channels/bluebubbles/send.js.map +1 -0
  98. package/dist/agents/channels/bluebubbles/status-issues.d.ts +57 -0
  99. package/dist/agents/channels/bluebubbles/status-issues.d.ts.map +1 -0
  100. package/dist/agents/channels/bluebubbles/status-issues.js +93 -0
  101. package/dist/agents/channels/bluebubbles/status-issues.js.map +1 -0
  102. package/dist/agents/channels/bluebubbles/types.d.ts +69 -0
  103. package/dist/agents/channels/bluebubbles/types.d.ts.map +1 -0
  104. package/dist/agents/channels/bluebubbles/types.js +118 -0
  105. package/dist/agents/channels/bluebubbles/types.js.map +1 -0
  106. package/dist/agents/channels/bluebubbles/webhook.d.ts +97 -0
  107. package/dist/agents/channels/bluebubbles/webhook.d.ts.map +1 -0
  108. package/dist/agents/channels/bluebubbles/webhook.js +249 -0
  109. package/dist/agents/channels/bluebubbles/webhook.js.map +1 -0
  110. package/dist/agents/channels/bundled-channel-metas.d.ts +13 -0
  111. package/dist/agents/channels/bundled-channel-metas.d.ts.map +1 -1
  112. package/dist/agents/channels/bundled-channel-metas.js +33 -0
  113. package/dist/agents/channels/bundled-channel-metas.js.map +1 -1
  114. package/dist/agents/channels/imessage/account-config.d.ts +178 -0
  115. package/dist/agents/channels/imessage/account-config.d.ts.map +1 -0
  116. package/dist/agents/channels/imessage/account-config.js +371 -0
  117. package/dist/agents/channels/imessage/account-config.js.map +1 -0
  118. package/dist/agents/channels/imessage/adapter.d.ts +36 -0
  119. package/dist/agents/channels/imessage/adapter.d.ts.map +1 -0
  120. package/dist/agents/channels/imessage/adapter.js +286 -0
  121. package/dist/agents/channels/imessage/adapter.js.map +1 -0
  122. package/dist/agents/channels/imessage/client.d.ts +99 -0
  123. package/dist/agents/channels/imessage/client.d.ts.map +1 -0
  124. package/dist/agents/channels/imessage/client.js +231 -0
  125. package/dist/agents/channels/imessage/client.js.map +1 -0
  126. package/dist/agents/channels/imessage/connection.d.ts +101 -0
  127. package/dist/agents/channels/imessage/connection.d.ts.map +1 -0
  128. package/dist/agents/channels/imessage/connection.js +367 -0
  129. package/dist/agents/channels/imessage/connection.js.map +1 -0
  130. package/dist/agents/channels/imessage/format.d.ts +45 -0
  131. package/dist/agents/channels/imessage/format.d.ts.map +1 -0
  132. package/dist/agents/channels/imessage/format.js +170 -0
  133. package/dist/agents/channels/imessage/format.js.map +1 -0
  134. package/dist/agents/channels/imessage/history.d.ts +49 -0
  135. package/dist/agents/channels/imessage/history.d.ts.map +1 -0
  136. package/dist/agents/channels/imessage/history.js +74 -0
  137. package/dist/agents/channels/imessage/history.js.map +1 -0
  138. package/dist/agents/channels/imessage/index.d.ts +25 -0
  139. package/dist/agents/channels/imessage/index.d.ts.map +1 -0
  140. package/dist/agents/channels/imessage/index.js +25 -0
  141. package/dist/agents/channels/imessage/index.js.map +1 -0
  142. package/dist/agents/channels/imessage/media.d.ts +92 -0
  143. package/dist/agents/channels/imessage/media.d.ts.map +1 -0
  144. package/dist/agents/channels/imessage/media.js +196 -0
  145. package/dist/agents/channels/imessage/media.js.map +1 -0
  146. package/dist/agents/channels/imessage/messaging.d.ts +14 -0
  147. package/dist/agents/channels/imessage/messaging.d.ts.map +1 -0
  148. package/dist/agents/channels/imessage/messaging.js +37 -0
  149. package/dist/agents/channels/imessage/messaging.js.map +1 -0
  150. package/dist/agents/channels/imessage/module.d.ts +16 -0
  151. package/dist/agents/channels/imessage/module.d.ts.map +1 -0
  152. package/dist/agents/channels/imessage/module.js +23 -0
  153. package/dist/agents/channels/imessage/module.js.map +1 -0
  154. package/dist/agents/channels/imessage/monitor.d.ts +207 -0
  155. package/dist/agents/channels/imessage/monitor.d.ts.map +1 -0
  156. package/dist/agents/channels/imessage/monitor.js +504 -0
  157. package/dist/agents/channels/imessage/monitor.js.map +1 -0
  158. package/dist/agents/channels/imessage/plugin.d.ts +53 -0
  159. package/dist/agents/channels/imessage/plugin.d.ts.map +1 -0
  160. package/dist/agents/channels/imessage/plugin.js +215 -0
  161. package/dist/agents/channels/imessage/plugin.js.map +1 -0
  162. package/dist/agents/channels/imessage/probe.d.ts +68 -0
  163. package/dist/agents/channels/imessage/probe.d.ts.map +1 -0
  164. package/dist/agents/channels/imessage/probe.js +134 -0
  165. package/dist/agents/channels/imessage/probe.js.map +1 -0
  166. package/dist/agents/channels/imessage/remote-attachments.d.ts +61 -0
  167. package/dist/agents/channels/imessage/remote-attachments.d.ts.map +1 -0
  168. package/dist/agents/channels/imessage/remote-attachments.js +131 -0
  169. package/dist/agents/channels/imessage/remote-attachments.js.map +1 -0
  170. package/dist/agents/channels/imessage/send.d.ts +61 -0
  171. package/dist/agents/channels/imessage/send.d.ts.map +1 -0
  172. package/dist/agents/channels/imessage/send.js +108 -0
  173. package/dist/agents/channels/imessage/send.js.map +1 -0
  174. package/dist/agents/channels/imessage/targets.d.ts +91 -0
  175. package/dist/agents/channels/imessage/targets.d.ts.map +1 -0
  176. package/dist/agents/channels/imessage/targets.js +245 -0
  177. package/dist/agents/channels/imessage/targets.js.map +1 -0
  178. package/dist/agents/channels/imessage/watch-error.d.ts +23 -0
  179. package/dist/agents/channels/imessage/watch-error.d.ts.map +1 -0
  180. package/dist/agents/channels/imessage/watch-error.js +69 -0
  181. package/dist/agents/channels/imessage/watch-error.js.map +1 -0
  182. package/dist/agents/channels/inbound-pipeline.d.ts +11 -0
  183. package/dist/agents/channels/inbound-pipeline.d.ts.map +1 -1
  184. package/dist/agents/channels/inbound-pipeline.js +20 -1
  185. package/dist/agents/channels/inbound-pipeline.js.map +1 -1
  186. package/dist/agents/channels/manager.d.ts +9 -0
  187. package/dist/agents/channels/manager.d.ts.map +1 -1
  188. package/dist/agents/channels/manager.js.map +1 -1
  189. package/dist/agents/channels/sdk.d.ts +4 -0
  190. package/dist/agents/channels/sdk.d.ts.map +1 -1
  191. package/dist/agents/channels/sdk.js +4 -0
  192. package/dist/agents/channels/sdk.js.map +1 -1
  193. package/dist/agents/extensions/modules/index.d.ts.map +1 -1
  194. package/dist/agents/extensions/modules/index.js +12 -0
  195. package/dist/agents/extensions/modules/index.js.map +1 -1
  196. package/dist/agents/session-wiring.d.ts +31 -0
  197. package/dist/agents/session-wiring.d.ts.map +1 -1
  198. package/dist/agents/session-wiring.js +45 -2
  199. package/dist/agents/session-wiring.js.map +1 -1
  200. package/dist/agents/tools/bluebubbles-action-tool.d.ts +66 -0
  201. package/dist/agents/tools/bluebubbles-action-tool.d.ts.map +1 -0
  202. package/dist/agents/tools/bluebubbles-action-tool.js +234 -0
  203. package/dist/agents/tools/bluebubbles-action-tool.js.map +1 -0
  204. package/dist/agents/tools/registry.d.ts.map +1 -1
  205. package/dist/agents/tools/registry.js +18 -0
  206. package/dist/agents/tools/registry.js.map +1 -1
  207. package/dist/buildstamp.json +1 -1
  208. package/dist/cli/commands/expose.d.ts +40 -0
  209. package/dist/cli/commands/expose.d.ts.map +1 -0
  210. package/dist/cli/commands/expose.js +200 -0
  211. package/dist/cli/commands/expose.js.map +1 -0
  212. package/dist/cli/program/build-program.d.ts.map +1 -1
  213. package/dist/cli/program/build-program.js +61 -0
  214. package/dist/cli/program/build-program.js.map +1 -1
  215. package/dist/config/io.d.ts +41 -0
  216. package/dist/config/io.d.ts.map +1 -1
  217. package/dist/config/io.js.map +1 -1
  218. package/dist/core/server.d.ts.map +1 -1
  219. package/dist/core/server.js +48 -2
  220. package/dist/core/server.js.map +1 -1
  221. package/dist/core/tunnel/auth-proxy.d.ts +55 -0
  222. package/dist/core/tunnel/auth-proxy.d.ts.map +1 -0
  223. package/dist/core/tunnel/auth-proxy.js +179 -0
  224. package/dist/core/tunnel/auth-proxy.js.map +1 -0
  225. package/dist/core/tunnel/manager.d.ts +42 -0
  226. package/dist/core/tunnel/manager.d.ts.map +1 -0
  227. package/dist/core/tunnel/manager.js +102 -0
  228. package/dist/core/tunnel/manager.js.map +1 -0
  229. package/dist/core/tunnel/providers/bore.d.ts +18 -0
  230. package/dist/core/tunnel/providers/bore.d.ts.map +1 -0
  231. package/dist/core/tunnel/providers/bore.js +117 -0
  232. package/dist/core/tunnel/providers/bore.js.map +1 -0
  233. package/dist/core/tunnel/providers/cloudflared.d.ts +24 -0
  234. package/dist/core/tunnel/providers/cloudflared.d.ts.map +1 -0
  235. package/dist/core/tunnel/providers/cloudflared.js +179 -0
  236. package/dist/core/tunnel/providers/cloudflared.js.map +1 -0
  237. package/dist/core/tunnel/providers/custom.d.ts +21 -0
  238. package/dist/core/tunnel/providers/custom.d.ts.map +1 -0
  239. package/dist/core/tunnel/providers/custom.js +124 -0
  240. package/dist/core/tunnel/providers/custom.js.map +1 -0
  241. package/dist/core/tunnel/registry.d.ts +15 -0
  242. package/dist/core/tunnel/registry.d.ts.map +1 -0
  243. package/dist/core/tunnel/registry.js +26 -0
  244. package/dist/core/tunnel/registry.js.map +1 -0
  245. package/dist/core/tunnel/state.d.ts +39 -0
  246. package/dist/core/tunnel/state.d.ts.map +1 -0
  247. package/dist/core/tunnel/state.js +57 -0
  248. package/dist/core/tunnel/state.js.map +1 -0
  249. package/dist/core/tunnel/types.d.ts +61 -0
  250. package/dist/core/tunnel/types.d.ts.map +1 -0
  251. package/dist/core/tunnel/types.js +20 -0
  252. package/dist/core/tunnel/types.js.map +1 -0
  253. package/dist/infra/net/fetch-guard.d.ts +24 -2
  254. package/dist/infra/net/fetch-guard.d.ts.map +1 -1
  255. package/dist/infra/net/fetch-guard.js +78 -31
  256. package/dist/infra/net/fetch-guard.js.map +1 -1
  257. package/package.json +5 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send.js","sourceRoot":"","sources":["../../../../src/agents/channels/bluebubb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AAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACpB,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,6BAA6B,EAAE,MAAM,CAAC,sBAAsB,IAAI,cAAc,MAAM,CAAC,aAAa,EAAE;YACpG,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,CAAC;SAChC,CAAC;KACF,EACD,SAAS,CAAC,IAAI,CAAC,CACf,CAAC;IACF,MAAM,mBAAmB,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;AAChD,CAAC;AAED,wFAAwF;AACxF,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC7C,IAAyB,EACzB,MAAmD;IAEnD,IAAI,IAAI,CAAC,iBAAiB,KAAK,KAAK,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAC;IACpG,CAAC;IACD,MAAM,GAAG,GAAG,sBAAsB,CAAC;QAClC,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,IAAI,EAAE,WAAW,kBAAkB,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS;QAChE,QAAQ,EAAE,IAAI,CAAC,QAAQ;KACvB,CAAC,CAAC;IACH,MAAM,GAAG,GAAG,MAAM,2BAA2B,CAC5C,GAAG,EACH;QACC,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,CAAC,EAAE,CAAC;KAC1D,EACD,SAAS,CAAC,IAAI,CAAC,CACf,CAAC;IACF,MAAM,mBAAmB,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;AAClD,CAAC"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * BlueBubbles structured status-issues — the diagnostics the central status
3
+ * surface renders (`collectStatusIssues` on the plugin's status adapter).
4
+ *
5
+ * Three issue families, each carrying a concrete FIX hint:
6
+ * - `not-configured` — serverUrl + password aren't both resolvable.
7
+ * - `unreachable` — the server/info probe failed (server down / bad URL /
8
+ * wrong password).
9
+ * - `private-api-off` — the server is reachable but the Private API is OFF, so
10
+ * reactions / edit / unsend / typing / group-admin can't run.
11
+ *
12
+ * The RICH shape (`{ channel, accountId, kind, message, fix }`) is what callers
13
+ * that want the detail read; `toChannelStatusIssues` maps it onto the central
14
+ * `{ accountId, severity, message }` rows the rollup view + `brigade doctor`
15
+ * already render, so BlueBubbles health shows up alongside the other channels.
16
+ */
17
+ import type { ChannelAccountSnapshot, ChannelStatusIssue } from "../sdk.js";
18
+ /** The structured issue kinds BlueBubbles surfaces. */
19
+ export type BlueBubblesStatusIssueKind = "not-configured" | "unreachable" | "private-api-off";
20
+ /** A rich, structured BlueBubbles status issue. */
21
+ export interface BlueBubblesStatusIssue {
22
+ /** Always `"bluebubbles"`. */
23
+ channel: string;
24
+ /** The account the issue is about. */
25
+ accountId: string;
26
+ /** The issue family. */
27
+ kind: BlueBubblesStatusIssueKind;
28
+ /** Operator-facing description. */
29
+ message: string;
30
+ /** A concrete remediation hint. */
31
+ fix: string;
32
+ }
33
+ /** The per-account diagnostics `collectBlueBubblesStatusIssues` reads. */
34
+ export interface BlueBubblesStatusAccount {
35
+ accountId: string;
36
+ /** serverUrl + password both resolvable? */
37
+ configured: boolean;
38
+ /** server/info probe reachable? (undefined → not probed). */
39
+ reachable?: boolean;
40
+ /** Private-API status from the probe — true/false/null (unknown). */
41
+ privateApi?: boolean | null;
42
+ }
43
+ /**
44
+ * Derive the structured issues for one or more BlueBubbles accounts. A fully
45
+ * configured + reachable + Private-API-on account contributes nothing. Pure +
46
+ * total — given the diagnostics, it derives the rows; no I/O of its own.
47
+ */
48
+ export declare function collectBlueBubblesStatusIssues(accounts: BlueBubblesStatusAccount[]): BlueBubblesStatusIssue[];
49
+ /** Map the rich BlueBubbles issues onto the central `ChannelStatusIssue[]` rows. */
50
+ export declare function toChannelStatusIssues(issues: BlueBubblesStatusIssue[]): ChannelStatusIssue[];
51
+ /**
52
+ * Read the BlueBubbles diagnostics off an open-shaped account snapshot. The
53
+ * plugin's `buildAccountSnapshot` stamps `configured` / `reachable` /
54
+ * `privateApi`; this reads them back defensively for `collectStatusIssues`.
55
+ */
56
+ export declare function statusAccountFromSnapshot(snapshot: ChannelAccountSnapshot): BlueBubblesStatusAccount;
57
+ //# sourceMappingURL=status-issues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-issues.d.ts","sourceRoot":"","sources":["../../../../src/agents/channels/bluebubbles/status-issues.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAG5E,uDAAuD;AACvD,MAAM,MAAM,0BAA0B,GAAG,gBAAgB,GAAG,aAAa,GAAG,iBAAiB,CAAC;AAE9F,mDAAmD;AACnD,MAAM,WAAW,sBAAsB;IACtC,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,IAAI,EAAE,0BAA0B,CAAC;IACjC,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAC;CACZ;AAED,0EAA0E;AAC1E,MAAM,WAAW,wBAAwB;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,UAAU,EAAE,OAAO,CAAC;IACpB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qEAAqE;IACrE,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC5B;AAgBD;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,wBAAwB,EAAE,GAAG,sBAAsB,EAAE,CAuC7G;AAED,oFAAoF;AACpF,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,sBAAsB,EAAE,GAAG,kBAAkB,EAAE,CAE5F;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,sBAAsB,GAAG,wBAAwB,CASpG"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * BlueBubbles structured status-issues — the diagnostics the central status
3
+ * surface renders (`collectStatusIssues` on the plugin's status adapter).
4
+ *
5
+ * Three issue families, each carrying a concrete FIX hint:
6
+ * - `not-configured` — serverUrl + password aren't both resolvable.
7
+ * - `unreachable` — the server/info probe failed (server down / bad URL /
8
+ * wrong password).
9
+ * - `private-api-off` — the server is reachable but the Private API is OFF, so
10
+ * reactions / edit / unsend / typing / group-admin can't run.
11
+ *
12
+ * The RICH shape (`{ channel, accountId, kind, message, fix }`) is what callers
13
+ * that want the detail read; `toChannelStatusIssues` maps it onto the central
14
+ * `{ accountId, severity, message }` rows the rollup view + `brigade doctor`
15
+ * already render, so BlueBubbles health shows up alongside the other channels.
16
+ */
17
+ import { BLUEBUBBLES_CHANNEL_ID } from "./account-config.js";
18
+ /** Map a rich issue's kind to the central severity. */
19
+ function severityFor(kind) {
20
+ switch (kind) {
21
+ case "not-configured":
22
+ return "warn";
23
+ case "unreachable":
24
+ return "error";
25
+ case "private-api-off":
26
+ return "warn";
27
+ default:
28
+ return "warn";
29
+ }
30
+ }
31
+ /**
32
+ * Derive the structured issues for one or more BlueBubbles accounts. A fully
33
+ * configured + reachable + Private-API-on account contributes nothing. Pure +
34
+ * total — given the diagnostics, it derives the rows; no I/O of its own.
35
+ */
36
+ export function collectBlueBubblesStatusIssues(accounts) {
37
+ const issues = [];
38
+ for (const acc of accounts ?? []) {
39
+ const accountId = (acc?.accountId ?? "").trim();
40
+ if (!accountId)
41
+ continue;
42
+ if (!acc.configured) {
43
+ issues.push({
44
+ channel: BLUEBUBBLES_CHANNEL_ID,
45
+ accountId,
46
+ kind: "not-configured",
47
+ message: "BlueBubbles is not fully configured (serverUrl + password).",
48
+ fix: "Set channels.bluebubbles.serverUrl + password (or run `brigade channels add bluebubbles`).",
49
+ });
50
+ continue; // nothing else is meaningful until it's configured
51
+ }
52
+ if (acc.reachable === false) {
53
+ issues.push({
54
+ channel: BLUEBUBBLES_CHANNEL_ID,
55
+ accountId,
56
+ kind: "unreachable",
57
+ message: "BlueBubbles server/info probe failed — the server is unreachable or rejected the password.",
58
+ fix: "Check the BlueBubbles Server app is running, the serverUrl is reachable from the gateway host, and the password is correct.",
59
+ });
60
+ continue; // can't judge the Private API when unreachable
61
+ }
62
+ if (acc.privateApi === false) {
63
+ issues.push({
64
+ channel: BLUEBUBBLES_CHANNEL_ID,
65
+ accountId,
66
+ kind: "private-api-off",
67
+ message: "BlueBubbles Private API is disabled — reactions, edit, unsend, typing, and group admin can't run.",
68
+ fix: "Enable the Private API in the BlueBubbles Server app (Settings → Private API) and restart the server.",
69
+ });
70
+ }
71
+ }
72
+ return issues;
73
+ }
74
+ /** Map the rich BlueBubbles issues onto the central `ChannelStatusIssue[]` rows. */
75
+ export function toChannelStatusIssues(issues) {
76
+ return issues.map((i) => ({ accountId: i.accountId, severity: severityFor(i.kind), message: `${i.message} ${i.fix}` }));
77
+ }
78
+ /**
79
+ * Read the BlueBubbles diagnostics off an open-shaped account snapshot. The
80
+ * plugin's `buildAccountSnapshot` stamps `configured` / `reachable` /
81
+ * `privateApi`; this reads them back defensively for `collectStatusIssues`.
82
+ */
83
+ export function statusAccountFromSnapshot(snapshot) {
84
+ const rec = snapshot;
85
+ const privateApiRaw = rec.privateApi;
86
+ return {
87
+ accountId: (snapshot.id ?? "").trim(),
88
+ configured: rec.configured === true,
89
+ ...(typeof rec.reachable === "boolean" ? { reachable: rec.reachable } : {}),
90
+ ...(typeof privateApiRaw === "boolean" || privateApiRaw === null ? { privateApi: privateApiRaw } : {}),
91
+ };
92
+ }
93
+ //# sourceMappingURL=status-issues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-issues.js","sourceRoot":"","sources":["../../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bles authenticates EVERY REST call by the server password in the QUERY
5
+ * STRING (`?password=<urlencoded>`), NOT a header. `buildBlueBubblesApiUrl`
6
+ * assembles `${serverUrl}/api/v1/<path>?password=…` (the `URL` constructor
7
+ * URL-encodes the password automatically). `blueBubblesFetchWithTimeout` is the
8
+ * single network primitive every REST helper goes through — and it takes an
9
+ * INJECTABLE `fetch` so tests can mock the wire with zero network.
10
+ */
11
+ /** Default REST timeout (ms). Attachment uploads override to a longer value. */
12
+ export declare const BLUEBUBBLES_DEFAULT_TIMEOUT_MS = 10000;
13
+ /** The injectable fetch seam — production passes `fetch`; tests pass a mock. */
14
+ export type FetchLike = typeof fetch;
15
+ export { SsrfBlockedError } from "../../../infra/net/fetch-guard.js";
16
+ /**
17
+ * Build a BlueBubbles REST URL. `path` is the API path AFTER `/api/v1/`
18
+ * (e.g. `"message/text"`). The password rides in the query string (the wire's
19
+ * auth) and is URL-encoded by the `URL` builder. `query` adds extra params.
20
+ */
21
+ export declare function buildBlueBubblesApiUrl(params: {
22
+ serverUrl: string;
23
+ path: string;
24
+ password?: string;
25
+ query?: Record<string, string | number | undefined>;
26
+ }): string;
27
+ /**
28
+ * Fetch a BlueBubbles REST URL through Brigade's SSRF guard with a timeout.
29
+ *
30
+ * Every REST call goes through the guard: it re-checks the host on each redirect
31
+ * hop (so a redirect to `169.254.169.254` / `metadata.*` can't reach cloud
32
+ * metadata) and strips `Authorization`/`Cookie` on cross-origin redirects.
33
+ *
34
+ * A BlueBubbles server is almost always a LAN / private-IP host
35
+ * (`192.168.x.x`, `10.x.x.x`, `localhost`), so `allowPrivateNetwork` defaults to
36
+ * TRUE for this channel — but cloud-metadata stays blocked even then, so the
37
+ * guard still defends against the highest-value SSRF target. The operator can
38
+ * tighten it via `channels.bluebubbles.network.allowPrivate=false`.
39
+ *
40
+ * `fetchImpl` is the test seam (inject a mock); it is threaded into the guard so
41
+ * the SSRF classification still runs but the actual wire call is the mock.
42
+ */
43
+ export declare function blueBubblesFetchWithTimeout(url: string, init: RequestInit, opts?: {
44
+ timeoutMs?: number;
45
+ fetchImpl?: FetchLike;
46
+ allowPrivateNetwork?: boolean;
47
+ }): Promise<Response>;
48
+ /**
49
+ * Read a BlueBubbles JSON response, returning the `data` field (the API wraps
50
+ * payloads as `{ status, message, data }`). Throws an operator-facing error on a
51
+ * non-2xx response or a server-reported error. `context` names the call for the
52
+ * error message.
53
+ */
54
+ export declare function readBlueBubblesJson<T = unknown>(res: Response, context: string): Promise<T>;
55
+ /** The BlueBubbles `server/info` payload the probe + capability detection read. */
56
+ export interface BlueBubblesServerInfo {
57
+ /** macOS version of the host (`"14.4"`, `"26.0"`, …). */
58
+ os_version?: string;
59
+ /** BlueBubbles server version. */
60
+ server_version?: string;
61
+ /** Whether the Private API is enabled (gates reactions/edit/unsend/effects/groups). */
62
+ private_api?: boolean;
63
+ /** Whether the BlueBubbles helper bundle is connected. */
64
+ helper_connected?: boolean;
65
+ /** Proxy service in use (ngrok / cloudflare / …). */
66
+ proxy_service?: string;
67
+ [key: string]: unknown;
68
+ }
69
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/agents/channels/bluebubbles/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,gFAAgF;AAChF,eAAO,MAAM,8BAA8B,QAAS,CAAC;AAErD,gFAAgF;AAChF,MAAM,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC;AAErC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;CACpD,GAAG,MAAM,CAaT;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,2BAA2B,CAChD,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,WAAW,EACjB,IAAI,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAAO,GACrF,OAAO,CAAC,QAAQ,CAAC,CAcnB;AAsBD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAmBjG;AAED,mFAAmF;AACnF,MAAM,WAAW,qBAAqB;IACrC,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uFAAuF;IACvF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,0DAA0D;IAC1D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * BlueBubbles REST plumbing + shared transport types.
3
+ *
4
+ * BlueBubbles authenticates EVERY REST call by the server password in the QUERY
5
+ * STRING (`?password=<urlencoded>`), NOT a header. `buildBlueBubblesApiUrl`
6
+ * assembles `${serverUrl}/api/v1/<path>?password=…` (the `URL` constructor
7
+ * URL-encodes the password automatically). `blueBubblesFetchWithTimeout` is the
8
+ * single network primitive every REST helper goes through — and it takes an
9
+ * INJECTABLE `fetch` so tests can mock the wire with zero network.
10
+ */
11
+ import { guardedFetch } from "../../../infra/net/fetch-guard.js";
12
+ /** Default REST timeout (ms). Attachment uploads override to a longer value. */
13
+ export const BLUEBUBBLES_DEFAULT_TIMEOUT_MS = 10_000;
14
+ export { SsrfBlockedError } from "../../../infra/net/fetch-guard.js";
15
+ /**
16
+ * Build a BlueBubbles REST URL. `path` is the API path AFTER `/api/v1/`
17
+ * (e.g. `"message/text"`). The password rides in the query string (the wire's
18
+ * auth) and is URL-encoded by the `URL` builder. `query` adds extra params.
19
+ */
20
+ export function buildBlueBubblesApiUrl(params) {
21
+ const base = (params.serverUrl ?? "").trim().replace(/\/+$/, "");
22
+ if (!base)
23
+ throw new Error("BlueBubbles serverUrl is required");
24
+ const cleanPath = params.path.replace(/^\/+/, "");
25
+ const url = new URL(`/api/v1/${cleanPath}`, `${base}/`);
26
+ if (params.password)
27
+ url.searchParams.set("password", params.password);
28
+ if (params.query) {
29
+ for (const [k, v] of Object.entries(params.query)) {
30
+ if (v === undefined)
31
+ continue;
32
+ url.searchParams.set(k, String(v));
33
+ }
34
+ }
35
+ return url.toString();
36
+ }
37
+ /**
38
+ * Fetch a BlueBubbles REST URL through Brigade's SSRF guard with a timeout.
39
+ *
40
+ * Every REST call goes through the guard: it re-checks the host on each redirect
41
+ * hop (so a redirect to `169.254.169.254` / `metadata.*` can't reach cloud
42
+ * metadata) and strips `Authorization`/`Cookie` on cross-origin redirects.
43
+ *
44
+ * A BlueBubbles server is almost always a LAN / private-IP host
45
+ * (`192.168.x.x`, `10.x.x.x`, `localhost`), so `allowPrivateNetwork` defaults to
46
+ * TRUE for this channel — but cloud-metadata stays blocked even then, so the
47
+ * guard still defends against the highest-value SSRF target. The operator can
48
+ * tighten it via `channels.bluebubbles.network.allowPrivate=false`.
49
+ *
50
+ * `fetchImpl` is the test seam (inject a mock); it is threaded into the guard so
51
+ * the SSRF classification still runs but the actual wire call is the mock.
52
+ */
53
+ export async function blueBubblesFetchWithTimeout(url, init, opts = {}) {
54
+ const timeoutMs = opts.timeoutMs ?? BLUEBUBBLES_DEFAULT_TIMEOUT_MS;
55
+ const headers = headersToRecord(init.headers);
56
+ const { response } = await guardedFetch(url, {
57
+ method: init.method ?? "GET",
58
+ ...(Object.keys(headers).length > 0 ? { headers } : {}),
59
+ ...(init.body !== undefined && init.body !== null ? { body: init.body } : {}),
60
+ timeoutMs,
61
+ // LAN servers are the norm for BlueBubbles; default-allow private but keep
62
+ // cloud-metadata blocked. The operator may flip this off per account.
63
+ allowPrivateNetwork: opts.allowPrivateNetwork !== false,
64
+ ...(opts.fetchImpl ? { fetchImpl: opts.fetchImpl } : {}),
65
+ });
66
+ return response;
67
+ }
68
+ /** Coerce a fetch headers init to a plain record for the guard's option shape. */
69
+ function headersToRecord(h) {
70
+ const out = {};
71
+ if (!h)
72
+ return out;
73
+ if (typeof Headers !== "undefined" && h instanceof Headers) {
74
+ h.forEach((v, k) => {
75
+ out[k] = v;
76
+ });
77
+ }
78
+ else if (Array.isArray(h)) {
79
+ for (const pair of h) {
80
+ const k = pair[0];
81
+ const v = pair[1];
82
+ if (k)
83
+ out[k] = String(v ?? "");
84
+ }
85
+ }
86
+ else {
87
+ for (const [k, v] of Object.entries(h))
88
+ out[k] = String(v ?? "");
89
+ }
90
+ return out;
91
+ }
92
+ /**
93
+ * Read a BlueBubbles JSON response, returning the `data` field (the API wraps
94
+ * payloads as `{ status, message, data }`). Throws an operator-facing error on a
95
+ * non-2xx response or a server-reported error. `context` names the call for the
96
+ * error message.
97
+ */
98
+ export async function readBlueBubblesJson(res, context) {
99
+ let body = null;
100
+ const text = await res.text();
101
+ if (text) {
102
+ try {
103
+ body = JSON.parse(text);
104
+ }
105
+ catch {
106
+ body = null;
107
+ }
108
+ }
109
+ const record = (body && typeof body === "object" ? body : {});
110
+ if (!res.ok) {
111
+ const msg = (typeof record.message === "string" && record.message) ||
112
+ (typeof record.error === "string" && record.error) ||
113
+ `HTTP ${res.status}`;
114
+ throw new Error(`BlueBubbles ${context} failed: ${msg}`);
115
+ }
116
+ return record.data;
117
+ }
118
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/agents/channels/bluebubbles/types.ts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AI,MAAM,CAAC,KAAK,CAAC;YAClD,QAAQ,GAAG,CAAC,MAAM,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,eAAe,OAAO,YAAY,GAAG,EAAE,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,MAAM,CAAC,IAAS,CAAC;AACzB,CAAC"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * BlueBubbles inbound gateway route.
3
+ *
4
+ * BlueBubbles POSTs each event to a Brigade gateway HTTP route. Because a
5
+ * BlueBubbles webhook CANNOT send custom headers, the server PASSWORD is embedded
6
+ * in the registered webhook URL's QUERY STRING (`?password=…` / `?guid=…`) and
7
+ * verified on each inbound POST. (Some BlueBubbles versions also send the token
8
+ * as a header — those are accepted too.) Verification happens FIRST, before the
9
+ * body is parsed / routed, so a forged event can't reach the agent.
10
+ *
11
+ * Mirrors `slack/webhook.ts` (the webhook-ingress blueprint): build an
12
+ * `HttpRoute`, register it via `b.httpRoute(...)` from the module, resolve the
13
+ * started adapter (`resolveSink`) at REQUEST time (late binding — the route is
14
+ * registered before the plugin starts accounts), always reply 200 so BlueBubbles
15
+ * doesn't retry-storm.
16
+ */
17
+ import type { HttpRoute } from "../sdk.js";
18
+ /** Default fixed-window rate-limit: max authenticated requests per window. */
19
+ export declare const WEBHOOK_RATE_LIMIT_MAX = 240;
20
+ /** Default fixed-window length (ms). 240 req / 10s ≈ 24 rps sustained per account. */
21
+ export declare const WEBHOOK_RATE_LIMIT_WINDOW_MS = 10000;
22
+ /** Default bound on concurrently in-flight handler bodies (normalize/dedupe/dispatch). */
23
+ export declare const WEBHOOK_MAX_IN_FLIGHT = 32;
24
+ /**
25
+ * A fixed-window request rate-limiter. `hit()` records one request against the
26
+ * current window and returns whether it is WITHIN the limit. The window resets
27
+ * lazily on the first hit after it elapses (no timers held). Self-contained so
28
+ * the webhook route can bound a replay-storm / hostile sender on the `auth:none`
29
+ * path without a central dependency.
30
+ */
31
+ export interface FixedWindowRateLimiter {
32
+ /** Record a request; returns true when it is allowed (within the window's cap). */
33
+ hit(nowMs?: number): boolean;
34
+ }
35
+ /** Build a fixed-window rate limiter (`max` requests per `windowMs`). */
36
+ export declare function createFixedWindowRateLimiter(max: number, windowMs: number): FixedWindowRateLimiter;
37
+ /**
38
+ * A bounded concurrency gate. `tryAcquire()` reserves a slot (returns a release
39
+ * fn) or returns null when the cap is already reached. The handler releases its
40
+ * slot in a `finally` so a thrown handler can't leak the count.
41
+ */
42
+ export interface InFlightLimiter {
43
+ tryAcquire(): (() => void) | null;
44
+ inFlight(): number;
45
+ }
46
+ /** Build an in-flight concurrency limiter capped at `max` simultaneous holders. */
47
+ export declare function createInFlightLimiter(max: number): InFlightLimiter;
48
+ /** Constant-time compare of two strings — avoids leaking via timing. */
49
+ export declare function safeEqualToken(a: string, b: string): boolean;
50
+ /**
51
+ * Verify a BlueBubbles webhook request's password. The supplied token comes from
52
+ * the URL query (`password` / `guid`) or, when present, a header. When
53
+ * `expectedPassword` is empty the check is SKIPPED (returns true) — the operator
54
+ * opted out (not recommended). Returns false when a password is configured but
55
+ * the supplied one is missing / wrong.
56
+ */
57
+ export declare function verifyBlueBubblesWebhook(args: {
58
+ expectedPassword: string;
59
+ suppliedToken: string | undefined;
60
+ }): boolean;
61
+ /**
62
+ * Parse the request body. BlueBubbles delivers JSON; a form-encoded fallback
63
+ * (some proxy setups) carries the JSON under a `payload`/`data` field.
64
+ */
65
+ export declare function parseBlueBubblesBody(rawBody: string, contentType: string): {
66
+ type?: string;
67
+ payload: unknown;
68
+ } | null;
69
+ /** The minimal adapter surface the webhook route drives. */
70
+ export interface BlueBubblesWebhookSink {
71
+ /** Feed a parsed BlueBubbles webhook event into the inbound path. */
72
+ feedWebhookEvent(eventType: string | undefined, payload: unknown): void;
73
+ }
74
+ export interface BuildBlueBubblesWebhookRouteArgs {
75
+ /** The gateway route path (e.g. `/bluebubbles/webhook`). */
76
+ path: string;
77
+ /** The configured server password (`""` → no auth check). */
78
+ password: string;
79
+ /** Resolve the started adapter to feed events into (null when not started). */
80
+ resolveSink: () => BlueBubblesWebhookSink | null;
81
+ /** Logger. */
82
+ log?: (msg: string, meta?: Record<string, unknown>) => void;
83
+ /** Max authenticated requests per window before throttling (default {@link WEBHOOK_RATE_LIMIT_MAX}). */
84
+ rateLimitMax?: number;
85
+ /** Fixed-window length in ms (default {@link WEBHOOK_RATE_LIMIT_WINDOW_MS}). */
86
+ rateLimitWindowMs?: number;
87
+ /** Max concurrently in-flight handler bodies (default {@link WEBHOOK_MAX_IN_FLIGHT}). */
88
+ maxInFlight?: number;
89
+ /** TEST SEAM — inject the clock used by the rate limiter. */
90
+ now?: () => number;
91
+ }
92
+ /**
93
+ * Build the Brigade `HttpRoute` for the BlueBubbles webhook. Register it via
94
+ * `b.httpRoute(...)` from the module.
95
+ */
96
+ export declare function buildBlueBubblesWebhookRoute(args: BuildBlueBubblesWebhookRouteArgs): HttpRoute;
97
+ //# sourceMappingURL=webhook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../../src/agents/channels/bluebubbles/webhook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAK3C,8EAA8E;AAC9E,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,sFAAsF;AACtF,eAAO,MAAM,4BAA4B,QAAS,CAAC;AACnD,0FAA0F;AAC1F,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACtC,mFAAmF;IACnF,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC7B;AAED,yEAAyE;AACzE,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,sBAAsB,CAelG;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B,UAAU,IA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