import type { AgentTool } from "@earendil-works/pi-agent-core";
import { type ShellConfig } from "../../utils/shell.ts";
import type { ToolDefinition } from "../extensions/types.ts";
import { type BashSpawnHook, type BashToolDetails, type bashSchema, type ShellToolConfig } from "./bash-schema.ts";
import { type ToolMachine } from "./machine.ts";
import { type BashOperations } from "./shell-operations.ts";
export { type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOutput, bashToolSystemPromptContribution, type ShellToolConfig, } from "./bash-schema.ts";
export type { BashOperations } from "./shell-operations.ts";
/**
 * Shared process execution used by the built-in shell tools: one `process.exec` of the operation layer (own
 * process group, scope token, abort/timeout kill the group). The tool keeps its own output handling.
 */
export declare function createLocalShellOperations(shellName: string, resolveShellConfig: () => ShellConfig, machine?: ToolMachine): BashOperations;
/**
 * Create bash operations using pi's built-in local shell execution backend.
 *
 * This is useful for extensions that intercept user_bash and still want pi's
 * standard local shell behavior while wrapping or rewriting commands.
 */
export declare function createLocalBashOperations(options?: {
    shellPath?: string;
    machine?: ToolMachine;
}): BashOperations;
/** A tool routed to the session's device by OMO_TOOLS_VIA_DAEMON found no device to run on; it never falls back to local. */
export declare class DeviceUnavailableError extends Error {
    readonly code: "device_unavailable";
    readonly tool: string;
    constructor(tool: string);
}
export interface BashToolOptions {
    /** Redact credential-shaped output before streaming or spilling. Default: false. */
    redactSecretsInOutput?: boolean;
    /** 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;
    /** Expose current Pi session metadata as PI_* environment variables. Default: true */
    exposeSessionEnvironment?: boolean;
    /** Hook to adjust command, cwd, or env before execution */
    spawnHook?: BashSpawnHook;
    /** Operation layer and policy gate. Default: the process-wide local machine. */
    machine?: ToolMachine;
    /**
     * The operation layer of the device this session works on. Slice 1a of the tools-via-daemon plan: an executor seam
     * only, NOT yet via the daemon; the relay transport that supplies it is slice 1b. Used only when OMO_TOOLS_VIA_DAEMON
     * names "bash"; with the flag on and no device machine, a call fails with DeviceUnavailableError and never runs locally.
     */
    deviceMachine?: ToolMachine | (() => ToolMachine | undefined);
}
export type BashRenderState = {
    startedAt: number | undefined;
    endedAt: number | undefined;
    interval: NodeJS.Timeout | undefined;
};
export declare function createShellToolDefinition(cwd: string, config: ShellToolConfig, options?: BashToolOptions): ToolDefinition<typeof bashSchema, BashToolDetails | undefined, BashRenderState>;
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>;
//# sourceMappingURL=bash.d.ts.map