Skip to content

feat(session): support unfocused agent windows (--no-focus) - #87

Merged
BB-fat merged 1 commit into
mainfrom
takeover/pr54-no-focus
Aug 12, 2026
Merged

feat(session): support unfocused agent windows (--no-focus)#87
BB-fat merged 1 commit into
mainfrom
takeover/pr54-no-focus

Conversation

@BB-fat

@BB-fat BB-fat commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Supersedes #54, closes #26 — reworked onto current main so it composes with #52 window sizing (options-object instead of colliding positional params). All credit to @alectimison-maker for the original design.

What

bsk session start --no-focus opens the Agent Window in the background without stealing focus from the user's current window.

How it differs from #54

PR #54 threaded focused through the same positional parameter slot that #52 (merged since) now uses for window size. This rework switches the extension-side interfaces to options objects so the two features compose:

  • AgentWindowApi.create(url, opts?: { size?: { width, height }; focused?: boolean })focused defaults to true, preserving today's behavior; chrome.windows.create receives focused plus the optional size.
  • SessionManager.start(sessionId, opts?: { size?; focused? }) — passes the options object straight through.

Chain

  • Protocol (crates/bsk-protocol): SessionStartParams.focused: Option<bool> with serde(default, skip_serializing_if), so old daemons/extensions interoperate; JSON schema regenerated via dump-schema.
  • CLI (crates/bsk-cli): --no-focus flag on bsk session start; start_session now takes a SessionStartOptions struct (browser/width/height/focused) instead of growing positional args; record start keeps the defaults.
  • Daemon IPC: CliSessionStartParams.focused pass-through; start_session takes an AgentWindowOptions { size, focused } struct (also fixes a new clippy::too_many_arguments at 8 args).
  • Extension: handleSessionStart validates size as before and forwards { size, focused }; chrome.windows.create gets focused: opts.focused ?? true.

Tests

  • Protocol: focused optional-by-default + false round-trip.
  • CLI: --no-focus parse test; daemon↔extension IPC round-trip asserts focused: Some(false) reaches tool.session_start.
  • Extension vitest: chromeAgentWindowApi.create (default focus / focused: false / size), SessionManager.start options forwarding, handleSessionStart and dispatcher focused: false forwarding. Assertions updated from positional args to the options object.

Verification

  • cargo fmt --all, cargo test -p bsk-protocol (115 passed), cargo test -p bsk --lib (226 passed; only the known environment-dependent sync_continues_on_partial_error fails), cargo test -p bsk --test cli_parse --test sessions_ipc (43 passed), cargo clippy -p bsk-protocol -p bsk --all-targets -- -D warnings clean.
  • Frontend: pnpm install, wxt prepare, pnpm lint, tsc --noEmit all clean; vitest 567 passed with only the pre-existing React.act .tsx baseline failures (48, identical on pristine main — verified via stash).
  • skill/SKILL.md and crates/bsk-cli/skill/SKILL.md updated and verified byte-identical with cmp.

`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>
@BB-fat
BB-fat force-pushed the takeover/pr54-no-focus branch from 20fa18f to b713a7b Compare August 12, 2026 11:58
@BB-fat
BB-fat merged commit f443cfa into main Aug 12, 2026
4 checks passed
@BB-fat
BB-fat deleted the takeover/pr54-no-focus branch August 12, 2026 11:58
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.

Feature Request: Add --no-focus / --minimized flag to bsk session start to prevent Agent Window from stealing focus

1 participant