"use strict";
/**
 * Tool composer for the built-in agent (#626).
 *
 * Operator-only tools (FS, schedule, fetch) are inline today. Once the
 * unified MCP tool registry (#615) lands with the Operations (#617) and
 * Application (#618) profiles, this is the seam where RBAC-filtered
 * registry tools get folded in for the agent's configured user. The shape
 * of {@link composeToolset} won't change — only the body gains a registry
 * lookup.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.composeToolset = composeToolset;
exports.toolMapByName = toolMapByName;
const fsTools_ts_1 = require("./tools/fsTools.js");
const httpFetchTool_ts_1 = require("./tools/httpFetchTool.js");
const scheduleTool_ts_1 = require("./tools/scheduleTool.js");
function composeToolset(opts) {
    const schedule = (0, scheduleTool_ts_1.buildScheduleTool)(opts);
    const all = [...fsTools_ts_1.fsTools, httpFetchTool_ts_1.httpFetchTool, schedule.tool, ...(opts.extraTools ?? [])];
    const tools = opts.allowDestructive === false ? all.filter((t) => !t.destructive) : all;
    return { tools, scheduled: schedule.pending };
}
function toolMapByName(tools) {
    const map = new Map();
    for (const tool of tools) {
        if (map.has(tool.def.name))
            throw new Error(`Duplicate tool registered: ${tool.def.name}`);
        map.set(tool.def.name, tool);
    }
    return map;
}
//# sourceMappingURL=toolset.js.map