feat(web): show how many subagents are running at a glance (#5745)
Co-authored-by: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
89ee692bf0
commit
c2f8cb7ca1
3 files changed
+48
-3
No files matched your search
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user