/**
 * VariantRunPlan — the single, canonical resolution of "what kind of run is
 * this" for an agent-variants session.
 *
 * Historically the lifecycle policy (work-item topology, how variants are
 * provisioned, how they're committed, how they preview) was re-derived
 * independently at every stage from `projectContext.kind`,
 * `executionPlan.mode`, and framework detection — `SessionStore.approve`,
 * `WorktreeOrchestrator` provisioning, the commit path, and the preview
 * wiring each made the same `kind === 'fresh'` / `mode === 'vite_app'`
 * decisions in their own way. That spread the same handful of facts across
 * dozens of call sites and let them drift.
 *
 * This module collapses those facts into a *closed* discriminated union. There
 * are exactly three legal run shapes:
 *
 *   1. existing project              — clone+diff against the user's tree
 *   2. generated project, static     — inline HTML/CSS/JS, no runtime
 *   3. generated project, app (vite) — scaffolded Vite app with a dev server
 *
 * Every other lifecycle policy (topology / provision / commit) is a pure
 * function of which of those three a session is — see `runPlanPolicy`. Callers
 * resolve the plan once (at `approve` time, the first point where every input
 * is known) and read policy off it, rather than re-deriving from raw context.
 *
 * Preview is deliberately *not* a fixed field of the plan. For generated
 * projects it's determined (static → static_artifact, app → dev_server), but
 * for existing projects it's only known at success time — a `framework:'static'`
 * existing project previews as a materialized static artifact, anything else
 * proxies a dev server. That one genuinely-late decision is exposed via
 * `existingPreviewKind` rather than baked into the plan at resolve time.
 */
import type { ProjectContext } from './contracts';
/**
 * The closed set of legal run shapes. Modelled as a discriminated union so the
 * compiler rejects impossible combinations (e.g. an existing project with a
 * `runtime`, or a generated project with no runtime) at construction time —
 * there is no way to hand-assemble an illegal plan.
 */
export type VariantRunPlan = {
    source: 'existing';
} | {
    source: 'generated';
    runtime: 'static';
} | {
    source: 'generated';
    runtime: 'app';
};
/** How the work items for a run are shaped at approve time. */
export type RunTopology = 
/** One `code_gen` item per variant, edited inside a git worktree. Used by
 *  existing projects and (with a `scaffold_base` dependency) generated apps. */
'code_gen'
/** One `static_preview` item per variant — inline HTML is the deliverable,
 *  no worktree, no scaffold. Generated-static only. */
 | 'static_preview';
/** How each variant's working copy is provisioned. */
export type RunProvision = 
/** A git worktree cloned from the user's repo (existing projects). */
'git_worktree'
/** A scaffolded template worktree under `.rivet-variants` (generated apps). */
 | 'template_worktree'
/** Nothing — the deliverable is inline HTML (generated-static). */
 | 'none';
/** How the picked variant is landed when the user commits. */
export type RunCommit = 
/** Apply the captured diff to the user's working tree (existing projects). */
'apply_diff'
/** Write the static site (HTML + assets) to the destination
 *  (generated-static). */
 | 'write_static_site'
/** Materialize / rename the whole scaffolded app to the destination
 *  (generated apps). */
 | 'materialize_project';
/** Preview surface for a generated variant. Existing projects defer this to
 *  success time — see {@link existingPreviewKind}. */
export type RunPreview = 'static_artifact' | 'dev_server';
export interface RunPlanPolicy {
    topology: RunTopology;
    provision: RunProvision;
    commit: RunCommit;
    /** True when the run needs a `scaffold_base` work item gating its
     *  `code_gen` items (generated Vite apps). */
    needsScaffoldBase: boolean;
    /** Fixed preview surface when the source determines it; `undefined` for
     *  existing projects, where it's resolved at success time. */
    preview?: RunPreview;
}
/**
 * Resolve the run plan from a project context. This is the single decision
 * point: `source` comes from `projectContext.kind`; for generated projects the
 * `runtime` comes from the agent's reported `executionPlan.mode`, defaulting to
 * `static` for source-less zero-to-one runs (which never report a plan).
 */
export declare function resolveRunPlan(projectContext: ProjectContext): VariantRunPlan;
/** Derive the lifecycle policy for a resolved plan. Total over the closed set. */
export declare function runPlanPolicy(plan: VariantRunPlan): RunPlanPolicy;
/** Convenience: resolve and derive policy in one step. */
export declare function resolveRunPlanPolicy(projectContext: ProjectContext): RunPlanPolicy;
/**
 * Preview surface for an existing-project variant, resolved at success time
 * from whether the variant materialized static files (framework `static`, no
 * dev command) or runs a dev server. Generated projects don't use this — their
 * preview is fixed by {@link runPlanPolicy}.
 */
export declare function existingPreviewKind(hasStaticFiles: boolean): RunPreview;
//# sourceMappingURL=runPlan.d.ts.map