Files
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

27 lines
601 B
JSON

{
"name": "@bb-browser/cli",
"version": "0.0.1",
"private": true,
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"bin": {
"bb-browser": "./dist/index.js"
},
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"test": "tsx --test src/openclaw-json.test.ts src/openclaw-bridge.test.ts src/__tests__/daemon-startup.test.ts"
},
"dependencies": {
"@bb-browser/shared": "workspace:*"
},
"devDependencies": {
"@types/node": "^20.0.0",
"tsx": "^4.20.6",
"tsup": "^8.0.0",
"typescript": "^5.3.0",
"ws": "^8.19.0"
}
}