mirror of
https://github.com/harivansh-afk/pi-telegram-webhook.git
synced 2026-04-15 03:00:47 +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
1.3 KiB
1.3 KiB
Build the pi-telegram-webhook extension. Read these references first:
- ~/Documents/GitHub/nix/tmp/openclaw/extensions/telegram/src/webhook.ts
- ~/Documents/GitHub/nix/tmp/openclaw/extensions/telegram/src/draft-stream.ts
- ~/.local/share/npm/lib/node_modules/@e9n/pi-channels/src/index.ts
- ~/.local/share/npm/lib/node_modules/@e9n/pi-channels/src/adapters/telegram.ts
- ~/.local/share/npm/lib/node_modules/@e9n/pi-channels/src/bridge/bridge.ts
- ~/.local/share/npm/lib/node_modules/@e9n/pi-channels/src/bridge/rpc-runner.ts
- ~/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.