fix: advertise telegram poll duration integer

This commit is contained in:
Peter Steinberger
2026-05-28 21:51:21 -04:00
parent b425438a58
commit edda0608ac
2 changed files with 21 additions and 1 deletions

View File

@@ -367,6 +367,25 @@ describe("telegramMessageActions", () => {
expect(discovery?.actions).not.toContain("react");
});
it("advertises poll duration as a positive integer in message tool schema", () => {
const cfg = {
channels: {
telegram: {
botToken: "tok",
actions: { poll: true },
},
},
} as OpenClawConfig;
const discovery = telegramMessageActions.describeMessageTool?.({ cfg });
const schema = Array.isArray(discovery?.schema) ? discovery.schema[0] : undefined;
expect(schema?.properties.pollDurationSeconds).toMatchObject({
type: "integer",
minimum: 1,
});
});
it("matches runtime account-key normalization during SecretRef-tolerant discovery", () => {
const cfg = {
channels: {

View File

@@ -1,8 +1,9 @@
import { optionalPositiveIntegerSchema } from "openclaw/plugin-sdk/channel-actions";
import { Type } from "typebox";
export function createTelegramPollExtraToolSchemas() {
return {
pollDurationSeconds: Type.Optional(Type.Number()),
pollDurationSeconds: optionalPositiveIntegerSchema(),
pollAnonymous: Type.Optional(Type.Boolean()),
pollPublic: Type.Optional(Type.Boolean()),
};