@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
49 lines • 1.97 kB
TypeScript
import { PyodideUnavailableError } from '../errors.ts';
import type { Context } from '../../../../commands/config.ts';
import type { RunResult } from '../../../types.ts';
import type { RuntimeFiles } from '../../../files.ts';
import type { ExecuteRequest, HostStdio } from './types.ts';
/**
* What a crashed worker reported, as an Error a command can print. A
* worker's uncaught exception arrives structured-cloned: an Error stays
* one, but anything else arrives as a plain value whose String() may be
* `[object Object]`.
*/
export declare function workerFailure(value: unknown): Error;
export declare class PyodideWorkerClient {
private readonly port;
private startup;
private readonly ready;
private readonly messages;
private waiter;
private readonly buffers;
private readonly interruptBuffer;
private failure;
private constructor();
/** A started worker, or the refusal that says why none could start. */
static create(): Promise<PyodideWorkerClient | PyodideUnavailableError>;
/**
* Run one request on the worker, answering its file and process calls
* until it reports.
*
* @param request the program and what of the run's context it reads.
* @param ctx the run's context: its processes, and the signal that
* interrupts the guest.
* @param files the run's file adapter, which answers the guest's calls.
* @param stdio the run's standard streams, which answer its stdio calls.
*/
execute(request: ExecuteRequest, ctx: Context, files: RuntimeFiles, stdio: HostStdio): Promise<RunResult>;
private nextMessage;
close(): void;
private fail;
/**
* Answer one call from the worker, through the memory it shares or
* through the page's service worker.
*
* @param message the worker's call.
* @param operation computes the answer.
*/
private answer;
private operation;
}
//# sourceMappingURL=client.d.ts.map