feat(desktop): follow the focused bot in the profile-grouped sidebar - #91052
feat(desktop): follow the focused bot in the profile-grouped sidebar#91052kennysamuerto wants to merge 2 commits into
Conversation
c891e16 to
081c686
Compare
Reviewed the diff. Tidy feature: the focused-profile ranking lives in a pure, well-tested helper (seven unit cases covering normalization, ghost focus, default-first preservation, color stamping), the auto-reveal effect correctly no-ops when focus doesn't change (so a manual collapse survives same-profile refocuses), and lifting `$focusedSessionProfile` into `session-states` removes a private duplicate so the SDK host state and the sidebar read one source of truth. Header session-count badge answers the collapsed-glance question nicely. Nit: two micro-points — (a) confirm `setWorkspaceNodeOpen(profileKey, true)` writes node state namespaced to the profile-grouping mode; if workspace open/closed state is shared across grouping modes, a project node that happens to share an id string would get expanded as a side effect; (b) in buildProfileGroups the `groups.set(key, group)` inside the loop is redundant (the Map already holds the mutated object reference). No blocking issues found. |
|
Thanks for the review! On the two nits: (a) Node-state collision — confirmed not possible: workspace node ids are always path-derived ( (b) |
With Grouping → Profile in the all-profiles scope, the sidebar now answers "what is THIS bot doing?" passively: the focused chat's profile group floats to the top and is re-opened if it had been collapsed, so switching bots always reveals that bot's sessions without hunting for its section. Profile group headers also gain a session count, readable while collapsed. - $focusedSessionProfile moves from the plugin SDK into the session-states store so the sidebar and host.state share one resolver (same focused-row → owner-profile ladder, unchanged behavior). - Group construction extracted to buildProfileGroups() with unit tests: focused profile first, then default, then alphabetical — a focused profile with no sessions changes nothing. Closes NousResearch#89347 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review follow-up: the unconditional groups.set() was needed only on first insert; make that branch explicit so existing references are never re-set. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
6570ba7 to
b7f8071
Compare
|
Rebased onto current main (v2026.8.27). Main had grown its own connection-qualified Typecheck, lint and the desktop suite are green (7,975 passed; the only suite my rebase had broken was |
What
With Grouping → Profile in the all-profiles scope, the sidebar now answers "what is THIS bot doing?" passively:
defaultkeeps its historical first spot when nothing else is focused; the rest stay alphabetical. A focused profile with no sessions changes nothing.analyst · 3-style, in the quaternary text tone so it stays out of the way of the cost/token totals).Closes #89347
How
$focusedSessionProfilemoves from the plugin SDK (src/sdk/index.ts) into the session-states store, so the sidebar andhost.state.focusedSessionProfileshare one resolver — same focused-row → owner-profile ladder, behavior unchanged for SDK consumers.index.tsxmemo into a purebuildProfileGroups()(sidebar/profile-groups.ts) with colocated unit tests covering ranking (focused > default > alpha), normalization, legacy rows without a profile, and color stamping.setWorkspaceNodeOpen(focusedProfile, true)when focus moves while profile-grouped, reusing the existing collapse-state store.Testing
vitest run --project ui src/app/chat/sidebar src/sdk src/store— 1285 passed (includes 7 new tests inprofile-groups.test.ts;profile-routing.test.tsmock updated for the moved atom).tsc -p . --noEmitclean;eslintclean on all touched files.Notes
PROJECT_PREVIEW_COUNTcap on profile groups (only a handful of rows per group, click the label to scope) is untouched — happy to follow up there if there's appetite, since "few visible rows" was also raised in the issue discussion.🤖 Generated with Claude Code