import type { CustomToolMetadata } from '../types/custom-tools.js';
import type { ToolHandler } from '../types/index.js';
/**
 * Build a `ToolHandler` that renders the script body and runs it under the
 * configured shell. Captures stdout + stderr, applies the timeout, and
 * returns the trimmed/truncated combined output.
 */
export declare function buildHandler(metadata: CustomToolMetadata, body: string, projectRoot: string): ToolHandler;
export interface RunOptions {
    cwd: string;
    env: NodeJS.ProcessEnv;
    shell: string;
    timeoutMs: number;
}
/**
 * Spawn the shell with the rendered script and wait for completion.
 *
 * Always returns the captured output (matching `execute_bash`'s behavior). A
 * non-zero exit gets an `EXIT_CODE: N` prefix and stderr/stdout sections so
 * the LLM can reason about it, but is NOT treated as a tool failure — many
 * CLIs (`pnpm audit`, `git diff --exit-code`, `grep`, test runners) exit
 * non-zero as part of normal operation. Throws are reserved for genuine tool
 * failures: spawn errors (command not found) and timeouts.
 */
export declare function runScript(script: string, options: RunOptions): Promise<string>;
/**
 * Resolve the working directory with `${VAR}` substitution from process.env.
 * Relative paths resolve against the project root. Returns the project root
 * if the configured directory doesn't exist (so we don't hard-fail on a
 * stale checkout).
 */
export declare function resolveCwd(configured: string | undefined, projectRoot: string): string;
/**
 * Merge configured env vars into `process.env`, performing `${VAR}`
 * substitution on values. Keys with no value resolve to an empty string.
 */
export declare function mergeEnv(configured: Record<string, string> | undefined): NodeJS.ProcessEnv;
/**
 * Expand `$VAR`, `${VAR}`, and `${VAR:-default}` references using values
 * from `process.env`. Unknown vars without a default expand to "".
 */
export declare function expandVars(value: string): string;
//# sourceMappingURL=handler.d.ts.map