type ByteReader = (path: string) => Promise; type BoundedByteReader = (path: string, byteLimit: number) => Promise; type ByteWriter = (path: string, content: Uint8Array) => Promise; export interface CapturedWholeFileReader { readonly maximumBytes: number; readonly read: ByteReader; } export interface CapturedFileSystemCapabilities { readonly readFileBytes?: ByteReader; readonly readFileBytesBounded?: BoundedByteReader; readonly readFileBytesWithinLimit?: BoundedByteReader; readonly writeFileBytes?: ByteWriter; readonly wholeFileReader?: CapturedWholeFileReader; } /** Compatibility view used by existing filesystem wrappers and adapters. */ export interface CapturedByteReaders { readonly unbounded?: ByteReader; readonly whole?: CapturedWholeFileReader; readonly prefix?: BoundedByteReader; readonly exact?: BoundedByteReader; } export interface CapturedSnapshotReader { read(path: string, containmentRoot: string, byteLimit: number): Promise; } export interface CapturedExclusiveCreator { create(path: string, content: Uint8Array): Promise; } export interface CapturedStaticReaders { snapshot?: CapturedSnapshotReader; virtual?: { generation(): Promise; exact?: (path: string, byteLimit: number) => Promise; whole?: { maximumBytes: number; read(path: string): Promise; }; }; } /** * Admit an untrusted byte result before copying it into an immutable-size, * tightly allocated ArrayBuffer. The maximum is checked from the intrinsic * Uint8Array byte length before allocating the defensive copy. */ export declare function copyFixedUint8ArrayWithinLimit(value: unknown, maximumBytes: number, label: string): Uint8Array; /** * Extract the ArrayBuffer from an admitted tight fixed Uint8Array without * consulting mutable global constructors or configurable typed-array getters. */ export declare function getFixedUint8ArrayBuffer(value: unknown, label: string): ArrayBuffer; /** Read the intrinsic byte length only after verifying a tight fixed buffer. */ export declare function getFixedUint8ArrayByteLength(value: unknown, label: string): number; /** * Preserve the broad legacy capture temporarily for its scheduled consumers. * Bounded text passes the narrow purpose so writer and prefix fields are never * inspected. */ export declare function captureFileSystemCapabilities(value: unknown, label?: string, purpose?: "legacy" | "bounded-text" | "byte-read"): CapturedFileSystemCapabilities; /** * Capture the established byte-reader surface while defensively admitting * every result. New purpose-specific code should prefer the narrower capture * functions above. */ export declare function captureByteReadCapabilities(value: unknown, label?: string): CapturedByteReaders; /** * Capture legacy byte capabilities after genuine snapshot authority has been * proven independently. Malformed optional fields are omitted one at a time; * unsafe object or prototype provenance still rejects the adapter. */ export declare function captureLegacyFileSystemCapabilitiesForSnapshot(value: unknown, label?: string): CapturedFileSystemCapabilities; export declare function captureSnapshotReadCapability(value: unknown, label?: string, allowExplicitUndefined?: boolean): CapturedSnapshotReader | undefined; export declare function captureExclusiveCreateCapability(value: unknown, label?: string): CapturedExclusiveCreator | undefined; /** * Capture snapshot and virtual read authority from a filesystem. * * `allowExplicitUndefined` stays strict by default, matching * {@link captureSnapshotReadCapability}: for a raw adapter, a capability key * present with the value `undefined` is a defect worth surfacing. * * Callers handed an `FSAdapterWrapper` must opt in, because that wrapper * publishes every optional capability as a frozen own property, `undefined` * included, so project code cannot inject one later. Without the opt-in this * threw, and its only caller wraps it in a catch, so wrapper-backed * filesystems silently lost virtual snapshot authority instead of failing. */ export declare function captureStaticReadCapabilities(value: unknown, label?: string, allowExplicitUndefined?: boolean): CapturedStaticReaders; export {}; //# sourceMappingURL=file-system-capabilities.d.ts.map