Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

feat(web): show how many subagents are running at a glance (#5745)

Theo Brownec2f8cb7ca157
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx
index 8b510d457..26a5c41de 100644
--- a/apps/web/src/components/ChatView.tsx
+++ b/apps/web/src/components/ChatView.tsx
@@ -5913,6 +5913,11 @@ function ChatViewContent(props: ChatViewProps) {
rightPanelAvailable={activeProject !== null}
rightPanelOpen={rightPanelOpen}
rightPanelShortcutLabel={shortcutLabelForCommand(keybindings, "rightPanel.toggle")}
+ // Suppressed while the Agents surface is visible: the roster itself is
+ // on screen, so the toggle badge would be pointing at nothing.
+ liveAgentCount={
+ rightPanelOpen && activeRightPanelSurface?.kind === "agents" ? 0 : agentPanelModel.liveCount
+ }
onToggleTerminal={toggleTerminalVisibility}
onToggleRightPanel={toggleRightPanel}
/>
@@ -6419,6 +6424,7 @@ function ChatViewContent(props: ChatViewProps) {
browserAvailable={isPreviewSupportedInRuntime()}
diffAvailable={isServerThread && isGitRepo}
filesAvailable={activeProject !== null}
+ liveAgentCount={agentPanelModel.liveCount}
>
{rightPanelContent}
</RightPanelTabs>
@@ -6447,6 +6453,7 @@ function ChatViewContent(props: ChatViewProps) {
browserAvailable={isPreviewSupportedInRuntime()}
diffAvailable={isServerThread && isGitRepo}
filesAvailable={activeProject !== null}
+ liveAgentCount={agentPanelModel.liveCount}
>
{rightPanelContent}
</RightPanelTabs>
diff --git a/apps/web/src/components/RightPanelTabs.tsx b/apps/web/src/components/RightPanelTabs.tsx
index b9345ab8c..0b1700e73 100644
--- a/apps/web/src/components/RightPanelTabs.tsx
+++ b/apps/web/src/components/RightPanelTabs.tsx
@@ -48,6 +48,8 @@ interface RightPanelTabsProps {
browserAvailable: boolean;
diffAvailable: boolean;
filesAvailable: boolean;
+ /** Running + waiting subagents; badges the Agents card in the empty state. */
+ liveAgentCount: number;
children: ReactNode;
}
@@ -96,6 +98,7 @@ function RightPanelEmptyState(props: {
browserAvailable: boolean;
diffAvailable: boolean;
filesAvailable: boolean;
+ liveAgentCount: number;
}) {
const actions = [
{
@@ -105,6 +108,7 @@ function RightPanelEmptyState(props: {
available: props.browserAvailable,
disabledReason: SURFACE_DISABLED_REASONS.browser,
onClick: props.onAddBrowser,
+ badgeCount: 0,
},
{
label: "Terminal",
@@ -113,6 +117,7 @@ function RightPanelEmptyState(props: {
available: true,
disabledReason: null,
onClick: props.onAddTerminal,
+ badgeCount: 0,
},
{
label: "Files",
@@ -121,6 +126,7 @@ function RightPanelEmptyState(props: {
available: props.filesAvailable,
disabledReason: SURFACE_DISABLED_REASONS.files,
onClick: props.onAddFiles,
+ badgeCount: 0,
},
{
label: "Diff",
@@ -129,6 +135,7 @@ function RightPanelEmptyState(props: {
available: props.diffAvailable,
disabledReason: SURFACE_DISABLED_REASONS.diff,
onClick: props.onAddDiff,
+ badgeCount: 0,
},
{
label: "Agents",
@@ -137,6 +144,7 @@ function RightPanelEmptyState(props: {
available: true,
disabledReason: null,
onClick: props.onAddAgents,
+ badgeCount: props.liveAgentCount,
},
] as const;
@@ -154,7 +162,17 @@ function RightPanelEmptyState(props: {
const Icon = action.icon;
const content = (
<>
- <Icon className="mb-3 size-5" />
+ <span className="relative mb-3 inline-flex">
+ <Icon className="size-5" />
+ {action.badgeCount > 0 ? (
+ <span
+ aria-hidden
+ className="absolute -top-1.5 -right-2 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-info px-1 text-[9px] font-semibold tabular-nums text-white"
+ >
+ {action.badgeCount}
+ </span>
+ ) : null}
+ </span>
<span className="text-sm font-medium">{action.label}</span>
<span className="mt-1 text-xs leading-relaxed text-muted-foreground">
{action.description}
@@ -498,6 +516,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) {
browserAvailable={props.browserAvailable}
diffAvailable={props.diffAvailable}
filesAvailable={props.filesAvailable}
+ liveAgentCount={props.liveAgentCount}
/>
) : (
props.children
diff --git a/apps/web/src/components/chat/PanelLayoutControls.tsx b/apps/web/src/components/chat/PanelLayoutControls.tsx
index deb7b3ee9..c61826f67 100644
--- a/apps/web/src/components/chat/PanelLayoutControls.tsx
+++ b/apps/web/src/components/chat/PanelLayoutControls.tsx
@@ -11,6 +11,8 @@ interface PanelLayoutControlsProps {
rightPanelAvailable: boolean;
rightPanelOpen: boolean;
rightPanelShortcutLabel: string | null;
+ /** Running + waiting subagents in this thread; badges the right panel toggle. */
+ liveAgentCount: number;
onToggleTerminal: () => void;
onToggleRightPanel: () => void;
}
@@ -22,6 +24,7 @@ export const PanelLayoutControls = memo(function PanelLayoutControls({
rightPanelAvailable,
rightPanelOpen,
rightPanelShortcutLabel,
+ liveAgentCount,
onToggleTerminal,
onToggleRightPanel,
}: PanelLayoutControlsProps) {
@@ -59,18 +62,34 @@ export const PanelLayoutControls = memo(function PanelLayoutControls({
className="shrink-0 [-webkit-app-region:no-drag]"
pressed={rightPanelOpen}
onPressedChange={onToggleRightPanel}
- aria-label="Toggle right panel"
+ aria-label={
+ liveAgentCount > 0
+ ? `Toggle right panel, ${liveAgentCount} ${liveAgentCount === 1 ? "agent" : "agents"} working`
+ : "Toggle right panel"
+ }
variant="ghost"
size="sm"
disabled={!rightPanelAvailable}
>
<PanelRightIcon className="size-3.5" />
+ {liveAgentCount > 0 ? (
+ <span
+ aria-hidden
+ className="absolute -top-1 -right-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-info px-1 text-[9px] font-semibold tabular-nums text-white"
+ >
+ {liveAgentCount}
+ </span>
+ ) : null}
</Toggle>
}
/>
<TooltipPopup side="bottom">
{rightPanelAvailable
- ? `Toggle right panel${rightPanelShortcutLabel ? ` (${rightPanelShortcutLabel})` : ""}`
+ ? `Toggle right panel${rightPanelShortcutLabel ? ` (${rightPanelShortcutLabel})` : ""}${
+ liveAgentCount > 0
+ ? ` · ${liveAgentCount} ${liveAgentCount === 1 ? "agent" : "agents"} working`
+ : ""
+ }`
: "Right panel is unavailable"}
</TooltipPopup>
</Tooltip>