@atlisp/mcp 1.0.24 → 1.0.25
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/package.json +1 -1
- package/src/cad-worker.js +15 -3
- package/src/constants.js +1 -1
package/package.json
CHANGED
package/src/cad-worker.js
CHANGED
|
@@ -135,9 +135,16 @@ const cadSendWithResult = edge.func(function() {/*
|
|
|
135
135
|
tempFile = System.IO.Path.Combine(tempDir, "atlisp_result_" + System.Guid.NewGuid().ToString("N") + ".txt");
|
|
136
136
|
lispFile = System.IO.Path.Combine(tempDir, "atlisp_code_" + System.Guid.NewGuid().ToString("N") + ".lsp");
|
|
137
137
|
|
|
138
|
-
// 生成 LISP
|
|
139
|
-
//
|
|
140
|
-
string lispCode = "(progn
|
|
138
|
+
// 生成 LISP 代码:使用 vl-catch-all-apply 捕获结果和错误
|
|
139
|
+
// 返回 (success . result) 或 (nil . error-msg)
|
|
140
|
+
string lispCode = "(progn"
|
|
141
|
+
+ "(setq f(open \"" + tempFile.Replace("\\", "\\\\") + "\" \"w\"))"
|
|
142
|
+
+ "(setq r(vl-catch-all-apply '(lambda ()(progn " + code + "))))"
|
|
143
|
+
+ "(if (vl-catch-all-error-p r)"
|
|
144
|
+
+ "(princ(strcat \"ERROR:\"(vl-catch-all-error-message r)) f)"
|
|
145
|
+
+ "(princ r f))"
|
|
146
|
+
+ "(close f)"
|
|
147
|
+
+ "(princ))";
|
|
141
148
|
|
|
142
149
|
// 使用系统 ANSI 编码以兼容 GstarCAD / ZWCAD
|
|
143
150
|
System.IO.File.WriteAllText(lispFile, lispCode, System.Text.Encoding.GetEncoding(System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage));
|
|
@@ -185,6 +192,11 @@ const cadSendWithResult = edge.func(function() {/*
|
|
|
185
192
|
|
|
186
193
|
result = enc.GetString(bytes).Trim();
|
|
187
194
|
|
|
195
|
+
// 检查是否有错误前缀
|
|
196
|
+
if (result.StartsWith("ERROR:")) {
|
|
197
|
+
return new { success = false, error = result.Substring(6).Trim() };
|
|
198
|
+
}
|
|
199
|
+
|
|
188
200
|
try { System.IO.File.Delete(tempFile); } catch {}
|
|
189
201
|
try { System.IO.File.Delete(lispFile); } catch {}
|
|
190
202
|
break;
|
package/src/constants.js
CHANGED
|
@@ -8,7 +8,7 @@ export const FILE_EXTENSIONS = {
|
|
|
8
8
|
|
|
9
9
|
export const PROTOCOL_VERSION = '2024-11-05';
|
|
10
10
|
export const SERVER_NAME = 'atlisp-mcp-server';
|
|
11
|
-
export const SERVER_VERSION = '1.0.
|
|
11
|
+
export const SERVER_VERSION = '1.0.25';
|
|
12
12
|
|
|
13
13
|
export const MOCK_PACKAGES = [
|
|
14
14
|
{ name: 'base', description: '基础函数库', version: '1.0.0' },
|