refactor: 系统性移除DACP架构 - 简化框架专注@tool协议
🗑️ 核心清理 - 完全移除DACP服务架构和HTTP模式 - 删除DACPCommand、DACPConfigManager等核心组件 - 清理所有DACP相关文件、测试和文档 - 从CLI移除dacp命令,精简为6大核心锦囊 📁 删除内容 Core: - src/dacp/ - 整个DACP服务目录 - src/lib/core/pouch/commands/DACPCommand.js - src/lib/utils/DACPConfigManager.js Tests: - src/tests/commands/DACPCommand.unit.test.js - src/tests/integration/dacp-integration.test.js - src/tests/e2e/dacp-*-e2e.test.js - src/tests/unit/DACPConfigManager.unit.test.js Scripts & Docs: - scripts/test-*dacp*.js - docs/dacp-*.md - prompt/core/dacp-*.execution.md 🔧 代码清理 CLI: - src/bin/promptx.js: 移除dacp命令和--with-dacp选项 - 帮助信息更新:7大命令→6大核心命令 Core: - src/lib/core/pouch/PouchCLI.js: 移除dacp命令注册 - src/lib/core/pouch/commands/index.js: 清理DACPCommand引用 MCP: - src/lib/mcp/toolDefinitions.js: 移除promptx_dacp工具定义 - src/lib/commands/MCPServerCommand.js: 清理所有DACP方法和引用 - src/lib/commands/MCPStreamableHttpCommand.js: 移除DACP参数映射 Registry: - src/package.registry.json: 自动更新,移除2个DACP execution资源 - package.json: 移除dacp相关npm脚本 📊 架构简化结果 - 资源总数:63个 → 61个 (移除2个DACP execution) - CLI命令:7个 → 6大核心锦囊 - 代码复杂度显著降低,专注核心功能 ✅ 验证通过 - @tool://calculator 计算功能正常: 6 × 7 = 42 - @tool://send-email 邮件工具正常 - MCP Server启动正常 - 所有锦囊命令工作正常 🎯 新架构重点 1. 角色系统 - AI专业能力激活 2. 记忆系统 - 知识学习和回忆 3. @tool协议 - JavaScript工具执行 4. MCP集成 - AI应用连接 💡 技术收益 - 移除HTTP服务复杂度 - 统一@tool协议标准 - 简化维护和扩展 - 提升性能和稳定性 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -1,52 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const { spawn } = require('child_process');
|
||||
const path = require('path');
|
||||
|
||||
// 测试计算器功能
|
||||
async function testCalculator() {
|
||||
console.log('🧪 测试DACP计算器服务...\n');
|
||||
|
||||
const promptxPath = path.join(__dirname, '..', 'src', 'bin', 'promptx.js');
|
||||
|
||||
// 测试案例
|
||||
const testCases = [
|
||||
{
|
||||
name: '简单加法',
|
||||
command: ['node', promptxPath, 'dacp', 'dacp-promptx-service', 'calculate', '{"user_request": "2加3等于多少"}']
|
||||
},
|
||||
{
|
||||
name: '复杂计算',
|
||||
command: ['node', promptxPath, 'dacp', 'dacp-promptx-service', 'calculate', '{"user_request": "(10 + 5) * 2 - 8 / 4"}']
|
||||
},
|
||||
{
|
||||
name: '中文运算符',
|
||||
command: ['node', promptxPath, 'dacp', 'dacp-promptx-service', 'calculate', '{"user_request": "100减去25"}']
|
||||
}
|
||||
];
|
||||
|
||||
for (const testCase of testCases) {
|
||||
console.log(`📝 测试: ${testCase.name}`);
|
||||
console.log(`命令: ${testCase.command.join(' ')}`);
|
||||
|
||||
await new Promise((resolve) => {
|
||||
const child = spawn(testCase.command[0], testCase.command.slice(1), {
|
||||
stdio: 'inherit'
|
||||
});
|
||||
|
||||
child.on('close', (code) => {
|
||||
console.log(`\n✅ 测试完成 (退出码: ${code})\n`);
|
||||
console.log('-'.repeat(60) + '\n');
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 运行测试
|
||||
testCalculator().then(() => {
|
||||
console.log('🎉 所有测试完成!');
|
||||
}).catch(error => {
|
||||
console.error('❌ 测试失败:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
@ -1,79 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* 测试 MCP → PromptX → DACP 完整链路
|
||||
*/
|
||||
|
||||
const { cli } = require('../src/lib/core/pouch');
|
||||
|
||||
async function testDACPIntegration() {
|
||||
console.log('🧪 测试 MCP → PromptX → DACP 集成\n');
|
||||
|
||||
const tests = [
|
||||
{
|
||||
name: '计算器测试',
|
||||
args: {
|
||||
service_id: 'dacp-promptx-service',
|
||||
action: 'calculate',
|
||||
parameters: {
|
||||
user_request: '(100 + 200) * 3'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '邮件测试',
|
||||
args: {
|
||||
service_id: 'dacp-promptx-service',
|
||||
action: 'send_email',
|
||||
parameters: {
|
||||
user_request: '给 boss@company.com 发个项目进展汇报邮件',
|
||||
context: {
|
||||
urgency: 'normal',
|
||||
recipient_type: 'superior'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '日历测试',
|
||||
args: {
|
||||
service_id: 'dacp-promptx-service',
|
||||
action: 'schedule_meeting',
|
||||
parameters: {
|
||||
user_request: '下周一安排团队周会',
|
||||
context: {
|
||||
location: '会议室A'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
for (const test of tests) {
|
||||
console.log(`\n📍 ${test.name}`);
|
||||
console.log('请求:', JSON.stringify(test.args, null, 2));
|
||||
|
||||
try {
|
||||
// 调用 DACP 命令
|
||||
const result = await cli.execute('dacp', [test.args], true);
|
||||
|
||||
if (result.success) {
|
||||
console.log('✅ 成功!');
|
||||
console.log('结果:', JSON.stringify(result.data.execution_result, null, 2));
|
||||
} else {
|
||||
console.log('❌ 失败:', result.error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('❌ 错误:', error.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 运行测试
|
||||
testDACPIntegration().then(() => {
|
||||
console.log('\n✅ 所有测试完成!');
|
||||
process.exit(0);
|
||||
}).catch(error => {
|
||||
console.error('测试失败:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user