import type { AgentTool } from "@catui/agent-core"; import { type Static } from "@sinclair/typebox"; import { type TruncationResult } from "./truncate.js"; interface BackgroundTask { id: string; outputPath: string; status: "running" | "completed" | "failed"; exitCode: number | null; startTime: number; endTime?: number; pid?: number; } /** Get a background task by ID. */ export declare function getBackgroundTask(taskId: string): BackgroundTask | undefined; /** List all background tasks. */ export declare function listBackgroundTasks(): BackgroundTask[]; /** Kill a background task's process tree. Returns true if task was found and killed. */ export declare function killBackgroundTask(taskId: string): boolean; /** Read the output of a background task (if finished). */ export declare function readBackgroundTaskOutput(taskId: string): string | null; declare const bashSchema: import("@sinclair/typebox").TObject<{ command: import("@sinclair/typebox").TOptional; timeout: import("@sinclair/typebox").TOptional; description: import("@sinclair/typebox").TOptional; run_in_background: import("@sinclair/typebox").TOptional; task_id: import("@sinclair/typebox").TOptional; }>; export type BashToolInput = Static; export interface BashToolDetails { truncation?: TruncationResult; fullOutputPath?: string; } /** * Pluggable operations for the bash tool. * Override these to delegate command execution to remote systems (e.g., SSH). */ export interface BashOperations { /** * Execute a command and stream output. * @param command - The command to execute * @param cwd - Working directory * @param options - Execution options * @returns Promise resolving to exit code (null if killed) */ exec: (command: string, cwd: string, options: { onData: (data: Buffer) => void; signal?: AbortSignal; timeout?: number; env?: NodeJS.ProcessEnv; onSpawn?: (pid: number) => void; }) => Promise<{ exitCode: number | null; pid?: number; }>; } export interface BashSpawnContext { command: string; cwd: string; env: NodeJS.ProcessEnv; } export type BashSpawnHook = (context: BashSpawnContext) => BashSpawnContext; export interface BashToolOptions { /** Custom operations for command execution. Default: local shell */ operations?: BashOperations; /** Command prefix prepended to every command (e.g., "shopt -s expand_aliases" for alias support) */ commandPrefix?: string; /** Hook to adjust command, cwd, or env before execution */ spawnHook?: BashSpawnHook; } export declare function createBashTool(cwd: string, options?: BashToolOptions): AgentTool; /** Default bash tool using process.cwd() - for backwards compatibility */ export declare const bashTool: AgentTool; timeout: import("@sinclair/typebox").TOptional; description: import("@sinclair/typebox").TOptional; run_in_background: import("@sinclair/typebox").TOptional; task_id: import("@sinclair/typebox").TOptional; }>, any>; export interface BashSandboxOptions { /** Additional patterns to block (in addition to default blocked patterns) */ additionalBlockedPatterns?: RegExp[]; /** Custom error message for blocked commands */ blockedMessage?: string; /** Optional path allowlist hook for simple write commands. Defaults to denying all writes. */ allowWritePath?: (absolutePath: string) => boolean; } /** * Create a sandboxed bash hook that blocks dangerous write operations. * This is a defense-in-depth measure for read-only SubAgents. */ export declare function createSandboxHook(options?: BashSandboxOptions): BashSpawnHook; export {};