UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

46 lines • 1.75 kB
import { type Files } from '../files.ts'; /** * Version stamp for one file's stored bytes. * * @param content The bytes to stamp. * @returns A base64url digest, matching the Python tracker's stamp. */ export declare function fingerprint(content: Uint8Array): Promise<string>; export declare class FileVersionTracker { readonly vfs: Files; private readonly enabled; private readonly readVersions; private readonly editVersions; private readonly writes; private readonly seen; /** * @param vfs The file API to read and write through, run as the * session whose reads are tracked. * @param enabled False serves every call unchecked. */ constructor(vfs: Files, enabled?: boolean); /** * This tracker read and written through `vfs`: one call's own view of * the session's files, which records what it sees where every other * call of the session finds it. */ through(vfs: Files): FileVersionTracker; private key; private currentVersion; private assertVersion; private recordWrite; /** * Whether a write may overwrite the file: the agent was shown all of it, * or wrote all of it, since this tracker started, or nothing is checked. * A read of a few lines does not count, so a write never replaces lines * the agent did not see. */ hasRead(path: string): boolean; /** Record that the agent was shown all of the file. */ markSeen(path: string): void; read(path: string): Promise<Uint8Array>; readForEdit(path: string): Promise<Uint8Array>; write(path: string, content: string): Promise<void>; writeEdit(path: string, content: string): Promise<void>; } //# sourceMappingURL=file_version.d.ts.map