@openclaw/matrix 2026.9.1 → 2026.9.2

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 (57) hide show
  1. package/dist/api.js +4 -4
  2. package/dist/{approval-handler.runtime-B_6ytY5I.js → approval-handler.runtime-BJCD4dLf.js} +3 -3
  3. package/dist/{approval-ids-CfHtZ9d1.js → approval-ids-Bst7HM_o.js} +1 -1
  4. package/dist/{approval-reaction-auth-BpDvJqfy.js → approval-reaction-auth-DhH8QOSe.js} +1 -1
  5. package/dist/{channel-b-jES-oi.js → channel-Bs8VLb6q.js} +6 -6
  6. package/dist/channel-plugin-api.js +1 -1
  7. package/dist/{channel.runtime-BkqjwEDU.js → channel.runtime-CCJRhdH5.js} +2 -2
  8. package/dist/{channel.setup-BY42QaL7.js → channel.setup-DhmDXwPp.js} +6 -3
  9. package/dist/{cli-CtYeU7ol.js → cli-IvDUuiDH.js} +147 -113
  10. package/dist/{cli-metadata-B7MQjR5S.js → cli-metadata-BGryAl2e.js} +1 -1
  11. package/dist/cli-metadata.js +1 -1
  12. package/dist/{client-D2utPQ1E.js → client-oNOlldJI.js} +1 -1
  13. package/dist/contract-api.js +2 -2
  14. package/dist/doctor-contract-api.js +2 -2
  15. package/dist/{draft-stream-DPYdv4fE.js → draft-stream-DglwxWzJ.js} +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/{messages-C1U3b1oN.js → messages-Czn8lNEh.js} +2 -2
  18. package/dist/{monitor-SNnu-0bp.js → monitor-DouG43FJ.js} +35 -38
  19. package/dist/{outbound-CeCEtF_q.js → outbound-Co_tJyE6.js} +1 -1
  20. package/dist/plugin-entry.handlers.runtime.js +1 -1
  21. package/dist/{profile-update-Cd1p8ABr.js → profile-update-CAl8nZNG.js} +1 -1
  22. package/dist/{reaction-events-DveJRUaX.js → reaction-events-C_7G7bvI.js} +3 -3
  23. package/dist/{room-info-DVkKDscD.js → room-info-6viLR3NH.js} +3 -3
  24. package/dist/{send-DG7Bnj7_.js → send-B5XChnvB.js} +5 -9
  25. package/dist/session-binding-contract-api.js +1 -1
  26. package/dist/{setup-bootstrap-Co985F63.js → setup-bootstrap-S_loyUyM.js} +1 -1
  27. package/dist/{setup-core-CEF6exLW.js → setup-core-XkIfQ65J.js} +1 -1
  28. package/dist/setup-plugin-api.js +1 -1
  29. package/dist/{setup-surface-BSlj1vnL.js → setup-surface-B2yZ8KGc.js} +2 -2
  30. package/dist/{thread-bindings-DgxQEB99.js → thread-bindings-BkBnn4te.js} +1 -1
  31. package/dist/{tool-actions.runtime-vbkQgU7D.js → tool-actions.runtime-a5L5xGSP.js} +7 -7
  32. package/dist/{verification-D-iOebn4.js → verification-XJtTc5DI.js} +1 -1
  33. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs +216 -183
  34. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs.map +1 -1
  35. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js +7 -7
  36. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js.map +1 -1
  37. package/node_modules/markdown-it/dist/markdown-it.cjs.js +98 -106
  38. package/node_modules/markdown-it/dist/markdown-it.cjs.js.map +1 -1
  39. package/node_modules/markdown-it/dist/markdown-it.d.mts +42 -71
  40. package/node_modules/markdown-it/dist/markdown-it.mjs +98 -106
  41. package/node_modules/markdown-it/dist/markdown-it.mjs.map +1 -1
  42. package/node_modules/markdown-it/package.json +1 -2
  43. package/node_modules/typebox/build/format/json_pointer.d.mts +2 -2
  44. package/node_modules/typebox/build/format/json_pointer.mjs +2 -2
  45. package/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +2 -2
  46. package/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +2 -2
  47. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  48. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  49. package/node_modules/typebox/build/system/memory/assign.mjs +2 -1
  50. package/node_modules/typebox/build/system/memory/create.mjs +3 -4
  51. package/node_modules/typebox/build/system/memory/discard.mjs +2 -2
  52. package/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
  53. package/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
  54. package/node_modules/typebox/build/system/memory/update.mjs +3 -2
  55. package/node_modules/typebox/package.json +1 -1
  56. package/openclaw.plugin.json +1 -2
  57. package/package.json +6 -6
package/dist/api.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { a as resolveMatrixDefaultOrOnlyAccountId, i as resolveMatrixChannelConfig, n as requiresExplicitMatrixDefaultAccount, r as resolveConfiguredMatrixAccountIds, t as findMatrixAccountEntry } from "./account-selection-DA-jfx22.js";
2
2
  import { n as listMatrixEnvAccountIds, r as resolveMatrixEnvAccountToken, t as getMatrixScopedEnvVarNames } from "./env-vars-dGqak9dN.js";
3
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 { t as matrixPlugin } from "./channel-b-jES-oi.js";
5
- import { n as matrixSetupAdapter, t as createMatrixSetupWizardProxy } from "./setup-core-CEF6exLW.js";
4
+ import { t as matrixPlugin } from "./channel-Bs8VLb6q.js";
5
+ import { n as matrixSetupAdapter, t as createMatrixSetupWizardProxy } from "./setup-core-XkIfQ65J.js";
6
6
  import { f as setMatrixThreadBindingMaxAgeBySessionKey, n as getMatrixThreadBindingManager, u as setMatrixThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings-shared-oNPiyMWY.js";
7
- import { n as matrixOnboardingAdapter } from "./setup-surface-BSlj1vnL.js";
8
- import { t as createMatrixThreadBindingManager } from "./thread-bindings-DgxQEB99.js";
7
+ import { n as matrixOnboardingAdapter } from "./setup-surface-B2yZ8KGc.js";
8
+ import { t as createMatrixThreadBindingManager } from "./thread-bindings-BkBnn4te.js";
9
9
  export { createMatrixSetupWizardProxy, createMatrixThreadBindingManager, findMatrixAccountEntry, getMatrixScopedEnvVarNames, getMatrixThreadBindingManager, hashMatrixAccessToken, listMatrixEnvAccountIds, matrixOnboardingAdapter, matrixOnboardingAdapter as matrixSetupWizard, matrixPlugin, matrixSetupAdapter, requiresExplicitMatrixDefaultAccount, resolveConfiguredMatrixAccountIds, resolveMatrixAccountStorageRoot, resolveMatrixChannelConfig, resolveMatrixCredentialsDir, resolveMatrixCredentialsFilename, resolveMatrixCredentialsPath, resolveMatrixDefaultOrOnlyAccountId, resolveMatrixEnvAccountToken, resolveMatrixHomeserverKey, sanitizeMatrixPathSegment, setMatrixThreadBindingIdleTimeoutBySessionKey, setMatrixThreadBindingMaxAgeBySessionKey };
@@ -1,9 +1,9 @@
1
1
  import { i as resolveMatrixAccount } from "./accounts-DR1c4xF_.js";
2
- import { C as shouldHandleMatrixApprovalRequest, S as isMatrixAnyApprovalClientEnabled } from "./channel-b-jES-oi.js";
2
+ import { C as shouldHandleMatrixApprovalRequest, S as isMatrixAnyApprovalClientEnabled } from "./channel-Bs8VLb6q.js";
3
3
  import { o as resolveMatrixTargetIdentity } from "./target-ids-Nwx7cMVE.js";
4
- import { C as repairMatrixDirectRooms, a as sendSingleTextMessageMatrix, n as reactMatrixMessage, r as sendMessageMatrix } from "./send-DG7Bnj7_.js";
4
+ import { C as repairMatrixDirectRooms, a as sendSingleTextMessageMatrix, n as reactMatrixMessage, r as sendMessageMatrix } from "./send-B5XChnvB.js";
5
5
  import { a as unregisterMatrixApprovalReactionTarget, n as listMatrixApprovalReactionBindings, r as registerMatrixApprovalReactionTarget, t as buildMatrixApprovalReactionHint } from "./approval-reactions-1fwEhoK9.js";
6
- import { n as editMatrixMessage, t as deleteMatrixMessage } from "./messages-C1U3b1oN.js";
6
+ import { n as editMatrixMessage, t as deleteMatrixMessage } from "./messages-Czn8lNEh.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 "./channel.setup-BY42QaL7.js";
1
+ import { a as normalizeMatrixUserId } from "./channel.setup-DhmDXwPp.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
1
  import { i as resolveMatrixAccount } from "./accounts-DR1c4xF_.js";
2
- import { t as normalizeMatrixApproverId } from "./approval-ids-CfHtZ9d1.js";
2
+ import { t as normalizeMatrixApproverId } from "./approval-ids-Bst7HM_o.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,8 +1,8 @@
1
1
  import { n as requiresExplicitMatrixDefaultAccount } from "./account-selection-DA-jfx22.js";
2
2
  import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
3
3
  import { i as resolveMatrixAccount, r as resolveDefaultMatrixAccountId, t as listMatrixAccountIds } from "./accounts-DR1c4xF_.js";
4
- import { a as normalizeMatrixUserId, r as DEFAULT_ACCOUNT_ID$2, t as matrixPluginBase } from "./channel.setup-BY42QaL7.js";
5
- import { t as normalizeMatrixApproverId } from "./approval-ids-CfHtZ9d1.js";
4
+ import { a as normalizeMatrixUserId, r as DEFAULT_ACCOUNT_ID$2, t as matrixPluginBase } from "./channel.setup-DhmDXwPp.js";
5
+ import { t as normalizeMatrixApproverId } from "./approval-ids-Bst7HM_o.js";
6
6
  import { a as resolveMatrixDirectUserId, i as normalizeMatrixResolvableTarget, n as isMatrixRoomId, o as resolveMatrixTargetIdentity, r as normalizeMatrixMessagingTarget, t as isMatrixQualifiedUserId } from "./target-ids-Nwx7cMVE.js";
7
7
  import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-HyWFZQVG.js";
8
8
  import { n as MATRIX_REACTION_EVENT_TYPE } from "./reaction-common-DkrQdBSZ.js";
@@ -149,7 +149,7 @@ const matrixMessageActions = {
149
149
  return account && createActionGate(account.config.actions)("messages") ? payload : null;
150
150
  },
151
151
  handleAction: async (ctx) => {
152
- const { handleMatrixAction } = await import("./tool-actions.runtime-vbkQgU7D.js");
152
+ const { handleMatrixAction } = await import("./tool-actions.runtime-a5L5xGSP.js");
153
153
  const { action, params, cfg, accountId, mediaLocalRoots } = ctx;
154
154
  const dispatch = async (actionParams) => await handleMatrixAction({
155
155
  ...actionParams,
@@ -634,7 +634,7 @@ const matrixNativeApprovalCapability = createApproverRestrictedNativeApprovalCap
634
634
  approvalKind,
635
635
  request
636
636
  }),
637
- load: async () => (await import("./approval-handler.runtime-B_6ytY5I.js")).matrixApprovalNativeRuntime
637
+ load: async () => (await import("./approval-handler.runtime-BJCD4dLf.js")).matrixApprovalNativeRuntime
638
638
  })
639
639
  });
640
640
  const splitMatrixApprovalCapability = splitChannelApprovalCapability(matrixNativeApprovalCapability);
@@ -1171,7 +1171,7 @@ function resolveMatrixOutboundSessionRoute(params) {
1171
1171
  //#endregion
1172
1172
  //#region extensions/matrix/src/channel.ts
1173
1173
  let matrixStartupLock = Promise.resolve();
1174
- const loadMatrixChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-BkqjwEDU.js"), "matrixChannelRuntime");
1174
+ const loadMatrixChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-CCJRhdH5.js"), "matrixChannelRuntime");
1175
1175
  const loadMatrixDoctorModule = createLazyRuntimeModule(() => import("./doctor-CJE8wO6y.js"));
1176
1176
  function buildMatrixTrafficStatusSummary(snapshot) {
1177
1177
  return {
@@ -1522,7 +1522,7 @@ const matrixPlugin = createChatChannelPlugin({
1522
1522
  await previousLock;
1523
1523
  let monitorMatrixProvider;
1524
1524
  try {
1525
- monitorMatrixProvider = (await import("./monitor-SNnu-0bp.js")).monitorMatrixProvider;
1525
+ monitorMatrixProvider = (await import("./monitor-DouG43FJ.js")).monitorMatrixProvider;
1526
1526
  } finally {
1527
1527
  releaseLock();
1528
1528
  }
@@ -1,2 +1,2 @@
1
- import { t as matrixPlugin } from "./channel-b-jES-oi.js";
1
+ import { t as matrixPlugin } from "./channel-Bs8VLb6q.js";
2
2
  export { matrixPlugin };
@@ -1,8 +1,8 @@
1
- import { o as sendTypingMatrix, r as sendMessageMatrix, v as cleanupMatrixDeliveryPlans, y as reconcileMatrixUnknownSend } from "./send-DG7Bnj7_.js";
1
+ import { o as sendTypingMatrix, r as sendMessageMatrix, v as cleanupMatrixDeliveryPlans, y as reconcileMatrixUnknownSend } from "./send-B5XChnvB.js";
2
2
  import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
3
3
  import { l as resolveMatrixAuth } from "./client-Dj4mcf-s.js";
4
4
  import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-DLUgWBhA.js";
5
- import { t as matrixOutbound } from "./outbound-CeCEtF_q.js";
5
+ import { t as matrixOutbound } from "./outbound-Co_tJyE6.js";
6
6
  import { t as resolveMatrixTargets } from "./resolve-targets-B64O69Nd.js";
7
7
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
8
8
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -1,6 +1,6 @@
1
1
  import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
2
2
  import { i as resolveMatrixAccount, r as resolveDefaultMatrixAccountId, t as listMatrixAccountIds } from "./accounts-DR1c4xF_.js";
3
- import { r as matrixSetupContract, t as createMatrixSetupWizardProxy } from "./setup-core-CEF6exLW.js";
3
+ import { r as matrixSetupContract, t as createMatrixSetupWizardProxy } from "./setup-core-XkIfQ65J.js";
4
4
  import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
5
5
  import { createChannelConfigUiHints } from "openclaw/plugin-sdk/channel-core";
6
6
  import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -314,7 +314,7 @@ const matrixPluginBase = {
314
314
  order: 70,
315
315
  quickstartAllowFrom: true
316
316
  },
317
- setupWizard: createMatrixSetupWizardProxy(async () => ({ matrixSetupWizard: (await import("./setup-surface-BSlj1vnL.js").then((n) => n.t)).matrixSetupWizard })),
317
+ setupWizard: createMatrixSetupWizardProxy(async () => ({ matrixSetupWizard: (await import("./setup-surface-B2yZ8KGc.js").then((n) => n.t)).matrixSetupWizard })),
318
318
  setupContract: matrixSetupContract,
319
319
  capabilities: {
320
320
  chatTypes: [
@@ -327,7 +327,10 @@ const matrixPluginBase = {
327
327
  threads: true,
328
328
  media: true
329
329
  },
330
- reload: { configPrefixes: ["channels.matrix"] },
330
+ reload: {
331
+ configPrefixes: ["channels.matrix"],
332
+ noopPrefixes: ["messages.ackReactionScope"]
333
+ },
331
334
  configSchema: MatrixChannelConfigSchema,
332
335
  config: {
333
336
  ...matrixConfigAdapter,
@@ -1,21 +1,23 @@
1
- import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
1
+ import { a as resolveMatrixAccountConfig, n as hasExplicitMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
2
2
  import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
3
3
  import { i as resolveMatrixAccount } from "./accounts-DR1c4xF_.js";
4
4
  import { n as resolveMatrixConfigPath, r as updateMatrixAccountConfig } from "./config-update-BnX26jCO.js";
5
- import { n as matrixSetupAdapter } from "./setup-core-CEF6exLW.js";
6
- import { n as withResolvedActionClient } from "./client-D2utPQ1E.js";
5
+ import { n as matrixSetupAdapter } from "./setup-core-XkIfQ65J.js";
6
+ import { n as withResolvedActionClient } from "./client-oNOlldJI.js";
7
7
  import { u as resolveMatrixAuthContext } from "./client-Dj4mcf-s.js";
8
8
  import { t as resolveMatrixRoomKeyBackupIssue } from "./backup-health-Dm_YMVFT.js";
9
9
  import { i as setMatrixSdkLogMode, r as setMatrixSdkConsoleLogging } from "./logging-DRjvUOIh.js";
10
10
  import { n as isOpenClawManagedMatrixDevice, r as summarizeMatrixDeviceHealth } from "./device-health-B4-YXtJR.js";
11
- import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update-Cd1p8ABr.js";
12
- import { a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, g as runMatrixSelfVerification, h as restoreMatrixRoomKeyBackup, l as getMatrixVerificationSas, m as resetMatrixRoomKeyBackup, n as bootstrapMatrixVerification, p as requestMatrixVerification, r as cancelMatrixVerification, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-D-iOebn4.js";
11
+ import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update-CAl8nZNG.js";
12
+ import { a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, g as runMatrixSelfVerification, h as restoreMatrixRoomKeyBackup, l as getMatrixVerificationSas, m as resetMatrixRoomKeyBackup, n as bootstrapMatrixVerification, p as requestMatrixVerification, r as cancelMatrixVerification, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-XJtTc5DI.js";
13
13
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
14
14
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
15
15
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
16
16
  import { parseStrictInteger, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
17
17
  import { formatZonedTimestamp } from "openclaw/plugin-sdk/time-runtime";
18
+ import { isDeepStrictEqual } from "node:util";
18
19
  import { readByteStreamWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
20
+ import { getRuntimeConfigSnapshot, getRuntimeConfigSourceSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
19
21
  //#region extensions/matrix/src/cli-shared.ts
20
22
  let matrixCliExitScheduled = false;
21
23
  const MATRIX_CLI_RECOVERY_KEY_STDIN_MAX_BYTES = 1048576;
@@ -73,6 +75,31 @@ function resolveMatrixCliAccountContext(accountId) {
73
75
  cfg
74
76
  };
75
77
  }
78
+ function createMatrixCliAccountConfigPublisher({ accountId, previousCfg }) {
79
+ const configApi = getMatrixRuntime().config;
80
+ const pairedSource = getRuntimeConfigSnapshot() === previousCfg ? getRuntimeConfigSourceSnapshot() : null;
81
+ const comparisonBase = pairedSource ? "sourceConfig" : "runtimeConfig";
82
+ const comparisonCfg = pairedSource ?? previousCfg;
83
+ const expectedChannelEnabled = comparisonCfg.channels?.matrix?.enabled !== false;
84
+ const expectedExists = hasExplicitMatrixAccountConfig(comparisonCfg, accountId);
85
+ const expectedAccount = structuredClone(resolveMatrixAccountConfig({
86
+ cfg: comparisonCfg,
87
+ accountId
88
+ }));
89
+ return async (update) => {
90
+ await configApi.mutateConfigFile({
91
+ afterWrite: { mode: "auto" },
92
+ mutate: (draft, { snapshot }) => {
93
+ const current = snapshot[comparisonBase];
94
+ if (current.channels?.matrix?.enabled !== false !== expectedChannelEnabled || hasExplicitMatrixAccountConfig(current, accountId) !== expectedExists || !isDeepStrictEqual(resolveMatrixAccountConfig({
95
+ cfg: current,
96
+ accountId
97
+ }), expectedAccount)) throw new Error(`Matrix account "${accountId}" changed during setup; review its configuration and run the setup command again.`);
98
+ draft.channels = update(draft).channels;
99
+ }
100
+ });
101
+ };
102
+ }
76
103
  function formatMatrixCliCommand(command, accountId) {
77
104
  return formatMatrixCliCommandParts(command.split(" "), accountId);
78
105
  }
@@ -369,8 +396,7 @@ async function pruneMatrixStaleGatewayDevices(opts = {}) {
369
396
  //#region extensions/matrix/src/cli-account.ts
370
397
  async function addMatrixAccount(params) {
371
398
  const initialSyncLimit = parseOptionalInt(params.initialSyncLimit, "--initial-sync-limit", { min: 0 });
372
- const runtime = getMatrixRuntime();
373
- const cfg = runtime.config.current();
399
+ const cfg = getMatrixRuntime().config.current();
374
400
  if (!matrixSetupAdapter.applyAccountConfig) throw new Error("Matrix account setup is unavailable.");
375
401
  const input = {
376
402
  name: params.name,
@@ -396,103 +422,108 @@ async function addMatrixAccount(params) {
396
422
  input
397
423
  });
398
424
  if (validationError) throw new Error(validationError);
399
- let updated = matrixSetupAdapter.applyAccountConfig({
400
- cfg,
425
+ const publishConfig = createMatrixCliAccountConfigPublisher({
401
426
  accountId,
402
- input
403
- });
404
- if (params.enableEncryption === true) updated = updateMatrixAccountConfig(updated, accountId, { encryption: true });
405
- await runtime.config.replaceConfigFile({
406
- nextConfig: updated,
407
- afterWrite: { mode: "auto" }
427
+ previousCfg: cfg
408
428
  });
429
+ const applyAccountConfig = (current) => {
430
+ const next = matrixSetupAdapter.applyAccountConfig({
431
+ cfg: current,
432
+ accountId,
433
+ input
434
+ });
435
+ return params.enableEncryption === true ? updateMatrixAccountConfig(next, accountId, { encryption: true }) : next;
436
+ };
437
+ let updated = applyAccountConfig(cfg);
438
+ let convertedAvatarUrl;
409
439
  const accountConfig = resolveMatrixAccountConfig({
410
440
  cfg: updated,
411
441
  accountId
412
442
  });
413
- let verificationBootstrap = {
414
- attempted: false,
415
- success: false,
416
- recoveryKeyCreatedAt: null,
417
- backupVersion: null
418
- };
419
- if (accountConfig.encryption === true) {
420
- const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-Co985F63.js");
421
- verificationBootstrap = await maybeBootstrapNewEncryptedMatrixAccount({
422
- previousCfg: cfg,
423
- cfg: updated,
424
- accountId
425
- });
426
- }
427
- const desiredDisplayName = input.name?.trim();
428
- const desiredAvatarUrl = input.avatarUrl?.trim();
429
- let profile = {
430
- attempted: false,
431
- displayNameUpdated: false,
432
- avatarUpdated: false,
433
- resolvedAvatarUrl: null,
434
- convertedAvatarFromHttp: false
435
- };
436
- if (desiredDisplayName || desiredAvatarUrl) try {
437
- const synced = await updateMatrixOwnProfile({
438
- cfg: updated,
439
- accountId,
440
- displayName: desiredDisplayName,
441
- avatarUrl: desiredAvatarUrl
442
- });
443
- let resolvedAvatarUrl = synced.resolvedAvatarUrl;
444
- if (synced.convertedAvatarFromHttp && synced.resolvedAvatarUrl) {
445
- const latestCfg = runtime.config.current();
446
- const withAvatar = updateMatrixAccountConfig(latestCfg, accountId, { avatarUrl: synced.resolvedAvatarUrl });
447
- await runtime.config.replaceConfigFile({
448
- nextConfig: withAvatar,
449
- afterWrite: { mode: "auto" }
443
+ try {
444
+ let verificationBootstrap = {
445
+ attempted: false,
446
+ success: false,
447
+ recoveryKeyCreatedAt: null,
448
+ backupVersion: null
449
+ };
450
+ if (accountConfig.encryption === true) {
451
+ const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-S_loyUyM.js");
452
+ verificationBootstrap = await maybeBootstrapNewEncryptedMatrixAccount({
453
+ previousCfg: cfg,
454
+ cfg: updated,
455
+ accountId
450
456
  });
451
- resolvedAvatarUrl = synced.resolvedAvatarUrl;
452
457
  }
453
- profile = {
454
- attempted: true,
455
- displayNameUpdated: synced.displayNameUpdated,
456
- avatarUpdated: synced.avatarUpdated,
457
- resolvedAvatarUrl,
458
- convertedAvatarFromHttp: synced.convertedAvatarFromHttp
459
- };
460
- } catch (err) {
461
- profile = {
462
- attempted: true,
458
+ const desiredDisplayName = input.name?.trim();
459
+ const desiredAvatarUrl = input.avatarUrl?.trim();
460
+ let profile = {
461
+ attempted: false,
463
462
  displayNameUpdated: false,
464
463
  avatarUpdated: false,
465
464
  resolvedAvatarUrl: null,
466
- convertedAvatarFromHttp: false,
467
- error: formatErrorMessage(err)
465
+ convertedAvatarFromHttp: false
468
466
  };
469
- }
470
- let deviceHealth;
471
- try {
472
- const addedDevices = await listMatrixOwnDevices({
467
+ if (desiredDisplayName || desiredAvatarUrl) try {
468
+ const synced = await updateMatrixOwnProfile({
469
+ cfg: updated,
470
+ accountId,
471
+ displayName: desiredDisplayName,
472
+ avatarUrl: desiredAvatarUrl
473
+ });
474
+ if (synced.convertedAvatarFromHttp && synced.resolvedAvatarUrl) {
475
+ convertedAvatarUrl = synced.resolvedAvatarUrl;
476
+ updated = updateMatrixAccountConfig(updated, accountId, { avatarUrl: synced.resolvedAvatarUrl });
477
+ }
478
+ profile = {
479
+ attempted: true,
480
+ displayNameUpdated: synced.displayNameUpdated,
481
+ avatarUpdated: synced.avatarUpdated,
482
+ resolvedAvatarUrl: synced.resolvedAvatarUrl,
483
+ convertedAvatarFromHttp: synced.convertedAvatarFromHttp
484
+ };
485
+ } catch (err) {
486
+ profile = {
487
+ attempted: true,
488
+ displayNameUpdated: false,
489
+ avatarUpdated: false,
490
+ resolvedAvatarUrl: null,
491
+ convertedAvatarFromHttp: false,
492
+ error: formatErrorMessage(err)
493
+ };
494
+ }
495
+ let deviceHealth;
496
+ try {
497
+ const addedDevices = await listMatrixOwnDevices({
498
+ accountId,
499
+ cfg: updated
500
+ });
501
+ deviceHealth = {
502
+ currentDeviceId: addedDevices.find((device) => device.current)?.deviceId ?? null,
503
+ staleOpenClawDeviceIds: addedDevices.filter((device) => !device.current && isOpenClawManagedMatrixDevice(device.displayName)).map((device) => device.deviceId)
504
+ };
505
+ } catch (err) {
506
+ deviceHealth = {
507
+ currentDeviceId: null,
508
+ staleOpenClawDeviceIds: [],
509
+ error: formatErrorMessage(err)
510
+ };
511
+ }
512
+ return {
473
513
  accountId,
474
- cfg: updated
475
- });
476
- deviceHealth = {
477
- currentDeviceId: addedDevices.find((device) => device.current)?.deviceId ?? null,
478
- staleOpenClawDeviceIds: addedDevices.filter((device) => !device.current && isOpenClawManagedMatrixDevice(device.displayName)).map((device) => device.deviceId)
479
- };
480
- } catch (err) {
481
- deviceHealth = {
482
- currentDeviceId: null,
483
- staleOpenClawDeviceIds: [],
484
- error: formatErrorMessage(err)
514
+ configPath: resolveMatrixConfigPath(updated, accountId),
515
+ useEnv: input.useEnv === true,
516
+ encryptionEnabled: accountConfig.encryption === true,
517
+ deviceHealth,
518
+ verificationBootstrap,
519
+ profile
485
520
  };
521
+ } finally {
522
+ await publishConfig((current) => {
523
+ const next = applyAccountConfig(current);
524
+ return convertedAvatarUrl ? updateMatrixAccountConfig(next, accountId, { avatarUrl: convertedAvatarUrl }) : next;
525
+ });
486
526
  }
487
- return {
488
- accountId,
489
- configPath: resolveMatrixConfigPath(updated, accountId),
490
- useEnv: input.useEnv === true,
491
- encryptionEnabled: accountConfig.encryption === true,
492
- deviceHealth,
493
- verificationBootstrap,
494
- profile
495
- };
496
527
  }
497
528
  function registerMatrixAccountCommands(root) {
498
529
  root.command("account").description("Manage matrix channel accounts").command("add").description("Add or update a matrix account (wrapper around channel setup)").option("--account <id>", "Account ID (default: normalized --name, else default)").option("--name <name>", "Optional display name for this account").option("--avatar-url <url>", "Optional Matrix avatar URL (mxc:// or http(s) URL)").option("--homeserver <url>", "Matrix homeserver URL").option("--proxy <url>", "Optional HTTP(S) proxy URL for Matrix requests").option("--allow-private-network", "Allow Matrix homeserver traffic to private/internal hosts for this account").option("--user-id <id>", "Matrix user ID").option("--access-token <token>", "Matrix access token").option("--password <password>", "Matrix password").option("--device-name <name>", "Matrix device display name").option("--initial-sync-limit <n>", "Matrix initial sync limit").option("--enable-e2ee", "Enable Matrix end-to-end encryption and bootstrap verification").option("--encryption", "Alias for --enable-e2ee").option("--use-env", "Use MATRIX_* env vars (or MATRIX_<ACCOUNT_ID>_* for non-default accounts)").option("--verbose", "Show setup details").option("--json", "Output as JSON").action(async (options) => {
@@ -605,8 +636,8 @@ function registerMatrixDeviceCommands(root) {
605
636
  }
606
637
  //#endregion
607
638
  //#region extensions/matrix/src/cli-direct.ts
608
- const loadMatrixActionClientModule = createLazyRuntimeModule(() => import("./client-D2utPQ1E.js").then((n) => n.t));
609
- const loadMatrixDirectManagementModule = createLazyRuntimeModule(() => import("./send-DG7Bnj7_.js").then((n) => n.x));
639
+ const loadMatrixActionClientModule = createLazyRuntimeModule(() => import("./client-oNOlldJI.js").then((n) => n.t));
640
+ const loadMatrixDirectManagementModule = createLazyRuntimeModule(() => import("./send-B5XChnvB.js").then((n) => n.x));
610
641
  function printDirectRoomCandidate(room) {
611
642
  const members = room.joinedMembers === null ? "unavailable" : room.joinedMembers.map((member) => formatMatrixCliText(member)).join(", ") || "none";
612
643
  console.log(`- ${formatMatrixCliText(room.roomId)} [${room.source}] strict=${room.strict ? "yes" : "no"} joined=${members}`);
@@ -750,8 +781,11 @@ function buildNoopMatrixVerificationBootstrap(status) {
750
781
  };
751
782
  }
752
783
  async function setupMatrixEncryption(params) {
753
- const runtime = getMatrixRuntime();
754
784
  const { accountId, cfg } = resolveMatrixCliAccountContext(params.account);
785
+ const publishConfig = createMatrixCliAccountConfigPublisher({
786
+ accountId,
787
+ previousCfg: cfg
788
+ });
755
789
  if (!resolveMatrixAccount({
756
790
  cfg,
757
791
  accountId
@@ -761,10 +795,6 @@ async function setupMatrixEncryption(params) {
761
795
  accountId
762
796
  }).encryption !== true;
763
797
  const updated = encryptionChanged ? updateMatrixAccountConfig(cfg, accountId, { encryption: true }) : cfg;
764
- if (encryptionChanged) await runtime.config.replaceConfigFile({
765
- nextConfig: updated,
766
- afterWrite: { mode: "auto" }
767
- });
768
798
  const existingStatus = !encryptionChanged && !params.recoveryKey && params.forceResetCrossSigning !== true ? await getMatrixVerificationStatus({
769
799
  accountId,
770
800
  cfg: updated,
@@ -777,23 +807,27 @@ async function setupMatrixEncryption(params) {
777
807
  bootstrap: buildNoopMatrixVerificationBootstrap(existingStatus),
778
808
  status: existingStatus
779
809
  };
780
- const bootstrap = await bootstrapMatrixVerification({
781
- accountId,
782
- cfg: updated,
783
- recoveryKey: params.recoveryKey,
784
- forceResetCrossSigning: params.forceResetCrossSigning === true
785
- });
786
- const status = await getMatrixVerificationStatus({
787
- accountId,
788
- cfg: updated
789
- });
790
- return {
791
- accountId,
792
- configPath: resolveMatrixConfigPath(updated, accountId),
793
- encryptionChanged,
794
- bootstrap,
795
- status
796
- };
810
+ try {
811
+ const bootstrap = await bootstrapMatrixVerification({
812
+ accountId,
813
+ cfg: updated,
814
+ recoveryKey: params.recoveryKey,
815
+ forceResetCrossSigning: params.forceResetCrossSigning === true
816
+ });
817
+ const status = await getMatrixVerificationStatus({
818
+ accountId,
819
+ cfg: updated
820
+ });
821
+ return {
822
+ accountId,
823
+ configPath: resolveMatrixConfigPath(updated, accountId),
824
+ encryptionChanged,
825
+ bootstrap,
826
+ status
827
+ };
828
+ } finally {
829
+ if (encryptionChanged) await publishConfig((current) => updateMatrixAccountConfig(current, accountId, { encryption: true }));
830
+ }
797
831
  }
798
832
  function printMatrixEncryptionSetupResult(result, verbose = false) {
799
833
  printAccountLabel(result.accountId);
@@ -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-CtYeU7ol.js");
5
+ const { registerMatrixCli } = await import("./cli-IvDUuiDH.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-B7MQjR5S.js";
1
+ import { n as registerMatrixCliMetadata, t as cli_metadata_default } from "./cli-metadata-BGryAl2e.js";
2
2
  export { cli_metadata_default as default, registerMatrixCliMetadata };
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { b as resolveMatrixRoomId } from "./send-DG7Bnj7_.js";
2
+ import { b as resolveMatrixRoomId } from "./send-B5XChnvB.js";
3
3
  import { n as withResolvedRuntimeMatrixClient } from "./client-bootstrap-n1Rqc8Go.js";
4
4
  //#region extensions/matrix/src/matrix/actions/client.ts
5
5
  var client_exports = /* @__PURE__ */ __exportAll({
@@ -1,3 +1,3 @@
1
- import { c as singleAccountKeysToMove, n as matrixSetupAdapter, o as namedAccountPromotionKeys, s as resolveSingleAccountPromotionTarget } from "./setup-core-CEF6exLW.js";
2
- import { n as matrixOnboardingAdapter } from "./setup-surface-BSlj1vnL.js";
1
+ import { c as singleAccountKeysToMove, n as matrixSetupAdapter, o as namedAccountPromotionKeys, s as resolveSingleAccountPromotionTarget } from "./setup-core-XkIfQ65J.js";
2
+ import { n as matrixOnboardingAdapter } from "./setup-surface-B2yZ8KGc.js";
3
3
  export { matrixSetupAdapter, matrixOnboardingAdapter as matrixSetupWizard, namedAccountPromotionKeys, resolveSingleAccountPromotionTarget, singleAccountKeysToMove };
@@ -39,9 +39,9 @@ const matrixAccountStateSchemaMigration = {
39
39
  id: "matrix-account-sqlite-schema",
40
40
  label: "Matrix account SQLite schemas",
41
41
  async detectLegacyState(params) {
42
- const { detectOpenClawStateDatabaseSchemaMigrations } = await import("openclaw/plugin-sdk/doctor-repair-runtime");
43
42
  const preview = [];
44
43
  for (const storageRootDir of await collectMatrixAccountStateRoots(params.stateDir)) {
44
+ const { detectOpenClawStateDatabaseSchemaMigrations } = await import("openclaw/plugin-sdk/doctor-repair-runtime");
45
45
  const env = resolveMatrixSqliteStateEnv({
46
46
  env: params.env,
47
47
  stateDir: storageRootDir
@@ -51,10 +51,10 @@ const matrixAccountStateSchemaMigration = {
51
51
  return preview.length > 0 ? { preview } : null;
52
52
  },
53
53
  async migrateLegacyState(params) {
54
- const { detectOpenClawStateDatabaseSchemaMigrations, repairOpenClawStateDatabaseSchema } = await import("openclaw/plugin-sdk/doctor-repair-runtime");
55
54
  const changes = [];
56
55
  const warnings = [];
57
56
  for (const storageRootDir of await collectMatrixAccountStateRoots(params.stateDir)) {
57
+ const { detectOpenClawStateDatabaseSchemaMigrations, repairOpenClawStateDatabaseSchema } = await import("openclaw/plugin-sdk/doctor-repair-runtime");
58
58
  const env = resolveMatrixSqliteStateEnv({
59
59
  env: params.env,
60
60
  stateDir: storageRootDir
@@ -1,4 +1,4 @@
1
- import { T as MsgType, a as sendSingleTextMessageMatrix, c as prepareMatrixSingleText, t as editMessageMatrix } from "./send-DG7Bnj7_.js";
1
+ import { T as MsgType, a as sendSingleTextMessageMatrix, c as prepareMatrixSingleText, t as editMessageMatrix } from "./send-B5XChnvB.js";
2
2
  import { createFinalizableDraftStreamControlsForState } from "openclaw/plugin-sdk/channel-outbound";
3
3
  //#region extensions/matrix/src/matrix/draft-stream.ts
4
4
  const DEFAULT_THROTTLE_MS = 1e3;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as registerMatrixCliMetadata } from "./cli-metadata-B7MQjR5S.js";
1
+ import { n as registerMatrixCliMetadata } from "./cli-metadata-BGryAl2e.js";
2
2
  import { registerMatrixSubagentHooks } from "./subagent-hooks-api.js";
3
3
  import { defineBundledChannelEntry } from "openclaw/plugin-sdk/channel-entry-contract";
4
4
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
@@ -1,6 +1,6 @@
1
1
  import { n as MATRIX_REACTION_EVENT_TYPE } from "./reaction-common-DkrQdBSZ.js";
2
- import { _ as resolvePollReferenceEventId, d as formatPollAsText, f as formatPollResultsAsText, g as parsePollStartContent, m as isPollStartType, p as isPollEventType, r as sendMessageMatrix, t as editMessageMatrix, u as buildPollResultsSummary } from "./send-DG7Bnj7_.js";
3
- import { r as withResolvedRoomAction } from "./client-D2utPQ1E.js";
2
+ import { _ as resolvePollReferenceEventId, d as formatPollAsText, f as formatPollResultsAsText, g as parsePollStartContent, m as isPollStartType, p as isPollEventType, r as sendMessageMatrix, t as editMessageMatrix, u as buildPollResultsSummary } from "./send-B5XChnvB.js";
3
+ import { r as withResolvedRoomAction } from "./client-oNOlldJI.js";
4
4
  import { n as isMatrixNotFoundError } from "./errors-DKVS3_DO.js";
5
5
  import { asNullableObjectRecord, asNullableRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
6
  import path from "node:path";