import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import type { Component } from "@oh-my-pi/pi-tui"; import * as z from "zod/v4"; 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; 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"; }; } export interface BashToolOptions { } /** * Bash tool implementation. * * Executes bash commands with optional timeout and working directory. */ 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; constructor(session: ToolSession); 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; } 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 {};