@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
34 lines • 1.91 kB
TypeScript
import type { GDriveAccessor } from '../../accessor/gdrive.ts';
import { Delta, type PathSpec } from '../../types.ts';
import type { DeltaHook } from '../../events/base.ts';
/**
* Checkpointed delta over Drive's change feed.
*
* Drive pings a channel with no body, so a ping reads `changes.list` from the
* page token the last read handed out. A change names an item by id, with its
* name and parents, so the hook places it by its parents up to the mount
* root, keeping each folder it has looked up (name and parent, by id) in the
* checkpoint, where the folders' own changes keep them current. An item whose
* parents never reach the root is outside the mount. The checkpoint also keeps
* the path of each item a read placed: one that moves leaves that path, with
* everything below a folder, and one deleted, trashed or no longer shared
* leaves it. An item seen for the first time is created when it is as Drive
* made it (its created and modified times agree) and updated otherwise; one
* removed before any read
* placed it names nothing, and is left to the index's expiry. On an unscoped
* mount, whose root lists the shared drives, a shared drive made, renamed or
* left reports the root as unknown. Each read first applies the feed's folder
* renames and moves, so an item listed before its folder is still placed where
* the folder is now, and a shared drive is named afresh each read, as the root
* listing may rename it. An item the feed lists more than once is taken at its
* last change.
*
* Mirrors Python `GDriveDeltaHook` (`core/gdrive/events.py`).
*/
export declare class GDriveDeltaHook implements DeltaHook {
private readonly accessor;
constructor(accessor: GDriveAccessor);
pull(root: PathSpec, checkpoint: string | null): Promise<Delta>;
}
export declare function buildDeltaHook(accessor: GDriveAccessor): DeltaHook;
//# sourceMappingURL=events.d.ts.map