@mearl/client
Advanced tools
| import { PAGE_ACT_ACTIONS } from './generated-browser-action-protocol.js'; | ||
| const SEND_REQUEST_FILE_TRANSFER_TIMEOUT_MS = 120_000; | ||
| // AgentBay context sync can poll for about 12 minutes before session deletion waits up to 5 more. | ||
| const BROWSER_CLOSE_TIMEOUT_SEC = 18 * 60; | ||
| function boundedNumber(value, fallback, minimum, maximum) { | ||
@@ -38,3 +40,5 @@ const numeric = Number(value); | ||
| return Math.max(fallback, 90); | ||
| if (action === 'browser_close' || action === 'tdbank_account') | ||
| if (action === 'browser_close') | ||
| return Math.max(fallback, BROWSER_CLOSE_TIMEOUT_SEC); | ||
| if (action === 'tdbank_account') | ||
| return Math.max(fallback, 20); | ||
@@ -41,0 +45,0 @@ if (action === 'run_actions') { |
@@ -297,3 +297,3 @@ import type { BrowserCommandAction } from './generated-browser-action-protocol.js'; | ||
| readonly name: "browser_list"; | ||
| readonly description: "列出所有浏览器及其连接状态、类型和托管实例信息;AgentBay 可包含 agentbayImageId 和 agentbayAccessUrl"; | ||
| readonly description: "列出所有浏览器及其连接状态、类型和托管实例信息;AgentBay 可包含镜像、持久化 Context 和串流地址"; | ||
| readonly examples: ["browser_list"]; | ||
@@ -331,3 +331,3 @@ }, { | ||
| readonly type: "boolean"; | ||
| readonly description: "关闭后是否保留独立 Profile,默认 false"; | ||
| readonly description: "关闭后是否保留浏览器状态,默认 false;本地保留 Profile,AgentBay 同名实例复用云端 Context"; | ||
| }, { | ||
@@ -366,6 +366,6 @@ readonly name: "url"; | ||
| }]; | ||
| 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\"]}'"]; | ||
| 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\"]}'"]; | ||
| }, { | ||
| readonly name: "browser_close"; | ||
| readonly description: "关闭指定托管浏览器并按策略清理独立 Profile"; | ||
| readonly description: "关闭指定托管浏览器并按策略保留或清理本地 Profile / AgentBay Context"; | ||
| readonly params: [{ | ||
@@ -379,3 +379,3 @@ readonly name: "browser"; | ||
| readonly type: "boolean"; | ||
| readonly description: "强制删除持久化 Profile,默认 false"; | ||
| readonly description: "强制删除持久化本地 Profile 或 AgentBay Context,默认 false"; | ||
| }]; | ||
@@ -382,0 +382,0 @@ 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}'"]; |
+9
-5
@@ -213,3 +213,3 @@ const PAGE_DIAGNOSTICS_PARAM = { | ||
| name: 'browser_list', | ||
| description: '列出所有浏览器及其连接状态、类型和托管实例信息;AgentBay 可包含 agentbayImageId 和 agentbayAccessUrl', | ||
| description: '列出所有浏览器及其连接状态、类型和托管实例信息;AgentBay 可包含镜像、持久化 Context 和串流地址', | ||
| examples: ['browser_list'], | ||
@@ -250,3 +250,3 @@ }, | ||
| type: 'boolean', | ||
| description: '关闭后是否保留独立 Profile,默认 false', | ||
| description: '关闭后是否保留浏览器状态,默认 false;本地保留 Profile,AgentBay 同名实例复用云端 Context', | ||
| }, | ||
@@ -277,3 +277,3 @@ { name: 'url', type: 'string', description: '登录完成后打开的初始页面' }, | ||
| `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":"cloud-login","provider":"agentbay","persistent":true,"copyCookieDomains":["example.com"],"url":"https://example.com/account"}'`, | ||
| `browser_launch --payload '{"name":"account-a","headless":true,"accountId":12345}'`, | ||
@@ -287,3 +287,3 @@ `browser_launch --payload '{"name":"figma","userAgentMode":"desktop","copyCookieDomains":["figma.com"]}'`, | ||
| name: 'browser_close', | ||
| description: '关闭指定托管浏览器并按策略清理独立 Profile', | ||
| description: '关闭指定托管浏览器并按策略保留或清理本地 Profile / AgentBay Context', | ||
| params: [ | ||
@@ -296,3 +296,7 @@ { | ||
| }, | ||
| { name: 'deleteProfile', type: 'boolean', description: '强制删除持久化 Profile,默认 false' }, | ||
| { | ||
| name: 'deleteProfile', | ||
| type: 'boolean', | ||
| description: '强制删除持久化本地 Profile 或 AgentBay Context,默认 false', | ||
| }, | ||
| ], | ||
@@ -299,0 +303,0 @@ examples: [ |
@@ -147,2 +147,6 @@ export interface GetRequestsParams { | ||
| agentbayImageId?: string; | ||
| /** Persistent AgentBay browser context ID when enabled for this instance. */ | ||
| agentbayContextId?: string; | ||
| /** Stable AgentBay browser context name derived from the managed browser name. */ | ||
| agentbayContextName?: string; | ||
| /** Browser-accessible AgentBay session URL when returned by the provider. */ | ||
@@ -149,0 +153,0 @@ agentbayAccessUrl?: string; |
+1
-1
| { | ||
| "name": "@mearl/client", | ||
| "version": "2.5.0", | ||
| "version": "2.5.1", | ||
| "description": "Client SDK & CLI for Mearl — communicate with Chrome Extension via Unix Socket", | ||
@@ -5,0 +5,0 @@ "type": "module", |
+2
-2
@@ -65,3 +65,3 @@ # @mearl/client | ||
| mearl browser_launch --payload '{"name":"cookie-copy","copyCookieDomains":["example.com"]}' | ||
| mearl browser_launch --payload '{"name":"cloud-login","provider":"agentbay","userAgentMode":"desktop","copyCookieDomains":["example.com"],"url":"https://example.com/account"}' | ||
| mearl browser_launch --payload '{"name":"cloud-login","provider":"agentbay","persistent":true,"userAgentMode":"desktop","copyCookieDomains":["example.com"],"url":"https://example.com/account"}' | ||
| mearl browser_launch --payload '{"name":"figma","userAgentMode":"desktop","copyCookieDomains":["figma.com"]}' | ||
@@ -109,3 +109,3 @@ mearl browser_list | ||
| 托管浏览器使用独立 Profile。控制浏览器需先登录 TDBank;生成的 SSO 地址在本地内部传递,本地实例可以使用 `headless: true`(默认)完成测试账号登录。AgentBay 固定为非 headless,传 `headless: true` 会被拒绝;`imageId` 可指定镜像别名或具体镜像 ID,省略时使用已验证的 Linux Browser Use 内网镜像。`copyCookieDomains` 可把控制浏览器指定域的 Cookie 复制到本地或 AgentBay 新实例,Cookie 值不会经过 cloud-server,也不会出现在命令结果或日志中;`userAgentMode: "desktop"` 让本地实例使用匹配本机 Chrome 版本的桌面 UA,AgentBay 则复用当前控制浏览器的桌面 UA。`browser_list` 通过 `agentbayImageId` 返回实例的实际镜像;当服务返回无影浏览器串流入口时,还会通过 `agentbayAccessUrl` 暴露,该地址可能包含临时访问凭据,应按敏感信息处理。完整设计见 [托管浏览器与 TDBank 多账号设计](../../docs/managed-browsers.md)。 | ||
| 托管浏览器使用独立 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)。 | ||
@@ -112,0 +112,0 @@ ## 架构 |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
182691
0.66%4067
0.3%