import type { AgentTool } from "@earendil-works/pi-agent-core";
import { type Static, Type } from "typebox";
import type { AsyncJobManager } from "../async/job-manager.js";
import type { AsyncJobDeliveryMessage } from "../async/types.js";
import type { BashResult } from "../bash-executor.ts";
import type { ToolDefinition } from "../extensions/types.ts";
import { type BashInterceptorRule } from "./bash-interceptor.ts";
import { type TruncationResult } from "./truncate.ts";
declare const bashSchema: Type.TObject<{
    command: Type.TString;
    env: Type.TOptional<Type.TUnsafe<Record<string, string>>>;
    timeout: Type.TOptional<Type.TNumber>;
    cwd: Type.TOptional<Type.TString>;
    pty: Type.TOptional<Type.TBoolean>;
    async: Type.TOptional<Type.TBoolean>;
}>;
export type BashToolInput = Static<typeof bashSchema>;
export interface BashToolDetails {
    truncation?: TruncationResult;
    fullOutputPath?: string;
    exitCode?: number | null;
    async?: {
        jobId: string;
        type: "bash";
        state: "running" | "completed" | "failed";
        command?: string;
        status?: "running" | "completed" | "failed";
    };
    timeoutSeconds?: number;
    requestedTimeoutSeconds?: number;
    wallTimeMs?: number;
}
export interface BashOperations {
    exec: (command: string, cwd: string, options: {
        onData: (data: Buffer) => void;
        signal?: AbortSignal;
        timeout?: number;
        env?: NodeJS.ProcessEnv;
        pty?: boolean;
    }) => Promise<{
        exitCode: number | null;
    }>;
}
export declare function createLocalBashOperations(options?: {
    shellPath?: string;
}): BashOperations;
export interface BashSpawnContext {
    command: string;
    cwd: string;
    env: NodeJS.ProcessEnv;
}
export type BashSpawnHook = (context: BashSpawnContext) => BashSpawnContext;
export interface BashInterceptorResult {
    operations?: BashOperations;
    result?: BashResult;
}
export type BashInterceptor = (context: BashSpawnContext) => Promise<BashInterceptorResult | undefined> | BashInterceptorResult | undefined;
export interface BashToolOptions {
    operations?: BashOperations;
    /** Prefix prepended to every shell command before execution. */
    commandPrefix?: string;
    /** Override shell executable resolution for local bash operations. */
    shellPath?: string;
    /** Last-mile hook for rewriting the command/cwd/env spawn context. */
    spawnHook?: BashSpawnHook;
    /** Optional command interceptor used by extensions and parity tests. */
    interceptor?: BashInterceptor;
    interceptorEnabled?: boolean | (() => boolean);
    availableTools?: string[];
    interceptorRules?: BashInterceptorRule[];
    /** Enable background bash jobs and session-managed async result delivery. */
    asyncEnabled?: boolean;
    asyncJobManager?: AsyncJobManager;
    asyncJobDeliveryHandler?: (message: AsyncJobDeliveryMessage) => void | Promise<void>;
    asyncJobSessionId?: symbol;
}
type BashRenderState = {
    startedAt: number | undefined;
    endedAt: number | undefined;
    interval: NodeJS.Timeout | undefined;
};
export declare function createBashToolDefinition(cwd: string, options?: BashToolOptions): ToolDefinition<typeof bashSchema, BashToolDetails | undefined, BashRenderState>;
export declare function createBashTool(cwd: string, options?: BashToolOptions): AgentTool<typeof bashSchema>;
export {};
//# sourceMappingURL=bash.d.ts.map