import type { ArtifactBundle } from '../core/artifact-bundle.js';
export declare class ArtifactRenderExportUnavailableError extends Error {
    constructor(message?: string);
}
export interface ArtifactRenderExportOptions {
    baseUrl?: string;
    timeoutMs?: number;
    context?: 'editor' | 'fullscreen' | 'export';
    onPage?: (page: import('playwright').Page) => void | Promise<void>;
    /** Artifact-asset capability token so the headless page (no session cookie)
     *  can load workspace images via `/api/assets/...?at=`. */
    assetToken?: string;
    /** Device pixel ratio for the rendered page. Defaults to 1 (full CSS-pixel
     *  resolution — what export/PDF need). The inspect path sets a fractional
     *  value so `scale:'device'` screenshots come out downscaled, keeping vision
     *  tokens + render time low. */
    deviceScaleFactor?: number;
}
export interface ArtifactPngExportFile {
    index: number;
    bytes: Buffer;
}
export interface NamedArtifactPngExportFile extends ArtifactPngExportFile {
    filename: string;
}
export interface ArtifactInspectOptions extends Omit<ArtifactRenderExportOptions, 'context'> {
    context?: 'editor' | 'fullscreen';
    frameSelector?: string;
    frameIndexes?: number[];
    maxFrames?: number;
    includePageScreenshot?: boolean;
    includeFrameScreenshots?: boolean;
    screenshotFormat?: 'png' | 'jpeg';
    jpegQuality?: number;
    /** Cap the longest side of inspect screenshots to this many pixels (keeps
     *  aspect ratio). Defaults to 1024 — a 1920x1080 slide becomes ~1024x576,
     *  ~1.6k vision tokens instead of ~300k as base64 text. */
    maxImageDimension?: number;
}
export interface ArtifactInspectionImage {
    mimeType: 'image/png' | 'image/jpeg';
    byteLength: number;
    /** Output pixel dimensions after downscaling (cssDimension * deviceScaleFactor). */
    width: number;
    height: number;
    /** Raw base64 (NO `data:` prefix) — ready to drop into a pi-ai/MCP image
     *  content block as `{ type:'image', data, mimeType }`. */
    base64: string;
}
export interface ArtifactInspectionFrame {
    index: number;
    tagName: string;
    id?: string;
    className?: string;
    textSnippet?: string;
    rect: {
        x: number;
        y: number;
        width: number;
        height: number;
    };
    screenshot?: ArtifactInspectionImage;
    screenshotError?: string;
}
export interface ArtifactInspectionResult {
    artifactId: string;
    title: string;
    kind: string;
    context: 'editor' | 'fullscreen';
    viewport: {
        width: number;
        height: number;
    };
    documentSize: {
        width: number;
        height: number;
    };
    frameSelector: string;
    frameCount: number;
    bodyTextSnippet: string;
    console: Array<{
        type: string;
        text: string;
    }>;
    pageErrors: string[];
    requestFailures: Array<{
        url: string;
        errorText: string;
    }>;
    screenshot?: ArtifactInspectionImage;
    frames: ArtifactInspectionFrame[];
}
export declare function artifactPngArchiveFilename(bundle: ArtifactBundle): string;
export declare function artifactPngFrameFilename(bundle: ArtifactBundle, index: number, count: number): string;
export declare function nameArtifactPngFiles(bundle: ArtifactBundle, files: ArtifactPngExportFile[]): NamedArtifactPngExportFile[];
/** Zip an arbitrary set of named byte entries. Backing primitive for both the
 *  multi-PNG archive and the self-contained HTML-export bundle. */
export declare function zipArtifactFiles(files: Array<{
    filename: string;
    bytes: Buffer;
}>): Promise<Buffer>;
/** @deprecated naming — use {@link zipArtifactFiles}. Kept for callers. */
export declare function zipArtifactPngFiles(files: Array<{
    filename: string;
    bytes: Buffer;
}>): Promise<Buffer>;
export declare function withRenderedArtifact<T>(bundle: ArtifactBundle, options: ArtifactRenderExportOptions, callback: (page: import('playwright').Page) => Promise<T>): Promise<T>;
export declare function renderArtifactPng(bundle: ArtifactBundle, options?: ArtifactRenderExportOptions): Promise<Buffer>;
export declare function renderArtifactPngFiles(bundle: ArtifactBundle, options?: ArtifactRenderExportOptions): Promise<ArtifactPngExportFile[]>;
/** In-page script for the PDF canvas pre-pass — exported for the real-browser
 *  regression test. Chromium's print pipeline (page.pdf) re-lays-out the
 *  document through print rendering, which does NOT composite GPU-backed
 *  canvas content: a three.js scene prints as an empty box while the DOM
 *  around it survives. Swap every visible canvas for a same-geometry <img> of
 *  its current pixels so the PDF carries the rendered scene (surrounding text
 *  stays vector — only the canvas itself becomes raster).
 *
 *  Capture runs inside a double-requestAnimationFrame: a continuously
 *  rendering scene's draw for the current frame has already run by our
 *  callback (its rAF was registered first), and same-task reads see the WebGL
 *  drawing buffer even without preserveDrawingBuffer. A scene that rendered
 *  ONCE long ago without preserveDrawingBuffer still snapshots blank — no
 *  worse than today's blank print. Tainted canvases and snapshot failures
 *  leave the canvas untouched. */
export declare const snapshotCanvasesInPage: () => Promise<number>;
export declare function renderArtifactPdf(bundle: ArtifactBundle, options?: ArtifactRenderExportOptions): Promise<Buffer>;
export declare function inspectArtifactRender(bundle: ArtifactBundle, options?: ArtifactInspectOptions): Promise<ArtifactInspectionResult>;
/** A model-bound image block: raw base64 + mime, the shape a pi-ai/MCP
 *  `{ type:'image', data, mimeType }` content block needs. */
export interface InspectionImageBlock {
    mimeType: 'image/png' | 'image/jpeg';
    data: string;
}
/**
 * Split an inspection into (a) compact METADATA text (everything except the
 * base64 pixels) and (b) ordered IMAGE blocks (page first if present, then each
 * frame that has a screenshot). Callers send the metadata as a text block and
 * the images as real vision blocks, so the model actually SEES the slides for
 * ~1.6k tokens each instead of ~300k of undecoded base64 text. Frame metadata
 * keeps a `screenshotIndex` pointing at the matching image block's position.
 */
export declare function inspectionToModelPayload(inspection: ArtifactInspectionResult): {
    metadata: Record<string, unknown>;
    images: InspectionImageBlock[];
};
