/** * Hono integration — `mountWebhook(agent, app, '/wa')` registers webhook routes. * * Hono is optional; the plain agent works with raw fetch handlers. */ import type { Agent } from './agent.js'; import type { CoexistenceHandler } from './webhook/coexistence.js'; interface HonoLike { get(path: string, handler: (c: HonoContextLike) => unknown): unknown; post(path: string, handler: (c: HonoContextLike) => unknown): unknown; } interface HonoContextLike { req: { query(name: string): string | undefined; header(name: string): string | undefined; arrayBuffer(): Promise; }; executionCtx: { waitUntil(promise: Promise): void; }; env: { DB: D1Database; [k: string]: unknown; }; text(body: string): unknown; json(body: unknown, status?: number): unknown; } export interface MountWebhookOptions { /** * Handle coexistence changes (v0.19) — `smb_message_echoes`, `history`, * `smb_app_state_sync` — delivered when the number also runs the * WhatsApp Business app. Runs after signature verification; those * changes are stripped from what reaches `Agent.enqueue`. * * mountWebhook(agent, app, '/wa', { * onCoexistence: async ({ echoes }) => { await handoff.markFromEchoes(echoes); }, * }); * * Omit it and coexistence changes are dropped, which is what happened * before v0.19. Throws are caught and logged so Meta still gets its 200. */ onCoexistence?: CoexistenceHandler; } export declare function mountWebhook(agent: Agent, app: HonoLike, base?: string, opts?: MountWebhookOptions): void; export {}; //# sourceMappingURL=hono.d.ts.map