diff --git a/apps/macos/Sources/OpenClawProtocol/GatewayModels.swift b/apps/macos/Sources/OpenClawProtocol/GatewayModels.swift index 3003ae79f7b..aaac880619d 100644 --- a/apps/macos/Sources/OpenClawProtocol/GatewayModels.swift +++ b/apps/macos/Sources/OpenClawProtocol/GatewayModels.swift @@ -942,102 +942,6 @@ public struct NodeEventParams: Codable, Sendable { } } -public struct NodePendingDrainParams: Codable, Sendable { - public let maxitems: Int? - - public init( - maxitems: Int?) - { - self.maxitems = maxitems - } - - private enum CodingKeys: String, CodingKey { - case maxitems = "maxItems" - } -} - -public struct NodePendingDrainResult: Codable, Sendable { - public let nodeid: String - public let revision: Int - public let items: [[String: AnyCodable]] - public let hasmore: Bool - - public init( - nodeid: String, - revision: Int, - items: [[String: AnyCodable]], - hasmore: Bool) - { - self.nodeid = nodeid - self.revision = revision - self.items = items - self.hasmore = hasmore - } - - private enum CodingKeys: String, CodingKey { - case nodeid = "nodeId" - case revision - case items - case hasmore = "hasMore" - } -} - -public struct NodePendingEnqueueParams: Codable, Sendable { - public let nodeid: String - public let type: String - public let priority: String? - public let expiresinms: Int? - public let wake: Bool? - - public init( - nodeid: String, - type: String, - priority: String?, - expiresinms: Int?, - wake: Bool?) - { - self.nodeid = nodeid - self.type = type - self.priority = priority - self.expiresinms = expiresinms - self.wake = wake - } - - private enum CodingKeys: String, CodingKey { - case nodeid = "nodeId" - case type - case priority - case expiresinms = "expiresInMs" - case wake - } -} - -public struct NodePendingEnqueueResult: Codable, Sendable { - public let nodeid: String - public let revision: Int - public let queued: [String: AnyCodable] - public let waketriggered: Bool - - public init( - nodeid: String, - revision: Int, - queued: [String: AnyCodable], - waketriggered: Bool) - { - self.nodeid = nodeid - self.revision = revision - self.queued = queued - self.waketriggered = waketriggered - } - - private enum CodingKeys: String, CodingKey { - case nodeid = "nodeId" - case revision - case queued - case waketriggered = "wakeTriggered" - } -} - public struct NodeInvokeRequestEvent: Codable, Sendable { public let id: String public let nodeid: String diff --git a/src/agents/tools/telegram-actions.test.ts b/src/agents/tools/telegram-actions.test.ts index 02d918bb64d..c8c961ffcc8 100644 --- a/src/agents/tools/telegram-actions.test.ts +++ b/src/agents/tools/telegram-actions.test.ts @@ -598,6 +598,22 @@ describe("handleTelegramAction", () => { ); }); + it("rejects malformed message ids for deleteMessage", async () => { + const cfg = { + channels: { telegram: { botToken: "tok" } }, + } as OpenClawConfig; + await expect( + handleTelegramAction( + { + action: "deleteMessage", + chatId: "123", + messageId: "456oops", + }, + cfg, + ), + ).rejects.toThrow(/messageId required/); + }); + it("deletes a forum topic", async () => { const cfg = { channels: { telegram: { botToken: "tok" } }, @@ -617,6 +633,22 @@ describe("handleTelegramAction", () => { ); }); + it("rejects malformed topic ids for deleteForumTopic", async () => { + const cfg = { + channels: { telegram: { botToken: "tok" } }, + } as OpenClawConfig; + await expect( + handleTelegramAction( + { + action: "deleteForumTopic", + chatId: "-100123", + topicId: "271abc", + }, + cfg, + ), + ).rejects.toThrow(/topicId required/); + }); + it("respects deleteMessage gating for deleteForumTopic", async () => { const cfg = { channels: { diff --git a/src/agents/tools/telegram-actions.ts b/src/agents/tools/telegram-actions.ts index 4f812f5f8f6..ec270ab32b0 100644 --- a/src/agents/tools/telegram-actions.ts +++ b/src/agents/tools/telegram-actions.ts @@ -327,6 +327,7 @@ export async function handleTelegramAction( const messageId = readNumberParam(params, "messageId", { required: true, integer: true, + strict: true, }); const token = resolveTelegramToken(cfg, { accountId }).token; if (!token) { @@ -354,6 +355,7 @@ export async function handleTelegramAction( const topicId = readNumberParam(params, "topicId", { required: true, integer: true, + strict: true, }); const token = resolveTelegramToken(cfg, { accountId }).token; if (!token) {