@seekskyworld/open-browser 0.3.0 → 0.3.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/CONTRIBUTING.md +2 -0
- package/Docs/desktop-packages.md +45 -0
- package/Docs//350/267/250/345/271/263/345/217/260/350/257/225/347/224/250/344/270/216/345/217/221/350/241/214.md +1 -1
- package/README.md +8 -6
- package/README.zh-CN.md +2 -0
- package/api-contract.mjs +2 -1
- package/browser-extension/_locales/en/messages.json +8 -0
- package/browser-extension/_locales/zh_CN/messages.json +8 -0
- package/browser-extension/i18n.js +84 -0
- package/browser-extension/manifest.json +5 -4
- package/browser-extension/messages.js +266 -0
- package/browser-extension/newtab.css +4 -0
- package/browser-extension/newtab.html +9 -9
- package/browser-extension/newtab.js +38 -36
- package/browser-extension/page-locale.js +23 -0
- package/browser-extension/phase-labels.js +33 -6
- package/browser-extension/popup.css +2 -2
- package/browser-extension/popup.html +24 -26
- package/browser-extension/popup.js +72 -49
- package/browser-extension/tab-action.js +29 -24
- package/browser-extension/worker.js +29 -5
- package/browser-extension/workspace-title.js +2 -2
- package/build-profile.mjs +10 -2
- package/chromium-host.mjs +22 -11
- package/chromium-shell.mjs +5 -3
- package/cli.mjs +33 -30
- package/control.mjs +9 -8
- package/desktop/Info.plist +3 -1
- package/desktop/Launcher.m +10 -2
- package/desktop/OBControlBar.m +12 -8
- package/desktop/OBLocalization.h +20 -0
- package/desktop/OBPageView.m +2 -1
- package/desktop/WorkspacePanel.m +84 -83
- package/desktop/archive-release.py +5 -1
- package/desktop/build-macos.mjs +11 -5
- package/desktop/build-managed-input.mjs +2 -1
- package/desktop/build-portable.mjs +5 -3
- package/desktop/build-profile.mjs +2 -1
- package/desktop/build.mjs +2 -1
- package/desktop/create-shortcut.ps1 +7 -1
- package/desktop/en.lproj/Localizable.strings +106 -0
- package/desktop/install-menu-entry.mjs +2 -0
- package/desktop/notarize-macos.mjs +21 -24
- package/desktop/package-macos.mjs +4 -3
- package/desktop/sign.mjs +5 -4
- package/desktop/start-profile.mjs +2 -1
- package/desktop/start.mjs +3 -1
- package/desktop/verify-macos-release.mjs +9 -8
- package/desktop/zh-Hans.lproj/Localizable.strings +106 -0
- package/engine-service.mjs +1 -1
- package/hosted/cli.mjs +2 -1
- package/hosted/init.mjs +2 -1
- package/i18n.mjs +41 -0
- package/mcp-http.mjs +3 -2
- package/mcp-server.mjs +4 -3
- package/messages.zh-CN.mjs +175 -0
- package/package.json +4 -1
- package/page-activity.mjs +8 -6
- package/paths.mjs +2 -5
- package/runtime.mjs +4 -3
- package/sdk.mjs +40 -39
- package/service.mjs +2 -1
- package/skills/open-browser/SKILL.md +11 -9
- package/skills/open-browser/SKILL.zh-CN.md +22 -0
- package/skills/open-browser/references/macos.en.md +3 -0
- package/skills/open-browser/references/macos.md +2 -0
- package/skills/open-browser/references/operations.en.md +54 -0
- package/skills/open-browser/references/operations.md +2 -0
- package/skills/open-browser/references/recovery.en.md +36 -0
- package/skills/open-browser/references/recovery.md +2 -0
- package/skills/open-browser/references/windows.en.md +3 -0
- package/skills/open-browser/references/windows.md +2 -0
- package/skills/open-browser/scripts/bootstrap.mjs +6 -4
- package/skills/open-browser/scripts/guide.mjs +7 -4
- package/skills/open-browser/scripts/open-browser +5 -1
- package/studio/demo-site.mjs +5 -4
- package/studio/index.html +37 -33
- package/studio/index.mjs +10 -3
- package/studio/native-demo.mjs +8 -7
- package/studio/studio.css +3 -0
- package/studio/studio.js +98 -68
- package/system-i18n.mjs +19 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// Chinese copy for the CLI, MCP server and desktop packaging tools.
|
|
2
|
+
export default {
|
|
3
|
+
"The extension service worker timed out. Check the extension and try again.": "open-browser 扩展 service worker 响应超时,请检查扩展状态后重试.",
|
|
4
|
+
"The workspace extension is offline. Restart Open Browser or reload the extension.": "open-browser 工作区扩展未运行,请重新启动应用或重新加载扩展.",
|
|
5
|
+
"The workspace extension requested an update.": "工作区扩展已请求更新",
|
|
6
|
+
"Rebuild the Open Browser workspace extension.": "请重新构建 open-browser 工作区扩展。",
|
|
7
|
+
"OPEN_BROWSER_INPUT_GUARD must be off, fallback or native.": "OPEN_BROWSER_INPUT_GUARD 必须是 off、fallback 或 native。",
|
|
8
|
+
"Persistent browsing on macOS requires an Open Browser v2 engine signed with Developer ID. Run npm run build in the project directory and restart.": "macOS 持久浏览需要已用 Developer ID 签名的 open-browser v2 引擎。请在项目目录执行 npm run build,再重新启动。",
|
|
9
|
+
"Invalid Open Browser v2 profile directory.": "无效的 open-browser v2 资料目录。",
|
|
10
|
+
"Could not configure tab groups on the bookmarks bar.": "无法设置书签栏的标签组显示方式。",
|
|
11
|
+
"Standard input exceeds 1 MiB.": "标准输入超过 1 MiB。",
|
|
12
|
+
"Standard input must contain a JSON object.": "标准输入必须是 JSON 对象。",
|
|
13
|
+
"Each line must be a JSON request.": "每行必须是 JSON 请求。",
|
|
14
|
+
"A session request needs an id, a method and a params object.": "session 请求需要 id、method 和对象 params。",
|
|
15
|
+
"--json requires an API method name.": "--json 需要一个 API 方法名。",
|
|
16
|
+
"session takes no additional arguments.": "session 不接受额外参数。",
|
|
17
|
+
"skill takes no additional arguments.": "skill 不接受额外参数。",
|
|
18
|
+
"Provide JSON parameters on standard input.": "请通过标准输入提供 JSON 参数。",
|
|
19
|
+
"Run this command from a local administrator session.": "请从本机管理会话运行。",
|
|
20
|
+
"Provide tokenFile as the path for the new token file.": "需要新令牌文件路径 tokenFile",
|
|
21
|
+
"Could not write the token file. Check and revoke {0} with admin.revokeClient.": "令牌文件写入失败,请用 admin.revokeClient 核对并撤销 {0}。",
|
|
22
|
+
"Unknown method. Use --help to list commands.": "未知的方法,请用 --help 查看命令。",
|
|
23
|
+
"macOS builds require arm64 or x64.": "macOS 构建目标架构必须是 arm64 或 x64。",
|
|
24
|
+
"--arch requires arm64 or x64.": "--arch 需要 arm64 或 x64。",
|
|
25
|
+
"This Node process is {0}. Build {1} on matching macOS hardware, with x64 Node under Rosetta, or on an x64 CI runner.": "当前 Node 是 {0},不能伪造 {1} 架构构建。请在对应架构的 macOS、Rosetta 下的 x64 Node,或 x64 CI runner 上运行。",
|
|
26
|
+
"Invalid previous Chromium path.": "旧版本 Chromium 路径无效。",
|
|
27
|
+
"Usage: node desktop/notarize-macos.mjs [app-path] [--zip zip-path] [--dmg dmg-path]\n\nSubmit the macOS app for notarization, staple its ticket and create the release ZIP and optional DMG. Set OPEN_BROWSER_NOTARY_PROFILE, use an App Store Connect API key, or use an Apple ID and app-specific password. Credentials are read from the environment or local keychain.\n": "用法:node desktop/notarize-macos.mjs [app-path] [--zip zip-path] [--dmg dmg-path]\n\n提交并公证 macOS 应用,固化票据后生成可上传的 GitHub ZIP 和可选 DMG。\n凭据优先使用 OPEN_BROWSER_NOTARY_PROFILE,其次使用 App Store Connect API Key,\n最后使用 Apple ID 加应用专用密码。凭据只从环境变量或本机钥匙串读取。",
|
|
28
|
+
"--zip requires a file path.": "--zip 需要文件路径。",
|
|
29
|
+
"--dmg requires a file path.": "--dmg 需要文件路径。",
|
|
30
|
+
"Unknown argument: ": "未知参数:",
|
|
31
|
+
"Specify a single application path.": "只能指定一个应用路径。",
|
|
32
|
+
"{0} does not exist: {1}": "{0}不存在:{1}",
|
|
33
|
+
"Use OPEN_BROWSER_NOTARY_PROFILE on its own.": "OPEN_BROWSER_NOTARY_PROFILE 不能和其他凭据模式同时设置。",
|
|
34
|
+
"Choose either API key or Apple ID notarization credentials.": "API Key 和 Apple ID 公证凭据不能混用。",
|
|
35
|
+
"API key mode requires OPEN_BROWSER_NOTARY_KEY and OPEN_BROWSER_NOTARY_KEY_ID.": "API Key 模式需要 OPEN_BROWSER_NOTARY_KEY 和 OPEN_BROWSER_NOTARY_KEY_ID。",
|
|
36
|
+
"A team API key requires OPEN_BROWSER_NOTARY_ISSUER.": "团队 API Key 模式需要 OPEN_BROWSER_NOTARY_ISSUER。",
|
|
37
|
+
"Set OPEN_BROWSER_NOTARY_PROFILE, provide an API key, ": "缺少公证凭据。优先设置 OPEN_BROWSER_NOTARY_PROFILE,或提供 API Key,",
|
|
38
|
+
"or set OPEN_BROWSER_NOTARY_APPLE_ID, OPEN_BROWSER_NOTARY_TEAM_ID and an app-specific password.": "或设置 OPEN_BROWSER_NOTARY_APPLE_ID、OPEN_BROWSER_NOTARY_TEAM_ID 和应用专用密码。",
|
|
39
|
+
"Apple ID mode requires OPEN_BROWSER_NOTARY_APPLE_ID and OPEN_BROWSER_NOTARY_TEAM_ID.": "Apple ID 模式需要 OPEN_BROWSER_NOTARY_APPLE_ID 和 OPEN_BROWSER_NOTARY_TEAM_ID。",
|
|
40
|
+
"Store an app-specific password in keychain service {0} or set OPEN_BROWSER_NOTARY_PASSWORD.": "未找到 Apple ID 应用专用密码。请将密码保存到钥匙串服务 {0},或设置 OPEN_BROWSER_NOTARY_PASSWORD。",
|
|
41
|
+
"The app-specific password is empty.": "Apple ID 应用专用密码为空。",
|
|
42
|
+
"Run macOS notarization on a Mac.": "macOS 公证只能在 macOS 构建机执行。",
|
|
43
|
+
"Application": "应用",
|
|
44
|
+
"Select an .app bundle for notarization.": "公证输入必须是 .app 应用包。",
|
|
45
|
+
"Apple notarization submission failed: ": "Apple 公证提交失败:",
|
|
46
|
+
"Apple declined the notarization submission.": "Apple 未接受这次公证提交。",
|
|
47
|
+
"Install a valid Developer ID Application certificate and its private key in the build keychain.": "macOS 构建需要稳定的签名身份。请在构建钥匙串中安装有效的 Developer ID Application 证书及配对私钥。",
|
|
48
|
+
"List identities with security find-identity -v -p codesigning.": "可用 security find-identity -v -p codesigning 查看身份。",
|
|
49
|
+
"If multiple Developer ID Application identities are available, set OPEN_BROWSER_SIGN_IDENTITY to the full certificate name or its 40-character SHA-1.": "有多项 Developer ID Application 身份时,请将 OPEN_BROWSER_SIGN_IDENTITY 设为完整证书名称或其 40 位 SHA-1。",
|
|
50
|
+
"Could not read the previous version's signing requirement.": "无法读取现有版本的签名要求。",
|
|
51
|
+
"Usage: node desktop/verify-macos-release.mjs [app-path] [--zip zip-path] [--dmg dmg-path]": "用法:node desktop/verify-macos-release.mjs [app-path] [--zip zip-path] [--dmg dmg-path]",
|
|
52
|
+
"Run macOS release verification on a Mac.": "macOS 发行验收只能在 macOS 执行。",
|
|
53
|
+
"Select an .app bundle for verification.": "验收输入必须是 .app 应用包。",
|
|
54
|
+
"Could not read the application signature.": "无法读取应用签名详情。",
|
|
55
|
+
"The application requires Hardened Runtime.": "应用没有启用 Hardened Runtime。",
|
|
56
|
+
"{0} SHA-256 mismatch: {1}": "{0} SHA-256 不匹配:{1}",
|
|
57
|
+
"Missing notarized {0} or checksum: {1}": "缺少已公证的 {0} 或校验和:{1}",
|
|
58
|
+
"macOS release verified: {0}": "macOS 发行验收通过:{0}",
|
|
59
|
+
"Set OPEN_BROWSER_HOSTED_DIR and OPEN_BROWSER_HOSTED_TOKEN_FILE, then specify a method.": "请设置 OPEN_BROWSER_HOSTED_DIR 和 OPEN_BROWSER_HOSTED_TOKEN_FILE,然后指定方法。",
|
|
60
|
+
"Choose a shorter hosted data directory for the Unix socket path.": "请选择较短的托管数据目录,以容纳 Unix socket 路径。",
|
|
61
|
+
"The MCP HTTP server must bind to a loopback address.": "MCP HTTP 只允许绑定回环地址。",
|
|
62
|
+
"Invalid OPEN_BROWSER_MCP_HTTP_PORT.": "OPEN_BROWSER_MCP_HTTP_PORT 无效。",
|
|
63
|
+
"Supply a non-empty task name when creating an agent workspace.": "创建 Agent 任务时必须提供非空任务名称 name。",
|
|
64
|
+
"The local service call failed.": "本地服务调用失败。",
|
|
65
|
+
"macOS engine builds require arm64 or x64.": "macOS 引擎目标架构必须是 arm64 或 x64。",
|
|
66
|
+
"This Node process is {0}. Install the {1} engine on matching macOS hardware or with x64 Node under Rosetta.": "当前 Node 是 {0},不能下载并登记 {1} 引擎。请在对应架构的 macOS 或 Rosetta x64 Node 下运行。",
|
|
67
|
+
"The request did not reach the service. Start Open Browser and check the local connection credentials before retrying.": "请求尚未送达。启动 open-browser 并确认本机连接凭据可用后重试。",
|
|
68
|
+
"After creating a task, check listWorkspaces. For an existing workspace, check getWorkspace. If there is an operationId, check getOperation. You can repeat reads.": "创建任务后用 listWorkspaces 核对任务。已有工作区用 getWorkspace 核对页面。有 operationId 时用 getOperation 核对回执。只读查询可重新执行。",
|
|
69
|
+
"Give createWorkspace or open a clear, non-empty name, then create the task again.": "为 createWorkspace 或 open 提供清晰的非空 name,再重新创建任务。",
|
|
70
|
+
"Check getOperation or diagnoseOperation with the same operationId before continuing.": "用同一 operationId 查询 getOperation 或 diagnoseOperation,再决定是否继续。",
|
|
71
|
+
"Observe the page again and use the new ref for your action.": "重新 observe 当前页面并用新 ref 构造动作。",
|
|
72
|
+
"Observe the current page again before acting.": "重新 observe 当前页面后再执行动作。",
|
|
73
|
+
"Call observe again for the current controlGeneration.": "重新 observe 获取最新 controlGeneration。",
|
|
74
|
+
"Observe the current page again to get its new document ID.": "重新 observe 当前页面,不要复用旧文档标识。",
|
|
75
|
+
"Check the receipt's obstruction and the foreground dialog in the current observation. Wait for it to clear before acting.": "查看回执的 obstruction 和当前观察中的前景弹窗,确认遮罩消失后再操作。",
|
|
76
|
+
"Ask the user to allow screenshots for the task owner in the tab extension. An administrator can grant a delegated client access by principalId and origin.": "请用户在当前标签的扩展内为任务所有者授权截图。委托客户端需由管理员按 principalId 和 origin 授权。",
|
|
77
|
+
"Capture the stable target region again and act before the new frame expires.": "重新截取目标所在的稳定区域,并在该帧有效期内操作。",
|
|
78
|
+
"Narrow the target with the observe locator or within.": "用 observe 的 locator 或 within 缩小目标范围。",
|
|
79
|
+
"Observe again and verify the page state or target name.": "重新 observe 并核对页面状态或目标名称。",
|
|
80
|
+
"Observe the current page and its URL before retrying navigation.": "先 observe 当前页面和地址,再决定是否重试导航。",
|
|
81
|
+
"Check blockedOrigins. Once in control, grant the required origin with grantOrigin.": "核对 blockedOrigins,取得控制权后用 grantOrigin 授权所需来源。",
|
|
82
|
+
"Switch to the Open Browser profile that owns the tab.": "请切换至该标签页所在的 open-browser profile。",
|
|
83
|
+
"Ask the user to authorize the original tab again, then redeem the authorization with the selected workspaceId.": "请用户在原标签页重新签发授权,使用所选任务的 workspaceId 兑换。",
|
|
84
|
+
"Ask the user to check the tab and site, then authorize the page again.": "请用户核对当前标签和站点,再授权此页。",
|
|
85
|
+
"Create a new, named, empty workspace and select the tab again.": "创建新的命名工作区,再让用户选择该任务。",
|
|
86
|
+
"Create a private workspace for this agent and authorize the tab again.": "创建一个仅当前 Agent 使用的新任务后重新授权。",
|
|
87
|
+
"The extension has not confirmed the page yet. Read getWorkspace and retry reattachPage.": "扩展尚未确认该页。请读取 getWorkspace 后重试 reattachPage。",
|
|
88
|
+
"This grant covers the selected tab and its site. Authorize any other page separately.": "此授权覆盖用户所选的一页及其站点。其他页需要单独授权。",
|
|
89
|
+
"Check the original page with getRecoverySummary. Ask the user to select the tab again if needed.": "用 getRecoverySummary 核对原页状态,需要时请用户重新选择标签。",
|
|
90
|
+
"Check profileId. After a restart, read getRecoverySummary and ask the user to authorize the original tab if needed.": "核对 profileId。服务重启后用 getRecoverySummary 查历史,并请用户重新授权原页。",
|
|
91
|
+
"Wait for the current operation to finish, then run previewFinish again.": "等待当前操作完成,重新调用 previewFinish 核对页面清单。",
|
|
92
|
+
"Check whether the development Chromium build includes the native managed input guard.": "请检查 Dev Chromium 是否包含受管页面输入保护补丁。",
|
|
93
|
+
"Call reattachPage with the original page handle and waitMs to wait for control and a fresh observation.": "用原页面句柄调用 reattachPage 并传 waitMs 等待交回和新观察。",
|
|
94
|
+
"Check getOperation or diagnoseOperation and verify the site before retrying.": "先用 getOperation 或 diagnoseOperation,并核对站点结果后再重试。",
|
|
95
|
+
"Check whether the site already applied the action before submitting a new operationId.": "先核对站点是否已生效,再决定是否提交新的 operationId。",
|
|
96
|
+
"The operation timed out. Query the receipt with the same operationId and check the site before continuing.": "运行预算已耗尽。用同一 operationId 查询回执,并核对站点结果后再决定是否继续。",
|
|
97
|
+
"Run --schema or read capabilities for the accepted parameters.": "运行 --schema 或读取 capabilities,按当前契约修正参数。",
|
|
98
|
+
"Start the local Open Browser service.": "请先启动 open-browser 本地服务。",
|
|
99
|
+
"The connection closed before a response arrived. Check the request outcome.": "本机服务的回包中断,请先核对请求结果。",
|
|
100
|
+
"Unknown agent API method.": "未知的 Agent API 方法。",
|
|
101
|
+
"Parameters must be a JSON object.": "参数必须是 JSON 对象。",
|
|
102
|
+
"observeAndAct requires at least one action.": "observeAndAct 需要至少一个 action。",
|
|
103
|
+
"The local service returned an unrecognized response.": "本地服务返回了无法识别的响应。",
|
|
104
|
+
"Timed out waiting for the service. Look up dispatched actions by operationId.": "等待服务响应超时。对于已派发的动作,请按 operationId 查询回执。",
|
|
105
|
+
"Timed out waiting for the local service to become ready.": "等待本机服务就绪超时。",
|
|
106
|
+
"Could not find the open-browser skill guide.": "未找到 skills/open-browser/SKILL.md。",
|
|
107
|
+
"Invalid open-browser tool name or arguments.": "open-browser 工具名称或参数无效。",
|
|
108
|
+
"Open Browser usage guide ({0})": "Open Browser 使用指南({0})",
|
|
109
|
+
"Page check": "页面检查",
|
|
110
|
+
"Research assistant": "研究助手",
|
|
111
|
+
"Read a JSON object from stdin and write the result to stdout.": "从标准输入读取一个 JSON 对象,将结果写到标准输出。",
|
|
112
|
+
"Available methods: {0}": "可用方法:{0}",
|
|
113
|
+
"Quick start": "快速开始",
|
|
114
|
+
"Print {result} or {error} to stdout and exit nonzero on failure.": "将 {result} 或 {error} 写到标准输出,失败时返回非零退出码。",
|
|
115
|
+
"Read one JSON request per line until stdin closes.": "从标准输入逐行读取 JSON 请求,直到输入关闭。",
|
|
116
|
+
"Show method names and parameter schemas.": "显示方法名称与参数定义。",
|
|
117
|
+
"Show the skill guide for this package.": "显示当前包版本的 Skill 指南。",
|
|
118
|
+
"Errors include code, message and an optional nextAction. After a timeout, query getOperation with the original operationId.": "错误包含 code、message 和可选的 nextAction。超时后用原 operationId 调用 getOperation 查询回执。",
|
|
119
|
+
"Local admin commands: {0}": "本机管理命令:{0}",
|
|
120
|
+
"Bind credentials in the local console. Use fillCredential and credentialRef for sign-in fields.": "在本地控制台绑定凭据。用 fillCredential 和 credentialRef 填写登录字段。",
|
|
121
|
+
"Run a local origin-bound semantic workflow and poll its operation receipt. Bind only granted file IDs or credential references. The optional timeout is a wall-clock budget shared by queueing and execution.": "在指定来源执行本地语义工作流,通过回执查询进度。仅绑定已授权的文件 ID 或凭据引用。可选超时包含排队和执行时间。",
|
|
122
|
+
"Discover service version, enabled inputs, limits and privacy mode before using optional features.": "查看服务版本、已启用的输入方式、限额和隐私模式,再使用可选功能。",
|
|
123
|
+
"Capture approved masked viewport pixels. Coordinates use viewport CSS pixels. For an animated game set liveCanvas to bind input to its sole canvas across repaints.": "截取已授权、经过遮盖的视口像素。坐标使用视口 CSS 像素。持续重绘的单画布游戏可设置 liveCanvas,将输入绑定到同一画布。",
|
|
124
|
+
"List the workspaces available to this agent.": "列出当前 Agent 可访问的工作区。",
|
|
125
|
+
"Create a browser workspace. Every task must provide a clear non-empty name. Each subagent should pass its own display name in agentName.": "创建浏览器工作区。每个任务都需要清晰的非空名称。子 Agent 可用 agentName 提供各自的显示名称。",
|
|
126
|
+
"Create a named workspace for one explicit URL and open its first page in one call.": "为指定 URL 创建命名工作区,并在同一次调用中打开首页。",
|
|
127
|
+
"Grant one origin already recorded as blocked for this workspace. Use only after checking blockedOrigins and obtaining workspace control.": "为工作区授权一个已记录的受阻来源。先检查 blockedOrigins 并取得工作区控制权。",
|
|
128
|
+
"Read visible React Flow nodes and edges, chat turns and download labels. Compare snapshotVersion after an action. Unsupported markup is reported explicitly.": "读取已渲染的 React Flow 节点和边、聊天回合及下载标签。执行操作后可比较 snapshotVersion。页面标记不受支持时会报告原因。",
|
|
129
|
+
"Redeem the two-minute token issued by the user for this empty named workspace. The original tab stays open at finish.": "兑换用户为此命名空工作区签发的两分钟授权码。任务结束后原标签页会保留。",
|
|
130
|
+
"Refresh the exact managed page after the user returns control. Returns a fresh observation. Set waitMs to wait for human control to return.": "用户交回控制权后,重新绑定指定的受管页面并获取最新观察。可设置 waitMs 等待用户交回。",
|
|
131
|
+
"Preview which pages will stay open and which will close. Pass previewId to finishWorkspace to require this plan.": "预览任务结束时会保留和关闭哪些页面。将 previewId 传给 finishWorkspace 即可按该计划交付。",
|
|
132
|
+
"Read workspace control, page availability and extension synchronization. Supply profileId to verify the expected profile.": "读取工作区控制权、页面可用性和扩展同步状态。可传 profileId 核对浏览器资料。",
|
|
133
|
+
"Open a page in the workspace.": "在工作区中打开一个页面。",
|
|
134
|
+
"Read visible controls. Continue a truncated observation with nextCursor or filter by name or viewport region. After stale_ref, stale_document or user handoff, observe again before acting.": "读取可见控件。使用 nextCursor 续读截断结果,或按名称、视口区域筛选。遇到 stale_ref、stale_document 或人工接管后,先重新观察。",
|
|
135
|
+
"Observe the current page and submit an ordered action batch through one service request. The service binds the actions to the returned document and control generation before queueing them.": "在一次服务请求中观察当前页面并依次提交操作。服务会把动作绑定到本次观察对应的文档和控制代次,再加入队列。",
|
|
136
|
+
"Submit ordered actions for the observed document and control generation. Use fillCredential for login secrets. Supply a unique operationId. The optional timeout is a wall-clock budget shared by queueing and execution. After a timeout or outcome_unknown, query the receipt and verify the site before retrying.": "按顺序向已观察的文档和控制代次提交操作。登录凭据使用 fillCredential。提供唯一的 operationId。可选超时包含排队和执行时间。超时或返回 outcome_unknown 时,先查询回执并核对站点结果。",
|
|
137
|
+
"Respond once to a pending JavaScript dialog in the controlled page.": "对受控页面中待处理的 JavaScript 对话框回应一次。",
|
|
138
|
+
"List live desktop file grants for this workspace.": "列出工作区内仍有效的桌面文件授权。",
|
|
139
|
+
"List downloads for this workspace and their current state.": "列出工作区的下载及其当前状态。",
|
|
140
|
+
"List locally delivered output manifests for this workspace.": "列出此工作区已交付到本机的输出清单。",
|
|
141
|
+
"Read one locally delivered output in bounded base64 chunks. Use nextOffset to continue.": "分块读取已交付到本机的输出,数据采用 base64 编码。使用 nextOffset 续读。",
|
|
142
|
+
"Cancel a download belonging to this workspace.": "取消此工作区的指定下载。",
|
|
143
|
+
"Get the current workspace event cursor before triggering an action.": "在触发操作前获取当前工作区事件游标。",
|
|
144
|
+
"Wait for a matching page event. Omit pageId for a workspace page_bound event after tab approval. Other kinds require pageId. Reuse the same cursor to read it after reconnecting.": "等待匹配的页面事件。用户授权标签后,可省略 pageId 来等待工作区的 page_bound 事件。其他事件需要 pageId。重新连接后可用原游标续读。",
|
|
145
|
+
"Poll redacted changes since a sequence number.": "从指定序号开始读取脱敏事件。",
|
|
146
|
+
"Read task recovery steps, delivered objects and page availability. Observe or verify before resuming.": "读取任务恢复步骤、已交付的对象及页面可用性。继续任务前先重新观察或核对结果。",
|
|
147
|
+
"Read redacted receipt history.": "读取脱敏的操作回执历史。",
|
|
148
|
+
"Call when the overall task is complete, before reporting success. Keep selected result tabs as ordinary tabs and remove the task group. Use an empty list when there are no results to keep.": "整体任务完成后、报告成功前调用。选中的结果页将保留为普通标签页,任务分组会移除。没有要保留的页面时传空列表。",
|
|
149
|
+
"Preview a redacted diagnostic with the next safe action. Use it after a timeout, disconnect or outcome_unknown.": "超时、连接中断或收到 outcome_unknown 后,查看脱敏诊断和建议的下一步操作。",
|
|
150
|
+
"Read an operation receipt, including its completed step count. Set waitMs to wait briefly for a pending action.": "读取操作回执和已完成步数。可设置 waitMs 短暂等待未结束的操作。",
|
|
151
|
+
"Cancel the remaining steps of an operation.": "取消操作中尚未执行的步骤。",
|
|
152
|
+
"Hand control of the workspace to its user.": "将工作区控制权交给用户。",
|
|
153
|
+
"Close the workspace and its managed pages.": "关闭工作区及其受管页面。",
|
|
154
|
+
"open-browser engine unavailable. Run npm run browser:install.": "找不到 open-browser 浏览器引擎,请运行 npm run browser:install。",
|
|
155
|
+
"tasks must be a nonempty array": "tasks 必须是非空数组。",
|
|
156
|
+
"concurrency must be an integer between 1 and 16": "concurrency 必须是 1 到 16 之间的整数。",
|
|
157
|
+
"each task needs a unique string id": "每个任务都需要唯一的字符串 ID。",
|
|
158
|
+
"each task needs an HTTP(S) URL": "每个任务都需要一个 HTTP(S) 地址。",
|
|
159
|
+
"steps must be an array": "steps 必须是数组。",
|
|
160
|
+
"each step needs a fill, click or read operation and a selector": "每个步骤都需要指定 fill、click 或 read 操作以及选择器。",
|
|
161
|
+
"fill needs a string value": "fill 需要字符串值。",
|
|
162
|
+
"stdin must contain a JSON batch": "标准输入需要提供一组 JSON 任务。",
|
|
163
|
+
"OPEN_BROWSER_BUILD_PROFILE must be dev or stable": "OPEN_BROWSER_BUILD_PROFILE 必须是 dev 或 stable。",
|
|
164
|
+
"build profile must be dev or stable": "构建配置必须是 dev 或 stable。",
|
|
165
|
+
"Node archive integrity check failed": "Node 归档文件完整性校验失败。",
|
|
166
|
+
"Use node desktop/build-portable.mjs linux-x64 or win32-x64": "请运行 node desktop/build-portable.mjs linux-x64 或 win32-x64。",
|
|
167
|
+
"Refresh the pinned Chrome archive version and SHA-256.": "请更新锁定的 Chrome 归档版本和 SHA-256 校验和。",
|
|
168
|
+
"--profile must be dev or stable": "--profile 必须是 dev 或 stable。",
|
|
169
|
+
"usage: start-profile.mjs <dev|stable>": "用法:start-profile.mjs <dev|stable>",
|
|
170
|
+
"usage: build-profile.mjs <dev|stable> [build arguments]": "用法:build-profile.mjs <dev|stable> [构建参数]",
|
|
171
|
+
"Usage: node desktop/build-managed-input.mjs <chromium-src>": "用法:node desktop/build-managed-input.mjs <Chromium 源码目录>",
|
|
172
|
+
"--arch must be arm64 or x64": "--arch 必须是 arm64 或 x64。",
|
|
173
|
+
"--format must be dmg, zip or both": "--format 必须是 dmg、zip 或 both。",
|
|
174
|
+
"macOS packages must be created on macOS": "请在 macOS 上创建 macOS 安装包。"
|
|
175
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seekskyworld/open-browser",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"prepack": "node desktop/verify-version.mjs",
|
|
54
54
|
"browser:install": "node runtime.mjs",
|
|
55
55
|
"control": "node control.mjs",
|
|
56
|
+
"check:i18n": "node .github/scripts/check-i18n.mjs",
|
|
56
57
|
"test": "npm run test:unit",
|
|
57
58
|
"test:unit": "node --test --test-concurrency=1 *.test.mjs studio/*.test.mjs",
|
|
58
59
|
"test:contract": "node --test --test-concurrency=1 experiments/observe-contract.test.mjs hosted/hosted.test.mjs",
|
|
@@ -75,6 +76,8 @@
|
|
|
75
76
|
"pngjs": "7.0.0"
|
|
76
77
|
},
|
|
77
78
|
"devDependencies": {
|
|
79
|
+
"acorn": "8.19.0",
|
|
80
|
+
"parse5": "7.3.0",
|
|
78
81
|
"resedit": "3.1.1"
|
|
79
82
|
}
|
|
80
83
|
}
|
package/page-activity.mjs
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { t } from "./i18n.mjs";
|
|
1
2
|
// Runs in a Chromium isolated world. The page receives only a decorative,
|
|
2
3
|
// input-transparent edge. Control requests stay in the browser toolbar.
|
|
4
|
+
const actionLabels = globalThis.openBrowserI18n.messageLabels({ click: "Click", doubleClick: "Double-click", hover: "Hover", press: "Press key",
|
|
5
|
+
scroll: "Scroll", drag: "Drag", fill: "Fill", fillCredential: "Fill credential", select: "Select",
|
|
6
|
+
upload: "Upload", setChecked: "Toggle" }, t);
|
|
7
|
+
|
|
3
8
|
function paintEdge(state, origin) {
|
|
4
9
|
const key = '__openBrowserActivityEdge';
|
|
5
10
|
if (!state || location.origin !== origin) {
|
|
@@ -26,7 +31,7 @@ function paintEdge(state, origin) {
|
|
|
26
31
|
globalThis[key] = edge;
|
|
27
32
|
}
|
|
28
33
|
|
|
29
|
-
function paintTarget(x, y, origin,
|
|
34
|
+
function paintTarget(x, y, origin, actionLabel) {
|
|
30
35
|
const key = '__openBrowserActionRing';
|
|
31
36
|
globalThis[key]?.remove();
|
|
32
37
|
delete globalThis[key];
|
|
@@ -40,9 +45,6 @@ function paintTarget(x, y, origin, actionKind = '操作') {
|
|
|
40
45
|
ring.inert = true;
|
|
41
46
|
ring.setAttribute('aria-hidden', 'true');
|
|
42
47
|
ring.setAttribute('data-open-browser-target', '');
|
|
43
|
-
const actionLabels = { click: '点击', doubleClick: '双击', hover: '悬停', press: '按键',
|
|
44
|
-
scroll: '滚动', drag: '拖拽', fill: '填写', fillCredential: '填写凭据', select: '选择',
|
|
45
|
-
upload: '上传', setChecked: '切换' };
|
|
46
48
|
for (const [property, value] of Object.entries({
|
|
47
49
|
all: 'initial', position: 'fixed', left: (x - 11) + 'px', top: (y - 11) + 'px',
|
|
48
50
|
width: '18px', height: '18px', border: '2px solid #7659e8', 'border-radius': '50%',
|
|
@@ -74,7 +76,7 @@ function paintTarget(x, y, origin, actionKind = '操作') {
|
|
|
74
76
|
cursor.style.setProperty('left', x + 'px', 'important');
|
|
75
77
|
cursor.style.setProperty('top', y + 'px', 'important');
|
|
76
78
|
const label = cursor.lastElementChild;
|
|
77
|
-
label.textContent = 'Agent · ' +
|
|
79
|
+
label.textContent = 'Agent · ' + actionLabel;
|
|
78
80
|
label.style.setProperty('left', x + 120 > innerWidth ? 'auto' : '12px', 'important');
|
|
79
81
|
label.style.setProperty('right', x + 120 > innerWidth ? '18px' : 'auto', 'important');
|
|
80
82
|
label.style.setProperty('top', y + 40 > innerHeight ? '-22px' : '10px', 'important');
|
|
@@ -180,7 +182,7 @@ export function pageActivity() {
|
|
|
180
182
|
if (!tab || tab.workspaceId !== workspaceId) return;
|
|
181
183
|
const navigation = tab.navigation;
|
|
182
184
|
const ticket = ++tab.targetRevision;
|
|
183
|
-
tab.pending = tab.pending.then(() => paint(tab, paintTarget, [x, y, origin, actionKind], () =>
|
|
185
|
+
tab.pending = tab.pending.then(() => paint(tab, paintTarget, [x, y, origin, actionLabels[actionKind] || t("Action")], () =>
|
|
184
186
|
tab.generation === controlGeneration && tab.navigation === navigation && tab.mode === 'agent' &&
|
|
185
187
|
tab.origin === origin && tab.edgeState === 'running' && tab.targetRevision === ticket)).catch(() => {});
|
|
186
188
|
},
|
package/paths.mjs
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
-
import { homedir } from 'node:os';
|
|
3
2
|
import path from 'node:path';
|
|
4
|
-
import { buildProfile,
|
|
3
|
+
import { buildProfile, profileStateDirectory } from './build-profile.mjs';
|
|
5
4
|
|
|
6
5
|
export const profileId = process.env.OPEN_BROWSER_PROFILE || 'default';
|
|
7
|
-
const base = scopedBuildRoot(path.resolve(process.env.OPEN_BROWSER_STATE_DIR || path.join(homedir(), '.open-browser')));
|
|
8
6
|
|
|
9
7
|
export function pathsForProfile(id) {
|
|
10
|
-
|
|
11
|
-
const stateDir = id === 'default' ? base : path.join(base, 'profiles', id);
|
|
8
|
+
const stateDir = profileStateDirectory(id);
|
|
12
9
|
const instance = createHash('sha256').update(stateDir).digest('hex').slice(0, 16);
|
|
13
10
|
const socketFile = path.join(stateDir, 'open-browser.sock');
|
|
14
11
|
const socketPath = process.platform === 'win32'
|
package/runtime.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t } from "./i18n.mjs";
|
|
1
2
|
import { execFileSync } from 'node:child_process';
|
|
2
3
|
import { randomUUID } from 'node:crypto';
|
|
3
4
|
import { readFile, realpath, rename, writeFile } from 'node:fs/promises';
|
|
@@ -16,7 +17,7 @@ export async function engineExecutable() {
|
|
|
16
17
|
const arch = targetArch();
|
|
17
18
|
const manifest = path.join(engineDir, `engine-${version}-${process.platform}-${arch}.json`);
|
|
18
19
|
if (process.platform === 'darwin' && !['arm64', 'x64'].includes(arch))
|
|
19
|
-
throw new Error(
|
|
20
|
+
throw new Error(t("macOS engine builds require arm64 or x64."));
|
|
20
21
|
try {
|
|
21
22
|
const entry = JSON.parse(await readFile(manifest, 'utf8'));
|
|
22
23
|
const executable = await realpath(path.join(engineDir, entry.executable));
|
|
@@ -25,13 +26,13 @@ export async function engineExecutable() {
|
|
|
25
26
|
throw new Error('Invalid engine path');
|
|
26
27
|
return executable;
|
|
27
28
|
} catch {
|
|
28
|
-
throw new Error('open-browser engine unavailable. Run npm run browser:install.');
|
|
29
|
+
throw new Error(t('open-browser engine unavailable. Run npm run browser:install.'));
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
async function install() {
|
|
33
34
|
if (process.platform === 'darwin' && targetArch() !== process.arch)
|
|
34
|
-
throw new Error(
|
|
35
|
+
throw new Error(t("This Node process is {0}. Install the {1} engine on matching macOS hardware or with x64 Node under Rosetta.", process.arch, targetArch()));
|
|
35
36
|
process.env.PLAYWRIGHT_BROWSERS_PATH = engineDir;
|
|
36
37
|
const cli = path.join(path.dirname(require.resolve('playwright-core/package.json')), 'cli.js');
|
|
37
38
|
execFileSync(process.execPath, [cli, 'install', 'chromium', '--no-shell'], { stdio: 'inherit' });
|
package/sdk.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t } from "./i18n.mjs";
|
|
1
2
|
import { readFile } from 'node:fs/promises';
|
|
2
3
|
import { Agent, request } from 'node:http';
|
|
3
4
|
import { randomUUID } from 'node:crypto';
|
|
@@ -11,37 +12,37 @@ export { agentMethods };
|
|
|
11
12
|
* service error. The hint never replaces the server error message.
|
|
12
13
|
*/
|
|
13
14
|
export const recoveryHints = Object.freeze({
|
|
14
|
-
SERVICE_UNAVAILABLE:
|
|
15
|
-
RESPONSE_LOST:
|
|
16
|
-
TASK_NAME_REQUIRED:
|
|
17
|
-
REQUEST_TIMEOUT:
|
|
18
|
-
stale_ref:
|
|
19
|
-
stale_document:
|
|
20
|
-
stale_control:
|
|
21
|
-
stale_observation:
|
|
22
|
-
target_obscured: '
|
|
23
|
-
pixel_permission_required:
|
|
24
|
-
stale_visual_frame:
|
|
25
|
-
target_ambiguous:
|
|
26
|
-
target_missing:
|
|
27
|
-
navigation_failed:
|
|
28
|
-
origin_denied:
|
|
29
|
-
profile_mismatch:
|
|
30
|
-
adoption_expired:
|
|
31
|
-
adoption_page_changed:
|
|
32
|
-
adoption_requires_empty_workspace:
|
|
33
|
-
adoption_requires_private_workspace:
|
|
34
|
-
sync_pending:
|
|
35
|
-
single_tab_scope:
|
|
36
|
-
page_not_found:
|
|
37
|
-
workspace_not_found:
|
|
38
|
-
finish_preview_changed:
|
|
39
|
-
input_guard_unavailable:
|
|
40
|
-
workspace_under_user_control:
|
|
41
|
-
outcome_unknown:
|
|
42
|
-
inspect_before_retry:
|
|
43
|
-
run_timeout:
|
|
44
|
-
invalid_params:
|
|
15
|
+
SERVICE_UNAVAILABLE: t("The request did not reach the service. Start Open Browser and check the local connection credentials before retrying."),
|
|
16
|
+
RESPONSE_LOST: t("After creating a task, check listWorkspaces. For an existing workspace, check getWorkspace. If there is an operationId, check getOperation. You can repeat reads."),
|
|
17
|
+
TASK_NAME_REQUIRED: t("Give createWorkspace or open a clear, non-empty name, then create the task again."),
|
|
18
|
+
REQUEST_TIMEOUT: t("Check getOperation or diagnoseOperation with the same operationId before continuing."),
|
|
19
|
+
stale_ref: t("Observe the page again and use the new ref for your action."),
|
|
20
|
+
stale_document: t("Observe the current page again before acting."),
|
|
21
|
+
stale_control: t("Call observe again for the current controlGeneration."),
|
|
22
|
+
stale_observation: t("Observe the current page again to get its new document ID."),
|
|
23
|
+
target_obscured: t("Check the receipt's obstruction and the foreground dialog in the current observation. Wait for it to clear before acting."),
|
|
24
|
+
pixel_permission_required: t("Ask the user to allow screenshots for the task owner in the tab extension. An administrator can grant a delegated client access by principalId and origin."),
|
|
25
|
+
stale_visual_frame: t("Capture the stable target region again and act before the new frame expires."),
|
|
26
|
+
target_ambiguous: t("Narrow the target with the observe locator or within."),
|
|
27
|
+
target_missing: t("Observe again and verify the page state or target name."),
|
|
28
|
+
navigation_failed: t("Observe the current page and its URL before retrying navigation."),
|
|
29
|
+
origin_denied: t("Check blockedOrigins. Once in control, grant the required origin with grantOrigin."),
|
|
30
|
+
profile_mismatch: t("Switch to the Open Browser profile that owns the tab."),
|
|
31
|
+
adoption_expired: t("Ask the user to authorize the original tab again, then redeem the authorization with the selected workspaceId."),
|
|
32
|
+
adoption_page_changed: t("Ask the user to check the tab and site, then authorize the page again."),
|
|
33
|
+
adoption_requires_empty_workspace: t("Create a new, named, empty workspace and select the tab again."),
|
|
34
|
+
adoption_requires_private_workspace: t("Create a private workspace for this agent and authorize the tab again."),
|
|
35
|
+
sync_pending: t("The extension has not confirmed the page yet. Read getWorkspace and retry reattachPage."),
|
|
36
|
+
single_tab_scope: t("This grant covers the selected tab and its site. Authorize any other page separately."),
|
|
37
|
+
page_not_found: t("Check the original page with getRecoverySummary. Ask the user to select the tab again if needed."),
|
|
38
|
+
workspace_not_found: t("Check profileId. After a restart, read getRecoverySummary and ask the user to authorize the original tab if needed."),
|
|
39
|
+
finish_preview_changed: t("Wait for the current operation to finish, then run previewFinish again."),
|
|
40
|
+
input_guard_unavailable: t("Check whether the development Chromium build includes the native managed input guard."),
|
|
41
|
+
workspace_under_user_control: t("Call reattachPage with the original page handle and waitMs to wait for control and a fresh observation."),
|
|
42
|
+
outcome_unknown: t("Check getOperation or diagnoseOperation and verify the site before retrying."),
|
|
43
|
+
inspect_before_retry: t("Check whether the site already applied the action before submitting a new operationId."),
|
|
44
|
+
run_timeout: t("The operation timed out. Query the receipt with the same operationId and check the site before continuing."),
|
|
45
|
+
invalid_params: t("Run --schema or read capabilities for the accepted parameters."),
|
|
45
46
|
});
|
|
46
47
|
|
|
47
48
|
export class OpenBrowserError extends Error {
|
|
@@ -53,8 +54,8 @@ export class OpenBrowserError extends Error {
|
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
const unavailable = () => new OpenBrowserError('SERVICE_UNAVAILABLE',
|
|
57
|
-
const responseLost = () => new OpenBrowserError('RESPONSE_LOST',
|
|
57
|
+
const unavailable = () => new OpenBrowserError('SERVICE_UNAVAILABLE', t("Start the local Open Browser service."));
|
|
58
|
+
const responseLost = () => new OpenBrowserError('RESPONSE_LOST', t("The connection closed before a response arrived. Check the request outcome."));
|
|
58
59
|
|
|
59
60
|
export class OpenBrowserClient {
|
|
60
61
|
constructor(options = {}) {
|
|
@@ -69,12 +70,12 @@ export class OpenBrowserClient {
|
|
|
69
70
|
|
|
70
71
|
async call(method, params = {}, {signal} = {}) {
|
|
71
72
|
if (!agentMethods.includes(method))
|
|
72
|
-
throw new OpenBrowserError('UNKNOWN_METHOD',
|
|
73
|
+
throw new OpenBrowserError('UNKNOWN_METHOD', t("Unknown agent API method."));
|
|
73
74
|
if (!params || typeof params !== 'object' || Array.isArray(params))
|
|
74
|
-
throw new OpenBrowserError('INVALID_PARAMS',
|
|
75
|
+
throw new OpenBrowserError('INVALID_PARAMS', t("Parameters must be a JSON object."));
|
|
75
76
|
if (['createWorkspace', 'open'].includes(method) &&
|
|
76
77
|
(typeof params.name !== 'string' || !params.name.trim()))
|
|
77
|
-
throw new OpenBrowserError('TASK_NAME_REQUIRED',
|
|
78
|
+
throw new OpenBrowserError('TASK_NAME_REQUIRED', t("Supply a non-empty task name when creating an agent workspace."));
|
|
78
79
|
if (['createWorkspace','open'].includes(method) && params.agentName === undefined)
|
|
79
80
|
params = { ...params, agentName: this.agentName };
|
|
80
81
|
return localRequest(this.socketPath,this.tokenPath,'/v1/call',method,params,this.agent,signal);
|
|
@@ -121,7 +122,7 @@ export class OpenBrowserClient {
|
|
|
121
122
|
observeAndAct(page, request = {}) {
|
|
122
123
|
const { actions, observeAfter, timeoutMs, operationId = randomUUID(), ...observeOptions } = request;
|
|
123
124
|
if (!Array.isArray(actions) || actions.length === 0)
|
|
124
|
-
return Promise.reject(new OpenBrowserError('INVALID_PARAMS',
|
|
125
|
+
return Promise.reject(new OpenBrowserError('INVALID_PARAMS', t("observeAndAct requires at least one action.")));
|
|
125
126
|
return this.call('observeAndAct', {
|
|
126
127
|
...page, ...observeOptions, actions, observeAfter, timeoutMs, operationId,
|
|
127
128
|
});
|
|
@@ -184,7 +185,7 @@ export async function localRequest(socket, credentials, endpoint, method, params
|
|
|
184
185
|
} else if (res.statusCode === 200 && reply && Object.hasOwn(reply, 'result')) {
|
|
185
186
|
resolve(reply.result);
|
|
186
187
|
} else {
|
|
187
|
-
reject(new OpenBrowserError('INVALID_RESPONSE',
|
|
188
|
+
reject(new OpenBrowserError('INVALID_RESPONSE', t("The local service returned an unrecognized response.")));
|
|
188
189
|
}
|
|
189
190
|
});
|
|
190
191
|
});
|
|
@@ -195,7 +196,7 @@ export async function localRequest(socket, credentials, endpoint, method, params
|
|
|
195
196
|
else reject(error.syscall === 'connect' ? unavailable() : responseLost());
|
|
196
197
|
});
|
|
197
198
|
req.setTimeout(limits.clientTimeoutMs, () => {
|
|
198
|
-
reject(new OpenBrowserError('REQUEST_TIMEOUT',
|
|
199
|
+
reject(new OpenBrowserError('REQUEST_TIMEOUT', t("Timed out waiting for the service. Look up dispatched actions by operationId.")));
|
|
199
200
|
req.destroy();
|
|
200
201
|
});
|
|
201
202
|
req.end(body);
|
package/service.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { locale } from './i18n.mjs';
|
|
1
2
|
import { limits } from './api-contract.mjs';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import { TabRecovery, restoreApprovedTabs } from './tab-recovery.mjs';
|
|
@@ -263,7 +264,7 @@ async function main() {
|
|
|
263
264
|
const send = frame => process.stdout.write(JSON.stringify(frame) + '\n');
|
|
264
265
|
const app = await startApplication({ headless: process.argv.includes('--headless'),
|
|
265
266
|
mode: native ? 'native' : process.argv.includes('--chromium') ? 'chromium' : 'service',
|
|
266
|
-
onBar: desktopBar ? bar => send({ event: 'desktop.bar', bar }) : undefined,
|
|
267
|
+
onBar: desktopBar ? bar => send({ event: 'desktop.bar', bar, locale }) : undefined,
|
|
267
268
|
onShow: () => send({ event: 'desktop.open' }) });
|
|
268
269
|
active = app;
|
|
269
270
|
for (const signal of ['SIGINT', 'SIGTERM']) process.once(signal, () => { void app.close(); });
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: open-browser
|
|
3
|
-
description:
|
|
3
|
+
description: Use the Open Browser CLI to browse, observe pages, operate workspaces or verify sign-in when the user requests Open Browser. 使用 open-browser 操作浏览器工作区或验证登录。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
[简体中文](SKILL.zh-CN.md)
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
2. **新开页面。** 用 `open` 传明确的任务 `name` 和 `url`,保存返回的工作区与页面 ID,再 `observe`。在已有任务中增加页面用 `openPage`。并行 Agent 可以传各自的 `agentName`。
|
|
10
|
-
3. **人工交回。** 用户处理登录或弹窗时用 `handOff`。用原句柄调用 `reattachPage` 并传 `waitMs:30000`,用户点击「交回 Agent」后直接使用返回的观察。工作区的 `mode` 表示控制权,页面的 `readyForAgent` 表示当前是否可操作。
|
|
8
|
+
## Start from the current task
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
1. **Continue an existing page.** Get the page handle with `getWorkspace`, or find the task using `listWorkspaces`. Call `reattachPage` for a fresh observation. To use an ordinary signed-in tab, create a named, empty workspace and save `eventCursor.nextCursor`. Ask the user to select the task in the tab’s extension and click **Give this tab to the agent**. Call `waitForEvent` with `workspaceId`, `kind:"page_bound"` and `after`, then use the event’s `pageId` with `reattachPage`. A timed-out wait can resume from the same cursor.
|
|
11
|
+
2. **Open a new page.** Call `open` with a clear task `name` and a specific `url`. Save the workspace and page IDs and call `observe`. Use `openPage` to add a page to an existing task. Parallel agents can supply their own `agentName`.
|
|
12
|
+
3. **Resume after human control.** Call `handOff` for the user to handle sign-in or a dialog. Call `reattachPage` with the original handle and `waitMs:30000`. When the user clicks **Return to agent**, use the observation in the response. Workspace `mode` describes ownership. Page `readyForAgent` indicates whether the page is ready for input.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
## Act on the page
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Use this skill’s `scripts/open-browser` on macOS and Linux, or `scripts/open-browser.cmd` on Windows. The launcher discovers the local service and starts the app when needed. For a sequence of calls, reuse an SDK client or run the launcher's `session` command and send one request per line, such as `{"id":1,"method":"listWorkspaces","params":{}}`.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Pass control refs from the latest observation to `observeAndAct` with a unique `operationId`, the `actions`, `observeAfter:"delta"` and `waitMs:3000`. Read the changes from the completed receipt. If it is still queued or running, use the same ID with `getOperation` and a bounded `waitMs` of up to 10000. For `outcome_unknown`, verify the result on the site before retrying. Use a workspace-bound `credentialRef` for passwords. Before reporting completion, call `finishWorkspace` and select the result pages in `keepPageIds`.
|
|
19
|
+
|
|
20
|
+
For a missing workspace, expired grant or CLI wrapper, read the [recovery guide](references/recovery.en.md). For canvases, frames, files and account profiles, read [operations and permissions](references/operations.en.md). Use `--schema` to inspect parameters supported by the installed version.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: open-browser
|
|
3
|
+
description: 用户要求用 open-browser 浏览、观察页面、操作工作区或验证登录时,通过 open-browser CLI 控制其独立 Chromium。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
[English](SKILL.md)
|
|
7
|
+
|
|
8
|
+
## 从当前任务开始
|
|
9
|
+
|
|
10
|
+
1. **继续已有页面。** 用 `getWorkspace`(或 `listWorkspaces` 找回任务)取得页面句柄,用 `reattachPage` 读当前观察。普通已登录标签需要一个命名的空工作区。创建后先保存 `eventCursor.nextCursor`,请用户在目标标签的扩展中选择任务并点击「让 Agent 操作此页」。用 `waitForEvent` 传 `workspaceId`、`kind:"page_bound"`、`after`,再用事件的 `pageId` 调用 `reattachPage`。等待超时可沿用原游标。
|
|
11
|
+
2. **新开页面。** 用 `open` 传明确的任务 `name` 和 `url`,保存返回的工作区与页面 ID,再 `observe`。在已有任务中增加页面用 `openPage`。并行 Agent 可以传各自的 `agentName`。
|
|
12
|
+
3. **人工交回。** 用户处理登录或弹窗时用 `handOff`。用原句柄调用 `reattachPage` 并传 `waitMs:30000`,用户点击「交回 Agent」后直接使用返回的观察。工作区的 `mode` 表示控制权,页面的 `readyForAgent` 表示当前是否可操作。
|
|
13
|
+
|
|
14
|
+
## 执行动作
|
|
15
|
+
|
|
16
|
+
macOS 和 Linux 使用本 Skill 的 `scripts/open-browser`,Windows 使用 `scripts/open-browser.cmd`。首次调用会探测本机服务并按需启动应用。连续任务优先复用 SDK 客户端或运行启动器的 `session` 命令,每行发送 `{"id":1,"method":"…","params":{…}}`。
|
|
17
|
+
|
|
18
|
+
用最新观察的控件 ref 调用 `observeAndAct`,传唯一 `operationId`、`actions`、`observeAfter:"delta"` 和 `waitMs:3000`。完成时直接读取回执的变化。回执仍为 queued 或 running 时,用同一个操作号调用 `getOperation` 并传 `waitMs`(最多 10000 毫秒)。`outcome_unknown` 先核对站点结果。密码使用工作区绑定的 `credentialRef`。任务完成前调用 `finishWorkspace`,通过 `keepPageIds` 指定交付页面。
|
|
19
|
+
|
|
20
|
+
找不到工作区、授权失效或需要封装 CLI 时,参阅[页面恢复与错误处理](references/recovery.md)。画布、跨框架、上传下载及多账号操作见[操作与授权](references/operations.md)。用 `--schema` 查看本机版本支持的参数。
|
|
21
|
+
|
|
22
|
+
<!-- source-sha256: e145ff28b3dd87c5cba7e6c13692f494886834d3b255785851ff3308267d9254 -->
|