feat(telegram): improve DM topics support (#30579) (thanks @kesor)

This commit is contained in:
Ayaan Zaidi
2026-03-02 09:06:10 +05:30
committed by Ayaan Zaidi
parent aafc4d56e3
commit c13b35b83d
16 changed files with 335 additions and 44 deletions

View File

@@ -79,6 +79,8 @@ export type TelegramAccountConfig = {
/** Control reply threading when reply tags are present (off|first|all). */
replyToMode?: ReplyToMode;
groups?: Record<string, TelegramGroupConfig>;
/** Per-DM configuration for Telegram DM topics (key is chat ID). */
direct?: Record<string, TelegramDirectConfig>;
/** DM allowlist (numeric Telegram user IDs). Onboarding can resolve @username to IDs. */
allowFrom?: Array<string | number>;
/** Default delivery target for CLI `--deliver` when no explicit `--reply-to` is provided. */
@@ -204,6 +206,26 @@ export type TelegramGroupConfig = {
systemPrompt?: string;
};
export type TelegramDirectConfig = {
/** Per-DM override for DM message policy (open|disabled|allowlist). */
dmPolicy?: DmPolicy;
/** Optional tool policy overrides for this DM. */
tools?: GroupToolPolicyConfig;
toolsBySender?: GroupToolPolicyBySenderConfig;
/** If specified, only load these skills for this DM (when no topic). Omit = all skills; empty = no skills. */
skills?: string[];
/** Per-topic configuration for DM topics (key is message_thread_id as string) */
topics?: Record<string, TelegramTopicConfig>;
/** If false, disable the bot for this DM (and its topics). */
enabled?: boolean;
/** If true, require messages to be from a topic when topics are enabled. */
requireTopic?: boolean;
/** Optional allowlist for DM senders (numeric Telegram user IDs). */
allowFrom?: Array<string | number>;
/** Optional system prompt snippet for this DM. */
systemPrompt?: string;
};
export type TelegramConfig = {
/** Optional per-account Telegram configuration (multi-account). */
accounts?: Record<string, TelegramAccountConfig>;