feat(agentui): per-agent Telegram bot channel - #160
Merged
Merged
Conversation
Splits Telegram into two independent services, as designed: the existing server-wide bot (Settings → Integrations) stays exactly as-is for the default opencode chat and trigger-multiplexed AgentUI access; each AgentUI can now additionally get its own dedicated bot token, running its own poll loop that responds to every message directly (no command-trigger prefix needed). - ConfigAgentUIV1.ChannelBinding: telegram channel gains optional `token` and `directory` fields. - Telegram.Service: extracted the poll loop into a reusable makePollLoop factory; the existing global loop is now one instance of it. A new reconciler watches AgentUI.Service.list() and starts/stops one independently-supervised poll loop per agent that has both a token and a directory configured — each loop re-reads its agent fresh every tick, so personality/guardrail/token edits apply without a restart. - handleMessage() takes an optional pinnedAgent, bypassing command-trigger matching and the default-chat fallback entirely for a dedicated bot. - agentui-form.tsx: the Telegram toggle now reveals a bot-token field (@Botfather), with a hint explaining the fallback to the shared bot when left empty. Saves the connected project as the bot's directory. - Regenerated SDK client; i18n keys added across all locales. Not yet covered here: a live end-to-end check against a real Telegram bot token (none available in this environment) — verified via typecheck, the existing agentui/telegram unit suites, and manually confirming the new token field renders/saves correctly in the browser preview.
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
6 tasks
This was referenced Sep 9, 2026
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 1 of "Canais" (Channels) for AgentUI — stacked on #159.
Splits Telegram into two independent, coexisting services:
Backend
ConfigAgentUIV1.ChannelBinding: telegram channel gains optionaltokenanddirectory.Telegram.Service: extracted the poll loop into amakePollLoopfactory; the existing global loop is now one instance of it. A reconciler watchesAgentUI.Service.list()every 5s and starts/stops one poll loop per agent that has both a token and a directory — each loop re-reads its agent fresh every tick, so edits (personality, guardrails, even the token) apply live without a restart.handleMessage()takes an optionalpinnedAgent, bypassing command-trigger matching and the default-chat fallback for a dedicated bot.Frontend
agentui-form.tsx: the Telegram toggle reveals a bot-token field with a hint explaining the fallback to the shared bot when left empty.settings.agentui.ai.*-adjacent i18n keys added across all locales.Test plan
bun turbo typecheck— clean across all 30 packagesbun test test/agentui test/telegram— 23/23 pass (one transient timeout on rerun, confirmed as flake by isolating and rerunning)bun test src/i18n/parity.test.ts— no new drift (pre-existingdvgap unchanged)🤖 Generated with Claude Code