UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

46 lines • 2.09 kB
import { OutputPipe } from '../io/output.ts'; import type { OutputEvent } from '../io/types.ts'; import { JobConsole } from '../shell/console/job_console.ts'; import { Channel } from '../shell/console/types.ts'; import type { ExecutionScope } from './execution.ts'; import { ExecuteResult } from './workspace/types.ts'; declare class ShellOutput extends JobConsole { readonly pipe: OutputPipe; constructor(bufferBytes: number); emit(channel: Channel, data: Uint8Array): Promise<void>; } declare class ShellEvents implements AsyncIterableIterator<OutputEvent> { private readonly owner; private readonly output; private readonly source; private ended; private pulling; constructor(owner: ShellExecution, output: ShellOutput); [Symbol.asyncIterator](): AsyncIterableIterator<OutputEvent>; next(): Promise<IteratorResult<OutputEvent>>; return(): Promise<IteratorResult<OutputEvent>>; release(): Promise<void>; } /** A shell invocation and bounded single-reader events. Drain events before wait(). */ export declare class ShellExecution { readonly events: ShellEvents; private readonly controller; private readonly output; private readonly result; private closing?; private settled; constructor(run: (sink: JobConsole, signal: AbortSignal, scope: ExecutionScope) => Promise<ExecuteResult>, scope: ExecutionScope, signal?: AbortSignal, bufferBytes?: number); private run; /** @internal Release workspace registration when invocation settles. */ onSettled(callback: () => void): void; cancel(): void; /** Join the invocation; final stdout/stderr are empty because events delivered them. */ wait(): Promise<ExecuteResult>; /** Collect output and await an optional observer before the next pull. */ collect(onEvent?: (event: OutputEvent) => Promise<void>): Promise<ExecuteResult>; /** Discard unread output, cancel and join under the shell's normal cancellation policy. */ close(): Promise<void>; private closeOwned; } export {}; //# sourceMappingURL=shell_execution.d.ts.map