UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

118 lines (117 loc) 4.5 kB
interface VercelRequestPathTransform { readonly args: string; readonly op: "set"; readonly type: "request.path"; } interface VercelServiceRouteDestination { readonly service?: string; readonly type?: string; } interface VercelRouteConfig { readonly destination?: string | VercelServiceRouteDestination; readonly handle?: string; readonly src?: string; readonly transforms?: readonly VercelRequestPathTransform[]; readonly [key: string]: unknown; } interface VercelServiceConfig { readonly framework?: string; readonly routes?: readonly VercelRouteConfig[]; readonly [key: string]: unknown; } /** * The top-level Vercel Build Output route that sends eve transport requests to * the generated eve service. */ export type EveVercelServiceRoute = { readonly destination: { readonly service: string; readonly type: "service"; }; readonly src: string; }; /** * A service-scoped route carrying the `request.path` transform that pins the * path the eve runtime observes to the eve transport namespace. */ export type EveVercelServiceRequestPathRoute = { readonly src: string; readonly transforms: readonly [VercelRequestPathTransform]; }; /** * The generated eve service entry written into the Vercel Build Output * `services` record. */ export type EveVercelGeneratedService = { readonly buildCommand: string; readonly framework: "eve"; readonly routes: readonly VercelRouteConfig[]; readonly root: string; }; /** * Minimal shape of the Nitro Vercel build-output config the module merges the * generated eve service into. */ export interface NitroVercelBuildConfig { version?: number; routes?: unknown[]; services?: Record<string, VercelServiceConfig>; [key: string]: unknown; } /** * Result of {@link ensureEveVercelServicesConfig}: `root` when `vercel.json` * already declares stable services (the user owns routing; nothing is * generated), `generated` with the service record to merge into the Nitro * Vercel build config otherwise. */ export type EnsureEveVercelServicesConfigResult = { readonly mode: "root"; } | { readonly mode: "generated"; readonly services: Record<string, EveVercelGeneratedService>; }; /** * Build the top-level Build Output route that exposes the eve service on the * eve transport namespace (`/eve/v1/*`). */ export declare function createEveServiceRoute(serviceName?: string): EveVercelServiceRoute; /** * Build the eve service's own route that sets `request.path` so the eve * runtime observes the transport path regardless of how the platform routed * the request into the service. */ export declare function createEveServiceRequestPathRoute(): EveVercelServiceRequestPathRoute; /** * Resolve the stable Vercel services configuration for a Nuxt + eve * deployment. * * When `vercel.json` (looked up from the linked Vercel project root, falling * back to the Nuxt root) already declares stable `services`, it must include * an eve service and the module generates nothing. Otherwise this prepares a * generated eve service — creating its isolated build root under * `.eve/vercel-services/eve` so the eve build output cannot collide with the * Nuxt Build Output — and returns the service record plus the public service * route for the caller to merge into the Nitro Vercel build config. A legacy * `experimentalServices` field is ignored with a migration warning: Vercel no * longer routes it. */ export declare function ensureEveVercelServicesConfig(input: { readonly appRoot: string; readonly eveBuildCommand?: string; readonly nuxtRoot: string; }): Promise<EnsureEveVercelServicesConfigResult>; /** * Merge the generated eve service and its public route into a Nitro Vercel * build config (`nitro.vercel.config`). * * The service route is inserted before an existing `handle: "filesystem"` * route, or prepended when none exists — Nitro appends its own generated * routes (including the filesystem handle) after this config's routes, so the * eve route always resolves before the Nuxt app's filesystem routing. An eve * service already configured by the user is preserved and only gains the * `request.path` route; everything else passes through untouched. */ export declare function mergeEveVercelConfig(existing: NitroVercelBuildConfig | undefined, generated: Extract<EnsureEveVercelServicesConfigResult, { mode: "generated"; }>): NitroVercelBuildConfig; export {};