browser-pilot-cli 0.3.0-rc.1 → 0.3.0-rc.3

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.
@@ -615,7 +615,9 @@ Artifacts. Raw CDP is never listed. `eval` requires `developer.eval`.
615
615
  - **BR-32:** Every ManagedTabSet is bound to at most one ProfileContext. Managed
616
616
  target creation verifies the returned context before public registration, and
617
617
  fallback-created targets enter janitor ownership before they become
618
- addressable.
618
+ addressable. Fallback ownership requires the exact new URL marker plus either
619
+ the expected opener ID or exact readback of a per-command random window name;
620
+ Profile membership alone is never sufficient.
619
621
  - **BR-33:** Switching to an existing target may update the owning Workspace's
620
622
  selected ProfileContext, but never prevents inventory or control of targets
621
623
  in other Profiles. No Profile selection is a permission grant.
@@ -816,21 +818,30 @@ a screenshot, PDF, download, or arbitrary Broker-internal path as upload
816
818
  authorization.
817
819
 
818
820
  Downloads are event-produced Artifacts rather than a separate path-returning
819
- tool. The implementation must configure download behavior on the controlled
820
- target session only, stage bytes in a mode-`0700` per-session directory, keep
821
- the CDP download GUID and staging path private, and ingest a completed file as a
822
- Workspace-owned `download` Artifact before publishing the completed `download`
823
- event. Lease/session/Workspace release removes partial staging files; failed,
824
- cancelled, oversized, or detached downloads publish bounded metadata without a
825
- local path. Browser-wide `Browser.setDownloadBehavior` on the user's default
826
- context is forbidden because it would redirect downloads from unrelated user
827
- tabs. If target-session isolation is unavailable in a Chrome version, Browser
828
- Pilot reports download capture as unavailable and does not fall back globally.
829
- The implementation applies per-download, per-Workspace staging, and global
830
- staging bounds. An oversized or over-capacity download is cancelled by its
831
- private GUID without changing download behavior for the browser's default
832
- context. Stale staging directories from a prior Broker process are removed before
833
- the first new download session is configured.
821
+ tool. CDP download behavior is browser-context scoped even when invoked through
822
+ an attached target session, so per-session download directories cannot provide
823
+ isolation. For each browser connection generation and Chrome Profile context,
824
+ the Broker enables `Browser.downloadProgress` once with
825
+ `Browser.setDownloadBehavior({ behavior: "default", eventsEnabled: true })`.
826
+ The `default` behavior preserves Chrome's configured download directory and
827
+ does not redirect user downloads.
828
+
829
+ `Page.downloadWillBegin` on an attached controlled target binds the private CDP
830
+ GUID to that target's Workspace and Lease. The browser-level completed event
831
+ supplies the absolute source `filePath`; the Broker accepts it only for a GUID
832
+ already bound by the Page event, validates a regular file, and copies it into a
833
+ Workspace-owned `download` Artifact before publishing completion. Browser-level
834
+ events without a controlled Page owner are ignored. GUIDs and source paths never
835
+ appear in protocol output.
836
+
837
+ The Browser Pilot copy is subject to tracking, item, Workspace, and global
838
+ Artifact bounds. Exceeding a bound rejects only Artifact creation: it must not
839
+ cancel, move, truncate, or delete Chrome's original download. Lease, session,
840
+ Workspace, Artifact, and Broker cleanup stop tracking and delete only protected
841
+ Artifact copies. The original file in the user's Chrome download directory is
842
+ always left intact. If browser-level download events are unavailable, Browser
843
+ Pilot reports capture as unavailable without changing Chrome's download
844
+ behavior.
834
845
 
835
846
  ## Browser Discovery and Setup
836
847
 
@@ -544,10 +544,11 @@ downloads are rejected as upload inputs. Workspace cleanup deletes the imported
544
544
  copy but never deletes the client-owned source file.
545
545
 
546
546
  Downloads have no path-returning tool. Once a controlled target session is
547
- attached, the Broker configures target-session download capture and emits
548
- `download` events with one of these states:
547
+ attached, the Broker enables browser-level completion events while preserving
548
+ Chrome's default download behavior, and emits `download` events with one of
549
+ these states:
549
550
 
550
- - `capture_unavailable`: that Chrome version rejected target-session isolation;
551
+ - `capture_unavailable`: Chrome rejected browser-level completion events;
551
552
  - `started`: includes an opaque `downloadId`, bounded URL, and suggested filename;
552
553
  - `completed`: includes the Workspace-owned `download` Artifact descriptor;
553
554
  - `failed` or `cancelled`: includes a stable, bounded reason and byte metadata.
@@ -558,14 +559,24 @@ public `artifactId`, and terminal failures recommend inspecting the bounded
558
559
  failure reason. `capture_unavailable` is setup state and does not claim that a
559
560
  download started.
560
561
 
561
- The private CDP GUID and staging path never appear in protocol output. On
562
- `completed`, use the descriptor's `id` with `artifacts/get` or `artifacts/export`
563
- exactly as for screenshots and PDFs. Staging directories are separate per CDP
564
- session, use mode `0700`, enforce concurrency and byte quotas, and are removed on
565
- session, Lease, or Workspace release. The session setting is restored to
566
- `default` before an attached session is retired. Browser Pilot never calls browser-wide
567
- `Browser.setDownloadBehavior`; unsupported target-session capture remains
568
- unavailable instead of redirecting unrelated user downloads.
562
+ The private CDP GUID and Chrome source path never appear in protocol output. On
563
+ `completed`, use the descriptor's `id` with `artifacts/get` or
564
+ `artifacts/export` exactly as for screenshots and PDFs. A session-scoped
565
+ `Page.downloadWillBegin` event establishes Workspace/Lease/target ownership;
566
+ the browser-level completion event is ignored unless that ownership already
567
+ exists. Browser Pilot enables those completion events once per browser
568
+ connection generation and Chrome Profile context with
569
+ `Browser.setDownloadBehavior({ behavior: "default", eventsEnabled: true })`.
570
+ It never supplies `downloadPath`, so Chrome continues to use the user's selected
571
+ download directory.
572
+
573
+ The Broker validates the completed absolute regular-file path and copies it to
574
+ protected Artifact storage. Releasing or expiring the Artifact, Lease, or
575
+ Workspace deletes only that copy. The original Chrome download is never moved
576
+ or deleted. Size, concurrency, or Artifact quota failures reject only the
577
+ Artifact copy and do not call `Browser.cancelDownload`. Downloads from tabs
578
+ without an attached controlled session remain ordinary Chrome downloads and
579
+ produce no Browser Pilot event.
569
580
 
570
581
  ## Cleanup
571
582
 
@@ -1,6 +1,6 @@
1
1
  # Profile Context Routing Plan
2
2
 
3
- Status: **In progress**
3
+ Status: **Complete**
4
4
  Target: Browser Pilot `v0.3.0`, protocol `1.2`
5
5
  Source of truth: `docs/architecture/browser-pilot-platform-spec.md`
6
6
 
@@ -138,11 +138,13 @@ managed-target janitor:
138
138
  varies by regular Profile context.
139
139
  3. If Chrome rejects or misroutes that call, attach to a bounded representative
140
140
  page target in the selected context, create an isolated world, and call
141
- `window.open("about:blank", "_blank", <fixed popup window features>)` with a
142
- debugger user gesture.
143
- 4. Identify exactly one new target by the pre-dispatch target set, opener ID,
144
- Profile context, page type, and blank URL. Ambiguous or mismatched targets are
145
- closed and the operation fails.
141
+ `window.open(<unique blank marker>, <unique window name>, <fixed popup window
142
+ features>)` with a debugger user gesture.
143
+ 4. Identify exactly one new page target by the pre-dispatch target set, unique
144
+ URL marker, and Profile context. Prove ownership through either the expected
145
+ opener ID or exact readback of the per-command random `window.name`; Chrome
146
+ may normalize the reported opener across regular Profile tabs. Ambiguous or
147
+ unverified targets are closed and the operation fails.
146
148
  5. Explicitly adopt the verified target into the janitor before registering it
147
149
  publicly, so Broker crash cleanup still closes it.
148
150
  6. Read and retain its window ID, bind the ManagedTabSet, register the opaque
@@ -177,21 +179,21 @@ candidate targets were closed.
177
179
  - [x] P4: update stdio integration guidance, adapters, skill, and release docs.
178
180
  - [x] P5: add protocol, dual-Profile, concurrency, reconnect, cleanup, and
179
181
  compatibility tests.
180
- - [ ] P6: run real Chrome acceptance and publish `v0.3.0-rc.1`.
182
+ - [x] P6: run real Chrome acceptance and publish `v0.3.0-rc.2`.
181
183
 
182
184
  ## Acceptance
183
185
 
184
- - All eligible user tabs across live Profile contexts appear in one inventory.
185
- - Existing user tabs can be controlled without selecting a Profile first.
186
- - No multi-context open silently selects a first Profile.
187
- - Explicit, active-target, Workspace, and single-context resolution follow the
186
+ - [x] All eligible user tabs across live Profile contexts appear in one inventory.
187
+ - [x] Existing user tabs can be controlled without selecting a Profile first.
188
+ - [x] No multi-context open silently selects a first Profile.
189
+ - [x] Explicit, active-target, Workspace, and single-context resolution follow the
188
190
  specified order.
189
- - Every managed target and popup matches its ManagedTabSet Profile context.
190
- - Two Workspaces may select different contexts and create targets concurrently
191
+ - [x] Every managed target and popup matches its ManagedTabSet Profile context.
192
+ - [x] Two Workspaces may select different contexts and create targets concurrently
191
193
  without cross-routing.
192
- - Reconnect invalidates old Profile IDs, target mappings, frames, and refs.
193
- - Passive listing creates no target and never focuses or navigates a user tab.
194
- - Janitor EOF/SIGKILL cleanup closes fallback-created managed windows but never
194
+ - [x] Reconnect invalidates old Profile IDs, target mappings, frames, and refs.
195
+ - [x] Passive listing creates no target and never focuses or navigates a user tab.
196
+ - [x] Janitor EOF/SIGKILL cleanup closes fallback-created managed windows but never
195
197
  user tabs.
196
- - Protocol 1.1 clients retain existing-tab control and cannot open ambiguously.
197
- - Single-Profile CLI and fixture behavior remains compatible.
198
+ - [x] Protocol 1.1 clients retain existing-tab control and cannot open ambiguously.
199
+ - [x] Single-Profile CLI and fixture behavior remains compatible.
@@ -114,9 +114,10 @@ Pilot. Tenon and OpenClaw are reference consumers only.
114
114
  Workspace scoped; request identity includes CDP session identity, sensitive
115
115
  events are metadata-only, and legacy daemon handlers ignore Broker sessions.
116
116
  Lease replacement preserves Workspace configuration while Workspace release
117
- clears it. Downloads use target-session CDP configuration, separate protected
118
- staging directories, bounded concurrency/bytes, Workspace-owned Artifacts,
119
- and Lease/session/Workspace cleanup without browser-wide fallback.
117
+ clears it. Downloads preserve each Profile's Chrome default directory;
118
+ Page events bind GUID ownership to controlled sessions, browser-level
119
+ completion paths are copied into bounded Workspace-owned Artifacts, and
120
+ cleanup deletes only the copy without cancelling or moving user downloads.
120
121
  - [x] **A2.6** Implement the default-unrestricted BrowserControlPolicy and
121
122
  optional launch-time Host operation removal.
122
123
  - Covers: FLOW-5, BR-21, BR-22, AC-4.
@@ -226,9 +227,10 @@ Pilot. Tenon and OpenClaw are reference consumers only.
226
227
  keeping explicit CLI export behavior compatible.
227
228
  - Covers: AC-1, AC-6.
228
229
  - Complete: screenshot and PDF tools return scoped Artifacts; large captures
229
- produce model-sized previews with optional originals. Session-scoped download
230
- events ingest completed files as protected `download` Artifacts without
231
- publishing staging paths or CDP GUIDs.
230
+ produce model-sized previews with optional originals. Session-scoped Page
231
+ events establish download ownership, and browser-level completion events
232
+ copy only those files into protected `download` Artifacts without publishing
233
+ Chrome source paths or CDP GUIDs.
232
234
  - [x] **A5.3** Add adapter-facing file authorization and revoke access on
233
235
  release or expiry.
234
236
  - Covers: CON-5, NFR-5.
@@ -0,0 +1,49 @@
1
+ # Browser Pilot v0.3.0 Stabilization Plan
2
+
3
+ Status: **In progress**
4
+ Candidate baseline: `v0.3.0-rc.2`; correction target: `v0.3.0-rc.3`, protocol `1.2`
5
+
6
+ ## Goal
7
+
8
+ Promote protocol 1.2 to `v0.3.0` only after the published executable passes
9
+ the same multi-host workflows that Tenon, OpenClaw, Codex, and other Agent
10
+ products depend on. No Agent-specific behavior enters Browser Pilot.
11
+
12
+ ## Release gate
13
+
14
+ - [x] Add a black-box host integration runner that launches two independent
15
+ stdio bridge clients against an exact executable command.
16
+ - [x] Verify separate Connections, Workspaces, Leases, opaque target IDs, one
17
+ shared Broker, and one shared in-flight browser connection.
18
+ - [x] Verify eligible user-tab exclusivity, `target_busy`, explicit release,
19
+ and handoff without navigation, editing, or closure.
20
+ - [x] Verify concurrent CLI use and separate managed inventories.
21
+ - [x] Verify screenshot conversion to native image content and PDF/download
22
+ export to host-owned absolute paths.
23
+ - [x] Verify event replay until explicit acknowledgement.
24
+ - [x] Verify Workspace cleanup closes only managed targets and preserves the
25
+ initial user-tab inventory.
26
+ - [x] Verify isolated browser loss/restoration events and invalidate old
27
+ Profile and target identities after reconnect.
28
+ - [x] Replace invalid per-session download redirection with Chrome-default
29
+ downloads, controlled Page-event ownership, browser-level completion paths,
30
+ and copy-only Artifacts. Verify unowned downloads are ignored and user source
31
+ files survive Artifact and Workspace cleanup.
32
+ - [x] Pass TypeScript, 276 Node, 109 Playwright, 13 stdio conformance, three
33
+ distribution-mode, and 13 host integration checks on the candidate source.
34
+ - [ ] Publish the corrected release candidate and rerun the host integration
35
+ gate against that installed package.
36
+ - [ ] Run one controlled user-Chrome host acceptance with explicit Profile
37
+ choices and a single authorization attempt.
38
+ - [ ] Soak several real Agent tasks through the installed candidate.
39
+ - [ ] Tag `v0.3.0`, publish npm `latest`, and verify upgrade/rollback metadata.
40
+
41
+ ## Stable decision
42
+
43
+ The first new host gate exposed a deeper CDP constraint: target-session calls to
44
+ `Page.setDownloadBehavior` still share download behavior across a Chrome
45
+ Profile. One host could therefore redirect another host's download, including
46
+ an uncontrolled user tab. `v0.3.0-rc.2` must not be promoted. RC.3 preserves
47
+ Chrome's default download destination and creates an Artifact only after a
48
+ session-scoped Page event proves ownership and a browser-level completion event
49
+ provides the final path.
@@ -1,5 +1,10 @@
1
1
  # Browser Pilot 0.3.0-rc.1
2
2
 
3
+ > Superseded by `0.3.0-rc.2`. Real-Chrome acceptance found that some regular
4
+ > Profile tabs report a normalized `TargetInfo.openerId` for fallback-created
5
+ > windows. RC.1 fails closed with `unknown_outcome` but may leave its blank
6
+ > marker tab for caller cleanup. Upgrade to RC.2.
7
+
3
8
  This release candidate adds extension-free multi-Profile routing on one
4
9
  authorized Chrome endpoint. Browser Pilot now inventories eligible user tabs
5
10
  from every live Profile context and keeps those tabs directly controllable.
@@ -44,6 +49,7 @@ Automated release gates completed before tagging:
44
49
  - The npm dry-run package contains the Profile routing plan and this release
45
50
  note.
46
51
 
47
- The controlled real Chrome dual-Profile acceptance is performed after installing
48
- the published RC so it exercises the same package and Codex skill path available
49
- to users.
52
+ The post-publication real Chrome run verified one-authorization Profile listing,
53
+ cross-Profile user-tab control, ambiguity rejection, and direct managed creation.
54
+ It then exposed the fallback issue documented above, which is fixed and accepted
55
+ in RC.2.
@@ -0,0 +1,58 @@
1
+ # Browser Pilot 0.3.0-rc.2
2
+
3
+ This release candidate fixes a real-Chrome edge case found while accepting the
4
+ multi-Profile routing introduced in `0.3.0-rc.1`.
5
+
6
+ Some regular Chrome Profile tabs create a `window.open` target whose
7
+ `TargetInfo.openerId` differs from the page target used for the isolated-world
8
+ dispatch. Chrome still returns the exact per-command URL marker, Profile
9
+ context, and random window name. RC.1 correctly refused to register that target
10
+ but could leave the unregistered blank marker visible until the caller cleaned
11
+ up the reported `unknown_outcome`.
12
+
13
+ RC.2 keeps fail-closed ownership verification without relying on opener IDs
14
+ alone. A fallback-created target must be a new page with the exact random URL
15
+ marker and selected Profile context, then prove ownership through either the
16
+ expected opener ID or exact readback of the per-command random `window.name`.
17
+ Profile membership by itself is never accepted.
18
+
19
+ All marker candidates are now tracked before validation, target discovery waits
20
+ through a bounded five-second Chrome metadata window, and failure cleanup waits
21
+ for asynchronous target destruction to become observable. A target that fails
22
+ both ownership proofs is closed and never registered or adopted.
23
+
24
+ The regression suite covers both paths: a Chrome-normalized opener with a valid
25
+ window-name proof succeeds, while a mismatched opener and mismatched window name
26
+ fails closed and leaves no marker target.
27
+
28
+ Automated release gates completed before tagging:
29
+
30
+ - TypeScript type checking passed.
31
+ - 266 Node unit, protocol, process, and adapter tests passed.
32
+ - 109 isolated Playwright core, compatibility, and network tests passed.
33
+ - The black-box stdio conformance suite passed all 13 checks.
34
+ - npm distribution verification passed for global, local project, and
35
+ product-bundled executable modes.
36
+ - The npm dry-run package contains both Profile RC notes and the Profile routing
37
+ plan.
38
+
39
+ The RC.1 real-Chrome run used one authorization and verified three live Profile
40
+ contexts, cross-Profile user-tab inventory, existing-tab control in two
41
+ Profiles, and managed creation in the direct-create Profile before exposing this
42
+ fallback defect.
43
+
44
+ The published RC.2 package then passed controlled real Chrome acceptance through
45
+ the installed Codex CLI and skill path:
46
+
47
+ - one explicit connection produced one Chrome authorization and discovered three
48
+ live Profile contexts;
49
+ - five eligible user tabs across two Profiles remained listable and controllable;
50
+ - an unanchored new-target request returned `profile_selection_required` before
51
+ browser dispatch and did not create a tab;
52
+ - direct creation and isolated-world fallback creation each landed in the
53
+ explicitly selected Profile with the expected managed origin;
54
+ - no marker target remained after fallback verification;
55
+ - targeted close and managed bulk close preserved all five user tabs;
56
+ - Profile selection, tab control, creation, and cleanup produced no additional
57
+ authorization prompt; and
58
+ - reconnect generated new Profile IDs and the prior connection's ID was rejected.
@@ -0,0 +1,56 @@
1
+ # Browser Pilot 0.3.0-rc.3
2
+
3
+ This release candidate adds a black-box integration gate for real Agent hosts
4
+ and replaces the previous download-capture model after that gate exposed a CDP
5
+ isolation flaw.
6
+
7
+ `Page.setDownloadBehavior` is not truly target-session isolated inside one
8
+ Chrome Profile. Assigning a private directory for Host B can overwrite Host A's
9
+ setting and redirect downloads from an uncontrolled user tab. RC.3 therefore:
10
+
11
+ - preserves Chrome's configured download directory with browser-context
12
+ `Browser.setDownloadBehavior({ behavior: "default", eventsEnabled: true })`;
13
+ - uses session-scoped `Page.downloadWillBegin` only to bind a private GUID to a
14
+ Workspace, Lease, and target;
15
+ - accepts browser-level completion paths only for already-owned GUIDs and
16
+ ignores unrelated browser downloads;
17
+ - copies a completed regular file into the Workspace's protected Artifact
18
+ storage without exposing its source path; and
19
+ - never cancels, moves, or deletes the user's original download when tracking,
20
+ size, quota, Artifact, Lease, or Workspace cleanup ends.
21
+
22
+ The host integration acceptance suite launches two independent stdio clients
23
+ against an exact executable command and verifies:
24
+
25
+ - separate Connections, Workspaces, Leases, and opaque target IDs reuse one
26
+ per-user Broker;
27
+ - concurrent browser connect calls share the Broker connection path;
28
+ - Profile routing and managed inventories remain isolated;
29
+ - one user tab reports `target_busy`, then transfers through explicit release;
30
+ - a one-shot CLI remains usable while both embedded hosts are live;
31
+ - screenshots become native image content while PDFs and downloads export to
32
+ host-owned absolute paths;
33
+ - Chrome's original downloaded file survives Artifact and Workspace cleanup;
34
+ - event polling replays until the host explicitly acknowledges its cursor;
35
+ - Workspace shutdown removes only managed targets and preserves user tabs; and
36
+ - an isolated Chrome restart emits lost/restored events and invalidates old
37
+ Profile and target identities.
38
+
39
+ RC.3 also closes a Broker startup race: the `starting` PID record is now
40
+ published only after exit and signal cleanup handlers are installed, so a
41
+ SIGTERM during browser authorization cannot leave a stale owner record.
42
+
43
+ Automated gates completed for the candidate source:
44
+
45
+ - TypeScript type checking passed.
46
+ - 276 Node unit, protocol, process, adapter, and runner tests passed.
47
+ - 109 isolated Playwright core, compatibility, and network tests passed.
48
+ - The stdio conformance suite passed all 13 checks.
49
+ - The host integration suite passed all 13 isolated checks, including original
50
+ Chrome download preservation.
51
+ - npm distribution verification passed for global, local project, and
52
+ product-bundled executable modes.
53
+
54
+ RC.3 keeps protocol 1.2 and the RC.2 Profile routing contract unchanged. It
55
+ adds no Native SDK, MCP server, browser extension, approval layer, or
56
+ Agent-specific production behavior.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-pilot-cli",
3
- "version": "0.3.0-rc.1",
3
+ "version": "0.3.0-rc.3",
4
4
  "description": "CLI tool to control your browser via Chrome DevTools Protocol",
5
5
  "repository": "https://github.com/relixiaobo/browser-pilot",
6
6
  "type": "module",
@@ -22,6 +22,7 @@
22
22
  "test:capabilities": "tsup && node --test tests/browser-capability-fixtures.test.mjs",
23
23
  "test:protocol": "tsup && node --test tests/protocol.test.mjs",
24
24
  "test:stdio-conformance": "tsup && node scripts/run-isolated-stdio-conformance.mjs",
25
+ "test:host-acceptance": "tsup && node scripts/run-isolated-host-integration-acceptance.mjs",
25
26
  "test:distribution": "tsup && node scripts/verify-npm-distribution.mjs",
26
27
  "test:canary": "tsup && node scripts/run-real-site-canaries.mjs",
27
28
  "test:canary:strict": "tsup && node scripts/run-real-site-canaries.mjs --strict",
@@ -41,8 +42,11 @@
41
42
  "docs/integration/stdio-conformance.md",
42
43
  "docs/plans/browser-capability-evolution.md",
43
44
  "docs/plans/profile-context-routing.md",
45
+ "docs/plans/v0.3.0-stabilization.md",
44
46
  "docs/plans/universal-agent-integration.md",
45
47
  "docs/releases/v0.3.0-rc.1.md",
48
+ "docs/releases/v0.3.0-rc.2.md",
49
+ "docs/releases/v0.3.0-rc.3.md",
46
50
  "README.md",
47
51
  "LICENSE"
48
52
  ],