eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
23 lines (22 loc) • 1.37 kB
TypeScript
import type { H3Event } from "nitro";
import type { WebSocketRouteHooks } from "#channel/routes.js";
import type { NitroArtifactsConfig } from "#internal/nitro/routes/runtime-artifacts.js";
/**
* Dispatches one channel request identified by `routeKey`.
*
* Each channel route is mounted as its own virtual Nitro handler with the
* route key and artifacts config baked in. Nitro's router matches the URL
* and populates `event.context.params`, so no custom URL matching is
* needed — the handler looks up the channel by its `(method, urlPath)` key
* directly. When routes register background work through `ctx.waitUntil`,
* Nitro forwards that work to `event.waitUntil()` so webhook
* acknowledgements can return immediately.
*
* Two dispatch shapes: authored channels (`defineChannel` and its
* wrappers) carry a `handler` field and receive `RouteHandlerArgs` with
* `send`, `getSession`, etc. Framework-internal channels (the
* connection callback route) build `ResolvedChannelDefinition` directly
* with just `fetch` and receive a `RouteContext` carrying `agent`.
*/
export declare function dispatchChannelRequest(event: H3Event, routeKey: string, config: NitroArtifactsConfig): Promise<Response>;
export declare function dispatchChannelWebSocketRequest(event: H3Event, routeKey: string, config: NitroArtifactsConfig): Promise<WebSocketRouteHooks>;