import type { AgentTool } from "@earendil-works/pi-agent-core"; import { type Static, Type } from "typebox"; import type { BashResult } from "../bash-executor.ts"; import type { ToolDefinition } from "../extensions/types.ts"; import type { WaitPolicy } from "../tasks/contracts.js"; import { type BashInterceptorRule } from "./bash-interceptor.ts"; import { type SupervisedCommandOwner, type SupervisedCommandResult } from "./bash-pty-native.js"; import { type ToolTimerState } from "./render-utils.ts"; import { type TruncationResult } from "./truncate.ts"; declare const bashBaseSchema: Type.TObject<{ command: Type.TString; env: Type.TOptional>>; timeout: Type.TOptional; wait: Type.TOptional>; cwd: Type.TOptional; pty: Type.TOptional; }>; type ShellCommandInput = Static & { action?: never; id?: never; budgetMs?: never; }; type ShellWaitInput = { action: "wait"; id: string; budgetMs?: number; } & Partial, never>>; declare const bashSchema: Type.TUnsafe; export declare const bashToolSystemPromptContribution: Readonly<{ readonly snippet: "Execute a shell command."; readonly guidelines: readonly ["You can inspect ATOMIC_* or PI_* environment variables for current model and session details.", "Use { action: \"wait\", id: taskId } to observe an existing shell task with the owner policy. Avoid repeated short polls; await completion notifications when no dependent work is blocked. Never relaunch a yielded command. Waiting does not extend execution timeout or owner lifetime.", "For ordinary commands, omit wait to use the owner's observation policy (normally 10s). Do not routinely request one-second waits: premature yields add tool calls without making the command faster. Use a short budget only for a concrete responsiveness need, or explicit background observation when you have independent work to do. Explicit budgets, including zero for polling, remain available.", "Choose foreground or background shell observation as needed without asking the user each time. Background yields after admission; foreground waits for its optional budget then the same command continues in background. Omitted wait uses owner-configured automatic background yield (default 10s). Observation never changes the execution timeout, which stops the command. Background requires a supported task owner; unbound foreground waits until completion regardless of budget."]; }>; export type BashToolInput = Static; export interface BashToolDetails { truncation?: TruncationResult; fullOutputPath?: string; exitCode?: number | null; observation?: import("../tasks/contracts.js").WaitOutcome; timeoutSeconds?: number; requestedTimeoutSeconds?: number; wallTimeMs?: number; } export declare function validateExplicitTimeoutSeconds(timeout: number): void; export type BashOutputChannel = "stdout" | "stderr"; export interface BashOperations { exec: (command: string, cwd: string, options: { onData: (data: Buffer, channel?: BashOutputChannel) => void; signal?: AbortSignal; timeout?: number; wait?: WaitPolicy; env?: NodeJS.ProcessEnv; pty?: boolean; }) => Promise; } export declare function createLocalBashOperations(options?: { shellPath?: string; taskOwner?: SupervisedCommandOwner; }): 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; export interface BashToolOptions { operations?: BashOperations; /** Trusted host ownership; never supplied by model arguments. */ taskOwner?: SupervisedCommandOwner; /** Expose the execution-time Atomic session snapshot and PI compatibility aliases. Default: true. */ exposeSessionEnvironment?: boolean; /** Prefix prepended to every shell command before execution. */ commandPrefix?: string; /** Override shell executable resolution for local bash operations. */ shellPath?: string; /** Dialect for generated internal-URL path literals. Defaults to POSIX; does not select the executable. */ shellDialect?: "posix" | "powershell"; /** 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[]; /** * Session-scoped directory for overflow logs, resolved per execution so a * session switch (fork, branch, resume) follows the live transcript session. */ sessionTempDir?: string | (() => string | undefined); } /** * Presentation identity for a shell-backed built-in tool. Atomic runs PowerShell * through the same execution pipeline as bash, so the transcript prompt and the * overflow temp-file prefix are the only shell-specific display values. */ export interface ShellToolPresentation { /** Transcript prompt prefix: `$` for bash, `PS>` for PowerShell. */ prompt: string; /** Prefix for the temp file that holds truncated output. */ tempFilePrefix: string; } export declare const BASH_SHELL_PRESENTATION: ShellToolPresentation; export declare function createBashToolDefinition(cwd: string, options?: BashToolOptions, presentation?: ShellToolPresentation): ToolDefinition; export declare function createBashTool(cwd: string, options?: BashToolOptions): AgentTool; export {}; //# sourceMappingURL=bash.d.ts.map