export type FileMutationKind = "write" | "edit"; export interface FilePathIdentity { dev: string; ino: string; mode: string; size: string; mtimeMs: string; ctimeMs: string; mtimeNs?: string; ctimeNs?: string; } export interface FilePathInspection { kind: "file" | "directory" | "other"; identity: FilePathIdentity; } export interface FileMutationIntentOperations { inspect(path: string, followSymlinks: boolean): Promise; access(path: string, mode: number): Promise; copyFileExclusive(sourcePath: string, targetPath: string): Promise; hashFile(path: string, signal?: AbortSignal): Promise; readPayload(path: string): Promise; removeFile(path: string): Promise; stagePayload(content: string, ttlMs: number): Promise; } export interface FileMutationLease { kind: FileMutationKind; path: string; displayPath: string; identity?: FilePathIdentity; } export interface FileContentReference { contentRef: string; byteLength: number; } export interface FileMutationPayloadReference { payloadRef: string; byteLength: number; } export type FileMutationPreflightFailureReason = "write_collision" | "edit_missing" | "edit_not_file"; export declare class FileMutationPreflightError extends Error { readonly reason: FileMutationPreflightFailureReason; constructor(reason: FileMutationPreflightFailureReason, message: string); } export declare class FileMutationIdentityError extends Error { constructor(displayPath: string); } export interface FileMutationIntentControllerOptions { operations?: FileMutationIntentOperations; contentReferenceLimit?: number; contentReferenceTtlMs?: number; mutationPayloadLimit?: number; mutationPayloadByteLimit?: number; mutationPayloadTtlMs?: number; now?: () => number; } export declare const localFileMutationIntentOperations: FileMutationIntentOperations; /** * Session-owned harness authority for file-mutation preflight, stale-target checks, * and bounded exact-content references. It retains only fixed-size metadata; file * bytes remain owned by the filesystem. */ export declare class FileMutationIntentController { private readonly operations; private readonly contentReferenceLimit; private readonly contentReferenceTtlMs; private readonly mutationPayloadLimit; private readonly mutationPayloadByteLimit; private readonly mutationPayloadTtlMs; private readonly now; private readonly contentReferences; private readonly mutationPayloads; private mutationPayloadBytes; private lastMutationPayloadExpiresAt; private mutationPayloadOperationTail; constructor(options?: FileMutationIntentControllerOptions); prepare(kind: FileMutationKind, path: string, signal?: AbortSignal, displayPath?: string): Promise; assertCurrent(lease: FileMutationLease, signal?: AbortSignal): Promise; /** * Re-anchor an edit lease to the file's current identity after an observed change. * The caller must then re-read and re-validate its content against that same version; * the next assertCurrent re-verifies that identity immediately before the caller writes. * That re-verification is a point-in-time observation, not a hold on the file: a write by * another process landing between it and the caller's write is neither detected nor * preserved — the caller's buffer overwrites it and nothing observes the loss afterwards. */ refreshIdentity(lease: FileMutationLease, signal?: AbortSignal): Promise; rememberContent(sourcePath: string, content: string): FileContentReference; /** True when this session's own earlier mutation produced exactly this content at this path. */ hasProducedContent(sourcePath: string, content: string): boolean; retainMutationPayload(kind: FileMutationKind, payload: string): Promise; readMutationPayload(payloadRef: string, kind: FileMutationKind, signal?: AbortSignal): Promise; assertMutationPayload(payloadRef: string, kind: FileMutationKind, signal?: AbortSignal): Promise; assertContentReference(contentRef: string, signal?: AbortSignal): Promise; copyMutationPayload(payloadRef: string, targetPath: string, signal?: AbortSignal): Promise; discardMutationPayload(payloadRef: string): Promise; /** Release every payload owned by this controller without touching another controller's files. */ dispose(): Promise; copyReferencedContent(contentRef: string, targetPath: string, signal?: AbortSignal): Promise; private requireVerifiedContentReference; private requireMutationPayload; private requireVerifiedMutationPayload; private verifySource; private copyVerifiedSource; private assertCreatableParent; private rememberContentDigest; private touchContentReference; private removeFailedCopy; private deleteMutationPayload; private runMutationPayloadOperation; private pruneExpiredMutationPayloads; private pruneExpired; } //# sourceMappingURL=file-mutation-intent.d.ts.map