@openclaw/matrix 2026.9.5 → 2026.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.setup/{account-selection-5koohRSQ.mjs → account-selection-BHkfU1eC.mjs} +10 -1
- package/dist/.setup/{accounts-BF5hyc-1.mjs → accounts-iThMol10.mjs} +38 -37
- package/dist/.setup/{approval-handler.runtime-CoZCYGUH.mjs → approval-handler.runtime-9W7R2ZMq.mjs} +6 -6
- package/dist/.setup/{approval-ids-CZOcdJ-5.mjs → approval-ids-j08q8LEG.mjs} +1 -1
- package/dist/.setup/{approval-reaction-auth-B51E4ZDa.mjs → approval-reaction-auth-DMVE7VSp.mjs} +7 -3
- package/dist/.setup/{channel-q6TBKEiG.mjs → channel-ConuJfxT.mjs} +43 -30
- package/dist/.setup/{channel.runtime-DcDBdxe6.mjs → channel.runtime-CnxR2JUK.mjs} +6 -6
- package/dist/.setup/{channel.setup-DZQ5rf9k.mjs → channel.setup-C6KvBV8l.mjs} +3 -3
- package/dist/.setup/{cli-Cx_cNaXN.mjs → cli-O196sg8g.mjs} +11 -11
- package/dist/.setup/{cli-metadata-DHU1H-Vr.mjs → cli-metadata-DFHQj5XR.mjs} +1 -1
- package/dist/.setup/{client-By2B3Wz4.mjs → client-C2yVkVdw.mjs} +2 -2
- package/dist/.setup/{client-DsJUnWlV.mjs → client-ChrXpxos.mjs} +84 -25
- package/dist/.setup/{client-bootstrap-DGX0f-4x.mjs → client-bootstrap-BSnUAoz1.mjs} +1 -1
- package/dist/.setup/{create-client-DQXAZjTw.mjs → create-client-CHxcron_.mjs} +13 -7
- package/dist/.setup/{credentials-CeRipapZ.mjs → credentials-BGKfiaJW.mjs} +1 -1
- package/dist/.setup/{credentials-read-Dp7BoEdm.mjs → credentials-read-Q5sHkkHv.mjs} +9 -1
- package/dist/.setup/{credentials-write.runtime-M_bUf3rL.mjs → credentials-write.runtime-DxbXh-pK.mjs} +1 -1
- package/dist/.setup/{crypto-runtime-9oxuU30y.mjs → crypto-runtime-D9qn_Pbj.mjs} +3 -3
- package/dist/.setup/{crypto-snapshot-doctor.runtime-DXpLbQ7y.mjs → crypto-snapshot-doctor.runtime-CMWa1d9Y.mjs} +2 -2
- package/dist/.setup/{directory-live-CatwztQc.mjs → directory-live-CxqkcYbT.mjs} +2 -2
- package/dist/.setup/{draft-stream-DIFZDNrb.mjs → draft-stream-y0Vq5f38.mjs} +21 -5
- package/dist/.setup/{encryption-guidance-DYEbeYj-.mjs → encryption-guidance-CMWXiBzJ.mjs} +1 -1
- package/dist/.setup/file-sync-store-CsalA4yI.mjs +213 -0
- package/dist/.setup/{http-client-BJjo-iw5.mjs → http-client-Bi6uKmzh.mjs} +17 -2
- package/dist/.setup/{idb-persistence-CIfFUjP3.mjs → idb-persistence-c8uxcofH.mjs} +1 -1
- package/dist/.setup/{messages-SW0NPYnR.mjs → messages-COuAcrz-.mjs} +10 -3
- package/dist/.setup/{monitor-DQfYX5rA.mjs → monitor-CzE3myC_.mjs} +127 -233
- package/dist/.setup/{outbound-DRWtSUe-.mjs → outbound-B508VPBM.mjs} +1 -1
- package/dist/.setup/probe.runtime-C-NMeYk2.mjs +2 -0
- package/dist/.setup/{profile-update-DPttQz3-.mjs → profile-update-DrblJttE.mjs} +1 -1
- package/dist/.setup/{reaction-events-CdAk_rh_.mjs → reaction-events-BvZmhjLC.mjs} +4 -3
- package/dist/.setup/{resolve-targets-drjgAdIe.mjs → resolve-targets-BLz748lX.mjs} +1 -1
- package/dist/.setup/{resolver.runtime-Ci6ddcPh.mjs → resolver.runtime-CuLQ2uHe.mjs} +1 -1
- package/dist/.setup/{room-info-DHd1j3qM.mjs → room-info-DTyP1k5g.mjs} +3 -3
- package/dist/.setup/{sdk-BkKE4ANj.mjs → sdk-rqFjgltR.mjs} +6 -225
- package/dist/.setup/{send-h0gZ_-qk.mjs → send-aVdC5NJO.mjs} +23 -26
- package/dist/.setup/{setup-bootstrap-BYgBD504.mjs → setup-bootstrap-A_WGFq1Y.mjs} +2 -2
- package/dist/.setup/{setup-core-BUcDAM7q.mjs → setup-core-D2hMbIi3.mjs} +3 -3
- package/dist/.setup/{setup-plugin-api-DoTm4v2q.mjs → setup-plugin-api-JiRgm8s6.mjs} +1 -1
- package/dist/.setup/{setup-surface-V_Q-enq-.mjs → setup-surface-BL3ha1l-.mjs} +6 -6
- package/dist/.setup/{startup-verification-Bq5qeEGn.mjs → startup-verification-Cp1Gf7pM.mjs} +7 -7
- package/dist/.setup/{storage-DJ-oUgmX.mjs → storage-BXaFc0S4.mjs} +75 -86
- package/dist/.setup/{storage-metadata-BQJjHC_i.mjs → storage-metadata-fHN6Df2m.mjs} +29 -45
- package/dist/.setup/{sync-cache-state-CFiZIPhA.mjs → sync-cache-state-BMtGMxU1.mjs} +30 -43
- package/dist/.setup/{thread-bindings-Hy96ujd3.mjs → thread-bindings-JlnLDfPM.mjs} +5 -5
- package/dist/.setup/{tool-actions.runtime-Dckttu43.mjs → tool-actions.runtime-REzYTNxm.mjs} +16 -8
- package/dist/.setup/{verification-CKqBZ9mI.mjs → verification-0o8MOW9T.mjs} +2 -2
- package/dist/api.js +5 -5
- package/dist/channel-plugin-api.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/contract-api.js +2 -2
- package/dist/doctor-contract-api.js +6 -6
- package/dist/helper-api.js +2 -2
- package/dist/index.js +1 -1
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/runtime-api.js +1 -1
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/node_modules/markdown-it/node_modules/argparse/lib/argparse.js +18 -2
- package/node_modules/markdown-it/node_modules/argparse/package.json +1 -1
- package/node_modules/matrix-js-sdk/node_modules/@babel/runtime/package.json +1 -1
- package/node_modules/music-metadata/node_modules/file-type/package.json +3 -2
- package/node_modules/music-metadata/node_modules/file-type/readme.md +3 -0
- package/node_modules/music-metadata/node_modules/file-type/source/index.js +28 -1
- package/node_modules/music-metadata/node_modules/file-type/source/supported.js +2 -0
- package/node_modules/zod/README.md +2 -2
- package/node_modules/zod/compile.cjs +19 -0
- package/node_modules/zod/index.cjs +19 -0
- package/node_modules/zod/locales/index.cjs +19 -0
- package/node_modules/zod/mini/index.cjs +19 -0
- package/node_modules/zod/package.json +8 -7
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +1 -1
- package/node_modules/zod/src/v4/classic/external.ts +2 -0
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +248 -25
- package/node_modules/zod/src/v4/classic/schemas.ts +243 -168
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +60 -9
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +6 -0
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +265 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +112 -6
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +9 -0
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +130 -1
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +157 -0
- package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +40 -2
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +27 -7
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +88 -56
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +56 -0
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +3 -2
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +70 -0
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +46 -1
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +19 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +95 -1
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +33 -1
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +234 -38
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +569 -0
- package/node_modules/zod/src/v4/core/api.ts +44 -28
- package/node_modules/zod/src/v4/core/checks.ts +62 -102
- package/node_modules/zod/src/v4/core/compile.ts +218 -93
- package/node_modules/zod/src/v4/core/core.ts +1 -3
- package/node_modules/zod/src/v4/core/doc.ts +6 -2
- package/node_modules/zod/src/v4/core/errors.ts +3 -6
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +2 -2
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +185 -81
- package/node_modules/zod/src/v4/core/memoizer.ts +75 -28
- package/node_modules/zod/src/v4/core/parse.ts +37 -16
- package/node_modules/zod/src/v4/core/regexes.ts +14 -4
- package/node_modules/zod/src/v4/core/schemas.ts +296 -132
- package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +35 -0
- package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +399 -2
- package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
- package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
- package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +118 -16
- package/node_modules/zod/src/v4/core/to-json-schema.ts +9 -7
- package/node_modules/zod/src/v4/core/util.ts +218 -147
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/locales/ar.ts +2 -0
- package/node_modules/zod/src/v4/locales/az.ts +2 -0
- package/node_modules/zod/src/v4/locales/be.ts +2 -0
- package/node_modules/zod/src/v4/locales/bg.ts +2 -0
- package/node_modules/zod/src/v4/locales/bn.ts +2 -0
- package/node_modules/zod/src/v4/locales/ca.ts +2 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +2 -0
- package/node_modules/zod/src/v4/locales/cs.ts +2 -0
- package/node_modules/zod/src/v4/locales/da.ts +2 -0
- package/node_modules/zod/src/v4/locales/de.ts +2 -0
- package/node_modules/zod/src/v4/locales/el.ts +2 -0
- package/node_modules/zod/src/v4/locales/en.ts +2 -0
- package/node_modules/zod/src/v4/locales/eo.ts +2 -0
- package/node_modules/zod/src/v4/locales/es.ts +2 -0
- package/node_modules/zod/src/v4/locales/fa.ts +2 -0
- package/node_modules/zod/src/v4/locales/fi.ts +2 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +2 -0
- package/node_modules/zod/src/v4/locales/fr.ts +2 -0
- package/node_modules/zod/src/v4/locales/gu.ts +2 -0
- package/node_modules/zod/src/v4/locales/he.ts +2 -0
- package/node_modules/zod/src/v4/locales/hi.ts +2 -0
- package/node_modules/zod/src/v4/locales/hr.ts +2 -0
- package/node_modules/zod/src/v4/locales/hu.ts +2 -0
- package/node_modules/zod/src/v4/locales/hy.ts +2 -0
- package/node_modules/zod/src/v4/locales/id.ts +2 -0
- package/node_modules/zod/src/v4/locales/index.ts +1 -0
- package/node_modules/zod/src/v4/locales/is.ts +2 -0
- package/node_modules/zod/src/v4/locales/it.ts +2 -0
- package/node_modules/zod/src/v4/locales/ja.ts +2 -0
- package/node_modules/zod/src/v4/locales/ka.ts +2 -0
- package/node_modules/zod/src/v4/locales/km.ts +2 -0
- package/node_modules/zod/src/v4/locales/kn.ts +2 -0
- package/node_modules/zod/src/v4/locales/ko.ts +2 -0
- package/node_modules/zod/src/v4/locales/lt.ts +2 -0
- package/node_modules/zod/src/v4/locales/mk.ts +2 -0
- package/node_modules/zod/src/v4/locales/ms.ts +2 -0
- package/node_modules/zod/src/v4/locales/ne.ts +2 -0
- package/node_modules/zod/src/v4/locales/nl.ts +2 -0
- package/node_modules/zod/src/v4/locales/nn.ts +2 -0
- package/node_modules/zod/src/v4/locales/no.ts +2 -0
- package/node_modules/zod/src/v4/locales/ota.ts +2 -0
- package/node_modules/zod/src/v4/locales/pl.ts +2 -0
- package/node_modules/zod/src/v4/locales/ps.ts +2 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +2 -0
- package/node_modules/zod/src/v4/locales/pt.ts +2 -0
- package/node_modules/zod/src/v4/locales/ro.ts +2 -0
- package/node_modules/zod/src/v4/locales/ru.ts +2 -0
- package/node_modules/zod/src/v4/locales/sk.ts +2 -0
- package/node_modules/zod/src/v4/locales/sl.ts +2 -0
- package/node_modules/zod/src/v4/locales/sv.ts +2 -0
- package/node_modules/zod/src/v4/locales/ta.ts +2 -0
- package/node_modules/zod/src/v4/locales/tg.ts +135 -0
- package/node_modules/zod/src/v4/locales/th.ts +2 -0
- package/node_modules/zod/src/v4/locales/tk.ts +2 -0
- package/node_modules/zod/src/v4/locales/tr.ts +2 -0
- package/node_modules/zod/src/v4/locales/uk.ts +2 -0
- package/node_modules/zod/src/v4/locales/ur.ts +2 -0
- package/node_modules/zod/src/v4/locales/uz.ts +2 -0
- package/node_modules/zod/src/v4/locales/vi.ts +2 -0
- package/node_modules/zod/src/v4/locales/yo.ts +2 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +2 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +2 -0
- package/node_modules/zod/src/v4/mini/external.ts +2 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +32 -7
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +1 -1
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +11 -17
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +86 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +16 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +23 -0
- package/node_modules/zod/v3/ZodError.cjs +19 -0
- package/node_modules/zod/v3/errors.cjs +19 -0
- package/node_modules/zod/v3/external.cjs +19 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +20 -1
- package/node_modules/zod/v3/helpers/errorUtil.js +1 -1
- package/node_modules/zod/v3/helpers/parseUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +19 -0
- package/node_modules/zod/v3/helpers/util.cjs +19 -0
- package/node_modules/zod/v3/index.cjs +19 -0
- package/node_modules/zod/v3/standard-schema.cjs +19 -0
- package/node_modules/zod/v3/types.cjs +19 -0
- package/node_modules/zod/v4/classic/checks.cjs +19 -0
- package/node_modules/zod/v4/classic/coerce.cjs +19 -0
- package/node_modules/zod/v4/classic/compat.cjs +19 -0
- package/node_modules/zod/v4/classic/deep-partial.cjs +19 -0
- package/node_modules/zod/v4/classic/errors.cjs +19 -0
- package/node_modules/zod/v4/classic/external.cjs +22 -1
- package/node_modules/zod/v4/classic/external.d.cts +1 -1
- package/node_modules/zod/v4/classic/external.d.ts +1 -1
- package/node_modules/zod/v4/classic/external.js +1 -1
- package/node_modules/zod/v4/classic/from-json-schema.cjs +264 -24
- package/node_modules/zod/v4/classic/from-json-schema.js +245 -24
- package/node_modules/zod/v4/classic/in-out.cjs +19 -0
- package/node_modules/zod/v4/classic/index.cjs +19 -0
- package/node_modules/zod/v4/classic/iso.cjs +19 -0
- package/node_modules/zod/v4/classic/parse.cjs +19 -0
- package/node_modules/zod/v4/classic/schemas.cjs +100 -35
- package/node_modules/zod/v4/classic/schemas.d.cts +15 -1
- package/node_modules/zod/v4/classic/schemas.d.ts +15 -1
- package/node_modules/zod/v4/classic/schemas.js +77 -33
- package/node_modules/zod/v4/core/api.cjs +45 -22
- package/node_modules/zod/v4/core/api.d.cts +12 -6
- package/node_modules/zod/v4/core/api.d.ts +12 -6
- package/node_modules/zod/v4/core/api.js +25 -22
- package/node_modules/zod/v4/core/checks.cjs +51 -97
- package/node_modules/zod/v4/core/checks.d.cts +17 -1
- package/node_modules/zod/v4/core/checks.d.ts +17 -1
- package/node_modules/zod/v4/core/checks.js +31 -96
- package/node_modules/zod/v4/core/compile.cjs +173 -78
- package/node_modules/zod/v4/core/compile.d.cts +18 -4
- package/node_modules/zod/v4/core/compile.d.ts +18 -4
- package/node_modules/zod/v4/core/compile.js +154 -79
- package/node_modules/zod/v4/core/core.cjs +20 -1
- package/node_modules/zod/v4/core/core.js +1 -1
- package/node_modules/zod/v4/core/doc.cjs +26 -2
- package/node_modules/zod/v4/core/doc.js +7 -2
- package/node_modules/zod/v4/core/errors.cjs +21 -5
- package/node_modules/zod/v4/core/errors.js +2 -5
- package/node_modules/zod/v4/core/index.cjs +19 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +20 -1
- package/node_modules/zod/v4/core/json-schema-generator.js +2 -2
- package/node_modules/zod/v4/core/json-schema-processors.cjs +188 -72
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +16 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +16 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +170 -74
- package/node_modules/zod/v4/core/json-schema.cjs +19 -0
- package/node_modules/zod/v4/core/memoizer.cjs +111 -23
- package/node_modules/zod/v4/core/memoizer.js +69 -23
- package/node_modules/zod/v4/core/parse.cjs +56 -16
- package/node_modules/zod/v4/core/parse.js +37 -16
- package/node_modules/zod/v4/core/regexes.cjs +31 -6
- package/node_modules/zod/v4/core/regexes.d.cts +3 -0
- package/node_modules/zod/v4/core/regexes.d.ts +3 -0
- package/node_modules/zod/v4/core/regexes.js +10 -4
- package/node_modules/zod/v4/core/registries.cjs +19 -0
- package/node_modules/zod/v4/core/schemas.cjs +302 -114
- package/node_modules/zod/v4/core/schemas.d.cts +28 -8
- package/node_modules/zod/v4/core/schemas.d.ts +28 -8
- package/node_modules/zod/v4/core/schemas.js +279 -113
- package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +28 -7
- package/node_modules/zod/v4/core/to-json-schema.d.cts +4 -3
- package/node_modules/zod/v4/core/to-json-schema.d.ts +4 -3
- package/node_modules/zod/v4/core/to-json-schema.js +7 -6
- package/node_modules/zod/v4/core/util.cjs +177 -143
- package/node_modules/zod/v4/core/util.d.cts +25 -4
- package/node_modules/zod/v4/core/util.d.ts +25 -4
- package/node_modules/zod/v4/core/util.js +156 -143
- package/node_modules/zod/v4/core/versions.cjs +21 -2
- package/node_modules/zod/v4/core/versions.d.cts +1 -1
- package/node_modules/zod/v4/core/versions.d.ts +1 -1
- package/node_modules/zod/v4/core/versions.js +2 -2
- package/node_modules/zod/v4/core/visit.cjs +19 -0
- package/node_modules/zod/v4/index.cjs +19 -0
- package/node_modules/zod/v4/locales/ar.cjs +2 -0
- package/node_modules/zod/v4/locales/ar.js +2 -0
- package/node_modules/zod/v4/locales/az.cjs +2 -0
- package/node_modules/zod/v4/locales/az.js +2 -0
- package/node_modules/zod/v4/locales/be.cjs +2 -0
- package/node_modules/zod/v4/locales/be.js +2 -0
- package/node_modules/zod/v4/locales/bg.cjs +2 -0
- package/node_modules/zod/v4/locales/bg.js +2 -0
- package/node_modules/zod/v4/locales/bn.cjs +2 -0
- package/node_modules/zod/v4/locales/bn.js +2 -0
- package/node_modules/zod/v4/locales/ca.cjs +2 -0
- package/node_modules/zod/v4/locales/ca.js +2 -0
- package/node_modules/zod/v4/locales/ckb.cjs +2 -0
- package/node_modules/zod/v4/locales/ckb.js +2 -0
- package/node_modules/zod/v4/locales/cs.cjs +2 -0
- package/node_modules/zod/v4/locales/cs.js +2 -0
- package/node_modules/zod/v4/locales/da.cjs +2 -0
- package/node_modules/zod/v4/locales/da.js +2 -0
- package/node_modules/zod/v4/locales/de.cjs +2 -0
- package/node_modules/zod/v4/locales/de.js +2 -0
- package/node_modules/zod/v4/locales/el.cjs +2 -0
- package/node_modules/zod/v4/locales/el.js +2 -0
- package/node_modules/zod/v4/locales/en.cjs +2 -0
- package/node_modules/zod/v4/locales/en.js +2 -0
- package/node_modules/zod/v4/locales/eo.cjs +2 -0
- package/node_modules/zod/v4/locales/eo.js +2 -0
- package/node_modules/zod/v4/locales/es.cjs +2 -0
- package/node_modules/zod/v4/locales/es.js +2 -0
- package/node_modules/zod/v4/locales/fa.cjs +2 -0
- package/node_modules/zod/v4/locales/fa.js +2 -0
- package/node_modules/zod/v4/locales/fi.cjs +2 -0
- package/node_modules/zod/v4/locales/fi.js +2 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +2 -0
- package/node_modules/zod/v4/locales/fr-CA.js +2 -0
- package/node_modules/zod/v4/locales/fr.cjs +2 -0
- package/node_modules/zod/v4/locales/fr.js +2 -0
- package/node_modules/zod/v4/locales/gu.cjs +2 -0
- package/node_modules/zod/v4/locales/gu.js +2 -0
- package/node_modules/zod/v4/locales/he.cjs +2 -0
- package/node_modules/zod/v4/locales/he.js +2 -0
- package/node_modules/zod/v4/locales/hi.cjs +2 -0
- package/node_modules/zod/v4/locales/hi.js +2 -0
- package/node_modules/zod/v4/locales/hr.cjs +2 -0
- package/node_modules/zod/v4/locales/hr.js +2 -0
- package/node_modules/zod/v4/locales/hu.cjs +2 -0
- package/node_modules/zod/v4/locales/hu.js +2 -0
- package/node_modules/zod/v4/locales/hy.cjs +2 -0
- package/node_modules/zod/v4/locales/hy.js +2 -0
- package/node_modules/zod/v4/locales/id.cjs +2 -0
- package/node_modules/zod/v4/locales/id.js +2 -0
- package/node_modules/zod/v4/locales/index.cjs +22 -1
- package/node_modules/zod/v4/locales/index.d.cts +1 -0
- package/node_modules/zod/v4/locales/index.d.ts +1 -0
- package/node_modules/zod/v4/locales/index.js +1 -0
- package/node_modules/zod/v4/locales/is.cjs +2 -0
- package/node_modules/zod/v4/locales/is.js +2 -0
- package/node_modules/zod/v4/locales/it.cjs +2 -0
- package/node_modules/zod/v4/locales/it.js +2 -0
- package/node_modules/zod/v4/locales/ja.cjs +2 -0
- package/node_modules/zod/v4/locales/ja.js +2 -0
- package/node_modules/zod/v4/locales/ka.cjs +2 -0
- package/node_modules/zod/v4/locales/ka.js +2 -0
- package/node_modules/zod/v4/locales/km.cjs +2 -0
- package/node_modules/zod/v4/locales/km.js +2 -0
- package/node_modules/zod/v4/locales/kn.cjs +2 -0
- package/node_modules/zod/v4/locales/kn.js +2 -0
- package/node_modules/zod/v4/locales/ko.cjs +2 -0
- package/node_modules/zod/v4/locales/ko.js +2 -0
- package/node_modules/zod/v4/locales/lt.cjs +2 -0
- package/node_modules/zod/v4/locales/lt.js +2 -0
- package/node_modules/zod/v4/locales/mk.cjs +2 -0
- package/node_modules/zod/v4/locales/mk.js +2 -0
- package/node_modules/zod/v4/locales/ms.cjs +2 -0
- package/node_modules/zod/v4/locales/ms.js +2 -0
- package/node_modules/zod/v4/locales/ne.cjs +2 -0
- package/node_modules/zod/v4/locales/ne.js +2 -0
- package/node_modules/zod/v4/locales/nl.cjs +2 -0
- package/node_modules/zod/v4/locales/nl.js +2 -0
- package/node_modules/zod/v4/locales/nn.cjs +2 -0
- package/node_modules/zod/v4/locales/nn.js +2 -0
- package/node_modules/zod/v4/locales/no.cjs +2 -0
- package/node_modules/zod/v4/locales/no.js +2 -0
- package/node_modules/zod/v4/locales/ota.cjs +2 -0
- package/node_modules/zod/v4/locales/ota.js +2 -0
- package/node_modules/zod/v4/locales/pl.cjs +2 -0
- package/node_modules/zod/v4/locales/pl.js +2 -0
- package/node_modules/zod/v4/locales/ps.cjs +2 -0
- package/node_modules/zod/v4/locales/ps.js +2 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +2 -0
- package/node_modules/zod/v4/locales/pt-BR.js +2 -0
- package/node_modules/zod/v4/locales/pt.cjs +2 -0
- package/node_modules/zod/v4/locales/pt.js +2 -0
- package/node_modules/zod/v4/locales/ro.cjs +2 -0
- package/node_modules/zod/v4/locales/ro.js +2 -0
- package/node_modules/zod/v4/locales/ru.cjs +2 -0
- package/node_modules/zod/v4/locales/ru.js +2 -0
- package/node_modules/zod/v4/locales/sk.cjs +2 -0
- package/node_modules/zod/v4/locales/sk.js +2 -0
- package/node_modules/zod/v4/locales/sl.cjs +2 -0
- package/node_modules/zod/v4/locales/sl.js +2 -0
- package/node_modules/zod/v4/locales/sv.cjs +2 -0
- package/node_modules/zod/v4/locales/sv.js +2 -0
- package/node_modules/zod/v4/locales/ta.cjs +2 -0
- package/node_modules/zod/v4/locales/ta.js +2 -0
- package/node_modules/zod/v4/locales/tg.cjs +144 -0
- package/node_modules/zod/v4/locales/tg.d.cts +5 -0
- package/node_modules/zod/v4/locales/tg.d.ts +4 -0
- package/node_modules/zod/v4/locales/tg.js +117 -0
- package/node_modules/zod/v4/locales/th.cjs +2 -0
- package/node_modules/zod/v4/locales/th.js +2 -0
- package/node_modules/zod/v4/locales/tk.cjs +2 -0
- package/node_modules/zod/v4/locales/tk.js +2 -0
- package/node_modules/zod/v4/locales/tr.cjs +2 -0
- package/node_modules/zod/v4/locales/tr.js +2 -0
- package/node_modules/zod/v4/locales/uk.cjs +2 -0
- package/node_modules/zod/v4/locales/uk.js +2 -0
- package/node_modules/zod/v4/locales/ur.cjs +2 -0
- package/node_modules/zod/v4/locales/ur.js +2 -0
- package/node_modules/zod/v4/locales/uz.cjs +2 -0
- package/node_modules/zod/v4/locales/uz.js +2 -0
- package/node_modules/zod/v4/locales/vi.cjs +2 -0
- package/node_modules/zod/v4/locales/vi.js +2 -0
- package/node_modules/zod/v4/locales/yo.cjs +2 -0
- package/node_modules/zod/v4/locales/yo.js +2 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +2 -0
- package/node_modules/zod/v4/locales/zh-CN.js +2 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +2 -0
- package/node_modules/zod/v4/locales/zh-TW.js +2 -0
- package/node_modules/zod/v4/mini/checks.cjs +19 -0
- package/node_modules/zod/v4/mini/coerce.cjs +19 -0
- package/node_modules/zod/v4/mini/deep-partial.cjs +19 -0
- package/node_modules/zod/v4/mini/external.cjs +22 -1
- package/node_modules/zod/v4/mini/external.d.cts +1 -1
- package/node_modules/zod/v4/mini/external.d.ts +1 -1
- package/node_modules/zod/v4/mini/external.js +1 -1
- package/node_modules/zod/v4/mini/in-out.cjs +19 -0
- package/node_modules/zod/v4/mini/index.cjs +19 -0
- package/node_modules/zod/v4/mini/iso.cjs +19 -0
- package/node_modules/zod/v4/mini/parse.cjs +19 -0
- package/node_modules/zod/v4/mini/schemas.cjs +44 -8
- package/node_modules/zod/v4/mini/schemas.d.cts +6 -1
- package/node_modules/zod/v4/mini/schemas.d.ts +6 -1
- package/node_modules/zod/v4/mini/schemas.js +21 -6
- package/node_modules/zod/v4-mini/index.cjs +19 -0
- package/package.json +7 -6
- package/dist/.setup/probe.runtime-qPRZE3Yf.mjs +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as getMatrixRuntime } from "./runtime-1kn1P6io.mjs";
|
|
2
2
|
import { n as isMatrixActiveTokenRootDirectory, r as resolveMatrixAccountStorageRoot } from "./storage-paths-DVCANXTc.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { S as scoreMatrixCryptoStateInStore, c as MATRIX_RECOVERY_KEY_FILENAME, d as migrateLegacyMatrixLegacyCryptoMigrationFileToStore, f as migrateLegacyMatrixRecoveryKeyFilePathToStoreAsync, i as openMatrixStorageMetaStoreOptions, o as MATRIX_IDB_SNAPSHOT_FILENAME, r as normalizeMatrixStorageMetadata, s as MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME, t as STORAGE_META_STATE_KEY } from "./storage-metadata-fHN6Df2m.mjs";
|
|
4
4
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import fs from "node:fs";
|
|
@@ -11,9 +11,9 @@ const DEFAULT_ACCOUNT_KEY = "default";
|
|
|
11
11
|
const STORAGE_META_FILENAME = "storage-meta.json";
|
|
12
12
|
const THREAD_BINDINGS_FILENAME = "thread-bindings.json";
|
|
13
13
|
function openStorageMetaStore(rootDir) {
|
|
14
|
-
return getMatrixRuntime().state.
|
|
14
|
+
return getMatrixRuntime().state.openKeyedStore(openMatrixStorageMetaStoreOptions(rootDir));
|
|
15
15
|
}
|
|
16
|
-
function scoreStorageRoot(rootDir, metadata
|
|
16
|
+
async function scoreStorageRoot(rootDir, metadata) {
|
|
17
17
|
let score = 0;
|
|
18
18
|
if (Object.keys(metadata).length > 0) score += 1;
|
|
19
19
|
if (metadata.currentTokenStateClaimed === true) score += 8;
|
|
@@ -22,7 +22,7 @@ function scoreStorageRoot(rootDir, metadata = readStoredRootMetadata(rootDir)) {
|
|
|
22
22
|
if (fs.existsSync(path.join(rootDir, "legacy-crypto-migration.json"))) score += 3;
|
|
23
23
|
if (fs.existsSync(path.join(rootDir, "recovery-key.json"))) score += 2;
|
|
24
24
|
if (fs.existsSync(path.join(rootDir, "crypto-idb-snapshot.json"))) score += 2;
|
|
25
|
-
score += scoreMatrixCryptoStateInStore(rootDir);
|
|
25
|
+
score += await scoreMatrixCryptoStateInStore(rootDir);
|
|
26
26
|
return score;
|
|
27
27
|
}
|
|
28
28
|
function resolveStorageRootMtimeMs(rootDir) {
|
|
@@ -32,15 +32,15 @@ function resolveStorageRootMtimeMs(rootDir) {
|
|
|
32
32
|
return 0;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
function readStoredRootMetadata(rootDir) {
|
|
35
|
+
async function readStoredRootMetadata(rootDir) {
|
|
36
36
|
if (fs.existsSync(path.join(rootDir, "state", "openclaw.sqlite"))) try {
|
|
37
|
-
const stored = normalizeMatrixStorageMetadata(openStorageMetaStore(rootDir).lookup(STORAGE_META_STATE_KEY));
|
|
37
|
+
const stored = normalizeMatrixStorageMetadata(await openStorageMetaStore(rootDir).lookup(STORAGE_META_STATE_KEY));
|
|
38
38
|
if (stored) return stored;
|
|
39
39
|
} catch {}
|
|
40
40
|
return normalizeMatrixStorageMetadata(loadJsonFile(path.join(rootDir, STORAGE_META_FILENAME))) ?? {};
|
|
41
41
|
}
|
|
42
42
|
function isCompatibleStorageRoot(params) {
|
|
43
|
-
const metadata =
|
|
43
|
+
const { metadata } = params;
|
|
44
44
|
if (metadata.homeserver && metadata.homeserver !== params.homeserver) return false;
|
|
45
45
|
if (metadata.userId && metadata.userId !== params.userId) return false;
|
|
46
46
|
if (metadata.accountId && normalizeAccountId(metadata.accountId) !== normalizeAccountId(params.accountKey)) return false;
|
|
@@ -48,17 +48,17 @@ function isCompatibleStorageRoot(params) {
|
|
|
48
48
|
if (params.requireExplicitDeviceMatch && params.deviceId && (!metadata.deviceId || metadata.deviceId.trim() !== params.deviceId.trim())) return false;
|
|
49
49
|
return true;
|
|
50
50
|
}
|
|
51
|
-
function resolvePreferredMatrixStorageRoot(params) {
|
|
51
|
+
async function resolvePreferredMatrixStorageRoot(params) {
|
|
52
52
|
const canonical = {
|
|
53
53
|
rootDir: params.canonicalRootDir,
|
|
54
54
|
tokenHash: params.canonicalTokenHash
|
|
55
55
|
};
|
|
56
56
|
const deviceId = params.deviceId?.trim();
|
|
57
57
|
if (!deviceId) return canonical;
|
|
58
|
-
const canonicalMetadata = readStoredRootMetadata(params.canonicalRootDir);
|
|
58
|
+
const canonicalMetadata = await readStoredRootMetadata(params.canonicalRootDir);
|
|
59
59
|
if (canonicalMetadata.accessTokenHash === params.canonicalTokenHash && canonicalMetadata.deviceId?.trim() === deviceId && canonicalMetadata.currentTokenStateClaimed === true) return canonical;
|
|
60
60
|
const parentDir = path.dirname(params.canonicalRootDir);
|
|
61
|
-
const bestCurrentScore = scoreStorageRoot(params.canonicalRootDir, canonicalMetadata);
|
|
61
|
+
const bestCurrentScore = await scoreStorageRoot(params.canonicalRootDir, canonicalMetadata);
|
|
62
62
|
const bestCurrentMtimeMs = resolveStorageRootMtimeMs(params.canonicalRootDir);
|
|
63
63
|
let best = {
|
|
64
64
|
rootDir: params.canonicalRootDir,
|
|
@@ -82,15 +82,16 @@ function resolvePreferredMatrixStorageRoot(params) {
|
|
|
82
82
|
if (entry.name === params.canonicalTokenHash) continue;
|
|
83
83
|
if (!isMatrixActiveTokenRootDirectory(entry.name)) continue;
|
|
84
84
|
const candidateRootDir = path.join(parentDir, entry.name);
|
|
85
|
+
const metadata = await readStoredRootMetadata(candidateRootDir);
|
|
85
86
|
if (!isCompatibleStorageRoot({
|
|
86
|
-
|
|
87
|
+
metadata,
|
|
87
88
|
homeserver: params.homeserver,
|
|
88
89
|
userId: params.userId,
|
|
89
90
|
accountKey: params.accountKey,
|
|
90
91
|
deviceId,
|
|
91
92
|
requireExplicitDeviceMatch: true
|
|
92
93
|
})) continue;
|
|
93
|
-
const candidateScore = scoreStorageRoot(candidateRootDir);
|
|
94
|
+
const candidateScore = await scoreStorageRoot(candidateRootDir, metadata);
|
|
94
95
|
if (candidateScore <= 0) continue;
|
|
95
96
|
populatedTokenHashes.push(entry.name);
|
|
96
97
|
compatiblePopulatedSiblings.push({
|
|
@@ -119,7 +120,7 @@ function resolvePreferredMatrixStorageRoot(params) {
|
|
|
119
120
|
tokenHash: best.tokenHash
|
|
120
121
|
};
|
|
121
122
|
}
|
|
122
|
-
function resolveMatrixStoragePaths(params) {
|
|
123
|
+
async function resolveMatrixStoragePaths(params) {
|
|
123
124
|
const env = params.env ?? process.env;
|
|
124
125
|
const stateDir = params.stateDir ?? getMatrixRuntime().state.resolveStateDir(env, os.homedir);
|
|
125
126
|
const canonical = resolveMatrixAccountStorageRoot({
|
|
@@ -129,7 +130,7 @@ function resolveMatrixStoragePaths(params) {
|
|
|
129
130
|
accessToken: params.accessToken,
|
|
130
131
|
accountId: params.accountId
|
|
131
132
|
});
|
|
132
|
-
const { rootDir, tokenHash } = resolvePreferredMatrixStorageRoot({
|
|
133
|
+
const { rootDir, tokenHash } = await resolvePreferredMatrixStorageRoot({
|
|
133
134
|
canonicalRootDir: canonical.rootDir,
|
|
134
135
|
canonicalTokenHash: canonical.tokenHash,
|
|
135
136
|
homeserver: params.homeserver,
|
|
@@ -147,8 +148,8 @@ function resolveMatrixStoragePaths(params) {
|
|
|
147
148
|
tokenHash
|
|
148
149
|
};
|
|
149
150
|
}
|
|
150
|
-
function resolveMatrixStateFilePath(params) {
|
|
151
|
-
const storagePaths = resolveMatrixStoragePaths({
|
|
151
|
+
async function resolveMatrixStateFilePath(params) {
|
|
152
|
+
const storagePaths = await resolveMatrixStoragePaths({
|
|
152
153
|
homeserver: params.auth.homeserver,
|
|
153
154
|
userId: params.auth.userId,
|
|
154
155
|
accessToken: params.auth.accessToken,
|
|
@@ -161,7 +162,7 @@ function resolveMatrixStateFilePath(params) {
|
|
|
161
162
|
}
|
|
162
163
|
async function maybeMigrateLegacyStorage(params) {
|
|
163
164
|
const hasAccountScopedLegacyStorageFile = fs.existsSync(params.storagePaths.storagePath);
|
|
164
|
-
const syncCache = hasAccountScopedLegacyStorageFile ? await import("./sync-cache-state-
|
|
165
|
+
const syncCache = hasAccountScopedLegacyStorageFile ? await import("./sync-cache-state-BMtGMxU1.mjs").then((n) => n.s) : null;
|
|
165
166
|
const hasAccountScopedLegacyStorage = hasAccountScopedLegacyStorageFile && await syncCache?.readLegacyMatrixSyncCacheState(params.storagePaths.rootDir) !== null;
|
|
166
167
|
const hasAccountScopedRecoveryKey = fs.existsSync(params.storagePaths.recoveryKeyPath);
|
|
167
168
|
const hasAccountScopedLegacyCryptoMigration = fs.existsSync(path.join(params.storagePaths.rootDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME));
|
|
@@ -181,7 +182,7 @@ async function maybeMigrateLegacyStorage(params) {
|
|
|
181
182
|
pendingArchives
|
|
182
183
|
});
|
|
183
184
|
if (hasAccountScopedRecoveryKey) {
|
|
184
|
-
|
|
185
|
+
await migrateLegacyMatrixRecoveryKeyFilePathToStoreAsync(params.storagePaths.recoveryKeyPath, getMatrixRuntime().state);
|
|
185
186
|
migrations.push({
|
|
186
187
|
sourcePath: params.storagePaths.recoveryKeyPath,
|
|
187
188
|
targetDescription: `${params.storagePaths.rootDir} SQLite recovery key state`,
|
|
@@ -189,7 +190,7 @@ async function maybeMigrateLegacyStorage(params) {
|
|
|
189
190
|
});
|
|
190
191
|
}
|
|
191
192
|
if (hasAccountScopedLegacyCryptoMigration) {
|
|
192
|
-
migrateLegacyMatrixLegacyCryptoMigrationFileToStore(params.storagePaths.rootDir);
|
|
193
|
+
await migrateLegacyMatrixLegacyCryptoMigrationFileToStore(params.storagePaths.rootDir);
|
|
193
194
|
migrations.push({
|
|
194
195
|
sourcePath: path.join(params.storagePaths.rootDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME),
|
|
195
196
|
targetDescription: `${params.storagePaths.rootDir} SQLite legacy crypto migration state`,
|
|
@@ -207,7 +208,7 @@ async function maybeMigrateLegacyStorage(params) {
|
|
|
207
208
|
if (skippedExistingTargets.length > 0) logger.warn?.(`matrix: legacy client storage files were left in place because their migrated targets already existed.\n${skippedExistingTargets.join("\n")}`);
|
|
208
209
|
}
|
|
209
210
|
async function migrateLegacySyncCacheToSqlite(params) {
|
|
210
|
-
const syncCache = await import("./sync-cache-state-
|
|
211
|
+
const syncCache = await import("./sync-cache-state-BMtGMxU1.mjs").then((n) => n.s);
|
|
211
212
|
const persisted = await syncCache.readLegacyMatrixSyncCacheState(params.sourceRootDir);
|
|
212
213
|
if (!persisted) return;
|
|
213
214
|
const store = getMatrixRuntime().state.openKeyedStore(syncCache.openMatrixSyncCacheStoreOptions(params.targetRootDir));
|
|
@@ -240,45 +241,35 @@ function archiveLegacyStoragePath(params) {
|
|
|
240
241
|
}
|
|
241
242
|
fs.renameSync(params.sourcePath, archivedLegacyStoragePath);
|
|
242
243
|
}
|
|
243
|
-
function
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
function writeStorageMeta(params) {
|
|
254
|
-
const existing = readStoredRootMetadata(params.storagePaths.rootDir);
|
|
255
|
-
return writeStoredRootMetadata(params.storagePaths.rootDir, {
|
|
256
|
-
homeserver: params.homeserver,
|
|
257
|
-
userId: params.userId,
|
|
258
|
-
accountId: params.accountId ?? DEFAULT_ACCOUNT_KEY,
|
|
259
|
-
accessTokenHash: params.storagePaths.tokenHash,
|
|
260
|
-
deviceId: params.deviceId ?? null,
|
|
261
|
-
currentTokenStateClaimed: params.currentTokenStateClaimed ?? existing.currentTokenStateClaimed === true,
|
|
262
|
-
createdAt: existing.createdAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
244
|
+
function prepareStorageMetaMutation(metadata, mutation) {
|
|
245
|
+
if (mutation.kind !== "initialize" && !metadata.accessTokenHash?.trim()) return null;
|
|
246
|
+
return normalizeMatrixStorageMetadata({
|
|
247
|
+
...mutation.kind === "initialize" ? mutation.metadata : metadata,
|
|
248
|
+
accountId: mutation.kind === "initialize" ? mutation.metadata.accountId : metadata.accountId ?? DEFAULT_ACCOUNT_KEY,
|
|
249
|
+
deviceId: mutation.kind === "device" ? mutation.deviceId : mutation.kind === "initialize" ? mutation.metadata.deviceId ?? metadata.deviceId : metadata.deviceId,
|
|
250
|
+
currentTokenStateClaimed: mutation.kind === "claim" || (mutation.kind === "initialize" ? mutation.metadata.currentTokenStateClaimed ?? metadata.currentTokenStateClaimed === true : metadata.currentTokenStateClaimed === true),
|
|
251
|
+
createdAt: metadata.createdAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
263
252
|
});
|
|
264
253
|
}
|
|
265
|
-
async function
|
|
254
|
+
async function mutateStorageMeta(rootDir, mutation) {
|
|
266
255
|
try {
|
|
267
|
-
const store =
|
|
268
|
-
|
|
256
|
+
const store = openStorageMetaStore(rootDir);
|
|
257
|
+
const decode = (value) => normalizeMatrixStorageMetadata(value) ?? normalizeMatrixStorageMetadata(loadJsonFile(path.join(rootDir, STORAGE_META_FILENAME))) ?? {};
|
|
258
|
+
if (!store.observe || !store.compareAndApply) {
|
|
259
|
+
const legacyStore = getMatrixRuntime().state.openSyncKeyedStore(openMatrixStorageMetaStoreOptions(rootDir));
|
|
260
|
+
const next = prepareStorageMetaMutation(decode(legacyStore.lookup(STORAGE_META_STATE_KEY)), mutation);
|
|
261
|
+
if (!next) return false;
|
|
262
|
+
legacyStore.register(STORAGE_META_STATE_KEY, next);
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
269
265
|
let observation = await store.observe(STORAGE_META_STATE_KEY);
|
|
270
266
|
for (;;) {
|
|
271
|
-
const
|
|
272
|
-
if (!
|
|
267
|
+
const next = prepareStorageMetaMutation(decode(observation.value), mutation);
|
|
268
|
+
if (!next) return false;
|
|
273
269
|
const result = await store.compareAndApply(STORAGE_META_STATE_KEY, observation.comparison, {
|
|
274
270
|
operation: "update",
|
|
275
271
|
action: "set",
|
|
276
|
-
value:
|
|
277
|
-
...metadata,
|
|
278
|
-
accountId: metadata.accountId ?? DEFAULT_ACCOUNT_KEY,
|
|
279
|
-
currentTokenStateClaimed: true,
|
|
280
|
-
createdAt: metadata.createdAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
281
|
-
}
|
|
272
|
+
value: next
|
|
282
273
|
});
|
|
283
274
|
if (result.status !== "conflict") return true;
|
|
284
275
|
observation = result.current;
|
|
@@ -287,48 +278,46 @@ async function claimCurrentTokenStorageState(params) {
|
|
|
287
278
|
return false;
|
|
288
279
|
}
|
|
289
280
|
}
|
|
290
|
-
function
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
281
|
+
async function writeStorageMeta(params) {
|
|
282
|
+
return mutateStorageMeta(params.storagePaths.rootDir, {
|
|
283
|
+
kind: "initialize",
|
|
284
|
+
metadata: {
|
|
285
|
+
homeserver: params.homeserver,
|
|
286
|
+
userId: params.userId,
|
|
287
|
+
accountId: params.accountId ?? DEFAULT_ACCOUNT_KEY,
|
|
288
|
+
accessTokenHash: params.storagePaths.tokenHash,
|
|
289
|
+
deviceId: params.deviceId ?? null,
|
|
290
|
+
currentTokenStateClaimed: params.currentTokenStateClaimed
|
|
291
|
+
}
|
|
301
292
|
});
|
|
302
293
|
}
|
|
303
|
-
function
|
|
294
|
+
async function claimCurrentTokenStorageState(params) {
|
|
295
|
+
return mutateStorageMeta(params.rootDir, { kind: "claim" });
|
|
296
|
+
}
|
|
297
|
+
async function recordCurrentStorageMetaDeviceId(params) {
|
|
298
|
+
const rootDir = params.rootDir;
|
|
304
299
|
const deviceId = params.deviceId.trim();
|
|
305
|
-
if (!deviceId) return false;
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
homeserver: metadata.homeserver,
|
|
310
|
-
userId: metadata.userId,
|
|
311
|
-
accountId: metadata.accountId ?? DEFAULT_ACCOUNT_KEY,
|
|
312
|
-
accessTokenHash: metadata.accessTokenHash,
|
|
313
|
-
deviceId,
|
|
314
|
-
currentTokenStateClaimed: metadata.currentTokenStateClaimed === true,
|
|
315
|
-
createdAt: metadata.createdAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
300
|
+
if (!deviceId || !(await readStoredRootMetadata(rootDir)).accessTokenHash?.trim()) return false;
|
|
301
|
+
return mutateStorageMeta(rootDir, {
|
|
302
|
+
kind: "device",
|
|
303
|
+
deviceId
|
|
316
304
|
});
|
|
317
305
|
}
|
|
318
|
-
function repairCurrentTokenStorageMetaDeviceId(params) {
|
|
306
|
+
async function repairCurrentTokenStorageMetaDeviceId(params) {
|
|
307
|
+
const { homeserver, userId, accessToken, accountId, deviceId, env, stateDir } = params;
|
|
319
308
|
return writeStorageMeta({
|
|
320
|
-
storagePaths: resolveMatrixStoragePaths({
|
|
321
|
-
homeserver
|
|
322
|
-
userId
|
|
323
|
-
accessToken
|
|
324
|
-
accountId
|
|
325
|
-
env
|
|
326
|
-
stateDir
|
|
309
|
+
storagePaths: await resolveMatrixStoragePaths({
|
|
310
|
+
homeserver,
|
|
311
|
+
userId,
|
|
312
|
+
accessToken,
|
|
313
|
+
accountId,
|
|
314
|
+
env,
|
|
315
|
+
stateDir
|
|
327
316
|
}),
|
|
328
|
-
homeserver
|
|
329
|
-
userId
|
|
330
|
-
accountId
|
|
331
|
-
deviceId
|
|
317
|
+
homeserver,
|
|
318
|
+
userId,
|
|
319
|
+
accountId,
|
|
320
|
+
deviceId
|
|
332
321
|
});
|
|
333
322
|
}
|
|
334
323
|
//#endregion
|
|
@@ -56,15 +56,6 @@ function openMatrixIdbSnapshotStoreOptions(storageRootDir) {
|
|
|
56
56
|
env: resolveMatrixSqliteStateEnv({ stateDir: storageRootDir })
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
function readMatrixRecoveryKeyState(storageRootDir) {
|
|
60
|
-
return readMatrixRecoveryKeyStateWithKey({
|
|
61
|
-
storageRootDir,
|
|
62
|
-
stateKey: STATE_KEY
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
function readMatrixRecoveryKeyStateWithKey(params) {
|
|
66
|
-
return normalizeMatrixStoredRecoveryKey(openSyncStore(openMatrixRecoveryKeyStoreOptions(params.storageRootDir)).lookup(params.stateKey));
|
|
67
|
-
}
|
|
68
59
|
async function readMatrixRecoveryKeyStateForPathAsync(recoveryKeyPath, stateRuntime) {
|
|
69
60
|
return normalizeMatrixStoredRecoveryKey(await stateRuntime.openKeyedStore(openMatrixRecoveryKeyStoreOptions(path.dirname(recoveryKeyPath))).lookup(resolveRecoveryKeyStateKeyForPath(recoveryKeyPath)));
|
|
70
61
|
}
|
|
@@ -103,11 +94,6 @@ async function updateMatrixRecoveryKeyState(params, update) {
|
|
|
103
94
|
observation = result.current;
|
|
104
95
|
}
|
|
105
96
|
}
|
|
106
|
-
function writeMatrixRecoveryKeyStateWithKey(params) {
|
|
107
|
-
const payload = normalizeMatrixStoredRecoveryKey(params.payload);
|
|
108
|
-
if (!payload) throw new Error("Invalid Matrix recovery key state");
|
|
109
|
-
openSyncStore(openMatrixRecoveryKeyStoreOptions(params.storageRootDir)).register(params.stateKey, payload);
|
|
110
|
-
}
|
|
111
97
|
async function hasMatrixRecoveryKeyStateInStore(params) {
|
|
112
98
|
return normalizeMatrixStoredRecoveryKey(await params.store.lookup(STATE_KEY)) !== null;
|
|
113
99
|
}
|
|
@@ -116,13 +102,8 @@ async function writeMatrixRecoveryKeyStateToStore(params) {
|
|
|
116
102
|
if (!payload) throw new Error("Invalid Matrix recovery key state");
|
|
117
103
|
await params.store.register(STATE_KEY, payload);
|
|
118
104
|
}
|
|
119
|
-
function readMatrixLegacyCryptoMigrationState(storageRootDir) {
|
|
120
|
-
return normalizeMatrixLegacyCryptoMigrationState(
|
|
121
|
-
}
|
|
122
|
-
function writeMatrixLegacyCryptoMigrationState(params) {
|
|
123
|
-
const state = normalizeMatrixLegacyCryptoMigrationState(params.state);
|
|
124
|
-
if (!state) throw new Error("Invalid Matrix legacy crypto migration state");
|
|
125
|
-
openSyncStore(openMatrixLegacyCryptoMigrationStoreOptions(params.storageRootDir)).register(STATE_KEY, state);
|
|
105
|
+
async function readMatrixLegacyCryptoMigrationState(storageRootDir) {
|
|
106
|
+
return normalizeMatrixLegacyCryptoMigrationState(await getMatrixRuntime().state.openKeyedStore(openMatrixLegacyCryptoMigrationStoreOptions(storageRootDir)).lookup(STATE_KEY));
|
|
126
107
|
}
|
|
127
108
|
async function hasMatrixLegacyCryptoMigrationStateInStore(params) {
|
|
128
109
|
return normalizeMatrixLegacyCryptoMigrationState(await params.store.lookup(STATE_KEY)) !== null;
|
|
@@ -135,8 +116,8 @@ async function writeMatrixLegacyCryptoMigrationStateToStore(params) {
|
|
|
135
116
|
async function readMatrixIdbSnapshotJson(storageRootDir, stateRuntime = getMatrixRuntime().state) {
|
|
136
117
|
return await readMatrixIdbSnapshotJsonFromStore({ store: stateRuntime.openKeyedStore(openMatrixIdbSnapshotStoreOptions(storageRootDir)) });
|
|
137
118
|
}
|
|
138
|
-
function hasMatrixIdbSnapshotState(storageRootDir) {
|
|
139
|
-
return isIdbSnapshotMeta(
|
|
119
|
+
async function hasMatrixIdbSnapshotState(storageRootDir) {
|
|
120
|
+
return isIdbSnapshotMeta(await getMatrixRuntime().state.openKeyedStore(openMatrixIdbSnapshotStoreOptions(storageRootDir)).lookup(idbMetaKey()));
|
|
140
121
|
}
|
|
141
122
|
async function writeMatrixIdbSnapshotJson(params) {
|
|
142
123
|
await writeMatrixIdbSnapshotJsonToStore({
|
|
@@ -154,17 +135,6 @@ async function writeMatrixIdbSnapshotJsonToStore(params) {
|
|
|
154
135
|
await params.store.register(rows.meta.key, rows.meta.value);
|
|
155
136
|
for (const row of await params.store.entries()) if (row.key.startsWith(idbChunkKeyPrefix()) && !rows.nextChunkKeys.has(row.key)) await params.store.delete(row.key);
|
|
156
137
|
}
|
|
157
|
-
function migrateLegacyMatrixRecoveryKeyFileToStore(storageRootDir) {
|
|
158
|
-
const recoveryKeyPath = path.join(storageRootDir, MATRIX_RECOVERY_KEY_FILENAME);
|
|
159
|
-
const existing = readMatrixRecoveryKeyState(storageRootDir);
|
|
160
|
-
const legacy = readLegacyMatrixRecoveryKeyFile(recoveryKeyPath);
|
|
161
|
-
if (!existing && legacy) writeMatrixRecoveryKeyStateWithKey({
|
|
162
|
-
storageRootDir,
|
|
163
|
-
stateKey: STATE_KEY,
|
|
164
|
-
payload: legacy
|
|
165
|
-
});
|
|
166
|
-
return archiveLegacyStateFileIfPossible(recoveryKeyPath);
|
|
167
|
-
}
|
|
168
138
|
async function migrateLegacyMatrixRecoveryKeyFilePathToStoreAsync(recoveryKeyPath, stateRuntime) {
|
|
169
139
|
const legacy = readLegacyMatrixRecoveryKeyFile(recoveryKeyPath);
|
|
170
140
|
if (legacy) await updateMatrixRecoveryKeyState({
|
|
@@ -174,13 +144,27 @@ async function migrateLegacyMatrixRecoveryKeyFilePathToStoreAsync(recoveryKeyPat
|
|
|
174
144
|
else await readMatrixRecoveryKeyStateForPathAsync(recoveryKeyPath, stateRuntime);
|
|
175
145
|
return archiveLegacyStateFileIfPossible(recoveryKeyPath);
|
|
176
146
|
}
|
|
177
|
-
function migrateLegacyMatrixLegacyCryptoMigrationFileToStore(storageRootDir) {
|
|
178
|
-
const
|
|
147
|
+
async function migrateLegacyMatrixLegacyCryptoMigrationFileToStore(storageRootDir) {
|
|
148
|
+
const options = openMatrixLegacyCryptoMigrationStoreOptions(storageRootDir);
|
|
149
|
+
const store = getMatrixRuntime().state.openKeyedStore(options);
|
|
179
150
|
const legacy = readLegacyMatrixLegacyCryptoMigrationState(storageRootDir);
|
|
180
|
-
if (!
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
151
|
+
if (!legacy) await store.lookup(STATE_KEY);
|
|
152
|
+
else if (!store.observe || !store.compareAndApply) {
|
|
153
|
+
const legacyStore = openSyncStore(options);
|
|
154
|
+
if (!normalizeMatrixLegacyCryptoMigrationState(legacyStore.lookup(STATE_KEY))) legacyStore.register(STATE_KEY, legacy);
|
|
155
|
+
} else {
|
|
156
|
+
let observation = await store.observe(STATE_KEY);
|
|
157
|
+
for (;;) {
|
|
158
|
+
if (normalizeMatrixLegacyCryptoMigrationState(observation.value)) break;
|
|
159
|
+
const result = await store.compareAndApply(STATE_KEY, observation.comparison, {
|
|
160
|
+
operation: "update",
|
|
161
|
+
action: "set",
|
|
162
|
+
value: legacy
|
|
163
|
+
});
|
|
164
|
+
if (result.status !== "conflict") break;
|
|
165
|
+
observation = result.current;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
184
168
|
return archiveLegacyStateFileIfPossible(path.join(storageRootDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME));
|
|
185
169
|
}
|
|
186
170
|
function readLegacyMatrixRecoveryKeyState(storageRootDir) {
|
|
@@ -192,17 +176,17 @@ function readLegacyMatrixRecoveryKeyFile(filePath) {
|
|
|
192
176
|
function readLegacyMatrixLegacyCryptoMigrationState(storageRootDir) {
|
|
193
177
|
return readJsonFileSync(path.join(storageRootDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME), normalizeMatrixLegacyCryptoMigrationState);
|
|
194
178
|
}
|
|
195
|
-
function scoreMatrixCryptoStateInStore(storageRootDir) {
|
|
179
|
+
async function scoreMatrixCryptoStateInStore(storageRootDir) {
|
|
196
180
|
if (!matrixCryptoStateDatabaseExists(storageRootDir)) return 0;
|
|
197
181
|
let score = 0;
|
|
198
182
|
try {
|
|
199
|
-
if (readMatrixLegacyCryptoMigrationState(storageRootDir)) score += 3;
|
|
183
|
+
if (await readMatrixLegacyCryptoMigrationState(storageRootDir)) score += 3;
|
|
200
184
|
} catch {}
|
|
201
185
|
try {
|
|
202
|
-
if (
|
|
186
|
+
if (await readMatrixRecoveryKeyStateForPathAsync(path.join(storageRootDir, "recovery-key.json"), getMatrixRuntime().state)) score += 2;
|
|
203
187
|
} catch {}
|
|
204
188
|
try {
|
|
205
|
-
if (hasMatrixIdbSnapshotState(storageRootDir)) score += 2;
|
|
189
|
+
if (await hasMatrixIdbSnapshotState(storageRootDir)) score += 2;
|
|
206
190
|
} catch {}
|
|
207
191
|
return score;
|
|
208
192
|
}
|
|
@@ -385,4 +369,4 @@ async function writeMatrixStorageMetaStateToStore(params) {
|
|
|
385
369
|
await params.store.register(STORAGE_META_STATE_KEY, params.payload);
|
|
386
370
|
}
|
|
387
371
|
//#endregion
|
|
388
|
-
export {
|
|
372
|
+
export { writeMatrixIdbSnapshotJson as C, writeMatrixRecoveryKeyStateToStore as D, writeMatrixRecoveryKeyStateForPathAsync as E, resolveMatrixSqliteStateEnv as O, scoreMatrixCryptoStateInStore as S, writeMatrixLegacyCryptoMigrationStateToStore as T, readLegacyMatrixRecoveryKeyFile as _, writeMatrixStorageMetaStateToStore as a, readMatrixIdbSnapshotJsonFromStore as b, MATRIX_RECOVERY_KEY_FILENAME as c, migrateLegacyMatrixLegacyCryptoMigrationFileToStore as d, migrateLegacyMatrixRecoveryKeyFilePathToStoreAsync as f, readLegacyMatrixLegacyCryptoMigrationState as g, openMatrixRecoveryKeyStoreOptions as h, openMatrixStorageMetaStoreOptions as i, resolveMatrixSqliteStateKey as k, hasMatrixLegacyCryptoMigrationStateInStore as l, openMatrixLegacyCryptoMigrationStoreOptions as m, hasMatrixStorageMetaStateInStore as n, MATRIX_IDB_SNAPSHOT_FILENAME as o, openMatrixIdbSnapshotStoreOptions as p, normalizeMatrixStorageMetadata as r, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME as s, STORAGE_META_STATE_KEY as t, hasMatrixRecoveryKeyStateInStore as u, readLegacyMatrixRecoveryKeyState as v, writeMatrixIdbSnapshotJsonToStore as w, readMatrixRecoveryKeyStateForPathAsync as x, readMatrixIdbSnapshotJson as y };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { O as resolveMatrixSqliteStateEnv } from "./storage-metadata-fHN6Df2m.mjs";
|
|
3
3
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import fs from "node:fs/promises";
|
|
7
|
+
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
7
8
|
//#region extensions/matrix/src/matrix/client/sync-cache-state.ts
|
|
8
9
|
var sync_cache_state_exports = /* @__PURE__ */ __exportAll({
|
|
9
10
|
MATRIX_SYNC_CACHE_VERSION: () => 1,
|
|
10
|
-
|
|
11
|
+
deleteMatrixSyncCacheStateFromStore: () => deleteMatrixSyncCacheStateFromStore,
|
|
11
12
|
hasMatrixSyncCacheStateInStore: () => hasMatrixSyncCacheStateInStore,
|
|
12
13
|
openMatrixSyncCacheStoreOptions: () => openMatrixSyncCacheStoreOptions,
|
|
13
14
|
readLegacyMatrixSyncCacheState: () => readLegacyMatrixSyncCacheState,
|
|
14
|
-
|
|
15
|
-
writeMatrixSyncCacheStateToStore: () => writeMatrixSyncCacheStateToStore
|
|
16
|
-
writeMatrixSyncCacheStateToSyncStore: () => writeMatrixSyncCacheStateToSyncStore
|
|
15
|
+
readPersistedStoreFromStore: () => readPersistedStoreFromStore,
|
|
16
|
+
writeMatrixSyncCacheStateToStore: () => writeMatrixSyncCacheStateToStore
|
|
17
17
|
});
|
|
18
18
|
const MATRIX_SYNC_CACHE_VERSION = 1;
|
|
19
19
|
const SYNC_CACHE_NAMESPACE = "sync-cache";
|
|
@@ -21,6 +21,7 @@ const SYNC_CACHE_MAX_ENTRIES = 2e4;
|
|
|
21
21
|
const SYNC_CACHE_MAX_CHUNKS = Math.floor(19999 / 2);
|
|
22
22
|
const SYNC_CACHE_STATE_KEY = "current";
|
|
23
23
|
const SYNC_CACHE_CHUNK_BYTES = 24e3;
|
|
24
|
+
const syncCacheOperations = new KeyedAsyncQueue();
|
|
24
25
|
function normalizeRoomsData(value) {
|
|
25
26
|
if (!isRecord(value)) return null;
|
|
26
27
|
return {
|
|
@@ -70,16 +71,20 @@ function normalizeLegacyPersistedStore(value) {
|
|
|
70
71
|
cleanShutdown: false
|
|
71
72
|
};
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
+
async function readPersistedStoreFromStore(params) {
|
|
75
|
+
const { storageRootDir, store } = params;
|
|
76
|
+
return syncCacheOperations.enqueue(path.resolve(storageRootDir), () => readPersistedStore(store));
|
|
77
|
+
}
|
|
78
|
+
async function readPersistedStore(store) {
|
|
74
79
|
const stateKey = SYNC_CACHE_STATE_KEY;
|
|
75
|
-
const meta = store.lookup(metaKey(stateKey));
|
|
80
|
+
const meta = await store.lookup(metaKey(stateKey));
|
|
76
81
|
if (!isSyncCacheMeta(meta)) return null;
|
|
77
|
-
const records = store.lookupMany?.(Array.from({ length: meta.chunkCount }, (_, index) => chunkKey(stateKey, meta.generation, index)));
|
|
82
|
+
const records = await store.lookupMany?.(Array.from({ length: meta.chunkCount }, (_, index) => chunkKey(stateKey, meta.generation, index)));
|
|
78
83
|
const chunks = [];
|
|
79
84
|
for (let index = 0; index < meta.chunkCount; index += 1) {
|
|
80
85
|
const result = records?.[index];
|
|
81
86
|
if (result && !result.ok) throw result.error;
|
|
82
|
-
const chunk = records ? result?.value : store.lookup(chunkKey(stateKey, meta.generation, index));
|
|
87
|
+
const chunk = records ? result?.value : await store.lookup(chunkKey(stateKey, meta.generation, index));
|
|
83
88
|
if (!isSyncCacheChunk(chunk) || chunk.index !== index) return normalizePersistedStore({
|
|
84
89
|
version: 1,
|
|
85
90
|
savedSync: null,
|
|
@@ -191,32 +196,17 @@ async function readLegacyMatrixSyncCacheState(storageRootDir) {
|
|
|
191
196
|
}
|
|
192
197
|
}
|
|
193
198
|
async function hasMatrixSyncCacheStateInStore(params) {
|
|
194
|
-
|
|
195
|
-
const meta = await params.store.lookup(metaKey(stateKey));
|
|
196
|
-
if (!isSyncCacheMeta(meta) || meta.chunkCount <= 0) return false;
|
|
197
|
-
const records = await params.store.lookupMany?.(Array.from({ length: meta.chunkCount }, (_, index) => chunkKey(stateKey, meta.generation, index)));
|
|
198
|
-
const chunks = [];
|
|
199
|
-
for (let index = 0; index < meta.chunkCount; index += 1) {
|
|
200
|
-
const result = records?.[index];
|
|
201
|
-
if (result && !result.ok) throw result.error;
|
|
202
|
-
const chunk = records ? result?.value : await params.store.lookup(chunkKey(stateKey, meta.generation, index));
|
|
203
|
-
if (!isSyncCacheChunk(chunk) || chunk.index !== index) return false;
|
|
204
|
-
chunks.push(chunk.data);
|
|
205
|
-
}
|
|
206
|
-
const syncJson = chunks.join("");
|
|
207
|
-
if (meta.syncDigest !== digestText(syncJson)) return false;
|
|
208
|
-
try {
|
|
209
|
-
return toPersistedSyncData(JSON.parse(syncJson)) !== null;
|
|
210
|
-
} catch {
|
|
211
|
-
return false;
|
|
212
|
-
}
|
|
199
|
+
return Boolean((await readPersistedStoreFromStore(params))?.savedSync);
|
|
213
200
|
}
|
|
214
201
|
async function writeMatrixSyncCacheStateToStore(params) {
|
|
202
|
+
const { storageRootDir, store, payload } = params;
|
|
215
203
|
const stateKey = SYNC_CACHE_STATE_KEY;
|
|
216
|
-
const rows = buildSyncCacheRows(stateKey,
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
204
|
+
const rows = buildSyncCacheRows(stateKey, payload);
|
|
205
|
+
return syncCacheOperations.enqueue(path.resolve(storageRootDir), async () => {
|
|
206
|
+
for (const row of rows.chunks) await store.register(row.key, row.value);
|
|
207
|
+
await store.register(rows.meta.key, rows.meta.value);
|
|
208
|
+
for (const row of await store.entries()) if (row.key.startsWith(chunkKeyPrefix(stateKey)) && !rows.nextChunkKeys.has(row.key)) await store.delete(row.key);
|
|
209
|
+
});
|
|
220
210
|
}
|
|
221
211
|
function openMatrixSyncCacheStoreOptions(storageRootDir) {
|
|
222
212
|
return {
|
|
@@ -225,16 +215,13 @@ function openMatrixSyncCacheStoreOptions(storageRootDir) {
|
|
|
225
215
|
env: resolveMatrixSqliteStateEnv({ stateDir: storageRootDir })
|
|
226
216
|
};
|
|
227
217
|
}
|
|
228
|
-
function
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
params.store.delete(metaKey(SYNC_CACHE_STATE_KEY));
|
|
236
|
-
for (const row of params.store.entries()) if (row.key.startsWith(chunkKeyPrefix(SYNC_CACHE_STATE_KEY))) params.store.delete(row.key);
|
|
237
|
-
await fs.rm(resolveLegacySyncCachePath(params.storageRootDir), { force: true }).catch(() => void 0);
|
|
218
|
+
async function deleteMatrixSyncCacheStateFromStore(params) {
|
|
219
|
+
const { storageRootDir, store } = params;
|
|
220
|
+
return syncCacheOperations.enqueue(path.resolve(storageRootDir), async () => {
|
|
221
|
+
await store.delete(metaKey(SYNC_CACHE_STATE_KEY));
|
|
222
|
+
for (const row of await store.entries()) if (row.key.startsWith(chunkKeyPrefix(SYNC_CACHE_STATE_KEY))) await store.delete(row.key);
|
|
223
|
+
await fs.rm(resolveLegacySyncCachePath(storageRootDir), { force: true }).catch(() => void 0);
|
|
224
|
+
});
|
|
238
225
|
}
|
|
239
226
|
//#endregion
|
|
240
|
-
export { readLegacyMatrixSyncCacheState as a, writeMatrixSyncCacheStateToStore as c, openMatrixSyncCacheStoreOptions as i,
|
|
227
|
+
export { readLegacyMatrixSyncCacheState as a, writeMatrixSyncCacheStateToStore as c, openMatrixSyncCacheStoreOptions as i, deleteMatrixSyncCacheStateFromStore as n, readPersistedStoreFromStore as o, hasMatrixSyncCacheStateInStore as r, sync_cache_state_exports as s, MATRIX_SYNC_CACHE_VERSION as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as getMatrixRuntime } from "./runtime-1kn1P6io.mjs";
|
|
2
2
|
import { a as listBindingsForAccount, c as resolveEffectiveBindingExpiry, d as setMatrixThreadBindingManagerEntry, l as setBindingRecord, m as toSessionBindingRecord, o as removeBindingRecord, p as toMatrixBindingTargetKind, r as getMatrixThreadBindingManagerEntry, s as resolveBindingKey, t as deleteMatrixThreadBindingManagerEntry } from "./thread-bindings-shared-oNPiyMWY.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { a as resolveMatrixStateFilePath, t as claimCurrentTokenStorageState } from "./storage-
|
|
5
|
-
import { r as sendMessageMatrix } from "./send-
|
|
3
|
+
import { O as resolveMatrixSqliteStateEnv, k as resolveMatrixSqliteStateKey } from "./storage-metadata-fHN6Df2m.mjs";
|
|
4
|
+
import { a as resolveMatrixStateFilePath, t as claimCurrentTokenStorageState } from "./storage-BXaFc0S4.mjs";
|
|
5
|
+
import { r as sendMessageMatrix } from "./send-aVdC5NJO.mjs";
|
|
6
6
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
8
|
import path from "node:path";
|
|
@@ -18,7 +18,7 @@ const THREAD_BINDINGS_MIGRATIONS_NAMESPACE = "thread-bindings-migrations";
|
|
|
18
18
|
const THREAD_BINDINGS_MAX_ENTRIES = 1e4;
|
|
19
19
|
const THREAD_BINDINGS_SWEEP_INTERVAL_MS = 6e4;
|
|
20
20
|
const TOUCH_PERSIST_DELAY_MS = 3e4;
|
|
21
|
-
function resolveBindingsPath(params) {
|
|
21
|
+
async function resolveBindingsPath(params) {
|
|
22
22
|
return resolveMatrixStateFilePath({
|
|
23
23
|
auth: params.auth,
|
|
24
24
|
accountId: params.accountId,
|
|
@@ -140,7 +140,7 @@ async function sendFarewellMessage(params) {
|
|
|
140
140
|
}
|
|
141
141
|
async function createMatrixThreadBindingManager(params) {
|
|
142
142
|
if (params.auth.accountId !== params.accountId) throw new Error(`Matrix thread binding account mismatch: requested ${params.accountId}, auth resolved ${params.auth.accountId}`);
|
|
143
|
-
const legacyFilePath = resolveBindingsPath({
|
|
143
|
+
const legacyFilePath = await resolveBindingsPath({
|
|
144
144
|
auth: params.auth,
|
|
145
145
|
accountId: params.accountId,
|
|
146
146
|
env: params.env,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { a as resolveMatrixAccountConfig, o as resolveMatrixBaseConfig } from "./account-config-CRsKoMqJ.mjs";
|
|
2
|
-
import { i as resolveMatrixAccount } from "./accounts-
|
|
3
|
-
import { a as resolveMatrixRoomConfig } from "./channel-
|
|
2
|
+
import { i as resolveMatrixAccount } from "./accounts-iThMol10.mjs";
|
|
3
|
+
import { a as resolveMatrixRoomConfig } from "./channel-ConuJfxT.mjs";
|
|
4
4
|
import { i as normalizeMatrixResolvableTarget } from "./target-ids-Nwx7cMVE.mjs";
|
|
5
5
|
import { l as selectOwnMatrixReactionEventIds, s as buildMatrixReactionRelationsPath, u as summarizeMatrixReactionEvents } from "./send-currentness-BrGXL7b8.mjs";
|
|
6
6
|
import { c as isStrictDirectMembership, s as hasDirectMatrixMemberFlag, u as readJoinedMatrixMembers } from "./direct-management-B2Bno2xL.mjs";
|
|
7
|
-
import { E as resolveMatrixRoomId, b as isPollStartType, h as buildPollResponseContent, n as reactMatrixMessage, x as parsePollStart } from "./send-
|
|
7
|
+
import { E as resolveMatrixRoomId, b as isPollStartType, h as buildPollResponseContent, n as reactMatrixMessage, x as parsePollStart } from "./send-aVdC5NJO.mjs";
|
|
8
8
|
import { i as parseMxc } from "./event-helpers-CspuhE9k.mjs";
|
|
9
|
-
import { a as
|
|
10
|
-
import { n as withResolvedActionClient, r as withResolvedRoomAction } from "./client-
|
|
11
|
-
import { t as applyMatrixProfileUpdate } from "./profile-update-
|
|
12
|
-
import { _ as scanMatrixVerificationQr, a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, h as restoreMatrixRoomKeyBackup, i as confirmMatrixVerificationReciprocateQr, l as getMatrixVerificationSas, n as bootstrapMatrixVerification, o as generateMatrixVerificationQr, p as requestMatrixVerification, r as cancelMatrixVerification, s as getMatrixEncryptionStatus, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-
|
|
13
|
-
import { n as getMatrixMemberInfo, r as getMatrixRoomInfo, t as createMatrixRoomInfoResolver } from "./room-info-
|
|
9
|
+
import { a as sendMatrixMessage, c as EventType, i as readMatrixMessages, l as resolveMatrixActionLimit, n as editMatrixMessage, o as fetchEventSummary, r as readMatrixMessage, s as readPinnedEvents, t as deleteMatrixMessage } from "./messages-COuAcrz-.mjs";
|
|
10
|
+
import { n as withResolvedActionClient, r as withResolvedRoomAction } from "./client-C2yVkVdw.mjs";
|
|
11
|
+
import { t as applyMatrixProfileUpdate } from "./profile-update-DrblJttE.mjs";
|
|
12
|
+
import { _ as scanMatrixVerificationQr, a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, h as restoreMatrixRoomKeyBackup, i as confirmMatrixVerificationReciprocateQr, l as getMatrixVerificationSas, n as bootstrapMatrixVerification, o as generateMatrixVerificationQr, p as requestMatrixVerification, r as cancelMatrixVerification, s as getMatrixEncryptionStatus, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-0o8MOW9T.mjs";
|
|
13
|
+
import { n as getMatrixMemberInfo, r as getMatrixRoomInfo, t as createMatrixRoomInfoResolver } from "./room-info-DTyP1k5g.mjs";
|
|
14
14
|
import { isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, uniqueStrings, uniqueValues } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
15
15
|
import { ToolAuthorizationError, createActionGate, jsonResult, readPositiveIntegerParam, readReactionParams, readStringArrayParam, readStringParam } from "openclaw/plugin-sdk/channel-actions";
|
|
16
16
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
@@ -479,11 +479,19 @@ async function handleMatrixAction(ctx) {
|
|
|
479
479
|
const before = readStringParam(params, "before");
|
|
480
480
|
const after = readStringParam(params, "after");
|
|
481
481
|
const threadId = readStringParam(params, "threadId");
|
|
482
|
+
const messageId = readStringParam(params, "messageId");
|
|
482
483
|
const { clientOpts, withReadTarget } = prepareAction({
|
|
483
484
|
name: "messages",
|
|
484
485
|
disabledMessage: "Matrix messages are disabled."
|
|
485
486
|
});
|
|
486
487
|
const result = await withReadTarget(roomId, async (target) => {
|
|
488
|
+
if (messageId) return {
|
|
489
|
+
messages: projectMatrixMessagesForDisplay([await readMatrixMessage(target.roomId, messageId, {
|
|
490
|
+
...clientOpts,
|
|
491
|
+
client: target.client
|
|
492
|
+
})]),
|
|
493
|
+
roomId: target.roomId
|
|
494
|
+
};
|
|
487
495
|
const messages = await readMatrixMessages(target.roomId, {
|
|
488
496
|
limit: limit ?? void 0,
|
|
489
497
|
before: before ?? void 0,
|