Telegram-user: add threading tool context

This commit is contained in:
Muhammed Mukhthar CM 2026-01-23 10:37:20 +00:00
parent 8bc17b39eb
commit fb9d36e433

View File

@ -152,6 +152,17 @@ export const telegramUserPlugin: ChannelPlugin<ResolvedTelegramUserAccount> = {
accountId, accountId,
}), }),
}, },
threading: {
resolveReplyToMode: ({ cfg }) => cfg.channels?.["telegram-user"]?.replyToMode ?? "first",
buildToolContext: ({ context, hasRepliedRef }) => {
const threadId = context.MessageThreadId ?? context.ReplyToId;
return {
currentChannelId: context.To?.trim() || undefined,
currentThreadTs: threadId != null ? String(threadId) : undefined,
hasRepliedRef,
};
},
},
actions: { actions: {
listActions: ({ cfg }) => { listActions: ({ cfg }) => {
if (!cfg.channels?.["telegram-user"]) return []; if (!cfg.channels?.["telegram-user"]) return [];
@ -161,6 +172,7 @@ export const telegramUserPlugin: ChannelPlugin<ResolvedTelegramUserAccount> = {
agentPrompt: { agentPrompt: {
messageToolHints: () => [ messageToolHints: () => [
"Telegram user polls only work in groups/channels (DM polls return MEDIA_INVALID). Use the group id for polls.", "Telegram user polls only work in groups/channels (DM polls return MEDIA_INVALID). Use the group id for polls.",
"When ChatType is group, use currentChannelId as the target for message/poll actions.",
], ],
}, },
outbound: { outbound: {