@alicloud/autowonder 0.3.39 → 0.3.40
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 +9 -9
- package/lib/browser/cli.js +14 -7
- package/lib/browser/mcp-runner.js +18 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/scripts/verify-browser-package.js +1 -1
- package/vendor/autowonder-daemon-darwin-amd64 +0 -0
- package/vendor/autowonder-daemon-darwin-arm64 +0 -0
- package/vendor/autowonder-daemon-linux-amd64 +0 -0
- package/vendor/autowonder-daemon-linux-arm64 +0 -0
- package/vendor/autowonder-daemon-win32-amd64.exe +0 -0
- package/vendor/autowonder-daemon-win32-arm64.exe +0 -0
package/README.md
CHANGED
|
@@ -18,10 +18,10 @@ Browser Use 的源码、测试、依赖和发布统一在本 runtime 仓库维
|
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
20
|
# Qoder CLI(模型使用 provider model ID;Context Window 使用固定档位)
|
|
21
|
-
npx -y @alicloud/autowonder@0.3.
|
|
21
|
+
npx -y @alicloud/autowonder@0.3.40 connect --ws-url <wss-endpoint> --token <executor-token> --executor-id <executor-id> --provider qoder --model qmodel_latest --reasoning-effort medium --context-window 260000
|
|
22
22
|
|
|
23
23
|
# Qoder CLI CN
|
|
24
|
-
npx -y @alicloud/autowonder@0.3.
|
|
24
|
+
npx -y @alicloud/autowonder@0.3.40 connect --ws-url <wss-endpoint> --token <executor-token> --executor-id <executor-id> --provider qodercn
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
`connect` 会安装当前 npm 包内置的 daemon,并使用页面生成的 WebSocket endpoint、Token 和执行器 ID 建立连接。客户端只支持通过 Qoder 系列 CLI 启动(`qoder` 对应 `qodercli`,`qodercn` 对应 `qodercn`),其他 `--provider` 取值会在启动 daemon 前直接报错拦截并提示 `Unsupported provider`。选择 Qoder CLI 或 Qoder CLI CN 时需要 Node.js 20+;runtime 会在缺少对应 CLI 时自动通过 npm 安装,并在尚未登录时打开浏览器登录。runtime 会继承当前用户的 HOME、环境变量和 CLI 登录状态。
|
|
@@ -213,7 +213,7 @@ mv "$queue/.assignment.tmp" "$queue/assignment.json"
|
|
|
213
213
|
也可以直接提交到本地 API:
|
|
214
214
|
|
|
215
215
|
```bash
|
|
216
|
-
npx -y @alicloud/autowonder@0.3.
|
|
216
|
+
npx -y @alicloud/autowonder@0.3.40 dispatch ./assignment.json
|
|
217
217
|
```
|
|
218
218
|
|
|
219
219
|
## 上传工单附件
|
|
@@ -221,7 +221,7 @@ npx -y @alicloud/autowonder@0.3.39 dispatch ./assignment.json
|
|
|
221
221
|
把本地需求/设计文档直接上传到工单,避免在会话里传递大文件:
|
|
222
222
|
|
|
223
223
|
```bash
|
|
224
|
-
npx -y @alicloud/autowonder@0.3.
|
|
224
|
+
npx -y @alicloud/autowonder@0.3.40 workitem upload --server-url <autowonder-server-url> --workitem-id <id> --file <filepath-1> --file <filepath-2> --json
|
|
225
225
|
```
|
|
226
226
|
|
|
227
227
|
上传令牌通过 MCP 工具 `autowonder.workitem_cli_upload_token` 签发,经 `--token` 或 `AUTOWONDER_UPLOAD_TOKEN` 环境变量传入。`--file` 可重复指定多个文件;`--json` 输出机器可读结果。失败时按错误类型返回不同退出码(401→3、403→4、404→5、409→6、413→7、其他 4xx→8、网络/重定向→9)。
|
|
@@ -231,7 +231,7 @@ npx -y @alicloud/autowonder@0.3.39 workitem upload --server-url <autowonder-serv
|
|
|
231
231
|
把工单上已有的需求/设计文档下载到本地目录,再用本地文件工具阅读,避免把大文件或二进制附件搬进会话上下文:
|
|
232
232
|
|
|
233
233
|
```bash
|
|
234
|
-
npx -y @alicloud/autowonder@0.3.
|
|
234
|
+
npx -y @alicloud/autowonder@0.3.40 workitem download --server-url <autowonder-server-url> --workitem-id <id> --file <name-or-id> --output-dir <dir> --json
|
|
235
235
|
```
|
|
236
236
|
|
|
237
237
|
下载令牌通过 MCP 工具 `autowonder.workitem_cli_download_token` 签发(与上传令牌相互独立),经 `--token` 或 `AUTOWONDER_DOWNLOAD_TOKEN` 环境变量传入。`--file` 可重复指定文档名或 artifact id,省略则下载该工单的全部附件;`--output-dir` 默认为当前目录;`--json` 输出机器可读结果,含每个文件的 `id`、`name`、`path`、`size`。退出码约定与 `workitem upload` 相同(401→3、403→4、404→5、409→6、413→7、其他 4xx→8、网络/重定向→9)。
|
|
@@ -241,7 +241,7 @@ npx -y @alicloud/autowonder@0.3.39 workitem download --server-url <autowonder-se
|
|
|
241
241
|
把需求/设计文档上传到 7x24 定时任务,用法与工单附件一致(同一套上传令牌与预检规则):
|
|
242
242
|
|
|
243
243
|
```bash
|
|
244
|
-
npx -y @alicloud/autowonder@0.3.
|
|
244
|
+
npx -y @alicloud/autowonder@0.3.40 scheduled-task upload --server-url <autowonder-server-url> --scheduled-task-id <id> --file <filepath-1> --file <filepath-2> --json
|
|
245
245
|
```
|
|
246
246
|
|
|
247
247
|
上传令牌同样通过 `autowonder.workitem_cli_upload_token` 签发(令牌为用户级,对当前可修改的任意定时任务生效),经 `--token` 或 `AUTOWONDER_UPLOAD_TOKEN` 传入;退出码约定与 `workitem upload` 相同。
|
|
@@ -249,8 +249,8 @@ npx -y @alicloud/autowonder@0.3.39 scheduled-task upload --server-url <autowonde
|
|
|
249
249
|
## 管理 daemon
|
|
250
250
|
|
|
251
251
|
```bash
|
|
252
|
-
npx -y @alicloud/autowonder@0.3.
|
|
253
|
-
npx -y @alicloud/autowonder@0.3.
|
|
252
|
+
npx -y @alicloud/autowonder@0.3.40 status
|
|
253
|
+
npx -y @alicloud/autowonder@0.3.40 stop
|
|
254
254
|
```
|
|
255
255
|
|
|
256
256
|
默认 API 是 `http://127.0.0.1:34989`,日志位于 `~/.autowonder/daemon.log`。npm 包不包含任何 agent、MCP 或服务端凭证。
|
|
@@ -273,7 +273,7 @@ daemon 内置独立于工作区 GC 的保留清扫:默认每小时运行一次
|
|
|
273
273
|
## 调试
|
|
274
274
|
|
|
275
275
|
```bash
|
|
276
|
-
npx -y @alicloud/autowonder@0.3.
|
|
276
|
+
npx -y @alicloud/autowonder@0.3.40 connect ... --debug
|
|
277
277
|
```
|
|
278
278
|
|
|
279
279
|
`--debug` 会让 CLI 以 `AUTOWONDER_DEBUG=1` 启动 daemon,把完整的 daemon 与 agent 活动(runtime 事件流、provider 事件解码、重试退避与会话门等待、空闲时的阻塞点)同时输出到控制台和会话调试日志。调试日志不做脱敏,仅用于本机排障;不传 `--debug` 时该环境变量不会注入。
|
package/lib/browser/cli.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { parseArgs } from 'node:util';
|
|
3
3
|
import { createRequire } from 'node:module';
|
|
4
4
|
import { dirname, join, resolve } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
5
6
|
import { homedir, networkInterfaces } from 'node:os';
|
|
6
7
|
import { access, mkdir, readFile, stat, writeFile } from 'node:fs/promises';
|
|
7
8
|
import { constants } from 'node:fs';
|
|
@@ -73,16 +74,23 @@ async function shutdown(code = 0) {
|
|
|
73
74
|
if (stopping) return;
|
|
74
75
|
stopping = true;
|
|
75
76
|
state.ready = false;
|
|
76
|
-
|
|
77
|
+
// Leave MCP's own 15-second watchdog time to finish before forcing exit.
|
|
78
|
+
const force = setTimeout(() => {
|
|
79
|
+
console.error('Browser shutdown timed out; forcing MCP exit. The profile may not have been saved.');
|
|
80
|
+
child?.kill('SIGKILL');
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}, 20000);
|
|
77
83
|
force.unref();
|
|
78
84
|
gateway?.closeAllConnections(); gateway?.close();
|
|
79
85
|
ui?.server.closeAllConnections(); ui?.server.close();
|
|
80
|
-
//
|
|
81
|
-
|
|
86
|
+
// browser_close is rejected for shared contexts; shut down the MCP process
|
|
87
|
+
// cooperatively instead so it closes Chromium and flushes the whole profile.
|
|
82
88
|
await client?.close().catch(() => {});
|
|
83
89
|
if (child && child.exitCode === null) {
|
|
84
90
|
const exited = new Promise(resolve => child.once('exit', resolve));
|
|
85
|
-
child.
|
|
91
|
+
child.send({ type: 'shutdown' }, error => {
|
|
92
|
+
if (error && child.exitCode === null) child.kill('SIGTERM');
|
|
93
|
+
});
|
|
86
94
|
await exited;
|
|
87
95
|
}
|
|
88
96
|
clearTimeout(force);
|
|
@@ -112,14 +120,13 @@ try {
|
|
|
112
120
|
ui = createUI(state);
|
|
113
121
|
const uiPort = await listen(ui.server, 0, '127.0.0.1');
|
|
114
122
|
const uiURL = `http://127.0.0.1:${uiPort}${ui.path}`;
|
|
115
|
-
const
|
|
116
|
-
const args = [join(mcpDir, 'cli.js'), '--host', '127.0.0.1', '--port', String(internalPort), '--allowed-hosts', `127.0.0.1:${internalPort}`,
|
|
123
|
+
const args = [fileURLToPath(new URL('./mcp-runner.js', import.meta.url)), '--host', '127.0.0.1', '--port', String(internalPort), '--allowed-hosts', `127.0.0.1:${internalPort}`,
|
|
117
124
|
'--user-data-dir', join(dataDir, 'profile'), '--shared-browser-context', '--idle-timeout', '0',
|
|
118
125
|
'--executable-path', executable,
|
|
119
126
|
'--image-responses', 'allow', '--output-dir', join(dataDir, 'output')];
|
|
120
127
|
if (values.headless) args.push('--headless');
|
|
121
128
|
console.log('正在启动 Playwright MCP 和浏览器…');
|
|
122
|
-
child = spawn(process.execPath, args, { stdio: ['ignore', 'pipe', 'pipe'], windowsHide: true });
|
|
129
|
+
child = spawn(process.execPath, args, { stdio: ['ignore', 'pipe', 'pipe', 'ipc'], windowsHide: true });
|
|
123
130
|
let diagnostics = '';
|
|
124
131
|
for (const stream of [child.stdout, child.stderr]) stream.on('data', chunk => { diagnostics = (diagnostics + chunk).slice(-6000); });
|
|
125
132
|
child.on('error', error => { console.error(error.message); shutdown(1); });
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Keep shutdown cooperative on Windows: child.kill('SIGTERM') terminates the
|
|
2
|
+
// process there instead of delivering Playwright MCP's graceful signal handler.
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
const cli = join(dirname(require.resolve('@playwright/mcp/package.json')), 'cli.js');
|
|
8
|
+
function shutdown() {
|
|
9
|
+
// MCP installs a SIGTERM handler that closes all browser processes and flushes
|
|
10
|
+
// persistent profiles. An early shutdown before it installs has no browser.
|
|
11
|
+
if (!process.emit('SIGTERM')) process.exit(0);
|
|
12
|
+
}
|
|
13
|
+
if (process.send) {
|
|
14
|
+
process.on('message', message => { if (message?.type === 'shutdown') shutdown(); });
|
|
15
|
+
process.on('disconnect', shutdown);
|
|
16
|
+
}
|
|
17
|
+
process.argv[1] = cli;
|
|
18
|
+
require(cli);
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alicloud/autowonder",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.40",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@alicloud/autowonder",
|
|
9
|
-
"version": "0.3.
|
|
9
|
+
"version": "0.3.40",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"bin": {
|
|
12
12
|
"autowonder": "bin/cli.js"
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ const fs = require("node:fs");
|
|
|
4
4
|
const path = require("node:path");
|
|
5
5
|
|
|
6
6
|
function verifyBrowserPackage(root) {
|
|
7
|
-
for (const file of ["bin/browser.js", "lib/browser/cli.js", "lib/browser/browser.js", "lib/browser/gateway.js", "lib/browser/ui.js", "lib/browser/package.json", "lib/browser/README.md", "npm-shrinkwrap.json"]) {
|
|
7
|
+
for (const file of ["bin/browser.js", "lib/browser/cli.js", "lib/browser/mcp-runner.js", "lib/browser/browser.js", "lib/browser/gateway.js", "lib/browser/ui.js", "lib/browser/package.json", "lib/browser/README.md", "npm-shrinkwrap.json"]) {
|
|
8
8
|
if (!fs.existsSync(path.join(root, file))) throw new Error(`Missing browser package file: ${file}`);
|
|
9
9
|
}
|
|
10
10
|
const pkg = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|