/**
 * Composes production toolkits into a duplicate-checked tool bundle.
 */
export class ToolBundleComposer {
    static compose(args) {
        const seenToolkitIds = new Set();
        const seenToolNames = new Set();
        const tools = [];
        for (const toolkit of args.toolkits) {
            if (seenToolkitIds.has(toolkit.id)) {
                throw new Error(`Duplicate toolkit id: ${toolkit.id}`);
            }
            seenToolkitIds.add(toolkit.id);
            const toolkitTools = toolkit.createTools(args.context);
            for (const tool of toolkitTools) {
                if (seenToolNames.has(tool.name)) {
                    throw new Error(`Duplicate tool name from toolkits: ${tool.name}`);
                }
                seenToolNames.add(tool.name);
                tools.push(tool);
            }
        }
        return tools;
    }
}
//# sourceMappingURL=toolkit.js.map