diff --git a/src/agents/tools/message-tool.test.ts b/src/agents/tools/message-tool.test.ts index 3f08e2c3c..84e25fd30 100644 --- a/src/agents/tools/message-tool.test.ts +++ b/src/agents/tools/message-tool.test.ts @@ -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(); }, ); }); diff --git a/src/agents/tools/message-tool.ts b/src/agents/tools/message-tool.ts index 098368fe9..27f72868c 100644 --- a/src/agents/tools/message-tool.ts +++ b/src/agents/tools/message-tool.ts @@ -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.", + }), + ), + ), }; } diff --git a/src/channels/plugins/message-action-names.ts b/src/channels/plugins/message-action-names.ts index 649bb6ce8..809d239be 100644 --- a/src/channels/plugins/message-action-names.ts +++ b/src/channels/plugins/message-action-names.ts @@ -2,6 +2,7 @@ export const CHANNEL_MESSAGE_ACTION_NAMES = [ "send", "broadcast", "poll", + "poll-vote", "react", "reactions", "read", diff --git a/src/infra/outbound/message-action-spec.ts b/src/infra/outbound/message-action-spec.ts index 641cc3620..b49a60c69 100644 --- a/src/infra/outbound/message-action-spec.ts +++ b/src/infra/outbound/message-action-spec.ts @@ -7,6 +7,7 @@ export const MESSAGE_ACTION_TARGET_MODE: Record