/** * Narrow public ingress proxy for Telegram (and other) bot webhooks. * * SECURITY: the daemon's port (default 18790) exposes the entire control * plane — `session_list`, `agent_start`, `agent_kill`, etc. A bare public * tunnel to that port would expose full daemon control to anyone who finds * the URL. This proxy listens on its own port and forwards ONLY * `POST /inbound/*` to the daemon. Every other path or method is rejected * with 404/405. */ interface TelegramProxyOptions { targetBaseUrl: string; listenPort: number; log?: (msg: string) => void; } interface TelegramProxy { start(): Promise<{ url: string; port: number; }>; stop(): Promise; } /** * Create a narrow reverse-proxy that forwards ONLY `POST /inbound/*` * to a target base URL. Every other path or method is rejected. * * SECURITY: the URL path is decoded, normalized (resolving `.` and `..`), * and then checked. Only paths whose normalized form literally begins with * `/inbound/` are forwarded. Path-traversal attempts such as * `/inbound/../sessions/foo` decode and normalize to `/sessions/foo`, which * does not start with `/inbound/` and is rejected with 404. */ declare function createTelegramProxy(opts: TelegramProxyOptions): TelegramProxy; export { type TelegramProxy, type TelegramProxyOptions, createTelegramProxy };