@openclaw/matrix 2026.7.1-beta.6 → 2026.7.2-beta.1

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 (87) hide show
  1. package/dist/{account-selection-5e4mHR1m.js → account-selection-Bz00QTmQ.js} +4 -3
  2. package/dist/api.js +8 -8
  3. package/dist/{approval-handler.runtime-DI5x9r8I.js → approval-handler.runtime--Ei44Vo2.js} +27 -17
  4. package/dist/{approval-ids-ZgqbspmS.js → approval-ids-C_2kSMdJ.js} +1 -1
  5. package/dist/{approval-reaction-auth-D9LijQhr.js → approval-reaction-auth-TdVPcgxP.js} +2 -2
  6. package/dist/approval-reactions-BgU51JGd.js +202 -0
  7. package/dist/auth-presence.js +1 -1
  8. package/dist/{channel-jUTBsjHU.js → channel-CxqDh7mS.js} +102 -143
  9. package/dist/channel-plugin-api.js +1 -1
  10. package/dist/{channel.runtime-DO1Nv9ed.js → channel.runtime-wNfJc57I.js} +7 -7
  11. package/dist/{cli-metadata-CfiEO-CE.js → cli-metadata-Gf3HSJ2c.js} +1 -1
  12. package/dist/cli-metadata.js +1 -1
  13. package/dist/{cli-CEfWwCKx.js → cli-o00oTJhx.js} +12 -12
  14. package/dist/{client-FRuyCNju.js → client-ClHisZbf.js} +2 -2
  15. package/dist/{client-tgnlQJk4.js → client-DP0nmFxK.js} +4 -4
  16. package/dist/{client-bootstrap-DjFJ7e0N.js → client-bootstrap-PqYOS-mO.js} +1 -1
  17. package/dist/{config-schema-DtnhNYd-.js → config-schema-CG9goLWp.js} +21 -55
  18. package/dist/contract-api.js +2 -2
  19. package/dist/{create-client-CNakT7zF.js → create-client-D9z9RjCM.js} +3 -3
  20. package/dist/{credentials-Ds9V1mn2.js → credentials-DnhsLAuR.js} +1 -1
  21. package/dist/{credentials-read-BlkvsNFg.js → credentials-read-BtS-HRT5.js} +3 -3
  22. package/dist/{credentials-write.runtime-CTqqxcut.js → credentials-write.runtime-J_EUt5WP.js} +1 -1
  23. package/dist/{crypto-runtime-B74cTS6A.js → crypto-runtime-BHcxauC4.js} +75 -45
  24. package/dist/{deps-CdjHvnmh.js → deps-DDbghaZH.js} +23 -90
  25. package/dist/{directory-live-Ufd4qSpX.js → directory-live-DPy2aaPF.js} +3 -3
  26. package/dist/doctor-BGTs609f.js +64 -0
  27. package/dist/{doctor-contract-BAja_fmb.js → doctor-contract-D2qTLe-C.js} +72 -6
  28. package/dist/doctor-contract-api.js +323 -45
  29. package/dist/{draft-stream-D4EH25gv.js → draft-stream-De7uikGn.js} +1 -1
  30. package/dist/{encryption-guidance-D8walY04.js → encryption-guidance-BFfgq7c7.js} +1 -1
  31. package/dist/{env-auth-DIzOApj0.js → env-auth-CQsYbz-p.js} +1 -1
  32. package/dist/{env-vars-KzaYveuy.js → env-vars-B0NxQnPk.js} +3 -1
  33. package/dist/{exec-approval-resolver-f9j6staN.js → exec-approval-resolver-BCgqRtZS.js} +2 -1
  34. package/dist/{file-sync-store-DVm0ACml.js → file-sync-store-Cxb0ckyX.js} +4 -5
  35. package/dist/helper-api.js +4 -4
  36. package/dist/{http-client-nSmFiVgk.js → http-client-W4TJQM6r.js} +17 -33
  37. package/dist/{idb-persistence-BHm97th-.js → idb-persistence-iUZoHZkp.js} +2 -2
  38. package/dist/inbound-dedupe-DcMs0YXL.js +67 -0
  39. package/dist/index.js +1 -1
  40. package/dist/{logger-D0GCSDQq.js → logger-BMClpI5b.js} +1 -1
  41. package/dist/{logging-QH-48Gr6.js → logging-CFJrbDAN.js} +1 -1
  42. package/dist/{media-text-p-LP21qs.js → media-text-DWaotsZB.js} +1 -1
  43. package/dist/{messages-DRKkiEY-.js → messages-Dm3K4ZvM.js} +3 -3
  44. package/dist/{monitor-CsGOGdwu.js → monitor-C_kgPPeV.js} +44 -382
  45. package/dist/plugin-entry.handlers.runtime.js +1 -1
  46. package/dist/probe.runtime-Dry8PTWC.js +3 -0
  47. package/dist/{profile-update-Ucc8RrJL.js → profile-update-iUHCoks3.js} +3 -3
  48. package/dist/{reaction-events-DentrVii.js → reaction-events-0tubdHRM.js} +60 -10
  49. package/dist/record-shared-CvzjvHRn.js +2 -0
  50. package/dist/{recovery-key-store-DSeLFvNx.js → recovery-key-store-Bx0zTJcB.js} +2 -2
  51. package/dist/{resolve-targets-DcV_KfgX.js → resolve-targets-DlLrfWDy.js} +1 -1
  52. package/dist/{resolver.runtime-Hr6bO5zl.js → resolver.runtime-MeaT1zXx.js} +1 -1
  53. package/dist/room-info-B6vKD5DF.js +86 -0
  54. package/dist/{runtime-6S3DNFNv.js → runtime-CveSqMOP.js} +1 -1
  55. package/dist/{runtime-api-CsBoesCU.js → runtime-api-D1xI_cvh.js} +3 -3
  56. package/dist/runtime-api.js +6 -6
  57. package/dist/runtime-setter-api.js +1 -1
  58. package/dist/{sdk-AZYVl34z.js → sdk-CI8E2TKg.js} +12 -17
  59. package/dist/{secret-contract-DTgQyQxc.js → secret-contract-OZoQf0kI.js} +7 -48
  60. package/dist/secret-contract-api.js +1 -1
  61. package/dist/{send-D92v6Yy0.js → send-C7xuGWpv.js} +10 -4
  62. package/dist/session-binding-contract-api.js +2 -2
  63. package/dist/{setup-bootstrap-Da564w5f.js → setup-bootstrap-CCsexWTZ.js} +2 -2
  64. package/dist/{setup-core-BGgbrdaJ.js → setup-core-DlmTyIP0.js} +9 -7
  65. package/dist/setup-plugin-api.js +3 -3
  66. package/dist/{setup-surface-iJ6pd-t5.js → setup-surface-2SS94JV0.js} +7 -7
  67. package/dist/{shared-DkFfq7mH.js → shared-DgvN5rBx.js} +14 -9
  68. package/dist/{startup-verification-BKMAXvcV.js → startup-verification-CbIyF7z1.js} +3 -4
  69. package/dist/storage-BtSOar8T.js +718 -0
  70. package/dist/{storage-paths-BWo_ZEMC.js → storage-paths-B4_I9iqO.js} +1 -12
  71. package/dist/{thread-bindings-BX5nmWpw.js → thread-bindings-BI8MHWp9.js} +4 -5
  72. package/dist/{tool-actions.runtime-C1d5fxE_.js → tool-actions.runtime-CnyhVPoY.js} +242 -53
  73. package/dist/{verification-BGCMiO1p.js → verification-DLSe3sP7.js} +2 -2
  74. package/npm-shrinkwrap.json +3 -3
  75. package/openclaw.plugin.json +66 -55
  76. package/package.json +4 -4
  77. package/dist/approval-reactions-BdUaUXVw.js +0 -113
  78. package/dist/crypto-state-store-Jy3qwhdy.js +0 -352
  79. package/dist/doctor-DfaOqFtr.js +0 -167
  80. package/dist/legacy-crypto-inspector-vzXSkm18.js +0 -42
  81. package/dist/legacy-crypto-restore-CIBfOmLn.js +0 -93
  82. package/dist/matrix-migration.runtime-BMCyrANT.js +0 -524
  83. package/dist/migration-snapshot-backup-YcCrSjbE.js +0 -69
  84. package/dist/migration-snapshot.runtime-VGD4QfeS.js +0 -2
  85. package/dist/probe.runtime-2MZLc6ng.js +0 -3
  86. package/dist/runtime-heavy-api.js +0 -3
  87. package/dist/storage-CQdyKcGg.js +0 -430
@@ -26,17 +26,6 @@ function resolveMatrixCredentialsDir(stateDir) {
26
26
  function resolveMatrixCredentialsPath(params) {
27
27
  return path.join(resolveMatrixCredentialsDir(params.stateDir), resolveMatrixCredentialsFilename(params.accountId));
28
28
  }
29
- function resolveMatrixLegacyFlatStoreRoot(stateDir) {
30
- return path.join(stateDir, "matrix");
31
- }
32
- function resolveMatrixLegacyFlatStoragePaths(stateDir) {
33
- const rootDir = resolveMatrixLegacyFlatStoreRoot(stateDir);
34
- return {
35
- rootDir,
36
- storagePath: path.join(rootDir, "bot-storage.json"),
37
- cryptoPath: path.join(rootDir, "crypto")
38
- };
39
- }
40
29
  function resolveMatrixAccountStorageRoot(params) {
41
30
  const accountKey = sanitizeMatrixPathSegment(params.accountId ?? DEFAULT_ACCOUNT_ID);
42
31
  const userKey = sanitizeMatrixPathSegment(params.userId);
@@ -49,4 +38,4 @@ function resolveMatrixAccountStorageRoot(params) {
49
38
  };
50
39
  }
51
40
  //#endregion
52
- export { resolveMatrixCredentialsPath as a, resolveMatrixLegacyFlatStoreRoot as c, resolveMatrixCredentialsFilename as i, sanitizeMatrixPathSegment as l, resolveMatrixAccountStorageRoot as n, resolveMatrixHomeserverKey as o, resolveMatrixCredentialsDir as r, resolveMatrixLegacyFlatStoragePaths as s, hashMatrixAccessToken as t };
41
+ export { resolveMatrixCredentialsPath as a, resolveMatrixCredentialsFilename as i, resolveMatrixAccountStorageRoot as n, resolveMatrixHomeserverKey as o, resolveMatrixCredentialsDir as r, sanitizeMatrixPathSegment as s, hashMatrixAccessToken as t };
@@ -1,14 +1,13 @@
1
- import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
1
+ import { t as getMatrixRuntime } from "./runtime-CveSqMOP.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 { O as resolveMatrixSqliteStateEnv, k as resolveMatrixSqliteStateKey } from "./crypto-state-store-Jy3qwhdy.js";
4
- import { c as resolveMatrixStateFilePath, t as claimCurrentTokenStorageState } from "./storage-CQdyKcGg.js";
5
- import { a as sendMessageMatrix } from "./send-D92v6Yy0.js";
3
+ import { M as resolveMatrixSqliteStateEnv, N as resolveMatrixSqliteStateKey, c as resolveMatrixStateFilePath, t as claimCurrentTokenStorageState } from "./storage-BtSOar8T.js";
4
+ import { a as sendMessageMatrix } from "./send-C7xuGWpv.js";
6
5
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
7
6
  import path from "node:path";
8
7
  import { createHash } from "node:crypto";
9
8
  import { registerSessionBindingAdapter, resolveThreadBindingFarewellText, unregisterSessionBindingAdapter } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
10
- import { readJsonFileWithFallback } from "openclaw/plugin-sdk/json-store";
11
9
  import fs from "node:fs/promises";
10
+ import { readJsonFileWithFallback } from "openclaw/plugin-sdk/json-store";
12
11
  import { resolveAgentIdFromSessionKey } from "openclaw/plugin-sdk/session-key-runtime";
13
12
  //#region extensions/matrix/src/matrix/thread-bindings.ts
14
13
  const STORE_VERSION = 1;
@@ -1,13 +1,17 @@
1
- import { a as resolveMatrixAccountConfig } from "./account-config-BZWN9tGS.js";
2
- import "./setup-core-BGgbrdaJ.js";
3
- import { E as parsePollStart, T as isPollStartType, b as buildPollResponseContent, i as reactMatrixMessage, u as resolveMatrixRoomId } from "./send-D92v6Yy0.js";
1
+ import { a as resolveMatrixAccountConfig, o as resolveMatrixBaseConfig } from "./account-config-BZWN9tGS.js";
2
+ import { g as resolveMatrixAccount } from "./setup-core-DlmTyIP0.js";
3
+ import { r as resolveMatrixRoomConfig } from "./channel-CxqDh7mS.js";
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-C7xuGWpv.js";
4
6
  import { i as buildMatrixReactionRelationsPath, o as selectOwnMatrixReactionEventIds, s as summarizeMatrixReactionEvents } from "./reaction-common-DkrQdBSZ.js";
5
- import { n as withResolvedActionClient, r as withResolvedRoomAction } from "./client-FRuyCNju.js";
6
- 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-DRKkiEY-.js";
7
- import { a as jsonResult, c as readStringArrayParam, l as readStringParam, o as readPositiveIntegerParam, r as createActionGate, s as readReactionParams } from "./runtime-api-CsBoesCU.js";
8
- import { t as applyMatrixProfileUpdate } from "./profile-update-Ucc8RrJL.js";
9
- 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-BGCMiO1p.js";
7
+ import { n as withResolvedActionClient, r as withResolvedRoomAction } from "./client-ClHisZbf.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-Dm3K4ZvM.js";
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-iUHCoks3.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-DLSe3sP7.js";
12
+ import { t as createMatrixRoomInfoResolver } from "./room-info-B6vKD5DF.js";
10
13
  import { normalizeOptionalLowercaseString, uniqueStrings, uniqueValues } from "openclaw/plugin-sdk/string-coerce-runtime";
14
+ import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
11
15
  //#region extensions/matrix/src/matrix/actions/polls.ts
12
16
  function normalizeOptionIndexes(indexes) {
13
17
  return uniqueValues(indexes.map((index) => Math.trunc(index)).filter((index) => Number.isFinite(index) && index > 0));
@@ -116,9 +120,10 @@ async function listMatrixPins(roomId, opts = {}) {
116
120
  }
117
121
  //#endregion
118
122
  //#region extensions/matrix/src/matrix/actions/room.ts
119
- async function getMatrixMemberInfo(userId, opts = {}) {
123
+ async function getMatrixMemberInfo(userId, opts) {
120
124
  return await withResolvedActionClient(opts, async (client) => {
121
- const roomId = opts.roomId ? await resolveMatrixRoomId(client, opts.roomId) : void 0;
125
+ const roomId = await resolveMatrixRoomId(client, opts.roomId);
126
+ if (!(await client.getJoinedRoomMembers(roomId)).includes(userId)) throw new Error(`User ${userId} is not a member of room ${roomId}`);
122
127
  const profile = await client.getUserProfile(userId);
123
128
  return {
124
129
  userId,
@@ -129,7 +134,7 @@ async function getMatrixMemberInfo(userId, opts = {}) {
129
134
  membership: null,
130
135
  powerLevel: null,
131
136
  displayName: profile?.displayname ?? null,
132
- roomId: roomId ?? null
137
+ roomId
133
138
  };
134
139
  });
135
140
  }
@@ -165,6 +170,126 @@ async function getMatrixRoomInfo(roomId, opts = {}) {
165
170
  });
166
171
  }
167
172
  //#endregion
173
+ //#region extensions/matrix/src/matrix/read-policy.ts
174
+ function normalizeRoomId(raw) {
175
+ return raw?.trim().replace(/^room:/i, "") ?? "";
176
+ }
177
+ function isCurrentRoom(params) {
178
+ return params.context?.currentChannelProvider?.trim().toLowerCase() === "matrix" && params.context.requesterAccountId?.trim() === params.accountId && normalizeRoomId(params.context.currentChannelId) === normalizeRoomId(params.roomId);
179
+ }
180
+ function includesEntry(entries, value) {
181
+ const normalized = value.trim().toLowerCase();
182
+ return (entries ?? []).some((entry) => {
183
+ const candidate = String(entry).replace(/^matrix:/i, "").trim().toLowerCase();
184
+ return candidate === "*" || candidate === normalized;
185
+ });
186
+ }
187
+ function hasWildcardEntry(entries) {
188
+ return (entries ?? []).some((entry) => String(entry).replace(/^matrix:/i, "").trim() === "*");
189
+ }
190
+ function resolveMatrixReadRoomPolicy(params) {
191
+ const room = resolveMatrixRoomConfig({
192
+ rooms: params.account.config.groups ?? params.account.config.rooms,
193
+ roomId: params.roomId,
194
+ aliases: params.aliases
195
+ });
196
+ const baseRoom = resolveMatrixRoomConfig({
197
+ rooms: params.baseConfig.groups ?? params.baseConfig.rooms,
198
+ roomId: params.roomId,
199
+ aliases: params.aliases
200
+ });
201
+ const baseRoomAccount = baseRoom.config?.account;
202
+ const explicitlyScopedToAnotherAccount = room.config === void 0 && baseRoom.matchSource === "direct" && typeof baseRoomAccount === "string" && normalizeAccountId(baseRoomAccount) !== params.account.accountId;
203
+ const accountMatches = !room.config?.account || room.config.account === params.account.accountId;
204
+ const configuredRoomBlocked = room.config !== void 0 && (!room.allowed || !accountMatches);
205
+ return {
206
+ blocked: explicitlyScopedToAnotherAccount || configuredRoomBlocked,
207
+ blockedBeforeProviderAccess: explicitlyScopedToAnotherAccount || room.matchSource === "direct" && configuredRoomBlocked,
208
+ room
209
+ };
210
+ }
211
+ async function classifyMatrixReadRoom(params) {
212
+ const members = await readJoinedMatrixMembers(params.client, params.roomId);
213
+ if (!members) return { kind: "unknown" };
214
+ if (members.length >= 3) return { kind: "group" };
215
+ if (members.length !== 2) return { kind: "unknown" };
216
+ const selfUserId = await params.client.getUserId().catch(() => null);
217
+ if (!selfUserId || !members.includes(selfUserId)) return { kind: "unknown" };
218
+ const remoteUserId = members.find((member) => member !== selfUserId);
219
+ if (!isStrictDirectMembership({
220
+ selfUserId,
221
+ remoteUserId,
222
+ joinedMembers: members
223
+ }) || !remoteUserId) return { kind: "unknown" };
224
+ const memberStateFlag = await hasDirectMatrixMemberFlag(params.client, params.roomId, selfUserId);
225
+ await params.client.dms.update().catch(() => false);
226
+ if (memberStateFlag === true || params.client.dms.isDm(params.roomId)) return {
227
+ kind: "direct",
228
+ remoteUserId
229
+ };
230
+ return memberStateFlag === false ? { kind: "group" } : { kind: "unknown" };
231
+ }
232
+ async function withAuthorizedMatrixReadTarget(params) {
233
+ const account = resolveMatrixAccount({
234
+ cfg: params.cfg,
235
+ accountId: params.accountId
236
+ });
237
+ const baseConfig = resolveMatrixBaseConfig(params.cfg);
238
+ if (resolveMatrixReadRoomPolicy({
239
+ account,
240
+ baseConfig,
241
+ roomId: normalizeMatrixResolvableTarget(params.roomId),
242
+ aliases: []
243
+ }).blockedBeforeProviderAccess) throw new ToolAuthorizationError("Matrix read target is not allowed.");
244
+ return await withResolvedActionClient(params.opts, async (client) => {
245
+ const roomId = await resolveMatrixRoomId(client, params.roomId);
246
+ const inputAlias = params.roomId.trim().startsWith("#") ? params.roomId.trim() : void 0;
247
+ const { getRoomInfo } = createMatrixRoomInfoResolver(client);
248
+ const roomInfo = await getRoomInfo(roomId, { includeAliases: true });
249
+ const mutableRoomName = account.config.dangerouslyAllowNameMatching === true ? roomInfo.name : void 0;
250
+ const aliases = [
251
+ inputAlias,
252
+ roomInfo.canonicalAlias,
253
+ ...roomInfo.altAliases,
254
+ mutableRoomName
255
+ ].filter((value) => Boolean(value));
256
+ const finalPolicy = resolveMatrixReadRoomPolicy({
257
+ account,
258
+ baseConfig,
259
+ roomId,
260
+ aliases
261
+ });
262
+ const room = finalPolicy.room;
263
+ const current = isCurrentRoom({
264
+ accountId: account.accountId,
265
+ context: params.context,
266
+ roomId
267
+ });
268
+ const currentChatType = params.context?.currentChatType?.trim().toLowerCase();
269
+ const trustedCurrentClassification = currentChatType === "direct" ? {
270
+ kind: "direct",
271
+ remoteUserId: ""
272
+ } : currentChatType === "group" || currentChatType === "channel" ? { kind: "group" } : null;
273
+ const classification = room.matchSource === "direct" ? { kind: "group" } : current && trustedCurrentClassification ? trustedCurrentClassification : await classifyMatrixReadRoom({
274
+ client,
275
+ roomId
276
+ });
277
+ const resolvedGroupPolicy = resolveAllowlistProviderRuntimeGroupPolicy({
278
+ providerConfigPresent: params.cfg.channels?.matrix !== void 0,
279
+ groupPolicy: account.config.groupPolicy,
280
+ defaultGroupPolicy: resolveDefaultGroupPolicy(params.cfg)
281
+ }).groupPolicy;
282
+ const groupPolicy = account.config.allowlistOnly && resolvedGroupPolicy === "open" ? "allowlist" : resolvedGroupPolicy;
283
+ const dmPolicy = account.config.allowlistOnly ? account.config.dm?.policy === "disabled" ? "disabled" : "allowlist" : account.config.dm?.policy ?? "pairing";
284
+ const directOperator = params.context?.conversationReadOrigin === "direct-operator";
285
+ if (!(finalPolicy.blocked ? false : directOperator ? classification.kind === "direct" ? account.config.dm?.enabled !== false && dmPolicy !== "disabled" : classification.kind === "group" ? groupPolicy !== "disabled" : groupPolicy !== "disabled" && dmPolicy !== "disabled" && account.config.dm?.enabled !== false : classification.kind === "direct" ? account.config.dm?.enabled !== false && dmPolicy !== "disabled" && (current || includesEntry(account.config.dm?.allowFrom, classification.remoteUserId)) : classification.kind === "group" ? groupPolicy !== "disabled" && (current || groupPolicy === "open" || room.config !== void 0) : current ? groupPolicy !== "disabled" && dmPolicy !== "disabled" && account.config.dm?.enabled !== false : groupPolicy === "open" && dmPolicy !== "disabled" && account.config.dm?.enabled !== false && hasWildcardEntry(account.config.dm?.allowFrom))) throw new ToolAuthorizationError("Matrix read target is not allowed.");
286
+ return await params.run({
287
+ client,
288
+ roomId
289
+ });
290
+ });
291
+ }
292
+ //#endregion
168
293
  //#region extensions/matrix/src/tool-actions.ts
169
294
  const messageActions = /* @__PURE__ */ new Set([
170
295
  "sendMessage",
@@ -247,6 +372,14 @@ async function handleMatrixAction(params, cfg, opts = {}) {
247
372
  cfg,
248
373
  ...accountId ? { accountId } : {}
249
374
  };
375
+ const withReadTarget = async (roomId, run) => await withAuthorizedMatrixReadTarget({
376
+ cfg,
377
+ accountId,
378
+ roomId,
379
+ context: opts.readContext,
380
+ opts: clientOpts,
381
+ run
382
+ });
250
383
  if (reactionActions.has(action)) {
251
384
  if (!isActionEnabled("reactions")) throw new Error("Matrix reactions are disabled.");
252
385
  const roomId = readRoomId(params);
@@ -255,12 +388,20 @@ async function handleMatrixAction(params, cfg, opts = {}) {
255
388
  const { emoji, remove, isEmpty } = readReactionParams(params, { removeErrorMessage: "Emoji is required to remove a Matrix reaction." });
256
389
  if (remove || isEmpty) return jsonResult({
257
390
  ok: true,
258
- removed: (await removeMatrixReactions(roomId, messageId, {
259
- ...clientOpts,
260
- emoji: remove ? emoji : void 0
391
+ removed: (await withReadTarget(roomId, async (target) => {
392
+ return await removeMatrixReactions(target.roomId, messageId, {
393
+ ...clientOpts,
394
+ client: target.client,
395
+ emoji: remove ? emoji : void 0
396
+ });
261
397
  })).removed
262
398
  });
263
- await reactMatrixMessage(roomId, messageId, emoji, clientOpts);
399
+ await withReadTarget(roomId, async (target) => {
400
+ await reactMatrixMessage(target.roomId, messageId, emoji, {
401
+ ...clientOpts,
402
+ client: target.client
403
+ });
404
+ });
264
405
  return jsonResult({
265
406
  ok: true,
266
407
  added: emoji
@@ -269,9 +410,12 @@ async function handleMatrixAction(params, cfg, opts = {}) {
269
410
  const limit = readPositiveIntegerParam(params, "limit", { message: "limit must be a positive integer." });
270
411
  return jsonResult({
271
412
  ok: true,
272
- reactions: await listMatrixReactions(roomId, messageId, {
273
- ...clientOpts,
274
- limit: limit ?? void 0
413
+ reactions: await withReadTarget(roomId, async (target) => {
414
+ return await listMatrixReactions(target.roomId, messageId, {
415
+ ...clientOpts,
416
+ client: target.client,
417
+ limit: limit ?? void 0
418
+ });
275
419
  })
276
420
  });
277
421
  }
@@ -285,10 +429,13 @@ async function handleMatrixAction(params, cfg, opts = {}) {
285
429
  const optionIndexes = [...readPositiveIntegerArrayParam(params, "pollOptionIndexes"), ...optionIndex !== void 0 ? [optionIndex] : []];
286
430
  return jsonResult({
287
431
  ok: true,
288
- result: await voteMatrixPoll(roomId, pollId, {
289
- ...clientOpts,
290
- optionIds,
291
- optionIndexes
432
+ result: await withReadTarget(roomId, async (target) => {
433
+ return await voteMatrixPoll(target.roomId, pollId, {
434
+ ...clientOpts,
435
+ client: target.client,
436
+ optionIds,
437
+ optionIndexes
438
+ });
292
439
  })
293
440
  });
294
441
  }
@@ -317,19 +464,36 @@ async function handleMatrixAction(params, cfg, opts = {}) {
317
464
  })
318
465
  });
319
466
  }
320
- case "editMessage": return jsonResult({
321
- ok: true,
322
- result: await editMatrixMessage(readRoomId(params), readStringParam(params, "messageId", { required: true }), readStringParam(params, "content", { required: true }), clientOpts)
323
- });
324
- case "deleteMessage":
325
- await deleteMatrixMessage(readRoomId(params), readStringParam(params, "messageId", { required: true }), {
326
- reason: readStringParam(params, "reason") ?? void 0,
327
- ...clientOpts
467
+ case "editMessage": {
468
+ const roomId = readRoomId(params);
469
+ const messageId = readStringParam(params, "messageId", { required: true });
470
+ const content = readStringParam(params, "content", { required: true });
471
+ return jsonResult({
472
+ ok: true,
473
+ result: await withReadTarget(roomId, async (target) => {
474
+ return await editMatrixMessage(target.roomId, messageId, content, {
475
+ ...clientOpts,
476
+ client: target.client
477
+ });
478
+ })
479
+ });
480
+ }
481
+ case "deleteMessage": {
482
+ const roomId = readRoomId(params);
483
+ const messageId = readStringParam(params, "messageId", { required: true });
484
+ const reason = readStringParam(params, "reason");
485
+ await withReadTarget(roomId, async (target) => {
486
+ await deleteMatrixMessage(target.roomId, messageId, {
487
+ reason: reason ?? void 0,
488
+ ...clientOpts,
489
+ client: target.client
490
+ });
328
491
  });
329
492
  return jsonResult({
330
493
  ok: true,
331
494
  deleted: true
332
495
  });
496
+ }
333
497
  case "readMessages": {
334
498
  const roomId = readRoomId(params);
335
499
  const limit = readPositiveIntegerParam(params, "limit", { message: "limit must be a positive integer." });
@@ -338,12 +502,15 @@ async function handleMatrixAction(params, cfg, opts = {}) {
338
502
  const threadId = readStringParam(params, "threadId");
339
503
  return jsonResult({
340
504
  ok: true,
341
- ...await readMatrixMessages(roomId, {
342
- limit: limit ?? void 0,
343
- before: before ?? void 0,
344
- after: after ?? void 0,
345
- threadId: threadId ?? void 0,
346
- ...clientOpts
505
+ ...await withReadTarget(roomId, async (target) => {
506
+ return await readMatrixMessages(target.roomId, {
507
+ limit: limit ?? void 0,
508
+ before: before ?? void 0,
509
+ after: after ?? void 0,
510
+ threadId: threadId ?? void 0,
511
+ ...clientOpts,
512
+ client: target.client
513
+ });
347
514
  })
348
515
  });
349
516
  }
@@ -353,19 +520,32 @@ async function handleMatrixAction(params, cfg, opts = {}) {
353
520
  if (pinActions.has(action)) {
354
521
  if (!isActionEnabled("pins")) throw new Error("Matrix pins are disabled.");
355
522
  const roomId = readRoomId(params);
356
- if (action === "pinMessage") return jsonResult({
357
- ok: true,
358
- pinned: (await pinMatrixMessage(roomId, readStringParam(params, "messageId", { required: true }), clientOpts)).pinned
359
- });
360
- if (action === "unpinMessage") return jsonResult({
361
- ok: true,
362
- pinned: (await unpinMatrixMessage(roomId, readStringParam(params, "messageId", { required: true }), clientOpts)).pinned
363
- });
364
- const result = await listMatrixPins(roomId, clientOpts);
365
- return jsonResult({
366
- ok: true,
367
- pinned: result.pinned,
368
- events: result.events
523
+ const request = action === "pinMessage" ? {
524
+ kind: "pin",
525
+ messageId: readStringParam(params, "messageId", { required: true })
526
+ } : action === "unpinMessage" ? {
527
+ kind: "unpin",
528
+ messageId: readStringParam(params, "messageId", { required: true })
529
+ } : { kind: "list" };
530
+ return await withReadTarget(roomId, async (target) => {
531
+ const actionOpts = {
532
+ ...clientOpts,
533
+ client: target.client
534
+ };
535
+ if (request.kind === "pin") return jsonResult({
536
+ ok: true,
537
+ pinned: (await pinMatrixMessage(target.roomId, request.messageId, actionOpts)).pinned
538
+ });
539
+ if (request.kind === "unpin") return jsonResult({
540
+ ok: true,
541
+ pinned: (await unpinMatrixMessage(target.roomId, request.messageId, actionOpts)).pinned
542
+ });
543
+ const result = await listMatrixPins(target.roomId, actionOpts);
544
+ return jsonResult({
545
+ ok: true,
546
+ pinned: result.pinned,
547
+ events: result.events
548
+ });
369
549
  });
370
550
  }
371
551
  if (profileActions.has(action)) {
@@ -385,11 +565,15 @@ async function handleMatrixAction(params, cfg, opts = {}) {
385
565
  }
386
566
  if (action === "memberInfo") {
387
567
  if (!isActionEnabled("memberInfo")) throw new Error("Matrix member info is disabled.");
568
+ const userId = readStringParam(params, "userId", { required: true });
388
569
  return jsonResult({
389
570
  ok: true,
390
- member: await getMatrixMemberInfo(readStringParam(params, "userId", { required: true }), {
391
- roomId: readStringParam(params, "roomId") ?? readStringParam(params, "channelId") ?? void 0,
392
- ...clientOpts
571
+ member: await withReadTarget(readRoomId(params), async (target) => {
572
+ return await getMatrixMemberInfo(userId, {
573
+ roomId: target.roomId,
574
+ ...clientOpts,
575
+ client: target.client
576
+ });
393
577
  })
394
578
  });
395
579
  }
@@ -397,7 +581,12 @@ async function handleMatrixAction(params, cfg, opts = {}) {
397
581
  if (!isActionEnabled("channelInfo")) throw new Error("Matrix room info is disabled.");
398
582
  return jsonResult({
399
583
  ok: true,
400
- room: await getMatrixRoomInfo(readRoomId(params), clientOpts)
584
+ room: await withReadTarget(readRoomId(params), async (target) => {
585
+ return await getMatrixRoomInfo(target.roomId, {
586
+ ...clientOpts,
587
+ client: target.client
588
+ });
589
+ })
401
590
  });
402
591
  }
403
592
  if (verificationActions.has(action)) {
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { i as withStartedActionClient, n as withResolvedActionClient } from "./client-FRuyCNju.js";
3
- import { n as formatMatrixEncryptionUnavailableError } from "./encryption-guidance-D8walY04.js";
2
+ import { i as withStartedActionClient, n as withResolvedActionClient } from "./client-ClHisZbf.js";
3
+ import { n as formatMatrixEncryptionUnavailableError } from "./encryption-guidance-BFfgq7c7.js";
4
4
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
6
6
  import { setTimeout } from "node:timers/promises";
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@openclaw/matrix",
3
- "version": "2026.7.1-beta.6",
3
+ "version": "2026.7.2-beta.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/matrix",
9
- "version": "2026.7.1-beta.6",
9
+ "version": "2026.7.2-beta.1",
10
10
  "dependencies": {
11
11
  "@matrix-org/matrix-sdk-crypto-nodejs": "0.6.1",
12
12
  "@matrix-org/matrix-sdk-crypto-wasm": "18.3.1",
@@ -18,7 +18,7 @@
18
18
  "zod": "4.4.3"
19
19
  },
20
20
  "peerDependencies": {
21
- "openclaw": ">=2026.7.1-beta.6"
21
+ "openclaw": ">=2026.7.2-beta.1"
22
22
  },
23
23
  "peerDependenciesMeta": {
24
24
  "openclaw": {
@@ -349,12 +349,10 @@
349
349
  "allowlist_quote"
350
350
  ]
351
351
  },
352
- "blockStreaming": {
353
- "type": "boolean"
354
- },
355
352
  "streaming": {
356
- "anyOf": [
357
- {
353
+ "type": "object",
354
+ "properties": {
355
+ "mode": {
358
356
  "type": "string",
359
357
  "enum": [
360
358
  "partial",
@@ -363,70 +361,90 @@
363
361
  "off"
364
362
  ]
365
363
  },
366
- {
367
- "type": "boolean"
364
+ "chunkMode": {
365
+ "type": "string",
366
+ "enum": [
367
+ "length",
368
+ "newline"
369
+ ]
368
370
  },
369
- {
371
+ "block": {
370
372
  "type": "object",
371
373
  "properties": {
372
- "mode": {
373
- "type": "string",
374
- "enum": [
375
- "partial",
376
- "quiet",
377
- "progress",
378
- "off"
379
- ]
374
+ "enabled": {
375
+ "type": "boolean"
380
376
  },
381
- "progress": {
377
+ "coalesce": {
382
378
  "type": "object",
383
379
  "properties": {
384
- "label": {
385
- "anyOf": [
386
- {
387
- "type": "string"
388
- },
389
- {
390
- "type": "boolean",
391
- "const": false
392
- }
393
- ]
394
- },
395
- "labels": {
396
- "type": "array",
397
- "items": {
398
- "type": "string"
399
- }
400
- },
401
- "maxLines": {
380
+ "minChars": {
402
381
  "type": "integer",
403
382
  "exclusiveMinimum": 0,
404
383
  "maximum": 9007199254740991
405
384
  },
406
- "maxLineChars": {
385
+ "maxChars": {
407
386
  "type": "integer",
408
387
  "exclusiveMinimum": 0,
409
388
  "maximum": 9007199254740991
410
389
  },
411
- "toolProgress": {
412
- "type": "boolean"
390
+ "idleMs": {
391
+ "type": "integer",
392
+ "minimum": 0,
393
+ "maximum": 9007199254740991
413
394
  }
414
395
  },
415
396
  "additionalProperties": false
416
- },
417
- "preview": {
418
- "type": "object",
419
- "properties": {
420
- "toolProgress": {
421
- "type": "boolean"
397
+ }
398
+ },
399
+ "additionalProperties": false
400
+ },
401
+ "progress": {
402
+ "type": "object",
403
+ "properties": {
404
+ "label": {
405
+ "anyOf": [
406
+ {
407
+ "type": "string"
408
+ },
409
+ {
410
+ "type": "boolean",
411
+ "const": false
422
412
  }
423
- },
424
- "additionalProperties": false
413
+ ]
414
+ },
415
+ "labels": {
416
+ "type": "array",
417
+ "items": {
418
+ "type": "string"
419
+ }
420
+ },
421
+ "maxLines": {
422
+ "type": "integer",
423
+ "exclusiveMinimum": 0,
424
+ "maximum": 9007199254740991
425
+ },
426
+ "maxLineChars": {
427
+ "type": "integer",
428
+ "exclusiveMinimum": 0,
429
+ "maximum": 9007199254740991
430
+ },
431
+ "toolProgress": {
432
+ "type": "boolean"
433
+ }
434
+ },
435
+ "additionalProperties": false
436
+ },
437
+ "preview": {
438
+ "type": "object",
439
+ "properties": {
440
+ "toolProgress": {
441
+ "type": "boolean"
425
442
  }
426
443
  },
427
444
  "additionalProperties": false
428
445
  }
429
- ]
446
+ },
447
+ "additionalProperties": false
430
448
  },
431
449
  "replyToMode": {
432
450
  "type": "string",
@@ -448,13 +466,6 @@
448
466
  "textChunkLimit": {
449
467
  "type": "number"
450
468
  },
451
- "chunkMode": {
452
- "type": "string",
453
- "enum": [
454
- "length",
455
- "newline"
456
- ]
457
- },
458
469
  "responsePrefix": {
459
470
  "type": "string"
460
471
  },
@@ -941,7 +952,7 @@
941
952
  },
942
953
  "streaming.progress.labels": {
943
954
  "label": "Matrix Progress Label Pool",
944
- "help": "Candidate labels for streaming.progress.label=\"auto\". Leave unset to use OpenClaw built-in progress labels."
955
+ "help": "Candidate labels for streaming.progress.label=\"auto\". Leave unset to use the built-in \"Working\" label."
945
956
  },
946
957
  "streaming.progress.maxLines": {
947
958
  "label": "Matrix Progress Max Lines",