UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

27 lines • 1.45 kB
import type { RedirectResult } from '../../../../context/session_context.ts'; import type { SessionState } from '../../../session/session.ts'; import type { BuiltinCall } from '../types.ts'; import { TrapEvent } from './types.ts'; /** * What a signal spec names: EXIT, ERR or RETURN, another signal bash knows * (which mirage cannot deliver), or nothing bash would accept. A name may * carry `SIG` and any case; a number is one too. */ export declare function eventOf(spec: string): TrapEvent | null; /** One `trap -p` row, the action single-quoted the way bash does. */ export declare function listing(action: string, event: TrapEvent): string; /** * Register, reset or list the shell's `EXIT`, `ERR` and `RETURN` actions. * * EXIT runs where the shell ends: at `exit` (in the frame that called it), * at the end of a child shell, or when an error ends the shell. A line of a * persistent session is not the end of its shell, so it runs nothing there. * ERR runs after a command fails where `set -e` would act, RETURN after a * function or a sourced file returns (`executor/traps.ts`). Mirage delivers * no signals, so any other event bash knows is refused rather than accepted * and never run. */ export declare function handleTrap(args: readonly string[], session: SessionState): RedirectResult; /** The `trap` arm. */ export declare function trapBuiltin(call: BuiltinCall): Promise<RedirectResult>; //# sourceMappingURL=trap.d.ts.map