import { memoryTool } from "../memory/tool.js";
import { memorySearchTool } from "../memory/search_tool.js";
import { skillManageTool } from "../skills/tool.js";
import { desireCloseTool, desireProgressTool, soulDiffTool, soulFeelTool, soulHistoryTool, soulJournalTool, soulObjectTool, soulPatchTool, soulReadTool, } from "../soul/tools.js";
import { speakTool, transcribeTool } from "../voice/tool.js";
import { applyPatchTool } from "./apply_patch.js";
import { bashTool } from "./bash.js";
import { editTool } from "./edit.js";
import { grepTool } from "./grep.js";
import { lsTool } from "./ls.js";
import { readTool } from "./read.js";
import { redeployTool } from "./redeploy.js";
import { setMoodTool } from "./set_mood.js";
import { webFetchTool } from "./web_fetch.js";
import { webSearchTool } from "./web_search.js";
import { writeTool } from "./write.js";
export function buildToolRegistry(opts = {}) {
    const tools = [
        readTool,
        writeTool,
        editTool,
        applyPatchTool,
        bashTool,
        grepTool,
        lsTool,
        skillManageTool,
        memoryTool,
        memorySearchTool,
        setMoodTool,
        soulPatchTool,
        soulJournalTool,
        soulReadTool,
        soulFeelTool,
        soulHistoryTool,
        soulDiffTool,
        soulObjectTool,
        desireProgressTool,
        desireCloseTool,
        webFetchTool,
        webSearchTool,
        redeployTool,
    ];
    if (opts.includeVoice) {
        tools.push(speakTool, transcribeTool);
    }
    if (opts.extra && opts.extra.length > 0) {
        const seen = new Set(tools.map((t) => t.name));
        for (const t of opts.extra) {
            if (seen.has(t.name))
                continue; // builtin wins; caller logged the conflict
            tools.push(t);
            seen.add(t.name);
        }
    }
    tools.sort((a, b) => a.name.localeCompare(b.name));
    return tools;
}
export const READ_ONLY_TOOL_NAMES = new Set([
    "read",
    "grep",
    "ls",
    "memory_search",
    "soul_history",
    "soul_diff",
    "web_fetch",
    "web_search",
]);
export function readOnlySubset(tools) {
    return tools.filter((t) => READ_ONLY_TOOL_NAMES.has(t.name));
}
//# sourceMappingURL=registry.js.map