import type { AgentTool } from "../../../agent-core/index.js"; import { type Static, Type } from "typebox"; import type { ToolDefinition } from "../extensions/types.js"; import { type TruncationResult } from "./truncate.js"; import { BashJobRegistry } from "../bash-jobs.js"; declare const bashSchema: Type.TObject<{ command: Type.TString; timeout: Type.TOptional; background: Type.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 (for example SSH). */ export interface BashBackgroundHandle { pid: number | undefined; /** Resolves (or rejects) when the process exits. Rejections mirror `exec`. */ done: Promise<{ exitCode: number | null; }>; /** Synchronously kills the process tree. */ kill: () => void; } 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; /** Skip the 30-minute hard deadline (persistent dev servers). */ persistent?: boolean; }) => Promise<{ exitCode: number | null; }>; /** * Start a command without blocking. Returns a handle immediately so the * caller can register a background job and later poll or kill it. */ execBackground?: (command: string, cwd: string, options: { onData: (data: Buffer) => void; signal?: AbortSignal; timeout?: number; env?: NodeJS.ProcessEnv; /** Skip the 30-minute hard deadline (persistent dev servers). */ persistent?: boolean; }) => BashBackgroundHandle; } /** * Create bash operations using spectral's built-in local shell execution backend. * * This is useful for extensions that intercept user_bash and still want spectral's * standard local shell behavior while wrapping or rewriting commands. */ export declare function createLocalBashOperations(options?: { shellPath?: string; /** Default persistent mode for every operation created by this factory. */ persistent?: boolean; }): BashOperations; 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 (for example shell setup commands) */ commandPrefix?: string; /** Optional explicit shell path from settings */ shellPath?: string; /** Hook to adjust command, cwd, or env before execution */ spawnHook?: BashSpawnHook; /** Session-scoped registry used by background jobs (shared with bash_status/bash_kill). */ jobs?: BashJobRegistry; } export declare function createBashToolDefinition(cwd: string, options?: BashToolOptions): ToolDefinition; export declare function createBashTool(cwd: string, options?: BashToolOptions): AgentTool; declare const bashStatusSchema: Type.TObject<{ jobId: Type.TString; }>; export type BashStatusToolInput = Static; export declare function createBashStatusToolDefinition(jobs: BashJobRegistry): ToolDefinition; declare const bashKillSchema: Type.TObject<{ jobId: Type.TString; }>; export type BashKillToolInput = Static; export declare function createBashKillToolDefinition(jobs: BashJobRegistry): ToolDefinition; export declare function createBashStatusTool(jobs: BashJobRegistry): AgentTool; export declare function createBashKillTool(jobs: BashJobRegistry): AgentTool; export {}; //# sourceMappingURL=bash.d.ts.map