@openclaw/matrix 2026.7.2-beta.7 → 2026.7.34

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 (368) hide show
  1. package/README.md +1 -1
  2. package/dist/{account-selection-kqquRzCf.js → .setup/account-selection-BOQeTqax.mjs} +18 -17
  3. package/dist/{approval-handler.runtime-DSeaIsGa.js → .setup/approval-handler.runtime-CEXm9_-p.mjs} +18 -28
  4. package/dist/{approval-ids-BdJGPAJT.js → .setup/approval-ids-DdFnDB3h.mjs} +1 -1
  5. package/dist/{approval-reaction-auth-BjOpELxu.js → .setup/approval-reaction-auth-CREvd7S7.mjs} +2 -2
  6. package/dist/.setup/approval-reactions-Cltyp8nL.mjs +113 -0
  7. package/dist/.setup/async-lock-BcLS4KOc.mjs +19 -0
  8. package/dist/{channel-vj788dNZ.js → .setup/channel-an4umty1.mjs} +186 -144
  9. package/dist/{channel.runtime-CLoF2S9T.js → .setup/channel.runtime-GHcIBJ7H.mjs} +51 -45
  10. package/dist/{cli-DMqfDE-q.js → .setup/cli-B3WYmv5U.mjs} +882 -901
  11. package/dist/{cli-metadata-C7D53SND.js → .setup/cli-metadata-RUKCn0wJ.mjs} +1 -1
  12. package/dist/{client-6eRENr7k.js → .setup/client-Ct0bUHCo.mjs} +5 -5
  13. package/dist/{shared-CUMWxcMz.js → .setup/client-DFBQtzCe.mjs} +422 -179
  14. package/dist/.setup/client-bootstrap-Be8jvNle.mjs +74 -0
  15. package/dist/{config-schema-Djxw3C6b.js → .setup/config-schema-D9J_vUF6.mjs} +89 -70
  16. package/dist/.setup/credentials-BhZlA0kL.mjs +56 -0
  17. package/dist/.setup/credentials-read-CRHg6XPm.mjs +114 -0
  18. package/dist/{credentials-write.runtime-Be9zNSUw.js → .setup/credentials-write.runtime-dWuLafsk.mjs} +1 -1
  19. package/dist/{crypto-runtime-D9_6J5tZ.js → .setup/crypto-runtime-D-cZa8P0.mjs} +81 -35
  20. package/dist/.setup/crypto-state-store-B43k3z3W.mjs +352 -0
  21. package/dist/{deps-CcVJfvRM.js → .setup/deps-Dy6yreL4.mjs} +92 -25
  22. package/dist/{device-health-B4-YXtJR.js → .setup/device-health-D4LBxuPq.mjs} +1 -6
  23. package/dist/{directory-live-C8dVBiCc.js → .setup/directory-live-BTEYxMwy.mjs} +10 -9
  24. package/dist/.setup/doctor-BGnvMzOR.mjs +169 -0
  25. package/dist/.setup/doctor-contract-DNJw0fdq.mjs +246 -0
  26. package/dist/{draft-stream-CtvOXq0Z.js → .setup/draft-stream-C-_OhpE8.mjs} +1 -6
  27. package/dist/{encryption-guidance-CbEFe38F.js → .setup/encryption-guidance-CpuuwmjL.mjs} +4 -3
  28. package/dist/{env-auth-CQsYbz-p.js → .setup/env-auth-CYJL1jNl.mjs} +2 -2
  29. package/dist/{env-vars-B0NxQnPk.js → .setup/env-vars-KzaYveuy.mjs} +1 -3
  30. package/dist/{exec-approval-resolver-BCgqRtZS.js → .setup/exec-approval-resolver-f9j6staN.mjs} +1 -2
  31. package/dist/{file-sync-store-DiiFsayX.js → .setup/file-sync-store-DU0cnYAz.mjs} +30 -25
  32. package/dist/{http-client-CycYxU9-.js → .setup/http-client-C954In2D.mjs} +45 -25
  33. package/dist/{idb-persistence-B6x7dMsF.js → .setup/idb-persistence-_HKTXkVC.mjs} +76 -78
  34. package/dist/{idb-persistence-lock-DAJ49nZX.js → .setup/idb-persistence-lock-B3fZXyF_.mjs} +1 -1
  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/{logger-D0GCSDQq.js → .setup/logger-DpoogOgz.mjs} +1 -1
  38. package/dist/{logging-DV-p52N0.js → .setup/logging-CgxQOJJP.mjs} +2 -9
  39. package/dist/.setup/matrix-migration.runtime-BDH5c3fN.mjs +530 -0
  40. package/dist/{media-text-BTwzADS_.js → .setup/media-text-Cib-dxkn.mjs} +1 -1
  41. package/dist/{messages-DxQJkhxs.js → .setup/messages-D4DYGHYX.mjs} +15 -67
  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/{monitor-VyWlSLwo.js → .setup/monitor-DNcW_oAN.mjs} +2525 -2361
  45. package/dist/.setup/probe.runtime-CMPh0mFk.mjs +2 -0
  46. package/dist/{profile-update-CffmyW_4.js → .setup/profile-update-DzOL3Wiw.mjs} +5 -4
  47. package/dist/{reaction-events-B00WSi98.js → .setup/reaction-events-BcvgXxHb.mjs} +14 -64
  48. package/dist/{resolve-targets-nm2L48sh.js → .setup/resolve-targets-Bq80X9Sn.mjs} +3 -3
  49. package/dist/{resolver.runtime-DS6uPaEe.js → .setup/resolver.runtime-CeBHR9-T.mjs} +1 -1
  50. package/dist/{runtime-api-D1xI_cvh.js → .setup/runtime-api-CEsWNdil.mjs} +4 -4
  51. package/dist/.setup/runtime-setter-api-DGMubGUq.mjs +3 -0
  52. package/dist/{sdk-bUytQHx7.js → .setup/sdk-He1quVAq.mjs} +592 -261
  53. package/dist/.setup/secret-contract-api-CiTJ7pd5.mjs +3 -0
  54. package/dist/{secret-contract-M3hRmGO-.js → .setup/secret-contract-phPvlNfV.mjs} +53 -28
  55. package/dist/{send-BldGYG8g.js → .setup/send-CGgl0uTn.mjs} +133 -660
  56. package/dist/{setup-bootstrap-Deleiibz.js → .setup/setup-bootstrap-DUXBC8X2.mjs} +4 -4
  57. package/dist/{setup-core-BVfBv2ai.js → .setup/setup-core-bhdcEo7v.mjs} +239 -189
  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-surface-BBq3WeqX.js → .setup/setup-surface-05_G-MnT.mjs} +149 -92
  61. package/dist/{startup-verification-wm3_i88s.js → .setup/startup-verification-BTwIGu1J.mjs} +7 -6
  62. package/dist/.setup/storage-NGZq5zet.mjs +432 -0
  63. package/dist/{storage-paths-gUmSydsW.js → .setup/storage-paths-BWo_ZEMC.mjs} +13 -2
  64. package/dist/{subagent-hooks-dkPAF6Et.js → .setup/subagent-hooks-BSWPJEmo.mjs} +2 -2
  65. package/dist/{thread-binding-api-DRbBZlhS.js → .setup/thread-binding-api-B7UaOoKv.mjs} +1 -1
  66. package/dist/{thread-bindings-DGbl3vDW.js → .setup/thread-bindings-DqmjG2on.mjs} +8 -8
  67. package/dist/{tool-actions.runtime-uu9blSqO.js → .setup/tool-actions.runtime-CXDLk2jg.mjs} +196 -332
  68. package/dist/{verification-DYMQ1QpI.js → .setup/verification-DeWOtZJr.mjs} +4 -3
  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 -44
  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/@matrix-org/matrix-sdk-crypto-wasm/package.json +1 -1
  89. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm.d.ts +2 -14
  90. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.cjs +384 -409
  91. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.js +224 -246
  92. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm +0 -0
  93. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm.d.ts +58 -59
  94. package/node_modules/markdown-it/README.md +18 -294
  95. package/node_modules/markdown-it/bin/markdown-it.mjs +2 -2
  96. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs +3013 -0
  97. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs.map +1 -0
  98. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js +14 -0
  99. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js.map +1 -0
  100. package/node_modules/markdown-it/dist/markdown-it.cjs.js +4420 -0
  101. package/node_modules/markdown-it/dist/markdown-it.cjs.js.map +1 -0
  102. package/node_modules/markdown-it/dist/markdown-it.d.cts +19 -0
  103. package/node_modules/markdown-it/dist/markdown-it.d.mts +950 -0
  104. package/node_modules/markdown-it/dist/{index.cjs.js → markdown-it.mjs} +1504 -1525
  105. package/node_modules/markdown-it/dist/markdown-it.mjs.map +1 -0
  106. package/node_modules/markdown-it/node_modules/argparse/LICENSE +1 -208
  107. package/node_modules/markdown-it/node_modules/argparse/README.md +46 -41
  108. package/node_modules/markdown-it/node_modules/argparse/lib/_colorize.js +72 -0
  109. package/node_modules/markdown-it/node_modules/argparse/lib/argparse.d.ts +292 -0
  110. package/node_modules/markdown-it/node_modules/argparse/{argparse.js → lib/argparse.js} +1142 -1029
  111. package/node_modules/markdown-it/node_modules/argparse/lib/difflib.js +190 -0
  112. package/node_modules/markdown-it/node_modules/argparse/lib/sub.js +4 -4
  113. package/node_modules/markdown-it/node_modules/argparse/lib/textwrap.js +28 -28
  114. package/node_modules/markdown-it/node_modules/argparse/package.json +18 -11
  115. package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.d.ts +8 -0
  116. package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.d.ts.map +1 -0
  117. package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.js +46 -0
  118. package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.js.map +1 -0
  119. package/node_modules/markdown-it/node_modules/entities/{lib → dist}/decode.d.ts +28 -45
  120. package/node_modules/markdown-it/node_modules/entities/dist/decode.d.ts.map +1 -0
  121. package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/decode.js +189 -141
  122. package/node_modules/markdown-it/node_modules/entities/dist/decode.js.map +1 -0
  123. package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/encode.d.ts +4 -2
  124. package/node_modules/markdown-it/node_modules/entities/dist/encode.d.ts.map +1 -0
  125. package/node_modules/markdown-it/node_modules/entities/dist/encode.js +90 -0
  126. package/node_modules/markdown-it/node_modules/entities/dist/encode.js.map +1 -0
  127. package/node_modules/markdown-it/node_modules/entities/{lib → dist}/escape.d.ts +15 -10
  128. package/node_modules/markdown-it/node_modules/entities/dist/escape.d.ts.map +1 -0
  129. package/node_modules/markdown-it/node_modules/entities/dist/escape.js +132 -0
  130. package/node_modules/markdown-it/node_modules/entities/dist/escape.js.map +1 -0
  131. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.d.ts +3 -0
  132. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.d.ts.map +1 -0
  133. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.js +5 -0
  134. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.js.map +1 -0
  135. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.d.ts +3 -0
  136. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.d.ts.map +1 -0
  137. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.js +5 -0
  138. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.js.map +1 -0
  139. package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.d.ts +5 -0
  140. package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.d.ts.map +1 -0
  141. package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.js +12 -0
  142. package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.js.map +1 -0
  143. package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/index.d.ts +14 -21
  144. package/node_modules/markdown-it/node_modules/entities/dist/index.d.ts.map +1 -0
  145. package/node_modules/markdown-it/node_modules/entities/dist/index.js +91 -0
  146. package/node_modules/markdown-it/node_modules/entities/dist/index.js.map +1 -0
  147. package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.d.ts +17 -0
  148. package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.d.ts.map +1 -0
  149. package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.js +18 -0
  150. package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.js.map +1 -0
  151. package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.d.ts +7 -0
  152. package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.d.ts.map +1 -0
  153. package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.js +17 -0
  154. package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.js.map +1 -0
  155. package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.d.ts +33 -0
  156. package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.d.ts.map +1 -0
  157. package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.js +93 -0
  158. package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.js.map +1 -0
  159. package/node_modules/markdown-it/node_modules/entities/package.json +63 -70
  160. package/node_modules/markdown-it/node_modules/entities/readme.md +54 -45
  161. package/node_modules/markdown-it/node_modules/entities/src/decode-codepoint.ts +50 -0
  162. package/node_modules/markdown-it/node_modules/entities/src/decode.ts +671 -0
  163. package/node_modules/markdown-it/node_modules/entities/src/encode.ts +95 -0
  164. package/node_modules/markdown-it/node_modules/entities/src/escape.ts +160 -0
  165. package/node_modules/markdown-it/node_modules/entities/src/generated/decode-data-html.ts +7 -0
  166. package/node_modules/markdown-it/node_modules/entities/src/generated/decode-data-xml.ts +7 -0
  167. package/node_modules/markdown-it/node_modules/entities/src/generated/encode-html.ts +18 -0
  168. package/node_modules/markdown-it/node_modules/entities/src/index.ts +162 -0
  169. package/node_modules/markdown-it/node_modules/entities/src/internal/bin-trie-flags.ts +16 -0
  170. package/node_modules/markdown-it/node_modules/entities/src/internal/decode-shared.ts +18 -0
  171. package/node_modules/markdown-it/node_modules/entities/src/internal/encode-shared.ts +123 -0
  172. package/node_modules/markdown-it/node_modules/linkify-it/README.md +49 -86
  173. package/node_modules/markdown-it/node_modules/linkify-it/build/index.cjs.js +636 -825
  174. package/node_modules/markdown-it/node_modules/linkify-it/build/index.cjs.js.map +1 -0
  175. package/node_modules/markdown-it/node_modules/linkify-it/build/index.d.ts +236 -0
  176. package/node_modules/markdown-it/node_modules/linkify-it/build/index.mjs +538 -0
  177. package/node_modules/markdown-it/node_modules/linkify-it/build/index.mjs.map +1 -0
  178. package/node_modules/markdown-it/node_modules/linkify-it/package.json +23 -20
  179. package/node_modules/markdown-it/node_modules/uc.micro/README.md +18 -1
  180. package/node_modules/markdown-it/node_modules/uc.micro/build/index.cjs.js +13 -18
  181. package/node_modules/markdown-it/node_modules/uc.micro/build/index.d.ts +6 -0
  182. package/node_modules/markdown-it/node_modules/uc.micro/build/index.mjs +8 -0
  183. package/node_modules/markdown-it/node_modules/uc.micro/package.json +12 -17
  184. package/node_modules/markdown-it/package.json +47 -30
  185. package/node_modules/matrix-js-sdk/CHANGELOG.md +0 -11
  186. package/node_modules/matrix-js-sdk/package.json +1 -1
  187. package/node_modules/music-metadata/lib/common/Util.d.ts +1 -1
  188. package/node_modules/music-metadata/lib/common/Util.js +1 -7
  189. package/node_modules/music-metadata/lib/id3v2/FrameHeader.js +3 -23
  190. package/node_modules/music-metadata/lib/id3v2/FrameParser.js +2 -2
  191. package/node_modules/music-metadata/lib/id3v2/ID3v2Token.js +1 -1
  192. package/node_modules/music-metadata/lib/mp4/AtomToken.js +13 -38
  193. package/node_modules/music-metadata/lib/mpeg/MpegParser.js +1 -1
  194. package/node_modules/music-metadata/package.json +6 -6
  195. package/node_modules/typebox/build/compile/validator.d.mts +4 -1
  196. package/node_modules/typebox/build/guard/guard.d.mts +1 -1
  197. package/node_modules/typebox/build/guard/guard.mjs +2 -5
  198. package/node_modules/typebox/build/guard/string.mjs +4 -16
  199. package/node_modules/typebox/build/schema/engine/_functions.mjs +15 -34
  200. package/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
  201. package/node_modules/typebox/build/type/action/readonly_object.mjs +0 -8
  202. package/node_modules/typebox/build/typebox.d.mts +1 -1
  203. package/node_modules/typebox/build/typebox.mjs +1 -1
  204. package/node_modules/typebox/package.json +1 -1
  205. package/node_modules/typebox/readme.md +32 -29
  206. package/openclaw.plugin.json +146 -152
  207. package/package.json +31 -114
  208. package/dist/accounts-DfngqebB.js +0 -130
  209. package/dist/active-client-DXvz2gCo.js +0 -20
  210. package/dist/approval-reactions-D-BxBK_L.js +0 -202
  211. package/dist/client-Dbso3-0V.js +0 -30
  212. package/dist/client-bootstrap-XsIkHNt0.js +0 -110
  213. package/dist/create-client-BmSU-q-D.js +0 -61
  214. package/dist/credentials-W2EmwRhu.js +0 -65
  215. package/dist/credentials-read-DVmFCm7X.js +0 -77
  216. package/dist/doctor-CM8ijNpW.js +0 -64
  217. package/dist/doctor-contract-BMSJkkAE.js +0 -167
  218. package/dist/inbound-dedupe-CaBLblef.js +0 -48
  219. package/dist/probe.runtime-BuieqmS3.js +0 -3
  220. package/dist/record-shared-CWWx6fvI.js +0 -2
  221. package/dist/recovery-key-store-BNnHvXdk.js +0 -275
  222. package/dist/room-info-CAFZ3Z9J.js +0 -87
  223. package/dist/route-DY6at4qJ.js +0 -161
  224. package/dist/storage-BvAkgzvT.js +0 -685
  225. package/node_modules/markdown-it/dist/index.cjs.js.map +0 -1
  226. package/node_modules/markdown-it/dist/markdown-it.js +0 -3975
  227. package/node_modules/markdown-it/dist/markdown-it.js.map +0 -1
  228. package/node_modules/markdown-it/dist/markdown-it.min.js +0 -3
  229. package/node_modules/markdown-it/dist/markdown-it.min.js.map +0 -1
  230. package/node_modules/markdown-it/index.mjs +0 -1
  231. package/node_modules/markdown-it/lib/common/html_blocks.mjs +0 -67
  232. package/node_modules/markdown-it/lib/common/html_re.mjs +0 -25
  233. package/node_modules/markdown-it/lib/common/utils.mjs +0 -324
  234. package/node_modules/markdown-it/lib/helpers/index.mjs +0 -11
  235. package/node_modules/markdown-it/lib/helpers/parse_link_destination.mjs +0 -77
  236. package/node_modules/markdown-it/lib/helpers/parse_link_label.mjs +0 -49
  237. package/node_modules/markdown-it/lib/helpers/parse_link_title.mjs +0 -66
  238. package/node_modules/markdown-it/lib/index.mjs +0 -565
  239. package/node_modules/markdown-it/lib/parser_block.mjs +0 -134
  240. package/node_modules/markdown-it/lib/parser_core.mjs +0 -62
  241. package/node_modules/markdown-it/lib/parser_inline.mjs +0 -197
  242. package/node_modules/markdown-it/lib/presets/commonmark.mjs +0 -88
  243. package/node_modules/markdown-it/lib/presets/default.mjs +0 -47
  244. package/node_modules/markdown-it/lib/presets/zero.mjs +0 -70
  245. package/node_modules/markdown-it/lib/renderer.mjs +0 -322
  246. package/node_modules/markdown-it/lib/ruler.mjs +0 -340
  247. package/node_modules/markdown-it/lib/rules_block/blockquote.mjs +0 -209
  248. package/node_modules/markdown-it/lib/rules_block/code.mjs +0 -30
  249. package/node_modules/markdown-it/lib/rules_block/fence.mjs +0 -94
  250. package/node_modules/markdown-it/lib/rules_block/heading.mjs +0 -51
  251. package/node_modules/markdown-it/lib/rules_block/hr.mjs +0 -40
  252. package/node_modules/markdown-it/lib/rules_block/html_block.mjs +0 -80
  253. package/node_modules/markdown-it/lib/rules_block/lheading.mjs +0 -85
  254. package/node_modules/markdown-it/lib/rules_block/list.mjs +0 -331
  255. package/node_modules/markdown-it/lib/rules_block/paragraph.mjs +0 -48
  256. package/node_modules/markdown-it/lib/rules_block/reference.mjs +0 -212
  257. package/node_modules/markdown-it/lib/rules_block/state_block.mjs +0 -220
  258. package/node_modules/markdown-it/lib/rules_block/table.mjs +0 -228
  259. package/node_modules/markdown-it/lib/rules_core/block.mjs +0 -13
  260. package/node_modules/markdown-it/lib/rules_core/inline.mjs +0 -11
  261. package/node_modules/markdown-it/lib/rules_core/linkify.mjs +0 -134
  262. package/node_modules/markdown-it/lib/rules_core/normalize.mjs +0 -17
  263. package/node_modules/markdown-it/lib/rules_core/replacements.mjs +0 -101
  264. package/node_modules/markdown-it/lib/rules_core/smartquotes.mjs +0 -209
  265. package/node_modules/markdown-it/lib/rules_core/state_core.mjs +0 -17
  266. package/node_modules/markdown-it/lib/rules_core/text_join.mjs +0 -43
  267. package/node_modules/markdown-it/lib/rules_inline/autolink.mjs +0 -72
  268. package/node_modules/markdown-it/lib/rules_inline/backticks.mjs +0 -60
  269. package/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs +0 -124
  270. package/node_modules/markdown-it/lib/rules_inline/emphasis.mjs +0 -123
  271. package/node_modules/markdown-it/lib/rules_inline/entity.mjs +0 -51
  272. package/node_modules/markdown-it/lib/rules_inline/escape.mjs +0 -83
  273. package/node_modules/markdown-it/lib/rules_inline/fragments_join.mjs +0 -38
  274. package/node_modules/markdown-it/lib/rules_inline/html_inline.mjs +0 -50
  275. package/node_modules/markdown-it/lib/rules_inline/image.mjs +0 -138
  276. package/node_modules/markdown-it/lib/rules_inline/link.mjs +0 -139
  277. package/node_modules/markdown-it/lib/rules_inline/linkify.mjs +0 -63
  278. package/node_modules/markdown-it/lib/rules_inline/newline.mjs +0 -42
  279. package/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +0 -154
  280. package/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs +0 -127
  281. package/node_modules/markdown-it/lib/rules_inline/text.mjs +0 -86
  282. package/node_modules/markdown-it/lib/token.mjs +0 -191
  283. package/node_modules/markdown-it/node_modules/argparse/CHANGELOG.md +0 -216
  284. package/node_modules/markdown-it/node_modules/entities/lib/decode.d.ts.map +0 -1
  285. package/node_modules/markdown-it/node_modules/entities/lib/decode.js +0 -536
  286. package/node_modules/markdown-it/node_modules/entities/lib/decode.js.map +0 -1
  287. package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.d.ts +0 -19
  288. package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.d.ts.map +0 -1
  289. package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.js +0 -76
  290. package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.js.map +0 -1
  291. package/node_modules/markdown-it/node_modules/entities/lib/encode.d.ts +0 -22
  292. package/node_modules/markdown-it/node_modules/entities/lib/encode.d.ts.map +0 -1
  293. package/node_modules/markdown-it/node_modules/entities/lib/encode.js +0 -77
  294. package/node_modules/markdown-it/node_modules/entities/lib/encode.js.map +0 -1
  295. package/node_modules/markdown-it/node_modules/entities/lib/escape.d.ts.map +0 -1
  296. package/node_modules/markdown-it/node_modules/entities/lib/escape.js +0 -122
  297. package/node_modules/markdown-it/node_modules/entities/lib/escape.js.map +0 -1
  298. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode.d.ts +0 -211
  299. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode.d.ts.map +0 -1
  300. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode.js.map +0 -1
  301. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.d.ts +0 -19
  302. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.d.ts.map +0 -1
  303. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.js +0 -71
  304. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.js.map +0 -1
  305. package/node_modules/markdown-it/node_modules/entities/lib/esm/encode.d.ts.map +0 -1
  306. package/node_modules/markdown-it/node_modules/entities/lib/esm/encode.js +0 -69
  307. package/node_modules/markdown-it/node_modules/entities/lib/esm/encode.js.map +0 -1
  308. package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.d.ts +0 -43
  309. package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.d.ts.map +0 -1
  310. package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.js +0 -116
  311. package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.js.map +0 -1
  312. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.d.ts +0 -3
  313. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.d.ts.map +0 -1
  314. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.js +0 -7
  315. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.js.map +0 -1
  316. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts +0 -3
  317. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts.map +0 -1
  318. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.js +0 -7
  319. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.js.map +0 -1
  320. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.d.ts +0 -8
  321. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.d.ts.map +0 -1
  322. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.js +0 -10
  323. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.js.map +0 -1
  324. package/node_modules/markdown-it/node_modules/entities/lib/esm/index.d.ts.map +0 -1
  325. package/node_modules/markdown-it/node_modules/entities/lib/esm/index.js +0 -99
  326. package/node_modules/markdown-it/node_modules/entities/lib/esm/index.js.map +0 -1
  327. package/node_modules/markdown-it/node_modules/entities/lib/esm/package.json +0 -1
  328. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.d.ts +0 -3
  329. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.d.ts.map +0 -1
  330. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.js +0 -9
  331. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.js.map +0 -1
  332. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.d.ts +0 -3
  333. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.d.ts.map +0 -1
  334. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.js +0 -9
  335. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.js.map +0 -1
  336. package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.d.ts +0 -8
  337. package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.d.ts.map +0 -1
  338. package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.js +0 -12
  339. package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.js.map +0 -1
  340. package/node_modules/markdown-it/node_modules/entities/lib/index.d.ts +0 -96
  341. package/node_modules/markdown-it/node_modules/entities/lib/index.d.ts.map +0 -1
  342. package/node_modules/markdown-it/node_modules/entities/lib/index.js +0 -126
  343. package/node_modules/markdown-it/node_modules/entities/lib/index.js.map +0 -1
  344. package/node_modules/markdown-it/node_modules/linkify-it/index.mjs +0 -646
  345. package/node_modules/markdown-it/node_modules/linkify-it/lib/re.mjs +0 -193
  346. package/node_modules/markdown-it/node_modules/uc.micro/categories/Cc/regex.mjs +0 -1
  347. package/node_modules/markdown-it/node_modules/uc.micro/categories/Cf/regex.mjs +0 -1
  348. package/node_modules/markdown-it/node_modules/uc.micro/categories/P/regex.mjs +0 -1
  349. package/node_modules/markdown-it/node_modules/uc.micro/categories/S/regex.mjs +0 -1
  350. package/node_modules/markdown-it/node_modules/uc.micro/categories/Z/regex.mjs +0 -1
  351. package/node_modules/markdown-it/node_modules/uc.micro/index.mjs +0 -8
  352. package/node_modules/markdown-it/node_modules/uc.micro/properties/Any/regex.mjs +0 -1
  353. /package/dist/{account-config-BZWN9tGS.js → .setup/account-config-BZWN9tGS.mjs} +0 -0
  354. /package/dist/{backup-health-Dm_YMVFT.js → .setup/backup-health-Dm_YMVFT.mjs} +0 -0
  355. /package/dist/{config-paths-CnREYb1Y.js → .setup/config-paths-CnREYb1Y.mjs} +0 -0
  356. /package/dist/{config-secret-input.runtime-CwsP3--c.js → .setup/config-secret-input.runtime-CwsP3--c.mjs} +0 -0
  357. /package/dist/{crypto-node.runtime-6Aj_ltHQ.js → .setup/crypto-node.runtime-6Aj_ltHQ.mjs} +0 -0
  358. /package/dist/{errors-C47hvAF8.js → .setup/errors-C47hvAF8.mjs} +0 -0
  359. /package/dist/{preflight-audio.runtime-BZxxQsxY.js → .setup/preflight-audio.runtime-BZxxQsxY.mjs} +0 -0
  360. /package/dist/{reaction-common-DkrQdBSZ.js → .setup/reaction-common-DkrQdBSZ.mjs} +0 -0
  361. /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
  362. /package/dist/{runtime-6S3DNFNv.js → .setup/runtime-6S3DNFNv.mjs} +0 -0
  363. /package/dist/{runtime-BefyhPWv.js → .setup/runtime-BefyhPWv.mjs} +0 -0
  364. /package/dist/{sync-state-CWbp0QSY.js → .setup/sync-state-CWbp0QSY.mjs} +0 -0
  365. /package/dist/{target-ids-B-5aQxwn.js → .setup/target-ids-B-5aQxwn.mjs} +0 -0
  366. /package/dist/{thread-bindings-shared-CKnY4LSd.js → .setup/thread-bindings-shared-CKnY4LSd.mjs} +0 -0
  367. /package/dist/{timeout-abort-signal-DMrgRFIy.js → .setup/timeout-abort-signal-DMrgRFIy.mjs} +0 -0
  368. /package/dist/{url-validation-GRHde6lq.js → .setup/url-validation-GRHde6lq.mjs} +0 -0
@@ -1,334 +1,21 @@
1
- import { a as resolveMatrixDefaultOrOnlyAccountId, n as requiresExplicitMatrixDefaultAccount } from "./account-selection-kqquRzCf.js";
2
- import { t as isRecord$1 } from "./record-shared-CWWx6fvI.js";
3
- import { r as resolveMatrixCredentialsDir } from "./storage-paths-gUmSydsW.js";
4
- import { a as isMatrixCredentialRevocation, c as normalizeMatrixStoredCredentials, s as matrixCredentialsStoreKey, t as MATRIX_CREDENTIALS_NAMESPACE } from "./credentials-read-DVmFCm7X.js";
5
- import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-BMSJkkAE.js";
6
- import { C as readLegacyMatrixRecoveryKeyState, O as writeMatrixIdbSnapshotJsonToStore, T as readMatrixIdbSnapshotJsonFromStore, a as openMatrixStorageMetaStoreOptions, b as openMatrixRecoveryKeyStoreOptions, f as MATRIX_IDB_SNAPSHOT_FILENAME, g as hasMatrixRecoveryKeyStateInStore, h as hasMatrixLegacyCryptoMigrationStateInStore, i as normalizeMatrixStorageMetadata, j as writeMatrixRecoveryKeyStateToStore, k as writeMatrixLegacyCryptoMigrationStateToStore, m as MATRIX_RECOVERY_KEY_FILENAME, n as hasMatrixStorageMetaStateInStore, p as MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME, u as writeMatrixStorageMetaStateToStore, v as openMatrixIdbSnapshotStoreOptions, x as readLegacyMatrixLegacyCryptoMigrationState, y as openMatrixLegacyCryptoMigrationStoreOptions } from "./storage-BvAkgzvT.js";
7
- import { a as readLegacyMatrixSyncCacheState, i as openMatrixSyncCacheStoreOptions, o as writeMatrixSyncCacheStateToStore, r as hasMatrixSyncCacheStateInStore } from "./file-sync-store-DiiFsayX.js";
8
- import { n as MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS } from "./idb-persistence-lock-DAJ49nZX.js";
9
- import { r as readLegacyMatrixIdbSnapshotStateUnlocked, t as isValidMatrixIdbSnapshotJson } from "./idb-persistence-B6x7dMsF.js";
10
- import { a as resolveMatrixInboundDedupeStateNamespace, n as MATRIX_INBOUND_DEDUPE_TTL_MS, r as buildMatrixInboundDedupeEventKey } from "./inbound-dedupe-CaBLblef.js";
11
- import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
12
- import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
13
- import { archiveLegacyStateSource } from "openclaw/plugin-sdk/runtime-doctor";
14
- import { createHash, randomUUID } from "node:crypto";
1
+ import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./.setup/doctor-contract-DNJw0fdq.mjs";
2
+ import { D as writeMatrixRecoveryKeyStateToStore, S as writeMatrixIdbSnapshotJsonToStore, a as hasMatrixLegacyCryptoMigrationStateInStore, d as openMatrixLegacyCryptoMigrationStoreOptions, f as openMatrixRecoveryKeyStoreOptions, h as readLegacyMatrixRecoveryKeyState, i as hasMatrixIdbSnapshotStateInStore, n as MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME, o as hasMatrixRecoveryKeyStateInStore, p as readLegacyMatrixLegacyCryptoMigrationState, r as MATRIX_RECOVERY_KEY_FILENAME, t as MATRIX_IDB_SNAPSHOT_FILENAME, u as openMatrixIdbSnapshotStoreOptions, w as writeMatrixLegacyCryptoMigrationStateToStore } from "./.setup/crypto-state-store-B43k3z3W.mjs";
3
+ import { a as openMatrixStorageMetaStoreOptions, i as normalizeMatrixStorageMetadata, n as hasMatrixStorageMetaStateInStore, u as writeMatrixStorageMetaStateToStore } from "./.setup/storage-NGZq5zet.mjs";
4
+ import { a as readLegacyMatrixSyncCacheState, i as openMatrixSyncCacheStoreOptions, o as writeMatrixSyncCacheStateToStore, r as hasMatrixSyncCacheStateInStore } from "./.setup/file-sync-store-DU0cnYAz.mjs";
5
+ import { r as readLegacyMatrixIdbSnapshotState } from "./.setup/idb-persistence-_HKTXkVC.mjs";
15
6
  import path from "node:path";
16
- import fs from "node:fs";
17
- import fs$1 from "node:fs/promises";
18
- import { isDeepStrictEqual } from "node:util";
19
- import { withFileLock } from "openclaw/plugin-sdk/file-lock";
20
- import { createPersistentDedupeImportEntry } from "openclaw/plugin-sdk/persistent-dedupe";
21
- //#region extensions/matrix/src/matrix/crypto-snapshot-doctor.ts
22
- async function migrateLegacyMatrixIdbSnapshot(params) {
23
- const snapshotPath = path.join(params.storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
24
- try {
25
- await withFileLock(snapshotPath, MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, () => migrateLegacyMatrixIdbSnapshotLocked(params));
26
- } catch (err) {
27
- params.warnings.push(`Failed locking Matrix IndexedDB snapshot for ${params.storageRootDir}: ${String(err)}; left legacy source in place`);
28
- }
29
- }
30
- async function migrateLegacyMatrixIdbSnapshotLocked(params) {
31
- const sourcePath = path.join(params.storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
32
- let snapshot;
33
- try {
34
- snapshot = readLegacyMatrixIdbSnapshotStateUnlocked(params.storageRootDir);
35
- } catch (err) {
36
- params.warnings.push(`Failed reading Matrix IndexedDB snapshot legacy source for ${params.storageRootDir}: ${String(err)}; left source in place`);
37
- return;
38
- }
39
- if (!snapshot) {
40
- if (!fs.existsSync(sourcePath)) return;
41
- const archived = await archiveLegacyMatrixIdbSnapshot(params);
42
- params.warnings.push(archived ? `Matrix IndexedDB snapshot legacy source is invalid for ${params.storageRootDir}; archived without import` : `Matrix IndexedDB snapshot legacy source is invalid for ${params.storageRootDir}; left active because archival failed`);
43
- return;
44
- }
45
- const snapshotJson = JSON.stringify(snapshot);
46
- const store = params.context.openPluginStateKeyedStore(openMatrixIdbSnapshotStoreOptions(params.storageRootDir));
47
- let persisted;
48
- let hadPartialState;
49
- try {
50
- persisted = await readMatrixIdbSnapshotJsonFromStore({ store });
51
- const persistedIsValid = persisted ? isValidMatrixIdbSnapshotJson(persisted) : false;
52
- hadPartialState = !persistedIsValid && (await store.entries()).length > 0;
53
- if (!persistedIsValid) persisted = null;
54
- } catch (err) {
55
- params.warnings.push(`Failed inspecting Matrix IndexedDB snapshot SQLite state for ${params.storageRootDir}: ${String(err)}; left legacy source in place`);
56
- return;
57
- }
58
- if (persisted && !snapshotContentMatches(persisted, snapshot)) {
59
- if (await archiveLegacyMatrixIdbSnapshot(params)) params.notices.push(`Kept the canonical Matrix IndexedDB snapshot in SQLite and archived a differing legacy source for ${params.storageRootDir}`);
60
- return;
61
- }
62
- if (!persisted) {
63
- try {
64
- await writeMatrixIdbSnapshotJsonToStore({
65
- snapshotJson,
66
- databaseCount: snapshot.length,
67
- store
68
- });
69
- persisted = await readMatrixIdbSnapshotJsonFromStore({ store });
70
- } catch (err) {
71
- params.warnings.push(`Failed importing Matrix IndexedDB snapshot for ${params.storageRootDir}: ${String(err)}; left legacy source in place`);
72
- return;
73
- }
74
- if (!persisted || !snapshotContentMatches(persisted, snapshot)) {
75
- params.warnings.push(`Failed verifying Matrix IndexedDB snapshot for ${params.storageRootDir}; left legacy source in place`);
76
- return;
77
- }
78
- params.changes.push(hadPartialState ? `Repaired partial or invalid Matrix IndexedDB snapshot SQLite state for ${params.storageRootDir}` : `Migrated Matrix IndexedDB snapshot JSON to SQLite for ${params.storageRootDir}`);
79
- }
80
- await archiveLegacyMatrixIdbSnapshot(params);
81
- }
82
- function snapshotContentMatches(persistedJson, snapshot) {
83
- try {
84
- return isDeepStrictEqual(JSON.parse(persistedJson), snapshot);
85
- } catch {
86
- return false;
87
- }
88
- }
89
- async function archiveLegacyMatrixIdbSnapshot(params) {
90
- const sourcePath = path.join(params.storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
91
- const archivePath = `${sourcePath}.migrated-${(/* @__PURE__ */ new Date()).toISOString().replaceAll(":", "-")}-${randomUUID()}`;
92
- try {
93
- await fs$1.rename(sourcePath, archivePath);
94
- params.changes.push(`Archived Matrix IndexedDB snapshot legacy source -> ${archivePath}`);
95
- return true;
96
- } catch (err) {
97
- params.warnings.push(`Failed archiving Matrix IndexedDB snapshot legacy source: ${String(err)}`);
98
- return false;
99
- }
100
- }
101
- //#endregion
102
- //#region extensions/matrix/src/matrix/monitor/inbound-dedupe-migration.ts
103
- const LEGACY_SQLITE_NAMESPACE = "inbound-dedupe";
104
- const LEGACY_SQLITE_MAX_ENTRIES = 2e4;
105
- const LEGACY_MARKERS_NAMESPACE = "inbound-dedupe-migrations";
106
- const LEGACY_MARKERS_MAX_ENTRIES = 1e3;
107
- const LEGACY_JSON_VERSION = 1;
108
- const STORAGE_META_FILENAME = "storage-meta.json";
109
- const MATRIX_LEGACY_INBOUND_DEDUPE_FILENAME = "inbound-dedupe.json";
110
- async function collectMatrixInboundDedupeSources(stateDir) {
111
- const matrixRoot = path.join(stateDir, "matrix");
112
- const sqliteRoots = /* @__PURE__ */ new Set();
113
- const jsonRoots = /* @__PURE__ */ new Set();
114
- async function visit(dir) {
115
- let entries;
116
- try {
117
- entries = await fs$1.readdir(dir, { withFileTypes: true });
118
- } catch {
119
- return;
120
- }
121
- for (const entry of entries) {
122
- const entryPath = path.join(dir, entry.name);
123
- if (entry.isFile()) {
124
- if (entry.name === "openclaw.sqlite" && path.basename(dir) === "state") sqliteRoots.add(path.dirname(dir));
125
- else if (entry.name === "inbound-dedupe.json") jsonRoots.add(dir);
126
- continue;
127
- }
128
- if (entry.isDirectory()) await visit(entryPath);
129
- }
130
- }
131
- await visit(matrixRoot);
132
- const matrixRootResolved = path.resolve(matrixRoot);
133
- const isAccountRoot = (root) => path.resolve(root) !== matrixRootResolved;
134
- return {
135
- sqliteRoots: [...sqliteRoots].filter(isAccountRoot).toSorted(),
136
- jsonRoots: [...jsonRoots].filter(isAccountRoot).toSorted()
137
- };
138
- }
139
- function openLegacySqliteStore(io, storageRootDir) {
140
- return io.context.openPluginStateKeyedStore({
141
- namespace: LEGACY_SQLITE_NAMESPACE,
142
- maxEntries: LEGACY_SQLITE_MAX_ENTRIES,
143
- env: {
144
- ...io.env,
145
- OPENCLAW_STATE_DIR: storageRootDir
146
- }
147
- });
148
- }
149
- function openLegacyMarkersStore(io, storageRootDir) {
150
- return io.context.openPluginStateKeyedStore({
151
- namespace: LEGACY_MARKERS_NAMESPACE,
152
- maxEntries: LEGACY_MARKERS_MAX_ENTRIES,
153
- env: {
154
- ...io.env,
155
- OPENCLAW_STATE_DIR: storageRootDir
156
- }
157
- });
158
- }
159
- function normalizeLegacyTimestamp(raw) {
160
- if (typeof raw !== "number" || !Number.isFinite(raw)) return null;
161
- return Math.max(0, Math.floor(raw));
162
- }
163
- function parseLegacySqliteRow(row) {
164
- const value = isRecord$1(row.value) ? row.value : {};
165
- const roomId = typeof value.roomId === "string" ? value.roomId.trim() : "";
166
- const eventId = typeof value.eventId === "string" ? value.eventId.trim() : "";
167
- const ts = normalizeLegacyTimestamp(value.ts);
168
- const separator = row.key.lastIndexOf(":");
169
- if (!roomId || !eventId || ts === null || separator <= 0) return null;
170
- const accountId = row.key.slice(0, separator);
171
- const digest = createHash("sha256").update(accountId).update("\0").update(roomId).update("\0").update(eventId).digest("hex");
172
- if (row.key.slice(separator + 1) !== digest) return null;
173
- return {
174
- accountId,
175
- roomId,
176
- eventId,
177
- ts
178
- };
179
- }
180
- /** Reads one storage root's legacy SQLite dedupe rows; throws on store errors. */
181
- async function readLegacyInboundDedupeSqliteSource(io, storageRootDir) {
182
- const rows = await openLegacySqliteStore(io, storageRootDir).entries();
183
- const markerRows = await openLegacyMarkersStore(io, storageRootDir).entries();
184
- const markers = [];
185
- for (const row of rows) {
186
- const marker = parseLegacySqliteRow(row);
187
- if (marker) markers.push(marker);
188
- }
189
- return {
190
- markers,
191
- legacyRowCount: rows.length + markerRows.length
192
- };
193
- }
194
- /** Clears one storage root's retired legacy dedupe namespaces after import. */
195
- async function retireLegacyInboundDedupeSqliteRows(io, storageRootDir) {
196
- await openLegacySqliteStore(io, storageRootDir).clear();
197
- await openLegacyMarkersStore(io, storageRootDir).clear();
198
- }
199
- async function resolveJsonRootAccountId(storageRootDir) {
200
- for (const filename of [STORAGE_META_FILENAME, `${STORAGE_META_FILENAME}.migrated`]) try {
201
- const metadata = normalizeMatrixStorageMetadata(JSON.parse(await fs$1.readFile(path.join(storageRootDir, filename), "utf8")));
202
- if (metadata?.accountId) return metadata.accountId;
203
- } catch {}
204
- return "default";
205
- }
206
- /**
207
- * Reads one storage root's legacy inbound-dedupe.json markers. Throws on file
208
- * read errors so a transiently unreadable file is never retired unread, and
209
- * returns null for malformed content so the caller can archive it explicitly.
210
- */
211
- async function readLegacyInboundDedupeJsonSource(storageRootDir) {
212
- const jsonPath = path.join(storageRootDir, MATRIX_LEGACY_INBOUND_DEDUPE_FILENAME);
213
- const raw = await fs$1.readFile(jsonPath, "utf8");
214
- let parsed;
215
- try {
216
- parsed = JSON.parse(raw);
217
- } catch {
218
- return null;
219
- }
220
- if (!isRecord$1(parsed) || parsed.version !== LEGACY_JSON_VERSION || !Array.isArray(parsed.entries)) return null;
221
- const accountId = await resolveJsonRootAccountId(storageRootDir);
222
- const markers = [];
223
- for (const entry of parsed.entries) {
224
- if (!isRecord$1(entry) || typeof entry.key !== "string") continue;
225
- const separator = entry.key.indexOf("|");
226
- if (separator <= 0) continue;
227
- const roomId = entry.key.slice(0, separator).trim();
228
- const eventId = entry.key.slice(separator + 1).trim();
229
- const ts = normalizeLegacyTimestamp(entry.ts);
230
- if (!roomId || !eventId || ts === null) continue;
231
- markers.push({
232
- accountId,
233
- roomId,
234
- eventId,
235
- ts
236
- });
237
- }
238
- return markers;
239
- }
240
- /**
241
- * Imports the globally newest legacy markers into the claimable-dedupe store.
242
- * Never exceeds capacity: eviction is by row creation time, so letting fresh
243
- * imports overflow the namespace would evict the newer rows the runtime
244
- * committed since the upgrade. Throws on store errors so the caller keeps the
245
- * legacy sources for the next doctor attempt.
246
- */
247
- async function importNewestInboundDedupeMarkers(params) {
248
- const now = params.now ?? Date.now();
249
- const stateMaxEntries = params.stateMaxEntries ?? 2e4;
250
- const newestByKey = /* @__PURE__ */ new Map();
251
- for (const marker of params.markers) {
252
- const key = buildMatrixInboundDedupeEventKey(marker);
253
- if (!key) continue;
254
- const existing = newestByKey.get(key);
255
- if (!existing || marker.ts > existing.ts) newestByKey.set(key, {
256
- ...marker,
257
- key
258
- });
259
- }
260
- const markers = [...newestByKey.values()].toSorted((left, right) => right.ts - left.ts);
261
- const store = params.io.context.openPluginStateKeyedStore({
262
- namespace: resolveMatrixInboundDedupeStateNamespace(),
263
- maxEntries: stateMaxEntries,
264
- defaultTtlMs: MATRIX_INBOUND_DEDUPE_TTL_MS,
265
- env: params.io.env
266
- });
267
- let capacity = Math.max(0, stateMaxEntries - (await store.entries()).length);
268
- let imported = 0;
269
- for (const marker of markers) {
270
- if (capacity <= 0) break;
271
- const remainingTtlMs = MATRIX_INBOUND_DEDUPE_TTL_MS - (now - marker.ts);
272
- if (remainingTtlMs <= 0) continue;
273
- const entry = createPersistentDedupeImportEntry({
274
- key: marker.key,
275
- seenAt: marker.ts,
276
- ttlMs: Math.max(1, Math.floor(remainingTtlMs))
277
- });
278
- if (await store.registerIfAbsent(entry.key, entry.value, { ttlMs: entry.ttlMs ?? 2592e6 })) {
279
- imported += 1;
280
- capacity -= 1;
281
- }
282
- }
283
- return {
284
- imported,
285
- total: markers.length
286
- };
287
- }
288
- //#endregion
7
+ import fs from "node:fs/promises";
8
+ import { legacyStateFileExists } from "openclaw/plugin-sdk/runtime-doctor";
289
9
  //#region extensions/matrix/doctor-contract-api.ts
290
10
  const MATRIX_SYNC_CACHE_FILENAME = "bot-storage.json";
291
11
  const MATRIX_STORAGE_META_FILENAME = "storage-meta.json";
292
- async function collectLegacyMatrixCredentialSources(params) {
293
- const credentialsDir = resolveMatrixCredentialsDir(params.stateDir);
294
- let entries;
295
- try {
296
- entries = await fs$1.readdir(credentialsDir, { withFileTypes: true });
297
- } catch {
298
- return [];
299
- }
300
- return entries.filter((entry) => entry.isFile() && /^credentials(?:-[a-z0-9._-]+)?\.json$/iu.test(entry.name)).toSorted((left, right) => {
301
- if (left.name === "credentials.json") return 1;
302
- if (right.name === "credentials.json") return -1;
303
- return left.name.localeCompare(right.name);
304
- }).map((entry) => {
305
- const namedAccount = /^credentials(?:-([a-z0-9._-]+))?\.json$/iu.exec(entry.name)?.[1];
306
- return {
307
- accountId: namedAccount ? normalizeAccountId(namedAccount) : requiresExplicitMatrixDefaultAccount(params.config, params.env) ? null : normalizeAccountId(resolveMatrixDefaultOrOnlyAccountId(params.config, params.env)),
308
- filePath: path.join(credentialsDir, entry.name)
309
- };
310
- });
311
- }
312
- async function readLegacyMatrixCredentials(source) {
313
- if (!source.accountId) return null;
314
- try {
315
- const raw = JSON.parse(await fs$1.readFile(source.filePath, "utf8"));
316
- const createdAt = isRecord(raw) && typeof raw.createdAt === "string" && raw.createdAt ? raw.createdAt : (await fs$1.stat(source.filePath)).mtime.toISOString();
317
- return normalizeMatrixStoredCredentials(isRecord(raw) ? {
318
- ...raw,
319
- createdAt
320
- } : raw, source.accountId);
321
- } catch {
322
- return null;
323
- }
324
- }
325
- async function collectLegacyMatrixStateRoots(stateDir, filename, options) {
12
+ async function collectLegacyMatrixStateRoots(stateDir, filename) {
326
13
  const matrixRoot = path.join(stateDir, "matrix");
327
14
  const roots = [];
328
15
  async function visit(dir) {
329
16
  let entries;
330
17
  try {
331
- entries = await fs$1.readdir(dir, { withFileTypes: true });
18
+ entries = await fs.readdir(dir, { withFileTypes: true });
332
19
  } catch {
333
20
  return;
334
21
  }
@@ -342,188 +29,47 @@ async function collectLegacyMatrixStateRoots(stateDir, filename, options) {
342
29
  }
343
30
  }
344
31
  await visit(matrixRoot);
345
- return roots.filter((root) => options?.includeMatrixRoot || path.resolve(root) !== path.resolve(matrixRoot)).toSorted();
32
+ return roots.filter((root) => path.resolve(root) !== path.resolve(matrixRoot)).toSorted();
346
33
  }
347
34
  async function collectLegacySyncCacheRoots(stateDir) {
348
35
  return collectLegacyMatrixStateRoots(stateDir, MATRIX_SYNC_CACHE_FILENAME);
349
36
  }
350
37
  async function readLegacyMatrixStorageMetadata(storageRootDir) {
351
38
  try {
352
- return normalizeMatrixStorageMetadata(JSON.parse(await fs$1.readFile(path.join(storageRootDir, MATRIX_STORAGE_META_FILENAME), "utf8")));
39
+ return normalizeMatrixStorageMetadata(JSON.parse(await fs.readFile(path.join(storageRootDir, MATRIX_STORAGE_META_FILENAME), "utf8")));
353
40
  } catch {
354
41
  return null;
355
42
  }
356
43
  }
357
44
  async function archiveLegacySyncCache(params) {
358
- await archiveLegacyMatrixStateFile({
359
- ...params,
360
- filename: MATRIX_SYNC_CACHE_FILENAME,
361
- label: "Matrix sync cache"
362
- });
45
+ const sourcePath = path.join(params.storageRootDir, MATRIX_SYNC_CACHE_FILENAME);
46
+ const archivedPath = `${sourcePath}.migrated`;
47
+ if (await legacyStateFileExists(archivedPath)) {
48
+ params.warnings.push(`Left migrated Matrix sync cache in place because ${archivedPath} already exists`);
49
+ return;
50
+ }
51
+ try {
52
+ await fs.rename(sourcePath, archivedPath);
53
+ params.changes.push(`Archived Matrix sync cache legacy source -> ${archivedPath}`);
54
+ } catch (err) {
55
+ params.warnings.push(`Failed archiving Matrix sync cache legacy source: ${String(err)}`);
56
+ }
363
57
  }
364
58
  async function archiveLegacyMatrixStateFile(params) {
365
- const warningCount = params.warnings.length;
366
- await archiveLegacyStateSource({
367
- filePath: path.join(params.storageRootDir, params.filename),
368
- label: params.label,
369
- changes: params.changes,
370
- warnings: params.warnings
371
- });
372
- if (params.notice && params.warnings.length === warningCount) params.notices?.push(params.notice);
59
+ const sourcePath = path.join(params.storageRootDir, params.filename);
60
+ const archivedPath = `${sourcePath}.migrated`;
61
+ if (await legacyStateFileExists(archivedPath)) {
62
+ params.warnings.push(`Left migrated ${params.label} in place because ${archivedPath} already exists`);
63
+ return;
64
+ }
65
+ try {
66
+ await fs.rename(sourcePath, archivedPath);
67
+ params.changes.push(`Archived ${params.label} legacy source -> ${archivedPath}`);
68
+ } catch (err) {
69
+ params.warnings.push(`Failed archiving ${params.label} legacy source: ${String(err)}`);
70
+ }
373
71
  }
374
72
  const stateMigrations = [
375
- {
376
- id: "matrix-credentials-json-to-plugin-state",
377
- label: "Matrix credentials",
378
- async detectLegacyState(params) {
379
- const sources = await collectLegacyMatrixCredentialSources(params);
380
- return sources.length > 0 ? { preview: [`Matrix credential JSON can migrate to SQLite (${sources.length} ${sources.length === 1 ? "file" : "files"})`] } : null;
381
- },
382
- async migrateLegacyState(params) {
383
- const changes = [];
384
- const warnings = [];
385
- const sources = await collectLegacyMatrixCredentialSources(params);
386
- const store = params.context.openPluginStateKeyedStore({
387
- namespace: MATRIX_CREDENTIALS_NAMESPACE,
388
- maxEntries: 256,
389
- overflowPolicy: "reject-new"
390
- });
391
- for (const source of sources) {
392
- if (!source.accountId) {
393
- warnings.push(`Left ambiguous Matrix credential legacy source in place because no default account is selected: ${source.filePath}`);
394
- continue;
395
- }
396
- const credentials = await readLegacyMatrixCredentials(source);
397
- if (!credentials) {
398
- warnings.push(`Left invalid Matrix credential legacy source in place: ${source.filePath}`);
399
- continue;
400
- }
401
- const key = matrixCredentialsStoreKey(source.accountId);
402
- const stored = await store.lookup(key);
403
- if (isMatrixCredentialRevocation(stored, source.accountId)) {
404
- changes.push(`Archived revoked Matrix credential legacy source for account ${source.accountId}`);
405
- await archiveLegacyStateSource({
406
- filePath: source.filePath,
407
- label: "Matrix credentials",
408
- changes,
409
- warnings
410
- });
411
- continue;
412
- }
413
- const existing = normalizeMatrixStoredCredentials(stored, source.accountId);
414
- if (existing && JSON.stringify(existing) !== JSON.stringify(credentials)) {
415
- warnings.push(`Kept existing Matrix credentials for account ${source.accountId}; left differing legacy source in place`);
416
- continue;
417
- }
418
- if (!existing) try {
419
- await store.registerIfAbsent(key, credentials);
420
- } catch (error) {
421
- warnings.push(`Failed importing Matrix credentials for account ${source.accountId}: ${String(error)}; left legacy source in place`);
422
- continue;
423
- }
424
- const persisted = normalizeMatrixStoredCredentials(await store.lookup(key), source.accountId);
425
- if (!persisted || JSON.stringify(persisted) !== JSON.stringify(credentials)) {
426
- warnings.push(`Failed verifying Matrix credentials for account ${source.accountId}; left legacy source in place`);
427
- continue;
428
- }
429
- changes.push(`Migrated Matrix credentials for account ${source.accountId} to SQLite`);
430
- await archiveLegacyStateSource({
431
- filePath: source.filePath,
432
- label: "Matrix credentials",
433
- changes,
434
- warnings
435
- });
436
- }
437
- return {
438
- changes,
439
- warnings
440
- };
441
- }
442
- },
443
- {
444
- id: "matrix-inbound-dedupe-to-claimable-dedupe",
445
- label: "Matrix inbound dedupe markers",
446
- async detectLegacyState(params) {
447
- const io = {
448
- context: params.context,
449
- env: params.env
450
- };
451
- const preview = [];
452
- const sources = await collectMatrixInboundDedupeSources(params.stateDir);
453
- for (const storageRootDir of sources.sqliteRoots) {
454
- try {
455
- if ((await readLegacyInboundDedupeSqliteSource(io, storageRootDir)).legacyRowCount === 0) continue;
456
- } catch {
457
- continue;
458
- }
459
- preview.push(`Matrix inbound dedupe rows can migrate to the claimable dedupe store: ${storageRootDir}`);
460
- }
461
- for (const storageRootDir of sources.jsonRoots) preview.push(`Matrix inbound dedupe JSON can migrate to the claimable dedupe store: ${path.join(storageRootDir, MATRIX_LEGACY_INBOUND_DEDUPE_FILENAME)}`);
462
- return preview.length > 0 ? { preview } : null;
463
- },
464
- async migrateLegacyState(params) {
465
- const io = {
466
- context: params.context,
467
- env: params.env
468
- };
469
- const changes = [];
470
- const warnings = [];
471
- const sources = await collectMatrixInboundDedupeSources(params.stateDir);
472
- const gathered = [];
473
- const sqliteRootsToRetire = [];
474
- for (const storageRootDir of sources.sqliteRoots) try {
475
- const source = await readLegacyInboundDedupeSqliteSource(io, storageRootDir);
476
- if (source.legacyRowCount === 0) continue;
477
- gathered.push(...source.markers);
478
- sqliteRootsToRetire.push(storageRootDir);
479
- } catch (err) {
480
- warnings.push(`Failed reading Matrix inbound dedupe rows for ${storageRootDir}: ${String(err)}; left legacy rows in place`);
481
- }
482
- const jsonRootsToRetire = [];
483
- for (const storageRootDir of sources.jsonRoots) try {
484
- const markers = await readLegacyInboundDedupeJsonSource(storageRootDir);
485
- if (markers === null) warnings.push(`Matrix inbound dedupe JSON for ${storageRootDir} is malformed; archived without import`);
486
- else gathered.push(...markers);
487
- jsonRootsToRetire.push(storageRootDir);
488
- } catch (err) {
489
- warnings.push(`Failed reading Matrix inbound dedupe JSON for ${storageRootDir}: ${String(err)}; left legacy file in place`);
490
- }
491
- if (sqliteRootsToRetire.length + jsonRootsToRetire.length === 0) return {
492
- changes,
493
- warnings
494
- };
495
- try {
496
- const result = await importNewestInboundDedupeMarkers({
497
- io,
498
- markers: gathered
499
- });
500
- changes.push(`Migrated Matrix inbound dedupe markers to the claimable dedupe store (${result.imported} of ${result.total} entries)`);
501
- } catch (err) {
502
- warnings.push(`Failed importing Matrix inbound dedupe markers: ${String(err)}; left legacy sources in place`);
503
- return {
504
- changes,
505
- warnings
506
- };
507
- }
508
- for (const storageRootDir of sqliteRootsToRetire) try {
509
- await retireLegacyInboundDedupeSqliteRows(io, storageRootDir);
510
- changes.push(`Retired Matrix inbound dedupe rows for ${storageRootDir}`);
511
- } catch (err) {
512
- warnings.push(`Failed retiring Matrix inbound dedupe rows for ${storageRootDir}: ${String(err)}`);
513
- }
514
- for (const storageRootDir of jsonRootsToRetire) await archiveLegacyMatrixStateFile({
515
- storageRootDir,
516
- filename: MATRIX_LEGACY_INBOUND_DEDUPE_FILENAME,
517
- label: "Matrix inbound dedupe",
518
- changes,
519
- warnings
520
- });
521
- return {
522
- changes,
523
- warnings
524
- };
525
- }
526
- },
527
73
  {
528
74
  id: "matrix-storage-meta-json-to-plugin-state",
529
75
  label: "Matrix storage metadata",
@@ -538,20 +84,18 @@ const stateMigrations = [
538
84
  async migrateLegacyState(params) {
539
85
  const changes = [];
540
86
  const warnings = [];
541
- const notices = [];
542
87
  for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_STORAGE_META_FILENAME)) {
543
88
  const payload = await readLegacyMatrixStorageMetadata(storageRootDir);
544
89
  if (!payload) continue;
545
90
  const store = params.context.openPluginStateKeyedStore(openMatrixStorageMetaStoreOptions(storageRootDir));
546
91
  if (await hasMatrixStorageMetaStateInStore({ store })) {
92
+ warnings.push(`Skipped Matrix storage metadata import for ${storageRootDir} because SQLite already has metadata`);
547
93
  await archiveLegacyMatrixStateFile({
548
94
  storageRootDir,
549
95
  filename: MATRIX_STORAGE_META_FILENAME,
550
96
  label: "Matrix storage metadata",
551
97
  changes,
552
- warnings,
553
- notices,
554
- notice: `Kept existing Matrix storage metadata in SQLite and archived the legacy source for ${storageRootDir}`
98
+ warnings
555
99
  });
556
100
  continue;
557
101
  }
@@ -570,8 +114,7 @@ const stateMigrations = [
570
114
  }
571
115
  return {
572
116
  changes,
573
- warnings,
574
- ...notices.length > 0 ? { notices } : {}
117
+ warnings
575
118
  };
576
119
  }
577
120
  },
@@ -589,7 +132,6 @@ const stateMigrations = [
589
132
  async migrateLegacyState(params) {
590
133
  const changes = [];
591
134
  const warnings = [];
592
- const notices = [];
593
135
  for (const storageRootDir of await collectLegacySyncCacheRoots(params.stateDir)) {
594
136
  const persisted = await readLegacyMatrixSyncCacheState(storageRootDir);
595
137
  if (!persisted) continue;
@@ -598,12 +140,11 @@ const stateMigrations = [
598
140
  storageRootDir,
599
141
  store
600
142
  })) {
143
+ warnings.push(`Skipped Matrix sync cache import for ${storageRootDir} because SQLite already has sync cache state`);
601
144
  await archiveLegacySyncCache({
602
145
  storageRootDir,
603
146
  changes,
604
- warnings,
605
- notices,
606
- notice: `Kept existing Matrix sync cache in SQLite and archived the legacy source for ${storageRootDir}`
147
+ warnings
607
148
  });
608
149
  continue;
609
150
  }
@@ -621,8 +162,7 @@ const stateMigrations = [
621
162
  }
622
163
  return {
623
164
  changes,
624
- warnings,
625
- ...notices.length > 0 ? { notices } : {}
165
+ warnings
626
166
  };
627
167
  }
628
168
  },
@@ -640,20 +180,18 @@ const stateMigrations = [
640
180
  async migrateLegacyState(params) {
641
181
  const changes = [];
642
182
  const warnings = [];
643
- const notices = [];
644
183
  for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_RECOVERY_KEY_FILENAME)) {
645
184
  const payload = readLegacyMatrixRecoveryKeyState(storageRootDir);
646
185
  if (!payload) continue;
647
186
  const store = params.context.openPluginStateKeyedStore(openMatrixRecoveryKeyStoreOptions(storageRootDir));
648
187
  if (await hasMatrixRecoveryKeyStateInStore({ store })) {
188
+ warnings.push(`Skipped Matrix recovery-key import for ${storageRootDir} because SQLite already has recovery-key state`);
649
189
  await archiveLegacyMatrixStateFile({
650
190
  storageRootDir,
651
191
  filename: MATRIX_RECOVERY_KEY_FILENAME,
652
192
  label: "Matrix recovery key",
653
193
  changes,
654
- warnings,
655
- notices,
656
- notice: `Kept existing Matrix recovery key in SQLite and archived the legacy source for ${storageRootDir}`
194
+ warnings
657
195
  });
658
196
  continue;
659
197
  }
@@ -672,40 +210,85 @@ const stateMigrations = [
672
210
  }
673
211
  return {
674
212
  changes,
675
- warnings,
676
- ...notices.length > 0 ? { notices } : {}
213
+ warnings
214
+ };
215
+ }
216
+ },
217
+ {
218
+ id: "matrix-idb-snapshot-json-to-plugin-state",
219
+ label: "Matrix IndexedDB snapshot",
220
+ async detectLegacyState(params) {
221
+ const previews = [];
222
+ for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_IDB_SNAPSHOT_FILENAME)) {
223
+ if (!await readLegacyMatrixIdbSnapshotState(storageRootDir)) continue;
224
+ previews.push(`Matrix IndexedDB snapshot JSON can migrate to SQLite: ${storageRootDir}`);
225
+ }
226
+ return previews.length > 0 ? { preview: previews } : null;
227
+ },
228
+ async migrateLegacyState(params) {
229
+ const changes = [];
230
+ const warnings = [];
231
+ for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_IDB_SNAPSHOT_FILENAME)) {
232
+ const snapshot = await readLegacyMatrixIdbSnapshotState(storageRootDir);
233
+ if (!snapshot) continue;
234
+ const store = params.context.openPluginStateKeyedStore(openMatrixIdbSnapshotStoreOptions(storageRootDir));
235
+ if (await hasMatrixIdbSnapshotStateInStore({ store })) {
236
+ warnings.push(`Skipped Matrix IndexedDB snapshot import for ${storageRootDir} because SQLite already has snapshot state`);
237
+ await archiveLegacyMatrixStateFile({
238
+ storageRootDir,
239
+ filename: MATRIX_IDB_SNAPSHOT_FILENAME,
240
+ label: "Matrix IndexedDB snapshot",
241
+ changes,
242
+ warnings
243
+ });
244
+ continue;
245
+ }
246
+ await writeMatrixIdbSnapshotJsonToStore({
247
+ snapshotJson: JSON.stringify(snapshot),
248
+ databaseCount: snapshot.length,
249
+ store
250
+ });
251
+ changes.push(`Migrated Matrix IndexedDB snapshot JSON to SQLite for ${storageRootDir}`);
252
+ await archiveLegacyMatrixStateFile({
253
+ storageRootDir,
254
+ filename: MATRIX_IDB_SNAPSHOT_FILENAME,
255
+ label: "Matrix IndexedDB snapshot",
256
+ changes,
257
+ warnings
258
+ });
259
+ }
260
+ return {
261
+ changes,
262
+ warnings
677
263
  };
678
264
  }
679
265
  },
680
266
  {
681
267
  id: "matrix-legacy-crypto-migration-json-to-plugin-state",
682
- label: "Matrix legacy crypto state",
268
+ label: "Matrix legacy crypto migration",
683
269
  async detectLegacyState(params) {
684
270
  const previews = [];
685
- for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME, { includeMatrixRoot: true })) {
271
+ for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME)) {
686
272
  if (!readLegacyMatrixLegacyCryptoMigrationState(storageRootDir)) continue;
687
273
  previews.push(`Matrix legacy crypto migration JSON can migrate to SQLite: ${storageRootDir}`);
688
274
  }
689
- for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_IDB_SNAPSHOT_FILENAME, { includeMatrixRoot: true })) previews.push(`Matrix IndexedDB snapshot JSON can migrate to SQLite: ${storageRootDir}`);
690
275
  return previews.length > 0 ? { preview: previews } : null;
691
276
  },
692
277
  async migrateLegacyState(params) {
693
278
  const changes = [];
694
279
  const warnings = [];
695
- const notices = [];
696
- for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME, { includeMatrixRoot: true })) {
280
+ for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME)) {
697
281
  const state = readLegacyMatrixLegacyCryptoMigrationState(storageRootDir);
698
282
  if (!state) continue;
699
283
  const store = params.context.openPluginStateKeyedStore(openMatrixLegacyCryptoMigrationStoreOptions(storageRootDir));
700
284
  if (await hasMatrixLegacyCryptoMigrationStateInStore({ store })) {
285
+ warnings.push(`Skipped Matrix legacy crypto migration import for ${storageRootDir} because SQLite already has migration state`);
701
286
  await archiveLegacyMatrixStateFile({
702
287
  storageRootDir,
703
288
  filename: MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME,
704
289
  label: "Matrix legacy crypto migration",
705
290
  changes,
706
- warnings,
707
- notices,
708
- notice: `Kept existing Matrix legacy crypto migration in SQLite and archived the legacy source for ${storageRootDir}`
291
+ warnings
709
292
  });
710
293
  continue;
711
294
  }
@@ -722,17 +305,9 @@ const stateMigrations = [
722
305
  warnings
723
306
  });
724
307
  }
725
- for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_IDB_SNAPSHOT_FILENAME, { includeMatrixRoot: true })) await migrateLegacyMatrixIdbSnapshot({
726
- storageRootDir,
727
- context: params.context,
728
- changes,
729
- notices,
730
- warnings
731
- });
732
308
  return {
733
309
  changes,
734
- warnings,
735
- ...notices.length > 0 ? { notices } : {}
310
+ warnings
736
311
  };
737
312
  }
738
313
  }