import type { ProjectEnvSnapshot } from "./project-env-contract.js"; type EnvRecord = Record; type EnvOverlayStore = Map; /** Returns the active host-only test overlay, or null outside test execution. */ export type EnvOverlayGetter = () => EnvOverlayStore | null; /** Returns the active project environment snapshot, or undefined outside one. */ export type ProjectEnvSnapshotGetter = () => ProjectEnvSnapshot | undefined; /** Minimal contract implemented by the Deno environment capability. */ export interface DenoEnvView { get(key: string): string | undefined; set(key: string, value: string): void; delete(key: string): void; has(key: string): boolean; toObject(): Record; } /** Whether a Deno environment view already composes with the supported test overlay. */ export declare function isTestOverlayAwareDenoEnvView(value: unknown): boolean; /** * Read a key as the scoped view presents it: snapshot entry, then any write * recorded against that snapshot. * * Exported so the accessors (`getEnv()`, `env()`) resolve keys through exactly * the same rule as the raw object, instead of reading the immutable snapshot * and missing writes the object has already accepted. */ export declare function readProjectScopedEnv(snapshot: ProjectEnvSnapshot, key: string): string | undefined; /** * Record a write against the active snapshot instead of the host environment. * * Exported so the mutating accessors (`setEnv()`) apply writes through exactly * the same rule as the raw `process.env` view: while a project scope is * active, its snapshot owns the whole environment and a write must stay * contained to that scope rather than reaching the shared host process. */ export declare function writeProjectScopedEnv(snapshot: ProjectEnvSnapshot, key: string, value: string): void; /** Record a deletion against the active snapshot (masks the snapshot entry). */ export declare function deleteProjectScopedEnv(snapshot: ProjectEnvSnapshot, key: string): void; /** * Create an ambient-scope-aware view over the Deno environment capability. * * The host methods are captured before tenant code runs. Project reads and * writes use the same snapshot log as process.env, while calls outside a * project scope preserve native Deno behavior and permission checks. */ export declare function createProjectScopedDenoEnvView(hostEnv: DenoEnvView, getSnapshot: ProjectEnvSnapshotGetter, getOverlay?: EnvOverlayGetter): DenoEnvView; /** The scoped view as a plain record, for the bulk accessor. */ export declare function projectScopedEnvRecord(snapshot: ProjectEnvSnapshot): Record; /** Create the one ambient-scope-aware process.env view installed for this process. */ export declare function createProjectScopedProcessEnvView(hostEnv: EnvRecord, getSnapshot: ProjectEnvSnapshotGetter, getOverlay?: EnvOverlayGetter): EnvRecord; /** * Install the project-scoped view over `process.env`. * * Idempotent: the first installation owns the view for the process lifetime, so * the record captured as the host view is always the pre-installation one. * Outside a project scope every operation passes straight through to it. * * The view is installed as a non-configurable accessor, so code running later * cannot detach it by assigning to or redefining `process.env` — an assignment * is applied through the view (see `applyEnvReplacement`) rather than replacing * it. Without that, one assignment would drop the view for every scope in the * process, not only the one that made it. */ export declare function installProjectScopedProcessEnv(getSnapshot: ProjectEnvSnapshotGetter, getOverlay?: EnvOverlayGetter): void; export {}; //# sourceMappingURL=scoped-process-env.d.ts.map