@openclaw/matrix 2026.7.2-beta.5 → 2026.7.33

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 (1206) hide show
  1. package/README.md +1 -1
  2. package/dist/.setup/account-selection-BOQeTqax.mjs +159 -0
  3. package/dist/.setup/approval-handler.runtime-CEXm9_-p.mjs +378 -0
  4. package/dist/.setup/approval-ids-DdFnDB3h.mjs +7 -0
  5. package/dist/.setup/approval-reaction-auth-CREvd7S7.mjs +27 -0
  6. package/dist/.setup/approval-reactions-Cltyp8nL.mjs +113 -0
  7. package/dist/.setup/async-lock-BcLS4KOc.mjs +19 -0
  8. package/dist/.setup/channel-an4umty1.mjs +1387 -0
  9. package/dist/.setup/channel.runtime-GHcIBJ7H.mjs +258 -0
  10. package/dist/.setup/cli-B3WYmv5U.mjs +1347 -0
  11. package/dist/.setup/cli-metadata-RUKCn0wJ.mjs +22 -0
  12. package/dist/.setup/client-Ct0bUHCo.mjs +25 -0
  13. package/dist/.setup/client-DFBQtzCe.mjs +916 -0
  14. package/dist/.setup/client-bootstrap-Be8jvNle.mjs +74 -0
  15. package/dist/.setup/config-schema-D9J_vUF6.mjs +321 -0
  16. package/dist/.setup/credentials-BhZlA0kL.mjs +56 -0
  17. package/dist/.setup/credentials-read-CRHg6XPm.mjs +114 -0
  18. package/dist/.setup/credentials-write.runtime-dWuLafsk.mjs +14 -0
  19. package/dist/.setup/crypto-runtime-D-cZa8P0.mjs +1184 -0
  20. package/dist/.setup/crypto-state-store-B43k3z3W.mjs +352 -0
  21. package/dist/.setup/deps-Dy6yreL4.mjs +236 -0
  22. package/dist/.setup/device-health-D4LBxuPq.mjs +16 -0
  23. package/dist/.setup/directory-live-BTEYxMwy.mjs +151 -0
  24. package/dist/.setup/doctor-BGnvMzOR.mjs +169 -0
  25. package/dist/.setup/doctor-contract-DNJw0fdq.mjs +246 -0
  26. package/dist/.setup/draft-stream-C-_OhpE8.mjs +146 -0
  27. package/dist/.setup/encryption-guidance-CpuuwmjL.mjs +16 -0
  28. package/dist/.setup/env-auth-CYJL1jNl.mjs +63 -0
  29. package/dist/.setup/env-vars-KzaYveuy.mjs +63 -0
  30. package/dist/.setup/exec-approval-resolver-f9j6staN.mjs +15 -0
  31. package/dist/.setup/file-sync-store-DU0cnYAz.mjs +420 -0
  32. package/dist/.setup/http-client-C954In2D.mjs +390 -0
  33. package/dist/.setup/idb-persistence-_HKTXkVC.mjs +230 -0
  34. package/dist/.setup/idb-persistence-lock-B3fZXyF_.mjs +32 -0
  35. package/dist/.setup/legacy-crypto-inspector-Byp8LCys.mjs +42 -0
  36. package/dist/.setup/legacy-crypto-restore-YQVoK1B2.mjs +93 -0
  37. package/dist/.setup/logger-DpoogOgz.mjs +78 -0
  38. package/dist/.setup/logging-CgxQOJJP.mjs +92 -0
  39. package/dist/.setup/matrix-migration.runtime-BDH5c3fN.mjs +530 -0
  40. package/dist/.setup/media-text-Cib-dxkn.mjs +146 -0
  41. package/dist/.setup/messages-D4DYGHYX.mjs +202 -0
  42. package/dist/.setup/migration-snapshot-backup-CpgYhiUp.mjs +70 -0
  43. package/dist/.setup/migration-snapshot.runtime-O8qkMVaC.mjs +2 -0
  44. package/dist/.setup/monitor-DNcW_oAN.mjs +4945 -0
  45. package/dist/.setup/probe.runtime-CMPh0mFk.mjs +2 -0
  46. package/dist/.setup/profile-update-DzOL3Wiw.mjs +69 -0
  47. package/dist/.setup/reaction-events-BcvgXxHb.mjs +114 -0
  48. package/dist/.setup/resolve-targets-Bq80X9Sn.mjs +140 -0
  49. package/dist/.setup/resolver.runtime-CeBHR9-T.mjs +5 -0
  50. package/dist/.setup/runtime-api-CEsWNdil.mjs +21 -0
  51. package/dist/.setup/runtime-setter-api-DGMubGUq.mjs +3 -0
  52. package/dist/.setup/sdk-He1quVAq.mjs +1604 -0
  53. package/dist/.setup/secret-contract-api-CiTJ7pd5.mjs +3 -0
  54. package/dist/.setup/secret-contract-phPvlNfV.mjs +120 -0
  55. package/dist/.setup/send-CGgl0uTn.mjs +1550 -0
  56. package/dist/.setup/setup-bootstrap-DUXBC8X2.mjs +62 -0
  57. package/dist/.setup/setup-core-bhdcEo7v.mjs +699 -0
  58. package/dist/.setup/setup-plugin-api-CAwZ_Bi7.mjs +43 -0
  59. package/dist/.setup/setup-plugin-api-DIFVsOs3.mjs +2 -0
  60. package/dist/.setup/setup-surface-05_G-MnT.mjs +544 -0
  61. package/dist/.setup/startup-verification-BTwIGu1J.mjs +233 -0
  62. package/dist/.setup/storage-NGZq5zet.mjs +432 -0
  63. package/dist/.setup/storage-paths-BWo_ZEMC.mjs +52 -0
  64. package/dist/.setup/subagent-hooks-BSWPJEmo.mjs +143 -0
  65. package/dist/.setup/thread-binding-api-B7UaOoKv.mjs +17 -0
  66. package/dist/.setup/thread-bindings-DqmjG2on.mjs +436 -0
  67. package/dist/.setup/tool-actions.runtime-CXDLk2jg.mjs +601 -0
  68. package/dist/.setup/verification-DeWOtZJr.mjs +346 -0
  69. package/dist/api.js +9 -9
  70. package/dist/auth-presence.js +21 -13
  71. package/dist/channel-plugin-api.js +1 -1
  72. package/dist/cli-metadata.js +1 -1
  73. package/dist/contract-api.js +2 -2
  74. package/dist/doctor-contract-api.js +99 -524
  75. package/dist/helper-api.js +4 -4
  76. package/dist/index.js +1 -1
  77. package/dist/plugin-entry.handlers.runtime.js +2 -2
  78. package/dist/runtime-api.js +8 -8
  79. package/dist/runtime-heavy-api.js +3 -0
  80. package/dist/runtime-setter-api.js +1 -1
  81. package/dist/secret-contract-api.js +1 -1
  82. package/dist/session-binding-contract-api.js +3 -3
  83. package/dist/setup-entry.js +4 -3
  84. package/dist/setup-plugin-api.js +1 -43
  85. package/dist/subagent-hooks-api.js +1 -1
  86. package/dist/thread-binding-api.js +1 -1
  87. package/dist/thread-bindings-runtime.js +1 -1
  88. package/node_modules/markdown-it/README.md +18 -294
  89. package/node_modules/markdown-it/bin/markdown-it.mjs +2 -2
  90. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs +3013 -0
  91. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs.map +1 -0
  92. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js +14 -0
  93. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js.map +1 -0
  94. package/node_modules/markdown-it/dist/markdown-it.cjs.js +4420 -0
  95. package/node_modules/markdown-it/dist/markdown-it.cjs.js.map +1 -0
  96. package/node_modules/markdown-it/dist/markdown-it.d.cts +19 -0
  97. package/node_modules/markdown-it/dist/markdown-it.d.mts +950 -0
  98. package/node_modules/markdown-it/dist/markdown-it.mjs +3880 -0
  99. package/node_modules/markdown-it/dist/markdown-it.mjs.map +1 -0
  100. package/node_modules/markdown-it/node_modules/argparse/LICENSE +47 -0
  101. package/node_modules/markdown-it/node_modules/argparse/README.md +89 -0
  102. package/node_modules/markdown-it/node_modules/argparse/lib/_colorize.js +72 -0
  103. package/node_modules/markdown-it/node_modules/argparse/lib/argparse.d.ts +292 -0
  104. package/node_modules/markdown-it/node_modules/argparse/lib/argparse.js +3820 -0
  105. package/node_modules/markdown-it/node_modules/argparse/lib/difflib.js +190 -0
  106. package/node_modules/markdown-it/node_modules/argparse/lib/sub.js +67 -0
  107. package/node_modules/markdown-it/node_modules/argparse/lib/textwrap.js +440 -0
  108. package/node_modules/markdown-it/node_modules/argparse/package.json +38 -0
  109. package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.d.ts +8 -0
  110. package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.d.ts.map +1 -0
  111. package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.js +46 -0
  112. package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.js.map +1 -0
  113. package/node_modules/markdown-it/node_modules/entities/dist/decode.d.ts +194 -0
  114. package/node_modules/markdown-it/node_modules/entities/dist/decode.d.ts.map +1 -0
  115. package/node_modules/markdown-it/node_modules/entities/dist/decode.js +544 -0
  116. package/node_modules/markdown-it/node_modules/entities/dist/decode.js.map +1 -0
  117. package/node_modules/markdown-it/node_modules/entities/dist/encode.d.ts +24 -0
  118. package/node_modules/markdown-it/node_modules/entities/dist/encode.d.ts.map +1 -0
  119. package/node_modules/markdown-it/node_modules/entities/dist/encode.js +90 -0
  120. package/node_modules/markdown-it/node_modules/entities/dist/encode.js.map +1 -0
  121. package/node_modules/markdown-it/node_modules/entities/dist/escape.d.ts +48 -0
  122. package/node_modules/markdown-it/node_modules/entities/dist/escape.d.ts.map +1 -0
  123. package/node_modules/markdown-it/node_modules/entities/dist/escape.js +132 -0
  124. package/node_modules/markdown-it/node_modules/entities/dist/escape.js.map +1 -0
  125. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.d.ts +3 -0
  126. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.d.ts.map +1 -0
  127. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.js +5 -0
  128. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.js.map +1 -0
  129. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.d.ts +3 -0
  130. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.d.ts.map +1 -0
  131. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.js +5 -0
  132. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.js.map +1 -0
  133. package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.d.ts +5 -0
  134. package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.d.ts.map +1 -0
  135. package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.js +12 -0
  136. package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.js.map +1 -0
  137. package/node_modules/markdown-it/node_modules/entities/dist/index.d.ts +89 -0
  138. package/node_modules/markdown-it/node_modules/entities/dist/index.d.ts.map +1 -0
  139. package/node_modules/markdown-it/node_modules/entities/dist/index.js +91 -0
  140. package/node_modules/markdown-it/node_modules/entities/dist/index.js.map +1 -0
  141. package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.d.ts +17 -0
  142. package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.d.ts.map +1 -0
  143. package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.js +18 -0
  144. package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.js.map +1 -0
  145. package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.d.ts +7 -0
  146. package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.d.ts.map +1 -0
  147. package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.js +17 -0
  148. package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.js.map +1 -0
  149. package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.d.ts +33 -0
  150. package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.d.ts.map +1 -0
  151. package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.js +93 -0
  152. package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.js.map +1 -0
  153. package/node_modules/markdown-it/node_modules/entities/package.json +83 -0
  154. package/node_modules/markdown-it/node_modules/entities/readme.md +131 -0
  155. package/node_modules/markdown-it/node_modules/entities/src/decode-codepoint.ts +50 -0
  156. package/node_modules/markdown-it/node_modules/entities/src/decode.ts +671 -0
  157. package/node_modules/markdown-it/node_modules/entities/src/encode.ts +95 -0
  158. package/node_modules/markdown-it/node_modules/entities/src/escape.ts +160 -0
  159. package/node_modules/markdown-it/node_modules/entities/src/generated/decode-data-html.ts +7 -0
  160. package/node_modules/markdown-it/node_modules/entities/src/generated/decode-data-xml.ts +7 -0
  161. package/node_modules/markdown-it/node_modules/entities/src/generated/encode-html.ts +18 -0
  162. package/node_modules/markdown-it/node_modules/entities/src/index.ts +162 -0
  163. package/node_modules/markdown-it/node_modules/entities/src/internal/bin-trie-flags.ts +16 -0
  164. package/node_modules/markdown-it/node_modules/entities/src/internal/decode-shared.ts +18 -0
  165. package/node_modules/markdown-it/node_modules/entities/src/internal/encode-shared.ts +123 -0
  166. package/node_modules/markdown-it/node_modules/linkify-it/README.md +158 -0
  167. package/node_modules/markdown-it/node_modules/linkify-it/build/index.cjs.js +651 -0
  168. package/node_modules/markdown-it/node_modules/linkify-it/build/index.cjs.js.map +1 -0
  169. package/node_modules/markdown-it/node_modules/linkify-it/build/index.d.ts +236 -0
  170. package/node_modules/markdown-it/node_modules/linkify-it/build/index.mjs +538 -0
  171. package/node_modules/markdown-it/node_modules/linkify-it/build/index.mjs.map +1 -0
  172. package/node_modules/markdown-it/node_modules/linkify-it/package.json +66 -0
  173. package/node_modules/markdown-it/node_modules/mdurl/lib/index.d.ts +28 -0
  174. package/node_modules/markdown-it/node_modules/mdurl/package.json +43 -0
  175. package/node_modules/markdown-it/node_modules/uc.micro/README.md +31 -0
  176. package/node_modules/markdown-it/node_modules/uc.micro/build/index.cjs.js +15 -0
  177. package/node_modules/markdown-it/node_modules/uc.micro/build/index.d.ts +6 -0
  178. package/node_modules/markdown-it/node_modules/uc.micro/build/index.mjs +8 -0
  179. package/node_modules/markdown-it/node_modules/uc.micro/package.json +32 -0
  180. package/node_modules/markdown-it/package.json +47 -30
  181. package/node_modules/music-metadata/lib/common/Util.d.ts +1 -1
  182. package/node_modules/music-metadata/lib/common/Util.js +1 -7
  183. package/node_modules/music-metadata/lib/id3v2/FrameHeader.js +3 -23
  184. package/node_modules/music-metadata/lib/id3v2/FrameParser.js +2 -2
  185. package/node_modules/music-metadata/lib/id3v2/ID3v2Token.js +1 -1
  186. package/node_modules/music-metadata/lib/mp4/AtomToken.js +13 -38
  187. package/node_modules/music-metadata/lib/mpeg/MpegParser.js +1 -1
  188. package/node_modules/music-metadata/node_modules/content-type/LICENSE +22 -0
  189. package/node_modules/music-metadata/node_modules/content-type/README.md +69 -0
  190. package/node_modules/music-metadata/node_modules/content-type/dist/index.d.ts +26 -0
  191. package/node_modules/music-metadata/node_modules/content-type/dist/index.js +170 -0
  192. package/node_modules/music-metadata/node_modules/content-type/dist/index.js.map +1 -0
  193. package/node_modules/music-metadata/node_modules/content-type/package.json +52 -0
  194. package/node_modules/music-metadata/node_modules/debug/LICENSE +20 -0
  195. package/node_modules/music-metadata/node_modules/debug/README.md +481 -0
  196. package/node_modules/music-metadata/node_modules/debug/package.json +64 -0
  197. package/node_modules/music-metadata/node_modules/debug/src/browser.js +272 -0
  198. package/node_modules/music-metadata/node_modules/debug/src/common.js +292 -0
  199. package/node_modules/music-metadata/node_modules/debug/src/index.js +10 -0
  200. package/node_modules/music-metadata/node_modules/debug/src/node.js +263 -0
  201. package/node_modules/music-metadata/node_modules/ms/index.js +162 -0
  202. package/node_modules/music-metadata/node_modules/ms/license.md +21 -0
  203. package/node_modules/music-metadata/node_modules/ms/package.json +38 -0
  204. package/node_modules/music-metadata/node_modules/ms/readme.md +59 -0
  205. package/node_modules/music-metadata/package.json +6 -6
  206. package/node_modules/typebox/build/compile/validator.d.mts +4 -1
  207. package/node_modules/typebox/build/guard/guard.d.mts +1 -1
  208. package/node_modules/typebox/build/guard/guard.mjs +2 -5
  209. package/node_modules/typebox/build/guard/string.mjs +4 -16
  210. package/node_modules/typebox/build/schema/engine/_functions.mjs +15 -34
  211. package/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
  212. package/node_modules/typebox/build/type/action/readonly_object.mjs +0 -8
  213. package/node_modules/typebox/build/typebox.d.mts +1 -1
  214. package/node_modules/typebox/build/typebox.mjs +1 -1
  215. package/node_modules/typebox/package.json +1 -1
  216. package/node_modules/typebox/readme.md +32 -29
  217. package/openclaw.plugin.json +145 -143
  218. package/package.json +30 -113
  219. package/dist/account-selection-kqquRzCf.js +0 -158
  220. package/dist/active-client-DXvz2gCo.js +0 -20
  221. package/dist/approval-handler.runtime-D1ibJgSk.js +0 -388
  222. package/dist/approval-ids-2OQj32-K.js +0 -7
  223. package/dist/approval-reaction-auth-CCAWWkbu.js +0 -27
  224. package/dist/approval-reactions-D-BxBK_L.js +0 -202
  225. package/dist/channel-Cmi248PA.js +0 -1344
  226. package/dist/channel.runtime-BaPXFRgT.js +0 -252
  227. package/dist/cli-0CNHkps5.js +0 -1365
  228. package/dist/cli-metadata-DnXxNCoj.js +0 -22
  229. package/dist/client-BFRg0kd4.js +0 -30
  230. package/dist/client-CitERujx.js +0 -25
  231. package/dist/client-bootstrap-CkAnkzB6.js +0 -110
  232. package/dist/config-schema-BShrVROw.js +0 -302
  233. package/dist/create-client-f-CkRllE.js +0 -61
  234. package/dist/credentials-W2EmwRhu.js +0 -65
  235. package/dist/credentials-read-DVmFCm7X.js +0 -77
  236. package/dist/credentials-write.runtime-Be9zNSUw.js +0 -14
  237. package/dist/crypto-runtime-D9_6J5tZ.js +0 -1138
  238. package/dist/deps-CcVJfvRM.js +0 -169
  239. package/dist/device-health-B4-YXtJR.js +0 -21
  240. package/dist/directory-live-YRgYDx2w.js +0 -150
  241. package/dist/doctor-CM8ijNpW.js +0 -64
  242. package/dist/doctor-contract-BMSJkkAE.js +0 -167
  243. package/dist/draft-stream-CIjafRr0.js +0 -146
  244. package/dist/encryption-guidance-CbEFe38F.js +0 -15
  245. package/dist/env-auth-CQsYbz-p.js +0 -63
  246. package/dist/env-vars-B0NxQnPk.js +0 -65
  247. package/dist/exec-approval-resolver-BCgqRtZS.js +0 -16
  248. package/dist/file-sync-store-DiiFsayX.js +0 -415
  249. package/dist/http-client-CycYxU9-.js +0 -370
  250. package/dist/idb-persistence-B6x7dMsF.js +0 -232
  251. package/dist/idb-persistence-lock-DAJ49nZX.js +0 -32
  252. package/dist/inbound-dedupe-CaBLblef.js +0 -48
  253. package/dist/logger-D0GCSDQq.js +0 -78
  254. package/dist/logging-DV-p52N0.js +0 -99
  255. package/dist/media-text-DlQC_k_K.js +0 -146
  256. package/dist/messages-Bf_s--M9.js +0 -202
  257. package/dist/monitor-s--XqoxF.js +0 -4653
  258. package/dist/probe.runtime-BJOvCHnZ.js +0 -3
  259. package/dist/profile-update-z3aM46KS.js +0 -68
  260. package/dist/reaction-events-DrK9Zua7.js +0 -164
  261. package/dist/record-shared-CWWx6fvI.js +0 -2
  262. package/dist/recovery-key-store-BNnHvXdk.js +0 -275
  263. package/dist/resolve-targets-nNMcrV3W.js +0 -140
  264. package/dist/resolver.runtime-BvaFlVLg.js +0 -5
  265. package/dist/room-info-CAFZ3Z9J.js +0 -87
  266. package/dist/route-DY6at4qJ.js +0 -161
  267. package/dist/runtime-api-D1xI_cvh.js +0 -21
  268. package/dist/sdk-UzPd8tst.js +0 -1273
  269. package/dist/secret-contract-M3hRmGO-.js +0 -95
  270. package/dist/send-C9Ssx-iV.js +0 -2069
  271. package/dist/setup-bootstrap-BBGpPKgy.js +0 -62
  272. package/dist/setup-core-a542Ernq.js +0 -772
  273. package/dist/setup-surface-BJrCI6KT.js +0 -542
  274. package/dist/shared-CUH5otj8.js +0 -663
  275. package/dist/startup-verification-wm3_i88s.js +0 -232
  276. package/dist/storage-BvAkgzvT.js +0 -685
  277. package/dist/storage-paths-gUmSydsW.js +0 -41
  278. package/dist/subagent-hooks-dkPAF6Et.js +0 -143
  279. package/dist/thread-binding-api-DRbBZlhS.js +0 -17
  280. package/dist/thread-bindings-D3RfVgAF.js +0 -436
  281. package/dist/tool-actions.runtime-Dh5ow2EK.js +0 -725
  282. package/dist/verification-ZdAXdmuh.js +0 -345
  283. package/node_modules/argparse/CHANGELOG.md +0 -216
  284. package/node_modules/argparse/LICENSE +0 -254
  285. package/node_modules/argparse/README.md +0 -84
  286. package/node_modules/argparse/argparse.js +0 -3707
  287. package/node_modules/argparse/lib/sub.js +0 -67
  288. package/node_modules/argparse/lib/textwrap.js +0 -440
  289. package/node_modules/argparse/package.json +0 -31
  290. package/node_modules/entities/lib/decode.d.ts +0 -211
  291. package/node_modules/entities/lib/decode.d.ts.map +0 -1
  292. package/node_modules/entities/lib/decode.js +0 -536
  293. package/node_modules/entities/lib/decode.js.map +0 -1
  294. package/node_modules/entities/lib/decode_codepoint.d.ts +0 -19
  295. package/node_modules/entities/lib/decode_codepoint.d.ts.map +0 -1
  296. package/node_modules/entities/lib/decode_codepoint.js +0 -76
  297. package/node_modules/entities/lib/decode_codepoint.js.map +0 -1
  298. package/node_modules/entities/lib/encode.d.ts +0 -22
  299. package/node_modules/entities/lib/encode.d.ts.map +0 -1
  300. package/node_modules/entities/lib/encode.js +0 -77
  301. package/node_modules/entities/lib/encode.js.map +0 -1
  302. package/node_modules/entities/lib/escape.d.ts +0 -43
  303. package/node_modules/entities/lib/escape.d.ts.map +0 -1
  304. package/node_modules/entities/lib/escape.js +0 -122
  305. package/node_modules/entities/lib/escape.js.map +0 -1
  306. package/node_modules/entities/lib/esm/decode.d.ts +0 -211
  307. package/node_modules/entities/lib/esm/decode.d.ts.map +0 -1
  308. package/node_modules/entities/lib/esm/decode.js +0 -496
  309. package/node_modules/entities/lib/esm/decode.js.map +0 -1
  310. package/node_modules/entities/lib/esm/decode_codepoint.d.ts +0 -19
  311. package/node_modules/entities/lib/esm/decode_codepoint.d.ts.map +0 -1
  312. package/node_modules/entities/lib/esm/decode_codepoint.js +0 -71
  313. package/node_modules/entities/lib/esm/decode_codepoint.js.map +0 -1
  314. package/node_modules/entities/lib/esm/encode.d.ts +0 -22
  315. package/node_modules/entities/lib/esm/encode.d.ts.map +0 -1
  316. package/node_modules/entities/lib/esm/encode.js +0 -69
  317. package/node_modules/entities/lib/esm/encode.js.map +0 -1
  318. package/node_modules/entities/lib/esm/escape.d.ts +0 -43
  319. package/node_modules/entities/lib/esm/escape.d.ts.map +0 -1
  320. package/node_modules/entities/lib/esm/escape.js +0 -116
  321. package/node_modules/entities/lib/esm/escape.js.map +0 -1
  322. package/node_modules/entities/lib/esm/generated/decode-data-html.d.ts +0 -3
  323. package/node_modules/entities/lib/esm/generated/decode-data-html.d.ts.map +0 -1
  324. package/node_modules/entities/lib/esm/generated/decode-data-html.js +0 -7
  325. package/node_modules/entities/lib/esm/generated/decode-data-html.js.map +0 -1
  326. package/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts +0 -3
  327. package/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts.map +0 -1
  328. package/node_modules/entities/lib/esm/generated/decode-data-xml.js +0 -7
  329. package/node_modules/entities/lib/esm/generated/decode-data-xml.js.map +0 -1
  330. package/node_modules/entities/lib/esm/generated/encode-html.d.ts +0 -8
  331. package/node_modules/entities/lib/esm/generated/encode-html.d.ts.map +0 -1
  332. package/node_modules/entities/lib/esm/generated/encode-html.js +0 -10
  333. package/node_modules/entities/lib/esm/generated/encode-html.js.map +0 -1
  334. package/node_modules/entities/lib/esm/index.d.ts +0 -96
  335. package/node_modules/entities/lib/esm/index.d.ts.map +0 -1
  336. package/node_modules/entities/lib/esm/index.js +0 -99
  337. package/node_modules/entities/lib/esm/index.js.map +0 -1
  338. package/node_modules/entities/lib/esm/package.json +0 -1
  339. package/node_modules/entities/lib/generated/decode-data-html.d.ts +0 -3
  340. package/node_modules/entities/lib/generated/decode-data-html.d.ts.map +0 -1
  341. package/node_modules/entities/lib/generated/decode-data-html.js +0 -9
  342. package/node_modules/entities/lib/generated/decode-data-html.js.map +0 -1
  343. package/node_modules/entities/lib/generated/decode-data-xml.d.ts +0 -3
  344. package/node_modules/entities/lib/generated/decode-data-xml.d.ts.map +0 -1
  345. package/node_modules/entities/lib/generated/decode-data-xml.js +0 -9
  346. package/node_modules/entities/lib/generated/decode-data-xml.js.map +0 -1
  347. package/node_modules/entities/lib/generated/encode-html.d.ts +0 -8
  348. package/node_modules/entities/lib/generated/encode-html.d.ts.map +0 -1
  349. package/node_modules/entities/lib/generated/encode-html.js +0 -12
  350. package/node_modules/entities/lib/generated/encode-html.js.map +0 -1
  351. package/node_modules/entities/lib/index.d.ts +0 -96
  352. package/node_modules/entities/lib/index.d.ts.map +0 -1
  353. package/node_modules/entities/lib/index.js +0 -126
  354. package/node_modules/entities/lib/index.js.map +0 -1
  355. package/node_modules/entities/package.json +0 -90
  356. package/node_modules/entities/readme.md +0 -122
  357. package/node_modules/linkify-it/README.md +0 -195
  358. package/node_modules/linkify-it/build/index.cjs.js +0 -840
  359. package/node_modules/linkify-it/index.mjs +0 -646
  360. package/node_modules/linkify-it/lib/re.mjs +0 -193
  361. package/node_modules/linkify-it/package.json +0 -63
  362. package/node_modules/markdown-it/dist/index.cjs.js +0 -3901
  363. package/node_modules/markdown-it/dist/index.cjs.js.map +0 -1
  364. package/node_modules/markdown-it/dist/markdown-it.js +0 -3975
  365. package/node_modules/markdown-it/dist/markdown-it.js.map +0 -1
  366. package/node_modules/markdown-it/dist/markdown-it.min.js +0 -3
  367. package/node_modules/markdown-it/dist/markdown-it.min.js.map +0 -1
  368. package/node_modules/markdown-it/index.mjs +0 -1
  369. package/node_modules/markdown-it/lib/common/html_blocks.mjs +0 -67
  370. package/node_modules/markdown-it/lib/common/html_re.mjs +0 -25
  371. package/node_modules/markdown-it/lib/common/utils.mjs +0 -324
  372. package/node_modules/markdown-it/lib/helpers/index.mjs +0 -11
  373. package/node_modules/markdown-it/lib/helpers/parse_link_destination.mjs +0 -77
  374. package/node_modules/markdown-it/lib/helpers/parse_link_label.mjs +0 -49
  375. package/node_modules/markdown-it/lib/helpers/parse_link_title.mjs +0 -66
  376. package/node_modules/markdown-it/lib/index.mjs +0 -565
  377. package/node_modules/markdown-it/lib/parser_block.mjs +0 -134
  378. package/node_modules/markdown-it/lib/parser_core.mjs +0 -62
  379. package/node_modules/markdown-it/lib/parser_inline.mjs +0 -197
  380. package/node_modules/markdown-it/lib/presets/commonmark.mjs +0 -88
  381. package/node_modules/markdown-it/lib/presets/default.mjs +0 -47
  382. package/node_modules/markdown-it/lib/presets/zero.mjs +0 -70
  383. package/node_modules/markdown-it/lib/renderer.mjs +0 -322
  384. package/node_modules/markdown-it/lib/ruler.mjs +0 -340
  385. package/node_modules/markdown-it/lib/rules_block/blockquote.mjs +0 -209
  386. package/node_modules/markdown-it/lib/rules_block/code.mjs +0 -30
  387. package/node_modules/markdown-it/lib/rules_block/fence.mjs +0 -94
  388. package/node_modules/markdown-it/lib/rules_block/heading.mjs +0 -51
  389. package/node_modules/markdown-it/lib/rules_block/hr.mjs +0 -40
  390. package/node_modules/markdown-it/lib/rules_block/html_block.mjs +0 -80
  391. package/node_modules/markdown-it/lib/rules_block/lheading.mjs +0 -85
  392. package/node_modules/markdown-it/lib/rules_block/list.mjs +0 -331
  393. package/node_modules/markdown-it/lib/rules_block/paragraph.mjs +0 -48
  394. package/node_modules/markdown-it/lib/rules_block/reference.mjs +0 -212
  395. package/node_modules/markdown-it/lib/rules_block/state_block.mjs +0 -220
  396. package/node_modules/markdown-it/lib/rules_block/table.mjs +0 -228
  397. package/node_modules/markdown-it/lib/rules_core/block.mjs +0 -13
  398. package/node_modules/markdown-it/lib/rules_core/inline.mjs +0 -11
  399. package/node_modules/markdown-it/lib/rules_core/linkify.mjs +0 -134
  400. package/node_modules/markdown-it/lib/rules_core/normalize.mjs +0 -17
  401. package/node_modules/markdown-it/lib/rules_core/replacements.mjs +0 -101
  402. package/node_modules/markdown-it/lib/rules_core/smartquotes.mjs +0 -209
  403. package/node_modules/markdown-it/lib/rules_core/state_core.mjs +0 -17
  404. package/node_modules/markdown-it/lib/rules_core/text_join.mjs +0 -43
  405. package/node_modules/markdown-it/lib/rules_inline/autolink.mjs +0 -72
  406. package/node_modules/markdown-it/lib/rules_inline/backticks.mjs +0 -60
  407. package/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs +0 -124
  408. package/node_modules/markdown-it/lib/rules_inline/emphasis.mjs +0 -123
  409. package/node_modules/markdown-it/lib/rules_inline/entity.mjs +0 -51
  410. package/node_modules/markdown-it/lib/rules_inline/escape.mjs +0 -83
  411. package/node_modules/markdown-it/lib/rules_inline/fragments_join.mjs +0 -38
  412. package/node_modules/markdown-it/lib/rules_inline/html_inline.mjs +0 -50
  413. package/node_modules/markdown-it/lib/rules_inline/image.mjs +0 -138
  414. package/node_modules/markdown-it/lib/rules_inline/link.mjs +0 -139
  415. package/node_modules/markdown-it/lib/rules_inline/linkify.mjs +0 -63
  416. package/node_modules/markdown-it/lib/rules_inline/newline.mjs +0 -42
  417. package/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +0 -154
  418. package/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs +0 -127
  419. package/node_modules/markdown-it/lib/rules_inline/text.mjs +0 -86
  420. package/node_modules/markdown-it/lib/token.mjs +0 -191
  421. package/node_modules/mdurl/package.json +0 -37
  422. package/node_modules/uc.micro/README.md +0 -14
  423. package/node_modules/uc.micro/build/index.cjs.js +0 -20
  424. package/node_modules/uc.micro/categories/Cc/regex.mjs +0 -1
  425. package/node_modules/uc.micro/categories/Cf/regex.mjs +0 -1
  426. package/node_modules/uc.micro/categories/P/regex.mjs +0 -1
  427. package/node_modules/uc.micro/categories/S/regex.mjs +0 -1
  428. package/node_modules/uc.micro/categories/Z/regex.mjs +0 -1
  429. package/node_modules/uc.micro/index.mjs +0 -8
  430. package/node_modules/uc.micro/package.json +0 -37
  431. package/node_modules/uc.micro/properties/Any/regex.mjs +0 -1
  432. /package/dist/{account-config-BZWN9tGS.js → .setup/account-config-BZWN9tGS.mjs} +0 -0
  433. /package/dist/{backup-health-Dm_YMVFT.js → .setup/backup-health-Dm_YMVFT.mjs} +0 -0
  434. /package/dist/{config-paths-CnREYb1Y.js → .setup/config-paths-CnREYb1Y.mjs} +0 -0
  435. /package/dist/{config-secret-input.runtime-CwsP3--c.js → .setup/config-secret-input.runtime-CwsP3--c.mjs} +0 -0
  436. /package/dist/{crypto-node.runtime-6Aj_ltHQ.js → .setup/crypto-node.runtime-6Aj_ltHQ.mjs} +0 -0
  437. /package/dist/{errors-C47hvAF8.js → .setup/errors-C47hvAF8.mjs} +0 -0
  438. /package/dist/{preflight-audio.runtime-BZxxQsxY.js → .setup/preflight-audio.runtime-BZxxQsxY.mjs} +0 -0
  439. /package/dist/{reaction-common-DkrQdBSZ.js → .setup/reaction-common-DkrQdBSZ.mjs} +0 -0
  440. /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
  441. /package/dist/{runtime-6S3DNFNv.js → .setup/runtime-6S3DNFNv.mjs} +0 -0
  442. /package/dist/{runtime-BefyhPWv.js → .setup/runtime-BefyhPWv.mjs} +0 -0
  443. /package/dist/{sync-state-CWbp0QSY.js → .setup/sync-state-CWbp0QSY.mjs} +0 -0
  444. /package/dist/{target-ids-B-5aQxwn.js → .setup/target-ids-B-5aQxwn.mjs} +0 -0
  445. /package/dist/{thread-bindings-shared-CKnY4LSd.js → .setup/thread-bindings-shared-CKnY4LSd.mjs} +0 -0
  446. /package/dist/{timeout-abort-signal-DMrgRFIy.js → .setup/timeout-abort-signal-DMrgRFIy.mjs} +0 -0
  447. /package/dist/{url-validation-GRHde6lq.js → .setup/url-validation-GRHde6lq.mjs} +0 -0
  448. /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/LICENSE +0 -0
  449. /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/README.md +0 -0
  450. /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/dist/helpers.d.ts +0 -0
  451. /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/dist/helpers.d.ts.map +0 -0
  452. /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/dist/helpers.js +0 -0
  453. /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/dist/helpers.js.map +0 -0
  454. /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/dist/index.d.ts +0 -0
  455. /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/dist/index.d.ts.map +0 -0
  456. /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/dist/index.js +0 -0
  457. /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/dist/index.js.map +0 -0
  458. /package/node_modules/{agent-base → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/agent-base}/package.json +0 -0
  459. /package/node_modules/{debug → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/debug}/LICENSE +0 -0
  460. /package/node_modules/{debug → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/debug}/README.md +0 -0
  461. /package/node_modules/{debug → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/debug}/package.json +0 -0
  462. /package/node_modules/{debug → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/debug}/src/browser.js +0 -0
  463. /package/node_modules/{debug → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/debug}/src/common.js +0 -0
  464. /package/node_modules/{debug → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/debug}/src/index.js +0 -0
  465. /package/node_modules/{debug → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/debug}/src/node.js +0 -0
  466. /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/LICENSE +0 -0
  467. /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/README.md +0 -0
  468. /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/dist/index.d.ts +0 -0
  469. /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/dist/index.d.ts.map +0 -0
  470. /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/dist/index.js +0 -0
  471. /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/dist/index.js.map +0 -0
  472. /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/dist/parse-proxy-response.d.ts +0 -0
  473. /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/dist/parse-proxy-response.d.ts.map +0 -0
  474. /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/dist/parse-proxy-response.js +0 -0
  475. /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/dist/parse-proxy-response.js.map +0 -0
  476. /package/node_modules/{https-proxy-agent → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/https-proxy-agent}/package.json +0 -0
  477. /package/node_modules/{ms → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/ms}/index.js +0 -0
  478. /package/node_modules/{ms → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/ms}/license.md +0 -0
  479. /package/node_modules/{ms → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/ms}/package.json +0 -0
  480. /package/node_modules/{ms → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/ms}/readme.md +0 -0
  481. /package/node_modules/{node-downloader-helper → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/node-downloader-helper}/LICENSE +0 -0
  482. /package/node_modules/{node-downloader-helper → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/node-downloader-helper}/README.md +0 -0
  483. /package/node_modules/{node-downloader-helper → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/node-downloader-helper}/bin/helpers.js +0 -0
  484. /package/node_modules/{node-downloader-helper → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/node-downloader-helper}/bin/ndh +0 -0
  485. /package/node_modules/{node-downloader-helper → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/node-downloader-helper}/dist/index.js +0 -0
  486. /package/node_modules/{node-downloader-helper → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/node-downloader-helper}/package.json +0 -0
  487. /package/node_modules/{node-downloader-helper → @matrix-org/matrix-sdk-crypto-nodejs/node_modules/node-downloader-helper}/types/index.d.ts +0 -0
  488. /package/node_modules/{entities → markdown-it/node_modules/entities}/LICENSE +0 -0
  489. /package/node_modules/{linkify-it → markdown-it/node_modules/linkify-it}/LICENSE +0 -0
  490. /package/node_modules/{mdurl → markdown-it/node_modules/mdurl}/LICENSE +0 -0
  491. /package/node_modules/{mdurl → markdown-it/node_modules/mdurl}/README.md +0 -0
  492. /package/node_modules/{mdurl → markdown-it/node_modules/mdurl}/build/index.cjs.js +0 -0
  493. /package/node_modules/{mdurl → markdown-it/node_modules/mdurl}/index.mjs +0 -0
  494. /package/node_modules/{mdurl → markdown-it/node_modules/mdurl}/lib/decode.mjs +0 -0
  495. /package/node_modules/{mdurl → markdown-it/node_modules/mdurl}/lib/encode.mjs +0 -0
  496. /package/node_modules/{mdurl → markdown-it/node_modules/mdurl}/lib/format.mjs +0 -0
  497. /package/node_modules/{mdurl → markdown-it/node_modules/mdurl}/lib/parse.mjs +0 -0
  498. /package/node_modules/{punycode.js → markdown-it/node_modules/punycode.js}/LICENSE-MIT.txt +0 -0
  499. /package/node_modules/{punycode.js → markdown-it/node_modules/punycode.js}/README.md +0 -0
  500. /package/node_modules/{punycode.js → markdown-it/node_modules/punycode.js}/package.json +0 -0
  501. /package/node_modules/{punycode.js → markdown-it/node_modules/punycode.js}/punycode.es6.js +0 -0
  502. /package/node_modules/{punycode.js → markdown-it/node_modules/punycode.js}/punycode.js +0 -0
  503. /package/node_modules/{uc.micro → markdown-it/node_modules/uc.micro}/LICENSE.txt +0 -0
  504. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/LICENSE +0 -0
  505. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/README.md +0 -0
  506. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/OverloadYield.js +0 -0
  507. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/applyDecoratedDescriptor.js +0 -0
  508. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/applyDecs2311.js +0 -0
  509. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/arrayLikeToArray.js +0 -0
  510. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/arrayWithHoles.js +0 -0
  511. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/arrayWithoutHoles.js +0 -0
  512. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/assertClassBrand.js +0 -0
  513. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/assertThisInitialized.js +0 -0
  514. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/asyncGeneratorDelegate.js +0 -0
  515. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/asyncIterator.js +0 -0
  516. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/asyncToGenerator.js +0 -0
  517. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/awaitAsyncGenerator.js +0 -0
  518. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/callSuper.js +0 -0
  519. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/checkInRHS.js +0 -0
  520. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/checkPrivateRedeclaration.js +0 -0
  521. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classCallCheck.js +0 -0
  522. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classNameTDZError.js +0 -0
  523. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classPrivateFieldGet2.js +0 -0
  524. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classPrivateFieldInitSpec.js +0 -0
  525. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classPrivateFieldLooseBase.js +0 -0
  526. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classPrivateFieldLooseKey.js +0 -0
  527. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classPrivateFieldSet2.js +0 -0
  528. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classPrivateGetter.js +0 -0
  529. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classPrivateMethodInitSpec.js +0 -0
  530. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classPrivateSetter.js +0 -0
  531. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/classStaticPrivateMethodGet.js +0 -0
  532. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/construct.js +0 -0
  533. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/createClass.js +0 -0
  534. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/createForOfIteratorHelper.js +0 -0
  535. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/createForOfIteratorHelperLoose.js +0 -0
  536. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/createSuper.js +0 -0
  537. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/defaults.js +0 -0
  538. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/defineAccessor.js +0 -0
  539. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/defineProperty.js +0 -0
  540. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/OverloadYield.js +0 -0
  541. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/applyDecoratedDescriptor.js +0 -0
  542. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/applyDecs2311.js +0 -0
  543. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/arrayLikeToArray.js +0 -0
  544. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/arrayWithHoles.js +0 -0
  545. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/arrayWithoutHoles.js +0 -0
  546. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/assertClassBrand.js +0 -0
  547. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/assertThisInitialized.js +0 -0
  548. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/asyncGeneratorDelegate.js +0 -0
  549. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/asyncIterator.js +0 -0
  550. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/asyncToGenerator.js +0 -0
  551. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/awaitAsyncGenerator.js +0 -0
  552. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/callSuper.js +0 -0
  553. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/checkInRHS.js +0 -0
  554. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/checkPrivateRedeclaration.js +0 -0
  555. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classCallCheck.js +0 -0
  556. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classNameTDZError.js +0 -0
  557. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classPrivateFieldGet2.js +0 -0
  558. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classPrivateFieldInitSpec.js +0 -0
  559. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classPrivateFieldLooseBase.js +0 -0
  560. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classPrivateFieldLooseKey.js +0 -0
  561. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classPrivateFieldSet2.js +0 -0
  562. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classPrivateGetter.js +0 -0
  563. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classPrivateMethodInitSpec.js +0 -0
  564. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classPrivateSetter.js +0 -0
  565. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/classStaticPrivateMethodGet.js +0 -0
  566. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/construct.js +0 -0
  567. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/createClass.js +0 -0
  568. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/createForOfIteratorHelper.js +0 -0
  569. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/createForOfIteratorHelperLoose.js +0 -0
  570. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/createSuper.js +0 -0
  571. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/defaults.js +0 -0
  572. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/defineAccessor.js +0 -0
  573. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/defineProperty.js +0 -0
  574. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/extends.js +0 -0
  575. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/get.js +0 -0
  576. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/getPrototypeOf.js +0 -0
  577. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/identity.js +0 -0
  578. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/importDeferProxy.js +0 -0
  579. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/inherits.js +0 -0
  580. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/inheritsLoose.js +0 -0
  581. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/initializerDefineProperty.js +0 -0
  582. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/initializerWarningHelper.js +0 -0
  583. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/instanceof.js +0 -0
  584. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/interopRequireDefault.js +0 -0
  585. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/interopRequireWildcard.js +0 -0
  586. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/isNativeFunction.js +0 -0
  587. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/isNativeReflectConstruct.js +0 -0
  588. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/iterableToArray.js +0 -0
  589. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/iterableToArrayLimit.js +0 -0
  590. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/jsx.js +0 -0
  591. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/maybeArrayLike.js +0 -0
  592. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/newArrowCheck.js +0 -0
  593. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/nonIterableRest.js +0 -0
  594. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/nonIterableSpread.js +0 -0
  595. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/nullishReceiverError.js +0 -0
  596. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/objectDestructuringEmpty.js +0 -0
  597. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/objectSpread2.js +0 -0
  598. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/objectWithoutProperties.js +0 -0
  599. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/objectWithoutPropertiesLoose.js +0 -0
  600. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/package.json +0 -0
  601. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/possibleConstructorReturn.js +0 -0
  602. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/readOnlyError.js +0 -0
  603. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/regenerator.js +0 -0
  604. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/regeneratorAsync.js +0 -0
  605. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/regeneratorAsyncGen.js +0 -0
  606. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/regeneratorAsyncIterator.js +0 -0
  607. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/regeneratorDefine.js +0 -0
  608. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/regeneratorKeys.js +0 -0
  609. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/regeneratorValues.js +0 -0
  610. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/set.js +0 -0
  611. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/setFunctionName.js +0 -0
  612. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/setPrototypeOf.js +0 -0
  613. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/skipFirstGeneratorNext.js +0 -0
  614. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/slicedToArray.js +0 -0
  615. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/superPropBase.js +0 -0
  616. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/superPropGet.js +0 -0
  617. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/superPropSet.js +0 -0
  618. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/taggedTemplateLiteral.js +0 -0
  619. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/taggedTemplateLiteralLoose.js +0 -0
  620. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/tdz.js +0 -0
  621. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/temporalRef.js +0 -0
  622. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/temporalUndefined.js +0 -0
  623. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/toArray.js +0 -0
  624. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/toConsumableArray.js +0 -0
  625. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/toPrimitive.js +0 -0
  626. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/toPropertyKey.js +0 -0
  627. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/toSetter.js +0 -0
  628. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/tsRewriteRelativeImportExtensions.js +0 -0
  629. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/typeof.js +0 -0
  630. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/unsupportedIterableToArray.js +0 -0
  631. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/usingCtx.js +0 -0
  632. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/wrapAsyncGenerator.js +0 -0
  633. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/wrapNativeSuper.js +0 -0
  634. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/wrapRegExp.js +0 -0
  635. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/esm/writeOnlyError.js +0 -0
  636. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/extends.js +0 -0
  637. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/get.js +0 -0
  638. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/getPrototypeOf.js +0 -0
  639. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/identity.js +0 -0
  640. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/importDeferProxy.js +0 -0
  641. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/inherits.js +0 -0
  642. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/inheritsLoose.js +0 -0
  643. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/initializerDefineProperty.js +0 -0
  644. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/initializerWarningHelper.js +0 -0
  645. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/instanceof.js +0 -0
  646. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/interopRequireDefault.js +0 -0
  647. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/interopRequireWildcard.js +0 -0
  648. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/isNativeFunction.js +0 -0
  649. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/isNativeReflectConstruct.js +0 -0
  650. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/iterableToArray.js +0 -0
  651. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/iterableToArrayLimit.js +0 -0
  652. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/jsx.js +0 -0
  653. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/maybeArrayLike.js +0 -0
  654. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/newArrowCheck.js +0 -0
  655. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/nonIterableRest.js +0 -0
  656. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/nonIterableSpread.js +0 -0
  657. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/nullishReceiverError.js +0 -0
  658. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/objectDestructuringEmpty.js +0 -0
  659. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/objectSpread2.js +0 -0
  660. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/objectWithoutProperties.js +0 -0
  661. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/objectWithoutPropertiesLoose.js +0 -0
  662. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/possibleConstructorReturn.js +0 -0
  663. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/readOnlyError.js +0 -0
  664. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/regenerator.js +0 -0
  665. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/regeneratorAsync.js +0 -0
  666. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/regeneratorAsyncGen.js +0 -0
  667. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/regeneratorAsyncIterator.js +0 -0
  668. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/regeneratorDefine.js +0 -0
  669. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/regeneratorKeys.js +0 -0
  670. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/regeneratorValues.js +0 -0
  671. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/set.js +0 -0
  672. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/setFunctionName.js +0 -0
  673. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/setPrototypeOf.js +0 -0
  674. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/skipFirstGeneratorNext.js +0 -0
  675. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/slicedToArray.js +0 -0
  676. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/superPropBase.js +0 -0
  677. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/superPropGet.js +0 -0
  678. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/superPropSet.js +0 -0
  679. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/taggedTemplateLiteral.js +0 -0
  680. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/taggedTemplateLiteralLoose.js +0 -0
  681. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/tdz.js +0 -0
  682. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/temporalRef.js +0 -0
  683. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/temporalUndefined.js +0 -0
  684. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/toArray.js +0 -0
  685. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/toConsumableArray.js +0 -0
  686. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/toPrimitive.js +0 -0
  687. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/toPropertyKey.js +0 -0
  688. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/toSetter.js +0 -0
  689. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/tsRewriteRelativeImportExtensions.js +0 -0
  690. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/typeof.js +0 -0
  691. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/unsupportedIterableToArray.js +0 -0
  692. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/usingCtx.js +0 -0
  693. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/wrapAsyncGenerator.js +0 -0
  694. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/wrapNativeSuper.js +0 -0
  695. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/wrapRegExp.js +0 -0
  696. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/helpers/writeOnlyError.js +0 -0
  697. /package/node_modules/{@babel → matrix-js-sdk/node_modules/@babel}/runtime/package.json +0 -0
  698. /package/node_modules/{@types → matrix-js-sdk/node_modules/@types}/events/LICENSE +0 -0
  699. /package/node_modules/{@types → matrix-js-sdk/node_modules/@types}/events/README.md +0 -0
  700. /package/node_modules/{@types → matrix-js-sdk/node_modules/@types}/events/index.d.ts +0 -0
  701. /package/node_modules/{@types → matrix-js-sdk/node_modules/@types}/events/package.json +0 -0
  702. /package/node_modules/{another-json → matrix-js-sdk/node_modules/another-json}/.jshint +0 -0
  703. /package/node_modules/{another-json → matrix-js-sdk/node_modules/another-json}/.npmignore +0 -0
  704. /package/node_modules/{another-json → matrix-js-sdk/node_modules/another-json}/.travis.yml +0 -0
  705. /package/node_modules/{another-json → matrix-js-sdk/node_modules/another-json}/LICENSE +0 -0
  706. /package/node_modules/{another-json → matrix-js-sdk/node_modules/another-json}/README.md +0 -0
  707. /package/node_modules/{another-json → matrix-js-sdk/node_modules/another-json}/another-json.js +0 -0
  708. /package/node_modules/{another-json → matrix-js-sdk/node_modules/another-json}/package.json +0 -0
  709. /package/node_modules/{another-json → matrix-js-sdk/node_modules/another-json}/spec/another-json-spec.js +0 -0
  710. /package/node_modules/{base-x → matrix-js-sdk/node_modules/base-x}/LICENSE.md +0 -0
  711. /package/node_modules/{base-x → matrix-js-sdk/node_modules/base-x}/README.md +0 -0
  712. /package/node_modules/{base-x → matrix-js-sdk/node_modules/base-x}/package.json +0 -0
  713. /package/node_modules/{base-x → matrix-js-sdk/node_modules/base-x}/src/cjs/index.cjs +0 -0
  714. /package/node_modules/{base-x → matrix-js-sdk/node_modules/base-x}/src/cjs/index.d.ts +0 -0
  715. /package/node_modules/{base-x → matrix-js-sdk/node_modules/base-x}/src/esm/index.js +0 -0
  716. /package/node_modules/{bs58 → matrix-js-sdk/node_modules/bs58}/LICENSE +0 -0
  717. /package/node_modules/{bs58 → matrix-js-sdk/node_modules/bs58}/README.md +0 -0
  718. /package/node_modules/{bs58 → matrix-js-sdk/node_modules/bs58}/package.json +0 -0
  719. /package/node_modules/{bs58 → matrix-js-sdk/node_modules/bs58}/src/cjs/index.cjs +0 -0
  720. /package/node_modules/{bs58 → matrix-js-sdk/node_modules/bs58}/src/cjs/index.d.ts +0 -0
  721. /package/node_modules/{bs58 → matrix-js-sdk/node_modules/bs58}/src/esm/index.js +0 -0
  722. /package/node_modules/{content-type → matrix-js-sdk/node_modules/content-type}/LICENSE +0 -0
  723. /package/node_modules/{content-type → matrix-js-sdk/node_modules/content-type}/README.md +0 -0
  724. /package/node_modules/{content-type → matrix-js-sdk/node_modules/content-type}/dist/index.d.ts +0 -0
  725. /package/node_modules/{content-type → matrix-js-sdk/node_modules/content-type}/dist/index.js +0 -0
  726. /package/node_modules/{content-type → matrix-js-sdk/node_modules/content-type}/dist/index.js.map +0 -0
  727. /package/node_modules/{content-type → matrix-js-sdk/node_modules/content-type}/package.json +0 -0
  728. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/.airtap.yml +0 -0
  729. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/.github/FUNDING.yml +0 -0
  730. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/.travis.yml +0 -0
  731. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/History.md +0 -0
  732. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/LICENSE +0 -0
  733. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/Readme.md +0 -0
  734. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/events.js +0 -0
  735. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/package.json +0 -0
  736. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/security.md +0 -0
  737. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/add-listeners.js +0 -0
  738. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/check-listener-leaks.js +0 -0
  739. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/common.js +0 -0
  740. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/errors.js +0 -0
  741. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/events-list.js +0 -0
  742. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/events-once.js +0 -0
  743. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/index.js +0 -0
  744. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/legacy-compat.js +0 -0
  745. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/listener-count.js +0 -0
  746. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/listeners-side-effects.js +0 -0
  747. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/listeners.js +0 -0
  748. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/max-listeners.js +0 -0
  749. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/method-names.js +0 -0
  750. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/modify-in-emit.js +0 -0
  751. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/num-args.js +0 -0
  752. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/once.js +0 -0
  753. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/prepend.js +0 -0
  754. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/remove-all-listeners.js +0 -0
  755. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/remove-listeners.js +0 -0
  756. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/set-max-listeners-side-effects.js +0 -0
  757. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/special-event-names.js +0 -0
  758. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/subclass.js +0 -0
  759. /package/node_modules/{events → matrix-js-sdk/node_modules/events}/tests/symbols.js +0 -0
  760. /package/node_modules/{is-network-error → matrix-js-sdk/node_modules/is-network-error}/index.d.ts +0 -0
  761. /package/node_modules/{is-network-error → matrix-js-sdk/node_modules/is-network-error}/index.js +0 -0
  762. /package/node_modules/{file-type → matrix-js-sdk/node_modules/is-network-error}/license +0 -0
  763. /package/node_modules/{is-network-error → matrix-js-sdk/node_modules/is-network-error}/package.json +0 -0
  764. /package/node_modules/{is-network-error → matrix-js-sdk/node_modules/is-network-error}/readme.md +0 -0
  765. /package/node_modules/{jwt-decode → matrix-js-sdk/node_modules/jwt-decode}/LICENSE +0 -0
  766. /package/node_modules/{jwt-decode → matrix-js-sdk/node_modules/jwt-decode}/README.md +0 -0
  767. /package/node_modules/{jwt-decode → matrix-js-sdk/node_modules/jwt-decode}/build/cjs/index.d.ts +0 -0
  768. /package/node_modules/{jwt-decode → matrix-js-sdk/node_modules/jwt-decode}/build/cjs/index.js +0 -0
  769. /package/node_modules/{jwt-decode → matrix-js-sdk/node_modules/jwt-decode}/build/cjs/package.json +0 -0
  770. /package/node_modules/{jwt-decode → matrix-js-sdk/node_modules/jwt-decode}/build/esm/index.d.ts +0 -0
  771. /package/node_modules/{jwt-decode → matrix-js-sdk/node_modules/jwt-decode}/build/esm/index.js +0 -0
  772. /package/node_modules/{jwt-decode → matrix-js-sdk/node_modules/jwt-decode}/package.json +0 -0
  773. /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/.editorconfig +0 -0
  774. /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/CONTRIBUTING.md +0 -0
  775. /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/Gruntfile.js +0 -0
  776. /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/LICENSE-MIT +0 -0
  777. /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/README.md +0 -0
  778. /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/_config.yml +0 -0
  779. /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/bower.json +0 -0
  780. /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/demo/index.html +0 -0
  781. /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/demo/script.js +0 -0
  782. /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/demo/styles.css +0 -0
  783. /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/dist/loglevel.js +0 -0
  784. /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/dist/loglevel.min.js +0 -0
  785. /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/index.d.ts +0 -0
  786. /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/lib/loglevel.js +0 -0
  787. /package/node_modules/{loglevel → matrix-js-sdk/node_modules/loglevel}/package.json +0 -0
  788. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/LICENSE +0 -0
  789. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/README.md +0 -0
  790. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/ExtensibleEvents.d.ts +0 -0
  791. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/ExtensibleEvents.js +0 -0
  792. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/IPartialEvent.d.ts +0 -0
  793. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/IPartialEvent.js +0 -0
  794. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/InvalidEventError.d.ts +0 -0
  795. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/InvalidEventError.js +0 -0
  796. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/NamespacedMap.d.ts +0 -0
  797. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/NamespacedMap.js +0 -0
  798. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/NamespacedValue.d.ts +0 -0
  799. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/NamespacedValue.js +0 -0
  800. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/EmoteEvent.d.ts +0 -0
  801. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/EmoteEvent.js +0 -0
  802. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/ExtensibleEvent.d.ts +0 -0
  803. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/ExtensibleEvent.js +0 -0
  804. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/MessageEvent.d.ts +0 -0
  805. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/MessageEvent.js +0 -0
  806. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/NoticeEvent.d.ts +0 -0
  807. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/NoticeEvent.js +0 -0
  808. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/PollEndEvent.d.ts +0 -0
  809. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/PollEndEvent.js +0 -0
  810. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/PollResponseEvent.d.ts +0 -0
  811. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/PollResponseEvent.js +0 -0
  812. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/PollStartEvent.d.ts +0 -0
  813. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/PollStartEvent.js +0 -0
  814. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/message_types.d.ts +0 -0
  815. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/message_types.js +0 -0
  816. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/poll_types.d.ts +0 -0
  817. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/poll_types.js +0 -0
  818. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/relationship_types.d.ts +0 -0
  819. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/events/relationship_types.js +0 -0
  820. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/index.d.ts +0 -0
  821. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/index.js +0 -0
  822. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/interpreters/legacy/MRoomMessage.d.ts +0 -0
  823. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/interpreters/legacy/MRoomMessage.js +0 -0
  824. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/interpreters/modern/MMessage.d.ts +0 -0
  825. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/interpreters/modern/MMessage.js +0 -0
  826. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/interpreters/modern/MPoll.d.ts +0 -0
  827. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/interpreters/modern/MPoll.js +0 -0
  828. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/types.d.ts +0 -0
  829. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/types.js +0 -0
  830. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/utility/MessageMatchers.d.ts +0 -0
  831. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/utility/MessageMatchers.js +0 -0
  832. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/utility/events.d.ts +0 -0
  833. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/lib/utility/events.js +0 -0
  834. /package/node_modules/{matrix-events-sdk → matrix-js-sdk/node_modules/matrix-events-sdk}/package.json +0 -0
  835. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/LICENSE +0 -0
  836. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/README.md +0 -0
  837. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/dist/api.js +0 -0
  838. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/dist/api.min.js +0 -0
  839. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/ClientWidgetApi.d.ts +0 -0
  840. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/ClientWidgetApi.js +0 -0
  841. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/ClientWidgetApi.js.map +0 -0
  842. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/Symbols.d.ts +0 -0
  843. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/Symbols.js +0 -0
  844. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/Symbols.js.map +0 -0
  845. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/WidgetApi.d.ts +0 -0
  846. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/WidgetApi.js +0 -0
  847. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/WidgetApi.js.map +0 -0
  848. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/driver/WidgetDriver.d.ts +0 -0
  849. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/driver/WidgetDriver.js +0 -0
  850. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/driver/WidgetDriver.js.map +0 -0
  851. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/index.d.ts +0 -0
  852. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/index.js +0 -0
  853. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/index.js.map +0 -0
  854. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ApiVersion.d.ts +0 -0
  855. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ApiVersion.js +0 -0
  856. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ApiVersion.js.map +0 -0
  857. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/Capabilities.d.ts +0 -0
  858. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/Capabilities.js +0 -0
  859. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/Capabilities.js.map +0 -0
  860. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/CapabilitiesAction.d.ts +0 -0
  861. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/CapabilitiesAction.js +0 -0
  862. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/CapabilitiesAction.js.map +0 -0
  863. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ContentLoadedAction.d.ts +0 -0
  864. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ContentLoadedAction.js +0 -0
  865. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ContentLoadedAction.js.map +0 -0
  866. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/DownloadFileAction.d.ts +0 -0
  867. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/DownloadFileAction.js +0 -0
  868. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/DownloadFileAction.js.map +0 -0
  869. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/GetMediaConfigAction.d.ts +0 -0
  870. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/GetMediaConfigAction.js +0 -0
  871. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/GetMediaConfigAction.js.map +0 -0
  872. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/GetOpenIDAction.d.ts +0 -0
  873. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/GetOpenIDAction.js +0 -0
  874. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/GetOpenIDAction.js.map +0 -0
  875. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ICustomWidgetData.d.ts +0 -0
  876. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ICustomWidgetData.js +0 -0
  877. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ICustomWidgetData.js.map +0 -0
  878. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IJitsiWidgetData.d.ts +0 -0
  879. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IJitsiWidgetData.js +0 -0
  880. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IJitsiWidgetData.js.map +0 -0
  881. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IRoomAccountData.d.ts +0 -0
  882. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IRoomAccountData.js +0 -0
  883. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IRoomAccountData.js.map +0 -0
  884. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IRoomEvent.d.ts +0 -0
  885. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IRoomEvent.js +0 -0
  886. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IRoomEvent.js.map +0 -0
  887. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IStickerpickerWidgetData.d.ts +0 -0
  888. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IStickerpickerWidgetData.js +0 -0
  889. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IStickerpickerWidgetData.js.map +0 -0
  890. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IToDeviceMessage.d.ts +0 -0
  891. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IToDeviceMessage.js +0 -0
  892. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IToDeviceMessage.js.map +0 -0
  893. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidget.d.ts +0 -0
  894. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidget.js +0 -0
  895. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidget.js.map +0 -0
  896. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidgetApiErrorResponse.d.ts +0 -0
  897. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidgetApiErrorResponse.js +0 -0
  898. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidgetApiErrorResponse.js.map +0 -0
  899. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidgetApiRequest.d.ts +0 -0
  900. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidgetApiRequest.js +0 -0
  901. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidgetApiRequest.js.map +0 -0
  902. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidgetApiResponse.d.ts +0 -0
  903. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidgetApiResponse.js +0 -0
  904. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/IWidgetApiResponse.js.map +0 -0
  905. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/LanguageChangeAction.d.ts +0 -0
  906. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/LanguageChangeAction.js +0 -0
  907. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/LanguageChangeAction.js.map +0 -0
  908. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ModalButtonKind.d.ts +0 -0
  909. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ModalButtonKind.js +0 -0
  910. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ModalButtonKind.js.map +0 -0
  911. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ModalWidgetActions.d.ts +0 -0
  912. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ModalWidgetActions.js +0 -0
  913. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ModalWidgetActions.js.map +0 -0
  914. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/NavigateAction.d.ts +0 -0
  915. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/NavigateAction.js +0 -0
  916. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/NavigateAction.js.map +0 -0
  917. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/OpenIDCredentialsAction.d.ts +0 -0
  918. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/OpenIDCredentialsAction.js +0 -0
  919. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/OpenIDCredentialsAction.js.map +0 -0
  920. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ReadEventAction.d.ts +0 -0
  921. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ReadEventAction.js +0 -0
  922. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ReadEventAction.js.map +0 -0
  923. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ReadRelationsAction.d.ts +0 -0
  924. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ReadRelationsAction.js +0 -0
  925. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ReadRelationsAction.js.map +0 -0
  926. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ReadRoomAccountDataAction.d.ts +0 -0
  927. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ReadRoomAccountDataAction.js +0 -0
  928. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ReadRoomAccountDataAction.js.map +0 -0
  929. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ScreenshotAction.d.ts +0 -0
  930. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ScreenshotAction.js +0 -0
  931. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ScreenshotAction.js.map +0 -0
  932. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SendEventAction.d.ts +0 -0
  933. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SendEventAction.js +0 -0
  934. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SendEventAction.js.map +0 -0
  935. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SendToDeviceAction.d.ts +0 -0
  936. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SendToDeviceAction.js +0 -0
  937. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SendToDeviceAction.js.map +0 -0
  938. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SetModalButtonEnabledAction.d.ts +0 -0
  939. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SetModalButtonEnabledAction.js +0 -0
  940. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SetModalButtonEnabledAction.js.map +0 -0
  941. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/StickerAction.d.ts +0 -0
  942. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/StickerAction.js +0 -0
  943. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/StickerAction.js.map +0 -0
  944. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/StickyAction.d.ts +0 -0
  945. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/StickyAction.js +0 -0
  946. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/StickyAction.js.map +0 -0
  947. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SupportedVersionsAction.d.ts +0 -0
  948. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SupportedVersionsAction.js +0 -0
  949. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/SupportedVersionsAction.js.map +0 -0
  950. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ThemeChangeAction.d.ts +0 -0
  951. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ThemeChangeAction.js +0 -0
  952. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/ThemeChangeAction.js.map +0 -0
  953. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/TurnServerActions.d.ts +0 -0
  954. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/TurnServerActions.js +0 -0
  955. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/TurnServerActions.js.map +0 -0
  956. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UpdateDelayedEventAction.d.ts +0 -0
  957. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UpdateDelayedEventAction.js +0 -0
  958. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UpdateDelayedEventAction.js.map +0 -0
  959. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UpdateStateAction.d.ts +0 -0
  960. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UpdateStateAction.js +0 -0
  961. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UpdateStateAction.js.map +0 -0
  962. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UploadFileAction.d.ts +0 -0
  963. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UploadFileAction.js +0 -0
  964. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UploadFileAction.js.map +0 -0
  965. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UserDirectorySearchAction.d.ts +0 -0
  966. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UserDirectorySearchAction.js +0 -0
  967. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/UserDirectorySearchAction.js.map +0 -0
  968. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/VisibilityAction.d.ts +0 -0
  969. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/VisibilityAction.js +0 -0
  970. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/VisibilityAction.js.map +0 -0
  971. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetApiAction.d.ts +0 -0
  972. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetApiAction.js +0 -0
  973. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetApiAction.js.map +0 -0
  974. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetApiDirection.d.ts +0 -0
  975. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetApiDirection.js +0 -0
  976. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetApiDirection.js.map +0 -0
  977. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetConfigAction.d.ts +0 -0
  978. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetConfigAction.js +0 -0
  979. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetConfigAction.js.map +0 -0
  980. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetKind.d.ts +0 -0
  981. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetKind.js +0 -0
  982. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetKind.js.map +0 -0
  983. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetType.d.ts +0 -0
  984. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetType.js +0 -0
  985. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/interfaces/WidgetType.js.map +0 -0
  986. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/Widget.d.ts +0 -0
  987. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/Widget.js +0 -0
  988. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/Widget.js.map +0 -0
  989. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/WidgetEventCapability.d.ts +0 -0
  990. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/WidgetEventCapability.js +0 -0
  991. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/WidgetEventCapability.js.map +0 -0
  992. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/WidgetParser.d.ts +0 -0
  993. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/WidgetParser.js +0 -0
  994. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/WidgetParser.js.map +0 -0
  995. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/validation/url.d.ts +0 -0
  996. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/validation/url.js +0 -0
  997. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/validation/url.js.map +0 -0
  998. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/validation/utils.d.ts +0 -0
  999. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/validation/utils.js +0 -0
  1000. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/models/validation/utils.js.map +0 -0
  1001. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/templating/url-template.d.ts +0 -0
  1002. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/templating/url-template.js +0 -0
  1003. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/templating/url-template.js.map +0 -0
  1004. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/transport/ITransport.d.ts +0 -0
  1005. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/transport/ITransport.js +0 -0
  1006. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/transport/ITransport.js.map +0 -0
  1007. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/transport/PostmessageTransport.d.ts +0 -0
  1008. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/transport/PostmessageTransport.js +0 -0
  1009. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/transport/PostmessageTransport.js.map +0 -0
  1010. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/util/SimpleObservable.d.ts +0 -0
  1011. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/util/SimpleObservable.js +0 -0
  1012. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/lib/util/SimpleObservable.js.map +0 -0
  1013. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/package.json +0 -0
  1014. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/ClientWidgetApi.ts +0 -0
  1015. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/Symbols.ts +0 -0
  1016. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/WidgetApi.ts +0 -0
  1017. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/driver/WidgetDriver.ts +0 -0
  1018. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/index.ts +0 -0
  1019. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ApiVersion.ts +0 -0
  1020. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/Capabilities.ts +0 -0
  1021. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/CapabilitiesAction.ts +0 -0
  1022. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ContentLoadedAction.ts +0 -0
  1023. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/DownloadFileAction.ts +0 -0
  1024. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/GetMediaConfigAction.ts +0 -0
  1025. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/GetOpenIDAction.ts +0 -0
  1026. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ICustomWidgetData.ts +0 -0
  1027. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/IJitsiWidgetData.ts +0 -0
  1028. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/IRoomAccountData.ts +0 -0
  1029. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/IRoomEvent.ts +0 -0
  1030. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/IStickerpickerWidgetData.ts +0 -0
  1031. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/IToDeviceMessage.ts +0 -0
  1032. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/IWidget.ts +0 -0
  1033. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/IWidgetApiErrorResponse.ts +0 -0
  1034. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/IWidgetApiRequest.ts +0 -0
  1035. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/IWidgetApiResponse.ts +0 -0
  1036. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/LanguageChangeAction.ts +0 -0
  1037. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ModalButtonKind.ts +0 -0
  1038. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ModalWidgetActions.ts +0 -0
  1039. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/NavigateAction.ts +0 -0
  1040. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/OpenIDCredentialsAction.ts +0 -0
  1041. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ReadEventAction.ts +0 -0
  1042. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ReadRelationsAction.ts +0 -0
  1043. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ReadRoomAccountDataAction.ts +0 -0
  1044. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ScreenshotAction.ts +0 -0
  1045. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/SendEventAction.ts +0 -0
  1046. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/SendToDeviceAction.ts +0 -0
  1047. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/SetModalButtonEnabledAction.ts +0 -0
  1048. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/StickerAction.ts +0 -0
  1049. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/StickyAction.ts +0 -0
  1050. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/SupportedVersionsAction.ts +0 -0
  1051. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/ThemeChangeAction.ts +0 -0
  1052. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/TurnServerActions.ts +0 -0
  1053. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/UpdateDelayedEventAction.ts +0 -0
  1054. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/UpdateStateAction.ts +0 -0
  1055. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/UploadFileAction.ts +0 -0
  1056. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/UserDirectorySearchAction.ts +0 -0
  1057. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/VisibilityAction.ts +0 -0
  1058. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/WidgetApiAction.ts +0 -0
  1059. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/WidgetApiDirection.ts +0 -0
  1060. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/WidgetConfigAction.ts +0 -0
  1061. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/WidgetKind.ts +0 -0
  1062. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/interfaces/WidgetType.ts +0 -0
  1063. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/models/Widget.ts +0 -0
  1064. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/models/WidgetEventCapability.ts +0 -0
  1065. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/models/WidgetParser.ts +0 -0
  1066. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/models/validation/url.ts +0 -0
  1067. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/models/validation/utils.ts +0 -0
  1068. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/templating/url-template.ts +0 -0
  1069. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/transport/ITransport.ts +0 -0
  1070. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/transport/PostmessageTransport.ts +0 -0
  1071. /package/node_modules/{matrix-widget-api → matrix-js-sdk/node_modules/matrix-widget-api}/src/util/SimpleObservable.ts +0 -0
  1072. /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/LICENSE +0 -0
  1073. /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/README.md +0 -0
  1074. /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/browser/oidc-client-ts.js +0 -0
  1075. /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/browser/oidc-client-ts.js.map +0 -0
  1076. /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/browser/oidc-client-ts.min.js +0 -0
  1077. /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/browser/oidc-client-ts.min.js.map +0 -0
  1078. /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/esm/oidc-client-ts.js +0 -0
  1079. /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/esm/oidc-client-ts.js.map +0 -0
  1080. /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/esm/package.json +0 -0
  1081. /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/types/oidc-client-ts.d.ts +0 -0
  1082. /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/types/tsdoc-metadata.json +0 -0
  1083. /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/umd/oidc-client-ts.js +0 -0
  1084. /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/dist/umd/oidc-client-ts.js.map +0 -0
  1085. /package/node_modules/{oidc-client-ts → matrix-js-sdk/node_modules/oidc-client-ts}/package.json +0 -0
  1086. /package/node_modules/{p-retry → matrix-js-sdk/node_modules/p-retry}/index.d.ts +0 -0
  1087. /package/node_modules/{p-retry → matrix-js-sdk/node_modules/p-retry}/index.js +0 -0
  1088. /package/node_modules/{is-network-error → matrix-js-sdk/node_modules/p-retry}/license +0 -0
  1089. /package/node_modules/{p-retry → matrix-js-sdk/node_modules/p-retry}/package.json +0 -0
  1090. /package/node_modules/{p-retry → matrix-js-sdk/node_modules/p-retry}/readme.md +0 -0
  1091. /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/.eslintrc.js +0 -0
  1092. /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/.github/FUNDING.yml +0 -0
  1093. /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/.github/codecov.yml +0 -0
  1094. /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/.github/dependabot.yml +0 -0
  1095. /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/.github/workflows/ci.yml +0 -0
  1096. /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/CHANGELOG.md +0 -0
  1097. /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/LICENSE +0 -0
  1098. /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/README.md +0 -0
  1099. /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/checker.js +0 -0
  1100. /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/lib/grammar.js +0 -0
  1101. /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/lib/index.js +0 -0
  1102. /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/lib/parser.js +0 -0
  1103. /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/lib/writer.js +0 -0
  1104. /package/node_modules/{sdp-transform → matrix-js-sdk/node_modules/sdp-transform}/package.json +0 -0
  1105. /package/node_modules/{unhomoglyph → matrix-js-sdk/node_modules/unhomoglyph}/CHANGELOG.md +0 -0
  1106. /package/node_modules/{unhomoglyph → matrix-js-sdk/node_modules/unhomoglyph}/LICENSE +0 -0
  1107. /package/node_modules/{unhomoglyph → matrix-js-sdk/node_modules/unhomoglyph}/README.md +0 -0
  1108. /package/node_modules/{unhomoglyph → matrix-js-sdk/node_modules/unhomoglyph}/data.json +0 -0
  1109. /package/node_modules/{unhomoglyph → matrix-js-sdk/node_modules/unhomoglyph}/index.d.ts +0 -0
  1110. /package/node_modules/{unhomoglyph → matrix-js-sdk/node_modules/unhomoglyph}/index.js +0 -0
  1111. /package/node_modules/{unhomoglyph → matrix-js-sdk/node_modules/unhomoglyph}/package.json +0 -0
  1112. /package/node_modules/{@borewit → music-metadata/node_modules/@borewit}/text-codec/LICENSE.txt +0 -0
  1113. /package/node_modules/{@borewit → music-metadata/node_modules/@borewit}/text-codec/README.md +0 -0
  1114. /package/node_modules/{@borewit → music-metadata/node_modules/@borewit}/text-codec/lib/index.d.ts +0 -0
  1115. /package/node_modules/{@borewit → music-metadata/node_modules/@borewit}/text-codec/lib/index.js +0 -0
  1116. /package/node_modules/{@borewit → music-metadata/node_modules/@borewit}/text-codec/package.json +0 -0
  1117. /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/LICENSE +0 -0
  1118. /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/README.md +0 -0
  1119. /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/lib/GzipHandler.d.ts +0 -0
  1120. /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/lib/GzipHandler.js +0 -0
  1121. /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/lib/ZipHandler.d.ts +0 -0
  1122. /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/lib/ZipHandler.js +0 -0
  1123. /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/lib/ZipToken.d.ts +0 -0
  1124. /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/lib/ZipToken.js +0 -0
  1125. /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/lib/index.d.ts +0 -0
  1126. /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/lib/index.js +0 -0
  1127. /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/inflate/package.json +0 -0
  1128. /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/token/README.md +0 -0
  1129. /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/token/index.d.ts +0 -0
  1130. /package/node_modules/{@tokenizer → music-metadata/node_modules/@tokenizer}/token/package.json +0 -0
  1131. /package/node_modules/{p-retry → music-metadata/node_modules/file-type}/license +0 -0
  1132. /package/node_modules/{file-type → music-metadata/node_modules/file-type}/package.json +0 -0
  1133. /package/node_modules/{file-type → music-metadata/node_modules/file-type}/readme.md +0 -0
  1134. /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/detectors/asf.js +0 -0
  1135. /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/detectors/ebml.js +0 -0
  1136. /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/detectors/png.js +0 -0
  1137. /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/detectors/zip.js +0 -0
  1138. /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/index.d.ts +0 -0
  1139. /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/index.js +0 -0
  1140. /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/index.test-d.ts +0 -0
  1141. /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/parser.js +0 -0
  1142. /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/supported.js +0 -0
  1143. /package/node_modules/{file-type → music-metadata/node_modules/file-type}/source/tokens.js +0 -0
  1144. /package/node_modules/{ieee754 → music-metadata/node_modules/ieee754}/LICENSE +0 -0
  1145. /package/node_modules/{ieee754 → music-metadata/node_modules/ieee754}/README.md +0 -0
  1146. /package/node_modules/{ieee754 → music-metadata/node_modules/ieee754}/index.d.ts +0 -0
  1147. /package/node_modules/{ieee754 → music-metadata/node_modules/ieee754}/index.js +0 -0
  1148. /package/node_modules/{ieee754 → music-metadata/node_modules/ieee754}/package.json +0 -0
  1149. /package/node_modules/{media-typer → music-metadata/node_modules/media-typer}/LICENSE +0 -0
  1150. /package/node_modules/{media-typer → music-metadata/node_modules/media-typer}/README.md +0 -0
  1151. /package/node_modules/{media-typer → music-metadata/node_modules/media-typer}/dist/index.d.ts +0 -0
  1152. /package/node_modules/{media-typer → music-metadata/node_modules/media-typer}/dist/index.js +0 -0
  1153. /package/node_modules/{media-typer → music-metadata/node_modules/media-typer}/dist/index.js.map +0 -0
  1154. /package/node_modules/{media-typer → music-metadata/node_modules/media-typer}/package.json +0 -0
  1155. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/LICENSE.txt +0 -0
  1156. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/README.md +0 -0
  1157. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/AbstractTokenizer.d.ts +0 -0
  1158. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/AbstractTokenizer.js +0 -0
  1159. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/BlobTokenizer.d.ts +0 -0
  1160. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/BlobTokenizer.js +0 -0
  1161. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/BufferTokenizer.d.ts +0 -0
  1162. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/BufferTokenizer.js +0 -0
  1163. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/FileTokenizer.d.ts +0 -0
  1164. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/FileTokenizer.js +0 -0
  1165. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/ReadStreamTokenizer.d.ts +0 -0
  1166. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/ReadStreamTokenizer.js +0 -0
  1167. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/core.d.ts +0 -0
  1168. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/core.js +0 -0
  1169. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/index.d.ts +0 -0
  1170. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/index.js +0 -0
  1171. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/AbstractStreamReader.d.ts +0 -0
  1172. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/AbstractStreamReader.js +0 -0
  1173. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/Deferred.d.ts +0 -0
  1174. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/Deferred.js +0 -0
  1175. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/Errors.d.ts +0 -0
  1176. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/Errors.js +0 -0
  1177. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/StreamReader.d.ts +0 -0
  1178. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/StreamReader.js +0 -0
  1179. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/WebStreamByobReader.d.ts +0 -0
  1180. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/WebStreamByobReader.js +0 -0
  1181. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/WebStreamDefaultReader.d.ts +0 -0
  1182. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/WebStreamDefaultReader.js +0 -0
  1183. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/WebStreamReader.d.ts +0 -0
  1184. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/WebStreamReader.js +0 -0
  1185. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/WebStreamReaderFactory.d.ts +0 -0
  1186. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/WebStreamReaderFactory.js +0 -0
  1187. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/index.d.ts +0 -0
  1188. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/stream/index.js +0 -0
  1189. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/types.d.ts +0 -0
  1190. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/lib/types.js +0 -0
  1191. /package/node_modules/{strtok3 → music-metadata/node_modules/strtok3}/package.json +0 -0
  1192. /package/node_modules/{token-types → music-metadata/node_modules/token-types}/LICENSE.txt +0 -0
  1193. /package/node_modules/{token-types → music-metadata/node_modules/token-types}/README.md +0 -0
  1194. /package/node_modules/{token-types → music-metadata/node_modules/token-types}/lib/index.d.ts +0 -0
  1195. /package/node_modules/{token-types → music-metadata/node_modules/token-types}/lib/index.js +0 -0
  1196. /package/node_modules/{token-types → music-metadata/node_modules/token-types}/package.json +0 -0
  1197. /package/node_modules/{uint8array-extras → music-metadata/node_modules/uint8array-extras}/index.d.ts +0 -0
  1198. /package/node_modules/{uint8array-extras → music-metadata/node_modules/uint8array-extras}/index.js +0 -0
  1199. /package/node_modules/{uint8array-extras → music-metadata/node_modules/uint8array-extras}/license +0 -0
  1200. /package/node_modules/{uint8array-extras → music-metadata/node_modules/uint8array-extras}/package.json +0 -0
  1201. /package/node_modules/{uint8array-extras → music-metadata/node_modules/uint8array-extras}/readme.md +0 -0
  1202. /package/node_modules/{win-guid → music-metadata/node_modules/win-guid}/LICENSE.txt +0 -0
  1203. /package/node_modules/{win-guid → music-metadata/node_modules/win-guid}/README.md +0 -0
  1204. /package/node_modules/{win-guid → music-metadata/node_modules/win-guid}/lib/guid.d.ts +0 -0
  1205. /package/node_modules/{win-guid → music-metadata/node_modules/win-guid}/lib/guid.js +0 -0
  1206. /package/node_modules/{win-guid → music-metadata/node_modules/win-guid}/package.json +0 -0
@@ -1,4653 +0,0 @@
1
- import { a as resolveMatrixAccountConfig, i as resolveMatrixAccountAllowlistConfig } from "./account-config-BZWN9tGS.js";
2
- import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
3
- import { h as resolveConfiguredMatrixBotUserIds } from "./setup-core-a542Ernq.js";
4
- import { a as buildAllowlistResolutionSummary, c as createTypingCallbacks, d as logInboundDrop, f as logTypingFailure, h as toLocationContext, i as addAllowlistUserEntriesFromConfigEntry, l as formatLocationText, m as summarizeMapping, n as resolveMatrixStoredSessionMeta, o as canonicalizeAllowlistWithResolvedIds, p as patchAllowlistUsersInConfigEntries, r as resolveMatrixRoomConfig, s as createReplyPrefixOptions, u as getAgentScopedMediaLocalRoots } from "./channel-Cmi248PA.js";
5
- import { a as normalizeMatrixUserId, i as normalizeMatrixAllowList, o as resolveMatrixAllowListMatch } from "./config-schema-BShrVROw.js";
6
- import { t as isMatrixQualifiedUserId } from "./target-ids-B-5aQxwn.js";
7
- import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
8
- import { D as parsePollStartContent, S as formatPollAsText, T as isPollStartType, g as MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY, h as readJoinedMatrixMembers, m as isStrictDirectMembership, p as hasDirectMatrixMemberFlag, r as sendMessageMatrix, u as promoteMatrixDirectRoomCandidate, v as chunkMatrixText, w as isPollEventType } from "./send-C9Ssx-iV.js";
9
- import { t as createMatrixThreadBindingManager } from "./thread-bindings-D3RfVgAF.js";
10
- import { i as createMatrixInboundEventDeduper } from "./inbound-dedupe-CaBLblef.js";
11
- import { a as resolveMatrixMessageAttachment, c as fetchMatrixPollSnapshot, i as isLikelyBareFilename, n as formatMatrixMediaUnavailableText, o as resolveMatrixMessageBody, r as formatMatrixMessageText, t as formatMatrixMediaTooLargeText } from "./media-text-DlQC_k_K.js";
12
- import { n as setActiveMatrixClient } from "./active-client-DXvz2gCo.js";
13
- import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
14
- import { d as backfillMatrixAuthDeviceIdAfterStartup, f as resolveMatrixAuth, i as resolveSharedMatrixClient, l as isMatrixStartupAbortError, n as releaseSharedClientInstance, p as resolveMatrixAuthContext, u as throwIfMatrixStartupAborted } from "./shared-CUH5otj8.js";
15
- import "./client-BFRg0kd4.js";
16
- import { i as isMatrixMediaSizeLimitError, r as MatrixMediaSizeLimitError } from "./http-client-CycYxU9-.js";
17
- import { d as resolveAllowlistProviderRuntimeGroupPolicy, f as resolveDefaultGroupPolicy, g as warnMissingProviderGroupPolicyFallbackOnce, h as resolveThreadBindingMaxAgeMsForChannel, m as resolveThreadBindingIdleTimeoutMsForChannel, t as GROUP_POLICY_BLOCKED_LABEL } from "./runtime-api-D1xI_cvh.js";
18
- import { t as resolveMatrixTargets } from "./resolve-targets-nNMcrV3W.js";
19
- import { t as formatMatrixEncryptedEventDisabledWarning } from "./encryption-guidance-CbEFe38F.js";
20
- import { n as isMatrixReadySyncState, r as isMatrixTerminalSyncState, t as isMatrixDisconnectedSyncState } from "./sync-state-CWbp0QSY.js";
21
- import { n as setBoundedMap, t as createMatrixRoomInfoResolver } from "./room-info-CAFZ3Z9J.js";
22
- import { a as EventType, i as resolveMatrixThreadRouting, n as resolveMatrixReplyToEventId, o as RelationType, r as resolveMatrixThreadRootId, t as resolveMatrixInboundRoute } from "./route-DY6at4qJ.js";
23
- import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
24
- import { buildChannelProgressDraftLineForEntry, createChannelProgressDraftGate, createPreviewMessageReceipt, defineFinalizableLivePreviewAdapter, deliverWithFinalizableLivePreviewAdapter, formatChannelProgressDraftLine, formatChannelProgressDraftText, isChannelProgressDraftWorkToolName, mergeChannelProgressDraftLine, normalizeChannelProgressDraftLineIdentity, resolveChannelProgressDraftMaxLines, resolveChannelStreamingBlockEnabled, waitUntilAbort } from "openclaw/plugin-sdk/channel-outbound";
25
- import { normalizeLowercaseStringOrEmpty, normalizeNullableString, normalizeOptionalString, normalizeStringifiedEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
26
- import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
27
- import { resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
28
- import { buildChannelInboundEventContext, createChannelInboundEnvelopeBuilder, hasFinalInboundReplyDispatch, resolveInboundMentionDecision, toInboundMediaFacts } from "openclaw/plugin-sdk/channel-inbound";
29
- import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
30
- import { isFutureDateTimestampMs, parseStrictFiniteNumber, resolveExpiresAtMsFromDurationMs, resolveOptionalIntegerOption } from "openclaw/plugin-sdk/number-runtime";
31
- import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
32
- import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
33
- import { format } from "node:util";
34
- import { escapeRegExp, sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
35
- import { buildTtsSupplementMediaPayload, getReplyPayloadTtsSupplement } from "openclaw/plugin-sdk/reply-payload";
36
- import { resolveAckReaction } from "openclaw/plugin-sdk/channel-feedback";
37
- import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
38
- import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
39
- import { createChannelIngressResolver, defineStableChannelIngressIdentity } from "openclaw/plugin-sdk/channel-ingress-runtime";
40
- import { evaluateSupplementalContextVisibility, resolveChannelContextVisibilityMode } from "openclaw/plugin-sdk/context-visibility-runtime";
41
- import { resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
42
- import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
43
- import { mergePairLoopGuardConfig } from "openclaw/plugin-sdk/pair-loop-guard-runtime";
44
- import { buildInboundHistoryFromEntries } from "openclaw/plugin-sdk/reply-history";
45
- import { decodeHtmlEntities } from "openclaw/plugin-sdk/html-entity-runtime";
46
- import { createConnectedChannelStatusPatch, createTransportActivityStatusPatch } from "openclaw/plugin-sdk/gateway-runtime";
47
- //#region extensions/matrix/src/matrix/monitor/auto-join.ts
48
- function registerMatrixAutoJoin(params) {
49
- const { client, accountConfig, runtime } = params;
50
- const core = getMatrixRuntime();
51
- const logVerbose = (message) => {
52
- if (!core.logging.shouldLogVerbose()) return;
53
- runtime.log?.(message);
54
- };
55
- const autoJoin = accountConfig.autoJoin ?? "off";
56
- const rawAllowlist = normalizeStringifiedEntries(accountConfig.autoJoinAllowlist ?? []);
57
- const autoJoinAllowlist = new Set(rawAllowlist);
58
- const allowedRoomIds = new Set(rawAllowlist.filter((entry) => entry.startsWith("!")));
59
- const allowedAliases = rawAllowlist.filter((entry) => entry.startsWith("#"));
60
- const resolvedAliasRoomIds = /* @__PURE__ */ new Map();
61
- if (autoJoin === "off") return;
62
- if (autoJoin === "always") logVerbose("matrix: auto-join enabled for all invites");
63
- else logVerbose("matrix: auto-join enabled for allowlist invites");
64
- const resolveAllowedAliasRoomId = async (alias) => {
65
- if (resolvedAliasRoomIds.has(alias)) return resolvedAliasRoomIds.get(alias) ?? null;
66
- const resolved = await params.client.resolveRoom(alias);
67
- if (resolved) resolvedAliasRoomIds.set(alias, resolved);
68
- return resolved;
69
- };
70
- const resolveAllowedAliasRoomIds = async () => {
71
- return (await Promise.all(allowedAliases.map(async (alias) => {
72
- try {
73
- return await resolveAllowedAliasRoomId(alias);
74
- } catch (err) {
75
- runtime.error?.(`matrix: failed resolving allowlisted alias ${alias}: ${String(err)}`);
76
- return null;
77
- }
78
- }))).filter((roomId) => Boolean(roomId));
79
- };
80
- const runInviteTask = (roomId, task) => {
81
- Promise.resolve().then(task).catch((err) => {
82
- runtime.error?.(`matrix: auto-join invite handler failed for room ${roomId}: ${String(err)}`);
83
- });
84
- };
85
- client.on("room.invite", (roomId, _inviteEvent) => {
86
- runInviteTask(roomId, async () => {
87
- if (autoJoin === "allowlist") {
88
- const allowedAliasRoomIds = await resolveAllowedAliasRoomIds();
89
- if (!(autoJoinAllowlist.has("*") || allowedRoomIds.has(roomId) || allowedAliasRoomIds.some((resolvedRoomId) => resolvedRoomId === roomId))) {
90
- logVerbose(`matrix: invite ignored (not in allowlist) room=${roomId}`);
91
- return;
92
- }
93
- }
94
- try {
95
- await client.joinRoom(roomId);
96
- logVerbose(`matrix: joined room ${roomId}`);
97
- } catch (err) {
98
- runtime.error?.(`matrix: failed to join room ${roomId}: ${String(err)}`);
99
- }
100
- });
101
- });
102
- }
103
- //#endregion
104
- //#region extensions/matrix/src/matrix/monitor/config.ts
105
- function normalizeMatrixUserLookupEntry(raw) {
106
- return raw.replace(/^matrix:/i, "").replace(/^user:/i, "").trim();
107
- }
108
- function normalizeMatrixRoomLookupEntry(raw) {
109
- return raw.replace(/^matrix:/i, "").replace(/^(room|channel):/i, "").trim();
110
- }
111
- function filterResolvedMatrixAllowlistEntries(entries) {
112
- return entries.filter((entry) => {
113
- const trimmed = entry.trim();
114
- if (!trimmed) return false;
115
- if (trimmed === "*") return true;
116
- return isMatrixQualifiedUserId(normalizeMatrixUserLookupEntry(trimmed));
117
- });
118
- }
119
- function filterFailClosedMatrixAllowlistEntries(entries) {
120
- return entries.filter((entry) => entry.trim().length > 0);
121
- }
122
- function listResolvedMatrixAllowlistEntries(params) {
123
- const resolvedEntries = [];
124
- const seen = /* @__PURE__ */ new Set();
125
- for (const entry of params.entries) {
126
- const input = String(entry).trim();
127
- if (!input || seen.has(input)) continue;
128
- seen.add(input);
129
- const resolved = params.resolvedMap.get(input);
130
- if (!resolved?.resolved || !resolved.id) continue;
131
- const id = normalizeMatrixUserId(resolved.id);
132
- if (isMatrixQualifiedUserId(id)) resolvedEntries.push({
133
- input,
134
- id
135
- });
136
- }
137
- return resolvedEntries;
138
- }
139
- function normalizeConfiguredMatrixAllowlistEntries(entries) {
140
- const normalized = [];
141
- for (const entry of entries ?? []) {
142
- const trimmed = String(entry).trim();
143
- if (trimmed) normalized.push(trimmed);
144
- }
145
- return normalized;
146
- }
147
- function isMatrixDangerousNameMatchingEnabled(params) {
148
- return isDangerousNameMatchingEnabled(resolveMatrixAccountConfig({
149
- cfg: params.cfg,
150
- accountId: params.accountId
151
- }));
152
- }
153
- function addUniqueMatrixAllowlistEntry(params) {
154
- const trimmed = params.entry.trim();
155
- if (!trimmed) return;
156
- const key = trimmed.toLowerCase();
157
- if (params.seen.has(key)) return;
158
- params.seen.add(key);
159
- params.entries.push(trimmed);
160
- }
161
- function resolveStableMatrixMonitorUserEntries(entries) {
162
- const directMatches = [];
163
- for (const entry of entries) {
164
- const input = String(entry).trim();
165
- if (!input) continue;
166
- const query = normalizeMatrixUserLookupEntry(input);
167
- if (!query || query === "*") continue;
168
- directMatches.push(isMatrixQualifiedUserId(query) ? {
169
- input,
170
- resolved: true,
171
- id: normalizeMatrixUserId(query)
172
- } : {
173
- input,
174
- resolved: false
175
- });
176
- }
177
- return buildAllowlistResolutionSummary(directMatches);
178
- }
179
- function logStableMatrixAllowlistUnresolved(params) {
180
- if (params.unresolved.length === 0) return;
181
- summarizeMapping(params.label, [], params.unresolved, params.runtime);
182
- params.runtime.log?.(`${params.label} entries must be full Matrix IDs (example: @user:server). Unresolved entries will not match any sender. To match Matrix display names, set channels.matrix.dangerouslyAllowNameMatching=true.`);
183
- }
184
- function resolveStableMatrixMonitorUserAllowlist(params) {
185
- const allowList = params.allowList;
186
- const resolution = resolveStableMatrixMonitorUserEntries(allowList);
187
- const canonicalized = canonicalizeAllowlistWithResolvedIds({
188
- existing: allowList,
189
- resolvedMap: resolution.resolvedMap
190
- });
191
- logStableMatrixAllowlistUnresolved({
192
- label: params.label,
193
- unresolved: resolution.unresolved,
194
- runtime: params.runtime
195
- });
196
- return {
197
- entries: params.failClosedOnUnresolved ? filterFailClosedMatrixAllowlistEntries(canonicalized) : filterResolvedMatrixAllowlistEntries(canonicalized),
198
- resolvedEntries: listResolvedMatrixAllowlistEntries({
199
- entries: allowList,
200
- resolvedMap: resolution.resolvedMap
201
- })
202
- };
203
- }
204
- async function resolveMatrixMonitorUserEntries(params) {
205
- const directMatches = [];
206
- const pending = [];
207
- for (const entry of params.entries) {
208
- const input = String(entry).trim();
209
- if (!input) continue;
210
- const query = normalizeMatrixUserLookupEntry(input);
211
- if (!query || query === "*") continue;
212
- if (isMatrixQualifiedUserId(query)) {
213
- directMatches.push({
214
- input,
215
- resolved: true,
216
- id: normalizeMatrixUserId(query)
217
- });
218
- continue;
219
- }
220
- pending.push({
221
- input,
222
- query
223
- });
224
- }
225
- (pending.length === 0 ? [] : await params.resolveTargets({
226
- cfg: params.cfg,
227
- accountId: params.accountId,
228
- inputs: pending.map((entry) => entry.query),
229
- kind: "user",
230
- runtime: params.runtime
231
- })).forEach((entry, index) => {
232
- const source = pending[index];
233
- if (!source) return;
234
- directMatches.push({
235
- input: source.input,
236
- resolved: entry.resolved,
237
- id: entry.id ? normalizeMatrixUserId(entry.id) : void 0
238
- });
239
- });
240
- return buildAllowlistResolutionSummary(directMatches);
241
- }
242
- async function resolveMatrixMonitorUserAllowlist(params) {
243
- const allowList = (params.list ?? []).map(String);
244
- if (allowList.length === 0) return {
245
- entries: allowList,
246
- resolvedEntries: []
247
- };
248
- if (!isMatrixDangerousNameMatchingEnabled({
249
- cfg: params.cfg,
250
- accountId: params.accountId
251
- })) return resolveStableMatrixMonitorUserAllowlist({
252
- allowList,
253
- failClosedOnUnresolved: params.failClosedOnUnresolved,
254
- label: params.label,
255
- runtime: params.runtime
256
- });
257
- const resolution = await resolveMatrixMonitorUserEntries({
258
- cfg: params.cfg,
259
- accountId: params.accountId,
260
- entries: allowList,
261
- runtime: params.runtime,
262
- resolveTargets: params.resolveTargets
263
- });
264
- const canonicalized = canonicalizeAllowlistWithResolvedIds({
265
- existing: allowList,
266
- resolvedMap: resolution.resolvedMap
267
- });
268
- summarizeMapping(params.label, resolution.mapping, resolution.unresolved, params.runtime);
269
- if (resolution.unresolved.length > 0) params.runtime.log?.(`${params.label} entries must be full Matrix IDs (example: @user:server). Unresolved entries will not match any sender.`);
270
- return {
271
- entries: params.failClosedOnUnresolved ? filterFailClosedMatrixAllowlistEntries(canonicalized) : filterResolvedMatrixAllowlistEntries(canonicalized),
272
- resolvedEntries: listResolvedMatrixAllowlistEntries({
273
- entries: allowList,
274
- resolvedMap: resolution.resolvedMap
275
- })
276
- };
277
- }
278
- async function resolveMatrixMonitorLiveUserAllowlist(params) {
279
- const liveEntries = normalizeConfiguredMatrixAllowlistEntries(params.entries);
280
- if (liveEntries.length === 0) return [];
281
- const allowNameMatching = isMatrixDangerousNameMatchingEnabled({
282
- cfg: params.cfg,
283
- accountId: params.accountId
284
- });
285
- const effective = [];
286
- const seen = /* @__PURE__ */ new Set();
287
- const startupByInput = new Map((params.startupResolvedEntries ?? []).map((entry) => [entry.input, entry.id]));
288
- const pending = [];
289
- for (const entry of liveEntries) {
290
- const query = normalizeMatrixUserLookupEntry(entry);
291
- if (entry === "*") {
292
- addUniqueMatrixAllowlistEntry({
293
- entries: effective,
294
- seen,
295
- entry
296
- });
297
- continue;
298
- }
299
- if (isMatrixQualifiedUserId(query)) {
300
- addUniqueMatrixAllowlistEntry({
301
- entries: effective,
302
- seen,
303
- entry: normalizeMatrixUserId(query)
304
- });
305
- continue;
306
- }
307
- const startupId = startupByInput.get(entry);
308
- if (allowNameMatching && startupId) {
309
- addUniqueMatrixAllowlistEntry({
310
- entries: effective,
311
- seen,
312
- entry: startupId
313
- });
314
- continue;
315
- }
316
- if (allowNameMatching) {
317
- pending.push(entry);
318
- continue;
319
- }
320
- if (params.failClosedOnUnresolved) addUniqueMatrixAllowlistEntry({
321
- entries: effective,
322
- seen,
323
- entry
324
- });
325
- }
326
- if (pending.length === 0) return effective;
327
- const canonicalized = canonicalizeAllowlistWithResolvedIds({
328
- existing: pending,
329
- resolvedMap: (await resolveMatrixMonitorUserEntries({
330
- cfg: params.cfg,
331
- accountId: params.accountId,
332
- entries: pending,
333
- runtime: params.runtime,
334
- resolveTargets: params.resolveTargets ?? resolveMatrixTargets
335
- })).resolvedMap
336
- });
337
- const resolvedEntries = params.failClosedOnUnresolved ? filterFailClosedMatrixAllowlistEntries(canonicalized) : filterResolvedMatrixAllowlistEntries(canonicalized);
338
- for (const entry of resolvedEntries) addUniqueMatrixAllowlistEntry({
339
- entries: effective,
340
- seen,
341
- entry
342
- });
343
- return effective;
344
- }
345
- async function resolveMatrixMonitorRoomsConfig(params) {
346
- const roomsConfig = params.roomsConfig;
347
- if (!roomsConfig || Object.keys(roomsConfig).length === 0) return roomsConfig;
348
- const mapping = [];
349
- const unresolved = [];
350
- const nextRooms = {};
351
- const allowNameMatching = isMatrixDangerousNameMatchingEnabled({
352
- cfg: params.cfg,
353
- accountId: params.accountId
354
- });
355
- if (roomsConfig["*"]) nextRooms["*"] = roomsConfig["*"];
356
- const pending = [];
357
- for (const [entry, roomConfig] of Object.entries(roomsConfig)) {
358
- if (entry === "*") continue;
359
- const input = entry.trim();
360
- if (!input) continue;
361
- const cleaned = normalizeMatrixRoomLookupEntry(input);
362
- if (!cleaned) {
363
- unresolved.push(entry);
364
- continue;
365
- }
366
- if (cleaned.startsWith("!") && cleaned.includes(":")) {
367
- if (!nextRooms[cleaned]) nextRooms[cleaned] = roomConfig;
368
- if (cleaned !== input) mapping.push(`${input}→${cleaned}`);
369
- continue;
370
- }
371
- if (!cleaned.startsWith("#") && !allowNameMatching) {
372
- unresolved.push(input);
373
- continue;
374
- }
375
- pending.push({
376
- input,
377
- query: cleaned,
378
- config: roomConfig
379
- });
380
- }
381
- if (pending.length > 0) (await params.resolveTargets({
382
- cfg: params.cfg,
383
- accountId: params.accountId,
384
- inputs: pending.map((entry) => entry.query),
385
- kind: "group",
386
- runtime: params.runtime
387
- })).forEach((entry, index) => {
388
- const source = pending[index];
389
- if (!source) return;
390
- if (entry.resolved && entry.id) {
391
- const roomKey = normalizeMatrixRoomLookupEntry(entry.id);
392
- if (!nextRooms[roomKey]) nextRooms[roomKey] = source.config;
393
- mapping.push(`${source.input}→${roomKey}`);
394
- } else unresolved.push(source.input);
395
- });
396
- summarizeMapping("matrix rooms", mapping, unresolved, params.runtime);
397
- if (unresolved.length > 0) params.runtime.log?.("matrix rooms must be room IDs or aliases (example: !room:server or #alias:server). Unresolved entries are ignored.");
398
- const roomUsers = /* @__PURE__ */ new Set();
399
- for (const roomConfig of Object.values(nextRooms)) addAllowlistUserEntriesFromConfigEntry(roomUsers, roomConfig);
400
- if (roomUsers.size === 0) return nextRooms;
401
- if (!allowNameMatching) {
402
- const resolution = resolveStableMatrixMonitorUserEntries(Array.from(roomUsers));
403
- logStableMatrixAllowlistUnresolved({
404
- label: "matrix room users",
405
- unresolved: resolution.unresolved,
406
- runtime: params.runtime
407
- });
408
- return patchAllowlistUsersInConfigEntries({
409
- entries: nextRooms,
410
- resolvedMap: resolution.resolvedMap,
411
- strategy: "canonicalize"
412
- });
413
- }
414
- const resolution = await resolveMatrixMonitorUserEntries({
415
- cfg: params.cfg,
416
- accountId: params.accountId,
417
- entries: Array.from(roomUsers),
418
- runtime: params.runtime,
419
- resolveTargets: params.resolveTargets
420
- });
421
- summarizeMapping("matrix room users", resolution.mapping, resolution.unresolved, params.runtime);
422
- if (resolution.unresolved.length > 0) params.runtime.log?.("matrix room users entries must be full Matrix IDs (example: @user:server). Unresolved entries will not match any sender.");
423
- return patchAllowlistUsersInConfigEntries({
424
- entries: nextRooms,
425
- resolvedMap: resolution.resolvedMap,
426
- strategy: "canonicalize"
427
- });
428
- }
429
- async function resolveMatrixMonitorConfig(params) {
430
- const resolveTargets = params.resolveTargets ?? resolveMatrixTargets;
431
- const [allowFrom, groupAllowFrom, roomsConfig] = await Promise.all([
432
- resolveMatrixMonitorUserAllowlist({
433
- cfg: params.cfg,
434
- accountId: params.accountId,
435
- label: "matrix dm allowlist",
436
- list: params.allowFrom,
437
- runtime: params.runtime,
438
- resolveTargets
439
- }),
440
- resolveMatrixMonitorUserAllowlist({
441
- cfg: params.cfg,
442
- accountId: params.accountId,
443
- label: "matrix group allowlist",
444
- list: params.groupAllowFrom,
445
- failClosedOnUnresolved: true,
446
- runtime: params.runtime,
447
- resolveTargets
448
- }),
449
- resolveMatrixMonitorRoomsConfig({
450
- cfg: params.cfg,
451
- accountId: params.accountId,
452
- roomsConfig: params.roomsConfig,
453
- runtime: params.runtime,
454
- resolveTargets
455
- })
456
- ]);
457
- return {
458
- allowFrom: allowFrom.entries,
459
- allowFromResolvedEntries: allowFrom.resolvedEntries,
460
- groupAllowFrom: groupAllowFrom.entries,
461
- groupAllowFromResolvedEntries: groupAllowFrom.resolvedEntries,
462
- roomsConfig
463
- };
464
- }
465
- //#endregion
466
- //#region extensions/matrix/src/matrix/monitor/direct.ts
467
- const DM_CACHE_TTL_MS = 3e4;
468
- const RECENT_INVITE_TTL_MS = 3e4;
469
- const MAX_DM_ROOMS = 1024;
470
- const MAX_DM_MEMBER_FLAGS = 2048;
471
- function createDirectRoomTracker(client, opts = {}) {
472
- const log = opts.log ?? (() => {});
473
- let lastDmUpdateMs = 0;
474
- let hasSeededDmCache = false;
475
- let cachedSelfUserId = null;
476
- const joinedMembersCache = /* @__PURE__ */ new Map();
477
- const directMemberFlagCache = /* @__PURE__ */ new Map();
478
- const recentInviteCandidates = /* @__PURE__ */ new Map();
479
- const locallyPromotedDirectRooms = /* @__PURE__ */ new Map();
480
- const ensureSelfUserId = async () => {
481
- if (cachedSelfUserId) return cachedSelfUserId;
482
- try {
483
- cachedSelfUserId = await client.getUserId();
484
- } catch {
485
- cachedSelfUserId = null;
486
- }
487
- return cachedSelfUserId;
488
- };
489
- const refreshDmCache = async () => {
490
- const now = Date.now();
491
- if (now - lastDmUpdateMs < DM_CACHE_TTL_MS) return;
492
- lastDmUpdateMs = now;
493
- hasSeededDmCache = await client.dms.update() || hasSeededDmCache;
494
- };
495
- const resolveJoinedMembers = async (roomId) => {
496
- const cached = joinedMembersCache.get(roomId);
497
- const now = Date.now();
498
- if (cached && now - cached.ts < DM_CACHE_TTL_MS) return cached.members;
499
- try {
500
- const normalized = await readJoinedMatrixMembers(client, roomId);
501
- if (!normalized) throw new Error("membership unavailable");
502
- setBoundedMap(joinedMembersCache, roomId, {
503
- members: normalized,
504
- ts: now
505
- }, MAX_DM_ROOMS);
506
- return normalized;
507
- } catch (err) {
508
- log(`matrix: dm member lookup failed room=${roomId} (${String(err)})`);
509
- return null;
510
- }
511
- };
512
- const resolveDirectMemberFlag = async (roomId, userId) => {
513
- const normalizedUserId = userId?.trim();
514
- if (!normalizedUserId) return null;
515
- const cacheKey = `${roomId}\n${normalizedUserId}`;
516
- const cached = directMemberFlagCache.get(cacheKey);
517
- const now = Date.now();
518
- if (cached && now - cached.ts < DM_CACHE_TTL_MS) return cached.isDirect;
519
- const isDirect = await hasDirectMatrixMemberFlag(client, roomId, normalizedUserId);
520
- setBoundedMap(directMemberFlagCache, cacheKey, {
521
- isDirect,
522
- ts: now
523
- }, MAX_DM_MEMBER_FLAGS);
524
- return isDirect;
525
- };
526
- const hasRecentInviteCandidate = (roomId, remoteUserId) => {
527
- const normalizedRemoteUserId = remoteUserId?.trim();
528
- if (!normalizedRemoteUserId) return false;
529
- const cached = recentInviteCandidates.get(roomId);
530
- if (!cached) return false;
531
- if (Date.now() - cached.ts >= RECENT_INVITE_TTL_MS) {
532
- recentInviteCandidates.delete(roomId);
533
- return false;
534
- }
535
- return cached.remoteUserId === normalizedRemoteUserId;
536
- };
537
- const canPromoteRecentInvite = async (roomId) => {
538
- try {
539
- return await opts.canPromoteRecentInvite?.(roomId) ?? true;
540
- } catch (err) {
541
- log(`matrix: recent invite promotion veto failed room=${roomId} (${String(err)})`);
542
- return false;
543
- }
544
- };
545
- const canPromoteUnmappedStrictRoom = async (roomId) => {
546
- try {
547
- return await opts.canPromoteUnmappedStrictRoom?.(roomId) ?? false;
548
- } catch (err) {
549
- log(`matrix: unmapped strict room promotion veto failed room=${roomId} (${String(err)})`);
550
- return false;
551
- }
552
- };
553
- const shouldKeepLocallyPromotedDirectRoom = async (roomId) => {
554
- try {
555
- return await opts.shouldKeepLocallyPromotedDirectRoom?.(roomId);
556
- } catch (err) {
557
- log(`matrix: local promotion keep-check failed room=${roomId} (${String(err)})`);
558
- return;
559
- }
560
- };
561
- const isExplicitlyConfiguredRoom = async (roomId) => {
562
- try {
563
- return await opts.isExplicitlyConfiguredRoom?.(roomId) ?? false;
564
- } catch (err) {
565
- log(`matrix: configured room check failed room=${roomId} (${String(err)})`);
566
- return true;
567
- }
568
- };
569
- const hasLocallyPromotedDirectRoom = (roomId, remoteUserId) => {
570
- const normalizedRemoteUserId = remoteUserId?.trim();
571
- if (!normalizedRemoteUserId) return false;
572
- return locallyPromotedDirectRooms.get(roomId)?.remoteUserId === normalizedRemoteUserId;
573
- };
574
- const rememberLocallyPromotedDirectRoom = (roomId, remoteUserId) => {
575
- const normalizedRemoteUserId = remoteUserId.trim();
576
- if (!normalizedRemoteUserId) return;
577
- setBoundedMap(locallyPromotedDirectRooms, roomId, { remoteUserId: normalizedRemoteUserId }, MAX_DM_ROOMS);
578
- };
579
- return {
580
- invalidateRoom: (roomId) => {
581
- joinedMembersCache.delete(roomId);
582
- for (const key of directMemberFlagCache.keys()) if (key.startsWith(`${roomId}\n`)) directMemberFlagCache.delete(key);
583
- lastDmUpdateMs = 0;
584
- log(`matrix: invalidated dm cache room=${roomId}`);
585
- },
586
- rememberInvite: (roomId, remoteUserId) => {
587
- const normalizedRemoteUserId = remoteUserId.trim();
588
- if (!normalizedRemoteUserId) return;
589
- setBoundedMap(recentInviteCandidates, roomId, {
590
- remoteUserId: normalizedRemoteUserId,
591
- ts: Date.now()
592
- }, MAX_DM_ROOMS);
593
- log(`matrix: remembered invite candidate room=${roomId} sender=${normalizedRemoteUserId}`);
594
- },
595
- isDirectMessage: async (params) => {
596
- const { roomId, senderId } = params;
597
- if (await isExplicitlyConfiguredRoom(roomId)) {
598
- log(`matrix: dm rejected via explicit room config room=${roomId}`);
599
- return false;
600
- }
601
- const selfUserId = params.selfUserId ?? await ensureSelfUserId();
602
- const joinedMembers = await resolveJoinedMembers(roomId);
603
- const strictDirectMembership = isStrictDirectMembership({
604
- selfUserId,
605
- remoteUserId: senderId,
606
- joinedMembers
607
- });
608
- try {
609
- await refreshDmCache();
610
- } catch (err) {
611
- log(`matrix: dm cache refresh failed (${String(err)})`);
612
- }
613
- if (client.dms.isDm(roomId)) {
614
- if (strictDirectMembership) {
615
- log(`matrix: dm detected via m.direct room=${roomId}`);
616
- return true;
617
- }
618
- log(`matrix: ignoring stale m.direct classification room=${roomId}`);
619
- }
620
- if (strictDirectMembership) {
621
- const directViaSelf = await resolveDirectMemberFlag(roomId, selfUserId);
622
- if (directViaSelf === true) {
623
- log(`matrix: dm detected via member state room=${roomId}`);
624
- return true;
625
- }
626
- if (directViaSelf === false) {
627
- log(`matrix: dm rejected via member state room=${roomId}`);
628
- return false;
629
- }
630
- if (!hasSeededDmCache) {
631
- log(`matrix: dm detected via exact 2-member fallback before dm cache seed room=${roomId}`);
632
- return true;
633
- }
634
- if (hasLocallyPromotedDirectRoom(roomId, senderId)) {
635
- if (await shouldKeepLocallyPromotedDirectRoom(roomId) !== false) {
636
- log(`matrix: dm detected via local promotion room=${roomId}`);
637
- return true;
638
- }
639
- locallyPromotedDirectRooms.delete(roomId);
640
- log(`matrix: local promotion cleared room=${roomId}`);
641
- }
642
- if (hasRecentInviteCandidate(roomId, senderId) && await canPromoteRecentInvite(roomId)) {
643
- const promotion = await promoteMatrixDirectRoomCandidate({
644
- client,
645
- remoteUserId: senderId ?? "",
646
- roomId,
647
- selfUserId
648
- });
649
- if (promotion.classifyAsDirect) {
650
- rememberLocallyPromotedDirectRoom(roomId, senderId ?? "");
651
- log(`matrix: dm detected via recent invite room=${roomId} reason=${promotion.reason} repaired=${String(promotion.repaired)}`);
652
- return true;
653
- }
654
- }
655
- if (await canPromoteUnmappedStrictRoom(roomId)) {
656
- const promotion = await promoteMatrixDirectRoomCandidate({
657
- client,
658
- remoteUserId: senderId ?? "",
659
- roomId,
660
- selfUserId
661
- });
662
- if (promotion.classifyAsDirect) {
663
- rememberLocallyPromotedDirectRoom(roomId, senderId ?? "");
664
- log(`matrix: dm detected via per-room strict fallback room=${roomId} reason=${promotion.reason} repaired=${String(promotion.repaired)}`);
665
- return true;
666
- }
667
- }
668
- }
669
- log(`matrix: dm check room=${roomId} result=group members=${joinedMembers?.length ?? "unknown"}`);
670
- return false;
671
- }
672
- };
673
- }
674
- //#endregion
675
- //#region extensions/matrix/src/matrix/monitor/access-state.ts
676
- function normalizeMatrixEntry(raw) {
677
- return normalizeMatrixAllowList([raw ?? ""])[0] ?? null;
678
- }
679
- const matrixIngressIdentity = defineStableChannelIngressIdentity({
680
- key: "sender-id",
681
- normalize: normalizeMatrixEntry,
682
- matchEntry({ subject, entry }) {
683
- const senderId = subject.identifiers[0]?.value;
684
- return entry.value === "*" || resolveMatrixAllowListMatch({
685
- allowList: [entry.value],
686
- userId: senderId ?? ""
687
- }).allowed;
688
- }
689
- });
690
- function resolveMatrixGroupIngress(params) {
691
- if (params.groupPolicy === "disabled") return {
692
- groupPolicy: "disabled",
693
- groupAllowFrom: []
694
- };
695
- if (params.effectiveRoomUsers.length > 0) return {
696
- groupPolicy: "allowlist",
697
- groupAllowFrom: params.effectiveRoomUsers
698
- };
699
- if (params.groupPolicy === "allowlist" && params.effectiveGroupAllowFrom.length > 0) return {
700
- groupPolicy: "allowlist",
701
- groupAllowFrom: params.effectiveGroupAllowFrom
702
- };
703
- return {
704
- groupPolicy: "open",
705
- groupAllowFrom: []
706
- };
707
- }
708
- async function resolveMatrixMonitorAccessState(params) {
709
- const dmPolicy = params.dmPolicy ?? "pairing";
710
- const groupPolicy = params.groupPolicy ?? "open";
711
- const effectiveGroupAllowFrom = normalizeMatrixAllowList(params.groupAllowFrom);
712
- const effectiveRoomUsers = normalizeMatrixAllowList(params.roomUsers);
713
- const groupIngress = resolveMatrixGroupIngress({
714
- groupPolicy,
715
- effectiveGroupAllowFrom,
716
- effectiveRoomUsers
717
- });
718
- const accountId = params.accountId ?? "default";
719
- const eventKind = params.eventKind ?? "message";
720
- return {
721
- effectiveGroupAllowFrom,
722
- effectiveRoomUsers,
723
- messageIngress: await createChannelIngressResolver({
724
- channelId: "matrix",
725
- accountId,
726
- identity: matrixIngressIdentity,
727
- readStoreAllowFrom: async () => params.storeAllowFrom
728
- }).message({
729
- subject: { stableId: params.senderId },
730
- conversation: {
731
- kind: params.isRoom ? "group" : "direct",
732
- id: params.isRoom ? "matrix-room" : "matrix-dm"
733
- },
734
- event: {
735
- kind: eventKind,
736
- authMode: "inbound",
737
- mayPair: params.isRoom ? false : eventKind === "message"
738
- },
739
- dmPolicy,
740
- groupPolicy: params.isRoom ? groupIngress.groupPolicy : "disabled",
741
- policy: { groupAllowFromFallbackToAllowFrom: false },
742
- allowFrom: params.allowFrom,
743
- ...params.isRoom ? { groupAllowFrom: groupIngress.groupAllowFrom } : {}
744
- }),
745
- accountId,
746
- senderId: params.senderId,
747
- isRoom: params.isRoom
748
- };
749
- }
750
- async function resolveMatrixMonitorCommandAccess(state, params) {
751
- const commandAllowFrom = state.isRoom ? [] : state.messageIngress.senderAccess.effectiveAllowFrom;
752
- const commandGroupAllowFrom = state.effectiveRoomUsers.length > 0 ? state.effectiveRoomUsers : state.effectiveGroupAllowFrom;
753
- return (await createChannelIngressResolver({
754
- channelId: "matrix",
755
- accountId: state.accountId,
756
- identity: matrixIngressIdentity
757
- }).command({
758
- subject: { stableId: state.senderId },
759
- conversation: {
760
- kind: state.isRoom ? "group" : "direct",
761
- id: state.isRoom ? "matrix-room" : "matrix-dm"
762
- },
763
- dmPolicy: "allowlist",
764
- groupPolicy: "allowlist",
765
- policy: { groupAllowFromFallbackToAllowFrom: false },
766
- allowFrom: commandAllowFrom,
767
- groupAllowFrom: commandGroupAllowFrom,
768
- command: {
769
- useAccessGroups: params.useAccessGroups,
770
- allowTextCommands: params.allowTextCommands,
771
- hasControlCommand: params.hasControlCommand,
772
- groupOwnerAllowFrom: "none",
773
- commandGroupAllowFromFallbackToAllowFrom: false
774
- }
775
- })).commandAccess;
776
- }
777
- //#endregion
778
- //#region extensions/matrix/src/matrix/monitor/verification-utils.ts
779
- const VERIFICATION_EVENT_PREFIX = "m.key.verification.";
780
- const VERIFICATION_REQUEST_MSGTYPE = "m.key.verification.request";
781
- const VERIFICATION_NOTICE_PREFIXES = [
782
- "Matrix verification request received from ",
783
- "Matrix verification is ready with ",
784
- "Matrix verification started with ",
785
- "Matrix verification completed with ",
786
- "Matrix verification cancelled by ",
787
- "Matrix verification SAS with "
788
- ];
789
- function trimMaybeString(input) {
790
- return normalizeOptionalString(input) ?? "";
791
- }
792
- function isMatrixVerificationEventType(type) {
793
- return trimMaybeString(type).startsWith(VERIFICATION_EVENT_PREFIX);
794
- }
795
- function isMatrixVerificationRequestMsgType(msgtype) {
796
- return trimMaybeString(msgtype) === VERIFICATION_REQUEST_MSGTYPE;
797
- }
798
- function isMatrixVerificationNoticeBody(body) {
799
- const text = trimMaybeString(body);
800
- return VERIFICATION_NOTICE_PREFIXES.some((prefix) => text.startsWith(prefix));
801
- }
802
- function isMatrixVerificationRoomMessage(content) {
803
- return isMatrixVerificationRequestMsgType(content.msgtype) || trimMaybeString(content.msgtype) === "m.notice" && isMatrixVerificationNoticeBody(content.body);
804
- }
805
- const matrixVerificationConstants = {
806
- eventPrefix: VERIFICATION_EVENT_PREFIX,
807
- requestMsgtype: VERIFICATION_REQUEST_MSGTYPE
808
- };
809
- //#endregion
810
- //#region extensions/matrix/src/matrix/monitor/verification-events.ts
811
- const MAX_TRACKED_VERIFICATION_EVENTS = 1024;
812
- const SAS_NOTICE_RETRY_DELAY_MS = 750;
813
- const VERIFICATION_EVENT_STARTUP_GRACE_MS = 3e4;
814
- const loadMatrixDirectRoomDeps = createLazyRuntimeModule(() => Promise.all([import("./send-C9Ssx-iV.js").then((n) => n.l), import("./send-C9Ssx-iV.js").then((n) => n.f)]).then(([directManagementModule, directRoomModule]) => ({
815
- inspectMatrixDirectRooms: directManagementModule.inspectMatrixDirectRooms,
816
- isStrictDirectRoom: directRoomModule.isStrictDirectRoom
817
- })));
818
- function readVerificationSignal(event) {
819
- const type = normalizeNullableString(event?.type) ?? "";
820
- const content = event?.content ?? {};
821
- const msgtype = normalizeNullableString(content.msgtype) ?? "";
822
- const relatedEventId = normalizeNullableString(content["m.relates_to"]?.event_id);
823
- const transactionId = normalizeNullableString(content.transaction_id);
824
- if (type === EventType.RoomMessage && isMatrixVerificationRequestMsgType(msgtype)) return {
825
- stage: "request",
826
- flowId: normalizeNullableString(event.event_id) ?? transactionId ?? relatedEventId
827
- };
828
- if (!isMatrixVerificationEventType(type)) return null;
829
- const flowId = transactionId ?? relatedEventId ?? normalizeNullableString(event.event_id);
830
- if (type === `${matrixVerificationConstants.eventPrefix}request`) return {
831
- stage: "request",
832
- flowId
833
- };
834
- if (type === `${matrixVerificationConstants.eventPrefix}ready`) return {
835
- stage: "ready",
836
- flowId
837
- };
838
- if (type === "m.key.verification.start") return {
839
- stage: "start",
840
- flowId
841
- };
842
- if (type === "m.key.verification.cancel") return {
843
- stage: "cancel",
844
- flowId
845
- };
846
- if (type === "m.key.verification.done") return {
847
- stage: "done",
848
- flowId
849
- };
850
- return {
851
- stage: "other",
852
- flowId
853
- };
854
- }
855
- function formatVerificationStageNotice(params) {
856
- const { stage, senderId, event } = params;
857
- const content = event.content;
858
- switch (stage) {
859
- case "request": return `Matrix verification request received from ${senderId}. Open "Verify by emoji" in your Matrix client to continue.`;
860
- case "ready": return `Matrix verification is ready with ${senderId}. Choose "Verify by emoji" to reveal the emoji sequence.`;
861
- case "start": return `Matrix verification started with ${senderId}.`;
862
- case "done": return `Matrix verification completed with ${senderId}.`;
863
- case "cancel": {
864
- const code = normalizeNullableString(content.code);
865
- const reason = normalizeNullableString(content.reason);
866
- if (code && reason) return `Matrix verification cancelled by ${senderId} (${code}: ${reason}).`;
867
- if (reason) return `Matrix verification cancelled by ${senderId} (${reason}).`;
868
- return `Matrix verification cancelled by ${senderId}.`;
869
- }
870
- default: return null;
871
- }
872
- }
873
- function formatVerificationSasNotice(summary) {
874
- const sas = summary.sas;
875
- if (!sas) return null;
876
- const emojiLine = Array.isArray(sas.emoji) && sas.emoji.length > 0 ? `SAS emoji: ${sas.emoji.map(([emoji, name]) => `${normalizeNullableString(emoji) ?? "?"} ${normalizeNullableString(name) ?? "?"}`).join(" | ")}` : null;
877
- const decimalLine = Array.isArray(sas.decimal) && sas.decimal.length === 3 ? `SAS decimal: ${sas.decimal.join(" ")}` : null;
878
- if (!emojiLine && !decimalLine) return null;
879
- const lines = [`Matrix verification SAS with ${summary.otherUserId}:`];
880
- if (emojiLine) lines.push(emojiLine);
881
- if (decimalLine) lines.push(decimalLine);
882
- lines.push("If both sides match, choose 'They match' in your Matrix app.");
883
- return lines.join("\n");
884
- }
885
- function resolveVerificationFlowCandidates(params) {
886
- const { event, flowId } = params;
887
- const content = event.content;
888
- const candidates = /* @__PURE__ */ new Set();
889
- const add = (value) => {
890
- const normalized = normalizeNullableString(value);
891
- if (normalized) candidates.add(normalized);
892
- };
893
- add(flowId);
894
- add(event.event_id);
895
- add(content.transaction_id);
896
- add(content["m.relates_to"]?.event_id);
897
- return Array.from(candidates);
898
- }
899
- function resolveSummaryRecency(summary) {
900
- const ts = Date.parse(summary.updatedAt ?? "");
901
- return Number.isFinite(ts) ? ts : 0;
902
- }
903
- function isActiveVerificationSummary(summary) {
904
- if (summary.completed === true) return false;
905
- if (summary.phaseName === "cancelled" || summary.phaseName === "done") return false;
906
- if (typeof summary.phase === "number" && summary.phase >= 4) return false;
907
- return true;
908
- }
909
- async function resolveVerificationSummaryForSignal(client, params) {
910
- if (!client.crypto) return null;
911
- await client.crypto.ensureVerificationDmTracked({
912
- roomId: params.roomId,
913
- userId: params.senderId
914
- }).catch(() => null);
915
- const list = await client.crypto.listVerifications();
916
- if (list.length === 0) return null;
917
- const candidates = resolveVerificationFlowCandidates({
918
- event: params.event,
919
- flowId: params.flowId
920
- });
921
- const byTransactionId = list.find((entry) => candidates.some((candidate) => entry.transactionId === candidate));
922
- if (byTransactionId) return byTransactionId;
923
- const { inspectMatrixDirectRooms, isStrictDirectRoom } = await loadMatrixDirectRoomDeps();
924
- const activeRoomId = normalizeNullableString((await inspectMatrixDirectRooms({
925
- client,
926
- remoteUserId: params.senderId
927
- }).catch(() => null))?.activeRoomId);
928
- if (activeRoomId) {
929
- if (activeRoomId !== params.roomId) return null;
930
- } else if (!await isStrictDirectRoom({
931
- client,
932
- roomId: params.roomId,
933
- remoteUserId: params.senderId
934
- })) return null;
935
- const activeByUser = list.filter((entry) => entry.otherUserId === params.senderId && isActiveVerificationSummary(entry)).toSorted((a, b) => resolveSummaryRecency(b) - resolveSummaryRecency(a));
936
- const activeInRoom = activeByUser.filter((entry) => {
937
- return normalizeNullableString(entry.roomId) === params.roomId;
938
- });
939
- if (activeInRoom.length > 0) return activeInRoom[0] ?? null;
940
- return activeByUser[0] ?? null;
941
- }
942
- async function resolveVerificationSasNoticeForSignal(client, params) {
943
- const summary = await resolveVerificationSummaryForSignal(client, params);
944
- const immediateNotice = summary && isActiveVerificationSummary(summary) ? formatVerificationSasNotice(summary) : null;
945
- if (immediateNotice || params.stage !== "ready" && params.stage !== "start") return {
946
- summary,
947
- sasNotice: immediateNotice
948
- };
949
- await new Promise((resolve) => {
950
- setTimeout(resolve, params.sasNoticeRetryDelayMs ?? SAS_NOTICE_RETRY_DELAY_MS);
951
- });
952
- const retriedSummary = await resolveVerificationSummaryForSignal(client, params);
953
- return {
954
- summary: retriedSummary,
955
- sasNotice: retriedSummary && isActiveVerificationSummary(retriedSummary) ? formatVerificationSasNotice(retriedSummary) : null
956
- };
957
- }
958
- function trackBounded(set, value) {
959
- if (!value || set.has(value)) return false;
960
- set.add(value);
961
- if (set.size > MAX_TRACKED_VERIFICATION_EVENTS) {
962
- const oldest = set.values().next().value;
963
- if (typeof oldest === "string") set.delete(oldest);
964
- }
965
- return true;
966
- }
967
- async function sendVerificationNotice(params) {
968
- const roomId = normalizeNullableString(params.roomId);
969
- if (!roomId) return;
970
- try {
971
- await params.client.sendMessage(roomId, {
972
- msgtype: "m.notice",
973
- body: params.body
974
- });
975
- } catch (err) {
976
- params.logVerboseMessage(`matrix: failed sending verification notice room=${roomId}: ${String(err)}`);
977
- }
978
- }
979
- async function isVerificationNoticeAuthorized(params) {
980
- if (!params.dmEnabled || params.dmPolicy === "disabled") {
981
- params.logVerboseMessage(`matrix: blocked verification sender ${params.senderId} (dmPolicy=${params.dmPolicy}, dmEnabled=${String(params.dmEnabled)})`);
982
- return false;
983
- }
984
- const storeAllowFrom = params.dmPolicy !== "allowlist" && params.dmPolicy !== "open" ? await params.readStoreAllowFrom() : [];
985
- if ((await resolveMatrixMonitorAccessState({
986
- allowFrom: params.allowFrom,
987
- storeAllowFrom,
988
- dmPolicy: params.dmPolicy,
989
- groupPolicy: "open",
990
- groupAllowFrom: [],
991
- roomUsers: [],
992
- senderId: params.senderId,
993
- isRoom: false
994
- })).messageIngress.senderAccess.decision === "allow") return true;
995
- params.logVerboseMessage(`matrix: blocked verification sender ${params.senderId} (dmPolicy=${params.dmPolicy})`);
996
- return false;
997
- }
998
- function createMatrixVerificationEventRouter(params) {
999
- const routerStartedAtMs = Date.now();
1000
- const routedVerificationEvents = /* @__PURE__ */ new Set();
1001
- const routedVerificationSasFingerprints = /* @__PURE__ */ new Set();
1002
- const routedVerificationStageNotices = /* @__PURE__ */ new Set();
1003
- const verificationFlowRooms = /* @__PURE__ */ new Map();
1004
- const verificationUserRooms = /* @__PURE__ */ new Map();
1005
- async function resolveActiveDirectRoomId(remoteUserId) {
1006
- const { inspectMatrixDirectRooms } = await loadMatrixDirectRoomDeps();
1007
- return normalizeNullableString((await inspectMatrixDirectRooms({
1008
- client: params.client,
1009
- remoteUserId
1010
- }).catch(() => null))?.activeRoomId);
1011
- }
1012
- function shouldEmitVerificationEventNotice(event) {
1013
- const eventTs = typeof event.origin_server_ts === "number" && Number.isFinite(event.origin_server_ts) ? event.origin_server_ts : null;
1014
- if (eventTs === null) return true;
1015
- return eventTs >= routerStartedAtMs - VERIFICATION_EVENT_STARTUP_GRACE_MS;
1016
- }
1017
- function rememberVerificationRoom(roomId, event, flowId) {
1018
- for (const candidate of resolveVerificationFlowCandidates({
1019
- event,
1020
- flowId
1021
- })) {
1022
- verificationFlowRooms.set(candidate, roomId);
1023
- if (verificationFlowRooms.size > MAX_TRACKED_VERIFICATION_EVENTS) {
1024
- const oldest = verificationFlowRooms.keys().next().value;
1025
- if (typeof oldest === "string") verificationFlowRooms.delete(oldest);
1026
- }
1027
- }
1028
- }
1029
- function rememberVerificationUserRoom(remoteUserId, roomId) {
1030
- const normalizedUserId = normalizeNullableString(remoteUserId);
1031
- const normalizedRoomId = normalizeNullableString(roomId);
1032
- if (!normalizedUserId || !normalizedRoomId) return;
1033
- verificationUserRooms.delete(normalizedUserId);
1034
- verificationUserRooms.set(normalizedUserId, normalizedRoomId);
1035
- if (verificationUserRooms.size > MAX_TRACKED_VERIFICATION_EVENTS) {
1036
- const oldest = verificationUserRooms.keys().next().value;
1037
- if (typeof oldest === "string") verificationUserRooms.delete(oldest);
1038
- }
1039
- }
1040
- async function resolveSummaryRoomId(summary) {
1041
- const mappedRoomId = normalizeNullableString(summary.roomId) ?? normalizeNullableString(summary.transactionId ? verificationFlowRooms.get(summary.transactionId) : null) ?? normalizeNullableString(verificationFlowRooms.get(summary.id));
1042
- if (mappedRoomId) return mappedRoomId;
1043
- const remoteUserId = normalizeNullableString(summary.otherUserId);
1044
- if (!remoteUserId) return null;
1045
- const recentRoomId = normalizeNullableString(verificationUserRooms.get(remoteUserId));
1046
- const activeRoomId = await resolveActiveDirectRoomId(remoteUserId);
1047
- if (recentRoomId && activeRoomId && recentRoomId === activeRoomId) return recentRoomId;
1048
- if (activeRoomId) return activeRoomId;
1049
- if (recentRoomId && await (await loadMatrixDirectRoomDeps()).isStrictDirectRoom({
1050
- client: params.client,
1051
- roomId: recentRoomId,
1052
- remoteUserId
1053
- })) return recentRoomId;
1054
- return null;
1055
- }
1056
- async function routeVerificationSummary(summary) {
1057
- const roomId = await resolveSummaryRoomId(summary);
1058
- if (!roomId || !isActiveVerificationSummary(summary)) return;
1059
- if (!await (await loadMatrixDirectRoomDeps()).isStrictDirectRoom({
1060
- client: params.client,
1061
- roomId,
1062
- remoteUserId: summary.otherUserId
1063
- })) {
1064
- params.logVerboseMessage(`matrix: ignoring verification summary outside strict DM room=${roomId} sender=${summary.otherUserId}`);
1065
- return;
1066
- }
1067
- if (!await isVerificationNoticeAuthorized({
1068
- senderId: summary.otherUserId,
1069
- allowFrom: params.allowFrom,
1070
- dmEnabled: params.dmEnabled,
1071
- dmPolicy: params.dmPolicy,
1072
- readStoreAllowFrom: params.readStoreAllowFrom,
1073
- logVerboseMessage: params.logVerboseMessage
1074
- })) return;
1075
- const sasNotice = formatVerificationSasNotice(summary);
1076
- if (!sasNotice) return;
1077
- const sasFingerprint = `${summary.id}:${JSON.stringify(summary.sas)}`;
1078
- if (!trackBounded(routedVerificationSasFingerprints, sasFingerprint)) return;
1079
- await sendVerificationNotice({
1080
- client: params.client,
1081
- roomId,
1082
- body: sasNotice,
1083
- logVerboseMessage: params.logVerboseMessage
1084
- });
1085
- }
1086
- function routeVerificationEvent(roomId, event) {
1087
- const senderId = normalizeNullableString(event?.sender);
1088
- if (!senderId) return false;
1089
- const signal = readVerificationSignal(event);
1090
- if (!signal) return false;
1091
- rememberVerificationRoom(roomId, event, signal.flowId);
1092
- const routeTask = async () => {
1093
- if (!shouldEmitVerificationEventNotice(event)) {
1094
- params.logVerboseMessage(`matrix: ignoring historical verification event room=${roomId} id=${event.event_id ?? "unknown"} type=${event.type ?? "unknown"}`);
1095
- return;
1096
- }
1097
- const flowId = signal.flowId;
1098
- const sourceFingerprint = normalizeNullableString(event?.event_id) ?? `${senderId}:${event.type}:${flowId ?? "none"}`;
1099
- if (!await (await loadMatrixDirectRoomDeps()).isStrictDirectRoom({
1100
- client: params.client,
1101
- roomId,
1102
- remoteUserId: senderId
1103
- })) {
1104
- params.logVerboseMessage(`matrix: ignoring verification event outside strict DM room=${roomId} sender=${senderId}`);
1105
- return;
1106
- }
1107
- if (!await isVerificationNoticeAuthorized({
1108
- senderId,
1109
- allowFrom: params.allowFrom,
1110
- dmEnabled: params.dmEnabled,
1111
- dmPolicy: params.dmPolicy,
1112
- readStoreAllowFrom: params.readStoreAllowFrom,
1113
- logVerboseMessage: params.logVerboseMessage
1114
- })) return;
1115
- rememberVerificationUserRoom(senderId, roomId);
1116
- if (!trackBounded(routedVerificationEvents, sourceFingerprint)) return;
1117
- const stageNotice = formatVerificationStageNotice({
1118
- stage: signal.stage,
1119
- senderId,
1120
- event
1121
- });
1122
- const { summary, sasNotice } = await resolveVerificationSasNoticeForSignal(params.client, {
1123
- roomId,
1124
- event,
1125
- senderId,
1126
- flowId,
1127
- stage: signal.stage,
1128
- sasNoticeRetryDelayMs: params.sasNoticeRetryDelayMs
1129
- }).catch(() => ({
1130
- summary: null,
1131
- sasNotice: null
1132
- }));
1133
- const notices = [];
1134
- if (stageNotice) {
1135
- const stageKey = `${roomId}:${senderId}:${flowId ?? sourceFingerprint}:${signal.stage}`;
1136
- if (trackBounded(routedVerificationStageNotices, stageKey)) notices.push(stageNotice);
1137
- }
1138
- if (summary && sasNotice) {
1139
- const sasFingerprint = `${summary.id}:${JSON.stringify(summary.sas)}`;
1140
- if (trackBounded(routedVerificationSasFingerprints, sasFingerprint)) notices.push(sasNotice);
1141
- }
1142
- if (notices.length === 0) return;
1143
- for (const body of notices) await sendVerificationNotice({
1144
- client: params.client,
1145
- roomId,
1146
- body,
1147
- logVerboseMessage: params.logVerboseMessage
1148
- });
1149
- };
1150
- if (params.runDetachedTask) params.runDetachedTask(`verification event handler room=${roomId} id=${event.event_id ?? "unknown"}`, routeTask);
1151
- else routeTask().catch((err) => {
1152
- params.logVerboseMessage(`matrix: failed routing verification event: ${String(err)}`);
1153
- });
1154
- return true;
1155
- }
1156
- return {
1157
- routeVerificationEvent,
1158
- routeVerificationSummary
1159
- };
1160
- }
1161
- //#endregion
1162
- //#region extensions/matrix/src/matrix/monitor/events.ts
1163
- const MATRIX_POST_HEALTHY_SYNC_DECRYPT_FAILURE_WINDOW_MS = 2 * 6e4;
1164
- const MATRIX_POST_HEALTHY_SYNC_DECRYPT_FAILURE_THRESHOLD = 3;
1165
- const MATRIX_POST_HEALTHY_SYNC_DECRYPT_FAILURE_SAMPLE_LIMIT = 3;
1166
- function formatMatrixPostHealthySyncDecryptionHint(accountId) {
1167
- return `matrix: repeated fresh encrypted messages are still failing to decrypt after Matrix resumed healthy sync. This device may still be missing new room keys. Check 'openclaw matrix verify status --verbose --account ${accountId}' and 'openclaw matrix devices list --account ${accountId}'.`;
1168
- }
1169
- function isFreshPostHealthySyncDecryptFailure(params) {
1170
- const { event, healthySyncSinceMs, graceMs = 0, nowMs } = params;
1171
- if (typeof healthySyncSinceMs !== "number" || !Number.isFinite(healthySyncSinceMs)) return false;
1172
- const eventTs = event.origin_server_ts;
1173
- if (!Number.isFinite(eventTs) || eventTs <= 0) return false;
1174
- if (eventTs < healthySyncSinceMs + graceMs) return false;
1175
- if (eventTs > nowMs + 6e4) return false;
1176
- return true;
1177
- }
1178
- function createMatrixPostHealthySyncDecryptFailureTracker(params) {
1179
- let observations = [];
1180
- let warningEmitted = false;
1181
- let trackedHealthySyncSinceMs;
1182
- const resetObservations = () => {
1183
- observations = [];
1184
- warningEmitted = false;
1185
- };
1186
- const pruneObservations = (nowMs) => {
1187
- observations = observations.filter((entry) => nowMs - entry.eventTs <= MATRIX_POST_HEALTHY_SYNC_DECRYPT_FAILURE_WINDOW_MS);
1188
- if (observations.length === 0) warningEmitted = false;
1189
- };
1190
- return { recordFailure(roomId, event, error) {
1191
- const nowMs = Date.now();
1192
- const healthySyncSinceMs = params.getHealthySyncSinceMs?.();
1193
- if (healthySyncSinceMs !== trackedHealthySyncSinceMs) {
1194
- trackedHealthySyncSinceMs = healthySyncSinceMs;
1195
- resetObservations();
1196
- }
1197
- if (!isFreshPostHealthySyncDecryptFailure({
1198
- event,
1199
- healthySyncSinceMs,
1200
- graceMs: params.startupGraceMs,
1201
- nowMs
1202
- })) return {
1203
- freshAfterHealthySync: false,
1204
- failureCount: 0
1205
- };
1206
- pruneObservations(nowMs);
1207
- const key = `${roomId}|${event.event_id}`;
1208
- if (!observations.some((entry) => entry.key === key)) observations.push({
1209
- key,
1210
- roomId,
1211
- eventId: event.event_id,
1212
- sender: typeof event.sender === "string" ? event.sender : null,
1213
- eventTs: event.origin_server_ts,
1214
- error: error.message
1215
- });
1216
- const failureCount = observations.length;
1217
- if (warningEmitted || failureCount < MATRIX_POST_HEALTHY_SYNC_DECRYPT_FAILURE_THRESHOLD) return {
1218
- freshAfterHealthySync: true,
1219
- failureCount
1220
- };
1221
- warningEmitted = true;
1222
- const rooms = uniqueStrings(observations.map((entry) => entry.roomId)).slice(0, MATRIX_POST_HEALTHY_SYNC_DECRYPT_FAILURE_SAMPLE_LIMIT);
1223
- const senders = uniqueStrings(observations.map((entry) => entry.sender).filter((sender) => Boolean(sender))).slice(0, MATRIX_POST_HEALTHY_SYNC_DECRYPT_FAILURE_SAMPLE_LIMIT);
1224
- const eventIds = observations.slice(-3).map((entry) => entry.eventId);
1225
- const latestError = observations.at(-1)?.error ?? error.message;
1226
- return {
1227
- freshAfterHealthySync: true,
1228
- failureCount,
1229
- warning: {
1230
- rooms,
1231
- roomCount: new Set(observations.map((entry) => entry.roomId)).size,
1232
- senders,
1233
- senderCount: new Set(observations.map((entry) => entry.sender).filter(Boolean)).size,
1234
- eventIds,
1235
- latestError,
1236
- windowMs: MATRIX_POST_HEALTHY_SYNC_DECRYPT_FAILURE_WINDOW_MS
1237
- }
1238
- };
1239
- } };
1240
- }
1241
- function formatMatrixSelfDecryptionHint(accountId) {
1242
- return `matrix: failed to decrypt a message from this same Matrix user. This usually means another Matrix device did not share the room key, or another OpenClaw runtime is using the same account. Check 'openclaw matrix verify status --verbose --account ${accountId}' and 'openclaw matrix devices list --account ${accountId}'.`;
1243
- }
1244
- async function resolveMatrixSelfUserId(client, logVerboseMessage) {
1245
- if (typeof client.getUserId !== "function") return null;
1246
- try {
1247
- return await client.getUserId() ?? null;
1248
- } catch (err) {
1249
- logVerboseMessage(`matrix: failed resolving self user id for decrypt warning: ${String(err)}`);
1250
- return null;
1251
- }
1252
- }
1253
- function registerMatrixMonitorEvents(params) {
1254
- const { cfg, client, auth, allowFrom, dmEnabled, dmPolicy, readStoreAllowFrom, directTracker, logVerboseMessage, warnedEncryptedRooms, warnedCryptoMissingRooms, logger, startupGraceMs, getHealthySyncSinceMs, formatNativeDependencyHint, onRoomMessage, runDetachedTask, sasNoticeRetryDelayMs } = params;
1255
- const postHealthySyncDecryptFailureTracker = createMatrixPostHealthySyncDecryptFailureTracker({
1256
- getHealthySyncSinceMs,
1257
- startupGraceMs
1258
- });
1259
- const { routeVerificationEvent, routeVerificationSummary } = createMatrixVerificationEventRouter({
1260
- client,
1261
- allowFrom,
1262
- dmEnabled,
1263
- dmPolicy,
1264
- readStoreAllowFrom,
1265
- logVerboseMessage,
1266
- runDetachedTask,
1267
- sasNoticeRetryDelayMs
1268
- });
1269
- const runMonitorTask = (label, task) => {
1270
- if (runDetachedTask) return runDetachedTask(label, task);
1271
- return Promise.resolve().then(task).catch((error) => {
1272
- logVerboseMessage(`matrix: ${label} failed (${String(error)})`);
1273
- });
1274
- };
1275
- client.on("room.message", (roomId, event) => {
1276
- if (routeVerificationEvent(roomId, event)) return;
1277
- runMonitorTask(`room message handler room=${roomId} id=${event.event_id ?? "unknown"}`, async () => {
1278
- await onRoomMessage(roomId, event);
1279
- });
1280
- });
1281
- client.on("room.encrypted_event", (roomId, event) => {
1282
- const eventId = event?.event_id ?? "unknown";
1283
- const eventType = event?.type ?? "unknown";
1284
- logVerboseMessage(`matrix: encrypted event room=${roomId} type=${eventType} id=${eventId}`);
1285
- });
1286
- client.on("room.decrypted_event", (roomId, event) => {
1287
- const eventId = event?.event_id ?? "unknown";
1288
- const eventType = event?.type ?? "unknown";
1289
- logVerboseMessage(`matrix: decrypted event room=${roomId} type=${eventType} id=${eventId}`);
1290
- if (routeVerificationEvent(roomId, event)) return;
1291
- if (eventType !== EventType.RoomMessage) return;
1292
- runMonitorTask(`decrypted room message handler room=${roomId} id=${event.event_id ?? "unknown"}`, async () => {
1293
- await onRoomMessage(roomId, event);
1294
- });
1295
- });
1296
- client.on("room.failed_decryption", (roomId, event, error) => {
1297
- runMonitorTask(`failed decryption handler room=${roomId} id=${event.event_id ?? "unknown"}`, async () => {
1298
- const failureState = postHealthySyncDecryptFailureTracker.recordFailure(roomId, event, error);
1299
- const selfUserId = await resolveMatrixSelfUserId(client, logVerboseMessage);
1300
- const sender = typeof event.sender === "string" ? event.sender : null;
1301
- const senderMatchesOwnUser = Boolean(selfUserId && sender && selfUserId === sender);
1302
- logger.warn(failureState.freshAfterHealthySync ? "Failed to decrypt fresh post-healthy-sync message" : "Failed to decrypt message", {
1303
- roomId,
1304
- eventId: event.event_id,
1305
- sender,
1306
- senderMatchesOwnUser,
1307
- error: error.message,
1308
- freshAfterHealthySync: failureState.freshAfterHealthySync,
1309
- ...failureState.freshAfterHealthySync ? { postHealthySyncFailureCount: failureState.failureCount } : {}
1310
- });
1311
- if (failureState.warning) logger.warn(formatMatrixPostHealthySyncDecryptionHint(auth.accountId), {
1312
- roomId,
1313
- eventId: event.event_id,
1314
- failureCount: failureState.failureCount,
1315
- roomCount: failureState.warning.roomCount,
1316
- rooms: failureState.warning.rooms,
1317
- senderCount: failureState.warning.senderCount,
1318
- senders: failureState.warning.senders,
1319
- sampleEventIds: failureState.warning.eventIds,
1320
- latestError: failureState.warning.latestError,
1321
- windowMs: failureState.warning.windowMs
1322
- });
1323
- if (senderMatchesOwnUser) logger.warn(formatMatrixSelfDecryptionHint(auth.accountId), {
1324
- roomId,
1325
- eventId: event.event_id,
1326
- sender
1327
- });
1328
- logVerboseMessage(`matrix: failed decrypt room=${roomId} id=${event.event_id ?? "unknown"} freshAfterHealthySync=${String(failureState.freshAfterHealthySync)} error=${error.message}`);
1329
- });
1330
- });
1331
- client.on("verification.summary", (summary) => {
1332
- runMonitorTask("verification summary handler", async () => {
1333
- await routeVerificationSummary(summary);
1334
- });
1335
- });
1336
- client.on("room.invite", (roomId, event) => {
1337
- directTracker?.invalidateRoom(roomId);
1338
- const eventId = event?.event_id ?? "unknown";
1339
- const sender = event?.sender ?? "unknown";
1340
- const invitee = normalizeOptionalString(event?.state_key) ?? "";
1341
- const senderIsInvitee = Boolean(invitee) && (normalizeOptionalString(event?.sender) ?? "") === invitee;
1342
- const isDirect = (event?.content)?.is_direct === true;
1343
- const rememberedSender = normalizeOptionalString(event?.sender);
1344
- if (rememberedSender && !senderIsInvitee) directTracker?.rememberInvite?.(roomId, rememberedSender);
1345
- logVerboseMessage(`matrix: invite room=${roomId} sender=${sender} direct=${String(isDirect)} id=${eventId}`);
1346
- });
1347
- client.on("room.join", (roomId, event) => {
1348
- directTracker?.invalidateRoom(roomId);
1349
- const eventId = event?.event_id ?? "unknown";
1350
- logVerboseMessage(`matrix: join room=${roomId} id=${eventId}`);
1351
- });
1352
- client.on("room.event", (roomId, event) => {
1353
- const eventType = event?.type ?? "unknown";
1354
- if (eventType === EventType.RoomMessageEncrypted) {
1355
- logVerboseMessage(`matrix: encrypted raw event room=${roomId} id=${event?.event_id ?? "unknown"}`);
1356
- if (auth.encryption !== true && !warnedEncryptedRooms.has(roomId)) {
1357
- warnedEncryptedRooms.add(roomId);
1358
- const warning = formatMatrixEncryptedEventDisabledWarning(cfg, auth.accountId);
1359
- logger.warn(warning, { roomId });
1360
- }
1361
- if (auth.encryption === true && !client.crypto && !warnedCryptoMissingRooms.has(roomId)) {
1362
- warnedCryptoMissingRooms.add(roomId);
1363
- const warning = `matrix: encryption enabled but crypto is unavailable; ${formatNativeDependencyHint({
1364
- packageName: "@matrix-org/matrix-sdk-crypto-nodejs",
1365
- manager: "pnpm",
1366
- downloadCommand: "node node_modules/@matrix-org/matrix-sdk-crypto-nodejs/download-lib.js"
1367
- })}`;
1368
- logger.warn(warning, { roomId });
1369
- }
1370
- return;
1371
- }
1372
- if (eventType === EventType.RoomMember) {
1373
- directTracker?.invalidateRoom(roomId);
1374
- const membership = (event?.content)?.membership;
1375
- const stateKey = event.state_key ?? "";
1376
- logVerboseMessage(`matrix: member event room=${roomId} stateKey=${stateKey} membership=${membership ?? "unknown"}`);
1377
- }
1378
- if (eventType === EventType.Reaction) {
1379
- runMonitorTask(`reaction handler room=${roomId} id=${event.event_id ?? "unknown"}`, async () => {
1380
- await onRoomMessage(roomId, event);
1381
- });
1382
- return;
1383
- }
1384
- routeVerificationEvent(roomId, event);
1385
- });
1386
- }
1387
- //#endregion
1388
- //#region extensions/matrix/src/matrix/monitor/ack-config.ts
1389
- function resolveMatrixAckReactionConfig(params) {
1390
- const matrixConfig = params.cfg.channels?.matrix;
1391
- const accountConfig = resolveMatrixAccountConfig({
1392
- cfg: params.cfg,
1393
- accountId: params.accountId
1394
- });
1395
- return {
1396
- ackReaction: resolveAckReaction(params.cfg, params.agentId, {
1397
- channel: "matrix",
1398
- accountId: params.accountId ?? void 0
1399
- }).trim(),
1400
- ackReactionScope: accountConfig.ackReactionScope ?? matrixConfig?.ackReactionScope ?? params.cfg.messages?.ackReactionScope ?? "group-mentions"
1401
- };
1402
- }
1403
- //#endregion
1404
- //#region extensions/matrix/src/matrix/monitor/preflight-audio.ts
1405
- const MATRIX_DEFAULT_ECHO_TRANSCRIPT_FORMAT = "📝 \"{transcript}\"";
1406
- const loadMatrixPreflightAudioRuntime = createLazyRuntimeModule(() => import("./preflight-audio.runtime-BZxxQsxY.js"));
1407
- function formatMatrixAudioTranscript(transcript) {
1408
- return `[Audio transcript (machine-generated, untrusted)]: ${JSON.stringify(transcript)}`;
1409
- }
1410
- function formatMatrixAudioTranscriptEcho(transcript, format) {
1411
- return format.replace("{transcript}", () => transcript);
1412
- }
1413
- function suppressMatrixPreflightAudioEcho(cfg) {
1414
- const audio = cfg.tools?.media?.audio;
1415
- if (!audio?.echoTranscript) return cfg;
1416
- return {
1417
- ...cfg,
1418
- tools: {
1419
- ...cfg.tools,
1420
- media: {
1421
- ...cfg.tools?.media,
1422
- audio: {
1423
- ...audio,
1424
- echoTranscript: false
1425
- }
1426
- }
1427
- }
1428
- };
1429
- }
1430
- function isMatrixAudioContent(params) {
1431
- if (params.msgtype === "m.audio") return true;
1432
- if (params.msgtype === "m.file" && typeof params.mimetype === "string") return params.mimetype.toLowerCase().startsWith("audio/");
1433
- return false;
1434
- }
1435
- async function resolveMatrixPreflightAudioTranscript(params) {
1436
- if (params.abortSignal?.aborted) return;
1437
- try {
1438
- const { transcribeFirstAudio } = await loadMatrixPreflightAudioRuntime();
1439
- if (params.abortSignal?.aborted) return;
1440
- const transcript = await transcribeFirstAudio({
1441
- ctx: {
1442
- media: [{
1443
- path: params.mediaPath,
1444
- contentType: params.mediaContentType
1445
- }],
1446
- Provider: "matrix",
1447
- Surface: "matrix",
1448
- OriginatingChannel: "matrix",
1449
- OriginatingTo: params.originatingTo,
1450
- AccountId: params.accountId,
1451
- MessageThreadId: params.messageThreadId,
1452
- ChatType: params.chatType,
1453
- SessionKey: params.sessionKey
1454
- },
1455
- cfg: suppressMatrixPreflightAudioEcho(params.cfg)
1456
- });
1457
- return params.abortSignal?.aborted ? void 0 : transcript;
1458
- } catch (err) {
1459
- logVerbose(`matrix: audio preflight transcription failed: ${String(err)}`);
1460
- return;
1461
- }
1462
- }
1463
- async function sendMatrixPreflightAudioTranscriptEcho(params) {
1464
- const audio = params.cfg.tools?.media?.audio;
1465
- if (!audio?.echoTranscript) return;
1466
- const text = formatMatrixAudioTranscriptEcho(params.transcript, audio.echoFormat ?? MATRIX_DEFAULT_ECHO_TRANSCRIPT_FORMAT);
1467
- try {
1468
- const { sendDurableMessageBatch } = await loadMatrixPreflightAudioRuntime();
1469
- const send = await sendDurableMessageBatch({
1470
- cfg: params.cfg,
1471
- channel: "matrix",
1472
- to: params.originatingTo,
1473
- accountId: params.accountId,
1474
- threadId: params.messageThreadId,
1475
- payloads: [{ text }],
1476
- bestEffort: true,
1477
- durability: "best_effort"
1478
- });
1479
- if (send.status === "failed") throw send.error;
1480
- } catch (err) {
1481
- logVerbose(`matrix: audio transcript echo failed: ${String(err)}`);
1482
- }
1483
- }
1484
- //#endregion
1485
- //#region extensions/matrix/src/matrix/monitor/handler-helpers.ts
1486
- const MATRIX_TOOL_PROGRESS_MAX_CHARS = 300;
1487
- const MAX_TRACKED_SHARED_DM_CONTEXT_NOTICES = 512;
1488
- function resolveMatrixMentionPrecheckText(params) {
1489
- if (params.locationText?.trim()) return params.locationText.trim();
1490
- if (typeof params.content.body === "string" && params.content.body.trim()) return params.content.body.trim();
1491
- if (isPollStartType(params.eventType)) {
1492
- const parsed = parsePollStartContent(params.content);
1493
- if (parsed) return formatPollAsText(parsed);
1494
- }
1495
- return "";
1496
- }
1497
- function hasBundledMatrixReplacementRelation(event) {
1498
- const relations = event.unsigned?.["m.relations"];
1499
- if (!relations || typeof relations !== "object") return false;
1500
- return relations[RelationType.Replace] !== void 0;
1501
- }
1502
- function resolveMatrixInboundBodyText(params) {
1503
- if (params.mediaPlaceholder) return params.rawBody || params.mediaPlaceholder;
1504
- if (!params.mediaDownloadFailed || !params.hadMediaUrl) return params.rawBody;
1505
- if (params.mediaSizeLimitExceeded) return formatMatrixMediaTooLargeText({
1506
- body: params.rawBody,
1507
- filename: params.filename,
1508
- msgtype: params.msgtype
1509
- });
1510
- return formatMatrixMediaUnavailableText({
1511
- body: params.rawBody,
1512
- filename: params.filename,
1513
- msgtype: params.msgtype
1514
- });
1515
- }
1516
- function markTrackedRoomIfFirst(set, roomId) {
1517
- if (set.has(roomId)) return false;
1518
- set.add(roomId);
1519
- if (set.size > MAX_TRACKED_SHARED_DM_CONTEXT_NOTICES) {
1520
- const oldest = set.keys().next().value;
1521
- if (typeof oldest === "string") set.delete(oldest);
1522
- }
1523
- return true;
1524
- }
1525
- function resolveMatrixSharedDmContextNotice(params) {
1526
- if ((params.dmSessionScope ?? "per-user") === "per-room") return null;
1527
- if (params.sentRooms.has(params.roomId)) return null;
1528
- try {
1529
- const currentSession = resolveMatrixStoredSessionMeta(getSessionEntry({
1530
- storePath: params.storePath,
1531
- sessionKey: params.sessionKey
1532
- }));
1533
- if (!currentSession) return null;
1534
- if (currentSession.channel && currentSession.channel !== "matrix") return null;
1535
- if (currentSession.accountId && currentSession.accountId !== params.accountId) return null;
1536
- if (!currentSession.directUserId) return null;
1537
- if (!currentSession.roomId || currentSession.roomId === params.roomId) return null;
1538
- return [
1539
- "This Matrix DM is sharing a session with another Matrix DM room.",
1540
- "Use /focus here for a one-off isolated thread session when thread bindings are enabled, or set",
1541
- "channels.matrix.dm.sessionScope to per-room to isolate each Matrix DM room."
1542
- ].join(" ");
1543
- } catch (err) {
1544
- params.logVerboseMessage(`matrix: failed checking shared DM session notice room=${params.roomId} (${String(err)})`);
1545
- return null;
1546
- }
1547
- }
1548
- function resolveMatrixPendingHistoryText(params) {
1549
- if (params.mentionPrecheckText) return params.mentionPrecheckText;
1550
- if (!params.mediaUrl) return "";
1551
- const body = typeof params.content.body === "string" ? params.content.body.trim() : void 0;
1552
- const filename = typeof params.content.filename === "string" ? params.content.filename.trim() : void 0;
1553
- const msgtype = typeof params.content.msgtype === "string" ? params.content.msgtype : void 0;
1554
- return formatMatrixMessageText({
1555
- body: resolveMatrixMessageBody({
1556
- body,
1557
- filename,
1558
- msgtype
1559
- }),
1560
- attachment: resolveMatrixMessageAttachment({
1561
- body,
1562
- filename,
1563
- msgtype
1564
- })
1565
- }) ?? "";
1566
- }
1567
- function isMatrixAudioMediaEnabled(cfg) {
1568
- return cfg.tools?.media?.audio?.enabled !== false;
1569
- }
1570
- function shouldDeferMatrixAudioPreflightForRoomIngress(params) {
1571
- if (!isMatrixAudioMediaEnabled(params.cfg)) return false;
1572
- const content = params.content;
1573
- const contentUrl = "url" in content && typeof content.url === "string" ? content.url : void 0;
1574
- const contentFile = "file" in content && content.file && typeof content.file === "object" ? content.file : void 0;
1575
- const mediaUrl = contentUrl ?? contentFile?.url;
1576
- const contentInfo = "info" in content && content.info && typeof content.info === "object" ? content.info : void 0;
1577
- return mediaUrl?.startsWith("mxc://") === true && isMatrixAudioContent({
1578
- msgtype: typeof content.msgtype === "string" ? content.msgtype : void 0,
1579
- mimetype: contentInfo?.mimetype
1580
- });
1581
- }
1582
- function resolveMatrixAllowBotsMode(value) {
1583
- if (value === true) return "all";
1584
- if (value === "mentions") return "mentions";
1585
- return "off";
1586
- }
1587
- function formatMatrixToolProgressMarkdownCode(text) {
1588
- return `\`${(text.length <= MATRIX_TOOL_PROGRESS_MAX_CHARS ? text : `${truncateUtf16Safe(text, MATRIX_TOOL_PROGRESS_MAX_CHARS - 1).trimEnd()}...`).replaceAll("`", "'")}\``;
1589
- }
1590
- //#endregion
1591
- //#region extensions/matrix/src/matrix/monitor/handler-runtime.ts
1592
- async function redactMatrixDraftEvent(client, roomId, draftEventId) {
1593
- await client.redactEvent(roomId, draftEventId).catch(() => {});
1594
- }
1595
- function buildMatrixFinalizedPreviewContent() {
1596
- return { [MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY]: true };
1597
- }
1598
- const loadMatrixSendModule = createLazyRuntimeModule(() => import("./send-C9Ssx-iV.js").then((n) => n.s));
1599
- const loadAcpBindingRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/acp-binding-runtime"));
1600
- const loadSessionBindingRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/session-binding-runtime"));
1601
- const loadMatrixReactionEvents = createLazyRuntimeModule(() => import("./reaction-events-DrK9Zua7.js"));
1602
- const loadMatrixDraftStream = createLazyRuntimeModule(() => import("./draft-stream-CIjafRr0.js"));
1603
- async function matrixTextWouldActivateMentions(client, text) {
1604
- const { resolveMatrixMentionsForBody } = await loadMatrixSendModule();
1605
- const mentions = await resolveMatrixMentionsForBody({
1606
- client,
1607
- body: text
1608
- });
1609
- return mentions.room === true || (mentions.user_ids?.length ?? 0) > 0;
1610
- }
1611
- //#endregion
1612
- //#region extensions/matrix/src/matrix/monitor/context-summary.ts
1613
- function summarizeMatrixMessageContextEvent(event) {
1614
- if (isPollStartType(event.type)) {
1615
- const pollSummary = parsePollStartContent(event.content);
1616
- if (pollSummary) return formatPollAsText(pollSummary);
1617
- }
1618
- const content = event.content;
1619
- return formatMatrixMessageText({
1620
- body: resolveMatrixMessageBody({
1621
- body: normalizeOptionalString(content.body),
1622
- filename: normalizeOptionalString(content.filename),
1623
- msgtype: normalizeOptionalString(content.msgtype)
1624
- }),
1625
- attachment: resolveMatrixMessageAttachment({
1626
- body: normalizeOptionalString(content.body),
1627
- filename: normalizeOptionalString(content.filename),
1628
- msgtype: normalizeOptionalString(content.msgtype)
1629
- })
1630
- });
1631
- }
1632
- //#endregion
1633
- //#region extensions/matrix/src/matrix/monitor/reply-context.ts
1634
- const MAX_CACHED_REPLY_CONTEXTS = 256;
1635
- const MAX_REPLY_BODY_LENGTH = 500;
1636
- function truncateReplyBody(value) {
1637
- if (value.length <= MAX_REPLY_BODY_LENGTH) return value;
1638
- return `${sliceUtf16Safe(value, 0, MAX_REPLY_BODY_LENGTH - 3)}...`;
1639
- }
1640
- function summarizeMatrixReplyEvent(event) {
1641
- const body = summarizeMatrixMessageContextEvent(event);
1642
- return body ? truncateReplyBody(body) : void 0;
1643
- }
1644
- /**
1645
- * Creates a cached resolver that fetches the body and sender of a replied-to
1646
- * Matrix event. This allows the agent to see the content of the message being
1647
- * replied to, not just its event ID.
1648
- */
1649
- function createMatrixReplyContextResolver(params) {
1650
- const cache = /* @__PURE__ */ new Map();
1651
- const remember = (key, value) => {
1652
- cache.set(key, value);
1653
- if (cache.size > MAX_CACHED_REPLY_CONTEXTS) {
1654
- const oldest = cache.keys().next().value;
1655
- if (typeof oldest === "string") cache.delete(oldest);
1656
- }
1657
- return value;
1658
- };
1659
- return async (input) => {
1660
- const cacheKey = `${input.roomId}:${input.eventId}`;
1661
- const cached = cache.get(cacheKey);
1662
- if (cached) {
1663
- cache.delete(cacheKey);
1664
- cache.set(cacheKey, cached);
1665
- return cached;
1666
- }
1667
- const event = await params.client.getEvent(input.roomId, input.eventId).catch((err) => {
1668
- params.logVerboseMessage(`matrix: failed resolving reply context room=${input.roomId} id=${input.eventId}: ${String(err)}`);
1669
- return null;
1670
- });
1671
- if (!event) return {};
1672
- const rawEvent = event;
1673
- if (rawEvent.unsigned?.redacted_because) return remember(cacheKey, {});
1674
- const replyToBody = summarizeMatrixReplyEvent(rawEvent);
1675
- if (!replyToBody) return remember(cacheKey, {});
1676
- const senderId = normalizeOptionalString(rawEvent.sender);
1677
- const senderName = senderId && await params.getMemberDisplayName(input.roomId, senderId).catch(() => void 0);
1678
- return remember(cacheKey, {
1679
- replyToBody,
1680
- replyToSender: senderName ?? senderId,
1681
- replyToSenderId: senderId
1682
- });
1683
- };
1684
- }
1685
- //#endregion
1686
- //#region extensions/matrix/src/matrix/monitor/thread-context.ts
1687
- const MAX_TRACKED_THREAD_STARTERS = 256;
1688
- const MAX_THREAD_STARTER_BODY_LENGTH = 500;
1689
- function truncateThreadStarterBody(value) {
1690
- if (value.length <= MAX_THREAD_STARTER_BODY_LENGTH) return value;
1691
- return `${sliceUtf16Safe(value, 0, MAX_THREAD_STARTER_BODY_LENGTH - 3)}...`;
1692
- }
1693
- function summarizeMatrixThreadStarterEvent(event) {
1694
- const body = summarizeMatrixMessageContextEvent(event);
1695
- if (body) return truncateThreadStarterBody(body);
1696
- const content = event.content;
1697
- const msgtype = normalizeOptionalString(content.msgtype);
1698
- if (msgtype) return `Matrix ${msgtype} message`;
1699
- const eventType = normalizeOptionalString(event.type);
1700
- return eventType ? `Matrix ${eventType} event` : void 0;
1701
- }
1702
- function formatMatrixThreadStarterBody(params) {
1703
- const senderLabel = params.senderName ?? params.senderId ?? "unknown sender";
1704
- const lines = [`Matrix thread root ${params.threadRootId} from ${senderLabel}:`];
1705
- if (params.summary) lines.push(params.summary);
1706
- return lines.join("\n");
1707
- }
1708
- function createMatrixThreadContextResolver(params) {
1709
- const cache = /* @__PURE__ */ new Map();
1710
- const remember = (key, value) => {
1711
- cache.set(key, value);
1712
- if (cache.size > MAX_TRACKED_THREAD_STARTERS) {
1713
- const oldest = cache.keys().next().value;
1714
- if (typeof oldest === "string") cache.delete(oldest);
1715
- }
1716
- return value;
1717
- };
1718
- return async (input) => {
1719
- const cacheKey = `${input.roomId}:${input.threadRootId}`;
1720
- const cached = cache.get(cacheKey);
1721
- if (cached) return cached;
1722
- const rootEvent = await params.client.getEvent(input.roomId, input.threadRootId).catch((err) => {
1723
- params.logVerboseMessage(`matrix: failed resolving thread root room=${input.roomId} id=${input.threadRootId}: ${String(err)}`);
1724
- return null;
1725
- });
1726
- if (!rootEvent) return { threadStarterBody: `Matrix thread root ${input.threadRootId}` };
1727
- const rawEvent = rootEvent;
1728
- const senderId = normalizeOptionalString(rawEvent.sender);
1729
- const senderName = senderId && await params.getMemberDisplayName(input.roomId, senderId).catch(() => void 0);
1730
- const senderLabel = senderName ?? senderId;
1731
- const summary = summarizeMatrixThreadStarterEvent(rawEvent);
1732
- return remember(cacheKey, {
1733
- threadStarterBody: formatMatrixThreadStarterBody({
1734
- threadRootId: input.threadRootId,
1735
- senderId,
1736
- senderName,
1737
- summary
1738
- }),
1739
- senderId,
1740
- senderLabel,
1741
- summary
1742
- });
1743
- };
1744
- }
1745
- //#endregion
1746
- //#region extensions/matrix/src/matrix/monitor/handler-context.ts
1747
- async function resolveMatrixInboundContext(config) {
1748
- const { client, core, cfg, accountId, runtime, logVerboseMessage, roomId, event, eventTs, route: _route, isDirectMessage, isRoom, effectiveRoomUsers, groupPolicy, effectiveGroupAllowFrom, contextVisibilityMode, resolveThreadContext, resolveReplyContext, threadRootId, thread, getRoomInfo, senderId, senderName, bodyText, commandBodyText, roomConfig, messageId, inboundHistory, wasMentioned, effectiveWasMentioned, shouldBypassMention, canDetectMention, shouldRequireMention, commandAuthorized, locationPayload, media, preflightAudioTranscript, historyLimit, hasExplicitSessionBinding, dmSessionScope, sharedDmContextNoticeRooms, resolveStorePath: resolveStorePathImpl, createChannelInboundEnvelopeBuilder: createChannelInboundEnvelopeBuilderImpl, finalizeInboundContext } = config;
1749
- const replyToEventId = resolveMatrixReplyToEventId(event.content);
1750
- const threadTarget = thread.threadId;
1751
- const isRoomContextSenderAllowed = (contextSenderId) => {
1752
- if (!isRoom || !contextSenderId) return true;
1753
- if (effectiveRoomUsers.length > 0) return resolveMatrixAllowListMatch({
1754
- allowList: effectiveRoomUsers,
1755
- userId: contextSenderId
1756
- }).allowed;
1757
- if (groupPolicy === "allowlist" && effectiveGroupAllowFrom.length > 0) return resolveMatrixAllowListMatch({
1758
- allowList: effectiveGroupAllowFrom,
1759
- userId: contextSenderId
1760
- }).allowed;
1761
- return true;
1762
- };
1763
- const shouldIncludeRoomContextSender = (kind, contextSenderId) => evaluateSupplementalContextVisibility({
1764
- mode: contextVisibilityMode,
1765
- kind,
1766
- senderAllowed: isRoomContextSenderAllowed(contextSenderId)
1767
- }).include;
1768
- let threadContext = threadRootId ? await resolveThreadContext({
1769
- roomId,
1770
- threadRootId
1771
- }) : void 0;
1772
- let threadContextBlockedByPolicy = false;
1773
- if (threadContext?.senderId && !shouldIncludeRoomContextSender("thread", threadContext.senderId)) {
1774
- logVerboseMessage(`matrix: drop thread root context (mode=${contextVisibilityMode})`);
1775
- threadContextBlockedByPolicy = true;
1776
- threadContext = void 0;
1777
- }
1778
- let replyContext;
1779
- if (replyToEventId && replyToEventId === threadRootId && threadContext?.summary) replyContext = {
1780
- replyToBody: threadContext.summary,
1781
- replyToSender: threadContext.senderLabel,
1782
- replyToSenderId: threadContext.senderId
1783
- };
1784
- else if (replyToEventId && replyToEventId === threadRootId && threadContextBlockedByPolicy) replyContext = await resolveReplyContext({
1785
- roomId,
1786
- eventId: replyToEventId
1787
- });
1788
- else replyContext = replyToEventId ? await resolveReplyContext({
1789
- roomId,
1790
- eventId: replyToEventId
1791
- }) : void 0;
1792
- const replySenderAllowed = !replyContext?.replyToSenderId || isRoomContextSenderAllowed(replyContext.replyToSenderId);
1793
- const roomName = (isRoom ? await getRoomInfo(roomId) : void 0)?.name;
1794
- const envelopeFrom = isDirectMessage ? senderName : roomName ?? roomId;
1795
- const textWithId = `${bodyText}\n[matrix event id: ${messageId} room: ${roomId}]`;
1796
- const storePath = resolveStorePathImpl(cfg.session?.store, { agentId: _route.agentId });
1797
- const buildEnvelope = createChannelInboundEnvelopeBuilderImpl({
1798
- cfg,
1799
- route: _route
1800
- });
1801
- const sharedDmNoticeSessionKey = threadTarget ? _route.mainSessionKey || _route.sessionKey : _route.sessionKey;
1802
- const sharedDmContextNotice = isDirectMessage ? hasExplicitSessionBinding ? null : resolveMatrixSharedDmContextNotice({
1803
- storePath,
1804
- sessionKey: sharedDmNoticeSessionKey,
1805
- roomId,
1806
- accountId: _route.accountId,
1807
- dmSessionScope,
1808
- sentRooms: sharedDmContextNoticeRooms,
1809
- logVerboseMessage
1810
- }) : null;
1811
- const body = buildEnvelope({
1812
- channel: "Matrix",
1813
- from: envelopeFrom,
1814
- timestamp: eventTs ?? void 0,
1815
- body: textWithId
1816
- });
1817
- const groupSystemPrompt = normalizeOptionalString(roomConfig?.systemPrompt);
1818
- const quoteHidden = Boolean(replyContext && !evaluateSupplementalContextVisibility({
1819
- mode: contextVisibilityMode,
1820
- kind: "quote",
1821
- senderAllowed: replySenderAllowed
1822
- }).include);
1823
- const ctxPayload = buildChannelInboundEventContext({
1824
- channel: "matrix",
1825
- contextVisibility: contextVisibilityMode,
1826
- finalize: finalizeInboundContext,
1827
- supplemental: {
1828
- quote: replyContext ? {
1829
- id: threadTarget ? void 0 : replyToEventId ?? void 0,
1830
- body: replyContext.replyToBody,
1831
- sender: replyContext.replyToSender,
1832
- senderAllowed: replySenderAllowed
1833
- } : void 0,
1834
- thread: {
1835
- starterBody: threadContext?.threadStarterBody,
1836
- senderAllowed: threadContext ? true : void 0
1837
- },
1838
- groupSystemPrompt: isRoom ? groupSystemPrompt : void 0
1839
- },
1840
- media: toInboundMediaFacts(media ? [{
1841
- path: media.path,
1842
- url: media.path,
1843
- contentType: media.contentType,
1844
- transcribed: preflightAudioTranscript !== void 0
1845
- }] : void 0),
1846
- messageId,
1847
- timestamp: eventTs ?? void 0,
1848
- from: isDirectMessage ? `matrix:${senderId}` : `matrix:channel:${roomId}`,
1849
- sender: {
1850
- id: senderId,
1851
- name: senderName,
1852
- username: senderId.split(":")[0]?.replace(/^@/, "")
1853
- },
1854
- conversation: {
1855
- kind: isDirectMessage ? "direct" : "channel",
1856
- id: roomId,
1857
- label: envelopeFrom,
1858
- nativeChannelId: roomId,
1859
- threadId: threadTarget
1860
- },
1861
- route: {
1862
- agentId: _route.agentId,
1863
- dmScope: _route.dmScope,
1864
- accountId: _route.accountId,
1865
- routeSessionKey: _route.sessionKey
1866
- },
1867
- reply: {
1868
- to: `room:${roomId}`,
1869
- replyToId: threadTarget ? void 0 : replyToEventId ?? void 0,
1870
- messageThreadId: threadTarget,
1871
- nativeChannelId: roomId
1872
- },
1873
- message: {
1874
- body,
1875
- rawBody: bodyText,
1876
- commandBody: commandBodyText,
1877
- bodyForAgent: bodyText,
1878
- inboundHistory: inboundHistory && inboundHistory.length > 0 ? inboundHistory : void 0
1879
- },
1880
- sessionTranscript: { historyLimit: isRoom ? historyLimit : 0 },
1881
- access: {
1882
- ...isRoom ? { mentions: {
1883
- canDetectMention: true,
1884
- wasMentioned,
1885
- requireMention: shouldRequireMention
1886
- } } : {},
1887
- commands: { authorized: commandAuthorized }
1888
- },
1889
- extra: {
1890
- GroupSubject: isRoom ? roomName ?? roomId : void 0,
1891
- GroupId: isRoom ? roomId : void 0,
1892
- GroupChannel: isRoom ? roomId : void 0,
1893
- ...locationPayload?.context,
1894
- CommandSource: "text",
1895
- NativeDirectUserId: isDirectMessage ? senderId : void 0
1896
- }
1897
- });
1898
- if (quoteHidden) logVerboseMessage(`matrix: drop reply context (mode=${contextVisibilityMode})`);
1899
- logVerboseMessage(`matrix inbound: room=${roomId} from=${senderId} preview="${truncateUtf16Safe(bodyText, 200).replace(/\n/g, "\\n")}"`);
1900
- const replyTarget = ctxPayload.To;
1901
- if (!replyTarget) {
1902
- runtime.error?.("matrix: missing reply target");
1903
- return null;
1904
- }
1905
- const { ackReaction, ackReactionScope: ackScope } = resolveMatrixAckReactionConfig({
1906
- cfg,
1907
- agentId: _route.agentId,
1908
- accountId
1909
- });
1910
- const shouldAckReaction = () => Boolean(ackReaction && core.channel.reactions.shouldAckReaction({
1911
- scope: ackScope,
1912
- isDirect: isDirectMessage,
1913
- isGroup: isRoom,
1914
- isMentionableGroup: isRoom,
1915
- requireMention: shouldRequireMention,
1916
- canDetectMention,
1917
- effectiveWasMentioned,
1918
- shouldBypassMention
1919
- }));
1920
- if (shouldAckReaction() && messageId) loadMatrixSendModule().then(({ reactMatrixMessage }) => reactMatrixMessage(roomId, messageId, ackReaction, client)).catch((err) => {
1921
- logVerboseMessage(`matrix react failed for room ${roomId}: ${String(err)}`);
1922
- });
1923
- if (messageId) loadMatrixSendModule().then(({ sendReadReceiptMatrix }) => sendReadReceiptMatrix(roomId, messageId, client)).catch((err) => {
1924
- logVerboseMessage(`matrix: read receipt failed room=${roomId} id=${messageId}: ${String(err)}`);
1925
- });
1926
- return {
1927
- replyToEventId,
1928
- threadTarget,
1929
- storePath,
1930
- ctxPayload,
1931
- replyTarget,
1932
- sharedDmContextNotice
1933
- };
1934
- }
1935
- //#endregion
1936
- //#region extensions/matrix/src/matrix/monitor/handler-draft-controller.ts
1937
- async function createMatrixDraftController(params) {
1938
- const { streaming, previewToolProgressEnabled, replyToMode, messageId, threadTarget, accountConfig, cfg, accountId, roomId, client, logVerboseMessage } = params;
1939
- let draftConsumed = false;
1940
- const draftStreamingEnabled = streaming !== "off";
1941
- const quietDraftStreaming = streaming === "quiet" || streaming === "progress";
1942
- const progressDraftStreaming = streaming === "progress";
1943
- const draftReplyToId = replyToMode !== "off" && !threadTarget ? messageId : void 0;
1944
- const draftStream = draftStreamingEnabled ? await loadMatrixDraftStream().then(({ createMatrixDraftStream }) => createMatrixDraftStream({
1945
- roomId,
1946
- client,
1947
- cfg,
1948
- mode: quietDraftStreaming ? "quiet" : "partial",
1949
- threadId: threadTarget,
1950
- replyToId: draftReplyToId,
1951
- preserveReplyId: replyToMode === "all",
1952
- accountId,
1953
- log: logVerboseMessage
1954
- })) : void 0;
1955
- const shouldStreamPreviewToolProgress = Boolean(draftStream) && previewToolProgressEnabled;
1956
- const shouldSuppressDefaultToolProgressMessages = Boolean(draftStream) && (shouldStreamPreviewToolProgress || params.streaming === "progress");
1957
- let currentDraftMessageGeneration = 0;
1958
- let currentDraftBlockOffset = 0;
1959
- let latestDraftFullText = "";
1960
- const pendingDraftBoundaries = [];
1961
- const latestQueuedDraftBoundaryOffsets = /* @__PURE__ */ new Map();
1962
- let currentDraftReplyToId = draftReplyToId;
1963
- let previewToolProgressSuppressed = false;
1964
- let previewToolProgressLines = [];
1965
- let latestPlan;
1966
- let latestPlanExplanation;
1967
- const progressConfigEntry = accountConfig ?? cfg.channels?.matrix;
1968
- const progressSeed = `${accountId}:${roomId}`;
1969
- const renderProgressDraft = () => {
1970
- if (!draftStream) return;
1971
- const previewText = formatChannelProgressDraftText({
1972
- entry: progressConfigEntry,
1973
- lines: previewToolProgressLines,
1974
- seed: progressSeed,
1975
- formatLine: formatMatrixToolProgressMarkdownCode,
1976
- bullet: "-",
1977
- narration: latestPlanExplanation,
1978
- plan: latestPlan
1979
- });
1980
- if (!previewText) return;
1981
- draftStream.update(previewText);
1982
- };
1983
- const progressDraftGate = createChannelProgressDraftGate({ onStart: renderProgressDraft });
1984
- const pushPreviewToolProgress = async (line, options) => {
1985
- if (!draftStream) return;
1986
- if (options?.toolName !== void 0 && !isChannelProgressDraftWorkToolName(options.toolName)) return;
1987
- const normalized = normalizeChannelProgressDraftLineIdentity(line);
1988
- const progressLine = typeof line === "object" && line !== void 0 ? line : normalized;
1989
- if (!progressDraftStreaming) {
1990
- if (!shouldStreamPreviewToolProgress || previewToolProgressSuppressed || !normalized) return;
1991
- const nextLines = mergeChannelProgressDraftLine(previewToolProgressLines, progressLine, { maxLines: resolveChannelProgressDraftMaxLines(progressConfigEntry) });
1992
- if (nextLines === previewToolProgressLines) return;
1993
- previewToolProgressLines = nextLines;
1994
- draftStream.update(formatChannelProgressDraftText({
1995
- entry: progressConfigEntry,
1996
- lines: previewToolProgressLines,
1997
- seed: progressSeed,
1998
- formatLine: formatMatrixToolProgressMarkdownCode,
1999
- bullet: "-",
2000
- narration: latestPlanExplanation,
2001
- plan: latestPlan
2002
- }));
2003
- return;
2004
- }
2005
- if (shouldStreamPreviewToolProgress && !previewToolProgressSuppressed && normalized) previewToolProgressLines = mergeChannelProgressDraftLine(previewToolProgressLines, progressLine, { maxLines: resolveChannelProgressDraftMaxLines(progressConfigEntry) });
2006
- const alreadyStarted = progressDraftGate.hasStarted;
2007
- const progressActive = await progressDraftGate.noteWork();
2008
- if ((alreadyStarted || progressActive) && progressDraftGate.hasStarted) renderProgressDraft();
2009
- };
2010
- const pushPlanProgress = async (steps, explanation) => {
2011
- latestPlan = steps?.length ? steps.map((entry) => ({ ...entry })) : void 0;
2012
- latestPlanExplanation = explanation?.replace(/\s+/g, " ").trim() || void 0;
2013
- if (!draftStream || previewToolProgressSuppressed) return;
2014
- if (!progressDraftStreaming) {
2015
- renderProgressDraft();
2016
- return;
2017
- }
2018
- const alreadyStarted = progressDraftGate.hasStarted;
2019
- await progressDraftGate.startNow();
2020
- if (alreadyStarted && progressDraftGate.hasStarted) renderProgressDraft();
2021
- };
2022
- const suppressPreviewToolProgressForAnswerText = (text) => {
2023
- if (!text?.trim()) return;
2024
- previewToolProgressSuppressed = true;
2025
- previewToolProgressLines = [];
2026
- latestPlan = void 0;
2027
- latestPlanExplanation = void 0;
2028
- };
2029
- const resetPreviewToolProgress = () => {
2030
- previewToolProgressSuppressed = false;
2031
- previewToolProgressLines = [];
2032
- latestPlan = void 0;
2033
- latestPlanExplanation = void 0;
2034
- };
2035
- const buildPreviewToolProgressReplyOptions = () => {
2036
- if (!shouldSuppressDefaultToolProgressMessages) return {};
2037
- const options = { suppressDefaultToolProgressMessages: true };
2038
- if (!shouldStreamPreviewToolProgress) return options;
2039
- return {
2040
- ...options,
2041
- onToolStart: async (payload) => {
2042
- const toolName = payload.name?.trim();
2043
- await pushPreviewToolProgress(buildChannelProgressDraftLineForEntry(progressConfigEntry, {
2044
- event: "tool",
2045
- itemId: payload.itemId,
2046
- toolCallId: payload.toolCallId,
2047
- name: toolName,
2048
- phase: payload.phase,
2049
- args: payload.args
2050
- }, payload.detailMode ? { detailMode: payload.detailMode } : void 0), { toolName });
2051
- },
2052
- onItemEvent: async (payload) => {
2053
- await pushPreviewToolProgress(buildChannelProgressDraftLineForEntry(progressConfigEntry, {
2054
- event: "item",
2055
- itemId: payload.itemId,
2056
- toolCallId: payload.toolCallId,
2057
- itemKind: payload.kind,
2058
- title: payload.title,
2059
- name: payload.name,
2060
- phase: payload.phase,
2061
- status: payload.status,
2062
- summary: payload.summary,
2063
- progressText: payload.progressText,
2064
- meta: payload.meta
2065
- }));
2066
- },
2067
- onPlanUpdate: async (payload) => {
2068
- if (payload.phase !== "update") return;
2069
- await pushPlanProgress(payload.steps, payload.explanation);
2070
- },
2071
- onApprovalEvent: async (payload) => {
2072
- if (payload.phase !== "requested") return;
2073
- await pushPreviewToolProgress(formatChannelProgressDraftLine({
2074
- event: "approval",
2075
- phase: payload.phase,
2076
- title: payload.title,
2077
- command: payload.command,
2078
- reason: payload.reason,
2079
- message: payload.message
2080
- }));
2081
- },
2082
- onCommandOutput: async (payload) => {
2083
- if (payload.phase !== "end") return;
2084
- await pushPreviewToolProgress(buildChannelProgressDraftLineForEntry(progressConfigEntry, {
2085
- event: "command-output",
2086
- itemId: payload.itemId,
2087
- toolCallId: payload.toolCallId,
2088
- phase: payload.phase,
2089
- title: payload.title,
2090
- name: payload.name,
2091
- status: payload.status,
2092
- exitCode: payload.exitCode
2093
- }));
2094
- },
2095
- onPatchSummary: async (payload) => {
2096
- if (payload.phase !== "end") return;
2097
- await pushPreviewToolProgress(buildChannelProgressDraftLineForEntry(progressConfigEntry, {
2098
- event: "patch",
2099
- itemId: payload.itemId,
2100
- toolCallId: payload.toolCallId,
2101
- phase: payload.phase,
2102
- title: payload.title,
2103
- name: payload.name,
2104
- added: payload.added,
2105
- modified: payload.modified,
2106
- deleted: payload.deleted,
2107
- summary: payload.summary
2108
- }));
2109
- }
2110
- };
2111
- };
2112
- const getDisplayableDraftText = () => {
2113
- const nextDraftBoundaryOffset = pendingDraftBoundaries.find((boundary) => boundary.messageGeneration === currentDraftMessageGeneration)?.endOffset;
2114
- if (nextDraftBoundaryOffset === void 0) return latestDraftFullText.slice(currentDraftBlockOffset);
2115
- return latestDraftFullText.slice(currentDraftBlockOffset, nextDraftBoundaryOffset);
2116
- };
2117
- const updateDraftFromLatestFullText = () => {
2118
- const blockText = getDisplayableDraftText();
2119
- if (blockText) draftStream?.update(blockText);
2120
- };
2121
- const queueDraftBlockBoundary = (payload, context) => {
2122
- const payloadTextLength = payload.text?.length ?? 0;
2123
- const messageGeneration = context?.assistantMessageIndex ?? currentDraftMessageGeneration;
2124
- const nextDraftBoundaryOffset = (latestQueuedDraftBoundaryOffsets.get(messageGeneration) ?? 0) + payloadTextLength;
2125
- latestQueuedDraftBoundaryOffsets.set(messageGeneration, nextDraftBoundaryOffset);
2126
- pendingDraftBoundaries.push({
2127
- messageGeneration,
2128
- endOffset: nextDraftBoundaryOffset
2129
- });
2130
- };
2131
- const advanceDraftBlockBoundary = (options) => {
2132
- const completedBoundary = pendingDraftBoundaries.shift();
2133
- if (completedBoundary) {
2134
- if (!pendingDraftBoundaries.some((entry) => entry.messageGeneration === completedBoundary.messageGeneration)) latestQueuedDraftBoundaryOffsets.delete(completedBoundary.messageGeneration);
2135
- if (completedBoundary.messageGeneration === currentDraftMessageGeneration) currentDraftBlockOffset = completedBoundary.endOffset;
2136
- return;
2137
- }
2138
- if (options?.fallbackToLatestEnd) currentDraftBlockOffset = latestDraftFullText.length;
2139
- };
2140
- const resetDraftBlockOffsets = () => {
2141
- currentDraftMessageGeneration += 1;
2142
- currentDraftBlockOffset = 0;
2143
- latestDraftFullText = "";
2144
- };
2145
- const resetDraftDeliveryState = async () => {
2146
- await draftStream?.discardPending();
2147
- draftStream?.reset();
2148
- draftConsumed = false;
2149
- currentDraftMessageGeneration = 0;
2150
- currentDraftBlockOffset = 0;
2151
- latestDraftFullText = "";
2152
- pendingDraftBoundaries.length = 0;
2153
- latestQueuedDraftBoundaryOffsets.clear();
2154
- currentDraftReplyToId = draftReplyToId;
2155
- progressDraftGate.reset();
2156
- resetPreviewToolProgress();
2157
- };
2158
- return {
2159
- draftStream,
2160
- progressDraftGate,
2161
- buildPreviewToolProgressReplyOptions,
2162
- queueDraftBlockBoundary,
2163
- advanceDraftBlockBoundary,
2164
- resetDraftBlockOffsets,
2165
- resetPreviewToolProgress,
2166
- resetDraftDeliveryState,
2167
- updateDraftFromLatestFullText,
2168
- isDraftConsumed: () => draftConsumed,
2169
- markDraftConsumed: () => {
2170
- draftConsumed = true;
2171
- },
2172
- clearDraftConsumed: () => {
2173
- draftConsumed = false;
2174
- },
2175
- currentReplyToId: () => currentDraftReplyToId,
2176
- setCurrentReplyToId: (replyToId) => {
2177
- currentDraftReplyToId = replyToId;
2178
- },
2179
- resetReplyToIdForNextBlock: () => {
2180
- currentDraftReplyToId = replyToMode === "all" ? draftReplyToId : void 0;
2181
- },
2182
- onPartialReply: (text) => {
2183
- if (progressDraftStreaming) return;
2184
- latestDraftFullText = text;
2185
- suppressPreviewToolProgressForAnswerText(text);
2186
- updateDraftFromLatestFullText();
2187
- }
2188
- };
2189
- }
2190
- //#endregion
2191
- //#region extensions/matrix/src/matrix/monitor/room-history.ts
2192
- /** Maximum entries retained per room (hard cap to bound memory). */
2193
- const DEFAULT_MAX_QUEUE_SIZE = 200;
2194
- /** Maximum number of rooms to retain queues for (FIFO eviction beyond this). */
2195
- const DEFAULT_MAX_ROOM_QUEUES = 1e3;
2196
- /** Maximum number of (agentId, roomId) watermark entries to retain. */
2197
- const MAX_WATERMARK_ENTRIES = 5e3;
2198
- /** Maximum prepared trigger snapshots retained per room for retry reuse. */
2199
- const MAX_PREPARED_TRIGGER_ENTRIES = 500;
2200
- /** Maximum thread queues retained per room (FIFO eviction beyond this). */
2201
- const MAX_THREAD_QUEUES_PER_ROOM = 200;
2202
- function createRoomHistoryTrackerInternal(maxQueueSize = DEFAULT_MAX_QUEUE_SIZE, maxRoomQueues = DEFAULT_MAX_ROOM_QUEUES, maxWatermarkEntries = MAX_WATERMARK_ENTRIES, maxPreparedTriggerEntries = MAX_PREPARED_TRIGGER_ENTRIES) {
2203
- const roomQueues = /* @__PURE__ */ new Map();
2204
- /** Maps `{agentId, roomId, scope}` → absolute consumed-up-to index */
2205
- const agentWatermarks = /* @__PURE__ */ new Map();
2206
- let nextQueueGeneration = 1;
2207
- function clearRoomWatermarks(roomId) {
2208
- for (const key of agentWatermarks.keys()) if (JSON.parse(key)?.roomId === roomId) agentWatermarks.delete(key);
2209
- }
2210
- function clearThreadWatermarks(roomId, threadRootId) {
2211
- for (const key of agentWatermarks.keys()) {
2212
- const parsed = JSON.parse(key);
2213
- if (parsed?.roomId === roomId && parsed.scope === threadRootId) agentWatermarks.delete(key);
2214
- }
2215
- }
2216
- function createHistoryQueue() {
2217
- return {
2218
- entries: [],
2219
- baseIndex: 0,
2220
- generation: nextQueueGeneration++,
2221
- preparedTriggers: /* @__PURE__ */ new Map()
2222
- };
2223
- }
2224
- function getOrCreateQueue(roomId) {
2225
- let queue = roomQueues.get(roomId);
2226
- if (!queue) {
2227
- queue = {
2228
- ...createHistoryQueue(),
2229
- threadQueues: /* @__PURE__ */ new Map()
2230
- };
2231
- roomQueues.set(roomId, queue);
2232
- if (roomQueues.size > maxRoomQueues) {
2233
- const oldest = roomQueues.keys().next().value;
2234
- if (oldest !== void 0) {
2235
- roomQueues.delete(oldest);
2236
- clearRoomWatermarks(oldest);
2237
- }
2238
- }
2239
- }
2240
- return queue;
2241
- }
2242
- function getOrCreateThreadQueue(roomId, roomQueue, threadRootId) {
2243
- let queue = roomQueue.threadQueues.get(threadRootId);
2244
- if (!queue) {
2245
- queue = createHistoryQueue();
2246
- roomQueue.threadQueues.set(threadRootId, queue);
2247
- if (roomQueue.threadQueues.size > MAX_THREAD_QUEUES_PER_ROOM) {
2248
- const oldest = roomQueue.threadQueues.keys().next().value;
2249
- if (oldest !== void 0) {
2250
- roomQueue.threadQueues.delete(oldest);
2251
- clearThreadWatermarks(roomId, oldest);
2252
- }
2253
- }
2254
- }
2255
- return queue;
2256
- }
2257
- function getScopedQueue(roomId, threadRootId) {
2258
- const roomQueue = getOrCreateQueue(roomId);
2259
- return threadRootId ? getOrCreateThreadQueue(roomId, roomQueue, threadRootId) : roomQueue;
2260
- }
2261
- function findScopedQueue(roomId, threadRootId) {
2262
- const roomQueue = roomQueues.get(roomId);
2263
- if (!roomQueue) return;
2264
- return threadRootId ? roomQueue.threadQueues.get(threadRootId) : roomQueue;
2265
- }
2266
- function appendToQueue(queue, entry) {
2267
- queue.entries.push(entry);
2268
- if (queue.entries.length > maxQueueSize) {
2269
- const overflow = queue.entries.length - maxQueueSize;
2270
- queue.entries.splice(0, overflow);
2271
- queue.baseIndex += overflow;
2272
- }
2273
- return {
2274
- snapshotIdx: queue.baseIndex + queue.entries.length,
2275
- queueGeneration: queue.generation
2276
- };
2277
- }
2278
- function wmKey(agentId, roomId, threadRootId) {
2279
- return JSON.stringify({
2280
- agentId,
2281
- roomId,
2282
- scope: threadRootId ?? "main"
2283
- });
2284
- }
2285
- function preparedTriggerKey(agentId, messageId) {
2286
- if (!messageId?.trim()) return null;
2287
- return `${agentId}:${messageId.trim()}`;
2288
- }
2289
- function rememberWatermark(key, snapshotIdx) {
2290
- const nextSnapshotIdx = Math.max(agentWatermarks.get(key) ?? 0, snapshotIdx);
2291
- if (agentWatermarks.has(key)) agentWatermarks.delete(key);
2292
- agentWatermarks.set(key, nextSnapshotIdx);
2293
- if (agentWatermarks.size > maxWatermarkEntries) {
2294
- const oldest = agentWatermarks.keys().next().value;
2295
- if (oldest !== void 0) agentWatermarks.delete(oldest);
2296
- }
2297
- }
2298
- function markConsumedAfterReservedGap(queue, key, firstReservedRel, snapshotIdx) {
2299
- const endRel = Math.min(snapshotIdx - queue.baseIndex, queue.entries.length);
2300
- for (let rel = firstReservedRel + 1; rel < endRel; rel += 1) {
2301
- const entry = queue.entries[rel];
2302
- if (!entry || entry.reserved || entry.discarded) continue;
2303
- entry.consumedBy ??= /* @__PURE__ */ new Set();
2304
- entry.consumedBy.add(key);
2305
- }
2306
- }
2307
- function rememberPreparedTrigger(queue, retryKey, prepared) {
2308
- if (queue.preparedTriggers.has(retryKey)) queue.preparedTriggers.delete(retryKey);
2309
- queue.preparedTriggers.set(retryKey, prepared);
2310
- if (queue.preparedTriggers.size > maxPreparedTriggerEntries) {
2311
- const oldest = queue.preparedTriggers.keys().next().value;
2312
- if (oldest !== void 0) queue.preparedTriggers.delete(oldest);
2313
- }
2314
- return prepared;
2315
- }
2316
- function computePendingHistory(queue, agentId, roomId, limit, endAbsExclusive = queue.baseIndex + queue.entries.length, startAbsOverride, threadRootId) {
2317
- if (limit <= 0 || queue.entries.length === 0) return [];
2318
- const wm = startAbsOverride ?? agentWatermarks.get(wmKey(agentId, roomId, threadRootId)) ?? 0;
2319
- const startRel = Math.max(wm, queue.baseIndex) - queue.baseIndex;
2320
- const endRel = Math.max(startRel, Math.min(endAbsExclusive - queue.baseIndex, queue.entries.length));
2321
- const available = queue.entries.slice(startRel, endRel).filter((entry) => !entry.discarded && !entry.reserved && !entry.consumedBy?.has(wmKey(agentId, roomId, threadRootId)));
2322
- return available.length > limit ? available.slice(-limit) : available;
2323
- }
2324
- function prepareTriggerInternal(agentId, roomId, limit, entry, threadRootId) {
2325
- const queue = getScopedQueue(roomId, threadRootId);
2326
- const retryKey = preparedTriggerKey(agentId, entry.messageId);
2327
- if (retryKey) {
2328
- const prepared = queue.preparedTriggers.get(retryKey);
2329
- if (prepared) return rememberPreparedTrigger(queue, retryKey, prepared);
2330
- }
2331
- const prepared = {
2332
- history: computePendingHistory(queue, agentId, roomId, limit, void 0, void 0, threadRootId),
2333
- ...appendToQueue(queue, entry)
2334
- };
2335
- if (retryKey) return rememberPreparedTrigger(queue, retryKey, prepared);
2336
- return prepared;
2337
- }
2338
- return {
2339
- recordPending(roomId, entry, threadRootId) {
2340
- appendToQueue(getScopedQueue(roomId, threadRootId), entry);
2341
- },
2342
- reservePending(agentId, roomId, entry, threadRootId) {
2343
- const snapshot = appendToQueue(getScopedQueue(roomId, threadRootId), {
2344
- ...entry,
2345
- reserved: true
2346
- });
2347
- return {
2348
- ...snapshot,
2349
- slotIdx: snapshot.snapshotIdx - 1,
2350
- watermarkIdx: agentWatermarks.get(wmKey(agentId, roomId, threadRootId)) ?? 0
2351
- };
2352
- },
2353
- finalizePending(roomId, slot, entry, threadRootId) {
2354
- const queue = findScopedQueue(roomId, threadRootId);
2355
- if (!queue || queue.generation !== slot.queueGeneration) return;
2356
- const rel = slot.slotIdx - queue.baseIndex;
2357
- if (rel < 0 || rel >= queue.entries.length) return;
2358
- queue.entries[rel] = entry;
2359
- },
2360
- discardPending(roomId, slot, threadRootId) {
2361
- const queue = findScopedQueue(roomId, threadRootId);
2362
- if (!queue || queue.generation !== slot.queueGeneration) return;
2363
- const rel = slot.slotIdx - queue.baseIndex;
2364
- if (rel < 0 || rel >= queue.entries.length) return;
2365
- queue.entries[rel] = {
2366
- sender: "",
2367
- body: "",
2368
- messageId: void 0,
2369
- discarded: true
2370
- };
2371
- },
2372
- prepareTrigger(agentId, roomId, limit, entry, threadRootId) {
2373
- return prepareTriggerInternal(agentId, roomId, limit, entry, threadRootId);
2374
- },
2375
- prepareReservedTrigger(agentId, roomId, limit, slot, entry, threadRootId) {
2376
- const queue = findScopedQueue(roomId, threadRootId);
2377
- if (!queue || queue.generation !== slot.queueGeneration) return prepareTriggerInternal(agentId, roomId, limit, entry, threadRootId);
2378
- const rel = slot.slotIdx - queue.baseIndex;
2379
- if (rel < 0 || rel >= queue.entries.length) return prepareTriggerInternal(agentId, roomId, limit, entry, threadRootId);
2380
- const retryKey = preparedTriggerKey(agentId, entry.messageId);
2381
- if (retryKey) {
2382
- const prepared = queue.preparedTriggers.get(retryKey);
2383
- if (prepared) {
2384
- queue.entries[rel] = {
2385
- sender: "",
2386
- body: "",
2387
- messageId: void 0,
2388
- discarded: true
2389
- };
2390
- return rememberPreparedTrigger(queue, retryKey, prepared);
2391
- }
2392
- }
2393
- queue.entries[rel] = entry;
2394
- const prepared = {
2395
- history: computePendingHistory(queue, agentId, roomId, limit, slot.slotIdx, slot.watermarkIdx, threadRootId),
2396
- snapshotIdx: slot.slotIdx + 1,
2397
- queueGeneration: queue.generation
2398
- };
2399
- if (retryKey) return rememberPreparedTrigger(queue, retryKey, prepared);
2400
- return prepared;
2401
- },
2402
- consumeHistory(agentId, roomId, snapshot, messageId, threadRootId) {
2403
- const key = wmKey(agentId, roomId, threadRootId);
2404
- const queue = findScopedQueue(roomId, threadRootId);
2405
- if (!queue) {
2406
- agentWatermarks.delete(key);
2407
- return;
2408
- }
2409
- if (queue.generation !== snapshot.queueGeneration) return;
2410
- const firstReservedRel = queue.entries.findIndex((entry, index) => entry.reserved === true && queue.baseIndex + index < snapshot.snapshotIdx);
2411
- if (firstReservedRel >= 0) markConsumedAfterReservedGap(queue, key, firstReservedRel, snapshot.snapshotIdx);
2412
- rememberWatermark(key, firstReservedRel >= 0 ? queue.baseIndex + firstReservedRel : snapshot.snapshotIdx);
2413
- const retryKey = preparedTriggerKey(agentId, messageId);
2414
- if (retryKey) queue.preparedTriggers.delete(retryKey);
2415
- }
2416
- };
2417
- }
2418
- function createRoomHistoryTracker(maxQueueSize = DEFAULT_MAX_QUEUE_SIZE, maxRoomQueues = DEFAULT_MAX_ROOM_QUEUES, maxWatermarkEntries = MAX_WATERMARK_ENTRIES, maxPreparedTriggerEntries = MAX_PREPARED_TRIGGER_ENTRIES) {
2419
- const tracker = createRoomHistoryTrackerInternal(maxQueueSize, maxRoomQueues, maxWatermarkEntries, maxPreparedTriggerEntries);
2420
- return {
2421
- recordPending: tracker.recordPending,
2422
- reservePending: tracker.reservePending,
2423
- finalizePending: tracker.finalizePending,
2424
- discardPending: tracker.discardPending,
2425
- prepareTrigger: tracker.prepareTrigger,
2426
- prepareReservedTrigger: tracker.prepareReservedTrigger,
2427
- consumeHistory: tracker.consumeHistory
2428
- };
2429
- }
2430
- //#endregion
2431
- //#region extensions/matrix/src/matrix/monitor/handler-ingress-access.ts
2432
- async function resolveMatrixIngressAccess(config) {
2433
- const { handler, params: paramsLocal, roomId, event, eventTs, senderId, isReactionEvent, readStoreAllowFrom, shouldSendPairingReply, resolveLiveAccountAllowlists, roomHistoryTracker, commitInboundEventIfClaimed } = config;
2434
- const { core, cfg, accountId, accountConfig, client, logVerboseMessage, groupPolicy, dmEnabled, dmPolicy, dmThreadReplies, threadReplies, roomsConfig, accountAllowBots, configuredBotUserIds, needsRoomAliasesForConfig, getRoomInfo, getMemberDisplayName } = handler;
2435
- const content = paramsLocal.content;
2436
- const isDirectMessage = paramsLocal.isDirectMessage;
2437
- const isRoom = !isDirectMessage;
2438
- const { audioPreflightMode, locationPayload, reservedHistorySlot, selfUserId } = paramsLocal;
2439
- const messageId = event.event_id ?? "";
2440
- const threadRootId = resolveMatrixThreadRootId({
2441
- event,
2442
- content
2443
- });
2444
- const thread = resolveMatrixThreadRouting({
2445
- isDirectMessage,
2446
- threadReplies,
2447
- dmThreadReplies,
2448
- messageId,
2449
- threadRootId
2450
- });
2451
- const historyThreadId = threadRootId ? thread.threadId : void 0;
2452
- let reservedHistorySlotConsumed = false;
2453
- const discardReservedHistorySlot = () => {
2454
- if (reservedHistorySlot && !reservedHistorySlotConsumed) {
2455
- roomHistoryTracker.discardPending(roomId, reservedHistorySlot, historyThreadId);
2456
- reservedHistorySlotConsumed = true;
2457
- }
2458
- };
2459
- const markReservedHistorySlotConsumed = () => {
2460
- reservedHistorySlotConsumed = true;
2461
- };
2462
- const commitInboundEventIfClaimedAndDiscardReserved = async () => {
2463
- discardReservedHistorySlot();
2464
- await commitInboundEventIfClaimed();
2465
- };
2466
- if (isRoom && groupPolicy === "disabled") {
2467
- await commitInboundEventIfClaimedAndDiscardReserved();
2468
- return;
2469
- }
2470
- const roomInfoForConfig = isRoom && needsRoomAliasesForConfig ? await getRoomInfo(roomId, { includeAliases: true }) : void 0;
2471
- const roomAliasesForConfig = roomInfoForConfig ? [roomInfoForConfig.canonicalAlias ?? "", ...roomInfoForConfig.altAliases].filter(Boolean) : [];
2472
- const roomConfigInfo = isRoom ? resolveMatrixRoomConfig({
2473
- rooms: roomsConfig,
2474
- roomId,
2475
- aliases: roomAliasesForConfig
2476
- }) : void 0;
2477
- const roomConfig = roomConfigInfo?.config;
2478
- const allowBotsMode = resolveMatrixAllowBotsMode(roomConfig?.allowBots ?? accountAllowBots);
2479
- const isConfiguredBotSender = configuredBotUserIds.has(senderId);
2480
- const roomMatchMeta = roomConfigInfo ? `matchKey=${roomConfigInfo.matchKey ?? "none"} matchSource=${roomConfigInfo.matchSource ?? "none"}` : "matchKey=none matchSource=none";
2481
- if (isConfiguredBotSender && allowBotsMode === "off") {
2482
- logVerboseMessage(`matrix: drop configured bot sender=${senderId} (allowBots=false${isDirectMessage ? "" : `, ${roomMatchMeta}`})`);
2483
- await commitInboundEventIfClaimedAndDiscardReserved();
2484
- return;
2485
- }
2486
- const botLoopProtection = isConfiguredBotSender && senderId !== selfUserId ? {
2487
- scopeId: accountId,
2488
- conversationId: roomId,
2489
- senderId,
2490
- receiverId: selfUserId,
2491
- config: mergePairLoopGuardConfig(accountConfig?.botLoopProtection, roomConfig?.botLoopProtection),
2492
- defaultsConfig: cfg.channels?.defaults?.botLoopProtection,
2493
- defaultEnabled: true,
2494
- nowMs: eventTs ?? void 0
2495
- } : void 0;
2496
- if (isRoom && roomConfig && !roomConfigInfo?.allowed) {
2497
- logVerboseMessage(`matrix: room disabled room=${roomId} (${roomMatchMeta})`);
2498
- await commitInboundEventIfClaimedAndDiscardReserved();
2499
- return;
2500
- }
2501
- if (isRoom && groupPolicy === "allowlist") {
2502
- if (!roomConfigInfo?.allowlistConfigured) {
2503
- logVerboseMessage(`matrix: drop room message (no allowlist, ${roomMatchMeta})`);
2504
- await commitInboundEventIfClaimedAndDiscardReserved();
2505
- return;
2506
- }
2507
- if (!roomConfig) {
2508
- logVerboseMessage(`matrix: drop room message (not in allowlist, ${roomMatchMeta})`);
2509
- await commitInboundEventIfClaimedAndDiscardReserved();
2510
- return;
2511
- }
2512
- }
2513
- let senderNamePromise = null;
2514
- const getSenderName = async () => {
2515
- senderNamePromise ??= getMemberDisplayName(roomId, senderId).catch(() => senderId);
2516
- return await senderNamePromise;
2517
- };
2518
- const storeAllowFrom = isDirectMessage && dmPolicy !== "allowlist" && dmPolicy !== "open" ? await readStoreAllowFrom() : [];
2519
- const roomUsers = roomConfig?.users ?? [];
2520
- const { liveDmAllowFrom, liveGroupAllowFrom } = await resolveLiveAccountAllowlists();
2521
- const accessState = await resolveMatrixMonitorAccessState({
2522
- allowFrom: liveDmAllowFrom,
2523
- storeAllowFrom,
2524
- dmPolicy,
2525
- groupPolicy,
2526
- groupAllowFrom: liveGroupAllowFrom,
2527
- roomUsers,
2528
- senderId,
2529
- isRoom,
2530
- accountId,
2531
- eventKind: isReactionEvent ? "reaction" : "message"
2532
- });
2533
- const { effectiveGroupAllowFrom, effectiveRoomUsers, messageIngress } = accessState;
2534
- const ingressDecision = messageIngress.ingress;
2535
- if (isDirectMessage) {
2536
- if (!dmEnabled || dmPolicy === "disabled") {
2537
- await commitInboundEventIfClaimedAndDiscardReserved();
2538
- return;
2539
- }
2540
- const senderReason = messageIngress.senderAccess.reasonCode;
2541
- if (ingressDecision.decision !== "allow") {
2542
- if (ingressDecision.admission === "pairing-required") {
2543
- const senderName = await getSenderName();
2544
- const { code, created } = await core.channel.pairing.upsertPairingRequest({
2545
- channel: "matrix",
2546
- id: senderId,
2547
- accountId,
2548
- meta: { name: senderName }
2549
- });
2550
- if (shouldSendPairingReply(senderId, created)) {
2551
- const pairingReply = core.channel.pairing.buildPairingReply({
2552
- channel: "matrix",
2553
- idLine: `Your Matrix user id: ${senderId}`,
2554
- code
2555
- });
2556
- logVerboseMessage(created ? `matrix pairing request sender=${senderId} name=${senderName ?? "unknown"} (reason=${senderReason})` : `matrix pairing reminder sender=${senderId} name=${senderName ?? "unknown"} (reason=${senderReason})`);
2557
- try {
2558
- const { sendMessageMatrix } = await loadMatrixSendModule();
2559
- await sendMessageMatrix(`room:${roomId}`, created ? pairingReply : `${pairingReply}\n\nPairing request is still pending approval. Reusing existing code.`, {
2560
- client,
2561
- cfg,
2562
- accountId
2563
- });
2564
- await commitInboundEventIfClaimed();
2565
- } catch (err) {
2566
- logVerboseMessage(`matrix pairing reply failed for ${senderId}: ${String(err)}`);
2567
- discardReservedHistorySlot();
2568
- return;
2569
- }
2570
- } else {
2571
- logVerboseMessage(`matrix pairing reminder suppressed sender=${senderId} (cooldown)`);
2572
- await commitInboundEventIfClaimedAndDiscardReserved();
2573
- }
2574
- }
2575
- if (isReactionEvent || dmPolicy !== "pairing") {
2576
- logVerboseMessage(`matrix: blocked ${isReactionEvent ? "reaction" : "dm"} sender ${senderId} (dmPolicy=${dmPolicy}, reason=${senderReason})`);
2577
- await commitInboundEventIfClaimedAndDiscardReserved();
2578
- }
2579
- return;
2580
- }
2581
- }
2582
- if (isRoom && ingressDecision.decision !== "allow") {
2583
- logVerboseMessage(`matrix: blocked sender ${senderId} (ingress=${ingressDecision.reasonCode}, ${roomMatchMeta})`);
2584
- await commitInboundEventIfClaimedAndDiscardReserved();
2585
- return;
2586
- }
2587
- if (isRoom) logVerboseMessage(`matrix: allow room ${roomId} (${roomMatchMeta})`);
2588
- if (isReactionEvent) {
2589
- const senderName = await getSenderName();
2590
- const { handleInboundMatrixReaction } = await loadMatrixReactionEvents();
2591
- await handleInboundMatrixReaction({
2592
- client,
2593
- core,
2594
- cfg,
2595
- accountId,
2596
- roomId,
2597
- event,
2598
- senderId,
2599
- senderLabel: senderName,
2600
- selfUserId,
2601
- isDirectMessage,
2602
- logVerboseMessage
2603
- });
2604
- await commitInboundEventIfClaimedAndDiscardReserved();
2605
- return;
2606
- }
2607
- return {
2608
- content,
2609
- messageId,
2610
- audioPreflightMode,
2611
- isDirectMessage,
2612
- isRoom,
2613
- locationPayload,
2614
- reservedHistorySlot,
2615
- threadRootId,
2616
- thread,
2617
- historyThreadId,
2618
- discardReservedHistorySlot,
2619
- markReservedHistorySlotConsumed,
2620
- commitInboundEventIfClaimedAndDiscardReserved,
2621
- roomConfig,
2622
- allowBotsMode,
2623
- isConfiguredBotSender,
2624
- selfUserId,
2625
- botLoopProtection,
2626
- roomMatchMeta,
2627
- getSenderName,
2628
- accessState,
2629
- effectiveGroupAllowFrom,
2630
- effectiveRoomUsers
2631
- };
2632
- }
2633
- //#endregion
2634
- //#region extensions/matrix/src/matrix/monitor/media.ts
2635
- const MATRIX_MEDIA_DOWNLOAD_IDLE_TIMEOUT_MS = 3e4;
2636
- async function fetchMatrixMediaBuffer(params) {
2637
- try {
2638
- return { buffer: await params.client.downloadContent(params.mxcUrl, {
2639
- maxBytes: params.maxBytes,
2640
- readIdleTimeoutMs: MATRIX_MEDIA_DOWNLOAD_IDLE_TIMEOUT_MS
2641
- }) };
2642
- } catch (err) {
2643
- if (isMatrixMediaSizeLimitError(err)) throw err;
2644
- throw new Error(`Matrix media download failed: ${String(err)}`, { cause: err });
2645
- }
2646
- }
2647
- /**
2648
- * Download and decrypt encrypted media from a Matrix room.
2649
- * Uses the Matrix crypto adapter's decryptMedia helper.
2650
- */
2651
- async function fetchEncryptedMediaBuffer(params) {
2652
- if (!params.client.crypto) throw new Error("Cannot decrypt media: crypto not enabled");
2653
- const decrypted = await params.client.crypto.decryptMedia(params.file, {
2654
- maxBytes: params.maxBytes,
2655
- readIdleTimeoutMs: MATRIX_MEDIA_DOWNLOAD_IDLE_TIMEOUT_MS
2656
- });
2657
- if (decrypted.byteLength > params.maxBytes) throw new MatrixMediaSizeLimitError();
2658
- return { buffer: decrypted };
2659
- }
2660
- async function downloadMatrixMedia(params) {
2661
- let fetched;
2662
- if (typeof params.sizeBytes === "number" && params.sizeBytes > params.maxBytes) throw new MatrixMediaSizeLimitError();
2663
- if (params.file) fetched = await fetchEncryptedMediaBuffer({
2664
- client: params.client,
2665
- file: params.file,
2666
- maxBytes: params.maxBytes
2667
- });
2668
- else fetched = await fetchMatrixMediaBuffer({
2669
- client: params.client,
2670
- mxcUrl: params.mxcUrl,
2671
- maxBytes: params.maxBytes
2672
- });
2673
- if (!fetched) return null;
2674
- const headerType = params.contentType ?? void 0;
2675
- const saved = await getMatrixRuntime().channel.media.saveMediaBuffer(fetched.buffer, headerType, "inbound", params.maxBytes, params.originalFilename);
2676
- return {
2677
- path: saved.path,
2678
- contentType: saved.contentType,
2679
- placeholder: "[matrix media]"
2680
- };
2681
- }
2682
- //#endregion
2683
- //#region extensions/matrix/src/matrix/monitor/mentions.ts
2684
- const MATRIX_HTML_ENTITY_RE = /&(?:#x?[0-9a-f]+|amp|apos|gt|lt|nbsp|quot);/gi;
2685
- function decodeVisibleHtmlEntities(value) {
2686
- return value.replace(MATRIX_HTML_ENTITY_RE, (entity) => {
2687
- const decoded = decodeHtmlEntities(entity.startsWith("&#") ? entity : entity.toLowerCase());
2688
- return decoded === "\xA0" ? " " : decoded;
2689
- });
2690
- }
2691
- function normalizeVisibleMentionText(value) {
2692
- return normalizeLowercaseStringOrEmpty(decodeVisibleHtmlEntities(value.replace(/<[^>]+>/g, " ").replace(/[\u200b-\u200f\u202a-\u202e\u2060-\u206f]/g, "")).replace(/\s+/g, " "));
2693
- }
2694
- function extractVisibleMentionText(value) {
2695
- return normalizeVisibleMentionText(value ?? "");
2696
- }
2697
- function resolveMatrixUserLocalpart(userId) {
2698
- const trimmed = userId.trim();
2699
- if (!trimmed.startsWith("@")) return null;
2700
- const colonIndex = trimmed.indexOf(":");
2701
- if (colonIndex <= 1) return null;
2702
- return trimmed.slice(1, colonIndex).trim() || null;
2703
- }
2704
- function resolveMatrixMentionPrefixCandidates(params) {
2705
- const candidates = [];
2706
- const seen = /* @__PURE__ */ new Set();
2707
- const append = (candidate) => {
2708
- const trimmed = candidate?.trim();
2709
- if (!trimmed) return;
2710
- const normalized = normalizeLowercaseStringOrEmpty(trimmed);
2711
- if (seen.has(normalized)) return;
2712
- seen.add(normalized);
2713
- candidates.push(trimmed);
2714
- };
2715
- append(params.userId);
2716
- const localpart = params.userId ? resolveMatrixUserLocalpart(params.userId) : null;
2717
- append(localpart ? `@${localpart}` : null);
2718
- append(params.displayName);
2719
- append(params.displayName ? `@${params.displayName}` : null);
2720
- append(params.displayName ? `@[${params.displayName}]` : null);
2721
- return candidates;
2722
- }
2723
- function stripMatchedMatrixMentionPrefix(text, pattern) {
2724
- const match = text.match(pattern);
2725
- if (!match) return null;
2726
- return text.slice(match[0].length).trimStart();
2727
- }
2728
- function stripNativeMatrixMentionPrefix(text, candidate) {
2729
- return stripMatchedMatrixMentionPrefix(text, new RegExp(`^\\s*${escapeRegExp(candidate)}(?:\\s*[:,])?(?:\\s+|$)`, "i"));
2730
- }
2731
- function stripRegexMatrixMentionPrefix(text, pattern) {
2732
- const flags = pattern.flags.replace(/[gy]/g, "");
2733
- return stripMatchedMatrixMentionPrefix(text, new RegExp(`^\\s*(?:${pattern.source})(?:\\s*[:,])?(?:\\s+|$)`, flags));
2734
- }
2735
- function stripMatrixMentionPrefix(params) {
2736
- const text = params.text;
2737
- if (!text) return text;
2738
- for (const candidate of resolveMatrixMentionPrefixCandidates(params)) {
2739
- const stripped = stripNativeMatrixMentionPrefix(text, candidate);
2740
- if (stripped !== null) return stripped;
2741
- }
2742
- for (const pattern of params.mentionRegexes ?? []) {
2743
- const stripped = stripRegexMatrixMentionPrefix(text, pattern);
2744
- if (stripped !== null) return stripped;
2745
- }
2746
- return text;
2747
- }
2748
- function isVisibleMentionLabel(params) {
2749
- const cleaned = extractVisibleMentionText(params.text);
2750
- if (!cleaned) return false;
2751
- if (params.mentionRegexes.some((pattern) => pattern.test(cleaned))) return true;
2752
- const localpart = resolveMatrixUserLocalpart(params.userId);
2753
- return [
2754
- extractVisibleMentionText(params.userId),
2755
- localpart ? extractVisibleMentionText(localpart) : null,
2756
- localpart ? extractVisibleMentionText(`@${localpart}`) : null,
2757
- params.displayName ? extractVisibleMentionText(params.displayName) : null,
2758
- params.displayName ? extractVisibleMentionText(`@${params.displayName}`) : null,
2759
- params.displayName ? extractVisibleMentionText(`@[${params.displayName}]`) : null
2760
- ].filter((value) => Boolean(value)).includes(cleaned);
2761
- }
2762
- function hasVisibleRoomMention(value) {
2763
- const cleaned = extractVisibleMentionText(value);
2764
- return /(^|[^a-z0-9_])@room\b/i.test(cleaned);
2765
- }
2766
- /**
2767
- * Check if formatted_body contains a matrix.to link whose visible label still
2768
- * looks like a real mention for the given user. Do not trust href alone, since
2769
- * senders can hide arbitrary matrix.to links behind unrelated link text.
2770
- * Many Matrix clients (including Element) use HTML links in formatted_body instead of
2771
- * or in addition to the m.mentions field.
2772
- */
2773
- function checkFormattedBodyMention(params) {
2774
- if (!params.formattedBody || !params.userId) return false;
2775
- for (const match of params.formattedBody.matchAll(/<a\b[^>]*href=(["'])(https:\/\/matrix\.to\/#[^"']+)\1[^>]*>(.*?)<\/a>/gis)) {
2776
- const href = match[2];
2777
- const visibleLabel = match[3] ?? "";
2778
- if (!href) continue;
2779
- try {
2780
- const parsed = new URL(href);
2781
- if (decodeURIComponent(parsed.hash.replace(/^#\/?/, "").trim()) !== params.userId.trim()) continue;
2782
- if (isVisibleMentionLabel({
2783
- text: visibleLabel,
2784
- userId: params.userId,
2785
- mentionRegexes: params.mentionRegexes,
2786
- displayName: params.displayName
2787
- })) return true;
2788
- } catch {
2789
- continue;
2790
- }
2791
- }
2792
- return false;
2793
- }
2794
- function resolveMentions(params) {
2795
- const mentions = params.content["m.mentions"];
2796
- const mentionedUsers = Array.isArray(mentions?.user_ids) ? new Set(mentions.user_ids) : /* @__PURE__ */ new Set();
2797
- const textMentioned = getMatrixRuntime().channel.mentions.matchesMentionPatterns(params.text ?? "", params.mentionRegexes);
2798
- const visibleRoomMention = hasVisibleRoomMention(params.text) || hasVisibleRoomMention(params.content.formatted_body);
2799
- const mentionedInFormattedBody = params.userId ? checkFormattedBodyMention({
2800
- formattedBody: params.content.formatted_body,
2801
- userId: params.userId,
2802
- displayName: params.displayName,
2803
- mentionRegexes: params.mentionRegexes
2804
- }) : false;
2805
- const metadataBackedUserMention = Boolean(params.userId && mentionedUsers.has(params.userId) && (mentionedInFormattedBody || textMentioned));
2806
- const metadataBackedRoomMention = Boolean(mentions?.room) && visibleRoomMention;
2807
- const explicitMention = mentionedInFormattedBody || metadataBackedUserMention || metadataBackedRoomMention;
2808
- return {
2809
- wasMentioned: explicitMention || textMentioned || visibleRoomMention,
2810
- hasExplicitMention: explicitMention
2811
- };
2812
- }
2813
- //#endregion
2814
- //#region extensions/matrix/src/matrix/monitor/handler-ingress-content.ts
2815
- async function resolveMatrixIngressContent(config) {
2816
- const { handler, params: paramsLocal, access, roomId, event, eventType, isPollEvent, eventTs, senderId, roomHistoryTracker, commitInboundEventIfClaimed } = config;
2817
- const { client, core, cfg, accountId, accountConfig, logger, logVerboseMessage, historyLimit, mediaMaxBytes, dmSessionScope, getMemberDisplayName } = handler;
2818
- const { content: accessContent, messageId, audioPreflightMode, isDirectMessage, isRoom, locationPayload, reservedHistorySlot, threadRootId, thread, historyThreadId, discardReservedHistorySlot, markReservedHistorySlotConsumed, commitInboundEventIfClaimedAndDiscardReserved, roomConfig, allowBotsMode, isConfiguredBotSender, selfUserId, botLoopProtection, roomMatchMeta, getSenderName, accessState, effectiveGroupAllowFrom, effectiveRoomUsers } = access;
2819
- let content = accessContent;
2820
- let pollSnapshotPromise = null;
2821
- const getPollSnapshot = async () => {
2822
- if (!isPollEvent) return null;
2823
- pollSnapshotPromise ??= fetchMatrixPollSnapshot(client, roomId, event).catch((err) => {
2824
- logVerboseMessage(`matrix: failed resolving poll snapshot room=${roomId} id=${event.event_id ?? "unknown"}: ${String(err)}`);
2825
- return null;
2826
- });
2827
- return await pollSnapshotPromise;
2828
- };
2829
- const mentionPrecheckText = resolveMatrixMentionPrecheckText({
2830
- eventType,
2831
- content,
2832
- locationText: locationPayload?.text
2833
- });
2834
- const contentUrl = "url" in content && typeof content.url === "string" ? content.url : void 0;
2835
- const contentFile = "file" in content && content.file && typeof content.file === "object" ? content.file : void 0;
2836
- const mediaUrl = contentUrl ?? contentFile?.url;
2837
- const earlyContentInfo = "info" in content && content.info && typeof content.info === "object" ? content.info : void 0;
2838
- const earlyContentType = earlyContentInfo?.mimetype;
2839
- const earlyContentSize = typeof earlyContentInfo?.size === "number" ? earlyContentInfo.size : void 0;
2840
- const earlyContentBody = typeof content.body === "string" ? content.body.trim() : "";
2841
- const earlyOriginalFilename = (typeof content.filename === "string" ? content.filename.trim() : "") || earlyContentBody || void 0;
2842
- const pendingHistoryText = resolveMatrixPendingHistoryText({
2843
- mentionPrecheckText,
2844
- content,
2845
- mediaUrl
2846
- });
2847
- const pendingHistoryPollText = !pendingHistoryText && isPollEvent && historyLimit > 0 ? (await getPollSnapshot())?.text : "";
2848
- if (!mentionPrecheckText && !mediaUrl && !isPollEvent) {
2849
- await commitInboundEventIfClaimedAndDiscardReserved();
2850
- return;
2851
- }
2852
- let preflightMedia = null;
2853
- let preflightMediaDownloadFailed = false;
2854
- let preflightMediaSizeLimitExceeded = false;
2855
- let preflightAudioTranscript;
2856
- const { route: _route, configuredBinding: _configuredBinding, runtimeBindingId: _runtimeBindingId } = resolveMatrixInboundRoute({
2857
- cfg,
2858
- accountId,
2859
- roomId,
2860
- senderId,
2861
- isDirectMessage,
2862
- dmSessionScope,
2863
- threadId: thread.threadId,
2864
- eventTs: eventTs ?? void 0,
2865
- resolveAgentRoute: core.channel.routing.resolveAgentRoute
2866
- });
2867
- const hasExplicitSessionBinding = _configuredBinding !== null || _runtimeBindingId !== null;
2868
- const preflightAudioMediaUrl = mediaUrl?.startsWith("mxc://") ? mediaUrl : void 0;
2869
- const shouldRunMatrixAudioPreflight = isMatrixAudioContent({
2870
- msgtype: typeof content.msgtype === "string" ? content.msgtype : void 0,
2871
- mimetype: earlyContentType
2872
- }) && isMatrixAudioMediaEnabled(cfg) && preflightAudioMediaUrl !== void 0;
2873
- if (shouldRunMatrixAudioPreflight && audioPreflightMode === "defer" && isRoom && historyLimit > 0 && !reservedHistorySlot) {
2874
- const reserved = roomHistoryTracker.reservePending(_route.agentId, roomId, {
2875
- sender: senderId,
2876
- body: pendingHistoryText,
2877
- timestamp: eventTs ?? void 0,
2878
- messageId
2879
- }, historyThreadId);
2880
- return { deferredPrefix: {
2881
- ...paramsLocal,
2882
- audioPreflightMode: "run",
2883
- reservedHistorySlot: reserved
2884
- } };
2885
- }
2886
- if (shouldRunMatrixAudioPreflight) {
2887
- try {
2888
- preflightMedia = await downloadMatrixMedia({
2889
- client,
2890
- mxcUrl: preflightAudioMediaUrl,
2891
- contentType: earlyContentType,
2892
- sizeBytes: earlyContentSize,
2893
- maxBytes: mediaMaxBytes,
2894
- file: contentFile,
2895
- originalFilename: earlyOriginalFilename
2896
- });
2897
- } catch (err) {
2898
- preflightMediaDownloadFailed = true;
2899
- if (isMatrixMediaSizeLimitError(err)) preflightMediaSizeLimitExceeded = true;
2900
- const errorText = formatMatrixErrorMessage(err);
2901
- logVerboseMessage(`matrix: media download failed room=${roomId} id=${event.event_id ?? "unknown"} type=${content.msgtype} error=${errorText}`);
2902
- logger.warn("matrix media download failed", {
2903
- roomId,
2904
- eventId: event.event_id,
2905
- msgtype: content.msgtype,
2906
- encrypted: Boolean(contentFile),
2907
- error: errorText
2908
- });
2909
- }
2910
- if (preflightMedia) preflightAudioTranscript = await resolveMatrixPreflightAudioTranscript({
2911
- mediaPath: preflightMedia.path,
2912
- mediaContentType: preflightMedia.contentType,
2913
- cfg,
2914
- accountId,
2915
- chatType: isDirectMessage ? "direct" : "channel",
2916
- originatingTo: `room:${roomId}`,
2917
- messageThreadId: thread.threadId,
2918
- sessionKey: _route.sessionKey
2919
- });
2920
- }
2921
- const agentMentionRegexes = core.channel.mentions.buildMentionRegexes(cfg, _route.agentId, {
2922
- provider: "matrix",
2923
- conversationId: roomId,
2924
- providerPolicy: accountConfig?.mentionPatterns
2925
- });
2926
- const selfDisplayName = content.formatted_body ? await getMemberDisplayName(roomId, selfUserId).catch(() => void 0) : void 0;
2927
- const mentionPrecheckTextWithTranscript = preflightAudioTranscript ? [mentionPrecheckText, preflightAudioTranscript].filter(Boolean).join("\n").trim() : mentionPrecheckText;
2928
- const { wasMentioned, hasExplicitMention } = resolveMentions({
2929
- content,
2930
- userId: selfUserId,
2931
- displayName: selfDisplayName,
2932
- text: mentionPrecheckTextWithTranscript,
2933
- mentionRegexes: agentMentionRegexes
2934
- });
2935
- if (isConfiguredBotSender && allowBotsMode === "mentions" && !isDirectMessage && !wasMentioned) {
2936
- logVerboseMessage(`matrix: drop configured bot sender=${senderId} (allowBots=mentions, missing mention, ${roomMatchMeta})`);
2937
- await commitInboundEventIfClaimedAndDiscardReserved();
2938
- return;
2939
- }
2940
- const allowTextCommands = core.channel.commands.shouldHandleTextCommands({
2941
- cfg,
2942
- surface: "matrix"
2943
- });
2944
- const useAccessGroups = true;
2945
- const commandCheckText = stripMatrixMentionPrefix({
2946
- text: mentionPrecheckText,
2947
- userId: selfUserId,
2948
- displayName: selfDisplayName,
2949
- mentionRegexes: agentMentionRegexes
2950
- });
2951
- const hasControlCommandInMessage = core.channel.text.hasControlCommand(commandCheckText, cfg);
2952
- const commandAccess = await resolveMatrixMonitorCommandAccess(accessState, {
2953
- useAccessGroups,
2954
- allowTextCommands,
2955
- hasControlCommand: hasControlCommandInMessage
2956
- });
2957
- const commandAuthorized = commandAccess.authorized;
2958
- if (isRoom && commandAccess.shouldBlockControlCommand) {
2959
- logInboundDrop({
2960
- log: logVerboseMessage,
2961
- channel: "matrix",
2962
- reason: "control command (unauthorized)",
2963
- target: senderId
2964
- });
2965
- await commitInboundEventIfClaimedAndDiscardReserved();
2966
- return;
2967
- }
2968
- const shouldRequireMention = isRoom ? roomConfig?.autoReply === true ? false : roomConfig?.autoReply === false ? true : typeof roomConfig?.requireMention === "boolean" ? roomConfig?.requireMention : true : false;
2969
- const mentionDecision = resolveInboundMentionDecision({
2970
- facts: {
2971
- canDetectMention: true,
2972
- wasMentioned,
2973
- hasAnyMention: hasExplicitMention
2974
- },
2975
- policy: {
2976
- isGroup: isRoom,
2977
- requireMention: shouldRequireMention,
2978
- allowTextCommands,
2979
- hasControlCommand: hasControlCommandInMessage,
2980
- commandAuthorized
2981
- }
2982
- });
2983
- const { effectiveWasMentioned, shouldBypassMention } = mentionDecision;
2984
- const canDetectMention = agentMentionRegexes.length > 0 || hasExplicitMention;
2985
- if (mentionDecision.shouldSkip) {
2986
- const pendingHistoryBody = preflightAudioTranscript ? formatMatrixAudioTranscript(preflightAudioTranscript) : pendingHistoryText || pendingHistoryPollText;
2987
- if (historyLimit > 0 && pendingHistoryBody) {
2988
- const pendingEntry = {
2989
- sender: senderId,
2990
- body: pendingHistoryBody,
2991
- timestamp: eventTs ?? void 0,
2992
- messageId
2993
- };
2994
- if (reservedHistorySlot) {
2995
- roomHistoryTracker.finalizePending(roomId, reservedHistorySlot, pendingEntry, historyThreadId);
2996
- markReservedHistorySlotConsumed();
2997
- } else roomHistoryTracker.recordPending(roomId, pendingEntry, historyThreadId);
2998
- }
2999
- logger.info("skipping room message", {
3000
- roomId,
3001
- reason: "no-mention"
3002
- });
3003
- await commitInboundEventIfClaimed();
3004
- return;
3005
- }
3006
- if (preflightAudioTranscript) await sendMatrixPreflightAudioTranscriptEcho({
3007
- transcript: preflightAudioTranscript,
3008
- cfg,
3009
- accountId,
3010
- originatingTo: `room:${roomId}`,
3011
- messageThreadId: thread.threadId
3012
- });
3013
- if (isPollEvent) {
3014
- const pollSnapshot = await getPollSnapshot();
3015
- if (!pollSnapshot) {
3016
- discardReservedHistorySlot();
3017
- return;
3018
- }
3019
- content = {
3020
- msgtype: "m.text",
3021
- body: pollSnapshot.text
3022
- };
3023
- }
3024
- let media = preflightMedia;
3025
- let mediaDownloadFailed = preflightMediaDownloadFailed;
3026
- let mediaSizeLimitExceeded = preflightMediaSizeLimitExceeded;
3027
- const finalContentUrl = "url" in content && typeof content.url === "string" ? content.url : void 0;
3028
- const finalContentFile = "file" in content && content.file && typeof content.file === "object" ? content.file : void 0;
3029
- const finalMediaUrl = finalContentUrl ?? finalContentFile?.url;
3030
- const contentBody = typeof content.body === "string" ? content.body.trim() : "";
3031
- const originalFilename = (typeof content.filename === "string" ? content.filename.trim() : "") || contentBody || void 0;
3032
- const contentInfo = "info" in content && content.info && typeof content.info === "object" ? content.info : void 0;
3033
- const contentType = contentInfo?.mimetype;
3034
- const contentSize = typeof contentInfo?.size === "number" ? contentInfo.size : void 0;
3035
- if (!media && !mediaDownloadFailed && finalMediaUrl?.startsWith("mxc://")) try {
3036
- media = await downloadMatrixMedia({
3037
- client,
3038
- mxcUrl: finalMediaUrl,
3039
- contentType,
3040
- sizeBytes: contentSize,
3041
- maxBytes: mediaMaxBytes,
3042
- file: finalContentFile,
3043
- originalFilename
3044
- });
3045
- } catch (err) {
3046
- mediaDownloadFailed = true;
3047
- if (isMatrixMediaSizeLimitError(err)) mediaSizeLimitExceeded = true;
3048
- const errorText = formatMatrixErrorMessage(err);
3049
- logVerboseMessage(`matrix: media download failed room=${roomId} id=${event.event_id ?? "unknown"} type=${content.msgtype} error=${errorText}`);
3050
- logger.warn("matrix media download failed", {
3051
- roomId,
3052
- eventId: event.event_id,
3053
- msgtype: content.msgtype,
3054
- encrypted: Boolean(finalContentFile),
3055
- error: errorText
3056
- });
3057
- }
3058
- let bodyText = resolveMatrixInboundBodyText({
3059
- rawBody: locationPayload?.text ?? contentBody,
3060
- filename: typeof content.filename === "string" ? content.filename : void 0,
3061
- mediaPlaceholder: media?.placeholder,
3062
- msgtype: content.msgtype,
3063
- hadMediaUrl: Boolean(finalMediaUrl),
3064
- mediaDownloadFailed,
3065
- mediaSizeLimitExceeded
3066
- });
3067
- if (preflightMedia && bodyText && bodyText !== preflightMedia.placeholder && isLikelyBareFilename(bodyText)) bodyText = preflightMedia.placeholder;
3068
- if (preflightAudioTranscript) {
3069
- const transcriptBody = formatMatrixAudioTranscript(preflightAudioTranscript);
3070
- bodyText = !bodyText || bodyText === media?.placeholder ? transcriptBody : `${bodyText}\n${transcriptBody}`;
3071
- }
3072
- if (!bodyText) {
3073
- await commitInboundEventIfClaimedAndDiscardReserved();
3074
- return;
3075
- }
3076
- const commandBodyText = hasControlCommandInMessage ? commandCheckText : bodyText;
3077
- const senderName = await getSenderName();
3078
- if (_configuredBinding) {
3079
- const { ensureConfiguredAcpBindingReady } = await loadAcpBindingRuntime();
3080
- if (!(await ensureConfiguredAcpBindingReady({
3081
- cfg,
3082
- configuredBinding: _configuredBinding
3083
- })).ok) {
3084
- logInboundDrop({
3085
- log: logVerboseMessage,
3086
- channel: "matrix",
3087
- reason: "configured ACP binding unavailable",
3088
- target: _configuredBinding.spec.conversationId
3089
- });
3090
- discardReservedHistorySlot();
3091
- return;
3092
- }
3093
- }
3094
- if (_runtimeBindingId) {
3095
- const { getSessionBindingService } = await loadSessionBindingRuntime();
3096
- getSessionBindingService().touch(_runtimeBindingId, eventTs ?? void 0);
3097
- }
3098
- const preparedTrigger = isRoom && historyLimit > 0 ? reservedHistorySlot ? roomHistoryTracker.prepareReservedTrigger(_route.agentId, roomId, historyLimit, reservedHistorySlot, {
3099
- sender: senderName,
3100
- body: bodyText,
3101
- timestamp: eventTs ?? void 0,
3102
- messageId
3103
- }, historyThreadId) : roomHistoryTracker.prepareTrigger(_route.agentId, roomId, historyLimit, {
3104
- sender: senderName,
3105
- body: bodyText,
3106
- timestamp: eventTs ?? void 0,
3107
- messageId
3108
- }, historyThreadId) : void 0;
3109
- if (reservedHistorySlot && preparedTrigger) markReservedHistorySlotConsumed();
3110
- return {
3111
- route: _route,
3112
- hasExplicitSessionBinding,
3113
- roomConfig,
3114
- isDirectMessage,
3115
- isRoom,
3116
- shouldRequireMention,
3117
- wasMentioned,
3118
- effectiveWasMentioned,
3119
- shouldBypassMention,
3120
- canDetectMention,
3121
- commandAuthorized,
3122
- inboundHistory: preparedTrigger ? buildInboundHistoryFromEntries({
3123
- entries: preparedTrigger.history,
3124
- limit: historyLimit
3125
- }) : void 0,
3126
- senderName,
3127
- bodyText,
3128
- commandBodyText,
3129
- media,
3130
- preflightAudioTranscript,
3131
- locationPayload,
3132
- messageId,
3133
- triggerSnapshot: preparedTrigger,
3134
- threadRootId,
3135
- thread,
3136
- botLoopProtection,
3137
- effectiveGroupAllowFrom,
3138
- effectiveRoomUsers
3139
- };
3140
- }
3141
- //#endregion
3142
- //#region extensions/matrix/src/matrix/monitor/location.ts
3143
- function decodeGeoUriParamValue(value) {
3144
- try {
3145
- return decodeURIComponent(value);
3146
- } catch {
3147
- return value;
3148
- }
3149
- }
3150
- function parseGeoUri(value) {
3151
- const trimmed = value.trim();
3152
- if (!trimmed) return null;
3153
- if (!normalizeLowercaseStringOrEmpty(trimmed).startsWith("geo:")) return null;
3154
- const [coordsPart, ...paramParts] = trimmed.slice(4).split(";");
3155
- if (!coordsPart) return null;
3156
- const coords = coordsPart.split(",");
3157
- if (coords.length < 2) return null;
3158
- const latitude = parseStrictFiniteNumber(coords[0] ?? "");
3159
- const longitude = parseStrictFiniteNumber(coords[1] ?? "");
3160
- if (latitude === void 0 || longitude === void 0) return null;
3161
- const params = /* @__PURE__ */ new Map();
3162
- for (const part of paramParts) {
3163
- const segment = part.trim();
3164
- if (!segment) continue;
3165
- const eqIndex = segment.indexOf("=");
3166
- const rawKey = eqIndex === -1 ? segment : segment.slice(0, eqIndex);
3167
- const rawValue = eqIndex === -1 ? "" : segment.slice(eqIndex + 1);
3168
- const key = normalizeLowercaseStringOrEmpty(rawKey);
3169
- if (!key) continue;
3170
- const valuePart = rawValue.trim();
3171
- params.set(key, valuePart ? decodeGeoUriParamValue(valuePart) : "");
3172
- }
3173
- const accuracyRaw = params.get("u");
3174
- return {
3175
- latitude,
3176
- longitude,
3177
- accuracy: accuracyRaw ? parseStrictFiniteNumber(accuracyRaw) : void 0
3178
- };
3179
- }
3180
- function resolveMatrixLocation(params) {
3181
- const { eventType, content } = params;
3182
- if (!(eventType === EventType.Location || eventType === EventType.RoomMessage && content.msgtype === EventType.Location)) return null;
3183
- const geoUri = normalizeOptionalString(content.geo_uri) ?? "";
3184
- if (!geoUri) return null;
3185
- const parsed = parseGeoUri(geoUri);
3186
- if (!parsed) return null;
3187
- const caption = normalizeOptionalString(content.body) ?? "";
3188
- const location = {
3189
- latitude: parsed.latitude,
3190
- longitude: parsed.longitude,
3191
- accuracy: parsed.accuracy,
3192
- caption: caption || void 0,
3193
- source: "pin",
3194
- isLive: false
3195
- };
3196
- return {
3197
- text: formatLocationText(location),
3198
- context: toLocationContext(location)
3199
- };
3200
- }
3201
- //#endregion
3202
- //#region extensions/matrix/src/matrix/monitor/handler-ingress-prefix.ts
3203
- async function readMatrixIngressPrefix(config) {
3204
- const { client, senderId, dropPreStartupMessages, eventTs, eventAge, startupMs, startupGraceMs, event, eventType, eventId, inboundDeduper, roomId, logVerboseMessage, directTracker, claimInboundReplay } = config;
3205
- const selfUserId = await client.getUserId();
3206
- if (senderId === selfUserId) return;
3207
- if (dropPreStartupMessages) {
3208
- if (typeof eventTs === "number" && eventTs < startupMs - startupGraceMs) return;
3209
- if (typeof eventTs !== "number" && typeof eventAge === "number" && eventAge > startupGraceMs) return;
3210
- }
3211
- const content = event.content;
3212
- if (eventType === EventType.RoomMessage && isMatrixVerificationRoomMessage({
3213
- msgtype: content.msgtype,
3214
- body: content.body
3215
- })) {
3216
- logVerboseMessage(`matrix: skip verification/system room message room=${roomId}`);
3217
- return;
3218
- }
3219
- const locationPayload = resolveMatrixLocation({
3220
- eventType,
3221
- content
3222
- });
3223
- const relates = content["m.relates_to"];
3224
- if (relates && "rel_type" in relates && relates.rel_type === RelationType.Replace) return;
3225
- if (hasBundledMatrixReplacementRelation(event)) return;
3226
- if (eventId && inboundDeduper) {
3227
- const claim = await inboundDeduper.claim({
3228
- roomId,
3229
- eventId
3230
- });
3231
- if (claim.kind === "claimed") claimInboundReplay(claim.handle);
3232
- else if (claim.kind !== "invalid") {
3233
- logVerboseMessage(`matrix: skip duplicate inbound event room=${roomId} id=${eventId}`);
3234
- return;
3235
- }
3236
- }
3237
- return {
3238
- content,
3239
- isDirectMessage: await directTracker.isDirectMessage({
3240
- roomId,
3241
- senderId,
3242
- selfUserId
3243
- }),
3244
- locationPayload,
3245
- selfUserId
3246
- };
3247
- }
3248
- //#endregion
3249
- //#region extensions/matrix/src/matrix/monitor/replies.ts
3250
- const THINKING_TAG_RE = /<\s*\/?\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;
3251
- const THINKING_BLOCK_RE = /<\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>[\s\S]*?<\s*\/\s*(?:think(?:ing)?|thought|antthinking)\s*>/gi;
3252
- function shouldSuppressReasoningReplyText(text) {
3253
- if (typeof text !== "string") return false;
3254
- const trimmedStart = text.trimStart();
3255
- if (!trimmedStart) return false;
3256
- if (normalizeLowercaseStringOrEmpty(trimmedStart).startsWith("reasoning:")) return true;
3257
- THINKING_TAG_RE.lastIndex = 0;
3258
- if (!THINKING_TAG_RE.test(text)) return false;
3259
- THINKING_BLOCK_RE.lastIndex = 0;
3260
- const withoutThinkingBlocks = text.replace(THINKING_BLOCK_RE, "");
3261
- THINKING_TAG_RE.lastIndex = 0;
3262
- return !withoutThinkingBlocks.replace(THINKING_TAG_RE, "").trim();
3263
- }
3264
- async function deliverMatrixReplies(params) {
3265
- const core = getMatrixRuntime();
3266
- const tableMode = params.tableMode ?? core.channel.text.resolveMarkdownTableMode({
3267
- cfg: params.cfg,
3268
- channel: "matrix",
3269
- accountId: params.accountId
3270
- });
3271
- const logVerbose = (message) => {
3272
- if (core.logging.shouldLogVerbose()) params.runtime.log?.(message);
3273
- };
3274
- let hasReplied = false;
3275
- let deliveredAny = false;
3276
- for (const reply of params.replies) {
3277
- if (reply.isReasoning === true || shouldSuppressReasoningReplyText(reply.text)) {
3278
- logVerbose("matrix reply suppressed as reasoning-only");
3279
- continue;
3280
- }
3281
- const hasMedia = Boolean(reply?.mediaUrl) || (reply?.mediaUrls?.length ?? 0) > 0;
3282
- if (!reply?.text && !hasMedia) {
3283
- if (reply?.audioAsVoice) {
3284
- logVerbose("matrix reply has audioAsVoice without media/text; skipping");
3285
- continue;
3286
- }
3287
- params.runtime.error?.("matrix reply missing text/media");
3288
- continue;
3289
- }
3290
- const replyToIdRaw = (reply.replyToId ?? params.replyToId)?.trim();
3291
- const replyToId = params.threadId ? replyToIdRaw : params.replyToMode === "off" ? void 0 : replyToIdRaw;
3292
- const rawText = reply.text ?? "";
3293
- const mediaList = reply.mediaUrls?.length ? reply.mediaUrls : reply.mediaUrl ? [reply.mediaUrl] : [];
3294
- const shouldIncludeReply = (id) => Boolean(id) && (params.threadId || params.replyToMode === "all" || !hasReplied);
3295
- const replyToIdForReply = shouldIncludeReply(replyToId) ? replyToId : void 0;
3296
- if (mediaList.length === 0) {
3297
- let sentTextChunk = false;
3298
- const { chunks } = chunkMatrixText(rawText, {
3299
- cfg: params.cfg,
3300
- accountId: params.accountId,
3301
- tableMode
3302
- });
3303
- for (const chunk of chunks) {
3304
- const trimmed = chunk.trim();
3305
- if (!trimmed) continue;
3306
- await sendMessageMatrix(params.roomId, trimmed, {
3307
- client: params.client,
3308
- cfg: params.cfg,
3309
- replyToId: replyToIdForReply,
3310
- threadId: params.threadId,
3311
- accountId: params.accountId
3312
- });
3313
- deliveredAny = true;
3314
- sentTextChunk = true;
3315
- }
3316
- if (replyToIdForReply && !hasReplied && sentTextChunk) hasReplied = true;
3317
- continue;
3318
- }
3319
- let first = true;
3320
- for (const mediaUrl of mediaList) {
3321
- const caption = first ? rawText : "";
3322
- await sendMessageMatrix(params.roomId, caption, {
3323
- client: params.client,
3324
- cfg: params.cfg,
3325
- mediaUrl,
3326
- mediaLocalRoots: params.mediaLocalRoots,
3327
- replyToId: replyToIdForReply,
3328
- threadId: params.threadId,
3329
- audioAsVoice: reply.audioAsVoice,
3330
- accountId: params.accountId
3331
- });
3332
- deliveredAny = true;
3333
- first = false;
3334
- }
3335
- if (replyToIdForReply && !hasReplied) hasReplied = true;
3336
- }
3337
- return deliveredAny;
3338
- }
3339
- //#endregion
3340
- //#region extensions/matrix/src/matrix/monitor/handler-reply-dispatcher.ts
3341
- function createMatrixReplyDispatcher(config) {
3342
- const { cfg, prefixOptions, humanDelay, typingCallbacks, streaming, draftStream, draftController, client, roomId, runtime, textLimit, replyToMode, threadTarget, replyToEventId, accountId, mediaLocalRoots, tableMode, logVerboseMessage } = config;
3343
- const quietDraftStreaming = streaming === "quiet" || streaming === "progress";
3344
- let finalReplyDeliveryFailed = false;
3345
- let nonFinalReplyDeliveryFailed = false;
3346
- const { deliver: deliverReply, onError: onReplyError, ...turnDispatcherOptions } = {
3347
- ...prefixOptions,
3348
- humanDelay,
3349
- deliver: async (payload, info) => {
3350
- if (draftStream && info.kind !== "tool" && !payload.isCompactionNotice) {
3351
- const hasMedia = Boolean(payload.mediaUrl) || (payload.mediaUrls?.length ?? 0) > 0;
3352
- const ttsSupplement = getReplyPayloadTtsSupplement(payload);
3353
- const fallbackPayload = ttsSupplement && ttsSupplement.visibleTextAlreadyDelivered !== true && !payload.text?.trim() ? {
3354
- ...payload,
3355
- text: ttsSupplement.spokenText
3356
- } : payload;
3357
- if (draftController.isDraftConsumed()) {
3358
- await draftStream.discardPending();
3359
- await deliverMatrixReplies({
3360
- cfg,
3361
- replies: [fallbackPayload],
3362
- roomId,
3363
- client,
3364
- runtime,
3365
- textLimit,
3366
- replyToMode,
3367
- threadId: threadTarget,
3368
- replyToId: threadTarget ?? replyToEventId ?? void 0,
3369
- accountId,
3370
- mediaLocalRoots,
3371
- tableMode
3372
- });
3373
- return;
3374
- }
3375
- const payloadReplyToId = normalizeOptionalString(payload.replyToId);
3376
- const payloadReplyMismatch = replyToMode !== "off" && !threadTarget && payloadReplyToId !== draftController.currentReplyToId();
3377
- let mustDeliverFinalNormally = draftStream.mustDeliverFinalNormally();
3378
- if (Boolean(payload.text?.trim()) && !payload.isError && !payloadReplyMismatch && !mustDeliverFinalNormally) {
3379
- await draftStream.stop();
3380
- mustDeliverFinalNormally = draftStream.mustDeliverFinalNormally();
3381
- } else await draftStream.discardPending();
3382
- const draftEventId = draftStream.eventId();
3383
- const draftFinalTextNeedsNormalMentionDelivery = Boolean(draftEventId) && typeof payload.text === "string" && Boolean(payload.text.trim()) && !payload.isError && !payloadReplyMismatch && !mustDeliverFinalNormally && await matrixTextWouldActivateMentions(client, payload.text);
3384
- if (draftEventId && payload.text && !payload.isError && !hasMedia && !payloadReplyMismatch && !mustDeliverFinalNormally && !draftFinalTextNeedsNormalMentionDelivery) {
3385
- const finalPreviewText = payload.text;
3386
- await deliverWithFinalizableLivePreviewAdapter({
3387
- kind: "final",
3388
- payload,
3389
- adapter: defineFinalizableLivePreviewAdapter({
3390
- draft: {
3391
- flush: async () => {},
3392
- clear: async () => {},
3393
- discardPending: async () => {},
3394
- id: () => draftEventId
3395
- },
3396
- buildFinalEdit: () => ({
3397
- text: finalPreviewText,
3398
- finalizeLive: !(quietDraftStreaming || !draftStream.matchesPreparedText(finalPreviewText)),
3399
- ...quietDraftStreaming ? { extraContent: buildMatrixFinalizedPreviewContent() } : {}
3400
- }),
3401
- editFinal: async (_draftEventId, edit) => {
3402
- if (edit.finalizeLive) {
3403
- if (!await draftStream.finalizeLive()) throw new Error("Matrix draft live finalize failed");
3404
- return;
3405
- }
3406
- const { editMessageMatrix } = await loadMatrixSendModule();
3407
- await editMessageMatrix(roomId, _draftEventId, edit.text, {
3408
- client,
3409
- cfg,
3410
- threadId: threadTarget,
3411
- accountId,
3412
- extraContent: edit.extraContent
3413
- });
3414
- },
3415
- createPreviewReceipt: (id) => createPreviewMessageReceipt({
3416
- id,
3417
- ...threadTarget ? { threadId: threadTarget } : {},
3418
- ...draftController.currentReplyToId() ? { replyToId: draftController.currentReplyToId() } : {}
3419
- }),
3420
- logPreviewEditFailure: (err) => {
3421
- logVerboseMessage(`matrix: preview final edit failed: ${String(err)}`);
3422
- }
3423
- }),
3424
- deliverNormally: async () => {
3425
- await redactMatrixDraftEvent(client, roomId, draftEventId);
3426
- await deliverMatrixReplies({
3427
- cfg,
3428
- replies: [fallbackPayload],
3429
- roomId,
3430
- client,
3431
- runtime,
3432
- textLimit,
3433
- replyToMode,
3434
- threadId: threadTarget,
3435
- replyToId: threadTarget ?? replyToEventId ?? void 0,
3436
- accountId,
3437
- mediaLocalRoots,
3438
- tableMode
3439
- });
3440
- }
3441
- });
3442
- draftController.markDraftConsumed();
3443
- } else if (draftEventId && hasMedia && !payloadReplyMismatch) {
3444
- let textEditOk = !mustDeliverFinalNormally;
3445
- const payloadText = payload.text ?? ttsSupplement?.spokenText;
3446
- const payloadTextMatchesDraft = typeof payloadText === "string" && draftStream.matchesPreparedText(payloadText);
3447
- const reusesDraftTextUnchanged = typeof payloadText === "string" && Boolean(payloadText.trim()) && payloadTextMatchesDraft;
3448
- const mediaTextNeedsNormalMentionDelivery = typeof payloadText === "string" && Boolean(payloadText.trim()) && await matrixTextWouldActivateMentions(client, payloadText);
3449
- const requiresFinalTextEdit = quietDraftStreaming || typeof payloadText === "string" && !payloadTextMatchesDraft;
3450
- if (textEditOk && mediaTextNeedsNormalMentionDelivery) textEditOk = false;
3451
- else if (textEditOk && payloadText && requiresFinalTextEdit) {
3452
- const { editMessageMatrix } = await loadMatrixSendModule();
3453
- textEditOk = await editMessageMatrix(roomId, draftEventId, payloadText, {
3454
- client,
3455
- cfg,
3456
- threadId: threadTarget,
3457
- accountId,
3458
- extraContent: quietDraftStreaming ? buildMatrixFinalizedPreviewContent() : void 0
3459
- }).then(() => true, () => false);
3460
- } else if (textEditOk && reusesDraftTextUnchanged) textEditOk = await draftStream.finalizeLive();
3461
- const reusesDraftAsFinalText = Boolean(payloadText?.trim()) && textEditOk;
3462
- if (!reusesDraftAsFinalText) await redactMatrixDraftEvent(client, roomId, draftEventId);
3463
- const mediaPayload = ttsSupplement && reusesDraftAsFinalText ? buildTtsSupplementMediaPayload(payload) : {
3464
- ...payload,
3465
- text: reusesDraftAsFinalText ? void 0 : payload.text ?? (ttsSupplement?.visibleTextAlreadyDelivered === true ? void 0 : ttsSupplement?.spokenText)
3466
- };
3467
- await deliverMatrixReplies({
3468
- cfg,
3469
- replies: [mediaPayload],
3470
- roomId,
3471
- client,
3472
- runtime,
3473
- textLimit,
3474
- replyToMode,
3475
- threadId: threadTarget,
3476
- replyToId: threadTarget ?? replyToEventId ?? void 0,
3477
- accountId,
3478
- mediaLocalRoots,
3479
- tableMode
3480
- });
3481
- draftController.markDraftConsumed();
3482
- } else {
3483
- const draftRedacted = Boolean(draftEventId) && (payload.isError || payloadReplyMismatch || mustDeliverFinalNormally || draftFinalTextNeedsNormalMentionDelivery);
3484
- if (draftRedacted && draftEventId) await redactMatrixDraftEvent(client, roomId, draftEventId);
3485
- const deliveredFallback = await deliverMatrixReplies({
3486
- cfg,
3487
- replies: [fallbackPayload],
3488
- roomId,
3489
- client,
3490
- runtime,
3491
- textLimit,
3492
- replyToMode,
3493
- threadId: threadTarget,
3494
- replyToId: threadTarget ?? replyToEventId ?? void 0,
3495
- accountId,
3496
- mediaLocalRoots,
3497
- tableMode
3498
- });
3499
- if (draftRedacted || deliveredFallback) draftController.markDraftConsumed();
3500
- }
3501
- if (info.kind === "block") {
3502
- draftController.clearDraftConsumed();
3503
- draftController.advanceDraftBlockBoundary({ fallbackToLatestEnd: true });
3504
- draftStream.reset();
3505
- draftController.resetReplyToIdForNextBlock();
3506
- draftController.updateDraftFromLatestFullText();
3507
- const { sendTypingMatrix } = await loadMatrixSendModule();
3508
- await sendTypingMatrix(roomId, true, void 0, client).catch(() => {});
3509
- }
3510
- } else await deliverMatrixReplies({
3511
- cfg,
3512
- replies: [payload],
3513
- roomId,
3514
- client,
3515
- runtime,
3516
- textLimit,
3517
- replyToMode,
3518
- threadId: threadTarget,
3519
- replyToId: threadTarget ?? replyToEventId ?? void 0,
3520
- accountId,
3521
- mediaLocalRoots,
3522
- tableMode
3523
- });
3524
- },
3525
- onError: (err, info) => {
3526
- if (info.kind === "final") finalReplyDeliveryFailed = true;
3527
- else nonFinalReplyDeliveryFailed = true;
3528
- if (info.kind === "block") draftController.advanceDraftBlockBoundary({ fallbackToLatestEnd: true });
3529
- runtime.error?.(`matrix ${info.kind} reply failed: ${String(err)}`);
3530
- },
3531
- onReplyStart: typingCallbacks.onReplyStart,
3532
- onIdle: typingCallbacks.onIdle
3533
- };
3534
- return {
3535
- deliverReply,
3536
- onReplyError,
3537
- turnDispatcherOptions,
3538
- finalReplyDeliveryFailed: () => finalReplyDeliveryFailed,
3539
- nonFinalReplyDeliveryFailed: () => nonFinalReplyDeliveryFailed
3540
- };
3541
- }
3542
- //#endregion
3543
- //#region extensions/matrix/src/matrix/monitor/handler-state.ts
3544
- const ALLOW_FROM_STORE_CACHE_TTL_MS = 3e4;
3545
- const PAIRING_REPLY_COOLDOWN_MS = 5 * 6e4;
3546
- const MAX_TRACKED_PAIRING_REPLY_SENDERS = 512;
3547
- function createMatrixHandlerState(config) {
3548
- const { core, accountId, runtime, allowFromResolvedEntries, groupAllowFromResolvedEntries, resolveLiveUserAllowlist } = config;
3549
- let cachedStoreAllowFrom = null;
3550
- let liveDmAllowlistCache = null;
3551
- let liveGroupAllowlistCache = null;
3552
- const resolveCachedLiveAllowlist = async (paramsValue) => {
3553
- const accountConfigLocal = resolveMatrixAccountConfig({
3554
- cfg: paramsValue.cfg,
3555
- accountId
3556
- });
3557
- const signature = JSON.stringify({
3558
- entries: (paramsValue.entries ?? []).map((entry) => String(entry).trim()),
3559
- failClosedOnUnresolved: paramsValue.failClosedOnUnresolved === true,
3560
- dangerouslyAllowNameMatching: isDangerousNameMatchingEnabled(accountConfigLocal)
3561
- });
3562
- if (paramsValue.cache?.signature === signature) return paramsValue.cache.entries;
3563
- const entries = await resolveLiveUserAllowlist({
3564
- cfg: paramsValue.cfg,
3565
- accountId,
3566
- entries: paramsValue.entries,
3567
- failClosedOnUnresolved: paramsValue.failClosedOnUnresolved,
3568
- startupResolvedEntries: paramsValue.startupResolvedEntries,
3569
- runtime
3570
- });
3571
- const next = {
3572
- signature,
3573
- entries
3574
- };
3575
- paramsValue.updateCache(next);
3576
- return entries;
3577
- };
3578
- const pairingReplySentAtMsBySender = /* @__PURE__ */ new Map();
3579
- const resolveLiveAccountAllowlists = async () => {
3580
- const liveCfg = core.config.current();
3581
- const liveAccountAllowlists = resolveMatrixAccountAllowlistConfig({
3582
- cfg: liveCfg,
3583
- accountId
3584
- });
3585
- return {
3586
- liveCfg,
3587
- liveDmAllowFrom: await resolveCachedLiveAllowlist({
3588
- cfg: liveCfg,
3589
- entries: liveAccountAllowlists.dmAllowFrom,
3590
- startupResolvedEntries: allowFromResolvedEntries,
3591
- cache: liveDmAllowlistCache,
3592
- updateCache: (next) => {
3593
- liveDmAllowlistCache = next;
3594
- }
3595
- }),
3596
- liveGroupAllowFrom: await resolveCachedLiveAllowlist({
3597
- cfg: liveCfg,
3598
- entries: liveAccountAllowlists.groupAllowFrom,
3599
- failClosedOnUnresolved: true,
3600
- startupResolvedEntries: groupAllowFromResolvedEntries,
3601
- cache: liveGroupAllowlistCache,
3602
- updateCache: (next) => {
3603
- liveGroupAllowlistCache = next;
3604
- }
3605
- })
3606
- };
3607
- };
3608
- const readStoreAllowFrom = async () => {
3609
- const now = Date.now();
3610
- if (cachedStoreAllowFrom && isFutureDateTimestampMs(cachedStoreAllowFrom.expiresAtMs, { nowMs: now })) return cachedStoreAllowFrom.value;
3611
- cachedStoreAllowFrom = null;
3612
- const value = await core.channel.pairing.readAllowFromStore({
3613
- channel: "matrix",
3614
- env: process.env,
3615
- accountId
3616
- }).catch(() => []);
3617
- const expiresAtMs = resolveExpiresAtMsFromDurationMs(ALLOW_FROM_STORE_CACHE_TTL_MS, { nowMs: now });
3618
- cachedStoreAllowFrom = expiresAtMs === void 0 ? null : {
3619
- value,
3620
- expiresAtMs
3621
- };
3622
- return value;
3623
- };
3624
- const shouldSendPairingReply = (senderId, created) => {
3625
- const now = Date.now();
3626
- if (created) {
3627
- pairingReplySentAtMsBySender.set(senderId, now);
3628
- return true;
3629
- }
3630
- const lastSentAtMs = pairingReplySentAtMsBySender.get(senderId);
3631
- if (typeof lastSentAtMs === "number" && now - lastSentAtMs < PAIRING_REPLY_COOLDOWN_MS) return false;
3632
- pairingReplySentAtMsBySender.set(senderId, now);
3633
- if (pairingReplySentAtMsBySender.size > MAX_TRACKED_PAIRING_REPLY_SENDERS) {
3634
- const oldestSender = pairingReplySentAtMsBySender.keys().next().value;
3635
- if (typeof oldestSender === "string") pairingReplySentAtMsBySender.delete(oldestSender);
3636
- }
3637
- return true;
3638
- };
3639
- return {
3640
- resolveLiveAccountAllowlists,
3641
- readStoreAllowFrom,
3642
- shouldSendPairingReply
3643
- };
3644
- }
3645
- //#endregion
3646
- //#region extensions/matrix/src/matrix/monitor/handler.ts
3647
- function createMatrixRoomMessageHandler(params) {
3648
- const { client, core, cfg, accountId, runtime, logger, logVerboseMessage, allowFromResolvedEntries = [], groupAllowFromResolvedEntries = [], configuredBotUserIds = /* @__PURE__ */ new Set(), groupPolicy, replyToMode, dmSessionScope, streaming, previewToolProgressEnabled, blockStreamingEnabled, textLimit, historyLimit, startupMs, startupGraceMs, dropPreStartupMessages, inboundDeduper, directTracker, getRoomInfo, getMemberDisplayName, resolveLiveUserAllowlist = resolveMatrixMonitorLiveUserAllowlist, resolveStorePath: resolveStorePathImpl = resolveStorePath, createChannelInboundEnvelopeBuilder: createChannelInboundEnvelopeBuilderImpl = createChannelInboundEnvelopeBuilder, finalizeInboundContext, resolveHumanDelayConfig: resolveHumanDelayConfigImpl = resolveHumanDelayConfig } = params;
3649
- const handlerConfig = {
3650
- ...params,
3651
- allowFromResolvedEntries,
3652
- groupAllowFromResolvedEntries,
3653
- configuredBotUserIds,
3654
- resolveLiveUserAllowlist,
3655
- resolveStorePath: resolveStorePathImpl,
3656
- createChannelInboundEnvelopeBuilder: createChannelInboundEnvelopeBuilderImpl,
3657
- resolveHumanDelayConfig: resolveHumanDelayConfigImpl
3658
- };
3659
- const contextVisibilityMode = resolveChannelContextVisibilityMode({
3660
- cfg,
3661
- channel: "matrix",
3662
- accountId
3663
- });
3664
- const handlerState = createMatrixHandlerState({
3665
- core,
3666
- accountId,
3667
- runtime,
3668
- allowFromResolvedEntries,
3669
- groupAllowFromResolvedEntries,
3670
- resolveLiveUserAllowlist
3671
- });
3672
- const resolveThreadContext = createMatrixThreadContextResolver({
3673
- client,
3674
- getMemberDisplayName,
3675
- logVerboseMessage
3676
- });
3677
- const resolveReplyContext = createMatrixReplyContextResolver({
3678
- client,
3679
- getMemberDisplayName,
3680
- logVerboseMessage
3681
- });
3682
- const roomHistoryTracker = createRoomHistoryTracker();
3683
- const roomIngressQueue = new KeyedAsyncQueue();
3684
- const sharedDmContextNoticeRooms = /* @__PURE__ */ new Set();
3685
- const runRoomIngress = async (roomId, task) => {
3686
- return await roomIngressQueue.enqueue(roomId, task);
3687
- };
3688
- return async (roomId, event) => {
3689
- const eventId = typeof event.event_id === "string" ? event.event_id.trim() : "";
3690
- let inboundReplayClaim;
3691
- let draftControllerRef;
3692
- try {
3693
- const eventType = event.type;
3694
- if (eventType === EventType.RoomMessageEncrypted) return;
3695
- const isPollEvent = isPollEventType(eventType);
3696
- const isReactionEvent = eventType === EventType.Reaction;
3697
- const locationContent = event.content;
3698
- const isLocationEvent = eventType === EventType.Location || eventType === EventType.RoomMessage && locationContent.msgtype === EventType.Location;
3699
- if (eventType !== EventType.RoomMessage && !isPollEvent && !isLocationEvent && !isReactionEvent) return;
3700
- logVerboseMessage(`matrix: inbound event room=${roomId} type=${eventType} id=${event.event_id ?? "unknown"}`);
3701
- if (event.unsigned?.redacted_because) return;
3702
- const senderId = event.sender;
3703
- if (!senderId) return;
3704
- const eventTs = event.origin_server_ts;
3705
- const eventAge = event.unsigned?.age;
3706
- const commitInboundEventIfClaimed = async () => {
3707
- if (!inboundReplayClaim) return;
3708
- await inboundReplayClaim.commit();
3709
- inboundReplayClaim = void 0;
3710
- };
3711
- const readIngressPrefix = () => readMatrixIngressPrefix({
3712
- client,
3713
- senderId,
3714
- dropPreStartupMessages,
3715
- eventTs: eventTs ?? void 0,
3716
- eventAge: eventAge ?? void 0,
3717
- startupMs,
3718
- startupGraceMs,
3719
- event,
3720
- eventType,
3721
- eventId,
3722
- inboundDeduper,
3723
- roomId,
3724
- logVerboseMessage,
3725
- directTracker,
3726
- claimInboundReplay: (handle) => {
3727
- inboundReplayClaim = handle;
3728
- }
3729
- });
3730
- const continueIngress = async (paramsLocal) => {
3731
- const access = await resolveMatrixIngressAccess({
3732
- handler: handlerConfig,
3733
- params: paramsLocal,
3734
- roomId,
3735
- event,
3736
- eventTs: eventTs ?? void 0,
3737
- senderId,
3738
- isReactionEvent,
3739
- readStoreAllowFrom: handlerState.readStoreAllowFrom,
3740
- shouldSendPairingReply: handlerState.shouldSendPairingReply,
3741
- resolveLiveAccountAllowlists: handlerState.resolveLiveAccountAllowlists,
3742
- roomHistoryTracker,
3743
- commitInboundEventIfClaimed
3744
- });
3745
- if (!access) return;
3746
- return await resolveMatrixIngressContent({
3747
- handler: handlerConfig,
3748
- params: paramsLocal,
3749
- access,
3750
- roomId,
3751
- event,
3752
- eventType,
3753
- isPollEvent,
3754
- eventTs: eventTs ?? void 0,
3755
- senderId,
3756
- roomHistoryTracker,
3757
- commitInboundEventIfClaimed
3758
- });
3759
- };
3760
- const ingressResult = historyLimit > 0 ? await runRoomIngress(roomId, async () => {
3761
- const prefix = await readIngressPrefix();
3762
- if (!prefix) return;
3763
- if (prefix.isDirectMessage) return { deferredPrefix: prefix };
3764
- const result = await continueIngress({
3765
- ...prefix,
3766
- audioPreflightMode: shouldDeferMatrixAudioPreflightForRoomIngress({
3767
- content: prefix.content,
3768
- cfg
3769
- }) ? "defer" : "run"
3770
- });
3771
- return result && "deferredPrefix" in result ? { deferredPrefix: result.deferredPrefix } : { ingressResult: result };
3772
- }) : void 0;
3773
- const resolvedIngressResult = historyLimit > 0 ? ingressResult?.deferredPrefix ? await continueIngress(ingressResult.deferredPrefix) : ingressResult?.ingressResult : await (async () => {
3774
- const prefix = await readIngressPrefix();
3775
- if (!prefix) return;
3776
- return await continueIngress(prefix);
3777
- })();
3778
- if (!resolvedIngressResult) return;
3779
- if ("deferredPrefix" in resolvedIngressResult) return;
3780
- const { route: _route, hasExplicitSessionBinding, roomConfig, isDirectMessage, isRoom, shouldRequireMention, wasMentioned, effectiveWasMentioned, shouldBypassMention, canDetectMention, commandAuthorized, inboundHistory, senderName, bodyText, commandBodyText, media, preflightAudioTranscript, locationPayload, messageId, triggerSnapshot, threadRootId, thread, botLoopProtection, effectiveGroupAllowFrom, effectiveRoomUsers } = resolvedIngressResult;
3781
- const inboundContext = await resolveMatrixInboundContext({
3782
- client,
3783
- core,
3784
- cfg,
3785
- accountId,
3786
- runtime,
3787
- logVerboseMessage,
3788
- roomId,
3789
- event,
3790
- eventTs: eventTs ?? void 0,
3791
- route: _route,
3792
- isDirectMessage,
3793
- isRoom,
3794
- effectiveRoomUsers,
3795
- groupPolicy,
3796
- effectiveGroupAllowFrom,
3797
- contextVisibilityMode,
3798
- resolveThreadContext,
3799
- resolveReplyContext,
3800
- threadRootId,
3801
- thread,
3802
- getRoomInfo,
3803
- senderId,
3804
- senderName,
3805
- bodyText,
3806
- commandBodyText,
3807
- roomConfig,
3808
- messageId,
3809
- inboundHistory,
3810
- wasMentioned,
3811
- effectiveWasMentioned,
3812
- shouldBypassMention,
3813
- canDetectMention,
3814
- shouldRequireMention,
3815
- commandAuthorized,
3816
- locationPayload,
3817
- media,
3818
- preflightAudioTranscript,
3819
- historyLimit,
3820
- hasExplicitSessionBinding,
3821
- dmSessionScope,
3822
- sharedDmContextNoticeRooms,
3823
- resolveStorePath: resolveStorePathImpl,
3824
- createChannelInboundEnvelopeBuilder: createChannelInboundEnvelopeBuilderImpl,
3825
- finalizeInboundContext
3826
- });
3827
- if (!inboundContext) return;
3828
- const { replyToEventId, threadTarget, storePath, ctxPayload, replyTarget, sharedDmContextNotice } = inboundContext;
3829
- const tableMode = core.channel.text.resolveMarkdownTableMode({
3830
- cfg,
3831
- channel: "matrix",
3832
- accountId: _route.accountId
3833
- });
3834
- const mediaLocalRoots = getAgentScopedMediaLocalRoots(cfg, _route.agentId);
3835
- const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
3836
- cfg,
3837
- agentId: _route.agentId,
3838
- channel: "matrix",
3839
- accountId: _route.accountId
3840
- });
3841
- const typingCallbacks = createTypingCallbacks({
3842
- start: async () => {
3843
- const { sendTypingMatrix } = await loadMatrixSendModule();
3844
- await sendTypingMatrix(roomId, true, void 0, client);
3845
- },
3846
- stop: async () => {
3847
- const { sendTypingMatrix } = await loadMatrixSendModule();
3848
- await sendTypingMatrix(roomId, false, void 0, client);
3849
- },
3850
- onStartError: (err) => {
3851
- logTypingFailure({
3852
- log: logVerboseMessage,
3853
- channel: "matrix",
3854
- action: "start",
3855
- target: roomId,
3856
- error: err
3857
- });
3858
- },
3859
- onStopError: (err) => {
3860
- logTypingFailure({
3861
- log: logVerboseMessage,
3862
- channel: "matrix",
3863
- action: "stop",
3864
- target: roomId,
3865
- error: err
3866
- });
3867
- }
3868
- });
3869
- const draftController = await createMatrixDraftController({
3870
- streaming,
3871
- previewToolProgressEnabled,
3872
- replyToMode,
3873
- messageId,
3874
- threadTarget,
3875
- accountConfig: params.accountConfig,
3876
- cfg,
3877
- accountId: _route.accountId,
3878
- roomId,
3879
- client,
3880
- logVerboseMessage
3881
- });
3882
- const { draftStream } = draftController;
3883
- draftControllerRef = draftController;
3884
- const replyDispatcher = createMatrixReplyDispatcher({
3885
- cfg,
3886
- prefixOptions,
3887
- humanDelay: resolveHumanDelayConfigImpl(cfg, _route.agentId),
3888
- typingCallbacks,
3889
- streaming,
3890
- draftStream,
3891
- draftController,
3892
- client,
3893
- roomId,
3894
- runtime,
3895
- textLimit,
3896
- replyToMode,
3897
- threadTarget,
3898
- replyToEventId: replyToEventId ?? void 0,
3899
- accountId: _route.accountId,
3900
- mediaLocalRoots,
3901
- tableMode,
3902
- logVerboseMessage
3903
- });
3904
- const { deliverReply, onReplyError, turnDispatcherOptions } = replyDispatcher;
3905
- const pinnedMainDmOwner = isDirectMessage ? await (async () => {
3906
- const { liveCfg, liveDmAllowFrom } = await handlerState.resolveLiveAccountAllowlists();
3907
- return resolvePinnedMainDmOwnerFromAllowlist({
3908
- dmScope: liveCfg.session?.dmScope,
3909
- allowFrom: liveDmAllowFrom,
3910
- normalizeEntry: normalizeMatrixUserId
3911
- });
3912
- })() : null;
3913
- const inboundLastRouteSessionKey = resolveInboundLastRouteSessionKey({
3914
- route: _route,
3915
- sessionKey: _route.sessionKey
3916
- });
3917
- const turnResult = await core.channel.inbound.run({
3918
- channel: "matrix",
3919
- accountId: _route.accountId,
3920
- raw: event,
3921
- adapter: {
3922
- ingest: () => ({
3923
- id: messageId,
3924
- rawText: bodyText,
3925
- textForAgent: ctxPayload.BodyForAgent,
3926
- textForCommands: ctxPayload.CommandBody,
3927
- raw: event
3928
- }),
3929
- resolveTurn: () => ({
3930
- cfg,
3931
- channel: "matrix",
3932
- accountId: _route.accountId,
3933
- route: {
3934
- agentId: _route.agentId,
3935
- sessionKey: _route.sessionKey
3936
- },
3937
- ctxPayload,
3938
- botLoopProtection,
3939
- record: {
3940
- updateLastRoute: isDirectMessage ? {
3941
- sessionKey: inboundLastRouteSessionKey,
3942
- channel: "matrix",
3943
- to: `room:${roomId}`,
3944
- accountId: _route.accountId,
3945
- mainDmOwnerPin: inboundLastRouteSessionKey === _route.mainSessionKey && pinnedMainDmOwner ? {
3946
- ownerRecipient: pinnedMainDmOwner,
3947
- senderRecipient: normalizeMatrixUserId(senderId),
3948
- onSkip: ({ ownerRecipient, senderRecipient }) => {
3949
- logVerboseMessage(`matrix: skip main-session last route for ${senderRecipient} (pinned owner ${ownerRecipient})`);
3950
- }
3951
- } : void 0
3952
- } : void 0,
3953
- onRecordError: (err) => {
3954
- logger.warn("failed updating session meta", {
3955
- error: String(err),
3956
- storePath,
3957
- sessionKey: ctxPayload.SessionKey ?? _route.sessionKey
3958
- });
3959
- }
3960
- },
3961
- afterRecord: async () => {
3962
- if (sharedDmContextNotice && markTrackedRoomIfFirst(sharedDmContextNoticeRooms, roomId)) try {
3963
- await client.sendMessage(roomId, {
3964
- msgtype: "m.notice",
3965
- body: sharedDmContextNotice
3966
- });
3967
- } catch (err) {
3968
- logVerboseMessage(`matrix: failed sending shared DM session notice room=${roomId}: ${String(err)}`);
3969
- }
3970
- },
3971
- delivery: {
3972
- deliver: deliverReply,
3973
- onError: (err, info) => onReplyError(err, info)
3974
- },
3975
- dispatcherOptions: {
3976
- ...turnDispatcherOptions,
3977
- onSettled: () => draftController.progressDraftGate.cancel()
3978
- },
3979
- replyOptions: {
3980
- skillFilter: roomConfig?.skills,
3981
- disableBlockStreaming: !blockStreamingEnabled,
3982
- onPartialReply: draftStream ? (payload) => draftController.onPartialReply(payload.text ?? "") : void 0,
3983
- onBlockReplyQueued: draftStream ? (payload, context) => {
3984
- if (payload.isCompactionNotice === true) return;
3985
- draftController.queueDraftBlockBoundary(payload, context);
3986
- } : void 0,
3987
- onAssistantMessageStart: draftStream ? () => {
3988
- draftController.resetDraftBlockOffsets();
3989
- draftController.resetPreviewToolProgress();
3990
- } : void 0,
3991
- onQueuedFollowupAdmitted: draftStream ? draftController.resetDraftDeliveryState : void 0,
3992
- ...draftController.buildPreviewToolProgressReplyOptions(),
3993
- onModelSelected
3994
- }
3995
- })
3996
- }
3997
- });
3998
- if (!turnResult.dispatched) {
3999
- if (turnResult.admission.kind === "drop" && turnResult.admission.reason === "bot-loop-protection") await commitInboundEventIfClaimed();
4000
- return;
4001
- }
4002
- const { dispatchResult } = turnResult;
4003
- const { queuedFinal, counts } = dispatchResult;
4004
- if (replyDispatcher.finalReplyDeliveryFailed()) {
4005
- logVerboseMessage(`matrix: final reply delivery failed room=${roomId} id=${messageId}; keeping replay committed`);
4006
- await commitInboundEventIfClaimed();
4007
- return;
4008
- }
4009
- if (!queuedFinal && replyDispatcher.nonFinalReplyDeliveryFailed()) {
4010
- logVerboseMessage(`matrix: non-final reply delivery failed room=${roomId} id=${messageId}; keeping replay committed`);
4011
- await commitInboundEventIfClaimed();
4012
- return;
4013
- }
4014
- if (isRoom && triggerSnapshot) roomHistoryTracker.consumeHistory(_route.agentId, roomId, triggerSnapshot, messageId, threadRootId ? thread.threadId : void 0);
4015
- if (!hasFinalInboundReplyDispatch({
4016
- queuedFinal,
4017
- counts
4018
- })) {
4019
- await commitInboundEventIfClaimed();
4020
- return;
4021
- }
4022
- const finalCount = counts.final;
4023
- logVerboseMessage(`matrix: delivered ${finalCount} reply${finalCount === 1 ? "" : "ies"} to ${replyTarget}`);
4024
- await commitInboundEventIfClaimed();
4025
- } catch (err) {
4026
- runtime.error?.(`matrix handler failed: ${String(err)}`);
4027
- } finally {
4028
- const draftStream = draftControllerRef?.draftStream;
4029
- if (draftStream) {
4030
- const draftEventId = await draftStream.stop().catch(() => void 0);
4031
- if (draftEventId && draftControllerRef?.isDraftConsumed() !== true) await redactMatrixDraftEvent(client, roomId, draftEventId);
4032
- }
4033
- inboundReplayClaim?.release();
4034
- }
4035
- };
4036
- }
4037
- //#endregion
4038
- //#region extensions/matrix/src/matrix/monitor/recent-invite.ts
4039
- function shouldPromoteRecentInviteRoom(params) {
4040
- if (!params.roomInfo.nameResolved || !params.roomInfo.aliasesResolved) return false;
4041
- const roomAliases = [params.roomInfo.canonicalAlias ?? "", ...params.roomInfo.altAliases].filter(Boolean);
4042
- if ((params.roomInfo.name?.trim() ?? "") || roomAliases.length > 0) return false;
4043
- return resolveMatrixRoomConfig({
4044
- rooms: params.rooms,
4045
- roomId: params.roomId,
4046
- aliases: roomAliases
4047
- }).matchSource === void 0;
4048
- }
4049
- //#endregion
4050
- //#region extensions/matrix/src/matrix/monitor/startup.ts
4051
- const loadMatrixStartupMaintenanceDeps = createLazyRuntimeModule(() => Promise.all([
4052
- import("./setup-core-a542Ernq.js").then((n) => n.c),
4053
- import("./device-health-B4-YXtJR.js").then((n) => n.t),
4054
- import("./setup-core-a542Ernq.js").then((n) => n.o),
4055
- import("./startup-verification-wm3_i88s.js")
4056
- ]).then(([configUpdateModule, deviceHealthModule, profileModule, startupVerificationModule]) => ({
4057
- updateMatrixAccountConfig: configUpdateModule.updateMatrixAccountConfig,
4058
- summarizeMatrixDeviceHealth: deviceHealthModule.summarizeMatrixDeviceHealth,
4059
- syncMatrixOwnProfile: profileModule.syncMatrixOwnProfile,
4060
- ensureMatrixStartupVerification: startupVerificationModule.ensureMatrixStartupVerification
4061
- })));
4062
- async function runMatrixStartupMaintenance(params, deps) {
4063
- const runtimeDeps = deps ?? await loadMatrixStartupMaintenanceDeps();
4064
- throwIfMatrixStartupAborted(params.abortSignal);
4065
- try {
4066
- const profileSync = await runtimeDeps.syncMatrixOwnProfile({
4067
- client: params.client,
4068
- userId: params.auth.userId,
4069
- displayName: params.accountConfig.name,
4070
- avatarUrl: params.accountConfig.avatarUrl,
4071
- loadAvatarFromUrl: async (url, maxBytes) => await params.loadWebMedia(url, maxBytes)
4072
- });
4073
- throwIfMatrixStartupAborted(params.abortSignal);
4074
- if (profileSync.displayNameUpdated) params.logger.info(`matrix: profile display name updated for ${params.auth.userId}`);
4075
- if (profileSync.avatarUpdated) params.logger.info(`matrix: profile avatar updated for ${params.auth.userId}`);
4076
- if (profileSync.convertedAvatarFromHttp && profileSync.resolvedAvatarUrl && params.accountConfig.avatarUrl !== profileSync.resolvedAvatarUrl) {
4077
- const latestCfg = params.getRuntimeConfig();
4078
- const updatedCfg = runtimeDeps.updateMatrixAccountConfig(latestCfg, params.accountId, { avatarUrl: profileSync.resolvedAvatarUrl });
4079
- await params.replaceConfigFile(updatedCfg);
4080
- throwIfMatrixStartupAborted(params.abortSignal);
4081
- params.logVerboseMessage(`matrix: persisted converted avatar URL for account ${params.accountId} (${profileSync.resolvedAvatarUrl})`);
4082
- }
4083
- } catch (err) {
4084
- if (isMatrixStartupAbortError(err)) throw err;
4085
- params.logger.warn("matrix: failed to sync profile from config", { error: String(err) });
4086
- }
4087
- if (!(params.auth.encryption && params.client.crypto)) return;
4088
- try {
4089
- throwIfMatrixStartupAborted(params.abortSignal);
4090
- const deviceHealth = runtimeDeps.summarizeMatrixDeviceHealth(await params.client.listOwnDevices());
4091
- if (deviceHealth.staleOpenClawDevices.length > 0) params.logger.warn(`matrix: stale OpenClaw devices detected for ${params.auth.userId}: ${deviceHealth.staleOpenClawDevices.map((device) => device.deviceId).join(", ")}. Run 'openclaw matrix devices prune-stale --account ${params.effectiveAccountId}' to keep encrypted-room trust healthy.`);
4092
- } catch (err) {
4093
- if (isMatrixStartupAbortError(err)) throw err;
4094
- params.logger.debug?.("Failed to inspect matrix device hygiene (non-fatal)", { error: String(err) });
4095
- }
4096
- try {
4097
- throwIfMatrixStartupAborted(params.abortSignal);
4098
- const startupVerification = await runtimeDeps.ensureMatrixStartupVerification({
4099
- client: params.client,
4100
- auth: params.auth,
4101
- accountConfig: params.accountConfig,
4102
- env: params.env
4103
- });
4104
- throwIfMatrixStartupAborted(params.abortSignal);
4105
- if (startupVerification.kind === "verified") params.logger.info("matrix: device is verified by its owner and ready for encrypted rooms");
4106
- else if (startupVerification.kind === "disabled" || startupVerification.kind === "cooldown" || startupVerification.kind === "pending" || startupVerification.kind === "request-failed") {
4107
- params.logger.info("matrix: device not verified — run 'openclaw matrix verify device <key>' to enable E2EE");
4108
- if (startupVerification.kind === "pending") params.logger.info("matrix: startup verification request is already pending; finish it in another Matrix client");
4109
- else if (startupVerification.kind === "cooldown") params.logVerboseMessage(`matrix: skipped startup verification request due to cooldown (retryAfterMs=${startupVerification.retryAfterMs ?? 0})`);
4110
- else if (startupVerification.kind === "request-failed") params.logger.debug?.("Matrix startup verification request failed (non-fatal)", { error: startupVerification.error ?? "unknown" });
4111
- } else if (startupVerification.kind === "requested") params.logger.info("matrix: device not verified — requested verification in another Matrix client");
4112
- } catch (err) {
4113
- if (isMatrixStartupAbortError(err)) throw err;
4114
- params.logger.debug?.("Failed to resolve matrix verification status (non-fatal)", { error: String(err) });
4115
- }
4116
- }
4117
- //#endregion
4118
- //#region extensions/matrix/src/matrix/monitor/status.ts
4119
- function cloneLastDisconnect(value) {
4120
- if (!value || typeof value === "string") return value ?? null;
4121
- return { ...value };
4122
- }
4123
- function formatSyncError(error) {
4124
- if (!error) return null;
4125
- if (error instanceof Error) return error.message || error.name || "unknown";
4126
- return formatMatrixErrorMessage(error);
4127
- }
4128
- function createMatrixMonitorStatusController(params) {
4129
- const status = {
4130
- accountId: params.accountId,
4131
- ...params.baseUrl ? { baseUrl: params.baseUrl } : {},
4132
- connected: false,
4133
- lastConnectedAt: null,
4134
- lastDisconnect: null,
4135
- lastError: null,
4136
- healthState: "starting"
4137
- };
4138
- const emit = () => {
4139
- params.statusSink?.({
4140
- ...status,
4141
- lastDisconnect: cloneLastDisconnect(status.lastDisconnect)
4142
- });
4143
- };
4144
- const noteConnected = (at = Date.now(), options) => {
4145
- if (status.connected === true) status.lastEventAt = at;
4146
- else Object.assign(status, createConnectedChannelStatusPatch(at));
4147
- if (options?.transportActivity) Object.assign(status, createTransportActivityStatusPatch(at));
4148
- status.lastError = null;
4149
- status.lastDisconnect = null;
4150
- status.healthState = "healthy";
4151
- emit();
4152
- };
4153
- const noteDisconnected = (paramsLocal) => {
4154
- const at = paramsLocal.at ?? Date.now();
4155
- const error = formatSyncError(paramsLocal.error);
4156
- status.connected = false;
4157
- status.lastEventAt = at;
4158
- status.lastDisconnect = {
4159
- at,
4160
- ...error ? { error } : {}
4161
- };
4162
- status.lastError = error;
4163
- status.healthState = paramsLocal.state.toLowerCase();
4164
- emit();
4165
- };
4166
- emit();
4167
- return {
4168
- noteSyncState(state, error, at = Date.now()) {
4169
- if (isMatrixReadySyncState(state)) {
4170
- noteConnected(at, { transportActivity: state === "SYNCING" });
4171
- return;
4172
- }
4173
- if (isMatrixDisconnectedSyncState(state)) {
4174
- noteDisconnected({
4175
- state,
4176
- at,
4177
- error
4178
- });
4179
- return;
4180
- }
4181
- status.lastEventAt = at;
4182
- status.healthState = state.toLowerCase();
4183
- emit();
4184
- },
4185
- noteUnexpectedError(error, at = Date.now()) {
4186
- noteDisconnected({
4187
- state: "ERROR",
4188
- at,
4189
- error
4190
- });
4191
- },
4192
- markStopped(at = Date.now()) {
4193
- status.connected = false;
4194
- status.lastEventAt = at;
4195
- if (status.healthState !== "error") status.healthState = "stopped";
4196
- emit();
4197
- }
4198
- };
4199
- }
4200
- //#endregion
4201
- //#region extensions/matrix/src/matrix/monitor/sync-lifecycle.ts
4202
- function formatSyncLifecycleError(state, error) {
4203
- if (error instanceof Error) return error;
4204
- const message = typeof error === "string" && error.trim() ? error.trim() : void 0;
4205
- if (state === "STOPPED") return new Error(message ?? "Matrix sync stopped unexpectedly");
4206
- if (state === "ERROR") return new Error(message ?? "Matrix sync entered ERROR unexpectedly");
4207
- return new Error(message ?? `Matrix sync entered ${state} unexpectedly`);
4208
- }
4209
- function createMatrixMonitorSyncLifecycle(params) {
4210
- let fatalError = null;
4211
- let resolveFatalWait = null;
4212
- let rejectFatalWait = null;
4213
- const settleFatal = (error) => {
4214
- if (fatalError) return;
4215
- fatalError = error;
4216
- rejectFatalWait?.(error);
4217
- resolveFatalWait = null;
4218
- rejectFatalWait = null;
4219
- };
4220
- const onSyncState = (state, _prevState, error) => {
4221
- if (isMatrixTerminalSyncState(state) && !params.isStopping?.()) {
4222
- const fatalErrorLocal = formatSyncLifecycleError(state, error);
4223
- params.statusController.noteUnexpectedError(fatalErrorLocal);
4224
- settleFatal(fatalErrorLocal);
4225
- return;
4226
- }
4227
- if (fatalError) return;
4228
- if (params.isStopping?.() && !isMatrixTerminalSyncState(state)) return;
4229
- params.statusController.noteSyncState(state, error);
4230
- };
4231
- const onUnexpectedError = (error) => {
4232
- if (params.isStopping?.()) return;
4233
- params.statusController.noteUnexpectedError(error);
4234
- settleFatal(error);
4235
- };
4236
- params.client.on("sync.state", onSyncState);
4237
- params.client.on("sync.unexpected_error", onUnexpectedError);
4238
- return {
4239
- async waitForFatalStop() {
4240
- if (fatalError) throw fatalError;
4241
- if (resolveFatalWait || rejectFatalWait) throw new Error("Matrix fatal-stop wait already in progress");
4242
- await new Promise((resolve, reject) => {
4243
- resolveFatalWait = resolve;
4244
- rejectFatalWait = (error) => reject(error);
4245
- });
4246
- },
4247
- dispose() {
4248
- resolveFatalWait?.();
4249
- resolveFatalWait = null;
4250
- rejectFatalWait = null;
4251
- params.client.off("sync.state", onSyncState);
4252
- params.client.off("sync.unexpected_error", onUnexpectedError);
4253
- }
4254
- };
4255
- }
4256
- //#endregion
4257
- //#region extensions/matrix/src/matrix/monitor/task-runner.ts
4258
- function createMatrixMonitorTaskRunner(params) {
4259
- const inFlight = /* @__PURE__ */ new Set();
4260
- const runDetachedTask = (label, task) => {
4261
- const trackedTask = Promise.resolve().then(task).catch((error) => {
4262
- const message = String(error);
4263
- params.logVerboseMessage(`matrix: ${label} failed (${message})`);
4264
- params.logger.warn("matrix background task failed", {
4265
- task: label,
4266
- error: message
4267
- });
4268
- }).finally(() => {
4269
- inFlight.delete(trackedTask);
4270
- });
4271
- inFlight.add(trackedTask);
4272
- return trackedTask;
4273
- };
4274
- const waitForIdle = async () => {
4275
- while (inFlight.size > 0) await Promise.allSettled(Array.from(inFlight));
4276
- };
4277
- return {
4278
- runDetachedTask,
4279
- waitForIdle
4280
- };
4281
- }
4282
- //#endregion
4283
- //#region extensions/matrix/src/matrix/monitor/index.ts
4284
- function resolveMatrixStreamingMode(streaming) {
4285
- const mode = streaming?.mode;
4286
- if (mode === "partial" || mode === "quiet" || mode === "progress") return mode;
4287
- return "off";
4288
- }
4289
- function resolveMatrixPreviewToolProgress(streaming) {
4290
- if (!streaming) return true;
4291
- if (resolveMatrixStreamingMode(streaming) === "progress") return streaming.progress?.toolProgress ?? streaming.preview?.toolProgress ?? true;
4292
- return streaming.preview?.toolProgress ?? true;
4293
- }
4294
- function resolveMatrixPreviewToolProgressEnabled(streaming) {
4295
- return resolveMatrixStreamingMode(streaming) !== "off" && resolveMatrixPreviewToolProgress(streaming);
4296
- }
4297
- const DEFAULT_MEDIA_MAX_MB = 20;
4298
- async function monitorMatrixProvider(opts = {}) {
4299
- if (opts.abortSignal?.aborted) return;
4300
- if (isBunRuntime()) throw new Error("Matrix provider requires Node (bun runtime not supported)");
4301
- const core = getMatrixRuntime();
4302
- let cfg = core.config.current();
4303
- if (cfg.channels?.["matrix"]?.enabled === false) return;
4304
- const logger = core.logging.getChildLogger({ module: "matrix-auto-reply" });
4305
- const formatRuntimeMessage = (...args) => format(...args);
4306
- const runtime = opts.runtime ?? {
4307
- log: (...args) => {
4308
- logger.info(formatRuntimeMessage(...args));
4309
- },
4310
- error: (...args) => {
4311
- logger.error(formatRuntimeMessage(...args));
4312
- },
4313
- exit: (code) => {
4314
- throw new Error(`exit ${code}`);
4315
- }
4316
- };
4317
- const logVerboseMessage = (message) => {
4318
- if (!core.logging.shouldLogVerbose()) return;
4319
- logger.debug?.(message);
4320
- };
4321
- const effectiveAccountId = resolveMatrixAuthContext({
4322
- cfg,
4323
- accountId: opts.accountId
4324
- }).accountId;
4325
- const accountConfig = resolveMatrixAccountConfig({
4326
- cfg,
4327
- accountId: effectiveAccountId
4328
- });
4329
- const allowlistOnly = accountConfig.allowlistOnly === true;
4330
- const accountAllowBots = accountConfig.allowBots;
4331
- let roomsConfig = accountConfig.groups ?? accountConfig.rooms;
4332
- let needsRoomAliasesForConfig = false;
4333
- const initialAllowFrom = (accountConfig.dm?.allowFrom ?? []).map(String);
4334
- const initialGroupAllowFrom = (accountConfig.groupAllowFrom ?? []).map(String);
4335
- const configuredBotUserIds = resolveConfiguredMatrixBotUserIds({
4336
- cfg,
4337
- accountId: effectiveAccountId
4338
- });
4339
- const { allowFrom, allowFromResolvedEntries, groupAllowFrom, groupAllowFromResolvedEntries, roomsConfig: resolvedRoomsConfig } = await resolveMatrixMonitorConfig({
4340
- cfg,
4341
- accountId: effectiveAccountId,
4342
- allowFrom: initialAllowFrom,
4343
- groupAllowFrom: initialGroupAllowFrom,
4344
- roomsConfig,
4345
- runtime
4346
- });
4347
- roomsConfig = resolvedRoomsConfig;
4348
- needsRoomAliasesForConfig = Boolean(roomsConfig && Object.keys(roomsConfig).some((key) => key.trim().startsWith("#")));
4349
- cfg = {
4350
- ...cfg,
4351
- channels: {
4352
- ...cfg.channels,
4353
- matrix: {
4354
- ...cfg.channels?.["matrix"],
4355
- dm: {
4356
- ...cfg.channels?.["matrix"]?.dm,
4357
- allowFrom
4358
- },
4359
- groupAllowFrom,
4360
- ...roomsConfig ? { groups: roomsConfig } : {}
4361
- }
4362
- }
4363
- };
4364
- const auth = await resolveMatrixAuth({
4365
- cfg,
4366
- accountId: effectiveAccountId
4367
- });
4368
- const resolvedInitialSyncLimit = resolveOptionalIntegerOption(opts.initialSyncLimit, { min: 0 }) ?? auth.initialSyncLimit;
4369
- const authWithLimit = resolvedInitialSyncLimit === auth.initialSyncLimit ? auth : {
4370
- ...auth,
4371
- initialSyncLimit: resolvedInitialSyncLimit
4372
- };
4373
- const statusController = createMatrixMonitorStatusController({
4374
- accountId: auth.accountId,
4375
- baseUrl: auth.homeserver,
4376
- statusSink: opts.setStatus
4377
- });
4378
- let cleanedUp = false;
4379
- let client = null;
4380
- let threadBindingManager = null;
4381
- const monitorTaskRunner = createMatrixMonitorTaskRunner({
4382
- logger,
4383
- logVerboseMessage
4384
- });
4385
- let syncLifecycle = null;
4386
- const cleanup = async (mode = "persist") => {
4387
- if (cleanedUp) return;
4388
- cleanedUp = true;
4389
- try {
4390
- client?.stopSyncWithoutPersist();
4391
- if (client && mode === "persist") await client.drainPendingDecryptions("matrix monitor shutdown");
4392
- if (mode === "persist") await monitorTaskRunner.waitForIdle();
4393
- threadBindingManager?.stop();
4394
- if (client) await releaseSharedClientInstance(client, mode);
4395
- } finally {
4396
- client?.off("sync.state", onSyncState);
4397
- syncLifecycle?.dispose();
4398
- statusController.markStopped();
4399
- setActiveMatrixClient(null, auth.accountId);
4400
- }
4401
- };
4402
- const defaultGroupPolicy = resolveDefaultGroupPolicy(cfg);
4403
- const { groupPolicy: groupPolicyRaw, providerMissingFallbackApplied } = resolveAllowlistProviderRuntimeGroupPolicy({
4404
- providerConfigPresent: cfg.channels?.["matrix"] !== void 0,
4405
- groupPolicy: accountConfig.groupPolicy,
4406
- defaultGroupPolicy
4407
- });
4408
- warnMissingProviderGroupPolicyFallbackOnce({
4409
- providerMissingFallbackApplied,
4410
- providerKey: "matrix",
4411
- accountId: effectiveAccountId,
4412
- blockedLabel: GROUP_POLICY_BLOCKED_LABEL.room,
4413
- log: (message) => logVerboseMessage(message)
4414
- });
4415
- const groupPolicy = allowlistOnly && groupPolicyRaw === "open" ? "allowlist" : groupPolicyRaw;
4416
- const replyToMode = opts.replyToMode ?? accountConfig.replyToMode ?? "off";
4417
- const threadReplies = accountConfig.threadReplies ?? "inbound";
4418
- const dmThreadReplies = accountConfig.dm?.threadReplies;
4419
- const threadBindingIdleTimeoutMs = resolveThreadBindingIdleTimeoutMsForChannel({
4420
- cfg,
4421
- channel: "matrix",
4422
- accountId: effectiveAccountId
4423
- });
4424
- const threadBindingMaxAgeMs = resolveThreadBindingMaxAgeMsForChannel({
4425
- cfg,
4426
- channel: "matrix",
4427
- accountId: effectiveAccountId
4428
- });
4429
- const dmConfig = accountConfig.dm;
4430
- const dmEnabled = dmConfig?.enabled ?? true;
4431
- const dmPolicyRaw = dmConfig?.policy ?? "pairing";
4432
- const dmPolicy = allowlistOnly && dmPolicyRaw !== "disabled" ? "allowlist" : dmPolicyRaw;
4433
- const dmSessionScope = dmConfig?.sessionScope ?? "per-user";
4434
- const textLimit = core.channel.text.resolveTextChunkLimit(cfg, "matrix", effectiveAccountId);
4435
- const globalGroupChatHistoryLimit = cfg.messages?.groupChat?.historyLimit;
4436
- const historyLimit = Math.max(0, accountConfig.historyLimit ?? globalGroupChatHistoryLimit ?? 0);
4437
- const mediaMaxMb = opts.mediaMaxMb ?? accountConfig.mediaMaxMb ?? DEFAULT_MEDIA_MAX_MB;
4438
- const mediaMaxBytes = Math.max(1, mediaMaxMb) * 1024 * 1024;
4439
- const streaming = resolveMatrixStreamingMode(accountConfig.streaming);
4440
- const previewToolProgressEnabled = resolveMatrixPreviewToolProgressEnabled(accountConfig.streaming);
4441
- const blockStreamingEnabled = resolveChannelStreamingBlockEnabled(accountConfig) === true;
4442
- const startupMs = Date.now();
4443
- const startupGraceMs = 0;
4444
- const warnedEncryptedRooms = /* @__PURE__ */ new Set();
4445
- const warnedCryptoMissingRooms = /* @__PURE__ */ new Set();
4446
- let healthySyncSinceMs;
4447
- const noteSyncHealthState = (state, at = Date.now()) => {
4448
- if (isMatrixReadySyncState(state)) {
4449
- healthySyncSinceMs ??= at;
4450
- return;
4451
- }
4452
- if (isMatrixDisconnectedSyncState(state)) healthySyncSinceMs = void 0;
4453
- };
4454
- const onSyncState = (state) => {
4455
- noteSyncHealthState(state);
4456
- };
4457
- try {
4458
- client = await resolveSharedMatrixClient({
4459
- cfg,
4460
- auth: authWithLimit,
4461
- startClient: false,
4462
- accountId: auth.accountId
4463
- });
4464
- setActiveMatrixClient(client, auth.accountId);
4465
- const inboundDeduper = createMatrixInboundEventDeduper({
4466
- auth,
4467
- env: process.env
4468
- });
4469
- syncLifecycle = createMatrixMonitorSyncLifecycle({
4470
- client,
4471
- statusController,
4472
- isStopping: () => cleanedUp || opts.abortSignal?.aborted === true
4473
- });
4474
- client.on("sync.state", onSyncState);
4475
- const dropPreStartupMessages = !client.hasPersistedSyncState();
4476
- const { getRoomInfo, getMemberDisplayName } = createMatrixRoomInfoResolver(client);
4477
- const isExplicitlyConfiguredRoom = async (roomId) => {
4478
- const roomInfoForConfig = needsRoomAliasesForConfig ? await getRoomInfo(roomId, { includeAliases: true }) : void 0;
4479
- const aliases = roomInfoForConfig ? [roomInfoForConfig.canonicalAlias ?? "", ...roomInfoForConfig.altAliases].filter(Boolean) : [];
4480
- return resolveMatrixRoomConfig({
4481
- rooms: roomsConfig,
4482
- roomId,
4483
- aliases
4484
- }).matchSource === "direct";
4485
- };
4486
- const directTracker = createDirectRoomTracker(client, {
4487
- log: logVerboseMessage,
4488
- isExplicitlyConfiguredRoom,
4489
- canPromoteRecentInvite: async (roomId) => shouldPromoteRecentInviteRoom({
4490
- roomId,
4491
- roomInfo: await getRoomInfo(roomId, { includeAliases: true }),
4492
- rooms: roomsConfig
4493
- }),
4494
- ...dmSessionScope === "per-room" ? { canPromoteUnmappedStrictRoom: async (roomId) => shouldPromoteRecentInviteRoom({
4495
- roomId,
4496
- roomInfo: await getRoomInfo(roomId, { includeAliases: true }),
4497
- rooms: roomsConfig
4498
- }) } : {},
4499
- shouldKeepLocallyPromotedDirectRoom: async (roomId) => {
4500
- try {
4501
- const roomInfo = await getRoomInfo(roomId, { includeAliases: true });
4502
- if (!roomInfo.nameResolved || !roomInfo.aliasesResolved) return;
4503
- return shouldPromoteRecentInviteRoom({
4504
- roomId,
4505
- roomInfo,
4506
- rooms: roomsConfig
4507
- });
4508
- } catch (err) {
4509
- logVerboseMessage(`matrix: local promotion revalidation failed room=${roomId} (${String(err)})`);
4510
- return;
4511
- }
4512
- }
4513
- });
4514
- registerMatrixAutoJoin({
4515
- client,
4516
- accountConfig,
4517
- runtime
4518
- });
4519
- const handleRoomMessage = createMatrixRoomMessageHandler({
4520
- client,
4521
- core,
4522
- cfg,
4523
- accountId: effectiveAccountId,
4524
- accountConfig,
4525
- runtime,
4526
- logger,
4527
- logVerboseMessage,
4528
- allowFrom,
4529
- allowFromResolvedEntries,
4530
- groupAllowFrom,
4531
- groupAllowFromResolvedEntries,
4532
- roomsConfig,
4533
- accountAllowBots,
4534
- configuredBotUserIds,
4535
- groupPolicy,
4536
- replyToMode,
4537
- threadReplies,
4538
- dmThreadReplies,
4539
- dmSessionScope,
4540
- streaming,
4541
- previewToolProgressEnabled,
4542
- blockStreamingEnabled,
4543
- dmEnabled,
4544
- dmPolicy,
4545
- textLimit,
4546
- mediaMaxBytes,
4547
- historyLimit,
4548
- startupMs,
4549
- startupGraceMs,
4550
- dropPreStartupMessages,
4551
- inboundDeduper,
4552
- directTracker,
4553
- getRoomInfo,
4554
- getMemberDisplayName,
4555
- needsRoomAliasesForConfig
4556
- });
4557
- threadBindingManager = await createMatrixThreadBindingManager({
4558
- cfg,
4559
- accountId: effectiveAccountId,
4560
- auth,
4561
- client,
4562
- env: process.env,
4563
- idleTimeoutMs: threadBindingIdleTimeoutMs,
4564
- maxAgeMs: threadBindingMaxAgeMs,
4565
- logVerboseMessage
4566
- });
4567
- logVerboseMessage(`matrix: thread bindings ready account=${threadBindingManager.accountId} idleMs=${threadBindingIdleTimeoutMs} maxAgeMs=${threadBindingMaxAgeMs}`);
4568
- registerMatrixMonitorEvents({
4569
- cfg,
4570
- client,
4571
- auth,
4572
- allowFrom,
4573
- dmEnabled,
4574
- dmPolicy,
4575
- readStoreAllowFrom: async () => await core.channel.pairing.readAllowFromStore({
4576
- channel: "matrix",
4577
- env: process.env,
4578
- accountId: effectiveAccountId
4579
- }).catch(() => []),
4580
- directTracker,
4581
- logVerboseMessage,
4582
- warnedEncryptedRooms,
4583
- warnedCryptoMissingRooms,
4584
- logger,
4585
- startupGraceMs,
4586
- getHealthySyncSinceMs: () => healthySyncSinceMs,
4587
- formatNativeDependencyHint: core.system.formatNativeDependencyHint,
4588
- onRoomMessage: handleRoomMessage,
4589
- runDetachedTask: monitorTaskRunner.runDetachedTask
4590
- });
4591
- logVerboseMessage("matrix: starting client");
4592
- await resolveSharedMatrixClient({
4593
- cfg,
4594
- auth: authWithLimit,
4595
- accountId: auth.accountId,
4596
- abortSignal: opts.abortSignal
4597
- });
4598
- logVerboseMessage("matrix: client started");
4599
- logger.info(`matrix: logged in as ${auth.userId}`);
4600
- backfillMatrixAuthDeviceIdAfterStartup({
4601
- auth,
4602
- env: process.env,
4603
- abortSignal: opts.abortSignal
4604
- }).catch((err) => {
4605
- logVerboseMessage(`matrix: failed to backfill deviceId after startup (${String(err)})`);
4606
- });
4607
- registerChannelRuntimeContext({
4608
- channelRuntime: opts.channelRuntime,
4609
- channelId: "matrix",
4610
- accountId: effectiveAccountId,
4611
- capability: CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY,
4612
- context: { client },
4613
- abortSignal: opts.abortSignal
4614
- });
4615
- await runMatrixStartupMaintenance({
4616
- client,
4617
- auth,
4618
- accountId: effectiveAccountId,
4619
- effectiveAccountId,
4620
- accountConfig,
4621
- logger,
4622
- logVerboseMessage,
4623
- getRuntimeConfig: () => core.config.current(),
4624
- replaceConfigFile: async (nextCfg) => {
4625
- await core.config.replaceConfigFile({
4626
- nextConfig: nextCfg,
4627
- afterWrite: { mode: "auto" }
4628
- });
4629
- },
4630
- loadWebMedia: async (url, maxBytes) => await core.media.loadWebMedia(url, maxBytes),
4631
- env: process.env,
4632
- abortSignal: opts.abortSignal
4633
- });
4634
- await Promise.race([waitUntilAbort(opts.abortSignal, async () => {
4635
- try {
4636
- logVerboseMessage("matrix: stopping client");
4637
- await cleanup();
4638
- } catch (err) {
4639
- logger.warn("matrix: failed during monitor shutdown cleanup", { error: String(err) });
4640
- }
4641
- }), syncLifecycle.waitForFatalStop()]);
4642
- } catch (err) {
4643
- if (opts.abortSignal?.aborted === true && isMatrixStartupAbortError(err)) {
4644
- await cleanup("stop");
4645
- return;
4646
- }
4647
- statusController.noteUnexpectedError(err);
4648
- await cleanup();
4649
- throw err;
4650
- }
4651
- }
4652
- //#endregion
4653
- export { monitorMatrixProvider };