()
| 53 | ]; |
| 54 | |
| 55 | export async function AppSidebar() { |
| 56 | const projects = listProjects(); |
| 57 | const active = await getActiveProject(); |
| 58 | const agentEntries = active ? await listProjectAgents(active.slug) : []; |
| 59 | // Best-effort fetch of harness usage. For Codex this hits the |
| 60 | // chatgpt.com wham/usage endpoint (cached 60s in-process); for |
| 61 | // Claude Code it just reads the local stats-cache. Either failure |
| 62 | // mode collapses to a quieter chip. |
| 63 | const harnessUsage = active |
| 64 | ? await readHarnessUsage(active.harness_adapter) |
| 65 | : null; |
| 66 | |
| 67 | return ( |
| 68 | <Sidebar collapsible="icon"> |
| 69 | <SidebarHeader> |
| 70 | {/* Brand mark + project switcher. The mark doubles as the expand |
| 71 | toggle when collapsed (SidebarBrand handles both modes); |
| 72 | SidebarTrigger only renders in the expanded state so the icon |
| 73 | rail isn't doubled up. */} |
| 74 | <div className="flex items-center gap-1"> |
| 75 | <SidebarBrand homeHref={active ? projectHref(active.slug, "") : "/"} /> |
| 76 | <div className="min-w-0 flex-1 group-data-[collapsible=icon]:hidden"> |
| 77 | <SidebarMenu> |
| 78 | <SidebarMenuItem> |
| 79 | <ProjectSwitcher |
| 80 | projects={projects} |
| 81 | activeSlug={active?.slug ?? null} |
| 82 | /> |
| 83 | </SidebarMenuItem> |
| 84 | </SidebarMenu> |
| 85 | </div> |
| 86 | <SidebarTrigger className="shrink-0 group-data-[collapsible=icon]:hidden" /> |
| 87 | </div> |
| 88 | </SidebarHeader> |
| 89 | |
| 90 | <SidebarContent> |
| 91 | {active && ( |
| 92 | <SidebarGroup> |
| 93 | <SidebarGroupLabel>Team</SidebarGroupLabel> |
| 94 | <SidebarGroupContent> |
| 95 | <AgentNav |
| 96 | projectSlug={active.slug} |
| 97 | agents={agentEntries.map((a) => ({ |
| 98 | key: a.agent_id, |
| 99 | slug: a.slug, |
| 100 | name: a.name, |
| 101 | role_label: a.template_key |
| 102 | ? TEMPLATES.find((t) => t.key === a.template_key)?.display_name |
| 103 | : undefined, |
| 104 | description: a.description, |
| 105 | template_key: a.template_key, |
| 106 | }))} |
| 107 | /> |
| 108 | </SidebarGroupContent> |
| 109 | </SidebarGroup> |
| 110 | )} |
| 111 | |
| 112 | {active && ( |
nothing calls this directly
no test coverage detected