hermes-agent/website/docs/user-guide/messaging
Teknium 29d7c244c5
feat(gateway): wire clarify tool with inline keyboard buttons on Telegram (#24199)
The clarify tool returned 'not available in this execution context' for
every gateway-mode agent because gateway/run.py never passed
clarify_callback into the AIAgent constructor. Schema actively encouraged
calling it; users never saw the question.

Changes:

- tools/clarify_gateway.py — new event-based primitive mirroring
  tools/approval.py: register/wait_for_response/resolve_gateway_clarify
  with per-session FIFO, threading.Event blocking with 1s heartbeat
  slices (so the inactivity watchdog keeps ticking), and
  clear_session for boundary cleanup.

- gateway/platforms/base.py — abstract send_clarify with a numbered-text
  fallback so every adapter (Discord, Slack, WhatsApp, Signal, Matrix,
  etc.) gets a working clarify out of the box. Plus an active-session
  bypass: when the agent is blocked on a text-awaiting clarify, the next
  non-command message routes inline to the runner's intercept instead
  of being queued + triggering an interrupt. Same shape as the /approve
  deadlock fix from PR #4926.

- gateway/platforms/telegram.py — concrete send_clarify renders one
  inline button per choice plus '✏️ Other (type answer)'. cl: callback
  handler resolves numeric choices immediately, flips to text-capture
  mode for Other, with the same authorization guards as exec/slash
  approvals.

- gateway/run.py — clarify_callback wired at the cached-agent per-turn
  callback assignment site (only the user-facing agent path; cron and
  hygiene-compress agents have no human attached). Bridges sync→async
  via run_coroutine_threadsafe, blocks with the configured timeout, and
  returns a '[user did not respond within Xm]' sentinel on timeout so
  the agent adapts rather than pinning the running-agent guard. Text-
  intercept added to _handle_message before slash-confirm intercept
  (skipping slash commands). clear_session called in the run's finally
  to cancel any orphan entries.

- hermes_cli/config.py — agent.clarify_timeout default 600s.

- website/docs/user-guide/messaging/telegram.md — Interactive Prompts
  section.

Tests:

- tests/tools/test_clarify_gateway.py (14 tests) — full primitive
  coverage: button resolve, open-ended auto-await, Other flip, timeout
  None, unknown-id idempotency, clear_session cancellation, FIFO
  ordering, register/unregister notify, config default.

- tests/gateway/test_telegram_clarify_buttons.py (12 tests) — render
  paths (multi-choice/open-ended/long-label/HTML-escape/not-connected),
  callback dispatch (numeric resolve/Other flip/already-resolved/
  unauthorized/invalid-token), and base-adapter text fallback.

Out of scope: bot-to-bot, guest mode, checklists, poll media, live
photos. Closes #24191.
2026-05-12 16:33:33 -07:00
..
_category_.json feat: add documentation website (Docusaurus) 2026-03-05 05:24:55 -08:00
bluebubbles.md docs: resync reference, user-guide, developer-guide, and messaging pages against code (#17738) 2026-04-29 20:55:59 -07:00
dingtalk.md docs: resync reference, user-guide, developer-guide, and messaging pages against code (#17738) 2026-04-29 20:55:59 -07:00
discord.md feat(gateway): per-platform admin/user split for slash commands (salvage of #4443) (#23373) 2026-05-10 12:33:54 -07:00
email.md docs: comprehensive docs audit — fix 12 stale/missing items across 10 pages (#3618) 2026-03-28 15:26:35 -07:00
feishu.md feat(feishu): add native update prompt cards 2026-05-09 02:32:55 -07:00
google_chat.md docs: round 2 audit — messaging, developer-guide, guides, integrations (#22858) 2026-05-09 15:00:24 -07:00
homeassistant.md docs: fix 40+ discrepancies between documentation and codebase (#5818) 2026-04-07 10:17:44 -07:00
index.md feat(gateway): per-platform admin/user split for slash commands (salvage of #4443) (#23373) 2026-05-10 12:33:54 -07:00
line.md feat(gateway): add LINE Messaging API platform plugin (#23197) 2026-05-10 06:40:46 -07:00
matrix.md docs: correctness audit — fix wrong values, add missing coverage (#11972) 2026-04-18 01:45:48 -07:00
mattermost.md feat: extend channel_prompts to Telegram, Slack, and Mattermost 2026-04-15 16:31:28 -07:00
msgraph-webhook.md docs(msgraph): webhook listener setup page + env var reference 2026-05-08 10:29:58 -07:00
open-webui.md docs: round 2 audit — messaging, developer-guide, guides, integrations (#22858) 2026-05-09 15:00:24 -07:00
qqbot.md docs: round 2 audit — messaging, developer-guide, guides, integrations (#22858) 2026-05-09 15:00:24 -07:00
signal.md feat(gateway/signal): add support for multiple images sending 2026-04-30 04:28:08 -07:00
slack.md docs: two-week gap sweep — platforms, CLI, config, TUI, hooks, providers (#17727) 2026-04-29 20:32:37 -07:00
sms.md docs: round 2 audit — messaging, developer-guide, guides, integrations (#22858) 2026-05-09 15:00:24 -07:00
teams-meetings.md docs: round 2 audit — messaging, developer-guide, guides, integrations (#22858) 2026-05-09 15:00:24 -07:00
teams.md docs(teams): split meetings setup from operator runbook 2026-05-08 12:41:41 -07:00
telegram.md feat(gateway): wire clarify tool with inline keyboard buttons on Telegram (#24199) 2026-05-12 16:33:33 -07:00
webhooks.md fix(webhook): widen INSECURE_NO_AUTH loopback check + tests + docs 2026-05-07 07:38:43 -07:00
wecom-callback.md docs: resync reference, user-guide, developer-guide, and messaging pages against code (#17738) 2026-04-29 20:55:59 -07:00
wecom.md docs(wecom): document QR scan-to-create setup flow 2026-04-22 05:15:32 -07:00
weixin.md docs(weixin): clarify iLink bot identity limits and warn on group policy (#17433) 2026-04-29 06:26:10 -07:00
whatsapp.md docs: comprehensive update for recent merged PRs (#9019) 2026-04-13 10:50:59 -07:00
yuanbao.md docs: resync reference, user-guide, developer-guide, and messaging pages against code (#17738) 2026-04-29 20:55:59 -07:00