@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,91 +0,0 @@
|
|
|
1
|
-
import { b as readMatrixIdbSnapshotJsonFromStore, o as MATRIX_IDB_SNAPSHOT_FILENAME, p as openMatrixIdbSnapshotStoreOptions, w as writeMatrixIdbSnapshotJsonToStore } from "./storage-metadata-BDRZ7vpX.mjs";
|
|
2
|
-
import { n as MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS } from "./idb-persistence-lock-D_mDu4Cf.mjs";
|
|
3
|
-
import { r as readLegacyMatrixIdbSnapshotStateUnlocked, t as isValidMatrixIdbSnapshotJson } from "./idb-persistence-DBvfre1X.mjs";
|
|
4
|
-
import { randomUUID } from "node:crypto";
|
|
5
|
-
import path from "node:path";
|
|
6
|
-
import fs from "node:fs";
|
|
7
|
-
import fs$1 from "node:fs/promises";
|
|
8
|
-
import { isDeepStrictEqual } from "node:util";
|
|
9
|
-
import { withFileLock } from "openclaw/plugin-sdk/file-lock";
|
|
10
|
-
//#region extensions/matrix/src/matrix/crypto-snapshot-doctor.runtime.ts
|
|
11
|
-
async function migrateLegacyMatrixIdbSnapshot(params) {
|
|
12
|
-
const snapshotPath = path.join(params.storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
|
|
13
|
-
try {
|
|
14
|
-
await withFileLock(snapshotPath, MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, () => migrateLegacyMatrixIdbSnapshotLocked(params));
|
|
15
|
-
} catch (err) {
|
|
16
|
-
params.warnings.push(`Failed locking Matrix IndexedDB snapshot for ${params.storageRootDir}: ${String(err)}; left legacy source in place`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
async function migrateLegacyMatrixIdbSnapshotLocked(params) {
|
|
20
|
-
const sourcePath = path.join(params.storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
|
|
21
|
-
let snapshot;
|
|
22
|
-
try {
|
|
23
|
-
snapshot = readLegacyMatrixIdbSnapshotStateUnlocked(params.storageRootDir);
|
|
24
|
-
} catch (err) {
|
|
25
|
-
params.warnings.push(`Failed reading Matrix IndexedDB snapshot legacy source for ${params.storageRootDir}: ${String(err)}; left source in place`);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (!snapshot) {
|
|
29
|
-
if (!fs.existsSync(sourcePath)) return;
|
|
30
|
-
const archived = await archiveLegacyMatrixIdbSnapshot(params);
|
|
31
|
-
params.warnings.push(archived ? `Matrix IndexedDB snapshot legacy source is invalid for ${params.storageRootDir}; archived without import` : `Matrix IndexedDB snapshot legacy source is invalid for ${params.storageRootDir}; left active because archival failed`);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const snapshotJson = JSON.stringify(snapshot);
|
|
35
|
-
const store = params.context.openPluginStateKeyedStore(openMatrixIdbSnapshotStoreOptions(params.storageRootDir));
|
|
36
|
-
let persisted;
|
|
37
|
-
let hadPartialState;
|
|
38
|
-
try {
|
|
39
|
-
persisted = await readMatrixIdbSnapshotJsonFromStore({ store });
|
|
40
|
-
const persistedIsValid = persisted ? isValidMatrixIdbSnapshotJson(persisted) : false;
|
|
41
|
-
hadPartialState = !persistedIsValid && (await store.entries()).length > 0;
|
|
42
|
-
if (!persistedIsValid) persisted = null;
|
|
43
|
-
} catch (err) {
|
|
44
|
-
params.warnings.push(`Failed inspecting Matrix IndexedDB snapshot SQLite state for ${params.storageRootDir}: ${String(err)}; left legacy source in place`);
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
if (persisted && !snapshotContentMatches(persisted, snapshot)) {
|
|
48
|
-
if (await archiveLegacyMatrixIdbSnapshot(params)) params.notices.push(`Kept the canonical Matrix IndexedDB snapshot in SQLite and archived a differing legacy source for ${params.storageRootDir}`);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (!persisted) {
|
|
52
|
-
try {
|
|
53
|
-
await writeMatrixIdbSnapshotJsonToStore({
|
|
54
|
-
snapshotJson,
|
|
55
|
-
databaseCount: snapshot.length,
|
|
56
|
-
store
|
|
57
|
-
});
|
|
58
|
-
persisted = await readMatrixIdbSnapshotJsonFromStore({ store });
|
|
59
|
-
} catch (err) {
|
|
60
|
-
params.warnings.push(`Failed importing Matrix IndexedDB snapshot for ${params.storageRootDir}: ${String(err)}; left legacy source in place`);
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (!persisted || !snapshotContentMatches(persisted, snapshot)) {
|
|
64
|
-
params.warnings.push(`Failed verifying Matrix IndexedDB snapshot for ${params.storageRootDir}; left legacy source in place`);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
params.changes.push(hadPartialState ? `Repaired partial or invalid Matrix IndexedDB snapshot SQLite state for ${params.storageRootDir}` : `Migrated Matrix IndexedDB snapshot JSON to SQLite for ${params.storageRootDir}`);
|
|
68
|
-
}
|
|
69
|
-
await archiveLegacyMatrixIdbSnapshot(params);
|
|
70
|
-
}
|
|
71
|
-
function snapshotContentMatches(persistedJson, snapshot) {
|
|
72
|
-
try {
|
|
73
|
-
return isDeepStrictEqual(JSON.parse(persistedJson), snapshot);
|
|
74
|
-
} catch {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
async function archiveLegacyMatrixIdbSnapshot(params) {
|
|
79
|
-
const sourcePath = path.join(params.storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
|
|
80
|
-
const archivePath = `${sourcePath}.migrated-${(/* @__PURE__ */ new Date()).toISOString().replaceAll(":", "-")}-${randomUUID()}`;
|
|
81
|
-
try {
|
|
82
|
-
await fs$1.rename(sourcePath, archivePath);
|
|
83
|
-
params.changes.push(`Archived Matrix IndexedDB snapshot legacy source -> ${archivePath}`);
|
|
84
|
-
return true;
|
|
85
|
-
} catch (err) {
|
|
86
|
-
params.warnings.push(`Failed archiving Matrix IndexedDB snapshot legacy source: ${String(err)}`);
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
//#endregion
|
|
91
|
-
export { migrateLegacyMatrixIdbSnapshot };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { detectPluginInstallPathIssue, formatPluginInstallPathIssue, removePluginFromConfig } from "openclaw/plugin-sdk/doctor-repair-runtime";
|
|
2
|
-
//#region extensions/matrix/src/doctor.ts
|
|
3
|
-
async function collectMatrixInstallPathWarnings(cfg) {
|
|
4
|
-
const issue = await detectPluginInstallPathIssue({
|
|
5
|
-
pluginId: "matrix",
|
|
6
|
-
install: cfg.plugins?.installs?.matrix
|
|
7
|
-
});
|
|
8
|
-
if (!issue) return [];
|
|
9
|
-
return formatPluginInstallPathIssue({
|
|
10
|
-
issue,
|
|
11
|
-
pluginLabel: "Matrix",
|
|
12
|
-
defaultInstallCommand: "openclaw plugins install @openclaw/matrix"
|
|
13
|
-
}).map((entry) => `- ${entry}`);
|
|
14
|
-
}
|
|
15
|
-
async function cleanStaleMatrixPluginConfig(cfg) {
|
|
16
|
-
const issue = await detectPluginInstallPathIssue({
|
|
17
|
-
pluginId: "matrix",
|
|
18
|
-
install: cfg.plugins?.installs?.matrix
|
|
19
|
-
});
|
|
20
|
-
if (!issue || issue.kind !== "missing-path") return {
|
|
21
|
-
config: cfg,
|
|
22
|
-
changes: []
|
|
23
|
-
};
|
|
24
|
-
const { config, actions } = removePluginFromConfig(cfg, "matrix");
|
|
25
|
-
const removed = [];
|
|
26
|
-
if (actions.install) removed.push("install record");
|
|
27
|
-
if (actions.loadPath) removed.push("load path");
|
|
28
|
-
if (actions.entry) removed.push("plugin entry");
|
|
29
|
-
if (actions.allowlist) removed.push("allowlist entry");
|
|
30
|
-
if (removed.length === 0) return {
|
|
31
|
-
config: cfg,
|
|
32
|
-
changes: []
|
|
33
|
-
};
|
|
34
|
-
return {
|
|
35
|
-
config,
|
|
36
|
-
changes: [`Removed stale Matrix plugin references (${removed.join(", ")}). The previous install path no longer exists: ${issue.path}`]
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
async function runMatrixDoctorSequence(params) {
|
|
40
|
-
const warningNotes = [];
|
|
41
|
-
const installWarnings = await collectMatrixInstallPathWarnings(params.cfg);
|
|
42
|
-
if (installWarnings.length > 0) warningNotes.push(installWarnings.join("\n"));
|
|
43
|
-
return {
|
|
44
|
-
changeNotes: [],
|
|
45
|
-
warningNotes
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
//#endregion
|
|
49
|
-
export { cleanStaleMatrixPluginConfig, collectMatrixInstallPathWarnings, runMatrixDoctorSequence };
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import { t as getMatrixRuntime } from "./runtime-1kn1P6io.mjs";
|
|
2
|
-
import { C as writeMatrixIdbSnapshotJson, o as MATRIX_IDB_SNAPSHOT_FILENAME, y as readMatrixIdbSnapshotJson } from "./storage-metadata-BDRZ7vpX.mjs";
|
|
3
|
-
import { n as LogService } from "./logger-CVv56jzH.mjs";
|
|
4
|
-
import { n as MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS } from "./idb-persistence-lock-D_mDu4Cf.mjs";
|
|
5
|
-
import path from "node:path";
|
|
6
|
-
import { toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
7
|
-
import fs from "node:fs";
|
|
8
|
-
import { withFileLock } from "openclaw/plugin-sdk/file-lock";
|
|
9
|
-
import { indexedDB } from "fake-indexeddb";
|
|
10
|
-
//#region extensions/matrix/src/matrix/sdk/idb-persistence.ts
|
|
11
|
-
const LEGACY_SNAPSHOT_DIAGNOSTIC = {
|
|
12
|
-
code: "matrix-idb-snapshot-requires-doctor",
|
|
13
|
-
message: "Matrix IndexedDB snapshot exists outside canonical SQLite state",
|
|
14
|
-
remediation: "openclaw doctor --fix"
|
|
15
|
-
};
|
|
16
|
-
var MatrixIdbSnapshotMigrationRequiredError = class extends Error {
|
|
17
|
-
constructor() {
|
|
18
|
-
super(`${LEGACY_SNAPSHOT_DIAGNOSTIC.message}; run ${LEGACY_SNAPSHOT_DIAGNOSTIC.remediation}`);
|
|
19
|
-
this.code = LEGACY_SNAPSHOT_DIAGNOSTIC.code;
|
|
20
|
-
this.remediation = LEGACY_SNAPSHOT_DIAGNOSTIC.remediation;
|
|
21
|
-
this.name = "MatrixIdbSnapshotMigrationRequiredError";
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
function isValidIdbIndexSnapshot(value) {
|
|
25
|
-
if (!value || typeof value !== "object") return false;
|
|
26
|
-
const candidate = value;
|
|
27
|
-
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";
|
|
28
|
-
}
|
|
29
|
-
function isValidIdbRecordSnapshot(value) {
|
|
30
|
-
if (!value || typeof value !== "object") return false;
|
|
31
|
-
return "key" in value && "value" in value;
|
|
32
|
-
}
|
|
33
|
-
function isValidIdbStoreSnapshot(value) {
|
|
34
|
-
if (!value || typeof value !== "object") return false;
|
|
35
|
-
const candidate = value;
|
|
36
|
-
const validKeyPath = candidate.keyPath === null || typeof candidate.keyPath === "string" || Array.isArray(candidate.keyPath) && candidate.keyPath.every((entry) => typeof entry === "string");
|
|
37
|
-
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));
|
|
38
|
-
}
|
|
39
|
-
function isValidIdbDatabaseSnapshot(value) {
|
|
40
|
-
if (!value || typeof value !== "object") return false;
|
|
41
|
-
const candidate = value;
|
|
42
|
-
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));
|
|
43
|
-
}
|
|
44
|
-
function parseSnapshotPayload(data) {
|
|
45
|
-
const parsed = JSON.parse(data);
|
|
46
|
-
if (!Array.isArray(parsed) || parsed.length === 0) return null;
|
|
47
|
-
if (!parsed.every((entry) => isValidIdbDatabaseSnapshot(entry))) throw new Error("Malformed IndexedDB snapshot payload");
|
|
48
|
-
return parsed;
|
|
49
|
-
}
|
|
50
|
-
function isValidMatrixIdbSnapshotJson(data) {
|
|
51
|
-
try {
|
|
52
|
-
return parseSnapshotPayload(data) !== null;
|
|
53
|
-
} catch {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function idbReq(req) {
|
|
58
|
-
return new Promise((resolve, reject) => {
|
|
59
|
-
req.addEventListener("success", () => resolve(req.result), { once: true });
|
|
60
|
-
req.addEventListener("error", () => reject(toErrorObject(req.error, "Non-Error rejection")), { once: true });
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
async function dumpIndexedDatabases(databasePrefix) {
|
|
64
|
-
const idb = indexedDB;
|
|
65
|
-
const dbList = await idb.databases();
|
|
66
|
-
const snapshot = [];
|
|
67
|
-
const expectedPrefix = databasePrefix ? `${databasePrefix}::` : null;
|
|
68
|
-
for (const { name, version } of dbList) {
|
|
69
|
-
if (!name || !version) continue;
|
|
70
|
-
if (expectedPrefix && !name.startsWith(expectedPrefix)) continue;
|
|
71
|
-
const db = await idbReq(idb.open(name, version));
|
|
72
|
-
const stores = [];
|
|
73
|
-
for (const storeName of db.objectStoreNames) {
|
|
74
|
-
const store = db.transaction(storeName, "readonly").objectStore(storeName);
|
|
75
|
-
const storeInfo = {
|
|
76
|
-
name: storeName,
|
|
77
|
-
keyPath: store.keyPath,
|
|
78
|
-
autoIncrement: store.autoIncrement,
|
|
79
|
-
indexes: [],
|
|
80
|
-
records: []
|
|
81
|
-
};
|
|
82
|
-
for (const idxName of store.indexNames) {
|
|
83
|
-
const idx = store.index(idxName);
|
|
84
|
-
storeInfo.indexes.push({
|
|
85
|
-
name: idxName,
|
|
86
|
-
keyPath: idx.keyPath,
|
|
87
|
-
multiEntry: idx.multiEntry,
|
|
88
|
-
unique: idx.unique
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
const keys = await idbReq(store.getAllKeys());
|
|
92
|
-
const values = await idbReq(store.getAll());
|
|
93
|
-
storeInfo.records = keys.map((k, i) => ({
|
|
94
|
-
key: k,
|
|
95
|
-
value: values[i]
|
|
96
|
-
}));
|
|
97
|
-
stores.push(storeInfo);
|
|
98
|
-
}
|
|
99
|
-
snapshot.push({
|
|
100
|
-
name,
|
|
101
|
-
version,
|
|
102
|
-
stores
|
|
103
|
-
});
|
|
104
|
-
db.close();
|
|
105
|
-
}
|
|
106
|
-
return snapshot;
|
|
107
|
-
}
|
|
108
|
-
async function restoreIndexedDatabases(snapshot) {
|
|
109
|
-
const idb = indexedDB;
|
|
110
|
-
for (const dbSnap of snapshot) {
|
|
111
|
-
const request = idb.open(dbSnap.name, dbSnap.version);
|
|
112
|
-
request.addEventListener("upgradeneeded", () => {
|
|
113
|
-
const db = request.result;
|
|
114
|
-
for (const storeSnap of dbSnap.stores) {
|
|
115
|
-
const opts = {};
|
|
116
|
-
if (storeSnap.keyPath !== null) opts.keyPath = storeSnap.keyPath;
|
|
117
|
-
if (storeSnap.autoIncrement) opts.autoIncrement = true;
|
|
118
|
-
const store = db.createObjectStore(storeSnap.name, opts);
|
|
119
|
-
for (const idx of storeSnap.indexes) store.createIndex(idx.name, idx.keyPath, {
|
|
120
|
-
unique: idx.unique,
|
|
121
|
-
multiEntry: idx.multiEntry
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
const db = await idbReq(request);
|
|
126
|
-
try {
|
|
127
|
-
for (const storeSnap of dbSnap.stores) {
|
|
128
|
-
if (storeSnap.records.length === 0) continue;
|
|
129
|
-
const tx = db.transaction(storeSnap.name, "readwrite");
|
|
130
|
-
const store = tx.objectStore(storeSnap.name);
|
|
131
|
-
for (const rec of storeSnap.records) if (storeSnap.keyPath !== null) store.put(rec.value);
|
|
132
|
-
else store.put(rec.value, rec.key);
|
|
133
|
-
await new Promise((resolve, reject) => {
|
|
134
|
-
tx.addEventListener("complete", () => resolve(), { once: true });
|
|
135
|
-
tx.addEventListener("abort", () => reject(toErrorObject(tx.error, "IndexedDB restore transaction aborted")), { once: true });
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
} finally {
|
|
139
|
-
db.close();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
function resolveDefaultIdbSnapshotPath() {
|
|
144
|
-
const stateDir = process.env.OPENCLAW_STATE_DIR || path.join(process.env.HOME || "/tmp", ".openclaw");
|
|
145
|
-
return path.join(stateDir, "matrix", "crypto-idb-snapshot.json");
|
|
146
|
-
}
|
|
147
|
-
async function readCanonicalSnapshotJson(snapshotPath, stateRuntime) {
|
|
148
|
-
let storedSnapshotJson;
|
|
149
|
-
try {
|
|
150
|
-
storedSnapshotJson = await readMatrixIdbSnapshotJson(path.dirname(snapshotPath), stateRuntime);
|
|
151
|
-
} catch (err) {
|
|
152
|
-
if (fs.existsSync(snapshotPath)) throwLegacySnapshotMigrationRequired();
|
|
153
|
-
throw err;
|
|
154
|
-
}
|
|
155
|
-
throwIfLegacySnapshotNeedsDoctor(snapshotPath, storedSnapshotJson);
|
|
156
|
-
return storedSnapshotJson;
|
|
157
|
-
}
|
|
158
|
-
async function restoreIdbFromDisk(snapshotPath, stateRuntime) {
|
|
159
|
-
const resolvedPath = snapshotPath ?? resolveDefaultIdbSnapshotPath();
|
|
160
|
-
let callbackStarted = false;
|
|
161
|
-
try {
|
|
162
|
-
const snapshotStateRuntime = stateRuntime ?? getMatrixRuntime().state;
|
|
163
|
-
return await withFileLock(resolvedPath, MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, async () => {
|
|
164
|
-
callbackStarted = true;
|
|
165
|
-
const storedSnapshotJson = await readCanonicalSnapshotJson(resolvedPath, snapshotStateRuntime);
|
|
166
|
-
if (!storedSnapshotJson) return false;
|
|
167
|
-
const snapshot = parseSnapshotPayload(storedSnapshotJson);
|
|
168
|
-
if (!snapshot) return false;
|
|
169
|
-
await restoreIndexedDatabases(snapshot);
|
|
170
|
-
LogService.info("IdbPersistence", `Restored ${snapshot.length} IndexedDB database(s) from Matrix SQLite state`);
|
|
171
|
-
return true;
|
|
172
|
-
});
|
|
173
|
-
} catch (err) {
|
|
174
|
-
if (err instanceof MatrixIdbSnapshotMigrationRequiredError) throw err;
|
|
175
|
-
if (!callbackStarted && fs.existsSync(resolvedPath)) throwLegacySnapshotMigrationRequired();
|
|
176
|
-
LogService.warn("IdbPersistence", "Failed to restore IndexedDB snapshot from SQLite:", err);
|
|
177
|
-
return false;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
async function persistIdbToDisk(params) {
|
|
181
|
-
const snapshotPath = params?.snapshotPath ?? resolveDefaultIdbSnapshotPath();
|
|
182
|
-
let callbackStarted = false;
|
|
183
|
-
try {
|
|
184
|
-
const stateRuntime = params?.stateRuntime ?? getMatrixRuntime().state;
|
|
185
|
-
fs.mkdirSync(path.dirname(snapshotPath), { recursive: true });
|
|
186
|
-
const persistedCount = await withFileLock(snapshotPath, MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, async () => {
|
|
187
|
-
callbackStarted = true;
|
|
188
|
-
const storageRootDir = path.dirname(snapshotPath);
|
|
189
|
-
await readCanonicalSnapshotJson(snapshotPath, stateRuntime);
|
|
190
|
-
const snapshot = await dumpIndexedDatabases(params?.databasePrefix);
|
|
191
|
-
if (params?.abortSignal?.aborted || snapshot.length === 0) return 0;
|
|
192
|
-
await writeMatrixIdbSnapshotJson({
|
|
193
|
-
storageRootDir,
|
|
194
|
-
snapshotJson: JSON.stringify(snapshot),
|
|
195
|
-
databaseCount: snapshot.length,
|
|
196
|
-
stateRuntime
|
|
197
|
-
});
|
|
198
|
-
return snapshot.length;
|
|
199
|
-
});
|
|
200
|
-
if (persistedCount === 0) return;
|
|
201
|
-
LogService.debug("IdbPersistence", `Persisted ${persistedCount} IndexedDB database(s) to Matrix SQLite state`);
|
|
202
|
-
} catch (err) {
|
|
203
|
-
if (err instanceof MatrixIdbSnapshotMigrationRequiredError) throw err;
|
|
204
|
-
if (!callbackStarted && fs.existsSync(snapshotPath)) throwLegacySnapshotMigrationRequired();
|
|
205
|
-
LogService.warn("IdbPersistence", "Failed to persist IndexedDB snapshot:", err);
|
|
206
|
-
if (params?.strict) throw err;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
function readLegacyMatrixIdbSnapshotStateUnlocked(storageRootDir) {
|
|
210
|
-
const snapshotPath = path.join(storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
|
|
211
|
-
if (!fs.existsSync(snapshotPath)) return null;
|
|
212
|
-
const data = fs.readFileSync(snapshotPath, "utf8");
|
|
213
|
-
try {
|
|
214
|
-
return parseSnapshotPayload(data);
|
|
215
|
-
} catch {
|
|
216
|
-
return null;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
function throwIfLegacySnapshotNeedsDoctor(snapshotPath, storedSnapshotJson) {
|
|
220
|
-
if (fs.existsSync(snapshotPath) && (!storedSnapshotJson || !isValidMatrixIdbSnapshotJson(storedSnapshotJson))) throwLegacySnapshotMigrationRequired();
|
|
221
|
-
}
|
|
222
|
-
function throwLegacySnapshotMigrationRequired() {
|
|
223
|
-
LogService.warn("IdbPersistence", LEGACY_SNAPSHOT_DIAGNOSTIC);
|
|
224
|
-
throw new MatrixIdbSnapshotMigrationRequiredError();
|
|
225
|
-
}
|
|
226
|
-
//#endregion
|
|
227
|
-
export { restoreIdbFromDisk as i, persistIdbToDisk as n, readLegacyMatrixIdbSnapshotStateUnlocked as r, isValidMatrixIdbSnapshotJson as t };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
//#region extensions/matrix/src/matrix/sdk/idb-persistence-lock.ts
|
|
2
|
-
const MATRIX_IDB_PERSIST_INTERVAL_MS = 6e4;
|
|
3
|
-
const IDB_SNAPSHOT_LOCK_STALE_MS = 3e5;
|
|
4
|
-
const IDB_SNAPSHOT_LOCK_RETRY_BASE = {
|
|
5
|
-
factor: 2,
|
|
6
|
-
minTimeout: 50,
|
|
7
|
-
maxTimeout: 5e3,
|
|
8
|
-
randomize: true
|
|
9
|
-
};
|
|
10
|
-
function resolveRetriesForMinimumWindowMs(retries, minimumWindowMs) {
|
|
11
|
-
const resolved = {
|
|
12
|
-
...retries,
|
|
13
|
-
retries: 0
|
|
14
|
-
};
|
|
15
|
-
let total = 0;
|
|
16
|
-
while (total < minimumWindowMs) {
|
|
17
|
-
total += Math.min(retries.maxTimeout, Math.max(retries.minTimeout, retries.minTimeout * retries.factor ** resolved.retries));
|
|
18
|
-
resolved.retries += 1;
|
|
19
|
-
}
|
|
20
|
-
return resolved;
|
|
21
|
-
}
|
|
22
|
-
const MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS = {
|
|
23
|
-
retries: resolveRetriesForMinimumWindowMs(IDB_SNAPSHOT_LOCK_RETRY_BASE, MATRIX_IDB_PERSIST_INTERVAL_MS),
|
|
24
|
-
stale: IDB_SNAPSHOT_LOCK_STALE_MS
|
|
25
|
-
};
|
|
26
|
-
//#endregion
|
|
27
|
-
export { MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS as n, MATRIX_IDB_PERSIST_INTERVAL_MS as t };
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { t as getMatrixRuntime } from "./runtime-1kn1P6io.mjs";
|
|
2
|
-
import { format } from "node:util";
|
|
3
|
-
import { redactSensitiveText } from "openclaw/plugin-sdk/security-runtime";
|
|
4
|
-
//#region extensions/matrix/src/matrix/sdk/logger.ts
|
|
5
|
-
function noop() {}
|
|
6
|
-
let forceConsoleLogging = false;
|
|
7
|
-
function setMatrixConsoleLogging(enabled) {
|
|
8
|
-
forceConsoleLogging = enabled;
|
|
9
|
-
}
|
|
10
|
-
function resolveRuntimeLogger(module) {
|
|
11
|
-
if (forceConsoleLogging) return null;
|
|
12
|
-
try {
|
|
13
|
-
return getMatrixRuntime().logging.getChildLogger({ module: `matrix:${module}` });
|
|
14
|
-
} catch {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function formatMessage(module, messageOrObject) {
|
|
19
|
-
if (messageOrObject.length === 0) return `[${module}]`;
|
|
20
|
-
return redactSensitiveText(`[${module}] ${format(...messageOrObject)}`);
|
|
21
|
-
}
|
|
22
|
-
var ConsoleLogger = class {
|
|
23
|
-
emit(level, module, ...messageOrObject) {
|
|
24
|
-
const runtimeLogger = resolveRuntimeLogger(module);
|
|
25
|
-
const message = formatMessage(module, messageOrObject);
|
|
26
|
-
if (runtimeLogger) {
|
|
27
|
-
if (level === "debug") {
|
|
28
|
-
runtimeLogger.debug?.(message);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
runtimeLogger[level](message);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
console[level](message);
|
|
35
|
-
}
|
|
36
|
-
trace(module, ...messageOrObject) {
|
|
37
|
-
this.emit("debug", module, ...messageOrObject);
|
|
38
|
-
}
|
|
39
|
-
debug(module, ...messageOrObject) {
|
|
40
|
-
this.emit("debug", module, ...messageOrObject);
|
|
41
|
-
}
|
|
42
|
-
info(module, ...messageOrObject) {
|
|
43
|
-
this.emit("info", module, ...messageOrObject);
|
|
44
|
-
}
|
|
45
|
-
warn(module, ...messageOrObject) {
|
|
46
|
-
this.emit("warn", module, ...messageOrObject);
|
|
47
|
-
}
|
|
48
|
-
error(module, ...messageOrObject) {
|
|
49
|
-
this.emit("error", module, ...messageOrObject);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
let activeLogger = new ConsoleLogger();
|
|
53
|
-
const LogService = {
|
|
54
|
-
setLogger(logger) {
|
|
55
|
-
activeLogger = logger;
|
|
56
|
-
},
|
|
57
|
-
trace(module, ...messageOrObject) {
|
|
58
|
-
activeLogger.trace(module, ...messageOrObject);
|
|
59
|
-
},
|
|
60
|
-
debug(module, ...messageOrObject) {
|
|
61
|
-
activeLogger.debug(module, ...messageOrObject);
|
|
62
|
-
},
|
|
63
|
-
info(module, ...messageOrObject) {
|
|
64
|
-
activeLogger.info(module, ...messageOrObject);
|
|
65
|
-
},
|
|
66
|
-
warn(module, ...messageOrObject) {
|
|
67
|
-
activeLogger.warn(module, ...messageOrObject);
|
|
68
|
-
},
|
|
69
|
-
error(module, ...messageOrObject) {
|
|
70
|
-
activeLogger.error(module, ...messageOrObject);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
//#endregion
|
|
74
|
-
export { setMatrixConsoleLogging as i, LogService as n, noop as r, ConsoleLogger as t };
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import { t as getMatrixRuntime } from "./runtime-1kn1P6io.mjs";
|
|
2
|
-
import { O as resolveMatrixSqliteStateEnv } from "./storage-metadata-BDRZ7vpX.mjs";
|
|
3
|
-
import { o as resolveMatrixStoragePaths, r as recordCurrentStorageMetaDeviceId } from "./storage-BXS2cB2i.mjs";
|
|
4
|
-
import { createHash } from "node:crypto";
|
|
5
|
-
import path from "node:path";
|
|
6
|
-
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
7
|
-
import { timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
8
|
-
import fs from "node:fs/promises";
|
|
9
|
-
import { tryReadJson } from "@openclaw/fs-safe/json";
|
|
10
|
-
//#region extensions/matrix/src/matrix/monitor/startup-verification.ts
|
|
11
|
-
const STARTUP_VERIFICATION_STATE_FILENAME = "startup-verification.json";
|
|
12
|
-
const STARTUP_VERIFICATION_NAMESPACE = "startup-verification";
|
|
13
|
-
const STARTUP_VERIFICATION_MIGRATIONS_NAMESPACE = "startup-verification-migrations";
|
|
14
|
-
const STARTUP_VERIFICATION_MAX_ENTRIES = 1e3;
|
|
15
|
-
const DEFAULT_STARTUP_VERIFICATION_MODE = "if-unverified";
|
|
16
|
-
const DEFAULT_STARTUP_VERIFICATION_COOLDOWN_HOURS = 24;
|
|
17
|
-
const DEFAULT_STARTUP_VERIFICATION_FAILURE_COOLDOWN_MS = 36e5;
|
|
18
|
-
function normalizeCooldownHours(value) {
|
|
19
|
-
if (typeof value !== "number" || !Number.isFinite(value)) return DEFAULT_STARTUP_VERIFICATION_COOLDOWN_HOURS;
|
|
20
|
-
return Math.max(0, value);
|
|
21
|
-
}
|
|
22
|
-
async function resolveStartupVerificationStatePath(params) {
|
|
23
|
-
const storagePaths = await resolveMatrixStoragePaths({
|
|
24
|
-
homeserver: params.auth.homeserver,
|
|
25
|
-
userId: params.auth.userId,
|
|
26
|
-
accessToken: params.auth.accessToken,
|
|
27
|
-
accountId: params.auth.accountId,
|
|
28
|
-
deviceId: params.auth.deviceId,
|
|
29
|
-
env: params.env,
|
|
30
|
-
stateDir: params.stateDir
|
|
31
|
-
});
|
|
32
|
-
return path.join(storagePaths.rootDir, STARTUP_VERIFICATION_STATE_FILENAME);
|
|
33
|
-
}
|
|
34
|
-
function buildStartupVerificationKey(auth) {
|
|
35
|
-
return auth.accountId.trim() || "default";
|
|
36
|
-
}
|
|
37
|
-
function createStartupVerificationStore(params) {
|
|
38
|
-
return getMatrixRuntime().state.openKeyedStore({
|
|
39
|
-
namespace: STARTUP_VERIFICATION_NAMESPACE,
|
|
40
|
-
maxEntries: STARTUP_VERIFICATION_MAX_ENTRIES,
|
|
41
|
-
env: resolveMatrixSqliteStateEnv(params)
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
function createStartupVerificationMigrationStore(params) {
|
|
45
|
-
return getMatrixRuntime().state.openKeyedStore({
|
|
46
|
-
namespace: STARTUP_VERIFICATION_MIGRATIONS_NAMESPACE,
|
|
47
|
-
maxEntries: STARTUP_VERIFICATION_MAX_ENTRIES,
|
|
48
|
-
env: resolveMatrixSqliteStateEnv(params)
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
function buildStartupVerificationImportKey(params) {
|
|
52
|
-
const accountId = buildStartupVerificationKey(params.auth);
|
|
53
|
-
return `${accountId}:${createHash("sha256").update(accountId).update("\0").update(params.legacyFilePath).digest("hex")}`;
|
|
54
|
-
}
|
|
55
|
-
async function readLegacyStartupVerificationState(filePath) {
|
|
56
|
-
const value = await tryReadJson(filePath);
|
|
57
|
-
return value && typeof value === "object" ? value : null;
|
|
58
|
-
}
|
|
59
|
-
async function readStartupVerificationState(params) {
|
|
60
|
-
const store = createStartupVerificationStore(params);
|
|
61
|
-
const key = buildStartupVerificationKey(params.auth);
|
|
62
|
-
const value = await store.lookup(key);
|
|
63
|
-
if (value && typeof value === "object") return value;
|
|
64
|
-
const migrationStore = createStartupVerificationMigrationStore(params);
|
|
65
|
-
const legacyImportKey = buildStartupVerificationImportKey({
|
|
66
|
-
auth: params.auth,
|
|
67
|
-
legacyFilePath: params.legacyFilePath
|
|
68
|
-
});
|
|
69
|
-
if (await migrationStore.lookup(legacyImportKey)) return null;
|
|
70
|
-
const legacy = await readLegacyStartupVerificationState(params.legacyFilePath);
|
|
71
|
-
if (legacy) await store.register(key, legacy).then(async () => {
|
|
72
|
-
if (typeof legacy.deviceId === "string" && legacy.deviceId.trim()) await recordCurrentStorageMetaDeviceId({
|
|
73
|
-
rootDir: path.dirname(params.legacyFilePath),
|
|
74
|
-
deviceId: legacy.deviceId
|
|
75
|
-
});
|
|
76
|
-
await migrationStore.register(legacyImportKey, { importedAt: Date.now() });
|
|
77
|
-
await fs.rm(params.legacyFilePath, { force: true }).catch(() => {});
|
|
78
|
-
}).catch(() => {});
|
|
79
|
-
return legacy;
|
|
80
|
-
}
|
|
81
|
-
async function writeStartupVerificationState(params) {
|
|
82
|
-
await createStartupVerificationStore(params).register(buildStartupVerificationKey(params.auth), params.state);
|
|
83
|
-
await createStartupVerificationMigrationStore(params).register(buildStartupVerificationImportKey({
|
|
84
|
-
auth: params.auth,
|
|
85
|
-
legacyFilePath: params.legacyFilePath
|
|
86
|
-
}), { importedAt: Date.now() }).catch(() => {});
|
|
87
|
-
if (typeof params.state.deviceId === "string" && params.state.deviceId.trim()) await recordCurrentStorageMetaDeviceId({
|
|
88
|
-
rootDir: path.dirname(params.legacyFilePath),
|
|
89
|
-
deviceId: params.state.deviceId
|
|
90
|
-
});
|
|
91
|
-
await fs.rm(params.legacyFilePath, { force: true }).catch(() => {});
|
|
92
|
-
}
|
|
93
|
-
async function clearStartupVerificationState(params) {
|
|
94
|
-
await createStartupVerificationStore(params).delete(buildStartupVerificationKey(params.auth)).catch(() => {});
|
|
95
|
-
await createStartupVerificationMigrationStore(params).register(buildStartupVerificationImportKey({
|
|
96
|
-
auth: params.auth,
|
|
97
|
-
legacyFilePath: params.legacyFilePath
|
|
98
|
-
}), { importedAt: Date.now() }).catch(() => {});
|
|
99
|
-
await fs.rm(params.legacyFilePath, { force: true }).catch(() => {});
|
|
100
|
-
}
|
|
101
|
-
function resolveStateCooldownMs(state, cooldownMs) {
|
|
102
|
-
if (state?.outcome === "failed") return Math.min(cooldownMs, DEFAULT_STARTUP_VERIFICATION_FAILURE_COOLDOWN_MS);
|
|
103
|
-
return cooldownMs;
|
|
104
|
-
}
|
|
105
|
-
function resolveRetryAfterMs(params) {
|
|
106
|
-
const attemptedAtMs = Date.parse(params.attemptedAt ?? "");
|
|
107
|
-
if (!Number.isFinite(attemptedAtMs)) return;
|
|
108
|
-
const remaining = attemptedAtMs + params.cooldownMs - params.nowMs;
|
|
109
|
-
return remaining > 0 ? remaining : void 0;
|
|
110
|
-
}
|
|
111
|
-
function resolveStartupVerificationTimestamp(nowMs) {
|
|
112
|
-
return timestampMsToIsoString(nowMs) ?? timestampMsToIsoString(Date.now()) ?? "1970-01-01T00:00:00.000Z";
|
|
113
|
-
}
|
|
114
|
-
function resolveStartupVerificationRetryAfterMs(params) {
|
|
115
|
-
if (!params.state || params.stateCooldownMs <= 0) return;
|
|
116
|
-
if (params.state.userId && params.verification.userId && params.state.userId !== params.verification.userId) return;
|
|
117
|
-
if (params.state.deviceId && params.verification.deviceId && params.state.deviceId !== params.verification.deviceId) return;
|
|
118
|
-
return resolveRetryAfterMs({
|
|
119
|
-
attemptedAt: params.state.attemptedAt,
|
|
120
|
-
cooldownMs: params.stateCooldownMs,
|
|
121
|
-
nowMs: params.nowMs
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
async function ensureMatrixStartupVerification(params) {
|
|
125
|
-
if (params.auth.encryption !== true || !params.client.crypto) return { kind: "unsupported" };
|
|
126
|
-
const verification = await params.client.getOwnDeviceVerificationStatus();
|
|
127
|
-
const statePath = params.stateFilePath ?? await resolveStartupVerificationStatePath({
|
|
128
|
-
auth: params.auth,
|
|
129
|
-
env: params.env,
|
|
130
|
-
stateDir: params.stateDir
|
|
131
|
-
});
|
|
132
|
-
const stateLocation = {
|
|
133
|
-
auth: params.auth,
|
|
134
|
-
env: params.env,
|
|
135
|
-
stateDir: params.stateDir ?? path.dirname(statePath),
|
|
136
|
-
legacyFilePath: statePath
|
|
137
|
-
};
|
|
138
|
-
const mode = params.accountConfig.startupVerification ?? DEFAULT_STARTUP_VERIFICATION_MODE;
|
|
139
|
-
if (verification.verified || mode === "off") {
|
|
140
|
-
await clearStartupVerificationState(stateLocation);
|
|
141
|
-
return {
|
|
142
|
-
kind: verification.verified ? "verified" : "disabled",
|
|
143
|
-
verification
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
if ((await params.client.crypto.listVerifications().catch(() => [])).some((entry) => entry.isSelfVerification && !entry.completed && entry.pending)) return {
|
|
147
|
-
kind: "pending",
|
|
148
|
-
verification
|
|
149
|
-
};
|
|
150
|
-
const cooldownMs = normalizeCooldownHours(params.accountConfig.startupVerificationCooldownHours) * 60 * 60 * 1e3;
|
|
151
|
-
const nowMs = params.nowMs ?? Date.now();
|
|
152
|
-
const attemptedAt = resolveStartupVerificationTimestamp(nowMs);
|
|
153
|
-
const state = await readStartupVerificationState(stateLocation);
|
|
154
|
-
const retryAfterMs = resolveStartupVerificationRetryAfterMs({
|
|
155
|
-
state,
|
|
156
|
-
verification,
|
|
157
|
-
stateCooldownMs: resolveStateCooldownMs(state, cooldownMs),
|
|
158
|
-
nowMs
|
|
159
|
-
});
|
|
160
|
-
if (retryAfterMs !== void 0) return {
|
|
161
|
-
kind: "cooldown",
|
|
162
|
-
verification,
|
|
163
|
-
retryAfterMs
|
|
164
|
-
};
|
|
165
|
-
try {
|
|
166
|
-
const request = await params.client.crypto.requestVerification({ ownUser: true });
|
|
167
|
-
await writeStartupVerificationState({
|
|
168
|
-
...stateLocation,
|
|
169
|
-
state: {
|
|
170
|
-
userId: verification.userId,
|
|
171
|
-
deviceId: verification.deviceId,
|
|
172
|
-
attemptedAt,
|
|
173
|
-
outcome: "requested",
|
|
174
|
-
requestId: request.id,
|
|
175
|
-
transactionId: request.transactionId
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
return {
|
|
179
|
-
kind: "requested",
|
|
180
|
-
verification,
|
|
181
|
-
requestId: request.id,
|
|
182
|
-
transactionId: request.transactionId ?? void 0
|
|
183
|
-
};
|
|
184
|
-
} catch (err) {
|
|
185
|
-
const error = formatErrorMessage(err);
|
|
186
|
-
await writeStartupVerificationState({
|
|
187
|
-
...stateLocation,
|
|
188
|
-
state: {
|
|
189
|
-
userId: verification.userId,
|
|
190
|
-
deviceId: verification.deviceId,
|
|
191
|
-
attemptedAt,
|
|
192
|
-
outcome: "failed",
|
|
193
|
-
error
|
|
194
|
-
}
|
|
195
|
-
}).catch(() => {});
|
|
196
|
-
return {
|
|
197
|
-
kind: "request-failed",
|
|
198
|
-
verification,
|
|
199
|
-
error
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
//#endregion
|
|
204
|
-
export { ensureMatrixStartupVerification };
|