feat(stealth): silent operation — never steal the user's foreground tab
Driving the user's real Chrome should not yank their view around. Now the agent operates entirely in the background: - New tabs are created with `background: true` (CreateTargetParams) so opening one never foregrounds it (the ab-connect extension already used active:false; this covers the raw-CDP path too). - Dropped the two AUTO `Page.bringToFront` calls (auto-connect fresh tab, and the internal active-page switch). The explicit `bringToFront` command is untouched — surfacing a tab stays opt-in. - enable_domains now sets `Emulation.setFocusEmulationEnabled(true)` so a backgrounded agent tab still renders (screenshots work), isn't render-throttled, and reports document.hasFocus()/visibilityState='visible' — which also removes the "tab is hidden the whole session" bot tell. Verified headless: hasFocus=true/visible while backgrounded; click + screenshot still work. Default behaviour, no flag.
This commit is contained in:
@@ -153,6 +153,12 @@ pub struct CreateTargetParams {
|
||||
/// endpoint never receives an unknown parameter.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub agent_group: Option<String>,
|
||||
/// Create the tab in the background so opening it never steals the user's
|
||||
/// foreground tab (silent operation). Standard CDP param; the ab-connect
|
||||
/// extension creates its tabs `active: false` regardless, so this only
|
||||
/// affects the raw-CDP (no extension) path.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub background: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
|
||||
Reference in New Issue
Block a user