import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@gajae-code/agent-core"; import type { Component } from "@gajae-code/tui"; import * as z from "zod/v4"; import { type BashArtifactSaveResult } from "../exec/bash-executor"; import type { RenderResultOptions } from "../extensibility/custom-tools/types"; import { type Theme } from "../modes/theme/theme"; import type { ToolSession } from "."; import { type OutputMeta } from "./output-meta"; export declare const BASH_DEFAULT_PREVIEW_LINES = 10; export type BashOriginalArtifactSaveResult = BashArtifactSaveResult; export declare function saveBashOriginalArtifactForTests(session: ToolSession, originalText: string, onResult?: (result: BashOriginalArtifactSaveResult) => void): Promise; declare const bashSchemaBase: z.ZodObject<{ command: z.ZodString; env: z.ZodOptional>; timeout: z.ZodOptional>; cwd: z.ZodOptional; pty: z.ZodOptional; }, z.core.$strip>; declare const bashSchemaWithAsync: z.ZodObject<{ command: z.ZodString; env: z.ZodOptional>; timeout: z.ZodOptional>; cwd: z.ZodOptional; pty: z.ZodOptional; async: z.ZodOptional; }, z.core.$strip>; type BashToolSchema = typeof bashSchemaBase | typeof bashSchemaWithAsync; export interface BashToolInput { command: string; env?: Record; timeout?: number; cwd?: string; async?: boolean; pty?: boolean; } export interface BashToolDetails { meta?: OutputMeta; timeoutSeconds?: number; requestedTimeoutSeconds?: number; terminalId?: string; async?: { state: "running" | "completed" | "failed"; jobId: string; type: "bash"; }; } /** Project only a bare executable name; commands and their output are never notification-safe. */ export declare function summarizeBashToolActivity(kind: "args" | "result", value: unknown): string | undefined; export interface BashToolOptions { } export declare class BashTool implements AgentTool { #private; private readonly session; readonly name = "bash"; readonly label = "Bash"; readonly loadMode = "essential"; readonly description: string; readonly parameters: BashToolSchema; readonly concurrency = "exclusive"; readonly strict = true; readonly safeSummary: typeof summarizeBashToolActivity; constructor(session: ToolSession); /** * Start a background bash job for the Monitor tool. Reuses the full Bash * pipeline (interceptors, internal-URL expansion, env, cwd, timeout); the * public `monitor` tool itself is ACP-gated by `AgentSession` before this * helper is called. The caller-supplied `onRawLine` callback is invoked once * per newline-terminated stdout chunk, between turns, so the upstream Claude * Code "Each stdout line is a task-notification event" semantics are preserved * through the agent's existing background-task delivery path. */ startMonitorJob(input: { command: string; cwd?: string; timeout?: number; env?: Record; }, opts?: { ownerId?: string; label?: string; ctx?: AgentToolContext; toolCallId?: string; onRawLine?: (line: string, jobId: string) => void; shouldAcceptRawLine?: (jobId: string) => boolean; lifecycle?: import("../async").AsyncJobLifecycleCleanup; }): Promise<{ jobId: string; label: string; commandCwd: string; }>; execute(toolCallId: string, { command: rawCommand, env: rawEnv, timeout: rawTimeout, cwd, async: asyncRequested, pty, }: BashToolInput, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback, ctx?: AgentToolContext): Promise>; } export interface BashRenderArgs { command?: string; env?: Record; timeout?: number; cwd?: string; __partialJson?: string; [key: string]: unknown; } export interface BashRenderContext { /** Raw output text */ output?: string; /** Whether output came from artifact storage */ isFullOutput?: boolean; /** Whether output is expanded */ expanded?: boolean; /** Number of preview lines when collapsed */ previewLines?: number; /** Timeout in seconds */ timeout?: number; } export interface ShellRendererConfig { resolveTitle: (args: TArgs | undefined, options: RenderResultOptions) => string; resolveCommand?: (args: TArgs | undefined) => string | undefined; resolveCwd?: (args: TArgs | undefined) => string | undefined; resolveEnv?: (args: TArgs | undefined) => Record | undefined; compactCommand?: boolean; } export declare function getBashEnvForDisplay(args: BashRenderArgs): Record | undefined; export declare function formatBashCommand(args: BashRenderArgs): string; /** * Returns the bash command formatted for the result body: the dim `$ cd … &&` * prefix joined with syntax-highlighted command lines. The prefix is applied * only to the first line so multi-line commands display cleanly — terminals * reset SGR state at line boundaries, which made the previous single-string * `theme.fg("dim", ...)` form render only the first line as dim. */ export declare function formatBashCommandLines(args: BashRenderArgs, uiTheme: Theme): string[]; export declare function createShellRenderer(config: ShellRendererConfig): { renderCall(args: TArgs, options: RenderResultOptions, uiTheme: Theme): Component; renderResult(result: { content: Array<{ type: string; text?: string; }>; details?: BashToolDetails; isError?: boolean; }, options: RenderResultOptions & { renderContext?: BashRenderContext; }, uiTheme: Theme, args?: TArgs): Component; mergeCallAndResult: boolean; inline: boolean; }; export declare const bashToolRenderer: { renderCall(args: BashRenderArgs, options: RenderResultOptions, uiTheme: Theme): Component; renderResult(result: { content: { type: string; text?: string; }[]; details?: BashToolDetails; isError?: boolean; }, options: RenderResultOptions & { renderContext?: BashRenderContext; }, uiTheme: Theme, args?: BashRenderArgs | undefined): Component; mergeCallAndResult: boolean; inline: boolean; }; export {};