mirror of
https://github.com/harivansh-afk/pi-telegram-webhook.git
synced 2026-04-15 09:01:16 +00:00
initial: webhook telegram adapter for pi with streaming replies
- webhook server with secret validation, rate limiting, body guards - streaming replies via sendMessage + editMessageText throttled loop - RPC session management for persistent conversations - 15/15 tests passing
This commit is contained in:
parent
809e9b1df5
commit
ce9abc2a8e
18 changed files with 6991 additions and 1 deletions
30
.pi/agents/worker.md
Normal file
30
.pi/agents/worker.md
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
name: worker
|
||||
description: Build pi-telegram-webhook extension
|
||||
tools: read, bash, edit, write
|
||||
model: anthropic/claude-sonnet-4-5
|
||||
thinking: xhigh
|
||||
---
|
||||
|
||||
You are building a new pi extension package called pi-telegram-webhook.
|
||||
|
||||
You have access to these reference codebases:
|
||||
- OpenClaw telegram extension (webhook + streaming): ~/Documents/GitHub/nix/tmp/openclaw/extensions/telegram/
|
||||
- Pi mono repo (pi SDK, agent core, TUI): ~/Documents/GitHub/nix/tmp/pi-mono/
|
||||
- Pi channels (existing telegram polling adapter): ~/.local/share/npm/lib/node_modules/@e9n/pi-channels/
|
||||
- Pi coding agent (extension API): ~/.local/share/npm/lib/node_modules/@mariozechner/pi-coding-agent/
|
||||
|
||||
Follow pi extension/package conventions from the pi mono repo. This is a pi package installable via `pi install npm:pi-telegram-webhook`.
|
||||
|
||||
Key requirements:
|
||||
- Telegram webhook ingress (HTTP server, setWebhook, secret token validation, rate limiting)
|
||||
- Streaming message delivery (sendMessage then editMessageText on throttled loop)
|
||||
- Clean, tested, concise TypeScript
|
||||
- No grammy dependency — use raw Telegram Bot API via fetch like pi-channels does
|
||||
- Must work behind nginx reverse proxy (support X-Forwarded-For, trusted proxies)
|
||||
- Health check endpoint
|
||||
- Graceful shutdown (deleteWebhook on stop)
|
||||
- Configurable via pi settings.json under "pi-telegram-webhook" key
|
||||
- Follow the same adapter/bridge pattern as pi-channels for compatibility
|
||||
|
||||
Do NOT use markdown formatting in any user-facing output. Write code only.
|
||||
Loading…
Add table
Add a link
Reference in a new issue