UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

28 lines • 1.89 kB
import { IOResult, type ByteSource } from '../../../io/types.ts'; import { LineFacts, type PathSpec, type StatFn } from '../../../types.ts'; import type { CommandFnResult, Context } from '../../config.ts'; import { type FsError } from '../../../errors/types.ts'; import { FlagView } from '../../spec/flag_view.ts'; import { type FlagValue } from '../../spec/types.ts'; /** * How tee answers a write into a pipe whose reader has gone: SIGPIPE without * -p and --output-error, nothing under a -nopipe mode, a write error's report * under warn and exit. Mirrors Python's PipeErrors. */ export declare enum PipeErrors { SIGNAL = "signal", IGNORE = "ignore", REPORT = "report" } export interface TeeFlags { append: boolean; stopOnError: boolean; pipeErrors: PipeErrors; } export declare function parseFlags(bag: Record<string, FlagValue>): TeeFlags; export declare function teeGeneric(paths: PathSpec[], texts: string[], ctx: Context, stream: (p: PathSpec) => AsyncIterable<Uint8Array>, write: (p: PathSpec, data: ByteSource) => Promise<void>, append?: (p: PathSpec, data: ByteSource) => Promise<void>, stat?: StatFn, outputKey?: (path: PathSpec) => string): Promise<CommandFnResult>; export declare function openRefusal(stat: StatFn, path: PathSpec, opened: readonly PathSpec[]): Promise<FsError | null>; export declare function writeOutput(paths: PathSpec[], raw: Uint8Array, parsed: TeeFlags, stream: (p: PathSpec) => AsyncIterable<Uint8Array>, write: (p: PathSpec, data: Uint8Array) => Promise<void>, append?: (p: PathSpec, data: Uint8Array) => Promise<void>, stat?: StatFn, openedPaths?: PathSpec[], root?: string): Promise<[ByteSource | null, IOResult]>; /** A tee line writes the files it names. Mirrors Python's `facts`. */ export declare function facts(fl: FlagView, operands: readonly (string | PathSpec)[]): LineFacts; //# sourceMappingURL=tee.d.ts.map