mirror of
https://github.com/harivansh-afk/pi-telegram-webhook.git
synced 2026-04-16 06:02:46 +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
22
.pi/task.md
Normal file
22
.pi/task.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Build the pi-telegram-webhook extension. Read these references first:
|
||||
|
||||
1. ~/Documents/GitHub/nix/tmp/openclaw/extensions/telegram/src/webhook.ts
|
||||
2. ~/Documents/GitHub/nix/tmp/openclaw/extensions/telegram/src/draft-stream.ts
|
||||
3. ~/.local/share/npm/lib/node_modules/@e9n/pi-channels/src/index.ts
|
||||
4. ~/.local/share/npm/lib/node_modules/@e9n/pi-channels/src/adapters/telegram.ts
|
||||
5. ~/.local/share/npm/lib/node_modules/@e9n/pi-channels/src/bridge/bridge.ts
|
||||
6. ~/.local/share/npm/lib/node_modules/@e9n/pi-channels/src/bridge/rpc-runner.ts
|
||||
7. ~/Documents/GitHub/nix/tmp/pi-mono/packages/coding-agent/package.json
|
||||
|
||||
Then build a focused pi extension package in this repo with:
|
||||
- package.json with pi.extensions entry for npm publish
|
||||
- src/index.ts (pi extension entry via ExtensionAPI)
|
||||
- src/webhook-server.ts (HTTP server, secret validation, rate limiting, health endpoint, trusted proxy)
|
||||
- src/streaming-reply.ts (sendMessage + editMessageText throttled loop, 4096 cap, generation tracking)
|
||||
- src/telegram-api.ts (thin fetch wrapper for Telegram Bot API)
|
||||
- src/bridge.ts (incoming message queue, RPC session management, connect webhook to agent)
|
||||
- src/types.ts and src/config.ts
|
||||
- tests/ with vitest
|
||||
- tsconfig.json, vitest.config.ts, README.md
|
||||
|
||||
Config key: "pi-telegram-webhook" in settings.json. No grammy. Raw fetch only. Concise.
|
||||
Loading…
Add table
Add a link
Reference in a new issue