@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
50 lines • 3.14 kB
TypeScript
import type { ExecuteFn } from './types.ts';
import type { ProcessSubLine } from '../frame.ts';
import { type EvaluationContext } from '../evaluation.ts';
import type { SessionView } from '../../view/types.ts';
import { CallStack } from '../../shell/call_stack.ts';
import type { IOResult } from '../../io/types.ts';
import { type Chunk } from './types.ts';
import type { TSNodeLike } from '../../shell/types.ts';
export declare function foldedWhitespace(node: TSNodeLike): string;
/**
* Run a substitution's line in a child shell.
*
* The evaluator isolates the child shell, except for Bash's `$(< file)`
* optimization, whose filename expands in the parent. It decides from
* a fresh parse of the body, including each pair in a backtick region.
* The line reaches the executor unwrapped, under the node that named it,
* so the pass places its commands where they were typed rather than
* under a subshell of their own. The child runs on a copy of the caller's
* frames: inside a function it reads the function's `$1`, `return` ends it,
* and so does a `break` from a loop the caller is in. `span` is the pair's
* span within the node, for a backtick region holding several.
*/
export declare function childLine(context: EvaluationContext, executeFn: ExecuteFn, text: string, node: TSNodeLike, callStack: CallStack | null, span?: [number, number], options?: NonNullable<Parameters<ProcessSubLine>[1]>): Promise<IOResult>;
/**
* Reconstruct arithmetic expression text for the shared evaluator. A bad
* substitution names the expression as written.
*/
export declare function expandArith(tsNode: TSNodeLike, context: EvaluationContext, executeFn: ExecuteFn, callStack: CallStack | null, view?: SessionView): Promise<string>;
export declare function expandNode(tsNode: TSNodeLike, context: EvaluationContext, executeFn: ExecuteFn, callStack?: CallStack | null, view?: SessionView): Promise<string>;
/**
* Expand a node, marking the glob characters quoting made literal.
*
* Same string as `expandNode`, except that a glob character quoting
* neutralized travels under its own mark. The node is read where no
* field splitting happens, so a splat reads as its elements joined
* (`$@` on a space, `$*` on IFS's first character).
*/
export declare function expandNodeMarked(tsNode: TSNodeLike, context: EvaluationContext, executeFn: ExecuteFn, callStack?: CallStack | null, view?: SessionView): Promise<string>;
/**
* Expand a node to the pieces field splitting reads.
*
* What an unquoted expansion produces splits on IFS, and what quoting
* protects does not; a splat's elements are separate fields.
* `splitFields` turns the pieces into words and `joinChunks` into the
* one string a context without splitting reads. `quoted` says whether
* the node sits inside double quotes. A bad substitution leaving it is
* renamed after the node, unless a boundary inside named it for good.
*/
export declare function expandChunks(tsNode: TSNodeLike, context: EvaluationContext, executeFn: ExecuteFn, callStack?: CallStack | null, view?: SessionView, quoted?: boolean): Promise<Chunk[]>;
//# sourceMappingURL=node.d.ts.map