refactor(ui): replace middle-dot separators with clearer hierarchy (#6087)

* refactor(ui): replace middle-dot separators with clearer hierarchy

* refactor(ui): use layout instead of punctuation separators
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-07 15:19:55 +08:00
1 parent d6ddceed99
commit 7cb396788c
82 files changed
+433 -462

No files matched your search

+1 -1
View File
@@ -1642,7 +1642,7 @@ function MoveToGroupSubmenu({
>
<span className="min-w-0 max-w-56 flex-1 truncate">{target.title}</span>
<span className="shrink-0 tabular-nums text-sidebar-muted-foreground">
· {target.paneCount}/{MAX_WORKBENCH_PANES}
{target.paneCount}/{MAX_WORKBENCH_PANES}
</span>
</DropdownMenuItem>
))}
-1
View File
@@ -81,7 +81,6 @@ export function DeleteConfirm({
<span className="truncate">
{formatAutomationSchedule(job, t, locale)}
</span>
<span aria-hidden>·</span>
<span className="truncate">{formatAutomationNextRun(job, t, locale)}</span>
</div>
</div>
+3 -2
View File
@@ -289,9 +289,10 @@ export function MessageBlockMenuActions({
{automationSourceLabel ? (
<span
data-automation-trigger
className="flex min-h-[var(--message-block-control-size)] items-center break-words"
className="flex min-h-[var(--message-block-control-size)] flex-wrap items-baseline gap-x-2 break-words"
>
{t("message.automationTriggered")} · {automationSourceLabel}
<span>{t("message.automationTriggered")}</span>{" "}
<span>{automationSourceLabel}</span>
</span>
) : null}
</div>
@@ -25,7 +25,7 @@ export function HostCompatibilityDialog({ profile, clientVersion, onClose }: {
<DialogContent className="remote-dialog max-w-md overflow-y-auto outline-none">
<DialogHeader className="pr-5 text-left">
<DialogTitle className="text-balance leading-snug">{t("remote.compatibility.title")}</DialogTitle>
<DialogDescription className="text-pretty [overflow-wrap:anywhere]">{displayedProfile?.name} · {displayedProfile?.host}</DialogDescription>
<DialogDescription className="text-pretty [overflow-wrap:anywhere]"><span className="block font-medium">{displayedProfile?.name}</span>{" "}<span className="block font-mono text-xs">{displayedProfile?.host}</span></DialogDescription>
</DialogHeader>
<SettingsGroup>
<dl className="space-y-3 px-4 py-3 text-[13px] leading-5">
+11 -6
View File
@@ -104,7 +104,7 @@ function HostMenuItems({ picker }: { picker: HostPicker }) {
{showLocal && !!profiles.length && <DropdownMenuSeparator />}
{profiles.map((profile) => <DropdownMenuItem key={profile.id} onSelect={() => picker.select(profile.id)} className="gap-2.5"
aria-label={`${profile.name} ${profile.host}`} aria-describedby={`host-state-${profile.id}`}
title={`${profile.name} · ${profile.host}`} aria-current={picker.currentId === profile.id || undefined}>
title={`${profile.name}\n${profile.host}`} aria-current={picker.currentId === profile.id || undefined}>
<Server className="h-4 w-4 shrink-0 text-muted-foreground" />
<span className="min-w-0 flex-1"><span className="block truncate">{profile.name}</span><span className="block truncate text-xs text-muted-foreground">{profile.host}</span></span>
<span id={`host-state-${profile.id}`}><HostConnectionStatus state={profile.state} compact /></span>
@@ -145,10 +145,9 @@ export function HostSwitcher({ collapsed = false, portalContainer }: { collapsed
// visible; progress belongs to the target's row and the accessible status.
const label = picker.name;
const currentLabel = failed ? shell?.offlineLabel || t("remote.offline") : t(`connection.${currentStatus}`);
const identity = picker.name === picker.hostname ? picker.name : `${picker.name} · ${picker.hostname}`;
const current = `${identity} · ${currentLabel}`;
const detail = pendingName ? `${current} · ${t("remote.preparing", { name: pendingName })}` : current;
const hint = picker.error ? `${detail} — ${picker.error}` : detail;
const identity = picker.name === picker.hostname ? picker.name : `${picker.name}, ${picker.hostname}`;
const current = `${identity}, ${currentLabel}`;
const detail = pendingName ? `${current}. ${t("remote.preparing", { name: pendingName })}` : current;
const button = <Button ref={buttonRef} variant="ghost" size="sm" aria-label={t("remote.switchHost")}
data-host-switcher className={cn("host-no-drag touch-target h-8 min-w-0 gap-2 rounded-xl px-2 text-xs font-normal text-sidebar-content/75 hover:text-sidebar-content",
collapsed ? "w-8 justify-center px-0" : "max-w-full flex-1 justify-start")}
@@ -168,7 +167,13 @@ export function HostSwitcher({ collapsed = false, portalContainer }: { collapsed
// The mobile sidebar already owns the modal lock; a nested lock can outlive it on navigation.
return <TooltipProvider><Tooltip>
{shell ? <DropdownMenu modal={!portalContainer}><DropdownMenuTrigger asChild>{trigger}</DropdownMenuTrigger><HostMenuContent picker={shell} portalContainer={portalContainer} /></DropdownMenu> : trigger}
<TooltipContent side="top">{hint}</TooltipContent>
<TooltipContent side="top" className="max-w-[min(24rem,calc(100vw-2rem))] space-y-1 break-words">
<p className="font-medium">{picker.name}</p>
{picker.hostname !== picker.name ? <p className="font-mono text-xs text-muted-foreground">{picker.hostname}</p> : null}
<p>{currentLabel}</p>
{pendingName ? <p>{t("remote.preparing", { name: pendingName })}</p> : null}
{picker.error ? <p className="text-destructive">{picker.error}</p> : null}
</TooltipContent>
</Tooltip></TooltipProvider>;
}
@@ -319,7 +319,7 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChro
}}>
{busy === profile.id ? <Loader2 className="h-[18px] w-[18px] shrink-0 animate-spin text-muted-foreground" /> : <Server className="h-[18px] w-[18px] shrink-0 text-muted-foreground" />}
<span className="min-w-0 flex-1"><span className="block truncate text-[14px] font-medium">{profile.name}</span><span className="mt-0.5 block truncate text-xs text-muted-foreground">{profile.host}</span>
{groups.some((other) => other.id !== groupId && other.profile.name === profile.name && other.profile.host === profile.host) && <span className="mt-0.5 block truncate text-xs text-muted-foreground" title={profile.config_path}>{profile.port ? `:${profile.port} · ` : ""}{profile.config_path}</span>}
{groups.some((other) => other.id !== groupId && other.profile.name === profile.name && other.profile.host === profile.host) && <span className="mt-0.5 block truncate text-xs text-muted-foreground" title={profile.config_path}>{profile.port ? <span className="mr-2">:{profile.port}</span> : null}{profile.config_path}</span>}
<span id={`${statusId}-${profile.id}`} className="mt-1 block"><HostConnectionStatus state={connections.hostStates[profile.id] || "closed"} /></span>
{profile.compatibility && profile.compatibility.status !== "compatible" && <span className="mt-1 block text-xs text-muted-foreground">
{t(`remote.compatibility.${profile.compatibility.status}`)}
@@ -134,7 +134,7 @@ export function RemoteInstances({ children }: { children: ReactNode }) {
manage,
cancel: hosts.cancel, clearError: hosts.clearError, restoreFocus: () => { if (!managing) restoreFocus(); },
};
useEffect(() => { if (selected) document.title = `${selected.name} · nanobot`; }, [selected]);
useEffect(() => { if (selected) document.title = selected.name; }, [selected]);
useEffect(() => {
const rememberFocus = (event: FocusEvent) => {
if (!managementOpen.current && event.target instanceof HTMLElement && localPanel.current?.contains(event.target)
@@ -190,9 +190,10 @@ export function RemoteInstances({ children }: { children: ReactNode }) {
<RemoteConnectionsPage onBackToChat={() => changeManagement(false)} mainNavigationExpanded={!!bridge.surface?.left} />
</ThemeProvider>
</main>}
{!managing && selected && (offline || !activeFrame?.loaded) && <div className="absolute inset-0 overflow-y-auto bg-background p-6 text-center"><div className="flex min-h-full flex-col items-center justify-center gap-3">
{!managing && selected && (offline || !activeFrame?.loaded) && <div role="region" aria-label={t(offline ? recoveryTitle : "remote.opening")} className="absolute inset-0 overflow-y-auto bg-background p-6 text-center"><div className="flex min-h-full flex-col items-center justify-center gap-3">
{offline ? <PlugZap className="h-7 w-7 text-muted-foreground" /> : <Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />}
<p className="max-w-full text-pretty text-xs text-muted-foreground [overflow-wrap:anywhere]">{selected.name} · {selected.hostname}</p>
<p className="max-w-full text-pretty text-xs text-muted-foreground [overflow-wrap:anywhere]"><span className="block font-medium">{selected.name}</span>{" "}
{selected.hostname !== selected.name ? <span className="block">{selected.hostname}</span> : null}</p>
<p className="font-medium">{t(offline ? recoveryTitle : "remote.opening")}</p>
<p className="max-w-sm text-pretty text-sm text-muted-foreground">{recoveryMessage}</p>
<div className="flex max-w-full flex-wrap items-stretch justify-center gap-2 [&>button]:h-auto [&>button]:min-h-10 [&>button]:min-w-0 [&>button]:max-w-full [&>button]:whitespace-normal">
@@ -526,10 +526,9 @@ function MarketplaceSkillRow({
</div>
<div className="mt-1 flex min-w-0 items-center gap-1.5 truncate text-[12px] text-muted-foreground">
{skill.source}
{skill.version ? <span>· v{skill.version}</span> : null}
{skill.version ? <span>v{skill.version}</span> : null}
{skill.provider === "skills_sh" ? (
<>
<span>·</span>
{skill.metric === "installs_24h"
? t("settings.skills.marketplaceInstalls24h", {
count: skill.installs,
@@ -90,7 +90,7 @@ export function TokenUsageModelTrend({ days, modelDays, models }: {
const tokens = columns.reduce((sum, column) => sum + column.values[index], 0);
const rate = model?.cache_read_observed_input_tokens ? percent.format(model.cache_read_tokens / model.cache_read_observed_input_tokens) : "—";
const parts = [
[t("settings.usage.totalTokens"), `${number.format(tokens)} · ${percent.format(tokens / total)}`],
[t("settings.usage.totalTokens"), `${number.format(tokens)} (${percent.format(tokens / total)})`],
[t("settings.usage.cacheHitRate"), rate],
];
return <Tooltip key={index}>
@@ -107,10 +107,8 @@ export function ChannelValidationProgress({
const status = validation?.status ?? (feature.configured ? "configured" : "needs_setup");
const presentation = channelUiPresentation(feature.name, feature.webui);
const identity = validation?.identity?.name
? validation.identity.workspace
? `${validation.identity.name} · ${validation.identity.workspace}`
: validation.identity.name
: presentation?.displayName ?? feature.display_name;
|| presentation?.displayName || feature.display_name;
const workspace = validation?.identity?.workspace;
return (
<div
@@ -173,7 +171,10 @@ export function ChannelValidationProgress({
)}
>
{channelValidationStatusIcon(status)}
<span className="min-w-0 truncate font-semibold">{identity}</span>
<span className="min-w-0 flex-1">
<span className="block truncate font-semibold">{identity}</span>
{workspace ? <span className="block truncate font-normal">{workspace}</span> : null}
</span>
<span className="lowercase">{channelValidationStatusLabel(status, t)}</span>
</div>
) : null}
@@ -511,15 +511,13 @@ export function ModelsSettings({
<span className="block text-[14px] font-medium text-foreground">
{tx("settings.models.advancedOptions", "Advanced options")}
</span>
<span className="mt-0.5 block text-[12px] text-muted-foreground">
{tx(
"settings.models.advancedSummary",
"Context {{context}} · Max {{max}} tokens",
{
context: Number.isFinite(form.contextWindowTokens) ? formatModelContextWindow(form.contextWindowTokens) : "—",
max: formatContextWindow(form.maxTokens),
},
)}
<span className="mt-0.5 flex flex-wrap gap-x-3 text-[12px] tabular-nums text-muted-foreground">
<span>{tx("settings.models.contextSummary", "Context {{context}}", {
context: Number.isFinite(form.contextWindowTokens) ? formatModelContextWindow(form.contextWindowTokens) : "—",
})}</span>{" "}
<span>{tx("settings.models.outputSummary", "Max {{max}} tokens", {
max: formatContextWindow(form.maxTokens),
})}</span>
</span>
</span>
<ChevronDown
@@ -344,10 +344,9 @@ export function ModelIdPicker({
{model.label ?? model.id}
</span>
{model.description || (model.label && model.label !== model.id) ? (
<span className="mt-0.5 block truncate text-[10.5px] text-muted-foreground">
{[model.label && model.label !== model.id ? model.id : null, model.description]
.filter(Boolean)
.join(" · ")}
<span className="mt-0.5 flex min-w-0 flex-wrap gap-x-2 text-[10.5px] text-muted-foreground">
{model.label && model.label !== model.id ? <span className="truncate font-mono">{model.id}</span> : null}{" "}
{model.description ? <span className="truncate">{model.description}</span> : null}
</span>
) : null}
</span>
@@ -23,15 +23,15 @@ export function TimezonePicker({ value, onChange, ...triggerProps }: {
.formatToParts(now).find((part) => part.type === "timeZoneName")?.value ?? zone;
const offset = new Intl.DateTimeFormat("en", { timeZone: zone, timeZoneName: "longOffset" })
.formatToParts(now).find((part) => part.type === "timeZoneName")?.value ?? "";
return { zone, detail: `${name} · ${offset.replace("GMT", "UTC")}` };
return { zone, detail: name, offset: offset.replace("GMT", "UTC") };
} catch {
// Keep a server-supported timezone visible even if this browser cannot format it.
return { zone, detail: zone };
return { zone, detail: zone, offset: "" };
}
});
}, [i18n.language, value]);
const filtered = options.filter(({ zone, detail }) =>
`${zone.replaceAll("_", " ")} ${zone} ${detail}`.toLocaleLowerCase(i18n.language)
const filtered = options.filter(({ zone, detail, offset }) =>
`${zone.replaceAll("_", " ")} ${zone} ${detail} ${offset}`.toLocaleLowerCase(i18n.language)
.includes(query.trim().toLocaleLowerCase(i18n.language)));
const select = (zone: string) => { onChange(zone); setOpen(false); };
const navigation = useComboboxNavigation({
@@ -52,10 +52,12 @@ export function TimezonePicker({ value, onChange, ...triggerProps }: {
aria-label={t("sidebar.searchAria")} placeholder={t("sidebar.searchPlaceholder")}
className="mb-1.5 h-9 rounded-full" />
<div {...navigation.listProps} aria-label={triggerProps["aria-label"]} className="max-h-64 overflow-y-auto">
{filtered.map(({ zone, detail }) => (
{filtered.map(({ zone, detail, offset }) => (
<ComboboxOption key={zone} {...navigation.getOptionProps(zone)} className="block">
<span className="block">{zone}</span>
<span className="block text-xs text-muted-foreground">{detail}</span>
<span className="flex flex-wrap gap-x-2 text-xs text-muted-foreground">
<span>{detail}</span>{" "}<span className="tabular-nums">{offset}</span>
</span>
</ComboboxOption>
))}
</div>
@@ -576,9 +576,7 @@ function McpAppsCatalogRow({
`settings.mcp.presetDescriptions.${preset.name}`,
preset.description || preset.note || preset.name,
);
const detail = agentPlugin && preset.requires
? `${description} · ${preset.requires}`
: description || preset.requires;
const detail = description || preset.requires;
const manualCallback =
oauthFlow?.completion_input === "callback_url" && Boolean(oauthFlow.authorization_url);
const callbackInputId = `mcp-oauth-callback-${preset.name}`;
@@ -629,6 +627,9 @@ function McpAppsCatalogRow({
<span className="truncate">
{runtimeFailed ? failureLabel : detail}
</span>
{!runtimeFailed && agentPlugin && description && preset.requires ? (
<span className="min-w-0 truncate">{preset.requires}</span>
) : null}
</p>
</div>
<div className="ml-auto flex shrink-0 items-center gap-1">
@@ -1431,9 +1432,7 @@ function CliAppReadyPanel({
</div>
<div className="mt-0.5 flex min-w-0 flex-wrap items-center gap-1.5 text-[12px] text-muted-foreground">
<span className="font-mono">@{app.name}</span>
<span aria-hidden>·</span>
<span className="truncate font-mono">{app.entry_point || app.name}</span>
<span aria-hidden>·</span>
<span>{app.category}</span>
</div>
</div>
@@ -535,7 +535,6 @@ function ConnectionPanel({
preset.connection_summary && "mt-3 border-t border-border/45 pt-3",
)}>
<span>{formatTransport(preset.transport)}</span>
<span aria-hidden>·</span>
<span>{authentication}</span>
<div className="ml-auto flex items-center gap-1.5">
{preset.docs_url ? (
@@ -587,11 +586,11 @@ function ConnectionPanel({
const inputId = `mcp-manage-${preset.name}-${field.name}`;
return (
<label key={field.name} htmlFor={inputId} className="min-w-0">
<span className="mb-1.5 flex items-center gap-1 text-[12.5px] font-medium text-muted-foreground">
<span className="mb-1.5 flex items-center gap-2 text-[12.5px] font-medium text-muted-foreground">
{field.label}
{field.configured ? (
<span className="font-normal text-emerald-600 dark:text-emerald-300">
· {tx("settings.mcp.configured", "Configured")}
{tx("settings.mcp.configured", "Configured")}
</span>
) : null}
</span>
@@ -346,14 +346,14 @@ function FoldedAgentActivity({
const activityLabel = retryStatus?.state === "exhausted"
? t("message.retryExhausted", {
error: retryError,
defaultValue: "{{error}} · ending turn",
defaultValue: "{{error}}. Ending turn.",
})
: retryStatus?.state === "waiting"
? t("message.retryWaiting", {
error: retryError,
seconds: retrySeconds,
attempt: retryAttempt,
defaultValue: "{{error}} · retrying in {{seconds}}s · attempt {{attempt}}",
defaultValue: "{{error}}. Retrying in {{seconds}}s (attempt {{attempt}}).",
})
: isTurnStreaming
? t("message.activityWorkingFor", {
@@ -828,7 +828,9 @@ function ActivityTraceRow({
icon={Icon}
active={rowActive && trace.kind !== "done"}
tone={status === "error" ? "error" : status === "done" ? "success" : "active"}
label={formatActivityTarget(t, trace.label, trace.detail)}
label={trace.kind === "search" ? trace.label : formatActivityTarget(t, trace.label, trace.detail)}
detail={trace.kind === "search" ? trace.detail : trace.aside}
detailClassName={trace.kind === "search" ? "whitespace-pre-line" : undefined}
/>
);
}
@@ -1251,16 +1253,18 @@ function CliRunRow({ run, active, app }: { run: CliRunSummary; active: boolean;
const logoUrls = useMemo(() => logoFallbackUrls(app?.logo_url), [app?.logo_url]);
const { logoUrl, onLogoError, onLogoLoad } = useLogoFallback(logoUrls);
const displayName = app?.display_name || titleFromPresetName(run.name);
const label = `${t(
const label = t(
`message.${failed ? "cliActivityFailedOne" : rowActive ? "cliActivityRunningOne" : "cliActivityRanOne"}`,
{ name: displayName },
)}${args ? ` · ${args}` : ""}`;
);
return (
<ActivityStep
active={rowActive}
tone={failed ? "error" : rowActive ? "active" : run.status === "done" ? "success" : "neutral"}
label={label}
detail={args}
detailClassName="font-mono text-[12px]"
marker={(
<span
data-testid={`activity-cli-logo-${run.name.toLowerCase()}`}
@@ -1334,13 +1338,14 @@ function McpRunRow({ run, active, preset }: { run: McpRunSummary; active: boolea
failed ? "error" : rowActive ? "running" : "done",
t,
);
const label = `${formatActivityTarget(t, activity.action, activity.target ?? "")} · ${displayName}`;
const label = formatActivityTarget(t, activity.action, activity.target ?? "");
return (
<ActivityStep
active={rowActive}
tone={failed ? "error" : rowActive ? "active" : run.status === "done" ? "success" : "neutral"}
label={label}
detail={displayName}
marker={(
<span
data-testid={`activity-mcp-logo-${run.presetName.toLowerCase()}`}
@@ -129,11 +129,11 @@ export function ModelPresetBadge({
model: modelDetail ?? modelPresets[listedIndex]?.model,
provider: provider || modelPresets[listedIndex]?.provider,
};
const tooltipLabel = needsSetup ? label : [...new Set([
const tooltipParts = needsSetup ? [label] : [...new Set([
label,
modelDetail,
providerLabel,
].filter(Boolean))].join(" · ");
].filter((part): part is string => Boolean(part)))];
const presets = !activeName
? modelPresets
: listedIndex < 0
@@ -459,9 +459,11 @@ export function ModelPresetBadge({
return (
<TooltipProvider>
<Tooltip open={tooltipLabel !== label && tooltipOpen && !open && !motion} onOpenChange={setTooltipOpen}>
<Tooltip open={tooltipParts.length > 1 && tooltipOpen && !open && !motion} onOpenChange={setTooltipOpen}>
{badge}
<TooltipContent side="top">{tooltipLabel}</TooltipContent>
<TooltipContent side="top" className="max-w-[min(24rem,calc(100vw-2rem))] space-y-1 break-words">
{tooltipParts.map((part, index) => <p key={part} className={index === 0 ? "font-medium" : "text-xs text-muted-foreground"}>{part}{index < tooltipParts.length - 1 ? " " : ""}</p>)}
</TooltipContent>
</Tooltip>
</TooltipProvider>
);
@@ -186,7 +186,7 @@ export function SubagentTasksProvider({ client, sessionKey, token, enabled, live
<SheetDescription className="flex items-center gap-2">
{selected ? <><TaskStateIcon task={selected} />
<span className={selected.state === "done" ? "sr-only" : undefined}>{t(`thread.subagents.states.${selected.state}`)}</span>
<span className="tabular-nums">{selected.state !== "done" ? "· " : null}<TaskElapsed task={selected} /></span></> : null}
<span className="tabular-nums"><TaskElapsed task={selected} /></span></> : null}
</SheetDescription>
</div>
{selected && sessionKey ? <div className="min-h-0 flex-1 overflow-y-auto overscroll-contain py-5">
@@ -313,9 +313,10 @@ function SubagentWork({ tasks, unlinked = false }: { tasks: ObservedSubagentTask
className="flex w-full items-center gap-2.5 px-3 py-2.5 text-left text-xs text-muted-foreground hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring">
<DelegationIcon className="h-3.5 w-3.5 shrink-0" aria-hidden />
<span className="font-medium">{title}</span>
<span className="ml-auto min-w-0 text-right">
{summary}{activeCount ? ` · ${t("thread.subagents.running", { count: activeCount })}` : ""}
{failedCount ? <span className="ml-2 text-destructive">{t("thread.subagents.needsReview", { count: failedCount })}</span> : null}
<span className="ml-auto flex min-w-0 flex-wrap justify-end gap-x-2 text-right">
<span>{summary}</span>{" "}
{activeCount ? <span>{t("thread.subagents.running", { count: activeCount })}</span> : null}
{failedCount ? <span className="text-destructive">{t("thread.subagents.needsReview", { count: failedCount })}</span> : null}
</span>
<ChevronDown className={`h-3.5 w-3.5 shrink-0 transition-transform ${open ? "rotate-180" : ""}`} aria-hidden />
</button>
@@ -12,6 +12,8 @@ export interface ActivityStepProps {
marker?: ReactNode;
showMarker?: boolean;
label: ReactNode;
detail?: string;
detailClassName?: string;
tooltipContent?: ReactNode;
ariaLabel?: string;
active?: boolean;
@@ -29,6 +31,8 @@ export function ActivityStep({
marker,
showMarker = true,
label,
detail,
detailClassName,
tooltipContent,
ariaLabel,
active = false,
@@ -42,11 +46,13 @@ export function ActivityStep({
}: ActivityStepProps) {
const lineRef = useRef<HTMLDivElement>(null);
const [hintOpen, setHintOpen] = useState(false);
const textLabel = typeof label === "string" ? [label, detail].filter(Boolean).join("\n") : undefined;
const line = (
<div
ref={lineRef}
data-testid="activity-line"
tabIndex={typeof label === "string" ? 0 : undefined}
aria-label={detail && typeof label === "string" ? `${label}, ${detail}` : undefined}
className="flex min-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap"
>
<StreamingLabelSheen
@@ -57,7 +63,12 @@ export function ActivityStep({
labelClassName,
)}
>
{label}
{detail ? (
<span className="flex min-w-0 items-baseline gap-2">
<span className="max-w-[70%] shrink-0 truncate">{label}</span>{" "}
<span className={cn("min-w-0 flex-1 truncate font-normal text-muted-foreground", detailClassName)}>{detail}</span>
</span>
) : label}
</StreamingLabelSheen>
</div>
);
@@ -99,11 +110,11 @@ export function ActivityStep({
<Tooltip open={hintOpen} onOpenChange={(open) => {
const truncated = Array.from(lineRef.current?.querySelectorAll<HTMLElement>(".truncate") ?? [])
.some((element) => element.scrollWidth > element.clientWidth);
setHintOpen(open && (truncated || tooltipContent !== undefined && tooltipContent !== label));
setHintOpen(open && (truncated || tooltipContent !== undefined && tooltipContent !== textLabel));
}}>
<TooltipTrigger asChild>{line}</TooltipTrigger>
<TooltipContent side="top" className="max-w-[min(32rem,calc(100vw-2rem))] whitespace-pre-wrap break-words">
{tooltipContent ?? label}
{tooltipContent ?? textLabel}
</TooltipContent>
</Tooltip>
</TooltipProvider>
@@ -37,14 +37,14 @@ export function GenericToolRun({ items }: { items: GenericToolRunItem[] }) {
const { t } = useTranslation();
const model = useMemo(() => buildModel(items, t), [items, t]);
const action = formatActivityTarget(t, model.label, model.detail);
const label = model.aside ? `${action} · ${model.aside}` : action;
return (
<ActivityStep
icon={model.status === "error" ? AlertCircle : model.icon}
active={model.status === "running"}
tone={model.status === "error" ? "error" : model.status === "done" ? "success" : "active"}
label={label}
label={action}
detail={model.aside}
/>
);
}
@@ -70,7 +70,7 @@ export function ThinkingReasoningShell({
onClick={onToggle}
aria-expanded={expanded}
aria-controls={contentId}
aria-label={expanded && collapseLabel ? `${label} · ${collapseLabel}` : label}
aria-label={expanded && collapseLabel ? `${label}, ${collapseLabel}` : label}
aria-live={active ? "polite" : undefined}
>
{headerContent}
@@ -32,7 +32,7 @@ export function WebActivityRow({
href={href}
target="_blank"
rel="noreferrer noopener"
aria-label={`${title} · ${displayUrl}`}
aria-label={`${title}, ${displayUrl}`}
className="flex min-w-0 items-center gap-2 overflow-hidden text-foreground/82 hover:text-foreground"
>
<span className="min-w-0 truncate font-medium">{title}</span>
@@ -15,7 +15,7 @@ export function WebSearchRun({ run, turnActive }: { run: WebSearchRunModel; turn
const { t } = useTranslation();
const active = run.status === "running" && turnActive;
const status = run.status === "running" && !turnActive ? "done" : run.status;
const label = presentWebSearchAction(run.query, status, run.target, t);
const presentation = presentWebSearchAction(run.query, status, run.target, t);
return (
<>
@@ -23,7 +23,9 @@ export function WebSearchRun({ run, turnActive }: { run: WebSearchRunModel; turn
icon={status === "error" ? AlertCircle : WebSearchIcon}
active={active}
tone={status === "error" ? "error" : status === "done" ? "success" : "active"}
label={label}
label={presentation.label}
detail={presentation.detail}
detailClassName="whitespace-pre-line"
/>
{run.sources.map((source) => (
<WebActivityRow
@@ -56,16 +56,17 @@ export function formatActivityTarget(t: TFunction, action: string, target: strin
: action;
}
export function summarizeShellCommand(command: string, t: TFunction): string {
export function summarizeShellCommand(command: string, t: TFunction): { detail: string; aside?: string } {
const lines = redactShellCommand(command.replace(/\r\n/g, "\n"))
.split("\n")
.map((line) => line.trim())
.filter(Boolean);
const firstLine = compactActivityPath(lines[0] || t("message.agentActivity.command"));
const firstPreview = truncateMiddle(firstLine, 92);
return lines.length <= 1
? firstPreview
: `${firstPreview} · ${t("message.agentActivity.scriptLines", { count: lines.length })}`;
return {
detail: firstPreview,
...(lines.length > 1 ? { aside: t("message.agentActivity.scriptLines", { count: lines.length }) } : {}),
};
}
function truncateMiddle(value: string, maxLength: number): string {
@@ -9,6 +9,7 @@ export interface TraceDescription {
kind: "search" | "tool" | "done" | "trace";
label: string;
detail: string;
aside?: string;
icon?: "clock";
url?: string;
host?: string;
@@ -33,8 +34,7 @@ export function describeTraceLine(
const query = traceFieldFromArgs(args, ["query", "q", "text"]) || args;
return {
kind: "search",
label: presentWebSearchAction(query, status, name === "x_search" ? "x" : "web", t),
detail: "",
...presentWebSearchAction(query, status, name === "x_search" ? "x" : "web", t),
};
}
if (/fetch|read|open/i.test(name) || plainWebReadTrace) {
@@ -108,7 +108,7 @@ function describeShellTrace(
return {
kind: "tool",
label: activityStatus(t, status, "runningCommand", "ranCommand", "commandFailed"),
detail: summarizeShellCommand(command, t),
...summarizeShellCommand(command, t),
};
}
@@ -78,12 +78,13 @@ function presentWebSearchQuery(query: string): WebSearchQueryPresentation {
const scopes: string[] = [];
const safeQuery = redactActivityText(query);
const cleanQuery = safeQuery
.replace(/(?:^|\s)site:([^\s]+)/gi, (_match, rawSite: string) => {
.replace(/(^|\s)site:([^\s]+)/gi, (_match, prefix: string, rawSite: string) => {
const scope = webSearchScope(rawSite);
if (scope && !scopes.includes(scope)) scopes.push(scope);
return " ";
return prefix;
})
.replace(/\s+/g, " ")
.replace(/[^\S\n]+/g, " ")
.replace(/ *\n */g, "\n")
.trim();
return {
@@ -97,14 +98,16 @@ export function presentWebSearchAction(
status: WebSearchStatus,
target: WebSearchTarget = "web",
t: TFunction,
): string {
): { label: string; detail: string } {
const presentation = presentWebSearchQuery(query);
const queryTarget = [presentation.scope, presentation.query].filter(Boolean).join(" · ");
const key = status === "error" ? "searchFailed" : status === "running" ? "searching" : "searched";
const searchTarget = target === "x"
? (queryTarget ? `X · ${queryTarget}` : "X")
: queryTarget || t("message.agentActivity.web");
return t(`message.agentActivity.${key}`, { target: searchTarget });
? ["X", presentation.scope].filter(Boolean).join(" ")
: presentation.scope || t("message.agentActivity.web");
return {
label: t(`message.agentActivity.${key}`, { target: searchTarget }),
detail: presentation.query,
};
}
function mergeWebSearchRun(
@@ -776,7 +776,7 @@ export function PaneWorkbench({
{active ? (
<TooltipContent side="top">
{t("workbench.movePaneHint", {
defaultValue: "Drag to move · Arrow keys also work",
defaultValue: "Drag to move, or use the arrow keys.",
})}
</TooltipContent>
) : null}