@mearl/client 3.2.0-beta.0 → 3.2.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/dist/cli.js +12 -3
- package/package.json +6 -6
package/dist/cli.js
CHANGED
|
@@ -2,6 +2,7 @@ import { readHelpCapabilities, formatCapabilityHelp } from './capabilityHelp.js'
|
|
|
2
2
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { resolve } from 'node:path';
|
|
4
4
|
import { Command, CommanderError } from 'commander';
|
|
5
|
+
import { declaresProviderTaskSessions } from '@mearl/browser-core';
|
|
5
6
|
import { listInstalledProviders } from '@mearl/provider/host';
|
|
6
7
|
import { resolveActionTimeoutSec } from './actionTimeouts.js';
|
|
7
8
|
import { runUnifiedCheck, parseCheckTimeout } from './check.js';
|
|
@@ -218,6 +219,7 @@ function providerSchemaLines(name, schema, required, indent = 2) {
|
|
|
218
219
|
}
|
|
219
220
|
function printProviderHelp(commandName, provider, extensionHelp) {
|
|
220
221
|
const browserType = provider.browserType;
|
|
222
|
+
const taskSessions = declaresProviderTaskSessions(browserType.inputSchema);
|
|
221
223
|
const lines = [
|
|
222
224
|
`${provider.providerId} — ${provider.name} v${provider.version}`,
|
|
223
225
|
'',
|
|
@@ -225,9 +227,16 @@ function printProviderHelp(commandName, provider, extensionHelp) {
|
|
|
225
227
|
];
|
|
226
228
|
if (browserType.help?.length)
|
|
227
229
|
lines.push('');
|
|
228
|
-
|
|
230
|
+
if (taskSessions) {
|
|
231
|
+
lines.push('创建任务会话:', ` 从 ${commandName} browser_list 选择此 Provider 的完整 browserId。`, ` ${commandName} session_manage --browser '<browserId>' --payload '{"operation":"new"}'`, ' 有必填任务参数时,在 payload 的 providerOptions 对象中填写。', ` ${commandName} tab_list --session '<返回的 session.sessionId>'`);
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
lines.push('创建:', ` ${commandName} browser_manage --payload '{"operation":"${browserType.openOperation ?? 'launch'}","provider":"${provider.providerId}","providerOptions":{}}'`);
|
|
235
|
+
}
|
|
236
|
+
lines.push('', taskSessions ? '任务参数(providerOptions):' : '启动参数(providerOptions):');
|
|
229
237
|
const required = new Set(browserType.inputSchema.required ?? []);
|
|
230
|
-
const
|
|
238
|
+
const isUserParameter = (name) => !taskSessions || name !== 'taskSession';
|
|
239
|
+
const properties = Object.entries(browserType.inputSchema.properties).filter(([name]) => isUserParameter(name));
|
|
231
240
|
if (properties.length === 0)
|
|
232
241
|
lines.push(' (无)');
|
|
233
242
|
else {
|
|
@@ -239,7 +248,7 @@ function printProviderHelp(commandName, provider, extensionHelp) {
|
|
|
239
248
|
lines.push('', '可选模式:');
|
|
240
249
|
browserType.inputSchema.oneOf.forEach((schema, index) => {
|
|
241
250
|
const mode = schema.title || `模式 ${index + 1}`;
|
|
242
|
-
const requiredFields = schema.required?.
|
|
251
|
+
const requiredFields = schema.required?.filter(isUserParameter).join(', ') || '无必填字段';
|
|
243
252
|
lines.push(` ${mode}(必填:${requiredFields})`);
|
|
244
253
|
});
|
|
245
254
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mearl/client",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "Unified Mearl SDK & CLI for local and remote browsers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
"commander": "^14.0.3",
|
|
70
70
|
"fastest-levenshtein": "^1.0.16",
|
|
71
71
|
"ws": "^8.18.0",
|
|
72
|
-
"@mearl/
|
|
73
|
-
"@mearl/
|
|
74
|
-
"@mearl/provider": "3.2.
|
|
75
|
-
"@mearl/agent-runtime": "3.2.
|
|
76
|
-
"@mearl/browser-core": "3.2.
|
|
72
|
+
"@mearl/cloud-types": "3.2.1",
|
|
73
|
+
"@mearl/daemon-core": "3.2.1",
|
|
74
|
+
"@mearl/provider": "3.2.1",
|
|
75
|
+
"@mearl/agent-runtime": "3.2.1",
|
|
76
|
+
"@mearl/browser-core": "3.2.1"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@types/node": "^24.9.1",
|