@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
33 lines • 2.59 kB
TypeScript
import type { DiffComputer } from '../../../rs/diff_types.ts';
import type { IdSource } from '../../../utils/ids.ts';
import type { FindExpr } from '../../../rs/find.ts';
import { IOResult } from '../../../io/types.ts';
import type { ByteSource } from '../../../io/types.ts';
import { PathSpec } from '../../../types.ts';
import type { DispatchFn } from '../../../runtime/types.ts';
import { type Caller } from '../../../context/session_context.ts';
import type { FollowOperands } from '../../../view/types.ts';
import { Files } from '../../../workspace/files.ts';
import type { FlagValue } from '../../spec/types.ts';
import type { GenericCommand } from './adapter.ts';
/** A streamed read that opens as the command that asked for it: at the first
* pull, which can come after that command ended, so under the command's
* caller, as a `fresh` mount trusts only the listings that command made. A
* directory fails with EISDIR, as a POSIX read does, before a keyed store
* reads it as nothing. `ahead` is what the read awaits first (`readAhead`).
* Mirrors Python's caller_stream. */
export declare function callerStream(dispatch: DispatchFn, caller: Caller, path: PathSpec, ahead?: (path: PathSpec) => Promise<void>): AsyncIterable<Uint8Array>;
/** Run the existing builder once over the full virtual namespace. Mirrors
* Python's run_dispatch. The builder runs as a run across mounts: no mount's
* command scope is bound around it (`crossesMounts`), so every call it makes
* through its files reaches whichever mount serves the path. The dispatcher
* lists the mounts below a directory itself, so no descendant is left to
* avoid; where each mount begins stays for `--one-file-system`, and each
* mount's du budget for a walk. `follow` is the line's operand resolution,
* which its globs' matches take too. The output is read before this returns,
* inside the running command: a `fresh` mount trusts only the listings that
* command made, so a lazy stream read after it ends would be served the
* previous command's. A builder that `streams` only reads, and each read opens
* as this command (`callerStream`), so its output is handed on live. */
export declare function runDispatch(builder: GenericCommand, paths: readonly PathSpec[], texts: readonly string[], bag: Record<string, FlagValue>, dispatch: DispatchFn, cwd: string, vfs?: Files, stdin?: ByteSource | null, signal?: AbortSignal, argv?: readonly string[], follow?: FollowOperands, diff?: DiffComputer, ids?: IdSource, find?: FindExpr): Promise<[ByteSource | null, IOResult]>;
//# sourceMappingURL=dispatch.d.ts.map