import { RegistryActors, RegistryConfigInput, Registry } from 'rivetkit'; /** Config passed to `setup` / `createHandler`. The wasm runtime is wired automatically. */ type CloudflareSetupConfig = Omit, "runtime" | "wasm">; /** * Wraps rivetkit's `setup` with the Cloudflare Workers WebAssembly runtime wired * in. Returns a typed `Registry`, so you can derive a typed client with * `createClient(...)` and pass the same registry to * `createHandler`. */ declare function setup(config: CloudflareSetupConfig): Registry; interface CreateHandlerOptions { /** * Path the Rivet manager API is mounted at. Defaults to `/api/rivet`. * * `rivet dev` and the engine poll `/metadata`, so changing this * also requires configuring the engine-side serverless runner URL to match. */ managerPath?: string; /** * Handler for requests that fall outside the Rivet manager API path. Accepts * a plain `(request, env, ctx)` handler or a framework `fetch` such as * Hono's `app.fetch`. */ fetch?: (request: Request, ...args: any[]) => Response | Promise; } interface CloudflareHandler { fetch(request: Request, env: unknown, ctx: unknown): Promise; } /** * Creates a Cloudflare Workers handler that hosts Rivet Actors on the wasm * runtime. Accepts either a registry from this package's `setup` or a setup * config (which is wired through `setup` for you). * * The Rivet manager API is mounted at `managerPath` (default `/api/rivet`). * Requests outside that path are routed to `options.fetch` if provided, letting * you mount your own routes alongside Rivet. The engine endpoint is read from * `RIVET_ENDPOINT` (with `RIVET_NAMESPACE`, `RIVET_TOKEN`, `RIVET_POOL` optional) * unless set in the config. */ declare function createHandler(registry: Registry, options?: CreateHandlerOptions): CloudflareHandler; declare function createHandler(config: CloudflareSetupConfig, options?: CreateHandlerOptions): CloudflareHandler; export { type CloudflareHandler, type CloudflareSetupConfig, type CreateHandlerOptions, createHandler, setup };