"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createAgentTools = createAgentTools;
const goto_js_1 = require("./goto.js");
const act_js_1 = require("./act.js");
const screenshot_js_1 = require("./screenshot.js");
const wait_js_1 = require("./wait.js");
const navback_js_1 = require("./navback.js");
const ariaTree_js_1 = require("./ariaTree.js");
const fillform_js_1 = require("./fillform.js");
const scroll_js_1 = require("./scroll.js");
const extract_js_1 = require("./extract.js");
const click_js_1 = require("./click.js");
const type_js_1 = require("./type.js");
const dragAndDrop_js_1 = require("./dragAndDrop.js");
const clickAndHold_js_1 = require("./clickAndHold.js");
const keys_js_1 = require("./keys.js");
const fillFormVision_js_1 = require("./fillFormVision.js");
const think_js_1 = require("./think.js");
const search_js_1 = require("./search.js");
/**
 * Filters tools based on mode and explicit exclusions.
 * - 'dom' mode: Removes coordinate-based tools (click, type, dragAndDrop, clickAndHold, fillFormVision)
 * - 'hybrid' mode: Removes DOM-based form tool (fillForm) in favor of coordinate-based fillFormVision
 * - excludeTools: Additional tools to remove from the toolset
 */
function filterTools(tools, mode, excludeTools) {
    const filtered = { ...tools };
    // Mode-based filtering
    if (mode === "hybrid") {
        delete filtered.fillForm;
    }
    else {
        // DOM mode (default)
        delete filtered.click;
        delete filtered.type;
        delete filtered.dragAndDrop;
        delete filtered.clickAndHold;
        delete filtered.fillFormVision;
    }
    if (excludeTools) {
        for (const toolName of excludeTools) {
            delete filtered[toolName];
        }
    }
    return filtered;
}
function createAgentTools(v3, options) {
    const executionModel = options?.executionModel;
    const mode = options?.mode ?? "dom";
    const provider = options?.provider;
    const excludeTools = options?.excludeTools;
    const variables = options?.variables;
    const allTools = {
        act: (0, act_js_1.actTool)(v3, executionModel, variables),
        ariaTree: (0, ariaTree_js_1.ariaTreeTool)(v3),
        click: (0, click_js_1.clickTool)(v3, provider),
        clickAndHold: (0, clickAndHold_js_1.clickAndHoldTool)(v3, provider),
        dragAndDrop: (0, dragAndDrop_js_1.dragAndDropTool)(v3, provider),
        extract: (0, extract_js_1.extractTool)(v3, executionModel),
        fillForm: (0, fillform_js_1.fillFormTool)(v3, executionModel, variables),
        fillFormVision: (0, fillFormVision_js_1.fillFormVisionTool)(v3, provider, variables),
        goto: (0, goto_js_1.gotoTool)(v3),
        keys: (0, keys_js_1.keysTool)(v3),
        navback: (0, navback_js_1.navBackTool)(v3),
        screenshot: (0, screenshot_js_1.screenshotTool)(v3),
        scroll: mode === "hybrid" ? (0, scroll_js_1.scrollVisionTool)(v3, provider) : (0, scroll_js_1.scrollTool)(v3),
        think: (0, think_js_1.thinkTool)(),
        type: (0, type_js_1.typeTool)(v3, provider, variables),
        wait: (0, wait_js_1.waitTool)(v3, mode),
    };
    // Only include search tool if BRAVE_API_KEY is configured
    if (process.env.BRAVE_API_KEY) {
        allTools.search = (0, search_js_1.searchTool)(v3);
    }
    return filterTools(allTools, mode, excludeTools);
}
//# sourceMappingURL=index.js.map