@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
66 lines • 3.34 kB
TypeScript
import type { RedirectResult } from '../../context/session_context.ts';
import { type ByteSource } from '../../io/types.ts';
import type { HandOff } from '../../policy/types.ts';
import type { DispatchFn } from '../../runtime/types.ts';
import { CallStack } from '../../shell/call_stack.ts';
import type { JobConsole } from '../../shell/console/index.ts';
import type { JobTable } from '../../shell/job_table/index.ts';
import type { ParseScope } from '../../shell/parse/scope.ts';
import type { TSNodeLike } from '../../shell/types.ts';
import { type EvaluationContext } from '../evaluation.ts';
import { ExecutionScope } from '../execution.ts';
import type { ExecuteFn } from '../expand/types.ts';
import type { Namespace } from '../mount/namespace/namespace.ts';
import type { MountRegistry } from '../mount/registry.ts';
/**
* The deps for a subtree that runs on `handed`.
*
* The hand-off a subtree's gates read and the one its nested
* evaluations run under are one fact, set together here so the walker
* can never carry one hand-off and evaluate under another. Everything a
* command hands a line to (eval, source, xargs, command, a substitution,
* a herestring, a redirect target) re-enters through `executeFn`, so the
* hand-off is bound into it rather than into the line's closure: a
* background job's subtree runs on a hand-off of the job's own, and a
* line it evaluates after the typed line has ended has to stand under
* that one. Under the line's, the inner gate could not see the grant the
* job holds and asked again, and what it claimed went back to a hand-off
* nothing revokes any more.
*/
export declare function withHandOff(deps: ExecuteNodeDeps, handed: HandOff): ExecuteNodeDeps;
export interface ExecuteNodeDeps {
/** @internal Scheduling scope; background jobs create their own. */
executionScope?: ExecutionScope;
dispatch: DispatchFn;
registry: MountRegistry;
namespace: Namespace;
jobTable: JobTable;
executeFn: ExecuteFn;
workspaceId: string;
registerCloser: (fn: () => Promise<void>) => void;
signal?: AbortSignal;
/**
* The hand-off this subtree runs on, carried to every command's gate
* so it runs on the grants claimed for this line and never another's,
* and bound into `executeFn` by `withHandOff` so every line the
* subtree evaluates stands under it too.
*/
handed?: HandOff;
/**
* The shell parser. Only alias expansion needs it: an alias rewrites the
* head word textually and the result is read as a fresh line, so a value
* holding a pipe is a pipe. Absent (a unit test driving the walker
* directly) means an alias definition is stored and printed but never
* expanded.
*/
parser?: ParseScope;
/**
* Console this node writes its output to as it is produced.
* When set, the node emits and returns no stdout; when unset
* it returns stdout as a value, which is what capture sites
* (command substitution, pipe stages, redirects) rely on.
*/
sink?: JobConsole;
}
export declare function executeNode(deps: ExecuteNodeDeps, node: TSNodeLike, context: EvaluationContext, stdin?: ByteSource | null, callStack?: CallStack | null, ownDiagnostics?: boolean, endsShell?: boolean): Promise<RedirectResult>;
//# sourceMappingURL=execute_node.d.ts.map