@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/dist/cli.js
CHANGED
|
@@ -26,7 +26,7 @@ const CATEGORIES = [
|
|
|
26
26
|
{ title: '标签页', names: ['tab_open', 'tab_list', 'tab_group', 'tab_close'] },
|
|
27
27
|
{
|
|
28
28
|
title: '页面感知',
|
|
29
|
-
names: ['page_snapshot', 'page_inspect', 'page_screenshot', 'page_frames'],
|
|
29
|
+
names: ['page_snapshot', 'page_inspect', 'page_screenshot', 'page_record', 'page_frames'],
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
title: '页面操作',
|
|
@@ -52,13 +52,11 @@ const CATEGORIES = [
|
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
title: '浏览器',
|
|
55
|
-
names: [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
'browser_control',
|
|
61
|
-
],
|
|
55
|
+
names: ['browser_list', 'browser_manage'],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
title: '控制会话',
|
|
59
|
+
names: ['session_list', 'session_manage'],
|
|
62
60
|
},
|
|
63
61
|
];
|
|
64
62
|
const BUILTIN_COMMANDS = [
|
|
@@ -92,7 +90,6 @@ const ADVANCED_BUILTIN_COMMANDS = new Set(['connector_list']);
|
|
|
92
90
|
const PLUGIN_HOST_OPTIONS = new Set([
|
|
93
91
|
'--all',
|
|
94
92
|
'--browser',
|
|
95
|
-
'--cdp',
|
|
96
93
|
'--compact',
|
|
97
94
|
'--connector',
|
|
98
95
|
'--help',
|
|
@@ -228,7 +225,7 @@ function printProviderHelp(commandName, provider, extensionHelp) {
|
|
|
228
225
|
];
|
|
229
226
|
if (browserType.help?.length)
|
|
230
227
|
lines.push('');
|
|
231
|
-
lines.push('创建:', ` ${commandName}
|
|
228
|
+
lines.push('创建:', ` ${commandName} browser_manage --payload '{"operation":"${browserType.openOperation ?? 'launch'}","provider":"${provider.providerId}","providerOptions":{}}'`, '', '启动参数(providerOptions):');
|
|
232
229
|
const required = new Set(browserType.inputSchema.required ?? []);
|
|
233
230
|
const properties = Object.entries(browserType.inputSchema.properties);
|
|
234
231
|
if (properties.length === 0)
|
|
@@ -294,7 +291,6 @@ function printCheckHelp(commandName) {
|
|
|
294
291
|
' --browser <id|名称> 只检查指定浏览器',
|
|
295
292
|
' --connector <id|名称> 限制到一台远端 connector',
|
|
296
293
|
' --local 只检查当前机器,不能与 --connector 同时使用',
|
|
297
|
-
' --cdp 当前机器强制使用 CDP(隐含 --local)',
|
|
298
294
|
' --server <url> 覆盖 cloud-server WebSocket URL',
|
|
299
295
|
' --timeout <seconds> 单项检查超时时间,默认 5 秒',
|
|
300
296
|
' --json 输出机器可读 JSON',
|
|
@@ -419,7 +415,6 @@ export function parseClientArgs(args, plugin = false) {
|
|
|
419
415
|
.option('--connector <id-or-name>')
|
|
420
416
|
.option('--local')
|
|
421
417
|
.option('--updates')
|
|
422
|
-
.option('--cdp')
|
|
423
418
|
.option('--server <url>');
|
|
424
419
|
if (plugin)
|
|
425
420
|
program
|
|
@@ -461,18 +456,16 @@ export function parseClientArgs(args, plugin = false) {
|
|
|
461
456
|
const parsedPayload = parsePayload(options.payload, options.payloadFile);
|
|
462
457
|
const { payload, outputPath } = normalizeScreenshotOutput(action, parsedPayload, options.output);
|
|
463
458
|
const fallbackTimeout = resolveActionTimeoutSec(action, payload, 60);
|
|
464
|
-
const
|
|
465
|
-
const local = forceCdp || options.local === true;
|
|
459
|
+
const local = options.local === true;
|
|
466
460
|
const connector = options.connector;
|
|
467
461
|
if (local && connector)
|
|
468
|
-
throw new Error('--local
|
|
462
|
+
throw new Error('--local 不能与 --connector 同时使用');
|
|
469
463
|
return {
|
|
470
464
|
action,
|
|
471
465
|
payload,
|
|
472
466
|
timeoutSec: parsePositiveTimeout(options.timeout, fallbackTimeout),
|
|
473
467
|
...(options.timeout !== undefined ? { timeoutOption: options.timeout } : {}),
|
|
474
468
|
compact: options.compact === true || process.stdout.isTTY !== true,
|
|
475
|
-
forceCdp,
|
|
476
469
|
json,
|
|
477
470
|
local,
|
|
478
471
|
updates: options.updates === true,
|
|
@@ -510,7 +503,6 @@ async function runPluginCli(args, commandName) {
|
|
|
510
503
|
...(parsed.session ? { session: parsed.session } : {}),
|
|
511
504
|
...(parsed.connector ? { connector: parsed.connector } : {}),
|
|
512
505
|
...(parsed.local ? { local: true } : {}),
|
|
513
|
-
...(parsed.forceCdp ? { transport: 'cdp' } : {}),
|
|
514
506
|
};
|
|
515
507
|
const plugin = await loadRegisteredPlugin(parsed.action, {
|
|
516
508
|
async invoke(action, payload, options) {
|
|
@@ -684,7 +676,6 @@ export async function runMearlCli(args, options = {}) {
|
|
|
684
676
|
...(parsed.session ? { session: parsed.session } : {}),
|
|
685
677
|
...(parsed.connector ? { connector: parsed.connector } : {}),
|
|
686
678
|
...(parsed.local ? { local: true } : {}),
|
|
687
|
-
...(parsed.forceCdp ? { transport: 'cdp' } : {}),
|
|
688
679
|
...(parsed.updates ? { checkUpdates: true } : {}),
|
|
689
680
|
};
|
|
690
681
|
if (parsed.json) {
|
|
@@ -698,20 +689,23 @@ export async function runMearlCli(args, options = {}) {
|
|
|
698
689
|
requestTimeoutSec: parsed.timeoutSec,
|
|
699
690
|
});
|
|
700
691
|
try {
|
|
692
|
+
if (parsed.action === 'page_record' && parsed.outputPath && parsed.payload.operation !== 'stop')
|
|
693
|
+
throw new Error('page_record --output requires operation "stop"');
|
|
701
694
|
const result = await client.invoke(parsed.action, parsed.payload, {
|
|
702
695
|
timeoutSec: parsed.timeoutSec,
|
|
703
696
|
...(parsed.browser ? { browser: parsed.browser } : {}),
|
|
704
697
|
...(parsed.session ? { session: parsed.session } : {}),
|
|
705
698
|
...(parsed.connector ? { connector: parsed.connector } : {}),
|
|
706
699
|
...(parsed.local ? { local: true } : {}),
|
|
707
|
-
...(parsed.forceCdp ? { transport: 'cdp' } : {}),
|
|
708
700
|
});
|
|
709
|
-
if (parsed.outputPath &&
|
|
710
|
-
|
|
701
|
+
if (parsed.outputPath &&
|
|
702
|
+
(parsed.action === 'page_download' || parsed.action === 'page_record')) {
|
|
703
|
+
const artifact = parsed.action === 'page_download' ? result.download : result.recording;
|
|
704
|
+
await client.saveArtifact(artifact, resolve(parsed.outputPath), {
|
|
711
705
|
...(parsed.session ? { session: parsed.session } : {}),
|
|
712
706
|
});
|
|
713
707
|
process.stdout.write(JSON.stringify({ ...result, outputPath: resolve(parsed.outputPath) }) + '\n');
|
|
714
|
-
if (!parsed.session)
|
|
708
|
+
if (!parsed.session && parsed.action === 'page_download')
|
|
715
709
|
await client.invoke('__artifact_remove', { artifactId: result.download.artifactId }, { browser: result.download.browserId });
|
|
716
710
|
}
|
|
717
711
|
else if (parsed.outputPath) {
|
package/dist/commandHelp.js
CHANGED
|
@@ -39,11 +39,8 @@ export function formatCommandHelp(commandName, command) {
|
|
|
39
39
|
];
|
|
40
40
|
const method = [...SDK_METHOD_ACTIONS].find(([, action]) => action === command.name)?.[0];
|
|
41
41
|
if (method)
|
|
42
|
-
lines.push('SDK:', ...(method === '
|
|
43
|
-
? [
|
|
44
|
-
` await mearl.${method}(options?)`,
|
|
45
|
-
` await mearl.${method}(params, options)`,
|
|
46
|
-
]
|
|
42
|
+
lines.push('SDK:', ...(method === 'browserList'
|
|
43
|
+
? [` await mearl.${method}(options?)`, ` await mearl.${method}(params, options)`]
|
|
47
44
|
: [
|
|
48
45
|
` await mearl.${method}(${SDK_OPTIONS_ONLY_METHODS.has(method) ? 'options?' : 'params, options?'})`,
|
|
49
46
|
]), '');
|
|
@@ -57,11 +54,11 @@ export function formatCommandHelp(commandName, command) {
|
|
|
57
54
|
}
|
|
58
55
|
lines.push('');
|
|
59
56
|
}
|
|
60
|
-
if (command.name === 'browser_list') {
|
|
57
|
+
if (command.name === 'browser_list' || command.name === 'session_list') {
|
|
61
58
|
lines.push('目标范围(按需):', ' --local 只列出当前机器上的浏览器', ' --connector <id|名称> 只列出指定远端 connector 的浏览器', '');
|
|
62
59
|
}
|
|
63
|
-
else if (command.name === '
|
|
64
|
-
lines.push('宿主选择(本机与远端同时可用时):', ' --local
|
|
60
|
+
else if (command.name === 'browser_manage') {
|
|
61
|
+
lines.push('宿主选择(本机与远端同时可用时):', ' --local 在当前机器启动或接入', ' --connector <id|名称> 在指定远端 connector 启动或接入', ' --browser <id|名称> 在控制浏览器所在宿主启动,并可作为 Cookie/UA 来源', '');
|
|
65
62
|
}
|
|
66
63
|
if (command.notes?.length) {
|
|
67
64
|
lines.push('约束与行为:', ...command.notes.map(note => ` ${note}`), '');
|
package/dist/commands.d.ts
CHANGED
|
@@ -34,28 +34,6 @@ export declare const COMMANDS: readonly [{
|
|
|
34
34
|
}];
|
|
35
35
|
readonly notes: readonly ["沿用 --browser / --session 路由;不传 app 返回摘要。apps.status=partial 表示目录未完整取得,unsupported 表示目标未提供目录;不能把两者当作未安装。", "available=false 的 App 当前不可启用;支持某个 action 不代表已有域名权限或真实设备授权。按需读取 usage.skills / usage.documentation,查询不会自动安装或加载 Skill。"];
|
|
36
36
|
readonly examples: ["get_capabilities", "get_capabilities --payload '{\"app\":\"example/app\"}'"];
|
|
37
|
-
}, {
|
|
38
|
-
readonly name: "browser_control";
|
|
39
|
-
readonly description: "交接或恢复浏览器控制;外部 Provider 也可结束任务";
|
|
40
|
-
readonly params: [{
|
|
41
|
-
readonly name: "operation";
|
|
42
|
-
readonly type: "\"handoff\" | \"resume\" | \"finish\"";
|
|
43
|
-
readonly required: true;
|
|
44
|
-
readonly description: "交给用户操作;resume 仅在用户明确交还后使用";
|
|
45
|
-
}, {
|
|
46
|
-
readonly name: "tabId";
|
|
47
|
-
readonly type: "number";
|
|
48
|
-
readonly description: "可选的目标页面";
|
|
49
|
-
}, {
|
|
50
|
-
readonly name: "reason";
|
|
51
|
-
readonly type: "string";
|
|
52
|
-
readonly description: "用户需要处理的事项";
|
|
53
|
-
}, {
|
|
54
|
-
readonly name: "keepTabIds";
|
|
55
|
-
readonly type: "number[]";
|
|
56
|
-
readonly description: "外部 Provider finish 时保留的结果页;默认不保留任务页面";
|
|
57
|
-
}];
|
|
58
|
-
readonly notes: readonly ["统一使用 --browser 选择目标。普通浏览器自动选择唯一的控制会话;多个会话时用 tabId 或 --session 明确任务。外部 Provider 由宿主管理任务,不传 --session。finish 仅用于支持它的外部 Provider。仅在用户明确交还后 resume;已经发出的操作可能仍然生效。"];
|
|
59
37
|
}, {
|
|
60
38
|
readonly name: "page_download";
|
|
61
39
|
readonly description: "先监听再点击,等待下载完成并创建浏览器文件产物";
|
|
@@ -80,6 +58,42 @@ export declare const COMMANDS: readonly [{
|
|
|
80
58
|
readonly description: "下载等待毫秒,默认 30000,范围 1000–300000";
|
|
81
59
|
}];
|
|
82
60
|
readonly notes: readonly ["--output 把文件分块保存到调用方机器;未指定时返回 artifactId,可供 page_upload 复用。", "共享 CDP 浏览器保持原下载目录;Chrome 未返回文件路径时明确报错。超时不能直接重复点击。"];
|
|
61
|
+
}, {
|
|
62
|
+
readonly name: "page_record";
|
|
63
|
+
readonly description: "开始、查询或停止 Chrome 标签页录制,导出 MP4";
|
|
64
|
+
readonly outputFlag: true;
|
|
65
|
+
readonly params: [{
|
|
66
|
+
readonly name: "operation";
|
|
67
|
+
readonly type: "\"start\" | \"status\" | \"stop\"";
|
|
68
|
+
readonly required: true;
|
|
69
|
+
readonly description: "开始、查询或停止录制";
|
|
70
|
+
}, {
|
|
71
|
+
readonly name: "tabId";
|
|
72
|
+
readonly type: "number";
|
|
73
|
+
readonly description: "start 时指定目标标签页";
|
|
74
|
+
}, {
|
|
75
|
+
readonly name: "recordingId";
|
|
76
|
+
readonly type: "string";
|
|
77
|
+
readonly description: "status 或 stop 时传入 start 返回的 ID";
|
|
78
|
+
}, {
|
|
79
|
+
readonly name: "maxWidth";
|
|
80
|
+
readonly type: "number";
|
|
81
|
+
readonly description: "最大宽度,默认 1280,上限 1920";
|
|
82
|
+
}, {
|
|
83
|
+
readonly name: "maxHeight";
|
|
84
|
+
readonly type: "number";
|
|
85
|
+
readonly description: "最大高度,默认 720,上限 1080";
|
|
86
|
+
}, {
|
|
87
|
+
readonly name: "frameRate";
|
|
88
|
+
readonly type: "number";
|
|
89
|
+
readonly description: "帧率上限,默认 30,最高 60";
|
|
90
|
+
}, {
|
|
91
|
+
readonly name: "audio";
|
|
92
|
+
readonly type: "boolean";
|
|
93
|
+
readonly description: "是否录制标签页音频,默认 false";
|
|
94
|
+
}];
|
|
95
|
+
readonly examples: ["page_record --payload '{\"operation\":\"start\",\"tabId\":12345}'", "page_record --browser '<browserId>' --payload '{\"operation\":\"status\",\"recordingId\":\"<recordingId>\"}'", "page_record --browser '<browserId>' --payload '{\"operation\":\"stop\",\"recordingId\":\"<recordingId>\"}' --output ./repro.mp4"];
|
|
96
|
+
readonly notes: readonly ["支持本机 Chrome 153+。查询或停止时使用开始返回的 browserId,并沿用原控制会话与连接方式。", "60 秒后自动停止。stop 返回文件产物,支持用 --output 保存到调用方机器。", "status 返回 recording、finalizing、ready 或 interrupted。达到时长上限会标记 duration_limit。结束后状态保留 5 分钟,释放所属控制会话时清理。"];
|
|
83
97
|
}, {
|
|
84
98
|
readonly name: "tab_checkpoint";
|
|
85
99
|
readonly description: "为目标标签页建立日志、请求和埋点增量边界";
|
|
@@ -387,39 +401,25 @@ export declare const COMMANDS: readonly [{
|
|
|
387
401
|
}];
|
|
388
402
|
readonly examples: ["browser_list", "browser_list --local"];
|
|
389
403
|
}, {
|
|
390
|
-
readonly name: "
|
|
391
|
-
readonly description: "
|
|
404
|
+
readonly name: "browser_manage";
|
|
405
|
+
readonly description: "启动、接入、断开、关闭浏览器或释放浏览器级控制资源";
|
|
392
406
|
readonly params: [{
|
|
393
|
-
readonly name: "
|
|
394
|
-
readonly type: "
|
|
395
|
-
readonly
|
|
396
|
-
|
|
397
|
-
readonly name: "keepTabIds";
|
|
398
|
-
readonly type: "number[]";
|
|
399
|
-
readonly description: "保留的结果页面;复用的用户页面始终保留";
|
|
407
|
+
readonly name: "operation";
|
|
408
|
+
readonly type: "\"launch\" | \"attach\" | \"detach\" | \"close\" | \"release\"";
|
|
409
|
+
readonly required: true;
|
|
410
|
+
readonly description: "launch 启动,attach 接入,detach 断开接入,close 关闭,release 清理调试控制";
|
|
400
411
|
}, {
|
|
401
|
-
readonly name: "
|
|
412
|
+
readonly name: "deleteProfile";
|
|
402
413
|
readonly type: "boolean";
|
|
403
|
-
readonly description: "
|
|
414
|
+
readonly description: "仅 close,删除持久化数据";
|
|
404
415
|
}, {
|
|
405
|
-
readonly name: "keepArtifactIds";
|
|
406
|
-
readonly type: "string[]";
|
|
407
|
-
readonly description: "保留在浏览器宿主的文件产物;其余会话临时文件删除";
|
|
408
|
-
}];
|
|
409
|
-
readonly notes: readonly ["带 --session 时可用于任务收尾,只释放该会话;未带会话时保留原浏览器级释放行为,活动会话存在时拒绝全局释放。"];
|
|
410
|
-
readonly summary: "释放浏览器调试控制和会话级临时效果";
|
|
411
|
-
readonly examples: ["browser_release", "browser_release --browser chrome-a"];
|
|
412
|
-
}, {
|
|
413
|
-
readonly name: "browser_launch";
|
|
414
|
-
readonly description: "启动本地 Chrome,或通过已注册 Provider 创建浏览器实例";
|
|
415
|
-
readonly params: [{
|
|
416
416
|
readonly name: "name";
|
|
417
417
|
readonly type: "string";
|
|
418
418
|
readonly description: "本地实例名称;使用 local Provider 时必填";
|
|
419
419
|
}, {
|
|
420
420
|
readonly name: "provider";
|
|
421
421
|
readonly type: "string";
|
|
422
|
-
readonly description: "
|
|
422
|
+
readonly description: "launch 默认 local;attach 指定接入 Provider,例如 cdp 接入已开启远程调试的 Chromium 或 Electron";
|
|
423
423
|
}, {
|
|
424
424
|
readonly name: "providerOptions";
|
|
425
425
|
readonly type: "Record<string, JSON value>";
|
|
@@ -449,21 +449,47 @@ export declare const COMMANDS: readonly [{
|
|
|
449
449
|
readonly type: "string[] | string | { presets?: string[]; domains?: string[] }";
|
|
450
450
|
readonly description: "从控制浏览器复制 Cookie:可传域名数组、已安装能力提供的范围名,或组合范围与额外域名";
|
|
451
451
|
}];
|
|
452
|
-
readonly
|
|
452
|
+
readonly notes: readonly ["close / detach 使用 --browser 指定目标。detach 保留浏览器进程;release 清理浏览器级调试状态并保留接入。活动会话需先用 session_manage end 结束。"];
|
|
453
|
+
readonly examples: ["browser_manage --local --payload '{\"operation\":\"attach\",\"provider\":\"cdp\",\"providerOptions\":{\"name\":\"Electron\",\"port\":9223}}'", "browser_manage --payload '{\"operation\":\"launch\",\"provider\":\"example-device\",\"providerOptions\":{}}'", "browser_manage --payload '{\"operation\":\"launch\",\"name\":\"figma\",\"userAgentMode\":\"desktop\",\"copyCookieDomains\":[\"figma.com\"]}'", "browser_manage --payload '{\"operation\":\"launch\",\"name\":\"with-cookies\",\"copyCookieDomains\":[\"example.com\",\"sub.example.org\"]}'"];
|
|
453
454
|
}, {
|
|
454
|
-
readonly name: "
|
|
455
|
-
readonly description: "
|
|
455
|
+
readonly name: "session_list";
|
|
456
|
+
readonly description: "列出当前可用的 Mearl 控制会话,可按浏览器或宿主筛选";
|
|
457
|
+
readonly examples: ["session_list", "session_list --local", "session_list --browser chrome-a"];
|
|
458
|
+
}, {
|
|
459
|
+
readonly name: "session_manage";
|
|
460
|
+
readonly description: "创建、交接、恢复或结束控制会话";
|
|
456
461
|
readonly params: [{
|
|
457
|
-
readonly name: "
|
|
458
|
-
readonly type: "
|
|
462
|
+
readonly name: "operation";
|
|
463
|
+
readonly type: "\"new\" | \"handoff\" | \"resume\" | \"end\"";
|
|
459
464
|
readonly required: true;
|
|
460
|
-
readonly description: "
|
|
465
|
+
readonly description: "new 创建空会话,handoff 交给用户,resume 恢复控制,end 结束会话并释放资源";
|
|
461
466
|
}, {
|
|
462
|
-
readonly name: "
|
|
467
|
+
readonly name: "sessionId";
|
|
468
|
+
readonly type: "string";
|
|
469
|
+
readonly description: "已有会话 ID,也可使用 --session";
|
|
470
|
+
}, {
|
|
471
|
+
readonly name: "reason";
|
|
472
|
+
readonly type: "string";
|
|
473
|
+
readonly description: "handoff 时说明需要用户处理的事项";
|
|
474
|
+
}, {
|
|
475
|
+
readonly name: "closeCreatedTabs";
|
|
463
476
|
readonly type: "boolean";
|
|
464
|
-
readonly description: "
|
|
477
|
+
readonly description: "end 时关闭会话创建的过程页,默认 false";
|
|
478
|
+
}, {
|
|
479
|
+
readonly name: "keepTabIds";
|
|
480
|
+
readonly type: "number[]";
|
|
481
|
+
readonly description: "保留的结果页面;复用的用户页面始终保留";
|
|
482
|
+
}, {
|
|
483
|
+
readonly name: "preserveEnvironment";
|
|
484
|
+
readonly type: "boolean";
|
|
485
|
+
readonly description: "end 默认 true,保留 Mock 与模拟现场;false 清理这些页面的环境";
|
|
486
|
+
}, {
|
|
487
|
+
readonly name: "keepArtifactIds";
|
|
488
|
+
readonly type: "string[]";
|
|
489
|
+
readonly description: "保留在浏览器宿主的文件产物;其余会话临时文件删除";
|
|
465
490
|
}];
|
|
466
|
-
readonly
|
|
491
|
+
readonly notes: readonly ["new 通过 --browser 选择浏览器,返回 session.sessionId。handoff、resume、end 使用已有会话 ID。", "仅在用户明确交还后 resume。外部 Provider 自行管理任务时通过 --browser 执行 handoff、resume 或 end。"];
|
|
492
|
+
readonly examples: ["session_manage --browser '<browserId>' --payload '{\"operation\":\"new\"}'", "session_manage --session '<sessionId>' --payload '{\"operation\":\"end\",\"closeCreatedTabs\":true}'"];
|
|
467
493
|
}, {
|
|
468
494
|
readonly name: "tab_open";
|
|
469
495
|
readonly description: "打开或按 URL 规则复用 Tab,并观察新页面的导航状态";
|
|
@@ -511,7 +537,7 @@ export declare const COMMANDS: readonly [{
|
|
|
511
537
|
}, {
|
|
512
538
|
readonly name: "appProfile";
|
|
513
539
|
readonly type: "string";
|
|
514
|
-
readonly description: "
|
|
540
|
+
readonly description: "应用已安装的 Profile,ID 与限制见当前动态帮助。需要系统栏时同时传 emulation.deviceShell=true";
|
|
515
541
|
}, {
|
|
516
542
|
readonly name: "os";
|
|
517
543
|
readonly type: "\"ios\" | \"android\"";
|
|
@@ -941,8 +967,8 @@ export declare const COMMANDS: readonly [{
|
|
|
941
967
|
readonly description: "目标标签页 ID";
|
|
942
968
|
}];
|
|
943
969
|
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 与可用观察或最小快照核验,避免重复提交。CLI 单次调用失败以退出码 1 结束;脚本需检查 action.success。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "effects.texts 按需返回普通可见文本的 selector/text,不代表可点击控件或业务成功;超限或覆盖不完整时仍提示补快照。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。"];
|
|
944
|
-
readonly notes: readonly ["直接写入 input[type=file],不依赖 file chooser;隐藏的文件节点也可上传。外部 Provider 的文件中转能力查询 mearl <providerId>。"];
|
|
945
|
-
readonly examples: ["page_upload --payload '{\"tabId\":12345,\"selector\":\"#file-input\",\"
|
|
970
|
+
readonly notes: readonly ["直接写入 input[type=file],不依赖 file chooser;隐藏的文件节点也可上传。外部 Provider 的文件中转能力查询 mearl <providerId>。", "Chrome 扩展连接中,files 分块传输,单次合计最多 256 MiB。filePaths 由 Chrome 直接读取,需要开启「允许访问文件网址」。直连 CDP 无需此扩展设置。"];
|
|
971
|
+
readonly examples: ["page_upload --payload '{\"tabId\":12345,\"selector\":\"#file-input\",\"files\":[{\"filePath\":\"/Users/me/photo.jpg\"}]}'"];
|
|
946
972
|
}, {
|
|
947
973
|
readonly name: "page_snapshot";
|
|
948
974
|
readonly description: "获取带 @ref 的页面结构快照,默认使用无障碍树,也可显式读取渲染 DOM";
|
|
@@ -1088,7 +1114,7 @@ export declare const COMMANDS: readonly [{
|
|
|
1088
1114
|
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}'"];
|
|
1089
1115
|
}, {
|
|
1090
1116
|
readonly name: "set_app_profile";
|
|
1091
|
-
readonly description: "
|
|
1117
|
+
readonly description: "为目标标签页应用 Profile,按配置启用 JSBridge 和容器行为。可同时设置已安装的网络控件,传 emulation 时联动设备模拟";
|
|
1092
1118
|
readonly summary: "设置或清除目标标签页的 App 容器模拟";
|
|
1093
1119
|
readonly params: [{
|
|
1094
1120
|
readonly name: "enabled";
|
|
@@ -1098,7 +1124,7 @@ export declare const COMMANDS: readonly [{
|
|
|
1098
1124
|
}, {
|
|
1099
1125
|
readonly name: "profile";
|
|
1100
1126
|
readonly type: "string";
|
|
1101
|
-
readonly description: "
|
|
1127
|
+
readonly description: "已安装的 Profile ID(enabled=true 时必填);当前动态帮助直接展示目标浏览器目录";
|
|
1102
1128
|
}, {
|
|
1103
1129
|
readonly name: "os";
|
|
1104
1130
|
readonly type: "\"ios\" | \"android\"";
|
|
@@ -1106,7 +1132,7 @@ export declare const COMMANDS: readonly [{
|
|
|
1106
1132
|
}, {
|
|
1107
1133
|
readonly name: "refreshDefinition";
|
|
1108
1134
|
readonly type: "boolean";
|
|
1109
|
-
readonly description: "
|
|
1135
|
+
readonly description: "立即采用最新 Profile,保留用户显式设置";
|
|
1110
1136
|
}, {
|
|
1111
1137
|
readonly name: "lockDefinition";
|
|
1112
1138
|
readonly type: "boolean";
|
|
@@ -1130,7 +1156,7 @@ export declare const COMMANDS: readonly [{
|
|
|
1130
1156
|
}, {
|
|
1131
1157
|
readonly name: "emulation";
|
|
1132
1158
|
readonly type: "object";
|
|
1133
|
-
readonly description: "可选设备联动参数,字段同 set_device_emulation 去掉 enabled/reload
|
|
1159
|
+
readonly description: "可选设备联动参数,字段同 set_device_emulation 去掉 enabled/reload;字段覆盖Profile 推荐的设备,deviceShell 默认 true,横屏时可传 splitScreen=true。省略时不设置或清除设备";
|
|
1134
1160
|
}, {
|
|
1135
1161
|
readonly name: "reload";
|
|
1136
1162
|
readonly type: "boolean";
|
|
@@ -1141,7 +1167,7 @@ export declare const COMMANDS: readonly [{
|
|
|
1141
1167
|
readonly required: true;
|
|
1142
1168
|
readonly description: "目标标签页 ID";
|
|
1143
1169
|
}];
|
|
1144
|
-
readonly notes: readonly ["只有用户明确要求 App/客户端/容器/JSBridge 模拟时启用。移动视口或普通 H5 调试使用 set_device_emulation。", "emulation={}
|
|
1170
|
+
readonly notes: readonly ["只有用户明确要求 App/客户端/容器/JSBridge 模拟时启用。移动视口或普通 H5 调试使用 set_device_emulation。", "emulation={} 使用Profile 推荐的设备;enabled=false 时省略 emulation 只清除 App 注入,传 {} 同时清除设备模拟。", "bridgeConfig.methods 按方法声明 behavior / response / noop 三选一,可传 silent;只支持受控行为、固定 JSON 回包或成功空实现,不执行配置脚本。"];
|
|
1145
1171
|
readonly result: readonly ["返回 enabled、profile、label、userAgent、os、networkControl、reloaded;联动设备时额外返回实际 emulation。"];
|
|
1146
1172
|
readonly examples: ["set_app_profile --payload '{\"tabId\":12345,\"enabled\":true,\"profile\":\"reader\"}'", "set_app_profile --payload '{\"tabId\":12345,\"enabled\":true,\"profile\":\"reader\",\"networkControl\":{\"id\":\"environment\",\"value\":\"pre\"}}'", "set_app_profile --payload '{\"tabId\":12345,\"enabled\":false,\"networkControl\":null}'", "set_app_profile --payload '{\"tabId\":12345,\"enabled\":true,\"profile\":\"reader\",\"emulation\":{}}'", "set_app_profile --payload '{\"tabId\":12345,\"enabled\":true,\"profile\":\"wallet\",\"emulation\":{\"preset\":\"pixel-11\",\"deviceShell\":true}}'", "set_app_profile --payload '{\"tabId\":12345,\"enabled\":true,\"profile\":\"reader\",\"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\":{}}'"];
|
|
1147
1173
|
}, {
|