mirror of
https://github.com/Tencent/BrowserSkill.git
synced 2026-09-10 13:01:23 +08:00
feat(session): support unfocused agent windows (--no-focus) (#87)
`bsk session start --no-focus` opens the Agent Window in the background without stealing focus. The flag threads focused=false through CLI -> daemon IPC -> tool.session_start -> chrome.windows.create; an omitted `focused` keeps the extension default (true) so older clients are unaffected. Reworked onto current main so it composes with #52 window sizing: AgentWindowApi.create / SessionManager.start (extension), start_session (CLI) and the daemon's session start now take options objects/structs ({ size, focused }) instead of colliding positional params. Co-authored-by: alectimison-maker <alec.timison@gmail.com>
This commit is contained in:
co-authored by
alectimison-maker
parent
0ce497f017
commit
f443cfae74
@@ -42,8 +42,8 @@ use tracing::{debug, warn};
|
||||
use super::abort::AbortRegistry;
|
||||
use super::queue::{DEFAULT_TOOL_TIMEOUT, DispatchError};
|
||||
use super::sessions::{
|
||||
SessionId, StartSessionError, StopSessionError, snapshot_status_entries, start_session,
|
||||
stop_session,
|
||||
AgentWindowOptions, SessionId, StartSessionError, StopSessionError, snapshot_status_entries,
|
||||
start_session, stop_session,
|
||||
};
|
||||
use super::state::{DAEMON_VERSION, DaemonState, PROTOCOL_VERSION};
|
||||
|
||||
@@ -545,6 +545,8 @@ struct CliSessionStartParams {
|
||||
pub width: Option<u32>,
|
||||
#[serde(default)]
|
||||
pub height: Option<u32>,
|
||||
#[serde(default)]
|
||||
pub focused: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@@ -638,6 +640,7 @@ async fn handle_session_start(state: &Arc<DaemonState>, params: Value) -> Result
|
||||
browser_instance_id: None,
|
||||
width: None,
|
||||
height: None,
|
||||
focused: None,
|
||||
}
|
||||
} else {
|
||||
serde_json::from_value(params).map_err(|err| RpcError {
|
||||
@@ -664,7 +667,10 @@ async fn handle_session_start(state: &Arc<DaemonState>, params: Value) -> Result
|
||||
&state.sessions,
|
||||
&state.tool_queues,
|
||||
params.browser_instance_id.as_deref(),
|
||||
window_size,
|
||||
AgentWindowOptions {
|
||||
size: window_size,
|
||||
focused: params.focused,
|
||||
},
|
||||
state.config.extension_connect_wait,
|
||||
DEFAULT_RPC_TIMEOUT,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user