Skip to content

feat: select browser tabs explicitly and preserve pasted text - #11

Merged
Steel-tech merged 2 commits into
mainfrom
feat/browser-tabs-paste
Sep 16, 2026
Merged

Steel-tech merged 2 commits into
mainfrom
feat/browser-tabs-paste

Conversation

@Steel-tech

@Steel-tech Steel-tech commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Summary

The Browser pane now selects attached and locally launched tabs from a title/URL picker. Closing or detaching the selected tab clears its image and pending text, drops queued input, and requires an explicit selection before input resumes. Selection stays bound to a stable target identity.

The text prompt preserves whitespace, Unicode, tabs, and multiline bracketed paste until insertion is confirmed. Insertion does not send Enter to the page. Shared agent-browser sessions retain their existing active-tab model and gain verbatim text insertion.

Validation

  • npm run validate: 331 passed, two expected skips.
  • npm run test:integration: all three required real-browser tests passed.
  • Chromium checks cover tab selection, target loss, and verbatim insertion at desktop and mobile viewport sizes.
  • Terminal smoke check covers the picker, paste preview, cancellation, and cleanup.

The streaming fixture now subscribes before navigating and includes event diagnostics after full-suite runs exposed missing initial frames. Multiline paste requires terminal bracketed-paste support.

Summary by CodeRabbit

  • New Features

    • Added a tab picker for selecting attached or locally launched browser tabs by title or URL.
    • Added bracketed paste support that preserves whitespace, Unicode, tabs, and newlines, with a 1 MiB limit and separate confirmation before insertion.
    • Added safeguards that clear stale content and block pending input when the selected tab closes or detaches.
  • Documentation

    • Updated usage guidance for tab selection, pasted text behavior, and browser attachment scenarios.
    • Clarified readiness coverage for verbatim text insertion and explicit target selection.

Keep input bound to the selected tab and require another selection after target loss. Preserve multiline pasted text until insertion is confirmed, without sending Enter to the page.
@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 48bfcbf7-f2b1-452e-b132-b6159830ffd9

📥 Commits

Reviewing files that changed from the base of the PR and between 3ed29f4 and 859d05e.

📒 Files selected for processing (8)
  • CHANGELOG.md
  • README.md
  • bin/cdp.mjs
  • bin/renderer.mjs
  • docs/readiness.md
  • tests/cdp.test.mjs
  • tests/launch.integration.test.mjs
  • tests/renderer.test.mjs

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change adds explicit CDP tab selection, target-loss invalidation, target-aware input guards, and bracketed-paste support. It updates the renderer, adapter tests, integration tests, changelog, README, and readiness documentation.

Changes

Target selection and lifecycle

Layer / File(s) Summary
CDP target lifecycle
bin/cdp.mjs, tests/cdp.test.mjs
The adapter adds listTargets() and selectTarget(), tracks selected target identity, preserves matching selections across reconnects, and clears targets on destruction or detachment. Browser actions now reject missing or stale targets with TARGET_GONE.
Renderer target picker and guards
bin/renderer.mjs, tests/renderer.test.mjs
Attach mode provides a keyboard target picker with refresh and selection. Target loss clears frames and pending input. Page actions require a current selected target and current input revisions.

Literal input and validation

Layer / File(s) Summary
Literal prompt and paste input
bin/renderer.mjs, tests/renderer.test.mjs
Bracketed paste preserves whitespace, Unicode, tabs, and newlines until confirmation. Pasted text has a 1 MiB limit, escaped preview output, Unicode-safe backspace handling, and no implicit page Enter.
Integration coverage and documentation
tests/launch.integration.test.mjs, CHANGELOG.md, README.md, docs/readiness.md
End-to-end coverage exercises tab switching, target loss, and verbatim insertion. Documentation describes the picker, reconnect behavior, paste handling, and readiness scope.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant Renderer
  participant makeCdpBrowser
  participant Chromium
  Operator->>Renderer: open target picker
  Renderer->>makeCdpBrowser: listTargets()
  makeCdpBrowser->>Chromium: enumerate page targets
  Chromium-->>makeCdpBrowser: target metadata
  makeCdpBrowser-->>Renderer: selectable targets
  Operator->>Renderer: select target
  Renderer->>makeCdpBrowser: selectTarget(targetId)
  makeCdpBrowser->>Chromium: attach selected target
  Chromium-->>makeCdpBrowser: target_selected
  makeCdpBrowser-->>Renderer: selected target state
  Operator->>Renderer: paste literal text and press Enter
  Renderer->>makeCdpBrowser: type(text)
  makeCdpBrowser->>Chromium: insert text
Loading

Suggested reviewers: claude

Merge Risk: ⚪ Minimal · up to 859d0

No actionable merge-blocking defect remains; the replacement-session race cannot occur through the implemented close path.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes both primary changes: explicit browser-tab selection and preservation of pasted text.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 5 files. (3 skipped: 3 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/browser-tabs-paste

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Steel-tech
Steel-tech merged commit 182a62c into main Sep 16, 2026
4 of 5 checks passed
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.

1 participant