UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

44 lines • 2.15 kB
import { IOResult, type ByteSource } from '../../../io/types.ts'; import { LineFacts, PathSpec, type JsonValue } from '../../../types.ts'; import type { CommandFnResult, Context } from '../../config.ts'; import { FlagView } from '../../spec/flag_view.ts'; import { type FlagValue } from '../../spec/types.ts'; export interface SortFlags { /** The engine's configuration, as mirage-rs read it. */ config: Record<string, JsonValue>; check: boolean; checkQuiet: boolean; merge: boolean; output: PathSpec | null; zeroTerminated: boolean; } export declare const CANNOT_READ = "cannot read"; export declare const OPEN_FAILED = "open failed"; export declare const STAT_FAILED = "stat failed"; export declare const READ_FAILED = "read failed"; export declare enum InputStage { ACCESS = 0, STAT = 1, READ = 2 } export declare function inputStage(strerror: string, sorting: boolean): InputStage; export declare function stepFailure(verb: string, label: string, strerror: string): Uint8Array; /** * The configuration a sort scan read, which every sort engine takes; throws * when the scan read none. Mirrors engine_config in sort.py. */ export declare function engineConfig(values: Record<string, JsonValue>): Record<string, JsonValue>; /** * Read sort's options and operands in mirage-rs, before any input: what the * options decide, or what GNU sort refuses first, exit 1 for a refused * `--check` word and 2 for the rest. Throws when the scan read no * configuration or check mode. Mirrors parse_flags in sort.py. */ export declare function parseFlags(bag: Record<string, FlagValue>, paths: readonly PathSpec[]): SortFlags | IOResult; export declare const SORT_RUN_BYTES: number; export declare function sortGeneric(paths: PathSpec[], ctx: Context, stream: (path: PathSpec) => AsyncIterable<Uint8Array>, write?: (path: PathSpec, data: ByteSource) => Promise<void>): Promise<CommandFnResult>; /** * A sort line writes only the file `-o` names. Mirrors Python's `facts`. */ export declare function facts(fl: FlagView, _operands: readonly (string | PathSpec)[]): LineFacts; //# sourceMappingURL=sort.d.ts.map