@openclaw/matrix 2026.10.5-beta.4 → 2026.10.10-beta.1

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 (313) hide show
  1. package/dist/.setup/{approval-handler.runtime-rxLn8CbP.mjs → approval-handler.runtime-CsqMdj7h.mjs} +9 -9
  2. package/dist/.setup/{approval-reactions-DhB6gNPU.mjs → approval-reactions-D2pEUrFS.mjs} +1 -1
  3. package/dist/.setup/{channel-BcwGspPw.mjs → channel-Dw4_imdd.mjs} +132 -111
  4. package/dist/.setup/{channel.runtime-CUc6rbu1.mjs → channel.runtime-2EEtIlyu.mjs} +6 -6
  5. package/dist/.setup/{channel.setup-CwuYD_CT.mjs → channel.setup-Be8TYKMA.mjs} +8 -3
  6. package/dist/.setup/{cli-mbL9jCro.mjs → cli-CEmWh7wh.mjs} +99 -37
  7. package/dist/.setup/{cli-metadata-6MOGuyHq.mjs → cli-metadata-CBLGwJT6.mjs} +1 -1
  8. package/dist/.setup/{client-BlTvpEWC.mjs → client-BKiiI29H.mjs} +3 -3
  9. package/dist/.setup/{client-vPPbaxNp.mjs → client-C4Gibhzl.mjs} +94 -120
  10. package/dist/.setup/{client-bootstrap-D05xy1HB.mjs → client-bootstrap-kOIDV4z_.mjs} +3 -3
  11. package/dist/.setup/{create-client-CroC4BVc.mjs → create-client-BS8UYx6N.mjs} +23 -15
  12. package/dist/.setup/{credentials-Bf9PQ7xs.mjs → credentials-CPnJZaZB.mjs} +3 -5
  13. package/dist/.setup/{credentials-read-CqRiEAQa.mjs → credentials-read-D2ULV55A.mjs} +12 -4
  14. package/dist/.setup/{crypto-runtime-CpJ0b7vY.mjs → crypto-runtime-D8yY7kjD.mjs} +168 -290
  15. package/dist/.setup/crypto-state-store-D4wrCvFs.mjs +185 -0
  16. package/dist/.setup/crypto-store-ownership-Z_Y5WRKr.mjs +174 -0
  17. package/dist/.setup/crypto-unsafe-state-doctor-C8szCYmf.mjs +54 -0
  18. package/dist/.setup/{directory-live-B1WbfSHo.mjs → directory-live-BpSz-FQB.mjs} +1 -1
  19. package/dist/.setup/{draft-stream-Bdrh7dRt.mjs → draft-stream-DYf0th1n.mjs} +1 -1
  20. package/dist/.setup/{exec-approvals-BgNWWJg1.mjs → exec-approvals-DaM-5OA5.mjs} +33 -43
  21. package/dist/.setup/{file-sync-store-BdKx_gMi.mjs → file-sync-store-CUH8EAJq.mjs} +3 -3
  22. package/dist/.setup/idb-persistence-BHTYPRe_.mjs +233 -0
  23. package/dist/.setup/idb-persistence-lock-Bh3ZLIsE.mjs +14 -0
  24. package/dist/.setup/{messages-B1CZqU8u.mjs → messages-_XHVg3do.mjs} +3 -18
  25. package/dist/.setup/{monitor-Dk_fQL1k.mjs → monitor-DRUSJ_Ev.mjs} +31 -39
  26. package/dist/.setup/{onboarding-CrSexor_.mjs → onboarding-CK9Ksgio.mjs} +3 -3
  27. package/dist/.setup/{outbound-LR3SqPIq.mjs → outbound-D5Z_4FBg.mjs} +28 -36
  28. package/dist/.setup/{profile-update-C7bjaGR6.mjs → profile-update--Pf3jCXD.mjs} +2 -2
  29. package/dist/.setup/{reaction-events-CTSvOlXO.mjs → reaction-events-BG9spedG.mjs} +6 -6
  30. package/dist/.setup/{resolve-targets-BVVbbvP6.mjs → resolve-targets-BJ5sIKeM.mjs} +1 -1
  31. package/dist/.setup/{retired-state-DW5pLH05.mjs → retired-state-DOCruzWd.mjs} +10 -10
  32. package/dist/.setup/{room-info-9Uqlpt1V.mjs → room-info-BE7bbX_c.mjs} +3 -3
  33. package/dist/.setup/runtime-setter-api-i2MOXoT3.mjs +2 -0
  34. package/dist/.setup/{sdk-Cfc6m7fY.mjs → sdk-ByU8So5S.mjs} +242 -139
  35. package/dist/.setup/secret-contract-DxyzKSzf.mjs +90 -0
  36. package/dist/.setup/secret-contract-api-Dukgvike.mjs +2 -0
  37. package/dist/.setup/{send-LCOuTVc1.mjs → send-BprM-Wmx.mjs} +19 -42
  38. package/dist/.setup/{setup-bootstrap-CV-hHBXu.mjs → setup-bootstrap-DmznRqYe.mjs} +2 -6
  39. package/dist/.setup/{setup-core-CKnNTfgD.mjs → setup-core-DcCk1_Tv.mjs} +4 -7
  40. package/dist/.setup/setup-plugin-api-BU6UGksW.mjs +2 -0
  41. package/dist/.setup/{startup-verification-CgfUb4yJ.mjs → startup-verification-UU8DUvi4.mjs} +5 -13
  42. package/dist/.setup/state-layout-walk-BQMgMykU.mjs +27 -0
  43. package/dist/.setup/{storage-DkC6bHgA.mjs → storage-l8V0XsGM.mjs} +7 -166
  44. package/dist/.setup/{subagent-hooks-D8jyeQsO.mjs → subagent-hooks-CSY4iwa_.mjs} +7 -6
  45. package/dist/.setup/{sync-cache-state-D4G-fi3t.mjs → sync-cache-state-Cnm4TCEI.mjs} +1 -1
  46. package/dist/.setup/thread-bindings-rrwQAS6R.mjs +620 -0
  47. package/dist/.setup/{thread-bindings-shared-CbsFNbAY.mjs → thread-bindings-shared-CPjUA0Ib.mjs} +26 -5
  48. package/dist/.setup/{tool-actions-DAp6_XSJ.mjs → tool-actions-DBrk6Yei.mjs} +9 -11
  49. package/dist/.setup/{verification-B3VswneT.mjs → verification--qUbmRd-.mjs} +2 -2
  50. package/dist/api.js +6 -6
  51. package/dist/auth-presence.js +16 -2
  52. package/dist/channel-plugin-api.js +1 -2
  53. package/dist/cli-metadata.js +1 -2
  54. package/dist/contract-api.js +2 -2
  55. package/dist/doctor-contract-api.js +20 -27
  56. package/dist/index.js +38 -12
  57. package/dist/plugin-entry.handlers.runtime.js +32 -5
  58. package/dist/runtime-api.js +3 -3
  59. package/dist/runtime-setter-api.js +1 -2
  60. package/dist/secret-contract-api.js +1 -2
  61. package/dist/session-binding-contract-api.js +1 -1
  62. package/dist/setup-entry.js +3 -3
  63. package/dist/setup-plugin-api.js +1 -2
  64. package/dist/subagent-hooks-api.js +1 -1
  65. package/dist/thread-binding-api.js +1 -2
  66. package/dist/thread-bindings-runtime.js +1 -2
  67. package/node_modules/@openclaw/fs-safe/CHANGELOG.md +148 -0
  68. package/node_modules/@openclaw/fs-safe/README.md +20 -4
  69. package/node_modules/@openclaw/fs-safe/dist/advanced.d.ts +2 -1
  70. package/node_modules/@openclaw/fs-safe/dist/advanced.js +1 -0
  71. package/node_modules/@openclaw/fs-safe/dist/archive-merge.js +28 -3
  72. package/node_modules/@openclaw/fs-safe/dist/archive-parser.wasm +0 -0
  73. package/node_modules/@openclaw/fs-safe/dist/archive-read.js +11 -5
  74. package/node_modules/@openclaw/fs-safe/dist/archive-zip-loader.js +4 -2
  75. package/node_modules/@openclaw/fs-safe/dist/archive.js +2 -2
  76. package/node_modules/@openclaw/fs-safe/dist/atomic-io.js +2 -2
  77. package/node_modules/@openclaw/fs-safe/dist/bounded-read.d.ts +1 -0
  78. package/node_modules/@openclaw/fs-safe/dist/bounded-read.js +9 -2
  79. package/node_modules/@openclaw/fs-safe/dist/clone-metadata.d.ts +2 -0
  80. package/node_modules/@openclaw/fs-safe/dist/clone-metadata.js +2 -1
  81. package/node_modules/@openclaw/fs-safe/dist/config.d.ts +6 -0
  82. package/node_modules/@openclaw/fs-safe/dist/config.js +5 -0
  83. package/node_modules/@openclaw/fs-safe/dist/copy-file-input.d.ts +3 -1
  84. package/node_modules/@openclaw/fs-safe/dist/copy-file-input.js +8 -7
  85. package/node_modules/@openclaw/fs-safe/dist/copy-link.d.ts +26 -0
  86. package/node_modules/@openclaw/fs-safe/dist/copy-link.js +170 -0
  87. package/node_modules/@openclaw/fs-safe/dist/copy-metadata.d.ts +9 -0
  88. package/node_modules/@openclaw/fs-safe/dist/copy-metadata.js +39 -0
  89. package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.js +11 -2
  90. package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.d.ts +2 -4
  91. package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.js +4 -2
  92. package/node_modules/@openclaw/fs-safe/dist/copy-tree-portable.js +3 -6
  93. package/node_modules/@openclaw/fs-safe/dist/copy.js +3 -3
  94. package/node_modules/@openclaw/fs-safe/dist/create.js +1 -1
  95. package/node_modules/@openclaw/fs-safe/dist/creation-boundary.js +7 -4
  96. package/node_modules/@openclaw/fs-safe/dist/darwin-acl.d.ts +12 -0
  97. package/node_modules/@openclaw/fs-safe/dist/darwin-acl.js +29 -0
  98. package/node_modules/@openclaw/fs-safe/dist/directory-durability.d.ts +7 -4
  99. package/node_modules/@openclaw/fs-safe/dist/directory-guard.js +20 -5
  100. package/node_modules/@openclaw/fs-safe/dist/directory-mode-node.d.ts +3 -0
  101. package/node_modules/@openclaw/fs-safe/dist/directory-mode-node.js +27 -2
  102. package/node_modules/@openclaw/fs-safe/dist/directory-receipt.d.ts +7 -7
  103. package/node_modules/@openclaw/fs-safe/dist/directory-receipt.js +9 -4
  104. package/node_modules/@openclaw/fs-safe/dist/durability.d.ts +2 -1
  105. package/node_modules/@openclaw/fs-safe/dist/entry-publication.js +2 -2
  106. package/node_modules/@openclaw/fs-safe/dist/exact-identity.d.ts +17 -0
  107. package/node_modules/@openclaw/fs-safe/dist/exact-identity.js +29 -0
  108. package/node_modules/@openclaw/fs-safe/dist/file-handle-transfer.js +4 -2
  109. package/node_modules/@openclaw/fs-safe/dist/file-hash.d.ts +1 -1
  110. package/node_modules/@openclaw/fs-safe/dist/file-hash.js +11 -9
  111. package/node_modules/@openclaw/fs-safe/dist/file-identity.d.ts +7 -1
  112. package/node_modules/@openclaw/fs-safe/dist/file-identity.js +27 -5
  113. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-admission.js +1 -2
  114. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync.js +8 -1
  115. package/node_modules/@openclaw/fs-safe/dist/file-lock.d.ts +1 -0
  116. package/node_modules/@openclaw/fs-safe/dist/file-lock.js +1 -0
  117. package/node_modules/@openclaw/fs-safe/dist/file-write-lease.d.ts +9 -0
  118. package/node_modules/@openclaw/fs-safe/dist/file-write-lease.js +42 -0
  119. package/node_modules/@openclaw/fs-safe/dist/guarded-mkdir.d.ts +1 -0
  120. package/node_modules/@openclaw/fs-safe/dist/guarded-mkdir.js +22 -15
  121. package/node_modules/@openclaw/fs-safe/dist/guest-native-python.js +3 -0
  122. package/node_modules/@openclaw/fs-safe/dist/hardlink-fallback.d.ts +1 -0
  123. package/node_modules/@openclaw/fs-safe/dist/hardlink-fallback.js +5 -0
  124. package/node_modules/@openclaw/fs-safe/dist/index.d.ts +1 -0
  125. package/node_modules/@openclaw/fs-safe/dist/index.js +1 -0
  126. package/node_modules/@openclaw/fs-safe/dist/json-durable-queue-ownership.js +16 -3
  127. package/node_modules/@openclaw/fs-safe/dist/local-file-descriptor.js +24 -13
  128. package/node_modules/@openclaw/fs-safe/dist/native-binding.d.ts +85 -18
  129. package/node_modules/@openclaw/fs-safe/dist/native-config.d.ts +5 -0
  130. package/node_modules/@openclaw/fs-safe/dist/native-config.js +11 -0
  131. package/node_modules/@openclaw/fs-safe/dist/native-directory-observation.js +6 -4
  132. package/node_modules/@openclaw/fs-safe/dist/native-fallback-warning.d.ts +2 -1
  133. package/node_modules/@openclaw/fs-safe/dist/native-fallback-warning.js +26 -2
  134. package/node_modules/@openclaw/fs-safe/dist/native-guidance.d.ts +3 -0
  135. package/node_modules/@openclaw/fs-safe/dist/native-guidance.js +21 -0
  136. package/node_modules/@openclaw/fs-safe/dist/native-move-fallback.d.ts +1 -1
  137. package/node_modules/@openclaw/fs-safe/dist/native-move-fallback.js +2 -0
  138. package/node_modules/@openclaw/fs-safe/dist/native-operations.js +8 -6
  139. package/node_modules/@openclaw/fs-safe/dist/native-parent-admission.d.ts +44 -4
  140. package/node_modules/@openclaw/fs-safe/dist/native-parent-admission.js +85 -15
  141. package/node_modules/@openclaw/fs-safe/dist/native-pinned-write-windows.d.ts +3 -3
  142. package/node_modules/@openclaw/fs-safe/dist/native-pinned-write-windows.js +33 -6
  143. package/node_modules/@openclaw/fs-safe/dist/native-pinned-write.d.ts +4 -1
  144. package/node_modules/@openclaw/fs-safe/dist/native-pinned-write.js +22 -3
  145. package/node_modules/@openclaw/fs-safe/dist/native-policy-directory-observation.js +4 -3
  146. package/node_modules/@openclaw/fs-safe/dist/native-policy-parent.d.ts +1 -1
  147. package/node_modules/@openclaw/fs-safe/dist/native-policy-parent.js +3 -0
  148. package/node_modules/@openclaw/fs-safe/dist/native-staged-file-metadata.d.ts +3 -0
  149. package/node_modules/@openclaw/fs-safe/dist/native-staged-file-metadata.js +16 -0
  150. package/node_modules/@openclaw/fs-safe/dist/native-staged-file.d.ts +1 -1
  151. package/node_modules/@openclaw/fs-safe/dist/native-staged-file.js +15 -5
  152. package/node_modules/@openclaw/fs-safe/dist/native-stat-identity.d.ts +3 -0
  153. package/node_modules/@openclaw/fs-safe/dist/native-stat-identity.js +7 -0
  154. package/node_modules/@openclaw/fs-safe/dist/native-status.d.ts +17 -0
  155. package/node_modules/@openclaw/fs-safe/dist/native-status.js +30 -0
  156. package/node_modules/@openclaw/fs-safe/dist/native.d.ts +31 -4
  157. package/node_modules/@openclaw/fs-safe/dist/native.js +107 -9
  158. package/node_modules/@openclaw/fs-safe/dist/opened-realpath.js +9 -1
  159. package/node_modules/@openclaw/fs-safe/dist/overwrite-file-handle.js +4 -1
  160. package/node_modules/@openclaw/fs-safe/dist/owner-dacl-batch.js +1 -1
  161. package/node_modules/@openclaw/fs-safe/dist/owner-dacl.js +1 -1
  162. package/node_modules/@openclaw/fs-safe/dist/permission-exec.js +9 -1
  163. package/node_modules/@openclaw/fs-safe/dist/permissions-public.d.ts +1 -0
  164. package/node_modules/@openclaw/fs-safe/dist/permissions-public.js +1 -0
  165. package/node_modules/@openclaw/fs-safe/dist/permissions-windows.js +83 -47
  166. package/node_modules/@openclaw/fs-safe/dist/pinned-open.d.ts +2 -0
  167. package/node_modules/@openclaw/fs-safe/dist/pinned-open.js +8 -3
  168. package/node_modules/@openclaw/fs-safe/dist/pinned-write-input.js +13 -0
  169. package/node_modules/@openclaw/fs-safe/dist/pinned-write-staged.js +10 -8
  170. package/node_modules/@openclaw/fs-safe/dist/pinned-write-types.d.ts +2 -1
  171. package/node_modules/@openclaw/fs-safe/dist/pinned-write.js +7 -5
  172. package/node_modules/@openclaw/fs-safe/dist/pipe.d.ts +9 -0
  173. package/node_modules/@openclaw/fs-safe/dist/pipe.js +26 -0
  174. package/node_modules/@openclaw/fs-safe/dist/private-directory.js +1 -1
  175. package/node_modules/@openclaw/fs-safe/dist/private-producer-handoff.js +2 -5
  176. package/node_modules/@openclaw/fs-safe/dist/private-temp-workspace.d.ts +3 -2
  177. package/node_modules/@openclaw/fs-safe/dist/private-temp-workspace.js +38 -10
  178. package/node_modules/@openclaw/fs-safe/dist/publish-copy-stage.js +92 -10
  179. package/node_modules/@openclaw/fs-safe/dist/publish-file-failure.d.ts +3 -0
  180. package/node_modules/@openclaw/fs-safe/dist/publish-file-failure.js +3 -0
  181. package/node_modules/@openclaw/fs-safe/dist/publish-file.d.ts +5 -3
  182. package/node_modules/@openclaw/fs-safe/dist/publish-file.js +26 -20
  183. package/node_modules/@openclaw/fs-safe/dist/read-opened-file.d.ts +2 -0
  184. package/node_modules/@openclaw/fs-safe/dist/read-opened-file.js +3 -4
  185. package/node_modules/@openclaw/fs-safe/dist/realpath.js +32 -0
  186. package/node_modules/@openclaw/fs-safe/dist/regular-file.d.ts +4 -0
  187. package/node_modules/@openclaw/fs-safe/dist/regular-file.js +11 -15
  188. package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.js +3 -2
  189. package/node_modules/@openclaw/fs-safe/dist/root-copy.d.ts +18 -0
  190. package/node_modules/@openclaw/fs-safe/dist/root-copy.js +128 -0
  191. package/node_modules/@openclaw/fs-safe/dist/root-create-native.d.ts +8 -13
  192. package/node_modules/@openclaw/fs-safe/dist/root-create-native.js +252 -27
  193. package/node_modules/@openclaw/fs-safe/dist/root-directory-creation.js +5 -1
  194. package/node_modules/@openclaw/fs-safe/dist/root-directory-list-types.d.ts +11 -8
  195. package/node_modules/@openclaw/fs-safe/dist/root-directory-list.js +35 -13
  196. package/node_modules/@openclaw/fs-safe/dist/root-file-open-batch-sync.d.ts +8 -0
  197. package/node_modules/@openclaw/fs-safe/dist/root-file-open-batch-sync.js +108 -0
  198. package/node_modules/@openclaw/fs-safe/dist/root-file.d.ts +7 -0
  199. package/node_modules/@openclaw/fs-safe/dist/root-file.js +15 -0
  200. package/node_modules/@openclaw/fs-safe/dist/root-impl.d.ts +2 -0
  201. package/node_modules/@openclaw/fs-safe/dist/root-impl.js +154 -175
  202. package/node_modules/@openclaw/fs-safe/dist/root-mkdir-native.d.ts +2 -0
  203. package/node_modules/@openclaw/fs-safe/dist/root-mkdir-native.js +239 -0
  204. package/node_modules/@openclaw/fs-safe/dist/root-move-noreplace.js +37 -15
  205. package/node_modules/@openclaw/fs-safe/dist/root-native-creation-path.d.ts +32 -0
  206. package/node_modules/@openclaw/fs-safe/dist/root-native-creation-path.js +56 -0
  207. package/node_modules/@openclaw/fs-safe/dist/root-options.d.ts +2 -0
  208. package/node_modules/@openclaw/fs-safe/dist/root-public-types.d.ts +1 -0
  209. package/node_modules/@openclaw/fs-safe/dist/root-remove-native.js +95 -16
  210. package/node_modules/@openclaw/fs-safe/dist/root-remove.js +6 -4
  211. package/node_modules/@openclaw/fs-safe/dist/root-walk.js +23 -19
  212. package/node_modules/@openclaw/fs-safe/dist/root-write-admission.js +8 -6
  213. package/node_modules/@openclaw/fs-safe/dist/root-write-publication.js +5 -1
  214. package/node_modules/@openclaw/fs-safe/dist/secure-file-windows.js +3 -1
  215. package/node_modules/@openclaw/fs-safe/dist/secure-file.d.ts +2 -0
  216. package/node_modules/@openclaw/fs-safe/dist/secure-file.js +10 -4
  217. package/node_modules/@openclaw/fs-safe/dist/sibling-staged-file.js +1 -1
  218. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-reclaim.js +2 -2
  219. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.js +1 -1
  220. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-target.js +8 -1
  221. package/node_modules/@openclaw/fs-safe/dist/staged-directory.d.ts +13 -0
  222. package/node_modules/@openclaw/fs-safe/dist/staged-directory.js +29 -0
  223. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.js +5 -3
  224. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-descriptor.d.ts +8 -0
  225. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-descriptor.js +13 -2
  226. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-owner.js +71 -3
  227. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-ownership.d.ts +2 -1
  228. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-ownership.js +22 -0
  229. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-types.d.ts +3 -0
  230. package/node_modules/@openclaw/fs-safe/dist/test-hooks.d.ts +1 -0
  231. package/node_modules/@openclaw/fs-safe/dist/test-hooks.js +1 -0
  232. package/node_modules/@openclaw/fs-safe/dist/trash.js +2 -2
  233. package/node_modules/@openclaw/fs-safe/dist/types.d.ts +4 -0
  234. package/node_modules/@openclaw/fs-safe/dist/watch-native.js +2 -2
  235. package/node_modules/@openclaw/fs-safe/dist/windows-appcontainer.d.ts +5 -0
  236. package/node_modules/@openclaw/fs-safe/dist/windows-appcontainer.js +39 -0
  237. package/node_modules/@openclaw/fs-safe/dist/windows-owner.d.ts +1 -0
  238. package/node_modules/@openclaw/fs-safe/dist/windows-owner.js +25 -36
  239. package/node_modules/@openclaw/fs-safe/dist/windows-security-command.js +24 -5
  240. package/node_modules/@openclaw/fs-safe/dist/windows-security-facts.d.ts +2 -1
  241. package/node_modules/@openclaw/fs-safe/dist/windows-security-facts.js +4 -0
  242. package/node_modules/@openclaw/fs-safe/dist/windows-security-helper.d.ts +2 -0
  243. package/node_modules/@openclaw/fs-safe/dist/windows-security-helper.exe +0 -0
  244. package/node_modules/@openclaw/fs-safe/dist/windows-security-helper.js +7 -0
  245. package/node_modules/@openclaw/fs-safe/dist/windows-test-hooks.d.ts +16 -0
  246. package/node_modules/@openclaw/fs-safe/dist/windows-test-hooks.js +51 -0
  247. package/node_modules/@openclaw/fs-safe/dist/write-file-handle.d.ts +1 -0
  248. package/node_modules/@openclaw/fs-safe/dist/write-file-handle.js +12 -10
  249. package/node_modules/@openclaw/fs-safe/docs/advanced.md +2 -1
  250. package/node_modules/@openclaw/fs-safe/docs/archive.md +16 -0
  251. package/node_modules/@openclaw/fs-safe/docs/config.md +71 -1
  252. package/node_modules/@openclaw/fs-safe/docs/contributing.md +45 -5
  253. package/node_modules/@openclaw/fs-safe/docs/copy.md +45 -5
  254. package/node_modules/@openclaw/fs-safe/docs/durability.md +34 -7
  255. package/node_modules/@openclaw/fs-safe/docs/errors.md +8 -0
  256. package/node_modules/@openclaw/fs-safe/docs/guest.md +2 -0
  257. package/node_modules/@openclaw/fs-safe/docs/install.md +47 -27
  258. package/node_modules/@openclaw/fs-safe/docs/migrating-to-0.5.md +6 -6
  259. package/node_modules/@openclaw/fs-safe/docs/migrating-to-0.6.md +1 -1
  260. package/node_modules/@openclaw/fs-safe/docs/native-helper.md +79 -6
  261. package/node_modules/@openclaw/fs-safe/docs/native.md +279 -8
  262. package/node_modules/@openclaw/fs-safe/docs/permissions.md +64 -15
  263. package/node_modules/@openclaw/fs-safe/docs/pipe.md +81 -0
  264. package/node_modules/@openclaw/fs-safe/docs/platform-capabilities.md +63 -0
  265. package/node_modules/@openclaw/fs-safe/docs/public-api.md +10 -0
  266. package/node_modules/@openclaw/fs-safe/docs/queue-link-free-design.md +237 -0
  267. package/node_modules/@openclaw/fs-safe/docs/quickstart.md +23 -3
  268. package/node_modules/@openclaw/fs-safe/docs/reading.md +56 -2
  269. package/node_modules/@openclaw/fs-safe/docs/regular-file.md +2 -0
  270. package/node_modules/@openclaw/fs-safe/docs/secret-file.md +5 -5
  271. package/node_modules/@openclaw/fs-safe/docs/secure-file.md +1 -1
  272. package/node_modules/@openclaw/fs-safe/docs/security-model.md +35 -0
  273. package/node_modules/@openclaw/fs-safe/docs/sidecar-lock.md +31 -13
  274. package/node_modules/@openclaw/fs-safe/docs/staged-file.md +18 -0
  275. package/node_modules/@openclaw/fs-safe/docs/store.md +15 -0
  276. package/node_modules/@openclaw/fs-safe/docs/temp.md +39 -0
  277. package/node_modules/@openclaw/fs-safe/docs/testing.md +13 -0
  278. package/node_modules/@openclaw/fs-safe/docs/types.md +51 -81
  279. package/node_modules/@openclaw/fs-safe/docs/walk.md +4 -1
  280. package/node_modules/@openclaw/fs-safe/docs/watch.md +3 -2
  281. package/node_modules/@openclaw/fs-safe/docs/writing.md +121 -14
  282. package/node_modules/@openclaw/fs-safe/package.json +21 -12
  283. package/node_modules/@openclaw/fs-safe-darwin-arm64/fs-safe-native.node +0 -0
  284. package/node_modules/@openclaw/fs-safe-darwin-arm64/package.json +1 -1
  285. package/node_modules/@openclaw/fs-safe-darwin-x64/fs-safe-native.node +0 -0
  286. package/node_modules/@openclaw/fs-safe-darwin-x64/package.json +1 -1
  287. package/node_modules/@openclaw/fs-safe-freebsd-arm64/fs-safe-native.node +0 -0
  288. package/node_modules/@openclaw/fs-safe-freebsd-arm64/package.json +29 -0
  289. package/node_modules/@openclaw/fs-safe-freebsd-x64/fs-safe-native.node +0 -0
  290. package/node_modules/@openclaw/fs-safe-freebsd-x64/package.json +29 -0
  291. package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/fs-safe-native.node +0 -0
  292. package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/package.json +1 -1
  293. package/node_modules/@openclaw/fs-safe-linux-arm64-musl/fs-safe-native.node +0 -0
  294. package/node_modules/@openclaw/fs-safe-linux-arm64-musl/package.json +1 -1
  295. package/node_modules/@openclaw/fs-safe-linux-x64-gnu/fs-safe-native.node +0 -0
  296. package/node_modules/@openclaw/fs-safe-linux-x64-gnu/package.json +1 -1
  297. package/node_modules/@openclaw/fs-safe-linux-x64-musl/fs-safe-native.node +0 -0
  298. package/node_modules/@openclaw/fs-safe-linux-x64-musl/package.json +1 -1
  299. package/node_modules/@openclaw/fs-safe-win32-arm64-msvc/fs-safe-native.node +0 -0
  300. package/node_modules/@openclaw/fs-safe-win32-arm64-msvc/package.json +29 -0
  301. package/node_modules/@openclaw/fs-safe-win32-x64-msvc/fs-safe-native.node +0 -0
  302. package/node_modules/@openclaw/fs-safe-win32-x64-msvc/package.json +1 -1
  303. package/node_modules/typebox/build/value/clean/from_object.mjs +1 -1
  304. package/node_modules/typebox/package.json +1 -1
  305. package/openclaw.plugin.json +3 -0
  306. package/package.json +7 -6
  307. package/dist/.setup/runtime-setter-api-DtxDAM-x.mjs +0 -3
  308. package/dist/.setup/secret-contract-DSBRvhdZ.mjs +0 -95
  309. package/dist/.setup/secret-contract-api-DzEJ-X7n.mjs +0 -3
  310. package/dist/.setup/setup-plugin-api-BDAYk1a5.mjs +0 -3
  311. package/dist/.setup/thread-bindings-CT4P-OSZ.mjs +0 -365
  312. package/node_modules/@openclaw/fs-safe/dist/windows-security-bridge.cs +0 -336
  313. package/node_modules/@openclaw/fs-safe/dist/windows-security-bridge.ps1 +0 -90
@@ -0,0 +1,90 @@
1
+ import { t as getMatrixScopedEnvVarNames } from "./env-vars-aEBngJPa.mjs";
2
+ import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
3
+ import { collectSecretInputAssignment, createChannelSecretContract, hasConfiguredSecretInputValue, hasOwnProperty, normalizeSecretStringValue } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
4
+ //#region extensions/matrix/src/secret-contract.ts
5
+ function accountSecretOwner(accountId) {
6
+ return {
7
+ ownerKind: "account",
8
+ ownerId: `matrix:${normalizeAccountId(accountId)}`,
9
+ requiredForGateway: false,
10
+ disposition: "isolate"
11
+ };
12
+ }
13
+ const channelSecrets = createChannelSecretContract({
14
+ channelKey: "matrix",
15
+ account: ["accessToken", "password"],
16
+ channel: ["accessToken", "password"],
17
+ collect(params) {
18
+ const { channel: matrix, surface } = params;
19
+ const envAccessTokenConfigured = normalizeSecretStringValue(params.context.env.MATRIX_ACCESS_TOKEN).length > 0;
20
+ const defaultScopedAccessTokenConfigured = normalizeSecretStringValue(params.context.env[getMatrixScopedEnvVarNames("default").accessToken]).length > 0;
21
+ const defaultScopedPasswordConfigured = normalizeSecretStringValue(params.context.env[getMatrixScopedEnvVarNames("default").password]).length > 0;
22
+ const defaultAccount = surface.hasExplicitAccounts ? surface.accounts.find(({ accountId }) => normalizeAccountId(accountId) === DEFAULT_ACCOUNT_ID) : void 0;
23
+ const defaultAccountEnabled = surface.channelEnabled && (defaultAccount?.enabled ?? true);
24
+ const defaultAccountAccessTokenConfigured = hasConfiguredSecretInputValue(defaultAccount?.account.accessToken, params.defaults);
25
+ const defaultAccountPasswordConfigured = hasConfiguredSecretInputValue(defaultAccount?.account.password, params.defaults);
26
+ const baseAccessTokenConfigured = hasConfiguredSecretInputValue(matrix.accessToken, params.defaults);
27
+ collectSecretInputAssignment({
28
+ value: matrix.accessToken,
29
+ path: "channels.matrix.accessToken",
30
+ expected: "string",
31
+ defaults: params.defaults,
32
+ context: params.context,
33
+ active: defaultAccountEnabled && !defaultAccountAccessTokenConfigured && !defaultScopedAccessTokenConfigured,
34
+ inactiveReason: "Matrix channel or default account is disabled, or default-account access-token auth overrides the top-level accessToken.",
35
+ owner: accountSecretOwner(DEFAULT_ACCOUNT_ID),
36
+ apply: (value) => {
37
+ matrix.accessToken = value;
38
+ }
39
+ });
40
+ collectSecretInputAssignment({
41
+ value: matrix.password,
42
+ path: "channels.matrix.password",
43
+ expected: "string",
44
+ defaults: params.defaults,
45
+ context: params.context,
46
+ active: defaultAccountEnabled && !(baseAccessTokenConfigured || envAccessTokenConfigured || defaultScopedAccessTokenConfigured || defaultAccountAccessTokenConfigured || defaultAccountPasswordConfigured || defaultScopedPasswordConfigured),
47
+ inactiveReason: "Matrix channel or default account is disabled, or higher-precedence default-account auth is configured.",
48
+ owner: accountSecretOwner(DEFAULT_ACCOUNT_ID),
49
+ apply: (value) => {
50
+ matrix.password = value;
51
+ }
52
+ });
53
+ if (!surface.hasExplicitAccounts) return;
54
+ for (const { accountId, account, enabled } of surface.accounts) {
55
+ if (hasOwnProperty(account, "accessToken")) collectSecretInputAssignment({
56
+ value: account.accessToken,
57
+ path: `channels.matrix.accounts.${accountId}.accessToken`,
58
+ expected: "string",
59
+ defaults: params.defaults,
60
+ context: params.context,
61
+ active: enabled,
62
+ inactiveReason: "Matrix account is disabled.",
63
+ owner: accountSecretOwner(accountId),
64
+ apply: (value) => {
65
+ account.accessToken = value;
66
+ }
67
+ });
68
+ if (!hasOwnProperty(account, "password")) continue;
69
+ const accountAccessTokenConfigured = hasConfiguredSecretInputValue(account.accessToken, params.defaults);
70
+ const scopedEnvAccessTokenConfigured = normalizeSecretStringValue(params.context.env[getMatrixScopedEnvVarNames(accountId).accessToken]).length > 0;
71
+ const inheritedDefaultAccountAccessTokenConfigured = normalizeAccountId(accountId) === DEFAULT_ACCOUNT_ID && (baseAccessTokenConfigured || envAccessTokenConfigured);
72
+ collectSecretInputAssignment({
73
+ value: account.password,
74
+ path: `channels.matrix.accounts.${accountId}.password`,
75
+ expected: "string",
76
+ defaults: params.defaults,
77
+ context: params.context,
78
+ active: enabled && !(accountAccessTokenConfigured || scopedEnvAccessTokenConfigured || inheritedDefaultAccountAccessTokenConfigured),
79
+ inactiveReason: "Matrix account is disabled or this account has an accessToken configured.",
80
+ owner: accountSecretOwner(accountId),
81
+ apply: (value) => {
82
+ account.password = value;
83
+ }
84
+ });
85
+ }
86
+ }
87
+ });
88
+ const { secretTargetRegistryEntries, collectRuntimeConfigAssignments } = channelSecrets;
89
+ //#endregion
90
+ export { collectRuntimeConfigAssignments as n, secretTargetRegistryEntries as r, channelSecrets as t };
@@ -0,0 +1,2 @@
1
+ export { t as channelSecrets, n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-DxyzKSzf.mjs";
2
+ import "../secret-contract-api.js";
@@ -23,7 +23,7 @@ import MarkdownIt from "markdown-it";
23
23
  import { isAutoLinkedFileRef } from "openclaw/plugin-sdk/text-autolink-runtime";
24
24
  import { parseBuffer } from "music-metadata";
25
25
  //#region extensions/matrix/src/matrix/send/client.ts
26
- const loadMatrixSendClientRuntime = createLazyRuntimeModule(() => import("./client-bootstrap-D05xy1HB.mjs"));
26
+ const loadMatrixSendClientRuntime = createLazyRuntimeModule(() => import("./client-bootstrap-kOIDV4z_.mjs"));
27
27
  function resolveMediaMaxBytes(accountId, cfg) {
28
28
  if (!cfg) throw new Error("Matrix media limits requires a resolved runtime config. Load and resolve config at the command or gateway boundary, then pass cfg through the runtime path.");
29
29
  const mediaMaxMb = resolveMatrixAccountConfig({
@@ -532,10 +532,6 @@ function buildTextContent$1(body) {
532
532
  "org.matrix.msc1767.text": body
533
533
  };
534
534
  }
535
- function buildPollFallbackText(question, answers) {
536
- if (answers.length === 0) return question;
537
- return `${question}\n${answers.map((answer, idx) => `${idx + 1}. ${answer}`).join("\n")}`;
538
- }
539
535
  function buildPollStartContent(poll) {
540
536
  const normalized = normalizePollInput(poll);
541
537
  const answers = normalized.options.map((option, idx) => ({
@@ -543,7 +539,7 @@ function buildPollStartContent(poll) {
543
539
  ...buildTextContent$1(option)
544
540
  }));
545
541
  const isMultiple = normalized.maxSelections > 1;
546
- const fallbackText = buildPollFallbackText(normalized.question, normalized.options);
542
+ const fallbackText = `${normalized.question}\n${normalized.options.map((option, idx) => `${idx + 1}. ${option}`).join("\n")}`;
547
543
  return {
548
544
  [M_POLL_START]: {
549
545
  question: buildTextContent$1(normalized.question),
@@ -1550,27 +1546,17 @@ function resolveMatrixMsgType(contentType) {
1550
1546
  }
1551
1547
  //#endregion
1552
1548
  //#region extensions/matrix/src/matrix/send/media.ts
1553
- function buildMatrixMediaInfo(params) {
1554
- const base = {};
1555
- if (Number.isFinite(params.size)) base.size = params.size;
1556
- if (params.mimetype) base.mimetype = params.mimetype;
1557
- const info = params.imageInfo ? {
1558
- ...base,
1559
- ...params.imageInfo
1560
- } : base;
1561
- if (typeof params.durationMs === "number") return {
1562
- ...info,
1563
- duration: params.durationMs
1564
- };
1565
- if (!params.imageInfo && Object.keys(info).length === 0) return;
1566
- return info;
1567
- }
1568
1549
  function buildMediaContent(params) {
1569
1550
  const base = {
1570
1551
  msgtype: params.msgtype,
1571
1552
  body: params.body,
1572
1553
  filename: params.filename,
1573
- info: buildMatrixMediaInfo(params)
1554
+ info: {
1555
+ size: params.size,
1556
+ ...params.mimetype ? { mimetype: params.mimetype } : {},
1557
+ ...params.imageInfo,
1558
+ ...typeof params.durationMs === "number" ? { duration: params.durationMs } : {}
1559
+ }
1574
1560
  };
1575
1561
  if (!params.file && params.url) base.url = params.url;
1576
1562
  if (params.file) base.file = params.file;
@@ -1760,7 +1746,14 @@ async function sendMessageMatrix(to, message, opts) {
1760
1746
  let textRelation = relation;
1761
1747
  let pendingExtraContent = opts.extraContent;
1762
1748
  const events = [];
1763
- const prepareContent = (content, receiptKind) => {
1749
+ const prepareContent = async (content, receiptKind, markdown) => {
1750
+ await enrichMatrixFormattedContent({
1751
+ client,
1752
+ content,
1753
+ markdown,
1754
+ preparedBody: markdown === convertedText ? singleEventBody : void 0,
1755
+ tableMode
1756
+ });
1764
1757
  events.push({
1765
1758
  content: withMatrixExtraContentFields(content, pendingExtraContent),
1766
1759
  receiptKind
@@ -1796,7 +1789,7 @@ async function sendMessageMatrix(to, message, opts) {
1796
1789
  }) : void 0;
1797
1790
  const [firstChunk, ...rest] = chunks;
1798
1791
  const captionMarkdown = useVoice ? "" : firstChunk ?? "";
1799
- const content = buildMediaContent({
1792
+ await prepareContent(buildMediaContent({
1800
1793
  msgtype,
1801
1794
  body: useVoice ? "Voice message" : captionMarkdown || media.fileName || "(file)",
1802
1795
  url: uploaded.url,
@@ -1808,29 +1801,13 @@ async function sendMessageMatrix(to, message, opts) {
1808
1801
  relation,
1809
1802
  isVoice: useVoice,
1810
1803
  imageInfo
1811
- });
1812
- await enrichMatrixFormattedContent({
1813
- client,
1814
- content,
1815
- markdown: captionMarkdown,
1816
- preparedBody: captionMarkdown === convertedText ? singleEventBody : void 0,
1817
- tableMode
1818
- });
1819
- prepareContent(content, receiptKind);
1804
+ }), receiptKind, captionMarkdown);
1820
1805
  textChunks = useVoice ? chunks : rest;
1821
1806
  textRelation = useVoice || threadId ? relation : void 0;
1822
1807
  }
1823
1808
  for (const chunk of textChunks) {
1824
1809
  if (!chunk.trim()) continue;
1825
- const content = buildTextContent(chunk, textRelation);
1826
- await enrichMatrixFormattedContent({
1827
- client,
1828
- content,
1829
- markdown: chunk,
1830
- preparedBody: chunk === convertedText ? singleEventBody : void 0,
1831
- tableMode
1832
- });
1833
- prepareContent(content, "text");
1810
+ await prepareContent(buildTextContent(chunk, textRelation), "text", chunk);
1834
1811
  }
1835
1812
  plannedEvents = durableIdentity ? createMatrixPlannedEvents({
1836
1813
  identity: durableIdentity,
@@ -1,6 +1,6 @@
1
1
  import { a as resolveMatrixAccountConfig, n as hasExplicitMatrixAccountConfig } from "./account-config-CRsKoMqJ.mjs";
2
- import "./setup-core-CKnNTfgD.mjs";
3
- import { n as bootstrapMatrixVerification } from "./verification-B3VswneT.mjs";
2
+ import "./setup-core-DcCk1_Tv.mjs";
3
+ import { n as bootstrapMatrixVerification } from "./verification--qUbmRd-.mjs";
4
4
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
5
5
  //#region extensions/matrix/src/setup-bootstrap.ts
6
6
  async function maybeBootstrapNewEncryptedMatrixAccount(params) {
@@ -41,10 +41,6 @@ async function maybeBootstrapNewEncryptedMatrixAccount(params) {
41
41
  }
42
42
  }
43
43
  async function runMatrixSetupBootstrapAfterConfigWrite(params) {
44
- if (resolveMatrixAccountConfig({
45
- cfg: params.cfg,
46
- accountId: params.accountId
47
- }).encryption !== true) return;
48
44
  const bootstrap = await maybeBootstrapNewEncryptedMatrixAccount({
49
45
  previousCfg: params.previousCfg,
50
46
  cfg: params.cfg,
@@ -1,7 +1,7 @@
1
1
  import { i as __exportAll } from "./doctor-contract-CsTNmbMa.mjs";
2
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
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";
4
+ import { a as loadMatrixCredentials, o as loadMatrixCredentialsAsync, r as credentialsMatchConfig, t as captureMatrixCredentialsEnv } from "./credentials-read-D2ULV55A.mjs";
5
5
  import { n as resolveMatrixConfigPath, r as shouldStoreMatrixAccountAtTopLevel, t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.mjs";
6
6
  import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
7
7
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -125,6 +125,7 @@ function isMatrixAccountConfigured(prepared, stored) {
125
125
  }) : false;
126
126
  return prepared.hasHomeserver && (prepared.hasConfiguredAuth || hasStored);
127
127
  }
128
+ /** @deprecated Use resolveMatrixAccountAsync. Final compatibility day: 2026-12-31. */
128
129
  function resolveMatrixAccount(params) {
129
130
  const prepared = prepareMatrixAccount(params);
130
131
  const stored = prepared.hasHomeserver && !prepared.hasConfiguredAuth ? loadMatrixCredentials(params.env ?? process.env, prepared.account.accountId) : null;
@@ -391,10 +392,6 @@ const COMMON_SINGLE_ACCOUNT_KEYS_TO_MOVE = /* @__PURE__ */ new Set([
391
392
  ]);
392
393
  const MATRIX_SINGLE_ACCOUNT_KEYS_TO_MOVE = new Set(matrixSingleAccountKeysToMove);
393
394
  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
395
  function resolveExistingMatrixAccountKey(accounts, targetAccountId) {
399
396
  const normalizedTargetAccountId = normalizeAccountId$1(targetAccountId);
400
397
  return Object.keys(accounts).find((accountId) => normalizeAccountId$1(accountId) === normalizedTargetAccountId) ?? targetAccountId;
@@ -414,7 +411,7 @@ function moveSingleMatrixAccountConfigToNamedAccount(cfg) {
414
411
  if (keysToMove.length === 0) return cfg;
415
412
  const resolvedTargetAccountId = resolveExistingMatrixAccountKey(accounts, resolveSingleAccountPromotionTarget({ channel: base }));
416
413
  const nextAccount = { ...accounts[resolvedTargetAccountId] };
417
- for (const key of keysToMove) nextAccount[key] = cloneIfObject(base[key]);
414
+ for (const key of keysToMove) nextAccount[key] = structuredClone(base[key]);
418
415
  return patchTopLevelChannelConfigSection({
419
416
  cfg,
420
417
  channel: channel$1,
@@ -555,7 +552,7 @@ function createMatrixSetupWizardProxy(loadWizardModule) {
555
552
  };
556
553
  }
557
554
  const finishMatrixSetupAfterConfigWrite = async ({ previousCfg, cfg, accountId, runtime }) => {
558
- const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-CV-hHBXu.mjs");
555
+ const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-DmznRqYe.mjs");
559
556
  await runMatrixSetupBootstrapAfterConfigWrite({
560
557
  previousCfg,
561
558
  cfg,
@@ -0,0 +1,2 @@
1
+ export { n as matrixSetupPlugin } from "./channel.setup-Be8TYKMA.mjs";
2
+ import "../setup-plugin-api.js";
@@ -1,9 +1,8 @@
1
1
  import { t as getMatrixRuntime } from "./runtime-1kn1P6io.mjs";
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";
2
+ import { o as resolveMatrixSqliteStateEnv, r as assertMatrixSupportedStateFile } from "./retired-state-DOCruzWd.mjs";
3
+ import { o as resolveMatrixStoragePaths, r as recordCurrentStorageMetaDeviceId } from "./storage-l8V0XsGM.mjs";
4
4
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
5
5
  import path from "node:path";
6
- import { timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
7
6
  //#region extensions/matrix/src/matrix/monitor/startup-verification.ts
8
7
  const STARTUP_VERIFICATION_STATE_FILENAME = "startup-verification.json";
9
8
  const STARTUP_VERIFICATION_NAMESPACE = "startup-verification";
@@ -11,20 +10,13 @@ const STARTUP_VERIFICATION_MAX_ENTRIES = 1e3;
11
10
  const DEFAULT_STARTUP_VERIFICATION_MODE = "if-unverified";
12
11
  const DEFAULT_STARTUP_VERIFICATION_COOLDOWN_HOURS = 24;
13
12
  const DEFAULT_STARTUP_VERIFICATION_FAILURE_COOLDOWN_MS = 36e5;
14
- function normalizeCooldownHours(value) {
15
- if (typeof value !== "number" || !Number.isFinite(value)) return DEFAULT_STARTUP_VERIFICATION_COOLDOWN_HOURS;
16
- return Math.max(0, value);
17
- }
18
13
  function createStartupVerificationStore(params) {
19
- return getMatrixRuntime().state.openKeyedStore({
14
+ return getMatrixRuntime().state.openKeyedStoreV2({
20
15
  namespace: STARTUP_VERIFICATION_NAMESPACE,
21
16
  maxEntries: STARTUP_VERIFICATION_MAX_ENTRIES,
22
17
  env: resolveMatrixSqliteStateEnv(params)
23
18
  });
24
19
  }
25
- function resolveStartupVerificationTimestamp(nowMs) {
26
- return timestampMsToIsoString(nowMs) ?? timestampMsToIsoString(Date.now()) ?? "1970-01-01T00:00:00.000Z";
27
- }
28
20
  function resolveStartupVerificationRetryAfterMs(params) {
29
21
  if (!params.state || params.stateCooldownMs <= 0) return;
30
22
  if (params.state.userId && params.verification.userId && params.state.userId !== params.verification.userId) return;
@@ -64,9 +56,9 @@ async function ensureMatrixStartupVerification(params) {
64
56
  kind: "pending",
65
57
  verification
66
58
  };
67
- const cooldownMs = normalizeCooldownHours(params.accountConfig.startupVerificationCooldownHours) * 60 * 60 * 1e3;
59
+ const cooldownMs = Math.max(0, params.accountConfig.startupVerificationCooldownHours ?? DEFAULT_STARTUP_VERIFICATION_COOLDOWN_HOURS) * 60 * 60 * 1e3;
68
60
  const nowMs = params.nowMs ?? Date.now();
69
- const attemptedAt = resolveStartupVerificationTimestamp(nowMs);
61
+ const attemptedAt = new Date(nowMs).toISOString();
70
62
  const value = await createStartupVerificationStore(stateLocation).lookup(stateKey);
71
63
  const state = value && typeof value === "object" ? value : null;
72
64
  const retryAfterMs = resolveStartupVerificationRetryAfterMs({
@@ -0,0 +1,27 @@
1
+ import { c as resolveMatrixStateLayoutChildDepth } from "./storage-paths-B51JM-pC.mjs";
2
+ import path from "node:path";
3
+ import { hasNodeErrorCode } from "@openclaw/fs-safe/path";
4
+ import { walkDirectory } from "@openclaw/fs-safe/walk";
5
+ //#region extensions/matrix/src/matrix/state-layout-walk.ts
6
+ /** Traverse only shipped Matrix layouts; archives and unrelated descendants stay unopened. */
7
+ async function walkMatrixStateFiles(stateDir, includeFile, stateRootDepths = []) {
8
+ const matrixRoot = path.resolve(stateDir, "matrix");
9
+ const depths = /* @__PURE__ */ new Map([[matrixRoot, 0]]);
10
+ const result = await walkDirectory(matrixRoot, {
11
+ symlinks: "skip",
12
+ include: (entry) => entry.kind === "file" && includeFile(entry.name, depths.get(path.dirname(entry.path))),
13
+ descend: (entry) => {
14
+ const parentDepth = depths.get(path.dirname(entry.path));
15
+ const depth = entry.name === "state" && stateRootDepths.includes(parentDepth) ? 5 : resolveMatrixStateLayoutChildDepth(parentDepth, entry.name);
16
+ if (depth === null) return false;
17
+ depths.set(entry.path, depth);
18
+ return true;
19
+ }
20
+ });
21
+ return {
22
+ entries: result.entries,
23
+ failedDirs: result.failedDirs.filter((failure) => failure.path !== matrixRoot || !hasNodeErrorCode(failure.error, "ENOENT"))
24
+ };
25
+ }
26
+ //#endregion
27
+ export { walkMatrixStateFiles as t };
@@ -1,165 +1,12 @@
1
1
  import { t as getMatrixRuntime } from "./runtime-1kn1P6io.mjs";
2
2
  import { n as isMatrixActiveTokenRootDirectory, r as resolveMatrixAccountStorageRoot } from "./storage-paths-B51JM-pC.mjs";
3
- import { c as updateMatrixKeyedState, d as writeMatrixStateChunks, i as assertMatrixSupportedStateRoot, l as chunkMatrixStateJson, o as resolveMatrixSqliteStateEnv, r as assertMatrixSupportedStateFile, u as readMatrixStateChunks } from "./retired-state-DW5pLH05.mjs";
3
+ import { c as updateMatrixKeyedState, i as assertMatrixSupportedStateRoot, o as resolveMatrixSqliteStateEnv, r as assertMatrixSupportedStateFile } from "./retired-state-DOCruzWd.mjs";
4
+ import { n as MATRIX_RECOVERY_KEY_FILENAME, o as scoreMatrixCryptoStateInStore, t as MATRIX_IDB_SNAPSHOT_FILENAME } from "./crypto-state-store-D4wrCvFs.mjs";
4
5
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
5
6
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
6
- import { createHash, randomUUID } from "node:crypto";
7
7
  import path from "node:path";
8
- import { asSafeIntegerInRange } from "openclaw/plugin-sdk/number-runtime";
9
8
  import fs from "node:fs";
10
9
  import os from "node:os";
11
- //#region extensions/matrix/src/matrix/crypto-state-store.ts
12
- const STATE_KEY = "current";
13
- const RECOVERY_KEY_NAMESPACE = "recovery-key";
14
- const LEGACY_CRYPTO_MIGRATION_NAMESPACE = "legacy-crypto-migration";
15
- const IDB_SNAPSHOT_NAMESPACE = "idb-snapshot";
16
- const SMALL_STATE_MAX_ENTRIES = 10;
17
- const IDB_SNAPSHOT_MAX_ENTRIES = 2e4;
18
- const IDB_SNAPSHOT_MAX_CHUNKS = Math.floor(19999 / 2);
19
- const IDB_SNAPSHOT_CHUNK_BYTES = 24e3;
20
- const MATRIX_RECOVERY_KEY_FILENAME = "recovery-key.json";
21
- const MATRIX_IDB_SNAPSHOT_FILENAME = "crypto-idb-snapshot.json";
22
- function openMatrixRecoveryKeyStoreOptions(storageRootDir) {
23
- return {
24
- namespace: RECOVERY_KEY_NAMESPACE,
25
- maxEntries: SMALL_STATE_MAX_ENTRIES,
26
- env: resolveMatrixSqliteStateEnv({ stateDir: storageRootDir })
27
- };
28
- }
29
- function openMatrixLegacyCryptoMigrationStoreOptions(storageRootDir) {
30
- return {
31
- namespace: LEGACY_CRYPTO_MIGRATION_NAMESPACE,
32
- maxEntries: SMALL_STATE_MAX_ENTRIES,
33
- env: resolveMatrixSqliteStateEnv({ stateDir: storageRootDir })
34
- };
35
- }
36
- function openMatrixIdbSnapshotStoreOptions(storageRootDir) {
37
- return {
38
- namespace: IDB_SNAPSHOT_NAMESPACE,
39
- maxEntries: IDB_SNAPSHOT_MAX_ENTRIES,
40
- env: resolveMatrixSqliteStateEnv({ stateDir: storageRootDir })
41
- };
42
- }
43
- async function readMatrixRecoveryKeyStateForPathAsync(recoveryKeyPath, stateRuntime) {
44
- return normalizeMatrixStoredRecoveryKey(await stateRuntime.openKeyedStore(openMatrixRecoveryKeyStoreOptions(path.dirname(recoveryKeyPath))).lookup(resolveRecoveryKeyStateKeyForPath(recoveryKeyPath)));
45
- }
46
- async function writeMatrixRecoveryKeyStateForPathAsync(params) {
47
- const payload = normalizeMatrixStoredRecoveryKey(params.payload);
48
- if (!payload) throw new Error("Invalid Matrix recovery key state");
49
- const store = params.stateRuntime.openKeyedStore(openMatrixRecoveryKeyStoreOptions(path.dirname(params.recoveryKeyPath)));
50
- const key = resolveRecoveryKeyStateKeyForPath(params.recoveryKeyPath);
51
- if (params.preserveEncodedPrivateKey) {
52
- const update = (current) => normalizeMatrixStoredRecoveryKey({
53
- ...payload,
54
- encodedPrivateKey: normalizeMatrixStoredRecoveryKey(current)?.encodedPrivateKey
55
- }) ?? void 0;
56
- await updateMatrixKeyedState(store, key, update, async () => {
57
- if (!store.update) throw new Error("Matrix recovery key store does not support atomic updates");
58
- return await store.update(key, update);
59
- });
60
- return;
61
- }
62
- await store.register(key, payload);
63
- }
64
- async function readMatrixIdbSnapshotJson(storageRootDir, stateRuntime = getMatrixRuntime().state) {
65
- const store = stateRuntime.openKeyedStore(openMatrixIdbSnapshotStoreOptions(storageRootDir));
66
- const meta = await store.lookup(idbMetaKey());
67
- if (!isIdbSnapshotMeta(meta)) return null;
68
- const chunks = await readMatrixStateChunks(store, Array.from({ length: meta.chunkCount }, (_, index) => idbChunkKey(meta.generation, index)), "snapshot-chunk");
69
- if (!chunks) return null;
70
- const snapshotJson = chunks.join("");
71
- return meta.digest === digestText(snapshotJson) ? snapshotJson : null;
72
- }
73
- async function hasMatrixIdbSnapshotState(storageRootDir) {
74
- return isIdbSnapshotMeta(await getMatrixRuntime().state.openKeyedStore(openMatrixIdbSnapshotStoreOptions(storageRootDir)).lookup(idbMetaKey()));
75
- }
76
- async function writeMatrixIdbSnapshotJson(params) {
77
- const store = (params.stateRuntime ?? getMatrixRuntime().state).openKeyedStore(openMatrixIdbSnapshotStoreOptions(params.storageRootDir));
78
- const rows = buildIdbSnapshotRows(params.snapshotJson, params.databaseCount);
79
- await writeMatrixStateChunks(store, rows, idbChunkKeyPrefix());
80
- }
81
- async function scoreMatrixCryptoStateInStore(storageRootDir) {
82
- if (!matrixCryptoStateDatabaseExists(storageRootDir)) return 0;
83
- let score = 0;
84
- try {
85
- const migration = await getMatrixRuntime().state.openKeyedStore(openMatrixLegacyCryptoMigrationStoreOptions(storageRootDir)).lookup(STATE_KEY);
86
- if (isRecord(migration) && migration.version === 1 && typeof migration.accountId === "string" && (migration.restoreStatus === "pending" || migration.restoreStatus === "completed" || migration.restoreStatus === "manual-action-required")) score += 3;
87
- } catch {}
88
- try {
89
- if (await readMatrixRecoveryKeyStateForPathAsync(path.join(storageRootDir, "recovery-key.json"), getMatrixRuntime().state)) score += 2;
90
- } catch {}
91
- try {
92
- if (await hasMatrixIdbSnapshotState(storageRootDir)) score += 2;
93
- } catch {}
94
- return score;
95
- }
96
- function matrixCryptoStateDatabaseExists(storageRootDir) {
97
- return fs.existsSync(path.join(storageRootDir, "state", "openclaw.sqlite"));
98
- }
99
- function resolveRecoveryKeyStateKeyForPath(recoveryKeyPath) {
100
- const basename = path.basename(recoveryKeyPath);
101
- if (basename === "recovery-key.json") return STATE_KEY;
102
- return `file:${createHash("sha256").update(basename, "utf8").digest("hex").slice(0, 32)}`;
103
- }
104
- function normalizeMatrixStoredRecoveryKey(value) {
105
- if (!isRecord(value) || value.version !== 1 || typeof value.createdAt !== "string" || typeof value.privateKeyBase64 !== "string" || !value.privateKeyBase64.trim()) return null;
106
- return {
107
- version: 1,
108
- createdAt: value.createdAt,
109
- keyId: typeof value.keyId === "string" ? value.keyId : null,
110
- ...typeof value.encodedPrivateKey === "string" ? { encodedPrivateKey: value.encodedPrivateKey } : {},
111
- privateKeyBase64: value.privateKeyBase64,
112
- ...isRecord(value.keyInfo) ? { keyInfo: {
113
- ...value.keyInfo.passphrase !== void 0 ? { passphrase: value.keyInfo.passphrase } : {},
114
- ...typeof value.keyInfo.name === "string" ? { name: value.keyInfo.name } : {}
115
- } } : {}
116
- };
117
- }
118
- function buildIdbSnapshotRows(snapshotJson, databaseCount) {
119
- const generation = randomUUID().replaceAll("-", "");
120
- const chunks = chunkMatrixStateJson(snapshotJson, IDB_SNAPSHOT_CHUNK_BYTES, IDB_SNAPSHOT_MAX_CHUNKS, "Matrix IndexedDB snapshot exceeds SQLite chunk limit").map((data, index) => ({
121
- key: idbChunkKey(generation, index),
122
- value: {
123
- kind: "snapshot-chunk",
124
- index,
125
- data
126
- }
127
- }));
128
- return {
129
- chunks,
130
- meta: {
131
- key: idbMetaKey(),
132
- value: {
133
- kind: "meta",
134
- version: 1,
135
- generation,
136
- chunkCount: chunks.length,
137
- digest: digestText(snapshotJson),
138
- databaseCount,
139
- persistedAt: (/* @__PURE__ */ new Date()).toISOString()
140
- }
141
- }
142
- };
143
- }
144
- function idbMetaKey() {
145
- return `${STATE_KEY}:meta`;
146
- }
147
- function idbChunkKeyPrefix() {
148
- return `${STATE_KEY}:snapshot:`;
149
- }
150
- function idbChunkKey(generation, index) {
151
- return `${idbChunkKeyPrefix()}${generation}:${index}`;
152
- }
153
- function digestText(value) {
154
- return createHash("sha256").update(value, "utf8").digest("hex");
155
- }
156
- function isIdbSnapshotMeta(value) {
157
- return isRecord(value) && value.kind === "meta" && value.version === 1 && typeof value.generation === "string" && value.generation.trim() !== "" && asSafeIntegerInRange(value.chunkCount, {
158
- min: 0,
159
- max: IDB_SNAPSHOT_MAX_CHUNKS
160
- }) !== void 0 && typeof value.digest === "string" && asSafeIntegerInRange(value.databaseCount, { min: 0 }) !== void 0 && typeof value.persistedAt === "string";
161
- }
162
- //#endregion
163
10
  //#region extensions/matrix/src/matrix/client/storage-metadata.ts
164
11
  const STORAGE_META_NAMESPACE = "storage-meta";
165
12
  const STORAGE_META_STATE_KEY = "current";
@@ -193,7 +40,7 @@ function normalizeMatrixStorageMetadata(value) {
193
40
  const DEFAULT_ACCOUNT_KEY = "default";
194
41
  const STORAGE_META_FILENAME = "storage-meta.json";
195
42
  function openStorageMetaStore(rootDir) {
196
- return getMatrixRuntime().state.openKeyedStore(openMatrixStorageMetaStoreOptions(rootDir));
43
+ return getMatrixRuntime().state.openKeyedStoreV2(openMatrixStorageMetaStoreOptions(rootDir));
197
44
  }
198
45
  async function scoreStorageRoot(rootDir, metadata) {
199
46
  let score = 0;
@@ -336,7 +183,7 @@ async function maybeMigrateLegacyStorage({ storagePaths }) {
336
183
  const { rootDir, storagePath } = storagePaths;
337
184
  await assertMatrixSupportedStateRoot(rootDir);
338
185
  if (!fs.existsSync(storagePath)) return;
339
- const syncCache = await import("./sync-cache-state-D4G-fi3t.mjs").then((n) => n.o);
186
+ const syncCache = await import("./sync-cache-state-Cnm4TCEI.mjs").then((n) => n.o);
340
187
  if (!await syncCache.readLegacyMatrixSyncCacheState(rootDir)) return;
341
188
  const logger = getMatrixRuntime().logging.getChildLogger({ module: "matrix-storage" });
342
189
  fs.mkdirSync(rootDir, { recursive: true });
@@ -344,7 +191,7 @@ async function maybeMigrateLegacyStorage({ storagePaths }) {
344
191
  try {
345
192
  const persisted = await syncCache.readLegacyMatrixSyncCacheState(rootDir);
346
193
  if (!persisted) return;
347
- const store = getMatrixRuntime().state.openKeyedStore(syncCache.openMatrixSyncCacheStoreOptions(rootDir));
194
+ const store = getMatrixRuntime().state.openKeyedStoreV2(syncCache.openMatrixSyncCacheStoreOptions(rootDir));
348
195
  if (!await syncCache.hasMatrixSyncCacheStateInStore({
349
196
  storageRootDir: rootDir,
350
197
  store
@@ -382,13 +229,7 @@ async function mutateStorageMeta(rootDir, mutation) {
382
229
  try {
383
230
  const store = openStorageMetaStore(rootDir);
384
231
  const decode = (value) => normalizeMatrixStorageMetadata(value) ?? {};
385
- return await updateMatrixKeyedState(store, STORAGE_META_STATE_KEY, (current) => prepareStorageMetaMutation(decode(current), mutation) ?? void 0, () => {
386
- const legacyStore = getMatrixRuntime().state.openSyncKeyedStore(openMatrixStorageMetaStoreOptions(rootDir));
387
- const next = prepareStorageMetaMutation(decode(legacyStore.lookup(STORAGE_META_STATE_KEY)), mutation);
388
- if (!next) return false;
389
- legacyStore.register(STORAGE_META_STATE_KEY, next);
390
- return true;
391
- }, "skip");
232
+ return await updateMatrixKeyedState(store, STORAGE_META_STATE_KEY, (current) => prepareStorageMetaMutation(decode(current), mutation) ?? void 0, "skip");
392
233
  } catch {
393
234
  return false;
394
235
  }
@@ -436,4 +277,4 @@ async function repairCurrentTokenStorageMetaDeviceId(params) {
436
277
  });
437
278
  }
438
279
  //#endregion
439
- export { resolveMatrixStateFilePath as a, readMatrixIdbSnapshotJson as c, writeMatrixRecoveryKeyStateForPathAsync as d, repairCurrentTokenStorageMetaDeviceId as i, readMatrixRecoveryKeyStateForPathAsync as l, maybeMigrateLegacyStorage as n, resolveMatrixStoragePaths as o, recordCurrentStorageMetaDeviceId as r, writeStorageMeta as s, claimCurrentTokenStorageState as t, writeMatrixIdbSnapshotJson as u };
280
+ export { resolveMatrixStateFilePath as a, repairCurrentTokenStorageMetaDeviceId as i, maybeMigrateLegacyStorage as n, resolveMatrixStoragePaths as o, recordCurrentStorageMetaDeviceId as r, writeStorageMeta as s, claimCurrentTokenStorageState as t };
@@ -1,4 +1,4 @@
1
- import { a as listBindingsForAccount, i as listAllBindings, n as getMatrixThreadBindingManager, o as removeBindingRecord, s as resolveBindingKey } from "./thread-bindings-shared-CbsFNbAY.mjs";
1
+ import { a as listBindingsForAccount, i as listAllBindings, n as getMatrixThreadBindingManager, s as resolveBindingKey } from "./thread-bindings-shared-CPjUA0Ib.mjs";
2
2
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import { getSessionBindingService } from "openclaw/plugin-sdk/conversation-binding-runtime";
4
4
  //#region extensions/matrix/src/matrix/subagent-hooks.ts
@@ -21,12 +21,13 @@ async function handleMatrixSubagentEnded(event) {
21
21
  })).some((entry) => entry.bindingId === bindingId)) removedBindingKeys.add(bindingId);
22
22
  }
23
23
  }
24
- const affectedAccountIds = /* @__PURE__ */ new Set();
25
- for (const binding of matching) {
26
- if (removedBindingKeys.has(resolveBindingKey(binding))) continue;
27
- if (removeBindingRecord(binding)) affectedAccountIds.add(binding.accountId);
24
+ const pendingByAccount = /* @__PURE__ */ new Map();
25
+ for (const binding of matching) if (!removedBindingKeys.has(resolveBindingKey(binding))) {
26
+ const pending = pendingByAccount.get(binding.accountId) ?? [];
27
+ pending.push(binding);
28
+ pendingByAccount.set(binding.accountId, pending);
28
29
  }
29
- for (const acctId of affectedAccountIds) await getMatrixThreadBindingManager(acctId)?.persist();
30
+ for (const [bindingAccountId, pending] of pendingByAccount) await getMatrixThreadBindingManager(bindingAccountId)?.removeBindingsAsync(pending);
30
31
  }
31
32
  function handleMatrixSubagentDeliveryTarget(event) {
32
33
  if (!event.expectsCompletionMessage) return;
@@ -1,5 +1,5 @@
1
1
  import { i as __exportAll } from "./doctor-contract-CsTNmbMa.mjs";
2
- import { d as writeMatrixStateChunks, l as chunkMatrixStateJson, o as resolveMatrixSqliteStateEnv, u as readMatrixStateChunks } from "./retired-state-DW5pLH05.mjs";
2
+ import { d as writeMatrixStateChunks, l as chunkMatrixStateJson, o as resolveMatrixSqliteStateEnv, u as readMatrixStateChunks } from "./retired-state-DOCruzWd.mjs";
3
3
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import { createHash, randomUUID } from "node:crypto";
5
5
  import path from "node:path";