import { ProcessManager } from "../core/process-manager.js";
import { createReadTool } from "./read.js";
import { getVideoByteLimit } from "../core/model-registry.js";
import { createWriteTool } from "./write.js";
import { createEditTool } from "./edit.js";
import { createBashTool } from "./bash.js";
import { createFindTool } from "./find.js";
import { createGrepTool } from "./grep.js";
import { createLsTool } from "./ls.js";
import { createSubAgentTool } from "./subagent.js";
import { createWebFetchTool } from "./web-fetch.js";
import { createWebSearchTool } from "./web-search.js";
import { createSourcePathTool } from "./source-path.js";
import { createTaskOutputTool } from "./task-output.js";
import { createTaskStopTool } from "./task-stop.js";
import { createTasksTool } from "./tasks.js";
import { createSkillTool } from "./skill.js";
import { createScreenshotTool } from "./screenshot.js";
import { createEnterPlanTool } from "./enter-plan.js";
import { createExitPlanTool } from "./exit-plan.js";
import { localOperations } from "./operations.js";
import { createGoalsTool } from "./goals.js";
export function createTools(cwd, opts) {
    const readFiles = new Map();
    const processManager = new ProcessManager();
    const ops = opts?.operations ?? localOperations;
    const planModeRef = opts?.planModeRef;
    const goalModeRef = opts?.goalModeRef;
    // Enable native video returns from the read tool for any video-capable model
    // (Kimi/Moonshot, Gemini, MiniMax), each with its own per-model byte cap that
    // drives auto-compression. Non-video models get `undefined` — video falls back
    // to the plain binary-file notice, never offered to models that can't watch it.
    const videoByteLimit = opts?.model ? getVideoByteLimit(opts.model) : undefined;
    const tools = [
        createReadTool(cwd, readFiles, ops, opts?.onFileRead, videoByteLimit),
        createWriteTool(cwd, readFiles, ops, planModeRef, opts?.onFileMutated, opts?.onPreFileMutation, goalModeRef),
        createEditTool(cwd, readFiles, ops, planModeRef, opts?.onFileMutated, opts?.onPreFileMutation, goalModeRef),
        createBashTool(cwd, processManager, ops, planModeRef, goalModeRef),
        createFindTool(cwd),
        createGrepTool(cwd, ops),
        createLsTool(cwd, ops),
        createSourcePathTool(cwd),
        createWebFetchTool(),
        createTaskOutputTool(processManager),
        createTaskStopTool(processManager),
        createTasksTool(cwd),
        createGoalsTool(cwd, goalModeRef),
        createScreenshotTool(cwd),
    ];
    // Add web search tool for providers without reliable native web search
    if (opts?.provider && opts.provider !== "anthropic") {
        tools.push(createWebSearchTool());
    }
    if (opts?.agents && opts.agents.length > 0 && opts.provider && opts.model) {
        tools.push(createSubAgentTool(cwd, opts.agents, opts.provider, opts.model, opts.getCacheKey, planModeRef, goalModeRef));
    }
    if (opts?.skills && opts.skills.length > 0) {
        tools.push(createSkillTool(opts.skills));
    }
    if (opts?.onEnterPlan) {
        tools.push(createEnterPlanTool(opts.onEnterPlan));
    }
    if (opts?.onExitPlan) {
        tools.push(createExitPlanTool(cwd, opts.onExitPlan));
    }
    const rebuildReadTool = (model) => createReadTool(cwd, readFiles, ops, opts?.onFileRead, getVideoByteLimit(model));
    return { tools, processManager, rebuildReadTool };
}
export { createReadTool } from "./read.js";
export { createWriteTool } from "./write.js";
export { createEditTool } from "./edit.js";
export { createBashTool } from "./bash.js";
export { createFindTool } from "./find.js";
export { createGrepTool } from "./grep.js";
export { createLsTool } from "./ls.js";
export { createWebFetchTool } from "./web-fetch.js";
export { createWebSearchTool } from "./web-search.js";
export { createSourcePathTool } from "./source-path.js";
export { createTaskOutputTool } from "./task-output.js";
export { createTaskStopTool } from "./task-stop.js";
export { createTasksTool } from "./tasks.js";
export { createSkillTool } from "./skill.js";
export { createScreenshotTool } from "./screenshot.js";
export { createEnterPlanTool } from "./enter-plan.js";
export { createExitPlanTool } from "./exit-plan.js";
export { createGoalsTool } from "./goals.js";
export { ProcessManager } from "../core/process-manager.js";
export { localOperations } from "./operations.js";
//# sourceMappingURL=index.js.map