@openclaw/matrix 2026.9.8 → 2026.10.1-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.
- package/dist/.setup/{account-selection-B7axQ80R.mjs → account-selection-BDeeqwwR.mjs} +1 -1
- package/dist/.setup/{accounts-WkgrIxMt.mjs → accounts-C_r0UlEm.mjs} +2 -2
- package/dist/.setup/{approval-handler.runtime-C-pw3NvY.mjs → approval-handler.runtime-QkHLH2az.mjs} +14 -19
- package/dist/.setup/{approval-reactions-BrS5ECU0.mjs → approval-reactions-DhB6gNPU.mjs} +11 -25
- package/dist/.setup/{channel-DXenXmj0.mjs → channel-CeRXEAEP.mjs} +17 -46
- package/dist/.setup/{channel.runtime-BXUawOno.mjs → channel.runtime-DBQA2y1F.mjs} +6 -6
- package/dist/.setup/{channel.setup-DWfLaXqT.mjs → channel.setup-DC2t7_PK.mjs} +12 -26
- package/dist/.setup/{cli-IhZO2OEj.mjs → cli-Be8tdNw8.mjs} +24 -45
- package/dist/.setup/{cli-metadata-nowEgdY0.mjs → cli-metadata-CtcjBFhc.mjs} +1 -1
- package/dist/.setup/{client-BXATebyo.mjs → client-DY3HExqI.mjs} +3 -3
- package/dist/.setup/{client-bootstrap-BiHX55is.mjs → client-bootstrap-CZvJjr29.mjs} +1 -1
- package/dist/.setup/{client-Ccv77kwh.mjs → client-kmih04ng.mjs} +21 -40
- package/dist/.setup/{client-support-Bn9Bk0-H.mjs → client-support-D7BlioUb.mjs} +14 -23
- package/dist/.setup/{config-update-5m1Un5gJ.mjs → config-update-CZndPxNd.mjs} +29 -72
- package/dist/.setup/{create-client-DRZ580E3.mjs → create-client-CbJVyFDy.mjs} +5 -5
- package/dist/.setup/{credentials-C9qDO5-2.mjs → credentials-C2dvc_kB.mjs} +1 -1
- package/dist/.setup/{credentials-read-KD4o5biZ.mjs → credentials-read-CqRiEAQa.mjs} +1 -1
- package/dist/.setup/{crypto-runtime-DPjIDF8H.mjs → crypto-runtime-B2AjWo-i.mjs} +223 -79
- package/dist/.setup/{deps-CLQ4EOq7.mjs → deps-CFNl7tQo.mjs} +14 -39
- package/dist/.setup/{device-health-U-yoVjPw.mjs → device-health-Be60VF1w.mjs} +1 -1
- package/dist/.setup/{direct-management-Cn2t8n1V.mjs → direct-management-DJtQhLKH.mjs} +4 -8
- package/dist/.setup/{directory-live-_sw-Q7KO.mjs → directory-live-DW5UykLL.mjs} +3 -3
- package/dist/.setup/{doctor-contract-De6geW0h.mjs → doctor-contract-CsTNmbMa.mjs} +10 -133
- package/dist/.setup/{draft-stream-CdVMstpR.mjs → draft-stream-B87DfA6a.mjs} +4 -8
- package/dist/.setup/{encryption-guidance-B6797jNA.mjs → encryption-guidance-BEjKbiMR.mjs} +1 -1
- package/dist/.setup/{exec-approvals-fsiMQ1ce.mjs → exec-approvals-BLDAMyHs.mjs} +6 -19
- package/dist/.setup/{file-sync-store-B-9bMb_O.mjs → file-sync-store-Clc9iEdn.mjs} +3 -3
- package/dist/.setup/{http-client-C1XvVD3K.mjs → http-client-DfJY5Ck0.mjs} +8 -29
- package/dist/.setup/{inbound-dedupe-BGrMrTTu.mjs → inbound-dedupe-C-EBGY0B.mjs} +1 -1
- package/dist/.setup/{joined-room-encryption-TZoOKXgh.mjs → joined-room-encryption-BAD70N5n.mjs} +1 -1
- package/dist/.setup/logger-CXQnpXCt.mjs +44 -0
- package/dist/.setup/{logging-mhnFQGzB.mjs → logging-BKV8TYQq.mjs} +7 -32
- package/dist/.setup/{messages-Buz27pi5.mjs → messages-uCbwLRKS.mjs} +5 -8
- package/dist/.setup/{monitor-BBg5qgov.mjs → monitor-skIntQVG.mjs} +109 -180
- package/dist/.setup/{onboarding-hJaieQj5.mjs → onboarding-Cm_tOJxs.mjs} +12 -19
- package/dist/.setup/{outbound-C9vBijaH.mjs → outbound-CqQou3ny.mjs} +16 -22
- package/dist/.setup/{profile-B3DD2jYa.mjs → profile-DS0xdJAi.mjs} +11 -31
- package/dist/.setup/{profile-update-CmxIAd4c.mjs → profile-update-C1n8SRqH.mjs} +3 -3
- package/dist/.setup/{reaction-events-mnzc_JvP.mjs → reaction-events-Cqq46xsG.mjs} +5 -5
- package/dist/.setup/{resolve-targets-BFq3q4c9.mjs → resolve-targets-DFeU1Ww6.mjs} +2 -2
- package/dist/.setup/retired-state-BXUQ2I-C.mjs +91 -0
- package/dist/.setup/{room-info-BbTGRJcR.mjs → room-info-BPMbwe8I.mjs} +33 -50
- package/dist/.setup/{sdk-DmRVM0VA.mjs → sdk-CgQGkCsS.mjs} +226 -182
- package/dist/.setup/{send-GOF64QRc.mjs → send-B1Y2L4wj.mjs} +19 -68
- package/dist/.setup/{setup-bootstrap-AzalcuCW.mjs → setup-bootstrap-UNIGyKnk.mjs} +2 -2
- package/dist/.setup/{setup-core-BeifoeL4.mjs → setup-core-6DppLENo.mjs} +5 -5
- package/dist/.setup/{setup-plugin-api-Bsbdw41x.mjs → setup-plugin-api-BRs9bcp4.mjs} +1 -1
- package/dist/.setup/startup-verification-D00eUt74.mjs +122 -0
- package/dist/.setup/storage-D7agewjH.mjs +464 -0
- package/dist/.setup/{sync-cache-state-C6sEmvJK.mjs → sync-cache-state-C2z64uyk.mjs} +10 -24
- package/dist/.setup/{thread-bindings-jXu_9cHE.mjs → thread-bindings-DveHVZqN.mjs} +13 -71
- package/dist/.setup/{tool-actions-Ce7Okg6m.mjs → tool-actions-BqlK2ilM.mjs} +51 -73
- package/dist/.setup/{verification-C45rOZkM.mjs → verification-kMlFYUn0.mjs} +10 -27
- package/dist/api.js +5 -5
- package/dist/channel-plugin-api.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/contract-api.js +2 -2
- package/dist/doctor-contract-api.js +48 -201
- package/dist/helper-api.js +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/runtime-api.js +3 -3
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/node_modules/@openclaw/fs-safe/CHANGELOG.md +95 -0
- package/node_modules/@openclaw/fs-safe/README.md +70 -379
- package/node_modules/@openclaw/fs-safe/dist/absolute-path.js +35 -51
- package/node_modules/@openclaw/fs-safe/dist/advanced.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/advanced.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/archive-input.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/archive-parser.wasm +0 -0
- package/node_modules/@openclaw/fs-safe/dist/archive-staging.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/archive-staging.js +9 -10
- package/node_modules/@openclaw/fs-safe/dist/archive.js +2 -5
- package/node_modules/@openclaw/fs-safe/dist/atomic-io.d.ts +51 -0
- package/node_modules/@openclaw/fs-safe/dist/atomic-io.js +242 -0
- package/node_modules/@openclaw/fs-safe/dist/config.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/config.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/copy-file-input.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/copy-file-input.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/copy-tree-portable.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/create.js +12 -5
- package/node_modules/@openclaw/fs-safe/dist/directory-guard.d.ts +11 -0
- package/node_modules/@openclaw/fs-safe/dist/directory-guard.js +4 -7
- package/node_modules/@openclaw/fs-safe/dist/entry-publication-types.d.ts +55 -0
- package/node_modules/@openclaw/fs-safe/dist/entry-publication-types.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/entry-publication.d.ts +8 -0
- package/node_modules/@openclaw/fs-safe/dist/entry-publication.js +262 -0
- package/node_modules/@openclaw/fs-safe/dist/exclusive-create.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/exclusive-create.js +22 -0
- package/node_modules/@openclaw/fs-safe/dist/file-cleanup.d.ts +1 -6
- package/node_modules/@openclaw/fs-safe/dist/file-cleanup.js +3 -6
- package/node_modules/@openclaw/fs-safe/dist/file-identity.js +3 -6
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-io.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-mutation.js +9 -0
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root.js +4 -6
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-stale-admission.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync.js +8 -0
- package/node_modules/@openclaw/fs-safe/dist/file-store-boundary.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/file-store-sync-write.js +20 -18
- package/node_modules/@openclaw/fs-safe/dist/file-store.js +4 -10
- package/node_modules/@openclaw/fs-safe/dist/fs.d.ts +2 -10
- package/node_modules/@openclaw/fs-safe/dist/fs.js +2 -10
- package/node_modules/@openclaw/fs-safe/dist/guarded-mkdir.d.ts +3 -4
- package/node_modules/@openclaw/fs-safe/dist/guarded-mkdir.js +6 -18
- package/node_modules/@openclaw/fs-safe/dist/guest-dispatch-python.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/guest-native-python.js +0 -2
- package/node_modules/@openclaw/fs-safe/dist/guest.js +3 -9
- package/node_modules/@openclaw/fs-safe/dist/index.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/index.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/json-durable-queue-directory.js +1 -5
- package/node_modules/@openclaw/fs-safe/dist/json.js +19 -37
- package/node_modules/@openclaw/fs-safe/dist/move-path.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/mutation-authority.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/mutation-authority.js +9 -1
- package/node_modules/@openclaw/fs-safe/dist/native-binding.d.ts +47 -2
- package/node_modules/@openclaw/fs-safe/dist/native-config.d.ts +1 -9
- package/node_modules/@openclaw/fs-safe/dist/native-config.js +6 -40
- package/node_modules/@openclaw/fs-safe/dist/native-parent-admission.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/native-parent-admission.js +5 -2
- package/node_modules/@openclaw/fs-safe/dist/native-pinned-write.js +11 -316
- package/node_modules/@openclaw/fs-safe/dist/native-policy-parent-windows.d.ts +7 -7
- package/node_modules/@openclaw/fs-safe/dist/native-policy-parent-windows.js +28 -175
- package/node_modules/@openclaw/fs-safe/dist/native-policy-parent.d.ts +15 -0
- package/node_modules/@openclaw/fs-safe/dist/native-policy-parent.js +418 -0
- package/node_modules/@openclaw/fs-safe/dist/native-rename-outcome.js +9 -4
- package/node_modules/@openclaw/fs-safe/dist/native-staged-file.js +17 -13
- package/node_modules/@openclaw/fs-safe/dist/native-staged-symlink.js +6 -24
- package/node_modules/@openclaw/fs-safe/dist/native.js +5 -1
- package/node_modules/@openclaw/fs-safe/dist/path-case.js +10 -9
- package/node_modules/@openclaw/fs-safe/dist/path-scope-lexical.js +4 -1
- package/node_modules/@openclaw/fs-safe/dist/path-segment-route.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/path-segment-route.js +3 -0
- package/node_modules/@openclaw/fs-safe/dist/path.js +4 -1
- package/node_modules/@openclaw/fs-safe/dist/permissions-windows.d.ts +0 -1
- package/node_modules/@openclaw/fs-safe/dist/pinned-mutation-admission.js +1 -3
- package/node_modules/@openclaw/fs-safe/dist/pinned-write-staged.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/pinned-write.js +9 -10
- package/node_modules/@openclaw/fs-safe/dist/private-producer-handoff.js +3 -6
- package/node_modules/@openclaw/fs-safe/dist/publish-copy-stage.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/publish-file.js +4 -3
- package/node_modules/@openclaw/fs-safe/dist/replace-file-buffer.d.ts +3 -4
- package/node_modules/@openclaw/fs-safe/dist/replace-file-buffer.js +18 -32
- package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-fallback.d.ts +5 -17
- package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-fallback.js +92 -230
- package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-source.d.ts +4 -15
- package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-source.js +22 -63
- package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.d.ts +9 -34
- package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.js +78 -83
- package/node_modules/@openclaw/fs-safe/dist/replace-file-destination.d.ts +18 -20
- package/node_modules/@openclaw/fs-safe/dist/replace-file-destination.js +64 -98
- package/node_modules/@openclaw/fs-safe/dist/replace-file-temp-owner.d.ts +16 -33
- package/node_modules/@openclaw/fs-safe/dist/replace-file-temp-owner.js +61 -200
- package/node_modules/@openclaw/fs-safe/dist/replace-file-types.d.ts +1 -6
- package/node_modules/@openclaw/fs-safe/dist/replace-file.js +76 -216
- package/node_modules/@openclaw/fs-safe/dist/root-boundary.js +14 -24
- package/node_modules/@openclaw/fs-safe/dist/root-context.d.ts +1 -4
- package/node_modules/@openclaw/fs-safe/dist/root-context.js +4 -19
- package/node_modules/@openclaw/fs-safe/dist/root-create-native.d.ts +52 -0
- package/node_modules/@openclaw/fs-safe/dist/root-create-native.js +350 -0
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list-types.d.ts +35 -0
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list-types.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list.d.ts +2 -27
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list.js +31 -28
- package/node_modules/@openclaw/fs-safe/dist/root-directory.js +1 -4
- package/node_modules/@openclaw/fs-safe/dist/root-errors.js +34 -0
- package/node_modules/@openclaw/fs-safe/dist/root-file.js +9 -21
- package/node_modules/@openclaw/fs-safe/dist/root-impl.js +105 -37
- package/node_modules/@openclaw/fs-safe/dist/root-move-noreplace.d.ts +7 -2
- package/node_modules/@openclaw/fs-safe/dist/root-move-noreplace.js +67 -38
- package/node_modules/@openclaw/fs-safe/dist/root-observed-path.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/root-observed-path.js +0 -2
- package/node_modules/@openclaw/fs-safe/dist/root-options.d.ts +2 -3
- package/node_modules/@openclaw/fs-safe/dist/root-path-existing.js +3 -1
- package/node_modules/@openclaw/fs-safe/dist/root-path-stat.js +68 -85
- package/node_modules/@openclaw/fs-safe/dist/root-path.js +6 -1
- package/node_modules/@openclaw/fs-safe/dist/root-paths-lexical.d.ts +4 -0
- package/node_modules/@openclaw/fs-safe/dist/root-paths-lexical.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/root-paths.js +4 -9
- package/node_modules/@openclaw/fs-safe/dist/root-remove-native.d.ts +4 -0
- package/node_modules/@openclaw/fs-safe/dist/root-remove-native.js +311 -0
- package/node_modules/@openclaw/fs-safe/dist/root-remove.d.ts +11 -0
- package/node_modules/@openclaw/fs-safe/dist/root-remove.js +3 -1
- package/node_modules/@openclaw/fs-safe/dist/root-walk.d.ts +2 -2
- package/node_modules/@openclaw/fs-safe/dist/root-walk.js +1 -3
- package/node_modules/@openclaw/fs-safe/dist/root-write-admission.d.ts +3 -3
- package/node_modules/@openclaw/fs-safe/dist/root-write-admission.js +8 -10
- package/node_modules/@openclaw/fs-safe/dist/safe-path-segment.d.ts +0 -1
- package/node_modules/@openclaw/fs-safe/dist/safe-path-segment.js +0 -4
- package/node_modules/@openclaw/fs-safe/dist/secret-file.js +12 -9
- package/node_modules/@openclaw/fs-safe/dist/secure-temp-dir.d.ts +0 -2
- package/node_modules/@openclaw/fs-safe/dist/sibling-staged-file.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/sibling-temp.js +7 -4
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-acquire.js +13 -6
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-reclaim.d.ts +0 -3
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-reclaim.js +5 -23
- package/node_modules/@openclaw/fs-safe/dist/staged-file-settlement.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/staged-file-settlement.js +11 -6
- package/node_modules/@openclaw/fs-safe/dist/temp-cleanup.js +1 -8
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.js +2 -9
- package/node_modules/@openclaw/fs-safe/dist/text-atomic.d.ts +1 -6
- package/node_modules/@openclaw/fs-safe/dist/trash.js +6 -2
- package/node_modules/@openclaw/fs-safe/dist/walk.js +100 -46
- package/node_modules/@openclaw/fs-safe/dist/watch-hints.d.ts +7 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-hints.js +235 -19
- package/node_modules/@openclaw/fs-safe/dist/watch-native.d.ts +21 -2
- package/node_modules/@openclaw/fs-safe/dist/watch-native.js +21 -3
- package/node_modules/@openclaw/fs-safe/dist/watch-rescan.d.ts +6 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-rescan.js +111 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-scan.d.ts +13 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-scan.js +27 -4
- package/node_modules/@openclaw/fs-safe/dist/watch-stream.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/watch.js +131 -40
- package/node_modules/@openclaw/fs-safe/dist/windows-path-alias.d.ts +8 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-path-alias.js +24 -6
- package/node_modules/@openclaw/fs-safe/dist/windows-path-syntax.d.ts +13 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-path-syntax.js +51 -0
- package/node_modules/@openclaw/fs-safe/docs/advanced.md +4 -0
- package/node_modules/@openclaw/fs-safe/docs/atomic.md +4 -1
- package/node_modules/@openclaw/fs-safe/docs/config.md +6 -14
- package/node_modules/@openclaw/fs-safe/docs/contributing.md +4 -14
- package/node_modules/@openclaw/fs-safe/docs/durability.md +6 -29
- package/node_modules/@openclaw/fs-safe/docs/entry-publication.md +146 -0
- package/node_modules/@openclaw/fs-safe/docs/errors.md +16 -0
- package/node_modules/@openclaw/fs-safe/docs/file-store.md +28 -5
- package/node_modules/@openclaw/fs-safe/docs/index.md +2 -31
- package/node_modules/@openclaw/fs-safe/docs/install.md +10 -31
- package/node_modules/@openclaw/fs-safe/docs/json.md +1 -1
- package/node_modules/@openclaw/fs-safe/docs/local-roots.md +0 -1
- package/node_modules/@openclaw/fs-safe/docs/migrating-to-0.5.md +12 -12
- package/node_modules/@openclaw/fs-safe/docs/native-helper.md +35 -96
- package/node_modules/@openclaw/fs-safe/docs/native.md +22 -20
- package/node_modules/@openclaw/fs-safe/docs/path.md +1 -1
- package/node_modules/@openclaw/fs-safe/docs/permissions.md +1 -2
- package/node_modules/@openclaw/fs-safe/docs/public-api.md +1 -2
- package/node_modules/@openclaw/fs-safe/docs/reading.md +1 -2
- package/node_modules/@openclaw/fs-safe/docs/root.md +26 -184
- package/node_modules/@openclaw/fs-safe/docs/secret-file.md +1 -1
- package/node_modules/@openclaw/fs-safe/docs/security-model.md +115 -3
- package/node_modules/@openclaw/fs-safe/docs/store.md +2 -2
- package/node_modules/@openclaw/fs-safe/docs/temp.md +29 -65
- package/node_modules/@openclaw/fs-safe/docs/testing.md +90 -58
- package/node_modules/@openclaw/fs-safe/docs/types.md +3 -16
- package/node_modules/@openclaw/fs-safe/docs/walk.md +33 -5
- package/node_modules/@openclaw/fs-safe/docs/watch.md +96 -14
- package/node_modules/@openclaw/fs-safe/docs/writing.md +172 -16
- package/node_modules/@openclaw/fs-safe/package.json +10 -10
- package/node_modules/@openclaw/fs-safe-darwin-arm64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-darwin-arm64/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-darwin-x64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-darwin-x64/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-arm64-musl/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-arm64-musl/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-x64-gnu/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-x64-gnu/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-x64-musl/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-x64-musl/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-win32-x64-msvc/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-win32-x64-msvc/package.json +1 -1
- package/openclaw.plugin.json +0 -9
- package/package.json +5 -5
- package/dist/.setup/crypto-snapshot-doctor.runtime-44FrCPR7.mjs +0 -91
- package/dist/.setup/doctor-DMvEBx6o.mjs +0 -49
- package/dist/.setup/idb-persistence-DBvfre1X.mjs +0 -227
- package/dist/.setup/idb-persistence-lock-D_mDu4Cf.mjs +0 -27
- package/dist/.setup/logger-CVv56jzH.mjs +0 -74
- package/dist/.setup/startup-verification-Aiy_xVdI.mjs +0 -204
- package/dist/.setup/storage-BXS2cB2i.mjs +0 -288
- package/dist/.setup/storage-metadata-BDRZ7vpX.mjs +0 -371
- package/node_modules/@openclaw/fs-safe/dist/watch-alias.d.ts +0 -6
- package/node_modules/@openclaw/fs-safe/dist/watch-alias.js +0 -88
- package/node_modules/@openclaw/fs-safe/docs/mutation-policy-proof.md +0 -69
- package/node_modules/@openclaw/fs-safe/docs/private-file-store.md +0 -68
- package/node_modules/@openclaw/fs-safe/docs/test-hooks.md +0 -110
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { t as getMatrixRuntime } from "./runtime-1kn1P6io.mjs";
|
|
2
|
+
import { t as ensureMatrixCryptoRuntime } from "./deps-CFNl7tQo.mjs";
|
|
3
|
+
import { n as RETIRED_MATRIX_STATE_REMEDIATION } from "./retired-state-BXUQ2I-C.mjs";
|
|
4
|
+
import { c as readMatrixIdbSnapshotJson, u as writeMatrixIdbSnapshotJson } from "./storage-D7agewjH.mjs";
|
|
5
|
+
import { r as noop, t as LogService } from "./logger-CXQnpXCt.mjs";
|
|
6
|
+
import { a as isRepairableSecretStorageAccessError, i as trustMatrixOwnIdentity, n as isMatrixDeviceOwnerVerified, o as MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, r as isMatrixDeviceVerifiedInCurrentClient } from "./sdk-CgQGkCsS.mjs";
|
|
5
7
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
6
|
-
import {
|
|
8
|
+
import { filterStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import { formatErrorMessage, toErrorObject, toStringifiedError } from "openclaw/plugin-sdk/error-runtime";
|
|
7
11
|
import { resolveDateTimestampMs, resolveTimestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
12
|
+
import fs from "node:fs";
|
|
13
|
+
import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
|
|
14
|
+
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
8
15
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
9
16
|
import { MatrixEventEvent } from "matrix-js-sdk/lib/matrix.js";
|
|
10
|
-
import { IDBDatabase } from "fake-indexeddb";
|
|
11
17
|
import { VerificationMethod } from "matrix-js-sdk/lib/types.js";
|
|
12
18
|
import "fake-indexeddb/auto";
|
|
19
|
+
import { IDBDatabase, indexedDB } from "fake-indexeddb";
|
|
13
20
|
import { CryptoEvent } from "matrix-js-sdk/lib/crypto-api/CryptoEvent.js";
|
|
14
21
|
import { DecryptionFailureCode } from "matrix-js-sdk/lib/crypto-api/index.js";
|
|
22
|
+
import { withFileLock } from "openclaw/plugin-sdk/file-lock";
|
|
15
23
|
import { VerificationPhase, VerificationRequestEvent, VerifierEvent } from "matrix-js-sdk/lib/crypto-api/verification.js";
|
|
16
24
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
17
25
|
//#region extensions/matrix/src/matrix/sdk/fake-indexeddb-prune.ts
|
|
@@ -52,14 +60,6 @@ function installFakeIndexedDbTransactionPruner() {
|
|
|
52
60
|
};
|
|
53
61
|
}
|
|
54
62
|
//#endregion
|
|
55
|
-
//#region extensions/matrix/src/matrix/sdk/verification-status.ts
|
|
56
|
-
function isMatrixDeviceOwnerVerified(status) {
|
|
57
|
-
return status?.crossSigningVerified === true;
|
|
58
|
-
}
|
|
59
|
-
function isMatrixDeviceVerifiedInCurrentClient(status) {
|
|
60
|
-
return status?.isVerified?.() === true || status?.localVerified === true || isMatrixDeviceOwnerVerified(status);
|
|
61
|
-
}
|
|
62
|
-
//#endregion
|
|
63
63
|
//#region extensions/matrix/src/matrix/sdk/crypto-bootstrap.ts
|
|
64
64
|
const CROSS_SIGNING_PUBLICATION_WAIT_MS = 5e3;
|
|
65
65
|
var MatrixCryptoBootstrapper = class {
|
|
@@ -173,7 +173,7 @@ var MatrixCryptoBootstrapper = class {
|
|
|
173
173
|
setupNewCrossSigning: true,
|
|
174
174
|
authUploadDeviceSigningKeys
|
|
175
175
|
});
|
|
176
|
-
await
|
|
176
|
+
await trustMatrixOwnIdentity(crypto);
|
|
177
177
|
} catch (err) {
|
|
178
178
|
LogService.warn("MatrixClientLite", "Forced cross-signing reset failed:", err);
|
|
179
179
|
if (options.strict) {
|
|
@@ -239,7 +239,7 @@ var MatrixCryptoBootstrapper = class {
|
|
|
239
239
|
setupNewCrossSigning: true,
|
|
240
240
|
authUploadDeviceSigningKeys
|
|
241
241
|
});
|
|
242
|
-
await
|
|
242
|
+
await trustMatrixOwnIdentity(crypto);
|
|
243
243
|
} catch (err) {
|
|
244
244
|
LogService.warn("MatrixClientLite", "Fallback cross-signing bootstrap failed:", err);
|
|
245
245
|
if (options.strict) throw toStringifiedError(err);
|
|
@@ -250,16 +250,6 @@ var MatrixCryptoBootstrapper = class {
|
|
|
250
250
|
}
|
|
251
251
|
return await finalize();
|
|
252
252
|
}
|
|
253
|
-
async trustFreshOwnIdentity(crypto) {
|
|
254
|
-
const ownIdentity = typeof crypto.getOwnIdentity === "function" ? await crypto.getOwnIdentity().catch(() => void 0) : void 0;
|
|
255
|
-
if (!ownIdentity) return;
|
|
256
|
-
try {
|
|
257
|
-
if (typeof ownIdentity.isVerified === "function" && ownIdentity.isVerified()) return;
|
|
258
|
-
await ownIdentity.verify?.();
|
|
259
|
-
} finally {
|
|
260
|
-
ownIdentity.free?.();
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
253
|
async bootstrapSecretStorage(crypto, options) {
|
|
264
254
|
try {
|
|
265
255
|
await this.deps.recoveryKeyStore.bootstrapSecretStorageWithRecoveryKey(crypto, { allowSecretStorageRecreateWithoutRecoveryKey: options.allowSecretStorageRecreateWithoutRecoveryKey });
|
|
@@ -287,12 +277,14 @@ var MatrixCryptoBootstrapper = class {
|
|
|
287
277
|
const deviceId = this.deps.getDeviceId()?.trim();
|
|
288
278
|
if (!deviceId) return null;
|
|
289
279
|
const userId = await this.deps.getUserId();
|
|
290
|
-
|
|
280
|
+
const deviceStatus = typeof crypto.getDeviceVerificationStatus === "function" ? await crypto.getDeviceVerificationStatus(userId, deviceId).catch(() => null) : null;
|
|
281
|
+
if (isMatrixDeviceOwnerVerified(deviceStatus)) return true;
|
|
291
282
|
if (typeof crypto.setDeviceVerified === "function") await crypto.setDeviceVerified(userId, deviceId, true);
|
|
292
283
|
if (typeof crypto.crossSignDevice === "function") {
|
|
293
284
|
if (typeof crypto.isCrossSigningReady === "function" ? await crypto.isCrossSigningReady() : true) await crypto.crossSignDevice(deviceId);
|
|
294
285
|
}
|
|
295
|
-
const
|
|
286
|
+
const refreshedStatus = typeof crypto.getDeviceVerificationStatus === "function" ? await crypto.getDeviceVerificationStatus(userId, deviceId).catch(() => null) : null;
|
|
287
|
+
const verified = isMatrixDeviceOwnerVerified(refreshedStatus);
|
|
296
288
|
if (!verified && options.strict) throw new Error(`Matrix own device ${deviceId} does not have full Matrix identity trust after bootstrap`);
|
|
297
289
|
return verified;
|
|
298
290
|
}
|
|
@@ -324,10 +316,6 @@ function createMatrixCryptoFacade(deps) {
|
|
|
324
316
|
}
|
|
325
317
|
return {
|
|
326
318
|
isRoomEncrypted: deps.isRoomEncrypted,
|
|
327
|
-
requestOwnUserVerification: async () => {
|
|
328
|
-
const crypto = deps.client.getCrypto();
|
|
329
|
-
return await deps.verificationManager.requestOwnUserVerification(crypto);
|
|
330
|
-
},
|
|
331
319
|
encryptMedia: async (buffer) => {
|
|
332
320
|
const { Attachment } = await loadMatrixCryptoNodeBindings();
|
|
333
321
|
const encrypted = Attachment.encrypt(new Uint8Array(buffer));
|
|
@@ -515,17 +503,9 @@ var MatrixDecryptBridge = class {
|
|
|
515
503
|
}
|
|
516
504
|
if (!state.inFlight) this.runDecryptRetry(retryKey).catch(noop);
|
|
517
505
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
timeout = setTimeout(() => {
|
|
522
|
-
reject(/* @__PURE__ */ new Error(`Matrix decryption drain did not finish within ${MATRIX_DECRYPT_DRAIN_TIMEOUT_MS}ms`));
|
|
523
|
-
}, MATRIX_DECRYPT_DRAIN_TIMEOUT_MS);
|
|
524
|
-
timeout.unref?.();
|
|
525
|
-
})]);
|
|
526
|
-
} finally {
|
|
527
|
-
if (timeout !== void 0) clearTimeout(timeout);
|
|
528
|
-
}
|
|
506
|
+
await raceWithTimeout(Promise.all([Promise.allSettled(pendingSdkDecryptions), this.waitForActiveRetryRunsToFinish()]), MATRIX_DECRYPT_DRAIN_TIMEOUT_MS, () => {
|
|
507
|
+
throw new Error(`Matrix decryption drain did not finish within ${MATRIX_DECRYPT_DRAIN_TIMEOUT_MS}ms`);
|
|
508
|
+
}, { ref: false });
|
|
529
509
|
}
|
|
530
510
|
handleEncryptedEventDecrypted(params) {
|
|
531
511
|
if (this.stopped) return;
|
|
@@ -646,11 +626,7 @@ var MatrixDecryptBridge = class {
|
|
|
646
626
|
}
|
|
647
627
|
pruneExhaustedDecryptRetries(now) {
|
|
648
628
|
for (const [retryKey, state] of this.exhaustedDecryptRetries) if (now - state.exhaustedAt > MATRIX_DECRYPT_EXHAUSTED_RETRY_TTL_MS) this.exhaustedDecryptRetries.delete(retryKey);
|
|
649
|
-
|
|
650
|
-
const oldest = this.exhaustedDecryptRetries.keys().next().value;
|
|
651
|
-
if (oldest === void 0) break;
|
|
652
|
-
this.exhaustedDecryptRetries.delete(oldest);
|
|
653
|
-
}
|
|
629
|
+
pruneMapToMaxSize(this.exhaustedDecryptRetries, MATRIX_DECRYPT_EXHAUSTED_RETRY_MAX_ENTRIES);
|
|
654
630
|
}
|
|
655
631
|
rememberDecryptedMessage(roomId, eventId) {
|
|
656
632
|
if (!eventId) return;
|
|
@@ -661,21 +637,12 @@ var MatrixDecryptBridge = class {
|
|
|
661
637
|
pruneDecryptedMessageDedupe(now) {
|
|
662
638
|
const ttlMs = 3e4;
|
|
663
639
|
for (const [key, createdAt] of this.decryptedMessageDedupe) if (now - createdAt > ttlMs) this.decryptedMessageDedupe.delete(key);
|
|
664
|
-
|
|
665
|
-
while (this.decryptedMessageDedupe.size > maxEntries) {
|
|
666
|
-
const oldest = this.decryptedMessageDedupe.keys().next().value;
|
|
667
|
-
if (oldest === void 0) break;
|
|
668
|
-
this.decryptedMessageDedupe.delete(oldest);
|
|
669
|
-
}
|
|
640
|
+
pruneMapToMaxSize(this.decryptedMessageDedupe, 2048);
|
|
670
641
|
}
|
|
671
642
|
async waitForActiveRetryRunsToFinish() {
|
|
672
643
|
if (this.activeRetryRuns === 0) return;
|
|
673
644
|
await new Promise((resolve) => {
|
|
674
645
|
this.retryIdleResolvers.add(resolve);
|
|
675
|
-
if (this.activeRetryRuns === 0) {
|
|
676
|
-
this.retryIdleResolvers.delete(resolve);
|
|
677
|
-
resolve();
|
|
678
|
-
}
|
|
679
646
|
});
|
|
680
647
|
}
|
|
681
648
|
resolveRetryIdleIfNeeded() {
|
|
@@ -685,6 +652,199 @@ var MatrixDecryptBridge = class {
|
|
|
685
652
|
}
|
|
686
653
|
};
|
|
687
654
|
//#endregion
|
|
655
|
+
//#region extensions/matrix/src/matrix/sdk/idb-persistence.ts
|
|
656
|
+
const LEGACY_SNAPSHOT_DIAGNOSTIC = {
|
|
657
|
+
code: "matrix-idb-snapshot-requires-doctor",
|
|
658
|
+
message: "Matrix IndexedDB snapshot exists outside canonical SQLite state",
|
|
659
|
+
remediation: RETIRED_MATRIX_STATE_REMEDIATION
|
|
660
|
+
};
|
|
661
|
+
var MatrixIdbSnapshotMigrationRequiredError = class extends Error {
|
|
662
|
+
constructor() {
|
|
663
|
+
super(`${LEGACY_SNAPSHOT_DIAGNOSTIC.message}; ${LEGACY_SNAPSHOT_DIAGNOSTIC.remediation}`);
|
|
664
|
+
this.code = LEGACY_SNAPSHOT_DIAGNOSTIC.code;
|
|
665
|
+
this.remediation = LEGACY_SNAPSHOT_DIAGNOSTIC.remediation;
|
|
666
|
+
this.name = "MatrixIdbSnapshotMigrationRequiredError";
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
function isValidIdbIndexSnapshot(value) {
|
|
670
|
+
if (!value || typeof value !== "object") return false;
|
|
671
|
+
const candidate = value;
|
|
672
|
+
return typeof candidate.name === "string" && (typeof candidate.keyPath === "string" || Array.isArray(candidate.keyPath) && candidate.keyPath.every((entry) => typeof entry === "string")) && typeof candidate.multiEntry === "boolean" && typeof candidate.unique === "boolean";
|
|
673
|
+
}
|
|
674
|
+
function isValidIdbRecordSnapshot(value) {
|
|
675
|
+
if (!value || typeof value !== "object") return false;
|
|
676
|
+
return "key" in value && "value" in value;
|
|
677
|
+
}
|
|
678
|
+
function isValidIdbStoreSnapshot(value) {
|
|
679
|
+
if (!value || typeof value !== "object") return false;
|
|
680
|
+
const candidate = value;
|
|
681
|
+
const validKeyPath = candidate.keyPath === null || typeof candidate.keyPath === "string" || Array.isArray(candidate.keyPath) && candidate.keyPath.every((entry) => typeof entry === "string");
|
|
682
|
+
return typeof candidate.name === "string" && validKeyPath && typeof candidate.autoIncrement === "boolean" && Array.isArray(candidate.indexes) && candidate.indexes.every((entry) => isValidIdbIndexSnapshot(entry)) && Array.isArray(candidate.records) && candidate.records.every((entry) => isValidIdbRecordSnapshot(entry));
|
|
683
|
+
}
|
|
684
|
+
function isValidIdbDatabaseSnapshot(value) {
|
|
685
|
+
if (!value || typeof value !== "object") return false;
|
|
686
|
+
const candidate = value;
|
|
687
|
+
return typeof candidate.name === "string" && typeof candidate.version === "number" && Number.isFinite(candidate.version) && candidate.version > 0 && Array.isArray(candidate.stores) && candidate.stores.every((entry) => isValidIdbStoreSnapshot(entry));
|
|
688
|
+
}
|
|
689
|
+
function parseSnapshotPayload(data) {
|
|
690
|
+
const parsed = JSON.parse(data);
|
|
691
|
+
if (!Array.isArray(parsed) || parsed.length === 0) return null;
|
|
692
|
+
if (!parsed.every((entry) => isValidIdbDatabaseSnapshot(entry))) throw new Error("Malformed IndexedDB snapshot payload");
|
|
693
|
+
return parsed;
|
|
694
|
+
}
|
|
695
|
+
function idbReq(req) {
|
|
696
|
+
return new Promise((resolve, reject) => {
|
|
697
|
+
req.addEventListener("success", () => resolve(req.result), { once: true });
|
|
698
|
+
req.addEventListener("error", () => reject(toErrorObject(req.error, "Non-Error rejection")), { once: true });
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
async function dumpIndexedDatabases(databasePrefix) {
|
|
702
|
+
const idb = indexedDB;
|
|
703
|
+
const dbList = await idb.databases();
|
|
704
|
+
const snapshot = [];
|
|
705
|
+
const expectedPrefix = databasePrefix ? `${databasePrefix}::` : null;
|
|
706
|
+
for (const { name, version } of dbList) {
|
|
707
|
+
if (!name || !version) continue;
|
|
708
|
+
if (expectedPrefix && !name.startsWith(expectedPrefix)) continue;
|
|
709
|
+
const db = await idbReq(idb.open(name, version));
|
|
710
|
+
const stores = [];
|
|
711
|
+
for (const storeName of db.objectStoreNames) {
|
|
712
|
+
const store = db.transaction(storeName, "readonly").objectStore(storeName);
|
|
713
|
+
const storeInfo = {
|
|
714
|
+
name: storeName,
|
|
715
|
+
keyPath: store.keyPath,
|
|
716
|
+
autoIncrement: store.autoIncrement,
|
|
717
|
+
indexes: [],
|
|
718
|
+
records: []
|
|
719
|
+
};
|
|
720
|
+
for (const idxName of store.indexNames) {
|
|
721
|
+
const idx = store.index(idxName);
|
|
722
|
+
storeInfo.indexes.push({
|
|
723
|
+
name: idxName,
|
|
724
|
+
keyPath: idx.keyPath,
|
|
725
|
+
multiEntry: idx.multiEntry,
|
|
726
|
+
unique: idx.unique
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
const keys = await idbReq(store.getAllKeys());
|
|
730
|
+
const values = await idbReq(store.getAll());
|
|
731
|
+
storeInfo.records = keys.map((k, i) => ({
|
|
732
|
+
key: k,
|
|
733
|
+
value: values[i]
|
|
734
|
+
}));
|
|
735
|
+
stores.push(storeInfo);
|
|
736
|
+
}
|
|
737
|
+
snapshot.push({
|
|
738
|
+
name,
|
|
739
|
+
version,
|
|
740
|
+
stores
|
|
741
|
+
});
|
|
742
|
+
db.close();
|
|
743
|
+
}
|
|
744
|
+
return snapshot;
|
|
745
|
+
}
|
|
746
|
+
async function restoreIndexedDatabases(snapshot) {
|
|
747
|
+
const idb = indexedDB;
|
|
748
|
+
for (const dbSnap of snapshot) {
|
|
749
|
+
const request = idb.open(dbSnap.name, dbSnap.version);
|
|
750
|
+
request.addEventListener("upgradeneeded", () => {
|
|
751
|
+
const db = request.result;
|
|
752
|
+
for (const storeSnap of dbSnap.stores) {
|
|
753
|
+
const opts = {};
|
|
754
|
+
if (storeSnap.keyPath !== null) opts.keyPath = storeSnap.keyPath;
|
|
755
|
+
if (storeSnap.autoIncrement) opts.autoIncrement = true;
|
|
756
|
+
const store = db.createObjectStore(storeSnap.name, opts);
|
|
757
|
+
for (const idx of storeSnap.indexes) store.createIndex(idx.name, idx.keyPath, {
|
|
758
|
+
unique: idx.unique,
|
|
759
|
+
multiEntry: idx.multiEntry
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
});
|
|
763
|
+
const db = await idbReq(request);
|
|
764
|
+
try {
|
|
765
|
+
for (const storeSnap of dbSnap.stores) {
|
|
766
|
+
if (storeSnap.records.length === 0) continue;
|
|
767
|
+
const tx = db.transaction(storeSnap.name, "readwrite");
|
|
768
|
+
const store = tx.objectStore(storeSnap.name);
|
|
769
|
+
for (const rec of storeSnap.records) if (storeSnap.keyPath !== null) store.put(rec.value);
|
|
770
|
+
else store.put(rec.value, rec.key);
|
|
771
|
+
await new Promise((resolve, reject) => {
|
|
772
|
+
tx.addEventListener("complete", () => resolve(), { once: true });
|
|
773
|
+
tx.addEventListener("abort", () => reject(toErrorObject(tx.error, "IndexedDB restore transaction aborted")), { once: true });
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
} finally {
|
|
777
|
+
db.close();
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
function resolveDefaultIdbSnapshotPath() {
|
|
782
|
+
const stateDir = process.env.OPENCLAW_STATE_DIR || path.join(process.env.HOME || "/tmp", ".openclaw");
|
|
783
|
+
return path.join(stateDir, "matrix", "crypto-idb-snapshot.json");
|
|
784
|
+
}
|
|
785
|
+
async function readCanonicalSnapshotJson(snapshotPath, stateRuntime) {
|
|
786
|
+
throwIfLegacySnapshotNeedsDoctor(snapshotPath);
|
|
787
|
+
return await readMatrixIdbSnapshotJson(path.dirname(snapshotPath), stateRuntime);
|
|
788
|
+
}
|
|
789
|
+
async function restoreIdbFromDisk(snapshotPath, stateRuntime) {
|
|
790
|
+
const resolvedPath = snapshotPath ?? resolveDefaultIdbSnapshotPath();
|
|
791
|
+
let callbackStarted = false;
|
|
792
|
+
try {
|
|
793
|
+
const snapshotStateRuntime = stateRuntime ?? getMatrixRuntime().state;
|
|
794
|
+
return await withFileLock(resolvedPath, MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, async () => {
|
|
795
|
+
callbackStarted = true;
|
|
796
|
+
const storedSnapshotJson = await readCanonicalSnapshotJson(resolvedPath, snapshotStateRuntime);
|
|
797
|
+
if (!storedSnapshotJson) return false;
|
|
798
|
+
const snapshot = parseSnapshotPayload(storedSnapshotJson);
|
|
799
|
+
if (!snapshot) return false;
|
|
800
|
+
await restoreIndexedDatabases(snapshot);
|
|
801
|
+
LogService.info("IdbPersistence", `Restored ${snapshot.length} IndexedDB database(s) from Matrix SQLite state`);
|
|
802
|
+
return true;
|
|
803
|
+
});
|
|
804
|
+
} catch (err) {
|
|
805
|
+
if (err instanceof MatrixIdbSnapshotMigrationRequiredError) throw err;
|
|
806
|
+
if (!callbackStarted && fs.existsSync(resolvedPath)) throwLegacySnapshotMigrationRequired();
|
|
807
|
+
LogService.warn("IdbPersistence", "Failed to restore IndexedDB snapshot from SQLite:", err);
|
|
808
|
+
return false;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
async function persistIdbToDisk(params) {
|
|
812
|
+
const snapshotPath = params?.snapshotPath ?? resolveDefaultIdbSnapshotPath();
|
|
813
|
+
let callbackStarted = false;
|
|
814
|
+
try {
|
|
815
|
+
const stateRuntime = params?.stateRuntime ?? getMatrixRuntime().state;
|
|
816
|
+
fs.mkdirSync(path.dirname(snapshotPath), { recursive: true });
|
|
817
|
+
const persistedCount = await withFileLock(snapshotPath, MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, async () => {
|
|
818
|
+
callbackStarted = true;
|
|
819
|
+
const storageRootDir = path.dirname(snapshotPath);
|
|
820
|
+
await readCanonicalSnapshotJson(snapshotPath, stateRuntime);
|
|
821
|
+
const snapshot = await dumpIndexedDatabases(params?.databasePrefix);
|
|
822
|
+
if (params?.abortSignal?.aborted || snapshot.length === 0) return 0;
|
|
823
|
+
await writeMatrixIdbSnapshotJson({
|
|
824
|
+
storageRootDir,
|
|
825
|
+
snapshotJson: JSON.stringify(snapshot),
|
|
826
|
+
databaseCount: snapshot.length,
|
|
827
|
+
stateRuntime
|
|
828
|
+
});
|
|
829
|
+
return snapshot.length;
|
|
830
|
+
});
|
|
831
|
+
if (persistedCount === 0) return;
|
|
832
|
+
LogService.debug("IdbPersistence", `Persisted ${persistedCount} IndexedDB database(s) to Matrix SQLite state`);
|
|
833
|
+
} catch (err) {
|
|
834
|
+
if (err instanceof MatrixIdbSnapshotMigrationRequiredError) throw err;
|
|
835
|
+
if (!callbackStarted && fs.existsSync(snapshotPath)) throwLegacySnapshotMigrationRequired();
|
|
836
|
+
LogService.warn("IdbPersistence", "Failed to persist IndexedDB snapshot:", err);
|
|
837
|
+
if (params?.strict) throw err;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
function throwIfLegacySnapshotNeedsDoctor(snapshotPath) {
|
|
841
|
+
if (fs.existsSync(snapshotPath)) throwLegacySnapshotMigrationRequired();
|
|
842
|
+
}
|
|
843
|
+
function throwLegacySnapshotMigrationRequired() {
|
|
844
|
+
LogService.warn("IdbPersistence", LEGACY_SNAPSHOT_DIAGNOSTIC);
|
|
845
|
+
throw new MatrixIdbSnapshotMigrationRequiredError();
|
|
846
|
+
}
|
|
847
|
+
//#endregion
|
|
688
848
|
//#region extensions/matrix/src/matrix/sdk/verification-manager.ts
|
|
689
849
|
const MATRIX_VERIFICATION_PHASES = /* @__PURE__ */ new Set([
|
|
690
850
|
-1,
|
|
@@ -708,7 +868,6 @@ var MatrixVerificationManager = class {
|
|
|
708
868
|
this.verificationSessionCounter = 0;
|
|
709
869
|
this.trackedVerificationRequests = /* @__PURE__ */ new WeakSet();
|
|
710
870
|
this.trackedVerificationVerifiers = /* @__PURE__ */ new WeakSet();
|
|
711
|
-
this.summaryListeners = /* @__PURE__ */ new Set();
|
|
712
871
|
}
|
|
713
872
|
readRequestValue(reader, fallback) {
|
|
714
873
|
try {
|
|
@@ -747,14 +906,11 @@ var MatrixVerificationManager = class {
|
|
|
747
906
|
if (this.verificationSessions.size <= MAX_TRACKED_VERIFICATION_SESSIONS) return;
|
|
748
907
|
const sortedByAge = Array.from(this.verificationSessions.entries()).toSorted((a, b) => a[1].updatedAtMs - b[1].updatedAtMs);
|
|
749
908
|
const overflow = this.verificationSessions.size - MAX_TRACKED_VERIFICATION_SESSIONS;
|
|
750
|
-
for (
|
|
751
|
-
const entry = sortedByAge[i];
|
|
752
|
-
if (entry) this.verificationSessions.delete(entry[0]);
|
|
753
|
-
}
|
|
909
|
+
for (const [id] of sortedByAge.slice(0, overflow)) this.verificationSessions.delete(id);
|
|
754
910
|
}
|
|
755
911
|
emitVerificationSummary(session) {
|
|
756
912
|
const summary = this.buildVerificationSummary(session);
|
|
757
|
-
|
|
913
|
+
this.opts.onSummaryChanged?.(summary);
|
|
758
914
|
}
|
|
759
915
|
touchVerificationSession(session) {
|
|
760
916
|
session.updatedAtMs = resolveDateTimestampMs(Date.now());
|
|
@@ -772,7 +928,7 @@ var MatrixVerificationManager = class {
|
|
|
772
928
|
const declining = this.readRequestValue(() => request.declining, false);
|
|
773
929
|
const pending = this.readRequestValue(() => request.pending, false);
|
|
774
930
|
const methodsRaw = this.readRequestValue(() => request.methods, []);
|
|
775
|
-
const methods =
|
|
931
|
+
const methods = filterStringEntries(methodsRaw);
|
|
776
932
|
const sasCallbacks = session.sasCallbacks ?? session.activeVerifier?.getShowSasCallbacks();
|
|
777
933
|
if (sasCallbacks) session.sasCallbacks = sasCallbacks;
|
|
778
934
|
const canAccept = phase < VerificationPhase.Ready && !accepting && !declining;
|
|
@@ -850,7 +1006,7 @@ var MatrixVerificationManager = class {
|
|
|
850
1006
|
const phase = this.readVerificationPhase(session.request, VerificationPhase.Requested);
|
|
851
1007
|
if (phase < VerificationPhase.Ready || phase >= VerificationPhase.Cancelled) return;
|
|
852
1008
|
const methodsRaw = this.readRequestValue(() => session.request.methods, []);
|
|
853
|
-
const methods =
|
|
1009
|
+
const methods = filterStringEntries(methodsRaw);
|
|
854
1010
|
const chosenMethod = this.readRequestValue(() => session.request.chosenMethod, null);
|
|
855
1011
|
if (!(methods.includes(VerificationMethod.Sas) || chosenMethod === VerificationMethod.Sas)) return;
|
|
856
1012
|
session.startRequested = true;
|
|
@@ -931,12 +1087,6 @@ var MatrixVerificationManager = class {
|
|
|
931
1087
|
if (!deviceId || !this.opts.trustOwnDeviceAfterSas) return;
|
|
932
1088
|
await this.opts.trustOwnDeviceAfterSas(deviceId);
|
|
933
1089
|
}
|
|
934
|
-
onSummaryChanged(listener) {
|
|
935
|
-
this.summaryListeners.add(listener);
|
|
936
|
-
return () => {
|
|
937
|
-
this.summaryListeners.delete(listener);
|
|
938
|
-
};
|
|
939
|
-
}
|
|
940
1090
|
trackVerificationRequest(request) {
|
|
941
1091
|
this.pruneVerificationSessions(Date.now());
|
|
942
1092
|
const requestObj = request;
|
|
@@ -974,12 +1124,6 @@ var MatrixVerificationManager = class {
|
|
|
974
1124
|
this.emitVerificationSummary(session);
|
|
975
1125
|
return this.buildVerificationSummary(session);
|
|
976
1126
|
}
|
|
977
|
-
async requestOwnUserVerification(crypto) {
|
|
978
|
-
if (!crypto) return null;
|
|
979
|
-
const request = await crypto.requestOwnUserVerification();
|
|
980
|
-
if (!request) return null;
|
|
981
|
-
return this.trackVerificationRequest(request);
|
|
982
|
-
}
|
|
983
1127
|
listVerifications() {
|
|
984
1128
|
this.pruneVerificationSessions(Date.now());
|
|
985
1129
|
return Array.from(this.verificationSessions.values()).map((session) => this.buildVerificationSummary(session)).toSorted((a, b) => b.updatedAt.localeCompare(a.updatedAt));
|
|
@@ -1036,7 +1180,7 @@ var MatrixVerificationManager = class {
|
|
|
1036
1180
|
session.sasCallbacks = callbacks;
|
|
1037
1181
|
session.sasAutoConfirmStarted = true;
|
|
1038
1182
|
await this.confirmSasForSession(session, callbacks);
|
|
1039
|
-
|
|
1183
|
+
await session.verifyPromise;
|
|
1040
1184
|
this.touchVerificationSession(session);
|
|
1041
1185
|
return this.buildVerificationSummary(session);
|
|
1042
1186
|
}
|
|
@@ -26,34 +26,6 @@ function isMatrixSdkAvailable() {
|
|
|
26
26
|
return resolveMissingMatrixPackages().length === 0;
|
|
27
27
|
}
|
|
28
28
|
let defaultMatrixCryptoRuntimeEnsurePromise = null;
|
|
29
|
-
async function runFixedCommandWithTimeout(params) {
|
|
30
|
-
if (!params.argv[0]) return {
|
|
31
|
-
code: 1,
|
|
32
|
-
stdout: "",
|
|
33
|
-
stderr: "command is required"
|
|
34
|
-
};
|
|
35
|
-
try {
|
|
36
|
-
const result = await runCommandWithTimeout(params.argv, {
|
|
37
|
-
cwd: params.cwd,
|
|
38
|
-
env: params.env,
|
|
39
|
-
killProcessTree: true,
|
|
40
|
-
maxOutputBytes: MATRIX_COMMAND_OUTPUT_TAIL_BYTES,
|
|
41
|
-
outputCapture: "tail",
|
|
42
|
-
timeoutMs: params.timeoutMs
|
|
43
|
-
});
|
|
44
|
-
return {
|
|
45
|
-
code: result.termination === "timeout" ? 124 : result.code ?? 1,
|
|
46
|
-
stdout: result.stdout,
|
|
47
|
-
stderr: result.stderr || (result.termination === "timeout" ? `command timed out after ${params.timeoutMs}ms` : "")
|
|
48
|
-
};
|
|
49
|
-
} catch (error) {
|
|
50
|
-
return {
|
|
51
|
-
code: 1,
|
|
52
|
-
stdout: "",
|
|
53
|
-
stderr: error instanceof Error ? error.message : String(error)
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
29
|
const defaultRequireFn = createRequire(import.meta.url);
|
|
58
30
|
const defaultResolveFn = defaultRequireFn.resolve;
|
|
59
31
|
function isMissingMatrixCryptoRuntimeError(error) {
|
|
@@ -134,23 +106,26 @@ async function ensureMatrixCryptoRuntimeOnce(params) {
|
|
|
134
106
|
}
|
|
135
107
|
const scriptPath = resolveFn("@matrix-org/matrix-sdk-crypto-nodejs/download-lib.js");
|
|
136
108
|
params.log?.("matrix: bootstrapping native crypto runtime");
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
log: params.log
|
|
109
|
+
let failure;
|
|
110
|
+
try {
|
|
111
|
+
const result = await runCommandWithTimeout([process.execPath, scriptPath], {
|
|
112
|
+
cwd: path.dirname(scriptPath),
|
|
113
|
+
env: { COREPACK_ENABLE_DOWNLOAD_PROMPT: "0" },
|
|
114
|
+
killProcessTree: true,
|
|
115
|
+
maxOutputBytes: MATRIX_COMMAND_OUTPUT_TAIL_BYTES,
|
|
116
|
+
outputCapture: "tail",
|
|
117
|
+
timeoutMs: 3e5
|
|
147
118
|
});
|
|
148
|
-
|
|
119
|
+
const timedOut = result.termination === "timeout";
|
|
120
|
+
if (timedOut || (result.code ?? 1) !== 0) failure = (result.stderr || (timedOut ? "command timed out after 300000ms" : "")).trim() || result.stdout.trim();
|
|
121
|
+
} catch (error) {
|
|
122
|
+
failure = (error instanceof Error ? error.message : String(error)).trim();
|
|
149
123
|
}
|
|
150
124
|
removeIncompleteMatrixCryptoNativeBinding({
|
|
151
125
|
bindingPath: nativeBindingPath,
|
|
152
126
|
log: params.log
|
|
153
127
|
});
|
|
128
|
+
if (failure !== void 0) throw new Error(failure || "Matrix crypto runtime bootstrap failed.");
|
|
154
129
|
requireFn("@matrix-org/matrix-sdk-crypto-nodejs");
|
|
155
130
|
}
|
|
156
131
|
async function ensureMatrixSdkInstalled(params) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as __exportAll } from "./doctor-contract-
|
|
1
|
+
import { i as __exportAll } from "./doctor-contract-CsTNmbMa.mjs";
|
|
2
2
|
//#region extensions/matrix/src/matrix/device-health.ts
|
|
3
3
|
var device_health_exports = /* @__PURE__ */ __exportAll({
|
|
4
4
|
isOpenClawManagedMatrixDevice: () => isOpenClawManagedMatrixDevice,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as __exportAll } from "./doctor-contract-
|
|
1
|
+
import { i as __exportAll } from "./doctor-contract-CsTNmbMa.mjs";
|
|
2
2
|
import { t as isMatrixQualifiedUserId } from "./target-ids-Nwx7cMVE.mjs";
|
|
3
3
|
import { a as MATRIX_REACTION_EVENT_TYPE, i as MATRIX_ANNOTATION_RELATION_TYPE } from "./send-currentness-C2rMVVIQ.mjs";
|
|
4
4
|
import { asOptionalRecord, normalizeNullableString, normalizeOptionalString, normalizeTrimmedStringList, normalizeUniqueTrimmedStringList, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -128,12 +128,8 @@ var direct_management_exports = /* @__PURE__ */ __exportAll({
|
|
|
128
128
|
const DIRECT_ACCOUNT_DATA_QUEUE_KEY = EventType.Direct;
|
|
129
129
|
const directAccountDataWriteQueues = /* @__PURE__ */ new WeakMap();
|
|
130
130
|
async function readMatrixDirectAccountData(client) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
return direct && typeof direct === "object" && !Array.isArray(direct) ? direct : {};
|
|
134
|
-
} catch {
|
|
135
|
-
return {};
|
|
136
|
-
}
|
|
131
|
+
const direct = await client.getAccountData(EventType.Direct);
|
|
132
|
+
return direct && typeof direct === "object" && !Array.isArray(direct) ? direct : {};
|
|
137
133
|
}
|
|
138
134
|
function normalizeRemoteUserId(remoteUserId) {
|
|
139
135
|
const normalized = normalizeOptionalString(remoteUserId) ?? "";
|
|
@@ -234,7 +230,7 @@ async function promoteMatrixDirectRoomCandidate(params) {
|
|
|
234
230
|
async function inspectMatrixDirectRooms(params) {
|
|
235
231
|
const remoteUserId = normalizeRemoteUserId(params.remoteUserId);
|
|
236
232
|
const selfUserId = normalizeOptionalString(await params.client.getUserId().catch(() => null)) ?? null;
|
|
237
|
-
const directContent = await readMatrixDirectAccountData(params.client);
|
|
233
|
+
const directContent = await readMatrixDirectAccountData(params.client).catch(() => ({}));
|
|
238
234
|
const mappedRoomIds = normalizeUniqueTrimmedStringList(directContent[remoteUserId]);
|
|
239
235
|
const mappedRooms = await Promise.all(mappedRoomIds.map(async (roomId) => await classifyDirectRoomCandidate({
|
|
240
236
|
client: params.client,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as __exportAll } from "./doctor-contract-
|
|
1
|
+
import { i as __exportAll } from "./doctor-contract-CsTNmbMa.mjs";
|
|
2
2
|
import { r as normalizeMatrixMessagingTarget, t as isMatrixQualifiedUserId } from "./target-ids-Nwx7cMVE.mjs";
|
|
3
|
-
import { u as resolveMatrixAuth } from "./client-
|
|
4
|
-
import { t as MatrixAuthedHttpClient } from "./http-client-
|
|
3
|
+
import { u as resolveMatrixAuth } from "./client-kmih04ng.mjs";
|
|
4
|
+
import { t as MatrixAuthedHttpClient } from "./http-client-DfJY5Ck0.mjs";
|
|
5
5
|
import { isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
//#region extensions/matrix/src/directory-live.ts
|
|
7
7
|
var directory_live_exports = /* @__PURE__ */ __exportAll({
|