export { createBashTool, createBashToolDefinition, createLocalBashOperations, } from "./bash.js";
export { createEditTool, createEditToolDefinition, } from "./edit.js";
export { withFileMutationQueue } from "./file-mutation-queue.js";
export { createFindTool, createFindToolDefinition, } from "./find.js";
export { createSearchTool, createSearchToolDefinition, } from "./search.js";
export { createLsTool, createLsToolDefinition, } from "./ls.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";
export { createAskUserQuestionToolDefinition } from "./ask-user-question/index.js";
export { STRUCTURED_OUTPUT_TOOL_NAME, createStructuredOutputCapture, createStructuredOutputTool, } from "./structured-output.js";
export { createTodoToolDefinition } from "./todos.js";
import { createAskUserQuestionToolDefinition } from "./ask-user-question/index.js";
import { createHashlineSnapshotStore } from "./hashline.js";
import { createBashTool, createBashToolDefinition } from "./bash.js";
import { createEditTool, createEditToolDefinition } from "./edit.js";
import { createFindTool, createFindToolDefinition } from "./find.js";
import { createLsTool, createLsToolDefinition } from "./ls.js";
import { createSearchTool, createSearchToolDefinition } from "./search.js";
import { createReadTool, createReadToolDefinition } from "./read.js";
import { createTodoToolDefinition } from "./todos.js";
import { wrapToolDefinition } from "./tool-definition-wrapper.js";
import { createWriteTool, createWriteToolDefinition } from "./write.js";
export const allToolNames = new Set([
    "read",
    "bash",
    "edit",
    "write",
    "find",
    "search",
    "ls",
    "ask_user_question",
    "todo",
]);
export const defaultToolNames = [
    "read",
    "bash",
    "edit",
    "write",
    "find",
    "search",
    "ask_user_question",
    "todo",
];
export function createToolDefinition(toolName, cwd, options) {
    // Default a shared store so the singular factories don't hand read/edit/
    // write/search isolated stores (which silently degrades drift recovery).
    const hashlineStore = options?.hashlineStore ?? createHashlineSnapshotStore();
    switch (toolName) {
        case "read":
            return createReadToolDefinition(cwd, { ...options?.read, hashlineStore });
        case "bash":
            return createBashToolDefinition(cwd, options?.bash);
        case "edit":
            return createEditToolDefinition(cwd, { ...options?.edit, hashlineStore });
        case "write":
            return createWriteToolDefinition(cwd, { ...options?.write, hashlineStore });
        case "find":
            return createFindToolDefinition(cwd, options?.find);
        case "search":
            return createSearchToolDefinition(cwd, { ...options?.search, hashlineStore });
        case "ls":
            return createLsToolDefinition(cwd, options?.ls);
        case "ask_user_question":
            return createAskUserQuestionToolDefinition();
        case "todo":
            return createTodoToolDefinition(cwd);
        default:
            throw new Error(`Unknown tool name: ${toolName}`);
    }
}
export function createTool(toolName, cwd, options) {
    const hashlineStore = options?.hashlineStore ?? createHashlineSnapshotStore();
    switch (toolName) {
        case "read":
            return createReadTool(cwd, { ...options?.read, hashlineStore });
        case "bash":
            return createBashTool(cwd, options?.bash);
        case "edit":
            return createEditTool(cwd, { ...options?.edit, hashlineStore });
        case "write":
            return createWriteTool(cwd, { ...options?.write, hashlineStore });
        case "find":
            return createFindTool(cwd, options?.find);
        case "search":
            return createSearchTool(cwd, { ...options?.search, hashlineStore });
        case "ls":
            return createLsTool(cwd, options?.ls);
        case "ask_user_question":
            return wrapToolDefinition(createAskUserQuestionToolDefinition());
        case "todo":
            return wrapToolDefinition(createTodoToolDefinition(cwd));
        default:
            throw new Error(`Unknown tool name: ${toolName}`);
    }
}
export function createCodingToolDefinitions(cwd, options) {
    const hashlineStore = options?.hashlineStore ?? createHashlineSnapshotStore();
    return [
        createReadToolDefinition(cwd, { ...options?.read, hashlineStore }),
        createBashToolDefinition(cwd, { asyncEnabled: true, ...options?.bash }),
        createEditToolDefinition(cwd, { ...options?.edit, hashlineStore }),
        createWriteToolDefinition(cwd, { ...options?.write, hashlineStore }),
        createFindToolDefinition(cwd, options?.find),
        createSearchToolDefinition(cwd, { ...options?.search, hashlineStore }),
    ];
}
export function createReadOnlyToolDefinitions(cwd, options) {
    const hashlineStore = options?.hashlineStore ?? createHashlineSnapshotStore();
    return [
        createReadToolDefinition(cwd, { ...options?.read, hashlineStore }),
        createFindToolDefinition(cwd, options?.find),
        createSearchToolDefinition(cwd, { ...options?.search, hashlineStore }),
        createLsToolDefinition(cwd, options?.ls),
    ];
}
export function createAllToolDefinitions(cwd, options) {
    const hashlineStore = options?.hashlineStore ?? createHashlineSnapshotStore();
    return {
        read: createReadToolDefinition(cwd, { ...options?.read, hashlineStore }),
        bash: createBashToolDefinition(cwd, { asyncEnabled: true, ...options?.bash }),
        edit: createEditToolDefinition(cwd, { ...options?.edit, hashlineStore }),
        write: createWriteToolDefinition(cwd, { ...options?.write, hashlineStore }),
        find: createFindToolDefinition(cwd, options?.find),
        search: createSearchToolDefinition(cwd, { ...options?.search, hashlineStore }),
        ls: createLsToolDefinition(cwd, options?.ls),
        ask_user_question: createAskUserQuestionToolDefinition(),
        todo: createTodoToolDefinition(cwd),
    };
}
export function createCodingTools(cwd, options) {
    const hashlineStore = options?.hashlineStore ?? createHashlineSnapshotStore();
    return [
        createReadTool(cwd, { ...options?.read, hashlineStore }),
        createBashTool(cwd, { asyncEnabled: true, ...options?.bash }),
        createEditTool(cwd, { ...options?.edit, hashlineStore }),
        createWriteTool(cwd, { ...options?.write, hashlineStore }),
        createFindTool(cwd, options?.find),
        createSearchTool(cwd, { ...options?.search, hashlineStore }),
    ];
}
export function createReadOnlyTools(cwd, options) {
    const hashlineStore = options?.hashlineStore ?? createHashlineSnapshotStore();
    return [
        createReadTool(cwd, { ...options?.read, hashlineStore }),
        createFindTool(cwd, options?.find),
        createSearchTool(cwd, { ...options?.search, hashlineStore }),
        createLsTool(cwd, options?.ls),
    ];
}
export function createAllTools(cwd, options) {
    const hashlineStore = options?.hashlineStore ?? createHashlineSnapshotStore();
    return {
        read: createReadTool(cwd, { ...options?.read, hashlineStore }),
        bash: createBashTool(cwd, { asyncEnabled: true, ...options?.bash }),
        edit: createEditTool(cwd, { ...options?.edit, hashlineStore }),
        write: createWriteTool(cwd, { ...options?.write, hashlineStore }),
        find: createFindTool(cwd, options?.find),
        search: createSearchTool(cwd, { ...options?.search, hashlineStore }),
        ls: createLsTool(cwd, options?.ls),
        ask_user_question: wrapToolDefinition(createAskUserQuestionToolDefinition()),
        todo: wrapToolDefinition(createTodoToolDefinition(cwd)),
    };
}
//# sourceMappingURL=index.js.map