@openclaw/matrix 2026.7.2-beta.4 → 2026.7.2-beta.5

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 (56) hide show
  1. package/README.md +1 -1
  2. package/dist/api.js +4 -4
  3. package/dist/{approval-handler.runtime-AsawryfP.js → approval-handler.runtime-D1ibJgSk.js} +4 -4
  4. package/dist/{approval-ids-XAMP8vN9.js → approval-ids-2OQj32-K.js} +1 -1
  5. package/dist/{approval-reaction-auth-DButmM13.js → approval-reaction-auth-CCAWWkbu.js} +2 -2
  6. package/dist/{channel-MBtrY36B.js → channel-Cmi248PA.js} +28 -32
  7. package/dist/channel-plugin-api.js +1 -1
  8. package/dist/{channel.runtime-Bi4Dgy2P.js → channel.runtime-BaPXFRgT.js} +34 -40
  9. package/dist/{cli-CcPuMyCk.js → cli-0CNHkps5.js} +863 -843
  10. package/dist/{cli-metadata-DAhDhbYX.js → cli-metadata-DnXxNCoj.js} +1 -1
  11. package/dist/cli-metadata.js +1 -1
  12. package/dist/{client-Dg8dk8NW.js → client-BFRg0kd4.js} +2 -2
  13. package/dist/{client-BwX6rURh.js → client-CitERujx.js} +2 -2
  14. package/dist/{client-bootstrap-ZAaO9fZ-.js → client-bootstrap-CkAnkzB6.js} +1 -1
  15. package/dist/{config-schema-CggnuwnJ.js → config-schema-BShrVROw.js} +16 -2
  16. package/dist/contract-api.js +2 -2
  17. package/dist/{create-client-Und1YmJ2.js → create-client-f-CkRllE.js} +3 -3
  18. package/dist/{crypto-runtime-_j7TpS7k.js → crypto-runtime-D9_6J5tZ.js} +2 -2
  19. package/dist/{device-health-D4LBxuPq.js → device-health-B4-YXtJR.js} +6 -1
  20. package/dist/{directory-live-B6fbX6jf.js → directory-live-YRgYDx2w.js} +3 -3
  21. package/dist/{doctor-C0LPJGTz.js → doctor-CM8ijNpW.js} +1 -1
  22. package/dist/{doctor-contract-CWVdlRQR.js → doctor-contract-BMSJkkAE.js} +21 -37
  23. package/dist/doctor-contract-api.js +4 -4
  24. package/dist/{draft-stream-BfibauH1.js → draft-stream-CIjafRr0.js} +1 -1
  25. package/dist/{file-sync-store-DUEWCEjb.js → file-sync-store-DiiFsayX.js} +1 -1
  26. package/dist/{http-client-DOyTG9l2.js → http-client-CycYxU9-.js} +1 -1
  27. package/dist/{idb-persistence-C6zQfW2w.js → idb-persistence-B6x7dMsF.js} +5 -11
  28. package/dist/index.js +1 -1
  29. package/dist/{logging-QH-48Gr6.js → logging-DV-p52N0.js} +8 -1
  30. package/dist/{media-text-Cv1VIHXW.js → media-text-DlQC_k_K.js} +1 -1
  31. package/dist/{messages-ClTgfFl6.js → messages-Bf_s--M9.js} +3 -3
  32. package/dist/{monitor-2BjKS9RV.js → monitor-s--XqoxF.js} +2037 -1803
  33. package/dist/plugin-entry.handlers.runtime.js +1 -1
  34. package/dist/probe.runtime-BJOvCHnZ.js +3 -0
  35. package/dist/{profile-update-C2My3TML.js → profile-update-z3aM46KS.js} +2 -2
  36. package/dist/{reaction-events-Cj6thhmc.js → reaction-events-DrK9Zua7.js} +2 -2
  37. package/dist/{recovery-key-store-0O8ARdT_.js → recovery-key-store-BNnHvXdk.js} +1 -1
  38. package/dist/{resolve-targets-Dn11HT76.js → resolve-targets-nNMcrV3W.js} +1 -1
  39. package/dist/{resolver.runtime-Zguh0hH9.js → resolver.runtime-BvaFlVLg.js} +1 -1
  40. package/dist/{room-info-B6vKD5DF.js → room-info-CAFZ3Z9J.js} +13 -12
  41. package/dist/{sdk-DiRXiRRf.js → sdk-UzPd8tst.js} +227 -181
  42. package/dist/{send-CZCmDQu8.js → send-C9Ssx-iV.js} +623 -108
  43. package/dist/session-binding-contract-api.js +1 -1
  44. package/dist/{setup-bootstrap-C9w01xQK.js → setup-bootstrap-BBGpPKgy.js} +2 -2
  45. package/dist/{setup-core-D6gyoyeg.js → setup-core-a542Ernq.js} +29 -27
  46. package/dist/setup-plugin-api.js +3 -3
  47. package/dist/{setup-surface-DZIEWtQC.js → setup-surface-BJrCI6KT.js} +32 -30
  48. package/dist/{shared-C7Vm9RxI.js → shared-CUH5otj8.js} +5 -12
  49. package/dist/{startup-verification-D1nscMh8.js → startup-verification-wm3_i88s.js} +1 -1
  50. package/dist/{storage-BrkTJZov.js → storage-BvAkgzvT.js} +20 -20
  51. package/dist/{thread-bindings-BcYBELC7.js → thread-bindings-D3RfVgAF.js} +4 -3
  52. package/dist/{tool-actions.runtime-Dbco_Vwn.js → tool-actions.runtime-Dh5ow2EK.js} +8 -8
  53. package/dist/{verification-DhMBWxOJ.js → verification-ZdAXdmuh.js} +1 -1
  54. package/package.json +4 -5
  55. package/dist/probe.runtime-BWkgfbiE.js +0 -3
  56. package/npm-shrinkwrap.json +0 -557
@@ -1,4 +1,4 @@
1
1
  import { r as setMatrixRuntime } from "./runtime-6S3DNFNv.js";
2
2
  import { s as resetMatrixThreadBindingsForTests } from "./thread-bindings-shared-CKnY4LSd.js";
3
- import { t as createMatrixThreadBindingManager } from "./thread-bindings-BcYBELC7.js";
3
+ import { t as createMatrixThreadBindingManager } from "./thread-bindings-D3RfVgAF.js";
4
4
  export { createMatrixThreadBindingManager, resetMatrixThreadBindingsForTests, setMatrixRuntime };
@@ -1,7 +1,7 @@
1
1
  import { a as resolveMatrixAccountConfig, n as hasExplicitMatrixAccountConfig } from "./account-config-BZWN9tGS.js";
2
- import "./setup-core-D6gyoyeg.js";
2
+ import "./setup-core-a542Ernq.js";
3
3
  import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
4
- import { n as bootstrapMatrixVerification } from "./verification-DhMBWxOJ.js";
4
+ import { n as bootstrapMatrixVerification } from "./verification-ZdAXdmuh.js";
5
5
  //#region extensions/matrix/src/setup-bootstrap.ts
6
6
  async function maybeBootstrapNewEncryptedMatrixAccount(params) {
7
7
  const accountConfig = resolveMatrixAccountConfig({
@@ -8,6 +8,7 @@ import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "opencl
8
8
  import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
9
9
  import { hasConfiguredSecretInput } from "openclaw/plugin-sdk/secret-input-runtime";
10
10
  import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, normalizeAccountId as normalizeAccountId$1 } from "openclaw/plugin-sdk/routing";
11
+ import { createChannelDmPolicy } from "openclaw/plugin-sdk/channel-dm-policy";
11
12
  import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
12
13
  import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$2, addWildcardAllowFrom, applyAccountNameToChannelSection, normalizeAccountId as normalizeAccountId$2, normalizeAllowFromEntries, normalizeSecretInputString, prepareScopedSetupConfig } from "openclaw/plugin-sdk/setup";
13
14
  import { resolveOptionalIntegerOption } from "openclaw/plugin-sdk/number-runtime";
@@ -586,19 +587,6 @@ function resolveMatrixSetupAccountId(params) {
586
587
  function resolveMatrixSetupWizardAccountId(cfg, accountId) {
587
588
  return normalizeAccountId$2(accountId?.trim() || resolveDefaultMatrixAccountId(cfg) || DEFAULT_ACCOUNT_ID$2);
588
589
  }
589
- function setMatrixDmPolicy(cfg, policy, accountId) {
590
- const resolvedAccountId = resolveMatrixSetupWizardAccountId(cfg, accountId);
591
- const existing = resolveMatrixAccountConfig({
592
- cfg,
593
- accountId: resolvedAccountId
594
- });
595
- const allowFrom = resolveMatrixSetupDmAllowFrom(policy, existing.dm?.allowFrom);
596
- return updateMatrixAccountConfig(cfg, resolvedAccountId, { dm: {
597
- ...existing.dm,
598
- policy,
599
- allowFrom
600
- } });
601
- }
602
590
  function createMatrixSetupWizardProxy(loadWizardModule) {
603
591
  let wizardPromise = null;
604
592
  const loadWizard = () => {
@@ -618,28 +606,42 @@ function createMatrixSetupWizardProxy(loadWizardModule) {
618
606
  return await (wizard.configureWhenConfigured ?? wizard.configureInteractive ?? wizard.configure)(ctx);
619
607
  },
620
608
  afterConfigWritten: async (ctx) => await (await loadWizard()).afterConfigWritten?.(ctx),
621
- dmPolicy: {
609
+ dmPolicy: createChannelDmPolicy({
622
610
  label: "Matrix",
623
611
  channel,
624
- policyKey: "channels.matrix.dm.policy",
625
- allowFromKey: "channels.matrix.dm.allowFrom",
626
- resolveConfigKeys: (cfg, accountId) => {
627
- const resolvedAccountId = resolveMatrixSetupWizardAccountId(cfg, accountId);
612
+ policyPath: "dm.policy",
613
+ allowFromPath: "dm.allowFrom",
614
+ resolveAccount: (cfg, accountId) => {
615
+ const accountIdResolved = resolveMatrixSetupWizardAccountId(cfg, accountId);
616
+ const config = resolveMatrixAccountConfig({
617
+ cfg,
618
+ accountId: accountIdResolved
619
+ });
628
620
  return {
629
- policyKey: resolveMatrixConfigFieldPath(cfg, resolvedAccountId, "dm.policy"),
630
- allowFromKey: resolveMatrixConfigFieldPath(cfg, resolvedAccountId, "dm.allowFrom")
621
+ accountId: accountIdResolved,
622
+ config: {
623
+ dmPolicy: config.dm?.policy,
624
+ allowFrom: config.dm?.allowFrom,
625
+ dm: config.dm
626
+ }
631
627
  };
632
628
  },
633
- getCurrent: (cfg, accountId) => resolveMatrixAccountConfig({
634
- cfg,
635
- accountId: resolveMatrixSetupWizardAccountId(cfg, accountId)
636
- }).dm?.policy ?? "pairing",
637
- setPolicy: (cfg, policy, accountId) => setMatrixDmPolicy(cfg, policy, accountId),
629
+ resolveConfigKeys: ({ cfg, account }) => ({
630
+ policyKey: resolveMatrixConfigFieldPath(cfg, account.accountId, "dm.policy"),
631
+ allowFromKey: resolveMatrixConfigFieldPath(cfg, account.accountId, "dm.allowFrom")
632
+ }),
633
+ resolveAllowFrom: ({ policy, account }) => resolveMatrixSetupDmAllowFrom(policy, account.config.allowFrom),
634
+ buildPatch: ({ account, policy, allowFrom }) => ({ dm: {
635
+ ...account.config.dm,
636
+ policy,
637
+ allowFrom
638
+ } }),
639
+ applyPatch: ({ cfg, account, patch }) => updateMatrixAccountConfig(cfg, account.accountId, patch),
638
640
  promptAllowFrom: async (params) => {
639
641
  const promptAllowFrom = (await loadWizard()).dmPolicy?.promptAllowFrom;
640
642
  return promptAllowFrom ? await promptAllowFrom(params) : params.cfg;
641
643
  }
642
- },
644
+ }),
643
645
  disable: (cfg) => ({
644
646
  ...cfg,
645
647
  channels: {
@@ -680,7 +682,7 @@ const matrixSetupAdapter = {
680
682
  input
681
683
  }),
682
684
  afterAccountConfigWritten: async ({ previousCfg, cfg, accountId, runtime }) => {
683
- const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-C9w01xQK.js");
685
+ const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-BBGpPKgy.js");
684
686
  await runMatrixSetupBootstrapAfterConfigWrite({
685
687
  previousCfg,
686
688
  cfg,
@@ -1,5 +1,5 @@
1
- import { _ as resolveMatrixAccount, n as matrixSetupAdapter, r as matrixSetupContract, t as createMatrixSetupWizardProxy } from "./setup-core-D6gyoyeg.js";
2
- import { r as matrixConfigAdapter, t as MatrixChannelConfigSchema } from "./config-schema-CggnuwnJ.js";
1
+ import { _ as resolveMatrixAccount, n as matrixSetupAdapter, r as matrixSetupContract, t as createMatrixSetupWizardProxy } from "./setup-core-a542Ernq.js";
2
+ import { r as matrixConfigAdapter, t as MatrixChannelConfigSchema } from "./config-schema-BShrVROw.js";
3
3
  import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
4
4
  const matrixSetupPlugin = {
5
5
  id: "matrix",
@@ -13,7 +13,7 @@ const matrixSetupPlugin = {
13
13
  order: 70,
14
14
  quickstartAllowFrom: true
15
15
  },
16
- setupWizard: createMatrixSetupWizardProxy(async () => ({ matrixSetupWizard: (await import("./setup-surface-DZIEWtQC.js").then((n) => n.t)).matrixSetupWizard })),
16
+ setupWizard: createMatrixSetupWizardProxy(async () => ({ matrixSetupWizard: (await import("./setup-surface-BJrCI6KT.js").then((n) => n.t)).matrixSetupWizard })),
17
17
  setup: matrixSetupAdapter,
18
18
  setupContract: matrixSetupContract,
19
19
  capabilities: {
@@ -2,12 +2,13 @@ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
2
  import { n as requiresExplicitMatrixDefaultAccount } from "./account-selection-kqquRzCf.js";
3
3
  import { a as resolveMatrixAccountConfig } from "./account-config-BZWN9tGS.js";
4
4
  import { r as resolveMatrixEnvAuthReadiness } from "./env-auth-CQsYbz-p.js";
5
- import { _ as resolveMatrixAccount, a as moveSingleMatrixAccountConfigToNamedAccount, g as resolveDefaultMatrixAccountId, i as resolveMatrixSetupDmAllowFrom, m as listMatrixAccountIds, u as updateMatrixAccountConfig } from "./setup-core-D6gyoyeg.js";
5
+ import { _ as resolveMatrixAccount, a as moveSingleMatrixAccountConfigToNamedAccount, g as resolveDefaultMatrixAccountId, i as resolveMatrixSetupDmAllowFrom, m as listMatrixAccountIds, u as updateMatrixAccountConfig } from "./setup-core-a542Ernq.js";
6
6
  import { t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.js";
7
7
  import { n as validateMatrixHomeserverUrl, r as isPrivateOrLoopbackHost, t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
8
8
  import { n as ensureMatrixSdkInstalled, r as isMatrixSdkAvailable } from "./deps-CcVJfvRM.js";
9
9
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
10
10
  import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
11
+ import { createChannelDmPolicy } from "openclaw/plugin-sdk/channel-dm-policy";
11
12
  import { formatDocsLink, hasConfiguredSecretInput, mergeAllowFromEntries, normalizeAccountId as normalizeAccountId$1, promptAccountId, promptChannelAccessConfig, splitSetupEntries } from "openclaw/plugin-sdk/setup";
12
13
  import { isPrivateNetworkOptInEnabled } from "openclaw/plugin-sdk/ssrf-policy";
13
14
  //#region extensions/matrix/src/onboarding.ts
@@ -38,19 +39,6 @@ function normalizeMatrixInviteAutoJoinTargets(entries) {
38
39
  function resolveMatrixOnboardingAccountId(cfg, accountId) {
39
40
  return normalizeAccountId$1(normalizeOptionalString(accountId) || resolveDefaultMatrixAccountId(cfg) || DEFAULT_ACCOUNT_ID);
40
41
  }
41
- function setMatrixDmPolicy(cfg, policy, accountId) {
42
- const resolvedAccountId = resolveMatrixOnboardingAccountId(cfg, accountId);
43
- const existing = resolveMatrixAccountConfig({
44
- cfg,
45
- accountId: resolvedAccountId
46
- });
47
- const allowFrom = resolveMatrixSetupDmAllowFrom(policy, existing.dm?.allowFrom);
48
- return updateMatrixAccountConfig(cfg, resolvedAccountId, { dm: {
49
- ...existing.dm,
50
- policy,
51
- allowFrom
52
- } });
53
- }
54
42
  async function noteMatrixAuthHelp(prompter) {
55
43
  await prompter.note([
56
44
  "Matrix requires a homeserver URL.",
@@ -105,7 +93,7 @@ async function promptMatrixAllowFrom(params) {
105
93
  pending.push(part);
106
94
  }
107
95
  if (pending.length > 0) {
108
- const { resolveMatrixTargets } = await import("./resolve-targets-Dn11HT76.js").then((n) => n.n);
96
+ const { resolveMatrixTargets } = await import("./resolve-targets-nNMcrV3W.js").then((n) => n.n);
109
97
  const results = await resolveMatrixTargets({
110
98
  cfg,
111
99
  accountId,
@@ -233,7 +221,7 @@ async function configureMatrixAccessPrompts(params) {
233
221
  resolvedIds.push(cleaned);
234
222
  continue;
235
223
  }
236
- const { listMatrixDirectoryGroupsLive } = await import("./directory-live-B6fbX6jf.js").then((n) => n.t);
224
+ const { listMatrixDirectoryGroupsLive } = await import("./directory-live-YRgYDx2w.js").then((n) => n.t);
237
225
  const matches = await listMatrixDirectoryGroupsLive({
238
226
  cfg: next,
239
227
  accountId: params.accountId,
@@ -258,25 +246,39 @@ async function configureMatrixAccessPrompts(params) {
258
246
  accountId: params.accountId
259
247
  });
260
248
  }
261
- const dmPolicy = {
249
+ const dmPolicy = createChannelDmPolicy({
262
250
  label: "Matrix",
263
251
  channel,
264
- policyKey: "channels.matrix.dm.policy",
265
- allowFromKey: "channels.matrix.dm.allowFrom",
266
- resolveConfigKeys: (cfg, accountId) => {
267
- const effectiveAccountId = resolveMatrixOnboardingAccountId(cfg, accountId);
252
+ policyPath: "dm.policy",
253
+ allowFromPath: "dm.allowFrom",
254
+ resolveAccount: (cfg, accountId) => {
255
+ const accountIdResolved = resolveMatrixOnboardingAccountId(cfg, accountId);
256
+ const config = resolveMatrixAccountConfig({
257
+ cfg,
258
+ accountId: accountIdResolved
259
+ });
268
260
  return {
269
- policyKey: resolveMatrixConfigFieldPath(cfg, effectiveAccountId, "dm.policy"),
270
- allowFromKey: resolveMatrixConfigFieldPath(cfg, effectiveAccountId, "dm.allowFrom")
261
+ accountId: accountIdResolved,
262
+ config: {
263
+ dmPolicy: config.dm?.policy,
264
+ allowFrom: config.dm?.allowFrom,
265
+ dm: config.dm
266
+ }
271
267
  };
272
268
  },
273
- getCurrent: (cfg, accountId) => resolveMatrixAccountConfig({
274
- cfg,
275
- accountId: resolveMatrixOnboardingAccountId(cfg, accountId)
276
- }).dm?.policy ?? "pairing",
277
- setPolicy: (cfg, policy, accountId) => setMatrixDmPolicy(cfg, policy, accountId),
269
+ resolveConfigKeys: ({ cfg, account }) => ({
270
+ policyKey: resolveMatrixConfigFieldPath(cfg, account.accountId, "dm.policy"),
271
+ allowFromKey: resolveMatrixConfigFieldPath(cfg, account.accountId, "dm.allowFrom")
272
+ }),
273
+ resolveAllowFrom: ({ policy, account }) => resolveMatrixSetupDmAllowFrom(policy, account.config.allowFrom),
274
+ buildPatch: ({ account, policy, allowFrom }) => ({ dm: {
275
+ ...account.config.dm,
276
+ policy,
277
+ allowFrom
278
+ } }),
279
+ applyPatch: ({ cfg, account, patch }) => updateMatrixAccountConfig(cfg, account.accountId, patch),
278
280
  promptAllowFrom: promptMatrixAllowFrom
279
- };
281
+ });
280
282
  async function runMatrixConfigure(params) {
281
283
  let next = params.cfg;
282
284
  await ensureMatrixSdkInstalled({
@@ -510,7 +512,7 @@ const matrixOnboardingAdapter = {
510
512
  });
511
513
  },
512
514
  afterConfigWritten: async ({ previousCfg, cfg, accountId, runtime }) => {
513
- const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-C9w01xQK.js");
515
+ const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-BBGpPKgy.js");
514
516
  await runMatrixSetupBootstrapAfterConfigWrite({
515
517
  previousCfg,
516
518
  cfg,
@@ -5,18 +5,18 @@ import { o as resolveMatrixBaseConfig, r as listNormalizedMatrixAccountIds, t as
5
5
  import { i as resolveScopedMatrixEnvConfig, n as resolveGlobalMatrixEnvConfig } from "./env-auth-CQsYbz-p.js";
6
6
  import { t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.js";
7
7
  import { t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
8
- import { s as repairCurrentTokenStorageMetaDeviceId } from "./storage-BrkTJZov.js";
8
+ import { s as repairCurrentTokenStorageMetaDeviceId } from "./storage-BvAkgzvT.js";
9
9
  import { n as LogService } from "./logger-D0GCSDQq.js";
10
10
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
11
11
  import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, normalizeAccountId as normalizeAccountId$1, normalizeOptionalAccountId, normalizeOptionalAccountId as normalizeOptionalAccountId$1 } from "openclaw/plugin-sdk/account-id";
12
12
  import { coerceSecretRef, normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input-runtime";
13
- import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
13
+ import { formatErrorMessage, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
14
14
  import { isPrivateNetworkOptInEnabled, ssrfPolicyFromDangerouslyAllowPrivateNetwork as ssrfPolicyFromDangerouslyAllowPrivateNetwork$1 } from "openclaw/plugin-sdk/ssrf-runtime";
15
15
  import { resolveOptionalIntegerOption } from "openclaw/plugin-sdk/number-runtime";
16
16
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
17
17
  import { retryAsync } from "openclaw/plugin-sdk/retry-runtime";
18
18
  //#region extensions/matrix/src/matrix/client/config.ts
19
- const loadDefaultMatrixAuthClientDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-DiRXiRRf.js"), import("./logging-QH-48Gr6.js")]).then(([sdkModule, loggingModule]) => ({
19
+ const loadDefaultMatrixAuthClientDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-UzPd8tst.js"), import("./logging-DV-p52N0.js").then((n) => n.n)]).then(([sdkModule, loggingModule]) => ({
20
20
  MatrixClient: sdkModule.MatrixClient,
21
21
  ensureMatrixSdkLoggingConfigured: loggingModule.ensureMatrixSdkLoggingConfigured
22
22
  })));
@@ -470,17 +470,10 @@ async function awaitMatrixStartupWithAbort(promise, abortSignal) {
470
470
  resolve(value);
471
471
  }, (error) => {
472
472
  abortSignal.removeEventListener("abort", onAbort);
473
- reject(toLintErrorObject(error, "Non-Error rejection"));
473
+ reject(toErrorObject(error, "Non-Error rejection"));
474
474
  });
475
475
  });
476
476
  }
477
- function toLintErrorObject(value, fallbackMessage) {
478
- if (value instanceof Error) return value;
479
- if (typeof value === "string") return new Error(value);
480
- const error = new Error(fallbackMessage, { cause: value });
481
- if (typeof value === "object" && value !== null || typeof value === "function") Object.assign(error, value);
482
- return error;
483
- }
484
477
  //#endregion
485
478
  //#region extensions/matrix/src/matrix/client/shared.ts
486
479
  var shared_exports = /* @__PURE__ */ __exportAll({
@@ -492,7 +485,7 @@ var shared_exports = /* @__PURE__ */ __exportAll({
492
485
  stopSharedClientForAccount: () => stopSharedClientForAccount,
493
486
  stopSharedClientInstance: () => stopSharedClientInstance
494
487
  });
495
- const loadMatrixCreateClientDeps = createLazyRuntimeModule(() => import("./create-client-Und1YmJ2.js").then((n) => n.n).then((runtime) => ({ createMatrixClient: runtime.createMatrixClient })));
488
+ const loadMatrixCreateClientDeps = createLazyRuntimeModule(() => import("./create-client-f-CkRllE.js").then((n) => n.n).then((runtime) => ({ createMatrixClient: runtime.createMatrixClient })));
496
489
  const sharedClientStates = /* @__PURE__ */ new Map();
497
490
  const sharedClientPromises = /* @__PURE__ */ new Map();
498
491
  function serializeDispatcherPolicyKey(auth) {
@@ -1,6 +1,6 @@
1
1
  import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
2
2
  import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
3
- import { M as resolveMatrixSqliteStateEnv, l as resolveMatrixStoragePaths, o as recordCurrentStorageMetaDeviceId } from "./storage-BrkTJZov.js";
3
+ import { M as resolveMatrixSqliteStateEnv, l as resolveMatrixStoragePaths, o as recordCurrentStorageMetaDeviceId } from "./storage-BvAkgzvT.js";
4
4
  import { createHash } from "node:crypto";
5
5
  import path from "node:path";
6
6
  import { timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
@@ -362,9 +362,8 @@ function openMatrixStorageMetaStoreOptions(storageRootDir) {
362
362
  function openStorageMetaStore(rootDir) {
363
363
  return getMatrixRuntime().state.openSyncKeyedStore(openMatrixStorageMetaStoreOptions(rootDir));
364
364
  }
365
- function scoreStorageRoot(rootDir) {
365
+ function scoreStorageRoot(rootDir, metadata = readStoredRootMetadata(rootDir)) {
366
366
  let score = 0;
367
- const metadata = readStoredRootMetadata(rootDir);
368
367
  if (Object.keys(metadata).length > 0) score += 1;
369
368
  if (metadata.currentTokenStateClaimed === true) score += 8;
370
369
  if (fs.existsSync(path.join(rootDir, "crypto"))) score += 8;
@@ -417,8 +416,16 @@ function isCompatibleStorageRoot(params) {
417
416
  return true;
418
417
  }
419
418
  function resolvePreferredMatrixStorageRoot(params) {
419
+ const canonical = {
420
+ rootDir: params.canonicalRootDir,
421
+ tokenHash: params.canonicalTokenHash
422
+ };
423
+ const deviceId = params.deviceId?.trim();
424
+ if (!deviceId) return canonical;
425
+ const canonicalMetadata = readStoredRootMetadata(params.canonicalRootDir);
426
+ if (canonicalMetadata.accessTokenHash === params.canonicalTokenHash && canonicalMetadata.deviceId?.trim() === deviceId && canonicalMetadata.currentTokenStateClaimed === true) return canonical;
420
427
  const parentDir = path.dirname(params.canonicalRootDir);
421
- const bestCurrentScore = scoreStorageRoot(params.canonicalRootDir);
428
+ const bestCurrentScore = scoreStorageRoot(params.canonicalRootDir, canonicalMetadata);
422
429
  const bestCurrentMtimeMs = resolveStorageRootMtimeMs(params.canonicalRootDir);
423
430
  let best = {
424
431
  rootDir: params.canonicalRootDir,
@@ -426,10 +433,6 @@ function resolvePreferredMatrixStorageRoot(params) {
426
433
  score: bestCurrentScore,
427
434
  mtimeMs: bestCurrentMtimeMs
428
435
  };
429
- if (!params.deviceId?.trim()) return {
430
- rootDir: best.rootDir,
431
- tokenHash: best.tokenHash
432
- };
433
436
  let siblingEntries;
434
437
  try {
435
438
  siblingEntries = fs.readdirSync(parentDir, { withFileTypes: true });
@@ -450,8 +453,8 @@ function resolvePreferredMatrixStorageRoot(params) {
450
453
  homeserver: params.homeserver,
451
454
  userId: params.userId,
452
455
  accountKey: params.accountKey,
453
- deviceId: params.deviceId,
454
- requireExplicitDeviceMatch: Boolean(params.deviceId)
456
+ deviceId,
457
+ requireExplicitDeviceMatch: true
455
458
  })) continue;
456
459
  const candidateScore = scoreStorageRoot(candidateRootDir);
457
460
  if (candidateScore <= 0) continue;
@@ -463,15 +466,12 @@ function resolvePreferredMatrixStorageRoot(params) {
463
466
  mtimeMs: resolveStorageRootMtimeMs(candidateRootDir)
464
467
  });
465
468
  }
466
- const canonicalMetadata = readStoredRootMetadata(params.canonicalRootDir);
467
- if (!(canonicalMetadata.accessTokenHash === params.canonicalTokenHash && canonicalMetadata.deviceId?.trim() === params.deviceId.trim() && canonicalMetadata.currentTokenStateClaimed === true)) {
468
- for (const candidate of compatiblePopulatedSiblings) if (candidate.score > best.score || best.rootDir !== params.canonicalRootDir && candidate.score === best.score && candidate.mtimeMs > best.mtimeMs) best = {
469
- rootDir: candidate.rootDir,
470
- tokenHash: candidate.tokenHash,
471
- score: candidate.score,
472
- mtimeMs: candidate.mtimeMs
473
- };
474
- }
469
+ for (const candidate of compatiblePopulatedSiblings) if (candidate.score > best.score || best.rootDir !== params.canonicalRootDir && candidate.score === best.score && candidate.mtimeMs > best.mtimeMs) best = {
470
+ rootDir: candidate.rootDir,
471
+ tokenHash: candidate.tokenHash,
472
+ score: candidate.score,
473
+ mtimeMs: candidate.mtimeMs
474
+ };
475
475
  if (populatedTokenHashes.length > 1) getMatrixRuntime().logging.getChildLogger({ module: "matrix-storage" }).warn("matrix: multiple populated token-hash storage roots detected", {
476
476
  parentDir,
477
477
  canonicalTokenHash: params.canonicalTokenHash,
@@ -526,7 +526,7 @@ function resolveMatrixStateFilePath(params) {
526
526
  }
527
527
  async function maybeMigrateLegacyStorage(params) {
528
528
  const hasAccountScopedLegacyStorageFile = fs.existsSync(params.storagePaths.storagePath);
529
- const syncCache = hasAccountScopedLegacyStorageFile ? await import("./file-sync-store-DUEWCEjb.js").then((n) => n.n) : null;
529
+ const syncCache = hasAccountScopedLegacyStorageFile ? await import("./file-sync-store-DiiFsayX.js").then((n) => n.n) : null;
530
530
  const hasAccountScopedLegacyStorage = hasAccountScopedLegacyStorageFile && await syncCache?.readLegacyMatrixSyncCacheState(params.storagePaths.rootDir) !== null;
531
531
  const hasAccountScopedRecoveryKey = fs.existsSync(params.storagePaths.recoveryKeyPath);
532
532
  const hasAccountScopedLegacyCryptoMigration = fs.existsSync(path.join(params.storagePaths.rootDir, MATRIX_LEGACY_CRYPTO_MIGRATION_FILENAME));
@@ -573,7 +573,7 @@ async function maybeMigrateLegacyStorage(params) {
573
573
  if (skippedExistingTargets.length > 0) logger.warn?.(`matrix: legacy client storage files were left in place because their migrated targets already existed.\n${skippedExistingTargets.join("\n")}`);
574
574
  }
575
575
  async function migrateLegacySyncCacheToSqlite(params) {
576
- const syncCache = await import("./file-sync-store-DUEWCEjb.js").then((n) => n.n);
576
+ const syncCache = await import("./file-sync-store-DiiFsayX.js").then((n) => n.n);
577
577
  const persisted = await syncCache.readLegacyMatrixSyncCacheState(params.sourceRootDir);
578
578
  if (!persisted) return;
579
579
  const store = getMatrixRuntime().state.openKeyedStore(syncCache.openMatrixSyncCacheStoreOptions(params.targetRootDir));
@@ -1,12 +1,13 @@
1
1
  import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
2
2
  import { a as listBindingsForAccount, c as resolveBindingKey, f as setMatrixThreadBindingManagerEntry, h as toSessionBindingRecord, l as resolveEffectiveBindingExpiry, m as toMatrixBindingTargetKind, o as removeBindingRecord, r as getMatrixThreadBindingManagerEntry, t as deleteMatrixThreadBindingManagerEntry, u as setBindingRecord } from "./thread-bindings-shared-CKnY4LSd.js";
3
- import { M as resolveMatrixSqliteStateEnv, N as resolveMatrixSqliteStateKey, c as resolveMatrixStateFilePath, t as claimCurrentTokenStorageState } from "./storage-BrkTJZov.js";
4
- import { a as sendMessageMatrix } from "./send-CZCmDQu8.js";
3
+ import { M as resolveMatrixSqliteStateEnv, N as resolveMatrixSqliteStateKey, c as resolveMatrixStateFilePath, t as claimCurrentTokenStorageState } from "./storage-BvAkgzvT.js";
4
+ import { r as sendMessageMatrix } from "./send-C9Ssx-iV.js";
5
5
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
6
  import { createHash } from "node:crypto";
7
7
  import path from "node:path";
8
8
  import { registerSessionBindingAdapter, resolveThreadBindingFarewellText, unregisterSessionBindingAdapter } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
9
9
  import fs from "node:fs/promises";
10
+ import { resolveDefaultAgentId } from "openclaw/plugin-sdk/agent-runtime";
10
11
  import { readJsonFileWithFallback } from "openclaw/plugin-sdk/json-store";
11
12
  import { resolveAgentIdFromSessionKey } from "openclaw/plugin-sdk/session-key-runtime";
12
13
  //#region extensions/matrix/src/matrix/thread-bindings.ts
@@ -353,7 +354,7 @@ async function createMatrixThreadBindingManager(params) {
353
354
  ...boundParentConversationId ? { parentConversationId: boundParentConversationId } : {},
354
355
  targetKind: toMatrixBindingTargetKind(input.targetKind),
355
356
  targetSessionKey,
356
- agentId: normalizeOptionalString(input.metadata?.agentId) || resolveAgentIdFromSessionKey(targetSessionKey),
357
+ agentId: normalizeOptionalString(input.metadata?.agentId) || resolveAgentIdFromSessionKey(targetSessionKey, resolveDefaultAgentId(params.cfg)),
357
358
  label: normalizeOptionalString(input.metadata?.label) || void 0,
358
359
  boundBy: normalizeOptionalString(input.metadata?.boundBy) || "system",
359
360
  boundAt: now,
@@ -1,15 +1,15 @@
1
1
  import { a as resolveMatrixAccountConfig, o as resolveMatrixBaseConfig } from "./account-config-BZWN9tGS.js";
2
- import { _ as resolveMatrixAccount } from "./setup-core-D6gyoyeg.js";
3
- import { r as resolveMatrixRoomConfig } from "./channel-MBtrY36B.js";
2
+ import { _ as resolveMatrixAccount } from "./setup-core-a542Ernq.js";
3
+ import { r as resolveMatrixRoomConfig } from "./channel-Cmi248PA.js";
4
4
  import { r as normalizeMatrixResolvableTarget } from "./target-ids-B-5aQxwn.js";
5
- import { E as parsePollStart, T as isPollStartType, _ as readJoinedMatrixMembers, b as buildPollResponseContent, g as isStrictDirectMembership, h as hasDirectMatrixMemberFlag, i as reactMatrixMessage, u as resolveMatrixRoomId } from "./send-CZCmDQu8.js";
5
+ import { E as parsePollStart, T as isPollStartType, b as buildPollResponseContent, c as resolveMatrixRoomId, h as readJoinedMatrixMembers, m as isStrictDirectMembership, n as reactMatrixMessage, p as hasDirectMatrixMemberFlag } from "./send-C9Ssx-iV.js";
6
6
  import { i as buildMatrixReactionRelationsPath, o as selectOwnMatrixReactionEventIds, s as summarizeMatrixReactionEvents } from "./reaction-common-DkrQdBSZ.js";
7
- import { n as withResolvedActionClient, r as withResolvedRoomAction } from "./client-BwX6rURh.js";
8
- import { a as fetchEventSummary, c as resolveMatrixActionLimit, i as sendMatrixMessage, n as editMatrixMessage, o as readPinnedEvents, r as readMatrixMessages, s as EventType, t as deleteMatrixMessage } from "./messages-ClTgfFl6.js";
7
+ import { n as withResolvedActionClient, r as withResolvedRoomAction } from "./client-CitERujx.js";
8
+ import { a as fetchEventSummary, c as resolveMatrixActionLimit, i as sendMatrixMessage, n as editMatrixMessage, o as readPinnedEvents, r as readMatrixMessages, s as EventType, t as deleteMatrixMessage } from "./messages-Bf_s--M9.js";
9
9
  import { c as readReactionParams, d as resolveAllowlistProviderRuntimeGroupPolicy, f as resolveDefaultGroupPolicy, i as createActionGate, l as readStringArrayParam, n as ToolAuthorizationError, o as jsonResult, s as readPositiveIntegerParam, u as readStringParam } from "./runtime-api-D1xI_cvh.js";
10
- import { t as applyMatrixProfileUpdate } from "./profile-update-C2My3TML.js";
11
- import { _ as scanMatrixVerificationQr, a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, h as restoreMatrixRoomKeyBackup, i as confirmMatrixVerificationReciprocateQr, l as getMatrixVerificationSas, n as bootstrapMatrixVerification, o as generateMatrixVerificationQr, p as requestMatrixVerification, r as cancelMatrixVerification, s as getMatrixEncryptionStatus, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-DhMBWxOJ.js";
12
- import { t as createMatrixRoomInfoResolver } from "./room-info-B6vKD5DF.js";
10
+ import { t as applyMatrixProfileUpdate } from "./profile-update-z3aM46KS.js";
11
+ import { _ as scanMatrixVerificationQr, a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, h as restoreMatrixRoomKeyBackup, i as confirmMatrixVerificationReciprocateQr, l as getMatrixVerificationSas, n as bootstrapMatrixVerification, o as generateMatrixVerificationQr, p as requestMatrixVerification, r as cancelMatrixVerification, s as getMatrixEncryptionStatus, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-ZdAXdmuh.js";
12
+ import { t as createMatrixRoomInfoResolver } from "./room-info-CAFZ3Z9J.js";
13
13
  import { normalizeOptionalLowercaseString, uniqueStrings, uniqueValues } from "openclaw/plugin-sdk/string-coerce-runtime";
14
14
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
15
15
  //#region extensions/matrix/src/matrix/actions/polls.ts
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { i as withStartedActionClient, n as withResolvedActionClient } from "./client-BwX6rURh.js";
2
+ import { i as withStartedActionClient, n as withResolvedActionClient } from "./client-CitERujx.js";
3
3
  import { n as formatMatrixEncryptionUnavailableError } from "./encryption-guidance-CbEFe38F.js";
4
4
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/matrix",
3
- "version": "2026.7.2-beta.4",
3
+ "version": "2026.7.2-beta.5",
4
4
  "description": "OpenClaw Matrix channel plugin for rooms and direct messages.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,7 +18,7 @@
18
18
  "zod": "4.4.3"
19
19
  },
20
20
  "peerDependencies": {
21
- "openclaw": ">=2026.7.2-beta.4"
21
+ "openclaw": ">=2026.7.2-beta.5"
22
22
  },
23
23
  "peerDependenciesMeta": {
24
24
  "openclaw": {
@@ -167,10 +167,10 @@
167
167
  "allowInvalidConfigRecovery": true
168
168
  },
169
169
  "compat": {
170
- "pluginApi": ">=2026.7.2-beta.4"
170
+ "pluginApi": ">=2026.7.2-beta.5"
171
171
  },
172
172
  "build": {
173
- "openclawVersion": "2026.7.2-beta.4"
173
+ "openclawVersion": "2026.7.2-beta.5"
174
174
  },
175
175
  "release": {
176
176
  "publishToClawHub": true,
@@ -184,7 +184,6 @@
184
184
  "files": [
185
185
  "dist/**",
186
186
  "openclaw.plugin.json",
187
- "npm-shrinkwrap.json",
188
187
  "README.md"
189
188
  ],
190
189
  "bundledDependencies": [
@@ -1,3 +0,0 @@
1
- import { t as createMatrixClient } from "./create-client-Und1YmJ2.js";
2
- import "./client-Dg8dk8NW.js";
3
- export { createMatrixClient };