import { CLIOptions } from '.';
import { TelemetryService } from './services/TelemetryService';
import { Framework } from './services/ProjectDetectionService';
import { SessionBridgeService } from './services/SessionBridgeService';
import type { AgentVariantsOrchestrator } from './mcp/agent-variants';
export declare const INACTIVE_VARIANTS_EVENT_HEARTBEAT_MS = 30000;
export declare const RIVET_CORS_ALLOWED_HEADERS: string[];
export declare const DIST_UI_PATH: string;
type RivetUiBootstrap = {
    agentApplyMode: 'embedded' | 'external' | null;
    queueAccessToken: string | null;
};
export declare const injectRivetUiBootstrap: (html: string, bootstrap: RivetUiBootstrap) => string;
type InactiveVariantsEventRequest = {
    on: (event: 'close', listener: () => void) => unknown;
};
type InactiveVariantsEventResponse = {
    set: (headers: Record<string, string>) => unknown;
    flushHeaders?: () => unknown;
    write: (chunk: string) => unknown;
};
/**
 * Keeps the inactive variants SSE endpoint well-formed for clients that always subscribe.
 */
export declare const sendInactiveVariantsEventStream: (req: InactiveVariantsEventRequest, res: InactiveVariantsEventResponse) => void;
/**
 * Returns the host interface Rivet should bind for the current runtime.
 */
export declare const resolveRivetListenHost: (agentApplyMode?: "embedded" | "external" | null) => string | undefined;
export declare const resolveEmbeddedAgentUiOrigin: (port: number) => string;
export declare const resolveEmbeddedAgentPreviewOrigin: (port: number) => string;
export declare const isEmbeddedAgentUiHost: (hostname: string, agentApplyMode?: "embedded" | "external" | null) => boolean;
export declare const isRivetUiStaticAssetPath: (requestPath: string) => boolean;
type RivetCorsOriginCheck = {
    requestOrigin?: string;
    requestHostname: string;
    requestPath: string;
    allowedOrigins: ReadonlySet<string>;
    agentApplyMode?: 'embedded' | 'external' | null;
};
/**
 * Allows browser requests from the Rivet UI origin and the opaque sandbox
 * origin used by embedded agent previews when loading preview assets.
 */
export declare const isRivetCorsOriginAllowed: ({ requestOrigin, requestHostname, requestPath, allowedOrigins, agentApplyMode, }: RivetCorsOriginCheck) => boolean;
export type ServerOptions = Omit<CLIOptions, 'help' | 'version' | 'debug'> & {
    framework: Framework;
    telemetry?: TelemetryService;
    projectPath: string;
    staticEntry?: string;
    styleFramework?: 'tailwind';
    tailwindConfig?: string;
    sessionBridge?: SessionBridgeService;
    /** Orchestrator for the agent-driven variants flow. When set, /api/variants routes are mounted. */
    agentVariantsOrchestrator?: AgentVariantsOrchestrator;
    /** The editor running the MCP session (e.g. 'claude', 'cursor', 'codex'). Shown in the UI button. */
    mcpEditor?: string;
    /** Whether apply progress is handled inside Rivet or by an external editor. */
    agentApplyMode?: 'embedded' | 'external';
    /** Cancels active embedded terminal-agent work when the UI Stop control is used. */
    agentRunController?: {
        cancelActiveRun: () => {
            stoppedCount: number;
        };
    };
    /** Skip registering process-level exit/signal handlers. Set true when embedded in another process (e.g. MCP server). */
    skipProcessHandlers?: boolean;
    /** Explicit port for the Rivet Express server. Defaults to DEFAULT_PORT (4000). */
    rivetPort?: number;
    /** The host where the user's dev server is running. Defaults to 'localhost'. */
    userHost?: string;
    /** Override git availability for this server instance. */
    isGitEnabled?: boolean;
    /** Hosted demo mode options. */
    demoMode?: {
        enabled: boolean;
        allowSessionProvisioning?: boolean;
        requireSignedInUsers?: boolean;
        templateProjectPath?: string;
        worktreesRootPath?: string;
        sessionTtlMs?: number;
        sessionIdleTtlMs?: number;
        maxActiveSessions?: number;
        baseRivetPort?: number;
        publicBaseUrl?: string;
        authRedisUrl?: string;
        authRedisKeyPrefix?: string;
        sessionMetadataRedisUrl?: string;
        sessionMetadataRedisKeyPrefix?: string;
    };
};
export type ServerHandle = {
    close: () => Promise<void>;
};
export declare const startServer: (options: ServerOptions) => Promise<ServerHandle>;
export {};
//# sourceMappingURL=server.d.ts.map