Replace chrome.debugger (CDP) with chrome.scripting.executeScript for
JS evaluation. Zero CDP fingerprint on sites without strict CSP.
- Add extension/src/scripting.ts: tries chrome.scripting first, auto
falls back to CDP on CSP errors (e.g. Twitter/X, Google)
- Add 'scripting' permission + host_permissions to manifest.json
- Route exec through scripting executor, keep CDP only for screenshot
- Remember CSP-blocked tabs to skip straight to CDP on subsequent calls
Replace eager close-window (which caused race conditions when
parallel commands shared the window) with an idle-based timer:
- Window auto-closes 30s after the last command completes
- Each incoming command resets the idle timer
- Consecutive commands reuse the same window (faster)
- No race conditions with parallel execution
- Close-window action kept for explicit cleanup if needed
- Add 'close-window' action to extension protocol and background.ts
- Add Page.closeWindow() method to send close-window command
- browserSession() now closes automation window in cleanup
- Remove domain pre-navigation + 2s wait from main.ts (CDP handles
cross-domain cookies natively, no same-origin workaround needed)
- Net effect: commands run faster, no stale windows left behind
All opencli operations now run in a dedicated Chrome window instead
of hijacking the user's active tab. The automation window:
- Created on first command via chrome.windows.create({ focused: false })
- 1280x900 viewport, auto-cleaned up when closed
- All tabs resolved within this window only
- User's main browsing session is never touched
Tested: twitter trending ✅, zhihu hot ✅