import { type AuthoredEntryIdentity, type StableAuthoredRoot } from './authored-state-transaction-fs.js'; import type { InitAuthoredPathState } from './init-authored-plan.js'; import type { BigIntStats } from 'node:fs'; interface BoundAuthoredAncestor { readonly path: string; readonly identity: AuthoredEntryIdentity; } export interface BoundAuthoredTargetEntry { readonly descriptor: number | null; readonly identity: AuthoredEntryIdentity; readonly type: 'directory' | 'file'; } export interface AuthoredTargetFilesystemDependencies { readonly platform?: NodeJS.Platform; readonly open?: (path: string, flags: number) => number; readonly chmodDirectoryPath?: (path: string, mode: number) => void; readonly fchmodDirectory?: (descriptor: number, mode: number) => void; readonly fsyncDirectoryDescriptor?: (descriptor: number) => void; } export interface ResolvedAuthoredTargetFilesystemDependencies { readonly platform: NodeJS.Platform; readonly open: (path: string, flags: number) => number; readonly chmodDirectoryPath: (path: string, mode: number) => void; readonly fchmodDirectory: (descriptor: number, mode: number) => void; readonly fsyncDirectoryDescriptor: (descriptor: number) => void; } /** * Attempt-local authority for one authored target. Node does not expose * openat(2)/renameat2(2), so path mutations still have an irreducible race * after the final check. Holding the parent and target descriptors, and * revalidating every path component immediately before each mutation, closes * all deterministic checkpoint windows without pretending this is an OS * sandbox. */ export interface BoundAuthoredTarget { readonly root: StableAuthoredRoot; readonly relativePath: string; readonly path: string; readonly parentPath: string; readonly parentDescriptor: number | null; readonly parentIdentity: AuthoredEntryIdentity; readonly ancestors: readonly BoundAuthoredAncestor[]; readonly filesystem: ResolvedAuthoredTargetFilesystemDependencies; target: BoundAuthoredTargetEntry | null; } export type AuthoredTargetMutationOperation = 'stage-file-temporary' | 'commit-file' | 'remove-satisfied-file-temporary' | 'create-directory' | 'chmod-directory' | 'remove-file' | 'remove-directory'; export interface AuthoredTargetMutationHooks { /** * Test/fault-injection seam. It runs before the final authority check, never * after it, so a swap injected here must be rejected before the syscall. */ readonly beforeFinalMutation?: (operation: AuthoredTargetMutationOperation) => void; } export declare function entryType(stat: BigIntStats): 'directory' | 'file'; export declare function openTargetEntry(path: string, filesystem: ResolvedAuthoredTargetFilesystemDependencies): BoundAuthoredTargetEntry | null; export declare function closeTargetDescriptor(target: BoundAuthoredTargetEntry | null): void; export declare function currentDirectoryIdentity(path: string, description: string): AuthoredEntryIdentity; export declare function assertPinnedParentAndAncestors(authority: BoundAuthoredTarget): void; export declare function assertPinnedTarget(authority: BoundAuthoredTarget): void; export declare function observeBoundAuthoredTarget(authority: BoundAuthoredTarget): InitAuthoredPathState; export declare function withBoundAuthoredTarget(root: StableAuthoredRoot, relativePath: string, callback: (authority: BoundAuthoredTarget, current: InitAuthoredPathState) => T, dependencies?: AuthoredTargetFilesystemDependencies): T; export {}; //# sourceMappingURL=authored-state-transaction-target-fs.d.ts.map