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

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 (69) hide show
  1. package/dist/{account-selection-Bz00QTmQ.js → account-selection-kqquRzCf.js} +5 -5
  2. package/dist/api.js +6 -6
  3. package/dist/{approval-handler.runtime-BQZdg_dJ.js → approval-handler.runtime-BEa98wwG.js} +4 -4
  4. package/dist/{approval-ids-De4IhOSN.js → approval-ids-Dfn7oQAm.js} +1 -1
  5. package/dist/{approval-reaction-auth-BLJKPLku.js → approval-reaction-auth-kXkCJBGi.js} +2 -2
  6. package/dist/auth-presence.js +13 -21
  7. package/dist/{channel-B1woOUgk.js → channel-j331Xd7b.js} +13 -13
  8. package/dist/channel-plugin-api.js +1 -1
  9. package/dist/{channel.runtime-BvJm9z0w.js → channel.runtime-BIwlVfQw.js} +15 -16
  10. package/dist/{cli-CLWOkMvw.js → cli-0EcKfqFw.js} +18 -11
  11. package/dist/{cli-metadata-9Naf7in0.js → cli-metadata-Xq1Xb15R.js} +1 -1
  12. package/dist/cli-metadata.js +1 -1
  13. package/dist/{client-BUai6s29.js → client-BtG4quUl.js} +2 -2
  14. package/dist/{client-CPuYbNL8.js → client-CA0PULls.js} +2 -2
  15. package/dist/{client-bootstrap-CNVF73sF.js → client-bootstrap-Dk5EAn3n.js} +1 -1
  16. package/dist/{config-schema-BTSatSY3.js → config-schema-B5GRV8wL.js} +1 -1
  17. package/dist/contract-api.js +2 -2
  18. package/dist/{create-client-85ttAWDP.js → create-client-WQExaby_.js} +4 -4
  19. package/dist/credentials-W2EmwRhu.js +65 -0
  20. package/dist/credentials-read-DVmFCm7X.js +77 -0
  21. package/dist/{credentials-write.runtime-BDtpqvj0.js → credentials-write.runtime-Be9zNSUw.js} +1 -1
  22. package/dist/{crypto-runtime-DoEB5RpM.js → crypto-runtime-CAff-n15.js} +3 -3
  23. package/dist/{directory-live-0TyS9xep.js → directory-live-DiC-0XBC.js} +3 -3
  24. package/dist/{doctor-BGTs609f.js → doctor-DwUVm5Lw.js} +1 -1
  25. package/dist/{doctor-contract-D2qTLe-C.js → doctor-contract-BA2Y6Crx.js} +1 -1
  26. package/dist/doctor-contract-api.js +116 -10
  27. package/dist/{draft-stream-GOdPZMBm.js → draft-stream-CTLKtJJ0.js} +1 -1
  28. package/dist/{encryption-guidance-BFfgq7c7.js → encryption-guidance-CbEFe38F.js} +1 -1
  29. package/dist/{file-sync-store-CUE9WwD2.js → file-sync-store-CPkgnSXp.js} +21 -4
  30. package/dist/helper-api.js +2 -2
  31. package/dist/{idb-persistence-BiHEEzD7.js → idb-persistence-Dyy6ipgU.js} +2 -2
  32. package/dist/index.js +1 -1
  33. package/dist/{media-text-DPCtdFjk.js → media-text-BMXEXb1j.js} +1 -1
  34. package/dist/{messages-DCRbGLMh.js → messages-3UBHfZrN.js} +3 -3
  35. package/dist/{monitor-C5EOF9et.js → monitor-BtUIds8T.js} +87 -89
  36. package/dist/plugin-entry.handlers.runtime.js +1 -1
  37. package/dist/probe.runtime-sBV-Govx.js +3 -0
  38. package/dist/{profile-update-DompcDyu.js → profile-update-Bh2XtJwN.js} +2 -2
  39. package/dist/{reaction-events-QUgxkQKQ.js → reaction-events-BwAKtUyQ.js} +2 -2
  40. package/dist/record-shared-CWWx6fvI.js +2 -0
  41. package/dist/{recovery-key-store-B2RglalK.js → recovery-key-store-CW6eePfp.js} +1 -1
  42. package/dist/{resolve-targets-Cx1VVArA.js → resolve-targets-DVoj-YxB.js} +1 -1
  43. package/dist/{resolver.runtime-PPrv3ZHu.js → resolver.runtime-CC0VVsAt.js} +1 -1
  44. package/dist/runtime-api.js +3 -3
  45. package/dist/{sdk-1TXuSiXZ.js → sdk-CIDZXWpZ.js} +5 -5
  46. package/dist/{secret-contract-OZoQf0kI.js → secret-contract-M3hRmGO-.js} +21 -5
  47. package/dist/secret-contract-api.js +1 -1
  48. package/dist/{send-yre1krm8.js → send-BJbrdmNm.js} +3 -2
  49. package/dist/session-binding-contract-api.js +1 -1
  50. package/dist/{setup-bootstrap-DXVRCd4G.js → setup-bootstrap-DGPOOdz-.js} +2 -2
  51. package/dist/{setup-core-CYQRY2oG.js → setup-core-XCdAx1nY.js} +3 -3
  52. package/dist/setup-plugin-api.js +3 -3
  53. package/dist/{setup-surface-BjvRQzK6.js → setup-surface-CzUiTe_k.js} +6 -6
  54. package/dist/{shared-BfW4lxGu.js → shared-DquM1oz6.js} +6 -6
  55. package/dist/{startup-verification-DSiyDKM5.js → startup-verification-CA00kebL.js} +2 -2
  56. package/dist/{storage-DD-EnNJE.js → storage-CzHxeF5E.js} +8 -8
  57. package/dist/{thread-bindings-U5ZroBeZ.js → thread-bindings-Cw194yEn.js} +3 -3
  58. package/dist/{tool-actions.runtime-BlfTr9b0.js → tool-actions.runtime-C0jgWYhX.js} +7 -7
  59. package/dist/{verification-CGnI9k1O.js → verification-DjxyWTNP.js} +2 -2
  60. package/npm-shrinkwrap.json +3 -3
  61. package/package.json +4 -4
  62. package/dist/async-lock-BcLS4KOc.js +0 -19
  63. package/dist/credentials-CncWUieb.js +0 -56
  64. package/dist/credentials-read-CwNJrmwu.js +0 -112
  65. package/dist/probe.runtime-BBvciVfo.js +0 -3
  66. package/dist/record-shared-CvzjvHRn.js +0 -2
  67. package/dist/{deps-DDbghaZH.js → deps-CcVJfvRM.js} +1 -1
  68. package/dist/{http-client-Jw5_bwQo.js → http-client-BmrgOZTL.js} +1 -1
  69. package/dist/{storage-paths-B4_I9iqO.js → storage-paths-gUmSydsW.js} +1 -1
@@ -1,5 +1,5 @@
1
1
  import { n as listMatrixEnvAccountIds, t as getMatrixScopedEnvVarNames } from "./env-vars-B0NxQnPk.js";
2
- import { t as isRecord } from "./record-shared-CvzjvHRn.js";
2
+ import { t as isRecord$1 } from "./record-shared-CWWx6fvI.js";
3
3
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import { listCombinedAccountIds, listConfiguredAccountIds, resolveListedDefaultAccountId, resolveNormalizedAccountEntry } from "openclaw/plugin-sdk/account-core";
5
5
  import { DEFAULT_ACCOUNT_ID, normalizeAccountId, normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-id";
@@ -102,20 +102,20 @@ function hasConfiguredDefaultMatrixAccountSource(params) {
102
102
  });
103
103
  }
104
104
  function resolveMatrixChannelConfig(cfg) {
105
- return isRecord(cfg.channels?.matrix) ? cfg.channels.matrix : null;
105
+ return isRecord$1(cfg.channels?.matrix) ? cfg.channels.matrix : null;
106
106
  }
107
107
  function findMatrixAccountEntry(cfg, accountId) {
108
108
  const channel = resolveMatrixChannelConfig(cfg);
109
109
  if (!channel) return null;
110
- const accounts = isRecord(channel.accounts) ? channel.accounts : null;
110
+ const accounts = isRecord$1(channel.accounts) ? channel.accounts : null;
111
111
  if (!accounts) return null;
112
112
  const entry = resolveNormalizedAccountEntry(accounts, accountId, normalizeAccountId);
113
- return isRecord(entry) ? entry : null;
113
+ return isRecord$1(entry) ? entry : null;
114
114
  }
115
115
  function resolveConfiguredMatrixAccountIds(cfg, env = process.env) {
116
116
  const channel = resolveMatrixChannelConfig(cfg);
117
117
  const configuredAccountIds = listConfiguredAccountIds({
118
- accounts: channel && isRecord(channel.accounts) ? channel.accounts : void 0,
118
+ accounts: channel && isRecord$1(channel.accounts) ? channel.accounts : void 0,
119
119
  normalizeAccountId
120
120
  });
121
121
  if (hasConfiguredDefaultMatrixAccountSource({
package/dist/api.js CHANGED
@@ -1,11 +1,11 @@
1
- import { a as resolveMatrixDefaultOrOnlyAccountId, i as resolveMatrixChannelConfig, n as requiresExplicitMatrixDefaultAccount, r as resolveConfiguredMatrixAccountIds, t as findMatrixAccountEntry } from "./account-selection-Bz00QTmQ.js";
1
+ import { a as resolveMatrixDefaultOrOnlyAccountId, i as resolveMatrixChannelConfig, n as requiresExplicitMatrixDefaultAccount, r as resolveConfiguredMatrixAccountIds, t as findMatrixAccountEntry } from "./account-selection-kqquRzCf.js";
2
2
  import { n as listMatrixEnvAccountIds, r as resolveMatrixEnvAccountToken, t as getMatrixScopedEnvVarNames } from "./env-vars-B0NxQnPk.js";
3
- import { a as resolveMatrixCredentialsPath, i as resolveMatrixCredentialsFilename, n as resolveMatrixAccountStorageRoot, o as resolveMatrixHomeserverKey, r as resolveMatrixCredentialsDir, s as sanitizeMatrixPathSegment, t as hashMatrixAccessToken } from "./storage-paths-B4_I9iqO.js";
4
- import { n as matrixSetupAdapter, t as createMatrixSetupWizardProxy } from "./setup-core-CYQRY2oG.js";
5
- import { t as matrixPlugin } from "./channel-B1woOUgk.js";
3
+ import { a as resolveMatrixCredentialsPath, i as resolveMatrixCredentialsFilename, n as resolveMatrixAccountStorageRoot, o as resolveMatrixHomeserverKey, r as resolveMatrixCredentialsDir, s as sanitizeMatrixPathSegment, t as hashMatrixAccessToken } from "./storage-paths-gUmSydsW.js";
4
+ import { n as matrixSetupAdapter, t as createMatrixSetupWizardProxy } from "./setup-core-XCdAx1nY.js";
5
+ import { t as matrixPlugin } from "./channel-j331Xd7b.js";
6
6
  import { d as setMatrixThreadBindingIdleTimeoutBySessionKey, n as getMatrixThreadBindingManager, p as setMatrixThreadBindingMaxAgeBySessionKey, s as resetMatrixThreadBindingsForTests } from "./thread-bindings-shared-CKnY4LSd.js";
7
- import { n as matrixOnboardingAdapter } from "./setup-surface-BjvRQzK6.js";
8
- import { t as createMatrixThreadBindingManager } from "./thread-bindings-U5ZroBeZ.js";
7
+ import { n as matrixOnboardingAdapter } from "./setup-surface-CzUiTe_k.js";
8
+ import { t as createMatrixThreadBindingManager } from "./thread-bindings-Cw194yEn.js";
9
9
  //#region extensions/matrix/api.ts
10
10
  const matrixSessionBindingAdapterChannels = ["matrix"];
11
11
  //#endregion
@@ -1,9 +1,9 @@
1
- import { g as resolveMatrixAccount } from "./setup-core-CYQRY2oG.js";
2
- import { _ as shouldHandleMatrixApprovalRequest, g as isMatrixAnyApprovalClientEnabled } from "./channel-B1woOUgk.js";
1
+ import { g as resolveMatrixAccount } from "./setup-core-XCdAx1nY.js";
2
+ import { _ as shouldHandleMatrixApprovalRequest, g as isMatrixAnyApprovalClientEnabled } from "./channel-j331Xd7b.js";
3
3
  import { a as resolveMatrixTargetIdentity } from "./target-ids-B-5aQxwn.js";
4
- import { a as sendMessageMatrix, i as reactMatrixMessage, p as repairMatrixDirectRooms, s as sendSingleTextMessageMatrix } from "./send-yre1krm8.js";
4
+ import { a as sendMessageMatrix, i as reactMatrixMessage, p as repairMatrixDirectRooms, s as sendSingleTextMessageMatrix } from "./send-BJbrdmNm.js";
5
5
  import { a as unregisterMatrixApprovalReactionTarget, n as listMatrixApprovalReactionBindings, r as registerMatrixApprovalReactionTarget, t as buildMatrixApprovalReactionHint } from "./approval-reactions-D-BxBK_L.js";
6
- import { n as editMatrixMessage, t as deleteMatrixMessage } from "./messages-DCRbGLMh.js";
6
+ import { n as editMatrixMessage, t as deleteMatrixMessage } from "./messages-3UBHfZrN.js";
7
7
  import { listMessageReceiptPlatformIds, resolveMessageReceiptPrimaryId } from "openclaw/plugin-sdk/channel-outbound";
8
8
  import { normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
9
9
  import { buildChannelApprovalNativeTargetKey } from "openclaw/plugin-sdk/approval-native-runtime";
@@ -1,4 +1,4 @@
1
- import { a as normalizeMatrixUserId } from "./config-schema-BTSatSY3.js";
1
+ import { a as normalizeMatrixUserId } from "./config-schema-B5GRV8wL.js";
2
2
  //#region extensions/matrix/src/approval-ids.ts
3
3
  function normalizeMatrixApproverId(value) {
4
4
  return normalizeMatrixUserId(String(value)) || void 0;
@@ -1,5 +1,5 @@
1
- import { g as resolveMatrixAccount } from "./setup-core-CYQRY2oG.js";
2
- import { t as normalizeMatrixApproverId } from "./approval-ids-De4IhOSN.js";
1
+ import { g as resolveMatrixAccount } from "./setup-core-XCdAx1nY.js";
2
+ import { t as normalizeMatrixApproverId } from "./approval-ids-Dfn7oQAm.js";
3
3
  import { resolveApprovalApprovers } from "openclaw/plugin-sdk/approval-auth-runtime";
4
4
  //#region extensions/matrix/src/approval-reaction-auth.ts
5
5
  function normalizeMatrixExecApproverId(value) {
@@ -1,26 +1,18 @@
1
- import { i as resolveMatrixCredentialsFilename, r as resolveMatrixCredentialsDir } from "./storage-paths-B4_I9iqO.js";
2
- import fs from "node:fs";
3
- import os from "node:os";
4
- import path from "node:path";
5
- import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
1
+ import { c as normalizeMatrixStoredCredentials, t as MATRIX_CREDENTIALS_NAMESPACE } from "./credentials-read-DVmFCm7X.js";
2
+ import { createPluginStateSyncKeyedStore } from "openclaw/plugin-sdk/runtime-doctor";
6
3
  //#region extensions/matrix/auth-presence.ts
7
- function listMatrixCredentialPaths(_cfg, env = process.env) {
8
- const credentialsDir = resolveMatrixCredentialsDir(resolveStateDir(env, os.homedir));
9
- const paths = /* @__PURE__ */ new Set([resolveMatrixCredentialsFilename(), resolveMatrixCredentialsFilename("default")]);
10
- try {
11
- const entries = fs.readdirSync(credentialsDir, { withFileTypes: true });
12
- for (const entry of entries) if (entry.isFile() && /^credentials(?:-[a-z0-9._-]+)?\.json$/i.test(entry.name)) paths.add(entry.name);
13
- } catch {}
14
- return [...paths].map((filename) => path.join(credentialsDir, filename));
15
- }
16
4
  function hasAnyMatrixAuth(params, env = process.env) {
17
- return listMatrixCredentialPaths(params && typeof params === "object" && "cfg" in params ? params.cfg : params, params && typeof params === "object" && "cfg" in params ? params.env ?? env : env).some((filePath) => {
18
- try {
19
- return fs.existsSync(filePath);
20
- } catch {
21
- return false;
22
- }
23
- });
5
+ const resolvedEnv = params && typeof params === "object" && "cfg" in params ? params.env ?? env : env;
6
+ try {
7
+ return createPluginStateSyncKeyedStore("matrix", {
8
+ namespace: MATRIX_CREDENTIALS_NAMESPACE,
9
+ maxEntries: 256,
10
+ overflowPolicy: "reject-new",
11
+ env: resolvedEnv
12
+ }).entries().some((entry) => normalizeMatrixStoredCredentials(entry.value) !== null);
13
+ } catch {
14
+ return false;
15
+ }
24
16
  }
25
17
  //#endregion
26
18
  export { hasAnyMatrixAuth };
@@ -1,13 +1,13 @@
1
- import { n as requiresExplicitMatrixDefaultAccount } from "./account-selection-Bz00QTmQ.js";
1
+ import { n as requiresExplicitMatrixDefaultAccount } from "./account-selection-kqquRzCf.js";
2
2
  import { a as resolveMatrixAccountConfig } from "./account-config-BZWN9tGS.js";
3
- import { d as resolveSingleAccountPromotionTarget, f as singleAccountKeysToMove, g as resolveMatrixAccount, h as resolveDefaultMatrixAccountId, n as matrixSetupAdapter, p as listMatrixAccountIds, t as createMatrixSetupWizardProxy, u as namedAccountPromotionKeys } from "./setup-core-CYQRY2oG.js";
4
- import { a as normalizeMatrixUserId, n as DEFAULT_ACCOUNT_ID$2, r as matrixConfigAdapter, t as MatrixChannelConfigSchema } from "./config-schema-BTSatSY3.js";
5
- import { t as normalizeMatrixApproverId } from "./approval-ids-De4IhOSN.js";
3
+ import { d as resolveSingleAccountPromotionTarget, f as singleAccountKeysToMove, g as resolveMatrixAccount, h as resolveDefaultMatrixAccountId, n as matrixSetupAdapter, p as listMatrixAccountIds, t as createMatrixSetupWizardProxy, u as namedAccountPromotionKeys } from "./setup-core-XCdAx1nY.js";
4
+ import { a as normalizeMatrixUserId, n as DEFAULT_ACCOUNT_ID$2, r as matrixConfigAdapter, t as MatrixChannelConfigSchema } from "./config-schema-B5GRV8wL.js";
5
+ import { t as normalizeMatrixApproverId } from "./approval-ids-Dfn7oQAm.js";
6
6
  import { a as resolveMatrixTargetIdentity, i as resolveMatrixDirectUserId, n as normalizeMatrixMessagingTarget, r as normalizeMatrixResolvableTarget, t as isMatrixQualifiedUserId } from "./target-ids-B-5aQxwn.js";
7
7
  import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
8
- import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-D2qTLe-C.js";
8
+ import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-BA2Y6Crx.js";
9
9
  import { d as setMatrixThreadBindingIdleTimeoutBySessionKey, p as setMatrixThreadBindingMaxAgeBySessionKey } from "./thread-bindings-shared-CKnY4LSd.js";
10
- import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-OZoQf0kI.js";
10
+ import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-M3hRmGO-.js";
11
11
  import { n as resolveMatrixInboundConversation, t as defaultTopLevelPlacement } from "./thread-binding-api-DRbBZlhS.js";
12
12
  import { createLazyRuntimeModule, createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
13
13
  import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
@@ -127,7 +127,7 @@ const matrixMessageActions = {
127
127
  return extractToolSend(args, "sendMessage");
128
128
  },
129
129
  handleAction: async (ctx) => {
130
- const { handleMatrixAction } = await import("./tool-actions.runtime-BlfTr9b0.js");
130
+ const { handleMatrixAction } = await import("./tool-actions.runtime-C0jgWYhX.js");
131
131
  const { action, params, cfg, accountId, mediaLocalRoots } = ctx;
132
132
  const dispatch = async (actionParams) => await handleMatrixAction({
133
133
  ...actionParams,
@@ -601,7 +601,7 @@ const matrixNativeApprovalCapability = createApproverRestrictedNativeApprovalCap
601
601
  approvalKind,
602
602
  request
603
603
  }),
604
- load: async () => (await import("./approval-handler.runtime-BQZdg_dJ.js")).matrixApprovalNativeRuntime
604
+ load: async () => (await import("./approval-handler.runtime-BEa98wwG.js")).matrixApprovalNativeRuntime
605
605
  })
606
606
  });
607
607
  const splitMatrixApprovalCapability = splitChannelApprovalCapability(matrixNativeApprovalCapability);
@@ -780,7 +780,7 @@ function resolveMatrixGroupToolPolicy(params) {
780
780
  }
781
781
  //#endregion
782
782
  //#region extensions/matrix/src/resolver.ts
783
- const loadMatrixChannelRuntime$1 = createLazyRuntimeNamedExport(() => import("./resolver.runtime-PPrv3ZHu.js"), "matrixResolverRuntime");
783
+ const loadMatrixChannelRuntime$1 = createLazyRuntimeNamedExport(() => import("./resolver.runtime-CC0VVsAt.js"), "matrixResolverRuntime");
784
784
  const matrixResolverAdapter = { resolveTargets: async ({ cfg, accountId, inputs, kind, runtime }) => (await loadMatrixChannelRuntime$1()).resolveMatrixTargets({
785
785
  cfg,
786
786
  accountId,
@@ -906,9 +906,9 @@ function resolveMatrixOutboundSessionRoute(params) {
906
906
  //#endregion
907
907
  //#region extensions/matrix/src/channel.ts
908
908
  let matrixStartupLock = Promise.resolve();
909
- const loadMatrixSetupWizard = createLazyRuntimeNamedExport(() => import("./setup-surface-BjvRQzK6.js").then((n) => n.t), "matrixSetupWizard");
910
- const loadMatrixChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-BvJm9z0w.js"), "matrixChannelRuntime");
911
- const loadMatrixDoctorModule = createLazyRuntimeModule(() => import("./doctor-BGTs609f.js"));
909
+ const loadMatrixSetupWizard = createLazyRuntimeNamedExport(() => import("./setup-surface-CzUiTe_k.js").then((n) => n.t), "matrixSetupWizard");
910
+ const loadMatrixChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-BIwlVfQw.js"), "matrixChannelRuntime");
911
+ const loadMatrixDoctorModule = createLazyRuntimeModule(() => import("./doctor-DwUVm5Lw.js"));
912
912
  const meta = {
913
913
  id: "matrix",
914
914
  label: "Matrix",
@@ -1281,7 +1281,7 @@ const matrixPlugin = createChatChannelPlugin({
1281
1281
  await previousLock;
1282
1282
  let monitorMatrixProvider;
1283
1283
  try {
1284
- monitorMatrixProvider = (await import("./monitor-C5EOF9et.js")).monitorMatrixProvider;
1284
+ monitorMatrixProvider = (await import("./monitor-BtUIds8T.js")).monitorMatrixProvider;
1285
1285
  } finally {
1286
1286
  releaseLock();
1287
1287
  }
@@ -1,2 +1,2 @@
1
- import { t as matrixPlugin } from "./channel-B1woOUgk.js";
1
+ import { t as matrixPlugin } from "./channel-j331Xd7b.js";
2
2
  export { matrixPlugin };
@@ -1,18 +1,18 @@
1
- import { a as sendMessageMatrix, c as sendTypingMatrix, o as sendPollMatrix } from "./send-yre1krm8.js";
1
+ import { a as sendMessageMatrix, c as sendTypingMatrix, o as sendPollMatrix } from "./send-BJbrdmNm.js";
2
2
  import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
3
- import { f as resolveMatrixAuth } from "./shared-BfW4lxGu.js";
4
- import "./client-CPuYbNL8.js";
5
- import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-0TyS9xep.js";
3
+ import { f as resolveMatrixAuth } from "./shared-DquM1oz6.js";
4
+ import "./client-CA0PULls.js";
5
+ import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-DiC-0XBC.js";
6
6
  import { p as resolveOutboundSendDep, r as chunkTextForOutbound } from "./runtime-api-D1xI_cvh.js";
7
- import { t as resolveMatrixTargets } from "./resolve-targets-Cx1VVArA.js";
7
+ import { t as resolveMatrixTargets } from "./resolve-targets-DVoj-YxB.js";
8
8
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
9
9
  import { createReplyToFanout } from "openclaw/plugin-sdk/channel-outbound";
10
10
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
11
11
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
12
12
  import { renderMessagePresentationFallbackText } from "openclaw/plugin-sdk/interactive-runtime";
13
- import { resolvePayloadMediaUrls } from "openclaw/plugin-sdk/reply-payload";
13
+ import { resolvePayloadMediaUrls, sendPayloadMediaSequence } from "openclaw/plugin-sdk/reply-payload";
14
14
  //#region extensions/matrix/src/matrix/probe.ts
15
- const loadMatrixProbeRuntimeDeps = createLazyRuntimeModule(() => import("./probe.runtime-BBvciVfo.js").then((runtimeModule) => ({ createMatrixClient: runtimeModule.createMatrixClient })));
15
+ const loadMatrixProbeRuntimeDeps = createLazyRuntimeModule(() => import("./probe.runtime-sBV-Govx.js").then((runtimeModule) => ({ createMatrixClient: runtimeModule.createMatrixClient })));
16
16
  async function probeMatrix(params) {
17
17
  const started = Date.now();
18
18
  const result = {
@@ -160,12 +160,12 @@ const matrixChannelRuntime = {
160
160
  const urls = resolvePayloadMediaUrls(payload);
161
161
  const payloadText = resolveMatrixPayloadText(payload);
162
162
  if (urls.length > 0) {
163
- let lastResult;
164
- for (let i = 0; i < urls.length; i++) {
165
- const isFirst = i === 0;
166
- lastResult = await send(to, isFirst ? payloadText : "", {
163
+ const lastResult = await sendPayloadMediaSequence({
164
+ text: payloadText,
165
+ mediaUrls: urls,
166
+ send: async ({ text, mediaUrl, isFirst }) => await send(to, text, {
167
167
  cfg,
168
- mediaUrl: urls[i],
168
+ mediaUrl,
169
169
  mediaAccess,
170
170
  mediaLocalRoots,
171
171
  mediaReadFile,
@@ -175,9 +175,9 @@ const matrixChannelRuntime = {
175
175
  audioAsVoice: payload.audioAsVoice ?? audioAsVoice,
176
176
  extraContent: isFirst ? resolveMatrixExtraContent(payload) : void 0,
177
177
  onDeliveryResult: resolveMatrixDeliveryProgress(onDeliveryResult)
178
- });
179
- }
180
- return {
178
+ })
179
+ });
180
+ if (lastResult !== void 0) return {
181
181
  channel: "matrix",
182
182
  messageId: lastResult.messageId,
183
183
  roomId: lastResult.roomId
@@ -185,7 +185,6 @@ const matrixChannelRuntime = {
185
185
  }
186
186
  const result = await send(to, payloadText, {
187
187
  cfg,
188
- mediaUrl: payload.mediaUrl,
189
188
  mediaAccess,
190
189
  mediaLocalRoots,
191
190
  mediaReadFile,
@@ -1,14 +1,14 @@
1
1
  import { a as resolveMatrixAccountConfig } from "./account-config-BZWN9tGS.js";
2
2
  import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
3
- import { c as resolveMatrixConfigPath, g as resolveMatrixAccount, l as updateMatrixAccountConfig, n as matrixSetupAdapter } from "./setup-core-CYQRY2oG.js";
3
+ import { c as resolveMatrixConfigPath, g as resolveMatrixAccount, l as updateMatrixAccountConfig, n as matrixSetupAdapter } from "./setup-core-XCdAx1nY.js";
4
4
  import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
5
- import { n as withResolvedActionClient } from "./client-BUai6s29.js";
6
- import { p as resolveMatrixAuthContext } from "./shared-BfW4lxGu.js";
7
- import "./client-CPuYbNL8.js";
5
+ import { n as withResolvedActionClient } from "./client-BtG4quUl.js";
6
+ import { p as resolveMatrixAuthContext } from "./shared-DquM1oz6.js";
7
+ import "./client-CA0PULls.js";
8
8
  import { a as formatZonedTimestamp } from "./runtime-api-D1xI_cvh.js";
9
9
  import { isOpenClawManagedMatrixDevice, summarizeMatrixDeviceHealth } from "./device-health-D4LBxuPq.js";
10
- import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update-DompcDyu.js";
11
- 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-CGnI9k1O.js";
10
+ import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update-Bh2XtJwN.js";
11
+ 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-DjxyWTNP.js";
12
12
  import { t as resolveMatrixRoomKeyBackupIssue } from "./backup-health-Dm_YMVFT.js";
13
13
  import { setMatrixSdkConsoleLogging, setMatrixSdkLogMode } from "./logging-QH-48Gr6.js";
14
14
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
@@ -36,8 +36,9 @@ async function pruneMatrixStaleGatewayDevices(opts = {}) {
36
36
  //#endregion
37
37
  //#region extensions/matrix/src/cli.ts
38
38
  let matrixCliExitScheduled = false;
39
- const loadMatrixActionClientModule = createLazyRuntimeModule(() => import("./client-BUai6s29.js").then((n) => n.t));
40
- const loadMatrixDirectManagementModule = createLazyRuntimeModule(() => import("./send-yre1krm8.js").then((n) => n.d));
39
+ const MATRIX_CLI_RECOVERY_KEY_STDIN_MAX_BYTES = 1024 * 1024;
40
+ const loadMatrixActionClientModule = createLazyRuntimeModule(() => import("./client-BtG4quUl.js").then((n) => n.t));
41
+ const loadMatrixDirectManagementModule = createLazyRuntimeModule(() => import("./send-BJbrdmNm.js").then((n) => n.d));
41
42
  function scheduleMatrixCliExit() {
42
43
  if (matrixCliExitScheduled || process.env.VITEST) return;
43
44
  matrixCliExitScheduled = true;
@@ -54,8 +55,14 @@ function markCliFailure() {
54
55
  }
55
56
  async function readMatrixCliRecoveryKeyFromStdin() {
56
57
  const chunks = [];
57
- for await (const chunk of process.stdin) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk)));
58
- const recoveryKey = Buffer.concat(chunks).toString("utf8").trim();
58
+ let totalBytes = 0;
59
+ for await (const chunk of process.stdin) {
60
+ const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk));
61
+ totalBytes += buffer.byteLength;
62
+ if (totalBytes > MATRIX_CLI_RECOVERY_KEY_STDIN_MAX_BYTES) throw new Error(`Matrix recovery key stdin exceeds ${MATRIX_CLI_RECOVERY_KEY_STDIN_MAX_BYTES} bytes.`);
63
+ chunks.push(buffer);
64
+ }
65
+ const recoveryKey = Buffer.concat(chunks, totalBytes).toString("utf8").trim();
59
66
  if (!recoveryKey) throw new Error("Matrix recovery key was requested from stdin, but stdin was empty.");
60
67
  return recoveryKey;
61
68
  }
@@ -205,7 +212,7 @@ async function addMatrixAccount(params) {
205
212
  backupVersion: null
206
213
  };
207
214
  if (accountConfig.encryption === true) {
208
- const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-DXVRCd4G.js");
215
+ const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-DGPOOdz-.js");
209
216
  verificationBootstrap = await maybeBootstrapNewEncryptedMatrixAccount({
210
217
  previousCfg: cfg,
211
218
  cfg: updated,
@@ -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-CLWOkMvw.js");
5
+ const { registerMatrixCli } = await import("./cli-0EcKfqFw.js");
6
6
  registerMatrixCli({ program });
7
7
  }, { descriptors: [{
8
8
  name: "matrix",
@@ -1,2 +1,2 @@
1
- import { n as registerMatrixCliMetadata, t as cli_metadata_default } from "./cli-metadata-9Naf7in0.js";
1
+ import { n as registerMatrixCliMetadata, t as cli_metadata_default } from "./cli-metadata-Xq1Xb15R.js";
2
2
  export { cli_metadata_default as default, registerMatrixCliMetadata };
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { u as resolveMatrixRoomId } from "./send-yre1krm8.js";
3
- import { n as withResolvedRuntimeMatrixClient } from "./client-bootstrap-CNVF73sF.js";
2
+ import { u as resolveMatrixRoomId } from "./send-BJbrdmNm.js";
3
+ import { n as withResolvedRuntimeMatrixClient } from "./client-bootstrap-Dk5EAn3n.js";
4
4
  //#region extensions/matrix/src/matrix/actions/client.ts
5
5
  var client_exports = /* @__PURE__ */ __exportAll({
6
6
  withResolvedActionClient: () => withResolvedActionClient,
@@ -3,8 +3,8 @@ import { t as getMatrixScopedEnvVarNames } from "./env-vars-B0NxQnPk.js";
3
3
  import { i as resolveScopedMatrixEnvConfig, r as resolveMatrixEnvAuthReadiness, t as hasReadyMatrixEnvAuth } from "./env-auth-CQsYbz-p.js";
4
4
  import { n as validateMatrixHomeserverUrl, t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
5
5
  import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
6
- import { d as backfillMatrixAuthDeviceIdAfterStartup, f as resolveMatrixAuth, i as resolveSharedMatrixClient, m as resolveMatrixConfigForAccount, n as releaseSharedClientInstance, o as stopSharedClientForAccount, p as resolveMatrixAuthContext, r as removeSharedClientInstance, s as stopSharedClientInstance, t as acquireSharedMatrixClient } from "./shared-BfW4lxGu.js";
7
- import { t as createMatrixClient } from "./create-client-85ttAWDP.js";
6
+ import { d as backfillMatrixAuthDeviceIdAfterStartup, f as resolveMatrixAuth, i as resolveSharedMatrixClient, m as resolveMatrixConfigForAccount, n as releaseSharedClientInstance, o as stopSharedClientForAccount, p as resolveMatrixAuthContext, r as removeSharedClientInstance, s as stopSharedClientInstance, t as acquireSharedMatrixClient } from "./shared-DquM1oz6.js";
7
+ import { t as createMatrixClient } from "./create-client-WQExaby_.js";
8
8
  //#region extensions/matrix/src/matrix/client.ts
9
9
  var client_exports = /* @__PURE__ */ __exportAll({
10
10
  acquireSharedMatrixClient: () => acquireSharedMatrixClient,
@@ -8,7 +8,7 @@ var client_bootstrap_exports = /* @__PURE__ */ __exportAll({
8
8
  resolveRuntimeMatrixClientWithReadiness: () => resolveRuntimeMatrixClientWithReadiness,
9
9
  withResolvedRuntimeMatrixClient: () => withResolvedRuntimeMatrixClient
10
10
  });
11
- const loadMatrixSharedClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./client-CPuYbNL8.js").then((n) => n.t), import("./shared-BfW4lxGu.js").then((n) => n.a)]).then(([clientModule, sharedModule]) => ({
11
+ const loadMatrixSharedClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./client-CA0PULls.js").then((n) => n.t), import("./shared-DquM1oz6.js").then((n) => n.a)]).then(([clientModule, sharedModule]) => ({
12
12
  acquireSharedMatrixClient: clientModule.acquireSharedMatrixClient,
13
13
  resolveMatrixAuthContext: clientModule.resolveMatrixAuthContext,
14
14
  releaseSharedClientInstance: sharedModule.releaseSharedClientInstance
@@ -1,5 +1,5 @@
1
1
  import { a as resolveMatrixAccountConfig } from "./account-config-BZWN9tGS.js";
2
- import { g as resolveMatrixAccount, h as resolveDefaultMatrixAccountId, p as listMatrixAccountIds } from "./setup-core-CYQRY2oG.js";
2
+ import { g as resolveMatrixAccount, h as resolveDefaultMatrixAccountId, p as listMatrixAccountIds } from "./setup-core-XCdAx1nY.js";
3
3
  import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
4
4
  import { createChannelConfigUiHints } from "openclaw/plugin-sdk/channel-core";
5
5
  import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -1,3 +1,3 @@
1
- import { d as resolveSingleAccountPromotionTarget, f as singleAccountKeysToMove, n as matrixSetupAdapter, u as namedAccountPromotionKeys } from "./setup-core-CYQRY2oG.js";
2
- import { n as matrixOnboardingAdapter } from "./setup-surface-BjvRQzK6.js";
1
+ import { d as resolveSingleAccountPromotionTarget, f as singleAccountKeysToMove, n as matrixSetupAdapter, u as namedAccountPromotionKeys } from "./setup-core-XCdAx1nY.js";
2
+ import { n as matrixOnboardingAdapter } from "./setup-surface-CzUiTe_k.js";
3
3
  export { matrixSetupAdapter, matrixOnboardingAdapter as matrixSetupWizard, namedAccountPromotionKeys, resolveSingleAccountPromotionTarget, singleAccountKeysToMove };
@@ -1,14 +1,14 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
2
  import { t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
3
- import { d as writeStorageMeta, l as resolveMatrixStoragePaths, r as maybeMigrateLegacyStorage } from "./storage-DD-EnNJE.js";
4
- import "./shared-BfW4lxGu.js";
3
+ import { d as writeStorageMeta, l as resolveMatrixStoragePaths, r as maybeMigrateLegacyStorage } from "./storage-CzHxeF5E.js";
4
+ import "./shared-DquM1oz6.js";
5
5
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
6
6
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
7
- import fs from "node:fs";
8
7
  import { ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "openclaw/plugin-sdk/ssrf-runtime";
8
+ import fs from "node:fs";
9
9
  //#region extensions/matrix/src/matrix/client/create-client.ts
10
10
  var create_client_exports = /* @__PURE__ */ __exportAll({ createMatrixClient: () => createMatrixClient });
11
- const loadMatrixCreateClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-1TXuSiXZ.js"), import("./logging-QH-48Gr6.js")]).then(([sdkModule, loggingModule]) => ({
11
+ const loadMatrixCreateClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-CIDZXWpZ.js"), import("./logging-QH-48Gr6.js")]).then(([sdkModule, loggingModule]) => ({
12
12
  MatrixClient: sdkModule.MatrixClient,
13
13
  ensureMatrixSdkLoggingConfigured: loggingModule.ensureMatrixSdkLoggingConfigured
14
14
  })));
@@ -0,0 +1,65 @@
1
+ import { a as resolveMatrixCredentialsPath, r as resolveMatrixCredentialsDir } from "./storage-paths-gUmSydsW.js";
2
+ import { a as isMatrixCredentialRevocation, c as normalizeMatrixStoredCredentials, l as openMatrixCredentialsStore, n as clearMatrixCredentials, o as loadMatrixCredentials, r as credentialsMatchConfig, s as matrixCredentialsStoreKey } from "./credentials-read-DVmFCm7X.js";
3
+ import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
4
+ //#region extensions/matrix/src/matrix/credentials.ts
5
+ function requireCredentialStoreUpdate(store) {
6
+ if (!store.update) throw new Error("Matrix credentials require atomic plugin-state updates");
7
+ return store.update;
8
+ }
9
+ async function saveMatrixCredentials(credentials, env = process.env, accountId) {
10
+ const normalizedAccountId = normalizeAccountId(accountId);
11
+ const store = openMatrixCredentialsStore(env);
12
+ const now = (/* @__PURE__ */ new Date()).toISOString();
13
+ requireCredentialStoreUpdate(store)(matrixCredentialsStoreKey(normalizedAccountId), (current) => {
14
+ const existing = normalizeMatrixStoredCredentials(current, normalizedAccountId);
15
+ return {
16
+ accountId: normalizedAccountId,
17
+ homeserver: credentials.homeserver,
18
+ userId: credentials.userId,
19
+ accessToken: credentials.accessToken,
20
+ ...typeof credentials.deviceId === "string" ? { deviceId: credentials.deviceId } : {},
21
+ createdAt: existing?.createdAt ?? now,
22
+ lastUsedAt: now
23
+ };
24
+ });
25
+ }
26
+ async function saveBackfilledMatrixDeviceId(credentials, env = process.env, accountId) {
27
+ const normalizedAccountId = normalizeAccountId(accountId);
28
+ const store = openMatrixCredentialsStore(env);
29
+ const now = (/* @__PURE__ */ new Date()).toISOString();
30
+ let result = "saved";
31
+ requireCredentialStoreUpdate(store)(matrixCredentialsStoreKey(normalizedAccountId), (current) => {
32
+ if (isMatrixCredentialRevocation(current, normalizedAccountId)) {
33
+ result = "skipped";
34
+ return current;
35
+ }
36
+ const existing = normalizeMatrixStoredCredentials(current, normalizedAccountId);
37
+ if (existing && (existing.homeserver !== credentials.homeserver || existing.userId !== credentials.userId || existing.accessToken !== credentials.accessToken)) {
38
+ result = "skipped";
39
+ return existing;
40
+ }
41
+ return {
42
+ accountId: normalizedAccountId,
43
+ homeserver: credentials.homeserver,
44
+ userId: credentials.userId,
45
+ accessToken: credentials.accessToken,
46
+ ...typeof credentials.deviceId === "string" ? { deviceId: credentials.deviceId } : {},
47
+ createdAt: existing?.createdAt ?? now,
48
+ lastUsedAt: now
49
+ };
50
+ });
51
+ return result;
52
+ }
53
+ async function touchMatrixCredentials(env = process.env, accountId) {
54
+ const normalizedAccountId = normalizeAccountId(accountId);
55
+ requireCredentialStoreUpdate(openMatrixCredentialsStore(env))(matrixCredentialsStoreKey(normalizedAccountId), (current) => {
56
+ if (isMatrixCredentialRevocation(current, normalizedAccountId)) return current;
57
+ const existing = normalizeMatrixStoredCredentials(current, normalizedAccountId);
58
+ return existing ? {
59
+ ...existing,
60
+ lastUsedAt: (/* @__PURE__ */ new Date()).toISOString()
61
+ } : void 0;
62
+ });
63
+ }
64
+ //#endregion
65
+ export { clearMatrixCredentials, credentialsMatchConfig, loadMatrixCredentials, resolveMatrixCredentialsDir, resolveMatrixCredentialsPath, saveBackfilledMatrixDeviceId, saveMatrixCredentials, touchMatrixCredentials };
@@ -0,0 +1,77 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
+ import { n as getOptionalMatrixRuntime } from "./runtime-6S3DNFNv.js";
3
+ import "./storage-paths-gUmSydsW.js";
4
+ import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
5
+ import { createPluginStateSyncKeyedStore } from "openclaw/plugin-sdk/runtime-doctor";
6
+ //#region extensions/matrix/src/matrix/credentials-read.ts
7
+ var credentials_read_exports = /* @__PURE__ */ __exportAll({
8
+ MATRIX_CREDENTIALS_MAX_ENTRIES: () => 256,
9
+ MATRIX_CREDENTIALS_NAMESPACE: () => MATRIX_CREDENTIALS_NAMESPACE,
10
+ clearMatrixCredentials: () => clearMatrixCredentials,
11
+ credentialsMatchConfig: () => credentialsMatchConfig,
12
+ isMatrixCredentialRevocation: () => isMatrixCredentialRevocation,
13
+ loadMatrixCredentials: () => loadMatrixCredentials,
14
+ matrixCredentialsStoreKey: () => matrixCredentialsStoreKey,
15
+ normalizeMatrixStoredCredentials: () => normalizeMatrixStoredCredentials,
16
+ openMatrixCredentialsStore: () => openMatrixCredentialsStore
17
+ });
18
+ const MATRIX_CREDENTIALS_NAMESPACE = "credentials";
19
+ function matrixCredentialsStoreKey(accountId) {
20
+ return `account:${normalizeAccountId(accountId)}`;
21
+ }
22
+ function normalizeMatrixStoredCredentials(value, accountId) {
23
+ if (!value || typeof value !== "object") return null;
24
+ const parsed = value;
25
+ if (typeof parsed.homeserver !== "string" || !parsed.homeserver || typeof parsed.userId !== "string" || !parsed.userId || typeof parsed.accessToken !== "string" || !parsed.accessToken || typeof parsed.createdAt !== "string" || !parsed.createdAt) return null;
26
+ return {
27
+ accountId: normalizeAccountId(accountId ?? parsed.accountId),
28
+ homeserver: parsed.homeserver,
29
+ userId: parsed.userId,
30
+ accessToken: parsed.accessToken,
31
+ ...typeof parsed.deviceId === "string" ? { deviceId: parsed.deviceId } : {},
32
+ createdAt: parsed.createdAt,
33
+ ...typeof parsed.lastUsedAt === "string" ? { lastUsedAt: parsed.lastUsedAt } : {}
34
+ };
35
+ }
36
+ function isMatrixCredentialRevocation(value, accountId) {
37
+ if (!value || typeof value !== "object") return false;
38
+ const parsed = value;
39
+ return parsed.kind === "revoked" && typeof parsed.revokedAt === "string" && parsed.revokedAt.length > 0 && normalizeAccountId(parsed.accountId) === normalizeAccountId(accountId ?? parsed.accountId);
40
+ }
41
+ function openMatrixCredentialsStore(env = process.env) {
42
+ const runtime = getOptionalMatrixRuntime();
43
+ const resolvedEnv = env.OPENCLAW_STATE_DIR?.trim() || !runtime ? env : {
44
+ ...env,
45
+ OPENCLAW_STATE_DIR: runtime.state.resolveStateDir(env)
46
+ };
47
+ return createPluginStateSyncKeyedStore("matrix", {
48
+ namespace: MATRIX_CREDENTIALS_NAMESPACE,
49
+ maxEntries: 256,
50
+ overflowPolicy: "reject-new",
51
+ env: resolvedEnv
52
+ });
53
+ }
54
+ function loadMatrixCredentials(env = process.env, accountId) {
55
+ const normalizedAccountId = normalizeAccountId(accountId);
56
+ const parsed = normalizeMatrixStoredCredentials(openMatrixCredentialsStore(env).lookup(matrixCredentialsStoreKey(accountId)), normalizedAccountId);
57
+ if (!parsed || parsed.accountId !== normalizedAccountId) return null;
58
+ const { accountId: _accountId, ...credentials } = parsed;
59
+ return credentials;
60
+ }
61
+ function clearMatrixCredentials(env = process.env, accountId) {
62
+ const normalizedAccountId = normalizeAccountId(accountId);
63
+ openMatrixCredentialsStore(env).register(matrixCredentialsStoreKey(normalizedAccountId), {
64
+ accountId: normalizedAccountId,
65
+ kind: "revoked",
66
+ revokedAt: (/* @__PURE__ */ new Date()).toISOString()
67
+ });
68
+ }
69
+ function credentialsMatchConfig(stored, config) {
70
+ if (!config.userId) {
71
+ if (!config.accessToken) return false;
72
+ return stored.homeserver === config.homeserver && stored.accessToken === config.accessToken;
73
+ }
74
+ return stored.homeserver === config.homeserver && stored.userId === config.userId;
75
+ }
76
+ //#endregion
77
+ export { isMatrixCredentialRevocation as a, normalizeMatrixStoredCredentials as c, credentials_read_exports as i, openMatrixCredentialsStore as l, clearMatrixCredentials as n, loadMatrixCredentials as o, credentialsMatchConfig as r, matrixCredentialsStoreKey as s, MATRIX_CREDENTIALS_NAMESPACE as t };
@@ -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-CncWUieb.js"));
3
+ const loadMatrixCredentialsRuntime = createLazyRuntimeModule(() => import("./credentials-W2EmwRhu.js"));
4
4
  async function saveMatrixCredentials(...args) {
5
5
  return (await loadMatrixCredentialsRuntime()).saveMatrixCredentials(...args);
6
6
  }
@@ -1,8 +1,8 @@
1
1
  import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
2
- import { t as ensureMatrixCryptoRuntime } from "./deps-DDbghaZH.js";
2
+ import { t as ensureMatrixCryptoRuntime } from "./deps-CcVJfvRM.js";
3
3
  import { n as LogService, r as noop } from "./logger-D0GCSDQq.js";
4
- import { i as restoreIdbFromDisk, n as persistIdbToDisk } from "./idb-persistence-BiHEEzD7.js";
5
- import { n as isRepairableSecretStorageAccessError } from "./recovery-key-store-B2RglalK.js";
4
+ import { i as restoreIdbFromDisk, n as persistIdbToDisk } from "./idb-persistence-Dyy6ipgU.js";
5
+ import { n as isRepairableSecretStorageAccessError } from "./recovery-key-store-CW6eePfp.js";
6
6
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
7
7
  import { resolveDateTimestampMs, resolveTimestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
8
8
  import { MatrixEventEvent } from "matrix-js-sdk/lib/matrix.js";
@@ -1,8 +1,8 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
2
  import { n as normalizeMatrixMessagingTarget, t as isMatrixQualifiedUserId } from "./target-ids-B-5aQxwn.js";
3
- import { f as resolveMatrixAuth } from "./shared-BfW4lxGu.js";
4
- import "./client-CPuYbNL8.js";
5
- import { t as MatrixAuthedHttpClient } from "./http-client-Jw5_bwQo.js";
3
+ import { f as resolveMatrixAuth } from "./shared-DquM1oz6.js";
4
+ import "./client-CA0PULls.js";
5
+ import { t as MatrixAuthedHttpClient } from "./http-client-BmrgOZTL.js";
6
6
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
7
7
  //#region extensions/matrix/src/directory-live.ts
8
8
  var directory_live_exports = /* @__PURE__ */ __exportAll({
@@ -1,4 +1,4 @@
1
- import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-D2qTLe-C.js";
1
+ import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-BA2Y6Crx.js";
2
2
  import { detectPluginInstallPathIssue, formatPluginInstallPathIssue, removePluginFromConfig } from "openclaw/plugin-sdk/runtime-doctor";
3
3
  //#region extensions/matrix/src/doctor.ts
4
4
  async function collectMatrixInstallPathWarnings(cfg) {
@@ -1,4 +1,4 @@
1
- import { t as isRecord } from "./record-shared-CvzjvHRn.js";
1
+ import { t as isRecord } from "./record-shared-CWWx6fvI.js";
2
2
  import { defineChannelAliasMigration } from "openclaw/plugin-sdk/runtime-doctor";
3
3
  import { hasLegacyFlatAllowPrivateNetworkAlias, migrateLegacyFlatAllowPrivateNetworkAlias } from "openclaw/plugin-sdk/ssrf-runtime";
4
4
  //#region extensions/matrix/src/doctor-contract.ts