@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
35 lines • 1.58 kB
TypeScript
import { LineFacts, type PathSpec } from '../../../types.ts';
import { type Command, CommandCatalog, type Context } from '../../config.ts';
import type { FactsFn } from './adapter.ts';
/**
* Every mount falls back to these after its VFS's own commands. Each reads
* and writes through the session's files (`ctx.vfs`), so one set serves the
* whole workspace. Mirrors Python's `GENERIC_COMMANDS`.
*/
export declare const GENERIC_COMMANDS: CommandCatalog;
/**
* The default command `name`, which a mount runs when its VFS has no command
* of that name. A VFS that replaces a command hands what the replacement does
* not support to this one: `generic('grep').fn(accessor, paths, texts, ctx)`.
* With `vfs`, the same command registered for that backend. Mirrors Python's
* `generic`.
*/
export declare function generic(name: string, options?: {
vfs?: string;
}): Command;
/**
* The generic command `name` registered for `vfs`, each operand streamed by
* `stream` where it answers one (null keeps the dispatched read): `/dev`'s
* endless `cat` and `head`. Mirrors Python's `generic_reading`.
*/
export declare function genericReading(name: string, options: {
vfs: string;
stream?: (ctx: Context, path: PathSpec) => AsyncIterable<Uint8Array> | null;
}): Command;
/**
* What the generic command `name` declares a line of it does; a name with no
* generic command declares nothing (`new LineFacts()`). Mirrors Python's
* `declared_facts`.
*/
export declare function declaredFacts(name: string): LineFacts | FactsFn;
//# sourceMappingURL=factory.d.ts.map