234 Commits

Author SHA1 Message Date
yan5xu bc76ed80de chore: release v0.12.0 v0.12.0 2026-05-25 19:53:31 +08:00
yan5xu 6837152c8e feat(daemon): auto-download and manage Chrome headless-shell (#120)
Daemon now automatically downloads and launches Chrome headless-shell
when started. No need to install Chrome separately.

- Downloads from Pinix COS (unified source for all platforms)
- Supports mac-arm64, mac-x64, linux64, linux-arm64
- Stores at ~/.bb-browser/browser/chrome-headless-shell-<platform>/
- Manages Chrome lifecycle: start on daemon start, kill on shutdown
- --no-chrome flag to skip (use external Chrome)
- Tested on macOS ARM64, Docker linux/amd64, Docker linux/arm64
2026-05-25 19:38:58 +08:00
yan5xu f0b2100c32 fix(site-adapter): preload _helper.js before executing site adapters
Site adapters like twitter/search.js reference shared functions defined
in _helper.js (e.g. findTransactionIdGenerator). The runtime was not
loading this helper file, causing ReferenceError at runtime.

Now checks for _helper.js in the same directory as the adapter and
prepends it into the evaluation scope.
2026-05-25 19:13:31 +08:00
yan5xu d882756351 docs: update AGENTS.md with stream lifecycle and view.html heartbeat design 2026-05-24 13:45:56 +08:00
Yanwu e60412f5fd feat(view): heartbeat ping + idle timeout + visibility-based disconnect (#226)
* feat(view): heartbeat ping + idle timeout + visibility-based disconnect

- Send OpPing (0x08) heartbeat every 5s (active) / 10s (idle)
- Visibility change: hidden starts 30s idle countdown, visible cancels
- cleanup(reason): distinct overlay messages for user/idle/network disconnect
- Start heartbeat on DataChannel open, stop on cleanup

* fix(view): use polling instead of setTimeout for idle timeout in hidden tabs

Browsers throttle setTimeout in hidden tabs to >=1 minute (Chrome).
The 30s idle timeout was never firing because the timer was delayed.

Fix: record hiddenSince timestamp on visibilitychange, check elapsed
time on each heartbeat interval tick instead of relying on setTimeout.

* fix(view): fire-and-forget stream.close to prevent disconnect from hanging

disconnect() was awaiting invoke('stream.close') which could hang if
the server is slow or the connection is degraded. This blocked cleanup()
from running, so the UI stayed in 'connected' state and heartbeat
continued indefinitely.

Fix: fire stream.close without awaiting, then immediately cleanup.
2026-05-24 13:40:00 +08:00
yan5xu e60463d8a9 docs: update AGENTS.md for new architecture
- Three CDP connections (controlConn/inputConn/captureConn)
- Protocol 1 (CLI↔daemon) and Protocol 2 (daemon↔streamer)
- Unified command definitions
- --hub mode, no standalone provider
- --tab required policy
2026-05-24 10:27:05 +08:00
yan5xu c7d4d94c3d fix: unwrap streamer result in hub-bridge stream.* handlers
Streamer returns {result: {...}} but hub-bridge was passing the
entire envelope to Hub invoke. Frontend received
{result: {offer_sdp: ...}} instead of {offer_sdp: ...}, causing
offer_sdp to be undefined and video blackscreen.

Unwrap resp.result for stream.start/answer/close/switch.
2026-05-22 22:12:47 +08:00
yan5xu 057ab7872c refactor: unified command definitions (commands.ts)
Single source of truth for all command metadata:
- ParamDef with type, required, position, description
- CommandDef with method, group, description, requiresTab, params
- commandToJsonSchema() for Hub registration
- getCommand() / getCommandsByGroup() helpers

Hub registration now uses COMMANDS directly instead of
hardcoded arrays. Removed zod dependency from shared package.

CLI and daemon dispatch unchanged — they can consume COMMANDS
in a future refactor.
2026-05-22 20:24:45 +08:00
yan5xu 811ae49592 fix: daemon lifecycle — stop stale daemon on startup and CDP port mismatch (#224)
- stopDaemon(): 3-phase shutdown (HTTP → wait → SIGKILL)
- ensureDaemon(): detect CDP port mismatch, stop old daemon before respawn
- Daemon startup: cleanupStaleDaemon() kills orphan processes
- Fixes stale daemon persisting across provider/daemon restarts
2026-05-22 20:18:35 +08:00
yan5xu 7fe310a1c6 chore: remove standalone provider (bb-browser-provider.ts)
Daemon --hub mode replaces the standalone provider. All Hub
connection, clip registration, and invoke handling is now in
packages/daemon/src/hub-bridge.ts.

Also remove provider entry from tsup release build.
2026-05-22 19:46:35 +08:00
yan5xu 822d0788a4 refactor: rename view.* to stream.*, update Clip Web UI
Hub registration:
- view.start → stream.start
- view.answer → stream.answer
- view.close → stream.close
- Add stream.switch (switch streamer to different tab)

Clip Web UI (view.html):
- Tab management: tab_list, tab_new, close (standard daemon commands)
- Tab switching: stream.switch with tab short ID
- Navigation: open/back/forward/reload with --tab
- All nav commands pass activeTabId explicitly

New: getTabCdpUrl() resolves short tab ID → CDP WebSocket URL
2026-05-22 19:46:00 +08:00
yan5xu 9fdff2e0b3 refactor: update hub-bridge for Protocol 2 streamer API
- stream.start → /command {method:'connect', params:{cdpUrl}}
- stream.answer → /command {method:'answer', params:{...}}
- stream.close → /command {method:'stop'}
- Remove view.tab_*/navigate/back/forward/reload routing
- ensureStreamer() no longer passes --cdp-port
- Add getCurrentTabCdpUrl() to resolve CDP WebSocket URL
2026-05-22 19:32:50 +08:00
yan5xu 635443fe05 feat: Phase 4 — merge provider into daemon with --hub mode
Daemon can now connect to Pinix Hub directly via --hub flag:
  bb-browser daemon --hub https://hub.pinixai.com --hub-token xxx

New: packages/daemon/src/hub-bridge.ts (1042 lines)
- HubBridge class with gRPC ProviderStream connection
- Clip registration (browser clip + platform clips)
- Invoke handling calls dispatchRequest() directly (no HTTP round-trip)
- Streamer (bb-viewer) lifecycle management
- Clip Web UI serving
- TURN credential generation
- Data command file I/O

Key improvement: browser commands invoked via Hub are dispatched
directly in-process instead of HTTP POST to daemon, eliminating
one network hop.

bin/bb-browser-provider.ts kept as-is for backward compat.
2026-05-22 19:02:50 +08:00
yan5xu 8559b772c9 refactor: Phase 2 — new protocol format, command renames, --tab required
Protocol:
- action → method, success/data/error → result/error (mutually exclusive)
- Remove id field from Request/Response
- Error is now {message, hint} object, not plain string
- HTTP method filter renamed: method → httpMethod (avoids conflict)

Command renames:
- snapshot → snap
- refresh → reload
- Remove tab_select (use open --tab)
- Remove tab_close (use close --tab)

--tab required:
- Most commands require --tab, error with hint if missing
- Exceptions: open (optional), site (auto-match domain), tab list/new, daemon

Removed commands:
- fetch (use eval or site run)
- wait (agent polls snap)
- history (not browser control)

Other:
- get supports all 5 attributes (text/url/title/value/html)
- -1400 lines across 36 files
2026-05-22 18:45:35 +08:00
yan5xu c7bd48a900 feat: move site adapter execution from CLI to daemon (Phase 3)
- New: packages/daemon/src/site-adapter.ts — site adapter scanning,
  @meta parsing, domain-based tab matching, and JS evaluation via CDP
- Daemon: add site_run, site_list, site_info, site_search actions
- CLI: site commands now send HTTP to daemon instead of executing locally
- Provider: executeSiteCommand uses daemon site_run instead of shelling
  out to CLI subprocess (removes execFile dependency)
- Protocol: add siteName, siteArgs, query fields to Request type

Site adapter execution is now a single path: CLI/Provider → daemon
→ CDP evaluate. No more three-layer process nesting.
2026-05-22 17:44:58 +08:00
yan5xu 7bb8cd1624 refactor: Phase 1 cleanup — remove MCP, dead code, unify CDP port
- Remove packages/mcp/ entirely (Agent uses CLI or Hub invoke)
- Remove dead code: reload.ts (never routed)
- Unify default CDP port to 9222 (daemon was 19825, viewer was 9222)
- Remove --mcp CLI flag
- Update comments to reflect MCP removal
2026-05-22 17:16:42 +08:00
yan5xu 6f7aeefa9c fix(view): correct mouse button mapping and clean up dead code
Fix left-click being sent as middle-click: mapButton was converting
Web API button 0 (left) to 1, but bb-viewer uses 0-indexed buttons
(0=left, 1=middle, 2=right). Middle-click on links opens new tabs
in Chrome, which was the root cause of the 'links open in new tab'
bug.

Also remove unused URL bar composition tracking variables and
debug-only url_keydown logging.
2026-05-21 22:54:15 +08:00
yan5xu bf6ab49cf9 fix(view): prevent stuck modifier keys on remote Chrome
Three fixes for modifier keys getting stuck:
- URL input capture-phase keyup no longer stops propagation for
  modifier keys (Shift/Ctrl/Alt/Meta), allowing them to reach the
  document-level onKeyUp handler
- Clicking the video overlay sends keyUp for all modifiers to clear
  any stuck state from URL bar interactions
- Window focus event resets all modifiers to handle Cmd+Tab scenarios

Also add version indicator (v9) for debugging cache issues.
2026-05-21 22:45:20 +08:00
yan5xu 03f7604ae3 feat(view): route tab/nav commands through bb-viewer
Route tab_list, tab_switch, tab_new, tab_close, navigate, back,
forward, reload through bb-viewer API instead of daemon. This ensures
tab operations and video stream operate on the same Chrome instance
and CDP session.

Also fix URL bar: skip polling overwrite when input is focused,
and simplify Enter key handling to avoid IME false suppression.
2026-05-21 20:34:16 +08:00
yan5xu f73d03551a fix(provider): pass CDP_PORT to daemon when spawning
When CDP_PORT is set, forward it as --cdp-port to the daemon process
so both daemon (tab operations) and bb-viewer (screencast) connect
to the same Chrome instance. Without this, daemon defaults to 19825
(GUI Chrome) while bb-viewer uses the CDP_PORT value, causing tab
list and video stream to reference different Chrome instances.
2026-05-21 20:06:48 +08:00
Yanwu bad09debe1 fix(web): polish remote viewer UI (#223)
- Green connect button, red disconnect state
- Video overlay with centered status text when disconnected
- Input overlay with crosshair cursor for mouse capture
- Tab/URL bar dimmed when not connected
- Slimmer toolbar (32px), webkit scrollbar styling
- Status resolution aligned right
2026-05-21 18:30:43 +08:00
Yanwu 80e4e37056 feat(web): add tab bar, URL bar, and debug panel to remote viewer (#222)
- Tab bar: list/switch/create/close tabs via invoke, 5s polling
- URL bar: address input, back/forward/reload, IME-aware Enter
- Debug panel: event log with timestamps, toggle Ctrl+Shift+D, copy/clear
- Status bar: connection dot, resolution display, debug toggle
- Matches bb-viewer index.html dark theme styling
2026-05-21 18:24:48 +08:00
Yanwu 4815d776c1 feat: remote browser viewing via Clip Web UI (#220)
* feat(daemon): expose CDP host/port in daemon.json and /status

- Add cdpHost, cdpPort to DaemonInfo (optional in shared, required in daemon)
- Write cdpHost/cdpPort from discovered cdpEndpoint to daemon.json
- Return cdpHost/cdpPort in GET /status response
- Enables external tools (bb-viewer) to discover the Chrome CDP connection

* feat(provider): add view.start/answer/close commands + bb-viewer sidecar management

- Register view.start, view.answer, view.close commands in browser clip
- Viewer sidecar: auto-spawn bb-viewer on first view.start, kill on exit
- Read CDP info from daemon.json (cdpHost/cdpPort) for viewer config
- TURN config from env vars: TURN_URL, TURN_USER, TURN_CRED
- bb-viewer binary lookup: ~/.bb-browser/bin/bb-viewer or PATH fallback
- Sidecar health check with 10s startup timeout

* feat(provider): add Clip Web UI for remote browser viewing

- web/view.html: remote viewer page using @pinixai/core/web invoke()
  - WebRTC video with playoutDelayHint=0 for low latency
  - DataChannel binary input: mouse, keyboard, scroll, IME
  - X11 keysym mapping, composition handling
  - Connect/Disconnect with auto-cleanup
- provider: set hasWeb=true for browser clip
- provider: handle GetClipWebCommand to serve web/ files
  - MIME type detection, ETag, range request support
  - Path security validation

* feat(provider): TURN ephemeral credentials via TURN REST API

- Generate time-limited TURN credentials using HMAC-SHA1 shared secret
- Credentials valid for 24h, auto-generated at viewer sidecar spawn
- Config: TURN_URL + TURN_SECRET env vars (no user-facing config needed)
- Replaces static TURN_USER/TURN_CRED with secure ephemeral credentials

* fix(web): replace esm.sh import with direct /api/ fetch

@pinixai/core is a private package, not available on esm.sh.
Use direct fetch to /api/{command} which the Hub's subdomain
handler proxies to provider invoke.
2026-05-21 18:01:49 +08:00
github-actions[bot] 7ceb9e9ff5 chore(main): release bb-browser 0.11.6 (#214)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
bb-browser-v0.11.6
2026-05-11 18:01:40 +08:00
yan5xu ba86f0c38c feat(daemon): screenshot saves to clip data and returns pinix:// URI
Screenshot command now writes PNG to ~/.pinix/data/browser/screenshots/
and returns a pinix:// URI by default. Base64 dataUrl is only included
when explicitly requested (includeBase64 flag), keeping the response
lightweight for cross-clip consumption.

CLI screenshot command sets includeBase64 for local file saving.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-11 17:54:21 +08:00
yan5xu 0ddcca6b66 feat(provider): handle DataCommand for clip data protocol
bb-browser provider now processes DataCommand from the Hub, supporting
read/write/list/delete/stat on per-clip data directories (~/.pinix/data/).
This enables pinix://browser/... URIs to work for cross-clip file sharing.

Updated @pinixai/hub-client to ^0.2.0 for Data protocol types.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-11 17:47:52 +08:00
github-actions[bot] 46a8aff93a chore(main): release bb-browser 0.11.5 (#208)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
bb-browser-v0.11.5
2026-05-07 16:19:02 +08:00
yan5xu 1938ce46b1 fix(snapshot): clean up stale highlight overlays before each snapshot and screenshot
Highlights accumulated across multiple snapshot calls because the
cleanup function was commented out. Now buildDomTree clears previous
overlays at the start, and screenshot removes them before capture.

Closes #173

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-07 15:21:48 +08:00
github-actions[bot] 3494cb1d65 chore(main): release bb-browser 0.11.4 (#196)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
bb-browser-v0.11.4
2026-05-07 09:23:50 +08:00
Yanwu c0b4ff1691 fix(cli): daemon self-healing on CDP disconnect + cookie persistence (#207)
* fix(cli): daemon self-healing on CDP disconnect + cookie persistence

- ensureDaemon() now checks cdpConnected from /status response; when
  Chrome is killed and daemon loses its CDP WebSocket, the stale daemon
  is stopped and a fresh daemon+Chrome is spawned automatically instead
  of returning 503 on every command.

- daemon status command shows actionable hints: how to start when not
  running, how to stop when running, and a warning with recovery steps
  when CDP is disconnected.

- Add --use-mock-keychain to managed Chrome launch args so cookie
  encryption uses a fixed key instead of macOS Keychain. This fixes
  cookie persistence on headless/remote machines (e.g. Mac Mini via SSH)
  where Keychain access is unavailable (errSecInteractionNotAllowed).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(cli): add `daemon start` subcommand for explicit background startup

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-07 09:20:46 +08:00
yan5xu 561c002619 fix(provider): preserve large integer precision in decodeInput
Hub may send IDs (Twitter, Snowflake) as JSON numbers which exceed
Number.MAX_SAFE_INTEGER. Wrap integers >=16 digits as strings before
JSON.parse to prevent silent precision loss.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-19 11:06:19 +08:00
github-actions[bot] 71cd8baf11 chore(main): release bb-browser 0.11.3 (#174)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
bb-browser-v0.11.3
2026-04-09 22:39:05 +08:00
Yanwu 0da5e48a75 fix: preserve structured error from site CLI in provider (#187)
When a site CLI command exits non-zero, prefer stdout (which contains
structured JSON with error/hint) over stderr (which is often empty),
so callers receive actionable error messages instead of generic
"Command failed: node ..." text.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 22:36:48 +08:00
Yanwu 3a24359ac6 feat: warn when local adapter overrides community version (#178) (#179)
When running a site adapter that exists in both ~/.bb-browser/sites/
(local) and ~/.bb-browser/bb-sites/ (community), print a warning to
stderr so users know they're running a local override that may be
outdated. Suppressed in --json mode.

Closes #178

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 09:32:47 +08:00
Yanwu 03c6bf2010 refactor: provider rewrite + cleanup (-1891 lines) (#176)
* refactor: rewrite Edge Clip provider using @pinixai/hub-client (#175)

Replace hand-written protobuf descriptor in bb-browserd.ts with typed
imports from @pinixai/hub-client. The new bb-browser-provider.ts uses
create() from @bufbuild/protobuf with generated schemas, registers site
adapters as separate per-platform clips, and routes invocations to
either the daemon HTTP layer (browser commands) or CLI (site commands).

- Delete bin/bb-browserd.ts (1140 lines)
- Add bin/bb-browser-provider.ts (~710 lines)
- Add @pinixai/hub-client dependency
- Add bb-browser-provider bin entry and tsup entry point
- Add esbuild plugin to resolve hub-client gen subpath import

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: import from @pinixai/hub-client top-level exports

Use hub-client 0.1.2 which exports ProviderStream types directly.
Remove esbuild plugin hack for deep gen/hub_pb import.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: delete dead CDP code, fix MCP auth, extract shared daemon client

- Delete cdp-client.ts (1212 lines), cdp-monitor.ts (521 lines),
  cdp-monitor-state.ts (182 lines) — all dead code from pre-daemon era
- Fix MCP server to read daemon.json for token/port instead of
  hardcoded DAEMON_BASE_URL without auth
- Extract httpJson, readDaemonJson, isProcessAlive, DaemonInfo to
  packages/shared/src/daemon-client.ts — eliminates duplication across
  CLI daemon-manager, MCP server, and Edge Clip provider
- Fix scroll left/right: deltaX was hardcoded to 0, now properly
  maps direction to deltaX/deltaY
- Align daemon tsup target from node20 to node18 (matches engines)
- Remove cdp-monitor from tsup entry points

Net: -1891 lines

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: lint — use DAEMON_DIR from shared, remove unused os import

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: review feedback — refresh platformClipAliases on reconnect, remove dead DAEMON_BASE_URL

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: remove duplicate bun shebang from provider source

tsup adds #!/usr/bin/env node via banner config. The source file's
#!/usr/bin/env bun caused a double shebang in dist/provider.js,
breaking node execution.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 06:04:43 +08:00
Yanwu fd0d7956e2 feat: unified command registry for CLI/MCP/Edge Clip (#171)
* feat: add unified command registry (shared/commands.ts)

Single source of truth for all 30+ commands. CLI/MCP/Edge Clip
will auto-generate interfaces from this registry.

Part of #170

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: complete command registry (history args, fetch, site commands)

- Add missing `query` and `days` args to `history` command
- Add 6 site commands: site_list, site_search, site_info, site_recommend,
  site_run, site_update (category: "site")
- Verified `tab_new` is a real dispatch case (handled before ensurePageTarget)
- Verified `get` attribute enum is complete (text, url, title, value, html)
- Confirmed `fetch` is CLI-only (composes eval), not a daemon action — skip

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: use Zod schemas in command registry

Replace custom CommandArg interface with Zod schemas for runtime
validation, JSON Schema generation, and zero-conversion MCP integration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: MCP + Edge Clip auto-generate from command registry

MCP: 25 → 37 tools, auto-generated from COMMANDS registry.
13 new tools: back, forward, refresh, check, uncheck, select,
dialog, frame, frame_main, tab_select, tab_close, trace, history.
Special handlers preserved for snapshot/screenshot/eval/network etc.

Edge Clip: 7 → 37 commands. Removed all direct CDP code (~400 lines).
Now routes through daemon HTTP API like CLI and MCP.
Uses inline zod-to-json-schema converter for Hub registration.

Adding a new command = 1 registry entry + 1 dispatch case.
All three interfaces (CLI/MCP/Edge Clip) get it automatically.

Part of #170

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address review issues (since type, MCP compat, description loss, scroll default)

- Fix since field type: use z.union([z.literal("last_action"), z.number()])
  instead of z.string() for network/console/errors commands
- Add MCP backward compat: accept old arg names (time, command) alongside
  new ones (ms, networkCommand, consoleCommand, errorsCommand)
- Fix bb-browserd ZodOptional/ZodDefault unwrap losing outer description
- Fix typo: executeViaDeamon → executeViaDaemon
- Remove unnecessary tab arg from history command (daemon mode unsupported)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: prefix unused cmd params with underscore for lint

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: route Edge Clip site commands through CLI instead of daemon

Site commands (site_list, site_run, etc.) are handled by CLI, not
daemon. Edge Clip now routes them via CLI execFile, matching MCP's
approach. Other commands still go through daemon HTTP API.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: Edge Clip site commands use installed bb-browser CLI, not source

bun running CLI source fails because __BB_BROWSER_VERSION__ is a tsup
define not available at runtime. Use installed bb-browser binary with
fallback to dist/cli.js.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 22:16:28 +08:00
Yanwu cbd4e12a6f Merge pull request #156 from epiral/release-please--branches--main--components--bb-browser
chore(main): release bb-browser 0.11.2
bb-browser-v0.11.2
2026-04-03 10:55:52 +08:00
github-actions[bot] 8f67c7bb2f chore(main): release bb-browser 0.11.2 2026-04-03 02:55:02 +00:00
Yanwu 67efdd38fd fix: CDP 503 returns diagnostics immediately instead of 30s timeout (#157)
When Chrome disconnects or CDP connection fails, the daemon now:
- Returns 503 immediately instead of waiting 30 seconds
- Includes CDP target address, failure reason, and remediation hint
- Stores lastError in CdpConnection for diagnostic context

Before: {"error":"CDP connection timeout"} after 30s wait
After:  {"error":"Chrome not connected (CDP at host:port)","reason":"...","hint":"..."} immediately

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 10:54:48 +08:00
Yanwu 1931c55841 fix: remove extension packaging from publish workflow (#155)
Extension was removed in 0.11.0. Also removes one-time release-as override.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 09:46:02 +08:00
Yanwu e7f1e5c4b4 Merge pull request #135 from epiral/release-please--branches--main--components--bb-browser
chore(main): release bb-browser 0.11.1
bb-browser-v0.11.1
2026-04-03 09:36:39 +08:00
github-actions[bot] 4b575e007f chore(main): release bb-browser 0.11.1 2026-04-03 01:24:15 +00:00
Yanwu 9435d677fc chore: force release as 0.11.1 (#154)
Breaking changes (Extension removal) were already shipped in 0.11.0.
This release is bug fixes only (daemon auto-launch Chrome).

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 09:23:24 +08:00
Yanwu e857cdd590 chore: configure release-please for pre-1.0 versioning (#153)
Add bump-minor-pre-major and bump-patch-for-minor-pre-major so
breaking changes bump minor (not major) while version is 0.x.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 09:18:56 +08:00
Yanwu 9243517f18 fix: auto-launch Chrome when daemon starts (#152)
* fix: auto-launch Chrome when daemon starts (#136, #143, #141)

CLI's ensureDaemon() now discovers/launches Chrome via cdp-discovery
before spawning the daemon, and passes --cdp-host/--cdp-port to it.
Previously the daemon was spawned with no CDP info, failed silently,
and users got "Daemon did not start in time" for every command.

- CLI: call discoverCdpPort() before spawn, pass CDP endpoint to daemon
- CLI: improve error messages with specific remediation steps
- CLI: increase startup timeout from 5s to 10s (Chrome launch time)
- MCP: read managed port file and pass --cdp-port to daemon
- Tests: 8 new daemon-startup tests reproducing and verifying the fix
- Tests: fix daemon-lifecycle tests (unique ports, tsx runner, proper cleanup)

Closes #136, closes #143, relates to #141, #118, #146

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: remove unused variable in MCP ensureDaemon

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: fix daemon-lifecycle kill-9 assertion for parallel CI

Relax PID equality assertion since parallel test suites share
daemon.json in CI. Assert file existence and valid structure instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Revert "test: fix daemon-lifecycle kill-9 assertion for parallel CI"

This reverts commit ba572d0f2a.

* fix: isolate test suites with BB_BROWSER_HOME to avoid parallel conflicts

Daemon and CLI tests both spawn daemon processes that write to
~/.bb-browser/daemon.json. When turbo runs them in parallel, they
conflict. Fix by:
- Support BB_BROWSER_HOME env var in daemon and daemon-manager
- Each test suite uses its own temp dir via BB_BROWSER_HOME

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: use DAEMON_DIR for managed port file path in daemon

The managed port file path was hardcoded to ~/.bb-browser/browser/cdp-port
ignoring BB_BROWSER_HOME. This broke test isolation in CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 09:15:08 +08:00
yan5xu 6d52b22601 fix: consolidate daemon state into daemon.json with PID liveness check
Replace separate PID file (/tmp/bb-browser.pid) and token file
(~/.bb-browser/daemon.token) with a single ~/.bb-browser/daemon.json
containing pid, host, port, and token.

CLI now reads daemon.json to connect, using the actual bound address
instead of hardcoded DAEMON_HOST. PID liveness check via process.kill(0)
detects stale daemon.json from crashed processes and auto-recovers.

Add harness tests for PID strategy and cold-start recovery scenario.

Closes #140

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 05:48:25 +08:00
yan5xu 7936566ec5 feat!: remove Chrome Extension package
Move buildDomTree.js to packages/shared/. Delete packages/extension/
entirely. Update path references in daemon and CLI. Remove
build:extension script and release-please manifest sync.

The daemon connects directly to Chrome via CDP WebSocket since v0.11.0.
The Extension is no longer needed.

BREAKING CHANGE: Chrome Extension is removed. Users who relied on the
extension-based flow should use the daemon-direct mode instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 05:33:17 +08:00
Xeon 37f8d64959 fix: align daemon host defaults and restore daemon command (#137) 2026-04-02 05:29:36 +08:00
yan5xu 98d656cc7f chore: sync release-please manifest to v0.11.0
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 16:08:29 +08:00
haibinwang9 208643638e feat(cli): support cdpUrl and cdpHost from OpenClaw (#70)
* feat(cli): support cdpUrl and cdpHost from OpenClaw

- Prioritize cdpUrl field for full CDP endpoint URL
- Fall back to cdpHost + cdpPort if cdpUrl not available
- cdpHost defaults to 127.0.0.1 when not specified

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(cli): increase openclaw timeout to 30s

* perf(cli): add env var and file cache for CDP discovery

---------

Co-authored-by: User <user@example.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 16:01:04 +08:00