import { Context } from "hono";
/**
 * Register a background promise tied to the current request.
 *
 * On Cloudflare Workers (`workerd`), this uses `executionCtx.waitUntil`, which
 * holds the worker alive until the promise settles but does not block the
 * response.
 *
 * On Node/Bun and in tests we instead collect the promise on the context so a
 * surrounding middleware can await it before the response leaves. Without this
 * the response can return before background work (audit log writes, outbox
 * webhook dispatches) completes, producing flaky test behavior and requests
 * that occasionally lose tail work if the process exits.
 */
export declare function waitUntil(ctx: Context, promise: Promise<unknown>): void;
/**
 * Await any `waitUntil` promises registered during the current request. Invoke
 * from a middleware's finally block (after `await next()`) so non-Workers
 * runtimes flush background work before returning the response.
 */
export declare function flushBackgroundPromises(ctx: Context): Promise<void>;
