UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

59 lines • 3.32 kB
import { FileChangeKind, FileEvent, PathSpec } from '../types.ts'; export declare function specFor(root: PathSpec, virtual: string): PathSpec; /** * The event saying what changed under `root` is not known: UNKNOWN on the * root, which the hub reads as "re-inventory everything below". Mirrors * Python `lost_at`. */ export declare function lostAt(root: PathSpec, observed: Date): FileEvent; /** * How one item's paths moved: each path it left, each it reached, and each it * kept that `updated` says changed. Mirrors Python `changes_between`. */ export declare function changesBetween(before: readonly string[], after: readonly string[], updated: (path: string) => boolean): [FileChangeKind, string][]; /** * The changes a subscription to `root` reports (`eventsUnder`), from each change and * the virtual path it is at. Mirrors Python `changes_under`. */ export declare function changesUnder(root: PathSpec, changes: Iterable<readonly [FileChangeKind, string]>, observed: Date): FileEvent[]; /** * The events a subscription to `root` reports: each at or below it as itself, and * each at a directory above it as the root's own, since that directory removed * removes the root, and any other change to it may have moved the root * (UNKNOWN). A move out of the root is a delete where it was. Mirrors Python * `events_under`. */ export declare function eventsUnder(root: PathSpec, events: Iterable<FileEvent>): FileEvent[]; /** * Record how one item of a feed that names items by id moved from where the * last read placed it to `now`, and return where it was. * * An item seen before leaves its old path when it moved and is updated in * place otherwise; one not seen before is created when it is as the service * made it and updated otherwise, since where it was is not known. * Mirrors Python `settle`. */ export declare function settle(changes: [FileChangeKind, string][], seen: Record<string, string>, itemId: string, now: string | null, made: boolean): string | null; /** * Carry each kept path below a folder that moved to the folder's new path, or * forget it when the folder left. * * The moves of one read apply at once, each path by the deepest folder it was * below, so a folder that takes another's old name does not pull in what the * other held. Paths the read placed itself are where their items are now and * stay as they are. Mirrors Python `moved_below`. */ export declare function movedBelow(seen: Record<string, string>, moves: ReadonlyMap<string, string | null>, placed: ReadonlySet<string>): void; /** * Whether an item is as it was made: its creation and last modification * times, both the service's own clock, agree. Mirrors Python `just_made`. */ export declare function justMade(created: string | null | undefined, modified: string | null | undefined): boolean; /** * The path of a folder below the folder `top` by each folder's name and * parent, '' for `top` itself, null when its parents never reach `top`. Each * folder looked up is added to `folders`; a parent of '' is outside. Mirrors * Python `folder_path`. */ export declare function folderPath(folderId: string, top: string, folders: Record<string, [string, string]>, lookUp: (folderId: string) => Promise<[string, string] | null>): Promise<string | null>; //# sourceMappingURL=delta.d.ts.map