import type { UiHttpServer } from '../platform/ui-http/ui-http-server.js'; import type { AccessJwtVerifier } from '../platform/ui-http/access-jwt.js'; import type { UiService } from '../domain/ui-service/types.js'; export interface StartUiHttpOptions { /** The composed UiService (real domain-backed instance in production; a fake in tests). */ uiService: UiService; /** Token accessor the server accepts. Defaults to getClientToken (the shared secret clients carry). */ getToken?: () => string; /** Env to read the startup gate/port from. Defaults to process.env (injectable for tests). */ env?: NodeJS.ProcessEnv; /** * Directory of the built SPA to serve for non-tRPC paths. When omitted, resolved from * CORTEX_UI_SPA_DIR else the monorepo web/dist. Absent/missing on disk → 404 stub. */ spaDir?: string; /** Explicit static CORS allow-list override; production reads runtime settings per request. */ corsOrigins?: string[]; /** * Explicit Cloudflare Access JWT verifier forwarded to the transport-host (the browser auth path). * When omitted, it is built from env via accessVerifierFromEnv (CORTEX_ACCESS_TEAM_DOMAIN + * CORTEX_ACCESS_AUD, optional CORTEX_ACCESS_CERTS_URL). When those are unset the verifier is * undefined and the gate degrades to token-only. Injectable for tests. */ verifyAccessJwt?: AccessJwtVerifier; } /** Resolve a UI-relative `workspace/…` path to an absolute path strictly inside WORKSPACE_DIR. * Thin wrapper over the shared `resolveWorkspaceRelPath` (core/paths) so the download route and the * agent-runner attachment mapping resolve the `workspace/` alias identically. Returns null when the * prefix is wrong or the resolved target escapes the workspace root. Exported for the traversal-guard * unit test. */ export declare function resolveWorkspacePath(rel: string): string | null; /** * Build the AppRouter from the injected UiService and start the Web UI HTTP+SSE transport-host * on CORTEX_UI_PORT (default 3004), bound 127.0.0.1, behind the x-cortex-token gate, serving the * built SPA same-origin. Returns the running server handle, or null when the CORTEX_UI_HTTP env * gate is off (clean skip). The caller owns the handle and must call close() on shutdown. */ export declare function startUiHttpServer(opts: StartUiHttpOptions): UiHttpServer | null;