@mearl/client 2.19.0 → 2.19.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.md +6 -5
- package/dist/cli.js +1 -1
- package/dist/commands.d.ts +31 -5
- package/dist/commands.js +68 -13
- package/dist/generated-browser-action-protocol.d.ts +23 -7
- package/dist/generated-browser-action-protocol.js +10 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.js +9 -6
- package/dist/officialPluginCatalog.d.ts +5 -1
- package/dist/officialPluginCatalog.js +5 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ pnpm add @mearl/client
|
|
|
18
18
|
import * as client from '@mearl/client';
|
|
19
19
|
|
|
20
20
|
// 具名方法(类型安全)
|
|
21
|
-
const requests = await client.getRequests({ count: 5 });
|
|
21
|
+
const requests = await client.getRequests({ tabId: 12345, count: 5 });
|
|
22
22
|
const result = await client.sendRequest({
|
|
23
23
|
url: 'https://api.example.com',
|
|
24
24
|
method: 'GET',
|
|
@@ -30,7 +30,7 @@ const data = await client.invoke('send_request', { url: '...' });
|
|
|
30
30
|
|
|
31
31
|
// browser_list 默认聚合本机和所有远端 connector
|
|
32
32
|
const browsers = await client.browserList();
|
|
33
|
-
await client.getLogs({}, { browser: browsers.browsers[0].browserId });
|
|
33
|
+
await client.getLogs({ tabId: 12345 }, { browser: browsers.browsers[0].browserId });
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
## CLI 使用
|
|
@@ -39,7 +39,7 @@ await client.getLogs({}, { browser: browsers.browsers[0].browserId });
|
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
41
|
# 获取最近 5 个请求
|
|
42
|
-
mearl get_requests --payload '{"count":5}'
|
|
42
|
+
mearl get_requests --payload '{"tabId":12345,"count":5}'
|
|
43
43
|
|
|
44
44
|
# 代理一个 HTTP 请求
|
|
45
45
|
mearl send_request --payload '{"url":"https://api.example.com","method":"GET"}'
|
|
@@ -50,7 +50,7 @@ mearl send_request --payload '{"url":"https://api.example.com/upload","method":"
|
|
|
50
50
|
# 截图并保存(tabId 来自 tab_open 或 tab_list)
|
|
51
51
|
mearl page_screenshot --payload '{"tabId":12345}' --output ./screenshot.png
|
|
52
52
|
|
|
53
|
-
#
|
|
53
|
+
# 从文件读取大体积参数(mock-data.json 需包含 tabId)
|
|
54
54
|
mearl set_mock --payload-file ./mock-data.json
|
|
55
55
|
|
|
56
56
|
# 环境自检
|
|
@@ -158,6 +158,7 @@ client、native-host、cloud-server 和 MCP server 的已安装版本。发现
|
|
|
158
158
|
```bash
|
|
159
159
|
npx @mearl/setup plugin install trip/mearl --skill yuque-doc-fetch --yes
|
|
160
160
|
npx @mearl/setup plugin install trip/mearl --skill buc-request --yes
|
|
161
|
+
npx @mearl/setup plugin install trip/mearl --skill authx-request --yes
|
|
161
162
|
npx @mearl/setup plugin /absolute/path/to/yuque-doc-fetch
|
|
162
163
|
npx @mearl/setup plugin uninstall yuque
|
|
163
164
|
mearl yuque read "https://aliyuque.antfin.com/group/book/doc"
|
|
@@ -198,7 +199,7 @@ const result = await invokePlugin(
|
|
|
198
199
|
);
|
|
199
200
|
```
|
|
200
201
|
|
|
201
|
-
MCP Server 通过固定工具 `plugin_invoke` 接受同样的 `plugin`、`command` 和 `input`,不会把插件子命令动态扩展成 MCP 工具。SDK 与 MCP 不接受任意入口路径;调用尚未注册的 `buc` 或 `tdbank` 时,会通过匹配当前 client 版本的 setup 自动安装并重试一次。其他未注册名称返回 `PLUGIN_NOT_REGISTERED`。
|
|
202
|
+
MCP Server 通过固定工具 `plugin_invoke` 接受同样的 `plugin`、`command` 和 `input`,不会把插件子命令动态扩展成 MCP 工具。SDK 与 MCP 不接受任意入口路径;调用尚未注册的 `buc`、`authx` 或 `tdbank` 时,会通过匹配当前 client 版本的 setup 自动安装并重试一次。其他未注册名称返回 `PLUGIN_NOT_REGISTERED`。
|
|
202
203
|
|
|
203
204
|
注册记录在 `~/.mearl/plugins/<name>.json`,保存入口路径和可选的简短描述;skill 业务代码原地更新直接生效,换路径或更新描述后重新注册。
|
|
204
205
|
`plugin uninstall <name>` 会对 `~/.agents/skills` 中的全局 Skill 调用 `ali-skills remove --global --yes`,
|
package/dist/cli.js
CHANGED
|
@@ -21,7 +21,7 @@ const CATEGORIES = [
|
|
|
21
21
|
title: '网络请求',
|
|
22
22
|
names: ['send_request', 'send_mtop_request', 'request_domain_permission'],
|
|
23
23
|
},
|
|
24
|
-
{ title: '标签页', names: ['tab_open', 'tab_list', 'tab_close'] },
|
|
24
|
+
{ title: '标签页', names: ['tab_open', 'tab_list', 'tab_group', 'tab_close'] },
|
|
25
25
|
{
|
|
26
26
|
title: '页面感知',
|
|
27
27
|
names: ['page_snapshot', 'page_inspect', 'page_screenshot', 'page_frames'],
|
package/dist/commands.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare const COMMANDS: readonly [{
|
|
|
24
24
|
readonly params: [{
|
|
25
25
|
readonly name: "tabId";
|
|
26
26
|
readonly type: "number";
|
|
27
|
+
readonly required: true;
|
|
27
28
|
readonly description: "目标标签页 ID,从 tab_open 获取";
|
|
28
29
|
}];
|
|
29
30
|
readonly examples: ["tab_checkpoint --payload '{\"tabId\":12345}'"];
|
|
@@ -33,6 +34,7 @@ export declare const COMMANDS: readonly [{
|
|
|
33
34
|
readonly params: [{
|
|
34
35
|
readonly name: "tabId";
|
|
35
36
|
readonly type: "number";
|
|
37
|
+
readonly required: true;
|
|
36
38
|
readonly description: "目标标签页 ID,从 tab_list 获取";
|
|
37
39
|
}, {
|
|
38
40
|
readonly name: "count";
|
|
@@ -75,13 +77,14 @@ export declare const COMMANDS: readonly [{
|
|
|
75
77
|
readonly type: "boolean";
|
|
76
78
|
readonly description: "只返回数据结构,不返回叶子值";
|
|
77
79
|
}];
|
|
78
|
-
readonly examples: ["get_requests --payload '{\"count\":5}'", "get_requests --payload '{\"source\":\"mtop\",\"filter\":\"cart\"}'"];
|
|
80
|
+
readonly examples: ["get_requests --payload '{\"tabId\":12345,\"count\":5}'", "get_requests --payload '{\"tabId\":12345,\"source\":\"mtop\",\"filter\":\"cart\"}'"];
|
|
79
81
|
}, {
|
|
80
82
|
readonly name: "get_logs";
|
|
81
83
|
readonly description: "获取浏览器控制台日志";
|
|
82
84
|
readonly params: [{
|
|
83
85
|
readonly name: "tabId";
|
|
84
86
|
readonly type: "number";
|
|
87
|
+
readonly required: true;
|
|
85
88
|
readonly description: "目标标签页 ID,从 tab_list 获取";
|
|
86
89
|
}, {
|
|
87
90
|
readonly name: "limit";
|
|
@@ -104,13 +107,14 @@ export declare const COMMANDS: readonly [{
|
|
|
104
107
|
readonly type: "string";
|
|
105
108
|
readonly description: "只返回指定 tab checkpoint 或同类查询 cursor 之后的日志";
|
|
106
109
|
}];
|
|
107
|
-
readonly examples: ["get_logs --payload '{\"limit\":10,\"level\":\"error\"}'"];
|
|
110
|
+
readonly examples: ["get_logs --payload '{\"tabId\":12345,\"limit\":10,\"level\":\"error\"}'"];
|
|
108
111
|
}, {
|
|
109
112
|
readonly name: "get_events";
|
|
110
113
|
readonly description: "获取 RUM/aplus/ARMS 埋点事件";
|
|
111
114
|
readonly params: [{
|
|
112
115
|
readonly name: "tabId";
|
|
113
116
|
readonly type: "number";
|
|
117
|
+
readonly required: true;
|
|
114
118
|
readonly description: "目标标签页 ID,从 tab_list 获取";
|
|
115
119
|
}, {
|
|
116
120
|
readonly name: "source";
|
|
@@ -141,13 +145,14 @@ export declare const COMMANDS: readonly [{
|
|
|
141
145
|
readonly type: "boolean";
|
|
142
146
|
readonly description: "返回完整 URL、_raw 和 _context;默认 false";
|
|
143
147
|
}];
|
|
144
|
-
readonly examples: ["get_events --payload '{\"source\":\"aplus\",\"event_type\":\"CLK\",\"limit\":10}'", "get_events --payload '{\"filter\":\"order\",\"includeRaw\":true,\"limit\":1}'", "get_events --payload '{\"tabId\":12345,\"source\":\"all\",\"limit\":20}'"];
|
|
148
|
+
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}'"];
|
|
145
149
|
}, {
|
|
146
150
|
readonly name: "set_mock";
|
|
147
151
|
readonly description: "设置 API mock 数据";
|
|
148
152
|
readonly params: [{
|
|
149
153
|
readonly name: "tabId";
|
|
150
154
|
readonly type: "number";
|
|
155
|
+
readonly required: true;
|
|
151
156
|
readonly description: "目标标签页 ID,从 tab_list 获取";
|
|
152
157
|
}, {
|
|
153
158
|
readonly name: "apiName";
|
|
@@ -175,20 +180,21 @@ export declare const COMMANDS: readonly [{
|
|
|
175
180
|
readonly type: "object";
|
|
176
181
|
readonly description: "请求 query/body 字段子集匹配;$index 从 0 开始指定调用顺序";
|
|
177
182
|
}];
|
|
178
|
-
readonly examples: ["set_mock --payload '{\"apiName\":\"mtop.cart.query\",\"mockData\":{\"ret\":[\"SUCCESS::调用成功\"]}}'", "set_mock --payload-file ./mock-data.json"];
|
|
183
|
+
readonly examples: ["set_mock --payload '{\"tabId\":12345,\"apiName\":\"mtop.cart.query\",\"mockData\":{\"ret\":[\"SUCCESS::调用成功\"]}}'", "set_mock --payload-file ./mock-data.json"];
|
|
179
184
|
}, {
|
|
180
185
|
readonly name: "get_mocks";
|
|
181
186
|
readonly description: "查看当前生效的 mock 列表";
|
|
182
187
|
readonly params: [{
|
|
183
188
|
readonly name: "tabId";
|
|
184
189
|
readonly type: "number";
|
|
190
|
+
readonly required: true;
|
|
185
191
|
readonly description: "目标标签页 ID,从 tab_list 获取";
|
|
186
192
|
}, {
|
|
187
193
|
readonly name: "apiName";
|
|
188
194
|
readonly type: "string";
|
|
189
195
|
readonly description: "按 API 名称或正则表达式过滤";
|
|
190
196
|
}];
|
|
191
|
-
readonly examples: ["get_mocks"];
|
|
197
|
+
readonly examples: ["get_mocks --payload '{\"tabId\":12345}'"];
|
|
192
198
|
}, {
|
|
193
199
|
readonly name: "set_rule";
|
|
194
200
|
readonly description: "添加 Chrome declarativeNetRequest 规则(重定向/修改请求头/拦截请求)";
|
|
@@ -452,6 +458,26 @@ export declare const COMMANDS: readonly [{
|
|
|
452
458
|
readonly description: "列出目标浏览器所有窗口中的标签页";
|
|
453
459
|
readonly aliases: readonly ["tabs", "list_tabs", "show_tabs"];
|
|
454
460
|
readonly examples: ["tab_list"];
|
|
461
|
+
}, {
|
|
462
|
+
readonly name: "tab_group";
|
|
463
|
+
readonly description: "把同一窗口中的标签页加入分组,或通过 ungroup 取消分组并保留标签页;仅扩展模式支持";
|
|
464
|
+
readonly params: [{
|
|
465
|
+
readonly name: "tabIds";
|
|
466
|
+
readonly type: "number[]";
|
|
467
|
+
readonly required: true;
|
|
468
|
+
readonly description: "标签页 ID,分组最多 100 个,取消分组最多 1000 个";
|
|
469
|
+
}, {
|
|
470
|
+
readonly name: "title";
|
|
471
|
+
readonly type: "string";
|
|
472
|
+
readonly required: false;
|
|
473
|
+
readonly description: "分组标题;取消分组时省略";
|
|
474
|
+
}, {
|
|
475
|
+
readonly name: "ungroup";
|
|
476
|
+
readonly type: "boolean";
|
|
477
|
+
readonly required: false;
|
|
478
|
+
readonly description: "为 true 时取消分组并保留标签页";
|
|
479
|
+
}];
|
|
480
|
+
readonly examples: ["tab_group --payload '{\"tabIds\":[123,124],\"title\":\"项目文档\"}'", "tab_group --payload '{\"tabIds\":[123,124],\"ungroup\":true}'"];
|
|
455
481
|
}, {
|
|
456
482
|
readonly name: "page_click";
|
|
457
483
|
readonly description: "点击页面元素,支持 CSS/@ref、可见文本或视口坐标定位";
|
package/dist/commands.js
CHANGED
|
@@ -17,14 +17,26 @@ export const COMMANDS = [
|
|
|
17
17
|
{
|
|
18
18
|
name: 'tab_checkpoint',
|
|
19
19
|
description: '为目标标签页建立日志、请求和埋点增量边界',
|
|
20
|
-
params: [
|
|
20
|
+
params: [
|
|
21
|
+
{
|
|
22
|
+
name: 'tabId',
|
|
23
|
+
type: 'number',
|
|
24
|
+
required: true,
|
|
25
|
+
description: '目标标签页 ID,从 tab_open 获取',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
21
28
|
examples: [`tab_checkpoint --payload '{"tabId":12345}'`],
|
|
22
29
|
},
|
|
23
30
|
{
|
|
24
31
|
name: 'get_requests',
|
|
25
32
|
description: '获取最近的网络请求(mtop 或普通 xhr/fetch)',
|
|
26
33
|
params: [
|
|
27
|
-
{
|
|
34
|
+
{
|
|
35
|
+
name: 'tabId',
|
|
36
|
+
type: 'number',
|
|
37
|
+
required: true,
|
|
38
|
+
description: '目标标签页 ID,从 tab_list 获取',
|
|
39
|
+
},
|
|
28
40
|
{ name: 'count', type: 'number', description: '返回条数,默认 10' },
|
|
29
41
|
{
|
|
30
42
|
name: 'source',
|
|
@@ -45,15 +57,20 @@ export const COMMANDS = [
|
|
|
45
57
|
{ name: 'keysOnly', type: 'boolean', description: '只返回数据结构,不返回叶子值' },
|
|
46
58
|
],
|
|
47
59
|
examples: [
|
|
48
|
-
`get_requests --payload '{"count":5}'`,
|
|
49
|
-
`get_requests --payload '{"source":"mtop","filter":"cart"}'`,
|
|
60
|
+
`get_requests --payload '{"tabId":12345,"count":5}'`,
|
|
61
|
+
`get_requests --payload '{"tabId":12345,"source":"mtop","filter":"cart"}'`,
|
|
50
62
|
],
|
|
51
63
|
},
|
|
52
64
|
{
|
|
53
65
|
name: 'get_logs',
|
|
54
66
|
description: '获取浏览器控制台日志',
|
|
55
67
|
params: [
|
|
56
|
-
{
|
|
68
|
+
{
|
|
69
|
+
name: 'tabId',
|
|
70
|
+
type: 'number',
|
|
71
|
+
required: true,
|
|
72
|
+
description: '目标标签页 ID,从 tab_list 获取',
|
|
73
|
+
},
|
|
57
74
|
{ name: 'limit', type: 'number', description: '返回最新 N 条,默认 100' },
|
|
58
75
|
{ name: 'level', type: 'string', description: '按日志级别过滤:log/info/warn/error/all' },
|
|
59
76
|
{ name: 'filter', type: 'string', description: '按内容过滤,支持正则' },
|
|
@@ -64,13 +81,18 @@ export const COMMANDS = [
|
|
|
64
81
|
description: '只返回指定 tab checkpoint 或同类查询 cursor 之后的日志',
|
|
65
82
|
},
|
|
66
83
|
],
|
|
67
|
-
examples: [`get_logs --payload '{"limit":10,"level":"error"}'`],
|
|
84
|
+
examples: [`get_logs --payload '{"tabId":12345,"limit":10,"level":"error"}'`],
|
|
68
85
|
},
|
|
69
86
|
{
|
|
70
87
|
name: 'get_events',
|
|
71
88
|
description: '获取 RUM/aplus/ARMS 埋点事件',
|
|
72
89
|
params: [
|
|
73
|
-
{
|
|
90
|
+
{
|
|
91
|
+
name: 'tabId',
|
|
92
|
+
type: 'number',
|
|
93
|
+
required: true,
|
|
94
|
+
description: '目标标签页 ID,从 tab_list 获取',
|
|
95
|
+
},
|
|
74
96
|
{
|
|
75
97
|
name: 'source',
|
|
76
98
|
type: '"rum" | "aplus" | "arms" | "all"',
|
|
@@ -88,8 +110,8 @@ export const COMMANDS = [
|
|
|
88
110
|
},
|
|
89
111
|
],
|
|
90
112
|
examples: [
|
|
91
|
-
`get_events --payload '{"source":"aplus","event_type":"CLK","limit":10}'`,
|
|
92
|
-
`get_events --payload '{"filter":"order","includeRaw":true,"limit":1}'`,
|
|
113
|
+
`get_events --payload '{"tabId":12345,"source":"aplus","event_type":"CLK","limit":10}'`,
|
|
114
|
+
`get_events --payload '{"tabId":12345,"filter":"order","includeRaw":true,"limit":1}'`,
|
|
93
115
|
`get_events --payload '{"tabId":12345,"source":"all","limit":20}'`,
|
|
94
116
|
],
|
|
95
117
|
},
|
|
@@ -98,7 +120,12 @@ export const COMMANDS = [
|
|
|
98
120
|
name: 'set_mock',
|
|
99
121
|
description: '设置 API mock 数据',
|
|
100
122
|
params: [
|
|
101
|
-
{
|
|
123
|
+
{
|
|
124
|
+
name: 'tabId',
|
|
125
|
+
type: 'number',
|
|
126
|
+
required: true,
|
|
127
|
+
description: '目标标签页 ID,从 tab_list 获取',
|
|
128
|
+
},
|
|
102
129
|
{ name: 'apiName', type: 'string', required: true, description: 'API 名称或正则表达式' },
|
|
103
130
|
{ name: 'mockData', type: 'object', description: '完整 mock 响应数据(与 fields 二选一)' },
|
|
104
131
|
{
|
|
@@ -123,7 +150,7 @@ export const COMMANDS = [
|
|
|
123
150
|
},
|
|
124
151
|
],
|
|
125
152
|
examples: [
|
|
126
|
-
`set_mock --payload '{"apiName":"mtop.cart.query","mockData":{"ret":["SUCCESS::调用成功"]}}'`,
|
|
153
|
+
`set_mock --payload '{"tabId":12345,"apiName":"mtop.cart.query","mockData":{"ret":["SUCCESS::调用成功"]}}'`,
|
|
127
154
|
`set_mock --payload-file ./mock-data.json`,
|
|
128
155
|
],
|
|
129
156
|
},
|
|
@@ -131,10 +158,15 @@ export const COMMANDS = [
|
|
|
131
158
|
name: 'get_mocks',
|
|
132
159
|
description: '查看当前生效的 mock 列表',
|
|
133
160
|
params: [
|
|
134
|
-
{
|
|
161
|
+
{
|
|
162
|
+
name: 'tabId',
|
|
163
|
+
type: 'number',
|
|
164
|
+
required: true,
|
|
165
|
+
description: '目标标签页 ID,从 tab_list 获取',
|
|
166
|
+
},
|
|
135
167
|
{ name: 'apiName', type: 'string', description: '按 API 名称或正则表达式过滤' },
|
|
136
168
|
],
|
|
137
|
-
examples: [
|
|
169
|
+
examples: [`get_mocks --payload '{"tabId":12345}'`],
|
|
138
170
|
},
|
|
139
171
|
{
|
|
140
172
|
name: 'set_rule',
|
|
@@ -389,6 +421,29 @@ export const COMMANDS = [
|
|
|
389
421
|
aliases: ['tabs', 'list_tabs', 'show_tabs'],
|
|
390
422
|
examples: ['tab_list'],
|
|
391
423
|
},
|
|
424
|
+
{
|
|
425
|
+
name: 'tab_group',
|
|
426
|
+
description: '把同一窗口中的标签页加入分组,或通过 ungroup 取消分组并保留标签页;仅扩展模式支持',
|
|
427
|
+
params: [
|
|
428
|
+
{
|
|
429
|
+
name: 'tabIds',
|
|
430
|
+
type: 'number[]',
|
|
431
|
+
required: true,
|
|
432
|
+
description: '标签页 ID,分组最多 100 个,取消分组最多 1000 个',
|
|
433
|
+
},
|
|
434
|
+
{ name: 'title', type: 'string', required: false, description: '分组标题;取消分组时省略' },
|
|
435
|
+
{
|
|
436
|
+
name: 'ungroup',
|
|
437
|
+
type: 'boolean',
|
|
438
|
+
required: false,
|
|
439
|
+
description: '为 true 时取消分组并保留标签页',
|
|
440
|
+
},
|
|
441
|
+
],
|
|
442
|
+
examples: [
|
|
443
|
+
`tab_group --payload '{"tabIds":[123,124],"title":"项目文档"}'`,
|
|
444
|
+
`tab_group --payload '{"tabIds":[123,124],"ungroup":true}'`,
|
|
445
|
+
],
|
|
446
|
+
},
|
|
392
447
|
// ── 页面操作 ──────────────────────────────────────────────────────────────
|
|
393
448
|
{
|
|
394
449
|
name: 'page_click',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface GetRequestsParams {
|
|
2
|
-
tabId
|
|
2
|
+
tabId: number;
|
|
3
3
|
count?: number;
|
|
4
4
|
filter?: string;
|
|
5
5
|
/** Relative time window in seconds. */
|
|
@@ -15,7 +15,7 @@ export interface GetRequestsParams {
|
|
|
15
15
|
source?: 'mtop' | 'requests' | 'all';
|
|
16
16
|
}
|
|
17
17
|
export interface GetLogsParams {
|
|
18
|
-
tabId
|
|
18
|
+
tabId: number;
|
|
19
19
|
level?: 'log' | 'warn' | 'error' | 'info' | 'all';
|
|
20
20
|
/** Relative time window in seconds. */
|
|
21
21
|
since?: number;
|
|
@@ -25,7 +25,7 @@ export interface GetLogsParams {
|
|
|
25
25
|
filter?: string;
|
|
26
26
|
}
|
|
27
27
|
export interface CaptureCheckpointParams {
|
|
28
|
-
tabId
|
|
28
|
+
tabId: number;
|
|
29
29
|
}
|
|
30
30
|
export interface CaptureCheckpointResult {
|
|
31
31
|
tabId: number;
|
|
@@ -34,7 +34,7 @@ export interface CaptureCheckpointResult {
|
|
|
34
34
|
captureStatus: 'armed' | 'active';
|
|
35
35
|
}
|
|
36
36
|
export interface GetEventsParams {
|
|
37
|
-
tabId
|
|
37
|
+
tabId: number;
|
|
38
38
|
source?: 'rum' | 'aplus' | 'arms' | 'all';
|
|
39
39
|
event_type?: string;
|
|
40
40
|
filter?: string;
|
|
@@ -45,7 +45,7 @@ export interface GetEventsParams {
|
|
|
45
45
|
includeRaw?: boolean;
|
|
46
46
|
}
|
|
47
47
|
export interface SetMockParams {
|
|
48
|
-
tabId
|
|
48
|
+
tabId: number;
|
|
49
49
|
apiName: string;
|
|
50
50
|
mockData?: unknown;
|
|
51
51
|
fields?: Array<{
|
|
@@ -57,7 +57,7 @@ export interface SetMockParams {
|
|
|
57
57
|
conditions?: Record<string, unknown>;
|
|
58
58
|
}
|
|
59
59
|
export interface GetMocksParams {
|
|
60
|
-
tabId
|
|
60
|
+
tabId: number;
|
|
61
61
|
apiName?: string;
|
|
62
62
|
}
|
|
63
63
|
export declare const SEND_REQUEST_MAX_FILES = 20;
|
|
@@ -403,6 +403,15 @@ export interface TabOpenParams {
|
|
|
403
403
|
/** 与 appProfile 配合使用;按方法覆盖档案内置桥配置 */
|
|
404
404
|
bridgeConfig?: AppBridgeConfig;
|
|
405
405
|
}
|
|
406
|
+
export type TabGroupParams = {
|
|
407
|
+
tabIds: number[];
|
|
408
|
+
title: string;
|
|
409
|
+
ungroup?: false;
|
|
410
|
+
} | {
|
|
411
|
+
tabIds: number[];
|
|
412
|
+
ungroup: true;
|
|
413
|
+
title?: never;
|
|
414
|
+
};
|
|
406
415
|
/**
|
|
407
416
|
* 客户端容器模拟可用档案名。
|
|
408
417
|
*
|
|
@@ -727,6 +736,10 @@ export interface BrowserActionMap {
|
|
|
727
736
|
request: undefined;
|
|
728
737
|
response: unknown;
|
|
729
738
|
};
|
|
739
|
+
tab_group: {
|
|
740
|
+
request: TabGroupParams;
|
|
741
|
+
response: unknown;
|
|
742
|
+
};
|
|
730
743
|
page_click: {
|
|
731
744
|
request: PageClickParams;
|
|
732
745
|
response: unknown;
|
|
@@ -813,7 +826,7 @@ export type BrowserActionRequest<A extends BrowserAction> = BrowserActionMap[A][
|
|
|
813
826
|
export type BrowserActionResponse<A extends BrowserAction> = BrowserActionMap[A]['response'];
|
|
814
827
|
export type BrowserCommandAction = Exclude<BrowserAction, 'browser_select_browser'>;
|
|
815
828
|
export type ExtensionBrowserAction = Exclude<BrowserCommandAction, 'browser_list' | 'browser_launch' | 'browser_close'>;
|
|
816
|
-
export declare const TAB_ID_REQUIRED_ACTIONS: readonly ["page_screenshot", "tab_close", "page_click", "page_drag", "page_type", "page_scroll", "page_hover", "page_eval", "page_inspect", "page_snapshot", "page_press", "page_wait", "page_navigate", "page_upload", "page_frames", "set_device_emulation", "set_app_profile", "set_timezone", "get_cookie", "set_cookie", "run_actions"];
|
|
829
|
+
export declare const TAB_ID_REQUIRED_ACTIONS: readonly ["tab_checkpoint", "capture_checkpoint", "get_requests", "get_logs", "get_events", "set_mock", "get_mocks", "page_screenshot", "tab_close", "page_click", "page_drag", "page_type", "page_scroll", "page_hover", "page_eval", "page_inspect", "page_snapshot", "page_press", "page_wait", "page_navigate", "page_upload", "page_frames", "set_device_emulation", "set_app_profile", "set_timezone", "get_cookie", "set_cookie", "run_actions"];
|
|
817
830
|
export type TabIdRequiredAction = (typeof TAB_ID_REQUIRED_ACTIONS)[number];
|
|
818
831
|
export declare function actionRequiresTabId(action: unknown): action is TabIdRequiredAction;
|
|
819
832
|
export declare function validateRequiredActionTabId(action: string, data: unknown): void;
|
|
@@ -840,6 +853,7 @@ export declare const BROWSER_ACTIONS: {
|
|
|
840
853
|
readonly tab_open: true;
|
|
841
854
|
readonly tab_close: true;
|
|
842
855
|
readonly tab_list: true;
|
|
856
|
+
readonly tab_group: true;
|
|
843
857
|
readonly page_click: true;
|
|
844
858
|
readonly page_drag: true;
|
|
845
859
|
readonly page_type: true;
|
|
@@ -881,6 +895,7 @@ export declare const BROWSER_COMMAND_ACTIONS: {
|
|
|
881
895
|
readonly tab_open: true;
|
|
882
896
|
readonly tab_close: true;
|
|
883
897
|
readonly tab_list: true;
|
|
898
|
+
readonly tab_group: true;
|
|
884
899
|
readonly page_click: true;
|
|
885
900
|
readonly page_drag: true;
|
|
886
901
|
readonly page_type: true;
|
|
@@ -919,6 +934,7 @@ export declare const EXTENSION_BROWSER_ACTIONS: {
|
|
|
919
934
|
readonly tab_open: true;
|
|
920
935
|
readonly tab_close: true;
|
|
921
936
|
readonly tab_list: true;
|
|
937
|
+
readonly tab_group: true;
|
|
922
938
|
readonly page_click: true;
|
|
923
939
|
readonly page_drag: true;
|
|
924
940
|
readonly page_type: true;
|
|
@@ -51,6 +51,13 @@ export const APP_PROFILE_NAMES = [
|
|
|
51
51
|
'easybike',
|
|
52
52
|
];
|
|
53
53
|
export const TAB_ID_REQUIRED_ACTIONS = [
|
|
54
|
+
'tab_checkpoint',
|
|
55
|
+
'capture_checkpoint',
|
|
56
|
+
'get_requests',
|
|
57
|
+
'get_logs',
|
|
58
|
+
'get_events',
|
|
59
|
+
'set_mock',
|
|
60
|
+
'get_mocks',
|
|
54
61
|
'page_screenshot',
|
|
55
62
|
'tab_close',
|
|
56
63
|
'page_click',
|
|
@@ -118,6 +125,7 @@ export const BROWSER_ACTIONS = {
|
|
|
118
125
|
tab_open: true,
|
|
119
126
|
tab_close: true,
|
|
120
127
|
tab_list: true,
|
|
128
|
+
tab_group: true,
|
|
121
129
|
page_click: true,
|
|
122
130
|
page_drag: true,
|
|
123
131
|
page_type: true,
|
|
@@ -159,6 +167,7 @@ export const BROWSER_COMMAND_ACTIONS = {
|
|
|
159
167
|
tab_open: true,
|
|
160
168
|
tab_close: true,
|
|
161
169
|
tab_list: true,
|
|
170
|
+
tab_group: true,
|
|
162
171
|
page_click: true,
|
|
163
172
|
page_drag: true,
|
|
164
173
|
page_type: true,
|
|
@@ -197,6 +206,7 @@ export const EXTENSION_BROWSER_ACTIONS = {
|
|
|
197
206
|
tab_open: true,
|
|
198
207
|
tab_close: true,
|
|
199
208
|
tab_list: true,
|
|
209
|
+
tab_group: true,
|
|
200
210
|
page_click: true,
|
|
201
211
|
page_drag: true,
|
|
202
212
|
page_type: true,
|
package/dist/index.d.ts
CHANGED
|
@@ -11,14 +11,14 @@ export { APP_PROFILE_NAMES, BROWSER_DEVICE_PRESET_NAMES, BROWSER_ACTIONS, BROWSE
|
|
|
11
11
|
export type { ActionStep, AppProfileName, BrowserAction, BrowserActionMap, BrowserActionRequest, BrowserActionResponse, BrowserCapabilities, BrowserCapabilityAction, BrowserCloseParams, BrowserCommandAction, BrowserInfo, BrowserInfoBase, BrowserJsonValue, BrowserLaunchParams, BrowserProviderOperation, BrowserListResult, BrowserPairingInfo, BrowserReleaseFailure, BrowserReleaseResult, BrowserProviderDefinition, BrowserProviderIdentity, BrowserProviderInputSchema, BrowserProviderListResult, BrowserReference, BrowserDetails, BrowserSource, BrowserStatus, BrowserScreenshotKind, BrowserTransport, CaptureCheckpointParams, CaptureCheckpointResult, BrowserDevicePresetName, BrowserEmulationOptions, ExtensionBrowserAction, GetCookieParams, GetCookieResult, GetEventsParams, GetLogsParams, GetMocksParams, GetRequestsParams, ManagedBrowserInfo, PageClickParams, PageDragEndpoint, PageDragParams, PageDragPoint, PageActAction, PageDiagnosticsOptions, PageDiagnosticsSetting, PageEvalParams, PageFramesParams, PageHoverParams, PageInspectFilter, PageInspectParams, PageNavigateParams, PageObservationWaitOptions, PagePressParams, PageScreenshotParams, PageScrollParams, PageSnapshotParams, PageSnapshotQuery, PageTypeParams, PageUploadParams, PageWaitParams, RegularBrowserInfo, RequestDomainPermissionParams, RulesResult, RunActionName, RunActionsParams, SelectBrowserParams, SelectBrowserResult, SendRequestFile, SendRequestFormValue, SendMtopRequestParams, SendRequestParams, SetAppProfileParams, SetCookieParams, SetCookieResult, SetDeviceEmulationParams, SetMockParams, SetRuleParams, SetTimezoneParams, SetTimezoneResult, TabCloseParams, TabOpenParams, } from './generated-browser-action-protocol.js';
|
|
12
12
|
import { type UnifiedInvokeOptions } from './unified.js';
|
|
13
13
|
import type * as Protocol from './generated-browser-action-protocol.js';
|
|
14
|
-
export declare function tabCheckpoint(params
|
|
14
|
+
export declare function tabCheckpoint(params: Protocol.CaptureCheckpointParams, options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'tab_checkpoint'>>;
|
|
15
15
|
/** Compatibility wrapper for tabCheckpoint. */
|
|
16
|
-
export declare function captureCheckpoint(params
|
|
17
|
-
export declare function getRequests(params
|
|
18
|
-
export declare function getLogs(params
|
|
19
|
-
export declare function getEvents(params
|
|
16
|
+
export declare function captureCheckpoint(params: Protocol.CaptureCheckpointParams, options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'tab_checkpoint'>>;
|
|
17
|
+
export declare function getRequests(params: Protocol.GetRequestsParams, options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'get_requests'>>;
|
|
18
|
+
export declare function getLogs(params: Protocol.GetLogsParams, options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'get_logs'>>;
|
|
19
|
+
export declare function getEvents(params: Protocol.GetEventsParams, options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'get_events'>>;
|
|
20
20
|
export declare function setMock(params: Protocol.SetMockParams, options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'set_mock'>>;
|
|
21
|
-
export declare function getMocks(params
|
|
21
|
+
export declare function getMocks(params: Protocol.GetMocksParams, options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'get_mocks'>>;
|
|
22
22
|
export declare function sendRequest(params: Protocol.SendRequestParams, options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'send_request'>>;
|
|
23
23
|
export declare function sendMtopRequest(params: Protocol.SendMtopRequestParams, options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'send_mtop_request'>>;
|
|
24
24
|
export declare function browserList(options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'browser_list'>>;
|
|
@@ -32,6 +32,7 @@ export declare function pageScreenshot(params: Protocol.PageScreenshotParams, op
|
|
|
32
32
|
export declare function tabOpen(params: Protocol.TabOpenParams, options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'tab_open'>>;
|
|
33
33
|
export declare function tabClose(params: Protocol.TabCloseParams, options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'tab_close'>>;
|
|
34
34
|
export declare function tabList(options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'tab_list'>>;
|
|
35
|
+
export declare function tabGroup(params: Protocol.TabGroupParams, options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'tab_group'>>;
|
|
35
36
|
export declare function pageClick(params: Protocol.PageClickParams, options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'page_click'>>;
|
|
36
37
|
export declare function pageDrag(params: Protocol.PageDragParams, options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'page_drag'>>;
|
|
37
38
|
export declare function pageType(params: Protocol.PageTypeParams, options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'page_type'>>;
|
package/dist/index.js
CHANGED
|
@@ -7,26 +7,26 @@
|
|
|
7
7
|
export { UnifiedClient, UnifiedClient as MearlClient, decodeBrowserTarget, invoke, invokePlugin, listCloudConnectors, } from './unified.js';
|
|
8
8
|
export { APP_PROFILE_NAMES, BROWSER_DEVICE_PRESET_NAMES, BROWSER_ACTIONS, BROWSER_COMMAND_ACTIONS, EXTENSION_BROWSER_ACTIONS, PAGE_ACT_ACTIONS, SEND_REQUEST_MAX_FILES, SEND_REQUEST_MAX_TOTAL_BASE64_FILE_BYTES, SEND_REQUEST_MAX_TOTAL_FILE_BYTES, isBrowserAction, isBrowserCapabilityAction, isBrowserCommandAction, isExtensionBrowserAction, } from './generated-browser-action-protocol.js';
|
|
9
9
|
import { invoke } from './unified.js';
|
|
10
|
-
export function tabCheckpoint(params
|
|
10
|
+
export function tabCheckpoint(params, options) {
|
|
11
11
|
return invoke('tab_checkpoint', params, options);
|
|
12
12
|
}
|
|
13
13
|
/** Compatibility wrapper for tabCheckpoint. */
|
|
14
|
-
export function captureCheckpoint(params
|
|
14
|
+
export function captureCheckpoint(params, options) {
|
|
15
15
|
return tabCheckpoint(params, options);
|
|
16
16
|
}
|
|
17
|
-
export function getRequests(params
|
|
17
|
+
export function getRequests(params, options) {
|
|
18
18
|
return invoke('get_requests', params, options);
|
|
19
19
|
}
|
|
20
|
-
export function getLogs(params
|
|
20
|
+
export function getLogs(params, options) {
|
|
21
21
|
return invoke('get_logs', params, options);
|
|
22
22
|
}
|
|
23
|
-
export function getEvents(params
|
|
23
|
+
export function getEvents(params, options) {
|
|
24
24
|
return invoke('get_events', params, options);
|
|
25
25
|
}
|
|
26
26
|
export function setMock(params, options) {
|
|
27
27
|
return invoke('set_mock', params, options);
|
|
28
28
|
}
|
|
29
|
-
export function getMocks(params
|
|
29
|
+
export function getMocks(params, options) {
|
|
30
30
|
return invoke('get_mocks', params, options);
|
|
31
31
|
}
|
|
32
32
|
export function sendRequest(params, options) {
|
|
@@ -68,6 +68,9 @@ export function tabClose(params, options) {
|
|
|
68
68
|
export function tabList(options) {
|
|
69
69
|
return invoke('tab_list', {}, options);
|
|
70
70
|
}
|
|
71
|
+
export function tabGroup(params, options) {
|
|
72
|
+
return invoke('tab_group', params, options);
|
|
73
|
+
}
|
|
71
74
|
export function pageClick(params, options) {
|
|
72
75
|
return invoke('page_click', params, options);
|
|
73
76
|
}
|
|
@@ -9,9 +9,13 @@ export declare const OFFICIAL_PLUGINS: {
|
|
|
9
9
|
readonly buc: {
|
|
10
10
|
readonly description: "使用 BUC 身份请求内部服务";
|
|
11
11
|
readonly installArgs: readonly ["trip/mearl", "--skill", "buc-request", "--yes"];
|
|
12
|
-
readonly setup: "alibaba";
|
|
13
12
|
readonly skill: "buc-request";
|
|
14
13
|
};
|
|
14
|
+
readonly authx: {
|
|
15
|
+
readonly description: "使用 AuthX 身份请求内部服务";
|
|
16
|
+
readonly installArgs: readonly ["trip/mearl", "--skill", "authx-request", "--yes"];
|
|
17
|
+
readonly skill: "authx-request";
|
|
18
|
+
};
|
|
15
19
|
readonly tdbank: {
|
|
16
20
|
readonly description: "查询、借用和切换 TDBank 测试账号";
|
|
17
21
|
readonly installArgs: readonly ["trip/mearl", "--skill", "tdbank-account", "--yes"];
|
|
@@ -3,9 +3,13 @@ export const OFFICIAL_PLUGINS = {
|
|
|
3
3
|
buc: {
|
|
4
4
|
description: '使用 BUC 身份请求内部服务',
|
|
5
5
|
installArgs: ['trip/mearl', '--skill', 'buc-request', '--yes'],
|
|
6
|
-
setup: 'alibaba',
|
|
7
6
|
skill: 'buc-request',
|
|
8
7
|
},
|
|
8
|
+
authx: {
|
|
9
|
+
description: '使用 AuthX 身份请求内部服务',
|
|
10
|
+
installArgs: ['trip/mearl', '--skill', 'authx-request', '--yes'],
|
|
11
|
+
skill: 'authx-request',
|
|
12
|
+
},
|
|
9
13
|
tdbank: {
|
|
10
14
|
description: '查询、借用和切换 TDBank 测试账号',
|
|
11
15
|
installArgs: ['trip/mearl', '--skill', 'tdbank-account', '--yes'],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mearl/client",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.1",
|
|
4
4
|
"description": "Unified Mearl SDK & CLI for local and remote browsers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"commander": "^15.0.0",
|
|
60
60
|
"fastest-levenshtein": "^1.0.16",
|
|
61
61
|
"ws": "^8.18.0",
|
|
62
|
-
"@mearl/
|
|
63
|
-
"@mearl/
|
|
62
|
+
"@mearl/cloud-types": "2.19.1",
|
|
63
|
+
"@mearl/provider": "2.19.1"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/node": "^24.9.1",
|