@openclaw/matrix 2026.8.1 → 2026.8.33

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 (117) hide show
  1. package/dist/{account-selection-C8nnBTxi.js → .setup/account-selection-DZMazUgX.mjs} +12 -10
  2. package/dist/{accounts-fC57n-Jo.js → .setup/accounts-BJ6ECCac.mjs} +3 -3
  3. package/dist/{approval-handler.runtime-BBjFZw1t.js → .setup/approval-handler.runtime-CdT1wQve.mjs} +6 -6
  4. package/dist/{approval-ids-DTIdXV-m.js → .setup/approval-ids-CU_nMQy9.mjs} +1 -1
  5. package/dist/{approval-reaction-auth-BDONXxnF.js → .setup/approval-reaction-auth-CpxhvOOT.mjs} +2 -2
  6. package/dist/{approval-reactions-tXh9KYrW.js → .setup/approval-reactions-D5eegob9.mjs} +2 -2
  7. package/dist/{channel-BkEcVUs_.js → .setup/channel-Q_N83Wwa.mjs} +57 -59
  8. package/dist/{channel.runtime-CTLSBFsP.js → .setup/channel.runtime-BFXlZFP1.mjs} +17 -13
  9. package/dist/{channel.setup-CSacbORr.js → .setup/channel.setup-2A6HBRbA.mjs} +22 -20
  10. package/dist/{cli-DRVtgrq5.js → .setup/cli-CyuDGiIr.mjs} +43 -34
  11. package/dist/{cli-metadata-Ddx_y4Os.js → .setup/cli-metadata-B_y2Z5Np.mjs} +1 -1
  12. package/dist/{client-CZ_JvrO0.js → .setup/client-CpHMD-C2.mjs} +3 -3
  13. package/dist/{client-kSi51NKp.js → .setup/client-DvcYcTSy.mjs} +76 -23
  14. package/dist/{client-bootstrap-D8irSL2i.js → .setup/client-bootstrap-Cb1tHsT4.mjs} +3 -3
  15. package/dist/{client-support-DLj4vDeu.js → .setup/client-support-Bn9Bk0-H.mjs} +1 -1
  16. package/dist/{config-update-DC0fWBxc.js → .setup/config-update-B_4qZ5bV.mjs} +49 -31
  17. package/dist/{credentials-BdAaWuiR.js → .setup/credentials-B2roKThT.mjs} +6 -10
  18. package/dist/{credentials-read-B37cQknZ.js → .setup/credentials-read-DaemdXHy.mjs} +11 -9
  19. package/dist/{credentials-write.runtime-nAV2-5uR.js → .setup/credentials-write.runtime-D83HEGcL.mjs} +1 -1
  20. package/dist/{crypto-runtime-C4WDYxlP.js → .setup/crypto-runtime-Ch4WOG1y.mjs} +8 -8
  21. package/dist/{deps-CcVJfvRM.js → .setup/deps-mtxF2mHI.mjs} +1 -1
  22. package/dist/{device-health-B4-YXtJR.js → .setup/device-health-CWOuIirq.mjs} +1 -1
  23. package/dist/{direct-room-RinHjtqX.js → .setup/direct-room-CKyU8upP.mjs} +1 -1
  24. package/dist/{directory-live-DKr0w35b.js → .setup/directory-live-DggLE-28.mjs} +10 -8
  25. package/dist/{doctor-EWf9CDso.js → .setup/doctor-BLCvdOFo.mjs} +1 -1
  26. package/dist/{doctor-contract-DEt4O4Zt.js → .setup/doctor-contract-HyWFZQVG.mjs} +5 -4
  27. package/dist/{draft-stream-0CEpNrBk.js → .setup/draft-stream-DfUFwKfN.mjs} +1 -1
  28. package/dist/{encryption-guidance-D4ZdAqzM.js → .setup/encryption-guidance-CvN_NQUJ.mjs} +4 -3
  29. package/dist/{http-client-D8o8b9u6.js → .setup/http-client-Bv6a2OfI.mjs} +11 -8
  30. package/dist/{idb-persistence-DfgW720p.js → .setup/idb-persistence-BiscLSq4.mjs} +3 -3
  31. package/dist/{idb-persistence-lock-DAJ49nZX.js → .setup/idb-persistence-lock-B3fZXyF_.mjs} +1 -1
  32. package/dist/{inbound-dedupe-RvSLqdsz.js → .setup/inbound-dedupe-BOsuMiaj.mjs} +2 -2
  33. package/dist/{logger-B_71hN6W.js → .setup/logger-B3tfcB-m.mjs} +1 -1
  34. package/dist/{logging-DRjvUOIh.js → .setup/logging-CkohOZwO.mjs} +2 -2
  35. package/dist/{messages-DaGRt-tu.js → .setup/messages-C3v-jkaN.mjs} +4 -4
  36. package/dist/{monitor-CLPbPcR9.js → .setup/monitor-CQ6pGvZh.mjs} +56 -81
  37. package/dist/.setup/probe.runtime-ni46ImsO.mjs +2 -0
  38. package/dist/{profile-D-Wubo0A.js → .setup/profile-ClrB3IgR.mjs} +2 -2
  39. package/dist/{profile-update-zXVCMg7y.js → .setup/profile-update-B9Q6Ox2O.mjs} +6 -5
  40. package/dist/{reaction-events-CjVUiqcY.js → .setup/reaction-events-Dtd3W-rj.mjs} +10 -8
  41. package/dist/{resolve-targets-qG6gceps.js → .setup/resolve-targets-Bke5jHKS.mjs} +3 -3
  42. package/dist/{resolver.runtime-zX3TR3TN.js → .setup/resolver.runtime-BtrbC025.mjs} +1 -1
  43. package/dist/{room-info-yheP1mod.js → .setup/room-info-B0VNxsF8.mjs} +4 -4
  44. package/dist/.setup/runtime-setter-api-DGMubGUq.mjs +3 -0
  45. package/dist/{sdk-TZYyo0XQ.js → .setup/sdk-DoObvds0.mjs} +528 -30
  46. package/dist/{secret-contract-CufozuyJ.js → .setup/secret-contract-JlB6VmI3.mjs} +1 -1
  47. package/dist/.setup/secret-contract-api-B-iJoQEv.mjs +3 -0
  48. package/dist/{send-BL_iH5Ox.js → .setup/send-SmBzUhD-.mjs} +19 -15
  49. package/dist/{setup-bootstrap-D8M7FmcO.js → .setup/setup-bootstrap-CUKhebeX.mjs} +3 -3
  50. package/dist/{setup-core-r6L0nno-.js → .setup/setup-core-BnqoLunq.mjs} +9 -8
  51. package/dist/.setup/setup-plugin-api-Dg95tydH.mjs +3 -0
  52. package/dist/{setup-surface-g174ElFO.js → .setup/setup-surface-sWwADrZ8.mjs} +87 -81
  53. package/dist/{startup-verification-Cs08ca8u.js → .setup/startup-verification-E46yu4fh.mjs} +3 -3
  54. package/dist/{storage-BsGuHngK.js → .setup/storage-B-nf2ReN.mjs} +7 -6
  55. package/dist/{subagent-hooks-CMoZaARG.js → .setup/subagent-hooks-jFgft_Mr.mjs} +6 -2
  56. package/dist/.setup/sync-cache-state-6Hjn1K-v.mjs +234 -0
  57. package/dist/{thread-binding-api-CzkeLZCU.js → .setup/thread-binding-api-DRMC62cs.mjs} +1 -1
  58. package/dist/{thread-bindings-ERWNousC.js → .setup/thread-bindings-_WJ8RYWJ.mjs} +4 -4
  59. package/dist/{tool-actions.runtime-DcBCSwY4.js → .setup/tool-actions.runtime-DLICojA3.mjs} +230 -168
  60. package/dist/{verification-4vsW_WSn.js → .setup/verification-DOT16noD.mjs} +4 -3
  61. package/dist/api.js +8 -8
  62. package/dist/auth-presence.js +1 -1
  63. package/dist/channel-plugin-api.js +1 -1
  64. package/dist/cli-metadata.js +1 -1
  65. package/dist/contract-api.js +2 -2
  66. package/dist/doctor-contract-api.js +9 -9
  67. package/dist/helper-api.js +3 -3
  68. package/dist/index.js +1 -1
  69. package/dist/plugin-entry.handlers.runtime.js +1 -1
  70. package/dist/runtime-api.js +6 -6
  71. package/dist/runtime-setter-api.js +1 -1
  72. package/dist/secret-contract-api.js +1 -1
  73. package/dist/session-binding-contract-api.js +2 -2
  74. package/dist/setup-entry.js +4 -3
  75. package/dist/setup-plugin-api.js +1 -1
  76. package/dist/subagent-hooks-api.js +1 -1
  77. package/dist/thread-binding-api.js +1 -1
  78. package/dist/thread-bindings-runtime.js +1 -1
  79. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs +525 -484
  80. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs.map +1 -1
  81. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js +7 -7
  82. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js.map +1 -1
  83. package/node_modules/markdown-it/dist/markdown-it.cjs.js +129 -121
  84. package/node_modules/markdown-it/dist/markdown-it.cjs.js.map +1 -1
  85. package/node_modules/markdown-it/dist/markdown-it.d.mts +42 -71
  86. package/node_modules/markdown-it/dist/markdown-it.mjs +129 -121
  87. package/node_modules/markdown-it/dist/markdown-it.mjs.map +1 -1
  88. package/node_modules/markdown-it/package.json +1 -2
  89. package/node_modules/matrix-js-sdk/lib/client.d.ts +2 -1
  90. package/node_modules/matrix-js-sdk/lib/client.js +6 -2
  91. package/node_modules/matrix-js-sdk/lib/sync.js +8 -8
  92. package/node_modules/matrix-js-sdk/src/client.ts +7 -3
  93. package/node_modules/matrix-js-sdk/src/sync.ts +8 -8
  94. package/node_modules/typebox/build/format/email.mjs +1 -1
  95. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
  96. package/node_modules/typebox/package.json +1 -1
  97. package/package.json +6 -6
  98. package/dist/file-sync-store-DjskBX2o.js +0 -436
  99. package/dist/probe.runtime-Bxpr1FFy.js +0 -2
  100. package/dist/recovery-key-store-CognuDys.js +0 -276
  101. /package/dist/{account-config-CRsKoMqJ.js → .setup/account-config-CRsKoMqJ.mjs} +0 -0
  102. /package/dist/{backup-health-Dm_YMVFT.js → .setup/backup-health-Dm_YMVFT.mjs} +0 -0
  103. /package/dist/{config-paths-CnREYb1Y.js → .setup/config-paths-CnREYb1Y.mjs} +0 -0
  104. /package/dist/{config-secret-input.runtime-CwsP3--c.js → .setup/config-secret-input.runtime-CwsP3--c.mjs} +0 -0
  105. /package/dist/{credentials-state-B3cuUFwZ.js → .setup/credentials-state-B3cuUFwZ.mjs} +0 -0
  106. /package/dist/{crypto-node.runtime-6Aj_ltHQ.js → .setup/crypto-node.runtime-6Aj_ltHQ.mjs} +0 -0
  107. /package/dist/{env-vars-dGqak9dN.js → .setup/env-vars-dGqak9dN.mjs} +0 -0
  108. /package/dist/{errors-DKVS3_DO.js → .setup/errors-DKVS3_DO.mjs} +0 -0
  109. /package/dist/{event-helpers-XRfAbOIh.js → .setup/event-helpers-XRfAbOIh.mjs} +0 -0
  110. /package/dist/{reaction-common-DkrQdBSZ.js → .setup/reaction-common-DkrQdBSZ.mjs} +0 -0
  111. /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
  112. /package/dist/{runtime-6S3DNFNv.js → .setup/runtime-6S3DNFNv.mjs} +0 -0
  113. /package/dist/{runtime-BefyhPWv.js → .setup/runtime-BefyhPWv.mjs} +0 -0
  114. /package/dist/{storage-paths-gUmSydsW.js → .setup/storage-paths-gUmSydsW.mjs} +0 -0
  115. /package/dist/{target-ids-Nwx7cMVE.js → .setup/target-ids-Nwx7cMVE.mjs} +0 -0
  116. /package/dist/{thread-bindings-shared-oNPiyMWY.js → .setup/thread-bindings-shared-oNPiyMWY.mjs} +0 -0
  117. /package/dist/{url-validation-GRHde6lq.js → .setup/url-validation-GRHde6lq.mjs} +0 -0
@@ -1,15 +1,15 @@
1
- import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
2
- import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
3
- import { i as resolveMatrixAccount } from "./accounts-fC57n-Jo.js";
4
- import { n as resolveMatrixConfigPath, r as updateMatrixAccountConfig } from "./config-update-DC0fWBxc.js";
5
- import { n as matrixSetupAdapter } from "./setup-core-r6L0nno-.js";
6
- import { n as withResolvedActionClient } from "./client-CZ_JvrO0.js";
7
- import { l as resolveMatrixAuthContext } from "./client-kSi51NKp.js";
8
- import { t as resolveMatrixRoomKeyBackupIssue } from "./backup-health-Dm_YMVFT.js";
9
- import { i as setMatrixSdkLogMode, r as setMatrixSdkConsoleLogging } from "./logging-DRjvUOIh.js";
10
- import { n as isOpenClawManagedMatrixDevice, r as summarizeMatrixDeviceHealth } from "./device-health-B4-YXtJR.js";
11
- import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update-zXVCMg7y.js";
12
- import { a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, g as runMatrixSelfVerification, h as restoreMatrixRoomKeyBackup, l as getMatrixVerificationSas, m as resetMatrixRoomKeyBackup, n as bootstrapMatrixVerification, p as requestMatrixVerification, r as cancelMatrixVerification, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-4vsW_WSn.js";
1
+ import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.mjs";
2
+ import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.mjs";
3
+ import { i as resolveMatrixAccount } from "./accounts-BJ6ECCac.mjs";
4
+ import { n as resolveMatrixConfigPath, r as updateMatrixAccountConfig } from "./config-update-B_4qZ5bV.mjs";
5
+ import { n as matrixSetupAdapter } from "./setup-core-BnqoLunq.mjs";
6
+ import { n as withResolvedActionClient } from "./client-CpHMD-C2.mjs";
7
+ import { u as resolveMatrixAuthContext } from "./client-DvcYcTSy.mjs";
8
+ import { t as resolveMatrixRoomKeyBackupIssue } from "./backup-health-Dm_YMVFT.mjs";
9
+ import { i as setMatrixSdkLogMode, r as setMatrixSdkConsoleLogging } from "./logging-CkohOZwO.mjs";
10
+ import { n as isOpenClawManagedMatrixDevice, r as summarizeMatrixDeviceHealth } from "./device-health-CWOuIirq.mjs";
11
+ import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update-B9Q6Ox2O.mjs";
12
+ import { a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, g as runMatrixSelfVerification, h as restoreMatrixRoomKeyBackup, l as getMatrixVerificationSas, m as resetMatrixRoomKeyBackup, n as bootstrapMatrixVerification, p as requestMatrixVerification, r as cancelMatrixVerification, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-DOT16noD.mjs";
13
13
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
14
14
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
15
15
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
@@ -18,7 +18,7 @@ import { formatZonedTimestamp } from "openclaw/plugin-sdk/time-runtime";
18
18
  import { readByteStreamWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
19
19
  //#region extensions/matrix/src/cli-shared.ts
20
20
  let matrixCliExitScheduled = false;
21
- const MATRIX_CLI_RECOVERY_KEY_STDIN_MAX_BYTES = 1024 * 1024;
21
+ const MATRIX_CLI_RECOVERY_KEY_STDIN_MAX_BYTES = 1048576;
22
22
  function scheduleMatrixCliExit() {
23
23
  if (matrixCliExitScheduled || process.env.VITEST) return;
24
24
  matrixCliExitScheduled = true;
@@ -292,10 +292,12 @@ function printBackupSummary(backup) {
292
292
  function buildVerificationGuidance(status, accountId) {
293
293
  const backup = resolveBackupStatus(status);
294
294
  const nextSteps = /* @__PURE__ */ new Set();
295
- if (!status.verified) if (status.recoveryKeyAccepted === true && status.backupUsable === true) {
296
- nextSteps.add(`Recovery key can unlock the room-key backup, but full Matrix identity trust is still incomplete. Run ${formatMatrixCliCommand("verify self", accountId)}, accept the request in another verified Matrix client, and confirm the SAS only if it matches.`);
297
- nextSteps.add(`If you intend to replace the current cross-signing identity, run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify bootstrap --recovery-key-stdin --force-reset-cross-signing", accountId)}.`);
298
- } else nextSteps.add(`Run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify device --recovery-key-stdin", accountId)}. If you do not have the recovery key but still have another verified Matrix client, run ${formatMatrixCliCommand("verify self", accountId)} instead.`);
295
+ if (!status.verified) {
296
+ if (status.recoveryKeyAccepted === true && status.backupUsable === true) {
297
+ nextSteps.add(`Recovery key can unlock the room-key backup, but full Matrix identity trust is still incomplete. Run ${formatMatrixCliCommand("verify self", accountId)}, accept the request in another verified Matrix client, and confirm the SAS only if it matches.`);
298
+ nextSteps.add(`If you intend to replace the current cross-signing identity, run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify bootstrap --recovery-key-stdin --force-reset-cross-signing", accountId)}.`);
299
+ } else nextSteps.add(`Run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify device --recovery-key-stdin", accountId)}. If you do not have the recovery key but still have another verified Matrix client, run ${formatMatrixCliCommand("verify self", accountId)} instead.`);
300
+ }
299
301
  if (status.serverDeviceKnown === false) nextSteps.add(`This Matrix device is no longer listed on the homeserver. Create a new OpenClaw Matrix device with ${formatMatrixCliCommand("account add --homeserver <url> --user-id <@user:server> --password <password> --device-name OpenClaw-Gateway", accountId)}. If you use token auth, create a fresh Matrix access token in your Matrix client or admin UI, then run ${formatMatrixCliCommand("account add --homeserver <url> --access-token <token>", accountId)}.`);
300
302
  for (const step of buildBackupGuidance(backup, accountId, { recoveryKeyStored: status.recoveryKeyStored })) nextSteps.add(step);
301
303
  if (status.pendingVerifications > 0) nextSteps.add(`Review pending verification requests with ${formatMatrixCliCommand("verify list", accountId)}. Complete each active request with ${formatMatrixCliCommand("verify sas <id>", accountId)} and ${formatMatrixCliCommand("verify confirm-sas <id>", accountId)}, or cancel stale requests with ${formatMatrixCliCommand("verify cancel <id>", accountId)}.`);
@@ -305,9 +307,10 @@ function buildBackupGuidance(backup, accountId, options = {}) {
305
307
  const backupIssue = resolveMatrixRoomKeyBackupIssue(backup);
306
308
  const nextSteps = /* @__PURE__ */ new Set();
307
309
  if (backupIssue.code === "missing-server-backup") nextSteps.add(`Run ${formatMatrixCliCommand("verify bootstrap", accountId)} to create a room key backup.`);
308
- else if (backupIssue.code === "key-load-failed" || backupIssue.code === "key-not-loaded" || backupIssue.code === "inactive") if (options.recoveryKeyStored) nextSteps.add(`Backup key is not loaded on this device. Run ${formatMatrixCliCommand("verify backup restore", accountId)} to load it and restore old room keys. If restore still cannot load the key, run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify backup restore --recovery-key-stdin", accountId)}.`);
309
- else nextSteps.add(`Run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify backup restore --recovery-key-stdin", accountId)} to load the server backup and store the key for future restores.`);
310
- else if (backupIssue.code === "key-mismatch") {
310
+ else if (backupIssue.code === "key-load-failed" || backupIssue.code === "key-not-loaded" || backupIssue.code === "inactive") {
311
+ if (options.recoveryKeyStored) nextSteps.add(`Backup key is not loaded on this device. Run ${formatMatrixCliCommand("verify backup restore", accountId)} to load it and restore old room keys. If restore still cannot load the key, run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify backup restore --recovery-key-stdin", accountId)}.`);
312
+ else nextSteps.add(`Run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify backup restore --recovery-key-stdin", accountId)} to load the server backup and store the key for future restores.`);
313
+ } else if (backupIssue.code === "key-mismatch") {
311
314
  nextSteps.add(`Backup key mismatch on this device. Run the shown printf pipeline with the active server backup recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify backup restore --recovery-key-stdin", accountId)}.`);
312
315
  nextSteps.add(`If you want a fresh backup baseline and accept losing unrecoverable history, run ${formatMatrixCliCommand("verify backup reset --yes", accountId)}. Add --rotate-recovery-key only when the old recovery key should stop unlocking the fresh backup.`);
313
316
  } else if (backupIssue.code === "untrusted-signature") {
@@ -325,7 +328,8 @@ function printGuidance(lines) {
325
328
  function printVerificationStatus(status, verbose = false, accountId) {
326
329
  console.log(`Verified by owner: ${status.verified ? "yes" : "no"}`);
327
330
  if (status.serverDeviceKnown === false) console.log("Device issue: current Matrix device is missing from the homeserver device list");
328
- const backupIssue = resolveMatrixRoomKeyBackupIssue(resolveBackupStatus(status));
331
+ const backup = resolveBackupStatus(status);
332
+ const backupIssue = resolveMatrixRoomKeyBackupIssue(backup);
329
333
  printVerificationBackupSummary(status);
330
334
  if (backupIssue.message) console.log(`Backup issue: ${backupIssue.message}`);
331
335
  console.log(`Recovery key stored: ${status.recoveryKeyStored ? "yes" : "no"}`);
@@ -413,7 +417,7 @@ async function addMatrixAccount(params) {
413
417
  backupVersion: null
414
418
  };
415
419
  if (accountConfig.encryption === true) {
416
- const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-D8M7FmcO.js");
420
+ const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-CUKhebeX.mjs");
417
421
  verificationBootstrap = await maybeBootstrapNewEncryptedMatrixAccount({
418
422
  previousCfg: cfg,
419
423
  cfg: updated,
@@ -438,7 +442,8 @@ async function addMatrixAccount(params) {
438
442
  });
439
443
  let resolvedAvatarUrl = synced.resolvedAvatarUrl;
440
444
  if (synced.convertedAvatarFromHttp && synced.resolvedAvatarUrl) {
441
- const withAvatar = updateMatrixAccountConfig(runtime.config.current(), accountId, { avatarUrl: synced.resolvedAvatarUrl });
445
+ const latestCfg = runtime.config.current();
446
+ const withAvatar = updateMatrixAccountConfig(latestCfg, accountId, { avatarUrl: synced.resolvedAvatarUrl });
442
447
  await runtime.config.replaceConfigFile({
443
448
  nextConfig: withAvatar,
444
449
  afterWrite: { mode: "auto" }
@@ -514,20 +519,24 @@ function registerMatrixAccountCommands(root) {
514
519
  console.log(`Config path: ${formatMatrixCliText(result.configPath)}`);
515
520
  console.log(`Credentials source: ${result.useEnv ? "MATRIX_* / MATRIX_<ACCOUNT_ID>_* env vars" : "inline config"}`);
516
521
  console.log(`Encryption: ${result.encryptionEnabled ? "enabled" : "disabled"}`);
517
- if (result.verificationBootstrap.attempted) if (result.verificationBootstrap.success) {
518
- console.log("Matrix verification bootstrap: complete");
519
- printTimestamp("Recovery key created at", result.verificationBootstrap.recoveryKeyCreatedAt);
520
- if (result.verificationBootstrap.backupVersion) console.log(`Backup version: ${formatMatrixCliText(result.verificationBootstrap.backupVersion)}`);
521
- } else console.error(`Matrix verification bootstrap warning: ${formatMatrixCliText(result.verificationBootstrap.error)}`);
522
+ if (result.verificationBootstrap.attempted) {
523
+ if (result.verificationBootstrap.success) {
524
+ console.log("Matrix verification bootstrap: complete");
525
+ printTimestamp("Recovery key created at", result.verificationBootstrap.recoveryKeyCreatedAt);
526
+ if (result.verificationBootstrap.backupVersion) console.log(`Backup version: ${formatMatrixCliText(result.verificationBootstrap.backupVersion)}`);
527
+ } else console.error(`Matrix verification bootstrap warning: ${formatMatrixCliText(result.verificationBootstrap.error)}`);
528
+ }
522
529
  if (result.deviceHealth.error) console.error(`Matrix device health warning: ${formatMatrixCliText(result.deviceHealth.error)}`);
523
530
  else if (result.deviceHealth.staleOpenClawDeviceIds.length > 0) {
524
531
  const staleDeviceIds = result.deviceHealth.staleOpenClawDeviceIds.map((deviceId) => formatMatrixCliText(deviceId)).join(", ");
525
532
  console.log(`Matrix device hygiene warning: stale OpenClaw devices detected (${staleDeviceIds}). Run ${formatMatrixCliCommand("devices prune-stale", result.accountId)}.`);
526
533
  }
527
- if (result.profile.attempted) if (result.profile.error) console.error(`Profile sync warning: ${formatMatrixCliText(result.profile.error)}`);
528
- else {
529
- console.log(`Profile sync: name ${result.profile.displayNameUpdated ? "updated" : "unchanged"}, avatar ${result.profile.avatarUpdated ? "updated" : "unchanged"}`);
530
- if (result.profile.convertedAvatarFromHttp && result.profile.resolvedAvatarUrl) console.log(`Avatar converted and saved as: ${formatMatrixCliText(result.profile.resolvedAvatarUrl)}`);
534
+ if (result.profile.attempted) {
535
+ if (result.profile.error) console.error(`Profile sync warning: ${formatMatrixCliText(result.profile.error)}`);
536
+ else {
537
+ console.log(`Profile sync: name ${result.profile.displayNameUpdated ? "updated" : "unchanged"}, avatar ${result.profile.avatarUpdated ? "updated" : "unchanged"}`);
538
+ if (result.profile.convertedAvatarFromHttp && result.profile.resolvedAvatarUrl) console.log(`Avatar converted and saved as: ${formatMatrixCliText(result.profile.resolvedAvatarUrl)}`);
539
+ }
531
540
  }
532
541
  const bindHint = `openclaw agents bind --agent <id> --bind matrix:${result.accountId}`;
533
542
  console.log(`Bind this account to an agent: ${bindHint}`);
@@ -596,8 +605,8 @@ function registerMatrixDeviceCommands(root) {
596
605
  }
597
606
  //#endregion
598
607
  //#region extensions/matrix/src/cli-direct.ts
599
- const loadMatrixActionClientModule = createLazyRuntimeModule(() => import("./client-CZ_JvrO0.js").then((n) => n.t));
600
- const loadMatrixDirectManagementModule = createLazyRuntimeModule(() => import("./send-BL_iH5Ox.js").then((n) => n.x));
608
+ const loadMatrixActionClientModule = createLazyRuntimeModule(() => import("./client-CpHMD-C2.mjs").then((n) => n.t));
609
+ const loadMatrixDirectManagementModule = createLazyRuntimeModule(() => import("./send-SmBzUhD-.mjs").then((n) => n.x));
601
610
  function printDirectRoomCandidate(room) {
602
611
  const members = room.joinedMembers === null ? "unavailable" : room.joinedMembers.map((member) => formatMatrixCliText(member)).join(", ") || "none";
603
612
  console.log(`- ${formatMatrixCliText(room.roomId)} [${room.source}] strict=${room.strict ? "yes" : "no"} joined=${members}`);
@@ -2,7 +2,7 @@ import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
2
2
  //#region extensions/matrix/src/cli-metadata.ts
3
3
  function registerMatrixCliMetadata(api) {
4
4
  api.registerCli(async ({ program }) => {
5
- const { registerMatrixCli } = await import("./cli-DRVtgrq5.js");
5
+ const { registerMatrixCli } = await import("./cli-CyuDGiIr.mjs");
6
6
  registerMatrixCli({ program });
7
7
  }, { descriptors: [{
8
8
  name: "matrix",
@@ -1,6 +1,6 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { b as resolveMatrixRoomId } from "./send-BL_iH5Ox.js";
3
- import { n as withResolvedRuntimeMatrixClient } from "./client-bootstrap-D8irSL2i.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
+ import { b as resolveMatrixRoomId } from "./send-SmBzUhD-.mjs";
3
+ import { n as withResolvedRuntimeMatrixClient } from "./client-bootstrap-Cb1tHsT4.mjs";
4
4
  //#region extensions/matrix/src/matrix/actions/client.ts
5
5
  var client_exports = /* @__PURE__ */ __exportAll({
6
6
  withResolvedActionClient: () => withResolvedActionClient,
@@ -1,11 +1,11 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { a as resolveMatrixDefaultOrOnlyAccountId, c as resolveScopedMatrixEnvConfig, l as resolveMatrixAccountStringValues, n as requiresExplicitMatrixDefaultAccount, o as resolveGlobalMatrixEnvConfig } from "./account-selection-C8nnBTxi.js";
3
- import { t as getMatrixScopedEnvVarNames } from "./env-vars-dGqak9dN.js";
4
- import { o as resolveMatrixBaseConfig, r as listNormalizedMatrixAccountIds, t as findMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
5
- import { t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.js";
6
- import { t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
7
- import { d as writeStorageMeta, l as resolveMatrixStoragePaths, r as maybeMigrateLegacyStorage, s as repairCurrentTokenStorageMetaDeviceId } from "./storage-BsGuHngK.js";
8
- import { n as LogService } from "./logger-B_71hN6W.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
+ import { a as resolveMatrixDefaultOrOnlyAccountId, c as resolveScopedMatrixEnvConfig, l as resolveMatrixAccountStringValues, n as requiresExplicitMatrixDefaultAccount, o as resolveGlobalMatrixEnvConfig } from "./account-selection-DZMazUgX.mjs";
3
+ import { t as getMatrixScopedEnvVarNames } from "./env-vars-dGqak9dN.mjs";
4
+ import { o as resolveMatrixBaseConfig, r as listNormalizedMatrixAccountIds, t as findMatrixAccountConfig } from "./account-config-CRsKoMqJ.mjs";
5
+ import { t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.mjs";
6
+ import { t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.mjs";
7
+ import { d as writeStorageMeta, l as resolveMatrixStoragePaths, r as maybeMigrateLegacyStorage, s as repairCurrentTokenStorageMetaDeviceId } from "./storage-B-nf2ReN.mjs";
8
+ import { n as LogService } from "./logger-B3tfcB-m.mjs";
9
9
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
10
10
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
11
11
  import { DEFAULT_ACCOUNT_ID, normalizeAccountId, normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-id";
@@ -18,15 +18,16 @@ import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime"
18
18
  import { retryAsync } from "openclaw/plugin-sdk/retry-runtime";
19
19
  import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
20
20
  import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
21
+ import { AsyncLocalStorage } from "node:async_hooks";
21
22
  //#region extensions/matrix/src/matrix/client/config.ts
22
- const loadMatrixAuthClientDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-TZYyo0XQ.js"), import("./logging-DRjvUOIh.js").then((n) => n.n)]).then(([sdkModule, loggingModule]) => ({
23
+ const loadMatrixAuthClientDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-DoObvds0.mjs").then((n) => n.t), import("./logging-CkohOZwO.mjs").then((n) => n.n)]).then(([sdkModule, loggingModule]) => ({
23
24
  MatrixClient: sdkModule.MatrixClient,
24
25
  ensureMatrixSdkLoggingConfigured: loggingModule.ensureMatrixSdkLoggingConfigured
25
26
  })));
26
27
  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;
27
- const loadMatrixCredentialsReadDeps = createLazyRuntimeModule(() => import("./credentials-read-B37cQknZ.js").then((n) => n.r));
28
- const loadMatrixCredentialsWriteRuntime = createLazyRuntimeModule(() => import("./credentials-write.runtime-nAV2-5uR.js"));
29
- const loadMatrixSecretInputDeps = createLazyRuntimeModule(() => import("./config-secret-input.runtime-CwsP3--c.js"));
28
+ const loadMatrixCredentialsReadDeps = createLazyRuntimeModule(() => import("./credentials-read-DaemdXHy.mjs").then((n) => n.r));
29
+ const loadMatrixCredentialsWriteRuntime = createLazyRuntimeModule(() => import("./credentials-write.runtime-D83HEGcL.mjs"));
30
+ const loadMatrixSecretInputDeps = createLazyRuntimeModule(() => import("./config-secret-input.runtime-CwsP3--c.mjs"));
30
31
  function shouldRetryMatrixAuthRequest(err) {
31
32
  return MATRIX_AUTH_REQUEST_RETRY_RE.test(formatErrorMessage(err));
32
33
  }
@@ -77,12 +78,13 @@ function readMatrixEnvSecretRef(params) {
77
78
  function readMatrixConfigString(params) {
78
79
  const ref = coerceSecretRef(params.value, params.cfg.secrets?.defaults);
79
80
  if (params.suppressSecretRef && ref) return "";
81
+ const value = params.allowEnvSecretRef ? ref?.source === "env" ? readMatrixEnvSecretRef({
82
+ ref,
83
+ cfg: params.cfg,
84
+ env: params.env
85
+ }) ?? params.value : ref ? "" : params.value : params.value;
80
86
  return normalizeResolvedSecretInputString({
81
- value: params.allowEnvSecretRef ? ref?.source === "env" ? readMatrixEnvSecretRef({
82
- ref,
83
- cfg: params.cfg,
84
- env: params.env
85
- }) ?? params.value : ref ? "" : params.value : params.value,
87
+ value,
86
88
  path: params.path,
87
89
  defaults: params.cfg.secrets?.defaults
88
90
  }) ?? "";
@@ -414,7 +416,7 @@ async function backfillMatrixAuthDeviceIdAfterStartup(params) {
414
416
  //#endregion
415
417
  //#region extensions/matrix/src/matrix/client/create-client.ts
416
418
  var create_client_exports = /* @__PURE__ */ __exportAll({ createMatrixClient: () => createMatrixClient });
417
- const loadMatrixCreateClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-TZYyo0XQ.js"), import("./logging-DRjvUOIh.js").then((n) => n.n)]).then(([sdkModule, loggingModule]) => ({
419
+ const loadMatrixCreateClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-DoObvds0.mjs").then((n) => n.t), import("./logging-CkohOZwO.mjs").then((n) => n.n)]).then(([sdkModule, loggingModule]) => ({
418
420
  MatrixClient: sdkModule.MatrixClient,
419
421
  ensureMatrixSdkLoggingConfigured: loggingModule.ensureMatrixSdkLoggingConfigured
420
422
  })));
@@ -464,6 +466,44 @@ async function createMatrixClient(params) {
464
466
  });
465
467
  }
466
468
  //#endregion
469
+ //#region extensions/matrix/src/matrix/monitor/task-runner.ts
470
+ const monitorTaskSignal = new AsyncLocalStorage();
471
+ function getMatrixMonitorTaskSignal() {
472
+ return monitorTaskSignal.getStore();
473
+ }
474
+ function createMatrixMonitorTaskRunner(params) {
475
+ const inFlight = /* @__PURE__ */ new Map();
476
+ let closed = false;
477
+ const runDetachedTask = (label, task) => {
478
+ if (closed) return Promise.resolve();
479
+ const controller = new AbortController();
480
+ const trackedTask = monitorTaskSignal.run(controller.signal, () => Promise.resolve().then(task)).catch((error) => {
481
+ const message = String(error);
482
+ params.logVerboseMessage(`matrix: ${label} failed (${message})`);
483
+ params.logger.warn("matrix background task failed", {
484
+ task: label,
485
+ error: message
486
+ });
487
+ }).finally(() => {
488
+ controller.abort();
489
+ inFlight.delete(trackedTask);
490
+ });
491
+ inFlight.set(trackedTask, controller);
492
+ return trackedTask;
493
+ };
494
+ const waitForIdle = async () => {
495
+ while (inFlight.size > 0) await Promise.allSettled(Array.from(inFlight.keys()));
496
+ };
497
+ return {
498
+ close: () => {
499
+ closed = true;
500
+ for (const controller of inFlight.values()) controller.abort();
501
+ },
502
+ runDetachedTask,
503
+ waitForIdle
504
+ };
505
+ }
506
+ //#endregion
467
507
  //#region extensions/matrix/src/matrix/startup-abort.ts
468
508
  function createMatrixStartupAbortError() {
469
509
  const error = /* @__PURE__ */ new Error("Matrix startup aborted");
@@ -590,6 +630,7 @@ async function resolveSharedMatrixAuth(params) {
590
630
  }
591
631
  async function resolveOpenSharedMatrixClientState(params) {
592
632
  const auth = await resolveSharedMatrixAuth(params);
633
+ throwIfMatrixStartupAborted(params.abortSignal);
593
634
  const key = buildSharedClientKey(auth);
594
635
  while (true) {
595
636
  const existing = sharedClientStates.get(key);
@@ -773,8 +814,8 @@ function createSharedMatrixClientLease(state, role) {
773
814
  leaseState.releasePromise = retireMonitorLease(state, leaseState);
774
815
  return leaseState.releasePromise;
775
816
  }
776
- if (!(finalMonitor || state.leases.size === 0)) {
777
- leaseState.releasePromise = Promise.resolve();
817
+ if (!(state.phase === "open" && (finalMonitor || state.leases.size === 0))) {
818
+ leaseState.releasePromise = state.poisonError ? Promise.reject(state.poisonError) : Promise.resolve();
778
819
  return leaseState.releasePromise;
779
820
  }
780
821
  leaseState.releasePromise = beginGenerationRetirement({
@@ -786,11 +827,23 @@ function createSharedMatrixClientLease(state, role) {
786
827
  };
787
828
  }
788
829
  async function acquireSharedMatrixClient(params = {}) {
830
+ const taskSignal = getMatrixMonitorTaskSignal();
831
+ const abortSignal = taskSignal && params.abortSignal ? AbortSignal.any([taskSignal, params.abortSignal]) : taskSignal ?? params.abortSignal;
832
+ const acquisition = {
833
+ ...params,
834
+ abortSignal
835
+ };
789
836
  while (true) {
790
- const lease = createSharedMatrixClientLease(await resolveOpenSharedMatrixClientState(params), params.role ?? "transient");
837
+ throwIfMatrixStartupAborted(abortSignal);
838
+ const state = await resolveOpenSharedMatrixClientState(acquisition);
839
+ if (abortSignal?.aborted) {
840
+ if (state.phase === "open" && state.leases.size === 0) await beginGenerationRetirement({ state });
841
+ throwIfMatrixStartupAborted(abortSignal);
842
+ }
843
+ const lease = createSharedMatrixClientLease(state, params.role ?? "transient");
791
844
  if (!lease) continue;
792
845
  if (params.startClient !== false) try {
793
- await lease.start(params.abortSignal);
846
+ await lease.start(abortSignal);
794
847
  } catch (error) {
795
848
  await lease.release({ mode: "stop" }).catch(() => void 0);
796
849
  throw error;
@@ -805,4 +858,4 @@ var client_exports = /* @__PURE__ */ __exportAll({
805
858
  resolveMatrixAuthContext: () => resolveMatrixAuthContext
806
859
  });
807
860
  //#endregion
808
- export { throwIfMatrixStartupAborted as a, resolveMatrixAuth as c, isMatrixStartupAbortError as i, resolveMatrixAuthContext as l, acquireSharedMatrixClient as n, createMatrixClient as o, createMatrixStartupAbortError as r, backfillMatrixAuthDeviceIdAfterStartup as s, client_exports as t };
861
+ export { throwIfMatrixStartupAborted as a, backfillMatrixAuthDeviceIdAfterStartup as c, isMatrixStartupAbortError as i, resolveMatrixAuth as l, acquireSharedMatrixClient as n, createMatrixMonitorTaskRunner as o, createMatrixStartupAbortError as r, createMatrixClient as s, client_exports as t, resolveMatrixAuthContext as u };
@@ -1,5 +1,5 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
+ import { t as isBunRuntime } from "./runtime-BefyhPWv.mjs";
3
3
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
4
4
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
5
5
  //#region extensions/matrix/src/matrix/client-bootstrap.ts
@@ -7,7 +7,7 @@ var client_bootstrap_exports = /* @__PURE__ */ __exportAll({
7
7
  resolveRuntimeMatrixClientWithReadiness: () => resolveRuntimeMatrixClientWithReadiness,
8
8
  withResolvedRuntimeMatrixClient: () => withResolvedRuntimeMatrixClient
9
9
  });
10
- const loadMatrixSharedClientRuntimeDeps = createLazyRuntimeModule(() => import("./client-kSi51NKp.js").then((n) => n.t).then((clientModule) => ({
10
+ const loadMatrixSharedClientRuntimeDeps = createLazyRuntimeModule(() => import("./client-DvcYcTSy.mjs").then((n) => n.t).then((clientModule) => ({
11
11
  acquireSharedMatrixClient: clientModule.acquireSharedMatrixClient,
12
12
  resolveMatrixAuthContext: clientModule.resolveMatrixAuthContext
13
13
  })));
@@ -1,4 +1,4 @@
1
- import { t as formatMatrixErrorReason } from "./errors-DKVS3_DO.js";
1
+ import { t as formatMatrixErrorReason } from "./errors-DKVS3_DO.mjs";
2
2
  //#region extensions/matrix/src/matrix/sync-state.ts
3
3
  function isMatrixReadySyncState(state) {
4
4
  return state === "PREPARED" || state === "SYNCING" || state === "CATCHUP";
@@ -1,6 +1,6 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { t as findMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
3
- import { n as resolveMatrixConfigPath$1, r as shouldStoreMatrixAccountAtTopLevel, t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
+ import { t as findMatrixAccountConfig } from "./account-config-CRsKoMqJ.mjs";
3
+ import { n as resolveMatrixConfigPath$1, r as shouldStoreMatrixAccountAtTopLevel, t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.mjs";
4
4
  import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
5
5
  import { coerceSecretRef, normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
6
6
  import { resolveOptionalIntegerOption } from "openclaw/plugin-sdk/number-runtime";
@@ -66,11 +66,13 @@ function updateMatrixAccountConfig(cfg, accountId, patch) {
66
66
  const matrix = cfg.channels?.matrix ?? {};
67
67
  const normalizedAccountId = normalizeAccountId(accountId);
68
68
  const nextAccount = { ...findMatrixAccountConfig(cfg, normalizedAccountId) ?? (normalizedAccountId === DEFAULT_ACCOUNT_ID ? matrix : {}) };
69
- if (patch.name !== void 0) if (patch.name === null) delete nextAccount.name;
70
- else {
71
- const trimmed = patch.name.trim();
72
- if (trimmed) nextAccount.name = trimmed;
73
- else delete nextAccount.name;
69
+ if (patch.name !== void 0) {
70
+ if (patch.name === null) delete nextAccount.name;
71
+ else {
72
+ const trimmed = patch.name.trim();
73
+ if (trimmed) nextAccount.name = trimmed;
74
+ else delete nextAccount.name;
75
+ }
74
76
  }
75
77
  if (typeof patch.enabled === "boolean") nextAccount.enabled = patch.enabled;
76
78
  else if (typeof nextAccount.enabled !== "boolean") nextAccount.enabled = true;
@@ -89,31 +91,47 @@ function updateMatrixAccountConfig(cfg, accountId, patch) {
89
91
  if (Object.keys(nextNetwork).length > 0) nextAccount.network = nextNetwork;
90
92
  else delete nextAccount.network;
91
93
  }
92
- if (patch.initialSyncLimit !== void 0) if (patch.initialSyncLimit === null) delete nextAccount.initialSyncLimit;
93
- else {
94
- const initialSyncLimit = resolveOptionalIntegerOption(patch.initialSyncLimit, { min: 0 });
95
- if (initialSyncLimit === void 0) delete nextAccount.initialSyncLimit;
96
- else nextAccount.initialSyncLimit = initialSyncLimit;
97
- }
98
- if (patch.encryption !== void 0) if (patch.encryption === null) delete nextAccount.encryption;
99
- else nextAccount.encryption = patch.encryption;
100
- if (patch.allowBots !== void 0) if (patch.allowBots === null) delete nextAccount.allowBots;
101
- else nextAccount.allowBots = patch.allowBots;
102
- if (patch.autoJoin !== void 0) if (patch.autoJoin === null) delete nextAccount.autoJoin;
103
- else nextAccount.autoJoin = patch.autoJoin;
94
+ if (patch.initialSyncLimit !== void 0) {
95
+ if (patch.initialSyncLimit === null) delete nextAccount.initialSyncLimit;
96
+ else {
97
+ const initialSyncLimit = resolveOptionalIntegerOption(patch.initialSyncLimit, { min: 0 });
98
+ if (initialSyncLimit === void 0) delete nextAccount.initialSyncLimit;
99
+ else nextAccount.initialSyncLimit = initialSyncLimit;
100
+ }
101
+ }
102
+ if (patch.encryption !== void 0) {
103
+ if (patch.encryption === null) delete nextAccount.encryption;
104
+ else nextAccount.encryption = patch.encryption;
105
+ }
106
+ if (patch.allowBots !== void 0) {
107
+ if (patch.allowBots === null) delete nextAccount.allowBots;
108
+ else nextAccount.allowBots = patch.allowBots;
109
+ }
110
+ if (patch.autoJoin !== void 0) {
111
+ if (patch.autoJoin === null) delete nextAccount.autoJoin;
112
+ else nextAccount.autoJoin = patch.autoJoin;
113
+ }
104
114
  applyNullableArrayField(nextAccount, "autoJoinAllowlist", patch.autoJoinAllowlist);
105
- if (patch.dm !== void 0) if (patch.dm === null) delete nextAccount.dm;
106
- else nextAccount.dm = cloneMatrixDmConfig({
107
- ...nextAccount.dm,
108
- ...patch.dm
109
- });
110
- if (patch.groupPolicy !== void 0) if (patch.groupPolicy === null) delete nextAccount.groupPolicy;
111
- else nextAccount.groupPolicy = patch.groupPolicy;
115
+ if (patch.dm !== void 0) {
116
+ if (patch.dm === null) delete nextAccount.dm;
117
+ else nextAccount.dm = cloneMatrixDmConfig({
118
+ ...nextAccount.dm,
119
+ ...patch.dm
120
+ });
121
+ }
122
+ if (patch.groupPolicy !== void 0) {
123
+ if (patch.groupPolicy === null) delete nextAccount.groupPolicy;
124
+ else nextAccount.groupPolicy = patch.groupPolicy;
125
+ }
112
126
  applyNullableArrayField(nextAccount, "groupAllowFrom", patch.groupAllowFrom);
113
- if (patch.groups !== void 0) if (patch.groups === null) delete nextAccount.groups;
114
- else nextAccount.groups = cloneMatrixRoomMap(patch.groups);
115
- if (patch.rooms !== void 0) if (patch.rooms === null) delete nextAccount.rooms;
116
- else nextAccount.rooms = cloneMatrixRoomMap(patch.rooms);
127
+ if (patch.groups !== void 0) {
128
+ if (patch.groups === null) delete nextAccount.groups;
129
+ else nextAccount.groups = cloneMatrixRoomMap(patch.groups);
130
+ }
131
+ if (patch.rooms !== void 0) {
132
+ if (patch.rooms === null) delete nextAccount.rooms;
133
+ else nextAccount.rooms = cloneMatrixRoomMap(patch.rooms);
134
+ }
117
135
  const nextAccounts = Object.fromEntries(Object.entries(matrix.accounts ?? {}).filter(([rawAccountId]) => rawAccountId === normalizedAccountId || normalizeAccountId(rawAccountId) !== normalizedAccountId));
118
136
  if (shouldStoreMatrixAccountAtTopLevel(cfg, normalizedAccountId)) {
119
137
  const { accounts: _ignoredAccounts, defaultAccount } = matrix;
@@ -1,17 +1,13 @@
1
- import { i as normalizeMatrixStoredCredentials, n as isMatrixCredentialRevocation, r as matrixCredentialsStoreKey } from "./credentials-state-B3cuUFwZ.js";
2
- import { a as resolveMatrixCredentialsPath, r as resolveMatrixCredentialsDir } from "./storage-paths-gUmSydsW.js";
3
- import { a as openMatrixCredentialsStore, i as loadMatrixCredentials, n as credentialsMatchConfig, t as clearMatrixCredentials } from "./credentials-read-B37cQknZ.js";
1
+ import { i as normalizeMatrixStoredCredentials, n as isMatrixCredentialRevocation, r as matrixCredentialsStoreKey } from "./credentials-state-B3cuUFwZ.mjs";
2
+ import { a as resolveMatrixCredentialsPath, r as resolveMatrixCredentialsDir } from "./storage-paths-gUmSydsW.mjs";
3
+ import { a as openMatrixCredentialsStore, i as loadMatrixCredentials, n as credentialsMatchConfig, t as clearMatrixCredentials } from "./credentials-read-DaemdXHy.mjs";
4
4
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
5
5
  //#region extensions/matrix/src/matrix/credentials.ts
6
- function requireCredentialStoreUpdate(store) {
7
- if (!store.update) throw new Error("Matrix credentials require atomic plugin-state updates");
8
- return store.update;
9
- }
10
6
  async function saveMatrixCredentials(credentials, env = process.env, accountId) {
11
7
  const normalizedAccountId = normalizeAccountId(accountId);
12
8
  const store = openMatrixCredentialsStore(env);
13
9
  const now = (/* @__PURE__ */ new Date()).toISOString();
14
- requireCredentialStoreUpdate(store)(matrixCredentialsStoreKey(normalizedAccountId), (current) => {
10
+ store.update(matrixCredentialsStoreKey(normalizedAccountId), (current) => {
15
11
  const existing = normalizeMatrixStoredCredentials(current, normalizedAccountId);
16
12
  return {
17
13
  accountId: normalizedAccountId,
@@ -29,7 +25,7 @@ async function saveBackfilledMatrixDeviceId(credentials, env = process.env, acco
29
25
  const store = openMatrixCredentialsStore(env);
30
26
  const now = (/* @__PURE__ */ new Date()).toISOString();
31
27
  let result = "saved";
32
- requireCredentialStoreUpdate(store)(matrixCredentialsStoreKey(normalizedAccountId), (current) => {
28
+ store.update(matrixCredentialsStoreKey(normalizedAccountId), (current) => {
33
29
  if (isMatrixCredentialRevocation(current, normalizedAccountId)) {
34
30
  result = "skipped";
35
31
  return current;
@@ -53,7 +49,7 @@ async function saveBackfilledMatrixDeviceId(credentials, env = process.env, acco
53
49
  }
54
50
  async function touchMatrixCredentials(env = process.env, accountId) {
55
51
  const normalizedAccountId = normalizeAccountId(accountId);
56
- requireCredentialStoreUpdate(openMatrixCredentialsStore(env))(matrixCredentialsStoreKey(normalizedAccountId), (current) => {
52
+ openMatrixCredentialsStore(env).update(matrixCredentialsStoreKey(normalizedAccountId), (current) => {
57
53
  if (isMatrixCredentialRevocation(current, normalizedAccountId)) return current;
58
54
  const existing = normalizeMatrixStoredCredentials(current, normalizedAccountId);
59
55
  return existing ? {
@@ -1,7 +1,7 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { n as getOptionalMatrixRuntime } from "./runtime-6S3DNFNv.js";
3
- import { i as normalizeMatrixStoredCredentials, r as matrixCredentialsStoreKey, t as MATRIX_CREDENTIALS_NAMESPACE } from "./credentials-state-B3cuUFwZ.js";
4
- import { a as resolveMatrixCredentialsPath, r as resolveMatrixCredentialsDir } from "./storage-paths-gUmSydsW.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
+ import { n as getOptionalMatrixRuntime } from "./runtime-6S3DNFNv.mjs";
3
+ import { i as normalizeMatrixStoredCredentials, r as matrixCredentialsStoreKey, t as MATRIX_CREDENTIALS_NAMESPACE } from "./credentials-state-B3cuUFwZ.mjs";
4
+ import { a as resolveMatrixCredentialsPath, r as resolveMatrixCredentialsDir } from "./storage-paths-gUmSydsW.mjs";
5
5
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
6
6
  import { createPluginStateSyncKeyedStore } from "openclaw/plugin-sdk/plugin-state-store-runtime";
7
7
  //#region extensions/matrix/src/matrix/credentials-read.ts
@@ -15,19 +15,21 @@ var credentials_read_exports = /* @__PURE__ */ __exportAll({
15
15
  });
16
16
  function openMatrixCredentialsStore(env = process.env) {
17
17
  const runtime = getOptionalMatrixRuntime();
18
+ const resolvedEnv = env.OPENCLAW_STATE_DIR?.trim() || !runtime ? env : {
19
+ ...env,
20
+ OPENCLAW_STATE_DIR: runtime.state.resolveStateDir(env)
21
+ };
18
22
  return createPluginStateSyncKeyedStore("matrix", {
19
23
  namespace: MATRIX_CREDENTIALS_NAMESPACE,
20
24
  maxEntries: 256,
21
25
  overflowPolicy: "reject-new",
22
- env: env.OPENCLAW_STATE_DIR?.trim() || !runtime ? env : {
23
- ...env,
24
- OPENCLAW_STATE_DIR: runtime.state.resolveStateDir(env)
25
- }
26
+ env: resolvedEnv
26
27
  });
27
28
  }
28
29
  function loadMatrixCredentials(env = process.env, accountId) {
29
30
  const normalizedAccountId = normalizeAccountId(accountId);
30
- const parsed = normalizeMatrixStoredCredentials(openMatrixCredentialsStore(env).lookup(matrixCredentialsStoreKey(accountId)), normalizedAccountId);
31
+ const stored = openMatrixCredentialsStore(env).lookup(matrixCredentialsStoreKey(accountId));
32
+ const parsed = normalizeMatrixStoredCredentials(stored, normalizedAccountId);
31
33
  if (!parsed || parsed.accountId !== normalizedAccountId) return null;
32
34
  const { accountId: _accountId, ...credentials } = parsed;
33
35
  return credentials;
@@ -1,6 +1,6 @@
1
1
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
2
2
  //#region extensions/matrix/src/matrix/credentials-write.runtime.ts
3
- const loadMatrixCredentialsRuntime = createLazyRuntimeModule(() => import("./credentials-BdAaWuiR.js"));
3
+ const loadMatrixCredentialsRuntime = createLazyRuntimeModule(() => import("./credentials-B2roKThT.mjs"));
4
4
  async function saveMatrixCredentials(...args) {
5
5
  return (await loadMatrixCredentialsRuntime()).saveMatrixCredentials(...args);
6
6
  }
@@ -1,13 +1,13 @@
1
- import { t as ensureMatrixCryptoRuntime } from "./deps-CcVJfvRM.js";
2
- import { n as LogService, r as noop } from "./logger-B_71hN6W.js";
3
- import { i as restoreIdbFromDisk, n as persistIdbToDisk } from "./idb-persistence-DfgW720p.js";
4
- import { n as isRepairableSecretStorageAccessError } from "./recovery-key-store-CognuDys.js";
1
+ import { t as ensureMatrixCryptoRuntime } from "./deps-mtxF2mHI.mjs";
2
+ import { n as LogService, r as noop } from "./logger-B3tfcB-m.mjs";
3
+ import { i as restoreIdbFromDisk, n as persistIdbToDisk } from "./idb-persistence-BiscLSq4.mjs";
4
+ import { n as isRepairableSecretStorageAccessError } from "./sdk-DoObvds0.mjs";
5
5
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
6
6
  import { formatErrorMessage, toStringifiedError } from "openclaw/plugin-sdk/error-runtime";
7
7
  import { resolveDateTimestampMs, resolveTimestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
8
- import { MatrixEventEvent } from "matrix-js-sdk/lib/matrix.js";
9
8
  import { IDBDatabase } from "fake-indexeddb";
10
9
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
10
+ import { MatrixEventEvent } from "matrix-js-sdk/lib/matrix.js";
11
11
  import { VerificationMethod } from "matrix-js-sdk/lib/types.js";
12
12
  import "fake-indexeddb/auto";
13
13
  import { CryptoEvent } from "matrix-js-sdk/lib/crypto-api/CryptoEvent.js";
@@ -331,7 +331,7 @@ var MatrixCryptoBootstrapper = class {
331
331
  };
332
332
  //#endregion
333
333
  //#region extensions/matrix/src/matrix/sdk/crypto-facade.ts
334
- const matrixCryptoNodeRuntimeLoader = createLazyRuntimeModule(() => import("./crypto-node.runtime-6Aj_ltHQ.js"));
334
+ const matrixCryptoNodeRuntimeLoader = createLazyRuntimeModule(() => import("./crypto-node.runtime-6Aj_ltHQ.mjs"));
335
335
  async function loadMatrixCryptoNodeRuntime() {
336
336
  try {
337
337
  return await matrixCryptoNodeRuntimeLoader();
@@ -450,7 +450,7 @@ const MATRIX_DECRYPT_RETRY_BASE_DELAY_MS = 1500;
450
450
  const MATRIX_DECRYPT_RETRY_MAX_DELAY_MS = 3e4;
451
451
  const MATRIX_DECRYPT_RETRY_MAX_ATTEMPTS = 8;
452
452
  const MATRIX_DECRYPT_DRAIN_TIMEOUT_MS = 5e3;
453
- const MATRIX_DECRYPT_EXHAUSTED_RETRY_TTL_MS = 60 * 6e4;
453
+ const MATRIX_DECRYPT_EXHAUSTED_RETRY_TTL_MS = 36e5;
454
454
  const MATRIX_DECRYPT_EXHAUSTED_RETRY_MAX_ENTRIES = 512;
455
455
  function resolveDecryptRetryKey(roomId, eventId) {
456
456
  if (!roomId || !eventId) return null;
@@ -770,7 +770,7 @@ function isMatrixVerificationPhase(value) {
770
770
  return typeof value === "number" && MATRIX_VERIFICATION_PHASES.has(value);
771
771
  }
772
772
  const MAX_TRACKED_VERIFICATION_SESSIONS = 256;
773
- const TERMINAL_SESSION_RETENTION_MS = 1440 * 60 * 1e3;
773
+ const TERMINAL_SESSION_RETENTION_MS = 864e5;
774
774
  const SAS_AUTO_CONFIRM_DELAY_MS = 3e4;
775
775
  var MatrixVerificationManager = class {
776
776
  constructor(opts = {}) {
@@ -10,7 +10,7 @@ const REQUIRED_MATRIX_PACKAGES = [
10
10
  "@matrix-org/matrix-sdk-crypto-wasm"
11
11
  ];
12
12
  const MIN_MATRIX_CRYPTO_NATIVE_BINDING_BYTES = 1e6;
13
- const MATRIX_COMMAND_OUTPUT_TAIL_BYTES = 64 * 1024;
13
+ const MATRIX_COMMAND_OUTPUT_TAIL_BYTES = 65536;
14
14
  function resolveMissingMatrixPackages(resolveFn) {
15
15
  const resolve = resolveFn ?? defaultResolveFn;
16
16
  return REQUIRED_MATRIX_PACKAGES.filter((pkg) => {
@@ -1,4 +1,4 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
2
  //#region extensions/matrix/src/matrix/device-health.ts
3
3
  var device_health_exports = /* @__PURE__ */ __exportAll({
4
4
  isOpenClawManagedMatrixDevice: () => isOpenClawManagedMatrixDevice,