diff --git a/src/agents/tools/message-tool.ts b/src/agents/tools/message-tool.ts index 324c8aa48be..48f1b8013a0 100644 --- a/src/agents/tools/message-tool.ts +++ b/src/agents/tools/message-tool.ts @@ -1,6 +1,4 @@ import { Type } from "@sinclair/typebox"; -import type { OpenClawConfig } from "../../config/config.js"; -import type { AnyAgentTool } from "./common.js"; import { BLUEBUBBLES_GROUP_ACTIONS } from "../../channels/plugins/bluebubbles-actions.js"; import { listChannelMessageActions, @@ -13,6 +11,7 @@ import { CHANNEL_MESSAGE_ACTION_NAMES, type ChannelMessageActionName, } from "../../channels/plugins/types.js"; +import type { OpenClawConfig } from "../../config/config.js"; import { loadConfig } from "../../config/config.js"; import { GATEWAY_CLIENT_IDS, GATEWAY_CLIENT_MODES } from "../../gateway/protocol/client-info.js"; import { getToolResult, runMessageAction } from "../../infra/outbound/message-action-runner.js"; @@ -23,6 +22,7 @@ import { normalizeMessageChannel } from "../../utils/message-channel.js"; import { resolveSessionAgentId } from "../agent-scope.js"; import { listChannelSupportedActions } from "../channel-tools.js"; import { channelTargetSchema, channelTargetsSchema, stringEnum } from "../schema/typebox.js"; +import type { AnyAgentTool } from "./common.js"; import { jsonResult, readNumberParam, readStringParam } from "./common.js"; import { resolveGatewayOptions } from "./gateway.js"; diff --git a/src/agents/tools/telegram-actions.e2e.test.ts b/src/agents/tools/telegram-actions.e2e.test.ts index 6a6777ac4ae..326dba18683 100644 --- a/src/agents/tools/telegram-actions.e2e.test.ts +++ b/src/agents/tools/telegram-actions.e2e.test.ts @@ -15,10 +15,14 @@ const deleteMessageTelegram = vi.fn(async () => ({ ok: true })); const originalToken = process.env.TELEGRAM_BOT_TOKEN; vi.mock("../../telegram/send.js", () => ({ - reactMessageTelegram: (...args: unknown[]) => reactMessageTelegram(...args), - sendMessageTelegram: (...args: unknown[]) => sendMessageTelegram(...args), - sendStickerTelegram: (...args: unknown[]) => sendStickerTelegram(...args), - deleteMessageTelegram: (...args: unknown[]) => deleteMessageTelegram(...args), + reactMessageTelegram: (...args: Parameters) => + reactMessageTelegram(...args), + sendMessageTelegram: (...args: Parameters) => + sendMessageTelegram(...args), + sendStickerTelegram: (...args: Parameters) => + sendStickerTelegram(...args), + deleteMessageTelegram: (...args: Parameters) => + deleteMessageTelegram(...args), })); describe("handleTelegramAction", () => { diff --git a/src/agents/tools/telegram-actions.ts b/src/agents/tools/telegram-actions.ts index e174510a14f..17a6c8e72fc 100644 --- a/src/agents/tools/telegram-actions.ts +++ b/src/agents/tools/telegram-actions.ts @@ -1,7 +1,7 @@ import type { AgentToolResult } from "@mariozechner/pi-agent-core"; import type { OpenClawConfig } from "../../config/config.js"; -import type { TelegramButtonStyle, TelegramInlineButtons } from "../../telegram/button-types.js"; import { createTelegramActionGate } from "../../telegram/accounts.js"; +import type { TelegramButtonStyle, TelegramInlineButtons } from "../../telegram/button-types.js"; import { resolveTelegramInlineButtonsScope, resolveTelegramTargetChatType, diff --git a/src/channels/plugins/actions/telegram.ts b/src/channels/plugins/actions/telegram.ts index 868c4d8bc93..f4c3141ae14 100644 --- a/src/channels/plugins/actions/telegram.ts +++ b/src/channels/plugins/actions/telegram.ts @@ -1,5 +1,3 @@ -import type { TelegramActionConfig } from "../../../config/types.telegram.js"; -import type { ChannelMessageActionAdapter, ChannelMessageActionName } from "../types.js"; import { readNumberParam, readStringArrayParam, @@ -7,12 +5,14 @@ import { readStringParam, } from "../../../agents/tools/common.js"; import { handleTelegramAction } from "../../../agents/tools/telegram-actions.js"; +import type { TelegramActionConfig } from "../../../config/types.telegram.js"; import { extractToolSend } from "../../../plugin-sdk/tool-send.js"; import { createTelegramActionGate, listEnabledTelegramAccounts, } from "../../../telegram/accounts.js"; import { isTelegramInlineButtonsEnabled } from "../../../telegram/inline-buttons.js"; +import type { ChannelMessageActionAdapter, ChannelMessageActionName } from "../types.js"; const providerId = "telegram"; diff --git a/src/telegram/bot-handlers.ts b/src/telegram/bot-handlers.ts index f21e8504c0c..6a40bd8bbbd 100644 --- a/src/telegram/bot-handlers.ts +++ b/src/telegram/bot-handlers.ts @@ -1,7 +1,4 @@ import type { Message, ReactionTypeEmoji } from "@grammyjs/types"; -import type { TelegramGroupConfig, TelegramTopicConfig } from "../config/types.js"; -import type { TelegramMediaRef } from "./bot-message-context.js"; -import type { TelegramContext } from "./bot/types.js"; import { resolveDefaultAgentId } from "../agents/agent-scope.js"; import { hasControlCommand } from "../auto-reply/command-detection.js"; import { @@ -17,6 +14,7 @@ import { resolveChannelConfigWrites } from "../channels/plugins/config-writes.js import { loadConfig } from "../config/config.js"; import { writeConfigFile } from "../config/io.js"; import { loadSessionStore, resolveStorePath } from "../config/sessions.js"; +import type { TelegramGroupConfig, TelegramTopicConfig } from "../config/types.js"; import { danger, logVerbose, warn } from "../globals.js"; import { enqueueSystemEvent } from "../infra/system-events.js"; import { readChannelAllowFromStore } from "../pairing/pairing-store.js"; @@ -28,6 +26,7 @@ import { normalizeAllowFromWithStore, type NormalizedAllowFrom, } from "./bot-access.js"; +import type { TelegramMediaRef } from "./bot-message-context.js"; import { RegisterTelegramHandlerParams } from "./bot-native-commands.js"; import { MEDIA_GROUP_TIMEOUT_MS, type MediaGroupEntry } from "./bot-updates.js"; import { resolveMedia } from "./bot/delivery.js"; @@ -37,6 +36,7 @@ import { resolveTelegramForumThreadId, resolveTelegramGroupAllowFromContext, } from "./bot/helpers.js"; +import type { TelegramContext } from "./bot/types.js"; import { evaluateTelegramGroupBaseAccess, evaluateTelegramGroupPolicyAccess, diff --git a/src/telegram/send.ts b/src/telegram/send.ts index 252e4f1a906..9efb57486b3 100644 --- a/src/telegram/send.ts +++ b/src/telegram/send.ts @@ -5,8 +5,6 @@ import type { ReactionTypeEmoji, } from "@grammyjs/types"; import { type ApiClientOptions, Bot, HttpError, InputFile } from "grammy"; -import type { RetryConfig } from "../infra/retry.js"; -import type { TelegramInlineButtons } from "./button-types.js"; import { loadConfig } from "../config/config.js"; import { resolveMarkdownTableMode } from "../config/markdown-tables.js"; import { logVerbose } from "../globals.js"; @@ -14,6 +12,7 @@ import { recordChannelActivity } from "../infra/channel-activity.js"; import { isDiagnosticFlagEnabled } from "../infra/diagnostic-flags.js"; import { formatErrorMessage, formatUncaughtError } from "../infra/errors.js"; import { createTelegramRetryRunner } from "../infra/retry-policy.js"; +import type { RetryConfig } from "../infra/retry.js"; import { redactSensitiveText } from "../logging/redact.js"; import { createSubsystemLogger } from "../logging/subsystem.js"; import { mediaKindFromMime } from "../media/constants.js"; @@ -23,6 +22,7 @@ import { loadWebMedia } from "../web/media.js"; import { type ResolvedTelegramAccount, resolveTelegramAccount } from "./accounts.js"; import { withTelegramApiErrorLogging } from "./api-logging.js"; import { buildTelegramThreadParams } from "./bot/helpers.js"; +import type { TelegramInlineButtons } from "./button-types.js"; import { splitTelegramCaption } from "./caption.js"; import { resolveTelegramFetch } from "./fetch.js"; import { renderTelegramHtmlText } from "./format.js";