/**
 * On-demand app preview (#475): serve a project's built result from the dashboard
 * without an agent run. This is the decoupled twin of the run's serve gate — where
 * that boots the app to *verify* it, this boots it to *show* it (a one-click Preview
 * button, useful for non-technical users too). It runs entirely in the daemon
 * process: the project's dev script when it has one, else a built-in static server
 * for a plain `index.html`. Kept a quick-win (#475): a URL + a Stop, not a full
 * in-dashboard preview view.
 */
/** A running preview: its URL, how it was served, and a teardown. */
export interface PreviewHandle {
    /** The reachable localhost URL. */
    url: string;
    /** The npm script serving it (e.g. `dev`), or `static` for the built-in file server. */
    command: string;
    /** Stop the preview and free its port. Idempotent. */
    stop(): Promise<void>;
    /**
     * Resolves when the preview is no longer serving — on {@link stop}, or when the dev
     * server exits on its own (a crash, a build error, the user killing it). The daemon
     * watches this to evict a dead preview so the next open restarts it (#475).
     */
    exited: Promise<void>;
}
/** Options for {@link startPreview}. */
export interface StartPreviewOptions {
    /** The project directory to serve. */
    cwd: string;
    /**
     * Which app to serve in a multi-package repo (#651), from {@link detectServeTargets}. Absent
     * serves the root package (the single-package default), preserving the original behavior.
     */
    target?: ServeTarget;
    /** How long to wait for a dev script to print its localhost URL before giving up. Default 20s. */
    waitMs?: number;
}
/** The npm scripts we try, best-first, when serving a project's dev preview. */
export declare const PREVIEW_SCRIPTS: readonly ["dev", "start", "preview", "serve"];
/** The first {@link PREVIEW_SCRIPTS} entry the project's `package.json` defines, else undefined. */
export declare function detectDevScript(cwd: string): Promise<string | undefined>;
/**
 * One servable app in a repo (#651): a package that defines a dev/serve script. Plain repos
 * have exactly one (the root); a monorepo has one per workspace package that can serve, and
 * the dashboard offers a picker over them.
 */
export interface ServeTarget {
    /** Stable id = the dir relative to the repo root, or `.` for the root package itself. */
    id: string;
    /** Human label: the package.json `name`, else the directory basename (`.` → `root`). */
    label: string;
    /** The dir to run the script in, relative to the repo root (`''` = the root). */
    dir: string;
    /** The npm script that serves it (a {@link PREVIEW_SCRIPTS} entry). */
    script: string;
}
/**
 * Enumerate the repo's servable apps (#651), best-first: the root package (when it has a serve
 * script) followed by each workspace package that has one, in path order. A plain single-package
 * repo yields at most one target (the root); a monorepo yields one per servable workspace so the
 * Serve button can offer a pick. Workspaces come from `pnpm-workspace.yaml` or the package.json
 * `workspaces` field; unreadable/absent config just yields the root (or nothing).
 */
export declare function detectServeTargets(cwd: string): Promise<ServeTarget[]>;
/**
 * Parse the first browsable localhost URL a dev server prints (Vite, Next, CRA, and
 * friends all announce one), normalizing `0.0.0.0` to `localhost` and trimming any
 * trailing punctuation. Returns undefined when the output carries no such URL yet.
 */
export declare function parsePreviewUrl(output: string): string | undefined;
/**
 * Start a live preview of the project. Prefers its dev script (spawned as its own
 * process group so {@link PreviewHandle.stop} kills the whole tree), and reads the
 * localhost URL the server announces on stdout/stderr. With no dev script, falls back
 * to a built-in static server when the project has an `index.html`. Throws when there
 * is nothing to serve, or the dev script never announces a URL.
 */
export declare function startPreview(opts: StartPreviewOptions): Promise<PreviewHandle>;
//# sourceMappingURL=preview.d.ts.map