@atlisp/agent 0.1.3 → 0.1.5
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/README.md +215 -0
- package/README.md~ +215 -0
- package/config.js +1 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# @lisp Agent
|
|
2
|
+
|
|
3
|
+
AI Agent for @lisp - 通过 MCP 连接到 CAD 执行 AI 辅助操作。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
### Windows (PowerShell)
|
|
8
|
+
|
|
9
|
+
```powershell
|
|
10
|
+
iwr -useb https://atlisp.cn/install.ps1 | iex
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### 手动安装
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm i -g @atlisp/agent
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 配置
|
|
20
|
+
|
|
21
|
+
配置文件位置: `~/.atlisp/atlisp.json` 或 `~/.atlisp/atlisp.yaml`
|
|
22
|
+
|
|
23
|
+
### 配置示例 (JSON)
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"agent": {
|
|
28
|
+
"enabled": true,
|
|
29
|
+
"maxSteps": 500,
|
|
30
|
+
"verbose": false
|
|
31
|
+
},
|
|
32
|
+
"llm": {
|
|
33
|
+
"provider": "deepseek",
|
|
34
|
+
"baseURL": "",
|
|
35
|
+
"model": "deepseek-v4-flash",
|
|
36
|
+
"apiKey": "sk-xxxxx",
|
|
37
|
+
"temperature": 0.7,
|
|
38
|
+
"maxTokens": 2048
|
|
39
|
+
},
|
|
40
|
+
"mcp": {
|
|
41
|
+
"mode": "stdio",
|
|
42
|
+
"command": "atlisp-mcp",
|
|
43
|
+
"args": ["--stdio"]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 配置示例 (YAML)
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
agent:
|
|
52
|
+
enabled: true
|
|
53
|
+
maxSteps: 10
|
|
54
|
+
verbose: false
|
|
55
|
+
|
|
56
|
+
llm:
|
|
57
|
+
provider: deepseek
|
|
58
|
+
baseURL: ""
|
|
59
|
+
model: deepseek-v4-flash
|
|
60
|
+
apiKey: sk-xxxxx
|
|
61
|
+
temperature: 0.7
|
|
62
|
+
maxTokens: 2048
|
|
63
|
+
|
|
64
|
+
mcp:
|
|
65
|
+
mode: stdio
|
|
66
|
+
command: atlisp-mcp
|
|
67
|
+
args:
|
|
68
|
+
- --stdio
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 配置说明
|
|
72
|
+
|
|
73
|
+
### Agent 配置
|
|
74
|
+
|
|
75
|
+
| 配置项 | 类型 | 默认值 | 说明 |
|
|
76
|
+
|--------|------|--------|------|
|
|
77
|
+
| enabled | boolean | true | 是否启用 agent |
|
|
78
|
+
| maxSteps | number | 10 | 最大执行步数 |
|
|
79
|
+
| verbose | boolean | false | 调试模式 |
|
|
80
|
+
|
|
81
|
+
### LLM 配置
|
|
82
|
+
|
|
83
|
+
| 配置项 | 类型 | 默认值 | 说明 |
|
|
84
|
+
|--------|------|--------|------|
|
|
85
|
+
| provider | string | deepseek | LLM 提供商: deepseek, vllm |
|
|
86
|
+
| baseURL | string | 空 | API 地址(留空使用默认值) |
|
|
87
|
+
| model | string | deepseek-v4-flash | 模型名称 |
|
|
88
|
+
| apiKey | string | 空 | API Key |
|
|
89
|
+
| temperature | number | 0.7 | 温度参数 |
|
|
90
|
+
| maxTokens | number | 2048 | 最大 token 数 |
|
|
91
|
+
|
|
92
|
+
### MCP 配置
|
|
93
|
+
|
|
94
|
+
| 配置项 | 类型 | 默认值 | 说明 |
|
|
95
|
+
|--------|------|--------|------|
|
|
96
|
+
| mode | string | stdio | 连接模式: http, stdio |
|
|
97
|
+
| url | string | http://localhost:8110 | HTTP 模式端点 |
|
|
98
|
+
| command | string | atlisp-mcp | stdio 模式命令 |
|
|
99
|
+
| args | array | ["--stdio"] | stdio 模式参数 |
|
|
100
|
+
|
|
101
|
+
## 环境变量
|
|
102
|
+
|
|
103
|
+
配置可被环境变量覆盖(优先级最高):
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# LLM
|
|
107
|
+
export LLM_PROVIDER=deepseek
|
|
108
|
+
export LLM_MODEL=deepseek-v4-flash
|
|
109
|
+
export DEEPSEEK_API_KEY=sk-xxxxx
|
|
110
|
+
export LLM_TEMPERATURE=0.7
|
|
111
|
+
export LLM_MAX_TOKENS=2048
|
|
112
|
+
|
|
113
|
+
# MCP
|
|
114
|
+
export MCP_MODE=stdio
|
|
115
|
+
export MCP_COMMAND=atlisp-mcp
|
|
116
|
+
export MCP_ARGS="--stdio"
|
|
117
|
+
|
|
118
|
+
# Agent
|
|
119
|
+
export AGENT_VERBOSE=true
|
|
120
|
+
export AGENT_MAX_STEPS=20
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## 使用方式
|
|
124
|
+
|
|
125
|
+
### CLI 交互模式
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
npx atlisp-agent chat
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 单次执行
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
npx atlisp-agent exec "查询 CAD 版本"
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 列出工具
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
npx atlisp-agent tools
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### HTTP Server 模式
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
npm run server
|
|
147
|
+
# 启动在 http://0.0.0.0:8120
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### API 端点
|
|
151
|
+
|
|
152
|
+
| 方法 | 路径 | 说明 |
|
|
153
|
+
|------|------|------|
|
|
154
|
+
| POST | /chat | AI 对话 |
|
|
155
|
+
| POST | /exec | 单次执行 |
|
|
156
|
+
| GET | /tools | 列出工具 |
|
|
157
|
+
| GET | /health | 健康检查 |
|
|
158
|
+
| GET | /history | 获取历史 |
|
|
159
|
+
| DELETE | /history | 清除历史 |
|
|
160
|
+
|
|
161
|
+
### API 调用示例
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
curl -X POST http://localhost:8120/chat \
|
|
165
|
+
-H "Content-Type: application/json" \
|
|
166
|
+
-d '{"message": "查询 CAD 版本"}'
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## MCP 工具
|
|
170
|
+
|
|
171
|
+
| 工具名 | 说明 |
|
|
172
|
+
|--------|------|
|
|
173
|
+
| connect_cad | 连接 CAD |
|
|
174
|
+
| eval_lisp | 执行 LISP 代码(无返回) |
|
|
175
|
+
| eval_lisp_with_result | 执行 LISP 代码(返回结果) |
|
|
176
|
+
| get_cad_info | 获取 CAD 信息 |
|
|
177
|
+
| list_packages | 列出已安装包 |
|
|
178
|
+
| search_packages | 搜索包 |
|
|
179
|
+
| install_package | 安装包 |
|
|
180
|
+
| get_platform_info | 获取平台信息 |
|
|
181
|
+
| at_command | 执行 @lisp 命令 |
|
|
182
|
+
|
|
183
|
+
## LLM Provider
|
|
184
|
+
|
|
185
|
+
### deepseek
|
|
186
|
+
|
|
187
|
+
使用 DeepSeek API。
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"llm": {
|
|
192
|
+
"provider": "deepseek",
|
|
193
|
+
"apiKey": "sk-xxxxx",
|
|
194
|
+
"model": "deepseek-v4-flash"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### vllm
|
|
200
|
+
|
|
201
|
+
使用本地 vLLM 服务器。
|
|
202
|
+
|
|
203
|
+
```json
|
|
204
|
+
{
|
|
205
|
+
"llm": {
|
|
206
|
+
"provider": "vllm",
|
|
207
|
+
"baseURL": "http://192.168.1.8:8001/v1",
|
|
208
|
+
"model": "your-model"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## 许可证
|
|
214
|
+
|
|
215
|
+
ISC
|
package/README.md~
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# @lisp Agent
|
|
2
|
+
|
|
3
|
+
AI Agent for @lisp - 通过 MCP 连接到 CAD 执行 AI 辅助操作。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
### Windows (PowerShell)
|
|
8
|
+
|
|
9
|
+
```powershell
|
|
10
|
+
iwr -useb https://atlisp.cn/install.ps1 | iex
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### 手动安装
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm i -g @atlisp/agent
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 配置
|
|
20
|
+
|
|
21
|
+
配置文件位置: `~/.atlisp/atlisp.json` 或 `~/.atlisp/atlisp.yaml`
|
|
22
|
+
|
|
23
|
+
### 配置示例 (JSON)
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"agent": {
|
|
28
|
+
"enabled": true,
|
|
29
|
+
"maxSteps": 10,
|
|
30
|
+
"verbose": false
|
|
31
|
+
},
|
|
32
|
+
"llm": {
|
|
33
|
+
"provider": "deepseek",
|
|
34
|
+
"baseURL": "",
|
|
35
|
+
"model": "deepseek-v4-flash",
|
|
36
|
+
"apiKey": "sk-xxxxx",
|
|
37
|
+
"temperature": 0.7,
|
|
38
|
+
"maxTokens": 2048
|
|
39
|
+
},
|
|
40
|
+
"mcp": {
|
|
41
|
+
"mode": "stdio",
|
|
42
|
+
"command": "atlisp-mcp",
|
|
43
|
+
"args": ["--stdio"]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 配置示例 (YAML)
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
agent:
|
|
52
|
+
enabled: true
|
|
53
|
+
maxSteps: 10
|
|
54
|
+
verbose: false
|
|
55
|
+
|
|
56
|
+
llm:
|
|
57
|
+
provider: deepseek
|
|
58
|
+
baseURL: ""
|
|
59
|
+
model: deepseek-v4-flash
|
|
60
|
+
apiKey: sk-xxxxx
|
|
61
|
+
temperature: 0.7
|
|
62
|
+
maxTokens: 2048
|
|
63
|
+
|
|
64
|
+
mcp:
|
|
65
|
+
mode: stdio
|
|
66
|
+
command: atlisp-mcp
|
|
67
|
+
args:
|
|
68
|
+
- --stdio
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 配置说明
|
|
72
|
+
|
|
73
|
+
### Agent 配置
|
|
74
|
+
|
|
75
|
+
| 配置项 | 类型 | 默认值 | 说明 |
|
|
76
|
+
|--------|------|--------|------|
|
|
77
|
+
| enabled | boolean | true | 是否启用 agent |
|
|
78
|
+
| maxSteps | number | 10 | 最大执行步数 |
|
|
79
|
+
| verbose | boolean | false | 调试模式 |
|
|
80
|
+
|
|
81
|
+
### LLM 配置
|
|
82
|
+
|
|
83
|
+
| 配置项 | 类型 | 默认值 | 说明 |
|
|
84
|
+
|--------|------|--------|------|
|
|
85
|
+
| provider | string | deepseek | LLM 提供商: deepseek, vllm |
|
|
86
|
+
| baseURL | string | 空 | API 地址(留空使用默认值) |
|
|
87
|
+
| model | string | deepseek-v4-flash | 模型名称 |
|
|
88
|
+
| apiKey | string | 空 | API Key |
|
|
89
|
+
| temperature | number | 0.7 | 温度参数 |
|
|
90
|
+
| maxTokens | number | 2048 | 最大 token 数 |
|
|
91
|
+
|
|
92
|
+
### MCP 配置
|
|
93
|
+
|
|
94
|
+
| 配置项 | 类型 | 默认值 | 说明 |
|
|
95
|
+
|--------|------|--------|------|
|
|
96
|
+
| mode | string | stdio | 连接模式: http, stdio |
|
|
97
|
+
| url | string | http://localhost:8110 | HTTP 模式端点 |
|
|
98
|
+
| command | string | atlisp-mcp | stdio 模式命令 |
|
|
99
|
+
| args | array | ["--stdio"] | stdio 模式参数 |
|
|
100
|
+
|
|
101
|
+
## 环境变量
|
|
102
|
+
|
|
103
|
+
配置可被环境变量覆盖(优先级最高):
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# LLM
|
|
107
|
+
export LLM_PROVIDER=deepseek
|
|
108
|
+
export LLM_MODEL=deepseek-v4-flash
|
|
109
|
+
export DEEPSEEK_API_KEY=sk-xxxxx
|
|
110
|
+
export LLM_TEMPERATURE=0.7
|
|
111
|
+
export LLM_MAX_TOKENS=2048
|
|
112
|
+
|
|
113
|
+
# MCP
|
|
114
|
+
export MCP_MODE=stdio
|
|
115
|
+
export MCP_COMMAND=atlisp-mcp
|
|
116
|
+
export MCP_ARGS="--stdio"
|
|
117
|
+
|
|
118
|
+
# Agent
|
|
119
|
+
export AGENT_VERBOSE=true
|
|
120
|
+
export AGENT_MAX_STEPS=20
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## 使用方式
|
|
124
|
+
|
|
125
|
+
### CLI 交互模式
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
npx atlisp-agent chat
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 单次执行
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
npx atlisp-agent exec "查询 CAD 版本"
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 列出工具
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
npx atlisp-agent tools
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### HTTP Server 模式
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
npm run server
|
|
147
|
+
# 启动在 http://0.0.0.0:8120
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### API 端点
|
|
151
|
+
|
|
152
|
+
| 方法 | 路径 | 说明 |
|
|
153
|
+
|------|------|------|
|
|
154
|
+
| POST | /chat | AI 对话 |
|
|
155
|
+
| POST | /exec | 单次执行 |
|
|
156
|
+
| GET | /tools | 列出工具 |
|
|
157
|
+
| GET | /health | 健康检查 |
|
|
158
|
+
| GET | /history | 获取历史 |
|
|
159
|
+
| DELETE | /history | 清除历史 |
|
|
160
|
+
|
|
161
|
+
### API 调用示例
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
curl -X POST http://localhost:8120/chat \
|
|
165
|
+
-H "Content-Type: application/json" \
|
|
166
|
+
-d '{"message": "查询 CAD 版本"}'
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## MCP 工具
|
|
170
|
+
|
|
171
|
+
| 工具名 | 说明 |
|
|
172
|
+
|--------|------|
|
|
173
|
+
| connect_cad | 连接 CAD |
|
|
174
|
+
| eval_lisp | 执行 LISP 代码(无返回) |
|
|
175
|
+
| eval_lisp_with_result | 执行 LISP 代码(返回结果) |
|
|
176
|
+
| get_cad_info | 获取 CAD 信息 |
|
|
177
|
+
| list_packages | 列出已安装包 |
|
|
178
|
+
| search_packages | 搜索包 |
|
|
179
|
+
| install_package | 安装包 |
|
|
180
|
+
| get_platform_info | 获取平台信息 |
|
|
181
|
+
| at_command | 执行 @lisp 命令 |
|
|
182
|
+
|
|
183
|
+
## LLM Provider
|
|
184
|
+
|
|
185
|
+
### deepseek
|
|
186
|
+
|
|
187
|
+
使用 DeepSeek API。
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"llm": {
|
|
192
|
+
"provider": "deepseek",
|
|
193
|
+
"apiKey": "sk-xxxxx",
|
|
194
|
+
"model": "deepseek-v4-flash"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### vllm
|
|
200
|
+
|
|
201
|
+
使用本地 vLLM 服务器。
|
|
202
|
+
|
|
203
|
+
```json
|
|
204
|
+
{
|
|
205
|
+
"llm": {
|
|
206
|
+
"provider": "vllm",
|
|
207
|
+
"baseURL": "http://192.168.1.8:8001/v1",
|
|
208
|
+
"model": "your-model"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## 许可证
|
|
214
|
+
|
|
215
|
+
ISC
|
package/config.js
CHANGED