Skip to content

The agent that grows with you

fix(desktop): align status rows and share leading dismiss controls

brooklyn!b7d51a38b768
diff --git a/apps/desktop/src/app/chat/composer/queue-panel.tsx b/apps/desktop/src/app/chat/composer/queue-panel.tsx
index 4fde7cc14e3..cc1136254bd 100644
--- a/apps/desktop/src/app/chat/composer/queue-panel.tsx
+++ b/apps/desktop/src/app/chat/composer/queue-panel.tsx
@@ -4,7 +4,7 @@ import { Button } from '@/components/ui/button'
import { Codicon } from '@/components/ui/codicon'
import { Tip } from '@/components/ui/tooltip'
import { type Translations, useI18n } from '@/i18n'
-import { CornerDownLeft, iconSize, Pencil, SteeringWheel, Trash2 } from '@/lib/icons'
+import { CornerDownLeft, iconSize, Pencil, SteeringWheel } from '@/lib/icons'
import { cn } from '@/lib/utils'
import { isSteerableEntry, type QueuedPromptEntry } from '@/store/composer-queue'
@@ -77,10 +77,11 @@ export function QueuePanel({
return (
<StatusRow
className={cn(
- 'border border-transparent',
- isEditing && 'border-[color-mix(in_srgb,var(--dt-composer-ring)_40%,transparent)] bg-accent/25'
+ isEditing && 'ring-1 ring-inset ring-[color-mix(in_srgb,var(--dt-composer-ring)_40%,transparent)] bg-accent/25'
)}
+ dismiss={{ label: c.queueDelete, onDismiss: () => onDelete(entry.id) }}
key={entry.id}
+ leading={<Codicon className="text-muted-foreground/70" name="comment" size="0.8rem" />}
trailing={
<>
<Tip label={c.queueEdit}>
@@ -124,18 +125,6 @@ export function QueuePanel({
<CornerDownLeft className={iconSize.xs} />
</Button>
</Tip>
- <Tip label={c.queueDelete}>
- <Button
- aria-label={c.queueDelete}
- className="size-5 rounded-md"
- onClick={() => onDelete(entry.id)}
- size="icon-xs"
- type="button"
- variant="ghost"
- >
- <Trash2 className={iconSize.xs} />
- </Button>
- </Tip>
</>
}
trailingVisible={isEditing}
diff --git a/apps/desktop/src/app/chat/composer/status-stack/preview-row.tsx b/apps/desktop/src/app/chat/composer/status-stack/preview-row.tsx
index 13d3794c524..65ede65eed2 100644
--- a/apps/desktop/src/app/chat/composer/status-stack/preview-row.tsx
+++ b/apps/desktop/src/app/chat/composer/status-stack/preview-row.tsx
@@ -2,7 +2,6 @@ import { useStore } from '@nanostores/react'
import { memo, useState } from 'react'
import { StatusRow } from '@/components/chat/status-row'
-import { Button } from '@/components/ui/button'
import { Codicon } from '@/components/ui/codicon'
import { Tip } from '@/components/ui/tooltip'
import { useI18n } from '@/i18n'
@@ -82,6 +81,7 @@ export const PreviewStatusRow = memo(function PreviewStatusRow({ item, onDismiss
return (
<StatusRow
+ dismiss={{ label: t.statusStack.dismiss, onDismiss: () => onDismiss(item.id) }}
leading={
<Codicon
aria-hidden
@@ -100,24 +100,6 @@ export const PreviewStatusRow = memo(function PreviewStatusRow({ item, onDismiss
void openDefaultTarget()
}
}}
- trailing={
- <Tip label={t.statusStack.dismiss}>
- <Button
- aria-label={t.statusStack.dismiss}
- className="-my-1 size-4 rounded-md text-muted-foreground/60 hover:text-foreground/90"
- onClick={event => {
- event.stopPropagation()
- onDismiss(item.id)
- }}
- size="icon-xs"
- type="button"
- variant="ghost"
- >
- <Codicon name="close" size="0.75rem" />
- </Button>
- </Tip>
- }
- trailingVisible
>
<Tip
label={
diff --git a/apps/desktop/src/app/chat/composer/status-stack/session-control-goal.tsx b/apps/desktop/src/app/chat/composer/status-stack/session-control-goal.tsx
index 60881ce3135..4405a25597e 100644
--- a/apps/desktop/src/app/chat/composer/status-stack/session-control-goal.tsx
+++ b/apps/desktop/src/app/chat/composer/status-stack/session-control-goal.tsx
@@ -2,6 +2,9 @@ import { memo, useCallback, useState } from 'react'
import { queueKickoffIfSessionBusy } from '@/app/session/hooks/use-prompt-actions/queue-if-busy'
import type { SubmitTextOptions } from '@/app/session/hooks/use-prompt-actions/utils'
+import { StatusControlRow } from '@/components/chat/status-control-row'
+import { StatusPendingIcon } from '@/components/chat/status-pending-icon'
+import { StatusRow } from '@/components/chat/status-row'
import { StatusSection } from '@/components/chat/status-section'
import { Button } from '@/components/ui/button'
import { Codicon } from '@/components/ui/codicon'
@@ -327,117 +330,121 @@ export const SessionControlGoalSection = memo(function SessionControlGoalSection
icon={<Codicon className={iconClass} name="target" size="0.8rem" />}
label={headerLabel}
>
- <div className="space-y-1.5 px-1 py-1">
- {/* Full goal title */}
- <div className="text-xs font-normal leading-relaxed text-foreground/92 break-words">{goal.title}</div>
-
- {/* Optional reasons */}
+ <div>
+ <StatusControlRow className="text-[0.73rem] leading-4 text-foreground/92 break-words" icon="flag">
+ {goal.title}
+ </StatusControlRow>
{!detailsOpen && goal.wait_barrier && (
- <div className="text-[0.7rem] italic text-muted-foreground/80">
+ <StatusControlRow>
{goal.wait_barrier.reason
? `${ctrl.waitBarrierTitle}: ${goal.wait_barrier.reason}`
: ctrl.waitBarrierTitle}
- </div>
+ </StatusControlRow>
)}
{!goal.wait_barrier && goal.paused_reason && (
- <div className="text-[0.7rem] italic text-muted-foreground/80">{goal.paused_reason}</div>
+ <StatusControlRow>{goal.paused_reason}</StatusControlRow>
)}
{!goal.wait_barrier && !goal.paused_reason && goal.last_reason && (
- <div className="text-[0.7rem] italic text-muted-foreground/80">{goal.last_reason}</div>
+ <StatusControlRow>{goal.last_reason}</StatusControlRow>
)}
-
- {/* View details button */}
{hasDetails && (
- <div>
+ <StatusControlRow icon="eye">
<Button
className="text-[0.7rem] text-muted-foreground/75 hover:text-foreground/90"
onClick={() => setDetailsOpen(true)}
- size="micro"
+ size="inline"
type="button"
variant="text"
>
{ctrl.viewDetails}
</Button>
- </div>
+ </StatusControlRow>
)}
{/* Criteria subsection */}
- <div className="mt-2 border-t border-(--ui-stroke-tertiary)/40 pt-1.5">
- <div className="flex items-center justify-between pb-1 text-[0.68rem] font-medium text-muted-foreground/75">
- <div className="flex items-center gap-1.5">
- <span aria-hidden="true" className={`inline-flex ${iconClass}`} data-slot="criteria-state-marker">
- <Codicon name="target" size="0.68rem" />
+ <div className="mt-1.5 border-t border-(--ui-stroke-tertiary)/40 pt-1.5">
+ <StatusRow
+ className="text-[0.68rem] font-medium text-muted-foreground/75"
+ leading={
+ <span aria-hidden="true" className="inline-flex text-muted-foreground/70" data-slot="criteria-state-marker">
+ <Codicon name="checklist" size="0.8rem" />
</span>
- <span>{ctrl.criteriaHeader(goal.subgoals.length)}</span>
- </div>
- <div className="flex items-center gap-1">
- <Button
- className="text-[0.68rem] text-muted-foreground/75 hover:text-foreground/90"
- disabled={isBusy}
- onClick={openAddCriterion}
- size="micro"
- type="button"
- variant="text"
- >
- {ctrl.addCriterion}
- </Button>
- {goal.subgoals.length > 0 && (
+ }
+ trailing={
+ <div className="flex items-center gap-1">
<Button
- className="text-[0.68rem] text-muted-foreground/60 hover:text-destructive"
+ className="text-[0.68rem] text-muted-foreground/75 hover:text-foreground/90"
disabled={isBusy}
- onClick={confirmClearCriteria}
+ onClick={openAddCriterion}
size="micro"
type="button"
variant="text"
>
- {ctrl.clearCriteria}
+ {ctrl.addCriterion}
</Button>
- )}
- </div>
- </div>
+ {goal.subgoals.length > 0 && (
+ <Button
+ className="text-[0.68rem] text-muted-foreground/60 hover:text-destructive"
+ disabled={isBusy}
+ onClick={confirmClearCriteria}
+ size="micro"
+ type="button"
+ variant="text"
+ >
+ {ctrl.clearCriteria}
+ </Button>
+ )}
+ </div>
+ }
+ trailingVisible
+ >
+ {ctrl.criteriaHeader(goal.subgoals.length)}
+ </StatusRow>
{goal.subgoals.length > 0 ? (
- <div className="space-y-1">
+ <div>
{goal.subgoals.map((subgoal, idx) => {
const index = idx + 1
return (
- <div
- className="group/criterion flex items-start justify-between gap-1.5 rounded px-1 py-0.5 text-xs text-foreground/85 hover:bg-(--ui-control-active-background)/40"
+ <StatusRow
+ className="text-xs leading-4 text-foreground/85"
+ depth={1}
key={`${index}-${subgoal}`}
+ leading={<StatusPendingIcon />}
+ trailing={
+ <div className="flex shrink-0 items-center gap-0.5">
+ <Tip label={ctrl.copyCriterion(index)}>
+ <Button
+ aria-label={ctrl.copyCriterion(index)}
+ className="size-6 rounded text-muted-foreground/60 hover:text-foreground/90"
+ onClick={() => void copyCriterionText(subgoal)}
+ size="icon-xs"
+ type="button"
+ variant="ghost"
+ >
+ <Codicon name="copy" size="0.7rem" />
+ </Button>
+ </Tip>
+ <Tip label={ctrl.removeCriterion(index)}>
+ <Button
+ aria-label={ctrl.removeCriterion(index)}
+ className="size-6 rounded text-muted-foreground/60 hover:text-destructive"
+ disabled={isBusy}
+ onClick={() => confirmRemoveCriterion(index)}
+ size="icon-xs"
+ type="button"
+ variant="ghost"
+ >
+ <Codicon name="close" size="0.7rem" />
+ </Button>
+ </Tip>
+ </div>
+ }
>
- <div className="flex min-w-0 flex-1 items-start gap-1.5 leading-relaxed">
- <span className="shrink-0 text-muted-foreground/60 tabular-nums">{index}.</span>
- <span className="break-words">{subgoal}</span>
- </div>
- <div className="flex shrink-0 items-center gap-0.5 opacity-80 group-hover/criterion:opacity-100">
- <Tip label={ctrl.copyCriterion(index)}>
- <Button
- aria-label={ctrl.copyCriterion(index)}
- className="size-6 rounded text-muted-foreground/60 hover:text-foreground/90"
- onClick={() => void copyCriterionText(subgoal)}
- size="icon-xs"
- type="button"
- variant="ghost"
- >
- <Codicon name="copy" size="0.7rem" />
- </Button>
- </Tip>
- <Tip label={ctrl.removeCriterion(index)}>
- <Button
- aria-label={ctrl.removeCriterion(index)}
- className="size-6 rounded text-muted-foreground/60 hover:text-destructive"
- disabled={isBusy}
- onClick={() => confirmRemoveCriterion(index)}
- size="icon-xs"
- type="button"
- variant="ghost"
- >
- <Codicon name="close" size="0.7rem" />
- </Button>
- </Tip>
- </div>
- </div>
+ <span className="sr-only">{index}.</span>
+ <span className="break-words">{subgoal}</span>
+ </StatusRow>
)
})}
</div>
diff --git a/apps/desktop/src/app/chat/composer/status-stack/session-control-heartbeat.tsx b/apps/desktop/src/app/chat/composer/status-stack/session-control-heartbeat.tsx
index d469add52e1..7d5891b013e 100644
--- a/apps/desktop/src/app/chat/composer/status-stack/session-control-heartbeat.tsx
+++ b/apps/desktop/src/app/chat/composer/status-stack/session-control-heartbeat.tsx
@@ -1,5 +1,6 @@
import { memo, useCallback, useEffect, useState } from 'react'
+import { StatusControlRow } from '@/components/chat/status-control-row'
import { StatusSection } from '@/components/chat/status-section'
import { Button } from '@/components/ui/button'
import { Codicon } from '@/components/ui/codicon'
@@ -188,11 +189,13 @@ export const SessionControlHeartbeatSection = memo(function SessionControlHeartb
icon={<Codicon className={iconClass} name="pulse" size="0.8rem" />}
label={headerLabel}
>
- <div className="space-y-1 px-1 py-1 text-xs">
- <div className="text-foreground/92 leading-relaxed break-words">{heartbeat.prompt}</div>
- <div className="text-[0.7rem] text-muted-foreground/80">
- <span>{ctrl.heartbeatFiredCount(heartbeat.fire_count)}</span>
- </div>
+ <div>
+ <StatusControlRow className="text-[0.73rem] leading-4 text-foreground/92 break-words" icon="bell">
+ {heartbeat.prompt}
+ </StatusControlRow>
+ <StatusControlRow icon="history">
+ {ctrl.heartbeatFiredCount(heartbeat.fire_count)}
+ </StatusControlRow>
</div>
</StatusSection>
</div>
diff --git a/apps/desktop/src/app/chat/composer/status-stack/session-control-loop.tsx b/apps/desktop/src/app/chat/composer/status-stack/session-control-loop.tsx
index de0d8864624..5c3bf49d4fb 100644
--- a/apps/desktop/src/app/chat/composer/status-stack/session-control-loop.tsx
+++ b/apps/desktop/src/app/chat/composer/status-stack/session-control-loop.tsx
@@ -1,5 +1,6 @@
import { memo, useCallback, useState } from 'react'
+import { StatusControlRow } from '@/components/chat/status-control-row'
import { StatusSection } from '@/components/chat/status-section'
import { Button } from '@/components/ui/button'
import { Codicon } from '@/components/ui/codicon'
@@ -195,32 +196,34 @@ export const SessionControlLoopSection = memo(function SessionControlLoopSection
icon={<Codicon className={iconClass} name="sync" size="0.8rem" />}
label={headerLabel}
>
- <div className="space-y-1 px-1 py-1 text-xs">
- <div className="text-foreground/92 leading-relaxed break-words">{loop.prompt}</div>
- <div className="text-[0.7rem] text-muted-foreground/80">
+ <div>
+ <StatusControlRow className="text-[0.73rem] leading-4 text-foreground/92 break-words" icon="comment">
+ {loop.prompt}
+ </StatusControlRow>
+ <StatusControlRow icon="clock">
<span>
{ctrl.loopCadenceLabel}:{' '}
{loop.mode === 'self_paced' ? ctrl.loopSelfPaced : formatInterval(loop.interval_seconds, t)}
</span>
- </div>
+ </StatusControlRow>
{loop.until && (
- <div className="text-[0.7rem] text-muted-foreground/80">
+ <StatusControlRow icon="flag">
<span>
{ctrl.loopUntilLabel}: {loop.until}
</span>
- </div>
+ </StatusControlRow>
)}
{loop.deferred_by_goal && (
- <div className="text-[0.7rem] italic text-muted-foreground/80">{ctrl.loopDeferredNotice}</div>
+ <StatusControlRow>{ctrl.loopDeferredNotice}</StatusControlRow>
)}
{loop.awaiting_response && (
- <div className="text-[0.7rem] italic text-muted-foreground/80">{ctrl.loopAwaitingResponse}</div>
+ <StatusControlRow>{ctrl.loopAwaitingResponse}</StatusControlRow>
)}
{loop.paused_reason && (
- <div className="text-[0.7rem] italic text-muted-foreground/80">{loop.paused_reason}</div>
+ <StatusControlRow>{loop.paused_reason}</StatusControlRow>
)}
{loop.last_stop_reason && (
- <div className="text-[0.7rem] italic text-muted-foreground/80">{loop.last_stop_reason}</div>
+ <StatusControlRow>{loop.last_stop_reason}</StatusControlRow>
)}
</div>
</StatusSection>
diff --git a/apps/desktop/src/app/chat/composer/status-stack/status-row.tsx b/apps/desktop/src/app/chat/composer/status-stack/status-row.tsx
index 9c0959b92f9..56ee644f03c 100644
--- a/apps/desktop/src/app/chat/composer/status-stack/status-row.tsx
+++ b/apps/desktop/src/app/chat/composer/status-stack/status-row.tsx
@@ -1,11 +1,10 @@
import { Fragment, memo, type ReactNode } from 'react'
import { openAgentTerminal } from '@/app/right-sidebar/terminal/terminals'
+import { StatusPendingIcon } from '@/components/chat/status-pending-icon'
import { StatusRow } from '@/components/chat/status-row'
-import { Button } from '@/components/ui/button'
import { Codicon } from '@/components/ui/codicon'
import { GlyphSpinner } from '@/components/ui/glyph-spinner'
-import { Tip } from '@/components/ui/tooltip'
import { type Translations, useI18n } from '@/i18n'
import { capitalize } from '@/lib/text'
import type { TodoStatus } from '@/lib/todos'
@@ -44,12 +43,7 @@ function leadingGlyph(item: ComposerStatusItem, s: Translations['statusStack']):
}
if (item.todoStatus === 'pending') {
- return (
- <span
- aria-hidden
- className="box-border size-[0.7rem] rounded-full border border-dashed border-muted-foreground/60"
- />
- )
+ return <StatusPendingIcon />
}
if (item.todoStatus && item.todoStatus !== 'in_progress') {
@@ -114,34 +108,12 @@ export const StatusItemRow = memo(function StatusItemRow({ item, onDismiss, onOp
return (
<Fragment>
<StatusRow
- leading={
- item.depth ? (
- <span className="flex items-center" style={{ paddingLeft: `${Math.min(item.depth, 4) * 0.8}rem` }}>
- {leadingGlyph(item, s)}
- </span>
- ) : (
- leadingGlyph(item, s)
- )
- }
+ depth={Math.min(item.depth ?? 0, 4)}
+ dismiss={action ? { label: action.label, onDismiss: action.onClick } : undefined}
+ leading={leadingGlyph(item, s)}
onActivate={onActivate}
trailing={
- action ? (
- <Tip label={action.label}>
- <Button
- aria-label={action.label}
- className="-my-1 size-4 rounded-md text-muted-foreground/60 hover:text-foreground/90"
- onClick={event => {
- event.stopPropagation()
- action.onClick()
- }}
- size="icon-xs"
- type="button"
- variant="ghost"
- >
- <Codicon name="close" size="0.75rem" />
- </Button>
- </Tip>
- ) : canOpen ? (
+ canOpen ? (
<Codicon aria-hidden className="text-muted-foreground/55" name="link-external" size="0.85rem" />
) : undefined
}
diff --git a/apps/desktop/src/app/chat/composer/status-stack/subagent-section.tsx b/apps/desktop/src/app/chat/composer/status-stack/subagent-section.tsx
index 186ae1ea1aa..53506c2d7c5 100644
--- a/apps/desktop/src/app/chat/composer/status-stack/subagent-section.tsx
+++ b/apps/desktop/src/app/chat/composer/status-stack/subagent-section.tsx
@@ -2,6 +2,7 @@ import { useState } from 'react'
import { SubagentRow } from '@/app/agents'
import { ActivityTimerText } from '@/components/chat/activity-timer-text'
+import { StatusRow } from '@/components/chat/status-row'
import { StatusSection } from '@/components/chat/status-section'
import { Codicon } from '@/components/ui/codicon'
import { GlyphSpinner } from '@/components/ui/glyph-spinner'
@@ -34,29 +35,32 @@ export function SubagentSection({ sessionId }: SubagentSectionProps) {
}
const row = (item: SubagentProgress) => (
- <button
- aria-expanded={selected === item.id}
- className="flex w-full min-w-0 items-start gap-2 px-2 py-1 text-left"
+ <StatusRow
+ expanded={selected === item.id}
key={item.id}
- onClick={() => setSelected(selected === item.id ? null : item.id)}
- type="button"
+ leading={
+ <GlyphSpinner
+ ariaLabel={item.status === 'queued' ? t.agents.queued : t.agents.running}
+ className="text-(--ui-purple)"
+ spinner="braille"
+ />
+ }
+ onActivate={() => setSelected(selected === item.id ? null : item.id)}
+ trailing={
+ <ActivityTimerText
+ className="shrink-0 text-[0.65rem]"
+ seconds={Math.max(0, Math.floor((nowMs - item.startedAt) / 1000))}
+ />
+ }
+ trailingVisible
>
- <GlyphSpinner
- ariaLabel={item.status === 'queued' ? t.agents.queued : t.agents.running}
- className="mt-0.5 shrink-0 text-(--ui-purple)"
- spinner="braille"
- />
<span className="min-w-0 flex-1">
<span className="block truncate text-xs text-(--ui-text-primary)">{item.goal}</span>
<span className="block truncate text-[0.68rem] text-(--ui-text-tertiary)">
{item.stream.at(-1)?.text || (item.status === 'queued' ? t.agents.queued : t.agents.waitingActivity)}
</span>
</span>
- <ActivityTimerText
- className="shrink-0 text-[0.65rem]"
- seconds={Math.max(0, Math.floor((nowMs - item.startedAt) / 1000))}
- />
- </button>
+ </StatusRow>
)
const detail = live.find(item => item.id === selected)
@@ -74,10 +78,10 @@ export function SubagentSection({ sessionId }: SubagentSectionProps) {
icon={<Codicon className="text-(--ui-purple)" name="agent" size="0.8rem" />}
label={t.statusStack.subagents(live.length)}
>
- <div className="max-h-[25vh] overflow-y-auto overscroll-contain">{live.map(row)}</div>
+ <div className="max-h-[25vh] overflow-y-auto overscroll-y-auto">{live.map(row)}</div>
{detail && (
<div
- className="max-h-[25vh] overflow-y-auto overscroll-contain px-3 py-2"
+ className="status-subagent-detail max-h-[25vh] overflow-y-auto overscroll-y-auto pr-3 py-2"
data-slot="composer-subagent-detail"
>
<SubagentControls
diff --git a/apps/desktop/src/components/chat/status-control-row.tsx b/apps/desktop/src/components/chat/status-control-row.tsx
new file mode 100644
index 00000000000..0525a1cb5a4
--- /dev/null
+++ b/apps/desktop/src/components/chat/status-control-row.tsx
@@ -0,0 +1,24 @@
+import type { ReactNode } from 'react'
+
+import { Codicon } from '@/components/ui/codicon'
+import { cn } from '@/lib/utils'
+
+import { StatusRow } from './status-row'
+
+interface StatusControlRowProps {
+ children: ReactNode
+ className?: string
+ icon?: string
+}
+
+/** Text/detail rows share the task icon column without decorating supporting copy. */
+export function StatusControlRow({ children, className, icon }: StatusControlRowProps) {
+ return (
+ <StatusRow
+ className={cn('status-control-row text-[0.7rem] text-muted-foreground/80', className)}
+ leading={icon ? <Codicon className="text-muted-foreground/70" name={icon} size="0.8rem" /> : undefined}
+ >
+ {children}
+ </StatusRow>
+ )
+}
diff --git a/apps/desktop/src/components/chat/status-dismiss-button.tsx b/apps/desktop/src/components/chat/status-dismiss-button.tsx
new file mode 100644
index 00000000000..5a5a678e452
--- /dev/null
+++ b/apps/desktop/src/components/chat/status-dismiss-button.tsx
@@ -0,0 +1,28 @@
+import { Button } from '@/components/ui/button'
+import { Codicon } from '@/components/ui/codicon'
+
+interface StatusDismissButtonProps {
+ label: string
+ onDismiss: () => void
+}
+
+/** The leading close control shared by artifacts, background work and queued prompts. */
+export function StatusDismissButton({ label, onDismiss }: StatusDismissButtonProps) {
+ return (
+ <Button
+ aria-label={label}
+ className="status-dismiss-button text-muted-foreground/60 hover:text-foreground/90"
+ data-slot="status-dismiss"
+ onClick={event => {
+ event.stopPropagation()
+ onDismiss()
+ }}
+ onKeyDown={event => event.stopPropagation()}
+ size="icon-xs"
+ type="button"
+ variant="ghost"
+ >
+ <Codicon name="close" size="0.8rem" />
+ </Button>
+ )
+}
diff --git a/apps/desktop/src/components/chat/status-pending-icon.tsx b/apps/desktop/src/components/chat/status-pending-icon.tsx
new file mode 100644
index 00000000000..82c1ed0cafe
--- /dev/null
+++ b/apps/desktop/src/components/chat/status-pending-icon.tsx
@@ -0,0 +1,9 @@
+/** Neutral, unfinished state shared by pending tasks and goal criteria. */
+export function StatusPendingIcon() {
+ return (
+ <span
+ aria-hidden
+ className="box-border size-[0.7rem] rounded-full border border-dashed border-muted-foreground/60"
+ />
+ )
+}
diff --git a/apps/desktop/src/components/chat/status-row.test.tsx b/apps/desktop/src/components/chat/status-row.test.tsx
new file mode 100644
index 00000000000..3cc7b408c8e
--- /dev/null
+++ b/apps/desktop/src/components/chat/status-row.test.tsx
@@ -0,0 +1,100 @@
+import { cleanup, fireEvent, render, screen, within } from '@testing-library/react'
+import { afterEach, expect, it, vi } from 'vitest'
+
+import { QueuePanel } from '@/app/chat/composer/queue-panel'
+import { PreviewStatusRow } from '@/app/chat/composer/status-stack/preview-row'
+import { StatusItemRow } from '@/app/chat/composer/status-stack/status-row'
+import { Codicon } from '@/components/ui/codicon'
+import { I18nProvider } from '@/i18n'
+
+import { StatusRow } from './status-row'
+
+vi.stubGlobal('ResizeObserver', class {
+ observe() {}
+ unobserve() {}
+ disconnect() {}
+})
+
+afterEach(cleanup)
+
+it('keeps dismiss and nested controls independent from row activation', () => {
+ const activate = vi.fn()
+ const dismiss = vi.fn()
+ const action = vi.fn()
+
+ const { container } = render(
+ <div data-slot="composer-status-stack">
+ <StatusRow
+ dismiss={{ label: 'Dismiss task', onDismiss: dismiss }}
+ leading={<Codicon name="comment" />}
+ onActivate={activate}
+ trailing={<button onClick={event => { event.stopPropagation(); action() }}>Edit task</button>}
+ >
+ <span>Task title</span>
+ </StatusRow>
+ </div>
+ )
+
+ const row = container.querySelector<HTMLElement>('[data-slot="status-row"]')!
+ const close = screen.getByRole('button', { name: 'Dismiss task' })
+ fireEvent.keyDown(close, { key: 'Enter' })
+ fireEvent.click(close)
+ expect(dismiss).toHaveBeenCalledOnce()
+ expect(activate).not.toHaveBeenCalled()
+ fireEvent.keyDown(screen.getByRole('button', { name: 'Edit task' }), { key: ' ' })
+ fireEvent.click(screen.getByRole('button', { name: 'Edit task' }))
+ expect(action).toHaveBeenCalledOnce()
+ expect(activate).not.toHaveBeenCalled()
+ fireEvent.keyDown(row, { key: 'Enter' })
+ fireEvent.keyDown(row, { key: ' ' })
+ expect(activate).toHaveBeenCalledTimes(2)
+})
+
+it('uses the same leading dismiss control for queued messages, artifacts and background work', () => {
+ const deleteQueued = vi.fn()
+ const dismissArtifact = vi.fn()
+ const stopBackground = vi.fn()
+
+ const { container } = render(
+ <I18nProvider configClient={null} initialLocale="en">
+ <div data-slot="composer-status-stack">
+ <QueuePanel
+ busy={false}
+ editingId={null}
+ entries={[{ id: 'queued', text: 'Queued message', attachments: [], queuedAt: 0 }]}
+ onDelete={deleteQueued}
+ onEdit={vi.fn()}
+ onResume={vi.fn()}
+ onSendNow={vi.fn()}
+ parked
+ />
+ <PreviewStatusRow
+ item={{ id: 'artifact', label: 'report.html', target: '/tmp/report.html', cwd: '/tmp' }}
+ onDismiss={dismissArtifact}
+ />
+ <StatusItemRow
+ item={{ id: 'process', title: 'Background task', type: 'background', state: 'running' }}
+ onStop={stopBackground}
+ />
+ </div>
+ </I18nProvider>
+ )
+
+ fireEvent.click(screen.getByRole('button', { name: /1 Queued/ }))
+ const buttons = [...container.querySelectorAll<HTMLButtonElement>('[data-slot="status-dismiss"]')]
+ expect(buttons).toHaveLength(3)
+ const reference = buttons[0]!
+
+ for (const button of buttons) {
+ expect(button.className).toBe(reference.className)
+ expect(button.querySelector('.codicon-close')?.outerHTML).toBe(reference.querySelector('.codicon-close')?.outerHTML)
+ expect(button.closest('[data-slot="status-row"]')?.firstElementChild?.contains(button)).toBe(true)
+ }
+
+ fireEvent.click(within(container).getByRole('button', { name: 'Delete' }))
+ fireEvent.click(within(container).getByRole('button', { name: 'Dismiss' }))
+ fireEvent.click(within(container).getByRole('button', { name: 'Stop' }))
+ expect(deleteQueued).toHaveBeenCalledWith('queued')
+ expect(dismissArtifact).toHaveBeenCalledWith('artifact')
+ expect(stopBackground).toHaveBeenCalledWith('process')
+})
diff --git a/apps/desktop/src/components/chat/status-row.tsx b/apps/desktop/src/components/chat/status-row.tsx
index 316b8b0619c..f99b817059e 100644
--- a/apps/desktop/src/components/chat/status-row.tsx
+++ b/apps/desktop/src/components/chat/status-row.tsx
@@ -1,10 +1,17 @@
-import { type KeyboardEvent, type MouseEvent, type ReactNode, type Ref } from 'react'
+import './status-stack.css'
+
+import { type CSSProperties, type KeyboardEvent, type MouseEvent, type ReactNode, type Ref } from 'react'
import { cn } from '@/lib/utils'
+import { StatusDismissButton } from './status-dismiss-button'
+
interface StatusRowProps {
children: ReactNode
className?: string
+ depth?: number
+ dismiss?: { label: string; onDismiss: () => void }
+ expanded?: boolean
/** Leading glyph slot (spinner / status dot / selection circle). */
leading?: ReactNode
/** Makes the whole row activatable (adds `cursor-pointer` + keyboard a11y).
@@ -23,14 +30,15 @@ interface StatusRowProps {
/**
* Shared row chrome for everything in the composer status stack — status items
- * (subagents, background) AND queued prompts. Fixed height, a leading glyph
- * slot, flexible content, and a trailing actions slot that reveals on hover.
- * Hover background matches the session sidebar. Consumers fill the three slots;
- * they never re-implement the row container.
+ * (subagents, background) and queued prompts. Icons and dismiss controls align
+ * with the first text line; section nesting and row padding share one CSS grid.
*/
export function StatusRow({
children,
className,
+ depth = 0,
+ dismiss,
+ expanded,
leading,
onActivate,
onContextMenu,
@@ -40,18 +48,21 @@ export function StatusRow({
}: StatusRowProps) {
return (
<div
+ aria-expanded={expanded}
className={cn(
- 'group/status-row flex min-h-6 items-center gap-2 rounded-md px-1.5 py-1',
+ 'group/status-row status-row flex min-h-6 items-center gap-2 rounded-md px-1.5 py-1',
// row-hover bundles cursor:pointer — only when the row actually activates.
onActivate ? 'row-hover' : 'hover:bg-(--ui-row-hover-background)',
className
)}
+ data-slot="status-row"
+ data-status-icon={leading !== undefined ? '' : undefined}
onClick={onActivate}
onContextMenu={onContextMenu}
onKeyDown={
onActivate
? event => {
- if (event.key === 'Enter' || event.key === ' ') {
+ if (event.target === event.currentTarget && (event.key === 'Enter' || event.key === ' ')) {
event.preventDefault()
onActivate(event)
}
@@ -60,14 +71,22 @@ export function StatusRow({
}
ref={ref}
role={onActivate ? 'button' : undefined}
+ style={{ '--status-row-depth': depth } as CSSProperties}
tabIndex={onActivate ? 0 : undefined}
>
- {leading !== undefined && <span className="flex size-3.5 shrink-0 items-center justify-center">{leading}</span>}
- <div className="flex min-w-0 flex-1 items-center gap-2">{children}</div>
+ {dismiss && (
+ <span className="status-row-dismiss">
+ <StatusDismissButton label={dismiss.label} onDismiss={dismiss.onDismiss} />
+ </span>
+ )}
+ {leading !== undefined && (
+ <span className="status-row-icon flex size-3.5 shrink-0 items-center justify-center">{leading}</span>
+ )}
+ <div className="status-row-content flex min-w-0 flex-1 items-center gap-2">{children}</div>
{trailing && (
<div
className={cn(
- 'flex shrink-0 items-center gap-0.5',
+ 'status-row-actions flex shrink-0 items-center gap-0.5',
!trailingVisible && 'opacity-0 group-hover/status-row:opacity-100 group-focus-within/status-row:opacity-100'
)}
>
diff --git a/apps/desktop/src/components/chat/status-section.tsx b/apps/desktop/src/components/chat/status-section.tsx
index 1a9847a83ca..b07ed1a1bf5 100644
--- a/apps/desktop/src/components/chat/status-section.tsx
+++ b/apps/desktop/src/components/chat/status-section.tsx
@@ -1,3 +1,5 @@
+import './status-stack.css'
+
import { type ReactNode, useState } from 'react'
import { DisclosureCaret } from '@/components/ui/disclosure-caret'
@@ -35,22 +37,22 @@ export function StatusSection({
const [collapsed, setCollapsed] = useState(defaultCollapsed)
return (
- <div>
- <div className="flex items-center gap-1 pr-1">
+ <div data-slot="status-section">
+ <div className="status-section-header flex items-center gap-1 pr-1">
<button
aria-expanded={!collapsed}
- className="flex min-w-0 flex-1 items-center gap-1.5 px-2 py-1 text-left text-xs font-normal text-muted-foreground/92 transition-colors hover:text-foreground/90"
+ className="status-section-trigger flex min-w-0 flex-1 items-center gap-1.5 px-2 py-1 text-left text-xs font-normal text-muted-foreground/92 transition-colors hover:text-foreground/90"
onClick={() => setCollapsed(open => !open)}
type="button"
>
<DisclosureCaret className="shrink-0" open={!collapsed} size="1em" />
- {icon && <span className="flex shrink-0 items-center">{icon}</span>}
+ {icon && <span className="status-section-icon flex shrink-0 items-center">{icon}</span>}
<span className="min-w-0 truncate">{label}</span>
{collapsedIndicator && <span className="flex shrink-0 items-center">{collapsedIndicator}</span>}
</button>
{accessory && <div className="flex shrink-0 items-center gap-1">{accessory}</div>}
</div>
- {(!collapsed || preview) && <div className="px-1 pb-0.5">{collapsed ? preview : children}</div>}
+ {(!collapsed || preview) && <div className="status-section-body">{collapsed ? preview : children}</div>}
</div>
)
}
diff --git a/apps/desktop/src/components/chat/status-stack.css b/apps/desktop/src/components/chat/status-stack.css
new file mode 100644
index 00000000000..b2012f894ff
--- /dev/null
+++ b/apps/desktop/src/components/chat/status-stack.css
@@ -0,0 +1,124 @@
+/* Shared columns: action, state glyph, content, optional trailing actions. */
+[data-slot='composer-status-stack'] {
+ --status-nest: 0.25rem;
+ --status-section-indent: 0rem;
+ --status-action-width: 0.75rem;
+ --status-icon-width: 0.8rem;
+ --status-gap: 0.375rem;
+}
+
+[data-slot='composer-status-stack'] .status-section-body {
+ --status-section-indent: var(--status-nest);
+ padding: 0;
+}
+
+[data-slot='composer-status-stack'] .status-row {
+ --status-inset: calc(0.5rem + var(--status-section-indent) + var(--status-row-depth, 0) * var(--status-nest));
+ display: grid;
+ grid-template-columns: var(--status-action-width) var(--status-icon-width) minmax(0, 1fr) auto;
+ align-items: start;
+ gap: var(--status-gap);
+ padding: 0.25rem 0.625rem 0.25rem var(--status-inset);
+ border-radius: 0;
+}
+
+[data-slot='composer-status-stack'] .status-row-icon {
+ grid-column: 2;
+ grid-row: 1;
+ width: var(--status-icon-width);
+ height: 1rem;
+}
+
+[data-slot='composer-status-stack'] .status-row-content {
+ grid-column: 3;
+ grid-row: 1;
+ align-items: start;
+}
+
+[data-slot='composer-status-stack'] .status-row-dismiss {
+ grid-column: 1;
+ grid-row: 1;
+ display: flex;
+ justify-content: center;
+ height: 1rem;
+}
+
+.status-dismiss-button {
+ width: 1rem;
+ height: 1rem;
+ margin: 0;
+}
+
+.status-dismiss-button > .codicon {
+ transform: translateY(-0.03125rem);
+}
+
+[data-slot='composer-status-stack'] .status-row-actions {
+ grid-column: 4;
+ grid-row: 1;
+ align-self: start;
+}
+
+[data-slot='composer-status-stack'] .status-row-actions > button {
+ margin-top: -0.125rem;
+}
+
+[data-slot='composer-status-stack'] .status-section-icon {
+ width: var(--status-icon-width);
+ justify-content: center;
+}
+
+[data-slot='composer-status-stack'] .status-section-body > .status-row:last-child {
+ padding-bottom: 0.375rem;
+}
+
+[data-slot='composer-status-stack'] .status-artifacts > .status-row:first-child {
+ padding-top: 0.375rem;
+}
+
+[data-slot='composer-status-stack'] .status-artifacts > .status-row:last-child {
+ padding-bottom: 0.375rem;
+}
+
+/* The first row owns the extra inset so its hover fill still reaches the shell. */
+[data-slot='status-stack-section']:first-child > [data-slot='status-section'] > .status-section-header > button,
+[data-slot='status-stack-section']:first-child > :first-child > [data-slot='status-section'] > .status-section-header > button {
+ padding-top: 0.5rem;
+}
+
+[data-slot='status-stack-section']:first-child > [data-slot='status-section'] > .status-section-header > div,
+[data-slot='status-stack-section']:first-child > :first-child > [data-slot='status-section'] > .status-section-header > div {
+ align-self: start;
+ padding-top: 0.25rem;
+}
+
+[data-slot='status-stack-section']:first-child > .status-artifacts > .status-row:first-child,
+[data-slot='status-stack-section']:first-child > .status-row {
+ padding-top: 0.625rem;
+}
+
+[data-slot='composer-status-stack'] .status-control-row {
+ min-height: 0;
+ padding-top: 0.125rem;
+ padding-bottom: 0.125rem;
+}
+
+[data-slot='composer-status-stack'] .status-control-row:first-child {
+ padding-top: 0.25rem;
+}
+
+[data-slot='composer-status-stack'] .status-control-row:last-child {
+ padding-bottom: 0.375rem;
+}
+
+[data-slot='composer-status-stack'] .status-control-row .status-row-content {
+ display: block;
+}
+
+[data-slot='composer-status-stack'] .status-control-row:not([data-status-icon]) {
+ background: none;
+}
+
+[data-slot='composer-status-stack'] .status-subagent-detail {
+ padding-left: calc(0.5rem + var(--status-nest) * 2 + var(--status-action-width) + var(--status-icon-width) + var(--status-gap) * 2);
+}