UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

65 lines • 3.2 kB
import type { CommandSpec } from '../../../commands/spec/types.ts'; import { type ByteSource, IOResult } from '../../../io/types.ts'; import type { EntryGate } from '../../../policy/types.ts'; import type { FindExpr } from '../../../rs/find.ts'; import type { DispatchFn, ShellFn } from '../../../runtime/types.ts'; import { PathSpec } from '../../../types.ts'; import type { FollowOperands } from '../../../view/types.ts'; import type { EvaluationContext } from '../../evaluation.ts'; import type { ExecuteFn } from '../../expand/types.ts'; import type { MountEntry } from '../../mount/mount.ts'; import type { Namespace } from '../../mount/namespace/namespace.ts'; import { type MountRegistry } from '../../mount/registry.ts'; import type { SessionState } from '../../session/session.ts'; import { ExecutionNode } from '../../types.ts'; import type { Flags } from './types.ts'; export interface RunOnMountCtx { admission: EntryGate | null; registry: MountRegistry; context: EvaluationContext; dispatch: DispatchFn; namespace?: Namespace; signal?: AbortSignal; executeFn?: ExecuteFn; follow?: FollowOperands; } /** * The entry point a command handler runs a nested line through (`opts.shell`): * the line runs in the calling command's own session, under its signal, * reading the input it is handed. */ export declare function nestedShell(executeFn: ExecuteFn, session: SessionState, signal: AbortSignal | undefined): ShellFn; /** * find's start points: the path operands typed before its expression. * The expression's start is mirage-rs's, so a word inside it (an `-exec` * command word, a `-newer` reference) is never a start point even when * the rest slot's PATH kind would have read it as one. Only the head is * parsed against the spec, so what it yields as path operands is exactly * the start points. */ export declare function findStartPoints(argv: readonly (string | PathSpec)[], start: number, spec: CommandSpec | null, cwd: string): PathSpec[]; /** * Build the recorded execution node, materializing any streamed stderr. * * The node is a recorded artifact, so the live lazy stderr is materialized * to concrete bytes here, and the bytes stay on `io` so the caller still * reads them. A result whose fields fill in as its output drains (a * runtime's run) brings the node up to date once they have. Mirrors * Python's `exec_node`. * * @param command original command text for the record. * @param io the command's result, whose stderr and status the node carries. * @param paths the classified path operands. */ export declare function execNode(command: string, io: IOResult, paths?: PathSpec[]): Promise<ExecutionNode>; /** The 126 result for a command no runtime accepted. */ export declare function admissionDenial(cmdName: string): IOResult; export declare function runOnMount(ctx: RunOnMountCtx, cmdName: string, paths: PathSpec[], texts: string[], flagKwargs: Flags, opts?: { signal?: AbortSignal; stdin?: ByteSource | null; resolveHint?: PathSpec | null; mount?: MountEntry | null; argv?: readonly string[]; find?: FindExpr; }): Promise<[ByteSource | null, IOResult]>; //# sourceMappingURL=run.d.ts.map