@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
38 lines • 2.88 kB
TypeScript
import type { TransferLinks } from '../cp.ts';
import type { LinkView } from '../../../../view/types.ts';
import { IOResult, type ByteSource } from '../../../../io/types.ts';
import type { PathSpec } from '../../../../types.ts';
import { type FileStat } from '../../../../types.ts';
import type { Context } from '../../../config.ts';
import type { DispatchFn, OperandRun, RunSingle } from './types.ts';
import type { FlagValue } from '../../../spec/types.ts';
/**
* What sets one run's grep or rg output off from the next's. Both print a
* separator between one file's context and the next file's (rg's own, or
* none under --no-context-separator), and rg a blank line between --heading
* groups, so the runs a line splits into join the way one run would. Nothing
* for any other output, a plain line stream.
*/
export declare function runSeparator(cmdName: string, flagKwargs: Record<string, FlagValue>): string;
export declare function runOperands(runSingle: RunSingle, cmdName: string, scopes: PathSpec[], texts: string[], flagKwargs: Record<string, FlagValue>): Promise<OperandRun[]>;
export declare function mergeOperandIos(results: OperandRun[], exitCode: number): Promise<IOResult>;
export declare function flatScopes(scopes: PathSpec[]): PathSpec[];
export declare function crossOpts(flagKwargs: Record<string, FlagValue>): Context;
export declare function statOp(dispatch: DispatchFn): (p: PathSpec) => Promise<FileStat>;
export declare function readdirOp(dispatch: DispatchFn): (p: PathSpec, nofollow?: boolean, limit?: number) => Promise<string[]>;
/** A directory-aware streamed reader. Mirrors Python's `file_stream_op`. */
export declare function fileStreamOp(dispatch: DispatchFn): (p: PathSpec) => AsyncIterable<Uint8Array>;
export declare function streamOp(dispatch: DispatchFn): (p: PathSpec) => AsyncIterable<Uint8Array>;
/** Write one whole file on the mount that owns it. Mirrors Python's `_relay_write`. */
export declare function relayWrite(dispatch: DispatchFn, path: PathSpec, data: ByteSource): Promise<void>;
/**
* Copy one file store to store, from its mount onto `dst`'s. The dispatcher
* judges the source as a read and the destination as a create, and answers
* EXDEV when the destination's store cannot copy from the source's. Mirrors
* Python's `_relay_copy`.
*/
export declare function relayCopy(dispatch: DispatchFn, src: PathSpec, dst: PathSpec): Promise<void>;
export declare function transferLinksOf(links: LinkView, dispatch: DispatchFn, cwd: string, owns?: (virtual: string) => boolean): TransferLinks;
/** Stream independent native reads in order, keeping at most four invocations open. */
export declare function streamOperands(runSingle: RunSingle, cmdName: string, scopes: readonly PathSpec[], texts: string[], bag: Record<string, FlagValue>, separator?: string): [ByteSource, IOResult];
//# sourceMappingURL=utils.d.ts.map