@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
74 lines • 3.81 kB
TypeScript
import type { Runtime } from './base.ts';
import type { RuntimeOptions } from './config.ts';
import { type LineExecutorMixin } from './mixin.ts';
/**
* The default world when no runtimes list is given: one python engine,
* one js engine, and the builtin command engine, the same three as
* Python's (pinned by integ/runtime/routing/defaults.json). Names, not
* classes: `name` is an instance field, so `MontyRuntime.name` is the JS
* function name, not the registry key.
*/
export declare const DEFAULT_ENTRIES: readonly string[];
/**
* Register a runtime class under a config name. Host-side only, like
* `registerVfs` 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 entry point 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<never>) => 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<string, unknown>): 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<string, unknown>): 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<string, Runtime>;
/**
* Resolve the ordered world into a command -> runtime binding map.
*
* A command binds to the FIRST entry that captures it; a default workspace
* runtime captures nothing, so only a workspace entry 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<string, Runtime>;
/**
* The runtime that runs this entire line, if any.
*
* Only an explicit WHOLE_LINE capture claims a whole line. Named captures
* and EXTERNAL_COMMANDS execute individual commands. The workspace runtime never matches here
* because it carries no capability: the workspace executor IS the
* path a workspace-resolved line takes anyway, so there is no delegate.
*/
export declare function wholeLineRuntime(bindings: Readonly<Record<string, Runtime | null | undefined>>): (Runtime & LineExecutorMixin) | null;
/**
* The runtime that serves commands no entry captures, if any.
*
* That is the world's WorkspaceRuntime, unless it declares captures (then it
* is an ordinary capturer and nothing is catch-all) or it is not among
* the given entries.
*/
export declare function catchAll(entries: readonly Runtime[]): Runtime | null;
//# sourceMappingURL=table.d.ts.map