@openclaw/matrix 2026.7.2-beta.7 → 2026.7.34
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/README.md +1 -1
- package/dist/{account-selection-kqquRzCf.js → .setup/account-selection-BOQeTqax.mjs} +18 -17
- package/dist/{approval-handler.runtime-DSeaIsGa.js → .setup/approval-handler.runtime-CEXm9_-p.mjs} +18 -28
- package/dist/{approval-ids-BdJGPAJT.js → .setup/approval-ids-DdFnDB3h.mjs} +1 -1
- package/dist/{approval-reaction-auth-BjOpELxu.js → .setup/approval-reaction-auth-CREvd7S7.mjs} +2 -2
- package/dist/.setup/approval-reactions-Cltyp8nL.mjs +113 -0
- package/dist/.setup/async-lock-BcLS4KOc.mjs +19 -0
- package/dist/{channel-vj788dNZ.js → .setup/channel-an4umty1.mjs} +186 -144
- package/dist/{channel.runtime-CLoF2S9T.js → .setup/channel.runtime-GHcIBJ7H.mjs} +51 -45
- package/dist/{cli-DMqfDE-q.js → .setup/cli-B3WYmv5U.mjs} +882 -901
- package/dist/{cli-metadata-C7D53SND.js → .setup/cli-metadata-RUKCn0wJ.mjs} +1 -1
- package/dist/{client-6eRENr7k.js → .setup/client-Ct0bUHCo.mjs} +5 -5
- package/dist/{shared-CUMWxcMz.js → .setup/client-DFBQtzCe.mjs} +422 -179
- package/dist/.setup/client-bootstrap-Be8jvNle.mjs +74 -0
- package/dist/{config-schema-Djxw3C6b.js → .setup/config-schema-D9J_vUF6.mjs} +89 -70
- package/dist/.setup/credentials-BhZlA0kL.mjs +56 -0
- package/dist/.setup/credentials-read-CRHg6XPm.mjs +114 -0
- package/dist/{credentials-write.runtime-Be9zNSUw.js → .setup/credentials-write.runtime-dWuLafsk.mjs} +1 -1
- package/dist/{crypto-runtime-D9_6J5tZ.js → .setup/crypto-runtime-D-cZa8P0.mjs} +81 -35
- package/dist/.setup/crypto-state-store-B43k3z3W.mjs +352 -0
- package/dist/{deps-CcVJfvRM.js → .setup/deps-Dy6yreL4.mjs} +92 -25
- package/dist/{device-health-B4-YXtJR.js → .setup/device-health-D4LBxuPq.mjs} +1 -6
- package/dist/{directory-live-C8dVBiCc.js → .setup/directory-live-BTEYxMwy.mjs} +10 -9
- package/dist/.setup/doctor-BGnvMzOR.mjs +169 -0
- package/dist/.setup/doctor-contract-DNJw0fdq.mjs +246 -0
- package/dist/{draft-stream-CtvOXq0Z.js → .setup/draft-stream-C-_OhpE8.mjs} +1 -6
- package/dist/{encryption-guidance-CbEFe38F.js → .setup/encryption-guidance-CpuuwmjL.mjs} +4 -3
- package/dist/{env-auth-CQsYbz-p.js → .setup/env-auth-CYJL1jNl.mjs} +2 -2
- package/dist/{env-vars-B0NxQnPk.js → .setup/env-vars-KzaYveuy.mjs} +1 -3
- package/dist/{exec-approval-resolver-BCgqRtZS.js → .setup/exec-approval-resolver-f9j6staN.mjs} +1 -2
- package/dist/{file-sync-store-DiiFsayX.js → .setup/file-sync-store-DU0cnYAz.mjs} +30 -25
- package/dist/{http-client-CycYxU9-.js → .setup/http-client-C954In2D.mjs} +45 -25
- package/dist/{idb-persistence-B6x7dMsF.js → .setup/idb-persistence-_HKTXkVC.mjs} +76 -78
- package/dist/{idb-persistence-lock-DAJ49nZX.js → .setup/idb-persistence-lock-B3fZXyF_.mjs} +1 -1
- package/dist/.setup/legacy-crypto-inspector-Byp8LCys.mjs +42 -0
- package/dist/.setup/legacy-crypto-restore-YQVoK1B2.mjs +93 -0
- package/dist/{logger-D0GCSDQq.js → .setup/logger-DpoogOgz.mjs} +1 -1
- package/dist/{logging-DV-p52N0.js → .setup/logging-CgxQOJJP.mjs} +2 -9
- package/dist/.setup/matrix-migration.runtime-BDH5c3fN.mjs +530 -0
- package/dist/{media-text-BTwzADS_.js → .setup/media-text-Cib-dxkn.mjs} +1 -1
- package/dist/{messages-DxQJkhxs.js → .setup/messages-D4DYGHYX.mjs} +15 -67
- package/dist/.setup/migration-snapshot-backup-CpgYhiUp.mjs +70 -0
- package/dist/.setup/migration-snapshot.runtime-O8qkMVaC.mjs +2 -0
- package/dist/{monitor-VyWlSLwo.js → .setup/monitor-DNcW_oAN.mjs} +2525 -2361
- package/dist/.setup/probe.runtime-CMPh0mFk.mjs +2 -0
- package/dist/{profile-update-CffmyW_4.js → .setup/profile-update-DzOL3Wiw.mjs} +5 -4
- package/dist/{reaction-events-B00WSi98.js → .setup/reaction-events-BcvgXxHb.mjs} +14 -64
- package/dist/{resolve-targets-nm2L48sh.js → .setup/resolve-targets-Bq80X9Sn.mjs} +3 -3
- package/dist/{resolver.runtime-DS6uPaEe.js → .setup/resolver.runtime-CeBHR9-T.mjs} +1 -1
- package/dist/{runtime-api-D1xI_cvh.js → .setup/runtime-api-CEsWNdil.mjs} +4 -4
- package/dist/.setup/runtime-setter-api-DGMubGUq.mjs +3 -0
- package/dist/{sdk-bUytQHx7.js → .setup/sdk-He1quVAq.mjs} +592 -261
- package/dist/.setup/secret-contract-api-CiTJ7pd5.mjs +3 -0
- package/dist/{secret-contract-M3hRmGO-.js → .setup/secret-contract-phPvlNfV.mjs} +53 -28
- package/dist/{send-BldGYG8g.js → .setup/send-CGgl0uTn.mjs} +133 -660
- package/dist/{setup-bootstrap-Deleiibz.js → .setup/setup-bootstrap-DUXBC8X2.mjs} +4 -4
- package/dist/{setup-core-BVfBv2ai.js → .setup/setup-core-bhdcEo7v.mjs} +239 -189
- package/dist/.setup/setup-plugin-api-CAwZ_Bi7.mjs +43 -0
- package/dist/.setup/setup-plugin-api-DIFVsOs3.mjs +2 -0
- package/dist/{setup-surface-BBq3WeqX.js → .setup/setup-surface-05_G-MnT.mjs} +149 -92
- package/dist/{startup-verification-wm3_i88s.js → .setup/startup-verification-BTwIGu1J.mjs} +7 -6
- package/dist/.setup/storage-NGZq5zet.mjs +432 -0
- package/dist/{storage-paths-gUmSydsW.js → .setup/storage-paths-BWo_ZEMC.mjs} +13 -2
- package/dist/{subagent-hooks-dkPAF6Et.js → .setup/subagent-hooks-BSWPJEmo.mjs} +2 -2
- package/dist/{thread-binding-api-DRbBZlhS.js → .setup/thread-binding-api-B7UaOoKv.mjs} +1 -1
- package/dist/{thread-bindings-DGbl3vDW.js → .setup/thread-bindings-DqmjG2on.mjs} +8 -8
- package/dist/{tool-actions.runtime-uu9blSqO.js → .setup/tool-actions.runtime-CXDLk2jg.mjs} +196 -332
- package/dist/{verification-DYMQ1QpI.js → .setup/verification-DeWOtZJr.mjs} +4 -3
- package/dist/api.js +9 -9
- package/dist/auth-presence.js +21 -13
- package/dist/channel-plugin-api.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/contract-api.js +2 -2
- package/dist/doctor-contract-api.js +99 -524
- package/dist/helper-api.js +4 -4
- package/dist/index.js +1 -1
- package/dist/plugin-entry.handlers.runtime.js +2 -2
- package/dist/runtime-api.js +8 -8
- package/dist/runtime-heavy-api.js +3 -0
- package/dist/runtime-setter-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/session-binding-contract-api.js +3 -3
- package/dist/setup-entry.js +4 -3
- package/dist/setup-plugin-api.js +1 -44
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/thread-binding-api.js +1 -1
- package/dist/thread-bindings-runtime.js +1 -1
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/package.json +1 -1
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm.d.ts +2 -14
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.cjs +384 -409
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.js +224 -246
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm +0 -0
- package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm.d.ts +58 -59
- package/node_modules/markdown-it/README.md +18 -294
- package/node_modules/markdown-it/bin/markdown-it.mjs +2 -2
- package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs +3013 -0
- package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs.map +1 -0
- package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js +14 -0
- package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js.map +1 -0
- package/node_modules/markdown-it/dist/markdown-it.cjs.js +4420 -0
- package/node_modules/markdown-it/dist/markdown-it.cjs.js.map +1 -0
- package/node_modules/markdown-it/dist/markdown-it.d.cts +19 -0
- package/node_modules/markdown-it/dist/markdown-it.d.mts +950 -0
- package/node_modules/markdown-it/dist/{index.cjs.js → markdown-it.mjs} +1504 -1525
- package/node_modules/markdown-it/dist/markdown-it.mjs.map +1 -0
- package/node_modules/markdown-it/node_modules/argparse/LICENSE +1 -208
- package/node_modules/markdown-it/node_modules/argparse/README.md +46 -41
- package/node_modules/markdown-it/node_modules/argparse/lib/_colorize.js +72 -0
- package/node_modules/markdown-it/node_modules/argparse/lib/argparse.d.ts +292 -0
- package/node_modules/markdown-it/node_modules/argparse/{argparse.js → lib/argparse.js} +1142 -1029
- package/node_modules/markdown-it/node_modules/argparse/lib/difflib.js +190 -0
- package/node_modules/markdown-it/node_modules/argparse/lib/sub.js +4 -4
- package/node_modules/markdown-it/node_modules/argparse/lib/textwrap.js +28 -28
- package/node_modules/markdown-it/node_modules/argparse/package.json +18 -11
- package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.d.ts +8 -0
- package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.js +46 -0
- package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/{lib → dist}/decode.d.ts +28 -45
- package/node_modules/markdown-it/node_modules/entities/dist/decode.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/decode.js +189 -141
- package/node_modules/markdown-it/node_modules/entities/dist/decode.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/encode.d.ts +4 -2
- package/node_modules/markdown-it/node_modules/entities/dist/encode.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/encode.js +90 -0
- package/node_modules/markdown-it/node_modules/entities/dist/encode.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/{lib → dist}/escape.d.ts +15 -10
- package/node_modules/markdown-it/node_modules/entities/dist/escape.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/escape.js +132 -0
- package/node_modules/markdown-it/node_modules/entities/dist/escape.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.d.ts +3 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.js +5 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.d.ts +3 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.js +5 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.d.ts +5 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.js +12 -0
- package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/index.d.ts +14 -21
- package/node_modules/markdown-it/node_modules/entities/dist/index.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/index.js +91 -0
- package/node_modules/markdown-it/node_modules/entities/dist/index.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.d.ts +17 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.js +18 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.d.ts +7 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.js +17 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.d.ts +33 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.d.ts.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.js +93 -0
- package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.js.map +1 -0
- package/node_modules/markdown-it/node_modules/entities/package.json +63 -70
- package/node_modules/markdown-it/node_modules/entities/readme.md +54 -45
- package/node_modules/markdown-it/node_modules/entities/src/decode-codepoint.ts +50 -0
- package/node_modules/markdown-it/node_modules/entities/src/decode.ts +671 -0
- package/node_modules/markdown-it/node_modules/entities/src/encode.ts +95 -0
- package/node_modules/markdown-it/node_modules/entities/src/escape.ts +160 -0
- package/node_modules/markdown-it/node_modules/entities/src/generated/decode-data-html.ts +7 -0
- package/node_modules/markdown-it/node_modules/entities/src/generated/decode-data-xml.ts +7 -0
- package/node_modules/markdown-it/node_modules/entities/src/generated/encode-html.ts +18 -0
- package/node_modules/markdown-it/node_modules/entities/src/index.ts +162 -0
- package/node_modules/markdown-it/node_modules/entities/src/internal/bin-trie-flags.ts +16 -0
- package/node_modules/markdown-it/node_modules/entities/src/internal/decode-shared.ts +18 -0
- package/node_modules/markdown-it/node_modules/entities/src/internal/encode-shared.ts +123 -0
- package/node_modules/markdown-it/node_modules/linkify-it/README.md +49 -86
- package/node_modules/markdown-it/node_modules/linkify-it/build/index.cjs.js +636 -825
- package/node_modules/markdown-it/node_modules/linkify-it/build/index.cjs.js.map +1 -0
- package/node_modules/markdown-it/node_modules/linkify-it/build/index.d.ts +236 -0
- package/node_modules/markdown-it/node_modules/linkify-it/build/index.mjs +538 -0
- package/node_modules/markdown-it/node_modules/linkify-it/build/index.mjs.map +1 -0
- package/node_modules/markdown-it/node_modules/linkify-it/package.json +23 -20
- package/node_modules/markdown-it/node_modules/uc.micro/README.md +18 -1
- package/node_modules/markdown-it/node_modules/uc.micro/build/index.cjs.js +13 -18
- package/node_modules/markdown-it/node_modules/uc.micro/build/index.d.ts +6 -0
- package/node_modules/markdown-it/node_modules/uc.micro/build/index.mjs +8 -0
- package/node_modules/markdown-it/node_modules/uc.micro/package.json +12 -17
- package/node_modules/markdown-it/package.json +47 -30
- package/node_modules/matrix-js-sdk/CHANGELOG.md +0 -11
- package/node_modules/matrix-js-sdk/package.json +1 -1
- package/node_modules/music-metadata/lib/common/Util.d.ts +1 -1
- package/node_modules/music-metadata/lib/common/Util.js +1 -7
- package/node_modules/music-metadata/lib/id3v2/FrameHeader.js +3 -23
- package/node_modules/music-metadata/lib/id3v2/FrameParser.js +2 -2
- package/node_modules/music-metadata/lib/id3v2/ID3v2Token.js +1 -1
- package/node_modules/music-metadata/lib/mp4/AtomToken.js +13 -38
- package/node_modules/music-metadata/lib/mpeg/MpegParser.js +1 -1
- package/node_modules/music-metadata/package.json +6 -6
- package/node_modules/typebox/build/compile/validator.d.mts +4 -1
- package/node_modules/typebox/build/guard/guard.d.mts +1 -1
- package/node_modules/typebox/build/guard/guard.mjs +2 -5
- package/node_modules/typebox/build/guard/string.mjs +4 -16
- package/node_modules/typebox/build/schema/engine/_functions.mjs +15 -34
- package/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
- package/node_modules/typebox/build/type/action/readonly_object.mjs +0 -8
- package/node_modules/typebox/build/typebox.d.mts +1 -1
- package/node_modules/typebox/build/typebox.mjs +1 -1
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +32 -29
- package/openclaw.plugin.json +146 -152
- package/package.json +31 -114
- package/dist/accounts-DfngqebB.js +0 -130
- package/dist/active-client-DXvz2gCo.js +0 -20
- package/dist/approval-reactions-D-BxBK_L.js +0 -202
- package/dist/client-Dbso3-0V.js +0 -30
- package/dist/client-bootstrap-XsIkHNt0.js +0 -110
- package/dist/create-client-BmSU-q-D.js +0 -61
- package/dist/credentials-W2EmwRhu.js +0 -65
- package/dist/credentials-read-DVmFCm7X.js +0 -77
- package/dist/doctor-CM8ijNpW.js +0 -64
- package/dist/doctor-contract-BMSJkkAE.js +0 -167
- package/dist/inbound-dedupe-CaBLblef.js +0 -48
- package/dist/probe.runtime-BuieqmS3.js +0 -3
- package/dist/record-shared-CWWx6fvI.js +0 -2
- package/dist/recovery-key-store-BNnHvXdk.js +0 -275
- package/dist/room-info-CAFZ3Z9J.js +0 -87
- package/dist/route-DY6at4qJ.js +0 -161
- package/dist/storage-BvAkgzvT.js +0 -685
- package/node_modules/markdown-it/dist/index.cjs.js.map +0 -1
- package/node_modules/markdown-it/dist/markdown-it.js +0 -3975
- package/node_modules/markdown-it/dist/markdown-it.js.map +0 -1
- package/node_modules/markdown-it/dist/markdown-it.min.js +0 -3
- package/node_modules/markdown-it/dist/markdown-it.min.js.map +0 -1
- package/node_modules/markdown-it/index.mjs +0 -1
- package/node_modules/markdown-it/lib/common/html_blocks.mjs +0 -67
- package/node_modules/markdown-it/lib/common/html_re.mjs +0 -25
- package/node_modules/markdown-it/lib/common/utils.mjs +0 -324
- package/node_modules/markdown-it/lib/helpers/index.mjs +0 -11
- package/node_modules/markdown-it/lib/helpers/parse_link_destination.mjs +0 -77
- package/node_modules/markdown-it/lib/helpers/parse_link_label.mjs +0 -49
- package/node_modules/markdown-it/lib/helpers/parse_link_title.mjs +0 -66
- package/node_modules/markdown-it/lib/index.mjs +0 -565
- package/node_modules/markdown-it/lib/parser_block.mjs +0 -134
- package/node_modules/markdown-it/lib/parser_core.mjs +0 -62
- package/node_modules/markdown-it/lib/parser_inline.mjs +0 -197
- package/node_modules/markdown-it/lib/presets/commonmark.mjs +0 -88
- package/node_modules/markdown-it/lib/presets/default.mjs +0 -47
- package/node_modules/markdown-it/lib/presets/zero.mjs +0 -70
- package/node_modules/markdown-it/lib/renderer.mjs +0 -322
- package/node_modules/markdown-it/lib/ruler.mjs +0 -340
- package/node_modules/markdown-it/lib/rules_block/blockquote.mjs +0 -209
- package/node_modules/markdown-it/lib/rules_block/code.mjs +0 -30
- package/node_modules/markdown-it/lib/rules_block/fence.mjs +0 -94
- package/node_modules/markdown-it/lib/rules_block/heading.mjs +0 -51
- package/node_modules/markdown-it/lib/rules_block/hr.mjs +0 -40
- package/node_modules/markdown-it/lib/rules_block/html_block.mjs +0 -80
- package/node_modules/markdown-it/lib/rules_block/lheading.mjs +0 -85
- package/node_modules/markdown-it/lib/rules_block/list.mjs +0 -331
- package/node_modules/markdown-it/lib/rules_block/paragraph.mjs +0 -48
- package/node_modules/markdown-it/lib/rules_block/reference.mjs +0 -212
- package/node_modules/markdown-it/lib/rules_block/state_block.mjs +0 -220
- package/node_modules/markdown-it/lib/rules_block/table.mjs +0 -228
- package/node_modules/markdown-it/lib/rules_core/block.mjs +0 -13
- package/node_modules/markdown-it/lib/rules_core/inline.mjs +0 -11
- package/node_modules/markdown-it/lib/rules_core/linkify.mjs +0 -134
- package/node_modules/markdown-it/lib/rules_core/normalize.mjs +0 -17
- package/node_modules/markdown-it/lib/rules_core/replacements.mjs +0 -101
- package/node_modules/markdown-it/lib/rules_core/smartquotes.mjs +0 -209
- package/node_modules/markdown-it/lib/rules_core/state_core.mjs +0 -17
- package/node_modules/markdown-it/lib/rules_core/text_join.mjs +0 -43
- package/node_modules/markdown-it/lib/rules_inline/autolink.mjs +0 -72
- package/node_modules/markdown-it/lib/rules_inline/backticks.mjs +0 -60
- package/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs +0 -124
- package/node_modules/markdown-it/lib/rules_inline/emphasis.mjs +0 -123
- package/node_modules/markdown-it/lib/rules_inline/entity.mjs +0 -51
- package/node_modules/markdown-it/lib/rules_inline/escape.mjs +0 -83
- package/node_modules/markdown-it/lib/rules_inline/fragments_join.mjs +0 -38
- package/node_modules/markdown-it/lib/rules_inline/html_inline.mjs +0 -50
- package/node_modules/markdown-it/lib/rules_inline/image.mjs +0 -138
- package/node_modules/markdown-it/lib/rules_inline/link.mjs +0 -139
- package/node_modules/markdown-it/lib/rules_inline/linkify.mjs +0 -63
- package/node_modules/markdown-it/lib/rules_inline/newline.mjs +0 -42
- package/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +0 -154
- package/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs +0 -127
- package/node_modules/markdown-it/lib/rules_inline/text.mjs +0 -86
- package/node_modules/markdown-it/lib/token.mjs +0 -191
- package/node_modules/markdown-it/node_modules/argparse/CHANGELOG.md +0 -216
- package/node_modules/markdown-it/node_modules/entities/lib/decode.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/decode.js +0 -536
- package/node_modules/markdown-it/node_modules/entities/lib/decode.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.d.ts +0 -19
- package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.js +0 -76
- package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/encode.d.ts +0 -22
- package/node_modules/markdown-it/node_modules/entities/lib/encode.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/encode.js +0 -77
- package/node_modules/markdown-it/node_modules/entities/lib/encode.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/escape.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/escape.js +0 -122
- package/node_modules/markdown-it/node_modules/entities/lib/escape.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode.d.ts +0 -211
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.d.ts +0 -19
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.js +0 -71
- package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/encode.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/encode.js +0 -69
- package/node_modules/markdown-it/node_modules/entities/lib/esm/encode.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.d.ts +0 -43
- package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.js +0 -116
- package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.d.ts +0 -3
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.js +0 -7
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts +0 -3
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.js +0 -7
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.d.ts +0 -8
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.js +0 -10
- package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/index.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/index.js +0 -99
- package/node_modules/markdown-it/node_modules/entities/lib/esm/index.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/esm/package.json +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.d.ts +0 -3
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.js +0 -9
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.d.ts +0 -3
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.js +0 -9
- package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.d.ts +0 -8
- package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.js +0 -12
- package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.js.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/index.d.ts +0 -96
- package/node_modules/markdown-it/node_modules/entities/lib/index.d.ts.map +0 -1
- package/node_modules/markdown-it/node_modules/entities/lib/index.js +0 -126
- package/node_modules/markdown-it/node_modules/entities/lib/index.js.map +0 -1
- package/node_modules/markdown-it/node_modules/linkify-it/index.mjs +0 -646
- package/node_modules/markdown-it/node_modules/linkify-it/lib/re.mjs +0 -193
- package/node_modules/markdown-it/node_modules/uc.micro/categories/Cc/regex.mjs +0 -1
- package/node_modules/markdown-it/node_modules/uc.micro/categories/Cf/regex.mjs +0 -1
- package/node_modules/markdown-it/node_modules/uc.micro/categories/P/regex.mjs +0 -1
- package/node_modules/markdown-it/node_modules/uc.micro/categories/S/regex.mjs +0 -1
- package/node_modules/markdown-it/node_modules/uc.micro/categories/Z/regex.mjs +0 -1
- package/node_modules/markdown-it/node_modules/uc.micro/index.mjs +0 -8
- package/node_modules/markdown-it/node_modules/uc.micro/properties/Any/regex.mjs +0 -1
- /package/dist/{account-config-BZWN9tGS.js → .setup/account-config-BZWN9tGS.mjs} +0 -0
- /package/dist/{backup-health-Dm_YMVFT.js → .setup/backup-health-Dm_YMVFT.mjs} +0 -0
- /package/dist/{config-paths-CnREYb1Y.js → .setup/config-paths-CnREYb1Y.mjs} +0 -0
- /package/dist/{config-secret-input.runtime-CwsP3--c.js → .setup/config-secret-input.runtime-CwsP3--c.mjs} +0 -0
- /package/dist/{crypto-node.runtime-6Aj_ltHQ.js → .setup/crypto-node.runtime-6Aj_ltHQ.mjs} +0 -0
- /package/dist/{errors-C47hvAF8.js → .setup/errors-C47hvAF8.mjs} +0 -0
- /package/dist/{preflight-audio.runtime-BZxxQsxY.js → .setup/preflight-audio.runtime-BZxxQsxY.mjs} +0 -0
- /package/dist/{reaction-common-DkrQdBSZ.js → .setup/reaction-common-DkrQdBSZ.mjs} +0 -0
- /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
- /package/dist/{runtime-6S3DNFNv.js → .setup/runtime-6S3DNFNv.mjs} +0 -0
- /package/dist/{runtime-BefyhPWv.js → .setup/runtime-BefyhPWv.mjs} +0 -0
- /package/dist/{sync-state-CWbp0QSY.js → .setup/sync-state-CWbp0QSY.mjs} +0 -0
- /package/dist/{target-ids-B-5aQxwn.js → .setup/target-ids-B-5aQxwn.mjs} +0 -0
- /package/dist/{thread-bindings-shared-CKnY4LSd.js → .setup/thread-bindings-shared-CKnY4LSd.mjs} +0 -0
- /package/dist/{timeout-abort-signal-DMrgRFIy.js → .setup/timeout-abort-signal-DMrgRFIy.mjs} +0 -0
- /package/dist/{url-validation-GRHde6lq.js → .setup/url-validation-GRHde6lq.mjs} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as getMatrixScopedEnvVarNames } from "./env-vars-
|
|
1
|
+
import { t as getMatrixScopedEnvVarNames } from "./env-vars-KzaYveuy.mjs";
|
|
2
2
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
3
3
|
//#region extensions/matrix/src/matrix/client/env-auth.ts
|
|
4
4
|
function cleanEnv(value) {
|
|
@@ -60,4 +60,4 @@ function resolveMatrixEnvAuthReadiness(accountId, env = process.env) {
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
//#endregion
|
|
63
|
-
export {
|
|
63
|
+
export { resolveMatrixEnvAuthReadiness as n, resolveScopedMatrixEnvConfig as r, resolveGlobalMatrixEnvConfig as t };
|
|
@@ -54,9 +54,7 @@ function listMatrixEnvAccountIds(env = process.env) {
|
|
|
54
54
|
for (const key of Object.keys(env)) {
|
|
55
55
|
const match = MATRIX_SCOPED_ENV_RE.exec(key);
|
|
56
56
|
if (!match) continue;
|
|
57
|
-
const
|
|
58
|
-
if (!encodedAccountId) continue;
|
|
59
|
-
const accountId = decodeMatrixEnvAccountToken(encodedAccountId);
|
|
57
|
+
const accountId = decodeMatrixEnvAccountToken(match[1]);
|
|
60
58
|
if (accountId) ids.add(accountId);
|
|
61
59
|
}
|
|
62
60
|
return Array.from(ids).toSorted((a, b) => a.localeCompare(b));
|
package/dist/{exec-approval-resolver-BCgqRtZS.js → .setup/exec-approval-resolver-f9j6staN.mjs}
RENAMED
|
@@ -2,10 +2,9 @@ import { isApprovalNotFoundError } from "openclaw/plugin-sdk/error-runtime";
|
|
|
2
2
|
import { resolveApprovalOverGateway } from "openclaw/plugin-sdk/approval-gateway-runtime";
|
|
3
3
|
//#region extensions/matrix/src/exec-approval-resolver.ts
|
|
4
4
|
async function resolveMatrixApproval(params) {
|
|
5
|
-
|
|
5
|
+
await resolveApprovalOverGateway({
|
|
6
6
|
cfg: params.cfg,
|
|
7
7
|
approvalId: params.approvalId,
|
|
8
|
-
approvalKind: params.approvalKind,
|
|
9
8
|
decision: params.decision,
|
|
10
9
|
senderId: params.senderId,
|
|
11
10
|
gatewayUrl: params.gatewayUrl,
|
|
@@ -1,30 +1,14 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.
|
|
2
|
-
import {
|
|
3
|
-
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
|
+
import { o as isRecord } from "./account-selection-BOQeTqax.mjs";
|
|
3
|
+
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.mjs";
|
|
4
|
+
import { O as resolveMatrixSqliteStateEnv } from "./crypto-state-store-B43k3z3W.mjs";
|
|
5
|
+
import { t as claimCurrentTokenStorageState } from "./storage-NGZq5zet.mjs";
|
|
6
|
+
import { t as createAsyncLock } from "./async-lock-BcLS4KOc.mjs";
|
|
7
|
+
import { n as LogService } from "./logger-DpoogOgz.mjs";
|
|
7
8
|
import path from "node:path";
|
|
9
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
8
10
|
import fs from "node:fs/promises";
|
|
9
11
|
import { Category, MemoryStore, SyncAccumulator } from "matrix-js-sdk/lib/matrix.js";
|
|
10
|
-
//#region extensions/matrix/src/matrix/async-lock.ts
|
|
11
|
-
function createAsyncLock() {
|
|
12
|
-
let lock = Promise.resolve();
|
|
13
|
-
return async function withLock(fn) {
|
|
14
|
-
const previous = lock;
|
|
15
|
-
let release;
|
|
16
|
-
lock = new Promise((resolve) => {
|
|
17
|
-
release = resolve;
|
|
18
|
-
});
|
|
19
|
-
await previous;
|
|
20
|
-
try {
|
|
21
|
-
return await fn();
|
|
22
|
-
} finally {
|
|
23
|
-
release?.();
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
//#endregion
|
|
28
12
|
//#region extensions/matrix/src/matrix/client/file-sync-store.ts
|
|
29
13
|
var file_sync_store_exports = /* @__PURE__ */ __exportAll({
|
|
30
14
|
SqliteBackedMatrixSyncStore: () => SqliteBackedMatrixSyncStore,
|
|
@@ -37,7 +21,7 @@ const STORE_VERSION = 1;
|
|
|
37
21
|
const PERSIST_DEBOUNCE_MS = 250;
|
|
38
22
|
const SYNC_CACHE_NAMESPACE = "sync-cache";
|
|
39
23
|
const SYNC_CACHE_MAX_ENTRIES = 2e4;
|
|
40
|
-
const SYNC_CACHE_MAX_CHUNKS = Math.floor(
|
|
24
|
+
const SYNC_CACHE_MAX_CHUNKS = Math.floor(19999 / 2);
|
|
41
25
|
const SYNC_CACHE_STATE_KEY = "current";
|
|
42
26
|
const SYNC_CACHE_CHUNK_BYTES = 24e3;
|
|
43
27
|
function normalizeRoomsData(value) {
|
|
@@ -108,6 +92,7 @@ var SqliteBackedMatrixSyncStore = class extends MemoryStore {
|
|
|
108
92
|
this.savedSync = null;
|
|
109
93
|
this.cleanShutdown = false;
|
|
110
94
|
this.dirty = false;
|
|
95
|
+
this.frozen = false;
|
|
111
96
|
this.persistTimer = null;
|
|
112
97
|
this.persistPromise = null;
|
|
113
98
|
this.stateKey = SYNC_CACHE_STATE_KEY;
|
|
@@ -154,6 +139,7 @@ var SqliteBackedMatrixSyncStore = class extends MemoryStore {
|
|
|
154
139
|
return Promise.resolve(this.savedSync?.nextBatch ?? null);
|
|
155
140
|
}
|
|
156
141
|
setSyncData(syncData) {
|
|
142
|
+
if (this.frozen) return Promise.resolve();
|
|
157
143
|
this.accumulator.accumulate(syncData);
|
|
158
144
|
this.savedSync = this.accumulator.getJSON();
|
|
159
145
|
this.markDirtyAndSchedulePersist();
|
|
@@ -163,6 +149,7 @@ var SqliteBackedMatrixSyncStore = class extends MemoryStore {
|
|
|
163
149
|
return Promise.resolve(this.savedClientOptions ? cloneJson(this.savedClientOptions) : void 0);
|
|
164
150
|
}
|
|
165
151
|
storeClientOptions(options) {
|
|
152
|
+
if (this.frozen) return Promise.resolve();
|
|
166
153
|
this.savedClientOptions = cloneJson(options);
|
|
167
154
|
super.storeClientOptions(options);
|
|
168
155
|
this.markDirtyAndSchedulePersist();
|
|
@@ -195,6 +182,23 @@ var SqliteBackedMatrixSyncStore = class extends MemoryStore {
|
|
|
195
182
|
this.cleanShutdown = true;
|
|
196
183
|
this.dirty = true;
|
|
197
184
|
}
|
|
185
|
+
async freezeSyncCursorPersistence() {
|
|
186
|
+
this.frozen = true;
|
|
187
|
+
if (this.persistTimer) {
|
|
188
|
+
clearTimeout(this.persistTimer);
|
|
189
|
+
this.persistTimer = null;
|
|
190
|
+
}
|
|
191
|
+
await this.persistPromise;
|
|
192
|
+
}
|
|
193
|
+
discardPendingSyncCursorPersistence() {
|
|
194
|
+
this.frozen = true;
|
|
195
|
+
if (this.persistTimer) {
|
|
196
|
+
clearTimeout(this.persistTimer);
|
|
197
|
+
this.persistTimer = null;
|
|
198
|
+
}
|
|
199
|
+
this.cleanShutdown = false;
|
|
200
|
+
this.dirty = false;
|
|
201
|
+
}
|
|
198
202
|
async flush() {
|
|
199
203
|
if (this.persistTimer) {
|
|
200
204
|
clearTimeout(this.persistTimer);
|
|
@@ -208,6 +212,7 @@ var SqliteBackedMatrixSyncStore = class extends MemoryStore {
|
|
|
208
212
|
}
|
|
209
213
|
}
|
|
210
214
|
markDirtyAndSchedulePersist() {
|
|
215
|
+
if (this.frozen) return;
|
|
211
216
|
this.cleanShutdown = false;
|
|
212
217
|
this.dirty = true;
|
|
213
218
|
if (this.persistTimer) return;
|
|
@@ -1,39 +1,48 @@
|
|
|
1
|
-
import { t as buildTimeoutAbortSignal } from "./timeout-abort-signal-DMrgRFIy.
|
|
2
|
-
import { parseMediaContentLength } from "openclaw/plugin-sdk/media-runtime";
|
|
1
|
+
import { t as buildTimeoutAbortSignal } from "./timeout-abort-signal-DMrgRFIy.mjs";
|
|
3
2
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
3
|
+
import { parseMediaContentLength } from "openclaw/plugin-sdk/media-runtime";
|
|
4
4
|
import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
5
5
|
import { fetchWithRuntimeDispatcherOrMockedGlobal } from "openclaw/plugin-sdk/runtime-fetch";
|
|
6
6
|
import { closeDispatcher, createPinnedDispatcher, resolvePinnedHostnameWithPolicy } from "openclaw/plugin-sdk/ssrf-dispatcher";
|
|
7
7
|
//#region extensions/matrix/src/matrix/sdk/event-helpers.ts
|
|
8
8
|
function matrixEventToRaw(event, opts = {}) {
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const normalizedContent = relation && !Object.hasOwn(content, "m.relates_to") ? {
|
|
13
|
-
...content,
|
|
14
|
-
"m.relates_to": relation
|
|
15
|
-
} : content;
|
|
9
|
+
const unsigned = event.getUnsigned?.() ?? {};
|
|
10
|
+
const eventWithOriginalContent = event;
|
|
11
|
+
const normalizedContent = preserveMatrixRelation(event, (opts.contentMode === "original" ? eventWithOriginalContent.getOriginalContent?.() ?? event.getContent?.() ?? {} : event.getContent?.() ?? eventWithOriginalContent.getOriginalContent?.() ?? {}) || {});
|
|
16
12
|
const raw = {
|
|
17
13
|
event_id: event.getId() ?? "",
|
|
18
14
|
sender: event.getSender() ?? "",
|
|
19
15
|
type: event.getType() ?? "",
|
|
20
16
|
origin_server_ts: event.getTs() ?? 0,
|
|
21
17
|
content: normalizedContent,
|
|
22
|
-
unsigned
|
|
18
|
+
unsigned
|
|
23
19
|
};
|
|
24
|
-
const stateKey =
|
|
20
|
+
const stateKey = resolveMatrixStateKey(event);
|
|
25
21
|
if (typeof stateKey === "string") raw.state_key = stateKey;
|
|
26
22
|
return raw;
|
|
27
23
|
}
|
|
24
|
+
function preserveMatrixRelation(event, content) {
|
|
25
|
+
if (Object.hasOwn(content, "m.relates_to")) return content;
|
|
26
|
+
const relation = resolveMatrixRelation(event);
|
|
27
|
+
return relation ? {
|
|
28
|
+
...content,
|
|
29
|
+
"m.relates_to": relation
|
|
30
|
+
} : content;
|
|
31
|
+
}
|
|
32
|
+
function resolveMatrixRelation(event) {
|
|
33
|
+
const originalRelation = (event.getOriginalContent?.())?.["m.relates_to"];
|
|
34
|
+
if (originalRelation) return originalRelation;
|
|
35
|
+
const wireRelation = (event.getWireContent?.())?.["m.relates_to"];
|
|
36
|
+
if (wireRelation) return wireRelation;
|
|
37
|
+
const rawContent = event.event?.content;
|
|
38
|
+
if (rawContent && typeof rawContent === "object") return rawContent["m.relates_to"];
|
|
39
|
+
}
|
|
28
40
|
function parseMxc(url) {
|
|
29
41
|
const match = /^mxc:\/\/([^/]+)\/(.+)$/.exec(url.trim());
|
|
30
42
|
if (!match) return null;
|
|
31
|
-
const server = match[1];
|
|
32
|
-
const mediaId = match[2];
|
|
33
|
-
if (!server || !mediaId) return null;
|
|
34
43
|
return {
|
|
35
|
-
server,
|
|
36
|
-
mediaId
|
|
44
|
+
server: match[1],
|
|
45
|
+
mediaId: match[2]
|
|
37
46
|
};
|
|
38
47
|
}
|
|
39
48
|
function buildHttpError(statusCode, bodyText) {
|
|
@@ -47,6 +56,14 @@ function buildHttpError(statusCode, bodyText) {
|
|
|
47
56
|
}
|
|
48
57
|
return Object.assign(new Error(message), { statusCode });
|
|
49
58
|
}
|
|
59
|
+
function resolveMatrixStateKey(event) {
|
|
60
|
+
const direct = event.getStateKey?.();
|
|
61
|
+
if (typeof direct === "string") return direct;
|
|
62
|
+
const wireContent = event.getWireContent?.();
|
|
63
|
+
if (wireContent && typeof wireContent.state_key === "string") return wireContent.state_key;
|
|
64
|
+
const rawEvent = event.event;
|
|
65
|
+
if (rawEvent && typeof rawEvent.state_key === "string") return rawEvent.state_key;
|
|
66
|
+
}
|
|
50
67
|
//#endregion
|
|
51
68
|
//#region extensions/matrix/src/matrix/media-errors.ts
|
|
52
69
|
const MATRIX_MEDIA_SIZE_LIMIT_ERROR_MESSAGE = "Matrix media exceeds configured size limit";
|
|
@@ -72,8 +89,8 @@ async function readResponseWithLimit$1(res, maxBytes, opts) {
|
|
|
72
89
|
}
|
|
73
90
|
//#endregion
|
|
74
91
|
//#region extensions/matrix/src/matrix/sdk/transport.ts
|
|
75
|
-
const MATRIX_JSON_RESPONSE_MAX_BYTES =
|
|
76
|
-
const MATRIX_SDK_RESPONSE_MAX_BYTES =
|
|
92
|
+
const MATRIX_JSON_RESPONSE_MAX_BYTES = 8388608;
|
|
93
|
+
const MATRIX_SDK_RESPONSE_MAX_BYTES = 67108864;
|
|
77
94
|
function normalizeEndpoint(endpoint) {
|
|
78
95
|
if (!endpoint) return "/";
|
|
79
96
|
return endpoint.startsWith("/") ? endpoint : `/${endpoint}`;
|
|
@@ -160,7 +177,8 @@ async function fetchWithMatrixGuardedRedirects(params) {
|
|
|
160
177
|
for (let redirectCount = 0; redirectCount <= maxRedirects; redirectCount += 1) {
|
|
161
178
|
let dispatcher;
|
|
162
179
|
try {
|
|
163
|
-
|
|
180
|
+
const pinned = await resolvePinnedHostnameWithPolicy(currentUrl.hostname, { policy: params.ssrfPolicy });
|
|
181
|
+
dispatcher = createPinnedDispatcher(pinned, params.dispatcherPolicy, params.ssrfPolicy);
|
|
164
182
|
const response = await fetchWithMatrixDispatcher({
|
|
165
183
|
url: currentUrl.toString(),
|
|
166
184
|
init: {
|
|
@@ -211,7 +229,7 @@ async function fetchWithMatrixGuardedRedirects(params) {
|
|
|
211
229
|
headers.delete("content-type");
|
|
212
230
|
headers.delete("content-length");
|
|
213
231
|
}
|
|
214
|
-
response.body?.cancel()
|
|
232
|
+
response.body?.cancel();
|
|
215
233
|
await closeDispatcher(dispatcher);
|
|
216
234
|
currentUrl = nextUrl;
|
|
217
235
|
} catch (error) {
|
|
@@ -260,10 +278,12 @@ async function performMatrixRequest(params) {
|
|
|
260
278
|
headers.set("Accept", params.raw ? "*/*" : "application/json");
|
|
261
279
|
if (params.accessToken) headers.set("Authorization", `Bearer ${params.accessToken}`);
|
|
262
280
|
let body;
|
|
263
|
-
if (params.body !== void 0)
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
281
|
+
if (params.body !== void 0) {
|
|
282
|
+
if (params.body instanceof Uint8Array || params.body instanceof ArrayBuffer || typeof params.body === "string") body = params.body;
|
|
283
|
+
else {
|
|
284
|
+
headers.set("Content-Type", "application/json");
|
|
285
|
+
body = JSON.stringify(params.body);
|
|
286
|
+
}
|
|
267
287
|
}
|
|
268
288
|
const { response, release } = await fetchWithMatrixGuardedRedirects({
|
|
269
289
|
url: baseUrl.toString(),
|
|
@@ -337,7 +357,7 @@ var MatrixAuthedHttpClient = class {
|
|
|
337
357
|
allowAbsoluteEndpoint: params.allowAbsoluteEndpoint
|
|
338
358
|
});
|
|
339
359
|
if (!response.ok) throw buildHttpError(response.status, text);
|
|
340
|
-
if ((response.headers.get("content-type") ?? "").
|
|
360
|
+
if ((response.headers.get("content-type") ?? "").includes("application/json")) {
|
|
341
361
|
if (!text.trim()) return {};
|
|
342
362
|
try {
|
|
343
363
|
return JSON.parse(text);
|
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
import
|
|
5
|
-
import { toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
|
+
import { g as readMatrixIdbSnapshotJson, t as MATRIX_IDB_SNAPSHOT_FILENAME, x as writeMatrixIdbSnapshotJson } from "./crypto-state-store-B43k3z3W.mjs";
|
|
3
|
+
import { n as LogService } from "./logger-DpoogOgz.mjs";
|
|
4
|
+
import { n as MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS } from "./idb-persistence-lock-B3fZXyF_.mjs";
|
|
6
5
|
import fs from "node:fs";
|
|
7
|
-
import
|
|
6
|
+
import path from "node:path";
|
|
8
7
|
import { indexedDB } from "fake-indexeddb";
|
|
8
|
+
import { withFileLock } from "openclaw/plugin-sdk/file-lock";
|
|
9
9
|
//#region extensions/matrix/src/matrix/sdk/idb-persistence.ts
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
var MatrixIdbSnapshotMigrationRequiredError = class extends Error {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(`${LEGACY_SNAPSHOT_DIAGNOSTIC.message}; run ${LEGACY_SNAPSHOT_DIAGNOSTIC.remediation}`);
|
|
18
|
-
this.code = LEGACY_SNAPSHOT_DIAGNOSTIC.code;
|
|
19
|
-
this.remediation = LEGACY_SNAPSHOT_DIAGNOSTIC.remediation;
|
|
20
|
-
this.name = "MatrixIdbSnapshotMigrationRequiredError";
|
|
21
|
-
}
|
|
22
|
-
};
|
|
10
|
+
var idb_persistence_exports = /* @__PURE__ */ __exportAll({
|
|
11
|
+
persistIdbToDisk: () => persistIdbToDisk,
|
|
12
|
+
readLegacyMatrixIdbSnapshotState: () => readLegacyMatrixIdbSnapshotState,
|
|
13
|
+
restoreIdbFromDisk: () => restoreIdbFromDisk
|
|
14
|
+
});
|
|
23
15
|
function isValidIdbIndexSnapshot(value) {
|
|
24
16
|
if (!value || typeof value !== "object") return false;
|
|
25
17
|
const candidate = value;
|
|
@@ -46,17 +38,10 @@ function parseSnapshotPayload(data) {
|
|
|
46
38
|
if (!parsed.every((entry) => isValidIdbDatabaseSnapshot(entry))) throw new Error("Malformed IndexedDB snapshot payload");
|
|
47
39
|
return parsed;
|
|
48
40
|
}
|
|
49
|
-
function isValidMatrixIdbSnapshotJson(data) {
|
|
50
|
-
try {
|
|
51
|
-
return parseSnapshotPayload(data) !== null;
|
|
52
|
-
} catch {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
41
|
function idbReq(req) {
|
|
57
42
|
return new Promise((resolve, reject) => {
|
|
58
43
|
req.addEventListener("success", () => resolve(req.result), { once: true });
|
|
59
|
-
req.addEventListener("error", () => reject(
|
|
44
|
+
req.addEventListener("error", () => reject(toLintErrorObject(req.error, "Non-Error rejection")), { once: true });
|
|
60
45
|
});
|
|
61
46
|
}
|
|
62
47
|
async function dumpIndexedDatabases(databasePrefix) {
|
|
@@ -70,7 +55,7 @@ async function dumpIndexedDatabases(databasePrefix) {
|
|
|
70
55
|
const db = await new Promise((resolve, reject) => {
|
|
71
56
|
const r = idb.open(name, version);
|
|
72
57
|
r.addEventListener("success", () => resolve(r.result), { once: true });
|
|
73
|
-
r.addEventListener("error", () => reject(
|
|
58
|
+
r.addEventListener("error", () => reject(toLintErrorObject(r.error, "Non-Error rejection")), { once: true });
|
|
74
59
|
});
|
|
75
60
|
const stores = [];
|
|
76
61
|
for (const storeName of db.objectStoreNames) {
|
|
@@ -142,7 +127,7 @@ async function restoreIndexedDatabases(snapshot) {
|
|
|
142
127
|
resolve();
|
|
143
128
|
})().catch(reject);
|
|
144
129
|
}, { once: true });
|
|
145
|
-
r.addEventListener("error", () => reject(
|
|
130
|
+
r.addEventListener("error", () => reject(toLintErrorObject(r.error, "Non-Error rejection")), { once: true });
|
|
146
131
|
});
|
|
147
132
|
}
|
|
148
133
|
function resolveDefaultIdbSnapshotPath() {
|
|
@@ -150,83 +135,96 @@ function resolveDefaultIdbSnapshotPath() {
|
|
|
150
135
|
return path.join(stateDir, "matrix", "crypto-idb-snapshot.json");
|
|
151
136
|
}
|
|
152
137
|
async function restoreIdbFromDisk(snapshotPath) {
|
|
153
|
-
const
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
138
|
+
const candidatePaths = snapshotPath ? [snapshotPath] : [resolveDefaultIdbSnapshotPath()];
|
|
139
|
+
for (const resolvedPath of candidatePaths) {
|
|
140
|
+
const storageRootDir = path.dirname(resolvedPath);
|
|
141
|
+
try {
|
|
142
|
+
if (await withFileLock(resolvedPath, MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, async () => {
|
|
143
|
+
try {
|
|
144
|
+
const storedSnapshotJson = readMatrixIdbSnapshotJson(storageRootDir);
|
|
145
|
+
if (storedSnapshotJson) {
|
|
146
|
+
const snapshot = parseSnapshotPayload(storedSnapshotJson);
|
|
147
|
+
if (snapshot) {
|
|
148
|
+
await restoreIndexedDatabases(snapshot);
|
|
149
|
+
LogService.info("IdbPersistence", `Restored ${snapshot.length} IndexedDB database(s) from Matrix SQLite state`);
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
} catch (err) {
|
|
154
|
+
LogService.warn("IdbPersistence", "Failed to restore IndexedDB snapshot from SQLite:", err);
|
|
155
|
+
}
|
|
156
|
+
if (!fs.existsSync(resolvedPath)) return false;
|
|
157
|
+
const data = fs.readFileSync(resolvedPath, "utf8");
|
|
158
|
+
const snapshot = parseSnapshotPayload(data);
|
|
159
|
+
if (!snapshot) return false;
|
|
160
|
+
let migratedToSqlite = false;
|
|
161
|
+
try {
|
|
162
|
+
writeMatrixIdbSnapshotJson({
|
|
163
|
+
storageRootDir,
|
|
164
|
+
snapshotJson: data,
|
|
165
|
+
databaseCount: snapshot.length
|
|
166
|
+
});
|
|
167
|
+
archiveLegacyIdbSnapshotFile(resolvedPath);
|
|
168
|
+
migratedToSqlite = true;
|
|
169
|
+
} catch (err) {
|
|
170
|
+
LogService.warn("IdbPersistence", `Failed to migrate IndexedDB snapshot to SQLite from ${resolvedPath}:`, err);
|
|
171
|
+
}
|
|
172
|
+
await restoreIndexedDatabases(snapshot);
|
|
173
|
+
LogService.info("IdbPersistence", migratedToSqlite ? `Migrated and restored ${snapshot.length} IndexedDB database(s) from ${resolvedPath}` : `Restored ${snapshot.length} IndexedDB database(s) from legacy snapshot ${resolvedPath}`);
|
|
174
|
+
return true;
|
|
175
|
+
})) return true;
|
|
176
|
+
} catch (err) {
|
|
177
|
+
LogService.warn("IdbPersistence", `Failed to restore IndexedDB snapshot from ${resolvedPath}:`, err);
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
179
180
|
}
|
|
181
|
+
return false;
|
|
180
182
|
}
|
|
181
183
|
async function persistIdbToDisk(params) {
|
|
182
184
|
const snapshotPath = params?.snapshotPath ?? resolveDefaultIdbSnapshotPath();
|
|
183
|
-
let callbackStarted = false;
|
|
184
185
|
try {
|
|
185
186
|
fs.mkdirSync(path.dirname(snapshotPath), { recursive: true });
|
|
186
187
|
const persistedCount = await withFileLock(snapshotPath, MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, async () => {
|
|
187
|
-
callbackStarted = true;
|
|
188
|
-
const storageRootDir = path.dirname(snapshotPath);
|
|
189
|
-
let storedSnapshotJson;
|
|
190
|
-
try {
|
|
191
|
-
storedSnapshotJson = readMatrixIdbSnapshotJson(storageRootDir);
|
|
192
|
-
} catch (err) {
|
|
193
|
-
if (fs.existsSync(snapshotPath)) throwLegacySnapshotMigrationRequired();
|
|
194
|
-
throw err;
|
|
195
|
-
}
|
|
196
|
-
throwIfLegacySnapshotNeedsDoctor(snapshotPath, storedSnapshotJson);
|
|
197
188
|
const snapshot = await dumpIndexedDatabases(params?.databasePrefix);
|
|
198
189
|
if (snapshot.length === 0) return 0;
|
|
199
190
|
writeMatrixIdbSnapshotJson({
|
|
200
|
-
storageRootDir,
|
|
191
|
+
storageRootDir: path.dirname(snapshotPath),
|
|
201
192
|
snapshotJson: JSON.stringify(snapshot),
|
|
202
193
|
databaseCount: snapshot.length
|
|
203
194
|
});
|
|
195
|
+
archiveLegacyIdbSnapshotFile(snapshotPath);
|
|
204
196
|
return snapshot.length;
|
|
205
197
|
});
|
|
206
198
|
if (persistedCount === 0) return;
|
|
207
199
|
LogService.debug("IdbPersistence", `Persisted ${persistedCount} IndexedDB database(s) to Matrix SQLite state`);
|
|
208
200
|
} catch (err) {
|
|
209
|
-
if (err instanceof MatrixIdbSnapshotMigrationRequiredError) throw err;
|
|
210
|
-
if (!callbackStarted && fs.existsSync(snapshotPath)) throwLegacySnapshotMigrationRequired();
|
|
211
201
|
LogService.warn("IdbPersistence", "Failed to persist IndexedDB snapshot:", err);
|
|
202
|
+
if (params?.strict) throw err;
|
|
212
203
|
}
|
|
213
204
|
}
|
|
214
|
-
function
|
|
205
|
+
async function readLegacyMatrixIdbSnapshotState(storageRootDir) {
|
|
215
206
|
const snapshotPath = path.join(storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
|
|
216
207
|
if (!fs.existsSync(snapshotPath)) return null;
|
|
217
|
-
const data = fs.readFileSync(snapshotPath, "utf8");
|
|
218
208
|
try {
|
|
219
|
-
return
|
|
209
|
+
return await withFileLock(snapshotPath, MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, async () => {
|
|
210
|
+
return parseSnapshotPayload(fs.readFileSync(snapshotPath, "utf8"));
|
|
211
|
+
});
|
|
220
212
|
} catch {
|
|
221
213
|
return null;
|
|
222
214
|
}
|
|
223
215
|
}
|
|
224
|
-
function
|
|
225
|
-
if (fs.existsSync(snapshotPath)
|
|
216
|
+
function archiveLegacyIdbSnapshotFile(snapshotPath) {
|
|
217
|
+
if (!fs.existsSync(snapshotPath)) return;
|
|
218
|
+
const archivedPath = `${snapshotPath}.migrated`;
|
|
219
|
+
if (fs.existsSync(archivedPath)) return;
|
|
220
|
+
fs.renameSync(snapshotPath, archivedPath);
|
|
226
221
|
}
|
|
227
|
-
function
|
|
228
|
-
|
|
229
|
-
|
|
222
|
+
function toLintErrorObject(value, fallbackMessage) {
|
|
223
|
+
if (value instanceof Error) return value;
|
|
224
|
+
if (typeof value === "string") return new Error(value);
|
|
225
|
+
const error = new Error(fallbackMessage, { cause: value });
|
|
226
|
+
if (typeof value === "object" && value !== null || typeof value === "function") Object.assign(error, value);
|
|
227
|
+
return error;
|
|
230
228
|
}
|
|
231
229
|
//#endregion
|
|
232
|
-
export { restoreIdbFromDisk as i, persistIdbToDisk as n,
|
|
230
|
+
export { restoreIdbFromDisk as i, persistIdbToDisk as n, readLegacyMatrixIdbSnapshotState as r, idb_persistence_exports as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region extensions/matrix/src/matrix/sdk/idb-persistence-lock.ts
|
|
2
2
|
const MATRIX_IDB_PERSIST_INTERVAL_MS = 6e4;
|
|
3
|
-
const IDB_SNAPSHOT_LOCK_STALE_MS =
|
|
3
|
+
const IDB_SNAPSHOT_LOCK_STALE_MS = 3e5;
|
|
4
4
|
const IDB_SNAPSHOT_LOCK_RETRY_BASE = {
|
|
5
5
|
factor: 2,
|
|
6
6
|
minTimeout: 50,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { t as ensureMatrixCryptoRuntime } from "./deps-Dy6yreL4.mjs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import crypto from "node:crypto";
|
|
6
|
+
//#region extensions/matrix/src/matrix/legacy-crypto-inspector.ts
|
|
7
|
+
const MATRIX_CRYPTO_STORE_SQLITE = 0;
|
|
8
|
+
function resolveLegacyMachineStorePath(params) {
|
|
9
|
+
const hashedDir = path.join(params.cryptoRootDir, crypto.createHash("sha256").update(params.deviceId).digest("hex"));
|
|
10
|
+
if (fs.existsSync(path.join(hashedDir, "matrix-sdk-crypto.sqlite3"))) return hashedDir;
|
|
11
|
+
if (fs.existsSync(path.join(params.cryptoRootDir, "matrix-sdk-crypto.sqlite3"))) return params.cryptoRootDir;
|
|
12
|
+
const match = fs.readdirSync(params.cryptoRootDir, { withFileTypes: true }).find((entry) => entry.isDirectory() && fs.existsSync(path.join(params.cryptoRootDir, entry.name, "matrix-sdk-crypto.sqlite3")));
|
|
13
|
+
return match ? path.join(params.cryptoRootDir, match.name) : null;
|
|
14
|
+
}
|
|
15
|
+
async function inspectLegacyMatrixCryptoStore(params) {
|
|
16
|
+
const machineStorePath = resolveLegacyMachineStorePath(params);
|
|
17
|
+
if (!machineStorePath) throw new Error(`Matrix legacy crypto store not found for device ${params.deviceId}`);
|
|
18
|
+
const requireFn = createRequire(import.meta.url);
|
|
19
|
+
await ensureMatrixCryptoRuntime({
|
|
20
|
+
requireFn,
|
|
21
|
+
resolveFn: requireFn.resolve.bind(requireFn),
|
|
22
|
+
log: params.log
|
|
23
|
+
});
|
|
24
|
+
const { DeviceId, OlmMachine, UserId } = requireFn("@matrix-org/matrix-sdk-crypto-nodejs");
|
|
25
|
+
const machine = await OlmMachine.initialize(new UserId(params.userId), new DeviceId(params.deviceId), machineStorePath, "", MATRIX_CRYPTO_STORE_SQLITE);
|
|
26
|
+
try {
|
|
27
|
+
const [backupKeys, roomKeyCounts] = await Promise.all([machine.getBackupKeys(), machine.roomKeyCounts()]);
|
|
28
|
+
return {
|
|
29
|
+
deviceId: params.deviceId,
|
|
30
|
+
roomKeyCounts: roomKeyCounts ? {
|
|
31
|
+
total: typeof roomKeyCounts.total === "number" ? roomKeyCounts.total : 0,
|
|
32
|
+
backedUp: typeof roomKeyCounts.backedUp === "number" ? roomKeyCounts.backedUp : 0
|
|
33
|
+
} : null,
|
|
34
|
+
backupVersion: typeof backupKeys?.backupVersion === "string" && backupKeys.backupVersion.trim() ? backupKeys.backupVersion : null,
|
|
35
|
+
decryptionKeyBase64: typeof backupKeys?.decryptionKeyBase64 === "string" && backupKeys.decryptionKeyBase64.trim() ? backupKeys.decryptionKeyBase64 : null
|
|
36
|
+
};
|
|
37
|
+
} finally {
|
|
38
|
+
machine.close();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { inspectLegacyMatrixCryptoStore };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.mjs";
|
|
2
|
+
import { C as writeMatrixLegacyCryptoMigrationState, _ as readMatrixLegacyCryptoMigrationState, s as migrateLegacyMatrixLegacyCryptoMigrationFileToStore } from "./crypto-state-store-B43k3z3W.mjs";
|
|
3
|
+
import { l as resolveMatrixStoragePaths } from "./storage-NGZq5zet.mjs";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import fs from "node:fs/promises";
|
|
7
|
+
//#region extensions/matrix/src/matrix/monitor/legacy-crypto-restore.ts
|
|
8
|
+
async function resolvePendingMigrationStateRoot(params) {
|
|
9
|
+
const { rootDir } = resolveMatrixStoragePaths({
|
|
10
|
+
homeserver: params.auth.homeserver,
|
|
11
|
+
userId: params.auth.userId,
|
|
12
|
+
accessToken: params.auth.accessToken,
|
|
13
|
+
accountId: params.auth.accountId,
|
|
14
|
+
deviceId: params.auth.deviceId,
|
|
15
|
+
stateDir: params.stateDir
|
|
16
|
+
});
|
|
17
|
+
try {
|
|
18
|
+
migrateLegacyMatrixLegacyCryptoMigrationFileToStore(rootDir);
|
|
19
|
+
} catch {}
|
|
20
|
+
const directValue = readMatrixLegacyCryptoMigrationState(rootDir);
|
|
21
|
+
if (directValue?.restoreStatus === "pending") return {
|
|
22
|
+
storageRootDir: rootDir,
|
|
23
|
+
value: directValue
|
|
24
|
+
};
|
|
25
|
+
const accountStorageDir = path.dirname(rootDir);
|
|
26
|
+
let siblingEntries;
|
|
27
|
+
try {
|
|
28
|
+
siblingEntries = (await fs.readdir(accountStorageDir, { withFileTypes: true })).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((entry) => path.join(accountStorageDir, entry) !== rootDir).toSorted((left, right) => left.localeCompare(right));
|
|
29
|
+
} catch {
|
|
30
|
+
return {
|
|
31
|
+
storageRootDir: rootDir,
|
|
32
|
+
value: directValue
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
for (const sibling of siblingEntries) {
|
|
36
|
+
const siblingRootDir = path.join(accountStorageDir, sibling);
|
|
37
|
+
try {
|
|
38
|
+
migrateLegacyMatrixLegacyCryptoMigrationFileToStore(siblingRootDir);
|
|
39
|
+
} catch {}
|
|
40
|
+
const value = readMatrixLegacyCryptoMigrationState(siblingRootDir);
|
|
41
|
+
if (value?.restoreStatus === "pending") return {
|
|
42
|
+
storageRootDir: siblingRootDir,
|
|
43
|
+
value
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
storageRootDir: rootDir,
|
|
48
|
+
value: directValue
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
async function maybeRestoreLegacyMatrixBackup(params) {
|
|
52
|
+
const env = params.env ?? process.env;
|
|
53
|
+
const { storageRootDir, value } = await resolvePendingMigrationStateRoot({
|
|
54
|
+
stateDir: params.stateDir ?? getMatrixRuntime().state.resolveStateDir(env, os.homedir),
|
|
55
|
+
auth: params.auth
|
|
56
|
+
});
|
|
57
|
+
if (value?.restoreStatus !== "pending") return { kind: "skipped" };
|
|
58
|
+
const restore = await params.client.restoreRoomKeyBackup();
|
|
59
|
+
const localOnlyKeys = value.roomKeyCounts && value.roomKeyCounts.total > value.roomKeyCounts.backedUp ? value.roomKeyCounts.total - value.roomKeyCounts.backedUp : 0;
|
|
60
|
+
if (restore.success) {
|
|
61
|
+
writeMatrixLegacyCryptoMigrationState({
|
|
62
|
+
storageRootDir,
|
|
63
|
+
state: {
|
|
64
|
+
...value,
|
|
65
|
+
restoreStatus: "completed",
|
|
66
|
+
restoredAt: restore.restoredAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
67
|
+
importedCount: restore.imported,
|
|
68
|
+
totalCount: restore.total,
|
|
69
|
+
lastError: null
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
kind: "restored",
|
|
74
|
+
imported: restore.imported,
|
|
75
|
+
total: restore.total,
|
|
76
|
+
localOnlyKeys
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
writeMatrixLegacyCryptoMigrationState({
|
|
80
|
+
storageRootDir,
|
|
81
|
+
state: {
|
|
82
|
+
...value,
|
|
83
|
+
lastError: restore.error ?? "unknown"
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
return {
|
|
87
|
+
kind: "failed",
|
|
88
|
+
error: restore.error ?? "unknown",
|
|
89
|
+
localOnlyKeys
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
export { maybeRestoreLegacyMatrixBackup };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.
|
|
1
|
+
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.mjs";
|
|
2
2
|
import { format } from "node:util";
|
|
3
3
|
import { redactSensitiveText } from "openclaw/plugin-sdk/logging-core";
|
|
4
4
|
//#region extensions/matrix/src/matrix/sdk/logger.ts
|