@openclaw/matrix 2026.2.21 → 2026.2.22
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.
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/channel.ts +8 -2
- package/src/matrix/monitor/handler.ts +4 -3
- package/src/matrix/monitor/index.ts +23 -3
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/channel.ts
CHANGED
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
formatPairingApproveHint,
|
|
7
7
|
normalizeAccountId,
|
|
8
8
|
PAIRING_APPROVED_MESSAGE,
|
|
9
|
+
resolveAllowlistProviderRuntimeGroupPolicy,
|
|
10
|
+
resolveDefaultGroupPolicy,
|
|
9
11
|
setAccountEnabledInConfigSection,
|
|
10
12
|
type ChannelPlugin,
|
|
11
13
|
} from "openclaw/plugin-sdk";
|
|
@@ -169,8 +171,12 @@ export const matrixPlugin: ChannelPlugin<ResolvedMatrixAccount> = {
|
|
|
169
171
|
};
|
|
170
172
|
},
|
|
171
173
|
collectWarnings: ({ account, cfg }) => {
|
|
172
|
-
const defaultGroupPolicy = (cfg as CoreConfig)
|
|
173
|
-
const
|
|
174
|
+
const defaultGroupPolicy = resolveDefaultGroupPolicy(cfg as CoreConfig);
|
|
175
|
+
const { groupPolicy } = resolveAllowlistProviderRuntimeGroupPolicy({
|
|
176
|
+
providerConfigPresent: (cfg as CoreConfig).channels?.matrix !== undefined,
|
|
177
|
+
groupPolicy: account.config.groupPolicy,
|
|
178
|
+
defaultGroupPolicy,
|
|
179
|
+
});
|
|
174
180
|
if (groupPolicy !== "open") {
|
|
175
181
|
return [];
|
|
176
182
|
}
|
|
@@ -218,9 +218,10 @@ export function createMatrixRoomMessageHandler(params: MatrixMonitorHandlerParam
|
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
const senderName = await getMemberDisplayName(roomId, senderId);
|
|
221
|
-
const storeAllowFrom =
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
const storeAllowFrom =
|
|
222
|
+
dmPolicy === "allowlist"
|
|
223
|
+
? []
|
|
224
|
+
: await core.channel.pairing.readAllowFromStore("matrix").catch(() => []);
|
|
224
225
|
const effectiveAllowFrom = normalizeMatrixAllowList([...allowFrom, ...storeAllowFrom]);
|
|
225
226
|
const groupAllowFrom = cfg.channels?.matrix?.groupAllowFrom ?? [];
|
|
226
227
|
const effectiveGroupAllowFrom = normalizeMatrixAllowList(groupAllowFrom);
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { format } from "node:util";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
GROUP_POLICY_BLOCKED_LABEL,
|
|
4
|
+
mergeAllowlist,
|
|
5
|
+
resolveAllowlistProviderRuntimeGroupPolicy,
|
|
6
|
+
resolveDefaultGroupPolicy,
|
|
7
|
+
summarizeMapping,
|
|
8
|
+
warnMissingProviderGroupPolicyFallbackOnce,
|
|
9
|
+
type RuntimeEnv,
|
|
10
|
+
} from "openclaw/plugin-sdk";
|
|
3
11
|
import { resolveMatrixTargets } from "../../resolve-targets.js";
|
|
4
12
|
import { getMatrixRuntime } from "../../runtime.js";
|
|
5
13
|
import type { CoreConfig, ReplyToMode } from "../../types.js";
|
|
@@ -242,8 +250,20 @@ export async function monitorMatrixProvider(opts: MonitorMatrixOpts = {}): Promi
|
|
|
242
250
|
setActiveMatrixClient(client, opts.accountId);
|
|
243
251
|
|
|
244
252
|
const mentionRegexes = core.channel.mentions.buildMentionRegexes(cfg);
|
|
245
|
-
const defaultGroupPolicy = cfg
|
|
246
|
-
const
|
|
253
|
+
const defaultGroupPolicy = resolveDefaultGroupPolicy(cfg);
|
|
254
|
+
const { groupPolicy: groupPolicyRaw, providerMissingFallbackApplied } =
|
|
255
|
+
resolveAllowlistProviderRuntimeGroupPolicy({
|
|
256
|
+
providerConfigPresent: cfg.channels?.matrix !== undefined,
|
|
257
|
+
groupPolicy: accountConfig.groupPolicy,
|
|
258
|
+
defaultGroupPolicy,
|
|
259
|
+
});
|
|
260
|
+
warnMissingProviderGroupPolicyFallbackOnce({
|
|
261
|
+
providerMissingFallbackApplied,
|
|
262
|
+
providerKey: "matrix",
|
|
263
|
+
accountId: account.accountId,
|
|
264
|
+
blockedLabel: GROUP_POLICY_BLOCKED_LABEL.room,
|
|
265
|
+
log: (message) => logVerboseMessage(message),
|
|
266
|
+
});
|
|
247
267
|
const groupPolicy = allowlistOnly && groupPolicyRaw === "open" ? "allowlist" : groupPolicyRaw;
|
|
248
268
|
const replyToMode = opts.replyToMode ?? accountConfig.replyToMode ?? "off";
|
|
249
269
|
const threadReplies = accountConfig.threadReplies ?? "inbound";
|