@mearl/client 2.19.2 → 2.19.3
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 +12 -3
- package/dist/check.js +16 -4
- package/dist/cli.js +20 -1
- package/dist/commands.d.ts +73 -12
- package/dist/commands.js +198 -8
- package/dist/generated-browser-action-protocol.d.ts +8 -4
- package/dist/generated-browser-action-protocol.js +14 -5
- package/dist/plugin.d.ts +5 -2
- package/dist/plugin.js +66 -21
- package/dist/pluginPageBundle.d.ts +1 -0
- package/dist/pluginPageBundle.js +7 -1
- package/dist/pluginRegistry.d.ts +5 -0
- package/dist/pluginRegistry.js +28 -0
- package/dist/pluginSource.d.ts +2 -0
- package/dist/pluginSource.js +8 -0
- package/dist/socket.js +180 -44
- package/dist/unified.js +2 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -123,7 +123,7 @@ Mearl 默认聚合当前机器和已配置 cloud-server 下的浏览器,并通
|
|
|
123
123
|
| ------------------------ | ------------------------------------- |
|
|
124
124
|
| `--connector <id\|名称>` | 限制到一台远端机器 |
|
|
125
125
|
| `--local` | 只使用当前机器 |
|
|
126
|
-
| `--cdp` | 当前机器强制使用 CDP
|
|
126
|
+
| `--cdp` | 当前机器强制使用 CDP;清单只列 CDP 浏览器,并隐含 `--local` |
|
|
127
127
|
| `--server <url>` | 覆盖自动读取的 cloud-server 地址 |
|
|
128
128
|
|
|
129
129
|
`browser_list --help` 和 `browser_launch --help` 会按场景展示宿主选择参数;连接或传输排障运行
|
|
@@ -268,13 +268,18 @@ Preact、Hooks 和 HTM 运行时。页面从 `window.mearl.ui` 读取 `html`、`
|
|
|
268
268
|
`--mearl-accent` 等语义变量;主操作按钮使用 `--mearl-action-primary`、
|
|
269
269
|
`--mearl-action-primary-hover` 和 `--mearl-action-primary-text`,以保持与扩展按钮一致。
|
|
270
270
|
|
|
271
|
-
需要 BUC 身份的内部 HTTP 接口通过官方 `buc` 插件调用。CLI 使用 `mearl buc request`,业务插件使用
|
|
271
|
+
需要 BUC 身份的内部 HTTP 接口通过官方 `buc` 插件调用。CLI 使用 `mearl buc request <url> [app]`,业务插件使用
|
|
272
272
|
`app.invoke('buc', { command: 'request', input })`;当前身份和人员资料分别使用 `whoami` 与 `profile`
|
|
273
273
|
子命令。BUC 插件按请求创建一次性凭据,只接受无 URL 凭据的 HTTPS 地址,过滤认证字段与 Cookie;
|
|
274
274
|
调用方须按已验证的业务契约确认目标服务可信。请求始终在运行 CLI、SDK 或 MCP Server 的机器上执行,
|
|
275
275
|
不随浏览器或 connector 转发。
|
|
276
276
|
`buc request` 支持与 `send_request` 同结构的 `formData` 和 `files`;`files[].filePath` 从该插件执行
|
|
277
277
|
宿主读取,而不是浏览器 native-host,无法引用宿主路径时使用 Base64 内容与 `filename`。
|
|
278
|
+
省略 `app` 时从内置 URL 映射选择;Mearl 正式与预发的 `/api` 地址均映射到 `Mearl`。未登记的地址
|
|
279
|
+
必须显式传入服务登记的 `app`,显式值优先;SDK、MCP 与插件调用的 `input.app` 遵循相同规则。
|
|
280
|
+
AuthX 对应 `mearl authx request <url> [audience]`,省略 `audience` 时同样使用已登记的 URL 映射。
|
|
281
|
+
两者的 `--help` 和 `request --help` 均包含完整 `--payload '{"command":"request","input":{...}}'`
|
|
282
|
+
示例,涵盖 JSON 请求与文件上传。
|
|
278
283
|
|
|
279
284
|
## 支持的操作
|
|
280
285
|
|
|
@@ -308,7 +313,11 @@ Preact、Hooks 和 HTM 运行时。页面从 `window.mearl.ui` 读取 `html`、`
|
|
|
308
313
|
|
|
309
314
|
`browser_list` 统一列出普通浏览器、Provider 浏览器和托管浏览器。`type` 区分
|
|
310
315
|
`regular` / `managed`,`status` 区分 `connected` / `pairing` / `running_disconnected` /
|
|
311
|
-
`stopped`;只有 `connected`
|
|
316
|
+
`stopped`;只有 `connected` 的浏览器可作为常规操作目标。本机没有已连接的插件浏览器时,
|
|
317
|
+
`browser_list` 会自动探测默认 CDP 端点,即使已有 Provider 配对记录也无需传 `--cdp`。
|
|
318
|
+
`browser_list --cdp` 在没有已注册的普通 CDP 浏览器时会主动探测该端点,并只返回 CDP 浏览器;
|
|
319
|
+
插件浏览器已连接也不影响这次探测。设置 `MEARL_SOCKET_PATH` 时,清单请求沿用该实例 Socket。
|
|
320
|
+
`check --cdp` 也只检查这些 CDP 浏览器。
|
|
312
321
|
|
|
313
322
|
`browser_release` 仅在用户明确要求结束调试、退出接管或清理会话资源时调用;它会释放
|
|
314
323
|
debugger/CDP 控制和会话级临时状态,保留浏览器及全部标签页。托管实例的启动、关闭、持久化、
|
package/dist/check.js
CHANGED
|
@@ -174,7 +174,11 @@ export async function runUnifiedCheck(options, dependencies = {}) {
|
|
|
174
174
|
environment.push({
|
|
175
175
|
status: 'error',
|
|
176
176
|
label: `Cloud server or connector discovery failed${source}`,
|
|
177
|
-
details: [
|
|
177
|
+
details: [
|
|
178
|
+
formatError(error),
|
|
179
|
+
redactServerUrl(options.serverUrl),
|
|
180
|
+
'On the Agent machine, run `mearl-cloud-server status` to verify the server and current connection command. Use `mearl check --local` to isolate this machine.',
|
|
181
|
+
],
|
|
178
182
|
});
|
|
179
183
|
}
|
|
180
184
|
}
|
|
@@ -215,7 +219,8 @@ export async function runUnifiedCheck(options, dependencies = {}) {
|
|
|
215
219
|
details: [formatError(error)],
|
|
216
220
|
});
|
|
217
221
|
}
|
|
218
|
-
const connected = (browserList?.browsers ?? []).filter(browser => browser.status === 'connected'
|
|
222
|
+
const connected = (browserList?.browsers ?? []).filter(browser => browser.status === 'connected' &&
|
|
223
|
+
(options.transport !== 'cdp' || browser.transport === 'cdp'));
|
|
219
224
|
let targets = connected;
|
|
220
225
|
if (options.browser) {
|
|
221
226
|
const matches = findBrowsers(connected, options.browser);
|
|
@@ -242,9 +247,16 @@ export async function runUnifiedCheck(options, dependencies = {}) {
|
|
|
242
247
|
if (!options.browser && connected.length === 0 && browserList) {
|
|
243
248
|
environment.push({
|
|
244
249
|
status: 'error',
|
|
245
|
-
label: 'No connected browser',
|
|
250
|
+
label: options.transport === 'cdp' ? 'No connected CDP browser' : 'No connected browser',
|
|
246
251
|
details: [
|
|
247
|
-
|
|
252
|
+
options.transport === 'cdp'
|
|
253
|
+
? 'Enable a local CDP endpoint (see `mearl-native-host --help`) and run `mearl browser_list --cdp` to inspect discovery.'
|
|
254
|
+
: 'Open Chrome with the Mearl extension, start a managed browser, or connect a browser host.',
|
|
255
|
+
...(!options.local && connectors.length > 0
|
|
256
|
+
? [
|
|
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.',
|
|
258
|
+
]
|
|
259
|
+
: []),
|
|
248
260
|
],
|
|
249
261
|
});
|
|
250
262
|
}
|
package/dist/cli.js
CHANGED
|
@@ -270,6 +270,9 @@ function printCheckHelp(commandName) {
|
|
|
270
270
|
' --json 输出机器可读 JSON',
|
|
271
271
|
' --updates 查询已安装组件的发布版本',
|
|
272
272
|
' -h, --help 查看帮助',
|
|
273
|
+
'',
|
|
274
|
+
'检查本机及远端控制链路;发现错误时退出码为 1。',
|
|
275
|
+
'Server 地址优先级:--server > MEARL_SERVER_URL > ~/.mearl/cloud-server.json。',
|
|
273
276
|
].join('\n'));
|
|
274
277
|
}
|
|
275
278
|
function printAdvancedCommandHelp(commandName, action) {
|
|
@@ -281,6 +284,7 @@ function printAdvancedCommandHelp(commandName, action) {
|
|
|
281
284
|
'',
|
|
282
285
|
'用法:',
|
|
283
286
|
` ${commandName} connector_list [--server <url>] [--timeout <seconds>]`,
|
|
287
|
+
'结果包含 count 与 connectors;每项包含 ID、名称、可选版本、连接时间和最后心跳。',
|
|
284
288
|
].join('\n'));
|
|
285
289
|
}
|
|
286
290
|
function printCommandHelp(commandName, command) {
|
|
@@ -298,6 +302,8 @@ function printCommandHelp(commandName, command) {
|
|
|
298
302
|
for (const parameter of command.params) {
|
|
299
303
|
const required = parameter.required ? '必填' : '可选';
|
|
300
304
|
lines.push(` ${parameter.name.padEnd(22)}${required.padEnd(6)}${parameter.type.padEnd(28)} ${parameter.description}`);
|
|
305
|
+
for (const detail of parameter.details ?? [])
|
|
306
|
+
lines.push(` ${detail}`);
|
|
301
307
|
}
|
|
302
308
|
lines.push('');
|
|
303
309
|
}
|
|
@@ -307,6 +313,12 @@ function printCommandHelp(commandName, command) {
|
|
|
307
313
|
else if (command.name === 'browser_launch') {
|
|
308
314
|
lines.push('宿主选择(本机与远端同时可用时):', ' --local 在当前机器启动', ' --connector <id|名称> 在指定远端 connector 启动', ' --browser <id|名称> 在控制浏览器所在宿主启动,并可作为 Cookie/UA 来源', '');
|
|
309
315
|
}
|
|
316
|
+
if (command.notes?.length) {
|
|
317
|
+
lines.push('约束与行为:', ...command.notes.map(note => ` ${note}`), '');
|
|
318
|
+
}
|
|
319
|
+
if (command.result?.length) {
|
|
320
|
+
lines.push('结果:', ...command.result.map(line => ` ${line}`), '');
|
|
321
|
+
}
|
|
310
322
|
if (command.examples?.length) {
|
|
311
323
|
lines.push('示例:');
|
|
312
324
|
for (const example of command.examples)
|
|
@@ -685,7 +697,14 @@ export async function runMearlCli(args, options = {}) {
|
|
|
685
697
|
return actionInvocationFailed(parsed.action, result) ? 1 : 0;
|
|
686
698
|
}
|
|
687
699
|
catch (error) {
|
|
688
|
-
|
|
700
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
701
|
+
console.error(message);
|
|
702
|
+
if (/connection timeout/i.test(message)) {
|
|
703
|
+
console.error('连接未就绪,请运行 mearl check 定位控制链路故障。');
|
|
704
|
+
}
|
|
705
|
+
else if (/请求超时|(?:request|command) timeout|timed out/i.test(message)) {
|
|
706
|
+
console.error('超时不代表动作未执行。点击、提交或写入后先读取当前状态确认结果;只读查询可缩小范围或增加 --timeout(秒)后重试。');
|
|
707
|
+
}
|
|
689
708
|
return 1;
|
|
690
709
|
}
|
|
691
710
|
finally {
|
package/dist/commands.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export interface ParamDef {
|
|
|
4
4
|
type: string;
|
|
5
5
|
required?: boolean;
|
|
6
6
|
description: string;
|
|
7
|
+
/** 复杂字段的结构与组合约束,仅在 action help 展示。 */
|
|
8
|
+
details?: readonly string[];
|
|
7
9
|
}
|
|
8
10
|
export interface CommandDef {
|
|
9
11
|
name: BrowserCommandAction;
|
|
@@ -17,6 +19,8 @@ export interface CommandDef {
|
|
|
17
19
|
/** 是否支持 --output */
|
|
18
20
|
outputFlag?: boolean;
|
|
19
21
|
examples?: string[];
|
|
22
|
+
notes?: readonly string[];
|
|
23
|
+
result?: readonly string[];
|
|
20
24
|
}
|
|
21
25
|
export declare const COMMANDS: readonly [{
|
|
22
26
|
readonly name: "tab_checkpoint";
|
|
@@ -77,6 +81,8 @@ export declare const COMMANDS: readonly [{
|
|
|
77
81
|
readonly type: "boolean";
|
|
78
82
|
readonly description: "只返回数据结构,不返回叶子值";
|
|
79
83
|
}];
|
|
84
|
+
readonly notes: readonly ["流式请求开始后即进入缓冲区;页面及 App 桥代发的 MTop SSE 都归入 mtop。无法归属当前页面 target 的 Service Worker 请求不在采集范围内。"];
|
|
85
|
+
readonly result: readonly ["nextCursor 用于同类查询续读,hasMore 表示还有数据,gap 表示缓冲区淘汰造成缺口;checkpoint cursor 可分别用于三类查询的初始边界。", "isPending 标记未完成请求;SSE 的 responseBody 保存按序到达的 event/data/timestamp/duration 分片。敏感请求头返回脱敏值。"];
|
|
80
86
|
readonly examples: ["get_requests --payload '{\"tabId\":12345,\"count\":5}'", "get_requests --payload '{\"tabId\":12345,\"source\":\"mtop\",\"filter\":\"cart\"}'"];
|
|
81
87
|
}, {
|
|
82
88
|
readonly name: "get_logs";
|
|
@@ -107,6 +113,7 @@ export declare const COMMANDS: readonly [{
|
|
|
107
113
|
readonly type: "string";
|
|
108
114
|
readonly description: "只返回指定 tab checkpoint 或同类查询 cursor 之后的日志";
|
|
109
115
|
}];
|
|
116
|
+
readonly result: readonly ["nextCursor 用于同类查询续读,hasMore 表示还有数据,gap 表示缓冲区淘汰造成缺口;checkpoint cursor 可分别用于三类查询的初始边界。"];
|
|
110
117
|
readonly examples: ["get_logs --payload '{\"tabId\":12345,\"limit\":10,\"level\":\"error\"}'"];
|
|
111
118
|
}, {
|
|
112
119
|
readonly name: "get_events";
|
|
@@ -145,6 +152,8 @@ export declare const COMMANDS: readonly [{
|
|
|
145
152
|
readonly type: "boolean";
|
|
146
153
|
readonly description: "返回完整 URL、_raw 和 _context;默认 false";
|
|
147
154
|
}];
|
|
155
|
+
readonly notes: readonly ["tab_open 新页从首屏采集;既有页面首次查询才启用采集,需要刷新或重新触发埋点。同批事件不会被 limit 拆开。"];
|
|
156
|
+
readonly result: readonly ["nextCursor 用于同类查询续读,hasMore 表示还有数据,gap 表示缓冲区淘汰造成缺口;checkpoint cursor 可分别用于三类查询的初始边界。", "captureStatus 为 armed/active/inactive;空结果附 hint 时按提示刷新或触发。默认去除 tracking URL query 与 _raw/_context,includeRaw=true 时保留。"];
|
|
148
157
|
readonly examples: ["get_events --payload '{\"tabId\":12345,\"source\":\"aplus\",\"event_type\":\"CLK\",\"limit\":10}'", "get_events --payload '{\"tabId\":12345,\"filter\":\"order\",\"includeRaw\":true,\"limit\":1}'", "get_events --payload '{\"tabId\":12345,\"source\":\"all\",\"limit\":20}'"];
|
|
149
158
|
}, {
|
|
150
159
|
readonly name: "set_mock";
|
|
@@ -180,6 +189,7 @@ export declare const COMMANDS: readonly [{
|
|
|
180
189
|
readonly type: "object";
|
|
181
190
|
readonly description: "请求 query/body 字段子集匹配;$index 从 0 开始指定调用顺序";
|
|
182
191
|
}];
|
|
192
|
+
readonly notes: readonly ["启用时至少提供 mockData 或非空 fields;非空 fields 优先。fields 每项 { path: string, value: any },path 支持点号和数组索引。", "相同 apiName 的多条无条件 Mock 会覆盖;conditions 子集匹配 query/body(含 data 内层),不同条件可共存;$index 从 0 起控制调用顺序,不参与字段匹配。", "大字段可用顶层 @<绝对路径> 文件引用或 --payload-file;文件展开后仍受 Native Messaging 单条消息大小限制。"];
|
|
183
193
|
readonly examples: ["set_mock --payload '{\"tabId\":12345,\"apiName\":\"mtop.cart.query\",\"mockData\":{\"ret\":[\"SUCCESS::调用成功\"]}}'", "set_mock --payload-file ./mock-data.json"];
|
|
184
194
|
}, {
|
|
185
195
|
readonly name: "get_mocks";
|
|
@@ -222,10 +232,12 @@ export declare const COMMANDS: readonly [{
|
|
|
222
232
|
readonly name: "requestHeaders";
|
|
223
233
|
readonly type: "array";
|
|
224
234
|
readonly description: "modifyHeaders 动作的请求头修改列表";
|
|
235
|
+
readonly details: readonly ["每项 { header: string, operation: \"set\" | \"append\" | \"remove\", value?: string };set/append 需 value"];
|
|
225
236
|
}, {
|
|
226
237
|
readonly name: "responseHeaders";
|
|
227
238
|
readonly type: "array";
|
|
228
239
|
readonly description: "modifyHeaders 动作的响应头修改列表";
|
|
240
|
+
readonly details: readonly ["每项 { header: string, operation: \"set\" | \"append\" | \"remove\", value?: string };set/append 需 value"];
|
|
229
241
|
}, {
|
|
230
242
|
readonly name: "initiatorDomains";
|
|
231
243
|
readonly type: "string";
|
|
@@ -243,6 +255,7 @@ export declare const COMMANDS: readonly [{
|
|
|
243
255
|
readonly type: "string";
|
|
244
256
|
readonly description: "规则说明";
|
|
245
257
|
}];
|
|
258
|
+
readonly notes: readonly ["扩展模式规则持久化;CDP 仅支持会话级 modifyHeaders 请求头 set,不支持响应头、initiatorDomains 或其他动作。Provider 是否支持以其能力声明为准。"];
|
|
246
259
|
readonly examples: ["set_rule --payload '{\"actionType\":\"block\",\"filter\":\"^https://example\\\\.com/ads/.*\"}'", "set_rule --payload '{\"ruleId\":42,\"enabled\":false}'"];
|
|
247
260
|
}, {
|
|
248
261
|
readonly name: "get_rules";
|
|
@@ -280,6 +293,7 @@ export declare const COMMANDS: readonly [{
|
|
|
280
293
|
readonly name: "files";
|
|
281
294
|
readonly type: "SendRequestFile[]";
|
|
282
295
|
readonly description: "multipart 文件,最多 20 个、总计不超过 40 MiB;Base64 文件总计不超过 7 MiB。每项传 fieldName 和绝对 filePath,或传 base64 + filename";
|
|
296
|
+
readonly details: readonly ["fieldName: string(必填);filePath: string 与 base64: string 二选一", "filename: string,base64 时必填,filePath 时默认文件 basename", "contentType: string(可选),默认按文件名推断 MIME,否则 application/octet-stream"];
|
|
283
297
|
}, {
|
|
284
298
|
readonly name: "withCookies";
|
|
285
299
|
readonly type: "boolean";
|
|
@@ -293,6 +307,8 @@ export declare const COMMANDS: readonly [{
|
|
|
293
307
|
readonly type: "number";
|
|
294
308
|
readonly description: "超时毫秒数,默认 30000";
|
|
295
309
|
}];
|
|
310
|
+
readonly notes: readonly ["仅用于非 BUC 请求;BUC 接口使用 mearl buc,不手工传 Token、DPoP 或 Ticket。", "body 不能与 formData/files 组合;multipart 不手工设置 Content-Type,由 Mearl 生成 boundary。", "filePath 属于 native-host 所在机器;无法引用远端路径时用 base64。BUC 上传的路径属于插件执行宿主。"];
|
|
311
|
+
readonly result: readonly ["返回 status、statusText、headers、body、bodyType、attachedCookieCount;bodyType 为 json/text/base64,二进制 body 需解码后保存。"];
|
|
296
312
|
readonly examples: ["send_request --payload '{\"url\":\"https://api.example.com/data\",\"method\":\"GET\"}'", "send_request --payload '{\"url\":\"https://api.example.com/upload\",\"method\":\"POST\",\"formData\":{\"folder\":\"assets\"},\"files\":[{\"fieldName\":\"file\",\"filePath\":\"/absolute/path/image.png\"}]}'"];
|
|
297
313
|
}, {
|
|
298
314
|
readonly name: "send_mtop_request";
|
|
@@ -327,6 +343,8 @@ export declare const COMMANDS: readonly [{
|
|
|
327
343
|
readonly type: "number";
|
|
328
344
|
readonly description: "超时毫秒数,默认 10000";
|
|
329
345
|
}];
|
|
346
|
+
readonly notes: readonly ["需要目标浏览器有对应登录态;Mearl 自动处理签名,不依赖页面脚本。api 以 mopen. 开头时使用 mopen 协议。", "env=prod 使用 h5api.m.taobao.com,pre 使用 h5api.wapa.taobao.com。"];
|
|
347
|
+
readonly result: readonly ["返回 success、response、requestData;业务成功需检查 response.ret。"];
|
|
330
348
|
readonly examples: ["send_mtop_request --payload '{\"api\":\"mtop.trade.order.detail\",\"data\":{\"orderId\":\"123\"}}'"];
|
|
331
349
|
}, {
|
|
332
350
|
readonly name: "browser_list";
|
|
@@ -447,6 +465,8 @@ export declare const COMMANDS: readonly [{
|
|
|
447
465
|
readonly type: "object";
|
|
448
466
|
readonly description: "与 appProfile 配合;声明式覆盖桥方法,形如 {methods:{api:{behavior|response|noop,silent?}}}";
|
|
449
467
|
}];
|
|
468
|
+
readonly notes: readonly ["emulation / appProfile 只应用到新建 Tab;复用 Tab 要切换状态时用对应设置 action。", "closeExisting 不能与复用或 openerTabId 组合;多匹配默认报错,match.onMultiple=first 可显式选择第一个。"];
|
|
469
|
+
readonly result: readonly ["返回 tabId、url、title、opened/reused;reused=true 的既有页面应保留。", "active=true 时 activation 包含 tabActive、windowFocused、windowState、visibilityState;emulation 返回实际生效配置。", "capture.cursor 是导航前诊断边界,可分别用于 get_logs/get_requests/get_events 的 after。"];
|
|
450
470
|
readonly examples: ["tab_open --payload '{\"url\":\"https://example.com\"}'", "tab_open --payload '{\"url\":\"https://example.com/page\",\"reuse\":\"prefer\",\"match\":{\"ignoreSearch\":true}}'", "tab_open --payload '{\"url\":\"https://m.example.com\",\"emulation\":{\"preset\":\"iphone-17-pro\"}}'", "tab_open --payload '{\"url\":\"https://market.m.taobao.com/app/trip/rx-home/pages/home\",\"appProfile\":\"fliggy\"}'", "tab_open --payload '{\"url\":\"https://market.m.taobao.com/app/trip/rx-home/pages/home\",\"appProfile\":\"fliggy\",\"emulation\":{\"preset\":\"ipad-mini-a17-pro\",\"orientation\":\"landscape\",\"deviceShell\":true,\"splitScreen\":true}}'", "tab_open --payload '{\"url\":\"https://example.com\",\"appProfile\":\"fliggy\",\"os\":\"android\"}'", "tab_open --payload '{\"url\":\"https://example.com\",\"group\":\"验证任务\"}'"];
|
|
451
471
|
}, {
|
|
452
472
|
readonly name: "tab_close";
|
|
@@ -529,6 +549,8 @@ export declare const COMMANDS: readonly [{
|
|
|
529
549
|
readonly required: true;
|
|
530
550
|
readonly description: "目标标签页 ID";
|
|
531
551
|
}];
|
|
552
|
+
readonly result: readonly ["默认返回 { action, observation };action.success 只表示动作成功,业务效果需结合 observation 和目标状态判断。", "observe=false 且未开启 diagnostics 时返回裸动作结果(如 { clicked: true }),没有 action/observation;开启 diagnostics 时返回 { action, diagnostics }。", "包装结果中的 action.stage=precondition 表示未派发,省略 observation/diagnostics;dispatch-uncertain 表示可能已派发,先查看 action.attempt 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。"];
|
|
553
|
+
readonly notes: readonly ["selector / text / point 必须且只能提供一个。隐藏页 auto 使用 DOM;只有明确依赖真实用户手势时才激活页面。", "原生 select 可按 option 文本点击;checkbox/radio 返回 controlState.checkedBefore/checkedAfter。"];
|
|
532
554
|
readonly examples: ["page_click --payload '{\"tabId\":12345,\"text\":\"提交\"}'", "page_click --payload '{\"tabId\":12345,\"text\":\"退款明细\",\"role\":\"button\"}'", "page_click --payload '{\"tabId\":12345,\"text\":\"确定\",\"scope\":\"@e12\"}'", "page_click --payload '{\"tabId\":12345,\"selector\":\"@e3\"}'", "page_click --payload '{\"tabId\":12345,\"selector\":\".submit-btn\"}'", "page_click --payload '{\"tabId\":12345,\"selector\":\".gesture-btn\",\"clickMode\":\"touch\"}'", "page_click --payload '{\"tabId\":12345,\"point\":{\"x\":336,\"y\":117}}'", "page_click --payload '{\"tabId\":12345,\"point\":{\"x\":196,\"y\":240},\"coordinateSpace\":\"active-frame\"}'"];
|
|
533
555
|
}, {
|
|
534
556
|
readonly name: "page_drag";
|
|
@@ -557,6 +579,8 @@ export declare const COMMANDS: readonly [{
|
|
|
557
579
|
readonly required: true;
|
|
558
580
|
readonly description: "目标标签页 ID";
|
|
559
581
|
}];
|
|
582
|
+
readonly result: readonly ["默认返回 { action, observation };action.success 只表示动作成功,业务效果需结合 observation 和目标状态判断。", "observe=false 且未开启 diagnostics 时返回裸动作结果(如 { clicked: true }),没有 action/observation;开启 diagnostics 时返回 { action, diagnostics }。", "包装结果中的 action.stage=precondition 表示未派发,省略 observation/diagnostics;dispatch-uncertain 表示可能已派发,先查看 action.attempt 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。"];
|
|
583
|
+
readonly notes: readonly ["起点会自动滚入视口,终点必须同时位于当前视口;否则先滚动页面。隐藏页 auto 使用 DOM,不切换活动页。"];
|
|
560
584
|
readonly examples: ["page_drag --payload '{\"tabId\":12345,\"from\":{\"x\":350,\"y\":80},\"to\":{\"x\":80,\"y\":80}}'", "page_drag --payload '{\"tabId\":12345,\"from\":\"@e3\",\"to\":\"#drop-zone\",\"dragMode\":\"mouse\"}'"];
|
|
561
585
|
}, {
|
|
562
586
|
readonly name: "page_type";
|
|
@@ -581,6 +605,7 @@ export declare const COMMANDS: readonly [{
|
|
|
581
605
|
readonly required: true;
|
|
582
606
|
readonly description: "目标标签页 ID";
|
|
583
607
|
}];
|
|
608
|
+
readonly result: readonly ["默认返回 { action, observation };action.success 只表示动作成功,业务效果需结合 observation 和目标状态判断。", "observe=false 且未开启 diagnostics 时返回裸动作结果(如 { clicked: true }),没有 action/observation;开启 diagnostics 时返回 { action, diagnostics }。", "包装结果中的 action.stage=precondition 表示未派发,省略 observation/diagnostics;dispatch-uncertain 表示可能已派发,先查看 action.attempt 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。"];
|
|
584
609
|
readonly examples: ["page_type --payload '{\"tabId\":12345,\"selector\":\"@e6\",\"text\":\"搜索关键词\"}'"];
|
|
585
610
|
}, {
|
|
586
611
|
readonly name: "page_hover";
|
|
@@ -596,6 +621,7 @@ export declare const COMMANDS: readonly [{
|
|
|
596
621
|
readonly required: true;
|
|
597
622
|
readonly description: "目标标签页 ID";
|
|
598
623
|
}];
|
|
624
|
+
readonly result: readonly ["默认返回 { action, observation };action.success 只表示动作成功,业务效果需结合 observation 和目标状态判断。", "observe=false 且未开启 diagnostics 时返回裸动作结果(如 { clicked: true }),没有 action/observation;开启 diagnostics 时返回 { action, diagnostics }。", "包装结果中的 action.stage=precondition 表示未派发,省略 observation/diagnostics;dispatch-uncertain 表示可能已派发,先查看 action.attempt 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。"];
|
|
599
625
|
readonly examples: ["page_hover --payload '{\"tabId\":12345,\"selector\":\".nav-menu\"}'"];
|
|
600
626
|
}, {
|
|
601
627
|
readonly name: "page_scroll";
|
|
@@ -623,6 +649,7 @@ export declare const COMMANDS: readonly [{
|
|
|
623
649
|
readonly required: true;
|
|
624
650
|
readonly description: "目标标签页 ID";
|
|
625
651
|
}];
|
|
652
|
+
readonly result: readonly ["默认返回 { action, observation };action.success 只表示动作成功,业务效果需结合 observation 和目标状态判断。", "observe=false 且未开启 diagnostics 时返回裸动作结果(如 { clicked: true }),没有 action/observation;开启 diagnostics 时返回 { action, diagnostics }。", "包装结果中的 action.stage=precondition 表示未派发,省略 observation/diagnostics;dispatch-uncertain 表示可能已派发,先查看 action.attempt 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。", "action.data 返回 moved、atTop/atBottom、scrollYBefore/After、maxScrollY、resolvedContainer 和 ancestorDistance;自动发现的内部容器提供可复用 containerSelector。"];
|
|
626
653
|
readonly examples: ["page_scroll --payload '{\"tabId\":12345,\"direction\":\"down\"}'", "page_scroll --payload '{\"tabId\":12345,\"direction\":\"bottom\"}'", "page_scroll --payload '{\"tabId\":12345,\"selector\":\".virtual-list\",\"direction\":\"down\",\"distance\":800}'", "page_scroll --payload '{\"tabId\":12345,\"selector\":\"@e8\",\"containerPolicy\":\"nearest\",\"direction\":\"bottom\"}'"];
|
|
627
654
|
}, {
|
|
628
655
|
readonly name: "page_eval";
|
|
@@ -637,15 +664,23 @@ export declare const COMMANDS: readonly [{
|
|
|
637
664
|
readonly type: "boolean";
|
|
638
665
|
readonly description: "表达式返回 Promise 时等待完成,默认 true";
|
|
639
666
|
}, {
|
|
640
|
-
readonly name: "
|
|
667
|
+
readonly name: "frameId";
|
|
668
|
+
readonly type: "string";
|
|
669
|
+
readonly description: "page_frames 返回的目标 frame ID,扩展/CDP 均支持;省略时容器/设备外壳使用当前业务 frame,普通页面使用主 frame";
|
|
670
|
+
}, {
|
|
641
671
|
readonly type: "object";
|
|
642
672
|
readonly description: "仅在表达式会修改页面且需要观察结果时显式传入;不传保持轻量裸执行";
|
|
673
|
+
readonly name: string;
|
|
674
|
+
readonly required?: boolean;
|
|
675
|
+
readonly details?: readonly string[];
|
|
643
676
|
}, ParamDef, {
|
|
644
677
|
readonly name: "tabId";
|
|
645
678
|
readonly type: "number";
|
|
646
679
|
readonly required: true;
|
|
647
680
|
readonly description: "目标标签页 ID";
|
|
648
681
|
}];
|
|
682
|
+
readonly notes: readonly ["优先使用结构化 action;仅在其无法表达需求时执行最小范围脚本。"];
|
|
683
|
+
readonly result: readonly ["默认返回 { result };observe 对象启用观察并返回 { action, observation };仅开启 diagnostics 时返回 { action, diagnostics }。diagnostics=false 不启用包装。失败阶段语义同 page_click。"];
|
|
649
684
|
readonly examples: ["page_eval --payload '{\"tabId\":12345,\"expression\":\"document.title\"}'"];
|
|
650
685
|
}, {
|
|
651
686
|
readonly name: "page_inspect";
|
|
@@ -676,6 +711,7 @@ export declare const COMMANDS: readonly [{
|
|
|
676
711
|
readonly required: true;
|
|
677
712
|
readonly description: "目标标签页 ID";
|
|
678
713
|
}];
|
|
714
|
+
readonly result: readonly ["matches[] 包含 boundingBox、computedStyle、hitTest、scroll 溢出量及可用的 scrollContainer。receivesPointerEvents=false 时读取 occludedBy。", "$0 还返回 resolvedSelector、属性、XPath 和可用框架信息。"];
|
|
679
715
|
readonly examples: ["page_inspect --payload '{\"tabId\":12345,\"selector\":\".form-field\",\"styles\":[\"display\",\"width\"]}'", "page_inspect --payload '{\"tabId\":12345,\"selector\":\"@e8\"}'", "page_inspect --payload '{\"tabId\":12345,\"selector\":\"$0\"}'", "page_inspect --payload '{\"tabId\":12345,\"filter\":\"horizontal-overflow\"}'", "page_inspect --payload '{\"tabId\":12345,\"filter\":\"scrollable\"}'"];
|
|
680
716
|
}, {
|
|
681
717
|
readonly name: "page_press";
|
|
@@ -699,6 +735,8 @@ export declare const COMMANDS: readonly [{
|
|
|
699
735
|
readonly required: true;
|
|
700
736
|
readonly description: "目标标签页 ID";
|
|
701
737
|
}];
|
|
738
|
+
readonly notes: readonly ["隐藏页 DOM 模式支持 Tab 焦点移动、原生控件 Enter/Space 激活和输入框 Enter 提交;编辑、选择、方向键和页面滚动等原生行为需可见页与 pressMode=keyboard。"];
|
|
739
|
+
readonly result: readonly ["默认返回 { action, observation };action.success 只表示动作成功,业务效果需结合 observation 和目标状态判断。", "observe=false 且未开启 diagnostics 时返回裸动作结果(如 { clicked: true }),没有 action/observation;开启 diagnostics 时返回 { action, diagnostics }。", "包装结果中的 action.stage=precondition 表示未派发,省略 observation/diagnostics;dispatch-uncertain 表示可能已派发,先查看 action.attempt 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。", "action.data.dispatchMode / fallbackReason / defaultAction 说明实际输入路径。"];
|
|
702
740
|
readonly examples: ["page_press --payload '{\"tabId\":12345,\"key\":\"Enter\"}'"];
|
|
703
741
|
}, {
|
|
704
742
|
readonly name: "page_wait";
|
|
@@ -741,6 +779,7 @@ export declare const COMMANDS: readonly [{
|
|
|
741
779
|
readonly required: true;
|
|
742
780
|
readonly description: "目标标签页 ID";
|
|
743
781
|
}];
|
|
782
|
+
readonly notes: readonly ["time / selector / text / condition 必须且只能提供一个;time 范围 0–60000ms。页面交互已有内置观察,仅在需要独立等待条件时使用。"];
|
|
744
783
|
readonly examples: ["page_wait --payload '{\"tabId\":12345,\"time\":1000}'", "page_wait --payload '{\"tabId\":12345,\"selector\":\".dialog\",\"state\":\"visible\"}'", "page_wait --payload '{\"tabId\":12345,\"selector\":\".loading\",\"state\":\"hidden\"}'", "page_wait --payload '{\"tabId\":12345,\"text\":\"提交成功\"}'", "page_wait --payload '{\"tabId\":12345,\"condition\":\"window.appReady === true\",\"timeout\":30000}'"];
|
|
745
784
|
}, {
|
|
746
785
|
readonly name: "page_navigate";
|
|
@@ -763,6 +802,7 @@ export declare const COMMANDS: readonly [{
|
|
|
763
802
|
readonly required: true;
|
|
764
803
|
readonly description: "目标标签页 ID";
|
|
765
804
|
}];
|
|
805
|
+
readonly notes: readonly ["url / refresh=true / history 必须且只能提供一个。"];
|
|
766
806
|
readonly examples: ["page_navigate --payload '{\"tabId\":12345,\"url\":\"https://example.com/page2\"}'", "page_navigate --payload '{\"tabId\":12345,\"refresh\":true}'", "page_navigate --payload '{\"tabId\":12345,\"history\":\"back\"}'"];
|
|
767
807
|
}, {
|
|
768
808
|
readonly name: "page_upload";
|
|
@@ -783,6 +823,8 @@ export declare const COMMANDS: readonly [{
|
|
|
783
823
|
readonly required: true;
|
|
784
824
|
readonly description: "目标标签页 ID";
|
|
785
825
|
}];
|
|
826
|
+
readonly result: readonly ["默认返回 { action, observation };action.success 只表示动作成功,业务效果需结合 observation 和目标状态判断。", "observe=false 且未开启 diagnostics 时返回裸动作结果(如 { clicked: true }),没有 action/observation;开启 diagnostics 时返回 { action, diagnostics }。", "包装结果中的 action.stage=precondition 表示未派发,省略 observation/diagnostics;dispatch-uncertain 表示可能已派发,先查看 action.attempt 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。"];
|
|
827
|
+
readonly notes: readonly ["直接写入 input[type=file],不依赖 file chooser;隐藏的文件节点也可上传。外部 Provider 的文件中转能力查询 mearl <providerId>。"];
|
|
786
828
|
readonly examples: ["page_upload --payload '{\"tabId\":12345,\"selector\":\"#file-input\",\"filePaths\":[\"/Users/me/photo.jpg\"]}'"];
|
|
787
829
|
}, {
|
|
788
830
|
readonly name: "page_snapshot";
|
|
@@ -825,6 +867,8 @@ export declare const COMMANDS: readonly [{
|
|
|
825
867
|
readonly required: true;
|
|
826
868
|
readonly description: "目标标签页 ID";
|
|
827
869
|
}];
|
|
870
|
+
readonly notes: readonly ["query.text / query.role 至少提供一个;query.exact 默认 true。每次快照刷新有效 ref 集合。", "interactive 无 AX 控件时回退到 viewport,不会自动改用 dom;Canvas 内容需截图。"];
|
|
871
|
+
readonly result: readonly ["返回 snapshot、elementCount、outputNodeCount、mode;截断时 truncated=true。", "query 返回 matches 与完整 matchCount,matches 最多 100 项,裁剪时 matchesTruncated=true。容器/iframe 的视口裁剪返回 outerViewport、contentViewport 和滚动位置。"];
|
|
828
872
|
readonly examples: ["page_snapshot --payload '{\"tabId\":12345}'", "page_snapshot --payload '{\"tabId\":1,\"mode\":\"viewport\"}'", "page_snapshot --payload '{\"tabId\":1,\"mode\":\"dom\"}'", "page_snapshot --payload '{\"tabId\":1,\"rootSelector\":\"[role=dialog]\"}'", "page_snapshot --payload '{\"tabId\":1,\"rootRef\":\"@e8\",\"ancestorDepth\":1}'", "page_snapshot --payload '{\"tabId\":1,\"query\":{\"text\":\"保存\",\"role\":\"button\"}}'"];
|
|
829
873
|
}, {
|
|
830
874
|
readonly name: "page_screenshot";
|
|
@@ -848,6 +892,8 @@ export declare const COMMANDS: readonly [{
|
|
|
848
892
|
readonly required: true;
|
|
849
893
|
readonly description: "目标标签页 ID";
|
|
850
894
|
}];
|
|
895
|
+
readonly notes: readonly ["使用 --output <path> 保存图片;省略时 stdout 返回含 base64 data 的 JSON,避免直接将其加载为文本。"];
|
|
896
|
+
readonly result: readonly ["meta 包含 format、width、height、size、url、title;宽高为物理像素(CSS 尺寸 × DPR)。"];
|
|
851
897
|
readonly examples: ["page_screenshot --payload '{\"tabId\":12345}' --output ./screenshot.png", "page_screenshot --payload '{\"tabId\":12345,\"selector\":\".product-card\"}' --output ./card.png"];
|
|
852
898
|
}, {
|
|
853
899
|
readonly name: "set_device_emulation";
|
|
@@ -912,6 +958,8 @@ export declare const COMMANDS: readonly [{
|
|
|
912
958
|
readonly required: true;
|
|
913
959
|
readonly description: "目标标签页 ID";
|
|
914
960
|
}];
|
|
961
|
+
readonly notes: readonly ["无 preset 时 width/height 必须成对提供且 userAgent 必填;mobile 默认 true,touch 跟随 mobile。", "deviceShell 开启/移除时必须重载;splitScreen 仅在已启用 App 档案、deviceShell=true、横屏时生效。"];
|
|
962
|
+
readonly result: readonly ["返回实际 viewport(width/height/deviceScaleFactor/scale)、UA、mobile、touch、orientation、deviceShell、splitScreen 和 reloaded;应以响应确认生效状态。"];
|
|
915
963
|
readonly examples: ["set_device_emulation --payload '{\"tabId\":12345,\"enabled\":true,\"preset\":\"iphone-17-pro\"}'", "set_device_emulation --payload '{\"tabId\":12345,\"enabled\":true,\"preset\":\"pixel-11\",\"orientation\":\"landscape\"}'", "set_device_emulation --payload '{\"tabId\":12345,\"enabled\":true,\"preset\":\"ipad-mini-a17-pro\",\"orientation\":\"landscape\",\"deviceShell\":true,\"splitScreen\":true}'", "set_device_emulation --payload '{\"tabId\":12345,\"enabled\":false}'"];
|
|
916
964
|
}, {
|
|
917
965
|
readonly name: "set_app_profile";
|
|
@@ -960,6 +1008,8 @@ export declare const COMMANDS: readonly [{
|
|
|
960
1008
|
readonly required: true;
|
|
961
1009
|
readonly description: "目标标签页 ID";
|
|
962
1010
|
}];
|
|
1011
|
+
readonly notes: readonly ["只有用户明确要求 App/客户端/容器/JSBridge 模拟时启用。移动视口或普通 H5 调试使用 set_device_emulation。", "emulation={} 使用档案推荐设备;enabled=false 时省略 emulation 只清除 App 注入,传 {} 同时清除设备模拟。", "bridgeConfig.methods 按方法声明 behavior / response / noop 三选一,可传 silent;只支持受控行为、固定 JSON 回包或成功空实现,不执行配置脚本。"];
|
|
1012
|
+
readonly result: readonly ["返回 enabled、profile、label、userAgent、os、mtopEnv、reloaded;联动设备时额外返回实际 emulation。"];
|
|
963
1013
|
readonly examples: ["set_app_profile --payload '{\"tabId\":12345,\"enabled\":true,\"profile\":\"fliggy\"}'", "set_app_profile --payload '{\"tabId\":12345,\"enabled\":true,\"profile\":\"fliggy\",\"mtopEnv\":\"pre\"}'", "set_app_profile --payload '{\"tabId\":12345,\"enabled\":false,\"mtopEnv\":\"prod\"}'", "set_app_profile --payload '{\"tabId\":12345,\"enabled\":true,\"profile\":\"fliggy\",\"emulation\":{}}'", "set_app_profile --payload '{\"tabId\":12345,\"enabled\":true,\"profile\":\"alipay\",\"emulation\":{\"preset\":\"pixel-11\",\"deviceShell\":true}}'", "set_app_profile --payload '{\"tabId\":12345,\"enabled\":true,\"profile\":\"fliggy\",\"emulation\":{\"preset\":\"ipad-mini-a17-pro\",\"orientation\":\"landscape\",\"deviceShell\":true,\"splitScreen\":true}}'", "set_app_profile --payload '{\"tabId\":12345,\"enabled\":false}'", "set_app_profile --payload '{\"tabId\":12345,\"enabled\":false,\"emulation\":{}}'"];
|
|
964
1014
|
}, {
|
|
965
1015
|
readonly name: "set_timezone";
|
|
@@ -982,8 +1032,7 @@ export declare const COMMANDS: readonly [{
|
|
|
982
1032
|
readonly params: [{
|
|
983
1033
|
readonly name: "tabId";
|
|
984
1034
|
readonly type: "number";
|
|
985
|
-
readonly
|
|
986
|
-
readonly description: "目标标签页 ID";
|
|
1035
|
+
readonly description: "可选;指定标签页的 Cookie 存储区,省略时使用浏览器默认存储区";
|
|
987
1036
|
}, {
|
|
988
1037
|
readonly name: "name";
|
|
989
1038
|
readonly type: "string";
|
|
@@ -992,7 +1041,7 @@ export declare const COMMANDS: readonly [{
|
|
|
992
1041
|
}, {
|
|
993
1042
|
readonly name: "url";
|
|
994
1043
|
readonly type: "string";
|
|
995
|
-
readonly description: "
|
|
1044
|
+
readonly description: "Cookie 查询 URL;未传 tabId 时必填,省略时使用指定标签页 URL";
|
|
996
1045
|
}, {
|
|
997
1046
|
readonly name: "domain";
|
|
998
1047
|
readonly type: "string";
|
|
@@ -1002,15 +1051,20 @@ export declare const COMMANDS: readonly [{
|
|
|
1002
1051
|
readonly type: "string";
|
|
1003
1052
|
readonly description: "可选精确 path 过滤";
|
|
1004
1053
|
}];
|
|
1005
|
-
readonly
|
|
1054
|
+
readonly notes: readonly ["只读取指定非分区 Cookie,不列举全部、不回退分区 Cookie,拒绝 HttpOnly;禁止读取认证 Token。指定 url 不导航,指定 tabId 仅选择存储区时不启动采集。"];
|
|
1055
|
+
readonly result: readonly ["找到时 found=true 并返回 value/domain/path;不存在时 found=false。"];
|
|
1056
|
+
readonly examples: ["get_cookie --payload '{\"tabId\":12345,\"name\":\"feature_flag\"}'", "get_cookie --payload '{\"url\":\"https://www.taobao.com/\",\"name\":\"tracknick\"}'", "get_cookie --payload '{\"tabId\":12345,\"name\":\"edith_switch_br.rx-vehicle-search_home\",\"domain\":\"taobao.com\"}'", "get_cookie --payload '{\"tabId\":12345,\"name\":\"tracknick\",\"url\":\"https://www.taobao.com/\",\"domain\":\"taobao.com\",\"path\":\"/\"}'"];
|
|
1006
1057
|
}, {
|
|
1007
1058
|
readonly name: "set_cookie";
|
|
1008
|
-
readonly description: "
|
|
1059
|
+
readonly description: "在目标浏览器设置一个指定非分区 session Cookie,可选刷新指定页面";
|
|
1009
1060
|
readonly params: [{
|
|
1010
1061
|
readonly name: "tabId";
|
|
1011
1062
|
readonly type: "number";
|
|
1012
|
-
readonly
|
|
1013
|
-
|
|
1063
|
+
readonly description: "可选;指定标签页的 Cookie 存储区,reload=true 时必填";
|
|
1064
|
+
}, {
|
|
1065
|
+
readonly name: "url";
|
|
1066
|
+
readonly type: "string";
|
|
1067
|
+
readonly description: "Cookie 目标 URL;未传 tabId 时必填,省略时使用指定标签页 URL";
|
|
1014
1068
|
}, {
|
|
1015
1069
|
readonly name: "name";
|
|
1016
1070
|
readonly type: "string";
|
|
@@ -1024,7 +1078,7 @@ export declare const COMMANDS: readonly [{
|
|
|
1024
1078
|
}, {
|
|
1025
1079
|
readonly name: "domain";
|
|
1026
1080
|
readonly type: "string";
|
|
1027
|
-
readonly description: "Cookie
|
|
1081
|
+
readonly description: "Cookie 域,默认目标 URL 的 host;只允许目标 host 或其父域";
|
|
1028
1082
|
}, {
|
|
1029
1083
|
readonly name: "path";
|
|
1030
1084
|
readonly type: "string";
|
|
@@ -1032,9 +1086,11 @@ export declare const COMMANDS: readonly [{
|
|
|
1032
1086
|
}, {
|
|
1033
1087
|
readonly name: "reload";
|
|
1034
1088
|
readonly type: "boolean";
|
|
1035
|
-
readonly description: "
|
|
1089
|
+
readonly description: "设置后是否刷新指定 tabId,默认 false;true 时必须传 tabId";
|
|
1036
1090
|
}];
|
|
1037
|
-
readonly
|
|
1091
|
+
readonly notes: readonly ["仅写非分区 session Cookie,不支持删除。reload=true 时校验目标域与刷新页域的授权。"];
|
|
1092
|
+
readonly result: readonly ["返回 url/name/domain/path/reloaded,指定标签页时包含 tabId;不回显 Cookie 值。"];
|
|
1093
|
+
readonly examples: ["set_cookie --payload '{\"tabId\":12345,\"name\":\"feature_flag\",\"value\":\"enabled\"}'", "set_cookie --payload '{\"url\":\"https://www.taobao.com/\",\"name\":\"feature_flag\",\"value\":\"enabled\"}'", "set_cookie --payload '{\"tabId\":12345,\"name\":\"edith_switch_br.rx-vehicle-search_home\",\"value\":\"3.6.63\",\"domain\":\"taobao.com\",\"reload\":true}'"];
|
|
1038
1094
|
}, {
|
|
1039
1095
|
readonly name: "page_frames";
|
|
1040
1096
|
readonly description: "获取页面主 frame 与所有 iframe 列表";
|
|
@@ -1044,6 +1100,7 @@ export declare const COMMANDS: readonly [{
|
|
|
1044
1100
|
readonly required: true;
|
|
1045
1101
|
readonly description: "目标标签页 ID";
|
|
1046
1102
|
}];
|
|
1103
|
+
readonly result: readonly ["frames[] 包含 frameId、url、name 和 isMainFrame;frameId 可用于 page_eval 等支持 frame 定位的 action。"];
|
|
1047
1104
|
readonly examples: ["page_frames --payload '{\"tabId\":12345}'"];
|
|
1048
1105
|
}, {
|
|
1049
1106
|
readonly name: "request_domain_permission";
|
|
@@ -1054,6 +1111,8 @@ export declare const COMMANDS: readonly [{
|
|
|
1054
1111
|
readonly required: true;
|
|
1055
1112
|
readonly description: "需要授权的域名,如 example.com";
|
|
1056
1113
|
}];
|
|
1114
|
+
readonly notes: readonly ["domain 使用纯主机名,不传 URL。仅在非 BUC send_request 报域权限缺失时申请,BUC 不使用浏览器域权限。", "弹窗等待用户选择,90 秒超时或关闭按拒绝处理;granted=true 后才重试原请求。"];
|
|
1115
|
+
readonly result: readonly ["返回 granted、domain,授权成功时包含 origin。"];
|
|
1057
1116
|
readonly examples: ["request_domain_permission --payload '{\"domain\":\"example.com\"}'"];
|
|
1058
1117
|
}, {
|
|
1059
1118
|
readonly name: "run_actions";
|
|
@@ -1070,6 +1129,8 @@ export declare const COMMANDS: readonly [{
|
|
|
1070
1129
|
readonly required: true;
|
|
1071
1130
|
readonly description: "所有步骤共享的 tabId,步骤自身指定的优先";
|
|
1072
1131
|
}];
|
|
1073
|
-
readonly
|
|
1132
|
+
readonly notes: readonly ["最多 50 步,不允许嵌套 run_actions;需要根据每步效果决策时逐步调用普通 action。"];
|
|
1133
|
+
readonly result: readonly ["返回 results、completedSteps、totalSteps;失败时包含 error/failedStep,后续步骤未执行。"];
|
|
1134
|
+
readonly examples: ["run_actions --payload '{\"tabId\":12345,\"actions\":[{\"action\":\"page_hover\",\"data\":{\"selector\":\"#menu\"}},{\"action\":\"page_click\",\"data\":{\"selector\":\"#menu-item\"}}]}'"];
|
|
1074
1135
|
}];
|
|
1075
1136
|
export declare const COMMAND_MAP: ReadonlyMap<string, CommandDef>;
|