Skip to content

Replace browser backend with agent-browser#23

Closed
vaayne wants to merge 10 commits into
mainfrom
feat/agent-browser-backend
Closed

Replace browser backend with agent-browser#23
vaayne wants to merge 10 commits into
mainfrom
feat/agent-browser-backend

Conversation

@vaayne

@vaayne vaayne commented May 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • replace transport, engine, fetch, attach, status, and browser CLI flows with agent-browser-backed adapter calls
  • remove old hand-rolled chromedp/CDP browser layer and chromedp dependencies
  • add agent-browser binary install support, new pass-through commands, and docs/skill updates

Verification

  • mise run lint && mise run test

Closes #22

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 24, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
tap c1cfcd1 May 24 2026, 07:18 AM

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 22c24106f7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmd/tap/attach.go
return err
}
ab.SessionName = ""
_, _, _ = ab.Exec(ctx, "close")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid closing external browser on attach clear

tap attach clear is documented to remove attachment metadata only, but this implementation executes agent-browser close first. In the common case where the user attached to an already-running Chrome instance, this can unexpectedly close their live browser session (and active work) instead of just detaching tap, which is a destructive behavior change from the command contract.

Useful? React with 👍 / 👎.

Comment thread cmd/tap/attach.go
Comment on lines +65 to +69
if url == "" {
if portFile := cmd.String("port-file"); portFile != "" {
return fmt.Errorf("port-file auto-discovery not yet implemented with agent-browser")
}
debugURL = url
source = fmt.Sprintf("port file: %s", path)
} else {
// Auto-discover
url, path, err := browser.DiscoverUserChromeDebugURL()
if err != nil {
return fmt.Errorf(`could not find a running Chrome with remote debugging enabled.

To use tap attach chrome, you need:
1. Chrome already running with --remote-debugging-port=9222, OR
2. Chrome with DevToolsActivePort in a standard location

Try one of:
tap attach chrome --browser-url http://localhost:9222
google-chrome --remote-debugging-port=9222 &
tap attach chrome

Original error: %w`, err)
}
debugURL = url
source = fmt.Sprintf("auto-discovered: %s", path)
}

// Resolve to WebSocket URL if HTTP base URL provided
wsURL, err := browser.ResolveDebugURL(ctx, debugURL)
if err != nil {
return fmt.Errorf("resolve debug URL: %w", err)
return fmt.Errorf("no Chrome URL provided; use --browser-url http://localhost:9222")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore no-arg attach chrome discovery flow

The chrome attach path now hard-fails unless --browser-url is provided, and --port-file also fails with “not yet implemented.” That removes the advertised no-arg tap attach chrome discovery workflow (DevToolsActivePort auto-discovery) and breaks existing scripts/users relying on default attach behavior.

Useful? React with 👍 / 👎.

@vaayne

vaayne commented May 24, 2026

Copy link
Copy Markdown
Owner Author

Browser smoke testing completed against agent-browser 0.27.0.

Validated tap → agent-browser command conversion for:

  • open/tabs/status/get/evaluate/text/snapshot/screenshot/wait/hover/scroll
  • forms/fill/select/click/keypress on a local form page
  • cookies, set viewport, storage local get/set, state save/list, auth list, vitals
  • network requests/unroute pass-through with agent-browser flags
  • browser-backed fetch and site script: tap fetch -b https://example.com, tap site run -b hackernews/top

Fixes pushed:

  • unwrap agent-browser eval envelopes so tap browser text/fetch browser HTML work
  • make pass-through commands accept arbitrary agent-browser flags while still supporting --session
  • align network commands with agent-browser 0.27.0 (requests/route/unroute/har)
  • restore forms via JS discovery and map keypress to agent-browser press
  • remove unsupported dialog command from CLI/docs
  • update docs and skills/tap-web network references

Verification: mise run lint && mise run test

@vaayne

vaayne commented May 24, 2026

Copy link
Copy Markdown
Owner Author

Updated per review: tap now embeds agent-browser instead of downloading it at runtime.

What changed:

  • added embedded agent-browser 0.27.0 binaries for darwin arm64/x64, linux arm64/x64, and windows x64
  • extraction happens automatically to ~/.cache/tap/agent-browser/agent-browser on first use
  • tap doctor --install refreshes the embedded binary and delegates browser dependency setup to agent-browser install
  • removed tap-side Chrome detection and Lightpanda download/install code
  • removed Lightpanda CLI flags/docs from current browser UX
  • updated GoReleaser to skip unsupported windows/arm64

Verification:

  • mise run lint && mise run test
  • cross-builds: darwin/arm64, darwin/amd64, linux/arm64, linux/amd64, windows/amd64

@vaayne

vaayne commented May 24, 2026

Copy link
Copy Markdown
Owner Author

Adjusted embedding strategy: agent-browser binaries are no longer committed to git.

What changed:

  • removed tracked browser/bin/agent-browser-* binaries
  • added scripts/prepare-agent-browser.sh to download agent-browser 0.27.0 release binaries into ignored browser/bin/
  • wired mise run build, mise run test, mise run lint, and mise run release to run the prepare step first
  • added a GoReleaser before hook to download binaries before release builds
  • kept runtime behavior the same: the selected binary is still embedded into the built tap binary via go:embed

Verification:

  • mise run lint && mise run test
  • cross-builds: darwin/arm64, darwin/amd64, linux/arm64, linux/amd64, windows/amd64

@vaayne

vaayne commented May 24, 2026

Copy link
Copy Markdown
Owner Author

Added simple first-class Lightpanda support via global --lightpanda / --lp.

Behavior:

  • global --lp selects agent-browser --engine lightpanda
  • browser-backed site/fetch commands force browser mode when --lp is present
  • tap browser ... --lp uses Lightpanda for direct browser commands
  • attached Chrome mode rejects --lp because Lightpanda is a managed engine, not an attached CDP target

Smoke test:

  • go run ./cmd/tap browser open https://example.com --lp --session test-lp-smoke
  • go run ./cmd/tap browser get title --lp --session test-lp-smoke

Verification: mise run lint && mise run test

@vaayne vaayne closed this Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: replace browser layer with agent-browser backend

1 participant