fix(activity): surface worktree sessions in active work, the sidebar and repo badges

- Resolve sessions in repo worktrees to the owning repo in the activity list; show the worktree branch and open the Workspaces tab
- Look up worktrees only for unmatched sessions in the window or under an active root, and hold the loading state until it settles
- Show schedule-worktree sessions only while running or needing input
- Light repo badges for worktree sessions through one app-wide worktree lookup
- List worktree sessions under the expanded repo in the sidebar
- Subscribe the event stream to active session directories so worktree permissions and forms arrive
- Keep the worktree tab when navigating from the desktop Activity panel
- Remove the braille spinner's always-dim bottom row
This commit is contained in:
Chris Scott committed 2026-10-16 20:36:56 +00:00
1 parent 1d31286904
commit bfbbbf08ef
23 files changed
+932 -81

No files matched your search

+19 -4
View File
@@ -5,6 +5,7 @@ import { sessionQueryOptions, useSessionsAcrossDirectories } from '@/hooks/useOp
import { useSessionPins } from '@/hooks/useSessionPins'
import { buildPinnedSessionKeys, buildSessionKey, getSessionKey } from '@/lib/sessionKey'
import type { Repo } from '@/api/types'
import type { ActiveWorktree } from '@/lib/activeWork'
import {
SIDEBAR_SESSIONS_PER_REPO,
buildSidebarRepoGroups,
@@ -17,10 +18,17 @@ import {
export function useSidebarRepoGroups(input: {
repos: Repo[]
search?: string
worktrees?: ReadonlyArray<ActiveWorktree>
}): { groups: SidebarRepoGroup[]; isLoading: boolean; isError: boolean; hasMore: boolean } {
const { repos, search } = input
const { repos, search, worktrees } = input
const directories = useMemo(() => repos.map((repo) => repo.fullPath), [repos])
const directories = useMemo(
() => [
...repos.map((repo) => repo.fullPath),
...(worktrees ?? []).map((worktree) => worktree.directory),
],
[repos, worktrees],
)
const { data: sessions, isLoading, isError, hasNextPage } = useSessionsAcrossDirectories(directories, {
search,
@@ -52,8 +60,15 @@ export function useSidebarRepoGroups(input: {
)
const groups = useMemo(
() => buildSidebarRepoGroups({ repos, sessions: mergedSessions, pinnedKeys, now: Date.now() }),
[repos, mergedSessions, pinnedKeys],
() =>
buildSidebarRepoGroups({
repos,
sessions: mergedSessions,
pinnedKeys,
now: Date.now(),
worktrees,
}),
[repos, mergedSessions, pinnedKeys, worktrees],
)
return { groups, isLoading, isError, hasMore: Boolean(hasNextPage) }