Skip to content

feat(agentui): per-agent Telegram bot channel - #160

Merged
alltomatos merged 2 commits into
agentui-ai-generatefrom
agentui-telegram-channel
Sep 13, 2026
Merged

alltomatos merged 2 commits into
agentui-ai-generatefrom
agentui-telegram-channel

Conversation

@alltomatos

Copy link
Copy Markdown
Owner

Summary

Phase 1 of "Canais" (Channels) for AgentUI — stacked on #159.

Splits Telegram into two independent, coexisting services:

  • Global bot (Settings → Integrations) — unchanged, still the "talk to opencode directly" channel and the trigger-multiplexed shared bot for agents without their own token.
  • Per-agent bot (new) — each AgentUI can now optionally set its own Telegram bot token (from @Botfather) in its Channel section. When set, that agent gets its own independently-supervised poll loop that responds to every message directly, no command-trigger prefix needed.

Backend

  • ConfigAgentUIV1.ChannelBinding: telegram channel gains optional token and directory.
  • Telegram.Service: extracted the poll loop into a makePollLoop factory; the existing global loop is now one instance of it. A reconciler watches AgentUI.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 optional pinnedAgent, 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.
  • Regenerated v2 SDK client; settings.agentui.ai.*-adjacent i18n keys added across all locales.

Test plan

  • bun turbo typecheck — clean across all 30 packages
  • bun 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-existing dv gap unchanged)
  • Manually verified in browser preview: token field appears/hides correctly with the Telegram toggle
  • Not covered: an actual live end-to-end message round-trip against a real Telegram bot token — none available in this environment. Recommend a manual smoke test with a real @Botfather token before relying on this in production.

🤖 Generated with Claude Code

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.
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

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.

@alltomatos
alltomatos merged commit 0bd264e into agentui-ai-generate Sep 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant