fix(desktop): keep tab selection local and sync sidebar state

Merged
KI
3mo ago
+476-28

What & why

Keep active v2 tab and pane selection local to each desktop window while continuing to sync structural pane-layout changes.

Also make sidebar agent/attention state update across windows immediately:

  • exclude active tab and pane ids from shared layout snapshots
  • preserve each renderer's valid local selection when structural updates arrive
  • remember renderer-local selection for notification visibility checks
  • rehydrate persisted attention state on cross-window storage events
  • broadcast a notification-free agent:bindings-changed event for host-side status clears so every renderer refetches without playing a completion sound

How I tested it

  • bun test focused pane-selection, notification-store, and host event-bus suites: 15 passed / 30 assertions
  • bun run --cwd packages/workspace-client typecheck
  • bun run --cwd packages/host-service typecheck
  • bun run --cwd apps/desktop typecheck
  • Biome checks on all changed files and git diff --check
  • CDP verification against the desktop dev app with two real Electron windows:
    • selecting Terminal in window A left window B on Browser
    • clearing sidebar attention in window A updated both windows in real time

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (targeted Biome checks and all affected package typechecks pass)
  • "Allow edits from maintainers" is not applicable because this branch is pushed to the upstream repository

Summary by cubic

Keeps active tab and pane selection local to each desktop window while still syncing structural pane-layout changes, and makes sidebar agent state update across windows immediately.

Bug Fixes

  • Excludes active tab and pane ids from shared layout snapshots so switching tabs or panes no longer affects other windows.
  • Preserves each window's local selection when structural updates arrive, choosing a nearby surviving tab or pane if the original is removed.
  • Remembers renderer-local selection in a new store so notification visibility checks use the correct selection per window.
  • Syncs the v2 notification store across windows so sidebar attention state updates everywhere.
  • Broadcasts a notification-free agent:bindings-changed event on status clears so all renderers refetch bindings without playing a completion sound.