export declare type BrowserRuntimeLoader = <TModule = BrowserRuntimeModule>(specifier?: string) => Promise<TModule>;

export declare type BrowserRuntimeModule = BrowserSandboxRuntimeModule;

export declare type BrowserSandboxFile = {
    path: string;
    contents: string;
};

export declare type BrowserSandboxFilePlan = {
    intent: string;
    files: Array<{
        path: string;
        purpose: string;
        action: 'create' | 'edit';
    }>;
};

export declare type BrowserSandboxResult = {
    ok: boolean;
    projectRoot?: string;
    provider?: string;
    validation?: 'typecheck' | 'build' | 'write-policy-validation' | 'import-validation' | 'data-api-validation';
    changedFiles?: string[];
    summary?: string;
    changes?: BrowserSandboxRevision['changes'];
    files?: Array<{
        path: string;
        size: number;
    }>;
    generationMeta?: BrowserSandboxRevision['generationMeta'];
    attempts?: Array<{
        label: string;
        ok: boolean;
        command: {
            command: string;
            durationMs: number;
            exitCode: number;
            ok: boolean;
            stdout: string;
            stderr: string;
        };
    }>;
    command?: {
        command: string;
        durationMs: number;
        exitCode: number;
        ok: boolean;
        stdout: string;
        stderr: string;
    };
    importValidation?: {
        ok: boolean;
        diagnostics: string[];
    };
    writePolicyValidation?: {
        ok: boolean;
        diagnostics: string[];
    };
    dataApiValidation?: {
        ok: boolean;
        diagnostics: string[];
    };
    telemetry?: {
        contextFileCount?: number;
        contextChars?: number;
        generatedFileCount?: number;
        generatedChars?: number;
        repairAttempts?: number;
    };
    error?: string;
};

export declare type BrowserSandboxRevision = {
    provider?: string;
    summary?: string;
    changes?: Array<{
        kind: 'add' | 'edit' | 'remove';
        label: string;
    }>;
    files: BrowserSandboxFile[];
    plan?: BrowserSandboxFilePlan;
    replaceExistingFiles?: boolean;
    generationMeta?: {
        model: string;
        strategy: string;
        reasoningEffort?: string;
        durationMs: number;
        outputChars?: number;
        fallbackFrom?: {
            strategy: string;
            reason: string;
        };
    };
    attemptLabel?: string;
};

export declare type BrowserSandboxRuntimeManifest = {
    id: string;
    name: string;
    execution: 'browser-sandbox';
    moduleSystem: string;
    cssPipeline: {
        mode: string;
        status: string;
    };
    packages: Array<{
        name: string;
        source: 'host' | 'runtime' | 'shim' | 'fallback';
        status: 'supported' | 'partial';
    }>;
    components: Array<{
        name: string;
        importPath: string;
        sourceFile: string;
        implementation: 'source' | 'shim';
        dependencies: string[];
    }>;
    limits: {
        writeScope: string[];
        editableGlobs: string[];
        unsupported: string[];
    };
};

export declare type BrowserSandboxRuntimeModule = {
    resetBrowserSandbox: (templateId?: string) => void;
    readBrowserSandboxWorkspaceContext: () => BrowserSandboxWorkspaceContext;
    readBrowserSandboxFiles: (paths: string[]) => BrowserSandboxFile[];
    listBrowserSandboxFiles: () => Array<{
        path: string;
        size: number;
    }>;
    applyBrowserSandboxRevision: (revision: BrowserSandboxRevision) => BrowserSandboxResult;
    compileBrowserSandboxPreviewHtml: () => Promise<{
        html: string;
        diagnostics: string[];
        warnings?: string[];
        cssMode?: 'tailwind' | 'fallback';
    }>;
};

export declare type BrowserSandboxWorkspaceContext = {
    projectRoot?: string;
    framework?: string;
    packageManager?: string;
    runtimeManifest?: BrowserSandboxRuntimeManifest;
    packageJson?: {
        dependencies?: Record<string, string>;
        devDependencies?: Record<string, string>;
        scripts?: Record<string, string>;
    };
    componentsJson?: unknown;
    tsconfig?: {
        baseUrl?: string | null;
        paths?: Record<string, string[]>;
        jsx?: string | null;
        strict?: boolean | null;
        noUnusedLocals?: boolean | null;
        noUnusedParameters?: boolean | null;
    };
    files?: {
        source?: string[];
        root?: string[];
        editable?: string[];
        editableGlobs?: string[];
        approvalRequiredGlobs?: string[];
        styleEntries?: string[];
        localModules?: string[];
    };
    validation?: {
        typecheck?: string | null;
        build?: string | null;
    };
    capabilities?: unknown;
};

/**
 * Lazily loads the browser execution runtime only when the user chooses
 * in-browser app building. Keep this behind a dedicated subpath so ordinary
 * dashboard and Analytics Hub consumers do not pay for runtime code.
 */
export declare const loadSemaphorBrowserRuntime: BrowserRuntimeLoader;

export { }
