@openclaw/matrix 2026.10.2 → 2026.10.5-beta.2

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 (279) hide show
  1. package/dist/.setup/{account-selection-BDeeqwwR.mjs → account-selection-Bs_jCAaG.mjs} +3 -5
  2. package/dist/.setup/{approval-handler.runtime-QkHLH2az.mjs → approval-handler.runtime-rxLn8CbP.mjs} +60 -83
  3. package/dist/.setup/{channel-CeRXEAEP.mjs → channel-BcwGspPw.mjs} +92 -120
  4. package/dist/.setup/{channel.runtime-DBQA2y1F.mjs → channel.runtime-CUc6rbu1.mjs} +23 -18
  5. package/dist/.setup/{channel.setup-DC2t7_PK.mjs → channel.setup-CwuYD_CT.mjs} +2 -3
  6. package/dist/.setup/{cli-Be8tdNw8.mjs → cli-mbL9jCro.mjs} +80 -120
  7. package/dist/.setup/{cli-metadata-CtcjBFhc.mjs → cli-metadata-6MOGuyHq.mjs} +1 -1
  8. package/dist/.setup/{client-DY3HExqI.mjs → client-BlTvpEWC.mjs} +2 -2
  9. package/dist/.setup/{client-bootstrap-CZvJjr29.mjs → client-bootstrap-D05xy1HB.mjs} +2 -3
  10. package/dist/.setup/{client-support-D7BlioUb.mjs → client-support-D-xHScuo.mjs} +1 -1
  11. package/dist/.setup/{client-kmih04ng.mjs → client-vPPbaxNp.mjs} +14 -24
  12. package/dist/.setup/{create-client-CbJVyFDy.mjs → create-client-CroC4BVc.mjs} +4 -4
  13. package/dist/.setup/{credentials-C2dvc_kB.mjs → credentials-Bf9PQ7xs.mjs} +4 -18
  14. package/dist/.setup/{crypto-runtime-B2AjWo-i.mjs → crypto-runtime-CpJ0b7vY.mjs} +80 -123
  15. package/dist/.setup/{deps-CFNl7tQo.mjs → deps-L_1bUAGL.mjs} +20 -37
  16. package/dist/.setup/{direct-management-DJtQhLKH.mjs → direct-management-B3wYhx_M.mjs} +25 -51
  17. package/dist/.setup/{directory-live-DW5UykLL.mjs → directory-live-B1WbfSHo.mjs} +3 -3
  18. package/dist/.setup/{draft-stream-B87DfA6a.mjs → draft-stream-Bdrh7dRt.mjs} +2 -3
  19. package/dist/.setup/{encryption-guidance-BEjKbiMR.mjs → encryption-guidance-D5_IsDIy.mjs} +1 -1
  20. package/dist/.setup/{env-vars-dGqak9dN.mjs → env-vars-aEBngJPa.mjs} +2 -17
  21. package/dist/.setup/{event-helpers-CspuhE9k.mjs → event-helpers-CxNgMQqH.mjs} +5 -7
  22. package/dist/.setup/{exec-approvals-BLDAMyHs.mjs → exec-approvals-BgNWWJg1.mjs} +6 -12
  23. package/dist/.setup/{file-sync-store-Clc9iEdn.mjs → file-sync-store-BdKx_gMi.mjs} +2 -5
  24. package/dist/.setup/{http-client-DfJY5Ck0.mjs → http-client-ByR4STVQ.mjs} +55 -59
  25. package/dist/.setup/{messages-uCbwLRKS.mjs → messages-B1CZqU8u.mjs} +4 -16
  26. package/dist/.setup/{monitor-skIntQVG.mjs → monitor-Dk_fQL1k.mjs} +176 -232
  27. package/dist/.setup/{onboarding-Cm_tOJxs.mjs → onboarding-CrSexor_.mjs} +33 -50
  28. package/dist/.setup/{outbound-CqQou3ny.mjs → outbound-LR3SqPIq.mjs} +2 -2
  29. package/dist/.setup/{profile-update-C1n8SRqH.mjs → profile-update-C7bjaGR6.mjs} +2 -3
  30. package/dist/.setup/{reaction-events-Cqq46xsG.mjs → reaction-events-CTSvOlXO.mjs} +4 -4
  31. package/dist/.setup/{resolve-targets-DFeU1Ww6.mjs → resolve-targets-BVVbbvP6.mjs} +15 -21
  32. package/dist/.setup/{retired-state-BXUQ2I-C.mjs → retired-state-DW5pLH05.mjs} +22 -3
  33. package/dist/.setup/{room-info-BPMbwe8I.mjs → room-info-9Uqlpt1V.mjs} +4 -4
  34. package/dist/.setup/{sdk-CgQGkCsS.mjs → sdk-Cfc6m7fY.mjs} +115 -195
  35. package/dist/.setup/{secret-contract-JlB6VmI3.mjs → secret-contract-DSBRvhdZ.mjs} +1 -1
  36. package/dist/.setup/{secret-contract-api-B-iJoQEv.mjs → secret-contract-api-DzEJ-X7n.mjs} +1 -1
  37. package/dist/.setup/{send-B1Y2L4wj.mjs → send-LCOuTVc1.mjs} +10 -30
  38. package/dist/.setup/{setup-bootstrap-UNIGyKnk.mjs → setup-bootstrap-CV-hHBXu.mjs} +2 -2
  39. package/dist/.setup/setup-core-CKnNTfgD.mjs +673 -0
  40. package/dist/.setup/{setup-plugin-api-BRs9bcp4.mjs → setup-plugin-api-BDAYk1a5.mjs} +1 -1
  41. package/dist/.setup/{startup-verification-D00eUt74.mjs → startup-verification-CgfUb4yJ.mjs} +3 -3
  42. package/dist/.setup/{storage-D7agewjH.mjs → storage-DkC6bHgA.mjs} +24 -49
  43. package/dist/.setup/{subagent-hooks-D5kd_kzN.mjs → subagent-hooks-D8jyeQsO.mjs} +1 -1
  44. package/dist/.setup/{sync-cache-state-C2z64uyk.mjs → sync-cache-state-D4G-fi3t.mjs} +20 -33
  45. package/dist/.setup/{target-ids-Nwx7cMVE.mjs → target-ids-HhcaKX1n.mjs} +15 -1
  46. package/dist/.setup/{thread-binding-api-DRMC62cs.mjs → thread-binding-api-BvuaKpd0.mjs} +1 -1
  47. package/dist/.setup/{thread-bindings-DveHVZqN.mjs → thread-bindings-CT4P-OSZ.mjs} +38 -58
  48. package/dist/.setup/{thread-bindings-shared-hxKkYC1W.mjs → thread-bindings-shared-CbsFNbAY.mjs} +19 -37
  49. package/dist/.setup/{tool-actions-BqlK2ilM.mjs → tool-actions-DAp6_XSJ.mjs} +17 -18
  50. package/dist/.setup/{verification-kMlFYUn0.mjs → verification-B3VswneT.mjs} +15 -21
  51. package/dist/api.js +7 -7
  52. package/dist/channel-plugin-api.js +1 -1
  53. package/dist/cli-metadata.js +1 -1
  54. package/dist/contract-api.js +2 -2
  55. package/dist/doctor-contract-api.js +13 -22
  56. package/dist/helper-api.js +2 -2
  57. package/dist/index.js +1 -1
  58. package/dist/plugin-entry.handlers.runtime.js +2 -2
  59. package/dist/runtime-api.js +4 -4
  60. package/dist/secret-contract-api.js +1 -1
  61. package/dist/session-binding-contract-api.js +1 -1
  62. package/dist/setup-entry.js +2 -2
  63. package/dist/setup-plugin-api.js +1 -1
  64. package/dist/subagent-hooks-api.js +1 -1
  65. package/dist/thread-binding-api.js +1 -1
  66. package/dist/thread-bindings-runtime.js +1 -1
  67. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/package.json +1 -1
  68. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm.d.ts +129 -129
  69. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.cjs +688 -688
  70. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.js +512 -512
  71. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm +0 -0
  72. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm.d.ts +84 -84
  73. package/node_modules/@openclaw/fs-safe/CHANGELOG.md +35 -0
  74. package/node_modules/@openclaw/fs-safe/README.md +1 -1
  75. package/node_modules/@openclaw/fs-safe/dist/advanced.d.ts +1 -1
  76. package/node_modules/@openclaw/fs-safe/dist/advanced.js +1 -1
  77. package/node_modules/@openclaw/fs-safe/dist/archive-durability.js +1 -1
  78. package/node_modules/@openclaw/fs-safe/dist/archive-merge.js +4 -4
  79. package/node_modules/@openclaw/fs-safe/dist/archive-parser.wasm +0 -0
  80. package/node_modules/@openclaw/fs-safe/dist/archive-read.js +5 -4
  81. package/node_modules/@openclaw/fs-safe/dist/archive-staging.d.ts +1 -1
  82. package/node_modules/@openclaw/fs-safe/dist/archive-staging.js +22 -38
  83. package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.d.ts +17 -0
  84. package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.js +117 -0
  85. package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.d.ts +8 -5
  86. package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.js +27 -50
  87. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.d.ts +3 -0
  88. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.js +57 -11
  89. package/node_modules/@openclaw/fs-safe/dist/guarded-mutation.js +5 -5
  90. package/node_modules/@openclaw/fs-safe/dist/guest-native-python.js +52 -5
  91. package/node_modules/@openclaw/fs-safe/dist/guest.js +1 -1
  92. package/node_modules/@openclaw/fs-safe/dist/native-binding.d.ts +1 -0
  93. package/node_modules/@openclaw/fs-safe/dist/native-operations.d.ts +0 -1
  94. package/node_modules/@openclaw/fs-safe/dist/native-operations.js +22 -26
  95. package/node_modules/@openclaw/fs-safe/dist/native-pinned-write-windows.js +5 -1
  96. package/node_modules/@openclaw/fs-safe/dist/native-staged-file.js +4 -1
  97. package/node_modules/@openclaw/fs-safe/dist/permission-exec.js +2 -1
  98. package/node_modules/@openclaw/fs-safe/dist/pinned-write-types.d.ts +6 -1
  99. package/node_modules/@openclaw/fs-safe/dist/private-temp-workspace.js +2 -2
  100. package/node_modules/@openclaw/fs-safe/dist/publish-file.js +34 -7
  101. package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-fallback.js +1 -4
  102. package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.js +6 -0
  103. package/node_modules/@openclaw/fs-safe/dist/root-create-input.d.ts +15 -1
  104. package/node_modules/@openclaw/fs-safe/dist/root-create-input.js +4 -0
  105. package/node_modules/@openclaw/fs-safe/dist/root-directory-entry.js +1 -1
  106. package/node_modules/@openclaw/fs-safe/dist/root-directory-list.d.ts +0 -1
  107. package/node_modules/@openclaw/fs-safe/dist/root-directory-list.js +6 -12
  108. package/node_modules/@openclaw/fs-safe/dist/root-impl.js +15 -15
  109. package/node_modules/@openclaw/fs-safe/dist/root-paths.js +1 -1
  110. package/node_modules/@openclaw/fs-safe/dist/root-walk.js +4 -4
  111. package/node_modules/@openclaw/fs-safe/dist/root-write-verification.d.ts +10 -1
  112. package/node_modules/@openclaw/fs-safe/dist/root-write-verification.js +20 -0
  113. package/node_modules/@openclaw/fs-safe/dist/secure-temp-dir.js +19 -7
  114. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-acquire.js +25 -3
  115. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-admission.d.ts +2 -0
  116. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.d.ts +14 -0
  117. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.js +187 -0
  118. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock.js +15 -1
  119. package/node_modules/@openclaw/fs-safe/dist/temp-directory-diagnostics.d.ts +10 -0
  120. package/node_modules/@openclaw/fs-safe/dist/temp-directory-diagnostics.js +29 -0
  121. package/node_modules/@openclaw/fs-safe/dist/temp-target.js +1 -1
  122. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-admission.js +6 -6
  123. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.d.ts +4 -4
  124. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.js +17 -16
  125. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-descriptor.js +20 -28
  126. package/node_modules/@openclaw/fs-safe/dist/walk.js +2 -13
  127. package/node_modules/@openclaw/fs-safe/dist/watch-native.d.ts +2 -2
  128. package/node_modules/@openclaw/fs-safe/dist/watch-native.js +3 -1
  129. package/node_modules/@openclaw/fs-safe/dist/watch-rescan.js +3 -9
  130. package/node_modules/@openclaw/fs-safe/dist/watch.js +2 -3
  131. package/node_modules/@openclaw/fs-safe/docs/advanced.md +1 -1
  132. package/node_modules/@openclaw/fs-safe/docs/archive.md +3 -0
  133. package/node_modules/@openclaw/fs-safe/docs/atomic.md +11 -3
  134. package/node_modules/@openclaw/fs-safe/docs/contributing.md +1 -1
  135. package/node_modules/@openclaw/fs-safe/docs/copy.md +48 -0
  136. package/node_modules/@openclaw/fs-safe/docs/guest.md +21 -4
  137. package/node_modules/@openclaw/fs-safe/docs/path-scope.md +4 -0
  138. package/node_modules/@openclaw/fs-safe/docs/sidecar-lock.md +46 -8
  139. package/node_modules/@openclaw/fs-safe/docs/temp.md +12 -0
  140. package/node_modules/@openclaw/fs-safe/docs/watch.md +3 -2
  141. package/node_modules/@openclaw/fs-safe/package.json +15 -15
  142. package/node_modules/@openclaw/fs-safe-darwin-arm64/fs-safe-native.node +0 -0
  143. package/node_modules/@openclaw/fs-safe-darwin-arm64/package.json +1 -1
  144. package/node_modules/@openclaw/fs-safe-darwin-x64/fs-safe-native.node +0 -0
  145. package/node_modules/@openclaw/fs-safe-darwin-x64/package.json +1 -1
  146. package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/fs-safe-native.node +0 -0
  147. package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/package.json +1 -1
  148. package/node_modules/@openclaw/fs-safe-linux-arm64-musl/fs-safe-native.node +0 -0
  149. package/node_modules/@openclaw/fs-safe-linux-arm64-musl/package.json +1 -1
  150. package/node_modules/@openclaw/fs-safe-linux-x64-gnu/fs-safe-native.node +0 -0
  151. package/node_modules/@openclaw/fs-safe-linux-x64-gnu/package.json +1 -1
  152. package/node_modules/@openclaw/fs-safe-linux-x64-musl/fs-safe-native.node +0 -0
  153. package/node_modules/@openclaw/fs-safe-linux-x64-musl/package.json +1 -1
  154. package/node_modules/@openclaw/fs-safe-win32-x64-msvc/fs-safe-native.node +0 -0
  155. package/node_modules/@openclaw/fs-safe-win32-x64-msvc/package.json +1 -1
  156. package/node_modules/matrix-widget-api/lib/interfaces/RtcLivekitActions.d.ts +6 -12
  157. package/node_modules/matrix-widget-api/lib/interfaces/RtcLivekitActions.js.map +1 -1
  158. package/node_modules/matrix-widget-api/package.json +1 -1
  159. package/node_modules/matrix-widget-api/src/interfaces/RtcLivekitActions.ts +6 -13
  160. package/node_modules/music-metadata/README.md +35 -32
  161. package/node_modules/music-metadata/lib/ParserFactory.d.ts +1 -1
  162. package/node_modules/music-metadata/lib/ParserFactory.js +17 -13
  163. package/node_modules/music-metadata/lib/aiff/AiffParser.js +19 -12
  164. package/node_modules/music-metadata/lib/aiff/AiffToken.d.ts +1 -1
  165. package/node_modules/music-metadata/lib/aiff/AiffToken.js +2 -1
  166. package/node_modules/music-metadata/lib/apev2/APEv2Parser.d.ts +4 -3
  167. package/node_modules/music-metadata/lib/apev2/APEv2Parser.js +59 -16
  168. package/node_modules/music-metadata/lib/apev2/APEv2TagMapper.js +1 -0
  169. package/node_modules/music-metadata/lib/apev2/APEv2Token.d.ts +1 -1
  170. package/node_modules/music-metadata/lib/apev2/APEv2Token.js +1 -1
  171. package/node_modules/music-metadata/lib/asf/AsfGuid.js +56 -50
  172. package/node_modules/music-metadata/lib/asf/AsfObject.d.ts +1 -1
  173. package/node_modules/music-metadata/lib/asf/AsfObject.js +3 -2
  174. package/node_modules/music-metadata/lib/asf/AsfParser.js +15 -7
  175. package/node_modules/music-metadata/lib/asf/AsfTagMapper.d.ts +3 -2
  176. package/node_modules/music-metadata/lib/asf/AsfTagMapper.js +21 -4
  177. package/node_modules/music-metadata/lib/common/CaseInsensitiveTagMap.d.ts +1 -1
  178. package/node_modules/music-metadata/lib/common/CombinedTagMapper.d.ts +2 -2
  179. package/node_modules/music-metadata/lib/common/CombinedTagMapper.js +6 -6
  180. package/node_modules/music-metadata/lib/common/FourCC.js +3 -2
  181. package/node_modules/music-metadata/lib/common/GenericTagMapper.d.ts +1 -1
  182. package/node_modules/music-metadata/lib/common/GenericTagTypes.js +1 -1
  183. package/node_modules/music-metadata/lib/common/MetadataCollector.d.ts +3 -1
  184. package/node_modules/music-metadata/lib/common/MetadataCollector.js +28 -9
  185. package/node_modules/music-metadata/lib/common/Util.js +25 -17
  186. package/node_modules/music-metadata/lib/core.d.ts +4 -4
  187. package/node_modules/music-metadata/lib/core.js +18 -11
  188. package/node_modules/music-metadata/lib/dsdiff/DsdiffParser.js +29 -16
  189. package/node_modules/music-metadata/lib/dsf/DsfChunk.d.ts +1 -1
  190. package/node_modules/music-metadata/lib/dsf/DsfParser.js +3 -5
  191. package/node_modules/music-metadata/lib/ebml/EbmlIterator.d.ts +1 -1
  192. package/node_modules/music-metadata/lib/ebml/EbmlIterator.js +35 -6
  193. package/node_modules/music-metadata/lib/ebml/types.d.ts +1 -1
  194. package/node_modules/music-metadata/lib/ebml/types.js +1 -1
  195. package/node_modules/music-metadata/lib/flac/FlacParser.d.ts +1 -1
  196. package/node_modules/music-metadata/lib/flac/FlacParser.js +6 -5
  197. package/node_modules/music-metadata/lib/flac/FlacToken.d.ts +1 -1
  198. package/node_modules/music-metadata/lib/flac/FlacToken.js +1 -1
  199. package/node_modules/music-metadata/lib/id3v1/ID3v1Parser.d.ts +1 -1
  200. package/node_modules/music-metadata/lib/id3v1/ID3v1Parser.js +212 -42
  201. package/node_modules/music-metadata/lib/id3v2/AbstractID3Parser.js +5 -5
  202. package/node_modules/music-metadata/lib/id3v2/FrameHeader.d.ts +1 -1
  203. package/node_modules/music-metadata/lib/id3v2/FrameHeader.js +8 -5
  204. package/node_modules/music-metadata/lib/id3v2/FrameParser.d.ts +2 -1
  205. package/node_modules/music-metadata/lib/id3v2/FrameParser.js +54 -23
  206. package/node_modules/music-metadata/lib/id3v2/ID3v22TagMapper.d.ts +1 -1
  207. package/node_modules/music-metadata/lib/id3v2/ID3v22TagMapper.js +1 -1
  208. package/node_modules/music-metadata/lib/id3v2/ID3v24TagMapper.js +3 -3
  209. package/node_modules/music-metadata/lib/id3v2/ID3v2ChapterToken.js +2 -2
  210. package/node_modules/music-metadata/lib/id3v2/ID3v2Parser.d.ts +1 -1
  211. package/node_modules/music-metadata/lib/id3v2/ID3v2Parser.js +32 -16
  212. package/node_modules/music-metadata/lib/id3v2/ID3v2Token.d.ts +2 -2
  213. package/node_modules/music-metadata/lib/id3v2/ID3v2Token.js +2 -3
  214. package/node_modules/music-metadata/lib/index.js +6 -3
  215. package/node_modules/music-metadata/lib/lrc/LyricsParser.js +3 -5
  216. package/node_modules/music-metadata/lib/matroska/MatroskaDtd.js +7 -3
  217. package/node_modules/music-metadata/lib/matroska/MatroskaParser.js +22 -11
  218. package/node_modules/music-metadata/lib/matroska/types.d.ts +2 -2
  219. package/node_modules/music-metadata/lib/mp4/Atom.d.ts +4 -3
  220. package/node_modules/music-metadata/lib/mp4/Atom.js +44 -11
  221. package/node_modules/music-metadata/lib/mp4/AtomToken.d.ts +1 -1
  222. package/node_modules/music-metadata/lib/mp4/AtomToken.js +30 -8
  223. package/node_modules/music-metadata/lib/mp4/MP4Parser.d.ts +2 -0
  224. package/node_modules/music-metadata/lib/mp4/MP4Parser.js +79 -54
  225. package/node_modules/music-metadata/lib/mp4/MP4TagMapper.d.ts +2 -2
  226. package/node_modules/music-metadata/lib/mpeg/MpegLoader.js +1 -1
  227. package/node_modules/music-metadata/lib/mpeg/MpegParser.js +41 -19
  228. package/node_modules/music-metadata/lib/mpeg/ReplayGainDataFormat.d.ts +2 -2
  229. package/node_modules/music-metadata/lib/mpeg/ReplayGainDataFormat.js +1 -1
  230. package/node_modules/music-metadata/lib/mpeg/XingTag.d.ts +1 -1
  231. package/node_modules/music-metadata/lib/musepack/MusepackParser.js +2 -2
  232. package/node_modules/music-metadata/lib/musepack/sv7/BitReader.js +1 -1
  233. package/node_modules/music-metadata/lib/musepack/sv7/MpcSv7Parser.js +4 -3
  234. package/node_modules/music-metadata/lib/musepack/sv7/StreamVersion7.js +3 -3
  235. package/node_modules/music-metadata/lib/musepack/sv8/MpcSv8Parser.js +7 -5
  236. package/node_modules/music-metadata/lib/musepack/sv8/StreamVersion8.js +2 -2
  237. package/node_modules/music-metadata/lib/ogg/OggParser.js +23 -13
  238. package/node_modules/music-metadata/lib/ogg/OggToken.d.ts +2 -0
  239. package/node_modules/music-metadata/lib/ogg/OggToken.js +1 -1
  240. package/node_modules/music-metadata/lib/ogg/flac/FlacStream.d.ts +2 -2
  241. package/node_modules/music-metadata/lib/ogg/flac/FlacStream.js +2 -2
  242. package/node_modules/music-metadata/lib/ogg/opus/OpusStream.d.ts +2 -2
  243. package/node_modules/music-metadata/lib/ogg/opus/OpusStream.js +8 -4
  244. package/node_modules/music-metadata/lib/ogg/speex/SpeexStream.d.ts +2 -2
  245. package/node_modules/music-metadata/lib/ogg/speex/SpeexStream.js +2 -1
  246. package/node_modules/music-metadata/lib/ogg/theora/TheoraStream.d.ts +2 -2
  247. package/node_modules/music-metadata/lib/ogg/vorbis/Vorbis.d.ts +1 -1
  248. package/node_modules/music-metadata/lib/ogg/vorbis/VorbisDecoder.js +1 -1
  249. package/node_modules/music-metadata/lib/ogg/vorbis/VorbisStream.d.ts +4 -3
  250. package/node_modules/music-metadata/lib/ogg/vorbis/VorbisStream.js +16 -9
  251. package/node_modules/music-metadata/lib/ogg/vorbis/VorbisTagMapper.js +4 -0
  252. package/node_modules/music-metadata/lib/riff/RiffChunk.d.ts +3 -1
  253. package/node_modules/music-metadata/lib/riff/RiffChunk.js +3 -2
  254. package/node_modules/music-metadata/lib/riff/RiffInfoTagMap.d.ts +1 -1
  255. package/node_modules/music-metadata/lib/type.d.ts +3 -3
  256. package/node_modules/music-metadata/lib/type.js +1 -1
  257. package/node_modules/music-metadata/lib/wav/WaveChunk.d.ts +1 -1
  258. package/node_modules/music-metadata/lib/wav/WaveChunk.js +3 -2
  259. package/node_modules/music-metadata/lib/wav/WaveParser.d.ts +6 -2
  260. package/node_modules/music-metadata/lib/wav/WaveParser.js +75 -22
  261. package/node_modules/music-metadata/lib/wavpack/WavPackParser.js +22 -13
  262. package/node_modules/music-metadata/lib/wavpack/WavPackToken.js +3 -2
  263. package/node_modules/music-metadata/package.json +3 -2
  264. package/node_modules/uint8array-extras/index.d.ts +7 -7
  265. package/node_modules/uint8array-extras/index.js +27 -13
  266. package/node_modules/uint8array-extras/package.json +6 -6
  267. package/node_modules/uint8array-extras/readme.md +7 -7
  268. package/package.json +7 -7
  269. package/dist/.setup/accounts-C_r0UlEm.mjs +0 -138
  270. package/dist/.setup/config-update-CZndPxNd.mjs +0 -102
  271. package/dist/.setup/profile-DS0xdJAi.mjs +0 -80
  272. package/dist/.setup/setup-core-6DppLENo.mjs +0 -377
  273. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-arbitration.d.ts +0 -17
  274. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-arbitration.js +0 -66
  275. package/node_modules/@openclaw/fs-safe/dist/publish-file-native.d.ts +0 -4
  276. package/node_modules/@openclaw/fs-safe/dist/publish-file-native.js +0 -35
  277. package/node_modules/@openclaw/fs-safe/dist/root-move-preflight.d.ts +0 -7
  278. package/node_modules/@openclaw/fs-safe/dist/root-move-preflight.js +0 -16
  279. package/dist/.setup/{errors-DKVS3_DO.mjs → errors-Bw4EHwKX.mjs} +1 -1
@@ -0,0 +1,673 @@
1
+ import { i as __exportAll } from "./doctor-contract-CsTNmbMa.mjs";
2
+ import { a as resolveConfiguredMatrixAccountIds, d as resolveScopedMatrixEnvConfig, f as resolveMatrixAccountStringValues, l as resolveGlobalMatrixEnvConfig, s as resolveMatrixDefaultOrOnlyAccountId, u as resolveMatrixEnvAuthReadiness } from "./account-selection-Bs_jCAaG.mjs";
3
+ import { a as resolveMatrixAccountConfig, o as resolveMatrixBaseConfig, t as findMatrixAccountConfig } from "./account-config-CRsKoMqJ.mjs";
4
+ import { a as loadMatrixCredentials, o as loadMatrixCredentialsAsync, r as credentialsMatchConfig, t as captureMatrixCredentialsEnv } from "./credentials-read-CqRiEAQa.mjs";
5
+ import { n as resolveMatrixConfigPath, r as shouldStoreMatrixAccountAtTopLevel, t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.mjs";
6
+ import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
7
+ import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
8
+ import { coerceSecretRef, hasConfiguredSecretInput, normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
9
+ import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
10
+ import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, addWildcardAllowFrom, applyAccountNameToChannelSection, normalizeAccountId as normalizeAccountId$1, normalizeAllowFromEntries, normalizeSecretInputString as normalizeSecretInputString$1, patchTopLevelChannelConfigSection, prepareScopedSetupConfig, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup";
11
+ import { resolveOptionalIntegerOption } from "openclaw/plugin-sdk/number-runtime";
12
+ import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$2, normalizeAccountId as normalizeAccountId$2 } from "openclaw/plugin-sdk/routing";
13
+ import { createChannelDmPolicy } from "openclaw/plugin-sdk/channel-dm-policy";
14
+ //#region extensions/matrix/src/matrix/accounts.ts
15
+ function clean(value) {
16
+ return normalizeOptionalString(value) ?? "";
17
+ }
18
+ function resolveMatrixAccountAuthView(params) {
19
+ const normalizedAccountId = normalizeAccountId(params.accountId);
20
+ const matrix = resolveMatrixBaseConfig(params.cfg);
21
+ const account = findMatrixAccountConfig(params.cfg, normalizedAccountId) ?? {};
22
+ const resolvedStrings = resolveMatrixAccountStringValues({
23
+ accountId: normalizedAccountId,
24
+ account: {
25
+ homeserver: clean(account.homeserver),
26
+ userId: clean(account.userId),
27
+ accessToken: typeof account.accessToken === "string" ? clean(account.accessToken) : "",
28
+ password: typeof account.password === "string" ? clean(account.password) : "",
29
+ deviceId: clean(account.deviceId),
30
+ deviceName: clean(account.deviceName)
31
+ },
32
+ scopedEnv: resolveScopedMatrixEnvConfig(normalizedAccountId, params.env),
33
+ channel: {
34
+ homeserver: clean(matrix.homeserver),
35
+ userId: clean(matrix.userId),
36
+ accessToken: typeof matrix.accessToken === "string" ? clean(matrix.accessToken) : "",
37
+ password: typeof matrix.password === "string" ? clean(matrix.password) : "",
38
+ deviceId: clean(matrix.deviceId),
39
+ deviceName: clean(matrix.deviceName)
40
+ },
41
+ globalEnv: resolveGlobalMatrixEnvConfig(params.env)
42
+ });
43
+ return {
44
+ homeserver: resolvedStrings.homeserver,
45
+ userId: resolvedStrings.userId,
46
+ accessToken: resolvedStrings.accessToken || void 0,
47
+ password: resolvedStrings.password || void 0
48
+ };
49
+ }
50
+ function resolveMatrixAccountUserId(authView, stored) {
51
+ const configuredUserId = authView.userId.trim();
52
+ if (configuredUserId) return configuredUserId;
53
+ if (!stored) return null;
54
+ if (authView.homeserver && stored.homeserver !== authView.homeserver) return null;
55
+ if (authView.accessToken && stored.accessToken !== authView.accessToken) return null;
56
+ return stored.userId.trim() || null;
57
+ }
58
+ function listMatrixAccountIds(cfg) {
59
+ const ids = resolveConfiguredMatrixAccountIds(cfg, process.env);
60
+ return ids.length > 0 ? ids : [DEFAULT_ACCOUNT_ID];
61
+ }
62
+ function resolveDefaultMatrixAccountId(cfg, env = process.env) {
63
+ return normalizeAccountId(resolveMatrixDefaultOrOnlyAccountId(cfg, env));
64
+ }
65
+ async function resolveConfiguredMatrixBotUserIds(params) {
66
+ const env = params.env ?? process.env;
67
+ const currentAccountId = normalizeAccountId(params.accountId);
68
+ const accounts = [.../* @__PURE__ */ new Set([...resolveConfiguredMatrixAccountIds(params.cfg, env), DEFAULT_ACCOUNT_ID])].filter((accountId) => normalizeAccountId(accountId) !== currentAccountId).map((accountId) => prepareMatrixAccount({
69
+ cfg: params.cfg,
70
+ accountId,
71
+ env
72
+ }));
73
+ const ids = /* @__PURE__ */ new Set();
74
+ if (accounts.length === 0 || params.abortSignal?.aborted) return ids;
75
+ const credentialsEnv = captureMatrixCredentialsEnv(env);
76
+ for (const prepared of accounts) {
77
+ if (params.abortSignal?.aborted) break;
78
+ const stored = await loadMatrixCredentialsAsync(credentialsEnv, prepared.account.accountId);
79
+ if (!isMatrixAccountConfigured(prepared, stored)) continue;
80
+ const userId = resolveMatrixAccountUserId(prepared.authView, stored);
81
+ if (userId) ids.add(userId);
82
+ }
83
+ return ids;
84
+ }
85
+ function prepareMatrixAccount(params) {
86
+ const env = params.env ?? process.env;
87
+ const accountId = normalizeAccountId(params.accountId ?? resolveDefaultMatrixAccountId(params.cfg, env));
88
+ const matrixBase = resolveMatrixBaseConfig(params.cfg);
89
+ const base = resolveMatrixAccountConfig({
90
+ cfg: params.cfg,
91
+ accountId,
92
+ env
93
+ });
94
+ const explicitAuthConfig = accountId === DEFAULT_ACCOUNT_ID ? base : findMatrixAccountConfig(params.cfg, accountId) ?? {};
95
+ const enabled = base.enabled !== false && matrixBase.enabled !== false;
96
+ const authView = resolveMatrixAccountAuthView({
97
+ cfg: params.cfg,
98
+ accountId,
99
+ env
100
+ });
101
+ const hasHomeserver = Boolean(authView.homeserver);
102
+ const hasUserId = Boolean(authView.userId);
103
+ const hasAccessToken = Boolean(authView.accessToken) || hasConfiguredSecretInput(explicitAuthConfig.accessToken);
104
+ const hasPassword = Boolean(authView.password);
105
+ const hasPasswordAuth = hasUserId && (hasPassword || hasConfiguredSecretInput(explicitAuthConfig.password));
106
+ return {
107
+ authView,
108
+ hasHomeserver,
109
+ hasConfiguredAuth: hasAccessToken || hasPasswordAuth,
110
+ account: {
111
+ accountId,
112
+ enabled,
113
+ name: normalizeOptionalString(base.name),
114
+ homeserver: authView.homeserver || void 0,
115
+ userId: authView.userId || void 0,
116
+ config: base
117
+ }
118
+ };
119
+ }
120
+ function isMatrixAccountConfigured(prepared, stored) {
121
+ const { authView } = prepared;
122
+ const hasStored = stored && authView.homeserver ? credentialsMatchConfig(stored, {
123
+ homeserver: authView.homeserver,
124
+ userId: authView.userId || ""
125
+ }) : false;
126
+ return prepared.hasHomeserver && (prepared.hasConfiguredAuth || hasStored);
127
+ }
128
+ function resolveMatrixAccount(params) {
129
+ const prepared = prepareMatrixAccount(params);
130
+ const stored = prepared.hasHomeserver && !prepared.hasConfiguredAuth ? loadMatrixCredentials(params.env ?? process.env, prepared.account.accountId) : null;
131
+ return {
132
+ ...prepared.account,
133
+ configured: isMatrixAccountConfigured(prepared, stored)
134
+ };
135
+ }
136
+ async function resolveMatrixAccountAsync(params) {
137
+ const prepared = prepareMatrixAccount(params);
138
+ const stored = prepared.hasHomeserver && !prepared.hasConfiguredAuth ? await loadMatrixCredentialsAsync(captureMatrixCredentialsEnv(params.env ?? process.env), prepared.account.accountId) : null;
139
+ return {
140
+ ...prepared.account,
141
+ configured: isMatrixAccountConfigured(prepared, stored)
142
+ };
143
+ }
144
+ //#endregion
145
+ //#region extensions/matrix/src/matrix/config-update.ts
146
+ var config_update_exports = /* @__PURE__ */ __exportAll({
147
+ resolveMatrixConfigFieldPath: () => resolveMatrixConfigFieldPath,
148
+ resolveMatrixConfigPath: () => resolveMatrixConfigPath,
149
+ shouldStoreMatrixAccountAtTopLevel: () => shouldStoreMatrixAccountAtTopLevel,
150
+ updateMatrixAccountConfig: () => updateMatrixAccountConfig
151
+ });
152
+ function applyNullableField(target, key, value, normalize = (entry) => entry) {
153
+ if (value === void 0) return;
154
+ const normalized = value === null ? void 0 : normalize(value);
155
+ if (normalized === void 0) delete target[key];
156
+ else target[key] = normalized;
157
+ }
158
+ function normalizeMatrixSecretInput(value, key, defaults) {
159
+ if (typeof value === "string") return normalizeSecretInputString(value) || void 0;
160
+ const ref = coerceSecretRef(value, defaults);
161
+ if (!ref) throw new Error(`Invalid Matrix ${key} SecretInput.`);
162
+ return ref;
163
+ }
164
+ function cloneMatrixDmConfig(dm) {
165
+ return {
166
+ ...dm,
167
+ ...dm.allowFrom ? { allowFrom: [...dm.allowFrom] } : {}
168
+ };
169
+ }
170
+ function cloneMatrixRoomMap(rooms) {
171
+ if (!rooms) return rooms;
172
+ return Object.fromEntries(Object.entries(rooms).map(([roomId, roomCfg]) => [roomId, roomCfg ? { ...roomCfg } : roomCfg]));
173
+ }
174
+ function updateMatrixAccountConfig(cfg, accountId, patch) {
175
+ const matrix = cfg.channels?.matrix ?? {};
176
+ const normalizedAccountId = normalizeAccountId(accountId);
177
+ const nextAccount = { ...findMatrixAccountConfig(cfg, normalizedAccountId) ?? (normalizedAccountId === DEFAULT_ACCOUNT_ID ? matrix : {}) };
178
+ const trimString = (value) => value.trim() || void 0;
179
+ applyNullableField(nextAccount, "name", patch.name, trimString);
180
+ if (typeof patch.enabled === "boolean") nextAccount.enabled = patch.enabled;
181
+ else if (typeof nextAccount.enabled !== "boolean") nextAccount.enabled = true;
182
+ applyNullableField(nextAccount, "homeserver", patch.homeserver, trimString);
183
+ applyNullableField(nextAccount, "proxy", patch.proxy, trimString);
184
+ applyNullableField(nextAccount, "userId", patch.userId, trimString);
185
+ for (const key of ["accessToken", "password"]) applyNullableField(nextAccount, key, patch[key], (value) => normalizeMatrixSecretInput(value, key, cfg.secrets?.defaults));
186
+ applyNullableField(nextAccount, "deviceId", patch.deviceId, trimString);
187
+ applyNullableField(nextAccount, "deviceName", patch.deviceName, trimString);
188
+ applyNullableField(nextAccount, "avatarUrl", patch.avatarUrl, trimString);
189
+ if (patch.allowPrivateNetwork !== void 0) {
190
+ const nextNetwork = nextAccount.network && typeof nextAccount.network === "object" ? { ...nextAccount.network } : {};
191
+ if (patch.allowPrivateNetwork === null) delete nextNetwork.dangerouslyAllowPrivateNetwork;
192
+ else nextNetwork.dangerouslyAllowPrivateNetwork = patch.allowPrivateNetwork;
193
+ if (Object.keys(nextNetwork).length > 0) nextAccount.network = nextNetwork;
194
+ else delete nextAccount.network;
195
+ }
196
+ applyNullableField(nextAccount, "initialSyncLimit", patch.initialSyncLimit, (value) => resolveOptionalIntegerOption(value, { min: 0 }));
197
+ applyNullableField(nextAccount, "encryption", patch.encryption);
198
+ applyNullableField(nextAccount, "allowBots", patch.allowBots);
199
+ applyNullableField(nextAccount, "autoJoin", patch.autoJoin);
200
+ applyNullableField(nextAccount, "autoJoinAllowlist", patch.autoJoinAllowlist, (value) => [...value]);
201
+ applyNullableField(nextAccount, "dm", patch.dm, (value) => cloneMatrixDmConfig({
202
+ ...nextAccount.dm,
203
+ ...value
204
+ }));
205
+ applyNullableField(nextAccount, "groupPolicy", patch.groupPolicy);
206
+ applyNullableField(nextAccount, "groupAllowFrom", patch.groupAllowFrom, (value) => [...value]);
207
+ for (const key of ["groups", "rooms"]) applyNullableField(nextAccount, key, patch[key], cloneMatrixRoomMap);
208
+ const nextAccounts = Object.fromEntries(Object.entries(matrix.accounts ?? {}).filter(([rawAccountId]) => rawAccountId === normalizedAccountId || normalizeAccountId(rawAccountId) !== normalizedAccountId));
209
+ if (shouldStoreMatrixAccountAtTopLevel(cfg, normalizedAccountId)) {
210
+ const { accounts: _ignoredAccounts, defaultAccount } = matrix;
211
+ const { accounts: _ignoredNextAccounts, defaultAccount: _ignoredNextDefaultAccount, ...topLevelAccount } = nextAccount;
212
+ return {
213
+ ...cfg,
214
+ channels: {
215
+ ...cfg.channels,
216
+ matrix: {
217
+ ...defaultAccount ? { defaultAccount } : {},
218
+ enabled: true,
219
+ ...topLevelAccount
220
+ }
221
+ }
222
+ };
223
+ }
224
+ return {
225
+ ...cfg,
226
+ channels: {
227
+ ...cfg.channels,
228
+ matrix: {
229
+ ...matrix,
230
+ enabled: true,
231
+ accounts: {
232
+ ...nextAccounts,
233
+ [normalizedAccountId]: nextAccount
234
+ }
235
+ }
236
+ }
237
+ };
238
+ }
239
+ //#endregion
240
+ //#region extensions/matrix/src/matrix/profile.ts
241
+ var profile_exports = /* @__PURE__ */ __exportAll({
242
+ isSupportedMatrixAvatarSource: () => isSupportedMatrixAvatarSource,
243
+ syncMatrixOwnProfile: () => syncMatrixOwnProfile
244
+ });
245
+ const MATRIX_PROFILE_AVATAR_MAX_BYTES = 10485760;
246
+ function isMatrixMxcUri(value) {
247
+ return normalizeLowercaseStringOrEmpty(value).startsWith("mxc://");
248
+ }
249
+ function isMatrixHttpAvatarUri(value) {
250
+ const normalized = normalizeLowercaseStringOrEmpty(value);
251
+ return normalized.startsWith("https://") || normalized.startsWith("http://");
252
+ }
253
+ function isSupportedMatrixAvatarSource(value) {
254
+ return isMatrixMxcUri(value) || isMatrixHttpAvatarUri(value);
255
+ }
256
+ async function syncMatrixOwnProfile(params) {
257
+ const desiredDisplayName = normalizeOptionalString(params.displayName) ?? null;
258
+ const avatarPath = normalizeOptionalString(params.avatarPath) ?? null;
259
+ const avatarSource = avatarPath ?? normalizeOptionalString(params.avatarUrl) ?? null;
260
+ let desiredAvatarUrl = avatarSource;
261
+ let uploadedAvatarSource = null;
262
+ if (avatarSource && (avatarPath || !isMatrixMxcUri(avatarSource))) {
263
+ if (!avatarPath && !isMatrixHttpAvatarUri(avatarSource)) throw new Error("Matrix avatar URL must be an mxc:// URI or an http(s) URL.");
264
+ const loadAvatar = avatarPath ? params.loadAvatarFromPath : params.loadAvatarFromUrl;
265
+ if (!loadAvatar) throw new Error(avatarPath ? "Matrix avatar path upload requires a media loader." : "Matrix avatar URL conversion requires a media loader.");
266
+ const media = await loadAvatar(avatarSource, params.avatarMaxBytes ?? MATRIX_PROFILE_AVATAR_MAX_BYTES);
267
+ desiredAvatarUrl = await params.client.uploadContent(media.buffer, media.contentType, media.fileName || "avatar");
268
+ uploadedAvatarSource = avatarPath ? "path" : "http";
269
+ }
270
+ const avatar = {
271
+ resolvedAvatarUrl: desiredAvatarUrl,
272
+ uploadedAvatarSource,
273
+ convertedAvatarFromHttp: uploadedAvatarSource === "http"
274
+ };
275
+ if (!desiredDisplayName && !desiredAvatarUrl) return {
276
+ skipped: true,
277
+ displayNameUpdated: false,
278
+ avatarUpdated: false,
279
+ ...avatar,
280
+ resolvedAvatarUrl: null
281
+ };
282
+ let currentDisplayName;
283
+ let currentAvatarUrl;
284
+ try {
285
+ const currentProfile = await params.client.getUserProfile(params.userId);
286
+ currentDisplayName = normalizeOptionalString(currentProfile.displayname);
287
+ currentAvatarUrl = normalizeOptionalString(currentProfile.avatar_url);
288
+ } catch {}
289
+ let displayNameUpdated = false;
290
+ let avatarUpdated = false;
291
+ if (desiredDisplayName && currentDisplayName !== desiredDisplayName) {
292
+ await params.client.setDisplayName(desiredDisplayName);
293
+ displayNameUpdated = true;
294
+ }
295
+ if (desiredAvatarUrl && currentAvatarUrl !== desiredAvatarUrl) {
296
+ await params.client.setAvatarUrl(desiredAvatarUrl);
297
+ avatarUpdated = true;
298
+ }
299
+ return {
300
+ skipped: false,
301
+ displayNameUpdated,
302
+ avatarUpdated,
303
+ ...avatar
304
+ };
305
+ }
306
+ //#endregion
307
+ //#region extensions/matrix/src/setup-contract.ts
308
+ const matrixSingleAccountKeysToMove = [
309
+ "homeserver",
310
+ "userId",
311
+ "accessToken",
312
+ "password",
313
+ "deviceId",
314
+ "deviceName",
315
+ "avatarUrl",
316
+ "initialSyncLimit",
317
+ "encryption",
318
+ "allowlistOnly",
319
+ "dangerouslyAllowNameMatching",
320
+ "allowBots",
321
+ "streaming",
322
+ "replyToMode",
323
+ "threadReplies",
324
+ "textChunkLimit",
325
+ "responsePrefix",
326
+ "ackReaction",
327
+ "ackReactionScope",
328
+ "reactionNotifications",
329
+ "threadBindings",
330
+ "startupVerification",
331
+ "startupVerificationCooldownHours",
332
+ "mediaMaxMb",
333
+ "autoJoin",
334
+ "autoJoinAllowlist",
335
+ "dm",
336
+ "groups",
337
+ "rooms",
338
+ "actions"
339
+ ];
340
+ const matrixNamedAccountPromotionKeys = [
341
+ "name",
342
+ "homeserver",
343
+ "userId",
344
+ "accessToken",
345
+ "password",
346
+ "deviceId",
347
+ "deviceName",
348
+ "avatarUrl",
349
+ "initialSyncLimit",
350
+ "encryption"
351
+ ];
352
+ const singleAccountKeysToMove = [...matrixSingleAccountKeysToMove];
353
+ const namedAccountPromotionKeys = [...matrixNamedAccountPromotionKeys];
354
+ function resolveSingleAccountPromotionTarget(params) {
355
+ const accounts = typeof params.channel.accounts === "object" && params.channel.accounts ? params.channel.accounts : {};
356
+ const normalizedDefaultAccount = typeof params.channel.defaultAccount === "string" && params.channel.defaultAccount.trim() ? normalizeAccountId$2(params.channel.defaultAccount) : void 0;
357
+ const matchedAccountId = normalizedDefaultAccount ? Object.entries(accounts).find(([accountId, value]) => accountId && value && typeof value === "object" && normalizeAccountId$2(accountId) === normalizedDefaultAccount)?.[0] : void 0;
358
+ if (matchedAccountId) return matchedAccountId;
359
+ if (normalizedDefaultAccount) return DEFAULT_ACCOUNT_ID$2;
360
+ const namedAccounts = Object.entries(accounts).filter(([accountId, value]) => accountId && typeof value === "object" && value);
361
+ if (namedAccounts.length === 1) {
362
+ const onlyAccount = namedAccounts[0];
363
+ if (onlyAccount) return onlyAccount[0];
364
+ }
365
+ return DEFAULT_ACCOUNT_ID$2;
366
+ }
367
+ //#endregion
368
+ //#region extensions/matrix/src/setup-config.ts
369
+ const channel$1 = "matrix";
370
+ const COMMON_SINGLE_ACCOUNT_KEYS_TO_MOVE = /* @__PURE__ */ new Set([
371
+ "name",
372
+ "enabled",
373
+ "httpPort",
374
+ "webhookPath",
375
+ "webhookUrl",
376
+ "webhookSecret",
377
+ "service",
378
+ "region",
379
+ "homeserver",
380
+ "userId",
381
+ "accessToken",
382
+ "password",
383
+ "deviceName",
384
+ "url",
385
+ "code",
386
+ "dmPolicy",
387
+ "allowFrom",
388
+ "groupPolicy",
389
+ "groupAllowFrom",
390
+ "defaultTo"
391
+ ]);
392
+ const MATRIX_SINGLE_ACCOUNT_KEYS_TO_MOVE = new Set(matrixSingleAccountKeysToMove);
393
+ const MATRIX_NAMED_ACCOUNT_PROMOTION_KEYS = new Set(matrixNamedAccountPromotionKeys);
394
+ function cloneIfObject(value) {
395
+ if (value && typeof value === "object") return structuredClone(value);
396
+ return value;
397
+ }
398
+ function resolveExistingMatrixAccountKey(accounts, targetAccountId) {
399
+ const normalizedTargetAccountId = normalizeAccountId$1(targetAccountId);
400
+ return Object.keys(accounts).find((accountId) => normalizeAccountId$1(accountId) === normalizedTargetAccountId) ?? targetAccountId;
401
+ }
402
+ function moveSingleMatrixAccountConfigToNamedAccount(cfg) {
403
+ const baseConfig = cfg.channels?.[channel$1];
404
+ const base = typeof baseConfig === "object" && baseConfig ? baseConfig : void 0;
405
+ if (!base) return cfg;
406
+ const accounts = typeof base.accounts === "object" && base.accounts ? base.accounts : {};
407
+ const hasNamedAccounts = Object.keys(accounts).some(Boolean);
408
+ const keysToMove = Object.entries(base).filter(([key, value]) => {
409
+ if (key === "accounts" || key === "enabled" || value === void 0) return false;
410
+ if (!COMMON_SINGLE_ACCOUNT_KEYS_TO_MOVE.has(key) && !MATRIX_SINGLE_ACCOUNT_KEYS_TO_MOVE.has(key)) return false;
411
+ if (hasNamedAccounts && !MATRIX_NAMED_ACCOUNT_PROMOTION_KEYS.has(key)) return false;
412
+ return true;
413
+ }).map(([key]) => key);
414
+ if (keysToMove.length === 0) return cfg;
415
+ const resolvedTargetAccountId = resolveExistingMatrixAccountKey(accounts, resolveSingleAccountPromotionTarget({ channel: base }));
416
+ const nextAccount = { ...accounts[resolvedTargetAccountId] };
417
+ for (const key of keysToMove) nextAccount[key] = cloneIfObject(base[key]);
418
+ return patchTopLevelChannelConfigSection({
419
+ cfg,
420
+ channel: channel$1,
421
+ clearFields: keysToMove,
422
+ patch: { accounts: {
423
+ ...accounts,
424
+ [resolvedTargetAccountId]: nextAccount
425
+ } }
426
+ });
427
+ }
428
+ function validateMatrixSetupInput(params) {
429
+ const input = params.input;
430
+ const avatarUrl = normalizeOptionalString(input.avatarUrl);
431
+ if (avatarUrl && !isSupportedMatrixAvatarSource(avatarUrl)) return "Matrix avatar URL must be an mxc:// URI or an http(s) URL.";
432
+ if (input.useEnv) {
433
+ const envReadiness = resolveMatrixEnvAuthReadiness(params.accountId, process.env);
434
+ return envReadiness.ready ? null : envReadiness.missingMessage;
435
+ }
436
+ if (!input.homeserver?.trim()) return "Matrix requires --homeserver";
437
+ const accessToken = input.accessToken?.trim();
438
+ const password = normalizeSecretInputString$1(input.password);
439
+ const userId = input.userId?.trim();
440
+ if (!accessToken && !password) return "Matrix requires --access-token or --password";
441
+ if (!accessToken && !userId) return "Matrix requires --user-id when using --password";
442
+ return null;
443
+ }
444
+ function applyMatrixSetupAccountConfig(params) {
445
+ const input = params.input;
446
+ const normalizedAccountId = normalizeAccountId$1(params.accountId);
447
+ const migratedCfg = normalizedAccountId !== DEFAULT_ACCOUNT_ID$1 ? moveSingleMatrixAccountConfigToNamedAccount(params.cfg) : params.cfg;
448
+ const next = applyAccountNameToChannelSection({
449
+ cfg: migratedCfg,
450
+ channelKey: channel$1,
451
+ accountId: normalizedAccountId,
452
+ name: input.name
453
+ });
454
+ const avatarUrl = normalizeOptionalString(input.avatarUrl);
455
+ if (input.useEnv) return updateMatrixAccountConfig(next, normalizedAccountId, {
456
+ enabled: true,
457
+ homeserver: null,
458
+ allowPrivateNetwork: null,
459
+ proxy: null,
460
+ userId: null,
461
+ accessToken: null,
462
+ password: null,
463
+ deviceId: null,
464
+ deviceName: null,
465
+ avatarUrl
466
+ });
467
+ const accessToken = input.accessToken?.trim();
468
+ const password = normalizeSecretInputString$1(input.password);
469
+ const userId = input.userId?.trim();
470
+ return updateMatrixAccountConfig(next, normalizedAccountId, {
471
+ enabled: true,
472
+ homeserver: input.homeserver?.trim(),
473
+ allowPrivateNetwork: typeof input.dangerouslyAllowPrivateNetwork === "boolean" ? input.dangerouslyAllowPrivateNetwork : typeof input.allowPrivateNetwork === "boolean" ? input.allowPrivateNetwork : void 0,
474
+ proxy: normalizeOptionalString(input.proxy),
475
+ userId: password && !userId ? null : userId,
476
+ accessToken: accessToken || (password ? null : void 0),
477
+ password: password || (accessToken ? null : void 0),
478
+ deviceName: input.deviceName?.trim(),
479
+ avatarUrl,
480
+ initialSyncLimit: input.initialSyncLimit
481
+ });
482
+ }
483
+ //#endregion
484
+ //#region extensions/matrix/src/setup-dm-policy.ts
485
+ function resolveMatrixSetupDmAllowFrom(policy, allowFrom) {
486
+ if (policy === "open") return addWildcardAllowFrom(allowFrom);
487
+ return normalizeAllowFromEntries(allowFrom ?? []).filter((entry) => entry !== "*");
488
+ }
489
+ function createMatrixSetupDmPolicy(promptAllowFrom) {
490
+ return createChannelDmPolicy({
491
+ label: "Matrix",
492
+ channel: "matrix",
493
+ policyPath: "dm.policy",
494
+ allowFromPath: "dm.allowFrom",
495
+ resolveAccount: (cfg, accountId) => {
496
+ const resolvedCfg = cfg;
497
+ const resolvedAccountId = normalizeAccountId$1(accountId?.trim() || resolveDefaultMatrixAccountId(resolvedCfg) || DEFAULT_ACCOUNT_ID$1);
498
+ const config = resolveMatrixAccountConfig({
499
+ cfg: resolvedCfg,
500
+ accountId: resolvedAccountId
501
+ });
502
+ return {
503
+ accountId: resolvedAccountId,
504
+ config: {
505
+ dmPolicy: config.dm?.policy,
506
+ allowFrom: config.dm?.allowFrom,
507
+ dm: config.dm
508
+ }
509
+ };
510
+ },
511
+ resolveConfigKeys: ({ cfg, account }) => ({
512
+ policyKey: resolveMatrixConfigFieldPath(cfg, account.accountId, "dm.policy"),
513
+ allowFromKey: resolveMatrixConfigFieldPath(cfg, account.accountId, "dm.allowFrom")
514
+ }),
515
+ resolveAllowFrom: ({ policy, account }) => resolveMatrixSetupDmAllowFrom(policy, account.config.allowFrom),
516
+ buildPatch: ({ account, policy, allowFrom }) => ({ dm: {
517
+ ...account.config.dm,
518
+ policy,
519
+ allowFrom
520
+ } }),
521
+ applyPatch: ({ cfg, account, patch }) => updateMatrixAccountConfig(cfg, account.accountId, patch),
522
+ promptAllowFrom
523
+ });
524
+ }
525
+ //#endregion
526
+ //#region extensions/matrix/src/setup-core.ts
527
+ const channel = "matrix";
528
+ function resolveMatrixSetupAccountId(params) {
529
+ return normalizeAccountId$1(params.accountId?.trim() || params.name?.trim() || DEFAULT_ACCOUNT_ID$1);
530
+ }
531
+ function createMatrixSetupWizardProxy(loadWizardModule) {
532
+ let wizardPromise = null;
533
+ const loadWizard = () => {
534
+ wizardPromise ??= loadWizardModule().then((module) => module.matrixSetupWizard);
535
+ return wizardPromise;
536
+ };
537
+ return {
538
+ channel,
539
+ getStatus: async (ctx) => await (await loadWizard()).getStatus(ctx),
540
+ configure: async (ctx) => await (await loadWizard()).configure(ctx),
541
+ configureInteractive: async (ctx) => {
542
+ const wizard = await loadWizard();
543
+ return await (wizard.configureInteractive ?? wizard.configure)(ctx);
544
+ },
545
+ configureWhenConfigured: async (ctx) => {
546
+ const wizard = await loadWizard();
547
+ return await (wizard.configureWhenConfigured ?? wizard.configureInteractive ?? wizard.configure)(ctx);
548
+ },
549
+ afterConfigWritten: async (ctx) => await (await loadWizard()).afterConfigWritten?.(ctx),
550
+ dmPolicy: createMatrixSetupDmPolicy(async (params) => {
551
+ const promptAllowFrom = (await loadWizard()).dmPolicy?.promptAllowFrom;
552
+ return promptAllowFrom ? await promptAllowFrom(params) : params.cfg;
553
+ }),
554
+ disable: (cfg) => setSetupChannelEnabled(cfg, channel, false)
555
+ };
556
+ }
557
+ const finishMatrixSetupAfterConfigWrite = async ({ previousCfg, cfg, accountId, runtime }) => {
558
+ const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-CV-hHBXu.mjs");
559
+ await runMatrixSetupBootstrapAfterConfigWrite({
560
+ previousCfg,
561
+ cfg,
562
+ accountId,
563
+ runtime
564
+ });
565
+ };
566
+ const matrixSetupAdapter = {
567
+ singleAccountKeysToMove,
568
+ namedAccountPromotionKeys,
569
+ resolveSingleAccountPromotionTarget,
570
+ resolveAccountId: ({ accountId, input }) => resolveMatrixSetupAccountId({
571
+ accountId,
572
+ name: input?.name
573
+ }),
574
+ resolveBindingAccountId: ({ accountId, agentId }) => resolveMatrixSetupAccountId({
575
+ accountId,
576
+ name: agentId
577
+ }),
578
+ applyAccountName: ({ cfg, accountId, name }) => prepareScopedSetupConfig({
579
+ cfg,
580
+ channelKey: channel,
581
+ accountId,
582
+ name
583
+ }),
584
+ validateInput: ({ accountId, input }) => validateMatrixSetupInput({
585
+ accountId,
586
+ input
587
+ }),
588
+ applyAccountConfig: ({ cfg, accountId, input }) => applyMatrixSetupAccountConfig({
589
+ cfg,
590
+ accountId,
591
+ input
592
+ }),
593
+ afterAccountConfigWritten: finishMatrixSetupAfterConfigWrite
594
+ };
595
+ const matrixSetupContract = defineChannelSetupContract({
596
+ fields: {
597
+ homeserver: {
598
+ kind: "string",
599
+ cli: {
600
+ flags: "--homeserver <url>",
601
+ description: "Matrix homeserver URL"
602
+ }
603
+ },
604
+ userId: {
605
+ kind: "string",
606
+ cli: {
607
+ flags: "--user-id <id>",
608
+ description: "Matrix user id"
609
+ }
610
+ },
611
+ accessToken: {
612
+ kind: "string",
613
+ sensitive: true,
614
+ cli: {
615
+ flags: "--access-token <token>",
616
+ description: "Matrix access token"
617
+ }
618
+ },
619
+ password: {
620
+ kind: "string",
621
+ sensitive: true,
622
+ cli: {
623
+ flags: "--password <password>",
624
+ description: "Matrix password"
625
+ }
626
+ },
627
+ deviceName: {
628
+ kind: "string",
629
+ cli: {
630
+ flags: "--device-name <name>",
631
+ description: "Matrix device name"
632
+ }
633
+ },
634
+ avatarUrl: {
635
+ kind: "string",
636
+ cli: {
637
+ flags: "--avatar-url <url>",
638
+ description: "Matrix avatar URL"
639
+ }
640
+ },
641
+ initialSyncLimit: {
642
+ kind: "integer",
643
+ cli: {
644
+ flags: "--initial-sync-limit <n>",
645
+ description: "Matrix initial sync room limit"
646
+ }
647
+ },
648
+ proxy: {
649
+ kind: "string",
650
+ cli: {
651
+ flags: "--proxy <url>",
652
+ description: "Matrix proxy URL"
653
+ }
654
+ },
655
+ dangerouslyAllowPrivateNetwork: {
656
+ kind: "boolean",
657
+ cli: {
658
+ flags: "--dangerously-allow-private-network",
659
+ description: "Allow private-network Matrix homeservers"
660
+ }
661
+ },
662
+ useEnv: {
663
+ kind: "boolean",
664
+ cli: {
665
+ flags: "--use-env",
666
+ description: "Use Matrix environment credentials"
667
+ }
668
+ }
669
+ },
670
+ legacyAdapter: matrixSetupAdapter
671
+ });
672
+ //#endregion
673
+ export { resolveMatrixAccount as _, createMatrixSetupDmPolicy as a, resolveSingleAccountPromotionTarget as c, syncMatrixOwnProfile as d, config_update_exports as f, resolveDefaultMatrixAccountId as g, resolveConfiguredMatrixBotUserIds as h, matrixSetupContract as i, singleAccountKeysToMove as l, listMatrixAccountIds as m, finishMatrixSetupAfterConfigWrite as n, moveSingleMatrixAccountConfigToNamedAccount as o, updateMatrixAccountConfig as p, matrixSetupAdapter as r, namedAccountPromotionKeys as s, createMatrixSetupWizardProxy as t, profile_exports as u, resolveMatrixAccountAsync as v };
@@ -1,3 +1,3 @@
1
- import { n as matrixSetupPlugin } from "./channel.setup-DC2t7_PK.mjs";
1
+ import { n as matrixSetupPlugin } from "./channel.setup-CwuYD_CT.mjs";
2
2
  import "../setup-plugin-api.js";
3
3
  export { matrixSetupPlugin };
@@ -1,8 +1,8 @@
1
1
  import { t as getMatrixRuntime } from "./runtime-1kn1P6io.mjs";
2
- import { o as resolveMatrixSqliteStateEnv, r as assertMatrixSupportedStateFile } from "./retired-state-BXUQ2I-C.mjs";
3
- import { o as resolveMatrixStoragePaths, r as recordCurrentStorageMetaDeviceId } from "./storage-D7agewjH.mjs";
4
- import path from "node:path";
2
+ import { o as resolveMatrixSqliteStateEnv, r as assertMatrixSupportedStateFile } from "./retired-state-DW5pLH05.mjs";
3
+ import { o as resolveMatrixStoragePaths, r as recordCurrentStorageMetaDeviceId } from "./storage-DkC6bHgA.mjs";
5
4
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
5
+ import path from "node:path";
6
6
  import { timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
7
7
  //#region extensions/matrix/src/matrix/monitor/startup-verification.ts
8
8
  const STARTUP_VERIFICATION_STATE_FILENAME = "startup-verification.json";