@openclaw/matrix 2026.5.28 → 2026.5.31-beta.1

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 (76) hide show
  1. package/dist/api.js +7 -7
  2. package/dist/{approval-handler.runtime-Cso-m9Q7.js → approval-handler.runtime-Dzh_2MS1.js} +5 -5
  3. package/dist/{approval-ids-IrHynnHK.js → approval-ids-CXPPSyAr.js} +1 -1
  4. package/dist/{approval-reaction-auth-D0nZ_4ik.js → approval-reaction-auth-m-11_ajL.js} +2 -2
  5. package/dist/auth-presence.js +1 -1
  6. package/dist/{channel-D7FK_lEY.js → channel-BwpVY2Ne.js} +23 -18
  7. package/dist/channel-plugin-api.js +1 -1
  8. package/dist/{channel.runtime-CBrW2dLp.js → channel.runtime-CUBxoFwA.js} +8 -8
  9. package/dist/{cli-C1xFg7Q-.js → cli-CaF5tlL-.js} +14 -13
  10. package/dist/{cli-metadata-zz9Cmwcs.js → cli-metadata-gFTG9oJL.js} +1 -1
  11. package/dist/cli-metadata.js +1 -1
  12. package/dist/{client-BIBY50VG.js → client-D-t6CdHz.js} +2 -2
  13. package/dist/{client-bootstrap-Chmkqhy7.js → client-bootstrap-DOlQb7Jx.js} +1 -1
  14. package/dist/{client-BMoZSA2L.js → client-spaouc7I.js} +2 -2
  15. package/dist/{config-schema-wK02TzmZ.js → config-schema-DfjBrYch.js} +21 -4
  16. package/dist/contract-api.js +4 -4
  17. package/dist/{create-client-B1a3Am-I.js → create-client-B4CPKa5P.js} +3 -3
  18. package/dist/{credentials-CDjQjIds.js → credentials-Bi0pTJDK.js} +1 -1
  19. package/dist/{credentials-read-DySnJlLx.js → credentials-read-DpxFOhx0.js} +2 -2
  20. package/dist/{credentials-write.runtime-Ca2MN99y.js → credentials-write.runtime-BB5QuM4Z.js} +1 -1
  21. package/dist/{crypto-runtime-oweQ3RiB.js → crypto-runtime-3hgwY-d6.js} +7 -6
  22. package/dist/{directory-live-M-3KeudM.js → directory-live-DgjzYeC_.js} +2 -2
  23. package/dist/{doctor-CENc9ks0.js → doctor-BKjr6uua.js} +17 -4
  24. package/dist/{draft-stream-r49dgIZc.js → draft-stream-eaBWrjVK.js} +1 -1
  25. package/dist/{encryption-guidance-CU-OAPMg.js → encryption-guidance-aEUzD940.js} +1 -1
  26. package/dist/helper-api.js +2 -2
  27. package/dist/index.js +2 -2
  28. package/dist/{legacy-crypto-restore-BgW3I87R.js → legacy-crypto-restore--9Wu5rsx.js} +1 -1
  29. package/dist/{logging-yEwXx4Hm.js → logging-C7wjdKK5.js} +1 -1
  30. package/dist/{matrix-migration.runtime-CZOep_JX.js → matrix-migration.runtime-RzIEp7RP.js} +3 -3
  31. package/dist/{media-text-C4IBQI5B.js → media-text-C2Wor3Gj.js} +1 -1
  32. package/dist/{messages-CMx2qIs1.js → messages-D0sumPNx.js} +3 -3
  33. package/dist/{monitor-COOR-Ksj.js → monitor-gDaABWfA.js} +140 -108
  34. package/dist/plugin-entry.handlers.runtime.js +1 -1
  35. package/dist/probe.runtime-BegszwhP.js +3 -0
  36. package/dist/{profile-update-Cl7wAFCq.js → profile-update-Defy1W90.js} +2 -2
  37. package/dist/{reaction-events-D3jtYqTp.js → reaction-events-Bh2u-_9j.js} +1 -1
  38. package/dist/{recovery-key-store-DfQ_9s6u.js → recovery-key-store-BRnvY8XS.js} +1 -1
  39. package/dist/{resolve-targets-D-K3tTPe.js → resolve-targets-CLuzv_Jl.js} +1 -1
  40. package/dist/{resolver.runtime-BRG9o8iL.js → resolver.runtime-VywXDAZv.js} +1 -1
  41. package/dist/runtime-api.js +3 -3
  42. package/dist/runtime-heavy-api.js +1 -1
  43. package/dist/{sdk-ymjYByhr.js → sdk-C2iC7PJZ.js} +6 -6
  44. package/dist/{send-peVVVL75.js → send-DHj1E9ji.js} +6 -4
  45. package/dist/{setup-bootstrap-CiX7Pd07.js → setup-bootstrap-kTPKb7jR.js} +2 -2
  46. package/dist/{setup-core-DOhHYRrZ.js → setup-core-DRg3cgB8.js} +4 -4
  47. package/dist/setup-plugin-api.js +3 -3
  48. package/dist/{setup-surface-CrUp7oeN.js → setup-surface-soZQLgfu.js} +6 -6
  49. package/dist/{shared-CmsjJY4i.js → shared-DjJds8e0.js} +6 -6
  50. package/dist/startup-verification-CWLSyFen.js +233 -0
  51. package/dist/{storage-onzulLbU.js → storage-Ds-2Iur5.js} +18 -6
  52. package/dist/subagent-hooks-api.js +18 -2
  53. package/dist/{subagent-hooks-api-bedE4GYl.js → subagent-hooks-dkPAF6Et.js} +3 -30
  54. package/dist/{thread-bindings-DAg6grT8.js → thread-bindings-DehFUArg.js} +142 -39
  55. package/dist/{tool-actions.runtime-DwbLBrRr.js → tool-actions.runtime-CU79qJ3e.js} +7 -7
  56. package/dist/{verification-BM7g0BeT.js → verification-BJfjKMr8.js} +2 -2
  57. package/node_modules/@babel/runtime/package.json +1 -1
  58. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/.node-version +1 -1
  59. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/CHANGELOG.md +32 -1
  60. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/README.md +3 -3
  61. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/index.d.ts +195 -15
  62. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/index.js +6 -1
  63. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/package.json +3 -3
  64. package/node_modules/typebox/build/type/script/mapping.d.mts +5 -2
  65. package/node_modules/typebox/build/type/script/mapping.mjs +15 -8
  66. package/node_modules/typebox/build/type/script/parser.d.mts +3 -1
  67. package/node_modules/typebox/build/type/script/parser.mjs +2 -1
  68. package/node_modules/typebox/package.json +29 -29
  69. package/npm-shrinkwrap.json +15 -15
  70. package/openclaw.plugin.json +46 -0
  71. package/package.json +6 -6
  72. package/dist/probe.runtime-DgSABMiF.js +0 -3
  73. package/dist/startup-verification-BmTEngvU.js +0 -132
  74. package/dist/{account-selection-C3arLOhC.js → account-selection-DEMtY2cn.js} +1 -1
  75. package/dist/{runtime-api-CsF7Kokd.js → runtime-api-CsBoesCU.js} +2 -2
  76. package/dist/{storage-paths-BV2Z7bns.js → storage-paths-BWo_ZEMC.js} +1 -1
@@ -1,13 +1,39 @@
1
+ import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
1
2
  import { a as listBindingsForAccount, c as resolveBindingKey, f as setMatrixThreadBindingManagerEntry, h as toSessionBindingRecord, l as resolveEffectiveBindingExpiry, m as toMatrixBindingTargetKind, o as removeBindingRecord, r as getMatrixThreadBindingManagerEntry, t as deleteMatrixThreadBindingManagerEntry, u as setBindingRecord } from "./thread-bindings-shared-CKnY4LSd.js";
2
- import { i as resolveMatrixStateFilePath, t as claimCurrentTokenStorageState } from "./storage-onzulLbU.js";
3
- import { a as sendMessageMatrix } from "./send-peVVVL75.js";
3
+ import { a as resolveMatrixStateFilePath, t as claimCurrentTokenStorageState } from "./storage-Ds-2Iur5.js";
4
+ import { a as sendMessageMatrix } from "./send-DHj1E9ji.js";
4
5
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
- import { registerSessionBindingAdapter, resolveThreadBindingFarewellText, unregisterSessionBindingAdapter } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
6
+ import os from "node:os";
6
7
  import path from "node:path";
7
- import { readJsonFileWithFallback, writeJsonFileAtomically } from "openclaw/plugin-sdk/json-store";
8
+ import { createHash } from "node:crypto";
9
+ import { registerSessionBindingAdapter, resolveThreadBindingFarewellText, unregisterSessionBindingAdapter } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
10
+ import { readJsonFileWithFallback } from "openclaw/plugin-sdk/json-store";
11
+ import fs from "node:fs/promises";
8
12
  import { resolveAgentIdFromSessionKey } from "openclaw/plugin-sdk/session-key-runtime";
13
+ //#region extensions/matrix/src/matrix/sqlite-state.ts
14
+ function resolveStateDirOverride(options) {
15
+ if (!options) return;
16
+ if (options.stateDir) return options.stateDir;
17
+ if (options.stateRootDir) return options.stateRootDir;
18
+ return getMatrixRuntime().state.resolveStateDir(options.env ?? process.env, os.homedir);
19
+ }
20
+ function resolveMatrixSqliteStateKey(options) {
21
+ return resolveStateDirOverride(options) ?? "";
22
+ }
23
+ function resolveMatrixSqliteStateEnv(options) {
24
+ const stateDir = resolveStateDirOverride(options);
25
+ if (!stateDir) return options?.env;
26
+ return {
27
+ ...options?.env ?? process.env,
28
+ OPENCLAW_STATE_DIR: stateDir
29
+ };
30
+ }
31
+ //#endregion
9
32
  //#region extensions/matrix/src/matrix/thread-bindings.ts
10
33
  const STORE_VERSION = 1;
34
+ const THREAD_BINDINGS_NAMESPACE = "thread-bindings";
35
+ const THREAD_BINDINGS_MIGRATIONS_NAMESPACE = "thread-bindings-migrations";
36
+ const THREAD_BINDINGS_MAX_ENTRIES = 1e4;
11
37
  const THREAD_BINDINGS_SWEEP_INTERVAL_MS = 6e4;
12
38
  const TOUCH_PERSIST_DELAY_MS = 3e4;
13
39
  function resolveBindingsPath(params) {
@@ -19,43 +45,81 @@ function resolveBindingsPath(params) {
19
45
  filename: "thread-bindings.json"
20
46
  });
21
47
  }
22
- async function loadBindingsFromDisk(filePath, accountId) {
48
+ function createThreadBindingStore(params) {
49
+ return getMatrixRuntime().state.openKeyedStore({
50
+ namespace: THREAD_BINDINGS_NAMESPACE,
51
+ maxEntries: THREAD_BINDINGS_MAX_ENTRIES,
52
+ env: resolveMatrixSqliteStateEnv(params)
53
+ });
54
+ }
55
+ function createThreadBindingMigrationStore(params) {
56
+ return getMatrixRuntime().state.openKeyedStore({
57
+ namespace: THREAD_BINDINGS_MIGRATIONS_NAMESPACE,
58
+ maxEntries: 1e3,
59
+ env: resolveMatrixSqliteStateEnv(params)
60
+ });
61
+ }
62
+ function buildThreadBindingStoreKey(record) {
63
+ const digest = createHash("sha256").update(record.accountId).update("\0").update(record.parentConversationId ?? "").update("\0").update(record.conversationId).digest("hex");
64
+ return `${record.accountId}:${digest}`;
65
+ }
66
+ function buildLegacyThreadBindingsImportKey(params) {
67
+ const digest = createHash("sha256").update(params.accountId).update("\0").update(params.legacyFilePath).digest("hex");
68
+ return `${params.accountId}:${digest}`;
69
+ }
70
+ function normalizeBindingRecord(entry, accountId) {
71
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) return null;
72
+ const record = entry;
73
+ if (record.accountId && record.accountId !== accountId) return null;
74
+ const conversationId = normalizeOptionalString(record.conversationId);
75
+ const parentConversationId = normalizeOptionalString(record.parentConversationId);
76
+ const targetSessionKey = normalizeOptionalString(record.targetSessionKey) ?? "";
77
+ if (!conversationId || !targetSessionKey) return null;
78
+ const boundAt = typeof record.boundAt === "number" && Number.isFinite(record.boundAt) ? Math.floor(record.boundAt) : Date.now();
79
+ const lastActivityAt = typeof record.lastActivityAt === "number" && Number.isFinite(record.lastActivityAt) ? Math.floor(record.lastActivityAt) : boundAt;
80
+ return {
81
+ accountId,
82
+ conversationId,
83
+ ...parentConversationId ? { parentConversationId } : {},
84
+ targetKind: record.targetKind === "subagent" ? "subagent" : "acp",
85
+ targetSessionKey,
86
+ agentId: normalizeOptionalString(record.agentId) || void 0,
87
+ label: normalizeOptionalString(record.label) || void 0,
88
+ boundBy: normalizeOptionalString(record.boundBy) || void 0,
89
+ boundAt,
90
+ lastActivityAt: Math.max(lastActivityAt, boundAt),
91
+ idleTimeoutMs: typeof record.idleTimeoutMs === "number" && Number.isFinite(record.idleTimeoutMs) ? Math.max(0, Math.floor(record.idleTimeoutMs)) : void 0,
92
+ maxAgeMs: typeof record.maxAgeMs === "number" && Number.isFinite(record.maxAgeMs) ? Math.max(0, Math.floor(record.maxAgeMs)) : void 0
93
+ };
94
+ }
95
+ async function loadBindingsFromLegacyDisk(filePath, accountId) {
23
96
  const { value } = await readJsonFileWithFallback(filePath, null);
24
97
  if (value?.version !== STORE_VERSION || !Array.isArray(value.bindings)) return [];
25
98
  const loaded = [];
26
99
  for (const entry of value.bindings) {
27
- const conversationId = normalizeOptionalString(entry?.conversationId);
28
- const parentConversationId = normalizeOptionalString(entry?.parentConversationId);
29
- const targetSessionKey = normalizeOptionalString(entry?.targetSessionKey) ?? "";
30
- if (!conversationId || !targetSessionKey) continue;
31
- const boundAt = typeof entry?.boundAt === "number" && Number.isFinite(entry.boundAt) ? Math.floor(entry.boundAt) : Date.now();
32
- const lastActivityAt = typeof entry?.lastActivityAt === "number" && Number.isFinite(entry.lastActivityAt) ? Math.floor(entry.lastActivityAt) : boundAt;
33
- loaded.push({
34
- accountId,
35
- conversationId,
36
- ...parentConversationId ? { parentConversationId } : {},
37
- targetKind: entry?.targetKind === "subagent" ? "subagent" : "acp",
38
- targetSessionKey,
39
- agentId: normalizeOptionalString(entry?.agentId) || void 0,
40
- label: normalizeOptionalString(entry?.label) || void 0,
41
- boundBy: normalizeOptionalString(entry?.boundBy) || void 0,
42
- boundAt,
43
- lastActivityAt: Math.max(lastActivityAt, boundAt),
44
- idleTimeoutMs: typeof entry?.idleTimeoutMs === "number" && Number.isFinite(entry.idleTimeoutMs) ? Math.max(0, Math.floor(entry.idleTimeoutMs)) : void 0,
45
- maxAgeMs: typeof entry?.maxAgeMs === "number" && Number.isFinite(entry.maxAgeMs) ? Math.max(0, Math.floor(entry.maxAgeMs)) : void 0
46
- });
100
+ const record = normalizeBindingRecord(entry, accountId);
101
+ if (record) loaded.push(record);
47
102
  }
48
103
  return loaded;
49
104
  }
50
- function toStoredBindingsState(bindings) {
51
- return {
52
- version: STORE_VERSION,
53
- bindings: [...bindings].toSorted((a, b) => a.boundAt - b.boundAt)
54
- };
105
+ async function loadBindingsFromPluginState(params) {
106
+ const store = createThreadBindingStore(params);
107
+ const loaded = [];
108
+ for (const entry of await store.entries()) {
109
+ const record = normalizeBindingRecord(entry.value, params.accountId);
110
+ if (record) loaded.push(record);
111
+ }
112
+ return loaded;
113
+ }
114
+ function toPluginJsonValue(value) {
115
+ const serialized = JSON.stringify(value);
116
+ return JSON.parse(serialized);
55
117
  }
56
- async function persistBindingsSnapshot(filePath, bindings) {
57
- await writeJsonFileAtomically(filePath, toStoredBindingsState(bindings));
58
- claimCurrentTokenStorageState({ rootDir: path.dirname(filePath) });
118
+ async function persistBindingsSnapshot(params) {
119
+ const store = createThreadBindingStore(params);
120
+ const liveKeys = new Set(params.bindings.map((record) => buildThreadBindingStoreKey(record)));
121
+ for (const entry of await store.entries()) if (normalizeBindingRecord(entry.value, params.accountId) && !liveKeys.has(entry.key)) await store.delete(entry.key);
122
+ for (const record of params.bindings) await store.register(buildThreadBindingStoreKey(record), toPluginJsonValue(record));
59
123
  }
60
124
  function buildMatrixBindingIntroText(params) {
61
125
  const introText = normalizeOptionalString(params.metadata?.introText);
@@ -94,24 +158,56 @@ async function sendFarewellMessage(params) {
94
158
  }
95
159
  async function createMatrixThreadBindingManager(params) {
96
160
  if (params.auth.accountId !== params.accountId) throw new Error(`Matrix thread binding account mismatch: requested ${params.accountId}, auth resolved ${params.auth.accountId}`);
97
- const filePath = resolveBindingsPath({
161
+ const legacyFilePath = resolveBindingsPath({
98
162
  auth: params.auth,
99
163
  accountId: params.accountId,
100
164
  env: params.env,
101
165
  stateDir: params.stateDir
102
166
  });
167
+ const sqliteStateDir = path.dirname(legacyFilePath);
168
+ const storageKey = resolveMatrixSqliteStateKey({
169
+ env: params.env,
170
+ stateDir: sqliteStateDir
171
+ });
103
172
  const existingEntry = getMatrixThreadBindingManagerEntry(params.accountId);
104
173
  if (existingEntry) {
105
- if (existingEntry.filePath === filePath) return existingEntry.manager;
174
+ if (existingEntry.storageKey === storageKey) return existingEntry.manager;
106
175
  existingEntry.manager.stop();
107
176
  }
108
- const loaded = await loadBindingsFromDisk(filePath, params.accountId);
177
+ const pluginLoaded = await loadBindingsFromPluginState({
178
+ accountId: params.accountId,
179
+ env: params.env,
180
+ stateDir: sqliteStateDir
181
+ });
182
+ const migrationStore = createThreadBindingMigrationStore({
183
+ env: params.env,
184
+ stateDir: sqliteStateDir
185
+ });
186
+ const legacyImportKey = buildLegacyThreadBindingsImportKey({
187
+ accountId: params.accountId,
188
+ legacyFilePath
189
+ });
190
+ const pluginLoadedKeys = new Set(pluginLoaded.map((record) => buildThreadBindingStoreKey(record)));
191
+ let legacyHadRows = false;
192
+ let legacyLoaded = [];
193
+ if (!await migrationStore.lookup(legacyImportKey)) {
194
+ const legacyCandidates = await loadBindingsFromLegacyDisk(legacyFilePath, params.accountId);
195
+ legacyHadRows = legacyCandidates.length > 0;
196
+ legacyLoaded = legacyCandidates.filter((record) => !pluginLoadedKeys.has(buildThreadBindingStoreKey(record)));
197
+ }
198
+ const loaded = [...pluginLoaded, ...legacyLoaded];
109
199
  for (const record of loaded) setBindingRecord(record);
110
200
  let persistQueue = Promise.resolve();
111
201
  const enqueuePersist = (bindings) => {
112
202
  const snapshot = bindings ?? listBindingsForAccount(params.accountId);
113
203
  const next = persistQueue.catch(() => {}).then(async () => {
114
- await persistBindingsSnapshot(filePath, snapshot);
204
+ await persistBindingsSnapshot({
205
+ accountId: params.accountId,
206
+ bindings: snapshot,
207
+ env: params.env,
208
+ stateDir: sqliteStateDir
209
+ });
210
+ claimCurrentTokenStorageState({ rootDir: sqliteStateDir });
115
211
  });
116
212
  persistQueue = next;
117
213
  return next;
@@ -126,6 +222,13 @@ async function createMatrixThreadBindingManager(params) {
126
222
  idleTimeoutMs: params.idleTimeoutMs,
127
223
  maxAgeMs: params.maxAgeMs
128
224
  };
225
+ if (legacyHadRows) {
226
+ if (legacyLoaded.length > 0) await persist();
227
+ await migrationStore.register(legacyImportKey, { importedAt: Date.now() });
228
+ await fs.rm(legacyFilePath, { force: true }).catch((err) => {
229
+ params.logVerboseMessage?.(`matrix: failed removing migrated legacy thread bindings account=${params.accountId}: ${String(err)}`);
230
+ });
231
+ }
129
232
  let persistTimer = null;
130
233
  const schedulePersist = (delayMs) => {
131
234
  if (persistTimer) return;
@@ -343,10 +446,10 @@ async function createMatrixThreadBindingManager(params) {
343
446
  sweepTimer.unref?.();
344
447
  }
345
448
  setMatrixThreadBindingManagerEntry(params.accountId, {
346
- filePath,
449
+ storageKey,
347
450
  manager
348
451
  });
349
452
  return manager;
350
453
  }
351
454
  //#endregion
352
- export { createMatrixThreadBindingManager as t };
455
+ export { resolveMatrixSqliteStateEnv as n, createMatrixThreadBindingManager as t };
@@ -1,12 +1,12 @@
1
1
  import { c as resolveMatrixAccountConfig } from "./config-paths-ZBCMwSos.js";
2
- import "./setup-core-DOhHYRrZ.js";
3
- import { E as parsePollStart, T as isPollStartType, b as buildPollResponseContent, i as reactMatrixMessage, u as resolveMatrixRoomId } from "./send-peVVVL75.js";
2
+ import "./setup-core-DRg3cgB8.js";
3
+ import { E as parsePollStart, T as isPollStartType, b as buildPollResponseContent, i as reactMatrixMessage, u as resolveMatrixRoomId } from "./send-DHj1E9ji.js";
4
4
  import { i as buildMatrixReactionRelationsPath, o as selectOwnMatrixReactionEventIds, s as summarizeMatrixReactionEvents } from "./reaction-common-DkrQdBSZ.js";
5
- import { n as withResolvedActionClient, r as withResolvedRoomAction } from "./client-BIBY50VG.js";
6
- import { a as fetchEventSummary, c as resolveMatrixActionLimit, i as sendMatrixMessage, n as editMatrixMessage, o as readPinnedEvents, r as readMatrixMessages, s as EventType, t as deleteMatrixMessage } from "./messages-CMx2qIs1.js";
7
- import { a as jsonResult, c as readStringArrayParam, l as readStringParam, o as readPositiveIntegerParam, r as createActionGate, s as readReactionParams } from "./runtime-api-CsF7Kokd.js";
8
- import { t as applyMatrixProfileUpdate } from "./profile-update-Cl7wAFCq.js";
9
- 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-BM7g0BeT.js";
5
+ import { n as withResolvedActionClient, r as withResolvedRoomAction } from "./client-D-t6CdHz.js";
6
+ import { a as fetchEventSummary, c as resolveMatrixActionLimit, i as sendMatrixMessage, n as editMatrixMessage, o as readPinnedEvents, r as readMatrixMessages, s as EventType, t as deleteMatrixMessage } from "./messages-D0sumPNx.js";
7
+ import { a as jsonResult, c as readStringArrayParam, l as readStringParam, o as readPositiveIntegerParam, r as createActionGate, s as readReactionParams } from "./runtime-api-CsBoesCU.js";
8
+ import { t as applyMatrixProfileUpdate } from "./profile-update-Defy1W90.js";
9
+ 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-BJfjKMr8.js";
10
10
  import { normalizeOptionalLowercaseString, uniqueStrings, uniqueValues } from "openclaw/plugin-sdk/string-coerce-runtime";
11
11
  //#region extensions/matrix/src/matrix/actions/polls.ts
12
12
  function normalizeOptionIndexes(indexes) {
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { i as withStartedActionClient, n as withResolvedActionClient } from "./client-BIBY50VG.js";
3
- import { n as formatMatrixEncryptionUnavailableError } from "./encryption-guidance-CU-OAPMg.js";
2
+ import { i as withStartedActionClient, n as withResolvedActionClient } from "./client-D-t6CdHz.js";
3
+ import { n as formatMatrixEncryptionUnavailableError } from "./encryption-guidance-aEUzD940.js";
4
4
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
6
6
  import { setTimeout } from "node:timers/promises";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babel/runtime",
3
- "version": "7.29.2",
3
+ "version": "7.29.7",
4
4
  "description": "babel's modular runtime helpers",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -1,6 +1,37 @@
1
1
  # Matrix-Rust-SDK Node.js Bindings
2
2
 
3
- ## UNRELEASED
3
+ ## v0.6.0 - 2026-05-18
4
+
5
+ - Update matrix-rust-sdk to 0.17.0
6
+
7
+ - Check the user ID in the `sender_device_keys` property of Olm-encrypted
8
+ to-device events to prevent sender spoofing by homeserver owners.
9
+ [#6553](https://github.com/matrix-org/matrix-rust-sdk/pull/6553)
10
+ - **BREAKING:** The `only_allow_trusted_devices` and
11
+ `error_on_verified_user_problem` fields of the `EncryptionSettings` have
12
+ been replaced with the `CollectStrategy` enum.
13
+ - **BREAKING:** The `ShieldStateCode::SentInClear` enum variant has been
14
+ removed.
15
+ - **BREAKING:** A new `ShieldStateCode::MismatchedSender` enum variant has been
16
+ added.
17
+
18
+ - Add support for Node.JS 26, and drop support for Node.JS 25. [#76](https://github.com/matrix-org/matrix-rust-sdk-crypto-nodejs/pull/76)
19
+ - Support Node-API Version 8. [#77](https://github.com/matrix-org/matrix-rust-sdk-crypto-nodejs/pull/77)
20
+
21
+ ## v0.5.1 - 2026-04-22
22
+
23
+ - Try to fix release script. [#72](https://github.com/matrix-org/matrix-rust-sdk-crypto-nodejs/pull/72)
24
+
25
+ ## v0.5.0 - 2026-04-20
26
+
27
+ - Support Node.JS 25, drop support for 22. [#68](https://github.com/matrix-org/matrix-rust-sdk-crypto-nodejs/pull/68)
28
+ - `OlmMachine.bootstrap_cross_signing` now returns the requests required to
29
+ upload the cross-signing keys to the server. [#67](https://github.com/matrix-org/matrix-rust-sdk-crypto-nodejs/pull/67)
30
+ - Add new functions `OlmMachine.export_secrets_for_secret_storage` and
31
+ `OlmMachine.import_secrets_from_secret_storage`, along with associated
32
+ types, for reading and writing to Secret Storage. [#67](https://github.com/matrix-org/matrix-rust-sdk-crypto-nodejs/pull/67)
33
+ - Add a new function `OlmMachine.get_device` to get information about a
34
+ device. [#67](https://github.com/matrix-org/matrix-rust-sdk-crypto-nodejs/pull/67)
4
35
 
5
36
  ## v0.4.0 - 2026-01-08
6
37
 
@@ -99,10 +99,10 @@ The binding is compatible with, and tested against, the Node.js
99
99
  versions that are in “current” or “active” states,
100
100
  according to [the Node.js Releases
101
101
  Page](https://nodejs.org/en/about/releases/), _and_ which are
102
- compatible with [NAPI v6 (Node.js
103
- API)](https://nodejs.org/api/n-api.html#node-api-version-matrix). It
102
+ compatible with [Node-API (formerly N-API)
103
+ v8)](https://nodejs.org/api/n-api.html#node-api-version-matrix). It
104
104
  means that this binding will work with the following versions:
105
- 22.0.0 and 24.0.0.
105
+ v24 and v26.
106
106
 
107
107
  Once the Rust compiler, Node.js and npm are installed, you can run the
108
108
  following commands:
@@ -13,6 +13,76 @@ export const enum EncryptionAlgorithm {
13
13
  /** Megolm version 1 using AES-256 and SHA-256. */
14
14
  MegolmV1AesSha2 = 1
15
15
  }
16
+ /**
17
+ * Strategy to collect the devices that should receive room keys for the
18
+ * current discussion.
19
+ */
20
+ export const enum CollectStrategy {
21
+ /**
22
+ * Share with all (unblacklisted) devices.
23
+ *
24
+ * Not recommended, per the guidance of [MSC4153].
25
+ *
26
+ * (Used by Element X and Element Web in the legacy, non-"exclude insecure
27
+ * devices" mode.)
28
+ *
29
+ * [MSC4153]: https://github.com/matrix-org/matrix-doc/pull/4153
30
+ */
31
+ AllDevices = 0,
32
+ /**
33
+ * Share with all devices, except errors for *verified* users cause sharing
34
+ * to fail with an error.
35
+ *
36
+ * In this strategy, if a verified user has an unsigned device,
37
+ * key sharing will fail with a
38
+ * [`SessionRecipientCollectionError::VerifiedUserHasUnsignedDevice`].
39
+ * If a verified user has replaced their identity, key
40
+ * sharing will fail with a
41
+ * [`SessionRecipientCollectionError::VerifiedUserChangedIdentity`].
42
+ *
43
+ * Otherwise, keys are shared with unsigned devices as normal.
44
+ *
45
+ * Once the problematic devices are blacklisted or whitelisted the
46
+ * caller can retry to share a second time.
47
+ *
48
+ * Not recommended, per the guidance of [MSC4153].
49
+ *
50
+ * [MSC4153]: https://github.com/matrix-org/matrix-doc/pull/4153
51
+ */
52
+ ErrorOnVerifiedUserProblem = 1,
53
+ /**
54
+ * Share based on identity. Only distribute to devices signed by their
55
+ * owner. If a user has no published identity he will not receive
56
+ * any room keys.
57
+ *
58
+ * This is the recommended strategy: it is compliant with the guidance of
59
+ * [MSC4153].
60
+ *
61
+ * (Used by Element Web and Element X in the "exclude insecure devices"
62
+ * mode.)
63
+ *
64
+ * [MSC4153]: https://github.com/matrix-org/matrix-doc/pull/4153
65
+ */
66
+ IdentityBasedStrategy = 2,
67
+ /**
68
+ * Only share keys with devices that we "trust". A device is trusted if any
69
+ * of the following is true:
70
+ * - It was manually marked as trusted.
71
+ * - It was marked as verified via interactive verification.
72
+ * - It is signed by its owner identity, and this identity has been
73
+ * trusted via interactive verification.
74
+ * - It is the current own device of the user.
75
+ *
76
+ * This strategy is compliant with [MSC4153], but is probably too strict
77
+ * for normal use.
78
+ *
79
+ * (Used by Element Web when "only send messages to verified users" is
80
+ * enabled.)
81
+ *
82
+ * [MSC4153]: https://github.com/matrix-org/matrix-doc/pull/4153
83
+ */
84
+ OnlyTrustedDevices = 3
85
+ }
16
86
  /**
17
87
  * Take a look at [`matrix_sdk_common::deserialized_responses::ShieldState`]
18
88
  * for more info.
@@ -36,8 +106,11 @@ export const enum ShieldStateCode {
36
106
  UnsignedDevice = 2,
37
107
  /** The sender hasn't been verified by the Client's user. */
38
108
  UnverifiedIdentity = 3,
39
- /** An unencrypted event in an encrypted room. */
40
- SentInClear = 4,
109
+ /**
110
+ * The `sender` field on the event does not match the owner of the device
111
+ * that established the Megolm session.
112
+ */
113
+ MismatchedSender = 4,
41
114
  /** The sender was previously verified but changed their identity. */
42
115
  VerificationViolation = 5,
43
116
  None = 6
@@ -221,6 +294,21 @@ export declare class BackupKeys {
221
294
  /** The version that we are using for backups. */
222
295
  backupVersion?: string
223
296
  }
297
+ /** A device represents a E2EE capable client of an user. */
298
+ export declare class Device {
299
+ /**
300
+ * Is this device considered to be verified.
301
+ *
302
+ * This method returns true if either the `is_locally_trusted`
303
+ * method returns `true` or if the `is_cross_signing_trusted`
304
+ * method returns `true`.
305
+ */
306
+ isVerified(): boolean
307
+ /** Is this device considered to be verified using cross signing. */
308
+ isCrossSigningTrusted(): boolean
309
+ /** Is this device cross-signed by its owner? */
310
+ isCrossSignedByOwner(): boolean
311
+ }
224
312
  /**
225
313
  * Settings for an encrypted room.
226
314
  *
@@ -243,16 +331,10 @@ export declare class EncryptionSettings {
243
331
  */
244
332
  historyVisibility: HistoryVisibility
245
333
  /**
246
- * Should untrusted devices receive the room key, or should they be
247
- * excluded from the conversation.
334
+ * The strategy used to distribute the room keys to participant.
335
+ * Default will send to all devices.
248
336
  */
249
- onlyAllowTrustedDevices: boolean
250
- /**
251
- * Should keys be shared with a verified user with an unverified device
252
- * or when a verified user has replaced their identity. Otherwise
253
- * keys are shared with unsigned devices as normal.
254
- */
255
- errorOnVerifiedUserProblem: boolean
337
+ sharingStrategy: CollectStrategy
256
338
  /** Create a new `EncryptionSettings` with default values. */
257
339
  constructor()
258
340
  }
@@ -401,10 +483,15 @@ export declare class OlmMachine {
401
483
  /** Get the public parts of our Olm identity keys. */
402
484
  get identityKeys(): IdentityKeys
403
485
  /**
404
- * Handle a to-device and one-time key counts from a sync response.
486
+ * Handle to-device events and one-time key counts from a sync response.
487
+ *
488
+ * This will decrypt and handle to-device events, returning a two-element
489
+ * array where:
405
490
  *
406
- * This will decrypt and handle to-device events returning the
407
- * decrypted versions of them, as a JSON-encoded string.
491
+ * * The first element is an array containing the decrypted to-device
492
+ * events as JSON-encoded strings.
493
+ * * The second element is an array containing information about room keys
494
+ * received as part of those decrypted to-device events.
408
495
  *
409
496
  * To decrypt an event from the room timeline, please use
410
497
  * `decrypt_room_event`.
@@ -416,6 +503,8 @@ export declare class OlmMachine {
416
503
  * response.
417
504
  * * `one_time_keys_count`, the current one-time keys counts that the sync
418
505
  * response returned.
506
+ * * `unused_fallback_keys`, the list of unused fallback keys the
507
+ * homeserver knows about.
419
508
  */
420
509
  receiveSyncChanges(toDeviceEvents: string, changedDevices: DeviceLists, oneTimeKeyCounts: Record<string, number>, unusedFallbackKeys: Array<string>): Promise<string>
421
510
  /**
@@ -527,6 +616,9 @@ export declare class OlmMachine {
527
616
  * Create a new cross signing identity and get the upload request
528
617
  * to push the new public keys to the server.
529
618
  *
619
+ * Returns the requests that need to be sent to the server to upload the
620
+ * required keys and signatures.
621
+ *
530
622
  * Warning: This will delete any existing cross signing keys that
531
623
  * might exist on the server and thus will reset the trust
532
624
  * between all the devices.
@@ -543,7 +635,7 @@ export declare class OlmMachine {
543
635
  * the same request multiple times, setting this argument to false
544
636
  * enables you to reuse the same request.
545
637
  */
546
- bootstrapCrossSigning(reset: boolean): Promise<void>
638
+ bootstrapCrossSigning(reset: boolean): Promise<CrossSigningBootstrapRequests>
547
639
  /**
548
640
  * Sign the given message using our device key and if available
549
641
  * cross-signing master key.
@@ -627,6 +719,25 @@ export declare class OlmMachine {
627
719
  * `OlmMachine` after this `close` method has been called.
628
720
  */
629
721
  close(): void
722
+ /**
723
+ * Export the client's secrets to store in Secret Storage, encrypted using
724
+ * the given secret storage key.
725
+ *
726
+ * Returns the items to store in account data.
727
+ *
728
+ * Currently only exports the cross-signing keys.
729
+ */
730
+ exportSecretsForSecretStorage(secretStorageKey: SecretStorageKey): Promise<SecretStorageItems>
731
+ /**
732
+ * Import secrets from Secret Storage, and sign the device's key with the
733
+ * user's self-signing key.
734
+ *
735
+ * Returns a signature upload request to upload the signature to the
736
+ * server.
737
+ */
738
+ importSecretsFromSecretStorage(secretStorageKey: SecretStorageKey, items: SecretStorageItems): Promise<SignatureUploadRequest>
739
+ /** Get information about a device. */
740
+ getDevice(userId: UserId, deviceId: DeviceId, timeout?: number | undefined | null): Promise<Device | null>
630
741
  }
631
742
  /**
632
743
  * Struct representing the state of our private cross signing keys,
@@ -803,6 +914,25 @@ export declare class KeysBackupRequest {
803
914
  /** Get its request type. */
804
915
  get type(): RequestType
805
916
  }
917
+ /** The requests needed to upload the cross-signing data to the server */
918
+ export declare class CrossSigningBootstrapRequests {
919
+ /**
920
+ * The request to upload the device's keys.
921
+ *
922
+ * Could be `None` if the device keys have already been uploaded.
923
+ */
924
+ readonly uploadKeysReq?: KeysUploadRequest
925
+ /**
926
+ * The request to upload the cross-signing keys, as a JSON-encoded string.
927
+ *
928
+ * This request does not have a request ID, and `mark_request_as_sent` does
929
+ * not need to be called for this request, so only the request body is
930
+ * provided.
931
+ */
932
+ readonly uploadSigningKeysReq: string
933
+ /** The request to upload the cross-signing signatures. */
934
+ readonly uploadSignaturesReq: SignatureUploadRequest
935
+ }
806
936
  /** A decrypted room event. */
807
937
  export declare class DecryptedRoomEvent {
808
938
  /** The JSON-encoded decrypted event. */
@@ -841,6 +971,56 @@ export declare class DecryptedRoomEvent {
841
971
  */
842
972
  shieldState(strict: boolean): ShieldState | null
843
973
  }
974
+ /** A key for encrypting/decrypting data in secret storage */
975
+ export declare class SecretStorageKey {
976
+ /** Create a new random [`SecretStorageKey`]. */
977
+ static createRandomKey(): SecretStorageKey
978
+ /** Create a new passphrase-based [`SecretStorageKey`]. */
979
+ static createFromPassphrase(passphrase: string): SecretStorageKey
980
+ /**
981
+ * Restore a [`SecretStorageKey`] from the given input and the description
982
+ * of the key.
983
+ *
984
+ * The [`SecretStorageKeyEventContent`] will contain the description of the
985
+ * [`SecretStorageKey`]. The constructor will check if the provided input
986
+ * string matches to the description.
987
+ *
988
+ * The input can be a passphrase or a Base58 export of the
989
+ * [`SecretStorageKey`].
990
+ */
991
+ static fromAccountData(input: string, eventType: string, content: string): SecretStorageKey
992
+ /** Export the [`SecretStorageKey`] as a base58-encoded string. */
993
+ toBase58(): string
994
+ /**
995
+ * Encrypt a secret string as a Secret Storage secret.
996
+ *
997
+ * Returns the JSON-encoded contents to store in Account Data.
998
+ */
999
+ encrypt(plaintext: string, secretName: string): string
1000
+ /**
1001
+ * Decrypt the given Secret Storage item, given as the JSON-encoded
1002
+ * contents.
1003
+ */
1004
+ decrypt(accountDataContentJson: string, secretName: string): string
1005
+ /**
1006
+ * The info about the [`SecretStorageKey`], as an item for storing in
1007
+ * account data.
1008
+ *
1009
+ * Returns a JSON-encoded object.
1010
+ */
1011
+ accountDataContent(): string
1012
+ /** The unique ID of this [`SecretStorageKey`]. */
1013
+ keyId(): string
1014
+ /** The event type of this [`SecretStorageKey`] for storing in account data. */
1015
+ eventType(): string
1016
+ }
1017
+ /** The account data items containing the secrets, encoded as JSON */
1018
+ export declare class SecretStorageItems {
1019
+ masterKey: string
1020
+ userSigningKey: string
1021
+ selfSigningKey: string
1022
+ constructor(items: Record<string, string>)
1023
+ }
844
1024
  /** Information on E2E device updates. */
845
1025
  export declare class DeviceLists {
846
1026
  /** Create an empty `DeviceLists`. */
@@ -310,7 +310,7 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { Attachment, EncryptedAttachment, BackupDecryptionKey, MegolmV1BackupKey, RoomKeyCounts, BackupKeys, EncryptionAlgorithm, EncryptionSettings, ShieldColor, ShieldStateCode, ShieldState, HistoryVisibility, UserId, DeviceId, DeviceKeyId, DeviceKeyAlgorithm, DeviceKeyAlgorithmName, RoomId, ServerName, StoreType, OlmMachine, CrossSigningStatus, KeysUploadRequest, KeysQueryRequest, KeysClaimRequest, ToDeviceRequest, SignatureUploadRequest, RoomMessageRequest, KeysBackupRequest, RequestType, DecryptedRoomEvent, DeviceLists, Signatures, Signature, MaybeSignature, SignatureVerification, SignatureState, Ed25519PublicKey, Ed25519Signature, Curve25519PublicKey, IdentityKeys, Versions, getVersions } = nativeBinding
313
+ const { Attachment, EncryptedAttachment, BackupDecryptionKey, MegolmV1BackupKey, RoomKeyCounts, BackupKeys, Device, EncryptionAlgorithm, EncryptionSettings, CollectStrategy, ShieldColor, ShieldStateCode, ShieldState, HistoryVisibility, UserId, DeviceId, DeviceKeyId, DeviceKeyAlgorithm, DeviceKeyAlgorithmName, RoomId, ServerName, StoreType, OlmMachine, CrossSigningStatus, KeysUploadRequest, KeysQueryRequest, KeysClaimRequest, ToDeviceRequest, SignatureUploadRequest, RoomMessageRequest, KeysBackupRequest, RequestType, CrossSigningBootstrapRequests, DecryptedRoomEvent, SecretStorageKey, SecretStorageItems, DeviceLists, Signatures, Signature, MaybeSignature, SignatureVerification, SignatureState, Ed25519PublicKey, Ed25519Signature, Curve25519PublicKey, IdentityKeys, Versions, getVersions } = nativeBinding
314
314
 
315
315
  module.exports.Attachment = Attachment
316
316
  module.exports.EncryptedAttachment = EncryptedAttachment
@@ -318,8 +318,10 @@ module.exports.BackupDecryptionKey = BackupDecryptionKey
318
318
  module.exports.MegolmV1BackupKey = MegolmV1BackupKey
319
319
  module.exports.RoomKeyCounts = RoomKeyCounts
320
320
  module.exports.BackupKeys = BackupKeys
321
+ module.exports.Device = Device
321
322
  module.exports.EncryptionAlgorithm = EncryptionAlgorithm
322
323
  module.exports.EncryptionSettings = EncryptionSettings
324
+ module.exports.CollectStrategy = CollectStrategy
323
325
  module.exports.ShieldColor = ShieldColor
324
326
  module.exports.ShieldStateCode = ShieldStateCode
325
327
  module.exports.ShieldState = ShieldState
@@ -342,7 +344,10 @@ module.exports.SignatureUploadRequest = SignatureUploadRequest
342
344
  module.exports.RoomMessageRequest = RoomMessageRequest
343
345
  module.exports.KeysBackupRequest = KeysBackupRequest
344
346
  module.exports.RequestType = RequestType
347
+ module.exports.CrossSigningBootstrapRequests = CrossSigningBootstrapRequests
345
348
  module.exports.DecryptedRoomEvent = DecryptedRoomEvent
349
+ module.exports.SecretStorageKey = SecretStorageKey
350
+ module.exports.SecretStorageItems = SecretStorageItems
346
351
  module.exports.DeviceLists = DeviceLists
347
352
  module.exports.Signatures = Signatures
348
353
  module.exports.Signature = Signature