"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BUILTIN_TOOL_ENTRIES = exports.ToolRegistry = void 0;
exports.createBuiltinToolRegistry = createBuiltinToolRegistry;
exports.createToolRegistry = createToolRegistry;
const bashTool_1 = require("./bashTool");
const fileTools_1 = require("./fileTools");
const grepTool_1 = require("./grepTool");
const learningTools_1 = require("./learningTools");
const memoryTools_1 = require("./memoryTools");
const multimodalTools_1 = require("./multimodalTools");
const pdfTool_1 = require("./pdfTool");
const curatorTools_1 = require("./curatorTools");
const documentTools_1 = require("./documentTools");
const ragTools_1 = require("./ragTools");
const skillTools_1 = require("./skillTools");
const webFetchTool_1 = require("./webFetchTool");
const webSearchTool_1 = require("./webSearchTool");
const desktopTools_1 = require("./desktopTools");
const desktopInputTools_1 = require("./desktopInputTools");
const browserTools_1 = require("./browserTools");
const skillInstallTool_1 = require("./skillInstallTool");
const skillImportTool_1 = require("./skillImportTool");
const emailTools_1 = require("./emailTools");
const slackTools_1 = require("./slackTools");
const telegramTools_1 = require("./telegramTools");
const recallTool_1 = require("./recallTool");
const calendarTools_1 = require("./calendarTools");
const mcpTools_1 = require("./mcpTools");
const taskTools_1 = require("./taskTools");
const agentTools_1 = require("./agentTools");
const squadTools_1 = require("./squadTools");
const agentManagementTools_1 = require("./agentManagementTools");
const dockerExecTool_1 = require("./dockerExecTool");
class ToolRegistry {
    entries = new Map();
    register(entry) {
        if (this.entries.has(entry.tool.name)) {
            throw new Error(`Tool already registered: ${entry.tool.name}`);
        }
        this.entries.set(entry.tool.name, entry);
    }
    get(name) {
        return this.entries.get(name);
    }
    listEntries() {
        return Array.from(this.entries.values());
    }
    listTools() {
        return this.listEntries().map((entry) => entry.tool);
    }
    listToolsets() {
        return Array.from(new Set(this.listEntries().map((entry) => entry.toolset))).sort();
    }
    listToolsForToolset(toolset) {
        return this.listEntries().filter((entry) => entry.toolset === toolset).map((entry) => entry.tool);
    }
}
exports.ToolRegistry = ToolRegistry;
function createBuiltinToolRegistry() {
    const registry = new ToolRegistry();
    for (const entry of exports.BUILTIN_TOOL_ENTRIES)
        registry.register(entry);
    return registry;
}
function createToolRegistry(projectDir) {
    const registry = createBuiltinToolRegistry();
    if (projectDir) {
        for (const entry of (0, mcpTools_1.createMcpToolEntries)(projectDir))
            registry.register(entry);
        registry.register({ tool: (0, recallTool_1.createRecallTool)(projectDir), toolset: 'memory', source: 'runtime', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'read', canDryRun: false });
    }
    return registry;
}
exports.BUILTIN_TOOL_ENTRIES = [
    { tool: fileTools_1.FileReadTool, toolset: 'files', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'read', canDryRun: false },
    { tool: fileTools_1.FileWriteTool, toolset: 'files', source: 'builtin', enabledByDefault: true, riskLevel: 'high', permissionCategory: 'write', canDryRun: false },
    { tool: fileTools_1.FileEditTool, toolset: 'files', source: 'builtin', enabledByDefault: true, riskLevel: 'high', permissionCategory: 'write', canDryRun: false },
    { tool: fileTools_1.FileMoveTool, toolset: 'files', source: 'builtin', enabledByDefault: true, riskLevel: 'high', permissionCategory: 'write', canDryRun: false },
    { tool: fileTools_1.FileDeleteTool, toolset: 'files', source: 'builtin', enabledByDefault: true, riskLevel: 'high', permissionCategory: 'write', canDryRun: false },
    { tool: fileTools_1.MakeDirectoryTool, toolset: 'files', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'write', canDryRun: false },
    { tool: fileTools_1.ListFilesTool, toolset: 'files', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'read', canDryRun: false },
    { tool: fileTools_1.ListUploadsTool, toolset: 'files', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'read', canDryRun: false },
    { tool: fileTools_1.AddWorkspacePathTool, toolset: 'files', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'read', canDryRun: false },
    { tool: bashTool_1.BashTool, toolset: 'shell', source: 'builtin', enabledByDefault: true, riskLevel: 'high', permissionCategory: 'shell', canDryRun: false },
    { tool: webFetchTool_1.WebFetchTool, toolset: 'web', source: 'builtin', enabledByDefault: true, riskLevel: 'medium', permissionCategory: 'network', canDryRun: false },
    { tool: webSearchTool_1.WebSearchTool, toolset: 'web', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'network', canDryRun: false },
    { tool: webSearchTool_1.WebReadTool, toolset: 'web', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'network', canDryRun: false },
    { tool: grepTool_1.GrepTool, toolset: 'search', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'read', canDryRun: false },
    { tool: skillTools_1.SkillTool, toolset: 'skills', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'skills', canDryRun: false },
    { tool: skillTools_1.ListSkillsTool, toolset: 'skills', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'skills', canDryRun: false },
    { tool: skillTools_1.CreateSkillTool, toolset: 'skills', source: 'builtin', enabledByDefault: true, riskLevel: 'medium', permissionCategory: 'skills', canDryRun: false },
    { tool: memoryTools_1.MemoryWriteTool, toolset: 'memory', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'memory', canDryRun: false },
    { tool: memoryTools_1.MemoryReadTool, toolset: 'memory', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'memory', canDryRun: false },
    { tool: learningTools_1.ReflectTool, toolset: 'learning', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'learning', canDryRun: false },
    { tool: learningTools_1.AnalyzePatternsTool, toolset: 'learning', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'learning', canDryRun: false },
    { tool: learningTools_1.PromotePatternTool, toolset: 'learning', source: 'builtin', enabledByDefault: true, riskLevel: 'medium', permissionCategory: 'learning', canDryRun: false },
    { tool: learningTools_1.ConsolidateTool, toolset: 'learning', source: 'builtin', enabledByDefault: true, riskLevel: 'medium', permissionCategory: 'learning', canDryRun: false },
    { tool: learningTools_1.EvolveTool, toolset: 'learning', source: 'builtin', enabledByDefault: true, riskLevel: 'medium', permissionCategory: 'learning', canDryRun: false },
    { tool: learningTools_1.ImproveSkillTool, toolset: 'learning', source: 'builtin', enabledByDefault: true, riskLevel: 'medium', permissionCategory: 'learning', canDryRun: false },
    { tool: multimodalTools_1.ImageAnalyzeTool, toolset: 'media', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'media', canDryRun: false },
    { tool: multimodalTools_1.AudioTranscribeTool, toolset: 'media', source: 'builtin', enabledByDefault: true, riskLevel: 'medium', permissionCategory: 'media', canDryRun: false },
    { tool: pdfTool_1.PdfReadTool, toolset: 'pdf', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'read', canDryRun: false },
    { tool: pdfTool_1.PdfMetadataTool, toolset: 'pdf', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'read', canDryRun: false },
    { tool: pdfTool_1.PdfRenderPageTool, toolset: 'pdf', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'read', canDryRun: false },
    { tool: pdfTool_1.PdfExtractTablesTool, toolset: 'pdf', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'read', canDryRun: false },
    { tool: ragTools_1.RagSearchTool, toolset: 'rag', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'rag', canDryRun: false },
    { tool: ragTools_1.RagListIndexesTool, toolset: 'rag', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'rag', canDryRun: false },
    { tool: curatorTools_1.CuratorPreviewTool, toolset: 'curator', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'read', canDryRun: false },
    { tool: desktopTools_1.DesktopScreenshotTool, toolset: 'desktop', source: 'builtin', enabledByDefault: false, riskLevel: 'medium', permissionCategory: 'desktop', canDryRun: false },
    { tool: desktopInputTools_1.DesktopInputReplayTool, toolset: 'desktop', source: 'builtin', enabledByDefault: false, riskLevel: 'high', permissionCategory: 'desktop', canDryRun: true },
    { tool: browserTools_1.BrowserBookmarksTool, toolset: 'browser', source: 'builtin', enabledByDefault: false, riskLevel: 'medium', permissionCategory: 'browser', canDryRun: false },
    { tool: browserTools_1.BrowserNavigateTool, toolset: 'browser', source: 'builtin', enabledByDefault: false, riskLevel: 'high', permissionCategory: 'browser', canDryRun: false },
    { tool: browserTools_1.BrowserClickTool, toolset: 'browser', source: 'builtin', enabledByDefault: false, riskLevel: 'high', permissionCategory: 'browser', canDryRun: false },
    { tool: browserTools_1.BrowserFillTool, toolset: 'browser', source: 'builtin', enabledByDefault: false, riskLevel: 'high', permissionCategory: 'browser', canDryRun: false },
    { tool: browserTools_1.BrowserReadTool, toolset: 'browser', source: 'builtin', enabledByDefault: false, riskLevel: 'medium', permissionCategory: 'browser', canDryRun: false },
    { tool: browserTools_1.BrowserScreenshotTool, toolset: 'browser', source: 'builtin', enabledByDefault: false, riskLevel: 'medium', permissionCategory: 'browser', canDryRun: false },
    { tool: browserTools_1.BrowserCloseTool, toolset: 'browser', source: 'builtin', enabledByDefault: false, riskLevel: 'low', permissionCategory: 'browser', canDryRun: false },
    { tool: skillInstallTool_1.InstallSkillTool, toolset: 'skills', source: 'builtin', enabledByDefault: false, riskLevel: 'medium', permissionCategory: 'skills', canDryRun: false },
    { tool: skillImportTool_1.ImportSkillTool, toolset: 'skills', source: 'builtin', enabledByDefault: true, riskLevel: 'medium', permissionCategory: 'skills', canDryRun: false },
    { tool: emailTools_1.EmailDraftTool, toolset: 'communications', source: 'builtin', enabledByDefault: false, riskLevel: 'medium', permissionCategory: 'write', canDryRun: false },
    { tool: emailTools_1.EmailSendTool, toolset: 'communications', source: 'builtin', enabledByDefault: false, riskLevel: 'high', permissionCategory: 'network', canDryRun: false },
    { tool: emailTools_1.EmailInboxTool, toolset: 'communications', source: 'builtin', enabledByDefault: false, riskLevel: 'low', permissionCategory: 'network', canDryRun: false },
    { tool: emailTools_1.EmailDeleteTool, toolset: 'communications', source: 'builtin', enabledByDefault: false, riskLevel: 'high', permissionCategory: 'network', canDryRun: true },
    { tool: slackTools_1.SlackNotifyTool, toolset: 'communications', source: 'builtin', enabledByDefault: false, riskLevel: 'high', permissionCategory: 'network', canDryRun: false },
    { tool: telegramTools_1.TelegramNotifyTool, toolset: 'communications', source: 'builtin', enabledByDefault: false, riskLevel: 'high', permissionCategory: 'network', canDryRun: false },
    { tool: calendarTools_1.CalendarReadTool, toolset: 'communications', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'read', canDryRun: false },
    { tool: calendarTools_1.CalendarWriteTool, toolset: 'communications', source: 'builtin', enabledByDefault: false, riskLevel: 'medium', permissionCategory: 'write', canDryRun: false },
    { tool: documentTools_1.DocumentExportTool, toolset: 'documents', source: 'builtin', enabledByDefault: true, riskLevel: 'medium', permissionCategory: 'write', canDryRun: false },
    { tool: taskTools_1.TaskManageTool, toolset: 'tasks', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'memory', canDryRun: false },
    { tool: taskTools_1.TaskProgressTool, toolset: 'tasks', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'memory', canDryRun: false },
    { tool: agentTools_1.CreateCustomAgentTool, toolset: 'agents', source: 'builtin', enabledByDefault: true, riskLevel: 'medium', permissionCategory: 'skills', canDryRun: false },
    { tool: agentManagementTools_1.ListAgentsTool, toolset: 'agents', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'read', canDryRun: false },
    { tool: agentManagementTools_1.DeleteAgentTool, toolset: 'agents', source: 'builtin', enabledByDefault: true, riskLevel: 'medium', permissionCategory: 'skills', canDryRun: false },
    { tool: agentManagementTools_1.CreateSquadTool, toolset: 'agents', source: 'builtin', enabledByDefault: true, riskLevel: 'medium', permissionCategory: 'skills', canDryRun: false },
    { tool: agentManagementTools_1.UpdateSquadTool, toolset: 'agents', source: 'builtin', enabledByDefault: true, riskLevel: 'medium', permissionCategory: 'skills', canDryRun: false },
    { tool: agentManagementTools_1.DeleteSquadTool, toolset: 'agents', source: 'builtin', enabledByDefault: true, riskLevel: 'medium', permissionCategory: 'skills', canDryRun: false },
    { tool: agentManagementTools_1.SquadRouteTool, toolset: 'agents', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'read', canDryRun: false },
    { tool: squadTools_1.SquadInspectTool, toolset: 'agents', source: 'builtin', enabledByDefault: true, riskLevel: 'low', permissionCategory: 'read', canDryRun: false },
    { tool: (0, dockerExecTool_1.createDockerExecTool)(), toolset: 'shell', source: 'builtin', enabledByDefault: false, riskLevel: 'high', permissionCategory: 'shell', canDryRun: false },
];
//# sourceMappingURL=registry.js.map