const fs = require("fs");
const path = require("path");

const agentsDir = path.join(".", "agents");
const files = fs.readdirSync(agentsDir);
console.log("子Agent文件:", files);

const { SubAgentConfigManager } = require("../src/core/sub-agent-config.js");
const configManager = new SubAgentConfigManager(agentsDir);

// 需要调用 loadAll() 来加载配置
configManager.loadAll();

const configs = configManager.getAll();
console.log("\n加载的子Agent配置:", configs.map(c => c.getName()));

// 测试 getAllConfigs
const configs2 = configManager.getAllConfigs();
console.log("getAllConfigs():", configs2.size, "个");
configs2.forEach((config, name) => {
    console.log(`  - ${name}: valid=${config.isValid()}`);
});

// 测试 orchestrator-demo
const demoConfig = configManager.get("orchestrator-demo");
if (demoConfig) {
    console.log("\norchestrator-demo 配置:");
    console.log("  名称:", demoConfig.getName());
    console.log("  描述:", demoConfig.getDescription());
    console.log("  技能:", demoConfig.getSkills());
    console.log("  工具:", demoConfig.getTools());
    console.log("  模型:", demoConfig.getModel());
} else {
    console.log("\n未找到 orchestrator-demo 配置");
}
