@mearl/client 2.0.2 → 2.2.0
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 +6 -2
- package/dist/actionTimeouts.js +9 -11
- package/dist/cli.js +5 -2
- package/dist/commands.d.ts +890 -4
- package/dist/commands.js +79 -4
- package/dist/generated-browser-action-protocol.d.ts +677 -0
- package/dist/generated-browser-action-protocol.js +144 -0
- package/dist/index.d.ts +41 -425
- package/dist/index.js +10 -12
- package/dist/socket.d.ts +2 -0
- package/dist/socket.js +70 -19
- package/package.json +3 -3
package/dist/commands.js
CHANGED
|
@@ -5,7 +5,7 @@ export const COMMANDS = [
|
|
|
5
5
|
description: '获取最近的网络请求(mtop 或普通 xhr/fetch)',
|
|
6
6
|
params: [
|
|
7
7
|
{ name: 'tabId', type: 'number', description: '目标标签页 ID,从 tab_list 获取' },
|
|
8
|
-
{ name: 'count', type: 'number', description: '返回条数,默认
|
|
8
|
+
{ name: 'count', type: 'number', description: '返回条数,默认 10' },
|
|
9
9
|
{
|
|
10
10
|
name: 'source',
|
|
11
11
|
type: '"mtop" | "requests"',
|
|
@@ -23,6 +23,7 @@ export const COMMANDS = [
|
|
|
23
23
|
name: 'get_logs',
|
|
24
24
|
description: '获取浏览器控制台日志',
|
|
25
25
|
params: [
|
|
26
|
+
{ name: 'tabId', type: 'number', description: '目标标签页 ID,从 tab_list 获取' },
|
|
26
27
|
{ name: 'limit', type: 'number', description: '返回条数,默认 20' },
|
|
27
28
|
{ name: 'level', type: 'string', description: '按日志级别过滤:log/info/warn/error' },
|
|
28
29
|
{ name: 'filter', type: 'string', description: '按内容过滤,支持正则' },
|
|
@@ -60,7 +61,11 @@ export const COMMANDS = [
|
|
|
60
61
|
description: '获取 API 接口 schema(出入参定义)',
|
|
61
62
|
params: [
|
|
62
63
|
{ name: 'api', type: 'string', required: true, description: 'API 名称' },
|
|
63
|
-
{
|
|
64
|
+
{
|
|
65
|
+
name: 'fields',
|
|
66
|
+
type: '("schema" | "hsf")[]',
|
|
67
|
+
description: '指定返回内容;不填时返回全部可用内容',
|
|
68
|
+
},
|
|
64
69
|
],
|
|
65
70
|
examples: [`get_api_schema --payload '{"api":"mtop.trade.order.detail"}'`],
|
|
66
71
|
},
|
|
@@ -69,6 +74,7 @@ export const COMMANDS = [
|
|
|
69
74
|
name: 'set_mock',
|
|
70
75
|
description: '设置 API mock 数据',
|
|
71
76
|
params: [
|
|
77
|
+
{ name: 'tabId', type: 'number', description: '目标标签页 ID,从 tab_list 获取' },
|
|
72
78
|
{ name: 'apiName', type: 'string', required: true, description: 'API 名称或正则表达式' },
|
|
73
79
|
{ name: 'mockData', type: 'object', description: '完整 mock 响应数据(与 fields 二选一)' },
|
|
74
80
|
{
|
|
@@ -100,6 +106,10 @@ export const COMMANDS = [
|
|
|
100
106
|
{
|
|
101
107
|
name: 'get_mocks',
|
|
102
108
|
description: '查看当前生效的 mock 列表',
|
|
109
|
+
params: [
|
|
110
|
+
{ name: 'tabId', type: 'number', description: '目标标签页 ID,从 tab_list 获取' },
|
|
111
|
+
{ name: 'apiName', type: 'string', description: '按 API 名称或正则表达式过滤' },
|
|
112
|
+
],
|
|
103
113
|
examples: ['get_mocks'],
|
|
104
114
|
},
|
|
105
115
|
{
|
|
@@ -147,6 +157,11 @@ export const COMMANDS = [
|
|
|
147
157
|
name: 'tdbank_account',
|
|
148
158
|
description: 'TDBank 账号操作:获取当前账号、账号列表、切换账号、快速借用并切换账号',
|
|
149
159
|
params: [
|
|
160
|
+
{
|
|
161
|
+
name: 'tabId',
|
|
162
|
+
type: 'number',
|
|
163
|
+
description: 'CDP 模式下可指定用于读取 Cookie 的标签页 ID',
|
|
164
|
+
},
|
|
150
165
|
{
|
|
151
166
|
name: 'operation',
|
|
152
167
|
type: '"current" | "list" | "switch" | "borrow"',
|
|
@@ -171,6 +186,11 @@ export const COMMANDS = [
|
|
|
171
186
|
description: '列出所有浏览器及其连接状态、类型和托管实例信息',
|
|
172
187
|
examples: ['browser_list'],
|
|
173
188
|
},
|
|
189
|
+
{
|
|
190
|
+
name: 'browser_release',
|
|
191
|
+
description: '按用户明确要求释放调试控制和会话级临时效果(含设备/时区模拟),保留浏览器和全部标签页;不用于普通任务收尾',
|
|
192
|
+
examples: ['browser_release', 'browser_release --browser chrome-a'],
|
|
193
|
+
},
|
|
174
194
|
{
|
|
175
195
|
name: 'browser_launch',
|
|
176
196
|
description: '启动独立 Chrome,可在新实例中通过 TDBank 登录指定账号',
|
|
@@ -630,17 +650,19 @@ export const COMMANDS = [
|
|
|
630
650
|
{
|
|
631
651
|
name: 'record_start',
|
|
632
652
|
description: '开始录制用户操作',
|
|
653
|
+
params: [{ name: 'tabId', type: 'number', description: '目标标签页 ID,从 tab_list 获取' }],
|
|
633
654
|
examples: ['record_start'],
|
|
634
655
|
},
|
|
635
656
|
{
|
|
636
657
|
name: 'record_stop',
|
|
637
658
|
description: '停止录制并返回完整结果(操作 + 关联请求);未在录制时不报错,返回 wasRecording: false',
|
|
659
|
+
params: [{ name: 'tabId', type: 'number', description: '目标标签页 ID,从 tab_list 获取' }],
|
|
638
660
|
examples: ['record_stop'],
|
|
639
661
|
},
|
|
640
662
|
// ── 移动端模拟 ────────────────────────────────────────────────────────────
|
|
641
663
|
{
|
|
642
664
|
name: 'set_device_emulation',
|
|
643
|
-
description: '把目标 tab 切换为移动端模拟(视口/UA/触摸),等价 DevTools 设备工具栏,作用域 per-tab',
|
|
665
|
+
description: '把目标 tab 切换为移动端模拟(视口/UA/触摸),等价 DevTools 设备工具栏,作用域 per-tab;需保持调试控制才持续生效',
|
|
644
666
|
params: [
|
|
645
667
|
{ name: 'enabled', type: 'boolean', required: true, description: 'true=启用,false=清除' },
|
|
646
668
|
{
|
|
@@ -685,6 +707,59 @@ export const COMMANDS = [
|
|
|
685
707
|
`set_timezone --payload '{"tabId":12345,"timezone":""}'`,
|
|
686
708
|
],
|
|
687
709
|
},
|
|
710
|
+
{
|
|
711
|
+
name: 'get_cookie',
|
|
712
|
+
description: '读取当前标签页的一个指定非分区 Cookie;拒绝返回 HttpOnly Cookie',
|
|
713
|
+
params: [
|
|
714
|
+
{ name: 'tabId', type: 'number', required: true, description: '目标标签页 ID' },
|
|
715
|
+
{
|
|
716
|
+
name: 'name',
|
|
717
|
+
type: 'string',
|
|
718
|
+
required: true,
|
|
719
|
+
description: '要读取的 Cookie 名称;不支持列举全部 Cookie',
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
name: 'domain',
|
|
723
|
+
type: 'string',
|
|
724
|
+
description: '可选精确域过滤,只允许当前 host 或其父域',
|
|
725
|
+
},
|
|
726
|
+
{ name: 'path', type: 'string', description: '可选精确 path 过滤' },
|
|
727
|
+
],
|
|
728
|
+
examples: [
|
|
729
|
+
`get_cookie --payload '{"tabId":12345,"name":"feature_flag"}'`,
|
|
730
|
+
`get_cookie --payload '{"tabId":12345,"name":"edith_switch_br.rx-vehicle-search_home","domain":"taobao.com"}'`,
|
|
731
|
+
],
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
name: 'set_cookie',
|
|
735
|
+
description: '设置当前标签页域下的一个指定非分区 session Cookie,可选刷新页面',
|
|
736
|
+
params: [
|
|
737
|
+
{ name: 'tabId', type: 'number', required: true, description: '目标标签页 ID' },
|
|
738
|
+
{
|
|
739
|
+
name: 'name',
|
|
740
|
+
type: 'string',
|
|
741
|
+
required: true,
|
|
742
|
+
description: 'Cookie 名称',
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
name: 'value',
|
|
746
|
+
type: 'string',
|
|
747
|
+
required: true,
|
|
748
|
+
description: 'Cookie 值,可传空字符串;空字符串不会删除 Cookie',
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
name: 'domain',
|
|
752
|
+
type: 'string',
|
|
753
|
+
description: 'Cookie 域,默认当前 host;只允许当前 host 或其父域',
|
|
754
|
+
},
|
|
755
|
+
{ name: 'path', type: 'string', description: 'Cookie path,默认 /' },
|
|
756
|
+
{ name: 'reload', type: 'boolean', description: '设置后是否刷新页面,默认 false' },
|
|
757
|
+
],
|
|
758
|
+
examples: [
|
|
759
|
+
`set_cookie --payload '{"tabId":12345,"name":"feature_flag","value":"enabled"}'`,
|
|
760
|
+
`set_cookie --payload '{"tabId":12345,"name":"edith_switch_br.rx-vehicle-search_home","value":"3.6.63","domain":"taobao.com","reload":true}'`,
|
|
761
|
+
],
|
|
762
|
+
},
|
|
688
763
|
// ── 其他 ──────────────────────────────────────────────────────────────────
|
|
689
764
|
{
|
|
690
765
|
name: 'page_frames',
|
|
@@ -728,4 +803,4 @@ export const COMMANDS = [
|
|
|
728
803
|
],
|
|
729
804
|
},
|
|
730
805
|
];
|
|
731
|
-
export const COMMAND_MAP = new Map(COMMANDS.map(
|
|
806
|
+
export const COMMAND_MAP = new Map(COMMANDS.map(command => [command.name, command]));
|