browser-pilot-cli 0.3.0 → 0.5.0

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.
@@ -299,11 +299,11 @@ Preserve Browser Pilot advantages:
299
299
  - [x] **B5.4** Update the universal skill with decision guidance grounded in
300
300
  actual tool errors and state, not framework-specific prompts.
301
301
  - Covers: FR-1, FR-8.
302
- - Complete: the Agent-neutral skill now separates direct one-shot CLI use
303
- from embedded stdio integration, starts from current tab/page state, uses
302
+ - Complete: the Agent-neutral skill now uses the same CLI workflow for
303
+ Agent-installed and product-bundled use, starts from current tab/page state, uses
304
304
  fresh refs, verifies action results, and gives explicit recovery decisions
305
- for structured evidence, hints, stable errors, events, reconnects, dialogs,
306
- and Artifacts. Command guidance now reflects all-tab inventory, explicit
305
+ for structured evidence, hints, stable errors, reconnects, dialogs, and
306
+ local file results. Command guidance now reflects all-tab inventory, explicit
307
307
  dialog handling, managed-only bulk cleanup, and actual local capture output.
308
308
  It names no Agent framework in its runtime decisions and adds no adapter or
309
309
  prompt-specific production behavior.
@@ -383,8 +383,8 @@ Preserve Browser Pilot advantages:
383
383
  `stagnant_page`; action parameters, typed values, page text, and hashes are
384
384
  not exposed.
385
385
  - [x] **B7.6** Keep the additions Agent-neutral and backward compatible.
386
- - Complete: one-shot CLI commands and Broker `tools/list` share the canonical
387
- implementations. The tools reuse existing capabilities and are additive
386
+ - Complete: all CLI commands use the Broker's canonical internal
387
+ implementations and schemas. The commands reuse existing capabilities and are additive
388
388
  for protocol 1.0/1.1. Multi-action queues, LLM extraction, planning, and
389
389
  memory remain Host-Agent responsibilities.
390
390
 
@@ -1,7 +1,7 @@
1
1
  # Profile Context Routing Plan
2
2
 
3
3
  Status: **Complete**
4
- Target: Browser Pilot `v0.3.0`, protocol `1.2`
4
+ Target: Browser Pilot `v0.4.0`, protocol `1.3`
5
5
  Source of truth: `docs/architecture/browser-pilot-platform-spec.md`
6
6
 
7
7
  ## Goal
@@ -53,7 +53,8 @@ It has:
53
53
  - an internal raw CDP browser-context ID, never exposed;
54
54
  - the owning BrowserInstance and connection generation;
55
55
  - a connection-scoped neutral label;
56
- - an optional verified display name and Profile directory;
56
+ - connection-generation-scoped identity status plus optional verified Profile
57
+ name, account name/email, and Profile directory;
57
58
  - current total and eligible tab counts;
58
59
  - one or more bounded representative targets for routing and user recognition.
59
60
 
@@ -99,10 +100,31 @@ Protocol 1.2 adds:
99
100
  Profile summaries and representative eligible tabs. It never opens, navigates,
100
101
  attaches to, or focuses a target merely to discover a display name.
101
102
 
103
+ ## Protocol 1.3
104
+
105
+ Protocol 1.3 adds `browser.profiles.identify` as an explicit, mutating identity
106
+ operation. For each requested unidentified Profile it creates a temporary
107
+ visible `chrome://version` target in that exact context, reads `#profile_path`,
108
+ verifies that path as an immediate child of the connected browser's
109
+ `userDataRoot`, reads bounded metadata from Chrome `Local State`, then detaches
110
+ and proves the temporary target was closed. Failure to prove cleanup returns
111
+ `unknown_outcome`; Browser Pilot never silently leaves an identity page behind.
112
+
113
+ Results use `identityStatus: unidentified | verified | unavailable` plus
114
+ optional `profileName`, `accountName`, `accountEmail`, `profileDirectory`, and a
115
+ stable `identityErrorCode`. Identity is cached only for the current browser
116
+ connection generation. `refresh: true` explicitly re-probes. No directory
117
+ ordering, tab title, or raw context ID is treated as account identity.
118
+
119
+ Protocol 1.3 also renames browser candidate `profile` to `userDataRoot` and tab
120
+ inventory `active` to `selected`. The latter is the Lease's logical target, not
121
+ Chrome foreground focus. Protocol 1.2 clients retain their legacy fields.
122
+
102
123
  `browser.profiles.select` accepts only a public `profileContextId`. Human CLI
103
- selectors such as index, neutral label, or verified display name are resolved
124
+ selectors such as one-based index, neutral label, or verified Profile/account
125
+ name or email are resolved
104
126
  client-side from a fresh list. The machine protocol never accepts an ambiguous
105
- free-form selector. Selecting a Profile clears the Lease's logical active-target
127
+ free-form selector. Selecting a Profile clears the Lease's logical selected-target
106
128
  anchor without releasing control or changing Chrome focus, so the next new
107
129
  managed target uses that explicit Workspace selection.
108
130
 
@@ -112,7 +134,7 @@ When `browser.open` needs a new target, resolve exactly one Profile context in
112
134
  this order:
113
135
 
114
136
  1. an explicit, current-generation `profileContextId`;
115
- 2. the current Lease's active target context;
137
+ 2. the current Lease's selected target context;
116
138
  3. the Workspace's current, valid selection;
117
139
  4. the only currently available Profile context;
118
140
  5. otherwise fail with `profile_selection_required` before browser dispatch.
@@ -161,13 +183,13 @@ candidate targets were closed.
161
183
  - Protocol 1.0/1.1 clients continue to list and control existing tabs.
162
184
  - In a single available context, their existing `browser.open` behavior remains
163
185
  automatic.
164
- - In multiple contexts, an active target remains an unambiguous anchor.
186
+ - In multiple contexts, a selected target remains an unambiguous anchor.
165
187
  - With multiple contexts and no anchor, older clients receive a structured
166
188
  failure and Browser Pilot never silently chooses the first context.
167
189
  - New Profile fields on existing results are additive; raw CDP IDs remain
168
190
  private.
169
- - The current CLI negotiates protocol 1.2, while the Broker continues to accept
170
- 1.0 and 1.1.
191
+ - The current CLI negotiates protocol 1.3, while the Broker continues to accept
192
+ 1.0 through 1.2.
171
193
 
172
194
  ## Delivery
173
195
 
@@ -176,7 +198,7 @@ candidate targets were closed.
176
198
  - [x] P2: implement Profile context registry, target propagation, Workspace
177
199
  selection, multiple ManagedTabSets, and janitor adoption.
178
200
  - [x] P3: implement `bp profiles`, `bp profile`, and `bp open --profile`.
179
- - [x] P4: update stdio integration guidance, adapters, skill, and release docs.
201
+ - [x] P4: update CLI integration guidance, skill, and release docs.
180
202
  - [x] P5: add protocol, dual-Profile, concurrency, reconnect, cleanup, and
181
203
  compatibility tests.
182
204
  - [x] P6: run real Chrome acceptance and publish `v0.3.0-rc.2`.
@@ -186,13 +208,16 @@ candidate targets were closed.
186
208
  - [x] All eligible user tabs across live Profile contexts appear in one inventory.
187
209
  - [x] Existing user tabs can be controlled without selecting a Profile first.
188
210
  - [x] No multi-context open silently selects a first Profile.
189
- - [x] Explicit, active-target, Workspace, and single-context resolution follow the
211
+ - [x] Explicit, selected-target, Workspace, and single-context resolution follow the
190
212
  specified order.
191
213
  - [x] Every managed target and popup matches its ManagedTabSet Profile context.
192
214
  - [x] Two Workspaces may select different contexts and create targets concurrently
193
215
  without cross-routing.
194
216
  - [x] Reconnect invalidates old Profile IDs, target mappings, frames, and refs.
195
217
  - [x] Passive listing creates no target and never focuses or navigates a user tab.
218
+ - [x] Explicit identity verifies Profile paths, returns structured account-aware
219
+ fields, cleans temporary targets, caches only within one connection
220
+ generation, and never guesses unavailable metadata.
196
221
  - [x] Janitor EOF/SIGKILL cleanup closes fallback-created managed windows but never
197
222
  user tabs.
198
223
  - [x] Protocol 1.1 clients retain existing-tab control and cannot open ambiguously.
@@ -1,339 +1,125 @@
1
- # Universal Agent Integration Plan
1
+ # Universal Agent CLI Integration Plan
2
2
 
3
- Status: **Complete**
4
- Source of truth: `docs/architecture/browser-pilot-platform-spec.md`
5
- Workstream: A
3
+ Status: implementation and local release verification complete for the
4
+ CLI-only architecture; formal publication remains.
6
5
 
7
6
  ## Goal
8
7
 
9
- Deliver the executable, Broker, machine protocol, distribution contract, and
10
- conformance assets required for any local Agent to install or embed Browser
11
- Pilot. Tenon and OpenClaw are reference consumers only.
12
-
13
- ## Scope Guardrails
14
-
15
- - Preserve existing one-shot CLI workflows under **FR-1**.
16
- - Expose only the executable protocol under **DEC-3**; do not publish a Native
17
- SDK or MCP server.
18
- - Do not place Agent-specific lifecycle nouns or payloads in production code.
19
- - Do not improve page understanding in this workstream except where needed to
20
- preserve the shared Observation contract.
21
- - Coordinate all changes to Observation/ref identity with Workstream B.
22
- - Keep Broker-created ManagedTabSets as the default independent task surface,
23
- while including every eligible user tab in the same inventory. Never add an
24
- Agent-callable raw-CDP `adopt(targetId)` shortcut.
25
-
26
- ## Delivery Order
27
-
28
- ### A0. Freeze the shared contract
29
-
30
- - [x] **A0.1** Publish the platform specification with stable decisions,
31
- requirements, rules, and acceptance criteria.
32
- - Covers: DEC-1 through DEC-7, FR-1 through FR-8.
33
- - Verification: product-spec inspection and contradiction review.
34
- - [x] **A0.2** Encode protocol versions, capabilities, domain identifiers,
35
- result envelopes, stable errors, and Artifact/Event descriptors as internal
36
- TypeScript types and runtime validators.
37
- - Covers: FR-2, FR-5, FR-6, FR-7.
38
- - Acceptance: incompatible versions and malformed messages fail with stable
39
- codes; unknown fields follow the compatibility rules.
40
- - [x] **A0.3** Publish the canonical machine-readable tool manifest and schema
41
- snapshots used by bridge and conformance tests.
42
- - Covers: FR-2, NFR-1.
43
- - Acceptance: `tools/list` output is generated from the same definitions used
44
- to validate `tools/call`.
45
-
46
- ### A1. Extract the internal service boundary
47
-
48
- - [x] **A1.1** Move browser discovery, target operations, observations,
49
- actions, capture, network, auth, and cookies out of Commander handlers into
50
- `BrowserPilotService` modules.
51
- - Covers: FR-1, FR-2.
52
- - Acceptance: CLI handlers contain parsing and formatting only; existing CLI
53
- fixture behavior remains unchanged.
54
- - Complete: every Commander handler now performs only parsing, compatibility
55
- formatting, and explicit client-owned file export. Browser discovery,
56
- target/session/frame state, observations, actions, capture, upload, tabs,
57
- dialogs, auth, cookies, and network operations execute through the same
58
- canonical Broker tools used by embedded clients.
59
- - [x] **A1.2** Replace process exits and console/file side effects below the CLI
60
- adapter with typed results, stable errors, and Artifact operations.
61
- - Covers: FR-2, FR-6, NFR-1.
62
- - Complete: protected screenshot/PDF/upload bytes cross the CLI boundary only
63
- through Artifact import/export/release; services return typed data and
64
- stable errors without console, process-exit, or destination-file effects.
65
- - [x] **A1.3** Make arbitrary CDP forwarding private and gate page evaluation
66
- behind `developer.eval` for machine clients.
67
- - Covers: DEC-5, CON-4, AC-4.
68
- - Complete: public CLI and stdio clients expose only canonical high-level
69
- operations. The daemon's CDP transport remains an internal implementation
70
- endpoint, and public evaluation requires `developer.eval`.
71
-
72
- ### A2. Build Broker domain isolation
73
-
74
- - [x] **A2.1** Implement ClientPrincipal, ClientConnection,
75
- BrowserWorkspace, ManagedTabSet, ControlLease, BrowserInstance,
76
- and ControlledTarget registries.
77
- - Covers: FR-3, FR-4, FR-5.
78
- - Complete: the daemon owns bounded in-memory Principal, Connection,
79
- Workspace, default ManagedTabSet, and Lease registries. Principal identity
80
- survives a bridge reconnect within one daemon lifetime; Connection-owned
81
- Leases do not.
82
- - [x] **A2.2** Create managed targets only through the control registry and
83
- validate the complete popup opener chain before adoption.
84
- - Covers: BR-1, BR-2, AC-4.
85
- - Progress: legacy CLI popup adoption now requires a complete opener chain
86
- ending at an already controlled Pilot target. Workspace control registry and
87
- Broker-only target creation remain.
88
- - Progress: the Broker inventory foundation now adopts managed popups only
89
- through a complete live opener chain and refuses to cross a user-tab record.
90
- - Complete: machine-created targets enter through `BrowserToolService` and
91
- `MemoryControlledTargetRegistry`; no public machine call accepts a raw CDP
92
- target ID.
93
- - [x] **A2.3** Replace global target/frame/session state with Workspace and
94
- Lease state; provide a compatibility Workspace for one-shot CLI calls.
95
- - Covers: FR-1, FR-3, AC-1, AC-3.
96
- - Complete: the CLI uses a fixed daemon-internal one-shot Connection plus
97
- idempotently keyed compatibility Workspace and renewable five-minute Lease.
98
- Every CLI command calls canonical tools; active targets, frames, sessions,
99
- Observations, refs, auth, rules, and request identity remain only in daemon
100
- memory. No `state.json` or `refs.json` compatibility mapping remains.
101
- - [x] **A2.4** Serialize commands through a per-target actor and implement
102
- explicit control transfer.
103
- - Covers: BR-5, BR-6, NFR-4.
104
- - Complete: reads and mutations for one physical CDP target share the same
105
- actor across Workspace-local opaque IDs, while different physical targets
106
- proceed concurrently. `browser.tabs.release` provides idempotent two-step
107
- handoff: the owner releases and fully retires its scoped target session,
108
- then another Lease acquires through its own opaque ID. Foreign Lease IDs,
109
- silent stealing, and tab closure are not part of transfer.
110
- - [x] **A2.5** Scope auth, network rules, request journals, downloads, and
111
- cleanup to their owner.
112
- - Covers: BR-3, BR-4, AC-3.
113
- - Complete: Broker auth, interception rules, and bounded request journals are
114
- Workspace scoped; request identity includes CDP session identity, sensitive
115
- events are metadata-only, and legacy daemon handlers ignore Broker sessions.
116
- Lease replacement preserves Workspace configuration while Workspace release
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.
121
- - [x] **A2.6** Implement the default-unrestricted BrowserControlPolicy and
122
- optional launch-time Host operation removal.
123
- - Covers: FLOW-5, BR-21, BR-22, AC-4.
124
- - Acceptance: no request/grant/approval lifecycle exists; every supported
125
- operation is available by default; explicitly denied operations fail with
126
- `capability_denied` before CDP dispatch.
127
- - Complete: `createBrowserControlPolicy` exposes all eligible user tabs and
128
- validates optional `deniedOperations` without any Agent-specific policy.
129
- - [x] **A2.7** Build eligible user-tab discovery and internal-target exclusion.
130
- - Covers: CON-2, FLOW-5, BR-2, BR-25, BR-26, FR-4.
131
- - Acceptance: current and future ordinary tabs are returned, while managed
132
- targets, Browser Pilot internal targets, DevTools, unsupported internal
133
- pages, and non-page targets are excluded.
134
- - Complete: `CdpBrowserTargetCatalog` implements the CDP catalog boundary.
135
- - [x] **A2.8** Merge ManagedTabSets and all eligible user tabs in
136
- ControlledTarget resolution, listing, switching, and popup inheritance.
137
- - Covers: BR-1, BR-2, BR-23 through BR-27.
138
- - Acceptance: `tabs.list` returns managed and user tabs with
139
- origin metadata; conflicting control reports `target_busy`; bulk cleanup
140
- closes only managed tabs; closing a user tab is explicit.
141
- - Complete: `MemoryControlledTargetRegistry`, `TargetInventoryService`, and
142
- `CdpBrowserTargetCatalog` now provide opaque per-Workspace target IDs,
143
- immediate managed/user inventory merging, dynamic new-tab discovery,
144
- physical-target Lease exclusion across Principals, ineligible-target
145
- invalidation, managed-popup inheritance, and safe managed-only bulk close.
146
- `tools/call` now lists, switches to, and explicitly closes both origins;
147
- Workspace release closes only managed targets. The compatibility CLI
148
- retains the same all-tab behavior.
149
-
150
- ### A3. Add bounded runtime lifecycle and command semantics
151
-
152
- - [x] **A3.1** Add in-memory Workspace, Lease, target assignment, command,
153
- idempotency, and bounded journal stores.
154
- - Covers: FR-5, NFR-2, NFR-5.
155
- - Complete: Workspace, Lease, target assignment, Command, idempotency, and
156
- per-Workspace event stores are bounded and live in daemon memory.
157
- - [x] **A3.2** Implement heartbeat, expiry, release, crash recovery, and
158
- idempotent cleanup for Workspaces and Leases.
159
- - Covers: AC-5, NFR-5.
160
- - Broker restart invalidates transient state; clients initialize, list, and
161
- observe again. Do not recover stale browser state from disk.
162
- - Complete: Lease heartbeat/expiry/release, EOF cleanup, idle Connection and
163
- Workspace reclamation, and idempotent Workspace release are implemented.
164
- Target, auth, network, frame, Observation, Artifact, and partial download
165
- cleanup is connected. Browser connection loss now rejects tools, invalidates
166
- sessions/refs, passively rediscovers the selected profile, and advances
167
- generation only after an explicit reconnect succeeds. A private child janitor solely owns the browser-level CDP
168
- connection, proxies daemon traffic over IPC, tracks verified managed popup
169
- descendants, and closes them on daemon-pipe EOF, including `SIGKILL`,
170
- without persisting target IDs or grouping by browser window. Process-level
171
- tests prove user tabs survive and only one browser WebSocket is opened.
172
- - [x] **A3.3** Implement command accepted/dispatched/completed,
173
- `unknown_outcome`, deadline, cancellation, and duplicate-call behavior.
174
- - Covers: BR-8 through BR-12, AC-5.
175
- - Complete: caller or Broker IDs, Workspace-scoped idempotency, bounded
176
- terminal outcomes, pre-dispatch cancellation, best-effort post-dispatch
177
- cancellation, deadlines, cached results, and no-replay unknown outcomes are
178
- enforced through the public bridge.
179
- - [x] **A3.4** Replace dialog auto-acceptance with typed events and explicit
180
- accept/dismiss commands.
181
- - Covers: DEC-5, event contract.
182
- - Complete: dialogs stay pending, emit opened/closed events, and can be listed
183
- and explicitly accepted or dismissed through out-of-band dialog tools.
184
- One-shot CLI dialogs use those same Workspace-scoped canonical tools and
185
- cannot list or respond to another Workspace's dialogs.
186
-
187
- ### A4. Deliver the stdio bridge
188
-
189
- - [x] **A4.1** Implement strict NDJSON framing, JSON-RPC parsing, stdout/stderr
190
- separation, initialization, and graceful shutdown.
191
- - Covers: FR-2, NFR-1.
192
- - Complete: fatal UTF-8 decoding, bounded line assembly, strict JSON-RPC
193
- envelopes, ordered normal dispatch, command-control bypass, notification
194
- semantics, stdout-only protocol, EOF cleanup, bridge-only shutdown, and
195
- structured framing errors are covered by black-box stream tests.
196
- - [x] **A4.2** Implement tool discovery/call, Workspace/Lease lifecycle,
197
- cancellation, and structured errors.
198
- - Covers: AC-2, FR-7.
199
- - Includes direct all-tab inventory and optional Host-configured operation
200
- removal. There are no browser-access approval methods.
201
- - Complete: canonical `tools/list`, validated `tools/call`, Workspace/Lease
202
- lifecycle, all-tab inventory, and production implementation filtering are
203
- implemented. `commands/get/cancel` can overtake a pending call on the same
204
- stdio connection and return structured outcomes.
205
- - [x] **A4.3** Implement event notifications plus cursor polling and
206
- `cursor_expired` recovery.
207
- - Covers: events contract, NFR-3.
208
- - Complete: bounded Workspace journals, explicit initial cursors, ordered
209
- replay, `cursor_expired` bounds, Principal isolation, best-effort stdio
210
- notifications, and daemon notification long-polling are implemented.
211
- - [x] **A4.4** Add protocol backpressure, negotiated message limits, and
212
- malformed-client isolation.
213
- - Covers: NFR-1, NFR-5.
214
- - Complete: protocol 1.1 negotiates per-Connection message/result ceilings;
215
- bootstrap and pipelined framing apply them deterministically. Input/output
216
- backpressure, bounded ordinary/control call queues, oversized-result
217
- replacement, notification dropping with cursor recovery, and bridge-local
218
- malformed-client termination prevent one client from exhausting or
219
- terminating another.
220
-
221
- ### A5. Deliver secure Artifacts
222
-
223
- - [x] **A5.1** Add protected Artifact storage, metadata, quotas, TTL, preview
224
- relationships, retain/release, and cleanup.
225
- - Covers: BR-17 through BR-20, FR-6.
226
- - [x] **A5.2** Return screenshot, PDF, and download results as Artifacts while
227
- keeping explicit CLI export behavior compatible.
228
- - Covers: AC-1, AC-6.
229
- - Complete: screenshot and PDF tools return scoped Artifacts; large captures
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.
234
- - [x] **A5.3** Add adapter-facing file authorization and revoke access on
235
- release or expiry.
236
- - Covers: CON-5, NFR-5.
237
- - Complete: import/get/export/retain/release require an owning active Workspace
238
- and Lease. `artifacts/import` copies an absolute client-authorized path to a
239
- `user_file` / `upload_input` Artifact, and `browser.upload` accepts only that
240
- kind. Release, expiry, Workspace cleanup, and Broker shutdown delete Broker
241
- bytes without deleting the source file.
242
-
243
- ### A6. Browser discovery and multi-version operation
244
-
245
- - [x] **A6.1** Return structured browser candidates and setup remediation;
246
- persist only explicit or deterministic selection.
247
- - Covers: browser discovery contract.
248
- - Complete: discovery enumerates installed supported product/profile candidates
249
- with stable IDs and separate process, remote-debugging, and authorization
250
- state. `initialize`, `browser.discover`, and `bp browsers` are passive and
251
- return bounded remediation; the Broker can start before any candidate is
252
- ready, connect candidates only through explicit `browser.connect`, and route ready browser instances by
253
- `browserId`. Selection is explicit (`--browser`/`browserId`) or stable-order
254
- deterministic and remains daemon-memory state only.
255
- - [x] **A6.2** Define the per-user Broker locator, socket/pipe permissions,
256
- startup locking, stale process recovery, and platform-specific paths.
257
- - Covers: FR-7, CON-5.
258
- - Complete: a versioned, owner-only locator records the per-user endpoint and
259
- Broker process identity. Unix uses a mode-`0600` domain socket with a
260
- deterministic short runtime path when required; Windows uses a per-user
261
- named pipe. State/runtime directories and metadata are owner-only. An
262
- atomic startup lock plus a post-lock health check makes concurrent launch a
263
- single-winner operation. Broker startup never requests Chrome authorization;
264
- concurrent explicit connect calls share one in-flight attempt. Dead owners are
265
- reclaimed without killing a PID; live but unresponsive ready Brokers fail
266
- with explicit remediation and are never silently replaced.
267
- - [x] **A6.3** Implement executable/protocol negotiation, live-client upgrade
268
- protection, rollback metadata, and deliberate version isolation.
269
- - Covers: AC-7, NFR-2.
270
- - Complete: compatible embedded clients negotiate and reuse the running
271
- Broker, while the one-shot compatibility CLI retains exact executable
272
- version semantics. Health and schema-2 locator metadata expose the current
273
- service, executable installation identity, protocol range, and bounded live
274
- client counts. Protected compare-and-stop shutdown rejects mismatched
275
- executables and returns `broker_in_use` while embedded Connections remain.
276
- Owner-only version history retains only current/previous executable metadata
277
- and no transient browser state. `BROWSER_PILOT_HOME` provides explicit
278
- cross-platform isolation; incompatibility never triggers hidden replacement
279
- or isolation. Process tests cover reuse, incompatibility, shutdown
280
- protection, crash recovery, and two intentional Broker namespaces.
281
- - [x] **A6.4** Preserve global npm, local npm/npx, and product-bundled launch
282
- modes. Add signed/self-contained artifacts where each platform permits.
283
- - Covers: FR-1, FR-2.
284
- - Complete: build-time version injection and a runtime layout abstraction
285
- preserve adjacent-script npm installs while allowing one Node SEA executable
286
- to serve the public CLI and reserved private Broker/janitor roles. Packed
287
- global npm, local npm/npx, and product-owned absolute-path launches pass
288
- black-box version, bridge, Broker startup, and cleanup tests. Native bundles
289
- include actual-state signature metadata, SHA-256 manifests, licenses, and
290
- platform archives; macOS Developer ID/notarization and Windows Authenticode
291
- hooks activate only with complete credentials, while unsigned/ad-hoc state
292
- remains explicit. Release CI uses fixed official Node 22.17.0 native runners
293
- and verifies every artifact before publishing it.
294
-
295
- ### A7. Agent-neutral integration kit
296
-
297
- - [x] **A7.1** Publish the process adapter contract: launch, initialize,
298
- manifest registration, tool calls, event handling, Artifact conversion, and
299
- cleanup.
300
- - Covers: AC-2, AC-6.
301
- - [x] **A7.2** Build a language-neutral conformance runner that treats the
302
- executable as a black box.
303
- - Covers: FR-2 through FR-7.
304
- - [x] **A7.3** Add Tenon and OpenClaw adapters as separate examples or consumer
305
- changes. Keep their lifecycle mapping out of Browser Pilot production code.
306
- - Covers: DEC-1, CON-3.
307
- - Complete: source-only Tenon and OpenClaw adapters consume only
308
- `bridge --stdio`, runtime `tools/list`, and protected Artifact files. They
309
- map Thread/Turn and Agent-session/run lifecycles to transient
310
- Workspace/Lease contexts, require explicit targets, derive Command identity
311
- from host tool-call IDs, convert screenshots to native image content, export
312
- files to host-owned absolute paths, explicitly acknowledge processed event
313
- cursors, and invalidate local state on failed cleanup. Concurrent begin,
314
- initialization/release failure, cursor recovery, media conversion, bounded
315
- model text, structured errors, and unknown outcomes are covered by process
316
- tests. The examples remain excluded from the npm package and no
317
- Agent-specific concept enters production code.
318
- - [x] **A7.4** Update the Agent skill to teach direct one-shot use and embedded
319
- stdio use without assuming a particular Agent runtime.
320
- - Covers: FR-1, AC-1.
321
-
322
- ## Cross-Workstream Dependencies
323
-
324
- - A0.2 and B0.1 jointly own the Observation/ref public contract.
325
- - A1 exposes internal service interfaces; B1-B4 implement improved behavior
326
- behind those interfaces.
327
- - A2 target actors provide B3 action ordering and document-change cancellation.
328
- - A4 events depend on B4 event producers but can be tested initially with
329
- synthetic Broker events.
330
- - A5 Artifact delivery is required before B5 screenshot guidance is complete.
331
-
332
- ## Release Gate
333
-
334
- Workstream A is complete only when AC-1 through AC-7 pass, existing CLI tests
335
- remain green, two concurrent reference clients are isolated, all eligible user
336
- tabs are combined with the Agent's managed tabs without a grant step, bulk
337
- cleanup leaves user tabs open, Host-disabled operations fail before dispatch,
338
- and a client can send a screenshot Artifact to its runtime's native image
339
- content without an SDK or MCP dependency.
8
+ Allow any shell-capable Agent to control the user's eligible Chrome tabs by
9
+ installing the Browser Pilot skill and invoking the same `bp` CLI, whether the
10
+ CLI was installed by the Agent or bundled by an Agent product.
11
+
12
+ ```text
13
+ Agent -> skill -> existing shell tool -> bp CLI -> shared Broker -> Chrome
14
+ ```
15
+
16
+ The integration must not require an extension, MCP, Native SDK, native Browser
17
+ Pilot tools, a persistent adapter, or Agent-specific runtime code.
18
+
19
+ ## Decisions
20
+
21
+ - [x] Keep one public Agent interface: skill plus CLI.
22
+ - [x] Keep the Broker and CDP transport private.
23
+ - [x] Use stable `BROWSER_PILOT_CLIENT_KEY` values for independent Agents.
24
+ - [x] Preserve logical Agent state across short-lived CLI calls.
25
+ - [x] Expose all eligible managed and user-opened tabs.
26
+ - [x] Keep user tabs open during release and crash cleanup.
27
+ - [x] Leave task-intent permission policy to the Agent host.
28
+ - [x] Support product bundling by putting a pinned CLI on the Agent `PATH`.
29
+ - [x] Support Apple Silicon macOS, x64 Linux, and x64 Windows only.
30
+
31
+ ## Workstream A: CLI Contract
32
+
33
+ - [x] Provide stable JSON success and error results.
34
+ - [x] Add stable error codes to parser, input, service, and browser failures.
35
+ - [x] Make `--client-key` discoverable in top-level help.
36
+ - [x] Add `bp status` with service, browser, selected state, command state, and
37
+ structured recovery.
38
+ - [x] Add bounded `bp commands`, `bp command`, and `bp cancel` commands.
39
+ - [x] Add global `--request-id` and deterministic idempotent recovery.
40
+ - [x] Add global `--timeout` and best-effort cancellation on process signals.
41
+ - [x] Add browser-visible `bp wait` conditions.
42
+ - [x] Add download list/export commands.
43
+ - [x] Add `BROWSER_PILOT_OUTPUT_DIR` and structured file metadata.
44
+ - [x] Keep `bp --help` as the canonical runtime command inventory.
45
+
46
+ ## Workstream B: Shared State and Concurrency
47
+
48
+ - [x] Replace global active-tab/ref files with Broker-owned keyed state.
49
+ - [x] Isolate selected profile, target, frame, refs, auth, network rules,
50
+ downloads, and commands by Agent key.
51
+ - [x] Serialize commands per physical tab and allow independent tabs to run in
52
+ parallel.
53
+ - [x] Enforce one controlling Agent per physical user tab.
54
+ - [x] Return stable `target_busy` rather than stealing control.
55
+ - [x] Reclaim expired state and managed targets.
56
+ - [x] Preserve user tabs on Agent release and crash cleanup.
57
+ - [x] Invalidate browser-generation-scoped state after reconnect.
58
+
59
+ ## Workstream C: Cross-Installation Broker Reuse
60
+
61
+ - [x] Negotiate compatibility by protocol rather than executable path.
62
+ - [x] Allow compatible global and product-bundled CLIs to share one Broker.
63
+ - [x] Keep one stable Agent principal across compatible CLI versions.
64
+ - [x] Use separate internal client sessions when compatible versions differ.
65
+ - [x] Let `bp disconnect` release the invoking Agent's namespace from any
66
+ compatible installation.
67
+ - [x] Require exact executable identity only for whole-Broker shutdown.
68
+ - [x] Refuse incompatible protocol clients without replacing the live Broker.
69
+ - [x] Support explicit incompatible isolation through `BROWSER_PILOT_HOME`.
70
+
71
+ ## Workstream D: Product Embedding
72
+
73
+ - [x] Document one generic integration for Tenon, OpenClaw, and other Agents.
74
+ - [x] Require the complete skill and a normal command runner.
75
+ - [x] Require a pinned native CLI or npm CLI plus pinned Node runtime.
76
+ - [x] Put the bundled CLI directory on the Agent command environment's `PATH`.
77
+ - [x] Inject a stable client key per logical Agent.
78
+ - [x] Inject a task-owned absolute output directory.
79
+ - [x] Return files by absolute path for the host's existing image/file tools.
80
+ - [x] Avoid command-to-native-tool mapping and permanent tool-schema context.
81
+ - [x] Keep Agent-managed and bundled installs on the same behavior path.
82
+
83
+ ## Workstream E: Skill and Documentation
84
+
85
+ - [x] Keep the main skill focused on the browser operating loop.
86
+ - [x] Split command, recovery, async, and embedding details into on-demand
87
+ references.
88
+ - [x] Remove internal state IDs and transport concepts from Agent guidance.
89
+ - [x] Document all eligible user tabs and explicit user-tab close behavior.
90
+ - [x] Document Chrome profile identity and routing.
91
+ - [x] Document tab-group control limitations without limiting grouped tabs.
92
+ - [x] Document local screenshot, PDF, download, and network-body results.
93
+ - [x] Document stable request recovery and uncertain mutation rules.
94
+
95
+ ## Workstream F: Distribution
96
+
97
+ - [x] Keep CLI, plugin, skill compatibility, and marketplace versions synced
98
+ from the root package version.
99
+ - [x] Publish a release index binding CLI, skill range, protocol, platforms,
100
+ checksums, and tested version.
101
+ - [x] Exclude Intel Mac assets.
102
+ - [x] Verify global, local, and product-bundled npm use.
103
+ - [x] Verify native archives do not need system Node.
104
+ - [x] Bump the next release version and produce local release artifacts.
105
+ - [ ] Publish the npm package, plugin archive, native archives, checksums, and
106
+ release index.
107
+
108
+ ## Acceptance Criteria
109
+
110
+ - [x] An Agent can install Browser Pilot itself and follow the skill.
111
+ - [x] A product can bundle Browser Pilot without adding native browser tools.
112
+ - [x] Two Agent products can share one Broker with isolated state.
113
+ - [x] A compatible bundled CLI can use a Broker started by a global CLI.
114
+ - [x] A compatible non-owner CLI can disconnect cleanly without stopping that
115
+ Broker.
116
+ - [x] Every eligible user-opened tab can be selected and controlled.
117
+ - [x] The same physical tab cannot be controlled by two Agents concurrently.
118
+ - [x] Browser authorization is requested only by explicit connection.
119
+ - [x] Stable request IDs prevent duplicate dispatch during recovery.
120
+ - [x] Screenshots, PDFs, downloads, and saved bodies are available as local
121
+ files with structured metadata.
122
+ - [x] Removed persistent adapter commands are absent from CLI help and release
123
+ packages.
124
+ - [x] Full unit, Playwright, distribution, standalone, and controlled real
125
+ Chrome release gates pass for the new version.