import type { FsNode } from "../sandbox/node/fs_node"; import type { ParsedApplyPatch, WorkspaceFile } from "../../lib/patch/index"; import type { MimeResolver } from "../sandbox/contracts/mime_resolver"; import type { SandboxFileSystem } from "../sandbox/contracts/file_system"; import type { PathTranslator } from "../sandbox/contracts/path_translator"; import type { DevFileAccess, DevInvocation, FileChangeSummary } from "./types"; import type { Diagnostic, ExecutionState, RawDiagnostic, StampedDelta, WorkspaceBounds } from "./types"; /** Internal provenance marker for runtime diagnostics that name an engine. */ export declare const runtimeDiagnostic: unique symbol; /** Whole-file names that are known textual despite having no useful extension. */ export declare const DEV_FILENAME_MIME: Readonly>; /** Resolve an admission MIME, giving the normative filename map precedence. */ export declare const resolveDevMime: (path: string, resolver: MimeResolver | undefined, bytes: Uint8Array) => Promise; /** Canonicalize an absolute host workspace root for comparisons and engine requests. */ export declare const canonicalizeDevRoot: (value: string) => string; /** Check all workspace resource limits against a proposed map. */ export declare const assertBounds: (files: ReadonlyMap, bounds: WorkspaceBounds) => void; /** Resolve acquisition paths without reading file contents. */ export declare const resolveAcquisitionTargets: (options: { paths: readonly string[]; fileSystem: SandboxFileSystem; pathTranslator: PathTranslator; signal?: AbortSignal; }) => Promise; /** Acquire explicitly requested files, expanding only entries containing an asterisk. */ export declare const acquireWorkspace: (options: { paths: readonly string[]; fileSystem: SandboxFileSystem; pathTranslator: PathTranslator; bounds: WorkspaceBounds; mimeResolver?: MimeResolver; signal?: AbortSignal; /** Previously resolved targets, used to keep approval and acquisition consistent. */ targets?: readonly string[]; }) => Promise>; /** * Derive the canonical workspace delta for a completely parsed structured patch. * * The patch primitive mutates its input map, so this always applies it to a clone and returns * nothing until the entire operation list has succeeded. */ export declare const derivePatchOutcome: (files: Map, parsed: ParsedApplyPatch) => { delta: { changed: Map; added: Map; deleted: Set; renamed: Map; diagnostics: never[]; }; recreated: Set; }; /** Normalize, validate, and apply one engine delta without mutating it. */ export declare const applyDelta: (options: { delta: StampedDelta; files: Map; state: ExecutionState; bounds: WorkspaceBounds; fileSystem: SandboxFileSystem; pathTranslator: PathTranslator; mimeResolver?: MimeResolver; persistedPaths?: Map; pendingDeletions?: Map; recreated?: Set; renames?: Map; /** Paths vacated earlier in this execution by a deletion or rename. */ vacated?: Set; unreadable?: ReadonlySet; engineId?: string; /** Resolved existing paths this engine invocation was authorized to modify. */ invocationPaths?: readonly string[]; /** Authored selector patterns; additions must match these when present. */ selector?: readonly string[] | null; /** Structured patch additions are textual by construction and retain their inferred MIME. */ skipAddedMimeResolution?: boolean; }) => Promise; /** Normalize and scope-stamp diagnostics after the workspace mutation has completed. */ /** Build the deliberately narrow disk API handed to an in-place engine. */ export declare const makeDevFileAccess: (options: { invocation: DevInvocation; allowlist: readonly string[]; fileSystem: SandboxFileSystem; pathTranslator: PathTranslator; policy: FsNode | undefined; selector: readonly string[] | null; signal?: AbortSignal; renameDestinations: Set; }) => DevFileAccess; /** Snapshot an in-place authorization envelope before its capability mutates disk. */ export declare const snapshotInPlaceEnvelope: (options: { envelope: readonly (readonly string[])[]; excluded?: ReadonlySet; files: ReadonlyMap; fileSystem: SandboxFileSystem; pathTranslator: PathTranslator; signal?: AbortSignal; }) => Promise<{ paths: Set; diagnostics: RawDiagnostic[]; }>; /** Assemble final-state changes, retaining rename identity rather than guessing from text. */ /** Re-read an in-place invocation's authorized envelope against its pre-step snapshot. */ export declare const rereadInPlace: (options: { envelope: readonly (readonly string[])[]; /** Dirty workspace paths whose disk copies must not be admitted by this re-read. */ excluded?: ReadonlySet; beforeSnapshot?: Set; files: Map; unreadable: Set; persistedPaths: Map; persistedBaseline: Map; renames: Map; recreated: Set; fileSystem: SandboxFileSystem; pathTranslator: PathTranslator; bounds: WorkspaceBounds; mimeResolver?: MimeResolver; signal?: AbortSignal; }) => Promise<{ changed: Set; diagnostics: RawDiagnostic[]; }>; export declare const assembleChanges: (baseline: ReadonlyMap, files: ReadonlyMap, renames: ReadonlyMap, recreated: ReadonlySet, unreadable: ReadonlySet) => Promise<{ changes: FileChangeSummary[]; lineCountsAvailable: boolean; }>; export declare const stampDiagnostics: (diagnostics: readonly (RawDiagnostic & { engineId: string | null; })[], files: ReadonlyMap, root: string, translator: PathTranslator, fallbackEngineId?: string | null) => Diagnostic[];