@openclaw/matrix 2026.10.5-beta.4 → 2026.10.10-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/{approval-handler.runtime-rxLn8CbP.mjs → approval-handler.runtime-CsqMdj7h.mjs} +9 -9
- package/dist/.setup/{approval-reactions-DhB6gNPU.mjs → approval-reactions-D2pEUrFS.mjs} +1 -1
- package/dist/.setup/{channel-BcwGspPw.mjs → channel-Dw4_imdd.mjs} +132 -111
- package/dist/.setup/{channel.runtime-CUc6rbu1.mjs → channel.runtime-2EEtIlyu.mjs} +6 -6
- package/dist/.setup/{channel.setup-CwuYD_CT.mjs → channel.setup-Be8TYKMA.mjs} +8 -3
- package/dist/.setup/{cli-mbL9jCro.mjs → cli-CEmWh7wh.mjs} +99 -37
- package/dist/.setup/{cli-metadata-6MOGuyHq.mjs → cli-metadata-CBLGwJT6.mjs} +1 -1
- package/dist/.setup/{client-BlTvpEWC.mjs → client-BKiiI29H.mjs} +3 -3
- package/dist/.setup/{client-vPPbaxNp.mjs → client-C4Gibhzl.mjs} +94 -120
- package/dist/.setup/{client-bootstrap-D05xy1HB.mjs → client-bootstrap-kOIDV4z_.mjs} +3 -3
- package/dist/.setup/{create-client-CroC4BVc.mjs → create-client-BS8UYx6N.mjs} +23 -15
- package/dist/.setup/{credentials-Bf9PQ7xs.mjs → credentials-CPnJZaZB.mjs} +3 -5
- package/dist/.setup/{credentials-read-CqRiEAQa.mjs → credentials-read-D2ULV55A.mjs} +12 -4
- package/dist/.setup/{crypto-runtime-CpJ0b7vY.mjs → crypto-runtime-D8yY7kjD.mjs} +168 -290
- package/dist/.setup/crypto-state-store-D4wrCvFs.mjs +185 -0
- package/dist/.setup/crypto-store-ownership-Z_Y5WRKr.mjs +174 -0
- package/dist/.setup/crypto-unsafe-state-doctor-C8szCYmf.mjs +54 -0
- package/dist/.setup/{directory-live-B1WbfSHo.mjs → directory-live-BpSz-FQB.mjs} +1 -1
- package/dist/.setup/{draft-stream-Bdrh7dRt.mjs → draft-stream-DYf0th1n.mjs} +1 -1
- package/dist/.setup/{exec-approvals-BgNWWJg1.mjs → exec-approvals-DaM-5OA5.mjs} +33 -43
- package/dist/.setup/{file-sync-store-BdKx_gMi.mjs → file-sync-store-CUH8EAJq.mjs} +3 -3
- package/dist/.setup/idb-persistence-BHTYPRe_.mjs +233 -0
- package/dist/.setup/idb-persistence-lock-Bh3ZLIsE.mjs +14 -0
- package/dist/.setup/{messages-B1CZqU8u.mjs → messages-_XHVg3do.mjs} +3 -18
- package/dist/.setup/{monitor-Dk_fQL1k.mjs → monitor-DRUSJ_Ev.mjs} +31 -39
- package/dist/.setup/{onboarding-CrSexor_.mjs → onboarding-CK9Ksgio.mjs} +3 -3
- package/dist/.setup/{outbound-LR3SqPIq.mjs → outbound-D5Z_4FBg.mjs} +28 -36
- package/dist/.setup/{profile-update-C7bjaGR6.mjs → profile-update--Pf3jCXD.mjs} +2 -2
- package/dist/.setup/{reaction-events-CTSvOlXO.mjs → reaction-events-BG9spedG.mjs} +6 -6
- package/dist/.setup/{resolve-targets-BVVbbvP6.mjs → resolve-targets-BJ5sIKeM.mjs} +1 -1
- package/dist/.setup/{retired-state-DW5pLH05.mjs → retired-state-DOCruzWd.mjs} +10 -10
- package/dist/.setup/{room-info-9Uqlpt1V.mjs → room-info-BE7bbX_c.mjs} +3 -3
- package/dist/.setup/runtime-setter-api-i2MOXoT3.mjs +2 -0
- package/dist/.setup/{sdk-Cfc6m7fY.mjs → sdk-ByU8So5S.mjs} +242 -139
- package/dist/.setup/secret-contract-DxyzKSzf.mjs +90 -0
- package/dist/.setup/secret-contract-api-Dukgvike.mjs +2 -0
- package/dist/.setup/{send-LCOuTVc1.mjs → send-BprM-Wmx.mjs} +19 -42
- package/dist/.setup/{setup-bootstrap-CV-hHBXu.mjs → setup-bootstrap-DmznRqYe.mjs} +2 -6
- package/dist/.setup/{setup-core-CKnNTfgD.mjs → setup-core-DcCk1_Tv.mjs} +4 -7
- package/dist/.setup/setup-plugin-api-BU6UGksW.mjs +2 -0
- package/dist/.setup/{startup-verification-CgfUb4yJ.mjs → startup-verification-UU8DUvi4.mjs} +5 -13
- package/dist/.setup/state-layout-walk-BQMgMykU.mjs +27 -0
- package/dist/.setup/{storage-DkC6bHgA.mjs → storage-l8V0XsGM.mjs} +7 -166
- package/dist/.setup/{subagent-hooks-D8jyeQsO.mjs → subagent-hooks-CSY4iwa_.mjs} +7 -6
- package/dist/.setup/{sync-cache-state-D4G-fi3t.mjs → sync-cache-state-Cnm4TCEI.mjs} +1 -1
- package/dist/.setup/thread-bindings-rrwQAS6R.mjs +620 -0
- package/dist/.setup/{thread-bindings-shared-CbsFNbAY.mjs → thread-bindings-shared-CPjUA0Ib.mjs} +26 -5
- package/dist/.setup/{tool-actions-DAp6_XSJ.mjs → tool-actions-DBrk6Yei.mjs} +9 -11
- package/dist/.setup/{verification-B3VswneT.mjs → verification--qUbmRd-.mjs} +2 -2
- package/dist/api.js +6 -6
- package/dist/auth-presence.js +16 -2
- package/dist/channel-plugin-api.js +1 -2
- package/dist/cli-metadata.js +1 -2
- package/dist/contract-api.js +2 -2
- package/dist/doctor-contract-api.js +20 -27
- package/dist/index.js +38 -12
- package/dist/plugin-entry.handlers.runtime.js +32 -5
- package/dist/runtime-api.js +3 -3
- package/dist/runtime-setter-api.js +1 -2
- package/dist/secret-contract-api.js +1 -2
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/setup-entry.js +3 -3
- package/dist/setup-plugin-api.js +1 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/thread-binding-api.js +1 -2
- package/dist/thread-bindings-runtime.js +1 -2
- package/node_modules/@openclaw/fs-safe/CHANGELOG.md +148 -0
- package/node_modules/@openclaw/fs-safe/README.md +20 -4
- package/node_modules/@openclaw/fs-safe/dist/advanced.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/advanced.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/archive-merge.js +28 -3
- package/node_modules/@openclaw/fs-safe/dist/archive-parser.wasm +0 -0
- package/node_modules/@openclaw/fs-safe/dist/archive-read.js +11 -5
- package/node_modules/@openclaw/fs-safe/dist/archive-zip-loader.js +4 -2
- package/node_modules/@openclaw/fs-safe/dist/archive.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/atomic-io.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/bounded-read.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/bounded-read.js +9 -2
- package/node_modules/@openclaw/fs-safe/dist/clone-metadata.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/clone-metadata.js +2 -1
- package/node_modules/@openclaw/fs-safe/dist/config.d.ts +6 -0
- package/node_modules/@openclaw/fs-safe/dist/config.js +5 -0
- package/node_modules/@openclaw/fs-safe/dist/copy-file-input.d.ts +3 -1
- package/node_modules/@openclaw/fs-safe/dist/copy-file-input.js +8 -7
- package/node_modules/@openclaw/fs-safe/dist/copy-link.d.ts +26 -0
- package/node_modules/@openclaw/fs-safe/dist/copy-link.js +170 -0
- package/node_modules/@openclaw/fs-safe/dist/copy-metadata.d.ts +9 -0
- package/node_modules/@openclaw/fs-safe/dist/copy-metadata.js +39 -0
- package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.js +11 -2
- package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.d.ts +2 -4
- package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.js +4 -2
- package/node_modules/@openclaw/fs-safe/dist/copy-tree-portable.js +3 -6
- package/node_modules/@openclaw/fs-safe/dist/copy.js +3 -3
- package/node_modules/@openclaw/fs-safe/dist/create.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/creation-boundary.js +7 -4
- package/node_modules/@openclaw/fs-safe/dist/darwin-acl.d.ts +12 -0
- package/node_modules/@openclaw/fs-safe/dist/darwin-acl.js +29 -0
- package/node_modules/@openclaw/fs-safe/dist/directory-durability.d.ts +7 -4
- package/node_modules/@openclaw/fs-safe/dist/directory-guard.js +20 -5
- package/node_modules/@openclaw/fs-safe/dist/directory-mode-node.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/directory-mode-node.js +27 -2
- package/node_modules/@openclaw/fs-safe/dist/directory-receipt.d.ts +7 -7
- package/node_modules/@openclaw/fs-safe/dist/directory-receipt.js +9 -4
- package/node_modules/@openclaw/fs-safe/dist/durability.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/entry-publication.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/exact-identity.d.ts +17 -0
- package/node_modules/@openclaw/fs-safe/dist/exact-identity.js +29 -0
- package/node_modules/@openclaw/fs-safe/dist/file-handle-transfer.js +4 -2
- package/node_modules/@openclaw/fs-safe/dist/file-hash.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/file-hash.js +11 -9
- package/node_modules/@openclaw/fs-safe/dist/file-identity.d.ts +7 -1
- package/node_modules/@openclaw/fs-safe/dist/file-identity.js +27 -5
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-admission.js +1 -2
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync.js +8 -1
- package/node_modules/@openclaw/fs-safe/dist/file-lock.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/file-lock.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/file-write-lease.d.ts +9 -0
- package/node_modules/@openclaw/fs-safe/dist/file-write-lease.js +42 -0
- package/node_modules/@openclaw/fs-safe/dist/guarded-mkdir.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/guarded-mkdir.js +22 -15
- package/node_modules/@openclaw/fs-safe/dist/guest-native-python.js +3 -0
- package/node_modules/@openclaw/fs-safe/dist/hardlink-fallback.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/hardlink-fallback.js +5 -0
- package/node_modules/@openclaw/fs-safe/dist/index.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/index.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/json-durable-queue-ownership.js +16 -3
- package/node_modules/@openclaw/fs-safe/dist/local-file-descriptor.js +24 -13
- package/node_modules/@openclaw/fs-safe/dist/native-binding.d.ts +85 -18
- package/node_modules/@openclaw/fs-safe/dist/native-config.d.ts +5 -0
- package/node_modules/@openclaw/fs-safe/dist/native-config.js +11 -0
- package/node_modules/@openclaw/fs-safe/dist/native-directory-observation.js +6 -4
- package/node_modules/@openclaw/fs-safe/dist/native-fallback-warning.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/native-fallback-warning.js +26 -2
- package/node_modules/@openclaw/fs-safe/dist/native-guidance.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/native-guidance.js +21 -0
- package/node_modules/@openclaw/fs-safe/dist/native-move-fallback.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/native-move-fallback.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/native-operations.js +8 -6
- package/node_modules/@openclaw/fs-safe/dist/native-parent-admission.d.ts +44 -4
- package/node_modules/@openclaw/fs-safe/dist/native-parent-admission.js +85 -15
- package/node_modules/@openclaw/fs-safe/dist/native-pinned-write-windows.d.ts +3 -3
- package/node_modules/@openclaw/fs-safe/dist/native-pinned-write-windows.js +33 -6
- package/node_modules/@openclaw/fs-safe/dist/native-pinned-write.d.ts +4 -1
- package/node_modules/@openclaw/fs-safe/dist/native-pinned-write.js +22 -3
- package/node_modules/@openclaw/fs-safe/dist/native-policy-directory-observation.js +4 -3
- package/node_modules/@openclaw/fs-safe/dist/native-policy-parent.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/native-policy-parent.js +3 -0
- package/node_modules/@openclaw/fs-safe/dist/native-staged-file-metadata.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/native-staged-file-metadata.js +16 -0
- package/node_modules/@openclaw/fs-safe/dist/native-staged-file.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/native-staged-file.js +15 -5
- package/node_modules/@openclaw/fs-safe/dist/native-stat-identity.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/native-stat-identity.js +7 -0
- package/node_modules/@openclaw/fs-safe/dist/native-status.d.ts +17 -0
- package/node_modules/@openclaw/fs-safe/dist/native-status.js +30 -0
- package/node_modules/@openclaw/fs-safe/dist/native.d.ts +31 -4
- package/node_modules/@openclaw/fs-safe/dist/native.js +107 -9
- package/node_modules/@openclaw/fs-safe/dist/opened-realpath.js +9 -1
- package/node_modules/@openclaw/fs-safe/dist/overwrite-file-handle.js +4 -1
- package/node_modules/@openclaw/fs-safe/dist/owner-dacl-batch.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/owner-dacl.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/permission-exec.js +9 -1
- package/node_modules/@openclaw/fs-safe/dist/permissions-public.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/permissions-public.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/permissions-windows.js +83 -47
- package/node_modules/@openclaw/fs-safe/dist/pinned-open.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/pinned-open.js +8 -3
- package/node_modules/@openclaw/fs-safe/dist/pinned-write-input.js +13 -0
- package/node_modules/@openclaw/fs-safe/dist/pinned-write-staged.js +10 -8
- package/node_modules/@openclaw/fs-safe/dist/pinned-write-types.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/pinned-write.js +7 -5
- package/node_modules/@openclaw/fs-safe/dist/pipe.d.ts +9 -0
- package/node_modules/@openclaw/fs-safe/dist/pipe.js +26 -0
- package/node_modules/@openclaw/fs-safe/dist/private-directory.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/private-producer-handoff.js +2 -5
- package/node_modules/@openclaw/fs-safe/dist/private-temp-workspace.d.ts +3 -2
- package/node_modules/@openclaw/fs-safe/dist/private-temp-workspace.js +38 -10
- package/node_modules/@openclaw/fs-safe/dist/publish-copy-stage.js +92 -10
- package/node_modules/@openclaw/fs-safe/dist/publish-file-failure.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/publish-file-failure.js +3 -0
- package/node_modules/@openclaw/fs-safe/dist/publish-file.d.ts +5 -3
- package/node_modules/@openclaw/fs-safe/dist/publish-file.js +26 -20
- package/node_modules/@openclaw/fs-safe/dist/read-opened-file.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/read-opened-file.js +3 -4
- package/node_modules/@openclaw/fs-safe/dist/realpath.js +32 -0
- package/node_modules/@openclaw/fs-safe/dist/regular-file.d.ts +4 -0
- package/node_modules/@openclaw/fs-safe/dist/regular-file.js +11 -15
- package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.js +3 -2
- package/node_modules/@openclaw/fs-safe/dist/root-copy.d.ts +18 -0
- package/node_modules/@openclaw/fs-safe/dist/root-copy.js +128 -0
- package/node_modules/@openclaw/fs-safe/dist/root-create-native.d.ts +8 -13
- package/node_modules/@openclaw/fs-safe/dist/root-create-native.js +252 -27
- package/node_modules/@openclaw/fs-safe/dist/root-directory-creation.js +5 -1
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list-types.d.ts +11 -8
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list.js +35 -13
- package/node_modules/@openclaw/fs-safe/dist/root-file-open-batch-sync.d.ts +8 -0
- package/node_modules/@openclaw/fs-safe/dist/root-file-open-batch-sync.js +108 -0
- package/node_modules/@openclaw/fs-safe/dist/root-file.d.ts +7 -0
- package/node_modules/@openclaw/fs-safe/dist/root-file.js +15 -0
- package/node_modules/@openclaw/fs-safe/dist/root-impl.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/root-impl.js +154 -175
- package/node_modules/@openclaw/fs-safe/dist/root-mkdir-native.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/root-mkdir-native.js +239 -0
- package/node_modules/@openclaw/fs-safe/dist/root-move-noreplace.js +37 -15
- package/node_modules/@openclaw/fs-safe/dist/root-native-creation-path.d.ts +32 -0
- package/node_modules/@openclaw/fs-safe/dist/root-native-creation-path.js +56 -0
- package/node_modules/@openclaw/fs-safe/dist/root-options.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/root-public-types.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/root-remove-native.js +95 -16
- package/node_modules/@openclaw/fs-safe/dist/root-remove.js +6 -4
- package/node_modules/@openclaw/fs-safe/dist/root-walk.js +23 -19
- package/node_modules/@openclaw/fs-safe/dist/root-write-admission.js +8 -6
- package/node_modules/@openclaw/fs-safe/dist/root-write-publication.js +5 -1
- package/node_modules/@openclaw/fs-safe/dist/secure-file-windows.js +3 -1
- package/node_modules/@openclaw/fs-safe/dist/secure-file.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/secure-file.js +10 -4
- package/node_modules/@openclaw/fs-safe/dist/sibling-staged-file.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-reclaim.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-target.js +8 -1
- package/node_modules/@openclaw/fs-safe/dist/staged-directory.d.ts +13 -0
- package/node_modules/@openclaw/fs-safe/dist/staged-directory.js +29 -0
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.js +5 -3
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-descriptor.d.ts +8 -0
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-descriptor.js +13 -2
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-owner.js +71 -3
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-ownership.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-ownership.js +22 -0
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-types.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/test-hooks.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/test-hooks.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/trash.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/types.d.ts +4 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-native.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/windows-appcontainer.d.ts +5 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-appcontainer.js +39 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-owner.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-owner.js +25 -36
- package/node_modules/@openclaw/fs-safe/dist/windows-security-command.js +24 -5
- package/node_modules/@openclaw/fs-safe/dist/windows-security-facts.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/windows-security-facts.js +4 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-security-helper.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-security-helper.exe +0 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-security-helper.js +7 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-test-hooks.d.ts +16 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-test-hooks.js +51 -0
- package/node_modules/@openclaw/fs-safe/dist/write-file-handle.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/write-file-handle.js +12 -10
- package/node_modules/@openclaw/fs-safe/docs/advanced.md +2 -1
- package/node_modules/@openclaw/fs-safe/docs/archive.md +16 -0
- package/node_modules/@openclaw/fs-safe/docs/config.md +71 -1
- package/node_modules/@openclaw/fs-safe/docs/contributing.md +45 -5
- package/node_modules/@openclaw/fs-safe/docs/copy.md +45 -5
- package/node_modules/@openclaw/fs-safe/docs/durability.md +34 -7
- package/node_modules/@openclaw/fs-safe/docs/errors.md +8 -0
- package/node_modules/@openclaw/fs-safe/docs/guest.md +2 -0
- package/node_modules/@openclaw/fs-safe/docs/install.md +47 -27
- package/node_modules/@openclaw/fs-safe/docs/migrating-to-0.5.md +6 -6
- package/node_modules/@openclaw/fs-safe/docs/migrating-to-0.6.md +1 -1
- package/node_modules/@openclaw/fs-safe/docs/native-helper.md +79 -6
- package/node_modules/@openclaw/fs-safe/docs/native.md +279 -8
- package/node_modules/@openclaw/fs-safe/docs/permissions.md +64 -15
- package/node_modules/@openclaw/fs-safe/docs/pipe.md +81 -0
- package/node_modules/@openclaw/fs-safe/docs/platform-capabilities.md +63 -0
- package/node_modules/@openclaw/fs-safe/docs/public-api.md +10 -0
- package/node_modules/@openclaw/fs-safe/docs/queue-link-free-design.md +237 -0
- package/node_modules/@openclaw/fs-safe/docs/quickstart.md +23 -3
- package/node_modules/@openclaw/fs-safe/docs/reading.md +56 -2
- package/node_modules/@openclaw/fs-safe/docs/regular-file.md +2 -0
- package/node_modules/@openclaw/fs-safe/docs/secret-file.md +5 -5
- package/node_modules/@openclaw/fs-safe/docs/secure-file.md +1 -1
- package/node_modules/@openclaw/fs-safe/docs/security-model.md +35 -0
- package/node_modules/@openclaw/fs-safe/docs/sidecar-lock.md +31 -13
- package/node_modules/@openclaw/fs-safe/docs/staged-file.md +18 -0
- package/node_modules/@openclaw/fs-safe/docs/store.md +15 -0
- package/node_modules/@openclaw/fs-safe/docs/temp.md +39 -0
- package/node_modules/@openclaw/fs-safe/docs/testing.md +13 -0
- package/node_modules/@openclaw/fs-safe/docs/types.md +51 -81
- package/node_modules/@openclaw/fs-safe/docs/walk.md +4 -1
- package/node_modules/@openclaw/fs-safe/docs/watch.md +3 -2
- package/node_modules/@openclaw/fs-safe/docs/writing.md +121 -14
- package/node_modules/@openclaw/fs-safe/package.json +21 -12
- 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-freebsd-arm64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-freebsd-arm64/package.json +29 -0
- package/node_modules/@openclaw/fs-safe-freebsd-x64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-freebsd-x64/package.json +29 -0
- 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-arm64-msvc/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-win32-arm64-msvc/package.json +29 -0
- 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/node_modules/typebox/build/value/clean/from_object.mjs +1 -1
- package/node_modules/typebox/package.json +1 -1
- package/openclaw.plugin.json +3 -0
- package/package.json +7 -6
- package/dist/.setup/runtime-setter-api-DtxDAM-x.mjs +0 -3
- package/dist/.setup/secret-contract-DSBRvhdZ.mjs +0 -95
- package/dist/.setup/secret-contract-api-DzEJ-X7n.mjs +0 -3
- package/dist/.setup/setup-plugin-api-BDAYk1a5.mjs +0 -3
- package/dist/.setup/thread-bindings-CT4P-OSZ.mjs +0 -365
- package/node_modules/@openclaw/fs-safe/dist/windows-security-bridge.cs +0 -336
- package/node_modules/@openclaw/fs-safe/dist/windows-security-bridge.ps1 +0 -90
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.mjs";
|
|
2
|
-
import { a as resolveMatrixThreadRouting, i as
|
|
2
|
+
import { a as resolveMatrixThreadRouting, i as resolveMatrixInboundRouteAsync } from "./channel-Dw4_imdd.mjs";
|
|
3
3
|
import { c as extractMatrixReactionAnnotation } from "./send-currentness-C2rMVVIQ.mjs";
|
|
4
4
|
import { p as resolveMatrixThreadRootId } from "./direct-management-B3wYhx_M.mjs";
|
|
5
|
-
import { i as resolveMatrixApprovalReactionTargetWithPersistence, o as unregisterMatrixApprovalReactionTargetsForApproval } from "./approval-reactions-
|
|
5
|
+
import { i as resolveMatrixApprovalReactionTargetWithPersistence, o as unregisterMatrixApprovalReactionTargetsForApproval } from "./approval-reactions-D2pEUrFS.mjs";
|
|
6
6
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
7
7
|
import { isApprovalNotFoundError } from "openclaw/plugin-sdk/error-runtime";
|
|
8
8
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
9
9
|
import { getSessionBindingService } from "openclaw/plugin-sdk/session-binding-runtime";
|
|
10
10
|
//#region extensions/matrix/src/matrix/monitor/reaction-events.ts
|
|
11
|
-
const loadApprovalReactionAuth = createLazyRuntimeModule(() => import("./channel-
|
|
11
|
+
const loadApprovalReactionAuth = createLazyRuntimeModule(() => import("./channel-Dw4_imdd.mjs").then((n) => n.s));
|
|
12
12
|
const loadExecApprovalResolver = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/approval-gateway-runtime"));
|
|
13
|
-
const loadMatrixSend = createLazyRuntimeModule(() => import("./send-
|
|
13
|
+
const loadMatrixSend = createLazyRuntimeModule(() => import("./send-BprM-Wmx.mjs").then((n) => n.s));
|
|
14
14
|
function buildMatrixApprovalTerminalText(result) {
|
|
15
15
|
const approval = result.approval;
|
|
16
16
|
const terminalLabel = approval.status === "allowed" ? approval.decision === "allow-always" ? "Allowed always" : "Allowed once" : approval.status === "denied" ? "Denied" : approval.status === "expired" ? "Expired" : "Cancelled";
|
|
@@ -142,7 +142,7 @@ async function handleInboundMatrixReaction(params) {
|
|
|
142
142
|
messageId: reaction.eventId,
|
|
143
143
|
threadRootId
|
|
144
144
|
});
|
|
145
|
-
const { route, runtimeBindingId } =
|
|
145
|
+
const { route, runtimeBindingId } = await resolveMatrixInboundRouteAsync({
|
|
146
146
|
cfg: params.cfg,
|
|
147
147
|
accountId: params.accountId,
|
|
148
148
|
roomId: params.roomId,
|
|
@@ -152,7 +152,7 @@ async function handleInboundMatrixReaction(params) {
|
|
|
152
152
|
threadId: thread.threadId,
|
|
153
153
|
resolveAgentRoute: params.core.channel.routing.resolveAgentRoute
|
|
154
154
|
});
|
|
155
|
-
if (runtimeBindingId) getSessionBindingService().
|
|
155
|
+
if (runtimeBindingId) await getSessionBindingService().touchAsync(runtimeBindingId, params.event.origin_server_ts, {
|
|
156
156
|
channel: "matrix",
|
|
157
157
|
accountId: params.accountId
|
|
158
158
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as __exportAll } from "./doctor-contract-CsTNmbMa.mjs";
|
|
2
2
|
import { i as normalizeMatrixMessagingTarget, n as isMatrixQualifiedUserId } from "./target-ids-HhcaKX1n.mjs";
|
|
3
|
-
import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-
|
|
3
|
+
import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-BpSz-FQB.mjs";
|
|
4
4
|
import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
//#region extensions/matrix/src/resolve-targets.ts
|
|
6
6
|
var resolve_targets_exports = /* @__PURE__ */ __exportAll({ resolveMatrixTargets: () => resolveMatrixTargets });
|
|
@@ -11,19 +11,20 @@ function chunkMatrixStateJson(value, maxBytes, maxChunks, limitMessage) {
|
|
|
11
11
|
if (chunks.length >= maxChunks) throw new Error(limitMessage);
|
|
12
12
|
chunks.push(chunk);
|
|
13
13
|
};
|
|
14
|
-
let
|
|
14
|
+
let chunkStart = 0;
|
|
15
15
|
let currentBytes = 0;
|
|
16
|
-
for (
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
for (let index = 0; index < value.length;) {
|
|
17
|
+
const codePoint = value.codePointAt(index);
|
|
18
|
+
const charBytes = codePoint <= 127 ? 1 : codePoint <= 2047 ? 2 : codePoint <= 65535 ? 3 : 4;
|
|
19
|
+
if (index > chunkStart && currentBytes + charBytes > maxBytes) {
|
|
20
|
+
pushChunk(value.slice(chunkStart, index));
|
|
21
|
+
chunkStart = index;
|
|
21
22
|
currentBytes = 0;
|
|
22
23
|
}
|
|
23
|
-
current += char;
|
|
24
24
|
currentBytes += charBytes;
|
|
25
|
+
index += codePoint > 65535 ? 2 : 1;
|
|
25
26
|
}
|
|
26
|
-
if (
|
|
27
|
+
if (chunkStart < value.length) pushChunk(value.slice(chunkStart));
|
|
27
28
|
return chunks;
|
|
28
29
|
}
|
|
29
30
|
async function readMatrixStateChunks(store, keys, kind) {
|
|
@@ -61,8 +62,7 @@ function resolveMatrixSqliteStateEnv(options) {
|
|
|
61
62
|
OPENCLAW_STATE_DIR: stateDir
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
|
-
async function updateMatrixKeyedState(store, key, update,
|
|
65
|
-
if (!store.observe || !store.compareAndApply) return await legacyUpdate();
|
|
65
|
+
async function updateMatrixKeyedState(store, key, update, onUndefined = "keep") {
|
|
66
66
|
let observation = await store.observe(key);
|
|
67
67
|
for (;;) {
|
|
68
68
|
const value = update(observation.value);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { w as setBoundedMap } from "./send-
|
|
2
|
-
import {
|
|
3
|
-
import { r as withResolvedRoomAction } from "./client-
|
|
1
|
+
import { w as setBoundedMap } from "./send-BprM-Wmx.mjs";
|
|
2
|
+
import { s as EventType } from "./messages-_XHVg3do.mjs";
|
|
3
|
+
import { r as withResolvedRoomAction } from "./client-BKiiI29H.mjs";
|
|
4
4
|
import { n as isMatrixNotFoundError } from "./errors-Bw4EHwKX.mjs";
|
|
5
5
|
import { filterStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
//#region extensions/matrix/src/matrix/actions/room.ts
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { i as __exportAll } from "./doctor-contract-CsTNmbMa.mjs";
|
|
2
2
|
import { t as getMatrixRuntime } from "./runtime-1kn1P6io.mjs";
|
|
3
|
-
import { r as assertMatrixSupportedStateFile } from "./retired-state-
|
|
4
|
-
import {
|
|
3
|
+
import { r as assertMatrixSupportedStateFile } from "./retired-state-DOCruzWd.mjs";
|
|
4
|
+
import { a as readMatrixRecoveryKeyStateForPathAsync, l as writeMatrixRecoveryKeyStateForPathAsync } from "./crypto-state-store-D4wrCvFs.mjs";
|
|
5
5
|
import { n as withMatrixSendCurrentness, r as withoutMatrixSendCurrentness, t as captureMatrixSendCurrentness } from "./send-currentness-C2rMVVIQ.mjs";
|
|
6
6
|
import { i as parseMxc, r as matrixEventToRaw } from "./event-helpers-CxNgMQqH.mjs";
|
|
7
|
+
import { i as createMatrixStartupAbortError, o as throwIfMatrixStartupAborted, r as awaitMatrixStartupWithAbort } from "./client-C4Gibhzl.mjs";
|
|
7
8
|
import { n as isMatrixNotFoundError, t as formatMatrixErrorReason } from "./errors-Bw4EHwKX.mjs";
|
|
8
|
-
import { i as createMatrixStartupAbortError, o as throwIfMatrixStartupAborted, r as awaitMatrixStartupWithAbort } from "./client-vPPbaxNp.mjs";
|
|
9
9
|
import { n as createMatrixGuardedFetch, t as MatrixAuthedHttpClient } from "./http-client-ByR4STVQ.mjs";
|
|
10
10
|
import { n as resolveMatrixRoomKeyBackupReadinessError } from "./backup-health-Dm_YMVFT.mjs";
|
|
11
11
|
import { r as noop, t as LogService } from "./logger-CXQnpXCt.mjs";
|
|
12
12
|
import { t as createMatrixJsSdkClientLogger } from "./logging-BKV8TYQq.mjs";
|
|
13
|
+
import { t as acquireMatrixCryptoStoreOwnership } from "./crypto-store-ownership-Z_Y5WRKr.mjs";
|
|
13
14
|
import { a as isMatrixAccessTokenInvalidatedError, c as resolveMatrixLocalTimeoutMs, f as isMatrixReadySyncState, i as createMatrixExplicitBootstrapOptions, l as unresolvedMatrixDeviceVerificationStatus, n as MATRIX_INITIAL_CRYPTO_BOOTSTRAP_OPTIONS, o as resolveMatrixDiagnostic, p as isMatrixTerminalSyncState, r as MATRIX_STATUS_DIAGNOSTIC_TIMEOUT_MS, s as resolveMatrixDiagnosticResult, t as MATRIX_AUTOMATIC_REPAIR_BOOTSTRAP_OPTIONS, u as unresolvedMatrixRoomKeyBackupStatus } from "./client-support-D-xHScuo.mjs";
|
|
15
|
+
import { t as MATRIX_IDB_PERSIST_INTERVAL_MS } from "./idb-persistence-lock-Bh3ZLIsE.mjs";
|
|
14
16
|
import { createRequire } from "node:module";
|
|
15
17
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
16
18
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -19,10 +21,10 @@ import { createHash } from "node:crypto";
|
|
|
19
21
|
import path from "node:path";
|
|
20
22
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
21
23
|
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
22
|
-
import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
|
|
23
24
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
25
|
+
import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
|
|
24
26
|
import { captureChannelReadAuthority, withEffectAuthority } from "openclaw/plugin-sdk/fetch-runtime";
|
|
25
|
-
import { ClientEvent, EventType, Filter, MatrixError,
|
|
27
|
+
import { ClientEvent, EventType, Filter, MatrixError, MsgType, Preset, createClient } from "matrix-js-sdk/lib/matrix.js";
|
|
26
28
|
import { EventEmitter } from "node:events";
|
|
27
29
|
import { RoomEvent } from "matrix-js-sdk/lib/models/room.js";
|
|
28
30
|
import { VerificationMethod } from "matrix-js-sdk/lib/types.js";
|
|
@@ -132,6 +134,25 @@ function refreshMatrixDmRoomIds(direct, dmRoomIds) {
|
|
|
132
134
|
return true;
|
|
133
135
|
}
|
|
134
136
|
//#endregion
|
|
137
|
+
//#region extensions/matrix/src/matrix/sdk/client-crypto-bootstrap.ts
|
|
138
|
+
async function bootstrapMatrixClientCrypto(params) {
|
|
139
|
+
const { crypto, bootstrapper, abortSignal } = params;
|
|
140
|
+
if (!crypto || !bootstrapper) return false;
|
|
141
|
+
const initial = await bootstrapper.bootstrap(crypto, MATRIX_INITIAL_CRYPTO_BOOTSTRAP_OPTIONS);
|
|
142
|
+
throwIfMatrixStartupAborted(abortSignal);
|
|
143
|
+
if (!initial.crossSigningPublished || initial.ownDeviceVerified === false) {
|
|
144
|
+
if ((await params.getOwnDeviceVerificationStatus()).signedByOwner) LogService.warn("MatrixClientLite", "Cross-signing/bootstrap is incomplete for an already owner-signed device; skipping automatic reset and preserving the current identity. Restore the recovery key or run an explicit verification bootstrap if repair is needed.");
|
|
145
|
+
else try {
|
|
146
|
+
const repaired = await bootstrapper.bootstrap(crypto, MATRIX_AUTOMATIC_REPAIR_BOOTSTRAP_OPTIONS);
|
|
147
|
+
throwIfMatrixStartupAborted(abortSignal);
|
|
148
|
+
if (repaired.crossSigningPublished && repaired.ownDeviceVerified !== false) LogService.info("MatrixClientLite", "Cross-signing/bootstrap recovered after forced reset");
|
|
149
|
+
} catch (err) {
|
|
150
|
+
LogService.warn("MatrixClientLite", "Failed to recover cross-signing/bootstrap with forced reset:", err);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
135
156
|
//#region extensions/matrix/src/matrix/sdk/client-sync-quiesce.ts
|
|
136
157
|
const MATRIX_SYNC_QUIESCE_TIMEOUT_MS = 5e3;
|
|
137
158
|
const MATRIX_JS_SDK_SYNC_VERSION = "42.4.0";
|
|
@@ -242,18 +263,102 @@ async function waitForMatrixInitialSyncReady(params) {
|
|
|
242
263
|
}
|
|
243
264
|
}
|
|
244
265
|
//#endregion
|
|
245
|
-
//#region extensions/matrix/src/matrix/sdk/
|
|
246
|
-
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
266
|
+
//#region extensions/matrix/src/matrix/sdk/crypto-store-lifecycle.ts
|
|
267
|
+
async function closeMatrixCryptoStores(closeRecoveryKeys, releaseOwnership, teardownComplete) {
|
|
268
|
+
const recovery = await Promise.allSettled([closeRecoveryKeys()]);
|
|
269
|
+
const release = teardownComplete ? await Promise.allSettled([releaseOwnership()]) : [];
|
|
270
|
+
const failures = [...recovery, ...release].filter((result) => result.status === "rejected").map((result) => result.reason);
|
|
271
|
+
if (failures.length > 1) throw new AggregateError(failures, "Failed to close Matrix crypto stores");
|
|
272
|
+
if (failures.length === 1) throw failures[0];
|
|
273
|
+
}
|
|
274
|
+
/** Final publication is allowed only for a generation that initialized under custody. */
|
|
275
|
+
async function persistMatrixFinalState(params) {
|
|
276
|
+
if (params.cryptoInitialized) {
|
|
277
|
+
if (params.snapshotPath && !params.ownership) throw new Error("Refusing Matrix crypto snapshot publication without ownership");
|
|
278
|
+
await params.persistSnapshot();
|
|
279
|
+
}
|
|
280
|
+
if (!params.encryptionEnabled || params.cryptoInitialized) params.syncStore?.markCleanShutdown();
|
|
281
|
+
await params.syncStore?.flush();
|
|
282
|
+
if (params.cryptoInitialized) await params.ownership?.sealSafeState();
|
|
283
|
+
}
|
|
284
|
+
/** Join an in-flight crypto initialization before a generation can be retired. */
|
|
285
|
+
function createMatrixCryptoInitializationGate() {
|
|
286
|
+
let pending = null;
|
|
287
|
+
let failure = null;
|
|
288
|
+
return {
|
|
289
|
+
get pending() {
|
|
290
|
+
return pending;
|
|
291
|
+
},
|
|
292
|
+
get failure() {
|
|
293
|
+
return failure;
|
|
294
|
+
},
|
|
295
|
+
recordFailure(error) {
|
|
296
|
+
failure = { error };
|
|
297
|
+
},
|
|
298
|
+
async run(initialize, abortSignal) {
|
|
299
|
+
if (failure) throw new Error("Matrix crypto initialization failed; restart this process before retrying", { cause: failure.error });
|
|
300
|
+
if (pending) {
|
|
301
|
+
await pending;
|
|
302
|
+
abortSignal?.throwIfAborted();
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
const task = initialize();
|
|
306
|
+
pending = task;
|
|
307
|
+
try {
|
|
308
|
+
await task;
|
|
309
|
+
} finally {
|
|
310
|
+
if (pending === task) pending = null;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
/** Quiescence failure forbids publication but still requires teardown under custody. */
|
|
316
|
+
async function runMatrixClientShutdown(params) {
|
|
317
|
+
const failures = [];
|
|
318
|
+
let persist = params.persist;
|
|
319
|
+
try {
|
|
320
|
+
try {
|
|
321
|
+
await params.quiesceSync();
|
|
322
|
+
} catch (error) {
|
|
323
|
+
if (persist) failures.push(error);
|
|
324
|
+
persist = false;
|
|
325
|
+
}
|
|
326
|
+
if (!persist) params.discardSync();
|
|
327
|
+
await params.stop(persist);
|
|
328
|
+
} catch (error) {
|
|
329
|
+
failures.push(error);
|
|
330
|
+
params.discardSync();
|
|
331
|
+
} finally {
|
|
332
|
+
try {
|
|
333
|
+
await params.closeStores();
|
|
334
|
+
} catch (error) {
|
|
335
|
+
failures.push(error);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
if (failures.length === 1) throw failures[0];
|
|
339
|
+
if (failures.length > 1) throw new AggregateError(failures, "Failed to shut down Matrix client generation");
|
|
340
|
+
}
|
|
341
|
+
/** SDK crypto stop is not retryable after throwing: it marks itself stopped before store closure. */
|
|
342
|
+
function createMatrixSdkStopGate() {
|
|
343
|
+
let stopped = false;
|
|
344
|
+
let failure = null;
|
|
345
|
+
return {
|
|
346
|
+
get stopped() {
|
|
347
|
+
return stopped || failure !== null;
|
|
348
|
+
},
|
|
349
|
+
stop(stopSdk) {
|
|
350
|
+
if (stopped) return;
|
|
351
|
+
if (failure) throw failure.error;
|
|
352
|
+
try {
|
|
353
|
+
stopSdk();
|
|
354
|
+
stopped = true;
|
|
355
|
+
} catch (error) {
|
|
356
|
+
failure = { error };
|
|
357
|
+
throw error;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
}
|
|
257
362
|
//#endregion
|
|
258
363
|
//#region extensions/matrix/src/matrix/sdk/live-room-readiness.ts
|
|
259
364
|
async function withMatrixLiveEncryptedRoom(owner, run, params) {
|
|
@@ -309,7 +414,6 @@ async function probeMatrixLiveEncryptedRoom(params) {
|
|
|
309
414
|
for (;;) {
|
|
310
415
|
changed = false;
|
|
311
416
|
assertActive();
|
|
312
|
-
const sync = params.getSync();
|
|
313
417
|
const room = params.client.getRoom(params.roomId);
|
|
314
418
|
const crypto = params.client.getCrypto();
|
|
315
419
|
const isCurrent = () => {
|
|
@@ -319,7 +423,7 @@ async function probeMatrixLiveEncryptedRoom(params) {
|
|
|
319
423
|
if (isCurrent() && crypto) {
|
|
320
424
|
const encrypted = await crypto.isEncryptionEnabledInRoom(params.roomId);
|
|
321
425
|
assertActive();
|
|
322
|
-
if (
|
|
426
|
+
if (!isCurrent()) continue;
|
|
323
427
|
if (encrypted) return () => {
|
|
324
428
|
assertActive();
|
|
325
429
|
if (!isCurrent()) throw new Error("Matrix live encrypted room changed before dispatch; retry the send");
|
|
@@ -714,7 +818,7 @@ var MatrixSendScheduler = class extends MatrixScheduler {
|
|
|
714
818
|
//#region extensions/matrix/src/matrix/sdk/client-base.ts
|
|
715
819
|
const MATRIX_ENCRYPTED_STARTUP_TIMEOUT_MS = 6e4;
|
|
716
820
|
let loadedMatrixCryptoRuntime = null;
|
|
717
|
-
const loadMatrixCryptoRuntime = createLazyRuntimeModule(() => import("./crypto-runtime-
|
|
821
|
+
const loadMatrixCryptoRuntime = createLazyRuntimeModule(() => import("./crypto-runtime-D8yY7kjD.mjs").then((runtime) => {
|
|
718
822
|
loadedMatrixCryptoRuntime = runtime;
|
|
719
823
|
return runtime;
|
|
720
824
|
}));
|
|
@@ -739,19 +843,21 @@ var MatrixClientBase = class {
|
|
|
739
843
|
this.currentSyncState = null;
|
|
740
844
|
this.currentSyncError = void 0;
|
|
741
845
|
this.currentSyncFromCache = false;
|
|
742
|
-
this.currentSyncRevision = 0;
|
|
743
846
|
this.transactionScopeId = null;
|
|
744
847
|
this.transactionScopePromise = null;
|
|
745
848
|
this.messageWireDispatchGuards = new MatrixMessageWireDispatchGuards();
|
|
746
849
|
this.requestAbortController = new AbortController();
|
|
747
850
|
this.cryptoRequestOwner = new AsyncLocalStorage();
|
|
748
851
|
this.startupPromise = null;
|
|
749
|
-
this.
|
|
852
|
+
this.cryptoInitializationGate = createMatrixCryptoInitializationGate();
|
|
750
853
|
this.liveRoomReadinessOperations = /* @__PURE__ */ new Set();
|
|
751
|
-
this.
|
|
854
|
+
this.sdkStopGate = createMatrixSdkStopGate();
|
|
855
|
+
this.generationTeardownComplete = false;
|
|
752
856
|
this.stopDiscardPromise = null;
|
|
753
857
|
this.idbPersistPromise = null;
|
|
754
858
|
this.idbPersistAbortController = null;
|
|
859
|
+
this.cryptoStoreOwnership = null;
|
|
860
|
+
this.sdkIndexedDbSession = null;
|
|
755
861
|
this.assertClientActive = () => {
|
|
756
862
|
this.requestAbortController.signal.throwIfAborted();
|
|
757
863
|
};
|
|
@@ -898,7 +1004,7 @@ var MatrixClientBase = class {
|
|
|
898
1004
|
}
|
|
899
1005
|
async startSyncSession(opts) {
|
|
900
1006
|
if (this.started) return;
|
|
901
|
-
if (this.
|
|
1007
|
+
if (this.sdkStopGate.stopped) throw new Error("Matrix client has been fully stopped and cannot be restarted; acquire a new shared client generation");
|
|
902
1008
|
const assertCurrent = this.captureRequestAuthority();
|
|
903
1009
|
assertCurrent?.();
|
|
904
1010
|
this.assertClientActive();
|
|
@@ -986,12 +1092,11 @@ var MatrixClientBase = class {
|
|
|
986
1092
|
assertActive: () => {
|
|
987
1093
|
this.assertClientActive();
|
|
988
1094
|
opts.assertCurrent?.();
|
|
989
|
-
if (this.
|
|
1095
|
+
if (this.sdkStopGate.stopped || this.syncQuiescePromise) throw new Error("Matrix client is stopping; acquire a new client before sending");
|
|
990
1096
|
},
|
|
991
1097
|
getSync: () => ({
|
|
992
1098
|
state: this.currentSyncState,
|
|
993
|
-
fromCache: this.currentSyncFromCache
|
|
994
|
-
revision: this.currentSyncRevision
|
|
1099
|
+
fromCache: this.currentSyncFromCache
|
|
995
1100
|
})
|
|
996
1101
|
});
|
|
997
1102
|
}
|
|
@@ -1002,14 +1107,6 @@ var MatrixClientBase = class {
|
|
|
1002
1107
|
if (this.started) return;
|
|
1003
1108
|
await this.startSyncSession({ bootstrapCrypto: false });
|
|
1004
1109
|
}
|
|
1005
|
-
stopSdkClient() {
|
|
1006
|
-
if (this.sdkStopped) return;
|
|
1007
|
-
this.currentSyncState = null;
|
|
1008
|
-
this.currentSyncError = void 0;
|
|
1009
|
-
this.sdkStopped = true;
|
|
1010
|
-
this.client.stopClient();
|
|
1011
|
-
this.started = false;
|
|
1012
|
-
}
|
|
1013
1110
|
async quiesceSync() {
|
|
1014
1111
|
this.syncQuiescePromise ??= quiesceMatrixClientSync({
|
|
1015
1112
|
client: this.client,
|
|
@@ -1028,122 +1125,138 @@ var MatrixClientBase = class {
|
|
|
1028
1125
|
stop() {
|
|
1029
1126
|
this.stopAndPersist().catch(() => this.stopWithoutPersist()).catch(noop);
|
|
1030
1127
|
}
|
|
1128
|
+
async releaseCryptoStoreOwnership() {
|
|
1129
|
+
const ownership = this.cryptoStoreOwnership;
|
|
1130
|
+
this.cryptoStoreOwnership = null;
|
|
1131
|
+
await ownership?.release();
|
|
1132
|
+
}
|
|
1031
1133
|
async stopClientGeneration(persist) {
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1134
|
+
await runMatrixClientShutdown({
|
|
1135
|
+
persist,
|
|
1136
|
+
quiesceSync: () => this.quiesceSync(),
|
|
1137
|
+
discardSync: () => this.syncStore?.discardPendingSyncCursorPersistence(),
|
|
1138
|
+
stop: async (publishFinalState) => {
|
|
1139
|
+
this.abortPendingRequests();
|
|
1140
|
+
await this.startupPromise?.catch(noop);
|
|
1141
|
+
await this.cryptoInitializationGate.pending?.catch(noop);
|
|
1142
|
+
await Promise.allSettled(this.liveRoomReadinessOperations);
|
|
1143
|
+
clearInterval(this.idbPersistTimer ?? void 0);
|
|
1144
|
+
this.idbPersistTimer = null;
|
|
1145
|
+
this.idbPersistAbortController?.abort();
|
|
1146
|
+
const activePeriodicPersist = this.idbPersistPromise;
|
|
1147
|
+
try {
|
|
1148
|
+
this.sdkStopGate.stop(() => {
|
|
1149
|
+
this.currentSyncState = null;
|
|
1150
|
+
this.currentSyncError = void 0;
|
|
1151
|
+
this.client.stopClient();
|
|
1152
|
+
this.started = false;
|
|
1153
|
+
});
|
|
1154
|
+
} finally {
|
|
1155
|
+
this.decryptBridge?.stop();
|
|
1156
|
+
this.cryptoRequestOwner.disable();
|
|
1157
|
+
}
|
|
1158
|
+
await this.sdkIndexedDbSession?.retire();
|
|
1159
|
+
await Promise.all([this.recoveryKeyStore.close(), activePeriodicPersist]);
|
|
1160
|
+
if (this.cryptoInitializationGate.failure) throw new Error("Matrix crypto initialization failed; restart this process before recovery", { cause: this.cryptoInitializationGate.failure.error });
|
|
1161
|
+
this.generationTeardownComplete = true;
|
|
1162
|
+
if (publishFinalState) await persistMatrixFinalState({
|
|
1163
|
+
encryptionEnabled: this.encryptionEnabled,
|
|
1164
|
+
cryptoInitialized: this.cryptoInitialized,
|
|
1165
|
+
ownership: this.cryptoStoreOwnership,
|
|
1055
1166
|
snapshotPath: this.idbSnapshotPath,
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1167
|
+
persistSnapshot: async () => {
|
|
1168
|
+
await (loadedMatrixCryptoRuntime ?? await loadMatrixCryptoRuntime()).persistIdbToDisk({
|
|
1169
|
+
snapshotPath: this.idbSnapshotPath,
|
|
1170
|
+
databasePrefix: this.cryptoDatabasePrefix,
|
|
1171
|
+
strict: true,
|
|
1172
|
+
stateRuntime: this.stateRuntime
|
|
1173
|
+
});
|
|
1174
|
+
},
|
|
1175
|
+
syncStore: this.syncStore
|
|
1059
1176
|
});
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
} finally {
|
|
1064
|
-
await this.recoveryKeyStore.close();
|
|
1065
|
-
}
|
|
1177
|
+
},
|
|
1178
|
+
closeStores: () => closeMatrixCryptoStores(() => this.recoveryKeyStore.close(), () => this.releaseCryptoStoreOwnership(), this.generationTeardownComplete)
|
|
1179
|
+
});
|
|
1066
1180
|
}
|
|
1067
1181
|
async stopAndPersist() {
|
|
1068
|
-
this.stopPersistPromise ??= this.stopClientGeneration(true);
|
|
1069
|
-
await this.stopPersistPromise;
|
|
1182
|
+
await (this.stopPersistPromise ??= this.stopClientGeneration(true));
|
|
1070
1183
|
}
|
|
1071
1184
|
stopWithoutPersist() {
|
|
1072
1185
|
if (!this.stopPersistPromise) this.stopPersistPromise = this.stopDiscardPromise = this.stopClientGeneration(false);
|
|
1073
|
-
return this.stopDiscardPromise ??= this.stopPersistPromise.catch(() => this.stopClientGeneration(false));
|
|
1186
|
+
return this.stopDiscardPromise ??= this.stopPersistPromise.catch(() => this.generationTeardownComplete ? void 0 : this.stopClientGeneration(false));
|
|
1074
1187
|
}
|
|
1075
1188
|
async bootstrapCryptoIfNeeded(abortSignal) {
|
|
1076
1189
|
if (!this.encryptionEnabled || !this.cryptoInitialized || this.cryptoBootstrapped) return;
|
|
1077
1190
|
throwIfMatrixStartupAborted(abortSignal);
|
|
1078
1191
|
await this.ensureCryptoSupportInitialized();
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
if (!initial.crossSigningPublished || initial.ownDeviceVerified === false) {
|
|
1086
|
-
if ((await this.getOwnDeviceVerificationStatus()).signedByOwner) LogService.warn("MatrixClientLite", "Cross-signing/bootstrap is incomplete for an already owner-signed device; skipping automatic reset and preserving the current identity. Restore the recovery key or run an explicit verification bootstrap if repair is needed.");
|
|
1087
|
-
else try {
|
|
1088
|
-
const repaired = await cryptoBootstrapper.bootstrap(crypto, MATRIX_AUTOMATIC_REPAIR_BOOTSTRAP_OPTIONS);
|
|
1089
|
-
throwIfMatrixStartupAborted(abortSignal);
|
|
1090
|
-
if (repaired.crossSigningPublished && repaired.ownDeviceVerified !== false) LogService.info("MatrixClientLite", "Cross-signing/bootstrap recovered after forced reset");
|
|
1091
|
-
} catch (err) {
|
|
1092
|
-
LogService.warn("MatrixClientLite", "Failed to recover cross-signing/bootstrap with forced reset:", err);
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
this.cryptoBootstrapped = true;
|
|
1192
|
+
this.cryptoBootstrapped = await bootstrapMatrixClientCrypto({
|
|
1193
|
+
crypto: this.client.getCrypto(),
|
|
1194
|
+
bootstrapper: this.cryptoBootstrapper,
|
|
1195
|
+
getOwnDeviceVerificationStatus: () => this.getOwnDeviceVerificationStatus(),
|
|
1196
|
+
abortSignal
|
|
1197
|
+
});
|
|
1096
1198
|
}
|
|
1097
1199
|
async initializeCryptoIfNeeded(abortSignal) {
|
|
1098
|
-
if (!this.encryptionEnabled) return;
|
|
1099
|
-
|
|
1100
|
-
await this.cryptoInitializationPromise;
|
|
1101
|
-
throwIfMatrixStartupAborted(abortSignal);
|
|
1102
|
-
return;
|
|
1103
|
-
}
|
|
1104
|
-
if (this.cryptoInitialized) return;
|
|
1105
|
-
const initialization = this.initializeCrypto(abortSignal ? AbortSignal.any([abortSignal, this.requestAbortController.signal]) : this.requestAbortController.signal);
|
|
1106
|
-
this.cryptoInitializationPromise = initialization;
|
|
1107
|
-
try {
|
|
1108
|
-
await initialization;
|
|
1109
|
-
} finally {
|
|
1110
|
-
if (this.cryptoInitializationPromise === initialization) this.cryptoInitializationPromise = null;
|
|
1111
|
-
}
|
|
1200
|
+
if (!this.encryptionEnabled || this.cryptoInitialized && !this.cryptoInitializationGate.pending) return;
|
|
1201
|
+
await this.cryptoInitializationGate.run(() => this.initializeCrypto(abortSignal ? AbortSignal.any([abortSignal, this.requestAbortController.signal]) : this.requestAbortController.signal), abortSignal);
|
|
1112
1202
|
}
|
|
1113
1203
|
async initializeCrypto(abortSignal) {
|
|
1114
1204
|
throwIfMatrixStartupAborted(abortSignal);
|
|
1115
|
-
const { persistIdbToDisk, restoreIdbFromDisk } = await loadMatrixCryptoRuntime();
|
|
1116
|
-
|
|
1117
|
-
|
|
1205
|
+
const { persistIdbToDisk, restoreIdbFromDisk, resolveDefaultIdbSnapshotPath, beginMatrixSdkIndexedDbSession } = await loadMatrixCryptoRuntime();
|
|
1206
|
+
this.idbSnapshotPath ??= resolveDefaultIdbSnapshotPath();
|
|
1207
|
+
if (!this.cryptoStoreOwnership) this.cryptoStoreOwnership = await acquireMatrixCryptoStoreOwnership(this.idbSnapshotPath, {
|
|
1208
|
+
signal: abortSignal,
|
|
1209
|
+
stateRuntime: this.stateRuntime
|
|
1210
|
+
});
|
|
1211
|
+
let rustCryptoInitializationStarted = false;
|
|
1118
1212
|
try {
|
|
1119
|
-
await this.
|
|
1120
|
-
this.cryptoInitialized = true;
|
|
1213
|
+
await restoreIdbFromDisk(this.idbSnapshotPath, this.stateRuntime, this.cryptoDatabasePrefix);
|
|
1121
1214
|
throwIfMatrixStartupAborted(abortSignal);
|
|
1122
|
-
await
|
|
1123
|
-
snapshotPath: this.idbSnapshotPath,
|
|
1124
|
-
databasePrefix: this.cryptoDatabasePrefix,
|
|
1125
|
-
abortSignal,
|
|
1126
|
-
stateRuntime: this.stateRuntime
|
|
1127
|
-
});
|
|
1215
|
+
await this.cryptoStoreOwnership?.armUnsafeState();
|
|
1128
1216
|
throwIfMatrixStartupAborted(abortSignal);
|
|
1129
|
-
this.
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
this.
|
|
1133
|
-
this.
|
|
1217
|
+
this.sdkIndexedDbSession = beginMatrixSdkIndexedDbSession(this.cryptoDatabasePrefix);
|
|
1218
|
+
try {
|
|
1219
|
+
rustCryptoInitializationStarted = true;
|
|
1220
|
+
await this.client.initRustCrypto({ cryptoDatabasePrefix: this.cryptoDatabasePrefix });
|
|
1221
|
+
this.cryptoInitialized = true;
|
|
1222
|
+
throwIfMatrixStartupAborted(abortSignal);
|
|
1223
|
+
await persistIdbToDisk({
|
|
1134
1224
|
snapshotPath: this.idbSnapshotPath,
|
|
1135
1225
|
databasePrefix: this.cryptoDatabasePrefix,
|
|
1136
|
-
abortSignal
|
|
1226
|
+
abortSignal,
|
|
1137
1227
|
stateRuntime: this.stateRuntime
|
|
1138
|
-
}).catch(noop).finally(() => {
|
|
1139
|
-
this.idbPersistPromise = null;
|
|
1140
|
-
this.idbPersistAbortController = null;
|
|
1141
1228
|
});
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1229
|
+
throwIfMatrixStartupAborted(abortSignal);
|
|
1230
|
+
this.idbPersistTimer = setInterval(() => {
|
|
1231
|
+
if (this.idbPersistPromise) return;
|
|
1232
|
+
const abortController = new AbortController();
|
|
1233
|
+
this.idbPersistAbortController = abortController;
|
|
1234
|
+
this.idbPersistPromise = persistIdbToDisk({
|
|
1235
|
+
snapshotPath: this.idbSnapshotPath,
|
|
1236
|
+
databasePrefix: this.cryptoDatabasePrefix,
|
|
1237
|
+
abortSignal: abortController.signal,
|
|
1238
|
+
stateRuntime: this.stateRuntime
|
|
1239
|
+
}).catch(noop).finally(() => {
|
|
1240
|
+
this.idbPersistPromise = null;
|
|
1241
|
+
this.idbPersistAbortController = null;
|
|
1242
|
+
});
|
|
1243
|
+
}, MATRIX_IDB_PERSIST_INTERVAL_MS);
|
|
1244
|
+
this.idbPersistTimer.unref?.();
|
|
1245
|
+
} catch (err) {
|
|
1246
|
+
if (!this.cryptoInitialized) {
|
|
1247
|
+
this.cryptoInitializationGate.recordFailure(err);
|
|
1248
|
+
throw err;
|
|
1249
|
+
}
|
|
1250
|
+
throwIfMatrixStartupAborted(abortSignal);
|
|
1251
|
+
LogService.warn("MatrixClientLite", "Failed to initialize rust crypto:", err);
|
|
1252
|
+
}
|
|
1253
|
+
} catch (error) {
|
|
1254
|
+
if (!this.cryptoInitialized && !rustCryptoInitializationStarted) try {
|
|
1255
|
+
await this.cryptoStoreOwnership?.cancelUnsafeState();
|
|
1256
|
+
} finally {
|
|
1257
|
+
await this.releaseCryptoStoreOwnership();
|
|
1258
|
+
}
|
|
1259
|
+
throw error;
|
|
1147
1260
|
}
|
|
1148
1261
|
}
|
|
1149
1262
|
};
|
|
@@ -1352,17 +1465,8 @@ var MatrixClientCore = class extends MatrixClientBase {
|
|
|
1352
1465
|
const rawEvent = await this.client.fetchRoomEvent(roomId, eventId);
|
|
1353
1466
|
if (rawEvent.type !== "m.room.encrypted") return rawEvent;
|
|
1354
1467
|
const event = this.client.getEventMapper()(rawEvent);
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
decryptedEvent = candidate;
|
|
1358
|
-
};
|
|
1359
|
-
event.once(MatrixEventEvent.Decrypted, onDecrypted);
|
|
1360
|
-
try {
|
|
1361
|
-
await this.client.decryptEventIfNeeded(event);
|
|
1362
|
-
} finally {
|
|
1363
|
-
event.off(MatrixEventEvent.Decrypted, onDecrypted);
|
|
1364
|
-
}
|
|
1365
|
-
return matrixEventToRaw(decryptedEvent ?? event);
|
|
1468
|
+
await this.client.decryptEventIfNeeded(event);
|
|
1469
|
+
return matrixEventToRaw(event);
|
|
1366
1470
|
}
|
|
1367
1471
|
async getRelations(roomId, eventId, relationType, eventType, opts = {}) {
|
|
1368
1472
|
const result = await this.client.relations(roomId, eventId, relationType, eventType, opts);
|
|
@@ -1849,7 +1953,6 @@ var MatrixClient = class extends MatrixClientVerification {
|
|
|
1849
1953
|
this.currentSyncState = state;
|
|
1850
1954
|
this.currentSyncError = error;
|
|
1851
1955
|
this.currentSyncFromCache = fromCache;
|
|
1852
|
-
this.currentSyncRevision += 1;
|
|
1853
1956
|
}
|
|
1854
1957
|
});
|
|
1855
1958
|
}
|
|
@@ -1868,4 +1971,4 @@ var MatrixClient = class extends MatrixClientVerification {
|
|
|
1868
1971
|
}
|
|
1869
1972
|
};
|
|
1870
1973
|
//#endregion
|
|
1871
|
-
export { MatrixClient, isRepairableSecretStorageAccessError as a, trustMatrixOwnIdentity as i, isMatrixDeviceOwnerVerified as n,
|
|
1974
|
+
export { MatrixClient, isRepairableSecretStorageAccessError as a, trustMatrixOwnIdentity as i, isMatrixDeviceOwnerVerified as n, isMatrixDeviceVerifiedInCurrentClient as r, sdk_exports as t };
|