@mearl/client 3.0.12 → 3.1.1
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.en.md +40 -30
- package/README.md +39 -29
- package/dist/actionTimeouts.js +9 -7
- package/dist/browserRegistry.d.ts +1 -1
- package/dist/browserRegistry.js +3 -1
- package/dist/capabilityHelp.js +21 -12
- package/dist/check.d.ts +0 -1
- package/dist/check.js +7 -22
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +16 -22
- package/dist/commandHelp.js +5 -8
- package/dist/commands.d.ts +88 -62
- package/dist/commands.js +87 -73
- package/dist/guides/api-browser-setup.md +23 -19
- package/dist/guides/api-page-automation.md +3 -1
- package/dist/guides/api-page-environment.md +5 -5
- package/dist/guides/api-request-debugging.md +1 -1
- package/dist/guides/browser-tool-cooperation.md +2 -2
- package/dist/guides/core.md +5 -5
- package/dist/guides/related-skills.md +16 -4
- package/dist/guides/troubleshooting.md +2 -2
- package/dist/index.d.ts +5 -6
- package/dist/index.js +9 -11
- package/dist/plugins/runtime/pluginDiagnostics.js +0 -1
- package/dist/plugins/runtime/pluginTaskManager.js +2 -5
- package/dist/script.js +22 -9
- package/dist/scriptCli.js +3 -5
- package/dist/sdkMethods.js +6 -1
- package/dist/socket.d.ts +0 -2
- package/dist/socket.js +159 -146
- package/dist/unified.d.ts +2 -3
- package/dist/unified.js +171 -84
- package/package.json +6 -6
package/README.en.md
CHANGED
|
@@ -58,6 +58,12 @@ mearl send_request --payload '{"url":"https://api.example.com/upload","method":"
|
|
|
58
58
|
# Save a screenshot; tabId comes from tab_open or tab_list
|
|
59
59
|
mearl page_screenshot --payload '{"tabId":12345}' --output ./screenshot.png
|
|
60
60
|
|
|
61
|
+
# Record a Chrome tab (local Chrome 153+)
|
|
62
|
+
mearl page_record --payload '{"operation":"start","tabId":12345}'
|
|
63
|
+
# After interacting with the page, use the browserId and recordingId returned by start
|
|
64
|
+
mearl page_record --browser '<browserId>' --payload '{"operation":"status","recordingId":"<recordingId>"}'
|
|
65
|
+
mearl page_record --browser '<browserId>' --payload '{"operation":"stop","recordingId":"<recordingId>"}' --output ./repro.mp4
|
|
66
|
+
|
|
61
67
|
# Read large parameters from a file; mock-data.json must include tabId
|
|
62
68
|
mearl set_mock --payload-file ./mock-data.json
|
|
63
69
|
|
|
@@ -72,12 +78,12 @@ npx @mearl/setup update --local
|
|
|
72
78
|
mearl <action> --help
|
|
73
79
|
|
|
74
80
|
# Launch isolated headless Chrome instances
|
|
75
|
-
mearl
|
|
76
|
-
mearl
|
|
77
|
-
mearl
|
|
78
|
-
mearl
|
|
81
|
+
mearl browser_manage --payload '{"operation":"launch","name":"browser-a","url":"https://example.com"}'
|
|
82
|
+
mearl browser_manage --payload '{"operation":"launch","name":"browser-b","persistent":true}'
|
|
83
|
+
mearl browser_manage --payload '{"operation":"launch","name":"cookie-copy","copyCookieDomains":["example.com"]}'
|
|
84
|
+
mearl browser_manage --payload '{"operation":"launch","name":"figma","userAgentMode":"desktop","copyCookieDomains":["figma.com"]}'
|
|
79
85
|
mearl browser_list
|
|
80
|
-
mearl
|
|
86
|
+
mearl browser_manage --payload '{"operation":"release"}'
|
|
81
87
|
```
|
|
82
88
|
|
|
83
89
|
### Agent scripts
|
|
@@ -129,11 +135,11 @@ const result = await mearl.invokePlugin('notes', {
|
|
|
129
135
|
console.log(result);
|
|
130
136
|
```
|
|
131
137
|
|
|
132
|
-
Browser APIs and plugin calls inherit script `--browser`, `--session`, `--connector`,
|
|
138
|
+
Browser APIs and plugin calls inherit script `--browser`, `--session`, `--connector`, and `--local`;
|
|
133
139
|
individual `options` may override them. `--server` selects cloud-server. After `--session new` establishes a session,
|
|
134
140
|
later calls use its returned ID automatically; `mearl.session` and CLI stderr report session information.
|
|
135
141
|
First await a session-establishing browser call before concurrency or Skill commands. Script completion disconnects SDK connections but retains control sessions;
|
|
136
|
-
explicitly call `mearl.
|
|
142
|
+
explicitly call `mearl.sessionManage({ operation: "end", sessionId })` to end the session. JavaScript variables reset each round; continue with returned `sessionId` and `tabId`.
|
|
137
143
|
|
|
138
144
|
Scripts run in separate Node.js processes inheriting caller cwd/environment with host Node.js permissions;
|
|
139
145
|
they are not security sandboxes. Load modules through dynamic imports such as `await import('node:fs/promises')`.
|
|
@@ -153,9 +159,9 @@ It supports `signal` cancellation and `executionTimeoutSec`, sharing executors w
|
|
|
153
159
|
|
|
154
160
|
### Control sessions and files
|
|
155
161
|
|
|
156
|
-
Use `
|
|
162
|
+
Use `session_list` to find control sessions. Use `session_manage` with `handoff` or `resume` and pass `--session <sessionId>` or a payload `sessionId`. For external Providers such as Ego, select the task with `--browser`.
|
|
157
163
|
|
|
158
|
-
|
|
164
|
+
Use `session_manage --browser <browserId> --payload '{"operation":"new"}'` to create an empty session, or pass `--session new` on the first `tab_open`, `page_snapshot`, or `page_screenshot`. Use the returned `sessionId` for subsequent calls.
|
|
159
165
|
|
|
160
166
|
`sessionId` is a short ID such as `s_aB3d_E-f`. The resident control host keeps sessions/browser/transport mappings in memory. New CLI processes internally query local/remote hosts for routing, without caller-managed routing or mapping files. Control-host exit invalidates sessions.
|
|
161
167
|
|
|
@@ -164,13 +170,13 @@ Calls may omit `--session`; existing actions, `run_actions`, and upload `filePat
|
|
|
164
170
|
```bash
|
|
165
171
|
mearl tab_open --session new --payload '{"url":"https://example.com"}'
|
|
166
172
|
mearl page_snapshot --session '<sessionId>' --payload '{"tabId":12345}'
|
|
167
|
-
mearl
|
|
173
|
+
mearl session_manage --session '<sessionId>' --payload '{"operation":"handoff","reason":"Please scan the QR code"}'
|
|
168
174
|
mearl page_download --session '<sessionId>' --payload '{"tabId":12345,"trigger":{"selector":"#export"}}' --output /absolute/path/report.csv
|
|
169
175
|
mearl page_upload --session '<sessionId>' --payload '{"tabId":12345,"selector":"input[type=file]","files":[{"filePath":"/absolute/path/report.csv"}]}'
|
|
170
|
-
mearl
|
|
176
|
+
mearl session_manage --session '<sessionId>' --payload '{"operation":"end","closeCreatedTabs":true,"keepTabIds":[12345]}'
|
|
171
177
|
```
|
|
172
178
|
|
|
173
|
-
Users take over, return, or end sessions in Popup browser management. Handoff stops queued stale requests and later batch steps; dispatched actions may still apply. Take a fresh snapshot after return. CDP-only environments can use the same `
|
|
179
|
+
Users take over, return, or end sessions in Popup browser management. Handoff stops queued stale requests and later batch steps; dispatched actions may still apply. Take a fresh snapshot after return. CDP-only environments can use the same `session_manage` with `operation:"resume"` after explicit user confirmation. Sessions survive CLI connections, expire on host exit, and are not idle-cleaned while users work.
|
|
174
180
|
|
|
175
181
|
New extension background tabs join a collapsed `Mearl` group; foreground tabs join the expanded `Mearl · 待操作` group. Both reuse one existing window and merge same-name managed groups. Subsequent opened tabs enter that window and inherit source-group expansion. Closing the work window selects another existing window without creating one. Explicit `tab_open.group` overrides grouping; reused ordinary pages retain windows/groups. Handoff moves only managed session pages into the pending group; return moves those still pending into `Mearl`. Groups remain expanded if users view other grouped pages or the window has no other visible page.
|
|
176
182
|
|
|
@@ -178,6 +184,8 @@ Session release affects only that session and keeps pages/environments by defaul
|
|
|
178
184
|
|
|
179
185
|
`page_download` listens before clicking and returns a browser artifact. CLI `--output` or SDK `saveArtifact(artifact, absolutePath, { session })` exports in 256 KiB chunks. `page_upload.files` accepts caller absolute `{filePath}` or browser `{artifactId}`; `filePaths` remains browser-host paths. Files are limited to 256 MiB. Caller-saved outputs are independent of temporary artifacts. Session release cleans temporary artifacts; `keepArtifactIds` retains selected ones. Sessionless artifacts expire after one idle hour; host exit clears staging.
|
|
180
186
|
|
|
187
|
+
Through the Chrome extension, `files` transfers up to 256 MiB total per upload in chunks to file inputs in HTTP(S) documents without **Allow access to file URLs**. With `filePaths`, Chrome reads host files directly. This supports large files and sites that require native file selection events. The extension requires the setting for `filePaths`. Direct CDP uploads do not require the extension setting.
|
|
188
|
+
|
|
181
189
|
Extension downloads require matching page referrers or an explicit expected `url`; unowned downloads are not guessed from recent files. CDP uses temporary directories only for managed browsers; shared browsers retain defaults and fail explicitly if Chrome provides no completed path. Timeouts may follow triggered downloads: inspect state before continuing. Session/download adapters support Extension/CDP; external action-handling Providers reject unsupported capabilities explicitly.
|
|
182
190
|
|
|
183
191
|
### External browser Providers
|
|
@@ -192,7 +200,7 @@ npx @mearl/setup provider install @example/mearl-provider-device
|
|
|
192
200
|
mearl example-device --help
|
|
193
201
|
|
|
194
202
|
# Provider launch arguments use providerOptions
|
|
195
|
-
mearl
|
|
203
|
+
mearl browser_manage --payload '{"operation":"launch","provider":"example-device","providerOptions":{}}'
|
|
196
204
|
mearl browser_list
|
|
197
205
|
|
|
198
206
|
# Use global Browser IDs returned by browser_list for later operations
|
|
@@ -203,9 +211,9 @@ npx @mearl/setup provider update example-device
|
|
|
203
211
|
npx @mearl/setup provider uninstall example-device
|
|
204
212
|
```
|
|
205
213
|
|
|
206
|
-
Creating a `pairing` instance with `
|
|
214
|
+
Creating a `pairing` instance with `browser_manage` returns `pairing.url` and an optional pairing code. Agents should render the URL directly as
|
|
207
215
|
a QR code, then confirm the same Browser ID becomes `connected` before page operations. Until the device connects,
|
|
208
|
-
it cannot become the default target. Use `
|
|
216
|
+
it cannot become the default target. Use `browser_manage close` to delete the Provider instance. Each Provider
|
|
209
217
|
receives only explicitly supported actions; screenshot support distinguishes native captures, reconstructed images, and unsupported.
|
|
210
218
|
|
|
211
219
|
Unknown or misspelled actions return up to three candidates and examples based on available commands/common aliases,
|
|
@@ -224,7 +232,7 @@ without connecting to browsers or executing suggestions. For example, `mearl tab
|
|
|
224
232
|
|
|
225
233
|
CLI, SDK, and MCP share return structures. Snapshot `@eN` refs are directly actionable; internal mappings remain runtime-local.
|
|
226
234
|
Ordinary `session` includes session ID, browser, transport, state, and generation. Query tabs with `tab_list`;
|
|
227
|
-
`
|
|
235
|
+
`session_manage` handoff for ordinary sessions also returns session `tabs`. External Providers omit `session` and return `{ controlSessionMode: "external", operation, control }`; supported Providers accept `operation: "end"` with `keepTabIds` to finish a task while retaining result pages. `run_actions` steps preserve individual action results.
|
|
228
236
|
stdout defaults to compact JSON in pipes/redirection and pretty output in interactive terminals. `--compact` forces compact layout without changing values. Snapshots collapse unnamed, stateless groups without refs while preserving control states and text.
|
|
229
237
|
|
|
230
238
|
With nonempty `fields`, `get_requests` omits request/response bodies by default, returning extracted fields and metadata;
|
|
@@ -242,10 +250,9 @@ Mearl aggregates local and configured cloud-server browsers by default, routing
|
|
|
242
250
|
| ------------------------ | ------------------------------------- |
|
|
243
251
|
| `--connector <id\|name>` | Restrict to one remote machine |
|
|
244
252
|
| `--local` | Current machine only |
|
|
245
|
-
| `--cdp` | Force local CDP; list only CDP browsers and imply `--local` |
|
|
246
253
|
| `--server <url>` | Override the automatically read cloud-server URL |
|
|
247
254
|
|
|
248
|
-
`browser_list --help` and `
|
|
255
|
+
`browser_list --help` and `browser_manage --help` show scenario-specific host options. For connection/transport troubleshooting, use
|
|
249
256
|
`mearl check --help`. `mearl check` checks connection/browser status. `mearl check --updates` also concurrently queries
|
|
250
257
|
latest client, native-host, cloud-connector, and extension releases. Release queries wait about 1.5 seconds at most;
|
|
251
258
|
unreachable sources report unconfirmed updates without affecting browser checks. `--json` returns machine-readable results,
|
|
@@ -275,7 +282,7 @@ Intervals use local calendar days. Run `mearl check --updates` for immediate rel
|
|
|
275
282
|
Install a Skill and automatically register commands, or register an existing entry:
|
|
276
283
|
|
|
277
284
|
```bash
|
|
278
|
-
npx @mearl/setup plugin install
|
|
285
|
+
npx @mearl/setup plugin install mearlhq/mearl --github --skill browser-tab-manager --yes
|
|
279
286
|
npx @mearl/setup plugin /absolute/path/to/browser-tab-manager
|
|
280
287
|
npx @mearl/setup plugin uninstall tabs
|
|
281
288
|
mearl tabs summary
|
|
@@ -464,11 +471,12 @@ Node plugins execute on the CLI/SDK/MCP Server host, never forwarded with browse
|
|
|
464
471
|
| Page runtimes | `page_runtime` (internal document adapter; plugins use `app.page`) |
|
|
465
472
|
| Composition | `run_actions` |
|
|
466
473
|
| Environment and Cookies | `set_device_emulation` `set_app_profile` `set_timezone` `get_cookie` `set_cookie` |
|
|
467
|
-
| Browsers | `browser_list` `
|
|
474
|
+
| Browsers | `browser_list` `browser_manage` |
|
|
475
|
+
| Control sessions | `session_list` `session_manage` |
|
|
468
476
|
|
|
469
477
|
Interactive actions (`page_click` / `page_drag` / `page_type` / `page_hover` / `page_scroll` / `page_press` / `page_upload`) wait for asynchronous stability by default and return `{ action, observation }`. Pre-dispatch argument/ref/target failures return `action.stage: "precondition"`, omitting meaningless observation/diagnostics. Potentially dispatched input with confirmation timeout returns `action.stage: "dispatch-uncertain"` and observations for reconciliation. Known targets, hits, coordinates, dispatch modes, and input sequences appear in `action.attempt` as diagnostic evidence, not proof of effect. CLI failures exit 1. `observe: false` performs bare actions; `diagnostics: true` collects new error logs/business requests during the action, with analytics optionally enabled through `diagnostics.events`. `page_eval` defaults to bare execution and permits observation/diagnostics.
|
|
470
478
|
|
|
471
|
-
`tab_open active:true` requests activation. Extension do-not-disturb defaults on: HTTP(S) pages get background-focus emulation before first navigation without switching tabs/windows. Disabling it activates/restores windows. `activation.mode` distinguishes `background` / `foreground`; emulated visibilityState does not prove foreground. Handoff, release, and disconnect disable focus emulation regardless of preserveEnvironment. After return, reactivate the same URL with `reuse:"require", active:true` if needed. Sessionless tasks finish with
|
|
479
|
+
`tab_open active:true` requests activation. Extension do-not-disturb defaults on: HTTP(S) pages get background-focus emulation before first navigation without switching tabs/windows. Disabling it activates/restores windows. `activation.mode` distinguishes `background` / `foreground`; emulated visibilityState does not prove foreground. Handoff, release, and disconnect disable focus emulation regardless of preserveEnvironment. After return, reactivate the same URL with `reuse:"require", active:true` if needed. Sessionless tasks finish with browser_manage release. Pure CDP/external Providers follow their own activation support. Stability observation waits for bounded-duration CSS animations within budget. Selector/ref clicks first scroll targets clipped by nested containers, failing explicitly only if still clipped.
|
|
472
480
|
|
|
473
481
|
In extension mode, `tab_open` with `appProfile` applies the App environment. Set `emulation.deviceShell` to `true` for the simulated WebView and system bars. On supported fixed devices with a single WebView, the extension applies the saved **Phone frame** preference from Quick Settings. Agent page actions target the active business WebView.
|
|
474
482
|
|
|
@@ -488,15 +496,17 @@ Disambiguate repeated text through `page_click.scope` CSS/ref subtrees. Extensio
|
|
|
488
496
|
|
|
489
497
|
`browser_list` lists ordinary, Provider, and managed browsers. `type` distinguishes
|
|
490
498
|
`regular` / `managed`; `status` distinguishes `connected` / `pairing` / `running_disconnected` /
|
|
491
|
-
`stopped`.
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
499
|
+
`stopped`. Ordinary browser actions require a connected browser. If neither an extension nor a CDP browser is connected locally, `browser_list` uses the CDP Provider to discover the default Chrome instance with remote debugging enabled. Browser commands also try discovery when no target is available. Use the following command to attach explicitly.
|
|
500
|
+
|
|
501
|
+
```bash
|
|
502
|
+
mearl browser_manage --local --payload '{"operation":"attach","provider":"cdp","providerOptions":{}}'
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
Set `providerOptions.port` to use a specific debugging port. Pass the returned `browserId` to `check --browser` or page actions. With `MEARL_SOCKET_PATH`, inventory requests use that instance socket.
|
|
506
|
+
|
|
507
|
+
`browser_manage` with `release` clears debugger/CDP control and temporary state while keeping the browser attached.
|
|
508
|
+
Use `detach` to disconnect while leaving the browser and its tabs running.
|
|
509
|
+
Run `mearl <providerId>` for the Provider’s lifecycle and sign-in options. Access URLs are excluded from
|
|
500
510
|
`browser_list`; explicitly run `mearl check --browser <id|name>` when needed and treat returned
|
|
501
511
|
`browserAccess.url` as sensitive.
|
|
502
512
|
|
package/README.md
CHANGED
|
@@ -58,6 +58,12 @@ mearl send_request --payload '{"url":"https://api.example.com/upload","method":"
|
|
|
58
58
|
# 截图并保存(tabId 来自 tab_open 或 tab_list)
|
|
59
59
|
mearl page_screenshot --payload '{"tabId":12345}' --output ./screenshot.png
|
|
60
60
|
|
|
61
|
+
# 录制 Chrome 标签页(本机 Chrome 153+)
|
|
62
|
+
mearl page_record --payload '{"operation":"start","tabId":12345}'
|
|
63
|
+
# 操作页面后,使用开始时返回的 browserId 和 recordingId
|
|
64
|
+
mearl page_record --browser '<browserId>' --payload '{"operation":"status","recordingId":"<recordingId>"}'
|
|
65
|
+
mearl page_record --browser '<browserId>' --payload '{"operation":"stop","recordingId":"<recordingId>"}' --output ./repro.mp4
|
|
66
|
+
|
|
61
67
|
# 从文件读取大体积参数(mock-data.json 需包含 tabId)
|
|
62
68
|
mearl set_mock --payload-file ./mock-data.json
|
|
63
69
|
|
|
@@ -72,12 +78,12 @@ npx @mearl/setup update --local
|
|
|
72
78
|
mearl <action> --help
|
|
73
79
|
|
|
74
80
|
# 启动两个隔离的 headless Chrome
|
|
75
|
-
mearl
|
|
76
|
-
mearl
|
|
77
|
-
mearl
|
|
78
|
-
mearl
|
|
81
|
+
mearl browser_manage --payload '{"operation":"launch","name":"browser-a","url":"https://example.com"}'
|
|
82
|
+
mearl browser_manage --payload '{"operation":"launch","name":"browser-b","persistent":true}'
|
|
83
|
+
mearl browser_manage --payload '{"operation":"launch","name":"cookie-copy","copyCookieDomains":["example.com"]}'
|
|
84
|
+
mearl browser_manage --payload '{"operation":"launch","name":"figma","userAgentMode":"desktop","copyCookieDomains":["figma.com"]}'
|
|
79
85
|
mearl browser_list
|
|
80
|
-
mearl
|
|
86
|
+
mearl browser_manage --payload '{"operation":"release"}'
|
|
81
87
|
```
|
|
82
88
|
|
|
83
89
|
### Agent 脚本
|
|
@@ -129,11 +135,11 @@ const result = await mearl.invokePlugin('notes', {
|
|
|
129
135
|
console.log(result);
|
|
130
136
|
```
|
|
131
137
|
|
|
132
|
-
脚本的 `--browser`、`--session`、`--connector`、`--local
|
|
138
|
+
脚本的 `--browser`、`--session`、`--connector`、`--local` 由浏览器 API 和插件调用继承;
|
|
133
139
|
单次调用的 `options` 可覆盖。`--server` 指定 cloud-server。`--session new` 成功建立会话后,
|
|
134
140
|
后续调用自动使用返回的 ID,`mearl.session` 和 CLI stderr 同时提供会话信息。
|
|
135
141
|
先 await 建立会话的浏览器调用,再执行并发或 Skill 命令。脚本结束断开 SDK 连接,控制会话保留;
|
|
136
|
-
按任务生命周期显式调用 `mearl.
|
|
142
|
+
按任务生命周期显式调用 `mearl.sessionManage({ operation: "end", sessionId })`。每轮重建 JS 变量,使用已返回的 `sessionId` 和 `tabId` 继续任务。
|
|
137
143
|
|
|
138
144
|
每次脚本在独立 Node.js 进程运行,继承调用方的工作目录和环境,拥有该宿主的 Node.js 权限;
|
|
139
145
|
它不是安全沙箱。用 `await import('node:fs/promises')` 等动态 import 加载模块;
|
|
@@ -153,9 +159,9 @@ SDK 宿主可从 `@mearl/client/script` 导入 `executeScript(code, options)`,
|
|
|
153
159
|
|
|
154
160
|
### 控制会话与文件
|
|
155
161
|
|
|
156
|
-
|
|
162
|
+
用 `session_list` 查询控制会话,使用 `session_manage` 的 `handoff` 和 `resume` 交接控制。指定 `--session <sessionId>` 或在 payload 中传入 `sessionId`。Ego 等外部 Provider 通过 `--browser` 指定任务。
|
|
157
163
|
|
|
158
|
-
|
|
164
|
+
用 `session_manage --browser <browserId> --payload '{"operation":"new"}'` 创建空会话。也可以在首次 `tab_open`、`page_snapshot` 或 `page_screenshot` 上用 `--session new`。后续用响应中的 `sessionId` 自动路由。会话绑定一个浏览器与传输,页面在首次使用时关联。同一页面只允许一个会话控制,会话之间共享 Cookie 和存储。
|
|
159
165
|
|
|
160
166
|
`sessionId` 是形如 `s_aB3d_E-f` 的短 ID。会话及其浏览器、传输映射保存在常驻控制宿主的内存中;新的 CLI 进程会内部查询本机和远端宿主完成路由,无需调用方保存或传递路由信息,也不写入会话映射文件。控制宿主退出后会话失效。
|
|
161
167
|
|
|
@@ -164,13 +170,13 @@ SDK 宿主可从 `@mearl/client/script` 导入 `executeScript(code, options)`,
|
|
|
164
170
|
```bash
|
|
165
171
|
mearl tab_open --session new --payload '{"url":"https://example.com"}'
|
|
166
172
|
mearl page_snapshot --session '<sessionId>' --payload '{"tabId":12345}'
|
|
167
|
-
mearl
|
|
173
|
+
mearl session_manage --session '<sessionId>' --payload '{"operation":"handoff","reason":"请完成扫码"}'
|
|
168
174
|
mearl page_download --session '<sessionId>' --payload '{"tabId":12345,"trigger":{"selector":"#export"}}' --output /absolute/path/report.csv
|
|
169
175
|
mearl page_upload --session '<sessionId>' --payload '{"tabId":12345,"selector":"input[type=file]","files":[{"filePath":"/absolute/path/report.csv"}]}'
|
|
170
|
-
mearl
|
|
176
|
+
mearl session_manage --session '<sessionId>' --payload '{"operation":"end","closeCreatedTabs":true,"keepTabIds":[12345]}'
|
|
171
177
|
```
|
|
172
178
|
|
|
173
|
-
用户在 Popup 的浏览器管理页接管、交还或结束会话。交接后排队旧请求和批次后续步骤停止;已派发动作可能仍然生效。交还后重新取快照。CDP-only 环境可在用户明确确认后用同一 `
|
|
179
|
+
用户在 Popup 的浏览器管理页接管、交还或结束会话。交接后排队旧请求和批次后续步骤停止;已派发动作可能仍然生效。交还后重新取快照。CDP-only 环境可在用户明确确认后用同一 `session_manage` 的 `operation:"resume"` 交还,无需额外 action。会话跨 CLI 连接保留,宿主进程退出后失效;不会根据空闲时间清理用户正在操作的会话。
|
|
174
180
|
|
|
175
181
|
扩展中新开的后台页面默认加入折叠的 `Mearl` 标签组,前台新页进入展开的 `Mearl · 待操作` 组。两个管理组统一复用同一个已有窗口,同名管理组会合并;页面打开的后续标签也收进该窗口,并继承源组的展开状态。工作窗口关闭后重新选择已有窗口,不额外创建窗口。显式传入 `tab_open.group` 时使用指定分组;复用普通页面时保留原窗口和分组。接管会话只把管理组内的会话页面移入待操作组;交还后,仍在待操作组内的会话页面收回 `Mearl` 组。用户正在查看组内其他页面,或窗口没有其他可显示页面时,保留展开状态。
|
|
176
182
|
|
|
@@ -178,6 +184,8 @@ mearl browser_release --session '<sessionId>' --payload '{"closeCreatedTabs":tru
|
|
|
178
184
|
|
|
179
185
|
`page_download` 先监听再点击,返回浏览器文件产物;CLI `--output` 或 SDK `saveArtifact(artifact, absolutePath, { session })` 以 256 KiB 分块导出到调用方。`page_upload.files` 接受调用方绝对路径 `{filePath}` 或浏览器 `{artifactId}`,`filePaths` 仍指浏览器宿主路径。单文件最多 256 MiB;保存到调用方的结果独立于临时产物。会话释放清理临时产物,`keepArtifactIds` 可保留指定产物;无会话产物空闲一小时回收,宿主退出清理暂存。
|
|
180
186
|
|
|
187
|
+
通过 Chrome 扩展连接时,`files` 支持 HTTP(S) 页面的文件输入框,分块传输合计最多 256 MiB,无需开启「允许访问文件网址」。`filePaths` 由 Chrome 直接读取宿主文件,适用于大文件或要求原生文件选择事件的站点,在扩展连接中需要开启该设置。直连 CDP 的上传无需此扩展设置。
|
|
188
|
+
|
|
181
189
|
扩展捕获下载需要匹配来源页 referrer 或明确的预期 `url`,无法归属时不会认领最近下载。CDP 只在托管浏览器中使用临时下载目录,共享浏览器保持默认目录,Chrome 未返回完成文件路径时明确报错。下载超时可能已经触发,需检查现场再决定下一步。当前会话与下载适配 Extension/CDP;直接处理页面动作的外部 Provider 对不支持的能力明确报错。
|
|
182
190
|
|
|
183
191
|
### 外部浏览器 Provider
|
|
@@ -192,7 +200,7 @@ npx @mearl/setup provider install @example/mearl-provider-device
|
|
|
192
200
|
mearl example-device --help
|
|
193
201
|
|
|
194
202
|
# Provider 启动参数统一放在 providerOptions
|
|
195
|
-
mearl
|
|
203
|
+
mearl browser_manage --payload '{"operation":"launch","provider":"example-device","providerOptions":{}}'
|
|
196
204
|
mearl browser_list
|
|
197
205
|
|
|
198
206
|
# 后续操作使用 browser_list 返回的全局 Browser ID
|
|
@@ -203,9 +211,9 @@ npx @mearl/setup provider update example-device
|
|
|
203
211
|
npx @mearl/setup provider uninstall example-device
|
|
204
212
|
```
|
|
205
213
|
|
|
206
|
-
`
|
|
214
|
+
`browser_manage` 创建 `pairing` 实例时会直接返回 `pairing.url` 和可选的配对码;Agent 应把 URL 直接渲染为
|
|
207
215
|
二维码交给用户,扫码后确认同一 Browser ID 变为 `connected`,再开始页面操作。在设备连入前
|
|
208
|
-
该实例不会成为默认操作目标;可用 `
|
|
216
|
+
该实例不会成为默认操作目标;可用 `browser_manage close` 删除对应 Provider 实例。每个 Provider
|
|
209
217
|
只接收它为该浏览器显式声明支持的 actions,截图能力同时标明为原生截图、重建画面或不支持。
|
|
210
218
|
|
|
211
219
|
输入不存在或拼写有误的 action 时,CLI 会基于可用命令和常见别名直接返回最多三个候选及调用示例,
|
|
@@ -224,7 +232,7 @@ npx @mearl/setup provider uninstall example-device
|
|
|
224
232
|
|
|
225
233
|
CLI、SDK、MCP 使用同一返回结构。快照中的 `@eN` 可直接用于操作,内部节点映射只保存在运行时。
|
|
226
234
|
常规响应的 `session` 包含会话 ID、浏览器、传输、状态和代次;标签页清单通过 `tab_list` 查询,
|
|
227
|
-
`
|
|
235
|
+
`session_manage` 的普通会话交接结果包含会话页面的 `tabs`。外部 Provider 不传 `session`,返回 `{ controlSessionMode: "external", operation, control }`;支持的 Provider 可用 `operation: "end"` 和 `keepTabIds` 完成任务并保留结果页。`run_actions` 的步骤使用各 action 的返回结构。
|
|
228
236
|
stdout 在管道或重定向时默认输出紧凑 JSON,在交互终端默认美化;`--compact` 可强制紧凑排版,不改变返回字段和值。快照会折叠无名称、无 ref 且无状态的分组,控件状态与文本内容完整保留。
|
|
229
237
|
|
|
230
238
|
`get_requests` 指定非空 `fields` 时默认省略请求体和响应体,只返回提取字段及请求元数据;
|
|
@@ -242,10 +250,9 @@ Mearl 默认聚合当前机器和已配置 cloud-server 下的浏览器,并通
|
|
|
242
250
|
| ------------------------ | ------------------------------------- |
|
|
243
251
|
| `--connector <id\|名称>` | 限制到一台远端机器 |
|
|
244
252
|
| `--local` | 只使用当前机器 |
|
|
245
|
-
| `--cdp` | 当前机器强制使用 CDP;清单只列 CDP 浏览器,并隐含 `--local` |
|
|
246
253
|
| `--server <url>` | 覆盖自动读取的 cloud-server 地址 |
|
|
247
254
|
|
|
248
|
-
`browser_list --help` 和 `
|
|
255
|
+
`browser_list --help` 和 `browser_manage --help` 会按场景展示宿主选择参数;连接或传输排障运行
|
|
249
256
|
`mearl check --help`。`mearl check` 检查连接与浏览器状态;`mearl check --updates` 还会并发查询
|
|
250
257
|
client、native-host、cloud-connector 和扩展的最新发布版本。发布版本查询最长等待约 1.5 秒,
|
|
251
258
|
无法访问发布源时会提示无法确认更新,不影响浏览器可用性检查。`--json` 输出机器可读的检查结果,
|
|
@@ -275,7 +282,7 @@ client、native-host、cloud-server 和 MCP server 的已安装版本。发现
|
|
|
275
282
|
安装 skill 并自动注册命令,或直接注册已有入口:
|
|
276
283
|
|
|
277
284
|
```bash
|
|
278
|
-
npx @mearl/setup plugin install
|
|
285
|
+
npx @mearl/setup plugin install mearlhq/mearl --github --skill browser-tab-manager --yes
|
|
279
286
|
npx @mearl/setup plugin /absolute/path/to/browser-tab-manager
|
|
280
287
|
npx @mearl/setup plugin uninstall tabs
|
|
281
288
|
mearl tabs summary
|
|
@@ -464,11 +471,12 @@ Node 插件在运行 CLI、SDK 或 MCP Server 的宿主上执行,不随浏览
|
|
|
464
471
|
| 页面运行时 | `page_runtime`(内部文档适配,插件使用 `app.page`) |
|
|
465
472
|
| 组合调用 | `run_actions` |
|
|
466
473
|
| 环境与 Cookie | `set_device_emulation` `set_app_profile` `set_timezone` `get_cookie` `set_cookie` |
|
|
467
|
-
| 浏览器
|
|
474
|
+
| 浏览器 | `browser_list` `browser_manage` |
|
|
475
|
+
| 控制会话 | `session_list` `session_manage` |
|
|
468
476
|
|
|
469
477
|
页面交互动作(`page_click` / `page_drag` / `page_type` / `page_hover` / `page_scroll` / `page_press` / `page_upload`)默认等待异步稳定并返回 `{ action, observation }`。参数、ref 或目标解析在派发前失败时返回 `action.stage: "precondition"`,省略无意义的 `observation` / `diagnostics`;浏览器可能已收到输入但确认超时时返回 `action.stage: "dispatch-uncertain"`,并保留 observation 供核验当前状态。能够在超时前确定的目标、命中、坐标、派发模式和输入序列状态保存在 `action.attempt`,它是诊断证据,不表示动作已经生效。失败时 CLI 退出码为 1。传 `observe: false` 可执行裸动作;需要同一动作期间的新增 error logs 和业务 requests 时传 `diagnostics: true`,埋点通过 `diagnostics.events` 按需开启。`page_eval` 默认裸执行,可按需开启观察或诊断。
|
|
470
478
|
|
|
471
|
-
`tab_open active:true` 请求激活目标页。扩展免打扰默认开启:HTTP(S) 页面在首次导航前启用后台焦点模拟,不切换标签页或窗口;关闭免打扰才会真实激活并恢复最小化窗口。`activation.mode` 区分 `background` / `foreground`,模拟后的 `visibilityState` 不代表窗口在前台。焦点模拟在交接、释放控制或扩展连接断开时关闭,`preserveEnvironment` 不保留它;交还后按需对同 URL 使用 `reuse:"require", active:true` 再次激活。不带会话时通过 `
|
|
479
|
+
`tab_open active:true` 请求激活目标页。扩展免打扰默认开启:HTTP(S) 页面在首次导航前启用后台焦点模拟,不切换标签页或窗口;关闭免打扰才会真实激活并恢复最小化窗口。`activation.mode` 区分 `background` / `foreground`,模拟后的 `visibilityState` 不代表窗口在前台。焦点模拟在交接、释放控制或扩展连接断开时关闭,`preserveEnvironment` 不保留它;交还后按需对同 URL 使用 `reuse:"require", active:true` 再次激活。不带会话时通过 `browser_manage release` 收尾。纯 CDP 和外部 Provider 遵循各自的激活能力。页面动作的稳定观察会在有限预算内等待有限时长 CSS 动画。selector/ref 点击遇到嵌套滚动裁剪时会先滚动目标,仍不可见时才以明确的裁剪错误停止。
|
|
472
480
|
|
|
473
481
|
扩展模式下,`tab_open` 传入 `appProfile` 会应用 App 环境。需要模拟 WebView 和系统栏时,设置 `emulation.deviceShell: true`。对于使用单个 WebView 的受支持固定机型,扩展会沿用快捷设置里保存的**手机壳**偏好。Agent 的页面操作以当前业务 WebView 为目标。
|
|
474
482
|
|
|
@@ -488,14 +496,16 @@ Node 插件在运行 CLI、SDK 或 MCP Server 的宿主上执行,不随浏览
|
|
|
488
496
|
|
|
489
497
|
`browser_list` 统一列出普通浏览器、Provider 浏览器和托管浏览器。`type` 区分
|
|
490
498
|
`regular` / `managed`,`status` 区分 `connected` / `pairing` / `running_disconnected` /
|
|
491
|
-
`stopped`;只有 `connected`
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
`
|
|
498
|
-
|
|
499
|
+
`stopped`;只有 `connected` 的浏览器可作为常规操作目标。本机没有已连接的扩展或已接入的 CDP 实例时,`browser_list` 会通过 CDP Provider 发现已开启远程调试的默认 Chrome。直接执行浏览器命令时,如果没有可用目标,也会尝试发现。可以用下列命令显式接入。
|
|
500
|
+
|
|
501
|
+
```bash
|
|
502
|
+
mearl browser_manage --local --payload '{"operation":"attach","provider":"cdp","providerOptions":{}}'
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
需要指定调试端口时传入 `providerOptions.port`。用响应中的 `browserId` 执行 `check --browser` 或页面操作。设置 `MEARL_SOCKET_PATH` 时,清单请求沿用该实例 Socket。
|
|
506
|
+
|
|
507
|
+
`browser_manage` 的 `release` 清理 debugger/CDP 控制及临时状态,保留浏览器、标签页和原有接入。
|
|
508
|
+
`detach` 断开接入并保留浏览器。托管实例的启动、关闭、持久化、
|
|
499
509
|
接入和登录态同步语义由各 Provider 声明;运行 `mearl <providerId>` 获取当前说明。访问入口不在
|
|
500
510
|
`browser_list` 中,需要时显式运行 `mearl check --browser <id|名称>`,并把返回的
|
|
501
511
|
`browserAccess.url` 按敏感信息处理。
|
package/dist/actionTimeouts.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { PAGE_ACT_ACTIONS } from '@mearl/browser-core';
|
|
1
|
+
import { PAGE_ACT_ACTIONS, PAGE_UPLOAD_FILE_TRANSFER_TIMEOUT_MS, } from '@mearl/browser-core';
|
|
2
2
|
const SEND_REQUEST_FILE_TRANSFER_TIMEOUT_MS = 120_000;
|
|
3
|
-
// Remote Providers may stage files before forwarding a page upload.
|
|
4
|
-
const PAGE_UPLOAD_FILE_TRANSFER_TIMEOUT_MS = 180_000;
|
|
5
3
|
// Persistent Providers may need to synchronize remote state before closing an instance.
|
|
6
4
|
const BROWSER_CLOSE_TIMEOUT_SEC = 18 * 60;
|
|
7
5
|
function boundedNumber(value, fallback, minimum, maximum) {
|
|
@@ -28,6 +26,8 @@ export function resolveActionTimeoutSec(action, data, fallback = 15) {
|
|
|
28
26
|
}
|
|
29
27
|
if (action === 'page_download')
|
|
30
28
|
return Math.max(fallback, Math.ceil((Number(data.timeout ?? 30000) + 10000) / 1000));
|
|
29
|
+
if (action === 'page_record' && data.operation === 'stop')
|
|
30
|
+
return Math.max(fallback, 60);
|
|
31
31
|
if (action === 'page_wait') {
|
|
32
32
|
const waitMs = data.time ?? data.timeout ?? 10000;
|
|
33
33
|
return Math.max(fallback, Math.ceil((Number(waitMs) + 5000) / 1000));
|
|
@@ -36,10 +36,12 @@ export function resolveActionTimeoutSec(action, data, fallback = 15) {
|
|
|
36
36
|
return Math.max(fallback, 40);
|
|
37
37
|
if (action === 'set_cookie' && data.reload === true)
|
|
38
38
|
return Math.max(fallback, 40);
|
|
39
|
-
if (action === '
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
if (action === 'browser_manage') {
|
|
40
|
+
if (data.operation === 'launch' || data.operation === 'attach')
|
|
41
|
+
return Math.max(fallback, 90);
|
|
42
|
+
if (data.operation === 'close' || data.operation === 'detach')
|
|
43
|
+
return Math.max(fallback, BROWSER_CLOSE_TIMEOUT_SEC);
|
|
44
|
+
}
|
|
43
45
|
if (action === 'run_actions') {
|
|
44
46
|
const actions = Array.isArray(data.actions) ? data.actions : [{}];
|
|
45
47
|
const timeoutSec = actions.reduce((total, step) => {
|
|
@@ -44,6 +44,6 @@ export declare function listLiveBrowsers(): LiveBrowser[];
|
|
|
44
44
|
* Find the browser matching a user selector: exact browserId first, then an
|
|
45
45
|
* exact (case-insensitive) name, then a substring of id/name.
|
|
46
46
|
*/
|
|
47
|
-
export declare function findBrowser(browsers: LiveBrowser[], selector: string): LiveBrowser | null;
|
|
47
|
+
export declare function findBrowser(browsers: LiveBrowser[], selector: string, exactOnly?: boolean): LiveBrowser | null;
|
|
48
48
|
/** Human-readable one-line label for a browser, used in listings and errors. */
|
|
49
49
|
export declare function describeBrowser(b: LiveBrowser): string;
|
package/dist/browserRegistry.js
CHANGED
|
@@ -61,7 +61,7 @@ export function listLiveBrowsers() {
|
|
|
61
61
|
* Find the browser matching a user selector: exact browserId first, then an
|
|
62
62
|
* exact (case-insensitive) name, then a substring of id/name.
|
|
63
63
|
*/
|
|
64
|
-
export function findBrowser(browsers, selector) {
|
|
64
|
+
export function findBrowser(browsers, selector, exactOnly = false) {
|
|
65
65
|
const sel = selector.trim().toLowerCase();
|
|
66
66
|
if (!sel)
|
|
67
67
|
return null;
|
|
@@ -76,6 +76,8 @@ export function findBrowser(browsers, selector) {
|
|
|
76
76
|
}
|
|
77
77
|
if (exactNameMatches[0])
|
|
78
78
|
return exactNameMatches[0];
|
|
79
|
+
if (exactOnly)
|
|
80
|
+
return null;
|
|
79
81
|
return (browsers.find(b => b.browserId.toLowerCase().includes(sel) || b.browserName.toLowerCase().includes(sel)) ?? null);
|
|
80
82
|
}
|
|
81
83
|
/** Human-readable one-line label for a browser, used in listings and errors. */
|
package/dist/capabilityHelp.js
CHANGED
|
@@ -5,27 +5,36 @@ import { UnifiedClient } from './unified.js';
|
|
|
5
5
|
export async function readHelpCapabilities(args) {
|
|
6
6
|
const value = (flag) => {
|
|
7
7
|
const index = args.indexOf(flag);
|
|
8
|
-
return index < 0
|
|
8
|
+
return index < 0
|
|
9
|
+
? args.find(arg => arg.startsWith(`${flag}=`))?.slice(flag.length + 1)
|
|
10
|
+
: args[index + 1];
|
|
9
11
|
};
|
|
10
12
|
const browser = value('--browser');
|
|
11
13
|
const session = value('--session');
|
|
12
14
|
const connector = value('--connector');
|
|
13
15
|
const { serverUrl } = resolveServer(value('--server'));
|
|
14
|
-
const local = args.includes('--local')
|
|
15
|
-
if (local && connector || session === 'new')
|
|
16
|
+
const local = args.includes('--local');
|
|
17
|
+
if ((local && connector) || session === 'new')
|
|
16
18
|
return;
|
|
17
19
|
if (!browser && !connector && (local || !serverUrl) && !session && !listLiveBrowsers().length)
|
|
18
20
|
return;
|
|
19
|
-
const client = new UnifiedClient({
|
|
21
|
+
const client = new UnifiedClient({
|
|
22
|
+
connectTimeoutSec: 1,
|
|
23
|
+
requestTimeoutSec: 1,
|
|
24
|
+
...(serverUrl ? { serverUrl } : {}),
|
|
25
|
+
});
|
|
20
26
|
let timer;
|
|
21
27
|
try {
|
|
22
28
|
const result = await Promise.race([
|
|
23
29
|
client.invoke('get_capabilities', {}, {
|
|
24
|
-
...(browser ? { browser } : {}),
|
|
25
|
-
...(
|
|
26
|
-
...(
|
|
30
|
+
...(browser ? { browser } : {}),
|
|
31
|
+
...(session ? { session } : {}),
|
|
32
|
+
...(connector ? { connector } : {}),
|
|
33
|
+
...(local ? { local: true } : {}),
|
|
34
|
+
}),
|
|
35
|
+
new Promise(resolve => {
|
|
36
|
+
timer = setTimeout(() => resolve(undefined), 1500);
|
|
27
37
|
}),
|
|
28
|
-
new Promise(resolve => { timer = setTimeout(() => resolve(undefined), 1500); }),
|
|
29
38
|
]);
|
|
30
39
|
if (result && Array.isArray(result.actions) && Array.isArray(result.apps?.entries))
|
|
31
40
|
return result;
|
|
@@ -41,11 +50,11 @@ export async function readHelpCapabilities(args) {
|
|
|
41
50
|
export function formatCapabilityHelp(catalog, detailed = false) {
|
|
42
51
|
if (!catalog)
|
|
43
52
|
return '当前浏览器能力暂不可读,以下为静态帮助。连接后再次运行 --help 可查看已安装的端模拟。';
|
|
44
|
-
const lines = [
|
|
45
|
-
'当前浏览器已安装的端模拟:',
|
|
46
|
-
];
|
|
53
|
+
const lines = ['当前浏览器已安装的端模拟:'];
|
|
47
54
|
if (!catalog.apps.entries.length)
|
|
48
|
-
lines.push(catalog.apps.status === 'available'
|
|
55
|
+
lines.push(catalog.apps.status === 'available'
|
|
56
|
+
? ' 暂无已安装的端模拟。设备模拟可独立使用。'
|
|
57
|
+
: ' 暂时无法读取端模拟列表,安装状态待确认。');
|
|
49
58
|
for (const app of catalog.apps.entries) {
|
|
50
59
|
lines.push(` ${app.id} — ${app.label}${app.available ? '' : '(暂不可用)'}`);
|
|
51
60
|
if (!detailed)
|
package/dist/check.d.ts
CHANGED
package/dist/check.js
CHANGED
|
@@ -152,9 +152,7 @@ export async function runUnifiedCheck(options, dependencies = {}) {
|
|
|
152
152
|
if (options.local) {
|
|
153
153
|
environment.push({
|
|
154
154
|
status: 'ok',
|
|
155
|
-
label:
|
|
156
|
-
? 'Browser scope: this machine (forced CDP)'
|
|
157
|
-
: 'Browser scope: this machine',
|
|
155
|
+
label: 'Browser scope: this machine',
|
|
158
156
|
});
|
|
159
157
|
}
|
|
160
158
|
else if (options.serverUrl) {
|
|
@@ -189,7 +187,6 @@ export async function runUnifiedCheck(options, dependencies = {}) {
|
|
|
189
187
|
const inventoryOptions = {
|
|
190
188
|
timeoutSec,
|
|
191
189
|
...(options.local ? { local: true } : {}),
|
|
192
|
-
...(options.transport ? { transport: options.transport } : {}),
|
|
193
190
|
...(!options.local && options.connector ? { connector: options.connector } : {}),
|
|
194
191
|
};
|
|
195
192
|
try {
|
|
@@ -220,10 +217,8 @@ export async function runUnifiedCheck(options, dependencies = {}) {
|
|
|
220
217
|
details: [formatError(error)],
|
|
221
218
|
});
|
|
222
219
|
}
|
|
223
|
-
const connected = (browserList?.browsers ?? []).filter(browser => browser.status === 'connected'
|
|
224
|
-
(options.transport !== 'cdp' || browser.transport === 'cdp'));
|
|
220
|
+
const connected = (browserList?.browsers ?? []).filter(browser => browser.status === 'connected');
|
|
225
221
|
if ((options.local || !options.serverUrl) &&
|
|
226
|
-
options.transport !== 'cdp' &&
|
|
227
222
|
!connected.some(browser => browser.transport === 'extension')) {
|
|
228
223
|
const diagnostics = (dependencies.inspectNativeHostInstallation ?? inspectNativeHostInstallation)();
|
|
229
224
|
environment.push(...diagnostics.map(item => ({ status: 'warning', ...item })));
|
|
@@ -254,11 +249,9 @@ export async function runUnifiedCheck(options, dependencies = {}) {
|
|
|
254
249
|
if (!options.browser && connected.length === 0 && browserList) {
|
|
255
250
|
environment.push({
|
|
256
251
|
status: 'error',
|
|
257
|
-
label:
|
|
252
|
+
label: 'No connected browser',
|
|
258
253
|
details: [
|
|
259
|
-
|
|
260
|
-
? 'Enable a local CDP endpoint (see `mearl-native-host --help`) and run `mearl browser_list --cdp` to inspect discovery.'
|
|
261
|
-
: 'Open Chrome with the Mearl extension, start a managed browser, or connect a browser host.',
|
|
254
|
+
'Open Chrome with the Mearl extension, start a managed browser, or attach an existing browser with a Provider.',
|
|
262
255
|
...(!options.local && connectors.length > 0
|
|
263
256
|
? [
|
|
264
257
|
'Connectors are connected but expose no ready browser. On the browser machine, run `mearl check --local`; use `mearl connector_list` for versions and heartbeat details.',
|
|
@@ -270,18 +263,12 @@ export async function runUnifiedCheck(options, dependencies = {}) {
|
|
|
270
263
|
const browserChecks = [];
|
|
271
264
|
await Promise.all(targets.map(async (browser) => {
|
|
272
265
|
try {
|
|
273
|
-
if (options.transport === 'cdp') {
|
|
274
|
-
await client.invoke('tab_list', {}, {
|
|
275
|
-
timeoutSec,
|
|
276
|
-
browser: browser.browserId,
|
|
277
|
-
transport: 'cdp',
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
266
|
const versions = (await client.invoke('get_versions', {}, {
|
|
281
267
|
timeoutSec,
|
|
282
268
|
browser: browser.browserId,
|
|
283
|
-
...(options.transport ? { transport: options.transport } : {}),
|
|
284
269
|
}));
|
|
270
|
+
if (browser.transport === 'cdp' && options.browser)
|
|
271
|
+
await client.invoke('tab_list', {}, { timeoutSec, browser: browser.browserId });
|
|
285
272
|
const publicVersions = {
|
|
286
273
|
...(versions.nativeHost ? { nativeHost: versions.nativeHost } : {}),
|
|
287
274
|
...(versions.extension !== undefined ? { extension: versions.extension } : {}),
|
|
@@ -334,9 +321,7 @@ export async function runUnifiedCheck(options, dependencies = {}) {
|
|
|
334
321
|
status: accessUrlWarning ? 'warning' : 'ok',
|
|
335
322
|
label: accessUrlWarning
|
|
336
323
|
? 'Browser command path ready; browser access URL unavailable'
|
|
337
|
-
:
|
|
338
|
-
? 'CDP command path'
|
|
339
|
-
: 'Browser command path',
|
|
324
|
+
: 'Browser command path',
|
|
340
325
|
details,
|
|
341
326
|
},
|
|
342
327
|
versions: publicVersions,
|