peppa/packages/testkit/src/mock-telegram-server.ts
Асель 112c08b063 PEP-6: dev stand with mock Telegram so agents can play the PM
- mock-telegram as a standalone server with /_mock/* inspection and PM
  actions (messages, send, click, callbacks)
- peppa-dev up|down|status|peppa|tg: isolated DB peppa_dev, tmux -L
  peppa-dev, ~/.peppa-dev, the real bot against mock-telegram, mock agents;
  test PM paired automatically via /start
- verified: question from a mock session answered with a button on the
  stand, delivered to the session; prod sessions/tmux/Telegram untouched
- OpenSpec: pep-6 archived into spec dev-sandbox

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 21:10:37 +05:00

10 lines
490 B
TypeScript

// Standalone mock Telegram Bot API for the dev stand: `mock-telegram --port 3190`.
// Bot API at /bot<token>/<method>; inspection and PM actions at /_mock/*.
import { MockTelegram } from "./mock-telegram.ts";
const i = process.argv.indexOf("--port");
const port = Number(i > 0 ? process.argv[i + 1] : (process.env.PEPPA_DEV_TG_PORT ?? 3190));
const tg = new MockTelegram();
await tg.start(port);
console.log(`mock-telegram on ${tg.url} (token ${tg.token}, PM chat ${tg.pmUser.chatId})`);