@seekskyworld/open-browser 0.2.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.
Files changed (99) hide show
  1. package/CONTRIBUTING.md +2 -0
  2. package/Docs/desktop-packages.md +45 -0
  3. package/Docs/open-browser-api.d.ts +13 -9
  4. 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 +6 -6
  5. package/README.md +11 -9
  6. package/README.zh-CN.md +6 -4
  7. package/access-registry.mjs +8 -3
  8. package/action-execution.mjs +30 -5
  9. package/api-contract.mjs +8 -7
  10. package/browser-extension/_locales/en/messages.json +8 -0
  11. package/browser-extension/_locales/zh_CN/messages.json +8 -0
  12. package/browser-extension/i18n.js +84 -0
  13. package/browser-extension/manifest.json +5 -4
  14. package/browser-extension/messages.js +266 -0
  15. package/browser-extension/newtab.css +4 -0
  16. package/browser-extension/newtab.html +9 -9
  17. package/browser-extension/newtab.js +38 -35
  18. package/browser-extension/page-locale.js +23 -0
  19. package/browser-extension/phase-labels.js +33 -6
  20. package/browser-extension/popup.css +2 -2
  21. package/browser-extension/popup.html +25 -25
  22. package/browser-extension/popup.js +102 -59
  23. package/browser-extension/tab-action.js +31 -25
  24. package/browser-extension/worker.js +31 -7
  25. package/browser-extension/workspace-title.js +2 -2
  26. package/build-profile.mjs +10 -2
  27. package/capability-matrix.mjs +1 -1
  28. package/chromium-host.mjs +26 -19
  29. package/chromium-shell.mjs +7 -5
  30. package/cli.mjs +51 -48
  31. package/contract-validation.mjs +1 -1
  32. package/control.mjs +9 -8
  33. package/desktop/Info.plist +4 -2
  34. package/desktop/Launcher.m +10 -2
  35. package/desktop/OBControlBar.m +12 -8
  36. package/desktop/OBLocalization.h +20 -0
  37. package/desktop/OBPageView.m +2 -1
  38. package/desktop/WorkspacePanel.m +85 -83
  39. package/desktop/archive-release.py +5 -1
  40. package/desktop/build-macos.mjs +17 -8
  41. package/desktop/build-managed-input.mjs +2 -1
  42. package/desktop/build-portable.mjs +5 -3
  43. package/desktop/build-profile.mjs +2 -1
  44. package/desktop/build.mjs +2 -1
  45. package/desktop/create-shortcut.ps1 +7 -1
  46. package/desktop/en.lproj/Localizable.strings +106 -0
  47. package/desktop/install-menu-entry.mjs +2 -0
  48. package/desktop/notarize-macos.mjs +70 -29
  49. package/desktop/package-macos.mjs +4 -3
  50. package/desktop/sign.mjs +22 -6
  51. package/desktop/start-profile.mjs +2 -1
  52. package/desktop/start.mjs +3 -1
  53. package/desktop/verify-macos-release.mjs +27 -18
  54. package/desktop/verify-version.mjs +22 -2
  55. package/desktop/zh-Hans.lproj/Localizable.strings +106 -0
  56. package/engine-service.mjs +86 -27
  57. package/hosted/cli.mjs +2 -1
  58. package/hosted/init.mjs +2 -1
  59. package/i18n.mjs +41 -0
  60. package/managed-input.mjs +22 -5
  61. package/mcp-http.mjs +12 -11
  62. package/mcp-server.mjs +27 -10
  63. package/mcp.mjs +1 -0
  64. package/messages.zh-CN.mjs +175 -0
  65. package/package.json +9 -5
  66. package/page-activity.mjs +10 -7
  67. package/page-observation.mjs +4 -1
  68. package/paths.mjs +2 -5
  69. package/receipt-store.mjs +17 -7
  70. package/runtime.mjs +5 -4
  71. package/sdk.mjs +57 -46
  72. package/service.mjs +38 -21
  73. package/skill-links.mjs +72 -18
  74. package/skills/open-browser/SKILL.md +10 -97
  75. package/skills/open-browser/SKILL.zh-CN.md +22 -0
  76. package/skills/open-browser/references/macos.en.md +3 -0
  77. package/skills/open-browser/references/macos.md +5 -0
  78. package/skills/open-browser/references/operations.en.md +54 -0
  79. package/skills/open-browser/{SKILL.windows.md → references/operations.md} +8 -59
  80. package/skills/open-browser/references/recovery.en.md +36 -0
  81. package/skills/open-browser/references/recovery.md +38 -0
  82. package/skills/open-browser/references/windows.en.md +3 -0
  83. package/skills/open-browser/references/windows.md +5 -0
  84. package/skills/open-browser/scripts/bootstrap.mjs +80 -90
  85. package/skills/open-browser/scripts/guide.mjs +20 -0
  86. package/skills/open-browser/scripts/open-browser +5 -1
  87. package/studio/demo-site.mjs +5 -4
  88. package/studio/index.html +37 -33
  89. package/studio/index.mjs +10 -3
  90. package/studio/native-demo.mjs +8 -7
  91. package/studio/studio.css +3 -0
  92. package/studio/studio.js +99 -69
  93. package/system-i18n.mjs +19 -0
  94. package/tab-adoption.mjs +9 -3
  95. package/tab-recovery.mjs +100 -0
  96. package/visual-page.mjs +17 -7
  97. package/workspace-lifecycle.mjs +18 -2
  98. package/workspace-state.mjs +57 -16
  99. package/skills/open-browser/SKILL.macos.md +0 -112
package/CONTRIBUTING.md CHANGED
@@ -12,4 +12,6 @@ node --test service.integration.test.mjs
12
12
 
13
13
  修改控制接口时,更新方法描述、SDK 类型和项目内 Skill。用 `node cli.mjs --schema` 查看 CLI、MCP 与服务使用的方法描述。修改任务执行时,请给出站点收到的结果、执行前后所用场景和复跑命令。截图、账号资料、令牌与真实站点正文留在本机。
14
14
 
15
+ 修改界面文案或 Skill 后运行 `npm run check:i18n`。扩展和网页控制台的固定文字在 HTML 中使用 `data-i18n` 或 `data-i18n-attrs` 标记,中文译文放在 `browser-extension/messages.js`。Skill 的英文原文更新后,核对对应的中文指南,并把检查输出的 SHA-256 写入该译文末尾的 `source-sha256` 注释。
16
+
15
17
  快速回归使用 `npm run test:unit`,合并前使用 `npm run test:all`。桌面签名、目标平台打包和 SHA-256 核对步骤见[跨平台试用与发行](Docs/跨平台试用与发行.md)。本地评测口径见[任务评测指南](Docs/open-browser任务评测指南.md)。安全或隐私问题请按[私下报告流程](SECURITY.md)联系维护者。
@@ -0,0 +1,45 @@
1
+ # Open Browser desktop packages
2
+
3
+ ## Install and start
4
+
5
+ - **macOS.** Download the DMG for Apple Silicon (arm64) or Intel (x64), open it, and drag the app to Applications. Launch `open-browser.app`.
6
+ - **Windows x64.** Extract the entire `open-browser-win32-x64.zip` archive and run `open-browser.cmd`. To create a desktop shortcut, run `powershell -NoProfile -ExecutionPolicy Bypass -File .\create-shortcut.ps1` in the extracted directory.
7
+ - **Linux x64.** Extract `open-browser-linux-x64.tar.gz` and run `./open-browser` from a graphical desktop session. For a menu entry, run `./node/bin/node install-menu-entry.mjs`. Install the system libraries required by Chromium. Ubuntu build environments can use `node node_modules/playwright-core/cli.js install-deps chromium`.
8
+
9
+ Both portable packages contain Node, Chromium, the extension and the local service. Recreate the shortcut or menu entry if you move the extracted directory. The portable package includes the Chinese instructions as `README.zh-CN.md`.
10
+
11
+ Open a new tab for the Agent Console. Create a workspace through the CLI or MCP to open a managed page. Its extension lets you take over, return control and bind credentials. The macOS app also provides a floating control bar.
12
+
13
+ Use the **Language** selector in the new-tab Agent Console or local web console to choose **Follow system**, **简体中文** or **English**. The selection is saved per profile and is used by later CLI and MCP sessions. OPEN_BROWSER_LOCALE=en or OPEN_BROWSER_LOCALE=zh-CN overrides the saved choice for one process.
14
+
15
+ ## Build and verify
16
+
17
+ Install Node.js 22 or later, Python 3, curl and tar. Run `npm ci` in the source checkout. `npm run build` selects the host platform. Portable archives can also be built on macOS.
18
+
19
+ | Target | Command | Output in `dist/` |
20
+ | --- | --- | --- |
21
+ | macOS arm64, local | `npm run package:macos:arm64` | App, ZIP, DMG and checksums |
22
+ | macOS arm64, DMG only | `npm run package:macos:dmg` | `open-browser-macos-arm64.dmg` and checksum |
23
+ | macOS x64, local | `npm run package:macos:x64` | Intel app, ZIP, DMG and checksums |
24
+ | Windows x64 | `npm run package:windows:x64` | `open-browser-win32-x64.zip` and checksum |
25
+ | Linux x64 | `npm run package:linux:x64` | `open-browser-linux-x64.tar.gz` and checksum |
26
+
27
+ `npm run package:macos` builds the default arm64 app, ZIP and DMG. Use `npm run package:portable:all` for both portable archives or `npm run package:all` for all local package targets. Use `npm run build:dev` or `npm run start:dev` for the development profile in `~/.open-browser/dev`. Stable builds use `npm run build:stable` or `npm start` and store data in `~/.open-browser`. Each profile has a separate browser profile, PID, socket and receipt database.
28
+
29
+ macOS requires Xcode command line tools and a Developer ID Application certificate. Run `npm run browser:install` before building. Use an arm64 Node process for Apple Silicon and an x64 Node process on Intel, under Rosetta or on an x64 runner for the Intel package. For public releases run `npm run build:release-macos:arm64` and `npm run build:release-macos:x64`. These commands sign and notarize the app, staple its ticket, then sign, notarize and staple the final DMG. Verify both using `npm run release:verify-macos -- dist/open-browser.app` and `npm run release:verify-macos -- dist/open-browser-x64.app`.
30
+
31
+ Verify the published checksums with `shasum -a 256 -c FILE.sha256` on macOS or Linux, or compare `Get-FileHash FILE -Algorithm SHA256` on Windows. Test the extracted portable bundle on its target system with `./node/bin/node verify.mjs .` or `.\node\node.exe verify.mjs .`. This starts a temporary service and extension, opens a local fixture and reads it through the CLI.
32
+
33
+ ## macOS signing and release records
34
+
35
+ The signing script enables Hardened Runtime and a trusted timestamp. Set `OPEN_BROWSER_SIGN_IDENTITY` to the Developer ID name or SHA-1 if needed. For local offline debugging, use `OPEN_BROWSER_CODESIGN_TIMESTAMP=none`. Public releases require the normal timestamp.
36
+
37
+ Supply notarization credentials through one of the following mechanisms.
38
+
39
+ 1. Set `OPEN_BROWSER_NOTARY_PROFILE` to a keychain profile created with `xcrun notarytool store-credentials`.
40
+ 2. Supply an App Store Connect key file using `OPEN_BROWSER_NOTARY_KEY` and its ID via `OPEN_BROWSER_NOTARY_KEY_ID`. Team keys also require `OPEN_BROWSER_NOTARY_ISSUER`.
41
+ 3. Supply `OPEN_BROWSER_NOTARY_APPLE_ID`, `OPEN_BROWSER_NOTARY_TEAM_ID` and an app-specific password in `OPEN_BROWSER_NOTARY_PASSWORD` or in the keychain service `open-browser-notary`.
42
+
43
+ Use `--zip`, `--dmg`, `OPEN_BROWSER_NOTARY_ZIP` or `OPEN_BROWSER_NOTARY_DMG` for custom artifact paths. Keep the source commit, target architecture, engine and Node versions, checksums, Apple request IDs and verification results with the release. Run `npm run test:all` for the automated suite and check takeover, handback and profile upgrades in a visible browser.
44
+
45
+ From the checkout, `python3 desktop/archive-release.py snapshot` writes a reproducible source archive and checksum under `dist/`. With the matching desktop archives and checksum files in place, run `python3 desktop/archive-release.py verify` to compare packaged source and write `dist/SHA256SUMS`. The bundle includes third-party notices, a Node license, a package license manifest and Chromium credits at `chrome://credits/`.
@@ -18,7 +18,7 @@ export interface WorkspaceInfo {
18
18
  pageAvailability:'managed'|'closed'|'unregistered'|'sync_pending';
19
19
  nextAction:'wait_for_sync'|'reattachPage'|'request_tab_selection'|'wait_for_agent_control';
20
20
  accountAlias?:string;
21
- pages: ReadonlyArray<PageHandle & { ownership:'user'|'agent'; syncState:'synced'|'not_required'|'sync_pending'; syncRevision:number; lastSyncedAt:number|null; documentId:string; origin: string; title: string; openerPageId?:string; openedByOperationId?:string }>;
21
+ pages: ReadonlyArray<PageHandle & { readyForAgent:boolean; ownership:'user'|'agent'; syncState:'synced'|'not_required'|'sync_pending'; syncRevision:number; lastSyncedAt:number|null; documentId:string; origin: string; title: string; openerPageId?:string; openedByOperationId?:string }>;
22
22
  activity: WorkspaceActivity;
23
23
  blockedOrigins?: Array<{origin:string; scope:'resource'|'navigation'; reason:string; resourceType:string}>;
24
24
  }
@@ -176,6 +176,7 @@ export interface OperationReceipt {
176
176
  stepKind?: PageAction['kind'];
177
177
  completedSteps: number;
178
178
  error?: string;
179
+ obstruction?:{targetBounds:{x:number;y:number;width:number;height:number};element:string;inDialog:boolean;inputGuard:string;cause:'foreground_dialog'|'element_intercepts_pointer'|'unknown';nextAction:'inspect_dialog'|'observe_target';dialogBounds?:{x:number;y:number;width:number;height:number}};
179
180
  observation?: PageObservation;
180
181
  delta?: {changed?: ObservedElement[]; textChanged:boolean; text?:string; added:Array<{role:string;name:string}>; removed:Array<{role:string;name:string}>};
181
182
  dialogIds?: string[];
@@ -188,7 +189,7 @@ export interface OperationReceipt {
188
189
 
189
190
  /** CLI and MCP call this surface through the same SDK. */
190
191
  export interface OpenBrowserV1 {
191
- capabilities(): Promise<{version:number;contractVersion?:number;methods?:readonly string[];limits?:Readonly<Record<string,number>>;privacy?:{
192
+ capabilities(options?:{signal?:AbortSignal}): Promise<{version:number;contractVersion?:number;methods?:readonly string[];limits?:Readonly<Record<string,number>>;privacy?:{
192
193
  profile:'strict'|'compatibility'|string;
193
194
  telemetry:'disabled';
194
195
  chromiumServices:'reduced'|'compatibility';
@@ -196,7 +197,7 @@ export interface OpenBrowserV1 {
196
197
  diagnostics:'redacted';
197
198
  credentials:'memory-scoped';
198
199
  };visual:{enabled:boolean;actions:readonly string[]}}>;
199
- captureVisual(page:PageHandle,options?:{region?:VisualRect;ref?:string}):Promise<VisualFrame>;
200
+ captureVisual(page:PageHandle,options?:{region?:VisualRect;ref?:string;liveCanvas?:boolean}):Promise<VisualFrame>;
200
201
  createWorkspace(options?: CreateWorkspaceOptions): Promise<WorkspaceInfo>;
201
202
  open(options: OpenOptions): Promise<PageHandle>;
202
203
  /** SDK convenience. Opens one URL and observes it with fresh document metadata. */
@@ -208,12 +209,13 @@ export interface OpenBrowserV1 {
208
209
  reattachPage(page:PageHandle, options?:{waitMs?:number}):Promise<PageObservation>;
209
210
  previewFinish(workspaceId:string, keepPageIds?:string[]):Promise<{previewId:string; keptPageIds:string[]; closedPageIds:string[]}>;
210
211
  canvasSnapshot(page:PageHandle):Promise<PageHandle & {documentId:string; controlGeneration:string; snapshotVersion:string;
211
- adapter:'react-flow'|'chat'|'unsupported'; nodes:Array<{id:string; label:string; selected:boolean}>;
212
+ adapter:'react-flow'|'chat'|'unsupported'; reason?:'canvas_without_semantic_adapter'|'no_supported_markup';
213
+ fallback?:{dom:'observe';visualStatus:string;visual?:'captureVisual';grant?:'admin.setPixelPermission'|'extension_pixel_permission';origin?:string}; nodes:Array<{id:string; label:string; selected:boolean}>;
212
214
  edges:Array<{id:string; label:string; selected:boolean; source?:string; target?:string}>; messages:Array<{role:string; text:string}>;
213
215
  attachments:Array<{label:string}>; truncated:boolean}>;
214
216
  observe(page: PageHandle & ObserveOptions): Promise<PageObservation>;
215
217
  /** SDK convenience. Observes and queues an action batch through one service request. */
216
- observeAndAct(page: PageHandle & ObserveOptions, request: {actions: readonly PageAction[];operationId?:string;observeAfter?:'full'|'delta';timeoutMs?:number}): Promise<{observation:PageObservation;receipt:OperationReceipt}>;
218
+ observeAndAct(page: PageHandle & ObserveOptions, request: {actions: readonly PageAction[];operationId?:string;waitMs?:number;observeAfter?:'full'|'delta';timeoutMs?:number}): Promise<{observation:PageObservation;receipt:OperationReceipt}>;
217
219
  runWorkflow(page:PageHandle,request:WorkflowRequest):Promise<OperationReceipt>;
218
220
  act(page: PageHandle, request: {
219
221
  operationId: string;
@@ -225,9 +227,9 @@ export interface OpenBrowserV1 {
225
227
  timeoutMs?: number;
226
228
  }): Promise<OperationReceipt>;
227
229
  /** SDK convenience. Observes immediately before acting and generates an operation ID when omitted. */
228
- actAfterObserve(page: PageHandle, request: {actions: readonly PageAction[];operationId?:string;observeAfter?:'full'|'delta';timeoutMs?:number}): Promise<{observation:PageObservation;receipt:OperationReceipt}>;
230
+ actAfterObserve(page: PageHandle, request: {actions: readonly PageAction[];operationId?:string;waitMs?:number;observeAfter?:'full'|'delta';timeoutMs?:number}): Promise<{observation:PageObservation;receipt:OperationReceipt}>;
229
231
  diagnoseOperation(workspaceId:string,operationId:string):Promise<{version:1;state:string;phase?:OperationReceipt['phase'];totalSteps?:number;completedSteps:number;dispatchRecorded:boolean;category:string;nextAction:string}>;
230
- getOperation(workspaceId: string, operationId: string): Promise<OperationReceipt>;
232
+ getOperation(workspaceId: string, operationId: string, options?:{waitMs?:number}): Promise<OperationReceipt>;
231
233
  finishWorkspace(workspaceId:string, keepPageIds:string[], operationId:string, previewId?:string): Promise<OperationReceipt>;
232
234
  /** SDK convenience. Generates a fresh idempotency key for finishing a workspace. */
233
235
  finish(workspaceId:string, keepPageIds?:string[]): Promise<OperationReceipt>;
@@ -238,12 +240,14 @@ export interface OpenBrowserV1 {
238
240
  readOutput(workspaceId:string, outputId:string, options?:{partName?:string;offset?:number;limit?:number}): Promise<OutputChunk>;
239
241
  cancelDownload(workspaceId:string,downloadId:string): Promise<WorkspaceDownload>;
240
242
  getRecoverySummary(workspaceId:string, options?:{after?:number;objectsAfter?:number;limit?:number}): Promise<{
241
- workspaceId:string; mode:WorkspaceInfo['mode']|'unavailable'; pages:Array<{pageId:string;next:'observe'|'handle_unavailable'; lastDisposition?:'released'|'closed'; pageAvailability:'managed'|'unregistered'|'closed'; nextAction:string}>;
243
+ workspaceId:string; mode:WorkspaceInfo['mode']|'unavailable'; closeReason?:'explicit_close'|'idle_timeout'|'finished'|'service_shutdown'|'open_failed'|'unknown'; pages:Array<{pageId:string;origin?:string;next:'observe'|'handle_unavailable'; lastDisposition?:'released'|'closed'; pageAvailability:'managed'|'restorable'|'unregistered'|'closed'; nextAction:string}>;
242
244
  deliveries:Array<{downloadId:string}>; outputs:Array<{outputId:string}>; operations:Array<OperationReceipt & {next:'verify_site'|'poll'|'already_completed'|'inspect_receipt'}>;
243
245
  nextCursor:number|null; nextObjectCursor:number|null;
244
246
  }>;
245
247
  listOperations(workspaceId:string, options?:{after?:number;limit?:number}): Promise<{operations:OperationReceipt[];nextCursor:number|null}>;
246
248
  eventCursor(workspaceId:string):Promise<{nextCursor:number}>;
249
+ waitForEvent(page:{workspaceId:string}, options:{after:number;kind:'page_bound';timeoutMs?:number}):
250
+ Promise<{event:null|{sequence:number;kind:string;state:string;pageId:string;resourceId:string};nextCursor:number}>;
247
251
  waitForEvent(page:PageHandle, options:{after:number;kind:'dialog'|'download'|'popup';operationId?:string;timeoutMs?:number}):
248
252
  Promise<{event:null|{sequence:number;kind:string;state:string;pageId:string;resourceId:string;operationId?:string};nextCursor:number}>;
249
253
  listEvents(workspaceId:string, options?:{after?:number;limit?:number}): Promise<{
@@ -279,7 +283,7 @@ export interface OpenBrowserHostV1 {
279
283
  previewPage(page: PageHandle): Promise<Omit<PageObservation, 'elements'>>;
280
284
  showPage(page: PageHandle): Promise<PageHandle>;
281
285
  takeControl(params: { workspaceId: string; pageId?: string; controlGeneration?: string }): Promise<WorkspaceInfo>;
282
- returnToAgent(params: { workspaceId: string; controlGeneration?: string }): Promise<WorkspaceInfo>;
286
+ returnToAgent(params: { workspaceId: string; pageId?:string; controlGeneration?: string }): Promise<WorkspaceInfo & {observation?:PageObservation;pageError?:{pageId:string;code:string}}>;
283
287
  grantOrigin(params:{workspaceId:string;controlGeneration:string;origin:string;scope:'resource'|'navigation'}):Promise<unknown>;
284
288
  resolveCredential(params:PageHandle & {documentId:string;controlGeneration:string;operationId:string;origin:string;credentialRef:string;value:string}):Promise<{credentialRef:string;saved:true}>;
285
289
  setCredential(params: {
@@ -26,7 +26,7 @@ Windows x64 下载 `open-browser-win32-x64.zip` 并完整解压,运行 `open-b
26
26
  | `npm run package:portable:all` | 依次生成 Windows、Linux 便携包 | 两个平台的归档和校验和 |
27
27
  | `npm run package:all` | 生成 macOS、Windows、Linux 全部本地发行包 | `dist/` 下全部平台归档 |
28
28
 
29
- macOS 正式公证发行仍使用 `npm run build:release-macos:arm64` 或 `npm run build:release-macos:x64`,然后运行 `npm run release:verify-macos`。本地 DMG 和 ZIP 适合安装测试,正式对外发布前需要完成 Apple 公证。
29
+ 每次公开发行都要提供 Apple Silicon 和 Intel 两份 DMG。两个架构分别使用 `npm run build:release-macos:arm64` 和 `npm run build:release-macos:x64`。脚本先公证应用并固化票据,再对最终 DMG 签名、单独提交 Apple 公证并固化镜像票据。使用 `npm run release:verify-macos -- dist/open-browser.app` 和 `npm run release:verify-macos -- dist/open-browser-x64.app` 分别验收。`npm run package:macos*` 只用于本地安装测试。
30
30
 
31
31
  开发构建使用 `npm run build:dev` 或 `npm run start:dev`。开发构建自动使用 `~/.open-browser/dev`,并隔离 PID、socket、回执数据库、Chromium profile 和 macOS 应用标识。稳定构建使用 `npm run build:stable` 或 `npm start`,数据目录为 `~/.open-browser`。
32
32
 
@@ -34,14 +34,14 @@ macOS 正式公证发行仍使用 `npm run build:release-macos:arm64` 或 `npm r
34
34
  | --- | --- | --- |
35
35
  | macOS arm64 开发构建 | `npm run browser:install`,然后 `npm run build:macos:arm64` | `dist/open-browser.app`,需要 arm64 macOS 和 Developer ID Application 签名证书 |
36
36
  | macOS x64 开发构建 | `npm run browser:install`,然后 `npm run build:macos:x64` | `dist/open-browser-x64.app`,需要 x64 macOS、Rosetta 下的 x64 Node,或 x64 CI runner |
37
- | macOS arm64 GitHub 发行 | `npm run build:release-macos:arm64` | 公证并固化票据的 `dist/open-browser-macos-arm64.zip` 及 SHA-256 |
38
- | macOS x64 GitHub 发行 | `npm run build:release-macos:x64` | 公证并固化票据的 `dist/open-browser-macos-x64.zip` 及 SHA-256 |
37
+ | macOS arm64 GitHub 发行 | `npm run build:release-macos:arm64` | 已公证并固化票据的 `dist/open-browser-macos-arm64.dmg`、ZIP 及 SHA-256 |
38
+ | macOS x64 GitHub 发行 | `npm run build:release-macos:x64` | 已公证并固化票据的 `dist/open-browser-macos-x64.dmg`、ZIP 及 SHA-256 |
39
39
  | Linux x64 | `node desktop/build-portable.mjs linux-x64` | `dist/open-browser-linux-x64.tar.gz` 和 SHA-256 文件 |
40
40
  | Windows x64 | `node desktop/build-portable.mjs win32-x64` | `dist/open-browser-win32-x64.zip` 和 SHA-256 文件 |
41
41
 
42
42
  在 Linux 或 macOS 运行 `shasum -a 256 -c 文件名.sha256`,在 Windows PowerShell 运行 `Get-FileHash 文件名 -Algorithm SHA256` 并与随附的 SHA-256 比较。便携包可在 macOS 交叉打包。在对应平台解压包后,进入解压目录,Linux 运行 `./node/bin/node verify.mjs .`,Windows 运行 `.\node\node.exe verify.mjs .`,检查实际归档能启动服务和扩展、创建工作区并通过 CLI 读取本地测试页面,再验证临时服务退出。
43
43
 
44
- 无需签名证书的贡献者可运行 `npm ci`、`npm run browser:install`、`node --test clients.test.mjs control.test.mjs engine-service.test.mjs`。Linux 和 Windows CI 还运行真实扩展登录、接管测试及解压后的服务验收。签名 macOS 构建机上运行 `npm run test:all` 和 `codesign --verify --strict --deep dist/open-browser.app`;检查实际可见标签打开、接管交回、普通标签不受影响及升级后登录态。正式发行运行 `npm run build:release-macos`,它会用 `xcrun notarytool` 提交公证,执行 `xcrun stapler staple`,重新生成含票据的 GitHub ZIP,并运行 `npm run release:verify-macos` 验收 Hardened Runtime、票据、Gatekeeper 和 SHA-256。
44
+ 无需签名证书的贡献者可运行 `npm ci`、`npm run browser:install`、`node --test clients.test.mjs control.test.mjs engine-service.test.mjs`。Linux 和 Windows CI 还运行真实扩展登录、接管测试及解压后的服务验收。签名 macOS 构建机上运行 `npm run test:all` 和 `codesign --verify --strict --deep dist/open-browser.app`;检查实际可见标签打开、接管交回、普通标签不受影响及升级后登录态。正式发行运行 `npm run build:release-macos:arm64` 或 `npm run build:release-macos:x64`,它会用 `xcrun notarytool` 提交公证,执行 `xcrun stapler staple`,生成含票据的 GitHub DMG 和 ZIP,并运行 `npm run release:verify-macos` 验收 Hardened Runtime、票据、Gatekeeper 和两个归档的 SHA-256。
45
45
 
46
46
  ### macOS 签名与公证凭据
47
47
 
@@ -55,13 +55,13 @@ macOS 正式公证发行仍使用 `npm run build:release-macos:arm64` 或 `npm r
55
55
 
56
56
  脚本也兼容现有 GoLutra 发布环境的变量名。若本机已有 `~/.golutra-macos-release.env`,可运行 `source ~/.golutra-macos-release.env` 后直接执行发行命令。`APPLE_SIGNING_IDENTITY`、`APPLE_API_KEY_PATH`、`APPLE_API_KEY`、`APPLE_API_ISSUER`、`APPLE_ID`、`APPLE_PASSWORD` 和 `APPLE_TEAM_ID` 会自动映射到 open-browser 的发行流程。
57
57
 
58
- 当前发行目标采用 GitHub ZIP。若需改变产物路径,可设置 `OPEN_BROWSER_NOTARY_ZIP` 或传入 `--zip`。公证完成后,使用 `npm run release:verify-macos`,并保存构建提交、系统架构、ZIP SHA-256、notarytool Request ID 和验收日志。
58
+ 当前发行目标采用 GitHub DMG 和 ZIP。若需改变产物路径,可设置 `OPEN_BROWSER_NOTARY_ZIP`、`OPEN_BROWSER_NOTARY_DMG` 或传入 `--zip`、`--dmg`。公证完成后,使用 `npm run release:verify-macos`,并保存构建提交、系统架构、DMG 和 ZIP SHA-256、notarytool Request ID 和验收日志。
59
59
 
60
60
  ## 发行记录
61
61
 
62
62
  核对 `Docs/THIRD-PARTY-NOTICES.md`、分发内 `app/third-party-packages.json`、Node LICENSE、引擎的 ABOUT 与运行中的 `chrome://credits/`。保存构建所用提交、系统和架构、Node/Chromium 版本、包 SHA-256、测试输出与已知限制。CI 执行构建和验收;对外发布版本、选定项目许可证及上传 macOS 公证均由项目所有者决定。
63
63
 
64
- 在项目根目录运行 `python3 desktop/archive-release.py snapshot` 会生成保留执行位、固定时间戳的源码归档和校验和,包含 Git 已跟踪和未忽略的源码。归档保存在 `dist/open-browser-source-0.2.0.tar.gz`。macOS 构建机可以用以下命令归档已签名应用,再比对发行包中的应用源文件、第三方声明与源码快照。在此期间保持工作树稳定。
64
+ 在项目根目录运行 `python3 desktop/archive-release.py snapshot` 会生成保留执行位、固定时间戳的源码归档和校验和,包含 Git 已跟踪和未忽略的源码。归档保存在 `dist/open-browser-source-0.3.1.tar.gz`。macOS 构建机可以用以下命令归档已签名应用,再比对发行包中的应用源文件、第三方声明与源码快照。在此期间保持工作树稳定。
65
65
 
66
66
  ```sh
67
67
  ditto -c -k --keepParent --sequesterRsrc dist/open-browser.app dist/open-browser-macos-arm64.zip
package/README.md CHANGED
@@ -13,17 +13,19 @@ open-browser is an open-source desktop browser for agents. It runs locally and s
13
13
  ## What you can do
14
14
 
15
15
  - **Run tasks in parallel.** Workspaces progress independently and actions on each page stay in order. The service keeps same-page actions ordered while independent workspaces run concurrently. Use `npm run test:unit` and `npm run test:contract` to reproduce the local regression suites.
16
- - **Use an existing signed-in tab.** Ask the agent to create a named workspace. Open the extension on the desired open-browser tab, choose that task, and pass the two-minute authorization to the agent. The tab stays open when the task finishes.
16
+ - **Use an existing signed-in tab.** Ask the agent to create a named workspace. Open the extension on the desired open-browser tab, choose that task, and approve control of that tab. The tab stays open when the task finishes.
17
17
  - **Share a live task with an agent.** Take over during sign-in, complete the form in place and hand the same tab back with its session intact. For routine sign-ins, bind a credential to the workspace and site so the agent can fill it by reference. [Workspace and handoff guide](Docs/控制台分组与接管方案.md)
18
- - **Keep Agent input visibly exclusive.** While a workspace is in Agent control, the managed page rejects human page input and shows the existing task border and action cursor. Each Agent action opens a scoped dispatch window, then the page locks again. Use **人工接管** to edit the page yourself and **交回 Agent** to resume.
19
- - **Pause safely for site verification.** When a site returns a recognized security challenge, the workspace stops Agent actions and shows **需要人工验证**. Take over the visible page, complete the site's own verification, then return control and observe again. open-browser does not hide automation signals or bypass the challenge.
20
- - **See the work without another dashboard window.** Every new tab opens the local Agent console with active workspaces, agent names, current status and recent operation records. The native task bar keeps only takeover and a one-click **End** action.
18
+ - **Keep Agent input visibly exclusive.** While a workspace is in Agent control, the managed page rejects human page input and shows the existing task border and action cursor. Each Agent action opens a scoped dispatch window, then the page locks again. Use **Take over** to edit the page yourself and **Return to agent** to resume.
19
+ - **Pause safely for site verification.** When a site returns a recognized security challenge, the workspace stops Agent actions and shows **Human verification required**. Take over the visible page, complete the site's own verification, then return control and observe again. open-browser does not hide automation signals or bypass the challenge.
20
+ - **See the work without another dashboard window.** Every new tab opens the local Agent console with active workspaces, agent names, current status and recent operation records. The native task bar keeps only takeover and a one-click **Finish** action.
21
21
  - **Delegate only the access a task needs.** Grant read access to an agent that checks results and control access to one that fills forms. Managed tabs have a list of permitted origins. Reading screenshots requires a separate pixel grant. [API types](Docs/open-browser-api.d.ts)
22
22
  - **Find out what happened after a disconnect.** The local service keeps the workspace alive when the CLI exits. Look up the receipt by operation ID. If submission is uncertain, check the site's result before retrying. [Evaluation guide](Docs/open-browser任务评测指南.md)
23
23
  - **Read delivered results in bounded chunks.** A kept download receives a local manifest and can be read through `readOutput` in 64 KiB chunks. The manifest expires after 24 hours and stays on the local machine.
24
24
 
25
25
  ## Quick start
26
26
 
27
+ The desktop controls, extension, CLI, Skill guide and MCP tool descriptions support English and Simplified Chinese. Choose **Language** in the new-tab Agent Console or the local web console. **Follow system** uses the system language and falls back to English. Choosing **English** or **简体中文** switches the open controls immediately and saves the choice for this profile, including future CLI and MCP sessions. Setting `OPEN_BROWSER_LOCALE=en` or `OPEN_BROWSER_LOCALE=zh-CN` at launch overrides the preference for that process. For example, run `OPEN_BROWSER_LOCALE=zh-CN node cli.mjs skill` to read the Chinese guide.
28
+
27
29
  From the repository root, install the dependencies and dedicated Chromium with Node.js 22.23.5 or later. The first engine installation requires internet access.
28
30
 
29
31
  ```sh
@@ -37,13 +39,13 @@ To try the control API, run the integration test. It starts a temporary local se
37
39
  node --test service.integration.test.mjs
38
40
  ```
39
41
 
40
- To open the stable desktop browser, run `npm start`. Use `npm run start:dev` for an isolated development build with separate state, PID, socket, receipts and macOS app identity. The first macOS desktop build requires Xcode command line tools and a Developer ID Application certificate. If you already have a build, open `dist/open-browser.app`. For a public GitHub ZIP, set a notarytool profile or CI credentials and run `npm run build:release-macos`, then run `npm run release:verify-macos`. Windows and Linux support running from source and x64 portable builds. For a headless service, run `node service.mjs --headless`. [Platform prerequisites and packaging](Docs/跨平台试用与发行.md)
42
+ To open the stable desktop browser, run `npm start`. Use `npm run start:dev` for an isolated development build with separate state, PID, socket, receipts and macOS app identity. The first macOS desktop build requires Xcode command line tools and a Developer ID Application certificate. If you already have a build, open `dist/open-browser.app`. For public GitHub DMG and ZIP releases, set a notarytool profile or CI credentials and run `npm run build:release-macos:arm64` or `npm run build:release-macos:x64`, then run `npm run release:verify-macos`. Windows and Linux support running from source and x64 portable builds. For a headless service, run `node service.mjs --headless`. [Platform prerequisites and packaging](Docs/desktop-packages.md)
41
43
 
42
44
  ## Try a handoff
43
45
 
44
46
  1. Use the CLI or SDK to open a local test page that requires a credential. The task appears in the browser's native Agent group and in the new-tab console.
45
- 2. Select the waiting page and choose **人工接管** in the bottom bar or extension. Complete the form in the original tab, then choose **交回 Agent**.
46
- 3. The Agent observes the current document again and continues with the existing session. The one-click **结束** action closes the active task group while keeping any result tabs you selected.
47
+ 2. Select the waiting page and choose **Take over** in the bottom bar or extension. Complete the form in the original tab, then choose **Return to agent**.
48
+ 3. The Agent observes the current document again and continues with the existing session. The one-click **Finish** action closes the active task group while keeping any result tabs you selected.
47
49
 
48
50
  ## Privacy and accounts
49
51
 
@@ -59,11 +61,11 @@ Every new workspace must include a clear `name` task label. The label appears in
59
61
 
60
62
  The scoped npm package exposes the same implementation through separate entry points. Install it with `npm install @seekskyworld/open-browser`. Run `open-browser` for CLI calls, configure `open-browser-mcp` as an MCP stdio server, or run `open-browser-mcp-http` for an authenticated loopback MCP endpoint. JavaScript clients can import `OpenBrowserClient` from `@seekskyworld/open-browser`.
61
63
 
62
- Agents using the [open-browser Skill](skills/open-browser/SKILL.md) call the CLI through `skills/open-browser/scripts/open-browser`. The Skill starts the local open-browser app or portable service when needed and retries once after it becomes ready. Set `OPEN_BROWSER_AUTOSTART=0` to require an already running service. Start the app manually or run `npm start` when you want to open the desktop window before creating a task. Pass method arguments as JSON on standard input. Use `node cli.mjs --help` to list methods. Run `open-browser skill` to print the platform-matched guide without starting the service.
64
+ Agents using the [open-browser Skill](skills/open-browser/SKILL.md) call the CLI through `skills/open-browser/scripts/open-browser`. The launcher starts the local app or portable service if needed. It retries once when the service could not accept the request. If a write loses its reply, the launcher returns `RESPONSE_LOST`. Check the workspace or operation receipt before submitting again. Set `OPEN_BROWSER_AUTOSTART=0` to require an already running service. Start the app manually or run `npm start` when you want to open the desktop window before creating a task. Pass method arguments as JSON on standard input. Use `node cli.mjs --help` to list methods. Run `open-browser skill` to print the platform-matched guide without starting the service.
63
65
 
64
66
  The optional `open-browser-mcp-http` command binds only to loopback, uses the profile token as Bearer authentication, and serves `/mcp` for clients that require URL-based MCP configuration. Set `OPEN_BROWSER_MCP_HTTP_PORT` to choose a port.
65
67
 
66
- On the first Skill or service start, open-browser detects existing Skill directories for Codex, Claude Code, Cursor, Windsurf, Gemini CLI, Cline, Roo Code and OpenCode. It creates an `open-browser` relative symlink in each detected directory, preserving existing files and links. Windsurf's standard `~/.codeium/windsurf/skills` directory and its legacy `~/.windsurf/skills` directory are both supported. Set `OPEN_BROWSER_AUTO_INSTALL_SKILLS=0` to disable this behavior. Add agent-specific Skill directories with the `OPEN_BROWSER_AGENT_SKILL_DIRS` path-list variable.
68
+ At service startup and on the first Skill call, open-browser detects existing Skill directories for Codex, Claude Code, Cursor, Windsurf, Gemini CLI, Cline, Roo Code and OpenCode. It creates an `open-browser` relative symlink in each detected directory, preserving user files and unrelated links. Windows uses a directory junction when the account lacks permission to create symbolic links. Skill calls reuse a successful scan for ten minutes. Newly installed agents are discovered on the next service start or the first call after the cache expires. Run `node skill-links.mjs` from the package directory for an immediate scan. Windsurf's standard `~/.codeium/windsurf/skills` directory and its legacy `~/.windsurf/skills` directory are both supported. Set `OPEN_BROWSER_AUTO_INSTALL_SKILLS=0` to disable this behavior. Add agent-specific Skill directories with the `OPEN_BROWSER_AGENT_SKILL_DIRS` path-list variable.
67
69
 
68
70
  For one explicit URL, an agent can use one `open` call to create a workspace and open the page. This shortcut keeps Chromium's normal page network so cross-origin CSS, scripts, fonts and images render normally. Observation and actions remain bound to the target workspace and origin. Use `createWorkspace` when strict origin isolation is required.
69
71
 
package/README.zh-CN.md CHANGED
@@ -13,7 +13,7 @@ open-browser 是一个本机运行的开源 Agent 浏览器,自带 Chromium。
13
13
  ## 用它做什么
14
14
 
15
15
  - **后台并行处理网页。** 不同工作区可以同时推进,同一页的动作按顺序执行。服务保证同页动作按顺序执行,同时允许不同工作区并发。可运行 `npm run test:unit` 和 `npm run test:contract` 重现本机回归套件。
16
- - **把打开的标签页交给 Agent。** 让 Agent 创建命名任务,在 open-browser 中已登录的标签页打开扩展,选择任务并点「让 Agent 操作此页」。把面板里的授权交给 Agent 即可继续,任务结束后原标签会保留。
16
+ - **把打开的标签页交给 Agent。** 让 Agent 创建命名任务,在 open-browser 中已登录的标签页打开扩展,选择任务并点「让 Agent 操作此页」。Agent 即可在该任务中读取所选页面,任务结束后原标签会保留。
17
17
  - **人和 Agent 接力完成任务。** 登录需要你确认时,接管原标签就能继续操作,保留当前表单和登录态。交回后,Agent 重新观察页面再继续。你也可以预先为指定站点绑定凭据,让常规登录自动完成。[工作区与接管](Docs/控制台分组与接管方案.md)
18
18
  - **Agent 操作时锁定页面输入。** Agent 控制工作区时,受管页面会拒绝人工鼠标、触控板和键盘输入,同时显示任务边框和动作光标。每次 Agent 动作结束后立即恢复锁定。点击 **人工接管** 后可以直接编辑原页,完成后点击 **交回 Agent**。
19
19
  - **站点安全验证暂停。** 检测到站点返回安全验证挑战时,工作区会停止 Agent 操作并显示“需要人工验证”。用户在可见页面完成站点自己的验证后交回控制权,再重新观察。open-browser 不隐藏自动化信号,也不绕过验证。
@@ -24,6 +24,8 @@ open-browser 是一个本机运行的开源 Agent 浏览器,自带 Chromium。
24
24
 
25
25
  ## 快速开始
26
26
 
27
+ 桌面控件、扩展、CLI、Skill 指南和 MCP 工具说明均支持简体中文和英文。在新标签页 Agent 控制台或本地网页控制台的「语言」中可选「跟随系统」「简体中文」或「English」。跟随系统时,其他语言回退到英文。切换后已打开的控件立即更新,选择保存在当前配置中,新启动的 CLI 和 MCP 也会读取。要为单次启动指定语言,可设置 `OPEN_BROWSER_LOCALE=zh-CN` 或 `OPEN_BROWSER_LOCALE=en`。例如,运行 `OPEN_BROWSER_LOCALE=en node cli.mjs skill` 可阅读英文指南。
28
+
27
29
  在仓库根目录使用 Node.js 22.23.5 或更新版本安装依赖和项目专用的 Chromium。首次安装需要联网。
28
30
 
29
31
  ```sh
@@ -37,7 +39,7 @@ npm run browser:install
37
39
  node --test service.integration.test.mjs
38
40
  ```
39
41
 
40
- **打开稳定桌面浏览器**,运行 `npm start`。开发构建使用 `npm run start:dev`,它会隔离开发状态目录、PID、socket、回执和 macOS 应用标识。macOS 首次启动会构建签名应用,需要 Xcode 命令行工具和 Developer ID Application 证书。公开发布 GitHub ZIP 时,配置 notarytool 钥匙串配置或 CI 凭据,运行 `npm run build:release-macos`,再运行 `npm run release:verify-macos`。Windows、Linux 支持从源码启动和 x64 便携包。仅需无头服务时运行 `node service.mjs --headless`。[各平台构建、系统依赖与校验](Docs/跨平台试用与发行.md)
42
+ **打开稳定桌面浏览器**,运行 `npm start`。开发构建使用 `npm run start:dev`,它会隔离开发状态目录、PID、socket、回执和 macOS 应用标识。macOS 首次启动会构建签名应用,需要 Xcode 命令行工具和 Developer ID Application 证书。公开发布 GitHub DMG 和 ZIP 时,配置 notarytool 钥匙串配置或 CI 凭据,运行 `npm run build:release-macos:arm64` 或 `npm run build:release-macos:x64`,再运行 `npm run release:verify-macos`。Windows、Linux 支持从源码启动和 x64 便携包。仅需无头服务时运行 `node service.mjs --headless`。[各平台构建、系统依赖与校验](Docs/跨平台试用与发行.md)
41
43
 
42
44
  本地生成可安装的 macOS 默认包可运行 `npm run package:macos`,它会同时生成 `.app`、ZIP 和带 `Applications` 快捷方式的 DMG。只需要 DMG 时运行 `npm run package:macos:dmg`。Windows、Linux 包分别使用 `npm run package:windows:x64` 和 `npm run package:linux:x64`。
43
45
 
@@ -61,9 +63,9 @@ CLI 和 MCP 都通过同一个 SDK 调用本机 API。服务端使用 Playwright
61
63
 
62
64
  Scoped npm 包提供同一套实现的多个入口。运行 `npm install @seekskyworld/open-browser` 后,使用 `open-browser` 调用 CLI,使用 `open-browser-mcp` 配置 MCP stdio 服务,或使用 `open-browser-mcp-http` 启动经过 Bearer 认证的本机回环 MCP 地址。JavaScript 客户端可以从 `@seekskyworld/open-browser` 导入 `OpenBrowserClient`。
63
65
 
64
- Agent 使用 [open-browser Skill](skills/open-browser/SKILL.md) 时,通过 `skills/open-browser/scripts/open-browser` 调用 CLI。Skill 会在需要时启动本机 open-browser 应用或便携服务,等待就绪后自动重试一次。设置 `OPEN_BROWSER_AUTOSTART=0` 可要求服务必须已运行。希望先打开桌面窗口时,也可以手动启动应用或执行 `npm start`。运行 `open-browser skill` 可以直接输出当前安装包对应平台的 Skill 指南,不会启动服务。
66
+ Agent 使用 [open-browser Skill](skills/open-browser/SKILL.md) 时,通过 `skills/open-browser/scripts/open-browser` 调用 CLI。启动器按需启动本机应用或便携服务。如果服务尚未接收请求,就绪后会重试一次。写操作发出后回包中断时会返回 `RESPONSE_LOST`,请先核对工作区或操作回执。设置 `OPEN_BROWSER_AUTOSTART=0` 可要求服务必须已运行。希望先打开桌面窗口时,也可以手动启动应用或执行 `npm start`。运行 `open-browser skill` 可以直接输出当前安装包对应平台的 Skill 指南,不会启动服务。
65
67
 
66
- 首次运行 Skill 或本机服务时,open-browser 会检测已经存在的 Codex、Claude Code、Cursor、Windsurf、Gemini CLI、Cline、Roo Code 和 OpenCode Skill 目录,并在其中创建 `open-browser` 相对符号链接。已有文件和非 open-browser 符号链接会保留。Windsurf 的标准目录 `~/.codeium/windsurf/skills` 和旧版目录 `~/.windsurf/skills` 都支持。设置 `OPEN_BROWSER_AUTO_INSTALL_SKILLS=0` 可关闭自动安装,也可以通过 `OPEN_BROWSER_AGENT_SKILL_DIRS` 路径列表补充其他 Agent 的 Skill 目录。
68
+ 本机服务每次启动以及首次调用 Skill 时,open-browser 会检测已经存在的 Codex、Claude Code、Cursor、Windsurf、Gemini CLI、Cline、Roo Code 和 OpenCode Skill 目录,并在其中创建 `open-browser` 相对符号链接。已有文件和指向其他内容的链接会保留。Windows 账号缺少创建符号链接的权限时,会使用目录联接。Skill 会复用最近十分钟内的成功扫描。新装的 Agent 会在服务下次启动或缓存过期后的首次调用时补链。在包目录运行 `node skill-links.mjs` 可立即扫描。Windsurf 的标准目录 `~/.codeium/windsurf/skills` 和旧版目录 `~/.windsurf/skills` 都支持。设置 `OPEN_BROWSER_AUTO_INSTALL_SKILLS=0` 可关闭自动安装,也可以通过 `OPEN_BROWSER_AGENT_SKILL_DIRS` 路径列表补充其他 Agent 的 Skill 目录。
67
69
 
68
70
  需要 URL 形式 MCP 配置时,可运行 `open-browser-mcp-http`。它只监听本机回环地址 `/mcp`,默认读取当前 profile 的 token 作为 Bearer 认证,端口可用 `OPEN_BROWSER_MCP_HTTP_PORT` 设置。
69
71
 
@@ -26,6 +26,9 @@ export class AccessRegistry {
26
26
  id TEXT PRIMARY KEY, owner TEXT NOT NULL, name TEXT NOT NULL DEFAULT '',
27
27
  agentName TEXT NOT NULL DEFAULT '', createdAt INTEGER NOT NULL DEFAULT 0,
28
28
  updatedAt INTEGER NOT NULL DEFAULT 0);
29
+ CREATE TABLE IF NOT EXISTS resumable_tabs(
30
+ task TEXT PRIMARY KEY REFERENCES tasks(id) ON DELETE CASCADE,
31
+ page TEXT NOT NULL, origin TEXT NOT NULL, entry TEXT NOT NULL, expires INTEGER NOT NULL);
29
32
  CREATE TABLE IF NOT EXISTS grants(client TEXT REFERENCES clients(id) ON DELETE CASCADE,
30
33
  task TEXT REFERENCES tasks(id) ON DELETE CASCADE,permission TEXT NOT NULL,PRIMARY KEY(client,task));`);
31
34
  const taskColumns = new Set(this.db.prepare('PRAGMA table_info(tasks)').all().map(field => field.name));
@@ -53,17 +56,19 @@ export class AccessRegistry {
53
56
  return typeof task === 'string' && this.db.prepare('SELECT permission FROM grants WHERE client=? AND task=?').get(client,task)?.permission;
54
57
  }
55
58
  async call(engine, client, method, params) {
56
- if (['capabilities','listWorkspaces','createWorkspace'].includes(method)) params = validateRequest(method,params);
59
+ if (['capabilities','listWorkspaces','createWorkspace','open'].includes(method)) params = validateRequest(method,params);
57
60
  if (method === 'capabilities') return engine.call(method,{},client);
58
- if (method === 'createWorkspace') {
61
+ if (method === 'createWorkspace' || method === 'open') {
59
62
  const info = await engine.call(method, params, client);
60
63
  if (client !== 'local' && !this.db.prepare('SELECT id FROM clients WHERE id=?').get(client)) {
61
64
  await engine.call('closeWorkspace', {workspaceId:info.workspaceId}, client);
62
65
  fail('forbidden');
63
66
  }
67
+ const workspace = engine.workspaces.get(info.workspaceId);
68
+ if (!workspace) fail('workspace_not_found');
64
69
  const now = Date.now();
65
70
  this.db.prepare('INSERT INTO tasks(id,owner,name,agentName,createdAt,updatedAt) VALUES(?,?,?,?,?,?)')
66
- .run(info.workspaceId, client, info.name || '', info.agentName || '', now, now);
71
+ .run(info.workspaceId, client, workspace.name, workspace.agentName, now, now);
67
72
  return info;
68
73
  }
69
74
  if (method === 'listWorkspaces') {
@@ -102,6 +102,21 @@ async function consumeClickProbe(handle, probeId, expectedClicks) {
102
102
  } catch { return false; }
103
103
  }
104
104
 
105
+ // Report only geometry and a small vocabulary of roles from the target frame.
106
+ function inspectObstruction(target) {
107
+ const rect = target.getBoundingClientRect();
108
+ const hit = document.elementFromPoint(rect.x + rect.width / 2, rect.y + rect.height / 2);
109
+ const blocked = hit && hit !== target && !target.contains(hit);
110
+ const element = blocked && ['button','div','dialog','section','aside','iframe'].includes(hit.localName)
111
+ ? hit.localName : blocked ? 'other' : 'unknown';
112
+ const dialog = blocked && hit.closest('dialog,[role="dialog"],[role="alertdialog"],[aria-modal="true"]');
113
+ const bounds = r => ({x:r.x,y:r.y,width:r.width,height:r.height});
114
+ return {targetBounds:bounds(rect), element, inDialog:!!dialog,
115
+ cause:dialog ? 'foreground_dialog' : blocked ? 'element_intercepts_pointer' : 'unknown',
116
+ nextAction:dialog ? 'inspect_dialog' : 'observe_target',
117
+ ...(dialog && {dialogBounds:bounds(dialog.getBoundingClientRect())})};
118
+ }
119
+
105
120
  async function waitActionable(service, ws, tab, op, el, kind, documentId, generation) {
106
121
  if (op.receipt.phase !== 'actionability') {
107
122
  op.receipt.phase = 'actionability';
@@ -109,6 +124,7 @@ async function waitActionable(service, ws, tab, op, el, kind, documentId, genera
109
124
  service.notify(ws);
110
125
  }
111
126
  const deadline = Math.min(Date.now() + 5000, op.deadline ?? Infinity);
127
+ let obscured = false;
112
128
  while (!op.cancel) {
113
129
  ensureBudget(op);
114
130
  service.requireControl(ws, generation);
@@ -119,15 +135,17 @@ async function waitActionable(service, ws, tab, op, el, kind, documentId, genera
119
135
  // one Playwright call. Avoid separate visibility and enabled RPCs for the
120
136
  // common pointer path.
121
137
  try {
122
- if (kind === 'hover') await el.hover({ trial: true, timeout: Math.max(1, deadline - Date.now()) });
123
- else await el.click({ trial: true, timeout: Math.max(1, deadline - Date.now()) });
138
+ // Bound each trial so a human takeover can drain a blocked click promptly.
139
+ const timeout = Math.max(1, Math.min(350, deadline - Date.now()));
140
+ if (kind === 'hover') await el.hover({trial:true, timeout});
141
+ else await el.click({trial:true, timeout});
124
142
  return;
125
143
  } catch (error) {
126
144
  if (error.name !== 'TimeoutError') throw error;
127
145
  if (!await el.evaluate(node => node.isConnected).catch(() => false)) fail('stale_ref');
128
146
  if (op.cancel) fail('operation_cancelled');
129
- if (Date.now() >= deadline)
130
- fail(error.message.includes('intercepts pointer events') ? 'target_obscured' : 'target_not_actionable');
147
+ if (error.message.includes('intercepts pointer events')) obscured = true;
148
+ if (Date.now() >= deadline) fail(obscured ? 'target_obscured' : 'target_not_actionable');
131
149
  await delay(40, undefined, {signal:op.controller.signal});
132
150
  continue;
133
151
  }
@@ -337,7 +355,14 @@ export async function perform(service, ws, tab, { documentId, controlGeneration,
337
355
  }
338
356
  }
339
357
  } catch (error) {
340
- if (!op.dispatched) throw error;
358
+ if (!op.dispatched) {
359
+ if (error.code === 'target_obscured' && tab.documentId === documentId && ws.generation === controlGeneration) {
360
+ const obstruction = await el.evaluate(inspectObstruction).catch(() => null);
361
+ if (obstruction) tab.actionObstruction = {operationId:receipt.operationId, documentId, controlGeneration,
362
+ origin, obstruction:{...obstruction,inputGuard:ws.inputGuardMode || 'unavailable'}};
363
+ }
364
+ throw error;
365
+ }
341
366
  if (clickProbe && !tab.dialog && await consumeClickProbe(el, clickProbe, action.kind === 'doubleClick' ? 2 : 1)) {
342
367
  receipt.completedSteps++;
343
368
  op.dispatched = false;
package/api-contract.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { t } from './i18n.mjs';
1
2
  import { desktopCapabilities, readCapabilities } from './capability-matrix.mjs';
2
3
 
3
4
  const id = { type: 'string', minLength: 1 };
@@ -56,7 +57,7 @@ const definitions = {
56
57
  },['workspaceId','pageId','documentId','controlGeneration','operationId','workflow']],
57
58
 
58
59
  capabilities: ['Discover service version, enabled inputs, limits and privacy mode before using optional features.',{}],
59
- captureVisual: ['Capture approved masked viewport pixels. Coordinates use viewport CSS pixels.',{...page,region,ref:id},Object.keys(page)],
60
+ captureVisual: ['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.',{...page,region,ref:id,liveCanvas:{type:'boolean'}},Object.keys(page)],
60
61
  listWorkspaces: ['List the workspaces available to this agent.', {}],
61
62
  createWorkspace: ['Create a browser workspace. Every task must provide a clear non-empty name. Each subagent should pass its own display name in agentName.', {
62
63
  profileId:{type:'string',pattern:'^[a-z0-9][a-z0-9_-]{0,47}$'},
@@ -92,7 +93,7 @@ const definitions = {
92
93
  ...page, includeFrames:{type:'boolean'}, frameControls:{type:'boolean'},
93
94
  locator:object({role:id,name:id,within:object({role:id,name:id})},['role','name']),
94
95
  cursor:id, limit:{type:'integer',minimum:1,maximum:180}, name:id, region,
95
- operationId:id, timeoutMs:{type:'integer',minimum:1,maximum:60000},
96
+ operationId:id, waitMs:{type:'integer',minimum:1,maximum:10000}, timeoutMs:{type:'integer',minimum:1,maximum:60000},
96
97
  observeAfter:{enum:['full','delta']},
97
98
  actions:{type:'array',minItems:1,maxItems:32,items:action},
98
99
  }, ['workspaceId','pageId','operationId','actions']],
@@ -109,21 +110,21 @@ const definitions = {
109
110
  readOutput:['Read one locally delivered output in bounded base64 chunks. Use nextOffset to continue.',{...workspace,outputId:id,partName:{type:'string',maxLength:180},offset:{type:'integer',minimum:0},limit:{type:'integer',minimum:1,maximum:65536}},['workspaceId','outputId']],
110
111
  cancelDownload:['Cancel a download belonging to this workspace.',{...workspace,downloadId:id}],
111
112
  eventCursor:['Get the current workspace event cursor before triggering an action.',workspace],
112
- waitForEvent:['Wait for a matching page event. Reuse the same cursor to read it after reconnecting.',
113
- {...page,kind:{enum:['dialog','download','popup']},after:{type:'integer',minimum:0},operationId:id,
114
- timeoutMs:{type:'integer',minimum:1,maximum:10000}},[...Object.keys(page),'kind','after']],
113
+ waitForEvent:['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.',
114
+ {...page,kind:{enum:['dialog','download','popup','page_bound']},after:{type:'integer',minimum:0},operationId:id,
115
+ timeoutMs:{type:'integer',minimum:1,maximum:10000}},['workspaceId','kind','after']],
115
116
  listEvents:['Poll redacted changes since a sequence number.',history,['workspaceId']],
116
117
  getRecoverySummary:['Read task recovery steps, delivered objects and page availability. Observe or verify before resuming.',{...history,objectsAfter:{type:'integer',minimum:0}},['workspaceId']],
117
118
  listOperations:['Read redacted receipt history.',history,['workspaceId']],
118
119
  finishWorkspace:['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.',{...operation,keepPageIds:{type:'array',uniqueItems:true,items:id},previewId:id},['workspaceId','operationId','keepPageIds']],
119
120
  diagnoseOperation: ['Preview a redacted diagnostic with the next safe action. Use it after a timeout, disconnect or outcome_unknown.', operation],
120
- getOperation: ['Read an operation receipt, including its completed step count.', operation],
121
+ getOperation: ['Read an operation receipt, including its completed step count. Set waitMs to wait briefly for a pending action.', {...operation,waitMs:{type:'integer',minimum:1,maximum:10000}},Object.keys(operation)],
121
122
  cancelOperation: ['Cancel the remaining steps of an operation.', operation],
122
123
  handOff: ['Hand control of the workspace to its user.', workspace],
123
124
  closeWorkspace: ['Close the workspace and its managed pages.', workspace],
124
125
  };
125
126
  export const tools = Object.freeze(Object.entries(definitions).map(([name, [description, fields, required]]) =>
126
- ({ name, description, inputSchema:object(fields, required) })));
127
+ ({ name, description: t(description), inputSchema:object(fields, required) })));
127
128
  export const agentMethods = Object.freeze(tools.map(tool => tool.name));
128
129
  export const capabilityProfiles = Object.freeze({
129
130
  agent: agentMethods,
@@ -0,0 +1,8 @@
1
+ {
2
+ "description": {
3
+ "message": "Manage local agent workspaces and Chromium tab groups"
4
+ },
5
+ "workspace": {
6
+ "message": "Open Browser Workspace"
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "description": {
3
+ "message": "管理本机 Agent 工作区与 Chromium 标签组"
4
+ },
5
+ "workspace": {
6
+ "message": "open-browser 工作区"
7
+ }
8
+ }
@@ -0,0 +1,84 @@
1
+ 'use strict';
2
+
3
+ // Loaded as a classic script by extension pages and the MV3 worker, and as a
4
+ // side-effect module by the local service. It never processes external pages.
5
+ globalThis.openBrowserI18n = (() => {
6
+ const chinese = globalThis.openBrowserChinese;
7
+
8
+ function resolveLocale(...preferences) {
9
+ for (const preference of preferences.flat()) {
10
+ const language = String(preference || '').trim().toLowerCase().split(/[-_.@]/)[0];
11
+ if (language === 'zh') return 'zh-CN';
12
+ if (['en', 'c', 'posix'].includes(language)) return 'en';
13
+ }
14
+ return 'en';
15
+ }
16
+
17
+ const browserLocale = globalThis.chrome?.i18n?.getUILanguage?.();
18
+ const preferences = globalThis.navigator?.languages || [];
19
+ const systemLocale = resolveLocale(browserLocale, preferences, Intl.DateTimeFormat().resolvedOptions().locale);
20
+ let locale = systemLocale;
21
+
22
+ function format(message, args) {
23
+ return args.length ? message.replace(/\{(\d+)\}/g, (field, i) => i < args.length ? String(args[i]) : field) : message;
24
+ }
25
+
26
+ function translate(language, source, ...args) {
27
+ const message = language === 'zh-CN' && Object.hasOwn(chinese, source) ? chinese[source] : source;
28
+ return format(message, args);
29
+ }
30
+
31
+ function t(source, ...args) { return translate(locale, source, ...args); }
32
+
33
+ function messageLabels(sources, localize = t) {
34
+ const labels = Object.create(null);
35
+ for (const [key, source] of Object.entries(sources))
36
+ Object.defineProperty(labels, key, { enumerable: true, get: () => localize(source) });
37
+ return Object.freeze(labels);
38
+ }
39
+
40
+ // Bind only the template's initial nodes. Runtime content, including user
41
+ // data that happens to match a message, must never enter the catalogue.
42
+ const templates = new WeakMap();
43
+ function applyDocument(doc) {
44
+ doc.documentElement.lang = locale;
45
+ if (!templates.has(doc)) {
46
+ const bindings = [];
47
+ for (const element of doc.querySelectorAll('[data-i18n]')) {
48
+ for (const node of element.childNodes) {
49
+ if (node.nodeType === 3 && node.data.trim()) bindings.push({node, raw:node.data});
50
+ }
51
+ }
52
+ for (const node of doc.querySelectorAll('[data-i18n-attrs]')) {
53
+ for (const name of node.dataset.i18nAttrs.split(/\s+/)) bindings.push({node, name, raw:node.getAttribute(name)});
54
+ }
55
+ templates.set(doc, bindings);
56
+ }
57
+ for (const { node, name, raw } of templates.get(doc)) {
58
+ if (!node.isConnected) continue;
59
+ if (name) node.setAttribute(name, t(raw));
60
+ else node.data = raw.replace(raw.trim(), () => t(raw.trim()));
61
+ }
62
+ }
63
+
64
+ function bindLanguageSelect(select, save, reportError) {
65
+ let settings, saving = false;
66
+ function show(current) {
67
+ settings = current;
68
+ select.value = current?.overridden ? current.locale : current?.preference || 'system';
69
+ select.disabled = !current || current.overridden || saving;
70
+ select.title = current?.overridden ? t('Language is set by OPEN_BROWSER_LOCALE.') : '';
71
+ }
72
+ select.onchange = async () => {
73
+ const choice = select.value;
74
+ saving = select.disabled = true;
75
+ try { settings = await save(choice); }
76
+ catch { reportError(t('Could not save the language setting.')); }
77
+ finally { saving = false; show(settings); }
78
+ };
79
+ return show;
80
+ }
81
+
82
+ return { resolveLocale, format, translate, t, messageLabels, applyDocument, bindLanguageSelect, get locale() { return locale; },
83
+ setLocale(value) { locale = value ? resolveLocale(value) : systemLocale; } };
84
+ })();
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "open-browser",
4
- "version": "0.2.0",
5
- "description": "管理本机 Agent 工作区与 Chromium 标签组",
4
+ "version": "0.3.1",
5
+ "description": "__MSG_description__",
6
6
  "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhZVSXIA/vfzO0jj4ebn25I3lbL//y8FbZUeQ8Q9shwfMWTbl3bsjcHzIITSGg5+NqVTAEB1AgjFZDi/Idoj+tgsvwQxXbMBzgdZA1tQMASXcbFRdVNTxWbRBSd4JXtsFfD7H6QeBwXuIHNqUeyQYD0sYn8Ot0c4KJCzsYshYPLU56+Lzdoy+7l6ydmmw31T4tpanZHJvUgyzATOjEekFJii+9IEI/G4BUGQhKdPqR/MBYiqzxgPB5WIr3w25z6bH5KC6wnUxblLQM0RAHa4hot38NOFul5JCW6BOLHEes7Pz3DOUpWFP+DFSkY42r0dt1Kh/5CFKr6ED3agcc+tB1wIDAQAB",
7
7
  "permissions": [
8
8
  "debugger",
@@ -14,7 +14,7 @@
14
14
  "service_worker": "worker.js"
15
15
  },
16
16
  "action": {
17
- "default_title": "open-browser 工作区",
17
+ "default_title": "__MSG_workspace__",
18
18
  "default_popup": "popup.html",
19
19
  "default_icon": {
20
20
  "16": "icons/open-browser-16.png",
@@ -31,5 +31,6 @@
31
31
  "32": "icons/open-browser-32.png",
32
32
  "48": "icons/open-browser-48.png",
33
33
  "128": "icons/open-browser-128.png"
34
- }
34
+ },
35
+ "default_locale": "en"
35
36
  }