@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
31 lines • 1.5 kB
TypeScript
import type { RouteRule } from '../../runtime/routing/types.ts';
import type { Policy } from '../base.ts';
import type { ScriptPolicy } from '../script.ts';
import type { Action, RouteContext } from '../types.ts';
/**
* The workspace's `routePolicy`, answering at `preExecute`. The workspace
* compiles the configured callable or program into this built-in
* (`Policies.place`), so a route is one more `preExecute` answer. A
* callable answers a runtime name (a Route) or null (silence). A program,
* `{script, runtime}`, runs as a profile's policy programs run and prints
* what a `preExecute` program may answer. A mistake in either (any other
* answer, a program that fails) throws `RouteError` to the caller rather
* than failing closed, since a misconfigured route policy is the
* deployment's to fix and not a refusal to show an agent.
* Mirrors the Python `RoutePolicy`.
*
* @throws Error - the route is a string (a path is the workspace yaml's),
* or the program is not `{script, runtime}`, or its script is still a path.
*/
export declare class RoutePolicy implements Policy {
private readonly programs;
private readonly call;
private readonly program;
/**
* @param route the configured callable or program.
* @param programs the workspace's program runner, which a program runs on.
*/
constructor(route: RouteRule, programs: ScriptPolicy);
preExecute(ctx: RouteContext): Promise<Action | null>;
}
//# sourceMappingURL=route.d.ts.map