@openclaw/matrix 2026.7.2-beta.7 → 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 (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,24 +1,42 @@
1
- import { a as resolveMatrixAccountConfig } from "./account-config-BZWN9tGS.js";
2
- import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
3
- import { i as resolveMatrixAccount } from "./accounts-DfngqebB.js";
4
- import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
5
- import { l as resolveMatrixConfigPath, n as matrixSetupAdapter, u as updateMatrixAccountConfig } from "./setup-core-BVfBv2ai.js";
6
- import { n as withResolvedActionClient } from "./client-6eRENr7k.js";
7
- import { p as resolveMatrixAuthContext } from "./shared-CUMWxcMz.js";
8
- import "./client-Dbso3-0V.js";
9
- import { a as formatZonedTimestamp } from "./runtime-api-D1xI_cvh.js";
10
- import { t as resolveMatrixRoomKeyBackupIssue } from "./backup-health-Dm_YMVFT.js";
11
- import { i as setMatrixSdkLogMode, r as setMatrixSdkConsoleLogging } from "./logging-DV-p52N0.js";
12
- import { n as isOpenClawManagedMatrixDevice, r as summarizeMatrixDeviceHealth } from "./device-health-B4-YXtJR.js";
13
- import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update-CffmyW_4.js";
14
- import { a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, g as runMatrixSelfVerification, h as restoreMatrixRoomKeyBackup, l as getMatrixVerificationSas, m as resetMatrixRoomKeyBackup, n as bootstrapMatrixVerification, p as requestMatrixVerification, r as cancelMatrixVerification, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-DYMQ1QpI.js";
1
+ import { a as resolveMatrixAccountConfig } from "./account-config-BZWN9tGS.mjs";
2
+ import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.mjs";
3
+ import { c as resolveMatrixConfigPath, g as resolveMatrixAccount, l as updateMatrixAccountConfig, n as matrixSetupAdapter } from "./setup-core-bhdcEo7v.mjs";
4
+ import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.mjs";
5
+ import { n as withResolvedActionClient } from "./client-Ct0bUHCo.mjs";
6
+ import { u as resolveMatrixAuthContext } from "./client-DFBQtzCe.mjs";
7
+ import { i as formatZonedTimestamp } from "./runtime-api-CEsWNdil.mjs";
8
+ import { isOpenClawManagedMatrixDevice, summarizeMatrixDeviceHealth } from "./device-health-D4LBxuPq.mjs";
9
+ import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update-DzOL3Wiw.mjs";
10
+ import { a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, g as runMatrixSelfVerification, h as restoreMatrixRoomKeyBackup, l as getMatrixVerificationSas, m as resetMatrixRoomKeyBackup, n as bootstrapMatrixVerification, p as requestMatrixVerification, r as cancelMatrixVerification, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-DeWOtZJr.mjs";
11
+ import { t as resolveMatrixRoomKeyBackupIssue } from "./backup-health-Dm_YMVFT.mjs";
12
+ import { setMatrixSdkConsoleLogging, setMatrixSdkLogMode } from "./logging-CgxQOJJP.mjs";
15
13
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
16
14
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
17
15
  import { parseStrictInteger, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
18
- import { readByteStreamWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
19
- //#region extensions/matrix/src/cli-shared.ts
16
+ //#region extensions/matrix/src/matrix/actions/devices.ts
17
+ async function listMatrixOwnDevices(opts = {}) {
18
+ return await withResolvedActionClient(opts, async (client) => await client.listOwnDevices());
19
+ }
20
+ async function pruneMatrixStaleGatewayDevices(opts = {}) {
21
+ return await withResolvedActionClient(opts, async (client) => {
22
+ const devices = await client.listOwnDevices();
23
+ const staleGatewayDeviceIds = summarizeMatrixDeviceHealth(devices).staleOpenClawDevices.map((device) => device.deviceId);
24
+ return {
25
+ before: devices,
26
+ staleGatewayDeviceIds,
27
+ ...staleGatewayDeviceIds.length > 0 ? await client.deleteOwnDevices(staleGatewayDeviceIds) : {
28
+ currentDeviceId: devices.find((device) => device.current)?.deviceId ?? null,
29
+ deletedDeviceIds: [],
30
+ remainingDevices: devices
31
+ }
32
+ };
33
+ });
34
+ }
35
+ //#endregion
36
+ //#region extensions/matrix/src/cli.ts
20
37
  let matrixCliExitScheduled = false;
21
- const MATRIX_CLI_RECOVERY_KEY_STDIN_MAX_BYTES = 1024 * 1024;
38
+ const loadMatrixActionClientModule = createLazyRuntimeModule(() => import("./client-Ct0bUHCo.mjs").then((n) => n.t));
39
+ const loadMatrixDirectManagementModule = createLazyRuntimeModule(() => import("./send-CGgl0uTn.mjs").then((n) => n.d));
22
40
  function scheduleMatrixCliExit() {
23
41
  if (matrixCliExitScheduled || process.env.VITEST) return;
24
42
  matrixCliExitScheduled = true;
@@ -34,10 +52,9 @@ function markCliFailure() {
34
52
  process.exitCode = 1;
35
53
  }
36
54
  async function readMatrixCliRecoveryKeyFromStdin() {
37
- const recoveryKey = (await readByteStreamWithLimit(process.stdin, {
38
- maxBytes: MATRIX_CLI_RECOVERY_KEY_STDIN_MAX_BYTES,
39
- onOverflow: ({ maxBytes }) => /* @__PURE__ */ new Error(`Matrix recovery key stdin exceeds ${maxBytes} bytes.`)
40
- })).toString("utf8").trim();
55
+ const chunks = [];
56
+ for await (const chunk of process.stdin) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk)));
57
+ const recoveryKey = Buffer.concat(chunks).toString("utf8").trim();
41
58
  if (!recoveryKey) throw new Error("Matrix recovery key was requested from stdin, but stdin was empty.");
42
59
  return recoveryKey;
43
60
  }
@@ -51,18 +68,28 @@ async function requireMatrixCliRecoveryKeyInput(options) {
51
68
  if (!recoveryKey) throw new Error("Matrix recovery key is required. Pass --recovery-key-stdin to read it from stdin.");
52
69
  return recoveryKey;
53
70
  }
71
+ function toErrorMessage(err) {
72
+ return formatMatrixErrorMessage(err);
73
+ }
54
74
  function printJson(payload) {
55
75
  process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
56
76
  }
57
- function printTimestamp(label, value) {
58
- if (!value) return;
77
+ function formatLocalTimestamp(value) {
78
+ if (!value) return null;
59
79
  const parsed = new Date(value);
60
- const formatted = Number.isFinite(parsed.getTime()) ? formatZonedTimestamp(parsed, { displaySeconds: true }) ?? value : value;
61
- console.log(`${label}: ${formatMatrixCliText(formatted)}`);
80
+ if (!Number.isFinite(parsed.getTime())) return value;
81
+ return formatZonedTimestamp(parsed, { displaySeconds: true }) ?? value;
82
+ }
83
+ function printTimestamp(label, value) {
84
+ const formatted = formatLocalTimestamp(value);
85
+ if (formatted) console.log(`${label}: ${formatMatrixCliText(formatted)}`);
62
86
  }
63
87
  function printAccountLabel(accountId) {
64
88
  console.log(`Account: ${formatMatrixCliText(normalizeAccountId(accountId))}`);
65
89
  }
90
+ function resolveMatrixCliAccountId(accountId) {
91
+ return resolveMatrixCliAccountContext(accountId).accountId;
92
+ }
66
93
  function resolveMatrixCliAccountContext(accountId) {
67
94
  const cfg = getMatrixRuntime().config.current();
68
95
  return {
@@ -101,6 +128,19 @@ function formatMatrixCliShellArg(value) {
101
128
  function formatMatrixCliText(value, fallback = "unknown") {
102
129
  return sanitizeMatrixCliText(value ?? fallback);
103
130
  }
131
+ function printMatrixOwnDevices(devices) {
132
+ if (devices.length === 0) {
133
+ console.log("Devices: none");
134
+ return;
135
+ }
136
+ for (const device of devices) {
137
+ const labels = [device.current ? "current" : null, device.displayName].filter((label) => Boolean(label)).map((label) => formatMatrixCliText(label));
138
+ console.log(`- ${formatMatrixCliText(device.deviceId)}${labels.length ? ` (${labels.join(", ")})` : ""}`);
139
+ const lastSeenAt = timestampMsToIsoString(device.lastSeenTs);
140
+ if (lastSeenAt) printTimestamp(" Last seen", lastSeenAt);
141
+ if (device.lastSeenIp) console.log(` Last IP: ${formatMatrixCliText(device.lastSeenIp)}`);
142
+ }
143
+ }
104
144
  function configureCliLogMode(verbose) {
105
145
  setMatrixSdkLogMode(verbose ? "default" : "quiet");
106
146
  setMatrixSdkConsoleLogging(verbose);
@@ -114,6 +154,210 @@ function parseOptionalInt(value, fieldName, opts = {}) {
114
154
  if (opts.min !== void 0 && parsed < opts.min) throw new Error(opts.min === 1 ? `${fieldName} must be a positive integer` : `${fieldName} must be a non-negative integer`);
115
155
  return parsed;
116
156
  }
157
+ async function addMatrixAccount(params) {
158
+ const initialSyncLimit = parseOptionalInt(params.initialSyncLimit, "--initial-sync-limit", { min: 0 });
159
+ const runtime = getMatrixRuntime();
160
+ const cfg = runtime.config.current();
161
+ if (!matrixSetupAdapter.applyAccountConfig) throw new Error("Matrix account setup is unavailable.");
162
+ const input = {
163
+ name: params.name,
164
+ avatarUrl: params.avatarUrl,
165
+ homeserver: params.homeserver,
166
+ dangerouslyAllowPrivateNetwork: params.allowPrivateNetwork,
167
+ proxy: params.proxy,
168
+ userId: params.userId,
169
+ accessToken: params.accessToken,
170
+ password: params.password,
171
+ deviceName: params.deviceName,
172
+ initialSyncLimit,
173
+ useEnv: params.useEnv === true
174
+ };
175
+ const accountId = matrixSetupAdapter.resolveAccountId?.({
176
+ cfg,
177
+ accountId: params.account,
178
+ input
179
+ }) ?? normalizeAccountId(params.account?.trim() || params.name?.trim());
180
+ const validationError = matrixSetupAdapter.validateInput?.({
181
+ cfg,
182
+ accountId,
183
+ input
184
+ });
185
+ if (validationError) throw new Error(validationError);
186
+ let updated = matrixSetupAdapter.applyAccountConfig({
187
+ cfg,
188
+ accountId,
189
+ input
190
+ });
191
+ if (params.enableEncryption === true) updated = updateMatrixAccountConfig(updated, accountId, { encryption: true });
192
+ await runtime.config.replaceConfigFile({
193
+ nextConfig: updated,
194
+ afterWrite: { mode: "auto" }
195
+ });
196
+ const accountConfig = resolveMatrixAccountConfig({
197
+ cfg: updated,
198
+ accountId
199
+ });
200
+ let verificationBootstrap = {
201
+ attempted: false,
202
+ success: false,
203
+ recoveryKeyCreatedAt: null,
204
+ backupVersion: null
205
+ };
206
+ if (accountConfig.encryption === true) {
207
+ const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-DUXBC8X2.mjs");
208
+ verificationBootstrap = await maybeBootstrapNewEncryptedMatrixAccount({
209
+ previousCfg: cfg,
210
+ cfg: updated,
211
+ accountId
212
+ });
213
+ }
214
+ const desiredDisplayName = input.name?.trim();
215
+ const desiredAvatarUrl = input.avatarUrl?.trim();
216
+ let profile = {
217
+ attempted: false,
218
+ displayNameUpdated: false,
219
+ avatarUpdated: false,
220
+ resolvedAvatarUrl: null,
221
+ convertedAvatarFromHttp: false
222
+ };
223
+ if (desiredDisplayName || desiredAvatarUrl) try {
224
+ const synced = await updateMatrixOwnProfile({
225
+ cfg: updated,
226
+ accountId,
227
+ displayName: desiredDisplayName,
228
+ avatarUrl: desiredAvatarUrl
229
+ });
230
+ let resolvedAvatarUrl = synced.resolvedAvatarUrl;
231
+ if (synced.convertedAvatarFromHttp && synced.resolvedAvatarUrl) {
232
+ const latestCfg = runtime.config.current();
233
+ const withAvatar = updateMatrixAccountConfig(latestCfg, accountId, { avatarUrl: synced.resolvedAvatarUrl });
234
+ await runtime.config.replaceConfigFile({
235
+ nextConfig: withAvatar,
236
+ afterWrite: { mode: "auto" }
237
+ });
238
+ resolvedAvatarUrl = synced.resolvedAvatarUrl;
239
+ }
240
+ profile = {
241
+ attempted: true,
242
+ displayNameUpdated: synced.displayNameUpdated,
243
+ avatarUpdated: synced.avatarUpdated,
244
+ resolvedAvatarUrl,
245
+ convertedAvatarFromHttp: synced.convertedAvatarFromHttp
246
+ };
247
+ } catch (err) {
248
+ profile = {
249
+ attempted: true,
250
+ displayNameUpdated: false,
251
+ avatarUpdated: false,
252
+ resolvedAvatarUrl: null,
253
+ convertedAvatarFromHttp: false,
254
+ error: toErrorMessage(err)
255
+ };
256
+ }
257
+ let deviceHealth;
258
+ try {
259
+ const addedDevices = await listMatrixOwnDevices({
260
+ accountId,
261
+ cfg: updated
262
+ });
263
+ deviceHealth = {
264
+ currentDeviceId: addedDevices.find((device) => device.current)?.deviceId ?? null,
265
+ staleOpenClawDeviceIds: addedDevices.filter((device) => !device.current && isOpenClawManagedMatrixDevice(device.displayName)).map((device) => device.deviceId)
266
+ };
267
+ } catch (err) {
268
+ deviceHealth = {
269
+ currentDeviceId: null,
270
+ staleOpenClawDeviceIds: [],
271
+ error: toErrorMessage(err)
272
+ };
273
+ }
274
+ return {
275
+ accountId,
276
+ configPath: resolveMatrixConfigPath(updated, accountId),
277
+ useEnv: input.useEnv === true,
278
+ encryptionEnabled: accountConfig.encryption === true,
279
+ deviceHealth,
280
+ verificationBootstrap,
281
+ profile
282
+ };
283
+ }
284
+ function printDirectRoomCandidate(room) {
285
+ const members = room.joinedMembers === null ? "unavailable" : room.joinedMembers.map((member) => formatMatrixCliText(member)).join(", ") || "none";
286
+ console.log(`- ${formatMatrixCliText(room.roomId)} [${room.source}] strict=${room.strict ? "yes" : "no"} joined=${members}`);
287
+ }
288
+ function printDirectRoomInspection(result) {
289
+ printAccountLabel(result.accountId);
290
+ console.log(`Peer: ${formatMatrixCliText(result.remoteUserId)}`);
291
+ console.log(`Self: ${formatMatrixCliText(result.selfUserId)}`);
292
+ console.log(`Active direct room: ${formatMatrixCliText(result.activeRoomId, "none")}`);
293
+ console.log(`Mapped rooms: ${result.mappedRoomIds.length ? result.mappedRoomIds.map((roomId) => formatMatrixCliText(roomId)).join(", ") : "none"}`);
294
+ console.log(`Discovered strict rooms: ${result.discoveredStrictRoomIds.length ? result.discoveredStrictRoomIds.map((roomId) => formatMatrixCliText(roomId)).join(", ") : "none"}`);
295
+ if (result.mappedRooms.length > 0) {
296
+ console.log("Mapped room details:");
297
+ for (const room of result.mappedRooms) printDirectRoomCandidate(room);
298
+ }
299
+ }
300
+ async function inspectMatrixDirectRoom(params) {
301
+ const cfg = getMatrixRuntime().config.current();
302
+ const [{ withResolvedActionClient }, { inspectMatrixDirectRooms }] = await Promise.all([loadMatrixActionClientModule(), loadMatrixDirectManagementModule()]);
303
+ return await withResolvedActionClient({
304
+ accountId: params.accountId,
305
+ cfg
306
+ }, async (client) => {
307
+ const inspection = await inspectMatrixDirectRooms({
308
+ client,
309
+ remoteUserId: params.userId
310
+ });
311
+ return {
312
+ accountId: params.accountId,
313
+ remoteUserId: inspection.remoteUserId,
314
+ selfUserId: inspection.selfUserId,
315
+ mappedRoomIds: inspection.mappedRoomIds,
316
+ mappedRooms: inspection.mappedRooms.map(toCliDirectRoomCandidate),
317
+ discoveredStrictRoomIds: inspection.discoveredStrictRoomIds,
318
+ activeRoomId: inspection.activeRoomId
319
+ };
320
+ }, "persist");
321
+ }
322
+ async function repairMatrixDirectRoom(params) {
323
+ const cfg = getMatrixRuntime().config.current();
324
+ const account = resolveMatrixAccount({
325
+ cfg,
326
+ accountId: params.accountId
327
+ });
328
+ const [{ withStartedActionClient }, { repairMatrixDirectRooms }] = await Promise.all([loadMatrixActionClientModule(), loadMatrixDirectManagementModule()]);
329
+ return await withStartedActionClient({
330
+ accountId: params.accountId,
331
+ cfg
332
+ }, async (client) => {
333
+ const repaired = await repairMatrixDirectRooms({
334
+ client,
335
+ remoteUserId: params.userId,
336
+ encrypted: account.config.encryption === true
337
+ });
338
+ return {
339
+ accountId: params.accountId,
340
+ remoteUserId: repaired.remoteUserId,
341
+ selfUserId: repaired.selfUserId,
342
+ mappedRoomIds: repaired.mappedRoomIds,
343
+ mappedRooms: repaired.mappedRooms.map(toCliDirectRoomCandidate),
344
+ discoveredStrictRoomIds: repaired.discoveredStrictRoomIds,
345
+ activeRoomId: repaired.activeRoomId,
346
+ encrypted: account.config.encryption === true,
347
+ createdRoomId: repaired.createdRoomId,
348
+ changed: repaired.changed,
349
+ directContentBefore: repaired.directContentBefore,
350
+ directContentAfter: repaired.directContentAfter
351
+ };
352
+ });
353
+ }
354
+ async function setMatrixProfile(params) {
355
+ return await applyMatrixProfileUpdate({
356
+ account: params.account,
357
+ displayName: params.name,
358
+ avatarUrl: params.avatarUrl
359
+ });
360
+ }
117
361
  async function runMatrixCliCommand(config) {
118
362
  configureCliLogMode(config.verbose);
119
363
  try {
@@ -122,7 +366,7 @@ async function runMatrixCliCommand(config) {
122
366
  else config.onText(result, config.verbose);
123
367
  if (config.shouldFail?.(result)) markCliFailure();
124
368
  } catch (err) {
125
- const message = formatMatrixErrorMessage(err);
369
+ const message = toErrorMessage(err);
126
370
  if (config.json) printJson(config.onJsonError ? config.onJsonError(message) : { error: message });
127
371
  else {
128
372
  console.error(`${config.errorPrefix}: ${formatMatrixCliText(message)}`);
@@ -133,75 +377,81 @@ async function runMatrixCliCommand(config) {
133
377
  scheduleMatrixCliExit();
134
378
  }
135
379
  }
136
- function sanitizeMatrixCliText(value) {
137
- let withoutAnsi = "";
138
- for (let index = 0; index < value.length; index++) {
139
- const code = value.charCodeAt(index);
140
- if (code === 155) {
141
- index++;
142
- while (index < value.length && !isAnsiFinalByte(value.charCodeAt(index))) index++;
143
- continue;
144
- }
145
- if (code === 157) {
146
- index++;
147
- while (index < value.length) {
148
- const current = value.charCodeAt(index);
149
- if (current === 7 || current === 156) break;
150
- if (current === 27 && value[index + 1] === "\\") {
151
- index++;
152
- break;
153
- }
154
- index++;
155
- }
156
- continue;
157
- }
158
- if (code === 144 || code === 158 || code === 159) {
159
- index++;
160
- while (index < value.length) {
161
- const current = value.charCodeAt(index);
162
- if (current === 7 || current === 156) break;
163
- if (current === 27 && value[index + 1] === "\\") {
164
- index++;
165
- break;
166
- }
167
- index++;
168
- }
169
- continue;
170
- }
171
- if (code !== 27) {
172
- withoutAnsi += value[index];
173
- continue;
174
- }
175
- const marker = value[index + 1];
176
- if (marker === "[") {
177
- index += 2;
178
- while (index < value.length && !isAnsiFinalByte(value.charCodeAt(index))) index++;
179
- continue;
180
- }
181
- if (marker === "]") {
182
- index += 2;
183
- while (index < value.length) {
184
- const current = value.charCodeAt(index);
185
- if (current === 7) break;
186
- if (current === 27 && value[index + 1] === "\\") {
187
- index++;
188
- break;
189
- }
190
- index++;
191
- }
192
- continue;
193
- }
194
- index++;
195
- }
196
- let sanitized = "";
197
- for (const character of withoutAnsi) if (!isUnsafeMatrixCliTerminalCode(character.charCodeAt(0))) sanitized += character;
198
- return sanitized;
380
+ function isMatrixVerificationSetupComplete(status) {
381
+ return status.encryptionEnabled && status.verified && status.crossSigningVerified && status.signedByOwner && status.serverDeviceKnown === true && resolveMatrixRoomKeyBackupIssue(resolveBackupStatus(status)).code === "ok";
199
382
  }
200
- function isUnsafeMatrixCliTerminalCode(code) {
201
- return code < 32 || code === 127 || code >= 128 && code <= 159 || code >= 8234 && code <= 8238 || code >= 8294 && code <= 8297;
383
+ function buildNoopMatrixVerificationBootstrap(status) {
384
+ return {
385
+ success: true,
386
+ verification: {
387
+ ...status,
388
+ backup: resolveBackupStatus(status),
389
+ serverDeviceKnown: status.serverDeviceKnown ?? null
390
+ },
391
+ crossSigning: {
392
+ userId: status.userId,
393
+ masterKeyPublished: status.crossSigningVerified,
394
+ selfSigningKeyPublished: status.signedByOwner,
395
+ userSigningKeyPublished: status.signedByOwner,
396
+ published: status.crossSigningVerified && status.signedByOwner
397
+ },
398
+ pendingVerifications: status.pendingVerifications,
399
+ cryptoBootstrap: null
400
+ };
202
401
  }
203
- function isAnsiFinalByte(code) {
204
- return code >= 64 && code <= 126;
402
+ async function setupMatrixEncryption(params) {
403
+ const runtime = getMatrixRuntime();
404
+ const { accountId, cfg } = resolveMatrixCliAccountContext(params.account);
405
+ if (!resolveMatrixAccount({
406
+ cfg,
407
+ accountId
408
+ }).configured) throw new Error(`Matrix account "${accountId}" is not configured; run ${formatMatrixCliCommand("account add", accountId)} first.`);
409
+ const encryptionChanged = resolveMatrixAccountConfig({
410
+ cfg,
411
+ accountId
412
+ }).encryption !== true;
413
+ const updated = encryptionChanged ? updateMatrixAccountConfig(cfg, accountId, { encryption: true }) : cfg;
414
+ if (encryptionChanged) await runtime.config.replaceConfigFile({
415
+ nextConfig: updated,
416
+ afterWrite: { mode: "auto" }
417
+ });
418
+ const existingStatus = !encryptionChanged && !params.recoveryKey && params.forceResetCrossSigning !== true ? await getMatrixVerificationStatus({
419
+ accountId,
420
+ cfg: updated,
421
+ readiness: "none"
422
+ }) : null;
423
+ if (existingStatus && isMatrixVerificationSetupComplete(existingStatus)) return {
424
+ accountId,
425
+ configPath: resolveMatrixConfigPath(updated, accountId),
426
+ encryptionChanged,
427
+ bootstrap: buildNoopMatrixVerificationBootstrap(existingStatus),
428
+ status: existingStatus
429
+ };
430
+ const bootstrap = await bootstrapMatrixVerification({
431
+ accountId,
432
+ cfg: updated,
433
+ recoveryKey: params.recoveryKey,
434
+ forceResetCrossSigning: params.forceResetCrossSigning === true
435
+ });
436
+ const status = await getMatrixVerificationStatus({
437
+ accountId,
438
+ cfg: updated
439
+ });
440
+ return {
441
+ accountId,
442
+ configPath: resolveMatrixConfigPath(updated, accountId),
443
+ encryptionChanged,
444
+ bootstrap,
445
+ status
446
+ };
447
+ }
448
+ function toCliDirectRoomCandidate(room) {
449
+ return {
450
+ roomId: room.roomId,
451
+ source: room.source,
452
+ strict: room.strict,
453
+ joinedMembers: room.joinedMembers
454
+ };
205
455
  }
206
456
  function resolveBackupStatus(status) {
207
457
  return {
@@ -243,805 +493,111 @@ function printVerificationTrustDiagnostics(status) {
243
493
  console.log(`Cross-signing verified: ${status.crossSigningVerified ? "yes" : "no"}`);
244
494
  console.log(`Signed by owner: ${status.signedByOwner ? "yes" : "no"}`);
245
495
  }
246
- function formatMatrixCliSasEmoji(emoji) {
247
- return emoji.map(([emojiValue, label]) => `${sanitizeMatrixCliText(emojiValue)} ${sanitizeMatrixCliText(label)}`).join(" | ");
248
- }
249
- function printMatrixVerificationSummary(summary) {
250
- console.log(`Verification id: ${sanitizeMatrixCliText(summary.id)}`);
251
- if (summary.transactionId) console.log(`Transaction id: ${sanitizeMatrixCliText(summary.transactionId)}`);
252
- if (summary.roomId) console.log(`Room id: ${sanitizeMatrixCliText(summary.roomId)}`);
253
- console.log(`Other user: ${sanitizeMatrixCliText(summary.otherUserId)}`);
254
- console.log(`Other device: ${sanitizeMatrixCliText(summary.otherDeviceId ?? "unknown")}`);
255
- console.log(`Self-verification: ${summary.isSelfVerification ? "yes" : "no"}`);
256
- console.log(`Initiated by OpenClaw: ${summary.initiatedByMe ? "yes" : "no"}`);
257
- console.log(`Phase: ${sanitizeMatrixCliText(summary.phaseName)}`);
258
- console.log(`Pending: ${summary.pending ? "yes" : "no"}`);
259
- console.log(`Completed: ${summary.completed ? "yes" : "no"}`);
260
- console.log(`Methods: ${summary.methods.length ? summary.methods.map(sanitizeMatrixCliText).join(", ") : "none"}`);
261
- if (summary.chosenMethod) console.log(`Chosen method: ${sanitizeMatrixCliText(summary.chosenMethod)}`);
262
- if (summary.hasSas && summary.sas?.emoji?.length) console.log(`SAS emoji: ${formatMatrixCliSasEmoji(summary.sas.emoji)}`);
263
- else if (summary.hasSas && summary.sas?.decimal) console.log(`SAS decimals: ${summary.sas.decimal.join(" ")}`);
264
- if (summary.error) console.log(`Verification error: ${sanitizeMatrixCliText(summary.error)}`);
265
- }
266
- function printMatrixVerificationSummaries(summaries) {
267
- if (summaries.length === 0) {
268
- console.log("Verifications: none");
269
- return;
270
- }
271
- summaries.forEach((summary, index) => {
272
- if (index > 0) console.log("");
273
- printMatrixVerificationSummary(summary);
274
- });
275
- }
276
- function printMatrixVerificationSas(sas) {
277
- if (sas.emoji?.length) console.log(`SAS emoji: ${formatMatrixCliSasEmoji(sas.emoji)}`);
278
- else if (sas.decimal) console.log(`SAS decimals: ${sas.decimal.join(" ")}`);
279
- else console.log("SAS: unavailable");
280
- }
281
- function printVerificationGuidance(status, accountId) {
282
- printGuidance(buildVerificationGuidance(status, accountId));
283
- }
284
- function printBackupGuidance(backup, accountId, options = {}) {
285
- printGuidance(buildBackupGuidance(backup, accountId, options));
286
- }
287
- function printBackupSummary(backup) {
288
- const issue = resolveMatrixRoomKeyBackupIssue(backup);
289
- console.log(`Backup: ${issue.summary}`);
290
- if (backup.serverVersion) console.log(`Backup version: ${formatMatrixCliText(backup.serverVersion)}`);
291
- }
292
- function buildVerificationGuidance(status, accountId) {
293
- const backup = resolveBackupStatus(status);
294
- const nextSteps = /* @__PURE__ */ new Set();
295
- if (!status.verified) if (status.recoveryKeyAccepted === true && status.backupUsable === true) {
296
- nextSteps.add(`Recovery key can unlock the room-key backup, but full Matrix identity trust is still incomplete. Run ${formatMatrixCliCommand("verify self", accountId)}, accept the request in another verified Matrix client, and confirm the SAS only if it matches.`);
297
- nextSteps.add(`If you intend to replace the current cross-signing identity, run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify bootstrap --recovery-key-stdin --force-reset-cross-signing", accountId)}.`);
298
- } else nextSteps.add(`Run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify device --recovery-key-stdin", accountId)}. If you do not have the recovery key but still have another verified Matrix client, run ${formatMatrixCliCommand("verify self", accountId)} instead.`);
299
- if (status.serverDeviceKnown === false) nextSteps.add(`This Matrix device is no longer listed on the homeserver. Create a new OpenClaw Matrix device with ${formatMatrixCliCommand("account add --homeserver <url> --user-id <@user:server> --password <password> --device-name OpenClaw-Gateway", accountId)}. If you use token auth, create a fresh Matrix access token in your Matrix client or admin UI, then run ${formatMatrixCliCommand("account add --homeserver <url> --access-token <token>", accountId)}.`);
300
- for (const step of buildBackupGuidance(backup, accountId, { recoveryKeyStored: status.recoveryKeyStored })) nextSteps.add(step);
301
- if (status.pendingVerifications > 0) nextSteps.add(`Review pending verification requests with ${formatMatrixCliCommand("verify list", accountId)}. Complete each active request with ${formatMatrixCliCommand("verify sas <id>", accountId)} and ${formatMatrixCliCommand("verify confirm-sas <id>", accountId)}, or cancel stale requests with ${formatMatrixCliCommand("verify cancel <id>", accountId)}.`);
302
- return Array.from(nextSteps);
303
- }
304
- function buildBackupGuidance(backup, accountId, options = {}) {
305
- const backupIssue = resolveMatrixRoomKeyBackupIssue(backup);
306
- const nextSteps = /* @__PURE__ */ new Set();
307
- if (backupIssue.code === "missing-server-backup") nextSteps.add(`Run ${formatMatrixCliCommand("verify bootstrap", accountId)} to create a room key backup.`);
308
- else if (backupIssue.code === "key-load-failed" || backupIssue.code === "key-not-loaded" || backupIssue.code === "inactive") if (options.recoveryKeyStored) nextSteps.add(`Backup key is not loaded on this device. Run ${formatMatrixCliCommand("verify backup restore", accountId)} to load it and restore old room keys. If restore still cannot load the key, run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify backup restore --recovery-key-stdin", accountId)}.`);
309
- else nextSteps.add(`Run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify backup restore --recovery-key-stdin", accountId)} to load the server backup and store the key for future restores.`);
310
- else if (backupIssue.code === "key-mismatch") {
311
- nextSteps.add(`Backup key mismatch on this device. Run the shown printf pipeline with the active server backup recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify backup restore --recovery-key-stdin", accountId)}.`);
312
- nextSteps.add(`If you want a fresh backup baseline and accept losing unrecoverable history, run ${formatMatrixCliCommand("verify backup reset --yes", accountId)}. Add --rotate-recovery-key only when the old recovery key should stop unlocking the fresh backup.`);
313
- } else if (backupIssue.code === "untrusted-signature") {
314
- nextSteps.add(`Backup trust chain is not verified on this device. Run the shown printf pipeline with the correct recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify device --recovery-key-stdin", accountId)}.`);
315
- nextSteps.add(`If device identity trust remains incomplete after that, run ${formatMatrixCliCommand("verify self", accountId)} from another verified Matrix client.`);
316
- nextSteps.add(`If you want a fresh backup baseline and accept losing unrecoverable history, run ${formatMatrixCliCommand("verify backup reset --yes", accountId)}. Add --rotate-recovery-key only when the old recovery key should stop unlocking the fresh backup.`);
317
- } else if (backupIssue.code === "indeterminate") nextSteps.add(`Run ${formatMatrixCliCommand("verify status --verbose", accountId)} to inspect backup trust diagnostics.`);
318
- return Array.from(nextSteps);
319
- }
320
- function printGuidance(lines) {
321
- if (lines.length === 0) return;
322
- console.log("Next steps:");
323
- for (const line of lines) console.log(`- ${line}`);
324
- }
325
- function printVerificationStatus(status, verbose = false, accountId) {
326
- console.log(`Verified by owner: ${status.verified ? "yes" : "no"}`);
327
- if (status.serverDeviceKnown === false) console.log("Device issue: current Matrix device is missing from the homeserver device list");
328
- const backupIssue = resolveMatrixRoomKeyBackupIssue(resolveBackupStatus(status));
329
- printVerificationBackupSummary(status);
330
- if (backupIssue.message) console.log(`Backup issue: ${backupIssue.message}`);
331
- if (verbose) {
332
- console.log("Diagnostics:");
333
- printVerificationIdentity(status);
334
- if (status.serverDeviceKnown !== void 0) console.log(`Device present on server: ${yesNoUnknown(status.serverDeviceKnown ?? null)}`);
335
- printVerificationTrustDiagnostics(status);
336
- printVerificationBackupStatus(status);
337
- console.log(`Recovery key stored: ${status.recoveryKeyStored ? "yes" : "no"}`);
338
- printTimestamp("Recovery key created at", status.recoveryKeyCreatedAt);
339
- console.log(`Pending verifications: ${status.pendingVerifications}`);
340
- } else console.log(`Recovery key stored: ${status.recoveryKeyStored ? "yes" : "no"}`);
341
- printVerificationGuidance(status, accountId);
342
- }
343
- //#endregion
344
- //#region extensions/matrix/src/matrix/actions/devices.ts
345
- async function listMatrixOwnDevices(opts = {}) {
346
- return await withResolvedActionClient(opts, async (client) => await client.listOwnDevices());
347
- }
348
- async function pruneMatrixStaleGatewayDevices(opts = {}) {
349
- return await withResolvedActionClient(opts, async (client) => {
350
- const devices = await client.listOwnDevices();
351
- const staleGatewayDeviceIds = summarizeMatrixDeviceHealth(devices).staleOpenClawDevices.map((device) => device.deviceId);
352
- return {
353
- before: devices,
354
- staleGatewayDeviceIds,
355
- ...staleGatewayDeviceIds.length > 0 ? await client.deleteOwnDevices(staleGatewayDeviceIds) : {
356
- currentDeviceId: devices.find((device) => device.current)?.deviceId ?? null,
357
- deletedDeviceIds: [],
358
- remainingDevices: devices
496
+ function sanitizeMatrixCliText(value) {
497
+ let withoutAnsi = "";
498
+ for (let index = 0; index < value.length; index++) {
499
+ const code = value.charCodeAt(index);
500
+ if (code === 155) {
501
+ index++;
502
+ while (index < value.length && !isAnsiFinalByte(value.charCodeAt(index))) index++;
503
+ continue;
504
+ }
505
+ if (code === 157) {
506
+ index++;
507
+ while (index < value.length) {
508
+ const current = value.charCodeAt(index);
509
+ if (current === 7 || current === 156) break;
510
+ if (current === 27 && value[index + 1] === "\\") {
511
+ index++;
512
+ break;
513
+ }
514
+ index++;
359
515
  }
360
- };
361
- });
362
- }
363
- //#endregion
364
- //#region extensions/matrix/src/cli-account.ts
365
- async function addMatrixAccount(params) {
366
- const initialSyncLimit = parseOptionalInt(params.initialSyncLimit, "--initial-sync-limit", { min: 0 });
367
- const runtime = getMatrixRuntime();
368
- const cfg = runtime.config.current();
369
- if (!matrixSetupAdapter.applyAccountConfig) throw new Error("Matrix account setup is unavailable.");
370
- const input = {
371
- name: params.name,
372
- avatarUrl: params.avatarUrl,
373
- homeserver: params.homeserver,
374
- dangerouslyAllowPrivateNetwork: params.allowPrivateNetwork,
375
- proxy: params.proxy,
376
- userId: params.userId,
377
- accessToken: params.accessToken,
378
- password: params.password,
379
- deviceName: params.deviceName,
380
- initialSyncLimit,
381
- useEnv: params.useEnv === true
382
- };
383
- const accountId = matrixSetupAdapter.resolveAccountId?.({
384
- cfg,
385
- accountId: params.account,
386
- input
387
- }) ?? normalizeAccountId(params.account?.trim() || params.name?.trim());
388
- const validationError = matrixSetupAdapter.validateInput?.({
389
- cfg,
390
- accountId,
391
- input
392
- });
393
- if (validationError) throw new Error(validationError);
394
- let updated = matrixSetupAdapter.applyAccountConfig({
395
- cfg,
396
- accountId,
397
- input
398
- });
399
- if (params.enableEncryption === true) updated = updateMatrixAccountConfig(updated, accountId, { encryption: true });
400
- await runtime.config.replaceConfigFile({
401
- nextConfig: updated,
402
- afterWrite: { mode: "auto" }
403
- });
404
- const accountConfig = resolveMatrixAccountConfig({
405
- cfg: updated,
406
- accountId
407
- });
408
- let verificationBootstrap = {
409
- attempted: false,
410
- success: false,
411
- recoveryKeyCreatedAt: null,
412
- backupVersion: null
413
- };
414
- if (accountConfig.encryption === true) {
415
- const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-Deleiibz.js");
416
- verificationBootstrap = await maybeBootstrapNewEncryptedMatrixAccount({
417
- previousCfg: cfg,
418
- cfg: updated,
419
- accountId
420
- });
421
- }
422
- const desiredDisplayName = input.name?.trim();
423
- const desiredAvatarUrl = input.avatarUrl?.trim();
424
- let profile = {
425
- attempted: false,
426
- displayNameUpdated: false,
427
- avatarUpdated: false,
428
- resolvedAvatarUrl: null,
429
- convertedAvatarFromHttp: false
430
- };
431
- if (desiredDisplayName || desiredAvatarUrl) try {
432
- const synced = await updateMatrixOwnProfile({
433
- cfg: updated,
434
- accountId,
435
- displayName: desiredDisplayName,
436
- avatarUrl: desiredAvatarUrl
437
- });
438
- let resolvedAvatarUrl = synced.resolvedAvatarUrl;
439
- if (synced.convertedAvatarFromHttp && synced.resolvedAvatarUrl) {
440
- const withAvatar = updateMatrixAccountConfig(runtime.config.current(), accountId, { avatarUrl: synced.resolvedAvatarUrl });
441
- await runtime.config.replaceConfigFile({
442
- nextConfig: withAvatar,
443
- afterWrite: { mode: "auto" }
444
- });
445
- resolvedAvatarUrl = synced.resolvedAvatarUrl;
516
+ continue;
446
517
  }
447
- profile = {
448
- attempted: true,
449
- displayNameUpdated: synced.displayNameUpdated,
450
- avatarUpdated: synced.avatarUpdated,
451
- resolvedAvatarUrl,
452
- convertedAvatarFromHttp: synced.convertedAvatarFromHttp
453
- };
454
- } catch (err) {
455
- profile = {
456
- attempted: true,
457
- displayNameUpdated: false,
458
- avatarUpdated: false,
459
- resolvedAvatarUrl: null,
460
- convertedAvatarFromHttp: false,
461
- error: formatMatrixErrorMessage(err)
462
- };
463
- }
464
- let deviceHealth;
465
- try {
466
- const addedDevices = await listMatrixOwnDevices({
467
- accountId,
468
- cfg: updated
469
- });
470
- deviceHealth = {
471
- currentDeviceId: addedDevices.find((device) => device.current)?.deviceId ?? null,
472
- staleOpenClawDeviceIds: addedDevices.filter((device) => !device.current && isOpenClawManagedMatrixDevice(device.displayName)).map((device) => device.deviceId)
473
- };
474
- } catch (err) {
475
- deviceHealth = {
476
- currentDeviceId: null,
477
- staleOpenClawDeviceIds: [],
478
- error: formatMatrixErrorMessage(err)
479
- };
480
- }
481
- return {
482
- accountId,
483
- configPath: resolveMatrixConfigPath(updated, accountId),
484
- useEnv: input.useEnv === true,
485
- encryptionEnabled: accountConfig.encryption === true,
486
- deviceHealth,
487
- verificationBootstrap,
488
- profile
489
- };
490
- }
491
- function registerMatrixAccountCommands(root) {
492
- root.command("account").description("Manage matrix channel accounts").command("add").description("Add or update a matrix account (wrapper around channel setup)").option("--account <id>", "Account ID (default: normalized --name, else default)").option("--name <name>", "Optional display name for this account").option("--avatar-url <url>", "Optional Matrix avatar URL (mxc:// or http(s) URL)").option("--homeserver <url>", "Matrix homeserver URL").option("--proxy <url>", "Optional HTTP(S) proxy URL for Matrix requests").option("--allow-private-network", "Allow Matrix homeserver traffic to private/internal hosts for this account").option("--user-id <id>", "Matrix user ID").option("--access-token <token>", "Matrix access token").option("--password <password>", "Matrix password").option("--device-name <name>", "Matrix device display name").option("--initial-sync-limit <n>", "Matrix initial sync limit").option("--enable-e2ee", "Enable Matrix end-to-end encryption and bootstrap verification").option("--encryption", "Alias for --enable-e2ee").option("--use-env", "Use MATRIX_* env vars (or MATRIX_<ACCOUNT_ID>_* for non-default accounts)").option("--verbose", "Show setup details").option("--json", "Output as JSON").action(async (options) => {
493
- await runMatrixCliCommand({
494
- verbose: options.verbose === true,
495
- json: options.json === true,
496
- run: async () => await addMatrixAccount({
497
- account: options.account,
498
- name: options.name,
499
- avatarUrl: options.avatarUrl,
500
- homeserver: options.homeserver,
501
- proxy: options.proxy,
502
- allowPrivateNetwork: options.allowPrivateNetwork === true,
503
- userId: options.userId,
504
- accessToken: options.accessToken,
505
- password: options.password,
506
- deviceName: options.deviceName,
507
- initialSyncLimit: options.initialSyncLimit,
508
- enableEncryption: options.enableE2ee === true || options.encryption === true,
509
- useEnv: options.useEnv === true
510
- }),
511
- onText: (result) => {
512
- console.log(`Saved matrix account: ${formatMatrixCliText(result.accountId)}`);
513
- console.log(`Config path: ${formatMatrixCliText(result.configPath)}`);
514
- console.log(`Credentials source: ${result.useEnv ? "MATRIX_* / MATRIX_<ACCOUNT_ID>_* env vars" : "inline config"}`);
515
- console.log(`Encryption: ${result.encryptionEnabled ? "enabled" : "disabled"}`);
516
- if (result.verificationBootstrap.attempted) if (result.verificationBootstrap.success) {
517
- console.log("Matrix verification bootstrap: complete");
518
- printTimestamp("Recovery key created at", result.verificationBootstrap.recoveryKeyCreatedAt);
519
- if (result.verificationBootstrap.backupVersion) console.log(`Backup version: ${formatMatrixCliText(result.verificationBootstrap.backupVersion)}`);
520
- } else console.error(`Matrix verification bootstrap warning: ${formatMatrixCliText(result.verificationBootstrap.error)}`);
521
- if (result.deviceHealth.error) console.error(`Matrix device health warning: ${formatMatrixCliText(result.deviceHealth.error)}`);
522
- else if (result.deviceHealth.staleOpenClawDeviceIds.length > 0) {
523
- const staleDeviceIds = result.deviceHealth.staleOpenClawDeviceIds.map((deviceId) => formatMatrixCliText(deviceId)).join(", ");
524
- console.log(`Matrix device hygiene warning: stale OpenClaw devices detected (${staleDeviceIds}). Run ${formatMatrixCliCommand("devices prune-stale", result.accountId)}.`);
525
- }
526
- if (result.profile.attempted) if (result.profile.error) console.error(`Profile sync warning: ${formatMatrixCliText(result.profile.error)}`);
527
- else {
528
- console.log(`Profile sync: name ${result.profile.displayNameUpdated ? "updated" : "unchanged"}, avatar ${result.profile.avatarUpdated ? "updated" : "unchanged"}`);
529
- if (result.profile.convertedAvatarFromHttp && result.profile.resolvedAvatarUrl) console.log(`Avatar converted and saved as: ${formatMatrixCliText(result.profile.resolvedAvatarUrl)}`);
530
- }
531
- const bindHint = `openclaw agents bind --agent <id> --bind matrix:${result.accountId}`;
532
- console.log(`Bind this account to an agent: ${bindHint}`);
533
- },
534
- errorPrefix: "Account setup failed"
535
- });
536
- });
537
- }
538
- //#endregion
539
- //#region extensions/matrix/src/cli-devices.ts
540
- function printMatrixOwnDevices(devices) {
541
- if (devices.length === 0) {
542
- console.log("Devices: none");
543
- return;
544
- }
545
- for (const device of devices) {
546
- const labels = [device.current ? "current" : null, device.displayName].filter((label) => Boolean(label)).map((label) => formatMatrixCliText(label));
547
- console.log(`- ${formatMatrixCliText(device.deviceId)}${labels.length ? ` (${labels.join(", ")})` : ""}`);
548
- const lastSeenAt = timestampMsToIsoString(device.lastSeenTs);
549
- if (lastSeenAt) printTimestamp(" Last seen", lastSeenAt);
550
- if (device.lastSeenIp) console.log(` Last IP: ${formatMatrixCliText(device.lastSeenIp)}`);
551
- }
552
- }
553
- function registerMatrixDeviceCommands(root) {
554
- const devices = root.command("devices").description("Inspect and clean up Matrix devices");
555
- devices.command("list").description("List server-side Matrix devices for this account").option("--account <id>", "Account ID (for multi-account setups)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
556
- const { accountId, cfg } = resolveMatrixCliAccountContext(options.account);
557
- await runMatrixCliCommand({
558
- verbose: options.verbose === true,
559
- json: options.json === true,
560
- run: async () => await listMatrixOwnDevices({
561
- accountId,
562
- cfg
563
- }),
564
- onText: (result) => {
565
- printAccountLabel(accountId);
566
- printMatrixOwnDevices(result);
567
- },
568
- errorPrefix: "Device listing failed"
569
- });
570
- });
571
- devices.command("prune-stale").description("Delete stale OpenClaw-managed devices for this account").option("--account <id>", "Account ID (for multi-account setups)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
572
- const { accountId, cfg } = resolveMatrixCliAccountContext(options.account);
573
- await runMatrixCliCommand({
574
- verbose: options.verbose === true,
575
- json: options.json === true,
576
- run: async () => await pruneMatrixStaleGatewayDevices({
577
- accountId,
578
- cfg
579
- }),
580
- onText: (result, verbose) => {
581
- printAccountLabel(accountId);
582
- console.log(`Deleted stale OpenClaw devices: ${result.deletedDeviceIds.length ? result.deletedDeviceIds.map((deviceId) => formatMatrixCliText(deviceId)).join(", ") : "none"}`);
583
- console.log(`Current device: ${formatMatrixCliText(result.currentDeviceId)}`);
584
- console.log(`Remaining devices: ${result.remainingDevices.length}`);
585
- if (verbose) {
586
- console.log("Devices before cleanup:");
587
- printMatrixOwnDevices(result.before);
588
- console.log("Devices after cleanup:");
589
- printMatrixOwnDevices(result.remainingDevices);
590
- }
591
- },
592
- errorPrefix: "Device cleanup failed"
593
- });
594
- });
595
- }
596
- //#endregion
597
- //#region extensions/matrix/src/cli-direct.ts
598
- const loadMatrixActionClientModule = createLazyRuntimeModule(() => import("./client-6eRENr7k.js").then((n) => n.t));
599
- const loadMatrixDirectManagementModule = createLazyRuntimeModule(() => import("./send-BldGYG8g.js").then((n) => n.l));
600
- function printDirectRoomCandidate(room) {
601
- const members = room.joinedMembers === null ? "unavailable" : room.joinedMembers.map((member) => formatMatrixCliText(member)).join(", ") || "none";
602
- console.log(`- ${formatMatrixCliText(room.roomId)} [${room.source}] strict=${room.strict ? "yes" : "no"} joined=${members}`);
603
- }
604
- function printDirectRoomInspection(result) {
605
- printAccountLabel(result.accountId);
606
- console.log(`Peer: ${formatMatrixCliText(result.remoteUserId)}`);
607
- console.log(`Self: ${formatMatrixCliText(result.selfUserId)}`);
608
- console.log(`Active direct room: ${formatMatrixCliText(result.activeRoomId, "none")}`);
609
- console.log(`Mapped rooms: ${result.mappedRoomIds.length ? result.mappedRoomIds.map((roomId) => formatMatrixCliText(roomId)).join(", ") : "none"}`);
610
- console.log(`Discovered strict rooms: ${result.discoveredStrictRoomIds.length ? result.discoveredStrictRoomIds.map((roomId) => formatMatrixCliText(roomId)).join(", ") : "none"}`);
611
- if (result.mappedRooms.length > 0) {
612
- console.log("Mapped room details:");
613
- for (const room of result.mappedRooms) printDirectRoomCandidate(room);
614
- }
615
- }
616
- async function inspectMatrixDirectRoom(params) {
617
- const cfg = getMatrixRuntime().config.current();
618
- const [{ withResolvedActionClient }, { inspectMatrixDirectRooms }] = await Promise.all([loadMatrixActionClientModule(), loadMatrixDirectManagementModule()]);
619
- return await withResolvedActionClient({
620
- accountId: params.accountId,
621
- cfg
622
- }, async (client) => {
623
- const inspection = await inspectMatrixDirectRooms({
624
- client,
625
- remoteUserId: params.userId
626
- });
627
- return {
628
- accountId: params.accountId,
629
- remoteUserId: inspection.remoteUserId,
630
- selfUserId: inspection.selfUserId,
631
- mappedRoomIds: inspection.mappedRoomIds,
632
- mappedRooms: inspection.mappedRooms.map(toCliDirectRoomCandidate),
633
- discoveredStrictRoomIds: inspection.discoveredStrictRoomIds,
634
- activeRoomId: inspection.activeRoomId
635
- };
636
- }, "persist");
637
- }
638
- async function repairMatrixDirectRoom(params) {
639
- const cfg = getMatrixRuntime().config.current();
640
- const account = resolveMatrixAccount({
641
- cfg,
642
- accountId: params.accountId
643
- });
644
- const [{ withStartedActionClient }, { repairMatrixDirectRooms }] = await Promise.all([loadMatrixActionClientModule(), loadMatrixDirectManagementModule()]);
645
- return await withStartedActionClient({
646
- accountId: params.accountId,
647
- cfg
648
- }, async (client) => {
649
- const repaired = await repairMatrixDirectRooms({
650
- client,
651
- remoteUserId: params.userId,
652
- encrypted: account.config.encryption === true
653
- });
654
- return {
655
- accountId: params.accountId,
656
- remoteUserId: repaired.remoteUserId,
657
- selfUserId: repaired.selfUserId,
658
- mappedRoomIds: repaired.mappedRoomIds,
659
- mappedRooms: repaired.mappedRooms.map(toCliDirectRoomCandidate),
660
- discoveredStrictRoomIds: repaired.discoveredStrictRoomIds,
661
- activeRoomId: repaired.activeRoomId,
662
- encrypted: account.config.encryption === true,
663
- createdRoomId: repaired.createdRoomId,
664
- changed: repaired.changed,
665
- directContentBefore: repaired.directContentBefore,
666
- directContentAfter: repaired.directContentAfter
667
- };
668
- });
669
- }
670
- function toCliDirectRoomCandidate(room) {
671
- return {
672
- roomId: room.roomId,
673
- source: room.source,
674
- strict: room.strict,
675
- joinedMembers: room.joinedMembers
676
- };
677
- }
678
- function registerMatrixDirectCommands(root) {
679
- const direct = root.command("direct").description("Inspect and repair Matrix direct-room state");
680
- direct.command("inspect").description("Inspect direct-room mappings for a Matrix user").requiredOption("--user-id <id>", "Peer Matrix user ID").option("--account <id>", "Account ID (for multi-account setups)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
681
- const accountId = resolveMatrixCliAccountContext(options.account).accountId;
682
- await runMatrixCliCommand({
683
- verbose: options.verbose === true,
684
- json: options.json === true,
685
- run: async () => await inspectMatrixDirectRoom({
686
- accountId,
687
- userId: options.userId
688
- }),
689
- onText: (result) => {
690
- printDirectRoomInspection(result);
691
- },
692
- errorPrefix: "Direct room inspection failed"
693
- });
694
- });
695
- direct.command("repair").description("Repair Matrix direct-room mappings for a Matrix user").requiredOption("--user-id <id>", "Peer Matrix user ID").option("--account <id>", "Account ID (for multi-account setups)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
696
- const accountId = resolveMatrixCliAccountContext(options.account).accountId;
697
- await runMatrixCliCommand({
698
- verbose: options.verbose === true,
699
- json: options.json === true,
700
- run: async () => await repairMatrixDirectRoom({
701
- accountId,
702
- userId: options.userId
703
- }),
704
- onText: (result, verbose) => {
705
- printDirectRoomInspection(result);
706
- console.log(`Encrypted room creation: ${result.encrypted ? "enabled" : "disabled"}`);
707
- console.log(`Created room: ${formatMatrixCliText(result.createdRoomId, "none")}`);
708
- console.log(`m.direct updated: ${result.changed ? "yes" : "no"}`);
709
- if (verbose) {
710
- console.log(`m.direct before: ${formatMatrixCliText(JSON.stringify(result.directContentBefore[result.remoteUserId] ?? []))}`);
711
- console.log(`m.direct after: ${formatMatrixCliText(JSON.stringify(result.directContentAfter[result.remoteUserId] ?? []))}`);
712
- }
713
- },
714
- errorPrefix: "Direct room repair failed"
715
- });
716
- });
717
- }
718
- //#endregion
719
- //#region extensions/matrix/src/cli-encryption.ts
720
- function isMatrixVerificationSetupComplete(status) {
721
- return status.encryptionEnabled && status.verified && status.crossSigningVerified && status.signedByOwner && status.serverDeviceKnown === true && resolveMatrixRoomKeyBackupIssue(resolveBackupStatus(status)).code === "ok";
722
- }
723
- function buildNoopMatrixVerificationBootstrap(status) {
724
- return {
725
- success: true,
726
- verification: {
727
- ...status,
728
- backup: resolveBackupStatus(status),
729
- serverDeviceKnown: status.serverDeviceKnown ?? null
730
- },
731
- crossSigning: {
732
- userId: status.userId,
733
- masterKeyPublished: status.crossSigningVerified,
734
- selfSigningKeyPublished: status.signedByOwner,
735
- userSigningKeyPublished: status.signedByOwner,
736
- published: status.crossSigningVerified && status.signedByOwner
737
- },
738
- pendingVerifications: status.pendingVerifications,
739
- cryptoBootstrap: null
740
- };
741
- }
742
- async function setupMatrixEncryption(params) {
743
- const runtime = getMatrixRuntime();
744
- const { accountId, cfg } = resolveMatrixCliAccountContext(params.account);
745
- if (!resolveMatrixAccount({
746
- cfg,
747
- accountId
748
- }).configured) throw new Error(`Matrix account "${accountId}" is not configured; run ${formatMatrixCliCommand("account add", accountId)} first.`);
749
- const encryptionChanged = resolveMatrixAccountConfig({
750
- cfg,
751
- accountId
752
- }).encryption !== true;
753
- const updated = encryptionChanged ? updateMatrixAccountConfig(cfg, accountId, { encryption: true }) : cfg;
754
- if (encryptionChanged) await runtime.config.replaceConfigFile({
755
- nextConfig: updated,
756
- afterWrite: { mode: "auto" }
757
- });
758
- const existingStatus = !encryptionChanged && !params.recoveryKey && params.forceResetCrossSigning !== true ? await getMatrixVerificationStatus({
759
- accountId,
760
- cfg: updated,
761
- readiness: "none"
762
- }) : null;
763
- if (existingStatus && isMatrixVerificationSetupComplete(existingStatus)) return {
764
- accountId,
765
- configPath: resolveMatrixConfigPath(updated, accountId),
766
- encryptionChanged,
767
- bootstrap: buildNoopMatrixVerificationBootstrap(existingStatus),
768
- status: existingStatus
769
- };
770
- const bootstrap = await bootstrapMatrixVerification({
771
- accountId,
772
- cfg: updated,
773
- recoveryKey: params.recoveryKey,
774
- forceResetCrossSigning: params.forceResetCrossSigning === true
775
- });
776
- const status = await getMatrixVerificationStatus({
777
- accountId,
778
- cfg: updated
779
- });
780
- return {
781
- accountId,
782
- configPath: resolveMatrixConfigPath(updated, accountId),
783
- encryptionChanged,
784
- bootstrap,
785
- status
786
- };
787
- }
788
- function printMatrixEncryptionSetupResult(result, verbose = false) {
789
- printAccountLabel(result.accountId);
790
- console.log(`Encryption config: ${result.encryptionChanged ? "enabled" : "already enabled"} at ${formatMatrixCliText(result.configPath)}`);
791
- console.log(`Bootstrap success: ${result.bootstrap.success ? "yes" : "no"}`);
792
- if (result.bootstrap.error) console.log(`Bootstrap error: ${formatMatrixCliText(result.bootstrap.error)}`);
793
- console.log(`Verified by owner: ${result.status.verified ? "yes" : "no"}`);
794
- printVerificationBackupSummary(result.status);
795
- if (verbose) {
796
- printVerificationIdentity(result.status);
797
- printVerificationTrustDiagnostics(result.status);
798
- printVerificationBackupStatus(result.status);
799
- console.log(`Recovery key stored: ${result.status.recoveryKeyStored ? "yes" : "no"}`);
800
- printTimestamp("Recovery key created at", result.status.recoveryKeyCreatedAt);
801
- console.log(`Pending verifications: ${result.status.pendingVerifications}`);
802
- }
803
- printVerificationGuidance(result.status, result.accountId);
804
- }
805
- function registerMatrixEncryptionCommands(root) {
806
- root.command("encryption").description("Set up Matrix end-to-end encryption").command("setup").description("Enable Matrix E2EE, bootstrap verification, and print next steps").option("--account <id>", "Account ID (for multi-account setups)").option("--recovery-key <key>", "Recovery key to apply before bootstrap (prefer --recovery-key-stdin)").option("--recovery-key-stdin", "Read the Matrix recovery key from stdin").option("--force-reset-cross-signing", "Force reset cross-signing identity before bootstrap (requires active recovery key)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
807
- await runMatrixCliCommand({
808
- verbose: options.verbose === true,
809
- json: options.json === true,
810
- run: async () => await setupMatrixEncryption({
811
- account: options.account,
812
- recoveryKey: await resolveMatrixCliRecoveryKeyInput({
813
- recoveryKey: options.recoveryKey,
814
- recoveryKeyStdin: options.recoveryKeyStdin
815
- }),
816
- forceResetCrossSigning: options.forceResetCrossSigning === true
817
- }),
818
- onText: (result, verbose) => {
819
- printMatrixEncryptionSetupResult(result, verbose);
820
- },
821
- onJson: (result) => ({
822
- success: result.bootstrap.success,
823
- ...result
824
- }),
825
- shouldFail: (result) => !result.bootstrap.success,
826
- errorPrefix: "Encryption setup failed",
827
- onJsonError: (message) => ({
828
- success: false,
829
- error: message
830
- })
831
- });
832
- });
833
- }
834
- //#endregion
835
- //#region extensions/matrix/src/cli-profile.ts
836
- function registerMatrixProfileCommands(root) {
837
- root.command("profile").description("Manage Matrix bot profile").command("set").description("Update Matrix profile display name and/or avatar").option("--account <id>", "Account ID (for multi-account setups)").option("--name <name>", "Profile display name").option("--avatar-url <url>", "Profile avatar URL (mxc:// or http(s) URL)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
838
- await runMatrixCliCommand({
839
- verbose: options.verbose === true,
840
- json: options.json === true,
841
- run: async () => await applyMatrixProfileUpdate({
842
- account: options.account,
843
- displayName: options.name,
844
- avatarUrl: options.avatarUrl
845
- }),
846
- onText: (result) => {
847
- printAccountLabel(result.accountId);
848
- console.log(`Config path: ${result.configPath}`);
849
- console.log(`Profile update: name ${result.profile.displayNameUpdated ? "updated" : "unchanged"}, avatar ${result.profile.avatarUpdated ? "updated" : "unchanged"}`);
850
- if (result.profile.convertedAvatarFromHttp && result.avatarUrl) console.log(`Avatar converted and saved as: ${formatMatrixCliText(result.avatarUrl)}`);
851
- },
852
- errorPrefix: "Profile update failed"
853
- });
854
- });
855
- }
856
- //#endregion
857
- //#region extensions/matrix/src/cli-verification-backup.ts
858
- function registerMatrixVerificationBackupCommands(verify) {
859
- const backup = verify.command("backup").description("Matrix room-key backup health and restore");
860
- backup.command("status").description("Show Matrix room-key backup status for this device").option("--account <id>", "Account ID (for multi-account setups)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
861
- const { accountId, cfg } = resolveMatrixCliAccountContext(options.account);
862
- await runMatrixCliCommand({
863
- verbose: options.verbose === true,
864
- json: options.json === true,
865
- run: async () => await getMatrixRoomKeyBackupStatus({
866
- accountId,
867
- cfg
868
- }),
869
- onText: (status, verbose) => {
870
- printAccountLabel(accountId);
871
- printBackupSummary(status);
872
- if (verbose) printBackupStatus(status);
873
- printBackupGuidance(status, accountId);
874
- },
875
- errorPrefix: "Backup status failed"
876
- });
877
- });
878
- backup.command("reset").description("Delete the current server backup and create a fresh room-key backup baseline, repairing secret storage if needed for a durable reset").option("--account <id>", "Account ID (for multi-account setups)").option("--yes", "Confirm destructive backup reset", false).option("--rotate-recovery-key", "Create a new Matrix recovery key for the fresh backup").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
879
- const { accountId, cfg } = resolveMatrixCliAccountContext(options.account);
880
- await runMatrixCliCommand({
881
- verbose: options.verbose === true,
882
- json: options.json === true,
883
- run: async () => {
884
- if (options.yes !== true) throw new Error(`Refusing to reset Matrix room-key backup without --yes. If you accept losing unrecoverable history, re-run ${formatMatrixCliCommand("verify backup reset --yes", accountId)}.`);
885
- return await resetMatrixRoomKeyBackup({
886
- accountId,
887
- cfg,
888
- rotateRecoveryKey: options.rotateRecoveryKey === true
889
- });
890
- },
891
- onText: (result, verbose) => {
892
- printAccountLabel(accountId);
893
- console.log(`Reset success: ${result.success ? "yes" : "no"}`);
894
- if (result.error) console.log(`Error: ${formatMatrixCliText(result.error)}`);
895
- console.log(`Previous backup version: ${formatMatrixCliText(result.previousVersion, "none")}`);
896
- console.log(`Deleted backup version: ${formatMatrixCliText(result.deletedVersion, "none")}`);
897
- console.log(`Current backup version: ${formatMatrixCliText(result.createdVersion, "none")}`);
898
- printBackupSummary(result.backup);
899
- if (verbose) {
900
- printTimestamp("Reset at", result.resetAt);
901
- printBackupStatus(result.backup);
902
- }
903
- printBackupGuidance(result.backup, accountId);
904
- },
905
- shouldFail: (result) => !result.success,
906
- errorPrefix: "Backup reset failed",
907
- onJsonError: (message) => ({
908
- success: false,
909
- error: message
910
- })
911
- });
912
- });
913
- backup.command("restore").description("Restore encrypted room keys from server backup").option("--account <id>", "Account ID (for multi-account setups)").option("--recovery-key <key>", "Optional recovery key to load before restoring (prefer --recovery-key-stdin)").option("--recovery-key-stdin", "Read the Matrix recovery key from stdin").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
914
- const { accountId, cfg } = resolveMatrixCliAccountContext(options.account);
915
- await runMatrixCliCommand({
916
- verbose: options.verbose === true,
917
- json: options.json === true,
918
- run: async () => await restoreMatrixRoomKeyBackup({
919
- accountId,
920
- cfg,
921
- recoveryKey: await resolveMatrixCliRecoveryKeyInput(options)
922
- }),
923
- onText: (result, verbose) => {
924
- printAccountLabel(accountId);
925
- console.log(`Restore success: ${result.success ? "yes" : "no"}`);
926
- if (result.error) console.log(`Error: ${formatMatrixCliText(result.error)}`);
927
- console.log(`Backup version: ${formatMatrixCliText(result.backupVersion, "none")}`);
928
- console.log(`Imported keys: ${result.imported}/${result.total}`);
929
- printBackupSummary(result.backup);
930
- if (verbose) {
931
- console.log(`Loaded key from secret storage: ${result.loadedFromSecretStorage ? "yes" : "no"}`);
932
- printTimestamp("Restored at", result.restoredAt);
933
- printBackupStatus(result.backup);
934
- }
935
- printBackupGuidance(result.backup, accountId, { recoveryKeyStored: result.loadedFromSecretStorage });
936
- },
937
- shouldFail: (result) => !result.success,
938
- errorPrefix: "Backup restore failed",
939
- onJsonError: (message) => ({
940
- success: false,
941
- error: message
942
- })
943
- });
944
- });
945
- verify.command("bootstrap").description("Bootstrap Matrix cross-signing and device verification state").option("--account <id>", "Account ID (for multi-account setups)").option("--recovery-key <key>", "Recovery key to apply before bootstrap (prefer --recovery-key-stdin)").option("--recovery-key-stdin", "Read the Matrix recovery key from stdin").option("--force-reset-cross-signing", "Force reset cross-signing identity before bootstrap (requires active recovery key)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
946
- const { accountId, cfg } = resolveMatrixCliAccountContext(options.account);
947
- await runMatrixCliCommand({
948
- verbose: options.verbose === true,
949
- json: options.json === true,
950
- run: async () => await bootstrapMatrixVerification({
951
- accountId,
952
- cfg,
953
- recoveryKey: await resolveMatrixCliRecoveryKeyInput(options),
954
- forceResetCrossSigning: options.forceResetCrossSigning === true
955
- }),
956
- onText: (result, verbose) => {
957
- printAccountLabel(accountId);
958
- console.log(`Bootstrap success: ${result.success ? "yes" : "no"}`);
959
- if (result.error) console.log(`Error: ${formatMatrixCliText(result.error)}`);
960
- console.log(`Verified by owner: ${result.verification.verified ? "yes" : "no"}`);
961
- printVerificationIdentity(result.verification);
962
- if (verbose) {
963
- printVerificationTrustDiagnostics(result.verification);
964
- console.log(`Cross-signing published: ${result.crossSigning.published ? "yes" : "no"} (master=${result.crossSigning.masterKeyPublished ? "yes" : "no"}, self=${result.crossSigning.selfSigningKeyPublished ? "yes" : "no"}, user=${result.crossSigning.userSigningKeyPublished ? "yes" : "no"})`);
965
- printVerificationBackupStatus(result.verification);
966
- printTimestamp("Recovery key created at", result.verification.recoveryKeyCreatedAt);
967
- console.log(`Pending verifications: ${result.pendingVerifications}`);
968
- } else {
969
- console.log(`Cross-signing published: ${result.crossSigning.published ? "yes" : "no"}`);
970
- printVerificationBackupSummary(result.verification);
971
- }
972
- printVerificationGuidance({
973
- ...result.verification,
974
- pendingVerifications: result.pendingVerifications
975
- }, accountId);
976
- },
977
- shouldFail: (result) => !result.success,
978
- errorPrefix: "Verification bootstrap failed",
979
- onJsonError: (message) => ({
980
- success: false,
981
- error: message
982
- })
983
- });
984
- });
985
- verify.command("device [key]").description("Verify device using a Matrix recovery key").option("--account <id>", "Account ID (for multi-account setups)").option("--recovery-key-stdin", "Read the Matrix recovery key from stdin").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (key, options) => {
986
- const { accountId, cfg } = resolveMatrixCliAccountContext(options.account);
987
- await runMatrixCliCommand({
988
- verbose: options.verbose === true,
989
- json: options.json === true,
990
- run: async () => await verifyMatrixRecoveryKey(await requireMatrixCliRecoveryKeyInput({
991
- recoveryKey: key,
992
- recoveryKeyStdin: options.recoveryKeyStdin
993
- }), {
994
- accountId,
995
- cfg
996
- }),
997
- onText: (result, verbose) => {
998
- printAccountLabel(accountId);
999
- if (!result.success) {
1000
- console.error(`Verification failed: ${formatMatrixCliText(result.error)}`);
1001
- printVerificationIdentity(result);
1002
- console.log(`Recovery key accepted: ${result.recoveryKeyAccepted ? "yes" : "no"}`);
1003
- console.log(`Backup usable: ${result.backupUsable ? "yes" : "no"}`);
1004
- console.log(`Device verified by owner: ${result.deviceOwnerVerified ? "yes" : "no"}`);
1005
- printVerificationBackupSummary(result);
1006
- if (verbose) {
1007
- printVerificationTrustDiagnostics(result);
1008
- printVerificationBackupStatus(result);
1009
- printTimestamp("Recovery key created at", result.recoveryKeyCreatedAt);
1010
- }
1011
- printVerificationGuidance({
1012
- ...result,
1013
- pendingVerifications: 0
1014
- }, accountId);
1015
- return;
1016
- }
1017
- console.log("Device verification completed successfully.");
1018
- printVerificationIdentity(result);
1019
- console.log(`Recovery key accepted: ${result.recoveryKeyAccepted ? "yes" : "no"}`);
1020
- console.log(`Backup usable: ${result.backupUsable ? "yes" : "no"}`);
1021
- console.log(`Device verified by owner: ${result.deviceOwnerVerified ? "yes" : "no"}`);
1022
- printVerificationBackupSummary(result);
1023
- if (verbose) {
1024
- printVerificationTrustDiagnostics(result);
1025
- printVerificationBackupStatus(result);
1026
- printTimestamp("Recovery key created at", result.recoveryKeyCreatedAt);
1027
- printTimestamp("Verified at", result.verifiedAt);
518
+ if (code === 144 || code === 158 || code === 159) {
519
+ index++;
520
+ while (index < value.length) {
521
+ const current = value.charCodeAt(index);
522
+ if (current === 7 || current === 156) break;
523
+ if (current === 27 && value[index + 1] === "\\") {
524
+ index++;
525
+ break;
1028
526
  }
1029
- printVerificationGuidance({
1030
- ...result,
1031
- pendingVerifications: 0
1032
- }, accountId);
1033
- },
1034
- shouldFail: (result) => !result.success,
1035
- errorPrefix: "Verification failed",
1036
- onJsonError: (message) => ({
1037
- success: false,
1038
- error: message
1039
- })
1040
- });
527
+ index++;
528
+ }
529
+ continue;
530
+ }
531
+ if (code !== 27) {
532
+ withoutAnsi += value[index];
533
+ continue;
534
+ }
535
+ const marker = value[index + 1];
536
+ if (marker === "[") {
537
+ index += 2;
538
+ while (index < value.length && !isAnsiFinalByte(value.charCodeAt(index))) index++;
539
+ continue;
540
+ }
541
+ if (marker === "]") {
542
+ index += 2;
543
+ while (index < value.length) {
544
+ const current = value.charCodeAt(index);
545
+ if (current === 7) break;
546
+ if (current === 27 && value[index + 1] === "\\") {
547
+ index++;
548
+ break;
549
+ }
550
+ index++;
551
+ }
552
+ continue;
553
+ }
554
+ index++;
555
+ }
556
+ let sanitized = "";
557
+ for (const character of withoutAnsi) if (!isUnsafeMatrixCliTerminalCode(character.charCodeAt(0))) sanitized += character;
558
+ return sanitized;
559
+ }
560
+ function isUnsafeMatrixCliTerminalCode(code) {
561
+ return code < 32 || code === 127 || code >= 128 && code <= 159 || code >= 8234 && code <= 8238 || code >= 8294 && code <= 8297;
562
+ }
563
+ function isAnsiFinalByte(code) {
564
+ return code >= 64 && code <= 126;
565
+ }
566
+ function formatMatrixCliSasEmoji(emoji) {
567
+ return emoji.map(([emojiValue, label]) => `${sanitizeMatrixCliText(emojiValue)} ${sanitizeMatrixCliText(label)}`).join(" | ");
568
+ }
569
+ function printMatrixVerificationSummary(summary) {
570
+ console.log(`Verification id: ${sanitizeMatrixCliText(summary.id)}`);
571
+ if (summary.transactionId) console.log(`Transaction id: ${sanitizeMatrixCliText(summary.transactionId)}`);
572
+ if (summary.roomId) console.log(`Room id: ${sanitizeMatrixCliText(summary.roomId)}`);
573
+ console.log(`Other user: ${sanitizeMatrixCliText(summary.otherUserId)}`);
574
+ console.log(`Other device: ${sanitizeMatrixCliText(summary.otherDeviceId ?? "unknown")}`);
575
+ console.log(`Self-verification: ${summary.isSelfVerification ? "yes" : "no"}`);
576
+ console.log(`Initiated by OpenClaw: ${summary.initiatedByMe ? "yes" : "no"}`);
577
+ console.log(`Phase: ${sanitizeMatrixCliText(summary.phaseName)}`);
578
+ console.log(`Pending: ${summary.pending ? "yes" : "no"}`);
579
+ console.log(`Completed: ${summary.completed ? "yes" : "no"}`);
580
+ console.log(`Methods: ${summary.methods.length ? summary.methods.map(sanitizeMatrixCliText).join(", ") : "none"}`);
581
+ if (summary.chosenMethod) console.log(`Chosen method: ${sanitizeMatrixCliText(summary.chosenMethod)}`);
582
+ if (summary.hasSas && summary.sas?.emoji?.length) console.log(`SAS emoji: ${formatMatrixCliSasEmoji(summary.sas.emoji)}`);
583
+ else if (summary.hasSas && summary.sas?.decimal) console.log(`SAS decimals: ${summary.sas.decimal.join(" ")}`);
584
+ if (summary.error) console.log(`Verification error: ${sanitizeMatrixCliText(summary.error)}`);
585
+ }
586
+ function printMatrixVerificationSummaries(summaries) {
587
+ if (summaries.length === 0) {
588
+ console.log("Verifications: none");
589
+ return;
590
+ }
591
+ summaries.forEach((summary, index) => {
592
+ if (index > 0) console.log("");
593
+ printMatrixVerificationSummary(summary);
1041
594
  });
1042
595
  }
1043
- //#endregion
1044
- //#region extensions/matrix/src/cli-verification.ts
596
+ function printMatrixVerificationSas(sas) {
597
+ if (sas.emoji?.length) console.log(`SAS emoji: ${formatMatrixCliSasEmoji(sas.emoji)}`);
598
+ else if (sas.decimal) console.log(`SAS decimals: ${sas.decimal.join(" ")}`);
599
+ else console.log("SAS: unavailable");
600
+ }
1045
601
  function matrixCliVerificationDmLookupOptions(options) {
1046
602
  const lookup = {};
1047
603
  if (options.roomId !== void 0) lookup.verificationDmRoomId = options.roomId;
@@ -1197,8 +753,221 @@ async function runMatrixCliSelfVerificationCommand(options) {
1197
753
  },
1198
754
  errorPrefix: "Self-verification failed"
1199
755
  });
1200
- }
1201
- function registerMatrixVerificationCommands(root) {
756
+ }
757
+ function printVerificationGuidance(status, accountId) {
758
+ printGuidance(buildVerificationGuidance(status, accountId));
759
+ }
760
+ function printBackupGuidance(backup, accountId, options = {}) {
761
+ printGuidance(buildBackupGuidance(backup, accountId, options));
762
+ }
763
+ function printBackupSummary(backup) {
764
+ const issue = resolveMatrixRoomKeyBackupIssue(backup);
765
+ console.log(`Backup: ${issue.summary}`);
766
+ if (backup.serverVersion) console.log(`Backup version: ${formatMatrixCliText(backup.serverVersion)}`);
767
+ }
768
+ function buildVerificationGuidance(status, accountId) {
769
+ const backup = resolveBackupStatus(status);
770
+ const nextSteps = /* @__PURE__ */ new Set();
771
+ if (!status.verified) {
772
+ if (status.recoveryKeyAccepted === true && status.backupUsable === true) {
773
+ nextSteps.add(`Recovery key can unlock the room-key backup, but full Matrix identity trust is still incomplete. Run ${formatMatrixCliCommand("verify self", accountId)}, accept the request in another verified Matrix client, and confirm the SAS only if it matches.`);
774
+ nextSteps.add(`If you intend to replace the current cross-signing identity, run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify bootstrap --recovery-key-stdin --force-reset-cross-signing", accountId)}.`);
775
+ } else nextSteps.add(`Run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify device --recovery-key-stdin", accountId)}. If you do not have the recovery key but still have another verified Matrix client, run ${formatMatrixCliCommand("verify self", accountId)} instead.`);
776
+ }
777
+ if (status.serverDeviceKnown === false) nextSteps.add(`This Matrix device is no longer listed on the homeserver. Create a new OpenClaw Matrix device with ${formatMatrixCliCommand("account add --homeserver <url> --user-id <@user:server> --password <password> --device-name OpenClaw-Gateway", accountId)}. If you use token auth, create a fresh Matrix access token in your Matrix client or admin UI, then run ${formatMatrixCliCommand("account add --homeserver <url> --access-token <token>", accountId)}.`);
778
+ for (const step of buildBackupGuidance(backup, accountId, { recoveryKeyStored: status.recoveryKeyStored })) nextSteps.add(step);
779
+ if (status.pendingVerifications > 0) nextSteps.add(`Review pending verification requests with ${formatMatrixCliCommand("verify list", accountId)}. Complete each active request with ${formatMatrixCliCommand("verify sas <id>", accountId)} and ${formatMatrixCliCommand("verify confirm-sas <id>", accountId)}, or cancel stale requests with ${formatMatrixCliCommand("verify cancel <id>", accountId)}.`);
780
+ return Array.from(nextSteps);
781
+ }
782
+ function buildBackupGuidance(backup, accountId, options = {}) {
783
+ const backupIssue = resolveMatrixRoomKeyBackupIssue(backup);
784
+ const nextSteps = /* @__PURE__ */ new Set();
785
+ if (backupIssue.code === "missing-server-backup") nextSteps.add(`Run ${formatMatrixCliCommand("verify bootstrap", accountId)} to create a room key backup.`);
786
+ else if (backupIssue.code === "key-load-failed" || backupIssue.code === "key-not-loaded" || backupIssue.code === "inactive") {
787
+ if (options.recoveryKeyStored) nextSteps.add(`Backup key is not loaded on this device. Run ${formatMatrixCliCommand("verify backup restore", accountId)} to load it and restore old room keys. If restore still cannot load the key, run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify backup restore --recovery-key-stdin", accountId)}.`);
788
+ else nextSteps.add(`Run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify backup restore --recovery-key-stdin", accountId)} to load the server backup and store the key for future restores.`);
789
+ } else if (backupIssue.code === "key-mismatch") {
790
+ nextSteps.add(`Backup key mismatch on this device. Run the shown printf pipeline with the active server backup recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify backup restore --recovery-key-stdin", accountId)}.`);
791
+ nextSteps.add(`If you want a fresh backup baseline and accept losing unrecoverable history, run ${formatMatrixCliCommand("verify backup reset --yes", accountId)}. Add --rotate-recovery-key only when the old recovery key should stop unlocking the fresh backup.`);
792
+ } else if (backupIssue.code === "untrusted-signature") {
793
+ nextSteps.add(`Backup trust chain is not verified on this device. Run the shown printf pipeline with the correct recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify device --recovery-key-stdin", accountId)}.`);
794
+ nextSteps.add(`If device identity trust remains incomplete after that, run ${formatMatrixCliCommand("verify self", accountId)} from another verified Matrix client.`);
795
+ nextSteps.add(`If you want a fresh backup baseline and accept losing unrecoverable history, run ${formatMatrixCliCommand("verify backup reset --yes", accountId)}. Add --rotate-recovery-key only when the old recovery key should stop unlocking the fresh backup.`);
796
+ } else if (backupIssue.code === "indeterminate") nextSteps.add(`Run ${formatMatrixCliCommand("verify status --verbose", accountId)} to inspect backup trust diagnostics.`);
797
+ return Array.from(nextSteps);
798
+ }
799
+ function printGuidance(lines) {
800
+ if (lines.length === 0) return;
801
+ console.log("Next steps:");
802
+ for (const line of lines) console.log(`- ${line}`);
803
+ }
804
+ function printVerificationStatus(status, verbose = false, accountId) {
805
+ console.log(`Verified by owner: ${status.verified ? "yes" : "no"}`);
806
+ if (status.serverDeviceKnown === false) console.log("Device issue: current Matrix device is missing from the homeserver device list");
807
+ const backup = resolveBackupStatus(status);
808
+ const backupIssue = resolveMatrixRoomKeyBackupIssue(backup);
809
+ printVerificationBackupSummary(status);
810
+ if (backupIssue.message) console.log(`Backup issue: ${backupIssue.message}`);
811
+ if (verbose) {
812
+ console.log("Diagnostics:");
813
+ printVerificationIdentity(status);
814
+ if (status.serverDeviceKnown !== void 0) console.log(`Device present on server: ${yesNoUnknown(status.serverDeviceKnown ?? null)}`);
815
+ printVerificationTrustDiagnostics(status);
816
+ printVerificationBackupStatus(status);
817
+ console.log(`Recovery key stored: ${status.recoveryKeyStored ? "yes" : "no"}`);
818
+ printTimestamp("Recovery key created at", status.recoveryKeyCreatedAt);
819
+ console.log(`Pending verifications: ${status.pendingVerifications}`);
820
+ } else console.log(`Recovery key stored: ${status.recoveryKeyStored ? "yes" : "no"}`);
821
+ printVerificationGuidance(status, accountId);
822
+ }
823
+ function printMatrixEncryptionSetupResult(result, verbose = false) {
824
+ printAccountLabel(result.accountId);
825
+ console.log(`Encryption config: ${result.encryptionChanged ? "enabled" : "already enabled"} at ${formatMatrixCliText(result.configPath)}`);
826
+ console.log(`Bootstrap success: ${result.bootstrap.success ? "yes" : "no"}`);
827
+ if (result.bootstrap.error) console.log(`Bootstrap error: ${formatMatrixCliText(result.bootstrap.error)}`);
828
+ console.log(`Verified by owner: ${result.status.verified ? "yes" : "no"}`);
829
+ printVerificationBackupSummary(result.status);
830
+ if (verbose) {
831
+ printVerificationIdentity(result.status);
832
+ printVerificationTrustDiagnostics(result.status);
833
+ printVerificationBackupStatus(result.status);
834
+ console.log(`Recovery key stored: ${result.status.recoveryKeyStored ? "yes" : "no"}`);
835
+ printTimestamp("Recovery key created at", result.status.recoveryKeyCreatedAt);
836
+ console.log(`Pending verifications: ${result.status.pendingVerifications}`);
837
+ }
838
+ printVerificationGuidance(result.status, result.accountId);
839
+ }
840
+ function registerMatrixCli(params) {
841
+ const root = params.program.command("matrix").description("Matrix channel utilities").addHelpText("after", () => "\nDocs: https://docs.openclaw.ai/channels/matrix\n");
842
+ root.command("account").description("Manage matrix channel accounts").command("add").description("Add or update a matrix account (wrapper around channel setup)").option("--account <id>", "Account ID (default: normalized --name, else default)").option("--name <name>", "Optional display name for this account").option("--avatar-url <url>", "Optional Matrix avatar URL (mxc:// or http(s) URL)").option("--homeserver <url>", "Matrix homeserver URL").option("--proxy <url>", "Optional HTTP(S) proxy URL for Matrix requests").option("--allow-private-network", "Allow Matrix homeserver traffic to private/internal hosts for this account").option("--user-id <id>", "Matrix user ID").option("--access-token <token>", "Matrix access token").option("--password <password>", "Matrix password").option("--device-name <name>", "Matrix device display name").option("--initial-sync-limit <n>", "Matrix initial sync limit").option("--enable-e2ee", "Enable Matrix end-to-end encryption and bootstrap verification").option("--encryption", "Alias for --enable-e2ee").option("--use-env", "Use MATRIX_* env vars (or MATRIX_<ACCOUNT_ID>_* for non-default accounts)").option("--verbose", "Show setup details").option("--json", "Output as JSON").action(async (options) => {
843
+ await runMatrixCliCommand({
844
+ verbose: options.verbose === true,
845
+ json: options.json === true,
846
+ run: async () => await addMatrixAccount({
847
+ account: options.account,
848
+ name: options.name,
849
+ avatarUrl: options.avatarUrl,
850
+ homeserver: options.homeserver,
851
+ proxy: options.proxy,
852
+ allowPrivateNetwork: options.allowPrivateNetwork === true,
853
+ userId: options.userId,
854
+ accessToken: options.accessToken,
855
+ password: options.password,
856
+ deviceName: options.deviceName,
857
+ initialSyncLimit: options.initialSyncLimit,
858
+ enableEncryption: options.enableE2ee === true || options.encryption === true,
859
+ useEnv: options.useEnv === true
860
+ }),
861
+ onText: (result) => {
862
+ console.log(`Saved matrix account: ${formatMatrixCliText(result.accountId)}`);
863
+ console.log(`Config path: ${formatMatrixCliText(result.configPath)}`);
864
+ console.log(`Credentials source: ${result.useEnv ? "MATRIX_* / MATRIX_<ACCOUNT_ID>_* env vars" : "inline config"}`);
865
+ console.log(`Encryption: ${result.encryptionEnabled ? "enabled" : "disabled"}`);
866
+ if (result.verificationBootstrap.attempted) {
867
+ if (result.verificationBootstrap.success) {
868
+ console.log("Matrix verification bootstrap: complete");
869
+ printTimestamp("Recovery key created at", result.verificationBootstrap.recoveryKeyCreatedAt);
870
+ if (result.verificationBootstrap.backupVersion) console.log(`Backup version: ${formatMatrixCliText(result.verificationBootstrap.backupVersion)}`);
871
+ } else console.error(`Matrix verification bootstrap warning: ${formatMatrixCliText(result.verificationBootstrap.error)}`);
872
+ }
873
+ if (result.deviceHealth.error) console.error(`Matrix device health warning: ${formatMatrixCliText(result.deviceHealth.error)}`);
874
+ else if (result.deviceHealth.staleOpenClawDeviceIds.length > 0) {
875
+ const staleDeviceIds = result.deviceHealth.staleOpenClawDeviceIds.map((deviceId) => formatMatrixCliText(deviceId)).join(", ");
876
+ console.log(`Matrix device hygiene warning: stale OpenClaw devices detected (${staleDeviceIds}). Run ${formatMatrixCliCommand("devices prune-stale", result.accountId)}.`);
877
+ }
878
+ if (result.profile.attempted) {
879
+ if (result.profile.error) console.error(`Profile sync warning: ${formatMatrixCliText(result.profile.error)}`);
880
+ else {
881
+ console.log(`Profile sync: name ${result.profile.displayNameUpdated ? "updated" : "unchanged"}, avatar ${result.profile.avatarUpdated ? "updated" : "unchanged"}`);
882
+ if (result.profile.convertedAvatarFromHttp && result.profile.resolvedAvatarUrl) console.log(`Avatar converted and saved as: ${formatMatrixCliText(result.profile.resolvedAvatarUrl)}`);
883
+ }
884
+ }
885
+ const bindHint = `openclaw agents bind --agent <id> --bind matrix:${result.accountId}`;
886
+ console.log(`Bind this account to an agent: ${bindHint}`);
887
+ },
888
+ errorPrefix: "Account setup failed"
889
+ });
890
+ });
891
+ root.command("profile").description("Manage Matrix bot profile").command("set").description("Update Matrix profile display name and/or avatar").option("--account <id>", "Account ID (for multi-account setups)").option("--name <name>", "Profile display name").option("--avatar-url <url>", "Profile avatar URL (mxc:// or http(s) URL)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
892
+ await runMatrixCliCommand({
893
+ verbose: options.verbose === true,
894
+ json: options.json === true,
895
+ run: async () => await setMatrixProfile({
896
+ account: options.account,
897
+ name: options.name,
898
+ avatarUrl: options.avatarUrl
899
+ }),
900
+ onText: (result) => {
901
+ printAccountLabel(result.accountId);
902
+ console.log(`Config path: ${result.configPath}`);
903
+ console.log(`Profile update: name ${result.profile.displayNameUpdated ? "updated" : "unchanged"}, avatar ${result.profile.avatarUpdated ? "updated" : "unchanged"}`);
904
+ if (result.profile.convertedAvatarFromHttp && result.avatarUrl) console.log(`Avatar converted and saved as: ${formatMatrixCliText(result.avatarUrl)}`);
905
+ },
906
+ errorPrefix: "Profile update failed"
907
+ });
908
+ });
909
+ const direct = root.command("direct").description("Inspect and repair Matrix direct-room state");
910
+ direct.command("inspect").description("Inspect direct-room mappings for a Matrix user").requiredOption("--user-id <id>", "Peer Matrix user ID").option("--account <id>", "Account ID (for multi-account setups)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
911
+ const accountId = resolveMatrixCliAccountId(options.account);
912
+ await runMatrixCliCommand({
913
+ verbose: options.verbose === true,
914
+ json: options.json === true,
915
+ run: async () => await inspectMatrixDirectRoom({
916
+ accountId,
917
+ userId: options.userId
918
+ }),
919
+ onText: (result) => {
920
+ printDirectRoomInspection(result);
921
+ },
922
+ errorPrefix: "Direct room inspection failed"
923
+ });
924
+ });
925
+ direct.command("repair").description("Repair Matrix direct-room mappings for a Matrix user").requiredOption("--user-id <id>", "Peer Matrix user ID").option("--account <id>", "Account ID (for multi-account setups)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
926
+ const accountId = resolveMatrixCliAccountId(options.account);
927
+ await runMatrixCliCommand({
928
+ verbose: options.verbose === true,
929
+ json: options.json === true,
930
+ run: async () => await repairMatrixDirectRoom({
931
+ accountId,
932
+ userId: options.userId
933
+ }),
934
+ onText: (result, verbose) => {
935
+ printDirectRoomInspection(result);
936
+ console.log(`Encrypted room creation: ${result.encrypted ? "enabled" : "disabled"}`);
937
+ console.log(`Created room: ${formatMatrixCliText(result.createdRoomId, "none")}`);
938
+ console.log(`m.direct updated: ${result.changed ? "yes" : "no"}`);
939
+ if (verbose) {
940
+ console.log(`m.direct before: ${formatMatrixCliText(JSON.stringify(result.directContentBefore[result.remoteUserId] ?? []))}`);
941
+ console.log(`m.direct after: ${formatMatrixCliText(JSON.stringify(result.directContentAfter[result.remoteUserId] ?? []))}`);
942
+ }
943
+ },
944
+ errorPrefix: "Direct room repair failed"
945
+ });
946
+ });
947
+ root.command("encryption").description("Set up Matrix end-to-end encryption").command("setup").description("Enable Matrix E2EE, bootstrap verification, and print next steps").option("--account <id>", "Account ID (for multi-account setups)").option("--recovery-key <key>", "Recovery key to apply before bootstrap").option("--force-reset-cross-signing", "Force reset cross-signing identity before bootstrap (requires active recovery key)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
948
+ await runMatrixCliCommand({
949
+ verbose: options.verbose === true,
950
+ json: options.json === true,
951
+ run: async () => await setupMatrixEncryption({
952
+ account: options.account,
953
+ recoveryKey: options.recoveryKey,
954
+ forceResetCrossSigning: options.forceResetCrossSigning === true
955
+ }),
956
+ onText: (result, verbose) => {
957
+ printMatrixEncryptionSetupResult(result, verbose);
958
+ },
959
+ onJson: (result) => ({
960
+ success: result.bootstrap.success,
961
+ ...result
962
+ }),
963
+ shouldFail: (result) => !result.bootstrap.success,
964
+ errorPrefix: "Encryption setup failed",
965
+ onJsonError: (message) => ({
966
+ success: false,
967
+ error: message
968
+ })
969
+ });
970
+ });
1202
971
  const verify = root.command("verify").description("Device verification for Matrix E2EE");
1203
972
  verify.command("list").description("List pending Matrix verification requests").option("--account <id>", "Account ID (for multi-account setups)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
1204
973
  const { accountId, cfg } = resolveMatrixCliAccountContext(options.account);
@@ -1349,18 +1118,230 @@ function registerMatrixVerificationCommands(root) {
1349
1118
  errorPrefix: "Error"
1350
1119
  });
1351
1120
  });
1352
- registerMatrixVerificationBackupCommands(verify);
1353
- }
1354
- //#endregion
1355
- //#region extensions/matrix/src/cli.ts
1356
- function registerMatrixCli(params) {
1357
- const root = params.program.command("matrix").description("Matrix channel utilities").addHelpText("after", () => "\nDocs: https://docs.openclaw.ai/channels/matrix\n");
1358
- registerMatrixAccountCommands(root);
1359
- registerMatrixProfileCommands(root);
1360
- registerMatrixDirectCommands(root);
1361
- registerMatrixEncryptionCommands(root);
1362
- registerMatrixVerificationCommands(root);
1363
- registerMatrixDeviceCommands(root);
1121
+ const backup = verify.command("backup").description("Matrix room-key backup health and restore");
1122
+ backup.command("status").description("Show Matrix room-key backup status for this device").option("--account <id>", "Account ID (for multi-account setups)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
1123
+ const { accountId, cfg } = resolveMatrixCliAccountContext(options.account);
1124
+ await runMatrixCliCommand({
1125
+ verbose: options.verbose === true,
1126
+ json: options.json === true,
1127
+ run: async () => await getMatrixRoomKeyBackupStatus({
1128
+ accountId,
1129
+ cfg
1130
+ }),
1131
+ onText: (status, verbose) => {
1132
+ printAccountLabel(accountId);
1133
+ printBackupSummary(status);
1134
+ if (verbose) printBackupStatus(status);
1135
+ printBackupGuidance(status, accountId);
1136
+ },
1137
+ errorPrefix: "Backup status failed"
1138
+ });
1139
+ });
1140
+ backup.command("reset").description("Delete the current server backup and create a fresh room-key backup baseline, repairing secret storage if needed for a durable reset").option("--account <id>", "Account ID (for multi-account setups)").option("--yes", "Confirm destructive backup reset", false).option("--rotate-recovery-key", "Create a new Matrix recovery key for the fresh backup").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
1141
+ const { accountId, cfg } = resolveMatrixCliAccountContext(options.account);
1142
+ await runMatrixCliCommand({
1143
+ verbose: options.verbose === true,
1144
+ json: options.json === true,
1145
+ run: async () => {
1146
+ if (options.yes !== true) throw new Error(`Refusing to reset Matrix room-key backup without --yes. If you accept losing unrecoverable history, re-run ${formatMatrixCliCommand("verify backup reset --yes", accountId)}.`);
1147
+ return await resetMatrixRoomKeyBackup({
1148
+ accountId,
1149
+ cfg,
1150
+ rotateRecoveryKey: options.rotateRecoveryKey === true
1151
+ });
1152
+ },
1153
+ onText: (result, verbose) => {
1154
+ printAccountLabel(accountId);
1155
+ console.log(`Reset success: ${result.success ? "yes" : "no"}`);
1156
+ if (result.error) console.log(`Error: ${formatMatrixCliText(result.error)}`);
1157
+ console.log(`Previous backup version: ${formatMatrixCliText(result.previousVersion, "none")}`);
1158
+ console.log(`Deleted backup version: ${formatMatrixCliText(result.deletedVersion, "none")}`);
1159
+ console.log(`Current backup version: ${formatMatrixCliText(result.createdVersion, "none")}`);
1160
+ printBackupSummary(result.backup);
1161
+ if (verbose) {
1162
+ printTimestamp("Reset at", result.resetAt);
1163
+ printBackupStatus(result.backup);
1164
+ }
1165
+ printBackupGuidance(result.backup, accountId);
1166
+ },
1167
+ shouldFail: (result) => !result.success,
1168
+ errorPrefix: "Backup reset failed",
1169
+ onJsonError: (message) => ({
1170
+ success: false,
1171
+ error: message
1172
+ })
1173
+ });
1174
+ });
1175
+ backup.command("restore").description("Restore encrypted room keys from server backup").option("--account <id>", "Account ID (for multi-account setups)").option("--recovery-key <key>", "Optional recovery key to load before restoring (prefer --recovery-key-stdin)").option("--recovery-key-stdin", "Read the Matrix recovery key from stdin").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
1176
+ const { accountId, cfg } = resolveMatrixCliAccountContext(options.account);
1177
+ await runMatrixCliCommand({
1178
+ verbose: options.verbose === true,
1179
+ json: options.json === true,
1180
+ run: async () => await restoreMatrixRoomKeyBackup({
1181
+ accountId,
1182
+ cfg,
1183
+ recoveryKey: await resolveMatrixCliRecoveryKeyInput(options)
1184
+ }),
1185
+ onText: (result, verbose) => {
1186
+ printAccountLabel(accountId);
1187
+ console.log(`Restore success: ${result.success ? "yes" : "no"}`);
1188
+ if (result.error) console.log(`Error: ${formatMatrixCliText(result.error)}`);
1189
+ console.log(`Backup version: ${formatMatrixCliText(result.backupVersion, "none")}`);
1190
+ console.log(`Imported keys: ${result.imported}/${result.total}`);
1191
+ printBackupSummary(result.backup);
1192
+ if (verbose) {
1193
+ console.log(`Loaded key from secret storage: ${result.loadedFromSecretStorage ? "yes" : "no"}`);
1194
+ printTimestamp("Restored at", result.restoredAt);
1195
+ printBackupStatus(result.backup);
1196
+ }
1197
+ printBackupGuidance(result.backup, accountId, { recoveryKeyStored: result.loadedFromSecretStorage });
1198
+ },
1199
+ shouldFail: (result) => !result.success,
1200
+ errorPrefix: "Backup restore failed",
1201
+ onJsonError: (message) => ({
1202
+ success: false,
1203
+ error: message
1204
+ })
1205
+ });
1206
+ });
1207
+ verify.command("bootstrap").description("Bootstrap Matrix cross-signing and device verification state").option("--account <id>", "Account ID (for multi-account setups)").option("--recovery-key <key>", "Recovery key to apply before bootstrap (prefer --recovery-key-stdin)").option("--recovery-key-stdin", "Read the Matrix recovery key from stdin").option("--force-reset-cross-signing", "Force reset cross-signing identity before bootstrap (requires active recovery key)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
1208
+ const { accountId, cfg } = resolveMatrixCliAccountContext(options.account);
1209
+ await runMatrixCliCommand({
1210
+ verbose: options.verbose === true,
1211
+ json: options.json === true,
1212
+ run: async () => await bootstrapMatrixVerification({
1213
+ accountId,
1214
+ cfg,
1215
+ recoveryKey: await resolveMatrixCliRecoveryKeyInput(options),
1216
+ forceResetCrossSigning: options.forceResetCrossSigning === true
1217
+ }),
1218
+ onText: (result, verbose) => {
1219
+ printAccountLabel(accountId);
1220
+ console.log(`Bootstrap success: ${result.success ? "yes" : "no"}`);
1221
+ if (result.error) console.log(`Error: ${formatMatrixCliText(result.error)}`);
1222
+ console.log(`Verified by owner: ${result.verification.verified ? "yes" : "no"}`);
1223
+ printVerificationIdentity(result.verification);
1224
+ if (verbose) {
1225
+ printVerificationTrustDiagnostics(result.verification);
1226
+ console.log(`Cross-signing published: ${result.crossSigning.published ? "yes" : "no"} (master=${result.crossSigning.masterKeyPublished ? "yes" : "no"}, self=${result.crossSigning.selfSigningKeyPublished ? "yes" : "no"}, user=${result.crossSigning.userSigningKeyPublished ? "yes" : "no"})`);
1227
+ printVerificationBackupStatus(result.verification);
1228
+ printTimestamp("Recovery key created at", result.verification.recoveryKeyCreatedAt);
1229
+ console.log(`Pending verifications: ${result.pendingVerifications}`);
1230
+ } else {
1231
+ console.log(`Cross-signing published: ${result.crossSigning.published ? "yes" : "no"}`);
1232
+ printVerificationBackupSummary(result.verification);
1233
+ }
1234
+ printVerificationGuidance({
1235
+ ...result.verification,
1236
+ pendingVerifications: result.pendingVerifications
1237
+ }, accountId);
1238
+ },
1239
+ shouldFail: (result) => !result.success,
1240
+ errorPrefix: "Verification bootstrap failed",
1241
+ onJsonError: (message) => ({
1242
+ success: false,
1243
+ error: message
1244
+ })
1245
+ });
1246
+ });
1247
+ verify.command("device [key]").description("Verify device using a Matrix recovery key").option("--account <id>", "Account ID (for multi-account setups)").option("--recovery-key-stdin", "Read the Matrix recovery key from stdin").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (key, options) => {
1248
+ const { accountId, cfg } = resolveMatrixCliAccountContext(options.account);
1249
+ await runMatrixCliCommand({
1250
+ verbose: options.verbose === true,
1251
+ json: options.json === true,
1252
+ run: async () => await verifyMatrixRecoveryKey(await requireMatrixCliRecoveryKeyInput({
1253
+ recoveryKey: key,
1254
+ recoveryKeyStdin: options.recoveryKeyStdin
1255
+ }), {
1256
+ accountId,
1257
+ cfg
1258
+ }),
1259
+ onText: (result, verbose) => {
1260
+ printAccountLabel(accountId);
1261
+ if (!result.success) {
1262
+ console.error(`Verification failed: ${formatMatrixCliText(result.error)}`);
1263
+ printVerificationIdentity(result);
1264
+ console.log(`Recovery key accepted: ${result.recoveryKeyAccepted ? "yes" : "no"}`);
1265
+ console.log(`Backup usable: ${result.backupUsable ? "yes" : "no"}`);
1266
+ console.log(`Device verified by owner: ${result.deviceOwnerVerified ? "yes" : "no"}`);
1267
+ printVerificationBackupSummary(result);
1268
+ if (verbose) {
1269
+ printVerificationTrustDiagnostics(result);
1270
+ printVerificationBackupStatus(result);
1271
+ printTimestamp("Recovery key created at", result.recoveryKeyCreatedAt);
1272
+ }
1273
+ printVerificationGuidance({
1274
+ ...result,
1275
+ pendingVerifications: 0
1276
+ }, accountId);
1277
+ return;
1278
+ }
1279
+ console.log("Device verification completed successfully.");
1280
+ printVerificationIdentity(result);
1281
+ console.log(`Recovery key accepted: ${result.recoveryKeyAccepted ? "yes" : "no"}`);
1282
+ console.log(`Backup usable: ${result.backupUsable ? "yes" : "no"}`);
1283
+ console.log(`Device verified by owner: ${result.deviceOwnerVerified ? "yes" : "no"}`);
1284
+ printVerificationBackupSummary(result);
1285
+ if (verbose) {
1286
+ printVerificationTrustDiagnostics(result);
1287
+ printVerificationBackupStatus(result);
1288
+ printTimestamp("Recovery key created at", result.recoveryKeyCreatedAt);
1289
+ printTimestamp("Verified at", result.verifiedAt);
1290
+ }
1291
+ printVerificationGuidance({
1292
+ ...result,
1293
+ pendingVerifications: 0
1294
+ }, accountId);
1295
+ },
1296
+ shouldFail: (result) => !result.success,
1297
+ errorPrefix: "Verification failed",
1298
+ onJsonError: (message) => ({
1299
+ success: false,
1300
+ error: message
1301
+ })
1302
+ });
1303
+ });
1304
+ const devices = root.command("devices").description("Inspect and clean up Matrix devices");
1305
+ devices.command("list").description("List server-side Matrix devices for this account").option("--account <id>", "Account ID (for multi-account setups)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
1306
+ const { accountId, cfg } = resolveMatrixCliAccountContext(options.account);
1307
+ await runMatrixCliCommand({
1308
+ verbose: options.verbose === true,
1309
+ json: options.json === true,
1310
+ run: async () => await listMatrixOwnDevices({
1311
+ accountId,
1312
+ cfg
1313
+ }),
1314
+ onText: (result) => {
1315
+ printAccountLabel(accountId);
1316
+ printMatrixOwnDevices(result);
1317
+ },
1318
+ errorPrefix: "Device listing failed"
1319
+ });
1320
+ });
1321
+ devices.command("prune-stale").description("Delete stale OpenClaw-managed devices for this account").option("--account <id>", "Account ID (for multi-account setups)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
1322
+ const { accountId, cfg } = resolveMatrixCliAccountContext(options.account);
1323
+ await runMatrixCliCommand({
1324
+ verbose: options.verbose === true,
1325
+ json: options.json === true,
1326
+ run: async () => await pruneMatrixStaleGatewayDevices({
1327
+ accountId,
1328
+ cfg
1329
+ }),
1330
+ onText: (result, verbose) => {
1331
+ printAccountLabel(accountId);
1332
+ console.log(`Deleted stale OpenClaw devices: ${result.deletedDeviceIds.length ? result.deletedDeviceIds.map((deviceId) => formatMatrixCliText(deviceId)).join(", ") : "none"}`);
1333
+ console.log(`Current device: ${formatMatrixCliText(result.currentDeviceId)}`);
1334
+ console.log(`Remaining devices: ${result.remainingDevices.length}`);
1335
+ if (verbose) {
1336
+ console.log("Devices before cleanup:");
1337
+ printMatrixOwnDevices(result.before);
1338
+ console.log("Devices after cleanup:");
1339
+ printMatrixOwnDevices(result.remainingDevices);
1340
+ }
1341
+ },
1342
+ errorPrefix: "Device cleanup failed"
1343
+ });
1344
+ });
1364
1345
  }
1365
1346
  //#endregion
1366
1347
  export { registerMatrixCli };