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.
- 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.
* 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.
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>
* 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>
* 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>
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>
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>
New commands:
- `history search/domains` — query Chrome browsing history via chrome.history API
- `site recommend` — cross-reference history with adapters for personalized discovery
- `site info <name>` — expose full adapter @meta (args, example, domain)
- `--jq <expr>` — inline jq-like JSON filtering (inspired by gh CLI)
Agent UX improvements:
- --help grouped by intent, "开始使用" section first with site examples
- --help top hint explicitly guides Agents to use site commands over browser automation
- `open` command shows 💡 hint when the URL has available site adapters
- `--jq` auto-strips `.data.` prefix for Agent tolerance
- `site update` post-install nudge for site recommend
- AGENTS.md with full UX writing spec for contributors
Closes#21, closes#23, relates #24
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Via CDP Network.loadingFinished + Network.getResponseBody, capture:
- Request headers and body (POST data)
- Response headers, body, and mimeType
- Memory management: 256KB/response, 64KB/request, 8MB/tab total
- Eviction: oldest bodies removed first when over budget
- Graceful error handling: bodyError field for failed captures
This enables a new paradigm for site adapters: instead of reverse-engineering
API signing (like Xiaohongshu's X-s), just navigate to a page and read the
response bodies from requests the page already made with proper authentication.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>