181 Commits

Author SHA1 Message Date
yan5xu 8ceed8c978 release: v0.11.0
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v0.11.0
2026-04-01 15:49:20 +08:00
Yanwu fb1a9b0644 chore: add harness — tests, CI, protocol types, design invariants (#133)
* chore: add harness — tests, CI, protocol types, design invariants

Context layer:
- Rewrite AGENTS.md: new daemon architecture, 3-file command pattern,
  7 design invariants (INV-1 through INV-7), testing section
- Update protocol.ts: add tab/seq/cursor/since fields, update
  DaemonStatus, remove SSE types, widen TabInfo.tabId to string

Constraints layer:
- Unit tests: RingBuffer (14), TabState + TabStateManager (36)
- Contract tests: all 7 invariants verified (48)
- Protocol drift tests: real daemon HTTP response shape checks (13,
  skipped when Chrome unavailable)
- CI workflow: build + lint + test on push/PR to main
- Pre-commit hook: pnpm build && pnpm test via husky

GC layer:
- Harness scenarios doc: 6 reusable Agent workflow scenarios for
  periodic UX validation

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

* fix: resolve lint errors caught by CI

- Remove unused imports (TabState, TabInfo, JsonObject, Response)
- Remove unused variable assignments in tests (r1-r4)
- Change `let items` to `const items` in command-dispatch
- Remove stale eslint-disable directive, use proper cast
- Exclude .d.ts files from eslint in daemon package

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

* fix: address Codex review findings

- cursor returns since threshold instead of 0 on empty results,
  preventing infinite re-fetch in incremental polling loops
- Guard shutdown against double-call (SIGINT + /shutdown race)
- Fix timer leak in discoverCdpPort when fetch fails

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

* docs: update READMEs — remove Extension references, update architecture diagram

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-01 15:47:10 +08:00
Yanwu 62af1f89d7 refactor: unify daemon — CDP direct, remove Extension dependency (#132)
Merge daemon + cdp-monitor into a single CDP-direct backend. All CLI
and MCP commands now route through the daemon HTTP API instead of
direct CDP connections or Extension relay.

Key changes:
- Daemon: rewrite to hold persistent CDP WebSocket, handle all 30+
  commands via dispatchRequest, per-tab event state with RingBuffer,
  short tab IDs (4-char hex), global seq counter, incremental queries
  via since/cursor mechanism
- CLI: all commands route through daemon HTTP, --tab accepts string
  short IDs, add --since/--method/--status flags for network queries,
  fix tab close with --tab flag, fix invalid tab ID silent fallback
- MCP: tab parameter z.number() → z.string(), add browser_console
  and browser_errors tools, add since/method/status/limit params to
  browser_network, remove Extension dependency hints
- Shared: export additional types for daemon consumption

Bug fixes from harness testing:
- Invalid tab ID now errors instead of silent fallback
- tab_new works with zero existing tabs
- console.warn() correctly captured as type "warn"
- --tab flag works with tab close command

Closes #131

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 11:02:48 +08:00
Yanwu 1fe733b416 feat: auto-launch Chrome in bb-browserd + clip.json (#123)
* fix: auto-reconnect after Hub restart

Two bugs prevented reconnection when pinixd restarts:

1. reconnectTimer was unref'd via maybeUnref(), so it didn't keep the
   event loop alive — the setTimeout callback never fired
2. gRPC transport was reused across reconnects, causing "protocol error:
   missing status" loops from stale HTTP/2 connection state

Fix: remove maybeUnref on reconnect timer, create fresh transport on
each reconnect attempt, remove unused runPromise guard.

Closes #103

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

* feat: auto-launch Chrome when CDP not available in bb-browserd

bb-browserd now automatically starts a managed Chrome instance if no
CDP connection is found, instead of failing with "Chrome not reachable".

Also adds clip.json for Pinix Registry publishing.

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-03-29 17:42:51 +08:00
Yanwu ef4f6849e4 fix: auto-reconnect after Hub restart (#111)
Two bugs prevented reconnection when pinixd restarts:

1. reconnectTimer was unref'd via maybeUnref(), so it didn't keep the
   event loop alive — the setTimeout callback never fired
2. gRPC transport was reused across reconnects, causing "protocol error:
   missing status" loops from stale HTTP/2 connection state

Fix: remove maybeUnref on reconnect timer, create fresh transport on
each reconnect attempt, remove unused runPromise guard.

Closes #103

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 15:34:56 +08:00
yan5xu 7ea9481a0d chore: remove pinix.json — manifest is now runtime-only
Part of manifest file removal across Pinix ecosystem (epiral/pinix#47).
Clip identity comes from package.json; commands/domain/etc from SDK code at runtime.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 15:50:38 +08:00
yan5xu 4ad258994b release: v0.10.1
Fixes:
- fix: remove replMode from CDP evaluate to fix async/Promise results
- fix: open new tabs in background (background: true)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 19:49:09 +08:00
yan5xu 54e02b0265 feat: add pinix.json (Edge Clip manifest) 2026-03-22 18:14:17 +08:00
yan5xu ad3898347a docs: add resilient adapter patterns (structural DOM, webpack discovery)
- Pattern 1: Structural DOM extraction using semantic HTML elements
  instead of CSS classes (Google search example)
- Pattern 2: Dynamic webpack module discovery by source code signatures
  instead of hardcoded module IDs (Twitter/X example)
- Pattern 3: Vue/React internal state access

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 15:31:02 +08:00
yan5xu ea6f08c007 fix: remove replMode from CDP evaluate to fix async/Promise results
replMode: true caused Chrome to treat Promise values as plain objects,
bypassing awaitPromise: true. This made all async site adapters
(twitter/reply, twitter/search, etc.) return empty {} instead of
actual results.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 15:21:57 +08:00
yan5xu b9ee3aaca2 fix: add Chrome Dev/Beta/Canary and Brave to Windows browser candidates
Chrome Dev installs to %LOCALAPPDATA% on Windows, not Program Files.
Without these paths bb-browser falls through to Edge even when Chrome
Dev is installed.

Fixes feedback from @NormanMises_

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 15:05:16 +08:00
yan5xu ee2c404245 fix: follow-up fixes for merged PRs #82, #91, #25
- #82: extract EXEC_TIMEOUT_BUFFER_MS constant for magic number 5000
- #91: remove failed tabs from sessionOpenedTabs to prevent stale entries
- #25: update platform/command counts from 35/97 to 36/103

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 14:40:45 +08:00
aichunyu d65f3c3ca1 docs(skill): 补全 bb-browser skill 文档,新增 site/fetch/network/adapter 参考文档 (#25)
- 更新 SKILL.md:新增 site 系统、fetch 命令、snapshot 高级选项、全局 --tab、MCP 集成、network 高级功能
- 新增 references/site-system.md:35 平台完整列表、自动 tab 管理、参数传递、错误处理
- 新增 references/fetch-and-network.md:带登录态 fetch、域名路由、请求拦截与 mock、API 逆向工程工作流
- 新增 references/adapter-development.md:三层复杂度指南、元数据格式、测试与贡献流程

Co-authored-by: 艾纯禹 <aquaqu@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 14:38:10 +08:00
Ted Li cfa1b0fd8b feat(mcp): add session tab cleanup tool (#91) 2026-03-22 14:37:59 +08:00
Waffle 7c2ee5e14e fix(cli): pass timeout through to OpenClaw (#82)
* fix(cli): pass timeout through to OpenClaw

* fix(cli): scope openclaw timeout to subcommands
2026-03-22 14:37:55 +08:00
Ted Li 45c1fbb385 fix(shared): avoid global crypto for request ids (#89) 2026-03-22 14:36:05 +08:00
Waffle 1316679fd9 chore(github): add issue templates (#83)
* chore(github): add issue templates

* chore(github): add issue template labels and checkboxes
2026-03-22 14:36:02 +08:00
yan5xu 57da2779d3 ci: fix publish — use workflow_call instead of release event
GITHUB_TOKEN-created releases don't trigger other workflows (GitHub
Actions limitation to prevent loops). Changed publish.yml to use
workflow_call (invoked by release-please) + workflow_dispatch (manual
retry from Actions tab).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 14:22:00 +08:00
github-actions[bot] 2a41d67a27 chore(main): release bb-browser 0.10.0 (#93)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
bb-browser-v0.10.0
2026-03-22 14:20:37 +08:00
yan5xu e50dae2278 ci: split publish into separate workflow triggered by release event
Previously all publish steps lived in release-please.yml gated on
release_created. If the release-please run failed (e.g. permissions)
but the release was created manually, npm publish could never be
retried — subsequent runs saw the release already existed and skipped.

Now release-please.yml only manages PRs/releases, and a new
publish.yml triggers on release:published to handle build, extension
upload, and npm publish independently. Publish failures can be re-run
without needing release-please to fire again.

Closes #94

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 14:19:20 +08:00
yan5xu 6d8f18b393 fix: open new tabs in background to avoid bringing Chrome to foreground
Add `background: true` to both `Target.createTarget` CDP calls so that
`bb-browser open --tab` and `bb-browser tab new` no longer activate the
Chrome window. This prevents disrupting the user's workflow when agents
run browser automation in the background.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 12:33:24 +08:00
yan5xu e730b0ef55 feat: bb-browserd migrate from WebSocket to Connect-RPC ProviderStream
Replace WebSocket /ws/provider with Connect-RPC ProviderStream for
communicating with pinixd Hub. Same functionality, unified protocol.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 00:02:28 +08:00
yan5xu 2ce47c55ce feat: bb-browserd CDP direct connection (replaces daemon HTTP)
- Connect directly to Chrome CDP WebSocket instead of daemon HTTP
- No Chrome Extension needed, same as CLI's cdp-client approach
- Lazy CDP initialization on first command
- Commands: navigate, click, type, evaluate, screenshot, getCookies, waitForSelector
- Verified: navigate returns {url, title}, evaluate returns {result}

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 22:34:24 +08:00
yan5xu 3af2b4c856 feat: bb-browserd — Pinix capability adapter
Single-file bridge: WebSocket to pinixd + HTTP to bb-browser daemon.
Registers browser capability with 7 commands: navigate, click, type,
evaluate, screenshot, getCookies, waitForSelector.
Auto-reconnect on disconnect.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 17:03:13 +08:00
Yanwu 0ae6dc6970 Merge pull request #88 from epiral/release-please--branches--main--components--bb-browser
chore(main): release bb-browser 0.9.0
bb-browser-v0.9.0
2026-03-20 00:14:07 +08:00
github-actions[bot] 2f2e153ef1 chore(main): release bb-browser 0.9.0 2026-03-19 16:08:24 +00:00
Yanwu aa3010f015 Merge pull request #87 from epiral/feat/cdp-monitor
feat(cli): add CDP monitor for persistent monitoring
2026-03-19 23:51:23 +08:00
yan5xu 94c94b7c4e feat(cli): add CDP monitor background process for persistent monitoring (Phase 1, #77)
Monitoring commands (network, console, errors, trace) are broken in
direct CDP mode because each CLI invocation is a new short-lived
process that cannot accumulate events over time.

This introduces a long-running background monitor process that
maintains a persistent CDP connection and collects events:

- cdp-monitor-state.ts: MonitorState class extracted from cdp-client.ts
  event handling logic (Network.*, Runtime.*, trace)
- cdp-monitor.ts: standalone Node.js process that connects to Chrome
  via CDP, attaches to all page targets, and serves an HTTP API on
  127.0.0.1 with bearer-token auth
- monitor-manager.ts: CLI-side lifecycle management (spawn, health
  check, shutdown, command forwarding)
- client.ts: routes monitor actions (network/console/errors/trace)
  through the monitor with graceful fallback to direct CDP
- tsup.config.ts: adds cdp-monitor as a build entry point

The monitor auto-discovers new tabs, writes PID/port/token files to
~/.bb-browser/, and auto-exits after 30 minutes of inactivity.
cdp-client.ts is intentionally left untouched to avoid regressions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 23:47:12 +08:00
Yanwu 1215b01604 Merge pull request #86 from ox01024/chore/release-please
chore(release): automate versioning and publishing
2026-03-19 20:17:28 +08:00
Yanwu 22d38c1368 Merge pull request #67 from MonkeyLeeT/codex/mcp-site-tools
feat(mcp): add site adapter tools
2026-03-19 20:15:59 +08:00
Yanwu 3a1541114f Merge pull request #69 from ox01024/fix/status-command-help
fix(cli): wire top-level status command
2026-03-19 20:15:22 +08:00
Yanwu a391b8241a Merge pull request #63 from MonkeyLeeT/codex/fix-eval-top-level-await
Clean fix using replMode: true — same approach as Chrome DevTools Console. No side effects on existing expressions. LGTM.
2026-03-19 20:14:39 +08:00
Yanwu 3659fb869a Merge pull request #74 from ox01024/fix/click-navigation
Fixes real click-offset bug on scrolled pages. Viewport coordinate transformation is correct. LGTM.
2026-03-19 20:14:29 +08:00
Yanwu 152225b2e0 Merge pull request #80 from ox01024/fix/get-ref-cross-invocation
Solid state management with proper stale-target protection. LGTM.
2026-03-19 20:14:21 +08:00
Yanwu 3cd1b05fda Merge pull request #81 from ox01024/fix/type-double-insert
Correct root cause analysis and clean fix — collapsing dual write paths into single Input.insertText. LGTM.
2026-03-19 20:14:14 +08:00
Yanwu e716ab59f2 Merge pull request #85 from ox01024/chore/eslint-small-scope
Clean ESLint setup with pragmatic rule choices. Only 1 existing code change needed — great minimal baseline.
2026-03-19 20:14:07 +08:00
Waffle 570737c957 chore(release): automate versioning and publishing 2026-03-19 17:25:33 +08:00
Waffle 0a2e150238 chore(lint): add small-scope eslint checks 2026-03-19 16:37:41 +08:00
Waffle 600244d0da fix(cli): avoid double-inserting typed text 2026-03-19 15:40:47 +08:00
Waffle 578e10f56d fix(cli): persist selected target for get commands 2026-03-19 15:40:10 +08:00
Waffle 92fa9f7fc7 fix(cli): use viewport coordinates for click targets 2026-03-19 14:59:34 +08:00
Waffle c8b1aab0ad fix(cli): wire top-level status command 2026-03-19 11:03:38 +08:00
ted 4626fff84a chore(cli): minimize site command diff 2026-03-18 18:54:06 -07:00
ted 7804f06226 feat(mcp): add site adapter tools 2026-03-18 18:51:25 -07:00
Yanwu d56cab9d6a Merge pull request #62 from MonkeyLeeT/codex/fix-openclaw-noisy-json
LGTM! All review feedback addressed thoroughly in b0b7c7b. Clean implementation, solid test coverage. Thanks for the quick turnaround!
2026-03-18 16:22:58 +08:00
ted 2a5493ea5b Revert "chore(shared): add Runtime.evaluate coverage"
This reverts commit ef79e28e7b.
2026-03-17 23:49:42 -07:00
ted ef79e28e7b chore(shared): add Runtime.evaluate coverage 2026-03-17 23:43:24 -07:00
ted cbad572068 refactor(cli): simplify OpenClaw JSON recovery 2026-03-17 23:39:35 -07:00
ted b0b7c7be0e fix(cli): harden OpenClaw JSON parsing 2026-03-17 23:32:55 -07:00
ted cfbae0763a fix: support top-level await in eval 2026-03-17 23:28:42 -07:00