@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
23 lines • 1.28 kB
TypeScript
import type { LiveVersion } from '../../cache/types.ts';
import type { FileStat } from '../../types.ts';
import type { BoxItem } from './api.ts';
/**
* A file's content token: its sha1, or null. The one rule stat, readdir and
* read all stamp by, so the two sides of a `read: fresh` check are always the
* same kind. modified_at is no content token: two same-size edits in one
* second share it on the real service.
*/
export declare function tokenOf(value: unknown): string | null;
/** A looked-up item's live tokens, null when it is no file. Mirrors Python's `live_of`. */
export declare function liveOf(item: BoxItem | null): LiveVersion | null;
/** The content token a listing row carries. */
export declare function entryToken(entry: FileStat): string | null;
/**
* The token a whole read stamps: the listed sha1, if the bytes match it. A
* download carries no version header, so the bytes are checked against the
* row they were resolved through. A writer between the listing and the
* download leaves them disagreeing, and new bytes are never labelled with
* the old token. `digest` is the SHA-1 hex of the bytes the read returned.
*/
export declare function readToken(entry: FileStat, digest: string): string | null;
//# sourceMappingURL=fingerprint.d.ts.map