@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
59 lines • 2.37 kB
TypeScript
import { type FsCondition } from '../../../errors/index.ts';
export declare class MontyUnavailableError extends Error {
constructor(message: string, options?: {
cause?: unknown;
});
}
export interface MontyDisplayableError extends Error {
display?: (format?: string) => string;
}
/**
* The error as guest CPython raises it for one condition: the builtin
* exception a guest should be able to `except`, with CPython-on-Linux
* numbering (a guest interpreter is platform-neutral, so the numbering
* must not wobble with the host).
*/
export interface CPythonError {
exception: string;
errno: number;
phrase: string;
}
/**
* The guest-python rendering for a condition: CPython on Linux, whose
* number and phrase are the shared POSIX table's (that table is Linux's
* numbering already).
*/
export declare function cpythonError(condition: FsCondition): CPythonError;
/** The traceback monty renders for one of its own errors. */
export declare function displayError(err: unknown): string;
/**
* Build the guest-side exception for one condition, in CPython's
* message shape.
*
* Args:
* code: the condition, e.g. ENOENT.
* path: the path the operation names.
* target: rename's destination, when there is one.
*/
export declare function guestError(code: FsCondition, path: string, target?: string): Error;
/**
* Re-throw a mount failure under its python exception name: the monty
* engine raises `err.name` as the matching guest exception type
* (PYTHON_EXC_NAMES), so agent code can `except FileNotFoundError`
* exactly as it does on the python host. Every named condition
* converts (a non-empty rmdir is an OSError with errno 39, not a raw
* JS error), and a failure the vocabulary does not name is EIO, as a
* kernel reports a device that failed (the engine knows only builtin
* types, so a backend's own error would reach the guest as
* RuntimeError). A stopped run's refusal is no failed device: it leaves
* as itself, so a callback making call after call (a scan) ends with
* its run.
*
* Args:
* err: whatever the mount op rejected with.
* path: the path the operation names.
* target: a rename's destination, which CPython prints after the
* source.
*/
export declare function asGuestError(err: unknown, path: string, target?: string): unknown;
//# sourceMappingURL=errors.d.ts.map