@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
29 lines • 1.74 kB
TypeScript
import { type IOResult } from '../../io/types.ts';
import { type OpenStream } from '../../rs/stream.ts';
import type { JsonValue } from '../../types.ts';
import { type GrepFlags } from './grep_binary.ts';
/** Bytes as the stream reads them: one character per byte. Mirrors Python's latin1. */
export declare function latin1(data: Uint8Array): string;
/**
* The mirage-rs grep stream's configuration for a command line; a null
* pattern is a -f list of no patterns, which matches nothing. Mirrors
* Python's stream_config.
*/
export declare function streamConfig(f: GrepFlags, pattern: string | null, utf8: boolean): Record<string, JsonValue>;
/**
* Compile the pattern list once for the whole command line: the stream,
* and GNU's warnings about the patterns as stderr. A pattern GNU grep
* refuses is a UsageError in its wording (exit 2). The caller closes the
* stream. Mirrors Python's open_grep.
*/
export declare function openGrep(config: Record<string, JsonValue>): Promise<[OpenStream, Uint8Array]>;
/**
* Run one input through the grep stream, yielding grep's output for it.
* Each chunk the backend serves is cut into probe-sized blocks, every one a
* block of the binary-file probe. A back-reference search that needs more
* than one call's steps leaves the stream busy, and the rest runs a bounded
* step per `drain`, so an abort lands between steps. Mirrors Python's
* stream_input.
*/
export declare function streamInput(source: AsyncIterable<Uint8Array>, stream: OpenStream, path: string, showFilename: boolean, io: IOResult, afterOutput?: boolean, size?: number | null, signal?: AbortSignal, consumeAll?: boolean, listLabel?: string | null): AsyncIterable<Uint8Array>;
//# sourceMappingURL=grep_stream.d.ts.map