@openclaw/matrix 2026.7.2-beta.1 → 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 (76) 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--Ei44Vo2.js → approval-handler.runtime-BEa98wwG.js} +5 -5
  4. package/dist/{approval-ids-C_2kSMdJ.js → approval-ids-Dfn7oQAm.js} +1 -1
  5. package/dist/{approval-reaction-auth-TdVPcgxP.js → approval-reaction-auth-kXkCJBGi.js} +2 -2
  6. package/dist/{approval-reactions-BgU51JGd.js → approval-reactions-D-BxBK_L.js} +1 -1
  7. package/dist/auth-presence.js +13 -21
  8. package/dist/{channel-CxqDh7mS.js → channel-j331Xd7b.js} +14 -13
  9. package/dist/channel-plugin-api.js +1 -1
  10. package/dist/{channel.runtime-wNfJc57I.js → channel.runtime-BIwlVfQw.js} +15 -16
  11. package/dist/{cli-o00oTJhx.js → cli-0EcKfqFw.js} +25 -15
  12. package/dist/{cli-metadata-Gf3HSJ2c.js → cli-metadata-Xq1Xb15R.js} +1 -1
  13. package/dist/cli-metadata.js +1 -1
  14. package/dist/{client-ClHisZbf.js → client-BtG4quUl.js} +2 -2
  15. package/dist/{client-DP0nmFxK.js → client-CA0PULls.js} +2 -2
  16. package/dist/{client-bootstrap-PqYOS-mO.js → client-bootstrap-Dk5EAn3n.js} +1 -1
  17. package/dist/{config-schema-CG9goLWp.js → config-schema-B5GRV8wL.js} +8 -10
  18. package/dist/contract-api.js +2 -2
  19. package/dist/{create-client-D9z9RjCM.js → create-client-WQExaby_.js} +4 -4
  20. package/dist/credentials-W2EmwRhu.js +65 -0
  21. package/dist/credentials-read-DVmFCm7X.js +77 -0
  22. package/dist/{credentials-write.runtime-J_EUt5WP.js → credentials-write.runtime-Be9zNSUw.js} +1 -1
  23. package/dist/{crypto-runtime-BHcxauC4.js → crypto-runtime-CAff-n15.js} +4 -4
  24. package/dist/{directory-live-DPy2aaPF.js → directory-live-DiC-0XBC.js} +3 -3
  25. package/dist/{doctor-BGTs609f.js → doctor-DwUVm5Lw.js} +1 -1
  26. package/dist/{doctor-contract-D2qTLe-C.js → doctor-contract-BA2Y6Crx.js} +1 -1
  27. package/dist/doctor-contract-api.js +117 -11
  28. package/dist/{draft-stream-De7uikGn.js → draft-stream-CTLKtJJ0.js} +1 -1
  29. package/dist/{encryption-guidance-BFfgq7c7.js → encryption-guidance-CbEFe38F.js} +1 -1
  30. package/dist/{file-sync-store-Cxb0ckyX.js → file-sync-store-CPkgnSXp.js} +23 -6
  31. package/dist/helper-api.js +2 -2
  32. package/dist/{http-client-W4TJQM6r.js → http-client-BmrgOZTL.js} +2 -2
  33. package/dist/{idb-persistence-iUZoHZkp.js → idb-persistence-Dyy6ipgU.js} +3 -3
  34. package/dist/{inbound-dedupe-DcMs0YXL.js → inbound-dedupe-CaBLblef.js} +19 -38
  35. package/dist/index.js +1 -1
  36. package/dist/{logger-BMClpI5b.js → logger-D0GCSDQq.js} +1 -1
  37. package/dist/{logging-CFJrbDAN.js → logging-QH-48Gr6.js} +1 -1
  38. package/dist/{media-text-DWaotsZB.js → media-text-BMXEXb1j.js} +1 -1
  39. package/dist/{messages-Dm3K4ZvM.js → messages-3UBHfZrN.js} +3 -3
  40. package/dist/{monitor-C_kgPPeV.js → monitor-BtUIds8T.js} +135 -136
  41. package/dist/plugin-entry.handlers.runtime.js +1 -1
  42. package/dist/probe.runtime-sBV-Govx.js +3 -0
  43. package/dist/{profile-update-iUHCoks3.js → profile-update-Bh2XtJwN.js} +3 -3
  44. package/dist/{reaction-events-0tubdHRM.js → reaction-events-BwAKtUyQ.js} +3 -3
  45. package/dist/record-shared-CWWx6fvI.js +2 -0
  46. package/dist/{recovery-key-store-Bx0zTJcB.js → recovery-key-store-CW6eePfp.js} +2 -2
  47. package/dist/{resolve-targets-DlLrfWDy.js → resolve-targets-DVoj-YxB.js} +1 -1
  48. package/dist/{resolver.runtime-MeaT1zXx.js → resolver.runtime-CC0VVsAt.js} +1 -1
  49. package/dist/{runtime-CveSqMOP.js → runtime-6S3DNFNv.js} +1 -1
  50. package/dist/runtime-api.js +6 -6
  51. package/dist/runtime-setter-api.js +1 -1
  52. package/dist/{sdk-CI8E2TKg.js → sdk-CIDZXWpZ.js} +7 -7
  53. package/dist/{secret-contract-OZoQf0kI.js → secret-contract-M3hRmGO-.js} +21 -5
  54. package/dist/secret-contract-api.js +1 -1
  55. package/dist/{send-C7xuGWpv.js → send-BJbrdmNm.js} +4 -3
  56. package/dist/session-binding-contract-api.js +2 -2
  57. package/dist/{setup-bootstrap-CCsexWTZ.js → setup-bootstrap-DGPOOdz-.js} +2 -2
  58. package/dist/{setup-core-DlmTyIP0.js → setup-core-XCdAx1nY.js} +3 -3
  59. package/dist/setup-plugin-api.js +3 -3
  60. package/dist/{setup-surface-2SS94JV0.js → setup-surface-CzUiTe_k.js} +6 -6
  61. package/dist/{shared-DgvN5rBx.js → shared-DquM1oz6.js} +7 -7
  62. package/dist/{startup-verification-CbIyF7z1.js → startup-verification-CA00kebL.js} +3 -3
  63. package/dist/{storage-BtSOar8T.js → storage-CzHxeF5E.js} +9 -9
  64. package/dist/{thread-bindings-BI8MHWp9.js → thread-bindings-Cw194yEn.js} +4 -4
  65. package/dist/{tool-actions.runtime-CnyhVPoY.js → tool-actions.runtime-C0jgWYhX.js} +19 -15
  66. package/dist/{verification-DLSe3sP7.js → verification-DjxyWTNP.js} +2 -2
  67. package/npm-shrinkwrap.json +3 -3
  68. package/openclaw.plugin.json +70 -70
  69. package/package.json +4 -4
  70. package/dist/async-lock-BcLS4KOc.js +0 -19
  71. package/dist/credentials-DnhsLAuR.js +0 -56
  72. package/dist/credentials-read-BtS-HRT5.js +0 -112
  73. package/dist/probe.runtime-Dry8PTWC.js +0 -3
  74. package/dist/record-shared-CvzjvHRn.js +0 -2
  75. package/dist/{deps-DDbghaZH.js → deps-CcVJfvRM.js} +1 -1
  76. 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-DlmTyIP0.js";
5
- import { t as matrixPlugin } from "./channel-CxqDh7mS.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-2SS94JV0.js";
8
- import { t as createMatrixThreadBindingManager } from "./thread-bindings-BI8MHWp9.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-DlmTyIP0.js";
2
- import { _ as shouldHandleMatrixApprovalRequest, g as isMatrixAnyApprovalClientEnabled } from "./channel-CxqDh7mS.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-C7xuGWpv.js";
5
- import { a as unregisterMatrixApprovalReactionTarget, n as listMatrixApprovalReactionBindings, r as registerMatrixApprovalReactionTarget, t as buildMatrixApprovalReactionHint } from "./approval-reactions-BgU51JGd.js";
6
- import { n as editMatrixMessage, t as deleteMatrixMessage } from "./messages-Dm3K4ZvM.js";
4
+ import { a as sendMessageMatrix, i as reactMatrixMessage, p as repairMatrixDirectRooms, s as sendSingleTextMessageMatrix } from "./send-BJbrdmNm.js";
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-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-CG9goLWp.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-DlmTyIP0.js";
2
- import { t as normalizeMatrixApproverId } from "./approval-ids-C_2kSMdJ.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,4 +1,4 @@
1
- import { n as getOptionalMatrixRuntime } from "./runtime-CveSqMOP.js";
1
+ import { n as getOptionalMatrixRuntime } from "./runtime-6S3DNFNv.js";
2
2
  import { normalizeAccountId, normalizeOptionalAccountId } from "openclaw/plugin-sdk/routing";
3
3
  import { createApprovalReactionTargetStore } from "openclaw/plugin-sdk/approval-reaction-runtime";
4
4
  //#region extensions/matrix/src/approval-reactions.ts
@@ -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-DlmTyIP0.js";
4
- import { a as normalizeMatrixUserId, n as DEFAULT_ACCOUNT_ID$2, r as matrixConfigAdapter, t as MatrixChannelConfigSchema } from "./config-schema-CG9goLWp.js";
5
- import { t as normalizeMatrixApproverId } from "./approval-ids-C_2kSMdJ.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-CnyhVPoY.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--Ei44Vo2.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-MeaT1zXx.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-2SS94JV0.js").then((n) => n.t), "matrixSetupWizard");
910
- const loadMatrixChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-wNfJc57I.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",
@@ -1176,6 +1176,7 @@ const matrixPlugin = createChatChannelPlugin({
1176
1176
  messaging: {
1177
1177
  defaultMarkdownTableMode: "bullets",
1178
1178
  targetPrefixes: ["matrix"],
1179
+ targetIdComparison: "case-sensitive",
1179
1180
  normalizeTarget: normalizeMatrixMessagingTarget,
1180
1181
  resolveInboundConversation: ({ to, conversationId, threadId }) => resolveMatrixInboundConversation({
1181
1182
  to,
@@ -1280,7 +1281,7 @@ const matrixPlugin = createChatChannelPlugin({
1280
1281
  await previousLock;
1281
1282
  let monitorMatrixProvider;
1282
1283
  try {
1283
- monitorMatrixProvider = (await import("./monitor-C_kgPPeV.js")).monitorMatrixProvider;
1284
+ monitorMatrixProvider = (await import("./monitor-BtUIds8T.js")).monitorMatrixProvider;
1284
1285
  } finally {
1285
1286
  releaseLock();
1286
1287
  }
@@ -1,2 +1,2 @@
1
- import { t as matrixPlugin } from "./channel-CxqDh7mS.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-C7xuGWpv.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-DgvN5rBx.js";
4
- import "./client-DP0nmFxK.js";
5
- import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-DPy2aaPF.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-DlLrfWDy.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-Dry8PTWC.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,16 +1,16 @@
1
1
  import { a as resolveMatrixAccountConfig } from "./account-config-BZWN9tGS.js";
2
- import { t as getMatrixRuntime } from "./runtime-CveSqMOP.js";
3
- import { c as resolveMatrixConfigPath, g as resolveMatrixAccount, l as updateMatrixAccountConfig, n as matrixSetupAdapter } from "./setup-core-DlmTyIP0.js";
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-XCdAx1nY.js";
4
4
  import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
5
- import { n as withResolvedActionClient } from "./client-ClHisZbf.js";
6
- import { p as resolveMatrixAuthContext } from "./shared-DgvN5rBx.js";
7
- import "./client-DP0nmFxK.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-iUHCoks3.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-DLSe3sP7.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
- import { setMatrixSdkConsoleLogging, setMatrixSdkLogMode } from "./logging-CFJrbDAN.js";
13
+ import { setMatrixSdkConsoleLogging, setMatrixSdkLogMode } from "./logging-QH-48Gr6.js";
14
14
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
15
15
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
16
16
  import { parseStrictInteger, timestampMsToIsoString } from "openclaw/plugin-sdk/number-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-ClHisZbf.js").then((n) => n.t));
40
- const loadMatrixDirectManagementModule = createLazyRuntimeModule(() => import("./send-C7xuGWpv.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-CCsexWTZ.js");
215
+ const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-DGPOOdz-.js");
209
216
  verificationBootstrap = await maybeBootstrapNewEncryptedMatrixAccount({
210
217
  previousCfg: cfg,
211
218
  cfg: updated,
@@ -936,13 +943,16 @@ function registerMatrixCli(params) {
936
943
  errorPrefix: "Direct room repair failed"
937
944
  });
938
945
  });
939
- root.command("encryption").description("Set up Matrix end-to-end encryption").command("setup").description("Enable Matrix E2EE, bootstrap verification, and print next steps").option("--account <id>", "Account ID (for multi-account setups)").option("--recovery-key <key>", "Recovery key to apply before bootstrap").option("--force-reset-cross-signing", "Force reset cross-signing identity before bootstrap (requires active recovery key)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
946
+ root.command("encryption").description("Set up Matrix end-to-end encryption").command("setup").description("Enable Matrix E2EE, bootstrap verification, and print next steps").option("--account <id>", "Account ID (for multi-account setups)").option("--recovery-key <key>", "Recovery key to apply before bootstrap (prefer --recovery-key-stdin)").option("--recovery-key-stdin", "Read the Matrix recovery key from stdin").option("--force-reset-cross-signing", "Force reset cross-signing identity before bootstrap (requires active recovery key)").option("--verbose", "Show detailed diagnostics").option("--json", "Output as JSON").action(async (options) => {
940
947
  await runMatrixCliCommand({
941
948
  verbose: options.verbose === true,
942
949
  json: options.json === true,
943
950
  run: async () => await setupMatrixEncryption({
944
951
  account: options.account,
945
- recoveryKey: options.recoveryKey,
952
+ recoveryKey: await resolveMatrixCliRecoveryKeyInput({
953
+ recoveryKey: options.recoveryKey,
954
+ recoveryKeyStdin: options.recoveryKeyStdin
955
+ }),
946
956
  forceResetCrossSigning: options.forceResetCrossSigning === true
947
957
  }),
948
958
  onText: (result, verbose) => {
@@ -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-o00oTJhx.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-Gf3HSJ2c.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-C7xuGWpv.js";
3
- import { n as withResolvedRuntimeMatrixClient } from "./client-bootstrap-PqYOS-mO.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-DgvN5rBx.js";
7
- import { t as createMatrixClient } from "./create-client-D9z9RjCM.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-DP0nmFxK.js").then((n) => n.t), import("./shared-DgvN5rBx.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,12 +1,12 @@
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-DlmTyIP0.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";
6
6
  import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1 } from "openclaw/plugin-sdk/account-id";
7
7
  import { resolveAllowlistMatchByCandidates } from "openclaw/plugin-sdk/allow-from";
8
8
  import { normalizeStringEntries as normalizeStringEntries$1 } from "openclaw/plugin-sdk/string-normalization-runtime";
9
- import { AllowFromListSchema, BlockStreamingCoalesceSchema, ContextVisibilityModeSchema, GroupPolicySchema, MarkdownConfigSchema, MentionPatternsPolicySchema, ToolPolicySchema, buildChannelConfigSchema, buildNestedDmConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
9
+ import { AllowFromListSchema, BlockStreamingCoalesceSchema, ContextVisibilityModeSchema, GroupPolicySchema, MarkdownConfigSchema, MentionPatternsPolicySchema, buildChannelConfigSchema, buildGroupEntrySchema, buildNestedDmConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
10
10
  import { buildSecretInputSchema } from "openclaw/plugin-sdk/secret-input";
11
11
  import { z } from "zod";
12
12
  //#region extensions/matrix/src/matrix/monitor/allowlist.ts
@@ -180,18 +180,16 @@ const botLoopProtectionSchema = z.object({
180
180
  windowSeconds: z.number().int().positive().optional(),
181
181
  cooldownSeconds: z.number().int().positive().optional()
182
182
  }).strict().optional();
183
- const matrixRoomSchema = z.object({
183
+ const matrixRoomSchema = buildGroupEntrySchema({
184
184
  account: z.string().optional(),
185
- enabled: z.boolean().optional(),
186
- requireMention: z.boolean().optional(),
187
185
  allowBots: z.union([z.boolean(), z.literal("mentions")]).optional(),
188
186
  botLoopProtection: botLoopProtectionSchema,
189
- tools: ToolPolicySchema,
190
187
  autoReply: z.boolean().optional(),
191
- users: AllowFromListSchema,
192
- skills: z.array(z.string()).optional(),
193
- systemPrompt: z.string().optional()
194
- }).optional();
188
+ users: AllowFromListSchema
189
+ }).omit({
190
+ toolsBySender: true,
191
+ allowFrom: true
192
+ }).strict().optional();
195
193
  const matrixNetworkSchema = z.object({ dangerouslyAllowPrivateNetwork: z.boolean().optional() }).strict().optional();
196
194
  const matrixStreamingSchema = z.object({
197
195
  mode: z.enum([
@@ -1,3 +1,3 @@
1
- import { d as resolveSingleAccountPromotionTarget, f as singleAccountKeysToMove, n as matrixSetupAdapter, u as namedAccountPromotionKeys } from "./setup-core-DlmTyIP0.js";
2
- import { n as matrixOnboardingAdapter } from "./setup-surface-2SS94JV0.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-BtSOar8T.js";
4
- import "./shared-DgvN5rBx.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-CI8E2TKg.js"), import("./logging-CFJrbDAN.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 };