feat: 添加DACP服务启动脚本和测试命令,更新相关依赖,优化配置文件路径处理

This commit is contained in:
sean
2025-06-19 16:46:12 +08:00
parent 90c4e5d8ab
commit d16d425fa0
4 changed files with 9 additions and 24 deletions

View File

@ -1,22 +0,0 @@
{
"name": "dacp-promptx-service",
"version": "1.0.0",
"description": "Unified DACP service with multiple demo actions for PromptX",
"main": "server.js",
"scripts": {
"start": "node server.js",
"dev": "node server.js",
"test": "jest"
},
"dependencies": {
"body-parser": "^1.20.2",
"cors": "^2.8.5",
"express": "^4.18.2",
"joi": "^17.11.0",
"nodemailer": "^7.0.3"
},
"devDependencies": {
"jest": "^29.7.0",
"supertest": "^6.3.3"
}
}

View File

@ -5,7 +5,7 @@ const fs = require('fs');
const path = require('path');
const app = express();
const config = JSON.parse(fs.readFileSync('./dacp.config.json', 'utf8'));
const config = JSON.parse(fs.readFileSync(path.join(__dirname, 'dacp.config.json'), 'utf8'));
const PORT = process.env.PORT || config.deployment.port || 3002;
// Middleware

View File

@ -311,7 +311,7 @@ class MCPServerCommand {
// 启动DACP服务作为子进程
// 注意:不能直接使用 'inherit'因为会干扰MCP的stdio通信
// 但我们需要看到DACP的启动信息
this.dacpProcess = spawn('npm', ['start'], {
this.dacpProcess = spawn('node', ['server.js'], {
cwd: dacpPath,
stdio: ['ignore', 'pipe', 'pipe'], // stdin忽略, stdout和stderr都输出到pipe
shell: true,