ace-tool-windows 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 CHANGED
@@ -1,62 +1,28 @@
1
1
  # ace-tool-windows
2
2
 
3
- Rust + Win32 的 MCP Server(stdio),提供 `search_context` 与 `enhance_prompt`,并用原生 Win32 GUI 替代浏览器交互。
3
+ Rust + Win32 的 MCP Server(stdio),提供 `search_context` 与 `enhance_prompt`,用原生 Win32 GUI 替代浏览器交互。
4
4
 
5
5
  > 原项目:https://github.com/eastxiaodong/ace-tool
6
6
 
7
- ## 目录
8
-
9
- - 项目简介
10
- - 功能特性
11
- - 环境要求
12
- - 快速开始
13
- - 配置为 MCP Server
14
- - 从源码运行
15
- - MCP 工具说明
16
- - 配置说明
17
- - npm 打包与发布
18
- - 项目结构
19
- - 对齐清单(Node 版本)
20
- - 测试
21
- - License
22
- - 致谢
23
-
24
- ## 项目简介
25
-
26
- 本仓库是 ace-tool 的 Rust + Win32 重写版本,目标与 Node 版本功能 1:1 对齐,同时保持 MCP stdio 兼容,供 Codex 客户端调用。
27
-
28
- ## 功能特性
29
-
30
- - MCP JSON-RPC over stdio,支持工具列举与调用
31
- - `search_context`:索引 + 检索代码库上下文
32
- - `enhance_prompt`:调用远端增强服务,支持中文/英文自动判断
33
- - Win32 GUI 交互窗口,提供继续增强 / 使用原始 / 结束对话
34
- - 本地索引与日志输出(`.ace-tool/`)
35
-
36
- ## 环境要求
37
-
38
- - Windows 10/11(Win32 GUI)
39
- - Rust 工具链(建议稳定版)
40
- - Node.js + npm(用于发布到 npm)
41
-
42
7
  ## 快速开始
43
8
 
44
- 全局安装后使用:
9
+ ### 1) 安装
45
10
 
46
11
  ```powershell
47
12
  npm i -g ace-tool-windows
48
- ace-tool-win --base-url <URL> --token <TOKEN> [--enable-log]
49
13
  ```
50
14
 
51
- ## 配置为 MCP Server
15
+ ### 2) 直接运行(本地验证)
52
16
 
53
- 本项目是 MCP stdio Server。配置时只需要声明 command + args,不需要额外端口配置。
17
+ ```powershell
18
+ ace-tool-win --base-url <URL> --token <TOKEN> [--enable-log]
19
+ ```
54
20
 
55
- 说明:不同 MCP 客户端字段名可能是 `mcpServers` 或 `servers`,以客户端文档为准。下面给出两种常见 JSON 格式。
21
+ ### 3) 配置为 MCP Server
56
22
 
57
- ### 方式一:mcpServers 格式(常见)
23
+ > 不同 MCP 客户端字段名可能是 `mcpServers` 或 `servers`,以客户端文档为准。
58
24
 
59
- 使用 npm 全局命令:
25
+ **mcpServers 格式(常见)**
60
26
 
61
27
  ```json
62
28
  {
@@ -69,20 +35,20 @@ ace-tool-win --base-url <URL> --token <TOKEN> [--enable-log]
69
35
  }
70
36
  ```
71
37
 
72
- 使用本地 exe 路径:
38
+ **使用本地 exe 路径**
73
39
 
74
40
  ```json
75
41
  {
76
42
  "mcpServers": {
77
43
  "ace-tool-windows": {
78
- "command": "C:\\\\path\\\\to\\\\ace-tool-win.exe",
44
+ "command": "C:\\path\\to\\ace-tool-win.exe",
79
45
  "args": ["--base-url", "<URL>", "--token", "<TOKEN>"]
80
46
  }
81
47
  }
82
48
  }
83
49
  ```
84
50
 
85
- ### 方式二:JSON 模式(servers 格式)
51
+ **servers 格式(兼容模式)**
86
52
 
87
53
  ```json
88
54
  {
@@ -95,20 +61,47 @@ ace-tool-win --base-url <URL> --token <TOKEN> [--enable-log]
95
61
  }
96
62
  ```
97
63
 
98
- ### 参数说明
64
+ 配置完成后,在 AI CLI 中输入 `xxxxx -enhance` 即可触发 `enhance_prompt`(同样支持 `-enhancer`)。
65
+
66
+ ## 项目简介
67
+
68
+ 本仓库是 ace-tool 的 Rust + Win32 重写版本,目标与 Node 版本功能 1:1 对齐,同时保持 MCP stdio 兼容,供 Codex / MCP 客户端调用。
69
+
70
+ ## 功能特性
71
+
72
+ - MCP JSON-RPC over stdio,支持工具列举与调用
73
+ - `search_context`:索引 + 检索代码库上下文
74
+ - `enhance_prompt`:调用远端增强服务,支持中文/英文自动判断
75
+ - Win32 GUI 交互窗口,提供继续增强 / 使用原始 / 结束对话
76
+ - 本地索引与日志输出(`.ace-tool/`)
77
+
78
+ ## 环境要求
79
+
80
+ - Windows 10/11(Win32 GUI)
81
+ - Rust 工具链(建议稳定版)
82
+ - Node.js + npm(用于发布到 npm)
83
+
84
+ ## 配置说明
85
+
86
+ ### CLI 参数
99
87
 
100
88
  - `--base-url` 必填,服务地址;未写协议会自动补 `https://`
101
89
  - `--token` 必填,ACE 服务 Token
102
90
  - `--enable-log` 可选,写入 `.ace-tool/ace-tool.log`
103
91
 
104
- > 提示:`enhance_prompt` 会弹 Win32 窗口确认;如果只想后台检索,可只调用 `search_context`。
105
-
106
- ## 从源码运行
92
+ ### 环境变量(可选)
107
93
 
108
- ```powershell
109
- # 在仓库根目录
110
- cargo run -- --base-url <URL> --token <TOKEN> [--enable-log]
111
- ```
94
+ - `ACE_TOOL_HEADLESS=1`:跳过 UI,直接返回增强结果
95
+ - `ACE_TOOL_HEADLESS_ACTION=enhanced|end|timeout`:headless 模式返回策略,默认 enhanced
96
+ - `ACE_TOOL_DEBUG=1`:输出 MCP 调试日志(stderr + 文件)
97
+ - `ACE_TOOL_DEBUG_VERBOSE=1`:输出更详细的帧解析日志
98
+ - `ACE_TOOL_DEBUG_FILE=<path>`:调试日志路径,默认 `%TEMP%\\ace-tool-mcp.log`
99
+
100
+ ### 超时规则(重要)
101
+
102
+ - 本项目默认不提供自定义超时参数。
103
+ - MCP 调用超时以客户端(Codex)配置为准,例如 `tool_timeout_sec` / `startup_timeout_sec`。
104
+ - 如需调整,请在 Codex 客户端配置中修改,不建议在服务端再做一套超时逻辑。
112
105
 
113
106
  ## MCP 工具说明
114
107
 
@@ -124,24 +117,15 @@ cargo run -- --base-url <URL> --token <TOKEN> [--enable-log]
124
117
  - 语言检测:中文输入 -> 中文输出;英文输入 -> 英文输出
125
118
  - 工具名映射:`codebase-retrieval` -> `search_context`
126
119
  - 8 分钟超时回退到原始 prompt
120
+ - 默认弹 Win32 窗口,等待用户点击后返回
121
+ - 如需无 UI,可设置 `ACE_TOOL_HEADLESS=1`
127
122
 
128
- ## 配置说明
129
-
130
- 必填参数:
131
- - `--base-url`
132
- - `--token`
133
-
134
- 可选参数:
135
- - `--enable-log`(写入 `.ace-tool/ace-tool.log`)
136
-
137
- ### 认证 URL 与 Token 获取
138
-
139
- 认证服务的 URL 与 Token 获取方式以原项目说明为准,建议先阅读原项目文档与相关讨论:
140
-
141
- - 原项目仓库:https://github.com/eastxiaodong/ace-tool
142
- - Issue #6: baseUrl 和 Token 有办法获取吗?
123
+ ## 从源码运行
143
124
 
144
- 注意:Issue #6 中有用户提到 baseUrl 直接指向 augmentcode.com,但未给出 Token 的官方获取流程,请以服务提供方的最新说明为准。
125
+ ```powershell
126
+ # 在仓库根目录
127
+ cargo run -- --base-url <URL> --token <TOKEN> [--enable-log]
128
+ ```
145
129
 
146
130
  ## npm 打包与发布
147
131
 
@@ -165,7 +149,7 @@ npm publish --access public
165
149
 
166
150
  ## 项目结构
167
151
 
168
- ```
152
+ ```text
169
153
  ace-tool-windows/
170
154
  - Cargo.toml
171
155
  - package.json
@@ -254,7 +238,3 @@ Apache-2.0
254
238
  ## 致谢
255
239
 
256
240
  - 原项目:ace-tool(https://github.com/eastxiaodong/ace-tool)
257
-
258
-
259
-
260
-
Binary file
package/package.json CHANGED
@@ -1,43 +1,39 @@
1
- {
2
- "name": "ace-tool-windows",
3
- "version": "0.1.3",
4
- "description": "ACE MCP server for Windows (Win32)",
5
- "bin": {
6
- "ace-tool-win": "bin/ace-tool-win.js"
7
- },
8
- "os": [
9
- "win32"
10
- ],
11
- "cpu": [
12
- "x64"
13
- ],
14
- "files": [
15
- "bin/ace-tool-win.js",
16
- "bin/ace-tool-win.exe",
17
- "README.md",
18
- "LICENSE"
19
- ],
20
- "license": "Apache-2.0",
21
- "scripts": {
22
- "build:bin": "powershell -NoProfile -ExecutionPolicy Bypass -File scripts/build-bin.ps1",
23
- "pack:local": "npm run build:bin && npm pack",
24
- "publish:public": "npm run build:bin && npm publish --access public"
25
- },
26
- "engines": {
27
- "node": ">=18.0.0"
28
- },
29
- "repository": {
30
- "type": "git",
31
- "url": "git+https://github.com/doudouHubs/ace-tool-windows.git"
32
- },
33
- "bugs": {
34
- "url": "https://github.com/doudouHubs/ace-tool-windows/issues"
35
- },
36
- "homepage": "https://github.com/doudouHubs/ace-tool-windows#readme",
37
- "keywords": [
38
- "mcp",
39
- "ace-tool",
40
- "win32",
41
- "windows"
42
- ]
43
- }
1
+ {
2
+ "name": "ace-tool-windows",
3
+ "version": "0.1.5",
4
+ "description": "ACE MCP server for Windows (Win32)",
5
+ "bin": {
6
+ "ace-tool-win": "bin/ace-tool-win.exe"
7
+ },
8
+ "os": [
9
+ "win32"
10
+ ],
11
+ "cpu": [
12
+ "x64"
13
+ ],
14
+ "files": [
15
+ "bin/ace-tool-win.exe",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "license": "Apache-2.0",
20
+ "scripts": {
21
+ "release": "cargo build --release",
22
+ "build:bin": "powershell -NoProfile -ExecutionPolicy Bypass -File scripts/build-bin.ps1",
23
+ "pack:local": "npm run build:bin && npm pack"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/doudouHubs/ace-tool-windows.git"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/doudouHubs/ace-tool-windows/issues"
31
+ },
32
+ "homepage": "https://github.com/doudouHubs/ace-tool-windows#readme",
33
+ "keywords": [
34
+ "mcp",
35
+ "ace-tool",
36
+ "win32",
37
+ "windows"
38
+ ]
39
+ }
@@ -1,237 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
4
- const fs = require('fs');
5
- const path = require('path');
6
- const { spawn } = require('child_process');
7
-
8
- const DEFAULT_PROTOCOL_VERSION = '2024-11-05';
9
- const SUPPORTED_PROTOCOL_VERSIONS = new Set([
10
- 'DRAFT-2026-v1',
11
- '2025-06-18',
12
- '2025-03-26',
13
- '2024-11-05',
14
- '2024-10-07',
15
- ]);
16
-
17
- function logError(message) {
18
- process.stderr.write(`${message}\n`);
19
- }
20
-
21
- const backendExe = process.env.ACE_TOOL_WIN_EXE || path.join(__dirname, 'ace-tool-win.exe');
22
- if (!fs.existsSync(backendExe)) {
23
- logError(`ace-tool-win backend not found: ${backendExe}`);
24
- process.exit(1);
25
- }
26
-
27
- const backendArgs = process.argv.slice(2);
28
- const backend = spawn(backendExe, backendArgs, { stdio: ['pipe', 'pipe', 'pipe'] });
29
- backend.stderr.on('data', (chunk) => process.stderr.write(chunk));
30
-
31
- let backendClosed = false;
32
- backend.on('exit', (code) => {
33
- backendClosed = true;
34
- logError(`ace-tool-win backend exited (${code ?? 'unknown'})`);
35
- process.exit(code ?? 1);
36
- });
37
- backend.on('error', (error) => {
38
- backendClosed = true;
39
- logError(`ace-tool-win backend failed: ${error.message}`);
40
- process.exit(1);
41
- });
42
-
43
- let backendRequestId = 1;
44
- const backendPending = new Map();
45
-
46
- function sendBackend(message) {
47
- if (backendClosed) {
48
- return Promise.reject(new Error('Backend closed'));
49
- }
50
- const payload = JSON.stringify(message);
51
- const header = `Content-Length: ${Buffer.byteLength(payload)}\r\n\r\n`;
52
- backend.stdin.write(header + payload);
53
- return new Promise((resolve, reject) => {
54
- backendPending.set(message.id, { resolve, reject });
55
- });
56
- }
57
-
58
- function createParser(onMessage) {
59
- let buffer = Buffer.alloc(0);
60
- return (chunk) => {
61
- buffer = Buffer.concat([buffer, chunk]);
62
- while (true) {
63
- const headerEnd = buffer.indexOf('\r\n\r\n');
64
- if (headerEnd === -1) {
65
- return;
66
- }
67
- const headerText = buffer.slice(0, headerEnd).toString('utf8');
68
- const match = headerText.match(/content-length:\s*(\d+)/i);
69
- if (!match) {
70
- buffer = buffer.slice(headerEnd + 4);
71
- continue;
72
- }
73
- const contentLength = Number(match[1]);
74
- const totalLength = headerEnd + 4 + contentLength;
75
- if (buffer.length < totalLength) {
76
- return;
77
- }
78
- const body = buffer.slice(headerEnd + 4, totalLength).toString('utf8');
79
- buffer = buffer.slice(totalLength);
80
- try {
81
- const message = JSON.parse(body);
82
- onMessage(message);
83
- } catch (error) {
84
- logError(`Failed to parse backend message: ${error.message}`);
85
- }
86
- }
87
- };
88
- }
89
-
90
- backend.stdout.on('data', createParser((message) => {
91
- if (!message || message.id === undefined || message.id === null) {
92
- return;
93
- }
94
- const pending = backendPending.get(message.id);
95
- if (!pending) {
96
- return;
97
- }
98
- backendPending.delete(message.id);
99
- if (message.error) {
100
- pending.reject(message.error);
101
- } else {
102
- pending.resolve(message);
103
- }
104
- }));
105
-
106
- const backendReady = (async () => {
107
- const initMessage = {
108
- jsonrpc: '2.0',
109
- id: backendRequestId++,
110
- method: 'initialize',
111
- params: {
112
- protocolVersion: DEFAULT_PROTOCOL_VERSION,
113
- capabilities: {},
114
- clientInfo: { name: 'ace-tool-win-proxy', version: '0.1.3' },
115
- },
116
- };
117
-
118
- await sendBackend(initMessage);
119
- })().catch((error) => {
120
- logError(`Backend initialize failed: ${error?.message || error}`);
121
- process.exit(1);
122
- });
123
-
124
- function sendRouter(message) {
125
- const payload = JSON.stringify(message);
126
- const header = `Content-Length: ${Buffer.byteLength(payload)}\r\n\r\n`;
127
- process.stdout.write(header + payload);
128
- }
129
-
130
- function normalizeMethod(method) {
131
- const value = (method || '').toLowerCase();
132
- if (value === 'tools.list' || value === 'tools/list' || value === 'list_tools' || value === 'listtools') {
133
- return 'tools/list';
134
- }
135
- if (value === 'tools.call' || value === 'tools/call' || value === 'call_tool' || value === 'calltool') {
136
- return 'tools/call';
137
- }
138
- if (value === 'initialize') {
139
- return 'initialize';
140
- }
141
- if (value === 'notifications/initialized' || value === 'initialized') {
142
- return 'initialized';
143
- }
144
- return method || '';
145
- }
146
-
147
- process.stdin.on('data', createParser(async (message) => {
148
- if (!message || typeof message !== 'object') {
149
- return;
150
- }
151
-
152
- const method = normalizeMethod(message.method);
153
- const id = message.id;
154
-
155
- if (method === 'initialized') {
156
- return;
157
- }
158
-
159
- if (method === 'initialize') {
160
- const requested = message.params?.protocolVersion;
161
- const protocolVersion = SUPPORTED_PROTOCOL_VERSIONS.has(requested) ? requested : DEFAULT_PROTOCOL_VERSION;
162
- sendRouter({
163
- jsonrpc: '2.0',
164
- id,
165
- result: {
166
- protocolVersion,
167
- capabilities: { tools: {}, logging: {} },
168
- serverInfo: { name: 'ace-tool-windows', version: '0.1.3' },
169
- },
170
- });
171
- return;
172
- }
173
-
174
- if (method === 'tools/list') {
175
- await backendReady;
176
- const backendMessage = {
177
- jsonrpc: '2.0',
178
- id: backendRequestId++,
179
- method: 'tools/list',
180
- params: message.params || {},
181
- };
182
- try {
183
- const response = await sendBackend(backendMessage);
184
- if (response.error) {
185
- sendRouter({ jsonrpc: '2.0', id, error: response.error });
186
- } else {
187
- sendRouter({ jsonrpc: '2.0', id, result: response.result });
188
- }
189
- } catch (error) {
190
- sendRouter({
191
- jsonrpc: '2.0',
192
- id,
193
- error: { code: -32000, message: error?.message || 'Backend error' },
194
- });
195
- }
196
- return;
197
- }
198
-
199
- if (method === 'tools/call') {
200
- await backendReady;
201
- const backendMessage = {
202
- jsonrpc: '2.0',
203
- id: backendRequestId++,
204
- method: 'tools/call',
205
- params: message.params || {},
206
- };
207
- try {
208
- const response = await sendBackend(backendMessage);
209
- if (response.error) {
210
- sendRouter({ jsonrpc: '2.0', id, error: response.error });
211
- } else {
212
- sendRouter({ jsonrpc: '2.0', id, result: response.result });
213
- }
214
- } catch (error) {
215
- sendRouter({
216
- jsonrpc: '2.0',
217
- id,
218
- error: { code: -32000, message: error?.message || 'Backend error' },
219
- });
220
- }
221
- return;
222
- }
223
-
224
- if (id !== undefined && id !== null) {
225
- sendRouter({
226
- jsonrpc: '2.0',
227
- id,
228
- error: { code: -32601, message: 'Method not found' },
229
- });
230
- }
231
- }));
232
-
233
- process.stdin.on('end', () => {
234
- if (!backendClosed) {
235
- backend.kill();
236
- }
237
- });