export type VariantHistoryStatus = 'completed' | 'committed' | 'rejected' | 'cancelled';
export type VariantHistoryKind = 'diff' | 'project-created';
export type VariantHistoryPreview = {
    kind: 'static';
    rootPath: 'files';
    entryPath: string;
} | {
    kind: 'dev-server';
    rootPath: 'files';
    command: {
        cwd: string;
        packageManager: string;
        script: string;
    };
    runnablePath?: string;
} | {
    kind: 'none';
    reason: 'diff_only' | 'missing_entry' | 'unsupported';
};
export type PersistVariantPreview = {
    kind: 'static';
    entryPath: string;
} | {
    kind: 'dev-server';
    command: {
        cwd: string;
        packageManager: string;
        script: string;
    };
    runnablePath?: string;
} | {
    kind: 'none';
    reason: 'diff_only' | 'missing_entry' | 'unsupported';
};
export type VariantHistoryArtifact = {
    kind: 'diff';
    diffPath: 'diff.patch';
    filesPath?: 'files';
} | {
    kind: 'project';
    filesPath: 'files';
    runnablePath?: string;
};
/** Where the persisted DESIGN.md came from. Slug entries point at a curated
 *  catalog inspiration; markdown entries carry user-supplied / Agent Browser
 *  extracted content. `label` is always human-readable for the history UI. */
export interface VariantDesignSource {
    kind: 'slug' | 'markdown';
    label: string;
    /** Catalog slug — present only when `kind === 'slug'`. */
    slug?: string;
}
/** A public deployment of this variant to the Prototype Preview Host. Recorded
 *  so the UI can re-show ("Copy link") an existing share URL instead of
 *  re-building, and so repeated deploys accrue rather than clobber. */
export interface VariantDeployment {
    deployId: string;
    shareUrl: string;
    deployedAt: string;
}
export interface VariantHistoryManifest {
    schemaVersion: number;
    variantId: string;
    sessionId: string;
    label: string;
    brief: string;
    sessionPrompt: string;
    projectKind: 'existing' | 'fresh';
    status: VariantHistoryStatus;
    createdAt: string;
    statusChangedAt: string;
    baseSha?: string;
    destinationPath?: string;
    changedFilesCount: number;
    artifact: VariantHistoryArtifact;
    preview: VariantHistoryPreview;
    designSource?: VariantDesignSource;
    /** Public deploys, newest last. Absent until the variant is first deployed. */
    deployments?: VariantDeployment[];
}
export interface VariantHistorySessionFile {
    schemaVersion: number;
    sessionId: string;
    createdAt: string;
    sessionPrompt: string;
    projectKind: 'existing' | 'fresh';
}
export interface PersistVariantArgs {
    projectPath: string;
    sessionId: string;
    variantId: string;
    label: string;
    brief: string;
    sessionPrompt: string;
    kind: VariantHistoryKind;
    /** Required when kind === 'diff'. */
    diff?: string;
    /** Required when kind === 'project-created'. Directory whose contents are copied into `files/`. */
    sourceDir?: string;
    /** Explicit preview contract for this history artifact. Diff variants can
     *  use `static` only when sourceDir is provided and copied to files/. */
    preview?: PersistVariantPreview;
    baseSha?: string;
    destinationPath?: string;
    changedFilesCount: number;
    /** Defaults to 'completed'. Use 'committed' / 'rejected' when persisting at commit time. */
    initialStatus?: VariantHistoryStatus;
    projectKind: 'existing' | 'fresh';
    /** Generated DESIGN.md body to persist as a top-level artifact alongside
     *  the diff/files. Currently only populated for fresh-project variants —
     *  existing-project variants don't generate a DESIGN.md. */
    designMarkdown?: string;
    designSource?: VariantDesignSource;
}
export interface ListVariantsArgs {
    projectPath: string;
    limit?: number;
    status?: VariantHistoryStatus;
}
export interface VariantHistoryEntry {
    manifest: VariantHistoryManifest;
    /** Absolute path to the variant's directory under `.rivet/variants/<sessionId>/<variantId>/`. */
    variantDir: string;
    /** True when `files/index.html` exists on disk — i.e. the variant can be
     *  rendered as a static preview in an iframe. Vite_app variants and diff
     *  variants are false. Computed at list/get time so the UI can filter
     *  click-to-preview affordances without poking the disk itself. */
    hasStaticPreview: boolean;
}
export interface VariantHistoryDetail extends VariantHistoryEntry {
    /** Diff body — present for `kind: 'diff'` variants. */
    diff?: string;
    /** Project-relative file list under `files/` — present for `kind: 'project-created'` variants. */
    files?: string[];
    /** Generated DESIGN.md body — present when the variant was scaffolded with
     *  a design context (fresh-project variants only). */
    designMarkdown?: string;
}
export interface StaticPreviewFile {
    body: Buffer;
    absolutePath: string;
}
export declare class VariantHistoryService {
    variantsRoot(projectPath: string): string;
    sessionDir(projectPath: string, sessionId: string): string;
    variantDir(projectPath: string, sessionId: string, variantId: string): string;
    persistVariant(args: PersistVariantArgs): Promise<void>;
    markStatus(args: {
        projectPath: string;
        sessionId: string;
        variantId: string;
        status: VariantHistoryStatus;
        /** Optional manifest patch applied alongside the status flip. Used at
         *  commit time so the chosen fresh-project variant records the path
         *  the materialized project landed at. */
        destinationPath?: string;
        /** Relative path to a runnable project copy from the history workspace. */
        runnablePath?: string;
    }): Promise<void>;
    /**
     * Append a public deployment to a variant's manifest. Unlike `markStatus`,
     * this never touches `status` — a deployed variant keeps whatever lifecycle
     * status it already has (a user can share an uncommitted prototype). The
     * read-patch-write is atomic via `writeManifestFile`; concurrent deploys of
     * the same variant are not expected (the UI disables the button while busy).
     */
    recordDeployment(args: {
        projectPath: string;
        sessionId: string;
        variantId: string;
        deployment: VariantDeployment;
    }): Promise<void>;
    listVariants(args: ListVariantsArgs): Promise<VariantHistoryEntry[]>;
    getVariant(args: {
        projectPath: string;
        sessionId: string;
        variantId: string;
    }): Promise<VariantHistoryDetail | null>;
    /**
     * Read the persisted static-preview HTML for a variant. Returns null when
     * the variant isn't on disk or doesn't have a `files/index.html`. Used by
     * the REST history-static endpoint that backs the AgentVariantsPanel
     * iframe when a past variant is clicked.
     */
    readStaticPreview(args: {
        projectPath: string;
        sessionId: string;
        variantId: string;
    }): Promise<string | null>;
    /**
     * Read a file from a variant's saved static preview snapshot.
     * Asset paths are resolved under `files/` and rejected when they attempt
     * to escape the snapshot root.
     */
    readStaticPreviewFile(args: {
        projectPath: string;
        sessionId: string;
        variantId: string;
        assetPath: string | null;
    }): Promise<StaticPreviewFile | null>;
    ensureGitignore(projectPath: string): Promise<void>;
}
//# sourceMappingURL=VariantHistoryService.d.ts.map