@mearl/client 2.19.1 → 2.19.2
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/dist/cli.js +8 -3
- package/dist/commands.d.ts +13 -7
- package/dist/commands.js +7 -5
- package/dist/generated-browser-action-protocol.d.ts +7 -1
- package/dist/plugin.js +1 -1
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -70,6 +70,7 @@ const SUGGESTABLE_COMMANDS = [
|
|
|
70
70
|
];
|
|
71
71
|
const ADVANCED_BUILTIN_COMMANDS = new Set(['connector_list']);
|
|
72
72
|
const PLUGIN_HOST_OPTIONS = new Set([
|
|
73
|
+
'--all',
|
|
73
74
|
'--browser',
|
|
74
75
|
'--cdp',
|
|
75
76
|
'--compact',
|
|
@@ -417,6 +418,7 @@ export function parseClientArgs(args, plugin = false) {
|
|
|
417
418
|
if (plugin)
|
|
418
419
|
program
|
|
419
420
|
.argument('[pluginArgs...]')
|
|
421
|
+
.option('--all')
|
|
420
422
|
.option('-h, --help')
|
|
421
423
|
.option('-v, --version')
|
|
422
424
|
.option('--verbose');
|
|
@@ -436,9 +438,12 @@ export function parseClientArgs(args, plugin = false) {
|
|
|
436
438
|
if (plugin && options.payloadFile !== undefined) {
|
|
437
439
|
throw new Error('插件使用 --payload 传入 command 和 input;正文文件可由业务字段引用');
|
|
438
440
|
}
|
|
439
|
-
const pluginInput =
|
|
440
|
-
|
|
441
|
-
|
|
441
|
+
const pluginInput = {
|
|
442
|
+
...Object.fromEntries(pluginInputOptionNames
|
|
443
|
+
.filter(name => Object.hasOwn(options, name))
|
|
444
|
+
.map(name => [name, options[name]])),
|
|
445
|
+
...(plugin && options.all === true ? { all: true } : {}),
|
|
446
|
+
};
|
|
442
447
|
if (plugin && options.payload !== undefined && Object.keys(pluginInput).length > 0) {
|
|
443
448
|
throw new Error('插件业务选项不能与 --payload 同时使用');
|
|
444
449
|
}
|
package/dist/commands.d.ts
CHANGED
|
@@ -197,17 +197,23 @@ export declare const COMMANDS: readonly [{
|
|
|
197
197
|
readonly examples: ["get_mocks --payload '{\"tabId\":12345}'"];
|
|
198
198
|
}, {
|
|
199
199
|
readonly name: "set_rule";
|
|
200
|
-
readonly description: "
|
|
200
|
+
readonly description: "添加浏览器请求规则;enabled=false 且传 ruleId 时彻底删除规则";
|
|
201
201
|
readonly params: [{
|
|
202
|
+
readonly name: "ruleId";
|
|
203
|
+
readonly type: "number";
|
|
204
|
+
readonly description: "删除时必填,从 get_rules 获取";
|
|
205
|
+
}, {
|
|
206
|
+
readonly name: "enabled";
|
|
207
|
+
readonly type: "boolean";
|
|
208
|
+
readonly description: "省略时添加;false 时按 ruleId 删除";
|
|
209
|
+
}, {
|
|
202
210
|
readonly name: "actionType";
|
|
203
211
|
readonly type: "\"redirect\" | \"block\" | \"allow\" | \"upgradeScheme\" | \"modifyHeaders\"";
|
|
204
|
-
readonly
|
|
205
|
-
readonly description: "规则动作";
|
|
212
|
+
readonly description: "添加时必填,规则动作";
|
|
206
213
|
}, {
|
|
207
214
|
readonly name: "filter";
|
|
208
215
|
readonly type: "string";
|
|
209
|
-
readonly
|
|
210
|
-
readonly description: "URL 过滤表达式";
|
|
216
|
+
readonly description: "添加时必填,URL 过滤表达式";
|
|
211
217
|
}, {
|
|
212
218
|
readonly name: "redirectUrl";
|
|
213
219
|
readonly type: "string";
|
|
@@ -237,10 +243,10 @@ export declare const COMMANDS: readonly [{
|
|
|
237
243
|
readonly type: "string";
|
|
238
244
|
readonly description: "规则说明";
|
|
239
245
|
}];
|
|
240
|
-
readonly examples: ["set_rule --payload '{\"actionType\":\"block\",\"filter\":\"^https://example\\\\.com/ads/.*\"}'"];
|
|
246
|
+
readonly examples: ["set_rule --payload '{\"actionType\":\"block\",\"filter\":\"^https://example\\\\.com/ads/.*\"}'", "set_rule --payload '{\"ruleId\":42,\"enabled\":false}'"];
|
|
241
247
|
}, {
|
|
242
248
|
readonly name: "get_rules";
|
|
243
|
-
readonly description: "
|
|
249
|
+
readonly description: "查看当前模式的请求规则;扩展模式包含 Options 面板配置的规则";
|
|
244
250
|
readonly examples: ["get_rules"];
|
|
245
251
|
}, {
|
|
246
252
|
readonly name: "send_request";
|
package/dist/commands.js
CHANGED
|
@@ -170,15 +170,16 @@ export const COMMANDS = [
|
|
|
170
170
|
},
|
|
171
171
|
{
|
|
172
172
|
name: 'set_rule',
|
|
173
|
-
description: '
|
|
173
|
+
description: '添加浏览器请求规则;enabled=false 且传 ruleId 时彻底删除规则',
|
|
174
174
|
params: [
|
|
175
|
+
{ name: 'ruleId', type: 'number', description: '删除时必填,从 get_rules 获取' },
|
|
176
|
+
{ name: 'enabled', type: 'boolean', description: '省略时添加;false 时按 ruleId 删除' },
|
|
175
177
|
{
|
|
176
178
|
name: 'actionType',
|
|
177
179
|
type: '"redirect" | "block" | "allow" | "upgradeScheme" | "modifyHeaders"',
|
|
178
|
-
|
|
179
|
-
description: '规则动作',
|
|
180
|
+
description: '添加时必填,规则动作',
|
|
180
181
|
},
|
|
181
|
-
{ name: 'filter', type: 'string',
|
|
182
|
+
{ name: 'filter', type: 'string', description: '添加时必填,URL 过滤表达式' },
|
|
182
183
|
{ name: 'redirectUrl', type: 'string', description: 'redirect 动作的目标 URL' },
|
|
183
184
|
{
|
|
184
185
|
name: 'requestHeaders',
|
|
@@ -197,11 +198,12 @@ export const COMMANDS = [
|
|
|
197
198
|
],
|
|
198
199
|
examples: [
|
|
199
200
|
`set_rule --payload '{"actionType":"block","filter":"^https://example\\\\.com/ads/.*"}'`,
|
|
201
|
+
`set_rule --payload '{"ruleId":42,"enabled":false}'`,
|
|
200
202
|
],
|
|
201
203
|
},
|
|
202
204
|
{
|
|
203
205
|
name: 'get_rules',
|
|
204
|
-
description: '
|
|
206
|
+
description: '查看当前模式的请求规则;扩展模式包含 Options 面板配置的规则',
|
|
205
207
|
examples: ['get_rules'],
|
|
206
208
|
},
|
|
207
209
|
// ── 网络代理 ──────────────────────────────────────────────────────────────
|
|
@@ -319,7 +319,8 @@ export interface BrowserAccessResult {
|
|
|
319
319
|
sensitive: true;
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
|
-
export interface
|
|
322
|
+
export interface AddRuleParams {
|
|
323
|
+
enabled?: true;
|
|
323
324
|
actionType: 'redirect' | 'block' | 'allow' | 'upgradeScheme' | 'modifyHeaders';
|
|
324
325
|
filter: string;
|
|
325
326
|
redirectUrl?: string;
|
|
@@ -338,6 +339,11 @@ export interface SetRuleParams {
|
|
|
338
339
|
priority?: number;
|
|
339
340
|
description?: string;
|
|
340
341
|
}
|
|
342
|
+
export interface DeleteRuleParams {
|
|
343
|
+
enabled: false;
|
|
344
|
+
ruleId: number;
|
|
345
|
+
}
|
|
346
|
+
export type SetRuleParams = AddRuleParams | DeleteRuleParams;
|
|
341
347
|
export interface RulesResult {
|
|
342
348
|
enabled: boolean;
|
|
343
349
|
rules: Array<Record<string, unknown>>;
|
package/dist/plugin.js
CHANGED
|
@@ -187,7 +187,7 @@ export async function loadPlugin(entry, context, pluginName) {
|
|
|
187
187
|
'',
|
|
188
188
|
'常用选项: --browser --timeout --compact --output',
|
|
189
189
|
'连接或传输排障运行 mearl check --help。',
|
|
190
|
-
'插件选项: --name=value 传入字符串业务字段;--verbose; -h, --help; -v, --version',
|
|
190
|
+
'插件选项: --name=value 传入字符串业务字段;--all 传入 all=true;--verbose; -h, --help; -v, --version',
|
|
191
191
|
'同名宿主选项及非字符串字段使用 --payload;业务字段与校验规则见对应 skill。',
|
|
192
192
|
].join('\n');
|
|
193
193
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mearl/client",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.2",
|
|
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/cloud-types": "2.19.
|
|
63
|
-
"@mearl/provider": "2.19.
|
|
62
|
+
"@mearl/cloud-types": "2.19.2",
|
|
63
|
+
"@mearl/provider": "2.19.2"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/node": "^24.9.1",
|