Agents: add generic poll-vote action support
This commit is contained in:
@@ -148,7 +148,7 @@ describe("message tool schema scoping", () => {
|
||||
label: "Discord",
|
||||
docsPath: "/channels/discord",
|
||||
blurb: "Discord test plugin.",
|
||||
actions: ["send", "poll"],
|
||||
actions: ["send", "poll", "poll-vote"],
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -161,14 +161,14 @@ describe("message tool schema scoping", () => {
|
||||
expectComponents: false,
|
||||
expectButtons: true,
|
||||
expectButtonStyle: true,
|
||||
expectedActions: ["send", "react", "poll"],
|
||||
expectedActions: ["send", "react", "poll", "poll-vote"],
|
||||
},
|
||||
{
|
||||
provider: "discord",
|
||||
expectComponents: true,
|
||||
expectButtons: false,
|
||||
expectButtonStyle: false,
|
||||
expectedActions: ["send", "poll", "react"],
|
||||
expectedActions: ["send", "poll", "poll-vote", "react"],
|
||||
},
|
||||
])(
|
||||
"scopes schema fields for $provider",
|
||||
@@ -209,6 +209,9 @@ describe("message tool schema scoping", () => {
|
||||
for (const action of expectedActions) {
|
||||
expect(actionEnum).toContain(action);
|
||||
}
|
||||
expect(properties.pollId).toBeDefined();
|
||||
expect(properties.pollOptionIndex).toBeDefined();
|
||||
expect(properties.pollOptionId).toBeDefined();
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
@@ -277,6 +277,34 @@ function buildPollSchema() {
|
||||
pollOption: Type.Optional(Type.Array(Type.String())),
|
||||
pollDurationHours: Type.Optional(Type.Number()),
|
||||
pollMulti: Type.Optional(Type.Boolean()),
|
||||
pollId: Type.Optional(Type.String()),
|
||||
pollOptionId: Type.Optional(
|
||||
Type.String({
|
||||
description: "Poll answer id to vote for. Use when the channel exposes stable answer ids.",
|
||||
}),
|
||||
),
|
||||
pollOptionIds: Type.Optional(
|
||||
Type.Array(
|
||||
Type.String({
|
||||
description:
|
||||
"Poll answer ids to vote for in a multiselect poll. Use when the channel exposes stable answer ids.",
|
||||
}),
|
||||
),
|
||||
),
|
||||
pollOptionIndex: Type.Optional(
|
||||
Type.Number({
|
||||
description:
|
||||
"1-based poll option number to vote for, matching the rendered numbered poll choices.",
|
||||
}),
|
||||
),
|
||||
pollOptionIndexes: Type.Optional(
|
||||
Type.Array(
|
||||
Type.Number({
|
||||
description:
|
||||
"1-based poll option numbers to vote for in a multiselect poll, matching the rendered numbered poll choices.",
|
||||
}),
|
||||
),
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ export const CHANNEL_MESSAGE_ACTION_NAMES = [
|
||||
"send",
|
||||
"broadcast",
|
||||
"poll",
|
||||
"poll-vote",
|
||||
"react",
|
||||
"reactions",
|
||||
"read",
|
||||
|
||||
@@ -7,6 +7,7 @@ export const MESSAGE_ACTION_TARGET_MODE: Record<ChannelMessageActionName, Messag
|
||||
send: "to",
|
||||
broadcast: "none",
|
||||
poll: "to",
|
||||
"poll-vote": "to",
|
||||
react: "to",
|
||||
reactions: "to",
|
||||
read: "to",
|
||||
|
||||
Reference in New Issue
Block a user