/** * Profile-reuse orchestration (plan Phase 2 wiring). * * Single entry point the launch path calls to decide, for a default headless * session, whether to warm up from an isolated copy of the user's real Chrome * profile. Ties together discovery + posture + isolated warm-up. Filesystem * effects (the copy) are performed only when the posture resolves to `real`. * The heavy pieces are injectable so this is unit-testable without a browser. */ import { type DiscoveredProfile, type DiscoveryEnv } from "./profile-discovery"; import { type ProfileReusePosture } from "./profile-posture"; import { type WarmupManifest } from "./profile-warmup"; export interface ResolveProfileReuseInputs { posture?: ProfileReusePosture; /** Caller explicitly requested real-profile reuse (e.g. app.browser === "chrome"). */ explicitlyRequested?: boolean; discoveryEnv: DiscoveryEnv; /** Destination for the isolated warm-up copy; defaults to an ephemeral temp dir. */ destDir?: string; /** Injectable copier (defaults to collectWarmupArtifacts). */ copy?: (sourceProfileDir: string, destDir: string) => WarmupManifest; /** Injectable temp-dir factory (defaults to fs.mkdtemp under os.tmpdir()). */ makeTempDir?: () => string; } export interface ProfileReuseResult { mode: "real" | "synthetic"; reason: string; warning: string | null; discovered: DiscoveredProfile | null; /** Isolated copy directory when mode === "real", else null. */ warmupDir: string | null; manifest: WarmupManifest | null; } /** * Resolve profile reuse for a default session. When the posture resolves to * `real`, copies an allowlisted, lock-free subset of the discovered profile * into an isolated dir and returns that dir for the launcher to use. */ export declare function resolveProfileReuse(inputs: ResolveProfileReuseInputs): ProfileReuseResult;