@openclaw/matrix 2026.5.27 → 2026.5.28-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 (72) hide show
  1. package/dist/api.js +4 -4
  2. package/dist/{approval-handler.runtime-D2nZfRw6.js → approval-handler.runtime-DluqYmxg.js} +7 -37
  3. package/dist/{approval-ids-DzBw_AG3.js → approval-ids-CFZrzmvI.js} +1 -1
  4. package/dist/{approval-reaction-auth-BvK3dXMH.js → approval-reaction-auth-D0qxpl_o.js} +2 -2
  5. package/dist/{channel-BLuA_9If.js → channel-NWX4upHC.js} +15 -15
  6. package/dist/channel-plugin-api.js +1 -1
  7. package/dist/{channel.runtime-CCAsyp75.js → channel.runtime-Bj0ZZFxY.js} +7 -7
  8. package/dist/{cli-Bo50M7l4.js → cli-CLRLY_-i.js} +15 -14
  9. package/dist/{cli-metadata-CqUHNx_0.js → cli-metadata-3lBoQ4Zu.js} +1 -1
  10. package/dist/cli-metadata.js +1 -1
  11. package/dist/{client-QO7vDxm0.js → client-DMLL7BD3.js} +2 -2
  12. package/dist/{client-BgsOzckO.js → client-PgC6QxFp.js} +2 -2
  13. package/dist/{client-bootstrap-DK9i3KZ5.js → client-bootstrap-DDWICVDG.js} +1 -1
  14. package/dist/{config-schema-DuSRVdwT.js → config-schema-DLcRkLoI.js} +1 -1
  15. package/dist/contract-api.js +3 -3
  16. package/dist/{create-client-hdBEoEIm.js → create-client-DuDqSLm5.js} +2 -2
  17. package/dist/{crypto-runtime-BcQzS9DV.js → crypto-runtime-DW4yyphN.js} +4 -4
  18. package/dist/{deps-CAdiytPJ.js → deps-BVWGd2XS.js} +12 -2
  19. package/dist/{directory-live-2-Vb6nss.js → directory-live-B1uWLPJc.js} +2 -2
  20. package/dist/{doctor-qLh9PyE4.js → doctor-CENc9ks0.js} +1 -1
  21. package/dist/{draft-stream-BBVqdEbn.js → draft-stream-CQOHHA1L.js} +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/{legacy-crypto-inspector-BRdo-WqV.js → legacy-crypto-inspector-tJOj25VL.js} +1 -1
  24. package/dist/{logging-BR-gcAjp.js → logging-Bs8MnTq3.js} +2 -9
  25. package/dist/{matrix-migration.runtime-BhJb4ZII.js → matrix-migration.runtime-CZOep_JX.js} +1 -1
  26. package/dist/{media-text-C6q1S0AJ.js → media-text-Bl2T_Tej.js} +1 -1
  27. package/dist/{messages-D-VxmWkC.js → messages-IJd7lTpT.js} +3 -3
  28. package/dist/{monitor-DO1yiHWm.js → monitor-BtYrCwXE.js} +24 -25
  29. package/dist/plugin-entry.handlers.runtime.js +1 -1
  30. package/dist/probe.runtime-DFzGeW9y.js +3 -0
  31. package/dist/{profile-update-B_LpeC8E.js → profile-update--OKomd5A.js} +2 -2
  32. package/dist/{reaction-events-BefH3-Gu.js → reaction-events-Cw229qBs.js} +1 -1
  33. package/dist/recovery-key-store-0i4do66_.js +294 -0
  34. package/dist/{resolve-targets-BPhBqXyj.js → resolve-targets-DICyeq1_.js} +1 -1
  35. package/dist/{resolver.runtime-BOS3foyc.js → resolver.runtime-BiecZkY9.js} +1 -1
  36. package/dist/{runtime-api-B-jlPE4A.js → runtime-api-CsF7Kokd.js} +2 -2
  37. package/dist/runtime-api.js +1 -1
  38. package/dist/runtime-heavy-api.js +1 -1
  39. package/dist/{sdk-BKBZkPKt.js → sdk-Bb6cggYW.js} +8 -303
  40. package/dist/{send-DivaFHb1.js → send-6c-_Pb_x.js} +1 -1
  41. package/dist/{setup-bootstrap-ClcP-tDQ.js → setup-bootstrap-DO6nQjiO.js} +2 -2
  42. package/dist/{setup-core-s8s_Qudu.js → setup-core-CcMpf9nt.js} +1 -1
  43. package/dist/setup-plugin-api.js +3 -3
  44. package/dist/{setup-surface-BOt10HNf.js → setup-surface-eTmNGZRP.js} +5 -5
  45. package/dist/{shared-3K27tl8e.js → shared-cY7hRlYO.js} +111 -4
  46. package/dist/{thread-bindings-CLjJrThw.js → thread-bindings-LZukDWcn.js} +1 -1
  47. package/dist/{tool-actions.runtime-Vky1krcK.js → tool-actions.runtime-DmgBERwn.js} +20 -21
  48. package/dist/{verification-Dar6QON4.js → verification-aUpgCdQU.js} +1 -1
  49. package/node_modules/linkify-it/build/index.cjs.js +99 -94
  50. package/node_modules/linkify-it/index.mjs +99 -94
  51. package/node_modules/linkify-it/package.json +11 -1
  52. package/node_modules/markdown-it/README.md +13 -17
  53. package/node_modules/markdown-it/dist/index.cjs.js +111 -31
  54. package/node_modules/markdown-it/dist/markdown-it.js +117 -31
  55. package/node_modules/markdown-it/dist/markdown-it.min.js +2 -2
  56. package/node_modules/markdown-it/lib/common/utils.mjs +30 -1
  57. package/node_modules/markdown-it/lib/index.mjs +1 -1
  58. package/node_modules/markdown-it/lib/rules_block/heading.mjs +2 -2
  59. package/node_modules/markdown-it/lib/rules_block/html_block.mjs +12 -1
  60. package/node_modules/markdown-it/lib/rules_block/lheading.mjs +4 -1
  61. package/node_modules/markdown-it/lib/rules_block/paragraph.mjs +3 -1
  62. package/node_modules/markdown-it/lib/rules_core/smartquotes.mjs +37 -21
  63. package/node_modules/markdown-it/lib/rules_inline/entity.mjs +2 -2
  64. package/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +37 -6
  65. package/node_modules/markdown-it/package.json +14 -3
  66. package/node_modules/matrix-js-sdk/CHANGELOG.md +7 -0
  67. package/node_modules/matrix-js-sdk/package.json +1 -1
  68. package/npm-shrinkwrap.json +35 -15
  69. package/package.json +6 -6
  70. package/dist/probe.runtime-9S17Q3Mo.js +0 -3
  71. package/dist/startup-abort-Bs0Up_Qx.js +0 -109
  72. package/dist/test-api.js +0 -4
@@ -1,23 +1,22 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
1
  import { t as isRecord } from "./record-shared-CvzjvHRn.js";
3
2
  import { n as formatMatrixErrorReason, r as isMatrixNotFoundError, t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
4
3
  import { t as claimCurrentTokenStorageState } from "./storage-onzulLbU.js";
4
+ import { c as createMatrixStartupAbortError, d as ConsoleLogger, f as LogService, p as noop, u as throwIfMatrixStartupAborted } from "./shared-cY7hRlYO.js";
5
+ import { a as matrixEventToRaw, n as createMatrixGuardedFetch, o as parseMxc, t as MatrixAuthedHttpClient } from "./http-client-DJNugFzO.js";
5
6
  import { n as resolveMatrixRoomKeyBackupReadinessError } from "./backup-health-Dm_YMVFT.js";
7
+ import { createMatrixJsSdkClientLogger } from "./logging-Bs8MnTq3.js";
6
8
  import { t as createAsyncLock } from "./async-lock-BcLS4KOc.js";
7
- import { a as ConsoleLogger, i as throwIfMatrixStartupAborted, n as createMatrixStartupAbortError, o as LogService, s as noop } from "./startup-abort-Bs0Up_Qx.js";
8
- import { t as createMatrixJsSdkClientLogger } from "./logging-BR-gcAjp.js";
9
- import { a as matrixEventToRaw, n as createMatrixGuardedFetch, o as parseMxc, t as MatrixAuthedHttpClient } from "./http-client-DJNugFzO.js";
10
9
  import { n as isMatrixReadySyncState, r as isMatrixTerminalSyncState } from "./sync-state-CWbp0QSY.js";
10
+ import { n as isRepairableSecretStorageAccessError, r as MATRIX_IDB_PERSIST_INTERVAL_MS, t as MatrixRecoveryKeyStore } from "./recovery-key-store-0i4do66_.js";
11
11
  import { normalizeNullableString, normalizeStringEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
12
12
  import { readFileSync } from "node:fs";
13
13
  import path from "node:path";
14
- import { loadJsonFile, saveJsonFile, writeJsonFileAtomically } from "openclaw/plugin-sdk/json-store";
14
+ import { writeJsonFileAtomically } from "openclaw/plugin-sdk/json-store";
15
15
  import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
16
+ import fs$1 from "node:fs/promises";
16
17
  import { EventEmitter } from "node:events";
17
18
  import { Category, ClientEvent, Filter, MatrixEventEvent, MemoryStore, Preset, SyncAccumulator, createClient } from "matrix-js-sdk/lib/matrix.js";
18
19
  import { VerificationMethod } from "matrix-js-sdk/lib/types.js";
19
- import fs$1 from "node:fs/promises";
20
- import { decodeRecoveryKey } from "matrix-js-sdk/lib/crypto-api/recovery-key.js";
21
20
  //#region extensions/matrix/src/matrix/client/file-sync-store.ts
22
21
  const STORE_VERSION = 1;
23
22
  const PERSIST_DEBOUNCE_MS = 250;
@@ -207,301 +206,7 @@ var FileBackedMatrixSyncStore = class extends MemoryStore {
207
206
  }
208
207
  };
209
208
  //#endregion
210
- //#region extensions/matrix/src/matrix/sdk/idb-persistence-lock.ts
211
- const MATRIX_IDB_PERSIST_INTERVAL_MS = 6e4;
212
- const IDB_SNAPSHOT_LOCK_STALE_MS = 5 * 6e4;
213
- const IDB_SNAPSHOT_LOCK_RETRY_BASE = {
214
- factor: 2,
215
- minTimeout: 50,
216
- maxTimeout: 5e3,
217
- randomize: true
218
- };
219
- function computeRetryDelayMs(retries, attempt) {
220
- return Math.min(retries.maxTimeout, Math.max(retries.minTimeout, retries.minTimeout * retries.factor ** attempt));
221
- }
222
- function computeMinimumRetryWindowMs(retries) {
223
- let total = 0;
224
- const attempts = Math.max(1, retries.retries + 1);
225
- for (let attempt = 0; attempt < attempts - 1; attempt += 1) total += computeRetryDelayMs(retries, attempt);
226
- return total;
227
- }
228
- function resolveRetriesForMinimumWindowMs(retries, minimumWindowMs) {
229
- const resolved = {
230
- ...retries,
231
- retries: 0
232
- };
233
- while (computeMinimumRetryWindowMs(resolved) < minimumWindowMs) resolved.retries += 1;
234
- return resolved;
235
- }
236
- const MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS = {
237
- retries: resolveRetriesForMinimumWindowMs(IDB_SNAPSHOT_LOCK_RETRY_BASE, MATRIX_IDB_PERSIST_INTERVAL_MS),
238
- stale: IDB_SNAPSHOT_LOCK_STALE_MS
239
- };
240
- //#endregion
241
- //#region extensions/matrix/src/matrix/sdk/recovery-key-store.ts
242
- function isRepairableSecretStorageAccessError(err) {
243
- const message = formatMatrixErrorReason(err);
244
- if (!message) return false;
245
- if (message.includes("getsecretstoragekey callback returned falsey")) return true;
246
- if (message.includes("decrypting secret") && message.includes("bad mac")) return true;
247
- return false;
248
- }
249
- var MatrixRecoveryKeyStore = class {
250
- constructor(recoveryKeyPath) {
251
- this.recoveryKeyPath = recoveryKeyPath;
252
- this.secretStorageKeyCache = /* @__PURE__ */ new Map();
253
- this.stagedRecoveryKey = null;
254
- this.stagedRecoveryKeyUsed = false;
255
- this.stagedCacheKeyIds = /* @__PURE__ */ new Set();
256
- }
257
- buildCryptoCallbacks() {
258
- return {
259
- getSecretStorageKey: async ({ keys }) => {
260
- const requestedKeyIds = Object.keys(keys ?? {});
261
- if (requestedKeyIds.length === 0) return null;
262
- const staged = this.resolveStagedSecretStorageKey(requestedKeyIds);
263
- if (staged) return staged;
264
- for (const keyId of requestedKeyIds) {
265
- const cached = this.secretStorageKeyCache.get(keyId);
266
- if (cached) return [keyId, new Uint8Array(cached.key)];
267
- }
268
- const stored = this.loadStoredRecoveryKey();
269
- if (!stored?.privateKeyBase64) return null;
270
- const privateKey = new Uint8Array(Buffer.from(stored.privateKeyBase64, "base64"));
271
- if (privateKey.length === 0) return null;
272
- if (stored.keyId && requestedKeyIds.includes(stored.keyId)) {
273
- this.rememberSecretStorageKey(stored.keyId, privateKey, stored.keyInfo);
274
- return [stored.keyId, privateKey];
275
- }
276
- const firstRequestedKeyId = requestedKeyIds[0];
277
- if (!firstRequestedKeyId) return null;
278
- this.rememberSecretStorageKey(firstRequestedKeyId, privateKey, stored.keyInfo);
279
- return [firstRequestedKeyId, privateKey];
280
- },
281
- cacheSecretStorageKey: (keyId, keyInfo, key) => {
282
- const privateKey = new Uint8Array(key);
283
- const normalizedKeyInfo = {
284
- passphrase: keyInfo?.passphrase,
285
- name: typeof keyInfo?.name === "string" ? keyInfo.name : void 0
286
- };
287
- this.rememberSecretStorageKey(keyId, privateKey, normalizedKeyInfo);
288
- const stored = this.loadStoredRecoveryKey();
289
- this.saveRecoveryKeyToDisk({
290
- keyId,
291
- keyInfo: normalizedKeyInfo,
292
- privateKey,
293
- encodedPrivateKey: stored?.encodedPrivateKey
294
- });
295
- }
296
- };
297
- }
298
- getRecoveryKeySummary() {
299
- const stored = this.loadStoredRecoveryKey();
300
- if (!stored) return null;
301
- return {
302
- encodedPrivateKey: stored.encodedPrivateKey,
303
- keyId: stored.keyId,
304
- createdAt: stored.createdAt
305
- };
306
- }
307
- resolveEncodedRecoveryKeyInput(params) {
308
- const encodedPrivateKey = params.encodedPrivateKey.trim();
309
- if (!encodedPrivateKey) throw new Error("Matrix recovery key is required");
310
- let privateKey;
311
- try {
312
- privateKey = decodeRecoveryKey(encodedPrivateKey);
313
- } catch (err) {
314
- throw new Error(`Invalid Matrix recovery key: ${formatMatrixErrorMessage(err)}`, { cause: err });
315
- }
316
- const keyId = typeof params.keyId === "string" && params.keyId.trim() ? params.keyId.trim() : null;
317
- return {
318
- encodedPrivateKey,
319
- privateKey,
320
- keyId,
321
- keyInfo: params.keyInfo ?? this.loadStoredRecoveryKey()?.keyInfo
322
- };
323
- }
324
- storeEncodedRecoveryKey(params) {
325
- const prepared = this.resolveEncodedRecoveryKeyInput(params);
326
- this.saveRecoveryKeyToDisk({
327
- keyId: prepared.keyId,
328
- keyInfo: prepared.keyInfo,
329
- privateKey: prepared.privateKey,
330
- encodedPrivateKey: prepared.encodedPrivateKey
331
- });
332
- if (prepared.keyId) this.rememberSecretStorageKey(prepared.keyId, prepared.privateKey, prepared.keyInfo);
333
- return this.getRecoveryKeySummary() ?? {};
334
- }
335
- stageEncodedRecoveryKey(params) {
336
- const prepared = this.resolveEncodedRecoveryKeyInput(params);
337
- this.discardStagedRecoveryKey();
338
- this.stagedRecoveryKey = {
339
- version: 1,
340
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
341
- keyId: prepared.keyId,
342
- encodedPrivateKey: prepared.encodedPrivateKey,
343
- privateKeyBase64: Buffer.from(prepared.privateKey).toString("base64"),
344
- keyInfo: prepared.keyInfo
345
- };
346
- }
347
- hasStagedRecoveryKeyBeenUsed() {
348
- return this.stagedRecoveryKeyUsed;
349
- }
350
- commitStagedRecoveryKey(params) {
351
- if (!this.stagedRecoveryKey) return this.getRecoveryKeySummary();
352
- const staged = this.stagedRecoveryKey;
353
- const privateKey = new Uint8Array(Buffer.from(staged.privateKeyBase64, "base64"));
354
- const keyId = typeof params?.keyId === "string" && params.keyId.trim() ? params.keyId.trim() : staged.keyId;
355
- this.saveRecoveryKeyToDisk({
356
- keyId,
357
- keyInfo: params?.keyInfo ?? staged.keyInfo,
358
- privateKey,
359
- encodedPrivateKey: staged.encodedPrivateKey
360
- });
361
- this.clearStagedRecoveryKeyTracking();
362
- return this.getRecoveryKeySummary();
363
- }
364
- discardStagedRecoveryKey() {
365
- for (const keyId of this.stagedCacheKeyIds) this.secretStorageKeyCache.delete(keyId);
366
- this.clearStagedRecoveryKeyTracking();
367
- }
368
- async bootstrapSecretStorageWithRecoveryKey(crypto, options = {}) {
369
- let status = null;
370
- const getSecretStorageStatus = crypto.getSecretStorageStatus;
371
- if (typeof getSecretStorageStatus === "function") try {
372
- status = await getSecretStorageStatus.call(crypto);
373
- } catch (err) {
374
- LogService.warn("MatrixClientLite", "Failed to read secret storage status:", err);
375
- }
376
- const hasDefaultSecretStorageKey = Boolean(status?.defaultKeyId);
377
- const hasKnownInvalidSecrets = Object.values(status?.secretStorageKeyValidityMap ?? {}).some((valid) => !valid);
378
- let generatedRecoveryKey = false;
379
- const storedRecovery = this.loadStoredRecoveryKey();
380
- const stagedRecovery = this.stagedRecoveryKey;
381
- const sourceRecovery = options.forceNewRecoveryKey === true ? null : stagedRecovery ?? storedRecovery;
382
- let recoveryKey = sourceRecovery ? {
383
- keyInfo: sourceRecovery.keyInfo,
384
- privateKey: new Uint8Array(Buffer.from(sourceRecovery.privateKeyBase64, "base64")),
385
- encodedPrivateKey: sourceRecovery.encodedPrivateKey
386
- } : null;
387
- if (recoveryKey && status?.defaultKeyId) {
388
- const defaultKeyId = status.defaultKeyId;
389
- if (!stagedRecovery) {
390
- this.rememberSecretStorageKey(defaultKeyId, recoveryKey.privateKey, recoveryKey.keyInfo);
391
- if (storedRecovery && storedRecovery.keyId !== defaultKeyId) this.saveRecoveryKeyToDisk({
392
- keyId: defaultKeyId,
393
- keyInfo: recoveryKey.keyInfo,
394
- privateKey: recoveryKey.privateKey,
395
- encodedPrivateKey: recoveryKey.encodedPrivateKey
396
- });
397
- }
398
- }
399
- const ensureRecoveryKey = async () => {
400
- if (recoveryKey) {
401
- if (stagedRecovery) this.stagedRecoveryKeyUsed = true;
402
- return recoveryKey;
403
- }
404
- if (typeof crypto.createRecoveryKeyFromPassphrase !== "function") throw new Error("Matrix crypto backend does not support recovery key generation (createRecoveryKeyFromPassphrase missing)");
405
- recoveryKey = await crypto.createRecoveryKeyFromPassphrase();
406
- this.saveRecoveryKeyToDisk(recoveryKey);
407
- generatedRecoveryKey = true;
408
- return recoveryKey;
409
- };
410
- const shouldRecreateSecretStorage = options.forceNewSecretStorage === true || !hasDefaultSecretStorageKey || !recoveryKey && status?.ready === false || hasKnownInvalidSecrets;
411
- if (hasKnownInvalidSecrets) recoveryKey = null;
412
- const secretStorageOptions = { setupNewKeyBackup: options.setupNewKeyBackup === true };
413
- if (shouldRecreateSecretStorage) {
414
- secretStorageOptions.setupNewSecretStorage = true;
415
- secretStorageOptions.createSecretStorageKey = ensureRecoveryKey;
416
- }
417
- try {
418
- await crypto.bootstrapSecretStorage(secretStorageOptions);
419
- } catch (err) {
420
- if (!(options.allowSecretStorageRecreateWithoutRecoveryKey === true && hasDefaultSecretStorageKey && isRepairableSecretStorageAccessError(err))) throw err;
421
- recoveryKey = null;
422
- LogService.warn("MatrixClientLite", "Secret storage exists on the server but local recovery material cannot unlock it; recreating secret storage during explicit bootstrap.");
423
- await crypto.bootstrapSecretStorage({
424
- setupNewSecretStorage: true,
425
- setupNewKeyBackup: options.setupNewKeyBackup === true,
426
- createSecretStorageKey: ensureRecoveryKey
427
- });
428
- }
429
- if (generatedRecoveryKey && this.recoveryKeyPath) LogService.warn("MatrixClientLite", `Generated Matrix recovery key and saved it to ${this.recoveryKeyPath}. Keep this file secure.`);
430
- }
431
- clearStagedRecoveryKeyTracking() {
432
- this.stagedRecoveryKey = null;
433
- this.stagedRecoveryKeyUsed = false;
434
- this.stagedCacheKeyIds.clear();
435
- }
436
- resolveStagedSecretStorageKey(requestedKeyIds) {
437
- const staged = this.stagedRecoveryKey;
438
- if (!staged?.privateKeyBase64) return null;
439
- const privateKey = new Uint8Array(Buffer.from(staged.privateKeyBase64, "base64"));
440
- if (privateKey.length === 0) return null;
441
- const keyId = staged.keyId && requestedKeyIds.includes(staged.keyId) ? staged.keyId : requestedKeyIds[0];
442
- if (!keyId) return null;
443
- this.rememberStagedSecretStorageKey(keyId, privateKey, staged.keyInfo);
444
- this.stagedCacheKeyIds.add(keyId);
445
- return [keyId, privateKey];
446
- }
447
- rememberStagedSecretStorageKey(keyId, key, keyInfo) {
448
- this.stagedRecoveryKeyUsed = true;
449
- this.rememberSecretStorageKey(keyId, key, keyInfo);
450
- }
451
- rememberSecretStorageKey(keyId, key, keyInfo) {
452
- if (!keyId.trim()) return;
453
- this.secretStorageKeyCache.set(keyId, {
454
- key: new Uint8Array(key),
455
- keyInfo
456
- });
457
- }
458
- loadStoredRecoveryKey() {
459
- if (!this.recoveryKeyPath) return null;
460
- try {
461
- const parsed = loadJsonFile(this.recoveryKeyPath);
462
- if (parsed?.version !== 1 || typeof parsed.createdAt !== "string" || typeof parsed.privateKeyBase64 !== "string" || !parsed.privateKeyBase64.trim()) return null;
463
- return {
464
- version: 1,
465
- createdAt: parsed.createdAt,
466
- keyId: typeof parsed.keyId === "string" ? parsed.keyId : null,
467
- encodedPrivateKey: typeof parsed.encodedPrivateKey === "string" ? parsed.encodedPrivateKey : void 0,
468
- privateKeyBase64: parsed.privateKeyBase64,
469
- keyInfo: parsed.keyInfo && typeof parsed.keyInfo === "object" ? {
470
- passphrase: parsed.keyInfo.passphrase,
471
- name: typeof parsed.keyInfo.name === "string" ? parsed.keyInfo.name : void 0
472
- } : void 0
473
- };
474
- } catch {
475
- return null;
476
- }
477
- }
478
- saveRecoveryKeyToDisk(params) {
479
- if (!this.recoveryKeyPath) return;
480
- try {
481
- const payload = {
482
- version: 1,
483
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
484
- keyId: typeof params.keyId === "string" ? params.keyId : null,
485
- encodedPrivateKey: params.encodedPrivateKey,
486
- privateKeyBase64: Buffer.from(params.privateKey).toString("base64"),
487
- keyInfo: params.keyInfo ? {
488
- passphrase: params.keyInfo.passphrase,
489
- name: params.keyInfo.name
490
- } : void 0
491
- };
492
- saveJsonFile(this.recoveryKeyPath, payload);
493
- } catch (err) {
494
- LogService.warn("MatrixClientLite", "Failed to persist recovery key:", err);
495
- }
496
- }
497
- };
498
- //#endregion
499
209
  //#region extensions/matrix/src/matrix/sdk.ts
500
- var sdk_exports = /* @__PURE__ */ __exportAll({
501
- ConsoleLogger: () => ConsoleLogger,
502
- LogService: () => LogService,
503
- MatrixClient: () => MatrixClient
504
- });
505
210
  const MATRIX_STATUS_DIAGNOSTIC_TIMEOUT_MS = 1e4;
506
211
  function unresolvedMatrixRoomKeyBackupStatus() {
507
212
  return {
@@ -578,7 +283,7 @@ function createMatrixExplicitBootstrapOptions(params) {
578
283
  let loadedMatrixCryptoRuntime = null;
579
284
  let matrixCryptoRuntimePromise = null;
580
285
  async function loadMatrixCryptoRuntime() {
581
- matrixCryptoRuntimePromise ??= import("./crypto-runtime-BcQzS9DV.js").then((runtime) => {
286
+ matrixCryptoRuntimePromise ??= import("./crypto-runtime-DW4yyphN.js").then((runtime) => {
582
287
  loadedMatrixCryptoRuntime = runtime;
583
288
  return runtime;
584
289
  });
@@ -1701,4 +1406,4 @@ var MatrixClient = class {
1701
1406
  }
1702
1407
  };
1703
1408
  //#endregion
1704
- export { MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS as i, sdk_exports as n, isRepairableSecretStorageAccessError as r, MatrixClient as t };
1409
+ export { ConsoleLogger, LogService, MatrixClient };
@@ -229,7 +229,7 @@ function buildPollResponseContent(pollEventId, answerIds) {
229
229
  //#region extensions/matrix/src/matrix/send/client.ts
230
230
  let matrixSendClientRuntimePromise = null;
231
231
  async function loadMatrixSendClientRuntime() {
232
- matrixSendClientRuntimePromise ??= import("./client-bootstrap-DK9i3KZ5.js").then((n) => n.t);
232
+ matrixSendClientRuntimePromise ??= import("./client-bootstrap-DDWICVDG.js").then((n) => n.t);
233
233
  return await matrixSendClientRuntimePromise;
234
234
  }
235
235
  function resolveMediaMaxBytes(accountId, cfg) {
@@ -1,7 +1,7 @@
1
1
  import { a as hasExplicitMatrixAccountConfig, c as resolveMatrixAccountConfig } from "./config-paths-ZBCMwSos.js";
2
- import "./setup-core-s8s_Qudu.js";
2
+ import "./setup-core-CcMpf9nt.js";
3
3
  import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
4
- import { n as bootstrapMatrixVerification } from "./verification-Dar6QON4.js";
4
+ import { n as bootstrapMatrixVerification } from "./verification-aUpgCdQU.js";
5
5
  //#region extensions/matrix/src/setup-bootstrap.ts
6
6
  async function maybeBootstrapNewEncryptedMatrixAccount(params) {
7
7
  const accountConfig = resolveMatrixAccountConfig({
@@ -664,7 +664,7 @@ const matrixSetupAdapter = {
664
664
  input
665
665
  }),
666
666
  afterAccountConfigWritten: async ({ previousCfg, cfg, accountId, runtime }) => {
667
- const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-ClcP-tDQ.js");
667
+ const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-DO6nQjiO.js");
668
668
  await runMatrixSetupBootstrapAfterConfigWrite({
669
669
  previousCfg,
670
670
  cfg,
@@ -1,5 +1,5 @@
1
- import { g as resolveMatrixAccount, n as matrixSetupAdapter, t as createMatrixSetupWizardProxy } from "./setup-core-s8s_Qudu.js";
2
- import { r as matrixConfigAdapter, t as MatrixChannelConfigSchema } from "./config-schema-DuSRVdwT.js";
1
+ import { g as resolveMatrixAccount, n as matrixSetupAdapter, t as createMatrixSetupWizardProxy } from "./setup-core-CcMpf9nt.js";
2
+ import { r as matrixConfigAdapter, t as MatrixChannelConfigSchema } from "./config-schema-DLcRkLoI.js";
3
3
  import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
4
4
  const matrixSetupPlugin = {
5
5
  id: "matrix",
@@ -13,7 +13,7 @@ const matrixSetupPlugin = {
13
13
  order: 70,
14
14
  quickstartAllowFrom: true
15
15
  },
16
- setupWizard: createMatrixSetupWizardProxy(async () => ({ matrixSetupWizard: (await import("./setup-surface-BOt10HNf.js").then((n) => n.t)).matrixSetupWizard })),
16
+ setupWizard: createMatrixSetupWizardProxy(async () => ({ matrixSetupWizard: (await import("./setup-surface-eTmNGZRP.js").then((n) => n.t)).matrixSetupWizard })),
17
17
  setup: matrixSetupAdapter,
18
18
  capabilities: {
19
19
  chatTypes: [
@@ -2,9 +2,9 @@ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
2
  import { n as requiresExplicitMatrixDefaultAccount } from "./account-selection-C3arLOhC.js";
3
3
  import { c as resolveMatrixAccountConfig, t as resolveMatrixConfigFieldPath } from "./config-paths-ZBCMwSos.js";
4
4
  import { r as resolveMatrixEnvAuthReadiness } from "./env-auth-DIzOApj0.js";
5
- import { g as resolveMatrixAccount, h as resolveDefaultMatrixAccountId, i as moveSingleMatrixAccountConfigToNamedAccount, l as updateMatrixAccountConfig, p as listMatrixAccountIds, r as resolveMatrixSetupDmAllowFrom } from "./setup-core-s8s_Qudu.js";
5
+ import { g as resolveMatrixAccount, h as resolveDefaultMatrixAccountId, i as moveSingleMatrixAccountConfigToNamedAccount, l as updateMatrixAccountConfig, p as listMatrixAccountIds, r as resolveMatrixSetupDmAllowFrom } from "./setup-core-CcMpf9nt.js";
6
6
  import { n as validateMatrixHomeserverUrl, r as isPrivateOrLoopbackHost, t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
7
- import { n as ensureMatrixSdkInstalled, r as isMatrixSdkAvailable } from "./deps-CAdiytPJ.js";
7
+ import { n as ensureMatrixSdkInstalled, r as isMatrixSdkAvailable } from "./deps-BVWGd2XS.js";
8
8
  import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
9
9
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
10
10
  import { formatDocsLink, hasConfiguredSecretInput, mergeAllowFromEntries, normalizeAccountId as normalizeAccountId$1, promptAccountId, promptChannelAccessConfig, splitSetupEntries } from "openclaw/plugin-sdk/setup";
@@ -104,7 +104,7 @@ async function promptMatrixAllowFrom(params) {
104
104
  pending.push(part);
105
105
  }
106
106
  if (pending.length > 0) {
107
- const { resolveMatrixTargets } = await import("./resolve-targets-BPhBqXyj.js").then((n) => n.n);
107
+ const { resolveMatrixTargets } = await import("./resolve-targets-DICyeq1_.js").then((n) => n.n);
108
108
  const results = await resolveMatrixTargets({
109
109
  cfg,
110
110
  accountId,
@@ -232,7 +232,7 @@ async function configureMatrixAccessPrompts(params) {
232
232
  resolvedIds.push(cleaned);
233
233
  continue;
234
234
  }
235
- const { listMatrixDirectoryGroupsLive } = await import("./directory-live-2-Vb6nss.js").then((n) => n.t);
235
+ const { listMatrixDirectoryGroupsLive } = await import("./directory-live-B1uWLPJc.js").then((n) => n.t);
236
236
  const matches = await listMatrixDirectoryGroupsLive({
237
237
  cfg: next,
238
238
  accountId: params.accountId,
@@ -507,7 +507,7 @@ const matrixOnboardingAdapter = {
507
507
  });
508
508
  },
509
509
  afterConfigWritten: async ({ previousCfg, cfg, accountId, runtime }) => {
510
- const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-ClcP-tDQ.js");
510
+ const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-DO6nQjiO.js");
511
511
  await runMatrixSetupBootstrapAfterConfigWrite({
512
512
  previousCfg,
513
513
  cfg,
@@ -3,15 +3,17 @@ import { a as resolveMatrixDefaultOrOnlyAccountId, n as requiresExplicitMatrixDe
3
3
  import { t as getMatrixScopedEnvVarNames } from "./env-vars-KzaYveuy.js";
4
4
  import { i as findMatrixAccountConfig, l as resolveMatrixBaseConfig, o as listNormalizedMatrixAccountIds, t as resolveMatrixConfigFieldPath } from "./config-paths-ZBCMwSos.js";
5
5
  import { i as resolveScopedMatrixEnvConfig, n as resolveGlobalMatrixEnvConfig } from "./env-auth-DIzOApj0.js";
6
+ import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
6
7
  import { t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
7
8
  import { r as repairCurrentTokenStorageMetaDeviceId } from "./storage-onzulLbU.js";
8
- import { o as LogService, t as awaitMatrixStartupWithAbort } from "./startup-abort-Bs0Up_Qx.js";
9
9
  import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, normalizeAccountId as normalizeAccountId$1, normalizeOptionalAccountId, normalizeOptionalAccountId as normalizeOptionalAccountId$1 } from "openclaw/plugin-sdk/account-id";
10
10
  import { coerceSecretRef, normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input-runtime";
11
11
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
12
12
  import { isPrivateNetworkOptInEnabled, ssrfPolicyFromDangerouslyAllowPrivateNetwork as ssrfPolicyFromDangerouslyAllowPrivateNetwork$1 } from "openclaw/plugin-sdk/ssrf-runtime";
13
13
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
14
14
  import { retryAsync } from "openclaw/plugin-sdk/retry-runtime";
15
+ import { format } from "node:util";
16
+ import { redactSensitiveText } from "openclaw/plugin-sdk/logging-core";
15
17
  //#region extensions/matrix/src/matrix/client/config.ts
16
18
  let matrixAuthClientDepsPromise;
17
19
  let matrixCredentialsReadDepsPromise;
@@ -19,7 +21,7 @@ let matrixCredentialsWriteRuntimePromise;
19
21
  let matrixSecretInputDepsPromise;
20
22
  const MATRIX_AUTH_REQUEST_RETRY_RE = /\b(fetch failed|econnreset|econnrefused|enotfound|etimedout|ehostunreach|enetunreach|eai_again|und_err_|socket hang up|network|headers timeout|body timeout|connect timeout)\b/i;
21
23
  async function loadMatrixAuthClientDeps() {
22
- matrixAuthClientDepsPromise ??= Promise.all([import("./sdk-BKBZkPKt.js").then((n) => n.n), import("./logging-BR-gcAjp.js").then((n) => n.n)]).then(([sdkModule, loggingModule]) => ({
24
+ matrixAuthClientDepsPromise ??= Promise.all([import("./sdk-Bb6cggYW.js"), import("./logging-Bs8MnTq3.js")]).then(([sdkModule, loggingModule]) => ({
23
25
  MatrixClient: sdkModule.MatrixClient,
24
26
  ensureMatrixSdkLoggingConfigured: loggingModule.ensureMatrixSdkLoggingConfigured
25
27
  }));
@@ -449,6 +451,111 @@ async function backfillMatrixAuthDeviceIdAfterStartup(params) {
449
451
  }, env, params.auth.accountId) === "saved" ? deviceId : void 0;
450
452
  }
451
453
  //#endregion
454
+ //#region extensions/matrix/src/matrix/sdk/logger.ts
455
+ function noop() {}
456
+ let forceConsoleLogging = false;
457
+ function setMatrixConsoleLogging(enabled) {
458
+ forceConsoleLogging = enabled;
459
+ }
460
+ function resolveRuntimeLogger(module) {
461
+ if (forceConsoleLogging) return null;
462
+ try {
463
+ return getMatrixRuntime().logging.getChildLogger({ module: `matrix:${module}` });
464
+ } catch {
465
+ return null;
466
+ }
467
+ }
468
+ function formatMessage(module, messageOrObject) {
469
+ if (messageOrObject.length === 0) return `[${module}]`;
470
+ return redactSensitiveText(`[${module}] ${format(...messageOrObject)}`);
471
+ }
472
+ var ConsoleLogger = class {
473
+ emit(level, module, ...messageOrObject) {
474
+ const runtimeLogger = resolveRuntimeLogger(module);
475
+ const message = formatMessage(module, messageOrObject);
476
+ if (runtimeLogger) {
477
+ if (level === "debug") {
478
+ runtimeLogger.debug?.(message);
479
+ return;
480
+ }
481
+ runtimeLogger[level](message);
482
+ return;
483
+ }
484
+ if (level === "debug") {
485
+ console.debug(message);
486
+ return;
487
+ }
488
+ console[level](message);
489
+ }
490
+ trace(module, ...messageOrObject) {
491
+ this.emit("debug", module, ...messageOrObject);
492
+ }
493
+ debug(module, ...messageOrObject) {
494
+ this.emit("debug", module, ...messageOrObject);
495
+ }
496
+ info(module, ...messageOrObject) {
497
+ this.emit("info", module, ...messageOrObject);
498
+ }
499
+ warn(module, ...messageOrObject) {
500
+ this.emit("warn", module, ...messageOrObject);
501
+ }
502
+ error(module, ...messageOrObject) {
503
+ this.emit("error", module, ...messageOrObject);
504
+ }
505
+ };
506
+ let activeLogger = new ConsoleLogger();
507
+ const LogService = {
508
+ setLogger(logger) {
509
+ activeLogger = logger;
510
+ },
511
+ trace(module, ...messageOrObject) {
512
+ activeLogger.trace(module, ...messageOrObject);
513
+ },
514
+ debug(module, ...messageOrObject) {
515
+ activeLogger.debug(module, ...messageOrObject);
516
+ },
517
+ info(module, ...messageOrObject) {
518
+ activeLogger.info(module, ...messageOrObject);
519
+ },
520
+ warn(module, ...messageOrObject) {
521
+ activeLogger.warn(module, ...messageOrObject);
522
+ },
523
+ error(module, ...messageOrObject) {
524
+ activeLogger.error(module, ...messageOrObject);
525
+ }
526
+ };
527
+ //#endregion
528
+ //#region extensions/matrix/src/matrix/startup-abort.ts
529
+ function createMatrixStartupAbortError() {
530
+ const error = /* @__PURE__ */ new Error("Matrix startup aborted");
531
+ error.name = "AbortError";
532
+ return error;
533
+ }
534
+ function throwIfMatrixStartupAborted(abortSignal) {
535
+ if (abortSignal?.aborted === true) throw createMatrixStartupAbortError();
536
+ }
537
+ function isMatrixStartupAbortError(error) {
538
+ return error instanceof Error && error.name === "AbortError";
539
+ }
540
+ async function awaitMatrixStartupWithAbort(promise, abortSignal) {
541
+ if (!abortSignal) return await promise;
542
+ if (abortSignal.aborted) throw createMatrixStartupAbortError();
543
+ return await new Promise((resolve, reject) => {
544
+ const onAbort = () => {
545
+ abortSignal.removeEventListener("abort", onAbort);
546
+ reject(createMatrixStartupAbortError());
547
+ };
548
+ abortSignal.addEventListener("abort", onAbort, { once: true });
549
+ promise.then((value) => {
550
+ abortSignal.removeEventListener("abort", onAbort);
551
+ resolve(value);
552
+ }, (error) => {
553
+ abortSignal.removeEventListener("abort", onAbort);
554
+ reject(error);
555
+ });
556
+ });
557
+ }
558
+ //#endregion
452
559
  //#region extensions/matrix/src/matrix/client/shared.ts
453
560
  var shared_exports = /* @__PURE__ */ __exportAll({
454
561
  acquireSharedMatrixClient: () => acquireSharedMatrixClient,
@@ -461,7 +568,7 @@ var shared_exports = /* @__PURE__ */ __exportAll({
461
568
  });
462
569
  let matrixCreateClientDepsPromise;
463
570
  async function loadMatrixCreateClientDeps() {
464
- matrixCreateClientDepsPromise ??= import("./create-client-hdBEoEIm.js").then((n) => n.n).then((runtime) => ({ createMatrixClient: runtime.createMatrixClient }));
571
+ matrixCreateClientDepsPromise ??= import("./create-client-DuDqSLm5.js").then((n) => n.n).then((runtime) => ({ createMatrixClient: runtime.createMatrixClient }));
465
572
  return await matrixCreateClientDepsPromise;
466
573
  }
467
574
  const sharedClientStates = /* @__PURE__ */ new Map();
@@ -638,4 +745,4 @@ async function releaseSharedClientInstance(client, mode = "stop") {
638
745
  return true;
639
746
  }
640
747
  //#endregion
641
- export { shared_exports as a, backfillMatrixAuthDeviceIdAfterStartup as c, resolveMatrixConfigForAccount as d, resolveSharedMatrixClient as i, resolveMatrixAuth as l, releaseSharedClientInstance as n, stopSharedClientForAccount as o, removeSharedClientInstance as r, stopSharedClientInstance as s, acquireSharedMatrixClient as t, resolveMatrixAuthContext as u };
748
+ export { resolveMatrixAuthContext as _, shared_exports as a, createMatrixStartupAbortError as c, ConsoleLogger as d, LogService as f, resolveMatrixAuth as g, backfillMatrixAuthDeviceIdAfterStartup as h, resolveSharedMatrixClient as i, isMatrixStartupAbortError as l, setMatrixConsoleLogging as m, releaseSharedClientInstance as n, stopSharedClientForAccount as o, noop as p, removeSharedClientInstance as r, stopSharedClientInstance as s, acquireSharedMatrixClient as t, throwIfMatrixStartupAborted as u, resolveMatrixConfigForAccount as v };
@@ -1,6 +1,6 @@
1
1
  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
2
  import { i as resolveMatrixStateFilePath, t as claimCurrentTokenStorageState } from "./storage-onzulLbU.js";
3
- import { a as sendMessageMatrix } from "./send-DivaFHb1.js";
3
+ import { a as sendMessageMatrix } from "./send-6c-_Pb_x.js";
4
4
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  import { registerSessionBindingAdapter, resolveThreadBindingFarewellText, unregisterSessionBindingAdapter } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
6
6
  import path from "node:path";