mirror of
https://github.com/harivansh-afk/pi-telegram-webhook.git
synced 2026-04-15 04:03:30 +00:00
- 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
22 lines
1.3 KiB
Markdown
22 lines
1.3 KiB
Markdown
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.
|