@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
29 lines • 1.62 kB
TypeScript
import { FlagView } from '../../spec/flag_view.ts';
import { type FlagValue } from '../../spec/types.ts';
import { IOResult, type ByteSource } from '../../../io/types.ts';
import { LineFacts, PathSpec } from '../../../types.ts';
import type { CommandFnResult, Context } from '../../config.ts';
export declare const NO_WRITE_OP = "shuf: backend provides no write op";
export declare const MEMORY_EXHAUSTED = "shuf: memory exhausted";
export declare const MAX_OUTPUT_LINES = 1000000n;
export declare function emitCount(available: bigint, count: bigint | null, withReplacement: boolean): bigint;
export interface ShufFlags {
readonly count: bigint | null;
readonly echo: boolean;
readonly zeroTerminated: boolean;
readonly withReplacement: boolean;
readonly inputRange: readonly [bigint, bigint] | null;
readonly output: PathSpec | null;
}
/**
* shuf's options, `-n`, `-i`, `-o` and `-e` read by mirage-rs before any
* operand is resolved, each where it was typed; the refusal as an IOResult
* otherwise. Mirrors Python's `parse_flags`.
*/
export declare function parseFlags(bag: Record<string, FlagValue>): ShufFlags | IOResult;
export declare function shufGeneric(paths: PathSpec[], texts: string[], ctx: Context, stream: (p: PathSpec) => AsyncIterable<Uint8Array>, write: (p: PathSpec, data: ByteSource) => Promise<void>, parsed?: ShufFlags | IOResult): Promise<CommandFnResult>;
/**
* A shuf line writes only the file `-o` names. Mirrors Python's `facts`.
*/
export declare function facts(fl: FlagView, _operands: readonly (string | PathSpec)[]): LineFacts;
//# sourceMappingURL=shuf.d.ts.map