@atlisp/agent 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent.js +2 -2
- package/config.js +8 -4
- package/install.ps1 +8 -0
- package/mcp/stdio-client.js +3 -1
- package/package.json +1 -1
package/agent.js
CHANGED
|
@@ -19,7 +19,7 @@ export class Agent {
|
|
|
19
19
|
return new Promise((resolve, reject) => {
|
|
20
20
|
console.error('[Agent] 正在启动 npx @atlisp/mcp...');
|
|
21
21
|
|
|
22
|
-
const mcpProc = spawn('npx', ['@atlisp/mcp', '--http'], {
|
|
22
|
+
const mcpProc = spawn('npx', ['-y', '@atlisp/mcp', '--http'], {
|
|
23
23
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
24
24
|
detached: true,
|
|
25
25
|
shell: true,
|
|
@@ -98,7 +98,7 @@ export class Agent {
|
|
|
98
98
|
console.error('[错误] 无法连接到 MCP 服务');
|
|
99
99
|
console.error('');
|
|
100
100
|
console.error('请先运行 atlisp-mcp 服务:');
|
|
101
|
-
console.error(' - 方式1: npx atlisp-mcp');
|
|
101
|
+
console.error(' - 方式1: npx -y atlisp-mcp');
|
|
102
102
|
console.error(' - 方式2: 在 CAD 中加载 @lisp 后执行 (@MCP)');
|
|
103
103
|
console.error('========================================\n');
|
|
104
104
|
throw new Error('MCP 服务不可用,请先启动 atlisp-mcp 服务');
|
package/config.js
CHANGED
|
@@ -32,7 +32,7 @@ function getDefaultConfig() {
|
|
|
32
32
|
},
|
|
33
33
|
mcp: {
|
|
34
34
|
mode: 'stdio',
|
|
35
|
-
url: 'http://localhost:
|
|
35
|
+
url: 'http://localhost:8120',
|
|
36
36
|
command: 'atlisp-mcp',
|
|
37
37
|
args: ['--stdio'],
|
|
38
38
|
},
|
|
@@ -71,8 +71,7 @@ function loadConfigFile() {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
return {};
|
|
74
|
+
return null;
|
|
76
75
|
}
|
|
77
76
|
|
|
78
77
|
function deepMerge(target, source) {
|
|
@@ -91,8 +90,13 @@ let config = null;
|
|
|
91
90
|
|
|
92
91
|
function loadConfig() {
|
|
93
92
|
const fileConfig = loadConfigFile();
|
|
94
|
-
let merged = deepMerge(getDefaultConfig(), fileConfig);
|
|
95
93
|
|
|
94
|
+
if (fileConfig === null) {
|
|
95
|
+
const jsonPath = getConfigPath();
|
|
96
|
+
saveDefaultConfig(jsonPath);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
let merged = deepMerge(getDefaultConfig(), fileConfig);
|
|
96
100
|
return merged;
|
|
97
101
|
}
|
|
98
102
|
|
package/install.ps1
CHANGED
|
@@ -218,6 +218,14 @@ function Install-Package {
|
|
|
218
218
|
Test-NpmAvailable
|
|
219
219
|
|
|
220
220
|
Write-Host ""
|
|
221
|
+
Write-Host "Installing @atlisp/mcp from npm registry..." -ForegroundColor Cyan
|
|
222
|
+
npm install -g @atlisp/mcp --silent
|
|
223
|
+
|
|
224
|
+
if ($LASTEXITCODE -ne 0) {
|
|
225
|
+
Write-Host "Error: npm install @atlisp/mcp failed" -ForegroundColor Red
|
|
226
|
+
exit 1
|
|
227
|
+
}
|
|
228
|
+
|
|
221
229
|
Write-Host "Installing $packageName from npm registry..." -ForegroundColor Cyan
|
|
222
230
|
npm install -g @atlisp/agent --silent
|
|
223
231
|
|
package/mcp/stdio-client.js
CHANGED
|
@@ -16,8 +16,10 @@ export class StdioMcpClient {
|
|
|
16
16
|
async connect() {
|
|
17
17
|
return new Promise((resolve, reject) => {
|
|
18
18
|
try {
|
|
19
|
-
|
|
19
|
+
const npxPath = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
|
20
|
+
this.proc = spawn(npxPath, ['-y', this.command, ...this.args], {
|
|
20
21
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
22
|
+
shell: true,
|
|
21
23
|
});
|
|
22
24
|
|
|
23
25
|
this.proc.stdout.on('data', (data) => {
|