@openclaw/matrix 2026.9.1 → 2026.9.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 (91) hide show
  1. package/dist/{account-selection-DA-jfx22.js → account-selection-Bbtc483D.js} +9 -1
  2. package/dist/{accounts-DR1c4xF_.js → accounts-GwSAk9vY.js} +2 -2
  3. package/dist/api.js +6 -6
  4. package/dist/{approval-handler.runtime-B_6ytY5I.js → approval-handler.runtime-tJLn5JFB.js} +6 -6
  5. package/dist/{approval-ids-CfHtZ9d1.js → approval-ids-DJZ9ZTuS.js} +1 -1
  6. package/dist/{approval-reaction-auth-BpDvJqfy.js → approval-reaction-auth-Cd0sKHFc.js} +2 -2
  7. package/dist/{channel-b-jES-oi.js → channel-BpYiqmx-.js} +10 -39
  8. package/dist/channel-plugin-api.js +1 -1
  9. package/dist/{channel.runtime-BkqjwEDU.js → channel.runtime-dfEvRdLQ.js} +6 -11
  10. package/dist/{channel.setup-BY42QaL7.js → channel.setup-oxd8RsIr.js} +7 -4
  11. package/dist/{cli-CtYeU7ol.js → cli-_49Vsqs4.js} +149 -115
  12. package/dist/{cli-metadata-B7MQjR5S.js → cli-metadata-D19lmKmz.js} +1 -1
  13. package/dist/cli-metadata.js +1 -1
  14. package/dist/{client-D2utPQ1E.js → client-BXQCQDfY.js} +2 -2
  15. package/dist/{client-Dj4mcf-s.js → client-COLiUdWe.js} +6 -6
  16. package/dist/{client-bootstrap-n1Rqc8Go.js → client-bootstrap-CQwf9qrm.js} +1 -6
  17. package/dist/contract-api.js +2 -2
  18. package/dist/{credentials-DJj2xs3q.js → credentials-DysXbkv2.js} +2 -2
  19. package/dist/{credentials-read-mexhw-Ur.js → credentials-read-WWpqi88V.js} +1 -1
  20. package/dist/{credentials-write.runtime-DQt-kgJq.js → credentials-write.runtime-D22lPwRO.js} +1 -1
  21. package/dist/{crypto-runtime-m1eplj3b.js → crypto-runtime-BvunIYVn.js} +2 -2
  22. package/dist/{crypto-snapshot-doctor.runtime-D0v841D_.js → crypto-snapshot-doctor.runtime-DxgUMXUy.js} +2 -2
  23. package/dist/{directory-live-DLUgWBhA.js → directory-live-DABCxf8j.js} +2 -2
  24. package/dist/doctor-contract-api.js +43 -23
  25. package/dist/{draft-stream-DPYdv4fE.js → draft-stream-DSwgyyBi.js} +16 -5
  26. package/dist/{encryption-guidance-BNcZNQZI.js → encryption-guidance-mDyxJV9U.js} +1 -1
  27. package/dist/{event-helpers-XRfAbOIh.js → event-helpers-CspuhE9k.js} +9 -1
  28. package/dist/helper-api.js +3 -3
  29. package/dist/{http-client-DOmFvKvB.js → http-client-BfPeF4CE.js} +1 -1
  30. package/dist/{idb-persistence-CU7CNLlX.js → idb-persistence-DBdwHSWg.js} +1 -1
  31. package/dist/index.js +1 -1
  32. package/dist/{messages-C1U3b1oN.js → messages-H4mi9Cap.js} +6 -99
  33. package/dist/{monitor-SNnu-0bp.js → monitor-3Fw96uiE.js} +84 -118
  34. package/dist/{outbound-CeCEtF_q.js → outbound-UPI45TD_.js} +1 -1
  35. package/dist/plugin-entry.handlers.runtime.js +1 -1
  36. package/dist/probe.runtime-DdXTrrmo.js +2 -0
  37. package/dist/{profile-update-Cd1p8ABr.js → profile-update-DWEg8Ylt.js} +1 -1
  38. package/dist/{reaction-events-DveJRUaX.js → reaction-events-D-iSW0iM.js} +5 -7
  39. package/dist/{resolve-targets-B64O69Nd.js → resolve-targets-BpnALDzR.js} +1 -1
  40. package/dist/{resolver.runtime-TRmePJDV.js → resolver.runtime-B83WkznZ.js} +1 -1
  41. package/dist/{room-info-DVkKDscD.js → room-info-CjnbX52D.js} +7 -4
  42. package/dist/runtime-api.js +2 -2
  43. package/dist/{sdk-C1yfda1L.js → sdk-CX9b0N8Q.js} +13 -6
  44. package/dist/{send-DG7Bnj7_.js → send-B9l1lKau.js} +201 -97
  45. package/dist/session-binding-contract-api.js +1 -1
  46. package/dist/{setup-bootstrap-Co985F63.js → setup-bootstrap-CSI1L1lm.js} +2 -2
  47. package/dist/{setup-core-CEF6exLW.js → setup-core-DuTlyqRz.js} +3 -3
  48. package/dist/setup-plugin-api.js +1 -1
  49. package/dist/{setup-surface-BSlj1vnL.js → setup-surface-fZing1WZ.js} +6 -6
  50. package/dist/{startup-verification-1Ney1mmI.js → startup-verification-BTSf31hS.js} +2 -1
  51. package/dist/storage-CV-pfV_2.js +320 -0
  52. package/dist/{storage-BVf4uucD.js → storage-metadata-DYArLcq1.js} +14 -319
  53. package/dist/{storage-paths-gUmSydsW.js → storage-paths-DVCANXTc.js} +13 -1
  54. package/dist/{sync-cache-state-d-A_OhbU.js → sync-cache-state-C-mhj3xb.js} +9 -3
  55. package/dist/{thread-bindings-DgxQEB99.js → thread-bindings-CRyf5on_.js} +3 -2
  56. package/dist/{tool-actions.runtime-vbkQgU7D.js → tool-actions.runtime-D5-hTkDu.js} +10 -10
  57. package/dist/types-DzSc7Sqm.js +32 -0
  58. package/dist/{verification-D-iOebn4.js → verification-B_aqtbx-.js} +2 -2
  59. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/package.json +1 -1
  60. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm.d.ts +69 -4
  61. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.cjs +526 -432
  62. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.js +358 -265
  63. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm +0 -0
  64. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm.d.ts +8 -7
  65. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs +216 -183
  66. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs.map +1 -1
  67. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js +7 -7
  68. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js.map +1 -1
  69. package/node_modules/markdown-it/dist/markdown-it.cjs.js +98 -106
  70. package/node_modules/markdown-it/dist/markdown-it.cjs.js.map +1 -1
  71. package/node_modules/markdown-it/dist/markdown-it.d.mts +42 -71
  72. package/node_modules/markdown-it/dist/markdown-it.mjs +98 -106
  73. package/node_modules/markdown-it/dist/markdown-it.mjs.map +1 -1
  74. package/node_modules/markdown-it/package.json +1 -2
  75. package/node_modules/typebox/build/format/json_pointer.d.mts +2 -2
  76. package/node_modules/typebox/build/format/json_pointer.mjs +2 -2
  77. package/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +2 -2
  78. package/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +2 -2
  79. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  80. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  81. package/node_modules/typebox/build/system/memory/assign.mjs +2 -1
  82. package/node_modules/typebox/build/system/memory/create.mjs +3 -4
  83. package/node_modules/typebox/build/system/memory/discard.mjs +2 -2
  84. package/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
  85. package/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
  86. package/node_modules/typebox/build/system/memory/update.mjs +3 -2
  87. package/node_modules/typebox/package.json +1 -1
  88. package/openclaw.plugin.json +24 -3
  89. package/package.json +7 -7
  90. package/dist/probe.runtime-B1YPxG9x.js +0 -2
  91. package/dist/runtime-BefyhPWv.js +0 -6
@@ -1,3 +1,4 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
1
2
  import { n as listMatrixEnvAccountIds, t as getMatrixScopedEnvVarNames } from "./env-vars-dGqak9dN.js";
2
3
  import { isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
4
  import { listCombinedAccountIds, listConfiguredAccountIds, resolveListedDefaultAccountId, resolveNormalizedAccountEntry } from "openclaw/plugin-sdk/account-core";
@@ -91,6 +92,13 @@ function resolveMatrixEnvAuthReadiness(accountId, env = process.env) {
91
92
  }
92
93
  //#endregion
93
94
  //#region extensions/matrix/src/account-selection.ts
95
+ var account_selection_exports = /* @__PURE__ */ __exportAll({
96
+ findMatrixAccountEntry: () => findMatrixAccountEntry,
97
+ requiresExplicitMatrixDefaultAccount: () => requiresExplicitMatrixDefaultAccount,
98
+ resolveConfiguredMatrixAccountIds: () => resolveConfiguredMatrixAccountIds,
99
+ resolveMatrixChannelConfig: () => resolveMatrixChannelConfig,
100
+ resolveMatrixDefaultOrOnlyAccountId: () => resolveMatrixDefaultOrOnlyAccountId
101
+ });
94
102
  function readConfiguredMatrixString(value) {
95
103
  return normalizeOptionalString(value) ?? "";
96
104
  }
@@ -192,4 +200,4 @@ function requiresExplicitMatrixDefaultAccount(cfg, env = process.env) {
192
200
  return !(configuredDefault && configuredAccountIds.includes(configuredDefault));
193
201
  }
194
202
  //#endregion
195
- export { resolveMatrixDefaultOrOnlyAccountId as a, resolveScopedMatrixEnvConfig as c, resolveMatrixChannelConfig as i, resolveMatrixAccountStringValues as l, requiresExplicitMatrixDefaultAccount as n, resolveGlobalMatrixEnvConfig as o, resolveConfiguredMatrixAccountIds as r, resolveMatrixEnvAuthReadiness as s, findMatrixAccountEntry as t };
203
+ export { resolveMatrixChannelConfig as a, resolveMatrixEnvAuthReadiness as c, resolveConfiguredMatrixAccountIds as i, resolveScopedMatrixEnvConfig as l, findMatrixAccountEntry as n, resolveMatrixDefaultOrOnlyAccountId as o, requiresExplicitMatrixDefaultAccount as r, resolveGlobalMatrixEnvConfig as s, account_selection_exports as t, resolveMatrixAccountStringValues as u };
@@ -1,6 +1,6 @@
1
- import { a as resolveMatrixDefaultOrOnlyAccountId, c as resolveScopedMatrixEnvConfig, l as resolveMatrixAccountStringValues, o as resolveGlobalMatrixEnvConfig, r as resolveConfiguredMatrixAccountIds } from "./account-selection-DA-jfx22.js";
1
+ import { i as resolveConfiguredMatrixAccountIds, l as resolveScopedMatrixEnvConfig, o as resolveMatrixDefaultOrOnlyAccountId, s as resolveGlobalMatrixEnvConfig, u as resolveMatrixAccountStringValues } from "./account-selection-Bbtc483D.js";
2
2
  import { a as resolveMatrixAccountConfig, o as resolveMatrixBaseConfig, t as findMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
3
- import { i as loadMatrixCredentials, n as credentialsMatchConfig } from "./credentials-read-mexhw-Ur.js";
3
+ import { i as loadMatrixCredentials, n as credentialsMatchConfig } from "./credentials-read-WWpqi88V.js";
4
4
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
6
6
  import { hasConfiguredSecretInput } from "openclaw/plugin-sdk/secret-input";
package/dist/api.js CHANGED
@@ -1,9 +1,9 @@
1
- import { a as resolveMatrixDefaultOrOnlyAccountId, i as resolveMatrixChannelConfig, n as requiresExplicitMatrixDefaultAccount, r as resolveConfiguredMatrixAccountIds, t as findMatrixAccountEntry } from "./account-selection-DA-jfx22.js";
1
+ import { a as resolveMatrixChannelConfig, i as resolveConfiguredMatrixAccountIds, n as findMatrixAccountEntry, o as resolveMatrixDefaultOrOnlyAccountId, r as requiresExplicitMatrixDefaultAccount } from "./account-selection-Bbtc483D.js";
2
2
  import { n as listMatrixEnvAccountIds, r as resolveMatrixEnvAccountToken, t as getMatrixScopedEnvVarNames } from "./env-vars-dGqak9dN.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 { t as matrixPlugin } from "./channel-b-jES-oi.js";
5
- import { n as matrixSetupAdapter, t as createMatrixSetupWizardProxy } from "./setup-core-CEF6exLW.js";
3
+ import { a as resolveMatrixCredentialsFilename, i as resolveMatrixCredentialsDir, l as sanitizeMatrixPathSegment, o as resolveMatrixCredentialsPath, r as resolveMatrixAccountStorageRoot, s as resolveMatrixHomeserverKey, t as hashMatrixAccessToken } from "./storage-paths-DVCANXTc.js";
4
+ import { t as matrixPlugin } from "./channel-BpYiqmx-.js";
5
+ import { n as matrixSetupAdapter, t as createMatrixSetupWizardProxy } from "./setup-core-DuTlyqRz.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-fZing1WZ.js";
8
+ import { t as createMatrixThreadBindingManager } from "./thread-bindings-CRyf5on_.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,16 +1,16 @@
1
- import { i as resolveMatrixAccount } from "./accounts-DR1c4xF_.js";
2
- import { C as shouldHandleMatrixApprovalRequest, S as isMatrixAnyApprovalClientEnabled } from "./channel-b-jES-oi.js";
1
+ import { i as resolveMatrixAccount } from "./accounts-GwSAk9vY.js";
2
+ import { v as isMatrixAnyApprovalClientEnabled, y as shouldHandleMatrixApprovalRequest } from "./channel-BpYiqmx-.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 { a as sendSingleTextMessageMatrix, j as repairMatrixDirectRooms, n as reactMatrixMessage, r as sendMessageMatrix } from "./send-B9l1lKau.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-H4mi9Cap.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";
10
10
  import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
11
11
  import { createChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-runtime";
12
12
  import { buildExecApprovalPendingReplyPayload, buildPluginApprovalPendingReplyPayload } from "openclaw/plugin-sdk/approval-reply-runtime";
13
- import { buildApprovalPendingReplyPayload, buildPluginApprovalResolvedReplyPayload } from "openclaw/plugin-sdk/approval-runtime";
13
+ import { buildApprovalPendingReplyPayload, buildPluginApprovalResolvedReplyPayload, formatChannelApprovalResolvedLabel } from "openclaw/plugin-sdk/approval-runtime";
14
14
  import { retryAsync } from "openclaw/plugin-sdk/retry-runtime";
15
15
  //#region extensions/matrix/src/approval-handler.runtime.ts
16
16
  const MATRIX_APPROVAL_METADATA_KEY = "com.openclaw.approval";
@@ -197,7 +197,7 @@ function buildResolvedApprovalText(view) {
197
197
  resolvedBy: view.resolvedBy ?? void 0,
198
198
  ts: 0
199
199
  } }).text ?? "";
200
- const decisionLabel = view.approvalKind === "system-agent" && view.terminalStatus === "cancelled" ? "Cancelled" : view.approvalKind === "system-agent" && view.applicationStatus === "applied" ? "Applied" : view.approvalKind === "system-agent" && view.applicationStatus === "not-applied" ? "Not applied" : view.decision === "allow-once" ? "Allowed once" : view.decision === "allow-always" ? "Allowed always" : "Denied";
200
+ const decisionLabel = formatChannelApprovalResolvedLabel(view);
201
201
  return [
202
202
  `${view.approvalKind === "system-agent" ? "OpenClaw change" : "Exec approval"}: ${decisionLabel}`,
203
203
  "",
@@ -1,4 +1,4 @@
1
- import { a as normalizeMatrixUserId } from "./channel.setup-BY42QaL7.js";
1
+ import { a as normalizeMatrixUserId } from "./channel.setup-oxd8RsIr.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 { i as resolveMatrixAccount } from "./accounts-DR1c4xF_.js";
2
- import { t as normalizeMatrixApproverId } from "./approval-ids-CfHtZ9d1.js";
1
+ import { i as resolveMatrixAccount } from "./accounts-GwSAk9vY.js";
2
+ import { t as normalizeMatrixApproverId } from "./approval-ids-DJZ9ZTuS.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,11 +1,10 @@
1
- import { n as requiresExplicitMatrixDefaultAccount } from "./account-selection-DA-jfx22.js";
1
+ import { r as requiresExplicitMatrixDefaultAccount } from "./account-selection-Bbtc483D.js";
2
2
  import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
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";
3
+ import { i as resolveMatrixAccount, r as resolveDefaultMatrixAccountId, t as listMatrixAccountIds } from "./accounts-GwSAk9vY.js";
4
+ import { a as normalizeMatrixUserId, r as DEFAULT_ACCOUNT_ID$2, t as matrixPluginBase } from "./channel.setup-oxd8RsIr.js";
5
+ import { t as normalizeMatrixApproverId } from "./approval-ids-DJZ9ZTuS.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
- import { n as MATRIX_REACTION_EVENT_TYPE } from "./reaction-common-DkrQdBSZ.js";
9
8
  import { f as setMatrixThreadBindingMaxAgeBySessionKey, u as setMatrixThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings-shared-oNPiyMWY.js";
10
9
  import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-CufozuyJ.js";
11
10
  import { n as resolveMatrixInboundConversation, t as defaultTopLevelPlacement } from "./thread-binding-api-CzkeLZCU.js";
@@ -149,7 +148,7 @@ const matrixMessageActions = {
149
148
  return account && createActionGate(account.config.actions)("messages") ? payload : null;
150
149
  },
151
150
  handleAction: async (ctx) => {
152
- const { handleMatrixAction } = await import("./tool-actions.runtime-vbkQgU7D.js");
151
+ const { handleMatrixAction } = await import("./tool-actions.runtime-D5-hTkDu.js");
153
152
  const { action, params, cfg, accountId, mediaLocalRoots } = ctx;
154
153
  const dispatch = async (actionParams) => await handleMatrixAction({
155
154
  ...actionParams,
@@ -634,7 +633,7 @@ const matrixNativeApprovalCapability = createApproverRestrictedNativeApprovalCap
634
633
  approvalKind,
635
634
  request
636
635
  }),
637
- load: async () => (await import("./approval-handler.runtime-B_6ytY5I.js")).matrixApprovalNativeRuntime
636
+ load: async () => (await import("./approval-handler.runtime-tJLn5JFB.js")).matrixApprovalNativeRuntime
638
637
  })
639
638
  });
640
639
  const splitMatrixApprovalCapability = splitChannelApprovalCapability(matrixNativeApprovalCapability);
@@ -859,19 +858,6 @@ function resolveMatrixGroupToolPolicy(params) {
859
858
  return resolveScopeToolsPolicy(resolveMatrixGroupScope(params));
860
859
  }
861
860
  //#endregion
862
- //#region extensions/matrix/src/matrix/monitor/types.ts
863
- const EventType = {
864
- RoomMessage: "m.room.message",
865
- RoomMessageEncrypted: "m.room.encrypted",
866
- RoomMember: "m.room.member",
867
- Location: "m.location",
868
- Reaction: MATRIX_REACTION_EVENT_TYPE
869
- };
870
- const RelationType = {
871
- Replace: "m.replace",
872
- Thread: "m.thread"
873
- };
874
- //#endregion
875
861
  //#region extensions/matrix/src/matrix/monitor/threads.ts
876
862
  function resolveMatrixThreadSessionKeys(params) {
877
863
  return resolveThreadSessionKeys({
@@ -879,10 +865,6 @@ function resolveMatrixThreadSessionKeys(params) {
879
865
  normalizeThreadId: (threadId) => threadId
880
866
  });
881
867
  }
882
- function resolveMatrixRelatedReplyToEventId(relates) {
883
- if (!relates || typeof relates !== "object") return;
884
- if ("m.in_reply_to" in relates && typeof relates["m.in_reply_to"] === "object" && relates["m.in_reply_to"] && "event_id" in relates["m.in_reply_to"] && typeof relates["m.in_reply_to"].event_id === "string") return relates["m.in_reply_to"].event_id;
885
- }
886
868
  function resolveMatrixThreadRouting(params) {
887
869
  const effectiveThreadReplies = params.isDirectMessage && params.dmThreadReplies !== void 0 ? params.dmThreadReplies : params.threadReplies;
888
870
  const messageId = params.messageId.trim();
@@ -890,17 +872,6 @@ function resolveMatrixThreadRouting(params) {
890
872
  const inboundThreadId = threadRootId && threadRootId !== messageId ? threadRootId : void 0;
891
873
  return { threadId: effectiveThreadReplies === "off" ? void 0 : effectiveThreadReplies === "inbound" ? inboundThreadId : inboundThreadId ?? (messageId || void 0) };
892
874
  }
893
- function resolveMatrixThreadRootId(params) {
894
- const relates = params.content["m.relates_to"];
895
- if (!relates || typeof relates !== "object") return;
896
- if ("rel_type" in relates && relates.rel_type === RelationType.Thread) {
897
- if ("event_id" in relates && typeof relates.event_id === "string") return relates.event_id;
898
- return resolveMatrixRelatedReplyToEventId(relates);
899
- }
900
- }
901
- function resolveMatrixReplyToEventId(content) {
902
- return resolveMatrixRelatedReplyToEventId(content["m.relates_to"]);
903
- }
904
875
  //#endregion
905
876
  //#region extensions/matrix/src/matrix/monitor/route.ts
906
877
  function resolveMatrixDmSessionKey(params) {
@@ -1042,7 +1013,7 @@ function resolveMatrixConversationRouteOwner(params) {
1042
1013
  }
1043
1014
  //#endregion
1044
1015
  //#region extensions/matrix/src/resolver.ts
1045
- const loadMatrixChannelRuntime$1 = createLazyRuntimeNamedExport(() => import("./resolver.runtime-TRmePJDV.js"), "matrixResolverRuntime");
1016
+ const loadMatrixChannelRuntime$1 = createLazyRuntimeNamedExport(() => import("./resolver.runtime-B83WkznZ.js"), "matrixResolverRuntime");
1046
1017
  const matrixResolverAdapter = { resolveTargets: async ({ cfg, accountId, inputs, kind, runtime }) => (await loadMatrixChannelRuntime$1()).resolveMatrixTargets({
1047
1018
  cfg,
1048
1019
  accountId,
@@ -1171,7 +1142,7 @@ function resolveMatrixOutboundSessionRoute(params) {
1171
1142
  //#endregion
1172
1143
  //#region extensions/matrix/src/channel.ts
1173
1144
  let matrixStartupLock = Promise.resolve();
1174
- const loadMatrixChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-BkqjwEDU.js"), "matrixChannelRuntime");
1145
+ const loadMatrixChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-dfEvRdLQ.js"), "matrixChannelRuntime");
1175
1146
  const loadMatrixDoctorModule = createLazyRuntimeModule(() => import("./doctor-CJE8wO6y.js"));
1176
1147
  function buildMatrixTrafficStatusSummary(snapshot) {
1177
1148
  return {
@@ -1522,7 +1493,7 @@ const matrixPlugin = createChatChannelPlugin({
1522
1493
  await previousLock;
1523
1494
  let monitorMatrixProvider;
1524
1495
  try {
1525
- monitorMatrixProvider = (await import("./monitor-SNnu-0bp.js")).monitorMatrixProvider;
1496
+ monitorMatrixProvider = (await import("./monitor-3Fw96uiE.js")).monitorMatrixProvider;
1526
1497
  } finally {
1527
1498
  releaseLock();
1528
1499
  }
@@ -1592,4 +1563,4 @@ const matrixPlugin = createChatChannelPlugin({
1592
1563
  outbound: matrixChannelOutbound
1593
1564
  });
1594
1565
  //#endregion
1595
- export { shouldHandleMatrixApprovalRequest as C, isMatrixAnyApprovalClientEnabled as S, logInboundDrop as _, resolveMatrixThreadRootId as a, summarizeMapping as b, RelationType as c, buildAllowlistResolutionSummary as d, canonicalizeAllowlistWithResolvedIds as f, getAgentScopedMediaLocalRoots as g, formatLocationText as h, resolveMatrixReplyToEventId as i, resolveMatrixRoomConfig as l, createTypingCallbacks as m, resolveMatrixStoredSessionMeta as n, resolveMatrixThreadRouting as o, createReplyPrefixOptions as p, resolveMatrixInboundRoute as r, EventType as s, matrixPlugin as t, addAllowlistUserEntriesFromConfigEntry as u, logTypingFailure as v, toLocationContext as x, patchAllowlistUsersInConfigEntries as y };
1566
+ export { toLocationContext as _, resolveMatrixRoomConfig as a, canonicalizeAllowlistWithResolvedIds as c, formatLocationText as d, getAgentScopedMediaLocalRoots as f, summarizeMapping as g, patchAllowlistUsersInConfigEntries as h, resolveMatrixThreadRouting as i, createReplyPrefixOptions as l, logTypingFailure as m, resolveMatrixStoredSessionMeta as n, addAllowlistUserEntriesFromConfigEntry as o, logInboundDrop as p, resolveMatrixInboundRoute as r, buildAllowlistResolutionSummary as s, matrixPlugin as t, createTypingCallbacks as u, isMatrixAnyApprovalClientEnabled as v, shouldHandleMatrixApprovalRequest as y };
@@ -1,2 +1,2 @@
1
- import { t as matrixPlugin } from "./channel-b-jES-oi.js";
1
+ import { t as matrixPlugin } from "./channel-BpYiqmx-.js";
2
2
  export { matrixPlugin };
@@ -1,15 +1,14 @@
1
- import { o as sendTypingMatrix, r as sendMessageMatrix, v as cleanupMatrixDeliveryPlans, y as reconcileMatrixUnknownSend } from "./send-DG7Bnj7_.js";
2
- import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
3
- import { l as resolveMatrixAuth } from "./client-Dj4mcf-s.js";
4
- import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-DLUgWBhA.js";
5
- import { t as matrixOutbound } from "./outbound-CeCEtF_q.js";
6
- import { t as resolveMatrixTargets } from "./resolve-targets-B64O69Nd.js";
1
+ import { D as reconcileMatrixUnknownSend, E as cleanupMatrixDeliveryPlans, o as sendTypingMatrix, r as sendMessageMatrix } from "./send-B9l1lKau.js";
2
+ import { l as resolveMatrixAuth } from "./client-COLiUdWe.js";
3
+ import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-DABCxf8j.js";
4
+ import { t as matrixOutbound } from "./outbound-UPI45TD_.js";
5
+ import { t as resolveMatrixTargets } from "./resolve-targets-BpnALDzR.js";
7
6
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
8
7
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
9
8
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
10
9
  import { runChannelProbe } from "openclaw/plugin-sdk/text-utility-runtime";
11
10
  //#region extensions/matrix/src/matrix/probe.ts
12
- const loadMatrixProbeRuntimeDeps = createLazyRuntimeModule(() => import("./probe.runtime-B1YPxG9x.js").then((runtimeModule) => ({ createMatrixClient: runtimeModule.createMatrixClient })));
11
+ const loadMatrixProbeRuntimeDeps = createLazyRuntimeModule(() => import("./probe.runtime-DdXTrrmo.js").then((runtimeModule) => ({ createMatrixClient: runtimeModule.createMatrixClient })));
13
12
  async function probeMatrix(params) {
14
13
  return await runChannelProbe(void 0, async () => {
15
14
  const result = {
@@ -17,10 +16,6 @@ async function probeMatrix(params) {
17
16
  status: null,
18
17
  error: null
19
18
  };
20
- if (isBunRuntime()) return {
21
- ...result,
22
- error: "Matrix probe requires Node (bun runtime not supported)"
23
- };
24
19
  if (!params.homeserver?.trim()) return {
25
20
  ...result,
26
21
  error: "missing homeserver"
@@ -1,6 +1,6 @@
1
1
  import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
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";
2
+ import { i as resolveMatrixAccount, r as resolveDefaultMatrixAccountId, t as listMatrixAccountIds } from "./accounts-GwSAk9vY.js";
3
+ import { r as matrixSetupContract, t as createMatrixSetupWizardProxy } from "./setup-core-DuTlyqRz.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-fZing1WZ.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
- import { i as resolveMatrixAccount } from "./accounts-DR1c4xF_.js";
3
+ import { i as resolveMatrixAccount } from "./accounts-GwSAk9vY.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";
7
- import { u as resolveMatrixAuthContext } from "./client-Dj4mcf-s.js";
5
+ import { n as matrixSetupAdapter } from "./setup-core-DuTlyqRz.js";
6
+ import { n as withResolvedActionClient } from "./client-BXQCQDfY.js";
7
+ import { u as resolveMatrixAuthContext } from "./client-COLiUdWe.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-DWEg8Ylt.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-B_aqtbx-.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-CSI1L1lm.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-BXQCQDfY.js").then((n) => n.t));
640
+ const loadMatrixDirectManagementModule = createLazyRuntimeModule(() => import("./send-B9l1lKau.js").then((n) => n.k));
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);