import type { RuntimeContext } from "../runtime/state/context.js"; import type { StateStack } from "../runtime/state/stateStack.js"; import type { ThreadStore } from "../runtime/state/threadStore.js"; import { SpawnResult } from "./abortable.js"; export type ExecOptions = { /** * Allow-list of executable names. When set, only commands whose * `command` matches one of these strings (case-insensitive, * whitespace-trimmed) will run. Empty / unset = no restriction. * Pair with `allowedPaths` to also pin the working directory. */ allowedExecutables?: string[]; /** * Block-list of executable names. When set, any command whose * `command` matches one of these strings is rejected. */ blockedCommands?: string[]; /** * Directory-allow-list for `cwd`. When set, `cwd` must resolve * inside one of these roots (symlink-aware). Empty / unset = no * restriction. */ allowedPaths?: string[]; }; /** Deprecated context-injected wrapper kept during the ALS migration; * see `_exec`. */ export declare function __internal_exec(ctx: RuntimeContext, stack: StateStack, _threads: ThreadStore, command: string, args: string[], cwd: string, timeout: number, stdin: string, options?: ExecOptions): Promise; /** ALS-reading replacement for `__internal_exec`. */ export declare function _exec(command: string, args: string[], cwd: string, timeout: number, stdin: string, options?: ExecOptions): Promise; export type BashOptions = { /** * Reject any bash string whose first non-whitespace token matches * one of these entries (prefix match). Useful to block `rm`, * `sudo`, etc. */ blockedCommands?: string[]; /** * Directory-allow-list for `cwd`. When set, `cwd` must resolve * inside one of these roots (symlink-aware). Empty / unset = no * restriction. */ allowedPaths?: string[]; }; /** Deprecated context-injected wrapper kept during the ALS migration; * see `_bash`. */ export declare function __internal_bash(ctx: RuntimeContext, stack: StateStack, _threads: ThreadStore, command: string, cwd: string, timeout: number, stdin: string, options?: BashOptions): Promise; /** ALS-reading replacement for `__internal_bash`. */ export declare function _bash(command: string, cwd: string, timeout: number, stdin: string, options?: BashOptions): Promise; export type LsEntry = { name: string; path: string; type: "file" | "dir" | "symlink" | "other"; size: number; }; export declare function _ls(dir: string, recursive: boolean, allowedPaths?: string[], maxResults?: number): Promise; export type GrepMatch = { file: string; line: number; text: string; }; export declare function _grep(pattern: string, dir: string, flags: string, maxResults: number, allowedPaths?: string[]): Promise; export declare function _glob(pattern: string, dir: string, maxResults: number, allowedPaths?: string[]): Promise; export type StatInfo = { exists: boolean; type: "file" | "dir" | "symlink" | "other" | "missing"; size: number; modifiedMs: number; }; export declare function _stat(filename: string, dir?: string, allowedPaths?: string[], followSymlinks?: boolean): Promise; export declare function _exists(filename: string, dir?: string, allowedPaths?: string[]): Promise; export declare function _which(command: string): Promise;