@openclaw/matrix 2026.2.2 → 2026.2.6
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 +12 -0
- package/package.json +1 -1
- package/src/config-schema.ts +1 -0
- package/src/matrix/monitor/handler.ts +9 -5
- package/src/onboarding.ts +24 -17
- package/src/types.ts +2 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/config-schema.ts
CHANGED
|
@@ -51,6 +51,7 @@ export const MatrixConfigSchema = z.object({
|
|
|
51
51
|
threadReplies: z.enum(["off", "inbound", "always"]).optional(),
|
|
52
52
|
textChunkLimit: z.number().optional(),
|
|
53
53
|
chunkMode: z.enum(["length", "newline"]).optional(),
|
|
54
|
+
responsePrefix: z.string().optional(),
|
|
54
55
|
mediaMaxMb: z.number().optional(),
|
|
55
56
|
autoJoin: z.enum(["always", "allowlist", "off"]).optional(),
|
|
56
57
|
autoJoinAllowlist: z.array(allowFromEntry).optional(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LocationMessageEventContent, MatrixClient } from "@vector-im/matrix-bot-sdk";
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
createReplyPrefixOptions,
|
|
4
4
|
createTypingCallbacks,
|
|
5
5
|
formatAllowlistMatchMeta,
|
|
6
6
|
logInboundDrop,
|
|
@@ -579,7 +579,12 @@ export function createMatrixRoomMessageHandler(params: MatrixMonitorHandlerParam
|
|
|
579
579
|
channel: "matrix",
|
|
580
580
|
accountId: route.accountId,
|
|
581
581
|
});
|
|
582
|
-
const
|
|
582
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
583
|
+
cfg,
|
|
584
|
+
agentId: route.agentId,
|
|
585
|
+
channel: "matrix",
|
|
586
|
+
accountId: route.accountId,
|
|
587
|
+
});
|
|
583
588
|
const typingCallbacks = createTypingCallbacks({
|
|
584
589
|
start: () => sendTypingMatrix(roomId, true, undefined, client),
|
|
585
590
|
stop: () => sendTypingMatrix(roomId, false, undefined, client),
|
|
@@ -604,8 +609,7 @@ export function createMatrixRoomMessageHandler(params: MatrixMonitorHandlerParam
|
|
|
604
609
|
});
|
|
605
610
|
const { dispatcher, replyOptions, markDispatchIdle } =
|
|
606
611
|
core.channel.reply.createReplyDispatcherWithTyping({
|
|
607
|
-
|
|
608
|
-
responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
|
|
612
|
+
...prefixOptions,
|
|
609
613
|
humanDelay: core.channel.reply.resolveHumanDelayConfig(cfg, route.agentId),
|
|
610
614
|
deliver: async (payload) => {
|
|
611
615
|
await deliverMatrixReplies({
|
|
@@ -635,7 +639,7 @@ export function createMatrixRoomMessageHandler(params: MatrixMonitorHandlerParam
|
|
|
635
639
|
replyOptions: {
|
|
636
640
|
...replyOptions,
|
|
637
641
|
skillFilter: roomConfig?.skills,
|
|
638
|
-
onModelSelected
|
|
642
|
+
onModelSelected,
|
|
639
643
|
},
|
|
640
644
|
});
|
|
641
645
|
markDispatchIdle();
|
package/src/onboarding.ts
CHANGED
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
} from "openclaw/plugin-sdk";
|
|
9
9
|
import type { CoreConfig, DmPolicy } from "./types.js";
|
|
10
10
|
import { listMatrixDirectoryGroupsLive } from "./directory-live.js";
|
|
11
|
-
import { listMatrixDirectoryPeersLive } from "./directory-live.js";
|
|
12
11
|
import { resolveMatrixAccount } from "./matrix/accounts.js";
|
|
13
12
|
import { ensureMatrixSdkInstalled, isMatrixSdkAvailable } from "./matrix/deps.js";
|
|
13
|
+
import { resolveMatrixTargets } from "./resolve-targets.js";
|
|
14
14
|
|
|
15
15
|
const channel = "matrix" as const;
|
|
16
16
|
|
|
@@ -65,14 +65,16 @@ async function promptMatrixAllowFrom(params: {
|
|
|
65
65
|
|
|
66
66
|
while (true) {
|
|
67
67
|
const entry = await prompter.text({
|
|
68
|
-
message: "Matrix allowFrom (
|
|
68
|
+
message: "Matrix allowFrom (full @user:server; display name only if unique)",
|
|
69
69
|
placeholder: "@user:server",
|
|
70
70
|
initialValue: existingAllowFrom[0] ? String(existingAllowFrom[0]) : undefined,
|
|
71
71
|
validate: (value) => (String(value ?? "").trim() ? undefined : "Required"),
|
|
72
72
|
});
|
|
73
73
|
const parts = parseInput(String(entry));
|
|
74
74
|
const resolvedIds: string[] = [];
|
|
75
|
-
|
|
75
|
+
const pending: string[] = [];
|
|
76
|
+
const unresolved: string[] = [];
|
|
77
|
+
const unresolvedNotes: string[] = [];
|
|
76
78
|
|
|
77
79
|
for (const part of parts) {
|
|
78
80
|
if (isFullUserId(part)) {
|
|
@@ -83,28 +85,33 @@ async function promptMatrixAllowFrom(params: {
|
|
|
83
85
|
unresolved.push(part);
|
|
84
86
|
continue;
|
|
85
87
|
}
|
|
86
|
-
|
|
88
|
+
pending.push(part);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (pending.length > 0) {
|
|
92
|
+
const results = await resolveMatrixTargets({
|
|
87
93
|
cfg,
|
|
88
|
-
|
|
89
|
-
|
|
94
|
+
inputs: pending,
|
|
95
|
+
kind: "user",
|
|
90
96
|
}).catch(() => []);
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
)
|
|
97
|
+
for (const result of results) {
|
|
98
|
+
if (result?.resolved && result.id) {
|
|
99
|
+
resolvedIds.push(result.id);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (result?.input) {
|
|
103
|
+
unresolved.push(result.input);
|
|
104
|
+
if (result.note) {
|
|
105
|
+
unresolvedNotes.push(`${result.input}: ${result.note}`);
|
|
106
|
+
}
|
|
99
107
|
}
|
|
100
|
-
} else {
|
|
101
|
-
unresolved.push(part);
|
|
102
108
|
}
|
|
103
109
|
}
|
|
104
110
|
|
|
105
111
|
if (unresolved.length > 0) {
|
|
112
|
+
const details = unresolvedNotes.length > 0 ? unresolvedNotes : unresolved;
|
|
106
113
|
await prompter.note(
|
|
107
|
-
`Could not resolve
|
|
114
|
+
`Could not resolve:\n${details.join("\n")}\nUse full @user:server IDs.`,
|
|
108
115
|
"Matrix allowlist",
|
|
109
116
|
);
|
|
110
117
|
continue;
|
package/src/types.ts
CHANGED
|
@@ -71,6 +71,8 @@ export type MatrixConfig = {
|
|
|
71
71
|
textChunkLimit?: number;
|
|
72
72
|
/** Chunking mode: "length" (default) splits by size; "newline" splits on every newline. */
|
|
73
73
|
chunkMode?: "length" | "newline";
|
|
74
|
+
/** Outbound response prefix override for this channel/account. */
|
|
75
|
+
responsePrefix?: string;
|
|
74
76
|
/** Max outbound media size in MB. */
|
|
75
77
|
mediaMaxMb?: number;
|
|
76
78
|
/** Auto-join invites (always|allowlist|off). Default: always. */
|