@mearl/client 2.5.0 → 2.5.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
CHANGED
|
@@ -62,7 +62,7 @@ mearl <action> --help
|
|
|
62
62
|
mearl browser_launch --payload '{"name":"account-a","accountId":12345}'
|
|
63
63
|
mearl browser_launch --payload '{"name":"account-b","query":"test_account"}'
|
|
64
64
|
mearl browser_launch --payload '{"name":"cookie-copy","copyCookieDomains":["example.com"]}'
|
|
65
|
-
mearl browser_launch --payload '{"name":"cloud-login","provider":"agentbay","userAgentMode":"desktop","copyCookieDomains":["example.com"],"url":"https://example.com/account"}'
|
|
65
|
+
mearl browser_launch --payload '{"name":"cloud-login","provider":"agentbay","persistent":true,"userAgentMode":"desktop","copyCookieDomains":["example.com"],"url":"https://example.com/account"}'
|
|
66
66
|
mearl browser_launch --payload '{"name":"figma","userAgentMode":"desktop","copyCookieDomains":["figma.com"]}'
|
|
67
67
|
mearl browser_list
|
|
68
68
|
mearl browser_release
|
|
@@ -105,7 +105,7 @@ mearl browser_release
|
|
|
105
105
|
|
|
106
106
|
`browser_release` 仅在用户明确要求结束调试、退出接管或清理会话资源时使用,不作为普通任务收尾。它会释放当前目标浏览器的 debugger/CDP 控制和会话级临时状态(包括设备/时区模拟),保留浏览器及全部标签页;后续浏览器操作可自动重新建立控制。
|
|
107
107
|
|
|
108
|
-
托管浏览器使用独立 Profile。控制浏览器需先登录 TDBank;生成的 SSO 地址在本地内部传递,本地实例可以使用 `headless: true`(默认)完成测试账号登录。AgentBay 固定为非 headless,传 `headless: true` 会被拒绝;`imageId` 可指定镜像别名或具体镜像 ID,省略时使用已验证的 Linux Browser Use 内网镜像。`
|
|
108
|
+
托管浏览器使用独立 Profile。控制浏览器需先登录 TDBank;生成的 SSO 地址在本地内部传递,本地实例可以使用 `headless: true`(默认)完成测试账号登录。AgentBay 固定为非 headless,传 `headless: true` 会被拒绝;`imageId` 可指定镜像别名或具体镜像 ID,省略时使用已验证的 Linux Browser Use 内网镜像。`persistent: true` 会让本地实例保留 Profile,让 AgentBay 同名实例绑定稳定的云端 Browser Context;正常关闭时同步 Cookie、LocalStorage、IndexedDB 等状态,下次启动无需再次复制本地登录态。`deleteProfile: true` 会显式删除对应 Profile 或 Context。`copyCookieDomains` 可在首次启动或需要刷新登录态时把控制浏览器指定域的 Cookie 复制到新实例,Cookie 值不会经过 cloud-server,也不会出现在命令结果或日志中;`userAgentMode: "desktop"` 让本地实例使用匹配本机 Chrome 版本的桌面 UA,AgentBay 则复用当前控制浏览器的桌面 UA。`browser_list` 通过 `agentbayImageId`、`agentbayContextId` 和 `agentbayContextName` 返回 AgentBay 实例配置;当服务返回无影浏览器串流入口时,还会通过 `agentbayAccessUrl` 暴露,该地址可能包含临时访问凭据,应按敏感信息处理。完整设计见 [托管浏览器与 TDBank 多账号设计](../../docs/managed-browsers.md)。
|
|
109
109
|
|
|
110
110
|
## 架构
|
|
111
111
|
|
package/dist/actionTimeouts.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { PAGE_ACT_ACTIONS } from './generated-browser-action-protocol.js';
|
|
2
2
|
const SEND_REQUEST_FILE_TRANSFER_TIMEOUT_MS = 120_000;
|
|
3
|
+
// AgentBay context sync can poll for about 12 minutes before session deletion waits up to 5 more.
|
|
4
|
+
const BROWSER_CLOSE_TIMEOUT_SEC = 18 * 60;
|
|
3
5
|
function boundedNumber(value, fallback, minimum, maximum) {
|
|
4
6
|
const numeric = Number(value);
|
|
5
7
|
if (!Number.isFinite(numeric))
|
|
@@ -35,7 +37,9 @@ export function resolveActionTimeoutSec(action, data, fallback = 15) {
|
|
|
35
37
|
return Math.max(fallback, 40);
|
|
36
38
|
if (action === 'browser_launch')
|
|
37
39
|
return Math.max(fallback, 90);
|
|
38
|
-
if (action === 'browser_close'
|
|
40
|
+
if (action === 'browser_close')
|
|
41
|
+
return Math.max(fallback, BROWSER_CLOSE_TIMEOUT_SEC);
|
|
42
|
+
if (action === 'tdbank_account')
|
|
39
43
|
return Math.max(fallback, 20);
|
|
40
44
|
if (action === 'run_actions') {
|
|
41
45
|
const actions = Array.isArray(data.actions) ? data.actions : [{}];
|
package/dist/commands.d.ts
CHANGED
|
@@ -294,7 +294,7 @@ export declare const COMMANDS: readonly [{
|
|
|
294
294
|
readonly examples: ["tdbank_account --payload '{\"operation\":\"current\"}'", "tdbank_account --payload '{\"operation\":\"list\",\"refresh\":true}'", "tdbank_account --payload '{\"operation\":\"switch\",\"accountId\":12345}'", "tdbank_account --payload '{\"operation\":\"borrow\",\"query\":\"test_account\"}'"];
|
|
295
295
|
}, {
|
|
296
296
|
readonly name: "browser_list";
|
|
297
|
-
readonly description: "列出所有浏览器及其连接状态、类型和托管实例信息;AgentBay
|
|
297
|
+
readonly description: "列出所有浏览器及其连接状态、类型和托管实例信息;AgentBay 可包含镜像、持久化 Context 和串流地址";
|
|
298
298
|
readonly examples: ["browser_list"];
|
|
299
299
|
}, {
|
|
300
300
|
readonly name: "browser_release";
|
|
@@ -327,7 +327,7 @@ export declare const COMMANDS: readonly [{
|
|
|
327
327
|
}, {
|
|
328
328
|
readonly name: "persistent";
|
|
329
329
|
readonly type: "boolean";
|
|
330
|
-
readonly description: "
|
|
330
|
+
readonly description: "关闭后是否保留浏览器状态,默认 false;本地保留 Profile,AgentBay 同名实例复用云端 Context";
|
|
331
331
|
}, {
|
|
332
332
|
readonly name: "url";
|
|
333
333
|
readonly type: "string";
|
|
@@ -361,10 +361,10 @@ export declare const COMMANDS: readonly [{
|
|
|
361
361
|
readonly type: "string[]";
|
|
362
362
|
readonly description: "从控制浏览器复制到本地或 AgentBay 新实例的 Cookie 域名列表,可与本地 TDBank 登录组合";
|
|
363
363
|
}];
|
|
364
|
-
readonly examples: ["browser_launch --payload '{\"name\":\"cloud-a\",\"provider\":\"agentbay\",\"userAgentMode\":\"desktop\",\"url\":\"https://example.com\"}'", "browser_launch --payload '{\"name\":\"cloud-public\",\"provider\":\"agentbay\",\"imageId\":\"browser_latest\",\"url\":\"https://example.com\"}'", "browser_launch --payload '{\"name\":\"cloud-login\",\"provider\":\"agentbay\",\"copyCookieDomains\":[\"example.com\"],\"url\":\"https://example.com/account\"}'", "browser_launch --payload '{\"name\":\"account-a\",\"headless\":true,\"accountId\":12345}'", "browser_launch --payload '{\"name\":\"figma\",\"userAgentMode\":\"desktop\",\"copyCookieDomains\":[\"figma.com\"]}'", "browser_launch --payload '{\"name\":\"account-b\",\"query\":\"test_account\",\"url\":\"https://www.taobao.com\"}'", "browser_launch --payload '{\"name\":\"with-cookies\",\"copyCookieDomains\":[\"example.com\",\"sub.example.org\"]}'"];
|
|
364
|
+
readonly examples: ["browser_launch --payload '{\"name\":\"cloud-a\",\"provider\":\"agentbay\",\"userAgentMode\":\"desktop\",\"url\":\"https://example.com\"}'", "browser_launch --payload '{\"name\":\"cloud-public\",\"provider\":\"agentbay\",\"imageId\":\"browser_latest\",\"url\":\"https://example.com\"}'", "browser_launch --payload '{\"name\":\"cloud-login\",\"provider\":\"agentbay\",\"persistent\":true,\"copyCookieDomains\":[\"example.com\"],\"url\":\"https://example.com/account\"}'", "browser_launch --payload '{\"name\":\"account-a\",\"headless\":true,\"accountId\":12345}'", "browser_launch --payload '{\"name\":\"figma\",\"userAgentMode\":\"desktop\",\"copyCookieDomains\":[\"figma.com\"]}'", "browser_launch --payload '{\"name\":\"account-b\",\"query\":\"test_account\",\"url\":\"https://www.taobao.com\"}'", "browser_launch --payload '{\"name\":\"with-cookies\",\"copyCookieDomains\":[\"example.com\",\"sub.example.org\"]}'"];
|
|
365
365
|
}, {
|
|
366
366
|
readonly name: "browser_close";
|
|
367
|
-
readonly description: "
|
|
367
|
+
readonly description: "关闭指定托管浏览器并按策略保留或清理本地 Profile / AgentBay Context";
|
|
368
368
|
readonly params: [{
|
|
369
369
|
readonly name: "browser";
|
|
370
370
|
readonly type: "string";
|
|
@@ -373,7 +373,7 @@ export declare const COMMANDS: readonly [{
|
|
|
373
373
|
}, {
|
|
374
374
|
readonly name: "deleteProfile";
|
|
375
375
|
readonly type: "boolean";
|
|
376
|
-
readonly description: "
|
|
376
|
+
readonly description: "强制删除持久化本地 Profile 或 AgentBay Context,默认 false";
|
|
377
377
|
}];
|
|
378
378
|
readonly examples: ["browser_close --payload '{\"browser\":\"managed:account-a\"}'", "browser_close --payload '{\"browser\":\"managed:agentbay:cloud-a\"}'", "browser_close --payload '{\"browser\":\"account-b\",\"deleteProfile\":true}'"];
|
|
379
379
|
}, {
|
package/dist/commands.js
CHANGED
|
@@ -210,7 +210,7 @@ export const COMMANDS = [
|
|
|
210
210
|
// ── 浏览器 ────────────────────────────────────────────────────────────────
|
|
211
211
|
{
|
|
212
212
|
name: 'browser_list',
|
|
213
|
-
description: '列出所有浏览器及其连接状态、类型和托管实例信息;AgentBay
|
|
213
|
+
description: '列出所有浏览器及其连接状态、类型和托管实例信息;AgentBay 可包含镜像、持久化 Context 和串流地址',
|
|
214
214
|
examples: ['browser_list'],
|
|
215
215
|
},
|
|
216
216
|
{
|
|
@@ -246,7 +246,7 @@ export const COMMANDS = [
|
|
|
246
246
|
{
|
|
247
247
|
name: 'persistent',
|
|
248
248
|
type: 'boolean',
|
|
249
|
-
description: '
|
|
249
|
+
description: '关闭后是否保留浏览器状态,默认 false;本地保留 Profile,AgentBay 同名实例复用云端 Context',
|
|
250
250
|
},
|
|
251
251
|
{ name: 'url', type: 'string', description: '登录完成后打开的初始页面' },
|
|
252
252
|
{ name: 'executablePath', type: 'string', description: '自定义 Chrome 可执行文件路径' },
|
|
@@ -272,7 +272,7 @@ export const COMMANDS = [
|
|
|
272
272
|
examples: [
|
|
273
273
|
`browser_launch --payload '{"name":"cloud-a","provider":"agentbay","userAgentMode":"desktop","url":"https://example.com"}'`,
|
|
274
274
|
`browser_launch --payload '{"name":"cloud-public","provider":"agentbay","imageId":"browser_latest","url":"https://example.com"}'`,
|
|
275
|
-
`browser_launch --payload '{"name":"cloud-login","provider":"agentbay","copyCookieDomains":["example.com"],"url":"https://example.com/account"}'`,
|
|
275
|
+
`browser_launch --payload '{"name":"cloud-login","provider":"agentbay","persistent":true,"copyCookieDomains":["example.com"],"url":"https://example.com/account"}'`,
|
|
276
276
|
`browser_launch --payload '{"name":"account-a","headless":true,"accountId":12345}'`,
|
|
277
277
|
`browser_launch --payload '{"name":"figma","userAgentMode":"desktop","copyCookieDomains":["figma.com"]}'`,
|
|
278
278
|
`browser_launch --payload '{"name":"account-b","query":"test_account","url":"https://www.taobao.com"}'`,
|
|
@@ -281,7 +281,7 @@ export const COMMANDS = [
|
|
|
281
281
|
},
|
|
282
282
|
{
|
|
283
283
|
name: 'browser_close',
|
|
284
|
-
description: '
|
|
284
|
+
description: '关闭指定托管浏览器并按策略保留或清理本地 Profile / AgentBay Context',
|
|
285
285
|
params: [
|
|
286
286
|
{
|
|
287
287
|
name: 'browser',
|
|
@@ -289,7 +289,11 @@ export const COMMANDS = [
|
|
|
289
289
|
required: true,
|
|
290
290
|
description: '托管浏览器的 browserId 或名称',
|
|
291
291
|
},
|
|
292
|
-
{
|
|
292
|
+
{
|
|
293
|
+
name: 'deleteProfile',
|
|
294
|
+
type: 'boolean',
|
|
295
|
+
description: '强制删除持久化本地 Profile 或 AgentBay Context,默认 false',
|
|
296
|
+
},
|
|
293
297
|
],
|
|
294
298
|
examples: [
|
|
295
299
|
`browser_close --payload '{"browser":"managed:account-a"}'`,
|
|
@@ -144,6 +144,10 @@ export interface ManagedBrowserInfo extends BrowserInfoBase {
|
|
|
144
144
|
agentbaySessionId?: string;
|
|
145
145
|
/** AgentBay image used to create the session. */
|
|
146
146
|
agentbayImageId?: string;
|
|
147
|
+
/** Persistent AgentBay browser context ID when enabled for this instance. */
|
|
148
|
+
agentbayContextId?: string;
|
|
149
|
+
/** Stable AgentBay browser context name derived from the managed browser name. */
|
|
150
|
+
agentbayContextName?: string;
|
|
147
151
|
/** Browser-accessible AgentBay session URL when returned by the provider. */
|
|
148
152
|
agentbayAccessUrl?: string;
|
|
149
153
|
createdAt: string;
|