UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

45 lines • 2.94 kB
import { type RedirectResult } from '../../context/session_context.ts'; import { type ByteSource } from '../../io/types.ts'; import type { Decisions } from '../../policy/decisions.ts'; import type { HandOff } from '../../policy/types.ts'; import type { DispatchFn } from '../../runtime/types.ts'; import type { 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 { TSNodeLike } from '../../shell/types.ts'; import type { EvaluationContext } from '../evaluation.ts'; import type { ExecuteNodeFn } from '../executor/command/types.ts'; import type { ExecuteFn } from '../expand/types.ts'; /** * Execute program node (root / semicolon-separated). * * `dispatch` is the dispatcher, threaded so an active `exec` redirect can * send each statement's output to its file; undefined (a nested loop that * is not the program root) leaves output undiverted. `handed` and * `decisions` are the line's hand-off and its ledger, for a background job * to borrow. `sink` takes each statement's output as it finishes, in the * order it was written, instead of the result. The outermost program of a * session's line routes what a statement wrote to the session's terminal * through a copy (`exec 3>&1`); a nested one (`eval`, `source`) leaves that * to it. An `inline` program runs on its caller's frames (`eval`, `source`, * an alias, `$( )`), so an `exit`, `return`, `break` or `continue` goes on * into the caller, after what the program wrote; any other program is a * shell of its own and ends there, running its EXIT action through * `executeFn`. Either resumes at its next line after an error that * discards one, unless it runs in a child shell. `set -n` stops the loop at * the next statement, so a later `set +n` never runs. `set -v` echoes each * input line once, as the first statement on it runs, from the line after * the last one echoed, comments and blank lines included, so `set -v; echo * a` echoes nothing. An ERROR node, the rest of a line the parser refused, * is skipped. */ export declare function executeProgram(recurse: ExecuteNodeFn, node: TSNodeLike, context: EvaluationContext, stdin: ByteSource | null, callStack: CallStack | null, jobTable: JobTable, dispatch?: DispatchFn, handed?: HandOff | null, decisions?: Decisions | null, sink?: JobConsole | null, inline?: boolean, executeFn?: ExecuteFn | null): Promise<RedirectResult>; /** * The row of the first line a parsed input's refusal belongs to, when lines * bash reads and runs come before it: bash reads its input a line at a * time, so those run first and the rest is read again from that row * (`readOn`). Null when the input is refused from its first line, or not * at all. Mirrors Python's refused_row. */ export declare function refusedRow(node: TSNodeLike): number | null; //# sourceMappingURL=program.d.ts.map