export { createBashTool, createBashToolDefinition, createLocalBashOperations, } from "./bash.js";
export { createCodeReviewTool, createCodeReviewToolDefinition, } from "./code-review.js";
export { createCommitSplitterTool, createCommitSplitterToolDefinition, } from "./commit-splitter.js";
export { createDapTool, createDapToolDefinition } from "./dap.js";
export { createEditTool, createEditToolDefinition, } from "./edit.js";
export { withFileMutationQueue } from "./file-mutation-queue.js";
export { createFindTool, createFindToolDefinition, } from "./find.js";
export { createGrepTool, createGrepToolDefinition, } from "./grep.js";
export { createLsTool, createLsToolDefinition, } from "./ls.js";
export { createLspTool, createLspToolDefinition } from "./lsp.js";
export { createReadTool, createReadToolDefinition, } from "./read.js";
export { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateHead, truncateLine, truncateTail, } from "./truncate.js";
export { createWriteTool, createWriteToolDefinition, } from "./write.js";
import { createBashTool, createBashToolDefinition } from "./bash.js";
import { createCodeReviewTool, createCodeReviewToolDefinition } from "./code-review.js";
import { createCommitSplitterTool, createCommitSplitterToolDefinition, } from "./commit-splitter.js";
import { createDapTool, createDapToolDefinition } from "./dap.js";
import { createEditTool, createEditToolDefinition } from "./edit.js";
import { createFindTool, createFindToolDefinition } from "./find.js";
import { createGrepTool, createGrepToolDefinition } from "./grep.js";
import { createLsTool, createLsToolDefinition } from "./ls.js";
import { createLspTool, createLspToolDefinition } from "./lsp.js";
import { createReadTool, createReadToolDefinition } from "./read.js";
import { createWriteTool, createWriteToolDefinition } from "./write.js";
export const allToolNames = new Set([
    "read",
    "bash",
    "edit",
    "write",
    "grep",
    "find",
    "ls",
    "code-review",
    "commit-splitter",
    "lsp",
    "dap",
]);
function mergeReadOptions(options) {
    return {
        ...options?.read,
        useHashline: options?.useHashline ?? options?.read?.useHashline,
        snapshotStore: options?.hashlineSnapshotStore ?? options?.read?.snapshotStore,
        conflictHistory: options?.conflictHistory ?? options?.read?.conflictHistory,
    };
}
function mergeEditOptions(options) {
    return {
        ...options?.edit,
        snapshotStore: options?.hashlineSnapshotStore ?? options?.edit?.snapshotStore,
        conflictHistory: options?.conflictHistory ?? options?.edit?.conflictHistory,
    };
}
function mergeWriteOptions(options) {
    return {
        ...options?.write,
        snapshotStore: options?.hashlineSnapshotStore ?? options?.write?.snapshotStore,
        conflictHistory: options?.conflictHistory ?? options?.write?.conflictHistory,
    };
}
export function createToolDefinition(toolName, cwd, options) {
    switch (toolName) {
        case "read":
            return createReadToolDefinition(cwd, mergeReadOptions(options));
        case "bash":
            return createBashToolDefinition(cwd, options?.bash);
        case "edit":
            return createEditToolDefinition(cwd, mergeEditOptions(options));
        case "write":
            return createWriteToolDefinition(cwd, mergeWriteOptions(options));
        case "grep":
            return createGrepToolDefinition(cwd, options?.grep);
        case "find":
            return createFindToolDefinition(cwd, options?.find);
        case "ls":
            return createLsToolDefinition(cwd, options?.ls);
        case "code-review":
            return createCodeReviewToolDefinition(cwd, options?.["code-review"]);
        case "commit-splitter":
            return createCommitSplitterToolDefinition(cwd, options?.["commit-splitter"]);
        case "lsp":
            return createLspToolDefinition(cwd);
        case "dap":
            return createDapToolDefinition(cwd);
        default:
            throw new Error(`Unknown tool name: ${toolName}`);
    }
}
export function createTool(toolName, cwd, options) {
    switch (toolName) {
        case "read":
            return createReadTool(cwd, mergeReadOptions(options));
        case "bash":
            return createBashTool(cwd, options?.bash);
        case "edit":
            return createEditTool(cwd, mergeEditOptions(options));
        case "write":
            return createWriteTool(cwd, mergeWriteOptions(options));
        case "grep":
            return createGrepTool(cwd, options?.grep);
        case "find":
            return createFindTool(cwd, options?.find);
        case "ls":
            return createLsTool(cwd, options?.ls);
        case "code-review":
            return createCodeReviewTool(cwd, options?.["code-review"]);
        case "commit-splitter":
            return createCommitSplitterTool(cwd, options?.["commit-splitter"]);
        case "lsp":
            return createLspTool(cwd);
        case "dap":
            return createDapTool(cwd);
        default:
            throw new Error(`Unknown tool name: ${toolName}`);
    }
}
export function createCodingToolDefinitions(cwd, options) {
    return [
        createReadToolDefinition(cwd, mergeReadOptions(options)),
        createBashToolDefinition(cwd, options?.bash),
        createEditToolDefinition(cwd, mergeEditOptions(options)),
        createWriteToolDefinition(cwd, mergeWriteOptions(options)),
    ];
}
export function createReadOnlyToolDefinitions(cwd, options) {
    return [
        createReadToolDefinition(cwd, mergeReadOptions(options)),
        createGrepToolDefinition(cwd, options?.grep),
        createFindToolDefinition(cwd, options?.find),
        createLsToolDefinition(cwd, options?.ls),
    ];
}
export function createAllToolDefinitions(cwd, options) {
    return {
        read: createReadToolDefinition(cwd, mergeReadOptions(options)),
        bash: createBashToolDefinition(cwd, options?.bash),
        edit: createEditToolDefinition(cwd, mergeEditOptions(options)),
        write: createWriteToolDefinition(cwd, mergeWriteOptions(options)),
        grep: createGrepToolDefinition(cwd, options?.grep),
        find: createFindToolDefinition(cwd, options?.find),
        ls: createLsToolDefinition(cwd, options?.ls),
        "code-review": createCodeReviewToolDefinition(cwd, options?.["code-review"]),
        "commit-splitter": createCommitSplitterToolDefinition(cwd, options?.["commit-splitter"]),
        lsp: createLspToolDefinition(cwd),
        dap: createDapToolDefinition(cwd),
    };
}
export function createCodingTools(cwd, options) {
    return [
        createReadTool(cwd, mergeReadOptions(options)),
        createBashTool(cwd, options?.bash),
        createEditTool(cwd, mergeEditOptions(options)),
        createWriteTool(cwd, mergeWriteOptions(options)),
    ];
}
export function createReadOnlyTools(cwd, options) {
    return [
        createReadTool(cwd, mergeReadOptions(options)),
        createGrepTool(cwd, options?.grep),
        createFindTool(cwd, options?.find),
        createLsTool(cwd, options?.ls),
    ];
}
export function createAllTools(cwd, options) {
    return {
        read: createReadTool(cwd, mergeReadOptions(options)),
        bash: createBashTool(cwd, options?.bash),
        edit: createEditTool(cwd, mergeEditOptions(options)),
        write: createWriteTool(cwd, mergeWriteOptions(options)),
        grep: createGrepTool(cwd, options?.grep),
        find: createFindTool(cwd, options?.find),
        ls: createLsTool(cwd, options?.ls),
        "code-review": createCodeReviewTool(cwd, options?.["code-review"]),
        "commit-splitter": createCommitSplitterTool(cwd, options?.["commit-splitter"]),
        lsp: createLspTool(cwd),
        dap: createDapTool(cwd),
    };
}
//# sourceMappingURL=index.js.map