Matrix: tighten verification trust and expose profile updates

This commit is contained in:
Gustavo Madeira Santana
2026-03-08 22:39:37 -04:00
parent 9101916e53
commit 50568f29d5
21 changed files with 453 additions and 78 deletions

View File

@@ -156,6 +156,14 @@ describe("message tool schema scoping", () => {
actions: ["send", "poll", "poll-vote"],
});
const matrixPlugin = createChannelPlugin({
id: "matrix",
label: "Matrix",
docsPath: "/channels/matrix",
blurb: "Matrix test plugin.",
actions: ["send", "set-profile"],
});
afterEach(() => {
setActivePluginRegistry(createTestRegistry([]));
});
@@ -191,6 +199,7 @@ describe("message tool schema scoping", () => {
createTestRegistry([
{ pluginId: "telegram", source: "test", plugin: telegramPlugin },
{ pluginId: "discord", source: "test", plugin: discordPlugin },
{ pluginId: "matrix", source: "test", plugin: matrixPlugin },
]),
);
@@ -235,6 +244,8 @@ describe("message tool schema scoping", () => {
expect(properties.pollId).toBeDefined();
expect(properties.pollOptionIndex).toBeDefined();
expect(properties.pollOptionId).toBeDefined();
expect(properties.avatarUrl).toBeDefined();
expect(properties.displayName).toBeDefined();
},
);

View File

@@ -421,6 +421,33 @@ function buildPresenceSchema() {
};
}
function buildProfileSchema() {
return {
displayName: Type.Optional(
Type.String({
description: "Profile display name for self-profile update actions.",
}),
),
display_name: Type.Optional(
Type.String({
description: "snake_case alias of displayName for self-profile update actions.",
}),
),
avatarUrl: Type.Optional(
Type.String({
description:
"Profile avatar URL for self-profile update actions. Matrix accepts mxc:// and http(s) URLs.",
}),
),
avatar_url: Type.Optional(
Type.String({
description:
"snake_case alias of avatarUrl for self-profile update actions. Matrix accepts mxc:// and http(s) URLs.",
}),
),
};
}
function buildChannelManagementSchema() {
return {
name: Type.Optional(Type.String()),
@@ -459,6 +486,7 @@ function buildMessageToolSchemaProps(options: {
...buildGatewaySchema(),
...buildChannelManagementSchema(),
...buildPresenceSchema(),
...buildProfileSchema(),
};
}

View File

@@ -51,6 +51,7 @@ export const CHANNEL_MESSAGE_ACTION_NAMES = [
"kick",
"ban",
"set-presence",
"set-profile",
"download-file",
] as const;

View File

@@ -56,6 +56,7 @@ export const MESSAGE_ACTION_TARGET_MODE: Record<ChannelMessageActionName, Messag
kick: "none",
ban: "none",
"set-presence": "none",
"set-profile": "none",
"download-file": "none",
};