@openclaw/matrix 2026.2.14 → 2026.2.15
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/group-mentions.ts +17 -34
- package/src/matrix/probe.ts +2 -3
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/group-mentions.ts
CHANGED
|
@@ -3,29 +3,33 @@ import type { CoreConfig } from "./types.js";
|
|
|
3
3
|
import { resolveMatrixAccountConfig } from "./matrix/accounts.js";
|
|
4
4
|
import { resolveMatrixRoomConfig } from "./matrix/monitor/rooms.js";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
function stripLeadingPrefixCaseInsensitive(value: string, prefix: string): string {
|
|
7
|
+
return value.toLowerCase().startsWith(prefix.toLowerCase())
|
|
8
|
+
? value.slice(prefix.length).trim()
|
|
9
|
+
: value;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function resolveMatrixRoomConfigForGroup(params: ChannelGroupContext) {
|
|
7
13
|
const rawGroupId = params.groupId?.trim() ?? "";
|
|
8
14
|
let roomId = rawGroupId;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (roomId.toLowerCase().startsWith("channel:")) {
|
|
14
|
-
roomId = roomId.slice("channel:".length).trim();
|
|
15
|
-
}
|
|
16
|
-
if (roomId.toLowerCase().startsWith("room:")) {
|
|
17
|
-
roomId = roomId.slice("room:".length).trim();
|
|
18
|
-
}
|
|
15
|
+
roomId = stripLeadingPrefixCaseInsensitive(roomId, "matrix:");
|
|
16
|
+
roomId = stripLeadingPrefixCaseInsensitive(roomId, "channel:");
|
|
17
|
+
roomId = stripLeadingPrefixCaseInsensitive(roomId, "room:");
|
|
18
|
+
|
|
19
19
|
const groupChannel = params.groupChannel?.trim() ?? "";
|
|
20
20
|
const aliases = groupChannel ? [groupChannel] : [];
|
|
21
21
|
const cfg = params.cfg as CoreConfig;
|
|
22
22
|
const matrixConfig = resolveMatrixAccountConfig({ cfg, accountId: params.accountId });
|
|
23
|
-
|
|
23
|
+
return resolveMatrixRoomConfig({
|
|
24
24
|
rooms: matrixConfig.groups ?? matrixConfig.rooms,
|
|
25
25
|
roomId,
|
|
26
26
|
aliases,
|
|
27
27
|
name: groupChannel || undefined,
|
|
28
28
|
}).config;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function resolveMatrixGroupRequireMention(params: ChannelGroupContext): boolean {
|
|
32
|
+
const resolved = resolveMatrixRoomConfigForGroup(params);
|
|
29
33
|
if (resolved) {
|
|
30
34
|
if (resolved.autoReply === true) {
|
|
31
35
|
return false;
|
|
@@ -43,27 +47,6 @@ export function resolveMatrixGroupRequireMention(params: ChannelGroupContext): b
|
|
|
43
47
|
export function resolveMatrixGroupToolPolicy(
|
|
44
48
|
params: ChannelGroupContext,
|
|
45
49
|
): GroupToolPolicyConfig | undefined {
|
|
46
|
-
const
|
|
47
|
-
let roomId = rawGroupId;
|
|
48
|
-
const lower = roomId.toLowerCase();
|
|
49
|
-
if (lower.startsWith("matrix:")) {
|
|
50
|
-
roomId = roomId.slice("matrix:".length).trim();
|
|
51
|
-
}
|
|
52
|
-
if (roomId.toLowerCase().startsWith("channel:")) {
|
|
53
|
-
roomId = roomId.slice("channel:".length).trim();
|
|
54
|
-
}
|
|
55
|
-
if (roomId.toLowerCase().startsWith("room:")) {
|
|
56
|
-
roomId = roomId.slice("room:".length).trim();
|
|
57
|
-
}
|
|
58
|
-
const groupChannel = params.groupChannel?.trim() ?? "";
|
|
59
|
-
const aliases = groupChannel ? [groupChannel] : [];
|
|
60
|
-
const cfg = params.cfg as CoreConfig;
|
|
61
|
-
const matrixConfig = resolveMatrixAccountConfig({ cfg, accountId: params.accountId });
|
|
62
|
-
const resolved = resolveMatrixRoomConfig({
|
|
63
|
-
rooms: matrixConfig.groups ?? matrixConfig.rooms,
|
|
64
|
-
roomId,
|
|
65
|
-
aliases,
|
|
66
|
-
name: groupChannel || undefined,
|
|
67
|
-
}).config;
|
|
50
|
+
const resolved = resolveMatrixRoomConfigForGroup(params);
|
|
68
51
|
return resolved?.tools;
|
|
69
52
|
}
|
package/src/matrix/probe.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import type { BaseProbeResult } from "openclaw/plugin-sdk";
|
|
1
2
|
import { createMatrixClient, isBunRuntime } from "./client.js";
|
|
2
3
|
|
|
3
|
-
export type MatrixProbe = {
|
|
4
|
-
ok: boolean;
|
|
4
|
+
export type MatrixProbe = BaseProbeResult & {
|
|
5
5
|
status?: number | null;
|
|
6
|
-
error?: string | null;
|
|
7
6
|
elapsedMs: number;
|
|
8
7
|
userId?: string | null;
|
|
9
8
|
};
|