import type { CodeGenTools, ContentMessageItemToolResult, GenerateCompletionStep, ProjectFile } from "$/ai-utils";
import type { DevToolsSys } from "../core";
import { type ChildProcessByStdio } from "child_process";
import type { RunCommandCtx } from "./codegen";
import type EventEmitter from "events";
import type { Readable } from "stream";
export interface LLMToolCalls {
    name: CodeGenTools;
    input: Record<string, any>;
    id: string;
}
export interface ToolResolution {
    toolResult: string;
    isError: boolean;
    title?: string;
}
export type CommitMode = "commits" | "draft-prs" | "prs";
export interface FusionContext {
    commandCtx?: RunCommandCtx;
    checkCommand?: string;
    serverUrl: string;
    allowedCommands: RegExp[];
    commitMode: CommitMode;
    git: boolean;
    gitRemote?: string;
    gitAutoInit?: boolean;
    gitFeatureBranch?: string;
}
export interface ToolContext extends Partial<FusionContext> {
    sys: DevToolsSys;
    files: ProjectFile[];
    emitter: EventEmitter<{
        step: [GenerateCompletionStep];
        idle: [];
    }>;
    signal: AbortSignal | undefined;
    workingDirectory: string;
    resolveWorkspacePath: (path: string) => string;
    workspaceFolders: Array<{
        path: string;
        name?: string;
    }>;
    readFile: (filePath: string) => Promise<string | null>;
    writeFile: (filePath: string, content: string | Uint8Array) => Promise<boolean>;
    deleteFile: (filePath: string) => Promise<boolean>;
    fileExists: (filePath: string) => Promise<boolean>;
    listDir: (dirPath: string) => Promise<string[]>;
    stat: (filePath: string) => Promise<{
        isDirectory: () => boolean;
        isFile: () => boolean;
    } | null>;
}
export declare function resolveToolCalls(toolContext: ToolContext, toolCalls: LLMToolCalls[]): Promise<ContentMessageItemToolResult[]>;
interface RipgrepMatch {
    path: string;
    lineNumber: number;
    lineContent: string;
}
interface RipgrepResult {
    matches: RipgrepMatch[];
}
export declare function runRipgrep(sys: DevToolsSys, workingDirectory: string, pattern: string, includeGlob?: string, excludeGlob?: string): Promise<RipgrepResult>;
export declare function newAbortError(): Error;
export declare function killProcess(sys: DevToolsSys, proc: ChildProcessByStdio<null, Readable, Readable> | undefined, abortSignal?: AbortSignal, timeout?: number): Promise<boolean>;
export {};
