ai-helper-agent 1.14.7 → 1.14.9
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 +199 -197
- package/README.zh-CN.md +372 -0
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -1,115 +1,117 @@
|
|
|
1
|
+
> [English](./README.md) | [中文](./README.zh-CN.md)
|
|
2
|
+
|
|
1
3
|
# AI Helper Agent
|
|
2
4
|
|
|
3
|
-
AI Helper
|
|
5
|
+
AI Helper Agent — a local proxy service that provides the [AI Helper Chrome Extension](https://github.com/xiweicheng/ai-helper) with local file read/write, system command execution, Skill system, and MCP protocol extension capabilities.
|
|
4
6
|
|
|
5
|
-
##
|
|
7
|
+
## Installation
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
10
|
npm install -g ai-helper-agent
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
Requires Node.js >= 18.0.0.
|
|
12
14
|
|
|
13
|
-
##
|
|
15
|
+
## Quick Start
|
|
14
16
|
|
|
15
17
|
```bash
|
|
16
|
-
#
|
|
18
|
+
# Start in foreground (real-time logs in terminal, ideal for debugging)
|
|
17
19
|
ai-helper-agent start
|
|
18
20
|
|
|
19
|
-
#
|
|
21
|
+
# Start in background (daemon mode, terminal returns immediately)
|
|
20
22
|
ai-helper-agent start --background
|
|
21
23
|
ai-helper-agent start -b
|
|
22
24
|
|
|
23
|
-
#
|
|
25
|
+
# Specify work directory and port
|
|
24
26
|
ai-helper-agent start --workdir /path/to/your/project --port 18911
|
|
25
27
|
```
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
After startup, the terminal will display a 4-digit pairing code. Enter it in the "Agent" tab of the Chrome extension settings page to complete pairing.
|
|
28
30
|
|
|
29
|
-
## CLI
|
|
31
|
+
## CLI Commands
|
|
30
32
|
|
|
31
|
-
|
|
|
32
|
-
|
|
33
|
-
| `start` |
|
|
34
|
-
| `start --background` / `start -b` |
|
|
35
|
-
| `stop` |
|
|
36
|
-
| `restart` |
|
|
37
|
-
| `status` |
|
|
38
|
-
| `paircode` |
|
|
39
|
-
| `config` |
|
|
40
|
-
| `help` |
|
|
41
|
-
| `--version` / `-v` |
|
|
33
|
+
| Command | Description |
|
|
34
|
+
|---------|-------------|
|
|
35
|
+
| `start` | Start the agent service (foreground, with real-time logs) |
|
|
36
|
+
| `start --background` / `start -b` | Start in background (daemon mode) |
|
|
37
|
+
| `stop` | Stop the running agent |
|
|
38
|
+
| `restart` | Restart the agent service (supports -b for background restart) |
|
|
39
|
+
| `status` | Check running status |
|
|
40
|
+
| `paircode` | Show pairing code |
|
|
41
|
+
| `config` | View current configuration |
|
|
42
|
+
| `help` | Show help information |
|
|
43
|
+
| `--version` / `-v` | Show version number |
|
|
42
44
|
|
|
43
|
-
###
|
|
45
|
+
### Startup Options
|
|
44
46
|
|
|
45
47
|
```
|
|
46
|
-
--background, -b
|
|
47
|
-
--port
|
|
48
|
-
--host
|
|
49
|
-
--workdir
|
|
48
|
+
--background, -b Run in background (daemon mode)
|
|
49
|
+
--port <port> Listen port, default 18910
|
|
50
|
+
--host <address> Listen address, default 127.0.0.1
|
|
51
|
+
--workdir <dir> Work directory (file read/write restricted to this scope)
|
|
50
52
|
```
|
|
51
53
|
|
|
52
|
-
###
|
|
54
|
+
### Foreground vs Background
|
|
53
55
|
|
|
54
|
-
|
|
|
55
|
-
|
|
56
|
-
|
|
|
57
|
-
|
|
|
56
|
+
| Mode | Command | Terminal Behavior | Use Case |
|
|
57
|
+
|------|---------|-------------------|----------|
|
|
58
|
+
| Foreground | `start` | Blocks terminal, shows real-time logs | Development, debugging |
|
|
59
|
+
| Background | `start --background` | Returns immediately, no log output | Production, daily use |
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
When running in foreground, all file read/write, command execution, and security interception logs are output in real-time in a formatted manner:
|
|
60
62
|
|
|
61
63
|
```
|
|
62
|
-
[12:30:01] [INFO] [
|
|
63
|
-
[12:30:05] [INFO] [
|
|
64
|
-
[12:30:12] [INFO] [
|
|
65
|
-
[12:31:00] [WARN] [
|
|
64
|
+
[12:30:01] [INFO] [File:read] path=/project/src/index.js size=2048
|
|
65
|
+
[12:30:05] [INFO] [Command:started] command="npm test" cwd=/project execId=a1b2c3d4
|
|
66
|
+
[12:30:12] [INFO] [Command:completed] execId=a1b2c3d4 exitCode=0 killed=false
|
|
67
|
+
[12:31:00] [WARN] [Security:exec_denied] command="rm -rf /" reason=High-risk command blocked
|
|
66
68
|
```
|
|
67
69
|
|
|
68
|
-
###
|
|
70
|
+
### Process Management
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
The agent manages process lifecycle via a PID file (`~/.ai-helper-agent/agent.pid`):
|
|
71
73
|
|
|
72
|
-
-
|
|
73
|
-
- `stop`
|
|
74
|
-
-
|
|
74
|
+
- Automatically writes PID file on startup
|
|
75
|
+
- `stop` command prefers graceful shutdown via API, falls back to killing process via PID file
|
|
76
|
+
- Automatically cleans up PID file on normal shutdown
|
|
75
77
|
|
|
76
|
-
##
|
|
78
|
+
## Security
|
|
77
79
|
|
|
78
|
-
###
|
|
80
|
+
### File Sandbox
|
|
79
81
|
|
|
80
|
-
|
|
82
|
+
All file operations are restricted to directories listed in the `allowedPaths` whitelist. `realpath` resolution prevents symlink bypasses, ensuring physical paths are safe.
|
|
81
83
|
|
|
82
|
-
###
|
|
84
|
+
### Command Tiered Control
|
|
83
85
|
|
|
84
|
-
|
|
86
|
+
**Blacklist** — Blocked directly, cannot be bypassed:
|
|
85
87
|
|
|
86
|
-
|
|
|
87
|
-
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
| Shell
|
|
88
|
+
| Type | Examples |
|
|
89
|
+
|------|----------|
|
|
90
|
+
| Disk destruction | `rm -rf /`, `mkfs.*`, `dd if=... of=/dev/...` |
|
|
91
|
+
| System file overwrite | `> /etc/passwd`, `> /etc/shadow` |
|
|
92
|
+
| Malicious pipe execution | `curl ... \| bash`, `git clone ... \| sh` |
|
|
93
|
+
| Shell injection | Backticks, `$()`, `${}` command substitution |
|
|
92
94
|
| Fork bomb | `:(){ :\|:& };:` |
|
|
93
95
|
|
|
94
|
-
|
|
96
|
+
**Greylist** — Requires user confirmation before execution:
|
|
95
97
|
|
|
96
|
-
|
|
|
97
|
-
|
|
98
|
-
| `sudo ...` |
|
|
99
|
-
| `npm install -g ...` |
|
|
100
|
-
| `pip install/uninstall` | Python
|
|
101
|
-
| `chmod -R 777` |
|
|
102
|
-
| `rm -rf ...` |
|
|
103
|
-
| `git push --force` |
|
|
104
|
-
| `shutdown/reboot` |
|
|
98
|
+
| Command Pattern | Reason |
|
|
99
|
+
|-----------------|--------|
|
|
100
|
+
| `sudo ...` | Requires admin privileges |
|
|
101
|
+
| `npm install -g ...` | Global package installation |
|
|
102
|
+
| `pip install/uninstall` | Python package management |
|
|
103
|
+
| `chmod -R 777` | Recursive permission modification |
|
|
104
|
+
| `rm -rf ...` | Recursive forced deletion |
|
|
105
|
+
| `git push --force` | Force push |
|
|
106
|
+
| `shutdown/reboot` | System shutdown/restart |
|
|
105
107
|
|
|
106
|
-
###
|
|
108
|
+
### Authentication
|
|
107
109
|
|
|
108
|
-
|
|
110
|
+
Pairing is completed by entering the 4-digit pairing code displayed in the terminal into the extension. The pairing code rotates every 30 seconds. After successful pairing, an HMAC token is used for subsequent request authentication, stored in `~/.ai-helper-agent/pairings.json`.
|
|
109
111
|
|
|
110
|
-
##
|
|
112
|
+
## Configuration
|
|
111
113
|
|
|
112
|
-
|
|
114
|
+
Configuration file path: `~/.ai-helper-agent/config.json`
|
|
113
115
|
|
|
114
116
|
```json
|
|
115
117
|
{
|
|
@@ -123,209 +125,209 @@ Agent 通过 PID 文件(`~/.ai-helper-agent/agent.pid`)管理进程生命周
|
|
|
123
125
|
}
|
|
124
126
|
```
|
|
125
127
|
|
|
126
|
-
|
|
|
127
|
-
|
|
128
|
-
| `port` |
|
|
129
|
-
| `host` |
|
|
130
|
-
| `workdir` |
|
|
131
|
-
| `allowedPaths` |
|
|
132
|
-
| `pairCodeTTL` |
|
|
133
|
-
| `commandTimeout` |
|
|
134
|
-
| `fileMaxSize` |
|
|
128
|
+
| Field | Description | Default |
|
|
129
|
+
|-------|-------------|---------|
|
|
130
|
+
| `port` | Listen port | 18910 |
|
|
131
|
+
| `host` | Listen address | 127.0.0.1 |
|
|
132
|
+
| `workdir` | Default work directory | Current directory at startup |
|
|
133
|
+
| `allowedPaths` | Additional allowed directory list | `[]` |
|
|
134
|
+
| `pairCodeTTL` | Pairing code validity (seconds) | 30 |
|
|
135
|
+
| `commandTimeout` | Command execution timeout (ms) | 300000 (5 min) |
|
|
136
|
+
| `fileMaxSize` | Max file read/write size (bytes) | 52428800 (50 MB) |
|
|
135
137
|
|
|
136
|
-
##
|
|
138
|
+
## File Search
|
|
137
139
|
|
|
138
|
-
|
|
140
|
+
The agent prefers native system search tools, with automatic fallback to Node.js implementation when unavailable:
|
|
139
141
|
|
|
140
|
-
|
|
|
141
|
-
|
|
142
|
-
| `fd` |
|
|
143
|
-
| `rg` (ripgrep) |
|
|
142
|
+
| Engine | Purpose | Detection Command |
|
|
143
|
+
|--------|---------|-------------------|
|
|
144
|
+
| `fd` | Filename search (fast) | `fd --version` |
|
|
145
|
+
| `rg` (ripgrep) | File content search (fast) | `rg --version` |
|
|
144
146
|
|
|
145
|
-
|
|
147
|
+
The status endpoint reports currently available search tools:
|
|
146
148
|
|
|
147
149
|
```json
|
|
148
150
|
{ "searchTools": { "fd": true, "rg": true } }
|
|
149
151
|
```
|
|
150
152
|
|
|
151
|
-
##
|
|
153
|
+
## Audit Logs
|
|
152
154
|
|
|
153
|
-
|
|
155
|
+
All operations are automatically recorded in audit logs, located in `~/.ai-helper-agent/logs/`.
|
|
154
156
|
|
|
155
|
-
###
|
|
157
|
+
### Dual Channel Output
|
|
156
158
|
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
+
- **Terminal output** (foreground mode): Formatted human-readable output to stderr
|
|
160
|
+
- **File output**: JSON Lines format, written to log files
|
|
159
161
|
|
|
160
|
-
|
|
162
|
+
Both channels work simultaneously without interfering with each other.
|
|
161
163
|
|
|
162
|
-
###
|
|
164
|
+
### Log Format
|
|
163
165
|
|
|
164
|
-
JSON Lines
|
|
166
|
+
JSON Lines format, one record per line, files named by date `agent-YYYY-MM-DD.log`.
|
|
165
167
|
|
|
166
168
|
```json
|
|
167
169
|
{"timestamp":"2026-01-15T10:30:00.123Z","level":"info","category":"fs","action":"read","path":"/home/user/project/src/index.js","size":2048}
|
|
168
170
|
{"timestamp":"2026-01-15T10:30:05.456Z","level":"info","category":"exec","action":"completed","command":"npm test","cwd":"/home/user/project","execId":"a1b2c3d4","exitCode":0,"killed":false,"stdoutLen":1024,"stderrLen":0}
|
|
169
|
-
{"timestamp":"2026-01-15T10:31:00.789Z","level":"warn","category":"security","action":"exec_denied","command":"rm -rf /","reason":"
|
|
171
|
+
{"timestamp":"2026-01-15T10:31:00.789Z","level":"warn","category":"security","action":"exec_denied","command":"rm -rf /","reason":"High-risk command blocked"}
|
|
170
172
|
```
|
|
171
173
|
|
|
172
|
-
###
|
|
174
|
+
### Log Categories
|
|
173
175
|
|
|
174
|
-
|
|
|
175
|
-
|
|
176
|
-
| `auth` |
|
|
177
|
-
| `fs` |
|
|
178
|
-
| `exec` |
|
|
179
|
-
| `security` |
|
|
180
|
-
| `system` |
|
|
176
|
+
| Category | Description | Included Actions |
|
|
177
|
+
|----------|-------------|-----------------|
|
|
178
|
+
| `auth` | Authentication events | Pairing success/failure |
|
|
179
|
+
| `fs` | File operations | read, write, list, delete, search_files, search_content |
|
|
180
|
+
| `exec` | Command execution | started, completed, stopped, error |
|
|
181
|
+
| `security` | Security events | deny, confirm, auth failure, path breach interception |
|
|
182
|
+
| `system` | System events | server_start, server_stop, shutdown, server_error, uncaught_exception, unhandled_rejection |
|
|
181
183
|
|
|
182
|
-
###
|
|
184
|
+
### Log Query API
|
|
183
185
|
|
|
184
186
|
```
|
|
185
187
|
GET /api/logs?date=2026-01-15&category=security&limit=50&offset=0
|
|
186
188
|
GET /api/logs/dates
|
|
187
189
|
```
|
|
188
190
|
|
|
189
|
-
- `date` -
|
|
190
|
-
- `category` -
|
|
191
|
-
- `limit` -
|
|
192
|
-
- `offset` -
|
|
191
|
+
- `date` - Date filter (YYYY-MM-DD), defaults to today
|
|
192
|
+
- `category` - Category filter, returns all if omitted
|
|
193
|
+
- `limit` - Max number of records returned, defaults to 200
|
|
194
|
+
- `offset` - Pagination offset
|
|
193
195
|
|
|
194
|
-
|
|
196
|
+
Results are returned in reverse chronological order (newest first).
|
|
195
197
|
|
|
196
|
-
###
|
|
198
|
+
### Auto Cleanup
|
|
197
199
|
|
|
198
|
-
-
|
|
199
|
-
-
|
|
200
|
-
-
|
|
200
|
+
- Maximum 30 log files retained
|
|
201
|
+
- Single files exceeding 10 MB are automatically deleted
|
|
202
|
+
- Cleanup check triggered on every log write
|
|
201
203
|
|
|
202
|
-
## API
|
|
204
|
+
## API Endpoints
|
|
203
205
|
|
|
204
|
-
###
|
|
206
|
+
### No Authentication Required
|
|
205
207
|
|
|
206
|
-
|
|
|
207
|
-
|
|
208
|
-
| POST | `/api/pair` |
|
|
209
|
-
| GET | `/api/status` |
|
|
210
|
-
| POST | `/api/shutdown` |
|
|
208
|
+
| Method | Path | Description |
|
|
209
|
+
|--------|------|-------------|
|
|
210
|
+
| POST | `/api/pair` | Pairing authentication |
|
|
211
|
+
| GET | `/api/status` | Health check (version, platform info, search tool availability) |
|
|
212
|
+
| POST | `/api/shutdown` | Shut down the agent service (local access only) |
|
|
211
213
|
|
|
212
|
-
###
|
|
214
|
+
### Authentication Required (Bearer Token)
|
|
213
215
|
|
|
214
|
-
|
|
|
215
|
-
|
|
216
|
-
| POST | `/api/fs/read` |
|
|
217
|
-
| POST | `/api/fs/write` |
|
|
218
|
-
| POST | `/api/fs/list` |
|
|
219
|
-
| POST | `/api/fs/delete` |
|
|
220
|
-
| POST | `/api/fs/search_files` |
|
|
221
|
-
| POST | `/api/fs/search_content` |
|
|
222
|
-
| POST | `/api/exec` |
|
|
223
|
-
| POST | `/api/exec/stop` |
|
|
224
|
-
| GET | `/api/exec/running` |
|
|
225
|
-
| GET | `/api/status/detail` |
|
|
226
|
-
| GET | `/api/logs` |
|
|
227
|
-
| GET | `/api/logs/dates` |
|
|
216
|
+
| Method | Path | Description |
|
|
217
|
+
|--------|------|-------------|
|
|
218
|
+
| POST | `/api/fs/read` | Read file content |
|
|
219
|
+
| POST | `/api/fs/write` | Write file |
|
|
220
|
+
| POST | `/api/fs/list` | List directory |
|
|
221
|
+
| POST | `/api/fs/delete` | Delete file/directory |
|
|
222
|
+
| POST | `/api/fs/search_files` | Search files by name pattern (glob) |
|
|
223
|
+
| POST | `/api/fs/search_content` | Search file content (rg preferred, Node.js fallback) |
|
|
224
|
+
| POST | `/api/exec` | Execute system command |
|
|
225
|
+
| POST | `/api/exec/stop` | Stop command execution |
|
|
226
|
+
| GET | `/api/exec/running` | List running processes |
|
|
227
|
+
| GET | `/api/status/detail` | Detailed info (work directory, pairing code, search tools) |
|
|
228
|
+
| GET | `/api/logs` | Query audit logs (supports date/category/limit/offset params) |
|
|
229
|
+
| GET | `/api/logs/dates` | Get available log date list |
|
|
228
230
|
|
|
229
231
|
### WebSocket
|
|
230
232
|
|
|
231
|
-
|
|
|
232
|
-
|
|
233
|
-
| `ws://127.0.0.1:18910/ws/exec/:execId` |
|
|
233
|
+
| Path | Description |
|
|
234
|
+
|------|-------------|
|
|
235
|
+
| `ws://127.0.0.1:18910/ws/exec/:execId` | Real-time command execution output stream |
|
|
234
236
|
|
|
235
|
-
##
|
|
237
|
+
## Robustness
|
|
236
238
|
|
|
237
|
-
|
|
239
|
+
The agent has built-in multi-layer exception protection to prevent a single error from crashing the entire service:
|
|
238
240
|
|
|
239
|
-
-
|
|
240
|
-
- **URL
|
|
241
|
-
-
|
|
242
|
-
-
|
|
243
|
-
-
|
|
244
|
-
-
|
|
241
|
+
- **Request-level protection**: Each HTTP request handler is wrapped with exception catching, returns 500 instead of crashing
|
|
242
|
+
- **URL parsing protection**: Malformed URLs don't crash the process, returns 400
|
|
243
|
+
- **Server-level protection**: Server errors like port conflicts are handled gracefully
|
|
244
|
+
- **Global fallback**: `uncaughtException` and `unhandledRejection` global handlers, logs errors but doesn't exit the process
|
|
245
|
+
- **File I/O protection**: Config file read/write failures don't affect service operation
|
|
246
|
+
- **Process management protection**: `SIGTERM`/`SIGKILL` sending has try-catch protection for already-exited processes
|
|
245
247
|
|
|
246
|
-
## Skill
|
|
248
|
+
## Skill System
|
|
247
249
|
|
|
248
|
-
|
|
250
|
+
The agent has a built-in Skill system that allows codifying workflows into reusable skills.
|
|
249
251
|
|
|
250
|
-
### Skill
|
|
252
|
+
### Skill Types
|
|
251
253
|
|
|
252
|
-
|
|
|
253
|
-
|
|
254
|
-
| **Workflow Skill** | JSON/YAML |
|
|
255
|
-
| **Agent Skill** | SKILL.md | AI
|
|
254
|
+
| Type | Definition Format | Execution | Purpose |
|
|
255
|
+
|------|-------------------|-----------|---------|
|
|
256
|
+
| **Workflow Skill** | JSON/YAML | Direct execution | Automated workflows, step-by-step |
|
|
257
|
+
| **Agent Skill** | SKILL.md | AI autonomous invocation | Knowledge codification, triggered in conversation |
|
|
256
258
|
|
|
257
|
-
### Skill
|
|
259
|
+
### Skill Directory Structure
|
|
258
260
|
|
|
259
|
-
|
|
261
|
+
All skills are stored in `~/.ai-helper-agent/skills/`:
|
|
260
262
|
|
|
261
263
|
```
|
|
262
264
|
~/.ai-helper-agent/skills/
|
|
263
|
-
├── workflow-skill.json # Workflow Skill
|
|
264
|
-
├── another-skill.yaml # Workflow Skill
|
|
265
|
-
└── agent-skill/ # Agent Skill
|
|
266
|
-
├── SKILL.md #
|
|
267
|
-
└── _meta.json #
|
|
265
|
+
├── workflow-skill.json # Workflow Skill (JSON format)
|
|
266
|
+
├── another-skill.yaml # Workflow Skill (YAML format)
|
|
267
|
+
└── agent-skill/ # Agent Skill (directory form)
|
|
268
|
+
├── SKILL.md # Skill definition file
|
|
269
|
+
└── _meta.json # Metadata (optional)
|
|
268
270
|
```
|
|
269
271
|
|
|
270
|
-
### SKILL.md
|
|
272
|
+
### SKILL.md Format
|
|
271
273
|
|
|
272
274
|
```markdown
|
|
273
275
|
---
|
|
274
276
|
name: <skill-name>
|
|
275
|
-
description: "
|
|
277
|
+
description: "<Brief description including: (1) what the skill does, (2) when to trigger>"
|
|
276
278
|
enabled: true
|
|
277
279
|
---
|
|
278
280
|
|
|
279
|
-
#
|
|
281
|
+
# <Skill Title>
|
|
280
282
|
|
|
281
283
|
## When to Use This Skill
|
|
282
284
|
|
|
283
|
-
-
|
|
284
|
-
-
|
|
285
|
+
- Trigger condition 1
|
|
286
|
+
- Trigger condition 2
|
|
285
287
|
|
|
286
288
|
## Core Capabilities
|
|
287
289
|
|
|
288
|
-
-
|
|
289
|
-
-
|
|
290
|
+
- Capability 1
|
|
291
|
+
- Capability 2
|
|
290
292
|
|
|
291
293
|
## Usage
|
|
292
294
|
|
|
293
295
|
### Step-by-Step
|
|
294
296
|
|
|
295
|
-
1.
|
|
296
|
-
2.
|
|
297
|
+
1. Step 1
|
|
298
|
+
2. Step 2
|
|
297
299
|
|
|
298
300
|
## Examples
|
|
299
301
|
|
|
300
|
-
[
|
|
302
|
+
[Concrete examples]
|
|
301
303
|
|
|
302
304
|
## Source
|
|
303
305
|
|
|
304
|
-
|
|
306
|
+
Codified from conversation, created: YYYY-MM-DD
|
|
305
307
|
```
|
|
306
308
|
|
|
307
|
-
###
|
|
309
|
+
### Built-in Skills
|
|
308
310
|
|
|
309
|
-
- **skill-creator
|
|
311
|
+
- **skill-creator**: Meta-skill for creating and updating other skills from conversations
|
|
310
312
|
|
|
311
313
|
### Skill API
|
|
312
314
|
|
|
313
|
-
|
|
|
314
|
-
|
|
315
|
-
| GET | `/api/skill/list` |
|
|
316
|
-
| GET | `/api/skill/:name` |
|
|
317
|
-
| POST | `/api/skill/import` |
|
|
318
|
-
| POST | `/api/skill/:name/toggle` |
|
|
319
|
-
| DELETE | `/api/skill/:name` |
|
|
320
|
-
| POST | `/api/skill/:name/run` |
|
|
315
|
+
| Method | Path | Description |
|
|
316
|
+
|--------|------|-------------|
|
|
317
|
+
| GET | `/api/skill/list` | Get all skills list |
|
|
318
|
+
| GET | `/api/skill/:name` | Get a single skill's full definition |
|
|
319
|
+
| POST | `/api/skill/import` | Import a new skill |
|
|
320
|
+
| POST | `/api/skill/:name/toggle` | Toggle enable/disable status |
|
|
321
|
+
| DELETE | `/api/skill/:name` | Delete a skill |
|
|
322
|
+
| POST | `/api/skill/:name/run` | Execute a workflow skill |
|
|
321
323
|
|
|
322
|
-
## MCP
|
|
324
|
+
## MCP Protocol Extension
|
|
323
325
|
|
|
324
|
-
|
|
326
|
+
Supports Model Context Protocol (MCP) to extend third-party tool capabilities.
|
|
325
327
|
|
|
326
|
-
### MCP Server
|
|
328
|
+
### MCP Server Configuration
|
|
327
329
|
|
|
328
|
-
|
|
330
|
+
Configuration file path: `~/.ai-helper-agent/config.json`
|
|
329
331
|
|
|
330
332
|
```json
|
|
331
333
|
{
|
|
@@ -342,28 +344,28 @@ enabled: true
|
|
|
342
344
|
|
|
343
345
|
### MCP API
|
|
344
346
|
|
|
345
|
-
|
|
|
346
|
-
|
|
347
|
-
| GET | `/api/mcp/status` |
|
|
348
|
-
| POST | `/api/mcp/:serverId/connect` |
|
|
349
|
-
| POST | `/api/mcp/:serverId/disconnect` |
|
|
350
|
-
| GET | `/api/mcp/tools` |
|
|
347
|
+
| Method | Path | Description |
|
|
348
|
+
|--------|------|-------------|
|
|
349
|
+
| GET | `/api/mcp/status` | Get all MCP server statuses |
|
|
350
|
+
| POST | `/api/mcp/:serverId/connect` | Connect to specified MCP server |
|
|
351
|
+
| POST | `/api/mcp/:serverId/disconnect` | Disconnect |
|
|
352
|
+
| GET | `/api/mcp/tools` | Get all MCP tools list |
|
|
351
353
|
|
|
352
|
-
###
|
|
354
|
+
### How It Works
|
|
353
355
|
|
|
354
|
-
1. Agent
|
|
355
|
-
2.
|
|
356
|
-
3.
|
|
357
|
-
4.
|
|
358
|
-
5.
|
|
356
|
+
1. Agent auto-connects all enabled MCP servers on startup
|
|
357
|
+
2. Establishes JSON-RPC 2.0 communication via stdio
|
|
358
|
+
3. Auto-discover tools provided by MCP servers
|
|
359
|
+
4. Tool call requests are forwarded to MCP servers via the agent
|
|
360
|
+
5. Tool results are returned to the extension
|
|
359
361
|
|
|
360
|
-
##
|
|
362
|
+
## Tech Stack
|
|
361
363
|
|
|
362
364
|
- Node.js >= 18
|
|
363
|
-
-
|
|
364
|
-
- `ws`
|
|
365
|
-
-
|
|
366
|
-
-
|
|
365
|
+
- Native `http` module (HTTP server)
|
|
366
|
+
- `ws` library (WebSocket server)
|
|
367
|
+
- Zero external framework dependencies
|
|
368
|
+
- Optional dependencies: `fd`, `rg` (ripgrep) — for accelerated file search
|
|
367
369
|
|
|
368
370
|
## License
|
|
369
371
|
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
> [English](./README.md) | [中文](./README.zh-CN.md)
|
|
2
|
+
|
|
3
|
+
# AI Helper Agent
|
|
4
|
+
|
|
5
|
+
AI Helper 代理服务,为 [AI Helper Chrome 扩展](https://github.com/xiweicheng/ai-helper) 提供本地文件读写、系统命令执行、Skill 技能系统和 MCP 协议扩展能力。
|
|
6
|
+
|
|
7
|
+
## 安装
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g ai-helper-agent
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
要求 Node.js >= 18.0.0。
|
|
14
|
+
|
|
15
|
+
## 快速开始
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# 前台启动(终端显示实时运行日志,适合调试)
|
|
19
|
+
ai-helper-agent start
|
|
20
|
+
|
|
21
|
+
# 后台启动(守护进程模式,终端立即返回)
|
|
22
|
+
ai-helper-agent start --background
|
|
23
|
+
ai-helper-agent start -b
|
|
24
|
+
|
|
25
|
+
# 指定工作目录和端口
|
|
26
|
+
ai-helper-agent start --workdir /path/to/your/project --port 18911
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
启动后终端会显示 4 位配对码,在 Chrome 扩展设置页「代理」标签中填入即可完成配对。
|
|
30
|
+
|
|
31
|
+
## CLI 命令
|
|
32
|
+
|
|
33
|
+
| 命令 | 说明 |
|
|
34
|
+
|------|------|
|
|
35
|
+
| `start` | 启动代理服务(前台运行,显示实时日志) |
|
|
36
|
+
| `start --background` / `start -b` | 后台启动(守护进程模式) |
|
|
37
|
+
| `stop` | 停止正在运行的 Agent |
|
|
38
|
+
| `restart` | 重启代理服务(支持 -b 后台重启) |
|
|
39
|
+
| `status` | 查看运行状态 |
|
|
40
|
+
| `paircode` | 查看配对码提示 |
|
|
41
|
+
| `config` | 查看当前配置 |
|
|
42
|
+
| `help` | 显示帮助信息 |
|
|
43
|
+
| `--version` / `-v` | 显示版本号 |
|
|
44
|
+
|
|
45
|
+
### 启动选项
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
--background, -b 后台运行(守护进程模式)
|
|
49
|
+
--port <端口> 监听端口,默认 18910
|
|
50
|
+
--host <地址> 监听地址,默认 127.0.0.1
|
|
51
|
+
--workdir <目录> 工作目录(文件读写限制在此范围内)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 前台 vs 后台运行
|
|
55
|
+
|
|
56
|
+
| 模式 | 命令 | 终端行为 | 适用场景 |
|
|
57
|
+
|------|------|----------|----------|
|
|
58
|
+
| 前台 | `start` | 阻塞终端,实时显示运行日志 | 开发调试、问题排查 |
|
|
59
|
+
| 后台 | `start --background` | 立即返回,终端无日志输出 | 生产环境、日常使用 |
|
|
60
|
+
|
|
61
|
+
前台运行时,所有文件读写、命令执行、安全拦截等操作日志会以格式化形式实时输出到终端:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
[12:30:01] [INFO] [文件:read] path=/project/src/index.js size=2048
|
|
65
|
+
[12:30:05] [INFO] [命令:started] command="npm test" cwd=/project execId=a1b2c3d4
|
|
66
|
+
[12:30:12] [INFO] [命令:completed] execId=a1b2c3d4 exitCode=0 killed=false
|
|
67
|
+
[12:31:00] [WARN] [安全:exec_denied] command="rm -rf /" reason=高危命令被拦截
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 进程管理
|
|
71
|
+
|
|
72
|
+
Agent 通过 PID 文件(`~/.ai-helper-agent/agent.pid`)管理进程生命周期:
|
|
73
|
+
|
|
74
|
+
- 启动时自动写入 PID 文件
|
|
75
|
+
- `stop` 命令优先通过 API 优雅关闭,失败则通过 PID 文件 kill 进程
|
|
76
|
+
- 正常关闭时自动清理 PID 文件
|
|
77
|
+
|
|
78
|
+
## 安全机制
|
|
79
|
+
|
|
80
|
+
### 文件沙箱
|
|
81
|
+
|
|
82
|
+
所有文件操作限制在配置的 `allowedPaths` 白名单目录内。通过 `realpath` 解析防止符号链接绕过,确保物理路径安全。
|
|
83
|
+
|
|
84
|
+
### 命令分级管控
|
|
85
|
+
|
|
86
|
+
**黑名单** — 直接拦截,不可绕过:
|
|
87
|
+
|
|
88
|
+
| 类型 | 示例 |
|
|
89
|
+
|------|------|
|
|
90
|
+
| 磁盘破坏 | `rm -rf /`、`mkfs.*`、`dd if=... of=/dev/...` |
|
|
91
|
+
| 系统文件覆盖 | `> /etc/passwd`、`> /etc/shadow` |
|
|
92
|
+
| 恶意管道执行 | `curl ... \| bash`、`git clone ... \| sh` |
|
|
93
|
+
| Shell 注入 | 反引号、`$()`、`${}` 命令替换 |
|
|
94
|
+
| Fork bomb | `:(){ :\|:& };:` |
|
|
95
|
+
|
|
96
|
+
**灰名单** — 需要用户确认后才执行:
|
|
97
|
+
|
|
98
|
+
| 命令模式 | 原因 |
|
|
99
|
+
|----------|------|
|
|
100
|
+
| `sudo ...` | 需要管理员权限 |
|
|
101
|
+
| `npm install -g ...` | 全局安装包 |
|
|
102
|
+
| `pip install/uninstall` | Python 包管理 |
|
|
103
|
+
| `chmod -R 777` | 递归修改权限 |
|
|
104
|
+
| `rm -rf ...` | 递归强制删除 |
|
|
105
|
+
| `git push --force` | 强制推送 |
|
|
106
|
+
| `shutdown/reboot` | 关机/重启 |
|
|
107
|
+
|
|
108
|
+
### 认证机制
|
|
109
|
+
|
|
110
|
+
首次配对时用户在扩展中输入终端显示的 4 位配对码完成配对。配对码每 30 秒轮换。配对成功后使用 HMAC token 做后续请求认证,存储在 `~/.ai-helper-agent/pairings.json`。
|
|
111
|
+
|
|
112
|
+
## 配置
|
|
113
|
+
|
|
114
|
+
配置文件路径:`~/.ai-helper-agent/config.json`
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"port": 18910,
|
|
119
|
+
"host": "127.0.0.1",
|
|
120
|
+
"workdir": "/path/to/project",
|
|
121
|
+
"allowedPaths": [],
|
|
122
|
+
"pairCodeTTL": 30,
|
|
123
|
+
"commandTimeout": 300000,
|
|
124
|
+
"fileMaxSize": 52428800
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
| 字段 | 说明 | 默认值 |
|
|
129
|
+
|------|------|--------|
|
|
130
|
+
| `port` | 监听端口 | 18910 |
|
|
131
|
+
| `host` | 监听地址 | 127.0.0.1 |
|
|
132
|
+
| `workdir` | 默认工作目录 | 启动时当前目录 |
|
|
133
|
+
| `allowedPaths` | 额外允许访问的目录列表 | `[]` |
|
|
134
|
+
| `pairCodeTTL` | 配对码有效期(秒) | 30 |
|
|
135
|
+
| `commandTimeout` | 命令执行超时(毫秒) | 300000(5分钟) |
|
|
136
|
+
| `fileMaxSize` | 文件读写最大字节数 | 52428800(50MB) |
|
|
137
|
+
|
|
138
|
+
## 文件搜索
|
|
139
|
+
|
|
140
|
+
Agent 优先使用系统原生搜索工具,不可用时自动回退到 Node.js 实现:
|
|
141
|
+
|
|
142
|
+
| 引擎 | 用途 | 检测命令 |
|
|
143
|
+
|------|------|----------|
|
|
144
|
+
| `fd` | 文件名搜索(快速) | `fd --version` |
|
|
145
|
+
| `rg` (ripgrep) | 文件内容搜索(快速) | `rg --version` |
|
|
146
|
+
|
|
147
|
+
状态接口返回当前可用的搜索工具:
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{ "searchTools": { "fd": true, "rg": true } }
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## 审计日志
|
|
154
|
+
|
|
155
|
+
所有操作自动记录到审计日志中,日志文件位于 `~/.ai-helper-agent/logs/`。
|
|
156
|
+
|
|
157
|
+
### 双通道输出
|
|
158
|
+
|
|
159
|
+
- **终端输出**(前台模式):格式化可读格式,输出到 stderr
|
|
160
|
+
- **文件输出**:JSON Lines 格式,写入日志文件
|
|
161
|
+
|
|
162
|
+
两种通道同时工作,互不影响。
|
|
163
|
+
|
|
164
|
+
### 日志格式
|
|
165
|
+
|
|
166
|
+
JSON Lines 格式,每行一条记录,文件按日命名 `agent-YYYY-MM-DD.log`。
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{"timestamp":"2026-01-15T10:30:00.123Z","level":"info","category":"fs","action":"read","path":"/home/user/project/src/index.js","size":2048}
|
|
170
|
+
{"timestamp":"2026-01-15T10:30:05.456Z","level":"info","category":"exec","action":"completed","command":"npm test","cwd":"/home/user/project","execId":"a1b2c3d4","exitCode":0,"killed":false,"stdoutLen":1024,"stderrLen":0}
|
|
171
|
+
{"timestamp":"2026-01-15T10:31:00.789Z","level":"warn","category":"security","action":"exec_denied","command":"rm -rf /","reason":"高危命令被拦截"}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### 日志分类
|
|
175
|
+
|
|
176
|
+
| category | 说明 | 包含的操作 |
|
|
177
|
+
|----------|------|-----------|
|
|
178
|
+
| `auth` | 认证事件 | 配对成功/失败 |
|
|
179
|
+
| `fs` | 文件操作 | read, write, list, delete, search_files, search_content |
|
|
180
|
+
| `exec` | 命令执行 | started, completed, stopped, error |
|
|
181
|
+
| `security` | 安全事件 | deny, confirm, auth 失败, 路径越权拦截 |
|
|
182
|
+
| `system` | 系统事件 | server_start, server_stop, shutdown, server_error, uncaught_exception, unhandled_rejection |
|
|
183
|
+
|
|
184
|
+
### 日志查询 API
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
GET /api/logs?date=2026-01-15&category=security&limit=50&offset=0
|
|
188
|
+
GET /api/logs/dates
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
- `date` - 日期筛选 (YYYY-MM-DD),不传默认今天
|
|
192
|
+
- `category` - 分类筛选,不传返回全部
|
|
193
|
+
- `limit` - 返回条数上限,默认 200
|
|
194
|
+
- `offset` - 分页偏移
|
|
195
|
+
|
|
196
|
+
返回按时间倒序排列(最新的在前)。
|
|
197
|
+
|
|
198
|
+
### 自动清理
|
|
199
|
+
|
|
200
|
+
- 最多保留 30 个日志文件
|
|
201
|
+
- 单文件超过 10MB 自动删除
|
|
202
|
+
- 每次写入日志时触发检查
|
|
203
|
+
|
|
204
|
+
## API 端点
|
|
205
|
+
|
|
206
|
+
### 无需认证
|
|
207
|
+
|
|
208
|
+
| 方法 | 路径 | 说明 |
|
|
209
|
+
|------|------|------|
|
|
210
|
+
| POST | `/api/pair` | 配对认证 |
|
|
211
|
+
| GET | `/api/status` | 健康检查(版本号、平台信息、搜索工具可用性) |
|
|
212
|
+
| POST | `/api/shutdown` | 关闭代理服务(仅限本地访问) |
|
|
213
|
+
|
|
214
|
+
### 需要认证(Bearer Token)
|
|
215
|
+
|
|
216
|
+
| 方法 | 路径 | 说明 |
|
|
217
|
+
|------|------|------|
|
|
218
|
+
| POST | `/api/fs/read` | 读取文件内容 |
|
|
219
|
+
| POST | `/api/fs/write` | 写入文件 |
|
|
220
|
+
| POST | `/api/fs/list` | 列出目录 |
|
|
221
|
+
| POST | `/api/fs/delete` | 删除文件/目录 |
|
|
222
|
+
| POST | `/api/fs/search_files` | 按文件名模式搜索(glob) |
|
|
223
|
+
| POST | `/api/fs/search_content` | 搜索文件内容(rg 优先,Node.js 回退) |
|
|
224
|
+
| POST | `/api/exec` | 执行系统命令 |
|
|
225
|
+
| POST | `/api/exec/stop` | 停止命令执行 |
|
|
226
|
+
| GET | `/api/exec/running` | 运行中的进程列表 |
|
|
227
|
+
| GET | `/api/status/detail` | 详细信息(含工作目录、配对码、搜索工具) |
|
|
228
|
+
| GET | `/api/logs` | 查询审计日志(支持 date/category/limit/offset 参数) |
|
|
229
|
+
| GET | `/api/logs/dates` | 获取可用日志日期列表 |
|
|
230
|
+
|
|
231
|
+
### WebSocket
|
|
232
|
+
|
|
233
|
+
| 路径 | 说明 |
|
|
234
|
+
|------|------|
|
|
235
|
+
| `ws://127.0.0.1:18910/ws/exec/:execId` | 命令执行实时输出流 |
|
|
236
|
+
|
|
237
|
+
## 健壮性
|
|
238
|
+
|
|
239
|
+
Agent 内置多层异常保护,防止单个错误导致整个服务崩溃:
|
|
240
|
+
|
|
241
|
+
- **请求级保护**:每个 HTTP 请求处理外层包裹异常捕获,异常时返回 500 而非崩溃
|
|
242
|
+
- **URL 解析保护**:畸形 URL 不会导致进程崩溃,返回 400
|
|
243
|
+
- **服务器级保护**:端口占用等服务器错误有专门处理,优雅报错退出
|
|
244
|
+
- **全局兜底**:`uncaughtException` 和 `unhandledRejection` 全局捕获,记录错误日志但不退出进程
|
|
245
|
+
- **文件 I/O 保护**:配置文件读写失败不影响服务运行
|
|
246
|
+
- **进程管理保护**:`SIGTERM`/`SIGKILL` 发送对已退出进程有 try-catch 保护
|
|
247
|
+
|
|
248
|
+
## Skill 系统
|
|
249
|
+
|
|
250
|
+
Agent 服务内置 Skill 系统,支持将操作流程沉淀为可复用的技能。
|
|
251
|
+
|
|
252
|
+
### Skill 类型
|
|
253
|
+
|
|
254
|
+
| 类型 | 定义格式 | 执行方式 | 用途 |
|
|
255
|
+
|------|----------|----------|------|
|
|
256
|
+
| **Workflow Skill** | JSON/YAML | 直接执行 | 自动化流程,按步骤执行 |
|
|
257
|
+
| **Agent Skill** | SKILL.md | AI 自主调用 | 知识沉淀,在对话中触发 |
|
|
258
|
+
|
|
259
|
+
### Skill 目录结构
|
|
260
|
+
|
|
261
|
+
所有 Skill 存储在 `~/.ai-helper-agent/skills/` 目录下:
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
~/.ai-helper-agent/skills/
|
|
265
|
+
├── workflow-skill.json # Workflow Skill(JSON 格式)
|
|
266
|
+
├── another-skill.yaml # Workflow Skill(YAML 格式)
|
|
267
|
+
└── agent-skill/ # Agent Skill(目录形式)
|
|
268
|
+
├── SKILL.md # 技能定义文件
|
|
269
|
+
└── _meta.json # 元数据(可选)
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### SKILL.md 格式
|
|
273
|
+
|
|
274
|
+
```markdown
|
|
275
|
+
---
|
|
276
|
+
name: <skill-name>
|
|
277
|
+
description: "<简明描述,包含:(1) 技能做什么,(2) 何时触发调用>"
|
|
278
|
+
enabled: true
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
# <技能标题>
|
|
282
|
+
|
|
283
|
+
## When to Use This Skill
|
|
284
|
+
|
|
285
|
+
- 触发条件1
|
|
286
|
+
- 触发条件2
|
|
287
|
+
|
|
288
|
+
## Core Capabilities
|
|
289
|
+
|
|
290
|
+
- 能力1
|
|
291
|
+
- 能力2
|
|
292
|
+
|
|
293
|
+
## Usage
|
|
294
|
+
|
|
295
|
+
### Step-by-Step
|
|
296
|
+
|
|
297
|
+
1. 步骤1
|
|
298
|
+
2. 步骤2
|
|
299
|
+
|
|
300
|
+
## Examples
|
|
301
|
+
|
|
302
|
+
[具体示例]
|
|
303
|
+
|
|
304
|
+
## Source
|
|
305
|
+
|
|
306
|
+
从对话中沉淀,创建日期:YYYY-MM-DD
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### 内置技能
|
|
310
|
+
|
|
311
|
+
- **skill-creator**:元技能,用于从对话中创建和更新其他技能
|
|
312
|
+
|
|
313
|
+
### Skill API
|
|
314
|
+
|
|
315
|
+
| 方法 | 路径 | 说明 |
|
|
316
|
+
|------|------|------|
|
|
317
|
+
| GET | `/api/skill/list` | 获取所有 Skill 列表 |
|
|
318
|
+
| GET | `/api/skill/:name` | 获取单个 Skill 完整定义 |
|
|
319
|
+
| POST | `/api/skill/import` | 导入新 Skill |
|
|
320
|
+
| POST | `/api/skill/:name/toggle` | 切换启用/停用状态 |
|
|
321
|
+
| DELETE | `/api/skill/:name` | 删除 Skill |
|
|
322
|
+
| POST | `/api/skill/:name/run` | 执行 Workflow Skill |
|
|
323
|
+
|
|
324
|
+
## MCP 协议扩展
|
|
325
|
+
|
|
326
|
+
支持 Model Context Protocol(MCP),扩展第三方工具能力。
|
|
327
|
+
|
|
328
|
+
### MCP Server 配置
|
|
329
|
+
|
|
330
|
+
配置文件路径:`~/.ai-helper-agent/config.json`
|
|
331
|
+
|
|
332
|
+
```json
|
|
333
|
+
{
|
|
334
|
+
"mcpServers": [
|
|
335
|
+
{
|
|
336
|
+
"id": "my-mcp-server",
|
|
337
|
+
"name": "My MCP Server",
|
|
338
|
+
"command": ["python", "-m", "my_mcp_server"],
|
|
339
|
+
"enabled": true
|
|
340
|
+
}
|
|
341
|
+
]
|
|
342
|
+
}
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### MCP API
|
|
346
|
+
|
|
347
|
+
| 方法 | 路径 | 说明 |
|
|
348
|
+
|------|------|------|
|
|
349
|
+
| GET | `/api/mcp/status` | 获取所有 MCP Server 状态 |
|
|
350
|
+
| POST | `/api/mcp/:serverId/connect` | 连接指定 MCP Server |
|
|
351
|
+
| POST | `/api/mcp/:serverId/disconnect` | 断开连接 |
|
|
352
|
+
| GET | `/api/mcp/tools` | 获取所有 MCP 工具列表 |
|
|
353
|
+
|
|
354
|
+
### 工作原理
|
|
355
|
+
|
|
356
|
+
1. Agent 启动时自动连接所有启用的 MCP Server
|
|
357
|
+
2. 通过 stdio 建立 JSON-RPC 2.0 通信
|
|
358
|
+
3. 自动发现 MCP Server 提供的工具
|
|
359
|
+
4. 工具调用请求通过 Agent 转发到 MCP Server
|
|
360
|
+
5. 工具结果返回给扩展
|
|
361
|
+
|
|
362
|
+
## 技术栈
|
|
363
|
+
|
|
364
|
+
- Node.js >= 18
|
|
365
|
+
- 原生 `http` 模块(HTTP 服务)
|
|
366
|
+
- `ws` 库(WebSocket 服务)
|
|
367
|
+
- 零外部框架依赖
|
|
368
|
+
- 可选依赖:`fd`、`rg`(ripgrep)— 用于加速文件搜索
|
|
369
|
+
|
|
370
|
+
## License
|
|
371
|
+
|
|
372
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-helper-agent",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.9",
|
|
4
4
|
"description": "AI Helper Agent - Local file access and system command execution proxy for Chrome extension / AI Helper 代理服务,为 Chrome 扩展提供本地文件读写和系统命令执行",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/server.js",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"bin/",
|
|
13
13
|
"src/",
|
|
14
|
-
"README.md"
|
|
14
|
+
"README.md",
|
|
15
|
+
"README.zh-CN.md"
|
|
15
16
|
],
|
|
16
17
|
"scripts": {
|
|
17
18
|
"start": "node bin/agent.js start",
|
|
@@ -41,9 +42,10 @@
|
|
|
41
42
|
"license": "MIT",
|
|
42
43
|
"repository": {
|
|
43
44
|
"type": "git",
|
|
44
|
-
"url": ""
|
|
45
|
+
"url": "git+https://github.com/xiweicheng/ai-helper.git",
|
|
46
|
+
"directory": "agent"
|
|
45
47
|
},
|
|
46
|
-
"homepage": "",
|
|
48
|
+
"homepage": "https://github.com/xiweicheng/ai-helper/tree/main/agent#readme",
|
|
47
49
|
"bugs": {
|
|
48
50
|
"url": "https://github.com/xiweicheng/ai-helper/issues"
|
|
49
51
|
}
|