import { Runtime } from './base.ts'; import { type LineExecutor } from './mixin.ts'; import { QuickJsRuntime } from './js/quickjs.ts'; import { MontyRuntime } from './python/monty/index.ts'; import { PyodideRuntime } from './python/pyodide.ts'; import type { RuntimeOptions } from './types.ts'; /** * The workspace's built-in command engine as a routing marker. * * By default it captures nothing and serves every command no other * runtime captures (cat, ls, echo, and anything unknown): it is the * catch-all. Passing explicit captures flips it into an ordinary * capturer: the workspace serves exactly those commands and anything * unclaimed exits 126. Required: every workspace world contains * exactly one, appended automatically when the runtimes list omits it; * pass your own instance to customize it. * * It is a pure routing marker, so it carries no capability mixin: a * line resolved to vfs runs on the workspace executor inline, the path * the line takes anyway, so there is no interpreter door (run) and no * delegate door (runLine) to implement. * * Constructed like every runtime (captures, config, script), with two * vfs readings: captures undefined (the default) keeps the catch-all * behavior, an empty array serves nothing (full lockdown); and the * config has no fields today, the slot exists for uniformity. */ export declare class VFSRuntime extends Runtime { readonly name = "vfs"; readonly reach = "vfs"; readonly restricted: boolean; constructor(options?: RuntimeOptions); } export declare const RUNTIMES: readonly [typeof PyodideRuntime, typeof MontyRuntime, typeof QuickJsRuntime]; /** * The python engine a default world registers, named rather than left * to a slot in DEFAULT_ENTRIES because it is the one entry the two * implementations disagree on: TypeScript registers pyodide, Python * registers monty (`DEFAULT_PYTHON` in `mirage/runtime/table.py`), * because `@pydantic/monty` cannot answer builtin `open()` calls yet * while `pydantic-monty` can. Both are sandboxed; neither reaches the * host. Pinned by integ/runtime/defaults.json, which reads the split * back out of a default world on each host. * * A name, not a class: `name` is an instance field, so `PyodideRuntime.name` * is the JS function name, not the registry key. */ export declare const DEFAULT_PYTHON = "pyodide"; /** * The default world when no runtimes list is given: one python engine, * one js engine, and the builtin command engine. `local`/`wasi` are * Python-only. */ export declare const DEFAULT_ENTRIES: readonly string[]; /** * Register a runtime class under a config name. Host-side only, like * `registerResourceFactory` and `registerCliSpec`: the embedding program * calls it, never a line the agent types. Once registered the name works * everywhere a builtin's does: a `runtimes:` entry in workspace config, a * string in `new Workspace(..., { runtimes })`, and `execute({ runtime })`. * Runtime packages use the same door for their own runtimes (`daytona` * from `@struktoai/mirage-node`). Mirrors `register_runtime` in * `mirage/runtime/table.py`: a core builtin cannot be shadowed, and * re-registering any other name replaces it. */ export declare function registerRuntime(name: string, cls: new (options?: RuntimeOptions) => Runtime): void; /** Every name `buildRuntime` can resolve, builtin and registered. */ export declare function knownRuntimes(): string[]; /** * Refuse an entry key no runtime takes, naming the entry. Every runtime * is constructed the same way, so this is one check for a builtin, a * registered name and a `source:Class` reference alike: `buildRuntime` * runs it for the names it resolves, and the config loader runs it for * a reference, whose class it constructs itself. */ export declare function checkRuntimeOptions(name: string, options: Record): void; /** * Construct a runtime by name, failing loud on unknown names (with a * cross-language hint for Python-only names) and on unknown options. */ export declare function buildRuntime(name: string, options?: Record): Runtime; /** * Resolve an explicit runtime name into a binding override map. * * Naming a runtime places a line's captured stages on it without * touching capability: only commands the runtime captures rebind, * everything else keeps its normal binding. */ export declare function runtimeBindingsFor(entries: readonly Runtime[], name: string): Record; /** * Resolve the ordered world into a command -> runtime binding map. * * A command binds to the FIRST entry that captures it; a default vfs * runtime captures nothing, so only a vfs with declared captures * appears in the map. Duplicate names are rejected: a second entry * under the same name could never bind anything and always signals a * config mistake. */ export declare function bindCommands(entries: readonly Runtime[]): Record; /** * The runtime that runs this entire line, if any. * * A runtime carrying LineExecutor takes the raw line when it captures * one of the line's commands; a "*" capture claims any line. A * specific capture beats "*". The vfs runtime never matches here * because it carries no capability: the workspace executor IS the * path a vfs-resolved line takes anyway, so there is no delegate. */ export declare function wholeLineRuntime(bindings: Record, commands: readonly string[]): (Runtime & LineExecutor) | null; /** * The runtime that serves commands no entry captures, if any. * * That is the world's VFSRuntime, unless it declares captures (then it * is an ordinary capturer and nothing is catch-all) or it is not among * the given entries (refused the line / omitted). */ export declare function catchAll(entries: readonly Runtime[]): Runtime | null; //# sourceMappingURL=table.d.ts.map