eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
56 lines (55 loc) • 2.74 kB
TypeScript
/**
* Framework-shipped callback route used by in-turn interactive
* connection authorization.
*
* The route at {@link EVE_CONNECTION_CALLBACK_ROUTE_PATTERN} is the
* redirect target the workflow body hands to the IdP via
* `startAuthorization`. When the IdP redirects the user's browser back
* with the OAuth `code`/`state` (or whatever payload the protocol
* carries), this handler:
*
* 1. Parses the inbound request into a JSON-serializable
* {@link AuthorizationCallback} (params only — never request headers).
* 2. Calls `resumeHook(token, payload)` to wake the suspended workflow.
* 3. Renders the standard "Authorization complete" landing page so the
* user sees a friendly UI instead of an empty `202 Accepted`.
*
* Owning this route in the framework - instead of routing the IdP at the
* workflow runtime's raw `/.well-known/workflow/v1/webhook/:token` -
* keeps the public surface namespaced under eve and lets the framework
* decide delivery policy (auth, throttling, logging) for connection
* callbacks without leaking generic workflow primitives to the public
* internet.
*/
import type { RouteContext } from "#public/definitions/channel.js";
import type { ResolvedChannelDefinition } from "#runtime/types.js";
/**
* Logical name prefix of the framework-shipped connection callback
* channel. The trailing method segment (`get` or `post`) keeps each
* `(method, urlPath)` pair distinct in the channel registry.
*/
export declare const HTTP_CONNECTION_CALLBACK_CHANNEL_NAME_PREFIX = "eve/v1/connections/callback";
/**
* Returns the framework-shipped channel definitions that mount the
* connection callback route at {@link EVE_CONNECTION_CALLBACK_ROUTE_PATTERN}.
*
* Returns one definition per accepted HTTP method (see
* {@link HANDLED_METHODS}). The framework channel resolver mounts each
* `(method, urlPath)` pair as a separate Nitro route; sharing one URL
* pattern across multiple methods is not supported by the channel
* model.
*/
export declare function getConnectionCallbackChannelDefinitions(): readonly ResolvedChannelDefinition[];
/**
* Returns the set of logical channel names registered by the connection
* callback route. Used by `getAllFrameworkChannelNames` so authors who
* `disableRoute()` one of these names get a useful diagnostic instead
* of a silent no-op.
*/
export declare function getConnectionCallbackChannelNames(): ReadonlySet<string>;
/**
* Inbound handler for the connection callback route. Exported for test
* coverage; the framework channel resolver wires it into Nitro via
* {@link getConnectionCallbackChannelDefinitions}.
*/
export declare function handleConnectionCallbackRequest(request: Request, ctx: RouteContext): Promise<Response>;