import { type BashOpResult, type PendingBashResult } from "./constants.js"; interface TrackedBashResult { id: string; command: string; status: "ok" | "error" | "aborted"; exitCode?: number; stdout: string; stderr: string; duration: number; timingTier: string; } /** * Process tracker for batch bash operations. * Both the `batch` tool (launch side) and `batch_bash_poll` tool (read side) * share the same instance. */ export declare class BashProcessTracker { private running; private completed; /** Launch a bash command. Returns immediately; the process runs in the background. */ launch(id: string, command: string, cwd: string, signal?: AbortSignal): void; /** Check if a command is still running. */ isRunning(id: string): boolean; /** Get the last N lines of a running process's stdout. */ getRunningTail(id: string): string; /** Get the command of a running process. */ getRunningCommand(id: string): string | undefined; /** Get the result of a completed/aborted command. Does NOT remove from cache. */ peekCompleted(id: string): TrackedBashResult | undefined; /** Get the result of a completed/aborted command. Removes from completed cache. */ popCompleted(id: string): TrackedBashResult | undefined; /** Get the start time of a running process. */ getStartedAt(id: string): number | undefined; /** Check if a command has completed. */ hasCompleted(id: string): boolean; /** Abort a running process by id. */ private abortById; /** Abort all running processes (cleanup). */ abortAll(): void; } /** Generate a short random ID for bash ops that don't provide one. */ /** * Run a single bash command with output truncation and optional timeout. * Returns a promise that resolves with stdout, stderr, and exitCode. * Uses execFile (synchronous completion) with truncateBashOutput applied. */ export declare function runBashWithLimits(command: string, cwd: string, timeoutMs?: number, signal?: AbortSignal): Promise<{ stdout: string; stderr: string; exitCode: number; }>; /** * Truncate bash stdout/stderr to prevent oversized tool results. * Applies line limit first, then byte limit, with clear markers. */ export declare function truncateBashOutput(text: string, maxBytes?: number, maxLines?: number): string; export { normalizeBashOp, generateBashId } from "./normalize.js"; /** * Execute a batch of bash ops concurrently. * * Launches all commands in parallel, then waits until all finish or the * soft timeout expires. The soft timeout is the max of per-op `t` values * (if any), or the global default. Commands that haven't finished within * the timeout are returned as "pending" with the last N lines of output. * They continue running in the background and can be polled via batch_bash_poll. */ export declare function executeBatchBash(ops: Array<{ i: string; c: string; t?: number; h?: string; }>, defaultCwd: string, tracker: BashProcessTracker, signal?: AbortSignal, softTimeoutMs?: number): Promise; /** Poll for completed bash results. */ export declare function pollBatchBashResults(ids: string[], tracker: BashProcessTracker): PendingBashResult[]; export declare function createBatchBashPollTool(tracker: BashProcessTracker): { name: string; label: string; description: string; promptSnippet: string; promptGuidelines: string[]; parameters: any; prepareArguments(input: unknown): unknown; execute(_toolCallId: string, input: unknown, _signal?: AbortSignal, _onUpdate?: unknown): Promise<{ content: { type: string; text: string; }[]; details: { results: PendingBashResult[]; }; }>; }; //# sourceMappingURL=batch-bash.d.ts.map