2026-08-21 13:53:15 +08:00
|
|
|
# Session Sidebar
|
|
|
|
|
|
|
|
|
|
Sidebar code is organized by the business object it owns. Shared contracts are
|
|
|
|
|
kept at this root in `types.ts` and `utils.tsx`.
|
|
|
|
|
|
|
|
|
|
- `shell/` owns sidebar chrome, navigation, search, confirmations, and switcher effects.
|
|
|
|
|
- `list/` owns global-first session collection, directory bootstrap demand,
|
|
|
|
|
layout-owned synchronization, authoritative cleanup, and nearby-session prefetch.
|
|
|
|
|
- `projects/` owns project zones, grouping, ordering, scroller behavior, project
|
|
|
|
|
view state, repository state, and worktree presentation.
|
|
|
|
|
- `sessions/` owns session rows, row actions, expansion, ownership, and activity indicators.
|
|
|
|
|
- `recent/` owns Recent and managed Chats activity projections.
|
|
|
|
|
- `folders/` owns folder DnD, bulk actions, archived folders, and folder UI.
|
|
|
|
|
|
|
|
|
|
`MainLayout` and `VSCodeLayout` call `useSessionListSync({ isVSCode })`
|
|
|
|
|
unconditionally. The hook publishes complete directory bootstrap demand,
|
|
|
|
|
refreshes newly added topology, coalesces control events, and performs
|
|
|
|
|
authoritative cleanup. Root-level `useGlobalSessionsPolling` remains the only
|
|
|
|
|
initial and 45-second global poller. `useSessionListSync` must not create a
|
|
|
|
|
second global polling lifecycle.
|
|
|
|
|
|
|
|
|
|
The global sessions cache is the complete source for active and archived
|
|
|
|
|
coverage. Initialized directory stores only supply sessions missing from that
|
|
|
|
|
cache. Live busy and retry state comes from `global-session-status`, never from
|
|
|
|
|
the global cache or persisted history. A failed global or directory fetch keeps
|
|
|
|
|
existing data; it is never treated as an authoritative empty list.
|
|
|
|
|
|
|
|
|
|
Web and desktop show managed Chats before optional Recent activity. Chats use
|
|
|
|
|
their shared managed root for folders and never expose worktree actions. Project
|
|
|
|
|
display can be all projects or one selected project. VS Code excludes worktrees
|
|
|
|
|
and managed Chats, while retaining its workspace-scoped grouped list and inline
|
|
|
|
|
archived buckets.
|
|
|
|
|
|
|
|
|
|
Directory demand always includes known project roots and worktrees. Visibility
|
|
|
|
|
only changes priority. Row mounts must not start bootstrap work. Selection and
|
|
|
|
|
activity subscriptions stay session-scoped so a structural list update does not
|
|
|
|
|
make every row observe unrelated streaming updates.
|