import type { RuntimeAdapter } from "../platform/adapters/base.js"; import { type BootstrapResult } from "./bootstrap.js"; import type { FileSystemAdapter } from "../platform/adapters/base.js"; /** Configuration for AI primitives discovery during server startup */ export interface DiscoveryOptions { baseDir: string; fsAdapter?: FileSystemAdapter; /** For multi-project proxy mode: project slug for context scoping */ projectSlug?: string; /** For multi-project proxy mode: API token for context scoping */ apiToken?: string; verbose?: boolean; } interface ServerOptions { projectDir: string; port: number; /** 0.0.0.0 = all interfaces, 127.0.0.1 = localhost only */ bindAddress?: string; signal?: AbortSignal; /** Default project slug when not provided via proxy headers (for tests/local mode) */ defaultProjectSlug?: string; /** Default project ID when not provided via proxy headers (for tests/local mode) */ defaultProjectId?: string; /** Default release ID when not provided via proxy headers (for standalone production mode) */ defaultReleaseId?: string; /** Default environment for standalone mode (preview or production). Defaults to preview for safety. */ defaultEnvironment?: "preview" | "production"; /** * Optional request interceptor for combined mode. * Transforms requests before they're processed by the core request handler. * Used by proxy middleware to inject context headers in combined mode. */ requestInterceptor?: (req: Request) => Request | Promise; /** Discovery configuration for AI primitives. Runs discoverAll() before serving. */ discoveryConfig?: DiscoveryOptions; /** Map of project slugs to their filesystem paths (seeds local project discovery). */ localProjects?: Record; } /** Public API contract for server handle. */ export interface ServerHandle { ready: Promise; stop: () => Promise; } /** Options accepted by start production server. */ export interface StartProductionServerOptions extends ServerOptions { debug?: boolean; adapter?: RuntimeAdapter; /** Pre-computed bootstrap result to skip internal bootstrap (avoids double initialization) */ bootstrapResult?: BootstrapResult; /** * Contain unhandled promise rejections instead of letting them terminate the * process. Defaults to true. * * The hosted runtime serves many projects per process, where one project's * dropped promise otherwise takes down every other project on the pod. Set * this to false when embedding the server in a process you own and would * rather have a rejection stay fatal, so a bug outside the server is not * masked. Rejections are reported at error level either way. */ unhandledRejectionGuard?: boolean; } /** Starts production server. */ export declare function startProductionServer(options: StartProductionServerOptions): Promise; export {}; //# sourceMappingURL=production-server.d.ts.map