feat: agent endpoints — notify in, captured Telegram replies out - #1
Conversation
…lies out
Adds /api/agent (POST: {repo, summary, kind, issue?, issue_url?} fanned out
as plain text) and /api/agent/replies (GET: inbound messages captured from
the authorized chat, with issue references extracted from reply-to text).
One base URL serves both directions of an agent bridge.
- src/replies.js: capped JSON reply store (data/, volume-backed in compose);
captures everything from TELEGRAM_CHAT_ID except bot utility commands
- src/bot.js: captured messages get no bot reply; /status in the agent chat
defers to the bridge (fleet status) instead of uptime
- src/auth.js: shared x-api-key / ?key= / Bearer middleware (moved from app.js)
- smoke tests for capture rules, auth, payload validation, bare-array replies
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThis PR adds an inbound reply store and agent notification API to integrate external alerts with a Telegram bot. The changes introduce JSON-backed persistence for bot replies, extract shared auth functions, route Telegram messages from an authorized agent chat for polling, and expose REST endpoints for alert submission and reply retrieval. ChangesInbound reply store and agent notification API
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Biome (2.4.16)src/bot.jsFile contains syntax errors that prevent linting: Line 12: Illegal return statement outside of a function Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Adds the missing inbound half of the agent bridge contract that gholam's
tg-bridge/_notifyexpect:/api/agent— accepts{repo, summary, kind, issue?, issue_url?}, fans out as plain text (no Markdown parse mode — summaries are arbitrary agent output)./api/agent/replies— bare JSON array of messages captured from the authorizedTELEGRAM_CHAT_IDchat, each{id, text, reference, ts}with the issue reference extracted from the replied-to message (or the text itself).idis the Telegrammessage_id, monotonic per chat, so pollers keep a high-water mark./statusfrom the agent chat defers to the polling agent (fleet status) instead of answering with uptime. Bot utility commands (/ping,/id, …) are unaffected.data/(gitignored, compose volume added). Auth middleware moved tosrc/auth.jsand now shared; acceptsx-api-key,?key=, orBearer.Verified live:
delivered: ["telegram","bale"]end-to-end from gholam's_notify.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores
Tests