@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,36 +1,29 @@
|
|
|
1
1
|
import { t as getMatrixRuntime } from "./runtime-1kn1P6io.mjs";
|
|
2
2
|
import { a as resolveMatrixAccountConfig, n as hasExplicitMatrixAccountConfig } from "./account-config-CRsKoMqJ.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { l as sanitizeMatrixPathSegment } from "./storage-paths-B51JM-pC.mjs";
|
|
4
|
+
import { p as updateMatrixAccountConfig, r as matrixSetupAdapter, v as resolveMatrixAccountAsync } from "./setup-core-DcCk1_Tv.mjs";
|
|
4
5
|
import { n as resolveMatrixConfigPath } from "./config-paths-CnREYb1Y.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
6
|
+
import { d as resolveMatrixAuthContext } from "./client-C4Gibhzl.mjs";
|
|
7
|
+
import { n as withResolvedActionClient } from "./client-BKiiI29H.mjs";
|
|
7
8
|
import { t as resolveMatrixRoomKeyBackupIssue } from "./backup-health-Dm_YMVFT.mjs";
|
|
8
9
|
import { i as setMatrixConsoleLogging } from "./logger-CXQnpXCt.mjs";
|
|
9
10
|
import { r as setMatrixSdkLogMode } from "./logging-BKV8TYQq.mjs";
|
|
10
11
|
import { n as isOpenClawManagedMatrixDevice, r as summarizeMatrixDeviceHealth } from "./device-health-Be60VF1w.mjs";
|
|
11
|
-
import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update
|
|
12
|
-
import {
|
|
12
|
+
import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update--Pf3jCXD.mjs";
|
|
13
|
+
import { n as listMatrixCryptoUnsafeState, r as recoverMatrixCryptoUnsafeState } from "./crypto-unsafe-state-doctor-C8szCYmf.mjs";
|
|
14
|
+
import { a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, g as runMatrixSelfVerification, h as restoreMatrixRoomKeyBackup, l as getMatrixVerificationSas, m as resetMatrixRoomKeyBackup, n as bootstrapMatrixVerification, p as requestMatrixVerification, r as cancelMatrixVerification, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification--qUbmRd-.mjs";
|
|
13
15
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
14
16
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
17
|
+
import path from "node:path";
|
|
15
18
|
import { parseStrictInteger, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
19
|
+
import os from "node:os";
|
|
16
20
|
import { formatZonedTimestamp } from "openclaw/plugin-sdk/time-runtime";
|
|
17
21
|
import { readByteStreamWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
18
22
|
import { isDeepStrictEqual } from "node:util";
|
|
23
|
+
import { runWithLocalStateOwner } from "openclaw/plugin-sdk/cli-state-owner";
|
|
19
24
|
import { getRuntimeConfigSnapshot, getRuntimeConfigSourceSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
20
25
|
//#region extensions/matrix/src/cli-shared.ts
|
|
21
|
-
let matrixCliExitScheduled = false;
|
|
22
26
|
const MATRIX_CLI_RECOVERY_KEY_STDIN_MAX_BYTES = 1048576;
|
|
23
|
-
function scheduleMatrixCliExit() {
|
|
24
|
-
if (matrixCliExitScheduled || process.env.VITEST) return;
|
|
25
|
-
matrixCliExitScheduled = true;
|
|
26
|
-
setTimeout(() => {
|
|
27
|
-
process.stdout.write("", () => {
|
|
28
|
-
process.stderr.write("", () => {
|
|
29
|
-
process.exit(process.exitCode ?? 0);
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
}, 0);
|
|
33
|
-
}
|
|
34
27
|
async function readMatrixCliRecoveryKeyFromStdin() {
|
|
35
28
|
const recoveryKey = (await readByteStreamWithLimit(process.stdin, {
|
|
36
29
|
maxBytes: MATRIX_CLI_RECOVERY_KEY_STDIN_MAX_BYTES,
|
|
@@ -134,13 +127,23 @@ function parseOptionalInt(value, fieldName, opts = {}) {
|
|
|
134
127
|
return parsed;
|
|
135
128
|
}
|
|
136
129
|
async function runMatrixCliAccountCommand(options, config) {
|
|
137
|
-
|
|
130
|
+
let accountId = normalizeAccountId(options.account);
|
|
138
131
|
await runMatrixCliCommand(options, {
|
|
139
132
|
...config,
|
|
140
|
-
|
|
133
|
+
...config.gateway ? { gateway: {
|
|
134
|
+
...config.gateway,
|
|
135
|
+
onAccount: (id) => {
|
|
136
|
+
accountId = id;
|
|
137
|
+
}
|
|
138
|
+
} } : {},
|
|
139
|
+
run: () => {
|
|
140
|
+
const context = resolveMatrixCliAccountContext(options.account);
|
|
141
|
+
accountId = context.accountId;
|
|
142
|
+
return config.run(context);
|
|
143
|
+
},
|
|
141
144
|
onText: (result, verbose) => {
|
|
142
|
-
printAccountLabel(
|
|
143
|
-
config.onText(result, verbose,
|
|
145
|
+
printAccountLabel(accountId);
|
|
146
|
+
config.onText(result, verbose, accountId);
|
|
144
147
|
}
|
|
145
148
|
});
|
|
146
149
|
}
|
|
@@ -150,7 +153,15 @@ async function runMatrixCliCommand(options, config) {
|
|
|
150
153
|
setMatrixSdkLogMode(verbose ? "default" : "quiet");
|
|
151
154
|
setMatrixConsoleLogging(verbose);
|
|
152
155
|
try {
|
|
153
|
-
const
|
|
156
|
+
const outcome = await runWithLocalStateOwner({
|
|
157
|
+
method: config.gateway?.method ?? "matrix.cli",
|
|
158
|
+
params: await config.gateway?.params() ?? {},
|
|
159
|
+
target: "Matrix account state",
|
|
160
|
+
...config.gateway ? {} : { onForeignOwner: "refuse" },
|
|
161
|
+
runLocal: async () => ({ result: await config.run() })
|
|
162
|
+
});
|
|
163
|
+
if (outcome.accountId) config.gateway?.onAccount?.(outcome.accountId);
|
|
164
|
+
const result = outcome.result;
|
|
154
165
|
if (json) printJson(config.onJson ? config.onJson(result) : result);
|
|
155
166
|
else config.onText(result, verbose);
|
|
156
167
|
if (config.shouldFail?.(result)) process.exitCode = 1;
|
|
@@ -162,8 +173,6 @@ async function runMatrixCliCommand(options, config) {
|
|
|
162
173
|
config.onTextError?.(message);
|
|
163
174
|
}
|
|
164
175
|
process.exitCode = 1;
|
|
165
|
-
} finally {
|
|
166
|
-
scheduleMatrixCliExit();
|
|
167
176
|
}
|
|
168
177
|
}
|
|
169
178
|
function sanitizeMatrixCliText(value) {
|
|
@@ -396,7 +405,7 @@ async function addMatrixAccount(params) {
|
|
|
396
405
|
backupVersion: null
|
|
397
406
|
};
|
|
398
407
|
if (accountConfig.encryption === true) {
|
|
399
|
-
const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-
|
|
408
|
+
const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-DmznRqYe.mjs");
|
|
400
409
|
verificationBootstrap = await maybeBootstrapNewEncryptedMatrixAccount({
|
|
401
410
|
previousCfg: cfg,
|
|
402
411
|
cfg: updated,
|
|
@@ -586,7 +595,7 @@ function printDirectRoomInspection(result) {
|
|
|
586
595
|
}
|
|
587
596
|
async function inspectMatrixDirectRoom(params) {
|
|
588
597
|
const cfg = getMatrixRuntime().config.current();
|
|
589
|
-
const [{ withResolvedActionClient }, { inspectMatrixDirectRooms }] = await Promise.all([import("./client-
|
|
598
|
+
const [{ withResolvedActionClient }, { inspectMatrixDirectRooms }] = await Promise.all([import("./client-BKiiI29H.mjs").then((n) => n.t), import("./direct-management-B3wYhx_M.mjs").then((n) => n.t)]);
|
|
590
599
|
return await withResolvedActionClient({
|
|
591
600
|
accountId: params.accountId,
|
|
592
601
|
cfg
|
|
@@ -604,7 +613,7 @@ async function repairMatrixDirectRoom(params) {
|
|
|
604
613
|
cfg,
|
|
605
614
|
accountId: params.accountId
|
|
606
615
|
});
|
|
607
|
-
const [{ withStartedActionClient }, { repairMatrixDirectRooms }] = await Promise.all([import("./client-
|
|
616
|
+
const [{ withStartedActionClient }, { repairMatrixDirectRooms }] = await Promise.all([import("./client-BKiiI29H.mjs").then((n) => n.t), import("./direct-management-B3wYhx_M.mjs").then((n) => n.t)]);
|
|
608
617
|
return await withStartedActionClient({
|
|
609
618
|
accountId: params.accountId,
|
|
610
619
|
cfg
|
|
@@ -676,6 +685,35 @@ function registerMatrixDirectCommands(root) {
|
|
|
676
685
|
});
|
|
677
686
|
}
|
|
678
687
|
//#endregion
|
|
688
|
+
//#region extensions/matrix/src/cli-doctor.ts
|
|
689
|
+
function registerMatrixDoctorCommands(root) {
|
|
690
|
+
const accountForRoot = (rootDir, stateDir) => rootDir === path.resolve(stateDir, "matrix") ? "default" : path.basename(path.dirname(path.dirname(rootDir)));
|
|
691
|
+
const doctor = root.command("doctor").description("Inspect and recover Matrix crypto storage refusal");
|
|
692
|
+
doctor.command("inspect").description("List accounts blocked by an unsafe crypto final save (read-only)").option("--json", "Output JSON").action(async (options) => {
|
|
693
|
+
const stateDir = getMatrixRuntime().state.resolveStateDir(process.env, os.homedir);
|
|
694
|
+
const accounts = (await listMatrixCryptoUnsafeState(stateDir)).map((rootDir) => ({
|
|
695
|
+
account: accountForRoot(rootDir, stateDir),
|
|
696
|
+
rootDir
|
|
697
|
+
}));
|
|
698
|
+
if (options.json) console.log(JSON.stringify({ blocked: accounts }, null, 2));
|
|
699
|
+
else {
|
|
700
|
+
console.log(accounts.length ? `Matrix crypto refusal: ${accounts.length} account store(s) blocked` : "No blocked Matrix crypto stores found.");
|
|
701
|
+
for (const account of accounts) console.log(`- ${account.account}: ${account.rootDir}`);
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
doctor.command("recover").description("Accept rollback to a validated SQLite snapshot and clear one account's refusal").requiredOption("--account <id>", "Blocked account ID").requiredOption("--accept-snapshot-rollback", "Acknowledge that keys from the failed owner may be lost").action(async (options) => {
|
|
705
|
+
const stateDir = getMatrixRuntime().state.resolveStateDir(process.env, os.homedir);
|
|
706
|
+
const account = sanitizeMatrixPathSegment(normalizeAccountId(options.account));
|
|
707
|
+
const roots = (await listMatrixCryptoUnsafeState(stateDir)).filter((rootDir) => accountForRoot(rootDir, stateDir) === account);
|
|
708
|
+
if (roots.length !== 1) throw new Error(`Expected exactly one blocked Matrix crypto store for account ${account}; found ${roots.length}. Refusing ambiguous recovery.`);
|
|
709
|
+
await recoverMatrixCryptoUnsafeState({
|
|
710
|
+
storageRootDir: roots[0],
|
|
711
|
+
acceptSnapshotRollback: options.acceptSnapshotRollback === true
|
|
712
|
+
});
|
|
713
|
+
console.log(`Matrix crypto refusal cleared for account ${account}; restart the Gateway.`);
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
//#endregion
|
|
679
717
|
//#region extensions/matrix/src/cli-encryption.ts
|
|
680
718
|
function isMatrixVerificationSetupComplete(status) {
|
|
681
719
|
return status.encryptionEnabled && status.verified && status.crossSigningVerified && status.signedByOwner && status.serverDeviceKnown === true && resolveMatrixRoomKeyBackupIssue(status.backup).code === "ok";
|
|
@@ -881,11 +919,20 @@ function registerMatrixVerificationBackupCommands(verify) {
|
|
|
881
919
|
});
|
|
882
920
|
});
|
|
883
921
|
verify.command("bootstrap").description("Bootstrap Matrix cross-signing and device verification state").option("--account <id>", "Account ID (for multi-account setups)").option("--recovery-key <key>", "Recovery key to apply before bootstrap (prefer --recovery-key-stdin)").option("--recovery-key-stdin", "Read the Matrix recovery key from stdin").option("--force-reset-cross-signing", "Force reset cross-signing identity before bootstrap (requires active recovery key)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
|
|
922
|
+
const recoveryKey = resolveMatrixCliRecoveryKeyInput(options);
|
|
884
923
|
await runMatrixCliAccountCommand(options, {
|
|
924
|
+
gateway: {
|
|
925
|
+
method: "matrix.verify.bootstrap.owner",
|
|
926
|
+
params: async () => ({
|
|
927
|
+
accountId: options.account,
|
|
928
|
+
recoveryKey: await recoveryKey,
|
|
929
|
+
forceResetCrossSigning: options.forceResetCrossSigning === true
|
|
930
|
+
})
|
|
931
|
+
},
|
|
885
932
|
run: async ({ accountId, cfg }) => await bootstrapMatrixVerification({
|
|
886
933
|
accountId,
|
|
887
934
|
cfg,
|
|
888
|
-
recoveryKey: await
|
|
935
|
+
recoveryKey: await recoveryKey,
|
|
889
936
|
forceResetCrossSigning: options.forceResetCrossSigning === true
|
|
890
937
|
}),
|
|
891
938
|
onText: (result, verbose, accountId) => {
|
|
@@ -917,11 +964,19 @@ function registerMatrixVerificationBackupCommands(verify) {
|
|
|
917
964
|
});
|
|
918
965
|
});
|
|
919
966
|
verify.command("device [key]").description("Verify device using a Matrix recovery key").option("--account <id>", "Account ID (for multi-account setups)").option("--recovery-key-stdin", "Read the Matrix recovery key from stdin").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (key, options) => {
|
|
967
|
+
const recoveryKey = requireMatrixCliRecoveryKeyInput({
|
|
968
|
+
recoveryKey: key,
|
|
969
|
+
recoveryKeyStdin: options.recoveryKeyStdin
|
|
970
|
+
});
|
|
920
971
|
await runMatrixCliAccountCommand(options, {
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
972
|
+
gateway: {
|
|
973
|
+
method: "matrix.verify.recoveryKey.owner",
|
|
974
|
+
params: async () => ({
|
|
975
|
+
accountId: options.account,
|
|
976
|
+
key: await recoveryKey
|
|
977
|
+
})
|
|
978
|
+
},
|
|
979
|
+
run: async ({ accountId, cfg }) => await verifyMatrixRecoveryKey(await recoveryKey, {
|
|
925
980
|
accountId,
|
|
926
981
|
cfg
|
|
927
982
|
}),
|
|
@@ -1165,16 +1220,14 @@ function registerMatrixVerificationCommands(root) {
|
|
|
1165
1220
|
errorPrefix: "Verification start failed"
|
|
1166
1221
|
});
|
|
1167
1222
|
verify.command("sas <id>").description("Show SAS emoji or decimals for a Matrix verification request").option("--account <id>", "Account ID (for multi-account setups)").option("--user-id <id>", "Matrix user ID for DM verification follow-up").option("--room-id <id>", "Matrix direct-message room ID for verification follow-up").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (id, options) => {
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
run: () => getMatrixVerificationSas(id, {
|
|
1223
|
+
await runMatrixCliAccountCommand(options, {
|
|
1224
|
+
run: ({ accountId, cfg }) => getMatrixVerificationSas(id, {
|
|
1171
1225
|
accountId,
|
|
1172
1226
|
cfg,
|
|
1173
1227
|
...matrixCliVerificationDmLookupOptions(options)
|
|
1174
1228
|
}),
|
|
1175
|
-
onText: (sas) => {
|
|
1229
|
+
onText: (sas, _verbose, accountId) => {
|
|
1176
1230
|
const requestId = formatMatrixCliText(id);
|
|
1177
|
-
printAccountLabel(accountId);
|
|
1178
1231
|
console.log(`Verification id: ${requestId}`);
|
|
1179
1232
|
printMatrixVerificationSas(sas);
|
|
1180
1233
|
printMatrixVerificationSasGuidance(requestId, accountId, formatMatrixVerificationDmFollowupParts(options));
|
|
@@ -1209,6 +1262,14 @@ function registerMatrixVerificationCommands(root) {
|
|
|
1209
1262
|
});
|
|
1210
1263
|
verify.command("status").description("Check Matrix device verification status").option("--account <id>", "Account ID (for multi-account setups)").option("--verbose", "Show detailed diagnostics").option("--include-recovery-key", "Include stored recovery key in output").option("--allow-degraded-local-state", "Return best-effort diagnostics without preparing the Matrix account").option("--json", "Output as JSON").action(async (options) => {
|
|
1211
1264
|
await runMatrixCliAccountCommand(options, {
|
|
1265
|
+
gateway: {
|
|
1266
|
+
method: "matrix.verify.status.owner",
|
|
1267
|
+
params: () => ({
|
|
1268
|
+
accountId: options.account,
|
|
1269
|
+
includeRecoveryKey: options.includeRecoveryKey === true,
|
|
1270
|
+
allowDegradedLocalState: options.allowDegradedLocalState === true
|
|
1271
|
+
})
|
|
1272
|
+
},
|
|
1212
1273
|
run: ({ accountId, cfg }) => getMatrixVerificationStatus({
|
|
1213
1274
|
accountId,
|
|
1214
1275
|
cfg,
|
|
@@ -1234,6 +1295,7 @@ function registerMatrixCli(params) {
|
|
|
1234
1295
|
registerMatrixEncryptionCommands(root);
|
|
1235
1296
|
registerMatrixVerificationCommands(root);
|
|
1236
1297
|
registerMatrixDeviceCommands(root);
|
|
1298
|
+
registerMatrixDoctorCommands(root);
|
|
1237
1299
|
}
|
|
1238
1300
|
//#endregion
|
|
1239
1301
|
export { registerMatrixCli };
|
|
@@ -2,7 +2,7 @@ import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
|
2
2
|
//#region extensions/matrix/src/cli-metadata.ts
|
|
3
3
|
function registerMatrixCliMetadata(api) {
|
|
4
4
|
api.registerCli(async ({ program }) => {
|
|
5
|
-
const { registerMatrixCli } = await import("./cli-
|
|
5
|
+
const { registerMatrixCli } = await import("./cli-CEmWh7wh.mjs");
|
|
6
6
|
registerMatrixCli({ program });
|
|
7
7
|
}, { descriptors: [{
|
|
8
8
|
name: "matrix",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as __exportAll } from "./doctor-contract-CsTNmbMa.mjs";
|
|
2
|
-
import { C as resolveMatrixRoomId } from "./send-
|
|
2
|
+
import { C as resolveMatrixRoomId } from "./send-BprM-Wmx.mjs";
|
|
3
3
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
4
4
|
//#region extensions/matrix/src/matrix/actions/client.ts
|
|
5
5
|
var client_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -7,8 +7,8 @@ var client_exports = /* @__PURE__ */ __exportAll({
|
|
|
7
7
|
withResolvedRoomAction: () => withResolvedRoomAction,
|
|
8
8
|
withStartedActionClient: () => withStartedActionClient
|
|
9
9
|
});
|
|
10
|
-
const loadMatrixActionClientRuntime = createLazyRuntimeModule(() => import("./client-bootstrap-
|
|
11
|
-
async function withResolvedActionClient(opts, run, mode = "
|
|
10
|
+
const loadMatrixActionClientRuntime = createLazyRuntimeModule(() => import("./client-bootstrap-kOIDV4z_.mjs"));
|
|
11
|
+
async function withResolvedActionClient(opts, run, mode = "persist") {
|
|
12
12
|
const { withResolvedRuntimeMatrixClient } = await loadMatrixActionClientRuntime();
|
|
13
13
|
return await withResolvedRuntimeMatrixClient(opts, run, mode);
|
|
14
14
|
}
|
|
@@ -5,7 +5,7 @@ import { t as getMatrixScopedEnvVarNames } from "./env-vars-aEBngJPa.mjs";
|
|
|
5
5
|
import { o as resolveMatrixBaseConfig, r as listNormalizedMatrixAccountIds, t as findMatrixAccountConfig } from "./account-config-CRsKoMqJ.mjs";
|
|
6
6
|
import { t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.mjs";
|
|
7
7
|
import { n as validateMatrixHomeserverUrl, t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-CF6pG6eE.mjs";
|
|
8
|
-
import { i as repairCurrentTokenStorageMetaDeviceId } from "./storage-
|
|
8
|
+
import { i as repairCurrentTokenStorageMetaDeviceId } from "./storage-l8V0XsGM.mjs";
|
|
9
9
|
import { createLazyRuntimeMethod, createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
10
10
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId, normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-id";
|
|
11
11
|
import { formatErrorMessage, toErrorObject, toStringifiedError } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -15,12 +15,13 @@ import { resolveOptionalIntegerOption } from "openclaw/plugin-sdk/number-runtime
|
|
|
15
15
|
import { ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
16
16
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
17
17
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
18
|
-
import { racePromiseWithAbortSignal, raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
|
|
19
18
|
import { retryAsync } from "openclaw/plugin-sdk/retry-runtime";
|
|
20
19
|
import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
21
20
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
21
|
+
import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
|
|
22
|
+
import { racePromiseWithAbortSignal, raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
|
|
22
23
|
//#region extensions/matrix/src/matrix/client/auth-request.ts
|
|
23
|
-
const loadMatrixAuthClientDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-
|
|
24
|
+
const loadMatrixAuthClientDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-ByU8So5S.mjs").then((n) => n.t), import("./logging-BKV8TYQq.mjs").then((n) => n.n)]).then(([sdkModule, loggingModule]) => ({
|
|
24
25
|
MatrixClient: sdkModule.MatrixClient,
|
|
25
26
|
ensureMatrixSdkLoggingConfigured: loggingModule.ensureMatrixSdkLoggingConfigured
|
|
26
27
|
})));
|
|
@@ -89,8 +90,8 @@ async function fetchMatrixWhoamiIdentity(params) {
|
|
|
89
90
|
}
|
|
90
91
|
//#endregion
|
|
91
92
|
//#region extensions/matrix/src/matrix/client/config.ts
|
|
92
|
-
const loadMatrixCredentialsReadDeps = createLazyRuntimeModule(() => import("./credentials-read-
|
|
93
|
-
const loadMatrixCredentialsWriteRuntime = createLazyRuntimeModule(() => import("./credentials-
|
|
93
|
+
const loadMatrixCredentialsReadDeps = createLazyRuntimeModule(() => import("./credentials-read-D2ULV55A.mjs").then((n) => n.i));
|
|
94
|
+
const loadMatrixCredentialsWriteRuntime = createLazyRuntimeModule(() => import("./credentials-CPnJZaZB.mjs"));
|
|
94
95
|
const loadMatrixSecretInputDeps = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/secret-input-runtime"));
|
|
95
96
|
function credentialsMatchBackfillAuthLineage(params) {
|
|
96
97
|
if (!params.stored) return true;
|
|
@@ -378,16 +379,21 @@ async function resolveMatrixAuth(params) {
|
|
|
378
379
|
ssrfPolicy: resolved.ssrfPolicy,
|
|
379
380
|
dispatcherPolicy: resolved.dispatcherPolicy
|
|
380
381
|
});
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
type: "m.
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
382
|
+
let login;
|
|
383
|
+
try {
|
|
384
|
+
login = await retryMatrixAuthRequest("matrix auth login", async () => await loginClient.doRequest("POST", "/_matrix/client/v3/login", void 0, {
|
|
385
|
+
type: "m.login.password",
|
|
386
|
+
identifier: {
|
|
387
|
+
type: "m.id.user",
|
|
388
|
+
user: resolved.userId
|
|
389
|
+
},
|
|
390
|
+
password,
|
|
391
|
+
device_id: resolved.deviceId,
|
|
392
|
+
initial_device_display_name: resolved.deviceName ?? "OpenClaw Gateway"
|
|
393
|
+
}));
|
|
394
|
+
} finally {
|
|
395
|
+
await loginClient.stopWithoutPersist();
|
|
396
|
+
}
|
|
391
397
|
const loginAccessToken = login.access_token?.trim();
|
|
392
398
|
if (!loginAccessToken) throw new Error("Matrix login did not return an access token");
|
|
393
399
|
const auth = buildResolvedMatrixAuth(resolved, {
|
|
@@ -517,10 +523,23 @@ async function awaitMatrixStartupWithAbort(promise, abortSignal) {
|
|
|
517
523
|
}
|
|
518
524
|
//#endregion
|
|
519
525
|
//#region extensions/matrix/src/matrix/client/shared.ts
|
|
520
|
-
const loadMatrixCreateClientDeps = createLazyRuntimeModule(() => import("./create-client-
|
|
526
|
+
const loadMatrixCreateClientDeps = createLazyRuntimeModule(() => import("./create-client-BS8UYx6N.mjs"));
|
|
521
527
|
const MATRIX_RETIREMENT_DRAIN_TIMEOUT_MS = 5e3;
|
|
522
|
-
const
|
|
523
|
-
|
|
528
|
+
const sharedClientRegistry = resolveGlobalSingleton(Symbol.for("openclaw.matrix.shared-client-registry"), () => ({
|
|
529
|
+
states: /* @__PURE__ */ new Map(),
|
|
530
|
+
promises: /* @__PURE__ */ new Map(),
|
|
531
|
+
storageOwners: /* @__PURE__ */ new Map()
|
|
532
|
+
}));
|
|
533
|
+
const sharedClientStates = sharedClientRegistry.states;
|
|
534
|
+
const sharedClientPromises = sharedClientRegistry.promises;
|
|
535
|
+
const sharedStorageOwners = sharedClientRegistry.storageOwners;
|
|
536
|
+
var MatrixTransportGenerationBusyError = class extends Error {
|
|
537
|
+
constructor() {
|
|
538
|
+
super("Matrix account transport is changing; retry after the account restart finishes.");
|
|
539
|
+
this.code = "MATRIX_ACCOUNT_RESTARTING";
|
|
540
|
+
this.retryable = true;
|
|
541
|
+
}
|
|
542
|
+
};
|
|
524
543
|
function buildSharedClientKey(auth) {
|
|
525
544
|
return JSON.stringify([
|
|
526
545
|
auth.homeserver,
|
|
@@ -538,8 +557,9 @@ async function createSharedMatrixClient(params) {
|
|
|
538
557
|
client: await createMatrixClient({
|
|
539
558
|
...params.auth,
|
|
540
559
|
localTimeoutMs: params.timeoutMs
|
|
541
|
-
}),
|
|
560
|
+
}, params.preparedStorage),
|
|
542
561
|
key: buildSharedClientKey(params.auth),
|
|
562
|
+
storageOwnerKey: params.preparedStorage.storagePaths?.idbSnapshotPath ?? null,
|
|
543
563
|
started: false,
|
|
544
564
|
startPromise: null,
|
|
545
565
|
phase: "open",
|
|
@@ -553,30 +573,17 @@ async function createSharedMatrixClient(params) {
|
|
|
553
573
|
};
|
|
554
574
|
}
|
|
555
575
|
function deleteSharedClientState(state) {
|
|
556
|
-
if (sharedClientStates.get(state.key) === state)
|
|
576
|
+
if (sharedClientStates.get(state.key) === state) {
|
|
577
|
+
sharedClientStates.delete(state.key);
|
|
578
|
+
if (state.storageOwnerKey) sharedStorageOwners.delete(state.storageOwnerKey);
|
|
579
|
+
}
|
|
557
580
|
const detachLifecycle = state.detachLifecycle;
|
|
558
581
|
state.detachLifecycle = void 0;
|
|
559
582
|
detachLifecycle?.();
|
|
560
583
|
}
|
|
561
584
|
function bindSharedClientLifecycle(state, lifecycle) {
|
|
562
585
|
if (!lifecycle) return;
|
|
563
|
-
|
|
564
|
-
const onAbort = () => {
|
|
565
|
-
retire().catch(() => void 0);
|
|
566
|
-
};
|
|
567
|
-
lifecycle.signal.addEventListener("abort", onAbort, { once: true });
|
|
568
|
-
let removeDisposer;
|
|
569
|
-
try {
|
|
570
|
-
removeDisposer = lifecycle.onDispose(retire);
|
|
571
|
-
} catch (error) {
|
|
572
|
-
lifecycle.signal.removeEventListener("abort", onAbort);
|
|
573
|
-
throw error;
|
|
574
|
-
}
|
|
575
|
-
state.detachLifecycle = () => {
|
|
576
|
-
lifecycle.signal.removeEventListener("abort", onAbort);
|
|
577
|
-
removeDisposer();
|
|
578
|
-
};
|
|
579
|
-
if (lifecycle.signal.aborted) onAbort();
|
|
586
|
+
state.detachLifecycle = lifecycle.onDispose(() => forceRetireState(state));
|
|
580
587
|
}
|
|
581
588
|
async function ensureSharedClientStarted(state, abortSignal) {
|
|
582
589
|
if (state.started) return;
|
|
@@ -626,12 +633,28 @@ async function resolveOpenSharedMatrixClientState(params, lifecycle) {
|
|
|
626
633
|
await awaitMatrixStartupWithAbort(pending, params.abortSignal);
|
|
627
634
|
continue;
|
|
628
635
|
}
|
|
636
|
+
const { prepareMatrixClientStorage } = await loadMatrixCreateClientDeps();
|
|
637
|
+
const preparedStorage = await prepareMatrixClientStorage(auth);
|
|
638
|
+
throwIfMatrixStartupAborted(params.abortSignal);
|
|
639
|
+
if (sharedClientStates.has(key) || sharedClientPromises.has(key)) continue;
|
|
640
|
+
const storageOwnerKey = preparedStorage.storagePaths?.idbSnapshotPath ?? null;
|
|
641
|
+
const ownerPromise = storageOwnerKey ? sharedStorageOwners.get(storageOwnerKey) : void 0;
|
|
642
|
+
if (ownerPromise) {
|
|
643
|
+
const owner = await awaitMatrixStartupWithAbort(ownerPromise, params.abortSignal);
|
|
644
|
+
if (owner.retirementPromise) {
|
|
645
|
+
await awaitMatrixStartupWithAbort(owner.retirementPromise, params.abortSignal);
|
|
646
|
+
continue;
|
|
647
|
+
}
|
|
648
|
+
throw new MatrixTransportGenerationBusyError();
|
|
649
|
+
}
|
|
629
650
|
const creationPromise = createSharedMatrixClient({
|
|
630
651
|
auth,
|
|
631
652
|
timeoutMs: params.timeoutMs,
|
|
632
|
-
lifecycle
|
|
653
|
+
lifecycle,
|
|
654
|
+
preparedStorage
|
|
633
655
|
});
|
|
634
656
|
sharedClientPromises.set(key, creationPromise);
|
|
657
|
+
if (storageOwnerKey) sharedStorageOwners.set(storageOwnerKey, creationPromise);
|
|
635
658
|
try {
|
|
636
659
|
const created = await creationPromise;
|
|
637
660
|
sharedClientStates.set(key, created);
|
|
@@ -644,6 +667,7 @@ async function resolveOpenSharedMatrixClientState(params, lifecycle) {
|
|
|
644
667
|
return created;
|
|
645
668
|
} finally {
|
|
646
669
|
if (sharedClientPromises.get(key) === creationPromise) sharedClientPromises.delete(key);
|
|
670
|
+
if (storageOwnerKey && !sharedClientStates.has(key) && sharedStorageOwners.get(storageOwnerKey) === creationPromise) sharedStorageOwners.delete(storageOwnerKey);
|
|
647
671
|
}
|
|
648
672
|
}
|
|
649
673
|
}
|
|
@@ -681,40 +705,20 @@ function forceReleaseLeases(state, releasePromise) {
|
|
|
681
705
|
state.leases.clear();
|
|
682
706
|
state.noLeases.resolve();
|
|
683
707
|
}
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
if (!isPending()) return task;
|
|
688
|
-
state.phase = "late-drain";
|
|
689
|
-
throw new Error(timeoutMessage);
|
|
708
|
+
function waitForRetirement(retirement) {
|
|
709
|
+
return raceWithTimeout(retirement, MATRIX_RETIREMENT_DRAIN_TIMEOUT_MS, () => {
|
|
710
|
+
throw new Error("Matrix client retirement did not settle within 5000ms");
|
|
690
711
|
}, { ref: false });
|
|
691
712
|
}
|
|
692
713
|
function beginGenerationRetirement(params) {
|
|
693
714
|
const { state } = params;
|
|
694
|
-
if (state.retirementPromise) return state.retirementPromise;
|
|
695
|
-
state.phase = "
|
|
715
|
+
if (state.retirementPromise) return waitForRetirement(state.retirementPromise);
|
|
716
|
+
state.phase = "retiring";
|
|
696
717
|
if (state.leases.size === 0) state.noLeases.resolve();
|
|
697
718
|
const result = createDeferred();
|
|
698
719
|
state.retirementPromise = result.promise;
|
|
699
720
|
Promise.resolve().then(async () => {
|
|
700
|
-
|
|
701
|
-
if (startup) try {
|
|
702
|
-
await waitForRetirementDrain(state, startup.catch(() => void 0), () => state.startPromise === startup, `Matrix client startup did not settle within ${MATRIX_RETIREMENT_DRAIN_TIMEOUT_MS}ms during retirement`);
|
|
703
|
-
} catch (error) {
|
|
704
|
-
state.poisonError = toStringifiedError(error);
|
|
705
|
-
result.reject(state.poisonError);
|
|
706
|
-
const failure = (await Promise.allSettled([
|
|
707
|
-
startup.catch(() => void 0).then(async () => {
|
|
708
|
-
state.started = false;
|
|
709
|
-
await state.client.stopWithoutPersist();
|
|
710
|
-
}),
|
|
711
|
-
retireMonitorLeases(state, params.monitorLeases ?? []),
|
|
712
|
-
state.noLeases.promise
|
|
713
|
-
])).find((outcome) => outcome.status === "rejected");
|
|
714
|
-
if (failure) state.poisonError = toStringifiedError(failure.reason);
|
|
715
|
-
else deleteSharedClientState(state);
|
|
716
|
-
throw state.poisonError;
|
|
717
|
-
}
|
|
721
|
+
await state.startPromise?.catch(() => void 0);
|
|
718
722
|
try {
|
|
719
723
|
await state.client.quiesceSync();
|
|
720
724
|
state.started = false;
|
|
@@ -722,30 +726,16 @@ function beginGenerationRetirement(params) {
|
|
|
722
726
|
} catch (error) {
|
|
723
727
|
state.poisonError = toStringifiedError(error);
|
|
724
728
|
}
|
|
725
|
-
let monitorRetired = true;
|
|
726
729
|
try {
|
|
727
730
|
await retireMonitorLeases(state, params.monitorLeases ?? []);
|
|
728
731
|
} catch (error) {
|
|
729
732
|
state.poisonError ??= toStringifiedError(error);
|
|
730
|
-
monitorRetired = false;
|
|
731
|
-
}
|
|
732
|
-
state.phase = "closing";
|
|
733
|
-
let lateLeaseDrain = null;
|
|
734
|
-
try {
|
|
735
|
-
await waitForRetirementDrain(state, state.noLeases.promise, () => state.leases.size > 0, `Matrix transient leases did not drain within ${MATRIX_RETIREMENT_DRAIN_TIMEOUT_MS}ms`);
|
|
736
|
-
} catch (error) {
|
|
737
|
-
state.poisonError ??= toStringifiedError(error);
|
|
738
|
-
result.reject(state.poisonError);
|
|
739
|
-
lateLeaseDrain = state.noLeases.promise;
|
|
740
733
|
}
|
|
734
|
+
await state.noLeases.promise;
|
|
735
|
+
if (state.poisonError) await state.client.drainPendingDecryptions("matrix failed shutdown").catch((error) => {
|
|
736
|
+
state.poisonError = toStringifiedError(error);
|
|
737
|
+
});
|
|
741
738
|
let failure = state.poisonError;
|
|
742
|
-
let canDelete = monitorRetired;
|
|
743
|
-
if (failure) canDelete = await state.client.drainPendingDecryptions("matrix poisoned client shutdown").then(() => true, () => false) && canDelete;
|
|
744
|
-
else try {
|
|
745
|
-
await state.client.drainPendingDecryptions("matrix shared client final shutdown");
|
|
746
|
-
} catch (error) {
|
|
747
|
-
failure = state.poisonError = toStringifiedError(error);
|
|
748
|
-
}
|
|
749
739
|
let discard = failure !== null || state.releaseMode === "discard";
|
|
750
740
|
if (!discard) try {
|
|
751
741
|
await state.client.stopAndPersist();
|
|
@@ -753,19 +743,18 @@ function beginGenerationRetirement(params) {
|
|
|
753
743
|
discard = true;
|
|
754
744
|
if (state.releaseMode === "persist") failure = state.poisonError = toStringifiedError(error);
|
|
755
745
|
}
|
|
756
|
-
if (discard) await state.client.stopWithoutPersist()
|
|
757
|
-
|
|
758
|
-
canDelete = false;
|
|
759
|
-
});
|
|
760
|
-
await lateLeaseDrain;
|
|
761
|
-
if (canDelete) deleteSharedClientState(state);
|
|
746
|
+
if (discard) await state.client.stopWithoutPersist();
|
|
747
|
+
deleteSharedClientState(state);
|
|
762
748
|
if (failure) throw failure;
|
|
763
|
-
}).then(result.resolve,
|
|
749
|
+
}).then(result.resolve, (error) => {
|
|
750
|
+
state.poisonError = toStringifiedError(error);
|
|
751
|
+
result.reject(state.poisonError);
|
|
752
|
+
});
|
|
764
753
|
abortTransientLeases(state);
|
|
765
|
-
return state.retirementPromise;
|
|
754
|
+
return waitForRetirement(state.retirementPromise);
|
|
766
755
|
}
|
|
767
756
|
function createSharedMatrixClientLease(state, role) {
|
|
768
|
-
if (state.phase !== "open" || state.poisonError)
|
|
757
|
+
if (state.phase !== "open" || state.poisonError) throw new Error("Matrix client is retiring; retry the operation after shutdown");
|
|
769
758
|
const leaseState = {
|
|
770
759
|
abortController: new AbortController(),
|
|
771
760
|
monitorRetirement: null,
|
|
@@ -779,9 +768,6 @@ function createSharedMatrixClientLease(state, role) {
|
|
|
779
768
|
client: state.client,
|
|
780
769
|
role,
|
|
781
770
|
registerMonitorRetirement: (retirement) => {
|
|
782
|
-
if (role !== "monitor") throw new Error("Matrix transient leases cannot register monitor retirement");
|
|
783
|
-
if (leaseState.releasePromise || state.phase !== "open") throw new Error("Matrix monitor lease is already retiring");
|
|
784
|
-
if (leaseState.monitorRetirement && leaseState.monitorRetirement !== retirement) throw new Error("Matrix monitor retirement is already registered");
|
|
785
771
|
leaseState.monitorRetirement = retirement;
|
|
786
772
|
},
|
|
787
773
|
start: async (abortSignal) => {
|
|
@@ -794,10 +780,6 @@ function createSharedMatrixClientLease(state, role) {
|
|
|
794
780
|
state.releaseMode = mergeReleaseMode(state.releaseMode, releaseParams.mode ?? "stop");
|
|
795
781
|
state.leases.delete(leaseState);
|
|
796
782
|
if (state.leases.size === 0) state.noLeases.resolve();
|
|
797
|
-
if (state.phase === "late-drain") {
|
|
798
|
-
leaseState.releasePromise = Promise.resolve();
|
|
799
|
-
return leaseState.releasePromise;
|
|
800
|
-
}
|
|
801
783
|
const finalMonitor = role === "monitor" && !Array.from(state.leases).some((lease) => lease.role === "monitor");
|
|
802
784
|
if (role === "monitor" && !finalMonitor) {
|
|
803
785
|
leaseState.releasePromise = retireMonitorLease(state, leaseState);
|
|
@@ -827,37 +809,29 @@ async function acquireSharedMatrixClient(params = {}) {
|
|
|
827
809
|
...params,
|
|
828
810
|
abortSignal
|
|
829
811
|
};
|
|
830
|
-
|
|
812
|
+
throwIfMatrixStartupAborted(abortSignal);
|
|
813
|
+
const state = await resolveOpenSharedMatrixClientState(acquisition, lifecycle);
|
|
814
|
+
if (abortSignal?.aborted) {
|
|
815
|
+
if (state.phase === "open" && state.leases.size === 0) await beginGenerationRetirement({ state });
|
|
831
816
|
throwIfMatrixStartupAborted(abortSignal);
|
|
832
|
-
const state = await resolveOpenSharedMatrixClientState(acquisition, lifecycle);
|
|
833
|
-
if (abortSignal?.aborted) {
|
|
834
|
-
if (state.phase === "open" && state.leases.size === 0) await beginGenerationRetirement({ state });
|
|
835
|
-
throwIfMatrixStartupAborted(abortSignal);
|
|
836
|
-
}
|
|
837
|
-
const lease = createSharedMatrixClientLease(state, params.role ?? "transient");
|
|
838
|
-
if (!lease) continue;
|
|
839
|
-
if (params.startClient !== false) try {
|
|
840
|
-
await lease.start(abortSignal);
|
|
841
|
-
} catch (error) {
|
|
842
|
-
await lease.release({ mode: "stop" }).catch(() => void 0);
|
|
843
|
-
throw error;
|
|
844
|
-
}
|
|
845
|
-
return lease;
|
|
846
817
|
}
|
|
818
|
+
const lease = createSharedMatrixClientLease(state, params.role ?? "transient");
|
|
819
|
+
if (params.startClient !== false) try {
|
|
820
|
+
await lease.start(abortSignal);
|
|
821
|
+
} catch (error) {
|
|
822
|
+
await lease.release({ mode: "stop" }).catch(() => void 0);
|
|
823
|
+
throw error;
|
|
824
|
+
}
|
|
825
|
+
return lease;
|
|
847
826
|
}
|
|
848
827
|
async function forceRetireState(state) {
|
|
849
|
-
if (state.phase === "late-drain") throw state.poisonError ?? /* @__PURE__ */ new Error("Matrix client generation is still retiring");
|
|
850
828
|
state.releaseMode = mergeReleaseMode(state.releaseMode, "stop");
|
|
851
829
|
const retirementPromise = beginGenerationRetirement({
|
|
852
830
|
state,
|
|
853
831
|
monitorLeases: Array.from(state.leases).filter((lease) => lease.role === "monitor")
|
|
854
832
|
});
|
|
855
833
|
forceReleaseLeases(state, retirementPromise);
|
|
856
|
-
|
|
857
|
-
await retirementPromise;
|
|
858
|
-
} catch (error) {
|
|
859
|
-
if (sharedClientStates.get(state.key) === state) throw state.poisonError ?? error;
|
|
860
|
-
}
|
|
834
|
+
await retirementPromise;
|
|
861
835
|
}
|
|
862
836
|
async function stopSharedClientForAccount(auth) {
|
|
863
837
|
const state = sharedClientStates.get(buildSharedClientKey(auth));
|
|
@@ -881,7 +855,7 @@ var client_exports = /* @__PURE__ */ __exportAll({
|
|
|
881
855
|
stopSharedClientForAccount: () => stopSharedClientForAccount,
|
|
882
856
|
validateMatrixHomeserverUrl: () => validateMatrixHomeserverUrl
|
|
883
857
|
});
|
|
884
|
-
const loadMatrixClientRuntime = createLazyRuntimeModule(() => import("./create-client-
|
|
858
|
+
const loadMatrixClientRuntime = createLazyRuntimeModule(() => import("./create-client-BS8UYx6N.mjs"));
|
|
885
859
|
const createMatrixClient = createLazyRuntimeMethod(loadMatrixClientRuntime, (runtime) => runtime.createMatrixClient);
|
|
886
860
|
//#endregion
|
|
887
861
|
export { isMatrixStartupAbortError as a, getMatrixMonitorTaskSignal as c, resolveMatrixAuthContext as d, createMatrixStartupAbortError as i, backfillMatrixAuthDeviceIdAfterStartup as l, acquireSharedMatrixClient as n, throwIfMatrixStartupAborted as o, awaitMatrixStartupWithAbort as r, createMatrixMonitorTaskRunner as s, client_exports as t, resolveMatrixAuth as u };
|