@mearl/client 2.22.5 → 2.23.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 CHANGED
@@ -58,7 +58,7 @@ mearl check
58
58
  mearl check --local --json
59
59
 
60
60
  # 更新本地环境
61
- npx @mearl/setup update --local
61
+ npx @mearl/setup@2 update --local --skip-skill
62
62
 
63
63
  # 查看某个 action 的帮助
64
64
  mearl <action> --help
@@ -176,8 +176,8 @@ Provider 浏览器与扩展、CDP 浏览器一起出现在 `browser_list` 中,
176
176
  全局 `browserId` 参与路由。Provider 的安装、更新和卸载由 `@mearl/setup` 管理:
177
177
 
178
178
  ```bash
179
- npx @mearl/setup provider install @ali/mearl-provider-brow
180
- npx @mearl/setup provider install @ali/mearl-provider-agentbay
179
+ npx @mearl/setup@2 provider install @ali/mearl-provider-brow
180
+ npx @mearl/setup@2 provider install @ali/mearl-provider-agentbay
181
181
 
182
182
  # 查看 Provider 当前版本的能力、参数与使用流程
183
183
  mearl brow
@@ -191,8 +191,8 @@ mearl browser_list
191
191
  mearl tab_list --browser '<browserId>'
192
192
  mearl page_snapshot --payload '{"tabId":12345}' --browser '<browserId>'
193
193
 
194
- npx @mearl/setup provider update brow
195
- npx @mearl/setup provider uninstall brow
194
+ npx @mearl/setup@2 provider update brow
195
+ npx @mearl/setup@2 provider uninstall brow
196
196
  ```
197
197
 
198
198
  `browser_launch` 创建 `pairing` 实例时会直接返回 `pairing.url` 和可选的配对码;Agent 应把 URL 直接渲染为
@@ -241,8 +241,7 @@ Mearl 默认聚合当前机器和已配置 cloud-server 下的浏览器,并通
241
241
  `mearl check --help`。`mearl check` 检查连接与浏览器状态;`mearl check --updates` 还会并发查询
242
242
  client、native-host、cloud-connector 和扩展的最新发布版本。发布版本查询最长等待约 1.5 秒,
243
243
  无法访问发布源时会提示无法确认更新,不影响浏览器可用性检查。`--json` 输出机器可读的检查结果,
244
- 与 `--updates` 同用时包含更新状态。发现更新时会提示适用的命令:client/native-host 使用
245
- `npx @mearl/setup update`,setup 管理的扩展使用 `npx @mearl/setup extension`。
244
+ 与 `--updates` 同用时包含更新状态。发现更新时,client/native-host 会显示 `npx @mearl/setup@2 update --skip-skill`,扩展会显示对应版本的 ZIP 下载链接。
246
245
 
247
246
  全局安装的 `mearl` CLI 默认在每天首次使用后启动独立后台进程,查询最新发布版本,并比较
248
247
  client、native-host、cloud-server 和 MCP server 的已安装版本。发现更新时调用
@@ -267,11 +266,11 @@ client、native-host、cloud-server 和 MCP server 的已安装版本。发现
267
266
  安装 skill 并自动注册命令,或直接注册已有入口:
268
267
 
269
268
  ```bash
270
- npx @mearl/setup plugin install trip/mearl --skill yuque-doc-fetch --yes
271
- npx @mearl/setup plugin install trip/mearl --skill buc-request --yes
272
- npx @mearl/setup plugin install trip/mearl --skill authx-request --yes
273
- npx @mearl/setup plugin /absolute/path/to/yuque-doc-fetch
274
- npx @mearl/setup plugin uninstall yuque
269
+ npx @mearl/setup@2 plugin install trip/mearl --branch 2.x --skill yuque-doc-fetch --yes
270
+ npx @mearl/setup@2 plugin install trip/mearl --branch 2.x --skill buc-request --yes
271
+ npx @mearl/setup@2 plugin install trip/mearl --branch 2.x --skill authx-request --yes
272
+ npx @mearl/setup@2 plugin /absolute/path/to/yuque-doc-fetch
273
+ npx @mearl/setup@2 plugin uninstall yuque
275
274
  mearl yuque read "https://aliyuque.antfin.com/group/book/doc"
276
275
  mearl yuque --payload '{"command":"read","input":{"url":"https://aliyuque.antfin.com/group/book/doc"}}'
277
276
  mearl yuque --help
@@ -291,7 +290,7 @@ setup 会补齐缺失或低于自身版本的 client、native-host;安装参
291
290
  `mearl-bbrowser` Skill 提供 `bbrowser` 插件,可直接加载 bb-browser 格式的社区及私有站点适配器,无需安装 bb-browser:
292
291
 
293
292
  ```bash
294
- npx @mearl/setup plugin install trip/mearl --skill mearl-bbrowser --yes
293
+ npx @mearl/setup@2 plugin install trip/mearl --branch 2.x --skill mearl-bbrowser --yes
295
294
  mearl bbrowser site list
296
295
  mearl bbrowser site fliggy-ebooking/whoami
297
296
  mearl bbrowser site ./fliggy-ebooking/ai-agent.js
@@ -5,14 +5,13 @@ import { homedir } from 'node:os';
5
5
  import { delimiter, dirname, join, resolve, win32 } from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { npmExecEnvironment } from '@mearl/daemon-core';
8
- import { isNewerRelease, parseReleaseVersion } from './check.js';
8
+ import { fetchLatestStablePackageVersion, isNewerRelease, parseReleaseVersion } from './check.js';
9
9
  import { loadCliAutoUpdateIntervalDays } from './unifiedConfig.js';
10
10
  const CONFIG_DIR = join(homedir(), '.mearl');
11
11
  const STATE_PATH = join(CONFIG_DIR, 'cli-auto-update-state.json');
12
12
  const LOCK_PATH = join(CONFIG_DIR, 'cli-auto-update.lock');
13
13
  const LOCK_STALE_MS = 10 * 60_000;
14
14
  const UPDATE_TIMEOUT_MS = 5 * 60_000;
15
- const VERSION_URL = 'https://registry.npmjs.org/@mearl%2Fclient/latest';
16
15
  function localDate(date) {
17
16
  return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
18
17
  }
@@ -286,17 +285,6 @@ function installedEnvironments() {
286
285
  }
287
286
  return versions;
288
287
  }
289
- async function fetchLatestClientVersion() {
290
- const response = await fetch(VERSION_URL, { signal: AbortSignal.timeout(2_000) });
291
- if (!response.ok)
292
- throw new Error(`Registry returned HTTP ${response.status}`);
293
- const payload = (await response.json());
294
- const version = payload.version;
295
- if (typeof version !== 'string') {
296
- throw new Error('Registry returned an invalid release version');
297
- }
298
- return version;
299
- }
300
288
  /** Runs only in the detached worker process. */
301
289
  export async function runCliAutoUpdate(installedVersion, packageRoot, token, options = {}) {
302
290
  const statePath = options.statePath ?? STATE_PATH;
@@ -313,7 +301,8 @@ export async function runCliAutoUpdate(installedVersion, packageRoot, token, opt
313
301
  }
314
302
  let result;
315
303
  try {
316
- const version = await (options.fetchLatestVersion ?? fetchLatestClientVersion)();
304
+ const version = await (options.fetchLatestVersion?.() ??
305
+ fetchLatestStablePackageVersion('client', installedVersion));
317
306
  if (!parseReleaseVersion(version))
318
307
  throw new Error('Registry returned an invalid release version');
319
308
  const environments = (options.getInstalledEnvironments ?? installedEnvironments)();
package/dist/check.d.ts CHANGED
@@ -99,8 +99,16 @@ export interface UnifiedCheckDependencies {
99
99
  fetchLatestVersion?: (component: string) => Promise<string>;
100
100
  inspectNativeHostInstallation?: () => NativeHostDiagnostic[];
101
101
  }
102
+ declare const UPDATE_SOURCES: {
103
+ readonly client: "https://registry.npmjs.org/@mearl%2Fclient";
104
+ readonly 'native-host': "https://registry.npmjs.org/@mearl%2Fnative-host";
105
+ readonly 'cloud-connector': "https://registry.npmjs.org/@mearl%2Fcloud-connector";
106
+ readonly extension: "https://mearl.alibaba-inc.com/config.json";
107
+ };
108
+ type UpdateComponent = keyof typeof UPDATE_SOURCES;
102
109
  export declare function parseReleaseVersion(value: unknown): number[] | null;
103
110
  export declare function isNewerRelease(latest: string, installed: string): boolean;
111
+ export declare function fetchLatestStablePackageVersion(component: Exclude<UpdateComponent, 'extension'>, installedVersion: string): Promise<string>;
104
112
  export declare function parseCheckTimeout(value: string | undefined): number | null;
105
113
  export declare function runUnifiedCheck(options: UnifiedCheckOptions & {
106
114
  json: true;
package/dist/check.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { inspectNativeHostInstallation } from './nativeHost.js';
2
2
  import { UnifiedClient, normalizeBrowserSelector, } from './unified.js';
3
3
  const UPDATE_SOURCES = {
4
- client: 'https://registry.npmjs.org/@mearl%2Fclient/latest',
5
- 'native-host': 'https://registry.npmjs.org/@mearl%2Fnative-host/latest',
6
- 'cloud-connector': 'https://registry.npmjs.org/@mearl%2Fcloud-connector/latest',
4
+ client: 'https://registry.npmjs.org/@mearl%2Fclient',
5
+ 'native-host': 'https://registry.npmjs.org/@mearl%2Fnative-host',
6
+ 'cloud-connector': 'https://registry.npmjs.org/@mearl%2Fcloud-connector',
7
7
  extension: 'https://mearl.alibaba-inc.com/config.json',
8
8
  };
9
9
  export function parseReleaseVersion(value) {
@@ -29,14 +29,42 @@ export function isNewerRelease(latest, installed) {
29
29
  }
30
30
  return false;
31
31
  }
32
- async function fetchLatestVersion(component) {
32
+ export async function fetchLatestStablePackageVersion(component, installedVersion) {
33
+ const major = parseReleaseVersion(installedVersion)?.[0];
33
34
  const response = await fetch(UPDATE_SOURCES[component], {
35
+ headers: { Accept: 'application/vnd.npm.install-v1+json' },
36
+ signal: AbortSignal.timeout(2_000),
37
+ });
38
+ if (!response.ok)
39
+ throw new Error(`Registry returned HTTP ${response.status}`);
40
+ const payload = (await response.json());
41
+ const tagged = payload['dist-tags']?.latest;
42
+ const taggedParts = parseReleaseVersion(tagged);
43
+ if (tagged && taggedParts && taggedParts[0] === major && taggedParts[3] === 1)
44
+ return tagged;
45
+ let latest;
46
+ for (const version of Object.keys(payload.versions ?? {})) {
47
+ const parts = parseReleaseVersion(version);
48
+ if (parts &&
49
+ parts[0] === major &&
50
+ parts[3] === 1 &&
51
+ (!latest || isNewerRelease(version, latest))) {
52
+ latest = version;
53
+ }
54
+ }
55
+ if (!latest)
56
+ throw new Error('Registry returned no stable release for the installed major version');
57
+ return latest;
58
+ }
59
+ async function fetchLatestVersion(component, clientVersion) {
60
+ if (component !== 'extension')
61
+ return fetchLatestStablePackageVersion(component, clientVersion);
62
+ const response = await fetch(UPDATE_SOURCES.extension, {
34
63
  signal: AbortSignal.timeout(1500),
35
64
  });
36
65
  if (!response.ok)
37
66
  throw new Error(`HTTP ${response.status}`);
38
- const payload = (await response.json());
39
- const version = component === 'extension' ? payload.latestVersion : payload.version;
67
+ const { latestVersion: version } = (await response.json());
40
68
  if (!parseReleaseVersion(version))
41
69
  throw new Error('Invalid release version');
42
70
  return version;
@@ -141,7 +169,8 @@ export async function runUnifiedCheck(options, dependencies = {}) {
141
169
  requestTimeoutSec: timeoutSec,
142
170
  });
143
171
  const latestVersions = options.checkUpdates
144
- ? Promise.allSettled(Object.keys(UPDATE_SOURCES).map(component => (dependencies.fetchLatestVersion ?? fetchLatestVersion)(component)))
172
+ ? Promise.allSettled(Object.keys(UPDATE_SOURCES).map(component => dependencies.fetchLatestVersion?.(component) ??
173
+ fetchLatestVersion(component, options.clientVersion)))
145
174
  : null;
146
175
  const environment = [
147
176
  { status: 'ok', label: `Unified client v${options.clientVersion}` },
@@ -401,7 +430,7 @@ export async function runUnifiedCheck(options, dependencies = {}) {
401
430
  const available = updates.filter(update => update.status === 'available');
402
431
  const unavailable = updates.filter(update => update.status === 'unavailable');
403
432
  const packageUpdateAvailable = available.some(update => update.component === 'client' || update.component === 'native-host');
404
- const extensionUpdateAvailable = available.some(update => update.component === 'extension');
433
+ const extensionUpdate = available.find(update => update.component === 'extension');
405
434
  const connectorUpdateAvailable = available.some(update => update.component === 'cloud-connector');
406
435
  environment.push({
407
436
  status: available.length || unavailable.length ? 'warning' : 'ok',
@@ -413,10 +442,12 @@ export async function runUnifiedCheck(options, dependencies = {}) {
413
442
  details: [
414
443
  ...available.map(update => `${update.component}: ${update.installed} → ${update.latest}`),
415
444
  ...(packageUpdateAvailable
416
- ? ['Update on the affected machine: npx @mearl/setup update']
445
+ ? ['Update Mearl 2.x on the affected machine: npx @mearl/setup@2 update --skip-skill']
417
446
  : []),
418
- ...(extensionUpdateAvailable
419
- ? ['Update a setup-managed extension: npx @mearl/setup extension']
447
+ ...(extensionUpdate
448
+ ? [
449
+ `Update the Chrome extension from its release ZIP: ${new URL(`mearl-chrome-v${extensionUpdate.latest}.zip`, UPDATE_SOURCES.extension).href}`,
450
+ ]
420
451
  : []),
421
452
  ...(connectorUpdateAvailable
422
453
  ? ['Update cloud-connector with its package manager on the connector machine.']
package/dist/cli.js CHANGED
@@ -237,7 +237,7 @@ function printProviderHelp(commandName, provider, extensionHelp) {
237
237
  lines.push(` ${mode}(必填:${requiredFields})`);
238
238
  });
239
239
  }
240
- lines.push('', '发现与检查:', ` ${commandName} browser_list`, ` ${commandName} check --browser <browserId>`, '', '管理:', ` npx @mearl/setup provider update ${provider.providerId}`, ` npx @mearl/setup provider uninstall ${provider.providerId}`);
240
+ lines.push('', '发现与检查:', ` ${commandName} browser_list`, ` ${commandName} check --browser <browserId>`, '', '管理:', ` npx @mearl/setup@2 provider update ${provider.providerId}`, ` npx @mearl/setup@2 provider uninstall ${provider.providerId}`);
241
241
  if (browserType.configuration) {
242
242
  lines.push('', 'Provider 配置(在 Mearl 浏览器管理器中填写):');
243
243
  const configurationRequired = new Set(browserType.configuration.inputSchema.required ?? []);
@@ -1 +1 @@
1
- export declare const PLUGIN_HOST_BUILD_ID = "025a1d4dd51ebda523c759b5e82c3de635a9016d5680ff189ffc27f60009c405";
1
+ export declare const PLUGIN_HOST_BUILD_ID = "83b778ad78c82ef3cd6d48e2a23b118d36e60b9adceda991f943f9c346dd10fe";
@@ -1,2 +1,2 @@
1
1
  // Generated by scripts/generate-plugin-host-build.mjs.
2
- export const PLUGIN_HOST_BUILD_ID = '025a1d4dd51ebda523c759b5e82c3de635a9016d5680ff189ffc27f60009c405';
2
+ export const PLUGIN_HOST_BUILD_ID = '83b778ad78c82ef3cd6d48e2a23b118d36e60b9adceda991f943f9c346dd10fe';
@@ -98,7 +98,7 @@ export function inspectNativeHostInstallation(options = {}) {
98
98
  details: [
99
99
  ...details,
100
100
  `Registration: ${manifestPath}`,
101
- 'Run `mearl-native-host init` with a working Node.js, then reopen the extension. If the runtime package is missing, run `npx @mearl/setup update --local`.',
101
+ 'Run `mearl-native-host init` with a working Node.js, then reopen the extension. If the runtime package is missing, run `npx @mearl/setup@2 update --local`.',
102
102
  ],
103
103
  });
104
104
  }
@@ -79,7 +79,7 @@ function missingPluginEntryMessage(entry, pluginName) {
79
79
  `插件:${name}`,
80
80
  `入口:${entry}`,
81
81
  '',
82
- `卸载命令:npx @mearl/setup plugin uninstall ${name}`,
82
+ `卸载命令:npx @mearl/setup@2 plugin uninstall ${name}`,
83
83
  ].join('\n');
84
84
  }
85
85
  const registrationRefreshes = new Map();
package/dist/socket.js CHANGED
@@ -676,7 +676,7 @@ function formatConnectError(error, socketPath) {
676
676
  if (error.code === 'ENOENT') {
677
677
  return [
678
678
  `未找到 Socket: ${socketPath}`,
679
- 'native host 自动拉起失败。先运行 mearl check --local;缺少命令时运行 npx @mearl/setup --local --yes。',
679
+ 'native host 自动拉起失败。先运行 mearl check --local;缺少命令时运行 npx @mearl/setup@2 --local --yes。',
680
680
  '自动拉起只使用默认 daemon 参数;自定义 CDP/Profile/浏览器参数需手工启动,参见 mearl-native-host --help。',
681
681
  '',
682
682
  '【方式一:浏览器插件模式】',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mearl/client",
3
- "version": "2.22.5",
3
+ "version": "2.23.0",
4
4
  "description": "Unified Mearl SDK & CLI for local and remote browsers",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -67,10 +67,10 @@
67
67
  "commander": "^14.0.3",
68
68
  "fastest-levenshtein": "^1.0.16",
69
69
  "ws": "^8.18.0",
70
- "@mearl/cloud-types": "2.22.5",
71
- "@mearl/agent-runtime": "2.22.5",
72
- "@mearl/provider": "2.22.5",
73
- "@mearl/daemon-core": "2.22.5"
70
+ "@mearl/daemon-core": "2.23.0",
71
+ "@mearl/cloud-types": "2.23.0",
72
+ "@mearl/agent-runtime": "2.23.0",
73
+ "@mearl/provider": "2.23.0"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@types/node": "^24.9.1",