@openclaw/matrix 2026.7.2-beta.3 → 2026.7.2-beta.4

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.
Files changed (73) hide show
  1. package/dist/api.js +4 -4
  2. package/dist/{approval-handler.runtime-BEa98wwG.js → approval-handler.runtime-AsawryfP.js} +4 -4
  3. package/dist/{approval-ids-Dfn7oQAm.js → approval-ids-XAMP8vN9.js} +1 -1
  4. package/dist/{approval-reaction-auth-kXkCJBGi.js → approval-reaction-auth-DButmM13.js} +2 -2
  5. package/dist/{channel-j331Xd7b.js → channel-MBtrY36B.js} +17 -11
  6. package/dist/channel-plugin-api.js +1 -1
  7. package/dist/{channel.runtime-BIwlVfQw.js → channel.runtime-Bi4Dgy2P.js} +6 -6
  8. package/dist/{cli-0EcKfqFw.js → cli-CcPuMyCk.js} +14 -18
  9. package/dist/{cli-metadata-Xq1Xb15R.js → cli-metadata-DAhDhbYX.js} +1 -1
  10. package/dist/cli-metadata.js +1 -1
  11. package/dist/{client-BtG4quUl.js → client-BwX6rURh.js} +2 -2
  12. package/dist/{client-CA0PULls.js → client-Dg8dk8NW.js} +2 -2
  13. package/dist/{client-bootstrap-Dk5EAn3n.js → client-bootstrap-ZAaO9fZ-.js} +1 -1
  14. package/dist/{config-schema-B5GRV8wL.js → config-schema-CggnuwnJ.js} +4 -5
  15. package/dist/contract-api.js +2 -2
  16. package/dist/{create-client-WQExaby_.js → create-client-Und1YmJ2.js} +3 -3
  17. package/dist/{crypto-runtime-CAff-n15.js → crypto-runtime-_j7TpS7k.js} +2 -2
  18. package/dist/{directory-live-DiC-0XBC.js → directory-live-B6fbX6jf.js} +3 -3
  19. package/dist/{doctor-DwUVm5Lw.js → doctor-C0LPJGTz.js} +1 -1
  20. package/dist/doctor-contract-CWVdlRQR.js +183 -0
  21. package/dist/doctor-contract-api.js +112 -71
  22. package/dist/{draft-stream-CTLKtJJ0.js → draft-stream-BfibauH1.js} +1 -1
  23. package/dist/{file-sync-store-CPkgnSXp.js → file-sync-store-DUEWCEjb.js} +1 -1
  24. package/dist/{http-client-BmrgOZTL.js → http-client-DOyTG9l2.js} +1 -1
  25. package/dist/{idb-persistence-Dyy6ipgU.js → idb-persistence-C6zQfW2w.js} +72 -63
  26. package/dist/index.js +1 -1
  27. package/dist/{media-text-BMXEXb1j.js → media-text-Cv1VIHXW.js} +1 -1
  28. package/dist/{messages-3UBHfZrN.js → messages-ClTgfFl6.js} +3 -3
  29. package/dist/{monitor-BtUIds8T.js → monitor-2BjKS9RV.js} +23 -20
  30. package/dist/plugin-entry.handlers.runtime.js +1 -1
  31. package/dist/probe.runtime-BWkgfbiE.js +3 -0
  32. package/dist/{profile-update-Bh2XtJwN.js → profile-update-C2My3TML.js} +2 -2
  33. package/dist/{reaction-events-BwAKtUyQ.js → reaction-events-Cj6thhmc.js} +2 -2
  34. package/dist/{recovery-key-store-CW6eePfp.js → recovery-key-store-0O8ARdT_.js} +1 -1
  35. package/dist/{resolve-targets-DVoj-YxB.js → resolve-targets-Dn11HT76.js} +1 -1
  36. package/dist/{resolver.runtime-CC0VVsAt.js → resolver.runtime-Zguh0hH9.js} +1 -1
  37. package/dist/{sdk-CIDZXWpZ.js → sdk-DiRXiRRf.js} +5 -5
  38. package/dist/{send-BJbrdmNm.js → send-CZCmDQu8.js} +2 -2
  39. package/dist/session-binding-contract-api.js +1 -1
  40. package/dist/{setup-bootstrap-DGPOOdz-.js → setup-bootstrap-C9w01xQK.js} +2 -2
  41. package/dist/{setup-core-XCdAx1nY.js → setup-core-D6gyoyeg.js} +107 -19
  42. package/dist/setup-plugin-api.js +4 -3
  43. package/dist/{setup-surface-CzUiTe_k.js → setup-surface-DZIEWtQC.js} +6 -4
  44. package/dist/{shared-DquM1oz6.js → shared-C7Vm9RxI.js} +3 -3
  45. package/dist/{startup-verification-CA00kebL.js → startup-verification-D1nscMh8.js} +1 -1
  46. package/dist/{storage-CzHxeF5E.js → storage-BrkTJZov.js} +6 -39
  47. package/dist/{thread-bindings-Cw194yEn.js → thread-bindings-BcYBELC7.js} +2 -2
  48. package/dist/{tool-actions.runtime-C0jgWYhX.js → tool-actions.runtime-Dbco_Vwn.js} +7 -7
  49. package/dist/{verification-DjxyWTNP.js → verification-DhMBWxOJ.js} +1 -1
  50. package/node_modules/music-metadata/lib/common/Util.d.ts +1 -1
  51. package/node_modules/music-metadata/lib/common/Util.js +7 -1
  52. package/node_modules/music-metadata/lib/id3v2/FrameHeader.js +23 -3
  53. package/node_modules/music-metadata/lib/id3v2/FrameParser.js +2 -2
  54. package/node_modules/music-metadata/lib/id3v2/ID3v2Token.js +1 -1
  55. package/node_modules/music-metadata/lib/mp4/AtomToken.js +38 -13
  56. package/node_modules/music-metadata/lib/mpeg/MpegParser.js +1 -1
  57. package/node_modules/music-metadata/package.json +6 -6
  58. package/node_modules/typebox/build/compile/validator.d.mts +1 -4
  59. package/node_modules/typebox/build/guard/guard.d.mts +1 -1
  60. package/node_modules/typebox/build/guard/guard.mjs +5 -2
  61. package/node_modules/typebox/build/guard/string.mjs +16 -4
  62. package/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
  63. package/node_modules/typebox/build/type/action/readonly_object.d.mts +5 -0
  64. package/node_modules/typebox/build/type/action/readonly_object.mjs +8 -0
  65. package/node_modules/typebox/build/typebox.d.mts +1 -1
  66. package/node_modules/typebox/build/typebox.mjs +1 -1
  67. package/node_modules/typebox/package.json +1 -1
  68. package/node_modules/typebox/readme.md +29 -32
  69. package/npm-shrinkwrap.json +11 -11
  70. package/openclaw.plugin.json +7 -20
  71. package/package.json +111 -28
  72. package/dist/doctor-contract-BA2Y6Crx.js +0 -312
  73. package/dist/probe.runtime-sBV-Govx.js +0 -3
@@ -2,18 +2,103 @@ import { a as resolveMatrixDefaultOrOnlyAccountId, n as requiresExplicitMatrixDe
2
2
  import { t as isRecord$1 } from "./record-shared-CWWx6fvI.js";
3
3
  import { r as resolveMatrixCredentialsDir } from "./storage-paths-gUmSydsW.js";
4
4
  import { a as isMatrixCredentialRevocation, c as normalizeMatrixStoredCredentials, s as matrixCredentialsStoreKey, t as MATRIX_CREDENTIALS_NAMESPACE } from "./credentials-read-DVmFCm7X.js";
5
- import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-BA2Y6Crx.js";
6
- import { O as writeMatrixIdbSnapshotJsonToStore, S as readLegacyMatrixLegacyCryptoMigrationState, _ as hasMatrixRecoveryKeyStateInStore, a as openMatrixStorageMetaStoreOptions, b as openMatrixLegacyCryptoMigrationStoreOptions, f as MATRIX_IDB_SNAPSHOT_FILENAME, g as hasMatrixLegacyCryptoMigrationStateInStore, h as hasMatrixIdbSnapshotStateInStore, i as normalizeMatrixStorageMetadata, j as writeMatrixRecoveryKeyStateToStore, k as writeMatrixLegacyCryptoMigrationStateToStore, m as MATRIX_RECOVERY_KEY_FILENAME, n as hasMatrixStorageMetaStateInStore, p as MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME, u as writeMatrixStorageMetaStateToStore, w as readLegacyMatrixRecoveryKeyState, x as openMatrixRecoveryKeyStoreOptions, y as openMatrixIdbSnapshotStoreOptions } from "./storage-CzHxeF5E.js";
7
- import { a as readLegacyMatrixSyncCacheState, i as openMatrixSyncCacheStoreOptions, o as writeMatrixSyncCacheStateToStore, r as hasMatrixSyncCacheStateInStore } from "./file-sync-store-CPkgnSXp.js";
5
+ import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-CWVdlRQR.js";
6
+ import { C as readLegacyMatrixRecoveryKeyState, O as writeMatrixIdbSnapshotJsonToStore, T as readMatrixIdbSnapshotJsonFromStore, a as openMatrixStorageMetaStoreOptions, b as openMatrixRecoveryKeyStoreOptions, f as MATRIX_IDB_SNAPSHOT_FILENAME, g as hasMatrixRecoveryKeyStateInStore, h as hasMatrixLegacyCryptoMigrationStateInStore, i as normalizeMatrixStorageMetadata, j as writeMatrixRecoveryKeyStateToStore, k as writeMatrixLegacyCryptoMigrationStateToStore, m as MATRIX_RECOVERY_KEY_FILENAME, n as hasMatrixStorageMetaStateInStore, p as MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME, u as writeMatrixStorageMetaStateToStore, v as openMatrixIdbSnapshotStoreOptions, x as readLegacyMatrixLegacyCryptoMigrationState, y as openMatrixLegacyCryptoMigrationStoreOptions } from "./storage-BrkTJZov.js";
7
+ import { a as readLegacyMatrixSyncCacheState, i as openMatrixSyncCacheStoreOptions, o as writeMatrixSyncCacheStateToStore, r as hasMatrixSyncCacheStateInStore } from "./file-sync-store-DUEWCEjb.js";
8
+ import { n as MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS } from "./idb-persistence-lock-DAJ49nZX.js";
9
+ import { r as readLegacyMatrixIdbSnapshotStateUnlocked, t as isValidMatrixIdbSnapshotJson } from "./idb-persistence-C6zQfW2w.js";
8
10
  import { a as resolveMatrixInboundDedupeStateNamespace, n as MATRIX_INBOUND_DEDUPE_TTL_MS, r as buildMatrixInboundDedupeEventKey } from "./inbound-dedupe-CaBLblef.js";
9
- import { r as readLegacyMatrixIdbSnapshotState } from "./idb-persistence-Dyy6ipgU.js";
10
11
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
11
12
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
12
13
  import { archiveLegacyStateSource } from "openclaw/plugin-sdk/runtime-doctor";
13
- import { createHash } from "node:crypto";
14
+ import { createHash, randomUUID } from "node:crypto";
14
15
  import path from "node:path";
15
- import fs from "node:fs/promises";
16
+ import fs from "node:fs";
17
+ import fs$1 from "node:fs/promises";
18
+ import { isDeepStrictEqual } from "node:util";
19
+ import { withFileLock } from "openclaw/plugin-sdk/file-lock";
16
20
  import { createPersistentDedupeImportEntry } from "openclaw/plugin-sdk/persistent-dedupe";
21
+ //#region extensions/matrix/src/matrix/crypto-snapshot-doctor.ts
22
+ async function migrateLegacyMatrixIdbSnapshot(params) {
23
+ const snapshotPath = path.join(params.storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
24
+ try {
25
+ await withFileLock(snapshotPath, MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, () => migrateLegacyMatrixIdbSnapshotLocked(params));
26
+ } catch (err) {
27
+ params.warnings.push(`Failed locking Matrix IndexedDB snapshot for ${params.storageRootDir}: ${String(err)}; left legacy source in place`);
28
+ }
29
+ }
30
+ async function migrateLegacyMatrixIdbSnapshotLocked(params) {
31
+ const sourcePath = path.join(params.storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
32
+ let snapshot;
33
+ try {
34
+ snapshot = readLegacyMatrixIdbSnapshotStateUnlocked(params.storageRootDir);
35
+ } catch (err) {
36
+ params.warnings.push(`Failed reading Matrix IndexedDB snapshot legacy source for ${params.storageRootDir}: ${String(err)}; left source in place`);
37
+ return;
38
+ }
39
+ if (!snapshot) {
40
+ if (!fs.existsSync(sourcePath)) return;
41
+ const archived = await archiveLegacyMatrixIdbSnapshot(params);
42
+ params.warnings.push(archived ? `Matrix IndexedDB snapshot legacy source is invalid for ${params.storageRootDir}; archived without import` : `Matrix IndexedDB snapshot legacy source is invalid for ${params.storageRootDir}; left active because archival failed`);
43
+ return;
44
+ }
45
+ const snapshotJson = JSON.stringify(snapshot);
46
+ const store = params.context.openPluginStateKeyedStore(openMatrixIdbSnapshotStoreOptions(params.storageRootDir));
47
+ let persisted;
48
+ let hadPartialState;
49
+ try {
50
+ persisted = await readMatrixIdbSnapshotJsonFromStore({ store });
51
+ const persistedIsValid = persisted ? isValidMatrixIdbSnapshotJson(persisted) : false;
52
+ hadPartialState = !persistedIsValid && (await store.entries()).length > 0;
53
+ if (!persistedIsValid) persisted = null;
54
+ } catch (err) {
55
+ params.warnings.push(`Failed inspecting Matrix IndexedDB snapshot SQLite state for ${params.storageRootDir}: ${String(err)}; left legacy source in place`);
56
+ return;
57
+ }
58
+ if (persisted && !snapshotContentMatches(persisted, snapshot)) {
59
+ if (await archiveLegacyMatrixIdbSnapshot(params)) params.notices.push(`Kept the canonical Matrix IndexedDB snapshot in SQLite and archived a differing legacy source for ${params.storageRootDir}`);
60
+ return;
61
+ }
62
+ if (!persisted) {
63
+ try {
64
+ await writeMatrixIdbSnapshotJsonToStore({
65
+ snapshotJson,
66
+ databaseCount: snapshot.length,
67
+ store
68
+ });
69
+ persisted = await readMatrixIdbSnapshotJsonFromStore({ store });
70
+ } catch (err) {
71
+ params.warnings.push(`Failed importing Matrix IndexedDB snapshot for ${params.storageRootDir}: ${String(err)}; left legacy source in place`);
72
+ return;
73
+ }
74
+ if (!persisted || !snapshotContentMatches(persisted, snapshot)) {
75
+ params.warnings.push(`Failed verifying Matrix IndexedDB snapshot for ${params.storageRootDir}; left legacy source in place`);
76
+ return;
77
+ }
78
+ params.changes.push(hadPartialState ? `Repaired partial or invalid Matrix IndexedDB snapshot SQLite state for ${params.storageRootDir}` : `Migrated Matrix IndexedDB snapshot JSON to SQLite for ${params.storageRootDir}`);
79
+ }
80
+ await archiveLegacyMatrixIdbSnapshot(params);
81
+ }
82
+ function snapshotContentMatches(persistedJson, snapshot) {
83
+ try {
84
+ return isDeepStrictEqual(JSON.parse(persistedJson), snapshot);
85
+ } catch {
86
+ return false;
87
+ }
88
+ }
89
+ async function archiveLegacyMatrixIdbSnapshot(params) {
90
+ const sourcePath = path.join(params.storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
91
+ const archivePath = `${sourcePath}.migrated-${(/* @__PURE__ */ new Date()).toISOString().replaceAll(":", "-")}-${randomUUID()}`;
92
+ try {
93
+ await fs$1.rename(sourcePath, archivePath);
94
+ params.changes.push(`Archived Matrix IndexedDB snapshot legacy source -> ${archivePath}`);
95
+ return true;
96
+ } catch (err) {
97
+ params.warnings.push(`Failed archiving Matrix IndexedDB snapshot legacy source: ${String(err)}`);
98
+ return false;
99
+ }
100
+ }
101
+ //#endregion
17
102
  //#region extensions/matrix/src/matrix/monitor/inbound-dedupe-migration.ts
18
103
  const LEGACY_SQLITE_NAMESPACE = "inbound-dedupe";
19
104
  const LEGACY_SQLITE_MAX_ENTRIES = 2e4;
@@ -29,7 +114,7 @@ async function collectMatrixInboundDedupeSources(stateDir) {
29
114
  async function visit(dir) {
30
115
  let entries;
31
116
  try {
32
- entries = await fs.readdir(dir, { withFileTypes: true });
117
+ entries = await fs$1.readdir(dir, { withFileTypes: true });
33
118
  } catch {
34
119
  return;
35
120
  }
@@ -113,7 +198,7 @@ async function retireLegacyInboundDedupeSqliteRows(io, storageRootDir) {
113
198
  }
114
199
  async function resolveJsonRootAccountId(storageRootDir) {
115
200
  for (const filename of [STORAGE_META_FILENAME, `${STORAGE_META_FILENAME}.migrated`]) try {
116
- const metadata = normalizeMatrixStorageMetadata(JSON.parse(await fs.readFile(path.join(storageRootDir, filename), "utf8")));
201
+ const metadata = normalizeMatrixStorageMetadata(JSON.parse(await fs$1.readFile(path.join(storageRootDir, filename), "utf8")));
117
202
  if (metadata?.accountId) return metadata.accountId;
118
203
  } catch {}
119
204
  return "default";
@@ -125,7 +210,7 @@ async function resolveJsonRootAccountId(storageRootDir) {
125
210
  */
126
211
  async function readLegacyInboundDedupeJsonSource(storageRootDir) {
127
212
  const jsonPath = path.join(storageRootDir, MATRIX_LEGACY_INBOUND_DEDUPE_FILENAME);
128
- const raw = await fs.readFile(jsonPath, "utf8");
213
+ const raw = await fs$1.readFile(jsonPath, "utf8");
129
214
  let parsed;
130
215
  try {
131
216
  parsed = JSON.parse(raw);
@@ -208,7 +293,7 @@ async function collectLegacyMatrixCredentialSources(params) {
208
293
  const credentialsDir = resolveMatrixCredentialsDir(params.stateDir);
209
294
  let entries;
210
295
  try {
211
- entries = await fs.readdir(credentialsDir, { withFileTypes: true });
296
+ entries = await fs$1.readdir(credentialsDir, { withFileTypes: true });
212
297
  } catch {
213
298
  return [];
214
299
  }
@@ -227,8 +312,8 @@ async function collectLegacyMatrixCredentialSources(params) {
227
312
  async function readLegacyMatrixCredentials(source) {
228
313
  if (!source.accountId) return null;
229
314
  try {
230
- const raw = JSON.parse(await fs.readFile(source.filePath, "utf8"));
231
- const createdAt = isRecord(raw) && typeof raw.createdAt === "string" && raw.createdAt ? raw.createdAt : (await fs.stat(source.filePath)).mtime.toISOString();
315
+ const raw = JSON.parse(await fs$1.readFile(source.filePath, "utf8"));
316
+ const createdAt = isRecord(raw) && typeof raw.createdAt === "string" && raw.createdAt ? raw.createdAt : (await fs$1.stat(source.filePath)).mtime.toISOString();
232
317
  return normalizeMatrixStoredCredentials(isRecord(raw) ? {
233
318
  ...raw,
234
319
  createdAt
@@ -237,13 +322,13 @@ async function readLegacyMatrixCredentials(source) {
237
322
  return null;
238
323
  }
239
324
  }
240
- async function collectLegacyMatrixStateRoots(stateDir, filename) {
325
+ async function collectLegacyMatrixStateRoots(stateDir, filename, options) {
241
326
  const matrixRoot = path.join(stateDir, "matrix");
242
327
  const roots = [];
243
328
  async function visit(dir) {
244
329
  let entries;
245
330
  try {
246
- entries = await fs.readdir(dir, { withFileTypes: true });
331
+ entries = await fs$1.readdir(dir, { withFileTypes: true });
247
332
  } catch {
248
333
  return;
249
334
  }
@@ -257,14 +342,14 @@ async function collectLegacyMatrixStateRoots(stateDir, filename) {
257
342
  }
258
343
  }
259
344
  await visit(matrixRoot);
260
- return roots.filter((root) => path.resolve(root) !== path.resolve(matrixRoot)).toSorted();
345
+ return roots.filter((root) => options?.includeMatrixRoot || path.resolve(root) !== path.resolve(matrixRoot)).toSorted();
261
346
  }
262
347
  async function collectLegacySyncCacheRoots(stateDir) {
263
348
  return collectLegacyMatrixStateRoots(stateDir, MATRIX_SYNC_CACHE_FILENAME);
264
349
  }
265
350
  async function readLegacyMatrixStorageMetadata(storageRootDir) {
266
351
  try {
267
- return normalizeMatrixStorageMetadata(JSON.parse(await fs.readFile(path.join(storageRootDir, MATRIX_STORAGE_META_FILENAME), "utf8")));
352
+ return normalizeMatrixStorageMetadata(JSON.parse(await fs$1.readFile(path.join(storageRootDir, MATRIX_STORAGE_META_FILENAME), "utf8")));
268
353
  } catch {
269
354
  return null;
270
355
  }
@@ -592,74 +677,23 @@ const stateMigrations = [
592
677
  };
593
678
  }
594
679
  },
595
- {
596
- id: "matrix-idb-snapshot-json-to-plugin-state",
597
- label: "Matrix IndexedDB snapshot",
598
- async detectLegacyState(params) {
599
- const previews = [];
600
- for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_IDB_SNAPSHOT_FILENAME)) {
601
- if (!await readLegacyMatrixIdbSnapshotState(storageRootDir)) continue;
602
- previews.push(`Matrix IndexedDB snapshot JSON can migrate to SQLite: ${storageRootDir}`);
603
- }
604
- return previews.length > 0 ? { preview: previews } : null;
605
- },
606
- async migrateLegacyState(params) {
607
- const changes = [];
608
- const warnings = [];
609
- const notices = [];
610
- for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_IDB_SNAPSHOT_FILENAME)) {
611
- const snapshot = await readLegacyMatrixIdbSnapshotState(storageRootDir);
612
- if (!snapshot) continue;
613
- const store = params.context.openPluginStateKeyedStore(openMatrixIdbSnapshotStoreOptions(storageRootDir));
614
- if (await hasMatrixIdbSnapshotStateInStore({ store })) {
615
- await archiveLegacyMatrixStateFile({
616
- storageRootDir,
617
- filename: MATRIX_IDB_SNAPSHOT_FILENAME,
618
- label: "Matrix IndexedDB snapshot",
619
- changes,
620
- warnings,
621
- notices,
622
- notice: `Kept existing Matrix IndexedDB snapshot in SQLite and archived the legacy source for ${storageRootDir}`
623
- });
624
- continue;
625
- }
626
- await writeMatrixIdbSnapshotJsonToStore({
627
- snapshotJson: JSON.stringify(snapshot),
628
- databaseCount: snapshot.length,
629
- store
630
- });
631
- changes.push(`Migrated Matrix IndexedDB snapshot JSON to SQLite for ${storageRootDir}`);
632
- await archiveLegacyMatrixStateFile({
633
- storageRootDir,
634
- filename: MATRIX_IDB_SNAPSHOT_FILENAME,
635
- label: "Matrix IndexedDB snapshot",
636
- changes,
637
- warnings
638
- });
639
- }
640
- return {
641
- changes,
642
- warnings,
643
- ...notices.length > 0 ? { notices } : {}
644
- };
645
- }
646
- },
647
680
  {
648
681
  id: "matrix-legacy-crypto-migration-json-to-plugin-state",
649
- label: "Matrix legacy crypto migration",
682
+ label: "Matrix legacy crypto state",
650
683
  async detectLegacyState(params) {
651
684
  const previews = [];
652
- for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME)) {
685
+ for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME, { includeMatrixRoot: true })) {
653
686
  if (!readLegacyMatrixLegacyCryptoMigrationState(storageRootDir)) continue;
654
687
  previews.push(`Matrix legacy crypto migration JSON can migrate to SQLite: ${storageRootDir}`);
655
688
  }
689
+ for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_IDB_SNAPSHOT_FILENAME, { includeMatrixRoot: true })) previews.push(`Matrix IndexedDB snapshot JSON can migrate to SQLite: ${storageRootDir}`);
656
690
  return previews.length > 0 ? { preview: previews } : null;
657
691
  },
658
692
  async migrateLegacyState(params) {
659
693
  const changes = [];
660
694
  const warnings = [];
661
695
  const notices = [];
662
- for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME)) {
696
+ for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME, { includeMatrixRoot: true })) {
663
697
  const state = readLegacyMatrixLegacyCryptoMigrationState(storageRootDir);
664
698
  if (!state) continue;
665
699
  const store = params.context.openPluginStateKeyedStore(openMatrixLegacyCryptoMigrationStoreOptions(storageRootDir));
@@ -688,6 +722,13 @@ const stateMigrations = [
688
722
  warnings
689
723
  });
690
724
  }
725
+ for (const storageRootDir of await collectLegacyMatrixStateRoots(params.stateDir, MATRIX_IDB_SNAPSHOT_FILENAME, { includeMatrixRoot: true })) await migrateLegacyMatrixIdbSnapshot({
726
+ storageRootDir,
727
+ context: params.context,
728
+ changes,
729
+ notices,
730
+ warnings
731
+ });
691
732
  return {
692
733
  changes,
693
734
  warnings,
@@ -1,4 +1,4 @@
1
- import { n as editMessageMatrix, r as prepareMatrixSingleText, s as sendSingleTextMessageMatrix, y as MsgType } from "./send-BJbrdmNm.js";
1
+ import { n as editMessageMatrix, r as prepareMatrixSingleText, s as sendSingleTextMessageMatrix, y as MsgType } from "./send-CZCmDQu8.js";
2
2
  import { createDraftStreamLoop } from "openclaw/plugin-sdk/channel-outbound";
3
3
  //#region extensions/matrix/src/matrix/draft-stream.ts
4
4
  const DEFAULT_THROTTLE_MS = 1e3;
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
2
  import { t as isRecord } from "./record-shared-CWWx6fvI.js";
3
3
  import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
4
- import { M as resolveMatrixSqliteStateEnv, t as claimCurrentTokenStorageState } from "./storage-CzHxeF5E.js";
4
+ import { M as resolveMatrixSqliteStateEnv, t as claimCurrentTokenStorageState } from "./storage-BrkTJZov.js";
5
5
  import { n as LogService } from "./logger-D0GCSDQq.js";
6
6
  import { createHash, randomUUID } from "node:crypto";
7
7
  import path from "node:path";
@@ -211,7 +211,7 @@ async function fetchWithMatrixGuardedRedirects(params) {
211
211
  headers.delete("content-type");
212
212
  headers.delete("content-length");
213
213
  }
214
- response.body?.cancel();
214
+ response.body?.cancel().catch(() => void 0);
215
215
  await closeDispatcher(dispatcher);
216
216
  currentUrl = nextUrl;
217
217
  } catch (error) {
@@ -1,17 +1,24 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { D as writeMatrixIdbSnapshotJson, T as readMatrixIdbSnapshotJson, f as MATRIX_IDB_SNAPSHOT_FILENAME } from "./storage-CzHxeF5E.js";
1
+ import { D as writeMatrixIdbSnapshotJson, f as MATRIX_IDB_SNAPSHOT_FILENAME, w as readMatrixIdbSnapshotJson } from "./storage-BrkTJZov.js";
3
2
  import { n as LogService } from "./logger-D0GCSDQq.js";
4
3
  import { n as MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS } from "./idb-persistence-lock-DAJ49nZX.js";
5
4
  import path from "node:path";
6
5
  import fs from "node:fs";
7
- import { indexedDB } from "fake-indexeddb";
8
6
  import { withFileLock } from "openclaw/plugin-sdk/file-lock";
7
+ import { indexedDB } from "fake-indexeddb";
9
8
  //#region extensions/matrix/src/matrix/sdk/idb-persistence.ts
10
- var idb_persistence_exports = /* @__PURE__ */ __exportAll({
11
- persistIdbToDisk: () => persistIdbToDisk,
12
- readLegacyMatrixIdbSnapshotState: () => readLegacyMatrixIdbSnapshotState,
13
- restoreIdbFromDisk: () => restoreIdbFromDisk
14
- });
9
+ const LEGACY_SNAPSHOT_DIAGNOSTIC = {
10
+ code: "matrix-idb-snapshot-requires-doctor",
11
+ message: "Matrix IndexedDB snapshot exists outside canonical SQLite state",
12
+ remediation: "openclaw doctor --fix"
13
+ };
14
+ var MatrixIdbSnapshotMigrationRequiredError = class extends Error {
15
+ constructor() {
16
+ super(`${LEGACY_SNAPSHOT_DIAGNOSTIC.message}; run ${LEGACY_SNAPSHOT_DIAGNOSTIC.remediation}`);
17
+ this.code = LEGACY_SNAPSHOT_DIAGNOSTIC.code;
18
+ this.remediation = LEGACY_SNAPSHOT_DIAGNOSTIC.remediation;
19
+ this.name = "MatrixIdbSnapshotMigrationRequiredError";
20
+ }
21
+ };
15
22
  function isValidIdbIndexSnapshot(value) {
16
23
  if (!value || typeof value !== "object") return false;
17
24
  const candidate = value;
@@ -38,6 +45,13 @@ function parseSnapshotPayload(data) {
38
45
  if (!parsed.every((entry) => isValidIdbDatabaseSnapshot(entry))) throw new Error("Malformed IndexedDB snapshot payload");
39
46
  return parsed;
40
47
  }
48
+ function isValidMatrixIdbSnapshotJson(data) {
49
+ try {
50
+ return parseSnapshotPayload(data) !== null;
51
+ } catch {
52
+ return false;
53
+ }
54
+ }
41
55
  function idbReq(req) {
42
56
  return new Promise((resolve, reject) => {
43
57
  req.addEventListener("success", () => resolve(req.result), { once: true });
@@ -135,88 +149,83 @@ function resolveDefaultIdbSnapshotPath() {
135
149
  return path.join(stateDir, "matrix", "crypto-idb-snapshot.json");
136
150
  }
137
151
  async function restoreIdbFromDisk(snapshotPath) {
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
- }
152
+ const resolvedPath = snapshotPath ?? resolveDefaultIdbSnapshotPath();
153
+ const storageRootDir = path.dirname(resolvedPath);
154
+ let callbackStarted = false;
155
+ try {
156
+ return await withFileLock(resolvedPath, MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, async () => {
157
+ callbackStarted = true;
158
+ let storedSnapshotJson;
159
+ try {
160
+ storedSnapshotJson = readMatrixIdbSnapshotJson(storageRootDir);
161
+ } catch (err) {
162
+ if (fs.existsSync(resolvedPath)) throwLegacySnapshotMigrationRequired();
163
+ throw err;
164
+ }
165
+ throwIfLegacySnapshotNeedsDoctor(resolvedPath, storedSnapshotJson);
166
+ if (!storedSnapshotJson) return false;
167
+ const snapshot = parseSnapshotPayload(storedSnapshotJson);
168
+ if (!snapshot) return false;
169
+ await restoreIndexedDatabases(snapshot);
170
+ LogService.info("IdbPersistence", `Restored ${snapshot.length} IndexedDB database(s) from Matrix SQLite state`);
171
+ return true;
172
+ });
173
+ } catch (err) {
174
+ if (err instanceof MatrixIdbSnapshotMigrationRequiredError) throw err;
175
+ if (!callbackStarted && fs.existsSync(resolvedPath)) throwLegacySnapshotMigrationRequired();
176
+ LogService.warn("IdbPersistence", "Failed to restore IndexedDB snapshot from SQLite:", err);
177
+ return false;
180
178
  }
181
- return false;
182
179
  }
183
180
  async function persistIdbToDisk(params) {
184
181
  const snapshotPath = params?.snapshotPath ?? resolveDefaultIdbSnapshotPath();
182
+ let callbackStarted = false;
185
183
  try {
186
184
  fs.mkdirSync(path.dirname(snapshotPath), { recursive: true });
187
185
  const persistedCount = await withFileLock(snapshotPath, MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, async () => {
186
+ callbackStarted = true;
187
+ const storageRootDir = path.dirname(snapshotPath);
188
+ let storedSnapshotJson;
189
+ try {
190
+ storedSnapshotJson = readMatrixIdbSnapshotJson(storageRootDir);
191
+ } catch (err) {
192
+ if (fs.existsSync(snapshotPath)) throwLegacySnapshotMigrationRequired();
193
+ throw err;
194
+ }
195
+ throwIfLegacySnapshotNeedsDoctor(snapshotPath, storedSnapshotJson);
188
196
  const snapshot = await dumpIndexedDatabases(params?.databasePrefix);
189
197
  if (snapshot.length === 0) return 0;
190
198
  writeMatrixIdbSnapshotJson({
191
- storageRootDir: path.dirname(snapshotPath),
199
+ storageRootDir,
192
200
  snapshotJson: JSON.stringify(snapshot),
193
201
  databaseCount: snapshot.length
194
202
  });
195
- archiveLegacyIdbSnapshotFile(snapshotPath);
196
203
  return snapshot.length;
197
204
  });
198
205
  if (persistedCount === 0) return;
199
206
  LogService.debug("IdbPersistence", `Persisted ${persistedCount} IndexedDB database(s) to Matrix SQLite state`);
200
207
  } catch (err) {
208
+ if (err instanceof MatrixIdbSnapshotMigrationRequiredError) throw err;
209
+ if (!callbackStarted && fs.existsSync(snapshotPath)) throwLegacySnapshotMigrationRequired();
201
210
  LogService.warn("IdbPersistence", "Failed to persist IndexedDB snapshot:", err);
202
211
  }
203
212
  }
204
- async function readLegacyMatrixIdbSnapshotState(storageRootDir) {
213
+ function readLegacyMatrixIdbSnapshotStateUnlocked(storageRootDir) {
205
214
  const snapshotPath = path.join(storageRootDir, MATRIX_IDB_SNAPSHOT_FILENAME);
206
215
  if (!fs.existsSync(snapshotPath)) return null;
216
+ const data = fs.readFileSync(snapshotPath, "utf8");
207
217
  try {
208
- return await withFileLock(snapshotPath, MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, async () => {
209
- return parseSnapshotPayload(fs.readFileSync(snapshotPath, "utf8"));
210
- });
218
+ return parseSnapshotPayload(data);
211
219
  } catch {
212
220
  return null;
213
221
  }
214
222
  }
215
- function archiveLegacyIdbSnapshotFile(snapshotPath) {
216
- if (!fs.existsSync(snapshotPath)) return;
217
- const archivedPath = `${snapshotPath}.migrated`;
218
- if (fs.existsSync(archivedPath)) return;
219
- fs.renameSync(snapshotPath, archivedPath);
223
+ function throwIfLegacySnapshotNeedsDoctor(snapshotPath, storedSnapshotJson) {
224
+ if (fs.existsSync(snapshotPath) && (!storedSnapshotJson || !isValidMatrixIdbSnapshotJson(storedSnapshotJson))) throwLegacySnapshotMigrationRequired();
225
+ }
226
+ function throwLegacySnapshotMigrationRequired() {
227
+ LogService.warn("IdbPersistence", LEGACY_SNAPSHOT_DIAGNOSTIC);
228
+ throw new MatrixIdbSnapshotMigrationRequiredError();
220
229
  }
221
230
  function toLintErrorObject(value, fallbackMessage) {
222
231
  if (value instanceof Error) return value;
@@ -226,4 +235,4 @@ function toLintErrorObject(value, fallbackMessage) {
226
235
  return error;
227
236
  }
228
237
  //#endregion
229
- export { restoreIdbFromDisk as i, persistIdbToDisk as n, readLegacyMatrixIdbSnapshotState as r, idb_persistence_exports as t };
238
+ export { restoreIdbFromDisk as i, persistIdbToDisk as n, readLegacyMatrixIdbSnapshotStateUnlocked as r, isValidMatrixIdbSnapshotJson as t };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as registerMatrixCliMetadata } from "./cli-metadata-Xq1Xb15R.js";
1
+ import { n as registerMatrixCliMetadata } from "./cli-metadata-DAhDhbYX.js";
2
2
  import { registerMatrixSubagentHooks } from "./subagent-hooks-api.js";
3
3
  import { defineBundledChannelEntry } from "openclaw/plugin-sdk/channel-entry-contract";
4
4
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
@@ -1,4 +1,4 @@
1
- import { C as formatPollResultsAsText, D as parsePollStartContent, O as resolvePollReferenceEventId, S as formatPollAsText, T as isPollStartType, w as isPollEventType, x as buildPollResultsSummary } from "./send-BJbrdmNm.js";
1
+ import { C as formatPollResultsAsText, D as parsePollStartContent, O as resolvePollReferenceEventId, S as formatPollAsText, T as isPollStartType, w as isPollEventType, x as buildPollResultsSummary } from "./send-CZCmDQu8.js";
2
2
  import path from "node:path";
3
3
  //#region extensions/matrix/src/matrix/poll-summary.ts
4
4
  function resolveMatrixPollRootEventId(event) {
@@ -1,8 +1,8 @@
1
1
  import { r as isMatrixNotFoundError } from "./errors-C47hvAF8.js";
2
- import { T as isPollStartType, a as sendMessageMatrix, n as editMessageMatrix, w as isPollEventType } from "./send-BJbrdmNm.js";
2
+ import { T as isPollStartType, a as sendMessageMatrix, n as editMessageMatrix, w as isPollEventType } from "./send-CZCmDQu8.js";
3
3
  import { n as MATRIX_REACTION_EVENT_TYPE } from "./reaction-common-DkrQdBSZ.js";
4
- import { a as resolveMatrixMessageAttachment, l as resolveMatrixPollRootEventId, o as resolveMatrixMessageBody, s as fetchMatrixPollMessageSummary } from "./media-text-BMXEXb1j.js";
5
- import { r as withResolvedRoomAction } from "./client-BtG4quUl.js";
4
+ import { a as resolveMatrixMessageAttachment, l as resolveMatrixPollRootEventId, o as resolveMatrixMessageBody, s as fetchMatrixPollMessageSummary } from "./media-text-Cv1VIHXW.js";
5
+ import { r as withResolvedRoomAction } from "./client-BwX6rURh.js";
6
6
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
7
7
  import { resolveIntegerOption } from "openclaw/plugin-sdk/number-runtime";
8
8
  //#region extensions/matrix/src/matrix/actions/limits.ts
@@ -1,21 +1,21 @@
1
1
  import { a as resolveMatrixAccountConfig, i as resolveMatrixAccountAllowlistConfig } from "./account-config-BZWN9tGS.js";
2
2
  import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
3
- import { m as resolveConfiguredMatrixBotUserIds } from "./setup-core-XCdAx1nY.js";
4
- import { a as buildAllowlistResolutionSummary, c as createTypingCallbacks, d as logInboundDrop, f as logTypingFailure, h as toLocationContext, i as addAllowlistUserEntriesFromConfigEntry, l as formatLocationText, m as summarizeMapping, n as resolveMatrixStoredSessionMeta, o as canonicalizeAllowlistWithResolvedIds, p as patchAllowlistUsersInConfigEntries, r as resolveMatrixRoomConfig, s as createReplyPrefixOptions, u as getAgentScopedMediaLocalRoots } from "./channel-j331Xd7b.js";
5
- import { a as normalizeMatrixUserId, i as normalizeMatrixAllowList, o as resolveMatrixAllowListMatch } from "./config-schema-B5GRV8wL.js";
3
+ import { h as resolveConfiguredMatrixBotUserIds } from "./setup-core-D6gyoyeg.js";
4
+ import { a as buildAllowlistResolutionSummary, c as createTypingCallbacks, d as logInboundDrop, f as logTypingFailure, h as toLocationContext, i as addAllowlistUserEntriesFromConfigEntry, l as formatLocationText, m as summarizeMapping, n as resolveMatrixStoredSessionMeta, o as canonicalizeAllowlistWithResolvedIds, p as patchAllowlistUsersInConfigEntries, r as resolveMatrixRoomConfig, s as createReplyPrefixOptions, u as getAgentScopedMediaLocalRoots } from "./channel-MBtrY36B.js";
5
+ import { a as normalizeMatrixUserId, i as normalizeMatrixAllowList, o as resolveMatrixAllowListMatch } from "./config-schema-CggnuwnJ.js";
6
6
  import { t as isMatrixQualifiedUserId } from "./target-ids-B-5aQxwn.js";
7
7
  import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
8
- import { D as parsePollStartContent, S as formatPollAsText, T as isPollStartType, _ as readJoinedMatrixMembers, a as sendMessageMatrix, f as promoteMatrixDirectRoomCandidate, g as isStrictDirectMembership, h as hasDirectMatrixMemberFlag, t as chunkMatrixText, v as MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY, w as isPollEventType } from "./send-BJbrdmNm.js";
9
- import { t as createMatrixThreadBindingManager } from "./thread-bindings-Cw194yEn.js";
8
+ import { D as parsePollStartContent, S as formatPollAsText, T as isPollStartType, _ as readJoinedMatrixMembers, a as sendMessageMatrix, f as promoteMatrixDirectRoomCandidate, g as isStrictDirectMembership, h as hasDirectMatrixMemberFlag, t as chunkMatrixText, v as MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY, w as isPollEventType } from "./send-CZCmDQu8.js";
9
+ import { t as createMatrixThreadBindingManager } from "./thread-bindings-BcYBELC7.js";
10
10
  import { i as createMatrixInboundEventDeduper } from "./inbound-dedupe-CaBLblef.js";
11
- import { a as resolveMatrixMessageAttachment, c as fetchMatrixPollSnapshot, i as isLikelyBareFilename, n as formatMatrixMediaUnavailableText, o as resolveMatrixMessageBody, r as formatMatrixMessageText, t as formatMatrixMediaTooLargeText } from "./media-text-BMXEXb1j.js";
11
+ import { a as resolveMatrixMessageAttachment, c as fetchMatrixPollSnapshot, i as isLikelyBareFilename, n as formatMatrixMediaUnavailableText, o as resolveMatrixMessageBody, r as formatMatrixMessageText, t as formatMatrixMediaTooLargeText } from "./media-text-Cv1VIHXW.js";
12
12
  import { n as setActiveMatrixClient } from "./active-client-DXvz2gCo.js";
13
13
  import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
14
- import { d as backfillMatrixAuthDeviceIdAfterStartup, f as resolveMatrixAuth, i as resolveSharedMatrixClient, l as isMatrixStartupAbortError, n as releaseSharedClientInstance, p as resolveMatrixAuthContext, u as throwIfMatrixStartupAborted } from "./shared-DquM1oz6.js";
15
- import "./client-CA0PULls.js";
16
- import { i as isMatrixMediaSizeLimitError, r as MatrixMediaSizeLimitError } from "./http-client-BmrgOZTL.js";
14
+ import { d as backfillMatrixAuthDeviceIdAfterStartup, f as resolveMatrixAuth, i as resolveSharedMatrixClient, l as isMatrixStartupAbortError, n as releaseSharedClientInstance, p as resolveMatrixAuthContext, u as throwIfMatrixStartupAborted } from "./shared-C7Vm9RxI.js";
15
+ import "./client-Dg8dk8NW.js";
16
+ import { i as isMatrixMediaSizeLimitError, r as MatrixMediaSizeLimitError } from "./http-client-DOyTG9l2.js";
17
17
  import { d as resolveAllowlistProviderRuntimeGroupPolicy, f as resolveDefaultGroupPolicy, g as warnMissingProviderGroupPolicyFallbackOnce, h as resolveThreadBindingMaxAgeMsForChannel, m as resolveThreadBindingIdleTimeoutMsForChannel, t as GROUP_POLICY_BLOCKED_LABEL } from "./runtime-api-D1xI_cvh.js";
18
- import { t as resolveMatrixTargets } from "./resolve-targets-DVoj-YxB.js";
18
+ import { t as resolveMatrixTargets } from "./resolve-targets-Dn11HT76.js";
19
19
  import { t as formatMatrixEncryptedEventDisabledWarning } from "./encryption-guidance-CbEFe38F.js";
20
20
  import { n as isMatrixReadySyncState, r as isMatrixTerminalSyncState, t as isMatrixDisconnectedSyncState } from "./sync-state-CWbp0QSY.js";
21
21
  import { a as EventType, i as resolveMatrixThreadRouting, n as resolveMatrixReplyToEventId, o as RelationType, r as resolveMatrixThreadRootId, t as resolveMatrixInboundRoute } from "./route-DY6at4qJ.js";
@@ -818,7 +818,7 @@ const matrixVerificationConstants = {
818
818
  const MAX_TRACKED_VERIFICATION_EVENTS = 1024;
819
819
  const SAS_NOTICE_RETRY_DELAY_MS = 750;
820
820
  const VERIFICATION_EVENT_STARTUP_GRACE_MS = 3e4;
821
- const loadMatrixDirectRoomDeps = createLazyRuntimeModule(() => Promise.all([import("./send-BJbrdmNm.js").then((n) => n.d), import("./send-BJbrdmNm.js").then((n) => n.m)]).then(([directManagementModule, directRoomModule]) => ({
821
+ const loadMatrixDirectRoomDeps = createLazyRuntimeModule(() => Promise.all([import("./send-CZCmDQu8.js").then((n) => n.d), import("./send-CZCmDQu8.js").then((n) => n.m)]).then(([directManagementModule, directRoomModule]) => ({
822
822
  inspectMatrixDirectRooms: directManagementModule.inspectMatrixDirectRooms,
823
823
  isStrictDirectRoom: directRoomModule.isStrictDirectRoom
824
824
  })));
@@ -1691,8 +1691,10 @@ async function resolveMatrixPreflightAudioTranscript(params) {
1691
1691
  if (params.abortSignal?.aborted) return;
1692
1692
  const transcript = await transcribeFirstAudio({
1693
1693
  ctx: {
1694
- MediaPaths: [params.mediaPath],
1695
- MediaTypes: params.mediaContentType ? [params.mediaContentType] : void 0,
1694
+ media: [{
1695
+ path: params.mediaPath,
1696
+ contentType: params.mediaContentType
1697
+ }],
1696
1698
  Provider: "matrix",
1697
1699
  Surface: "matrix",
1698
1700
  OriginatingChannel: "matrix",
@@ -2205,11 +2207,11 @@ function createMatrixThreadContextResolver(params) {
2205
2207
  const ALLOW_FROM_STORE_CACHE_TTL_MS = 3e4;
2206
2208
  const PAIRING_REPLY_COOLDOWN_MS = 5 * 6e4;
2207
2209
  const MATRIX_TOOL_PROGRESS_MAX_CHARS = 300;
2208
- const loadMatrixSendModule = createLazyRuntimeModule(() => import("./send-BJbrdmNm.js").then((n) => n.l));
2210
+ const loadMatrixSendModule = createLazyRuntimeModule(() => import("./send-CZCmDQu8.js").then((n) => n.l));
2209
2211
  const loadAcpBindingRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/acp-binding-runtime"));
2210
2212
  const loadSessionBindingRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/session-binding-runtime"));
2211
- const loadMatrixReactionEvents = createLazyRuntimeModule(() => import("./reaction-events-BwAKtUyQ.js"));
2212
- const loadMatrixDraftStream = createLazyRuntimeModule(() => import("./draft-stream-CTLKtJJ0.js"));
2213
+ const loadMatrixReactionEvents = createLazyRuntimeModule(() => import("./reaction-events-Cj6thhmc.js"));
2214
+ const loadMatrixDraftStream = createLazyRuntimeModule(() => import("./draft-stream-BfibauH1.js"));
2213
2215
  async function matrixTextWouldActivateMentions(client, text) {
2214
2216
  const { resolveMatrixMentionsForBody } = await loadMatrixSendModule();
2215
2217
  const mentions = await resolveMatrixMentionsForBody({
@@ -2797,7 +2799,7 @@ function createMatrixRoomMessageHandler(params) {
2797
2799
  cfg,
2798
2800
  surface: "matrix"
2799
2801
  });
2800
- const useAccessGroups = cfg.commands?.useAccessGroups !== false;
2802
+ const useAccessGroups = true;
2801
2803
  const commandCheckText = stripMatrixMentionPrefix({
2802
2804
  text: mentionPrecheckText,
2803
2805
  userId: selfUserId,
@@ -3146,6 +3148,7 @@ function createMatrixRoomMessageHandler(params) {
3146
3148
  bodyForAgent: bodyText,
3147
3149
  inboundHistory: inboundHistory && inboundHistory.length > 0 ? inboundHistory : void 0
3148
3150
  },
3151
+ sessionTranscript: { historyLimit: isRoom ? historyLimit : 0 },
3149
3152
  access: {
3150
3153
  ...isRoom ? { mentions: {
3151
3154
  canDetectMention: true,
@@ -3805,10 +3808,10 @@ function shouldPromoteRecentInviteRoom(params) {
3805
3808
  //#endregion
3806
3809
  //#region extensions/matrix/src/matrix/monitor/startup.ts
3807
3810
  const loadMatrixStartupMaintenanceDeps = createLazyRuntimeModule(() => Promise.all([
3808
- import("./setup-core-XCdAx1nY.js").then((n) => n.s),
3811
+ import("./setup-core-D6gyoyeg.js").then((n) => n.c),
3809
3812
  import("./device-health-D4LBxuPq.js"),
3810
- import("./setup-core-XCdAx1nY.js").then((n) => n.a),
3811
- import("./startup-verification-CA00kebL.js")
3813
+ import("./setup-core-D6gyoyeg.js").then((n) => n.o),
3814
+ import("./startup-verification-D1nscMh8.js")
3812
3815
  ]).then(([configUpdateModule, deviceHealthModule, profileModule, startupVerificationModule]) => ({
3813
3816
  updateMatrixAccountConfig: configUpdateModule.updateMatrixAccountConfig,
3814
3817
  summarizeMatrixDeviceHealth: deviceHealthModule.summarizeMatrixDeviceHealth,
@@ -2,7 +2,7 @@ import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
2
2
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
3
3
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  //#region extensions/matrix/src/plugin-entry.runtime.ts
5
- const loadMatrixVerificationRuntime = createLazyRuntimeModule(() => import("./verification-DjxyWTNP.js").then((n) => n.y));
5
+ const loadMatrixVerificationRuntime = createLazyRuntimeModule(() => import("./verification-DhMBWxOJ.js").then((n) => n.y));
6
6
  function sendError(respond, err) {
7
7
  respond(false, { error: formatMatrixErrorMessage(err) });
8
8
  }