Skip to content

The agent that grows with you

refactor(desktop): compose the shared lead cell instead of copying it

Brooklyn Nicholsonff5c5b4ae8e3
diff --git a/apps/desktop/src/components/assistant-ui/tool/delegate.tsx b/apps/desktop/src/components/assistant-ui/tool/delegate.tsx
index 8ec3d92b243..2c756176282 100644
--- a/apps/desktop/src/components/assistant-ui/tool/delegate.tsx
+++ b/apps/desktop/src/components/assistant-ui/tool/delegate.tsx
@@ -6,7 +6,7 @@ import { type FC, type ReactNode, useMemo } from 'react'
import { useSessionView } from '@/app/chat/session-view'
import { useElapsedSeconds } from '@/components/chat/activity-timer'
import { ActivityTimerText } from '@/components/chat/activity-timer-text'
-import { SCAFFOLD_LABEL_CLASS, SCAFFOLD_META_CLASS } from '@/components/chat/scaffold-row'
+import { SCAFFOLD_GLYPH_CLASS, SCAFFOLD_LABEL_CLASS, SCAFFOLD_META_CLASS } from '@/components/chat/scaffold-row'
import { FadeText } from '@/components/ui/fade-text'
import { GlyphSpinner } from '@/components/ui/glyph-spinner'
import { useI18n } from '@/i18n'
@@ -88,7 +88,7 @@ function DelegateRowView({ row }: { row: DelegateRow }) {
return (
<div className="grid min-w-0 max-w-full gap-0.5" data-conversation-scaffold="">
<div className="flex min-w-0 max-w-full items-center gap-1.5">
- <span className="grid size-3.5 shrink-0 place-items-center">{statusGlyph(row.status, statusLabel)}</span>
+ <span className={SCAFFOLD_GLYPH_CLASS}>{statusGlyph(row.status, statusLabel)}</span>
<button
className={cn(
SCAFFOLD_LABEL_CLASS,
diff --git a/apps/desktop/src/components/assistant-ui/tool/fallback.tsx b/apps/desktop/src/components/assistant-ui/tool/fallback.tsx
index b2c94ecf69a..fd26087e27f 100644
--- a/apps/desktop/src/components/assistant-ui/tool/fallback.tsx
+++ b/apps/desktop/src/components/assistant-ui/tool/fallback.tsx
@@ -24,7 +24,12 @@ import { ActivityTimerText } from '@/components/chat/activity-timer-text'
import { CompactMarkdown } from '@/components/chat/compact-markdown'
import { FileDiffPanel } from '@/components/chat/diff-lines'
import { DisclosureRow } from '@/components/chat/disclosure-row'
-import { SCAFFOLD_LABEL_CLASS, SCAFFOLD_META_CLASS, ScaffoldRow } from '@/components/chat/scaffold-row'
+import {
+ SCAFFOLD_GLYPH_CLASS,
+ SCAFFOLD_LABEL_CLASS,
+ SCAFFOLD_META_CLASS,
+ ScaffoldRow
+} from '@/components/chat/scaffold-row'
import { ZoomableImage } from '@/components/chat/zoomable-image'
import { Button } from '@/components/ui/button'
import { Codicon } from '@/components/ui/codicon'
@@ -84,7 +89,7 @@ const SEARCH_HIT_TITLE_CLASS =
const TOOL_HEADER_SUBTITLE_CLASS =
'text-[length:var(--conversation-caption-font-size)] leading-(--conversation-caption-line-height) text-(--ui-text-tertiary)'
-const TOOL_HEADER_GLYPH_WRAP_CLASS = 'grid size-3.5 shrink-0 place-items-center self-center'
+const TOOL_HEADER_GLYPH_WRAP_CLASS = cn(SCAFFOLD_GLYPH_CLASS, 'self-center')
// Glass-style section label that sits above any pre/JSON/output block.
// Lowercase tracking + tiny size so it reads as a quiet field label rather
diff --git a/apps/desktop/src/components/chat/scaffold-row.tsx b/apps/desktop/src/components/chat/scaffold-row.tsx
index e192837511e..c16bf318752 100644
--- a/apps/desktop/src/components/chat/scaffold-row.tsx
+++ b/apps/desktop/src/components/chat/scaffold-row.tsx
@@ -22,6 +22,10 @@ export const SCAFFOLD_LABEL_CLASS =
/** Durations, counts and diff stats trailing a scaffold label. */
export const SCAFFOLD_META_CLASS = 'shrink-0 text-[0.625rem] tabular-nums text-(--conversation-scaffold-meta)'
+/** The fixed cell a scaffold line's leading glyph sits in — status dot, tool
+ * icon, spinner. Same box on every line, so the labels share a left edge. */
+export const SCAFFOLD_GLYPH_CLASS = 'grid size-3.5 shrink-0 place-items-center'
+
/**
* One scaffold line. `children` is the label and whatever trails it in flow
* (meta, diff counts); `trailing` reserves a right-side slot for a live timer.
diff --git a/apps/desktop/src/plugins/hermes-bots/bot-row.tsx b/apps/desktop/src/plugins/hermes-bots/bot-row.tsx
index 3977f350f91..c62529838f0 100644
--- a/apps/desktop/src/plugins/hermes-bots/bot-row.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/bot-row.tsx
@@ -20,6 +20,7 @@ import {
queryClient,
RowButton,
SessionStatusDot,
+ SidebarRowLead,
Tip,
useI18n,
useValue
@@ -218,16 +219,23 @@ export function BotRow({ bot, onDelete, onEdit, onGroup, showHandle }: BotRowPro
onPointerEnter={warm}
>
<div className={cn('shrink-0', !sourceStatus.available && 'grayscale opacity-60')}>
- <BotFace color={avatarColor(color, bot.name)} image={photo ? image : null} mood={botMood} name={bot.name} shape={shape} size={34} />
+ <BotFace
+ color={avatarColor(color, bot.name)}
+ image={photo ? image : null}
+ mood={botMood}
+ name={bot.name}
+ shape={shape}
+ size={34}
+ />
</div>
<div className="min-w-0 flex-1">
<div className="flex items-baseline justify-between gap-2">
<div className="flex min-w-0 items-center gap-1.5">
- {/* Lead slot, same geometry as the session row's: a 3.5 grid cell
- ahead of the title so every row's name shares one left edge. */}
- <span className="grid size-3.5 shrink-0 place-items-center">
+ {/* The session row's own lead cell, so a bot's name sits on the
+ same left edge as every session name above it in the rail. */}
+ <SidebarRowLead>
<SessionStatusDot storedSessionId={canonicalSessionId} />
- </span>
+ </SidebarRowLead>
{pinned ? (
<Tip label={b.roster.pinned}>
<Codicon className="shrink-0 text-[0.6875rem] text-(--ui-text-quaternary)" name="pinned" />
diff --git a/apps/desktop/src/plugins/hermes-bots/roster-sections.tsx b/apps/desktop/src/plugins/hermes-bots/roster-sections.tsx
index 76d570559dd..dd4cd013784 100644
--- a/apps/desktop/src/plugins/hermes-bots/roster-sections.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/roster-sections.tsx
@@ -7,8 +7,7 @@
* without either half knowing about a bot row.
*/
-import * as sdk from '@hermes/plugin-sdk'
-import { cn, Codicon, DisclosureCaret, RowButton, Tip } from '@hermes/plugin-sdk'
+import { Codicon, ConnectionGlyph, DisclosureCaret, RowButton, Tip } from '@hermes/plugin-sdk'
import { botHandle, botRosterKey, botSourceStatus, filterBots } from './data'
import { displayName } from './labels'
@@ -203,26 +202,10 @@ export function rosterGatewaySections<TRow extends RosterGatewayRow>(
}
}
-function gatewayKindIcon(kind?: string) {
- const icons: Partial<typeof sdk.icons> = (typeof sdk === 'undefined' ? null : sdk.icons) || {}
-
- if (kind === 'local') {return icons.Monitor}
-
- if (kind === 'cloud') {return icons.Cloud}
-
- if (kind === 'ssh') {return icons.Terminal}
-
- return icons.Network
-}
-
-function gatewayKindCodicon(kind?: string) {
- if (kind === 'local') {return 'device-desktop'}
-
- if (kind === 'cloud') {return 'cloud'}
-
- if (kind === 'ssh') {return 'terminal'}
-
- return 'remote-explorer'
+/** Roster rows carry the kind as a loose string (it arrives off the wire).
+ * Anything the glyph doesn't recognise is a remote gateway. */
+function connectionKind(kind?: string) {
+ return kind === 'cloud' || kind === 'local' || kind === 'ssh' ? kind : ('remote' as const)
}
interface GatewayKindGlyphProps {
@@ -230,21 +213,10 @@ interface GatewayKindGlyphProps {
kind?: string
}
-/** Match the gateway switcher's Tabler glyphs while keeping older SDK shells
- * usable until they expose the shared icon namespace. */
+/** The gateway switcher's glyph, keyed by kind rather than by a whole
+ * connection record — the roster only ever knows the kind. */
export function GatewayKindGlyph({ className, kind }: GatewayKindGlyphProps) {
- const Icon = gatewayKindIcon(kind)
-
- return (
- <span
- aria-hidden
- className={cn('grid size-3.5 shrink-0 place-items-center', className)}
- data-connection-kind={kind || 'remote'}
- data-slot="connection-glyph"
- >
- {Icon ? <Icon className="size-3" /> : <Codicon className="text-[0.75rem]" name={gatewayKindCodicon(kind)} />}
- </span>
- )
+ return <ConnectionGlyph className={className} connection={{ kind: connectionKind(kind) }} />
}
/** Foldable roster heading. It organizes rows visually but never supplies or