Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(ui): refresh desktop shell and chat chrome

Steven Enamakel7e1f5d90a607
diff --git a/app/src/App.tsx b/app/src/App.tsx
index 5ae41e78ca..972cdcc3c1 100644
--- a/app/src/App.tsx
+++ b/app/src/App.tsx
@@ -272,13 +272,9 @@ export function AppShellDesktop() {
{chromeless ? (
content
) : (
- // Nothing sets `unframed` today. It existed for live CEF provider
- // webviews — WebviewHost handed the Rust side a plain rectangle and
- // CEF composited that child view above the whole HTML layer, so a
- // rounded card under it showed four square corners punching through
- // the radius. That surface was removed upstream along with
- // WebviewHost, so no route needs the escape hatch right now; the
- // prop stays on the primitive for the next full-bleed surface.
+ // The root surface is full-bleed by default. The floating sidebar
+ // supplies the inset/elevation; another rounded outer card would
+ // expose an unnecessary band of window chrome around the content.
<RootShellLayout sidebar={<AppSidebar />}>{content}</RootShellLayout>
)}
</div>
diff --git a/app/src/assets/composerHumanMascot.ts b/app/src/assets/composerHumanMascot.ts
new file mode 100644
index 0000000000..3d14dd647b
--- /dev/null
+++ b/app/src/assets/composerHumanMascot.ts
@@ -0,0 +1,3 @@
+/** Exact Tiny profile artwork used by the composer Human-mode action. */
+export const COMPOSER_HUMAN_MASCOT_DATA_URL =
+ 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAIAAAAiOjnJAAAy9UlEQVR4nO19B5RkV3nmvfelSl3VOU/sntATJc2MZiSjhFBCQlqERRRIIHsNFhiwMbaR1+v1WvbheFljfGzw2cPCGs7a2GdlWzbHa0lrg0FIAxJIQsOMwuSe0N3TqXK9cO+e/4b3XvWk6p6qDlX1TU11ddXril/9OeiJRAI10US1Qap+j0000SRWE7VCk1hN1ARNYjVREzSJ1URN0CRWEzVBk1hN1ARNYjVREzSJ1URN0CRWEzVBk1hN1ARNYjVREzSJ1URN0CRWEzVBk1hN1ARNYjVREzSJ1URN0CTW/KBrxDB0eOMIXurnsqwB71ETl0A0YlqW2d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R0JJlEQ+X85VFKXwt2r9gbrvLNa+vflF7ipSKxYlzRdvVuRWpalvnVX8MpVcJhuPpHIpoTbO9UnSkEPZmp6ZLthdBJIa02DytePH+a4iYHrNmMszAuYgJ6kg6gwGhpGbECPe0VlpgWOnzyOScREyf06bcEtc6UmzsXC6TxR7jadFKuSXKY3SwPUkL0lqKjjE7M5uwmsnBSqERNNhdGj09NZthFLcgrCriK9UbIodmMRK1XXNqupSIFHmvlS+xJKt8FUUIOzNFq0ysdM4+cSor9K18RC4zd2yyxs9lx6dcx4twmWwoblXwXcEW0hJIT7osPj5pEzoRjzT9wXmgrwvpaPr02UyuaDKtBd5MHOV9DJfllpjIYCBiURTPF7XpmWxbXHr9vu+vfENJNduBbSPVb/86n8sI4VQLwaxw+mw2UzAYjiMsBPIlDEkSklVxrCUZbskWtDNnJrsSU9UtGqx7xCKopy135Ojpc9OOQ+NISwG3NGFviY/gMmlZRBK2Fzl7ztZQLhGl/JNVpk5gTEtqFWyosKgysSYmi2MTeW7PlU3+6O0yutrQyVPTYxPFkhtDWgvoe1nf6NuS/kkIKgO+WFoS6a1Uays40dHT6Zgx2RJvRtvRfLF5nUbtqcNHxrJ5QlES6ylEUuoj0FUMqPwk7FocRaSFkpZ0lpwYne5uyRtiTwDzW935hHTlEoqP/sxkpZ/R/wdkdK0FebKe/gAAAABJRU5ErkJggg==';
diff --git a/app/src/components/assistant-ui/elements/context-breakdown.tsx b/app/src/components/assistant-ui/elements/context-breakdown.tsx
index af0e129717..980e78cfda 100644
--- a/app/src/components/assistant-ui/elements/context-breakdown.tsx
+++ b/app/src/components/assistant-ui/elements/context-breakdown.tsx
@@ -27,6 +27,11 @@ export interface ContextSegment {
tint: string;
}
+export interface ContextStat {
+ label: string;
+ value: string;
+}
+
export function ContextBreakdown({
segments,
limit,
@@ -34,6 +39,7 @@ export function ContextBreakdown({
headroomLabel = 'Headroom',
meterLabel = label => `${label} context usage`,
meterValueText = (used, max) => `${used} of ${max}`,
+ stats = [],
className,
...props
}: Omit<ComponentProps<'div'>, 'children' | 'segments' | 'limit' | 'title'> & {
@@ -43,6 +49,8 @@ export function ContextBreakdown({
headroomLabel?: string;
meterLabel?: (label: string) => string;
meterValueText?: (used: string, limit: string) => string;
+ /** Informational rows that do not consume the parent model's context window. */
+ stats?: readonly ContextStat[];
}) {
const used = segments.reduce((sum, segment) => sum + segment.tokens, 0);
const pressure = limit === 0 ? 0 : used / limit;
@@ -109,6 +117,15 @@ export function ContextBreakdown({
{fmt(Math.max(0, limit - used))}
</span>
</div>
+ {stats.length > 0 && <div className="border-foreground/10 my-1 border-t" />}
+ {stats.map(stat => (
+ <div key={stat.label} className="flex items-center justify-between gap-4">
+ <span className="text-foreground/55 min-w-0 truncate text-[12px]">{stat.label}</span>
+ <span className={cn(mono, 'text-foreground/45 shrink-0 tabular-nums')}>
+ {stat.value}
+ </span>
+ </div>
+ ))}
</div>
</div>
);
diff --git a/app/src/components/assistant-ui/elements/conversation-map.aui.tsx b/app/src/components/assistant-ui/elements/conversation-map.aui.tsx
new file mode 100644
index 0000000000..2530480592
--- /dev/null
+++ b/app/src/components/assistant-ui/elements/conversation-map.aui.tsx
@@ -0,0 +1,253 @@
+/**
+ * Vendored from assistant-ui's Conversation Map registry element.
+ * Source: https://r.assistant-ui.com/styles/base-nova/conversation-map.json
+ */
+'use client';
+
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { type ThreadMessage, useAuiState, useThreadViewport } from '@assistant-ui/react';
+import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
+
+import { ConversationMap, type ConversationMapEntry } from './conversation-map';
+
+const TITLE_LENGTH = 72;
+const PREVIEW_LENGTH = 320;
+
+/**
+ * A message scrolled to the top of the viewport lands a fraction of a pixel
+ * below it, which would otherwise hand the active tick to the turn before.
+ */
+const TOP_TOLERANCE = 1;
+
+const sameIds = (a: readonly string[], b: readonly string[]): boolean => {
+ if (a.length !== b.length) return false;
+ for (let i = 0; i < a.length; i++) {
+ if (a[i] !== b[i]) return false;
+ }
+ return true;
+};
+
+/**
+ * The line a message has to cross to count as the one being read. It sits at
+ * the top of the viewport for most of a thread, then slides to the bottom
+ * across the final screenful: a message that starts within one viewport height
+ * of the end can never reach the top, so a fixed line leaves the last screen's
+ * worth of ticks permanently unreachable.
+ */
+const readingLine = (viewport: HTMLElement) => {
+ const rect = viewport.getBoundingClientRect();
+ const height = viewport.clientHeight;
+ if (height <= 0) return rect.top + TOP_TOLERANCE;
+
+ const remaining = viewport.scrollHeight - height - viewport.scrollTop;
+ const descent = Math.min(1, Math.max(0, (height - remaining) / height));
+ return rect.top + rect.height * descent + TOP_TOLERANCE;
+};
+
+const partsOf = (message: ThreadMessage) => [...message.content];
+
+const textOf = (message: ThreadMessage) =>
+ partsOf(message)
+ .map(part => (part.type === 'text' ? part.text : ''))
+ .join('\n')
+ .trim();
+
+const labelOf = (message: ThreadMessage) => {
+ const parts = partsOf(message);
+ const tools = parts.flatMap(part => (part.type === 'tool-call' ? [part.toolName] : []));
+ if (tools.length === 1) return tools[0]!;
+ if (tools.length > 1) return `${tools.length} tool calls`;
+ if (parts.some(part => part.type === 'reasoning')) return 'Reasoning';
+
+ // A composer submission carries its files in `attachments` and leaves
+ // `content` empty, so both places decide an attachment-only turn's label.
+ const carriers = [...parts, ...(message.attachments ?? [])];
+ if (carriers.some(carrier => carrier.type === 'image')) return 'Image';
+ if (carriers.some(carrier => carrier.type === 'file')) return 'File';
+ if (carriers.length > 0) return 'Attachment';
+ return message.role === 'user' ? 'Message' : 'Response';
+};
+
+/** Cuts on a word boundary so a title never splits a word. */
+const cutAtWord = (text: string, limit: number) => {
+ if (text.length <= limit) return text;
+ const head = text.slice(0, limit);
+ const boundary = head.lastIndexOf(' ');
+ return boundary > limit / 2 ? head.slice(0, boundary) : head;
+};
+
+const linesOf = (message: ThreadMessage) =>
+ textOf(message)
+ .split('\n')
+ .map(line => line.replace(/^[\s#>*`-]+/, '').trim())
+ .filter(Boolean);
+
+/** A user message and the assistant messages answering it. */
+type Turn = { head: ThreadMessage; members: ThreadMessage[] };
+
+const groupIntoTurns = (messages: readonly ThreadMessage[]) => {
+ const turns: Turn[] = [];
+
+ for (const message of messages) {
+ if (message.role !== 'user' && message.role !== 'assistant') continue;
+
+ const current = turns.at(-1);
+ if (message.role === 'user' || !current) {
+ turns.push({ head: message, members: [message] });
+ continue;
+ }
+ current.members.push(message);
+ }
+
+ return turns;
+};
+
+const describe = ({ head, members }: Turn): ConversationMapEntry => {
+ const lines = linesOf(head);
+ const first = lines[0] ?? '';
+ const title = cutAtWord(first, TITLE_LENGTH);
+
+ // What the turn asked names it; the complete assistant response is the
+ // useful hover preview. A response can span multiple assistant messages, so
+ // collect every textual assistant member rather than stopping at the first.
+ // A turn still being answered falls back to the remainder of its own text.
+ const response = members
+ .filter(member => member !== head && member.role === 'assistant')
+ .flatMap(linesOf)
+ .join(' ')
+ .trim();
+ const preview = (response || [first.slice(title.length), ...lines.slice(1)].join(' '))
+ .trim()
+ .slice(0, PREVIEW_LENGTH);
+
+ return { id: head.id, title: title || labelOf(head), ...(preview ? { preview } : {}) };
+};
+
+export function ConversationMapAui({
+ side = 'left',
+ className,
+}: {
+ side?: 'left' | 'right';
+ className?: string;
+}) {
+ const messages = useAuiState(s => s.thread.messages);
+ const viewport = useThreadViewport(s => s.element.viewport);
+ const viewportHeight = useThreadViewport(s => s.height.viewport);
+ const [activeId, setActiveId] = useState<string | undefined>(undefined);
+ const [visibleIds, setVisibleIds] = useState<readonly string[]>([]);
+ const scheduleRef = useRef<(() => void) | undefined>(undefined);
+
+ const turns = useMemo(() => groupIntoTurns(messages), [messages]);
+ const entries = useMemo(() => turns.map(describe), [turns]);
+
+ /** Which turn each message belongs to, so a message in view marks its turn. */
+ const turnOf = useMemo(() => {
+ const owners = new Map<string, string>();
+ for (const turn of turns) {
+ for (const member of turn.members) owners.set(member.id, turn.head.id);
+ }
+ return owners;
+ }, [turns]);
+
+ const turnOfRef = useRef(turnOf);
+ const turnKey = turns.map(turn => turn.head.id).join(' ');
+
+ useEffect(() => {
+ turnOfRef.current = turnOf;
+ });
+
+ useEffect(() => {
+ if (!viewport) return undefined;
+
+ let frame = 0;
+ const measure = () => {
+ frame = 0;
+ const owners = turnOfRef.current;
+ const view = viewport.getBoundingClientRect();
+ const line = readingLine(viewport);
+
+ // One pass yields both facts the rail draws: which turn is being read,
+ // and which turns the viewport currently holds.
+ let current: string | undefined;
+ const onScreen: string[] = [];
+ for (const element of viewport.querySelectorAll<HTMLElement>('[data-message-id]')) {
+ const box = element.getBoundingClientRect();
+ if (box.top >= view.bottom) break;
+
+ const id = element.dataset['messageId'];
+ const head = id === undefined ? undefined : owners.get(id);
+ if (head === undefined) continue;
+
+ if (box.top <= line) current = head;
+ if (box.bottom > view.top && !onScreen.includes(head)) {
+ onScreen.push(head);
+ }
+ }
+
+ setActiveId(current ?? owners.values().next().value);
+ setVisibleIds(previous => (sameIds(previous, onScreen) ? previous : onScreen));
+ };
+ const schedule = () => {
+ if (frame) return;
+ frame = window.requestAnimationFrame(measure);
+ };
+
+ scheduleRef.current = schedule;
+ schedule();
+ viewport.addEventListener('scroll', schedule, { passive: true });
+ const observer = new ResizeObserver(schedule);
+ observer.observe(viewport);
+
+ return () => {
+ scheduleRef.current = undefined;
+ if (frame) window.cancelAnimationFrame(frame);
+ viewport.removeEventListener('scroll', schedule);
+ observer.disconnect();
+ };
+ }, [viewport]);
+
+ useEffect(() => {
+ scheduleRef.current?.();
+ }, [turnKey]);
+
+ const select = useCallback(
+ (id: string) => {
+ if (!viewport) return;
+ for (const element of viewport.querySelectorAll<HTMLElement>('[data-message-id]')) {
+ if (element.dataset['messageId'] !== id) continue;
+
+ // `scrollIntoView` aligns every scrollable ancestor, which drags the
+ // page a thread is embedded in; only this viewport should move.
+ const top =
+ element.getBoundingClientRect().top -
+ viewport.getBoundingClientRect().top +
+ viewport.scrollTop;
+ viewport.scrollTo({ top, behavior: 'smooth' });
+ return;
+ }
+ },
+ [viewport]
+ );
+
+ return (
+ <div
+ data-slot="conversation-map-rail"
+ className={cn('pointer-events-none sticky top-0 z-10 h-0 w-full', className)}>
+ <div
+ className={cn(
+ 'pointer-events-auto absolute top-0 px-3 py-10',
+ side === 'right' ? 'right-0' : 'left-0'
+ )}
+ style={{ height: viewportHeight }}>
+ <ConversationMap
+ entries={entries}
+ activeId={activeId}
+ visibleIds={visibleIds}
+ onSelect={select}
+ align={side}
+ side={side === 'right' ? 'left' : 'right'}
+ />
+ </div>
+ </div>
+ );
+}
diff --git a/app/src/components/assistant-ui/elements/conversation-map.tsx b/app/src/components/assistant-ui/elements/conversation-map.tsx
new file mode 100644
index 0000000000..d62e95b1de
--- /dev/null
+++ b/app/src/components/assistant-ui/elements/conversation-map.tsx
@@ -0,0 +1,151 @@
+/**
+ * Vendored from assistant-ui's Conversation Map registry element.
+ * Source: https://r.assistant-ui.com/base/elements-conversation-map.json
+ */
+'use client';
+
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { type ComponentProps, type KeyboardEvent, useCallback, useRef, useState } from 'react';
+
+import { clamp } from '../utils/range';
+import { floating } from './surfaces';
+
+export interface ConversationMapEntry {
+ id: string;
+ title: string;
+ preview?: string;
+}
+
+const TICK = '[data-slot="conversation-map-tick"]';
+
+export function ConversationMap({
+ entries,
+ activeId,
+ visibleIds,
+ onSelect,
+ side = 'right',
+ align = 'left',
+ className,
+ onKeyDown,
+ ...props
+}: Omit<ComponentProps<'nav'>, 'children' | 'onSelect'> & {
+ entries: readonly ConversationMapEntry[];
+ activeId?: string | undefined;
+ visibleIds?: readonly string[] | undefined;
+ onSelect?: ((id: string) => void) | undefined;
+ side?: 'left' | 'right';
+ /** Which edge of the 24px rail the collapsed ticks hug. */
+ align?: 'left' | 'right';
+}) {
+ const railRef = useRef<HTMLElement>(null);
+ const [focusedIndex, setFocusedIndex] = useState<number | null>(null);
+ const [previewId, setPreviewId] = useState<string | null>(null);
+
+ const inView = new Set(visibleIds);
+ const activeIndex = entries.findIndex(entry => entry.id === activeId);
+ const tabbableIndex = clamp(
+ focusedIndex ?? Math.max(0, activeIndex),
+ 0,
+ Math.max(0, entries.length - 1)
+ );
+ const previewEntry = entries.find(entry => entry.id === previewId);
+
+ const handleKeyDown = useCallback(
+ (event: KeyboardEvent<HTMLElement>) => {
+ onKeyDown?.(event);
+ if (event.defaultPrevented) return;
+
+ const ticks = railRef.current?.querySelectorAll<HTMLElement>(TICK);
+ if (!ticks?.length) return;
+
+ const current = Array.prototype.indexOf.call(ticks, event.target);
+ if (current === -1) return;
+
+ const next = { ArrowUp: current - 1, ArrowDown: current + 1, Home: 0, End: ticks.length - 1 }[
+ event.key
+ ];
+ if (next === undefined) return;
+
+ event.preventDefault();
+ ticks[clamp(next, 0, ticks.length - 1)]?.focus();
+ },
+ [onKeyDown]
+ );
+
+ return (
+ <nav
+ data-slot="conversation-map"
+ ref={railRef}
+ aria-label="Conversation map"
+ onKeyDown={handleKeyDown}
+ onPointerLeave={() => setPreviewId(null)}
+ className={cn('group/rail flex h-full w-6 flex-col justify-center', className)}
+ {...props}>
+ {entries.map((entry, index) => {
+ const current = index === activeIndex;
+ const onScreen = current || inView.has(entry.id);
+ return (
+ <button
+ key={entry.id}
+ type="button"
+ data-slot="conversation-map-tick"
+ data-active={current ? '' : undefined}
+ data-in-view={onScreen ? '' : undefined}
+ aria-label={entry.title}
+ aria-current={current ? 'true' : undefined}
+ tabIndex={index === tabbableIndex ? 0 : -1}
+ onPointerEnter={() => setPreviewId(entry.id)}
+ onFocus={() => {
+ setFocusedIndex(index);
+ setPreviewId(entry.id);
+ }}
+ onClick={onSelect ? () => onSelect(entry.id) : undefined}
+ // The cap keeps a short thread packed instead of spread over the
+ // whole gutter; a long one outgrows it and the share decides.
+ className={cn(
+ 'group flex max-h-3.5 min-h-0 flex-1 items-center outline-none',
+ align === 'right' ? 'justify-end' : 'justify-start'
+ )}>
+ {/* At rest every tick is the same short length and only weight and
+ depth separate the tiers. Pointing at the rail grows them out by
+ tier, and the one actually under the pointer reaches full length
+ so the rail says which turn the card belongs to. */}
+ <span
+ className={cn(
+ 'w-3 rounded-full transition-[width,height,background-color] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none',
+ current
+ ? 'bg-foreground/90 h-[3px] group-focus-within/rail:w-6 group-hover/rail:w-6'
+ : cn(
+ 'group-hover:bg-foreground/70 group-focus-visible:bg-foreground/70 h-0.5',
+ 'group-hover:w-6! group-focus-visible:w-6!',
+ onScreen
+ ? 'bg-foreground/50 group-focus-within/rail:w-[18px] group-hover/rail:w-[18px]'
+ : 'bg-foreground/15'
+ )
+ )}
+ />
+ </button>
+ );
+ })}
+
+ {previewEntry && (
+ <div
+ data-slot="conversation-map-preview"
+ data-side={side}
+ onPointerLeave={() => setPreviewId(null)}
+ className={cn(
+ floating,
+ 'absolute top-1/2 z-50 w-60 -translate-y-1/2 rounded-2xl bg-popover/95 p-3.5 shadow-xl ring-1 ring-foreground/15 backdrop-blur-xl outline-none',
+ side === 'left' ? 'right-full me-2.5' : 'left-full ms-2.5'
+ )}>
+ <p className="line-clamp-2 text-[13px] leading-snug font-medium">{previewEntry.title}</p>
+ {previewEntry.preview && (
+ <p className="text-foreground/60 mt-1 line-clamp-4 text-[13px] leading-relaxed">
+ {previewEntry.preview}
+ </p>
+ )}
+ </div>
+ )}
+ </nav>
+ );
+}
diff --git a/app/src/components/assistant-ui/markdown-text.tsx b/app/src/components/assistant-ui/markdown-text.tsx
index e87fa238d6..19dfe1c9c8 100644
--- a/app/src/components/assistant-ui/markdown-text.tsx
+++ b/app/src/components/assistant-ui/markdown-text.tsx
@@ -299,10 +299,7 @@ const defaultComponents = memoizeMarkdownComponents({
if (source) return <CitationMarker index={citationIndex} source={source} />;
return (
<a
- className={cn(
- 'aui-md-a text-primary hover:text-primary/80 underline underline-offset-2',
- className
- )}
+ className={cn('aui-md-a text-primary hover:text-primary/80 no-underline', className)}
href={href}
{...props}>
{children}
diff --git a/app/src/components/assistant-ui/thread.tsx b/app/src/components/assistant-ui/thread.tsx
index e3637fbeec..70eebedf3e 100644
--- a/app/src/components/assistant-ui/thread.tsx
+++ b/app/src/components/assistant-ui/thread.tsx
@@ -120,6 +120,10 @@ export type ThreadComponents = {
* anything else.
*/
ComposerExtras?: ComponentType | undefined;
+ /** Host-owned controls rendered in the right action cluster before voice. */
+ ComposerRightExtras?: ComponentType | undefined;
+ /** Host-owned navigation rail mounted inside the scrolling viewport. */
+ ConversationMap?: ComponentType | undefined;
/** Full-width host content immediately above the composer shell. */
ComposerHeader?: ComponentType | undefined;
/**
@@ -383,7 +387,11 @@ const ThreadRoot: FC<{
loadError: string | null;
onEscape?: () => void;
}> = ({ isEmpty, model, onModelChange, loadError, onEscape }) => {
- const { Welcome = ThreadWelcome, Composer: HostComposer } = useContext(ThreadComponentsContext);
+ const {
+ Welcome = ThreadWelcome,
+ Composer: HostComposer,
+ ConversationMap,
+ } = useContext(ThreadComponentsContext);
const viewportRef = useRef<HTMLDivElement>(null);
const messageGroupRef = useRef<HTMLDivElement>(null);
// Everything the viewport scrolls over, which is MORE than the message group:
@@ -415,6 +423,7 @@ const ThreadRoot: FC<{
scrollToBottomOnRunStart={false}
data-slot="aui_thread-viewport"
className="relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth">
+ {ConversationMap ? <ConversationMap /> : null}
<div
ref={scrollContentRef}
className={cn(
@@ -711,7 +720,8 @@ function useFollowBottom(
followRef.current = true;
} else if (
viewport.scrollTop < lastScrollTopRef.current &&
- (scrollbarDragActive || window.performance.now() - userIntentAt <= USER_SCROLL_INTENT_WINDOW_MS)
+ (scrollbarDragActive ||
+ window.performance.now() - userIntentAt <= USER_SCROLL_INTENT_WINDOW_MS)
) {
followRef.current = false;
}
@@ -1158,6 +1168,7 @@ const ComposerAction: FC<{
hasComposerAttachments,
onComposerAttachmentSend,
ComposerIdleAction,
+ ComposerRightExtras,
onSwitchToMicCloud,
} = useContext(ThreadComponentsContext);
const isRunning = useAuiState(state => state.thread.isRunning);
@@ -1175,6 +1186,7 @@ const ComposerAction: FC<{
<ComposerExtrasSlot />
</div>
<div className="flex items-center gap-1.5">
+ {ComposerRightExtras ? <ComposerRightExtras /> : null}
{onSwitchToMicCloud && (
<TooltipIconButton
tooltip="Voice mode"
@@ -1522,14 +1534,10 @@ const AssistantMessage: FC = () => {
</div>
);
case 'indicator':
- return (
- <span
- data-slot="aui_assistant-message-indicator"
- className="animate-pulse font-sans"
- aria-label="Assistant is working">
- {'●'}
- </span>
- );
+ // The host RunningStatus slot renders the single shared loading
+ // state below the message group. Rendering assistant-ui's raw
+ // indicator part as well produces a second, disconnected dot.
+ return null;
default:
return null;
}
diff --git a/app/src/components/layout/shell/AppSidebar.test.tsx b/app/src/components/layout/shell/AppSidebar.test.tsx
index 4135b411f6..1168ce7fec 100644
--- a/app/src/components/layout/shell/AppSidebar.test.tsx
+++ b/app/src/components/layout/shell/AppSidebar.test.tsx
@@ -34,12 +34,16 @@ vi.mock('../../../lib/i18n/I18nContext', () => ({ useT: () => ({ t: (k: string)
describe('nav separator visibility', () => {
it('shows the separator on a route whose region opens with a plain list', () => {
renderAppSidebar({ initialEntries: ['/settings'] });
- expect(screen.getByTestId('sidebar-nav-separator').className).not.toContain('opacity-0');
+ const separator = screen.getByTestId('sidebar-nav-separator');
+ expect(separator.className).not.toContain('opacity-0');
+ expect(separator).toHaveClass('my-2.5');
});
it('hides it on chat, whose region opens with its own outlined button', () => {
renderAppSidebar({ initialEntries: ['/chat'] });
- expect(screen.getByTestId('sidebar-nav-separator').className).toContain('opacity-0');
+ const separator = screen.getByTestId('sidebar-nav-separator');
+ expect(separator.className).toContain('opacity-0');
+ expect(separator).toHaveClass('my-2');
});
it('hides it on a chat thread route too', () => {
@@ -83,11 +87,13 @@ describe('AppSidebar — collapsed rail', () => {
it('reserves a strip above the reopen trigger for the macOS traffic lights', () => {
const { container } = renderAppSidebar({ initialEntries: ['/chat'] }, { open: false });
// A spacer now, not a drag region of its own — the column around it drags.
- expect(container.querySelector('.h-7.w-full.flex-none')).toBeInTheDocument();
+ const spacer = container.querySelector('.h-7.w-full.flex-none');
+ expect(spacer).toBeInTheDocument();
+ expect(spacer).toHaveClass('mb-2');
});
// The drag region is the whole column, not just that strip. `drag.js` drags a
- // bare region only on a direct hit, so the ~12px of column either side of each
+ // bare region only on a direct hit, so the 28px of column either side of each
// 32px rail button — the band sitting between the traffic lights and the rail
// — was dead chrome. Assert the *value* and that the controls are inside it:
// presence alone passed before the fix and would pass again after a revert.
@@ -96,6 +102,7 @@ describe('AppSidebar — collapsed rail', () => {
const region = container.querySelector('[data-tauri-drag-region]') as HTMLElement;
expect(region.getAttribute('data-tauri-drag-region')).toBe('deep');
expect(region.className).toContain('h-full');
+ expect(region.className).toContain('items-center');
// Only `"deep"` reaches descendants, so containment is what makes the
// margins around these controls draggable. They stay clickable because
// `isDragRegion` short-circuits on a clickable element first — which is
diff --git a/app/src/components/layout/shell/AppSidebar.tsx b/app/src/components/layout/shell/AppSidebar.tsx
index 582785e276..33c4b0b59d 100644
--- a/app/src/components/layout/shell/AppSidebar.tsx
+++ b/app/src/components/layout/shell/AppSidebar.tsx
@@ -67,7 +67,7 @@ function hidesSidebarSeparator(pathname: string): boolean {
* `Sidebar` layer so the same floating treatment also wraps collapsed mode.
*
* **Collapsed**: a draggable strip (clears the macOS traffic lights), a
- * reopen trigger, and {@link CollapsedNavRail}'s icon-only nav — formerly a
+ * reopen trigger, and {@link CollapsedNavRail}'s compact labelled nav — formerly a
* sibling `<div>` rendered by `RootShellLayout` outside the (unmounted)
* `Sidebar` column; now the column's own body while narrow. See
* `RootShellLayout`'s `collapsible="icon"` comment for why that's safe.
@@ -91,7 +91,7 @@ export default function AppSidebar() {
// fixed-size trigger/rail buttons in the narrow column.
//
// The whole column is the drag region, not just the strip below it. At
- // {@link SIDEBAR_ICON_WIDTH} (56px) around 32px buttons, the margins
+ // {@link SIDEBAR_ICON_WIDTH} (88px) around the labelled rail buttons, the margins
// either side of every rail icon — plus the `gap-0.5` bands and the
// wrapper above `CollapsedNavRail` — are unmarked container, and Tauri's
// `drag.js` drags a bare region only on a direct hit, so all of that was
@@ -108,7 +108,7 @@ export default function AppSidebar() {
height of the window controls and start the rail below it, clear of
the lights. It carries no drag region of its own: the column above
already drags, and this only has to hold that height open. */}
- <div className="h-7 w-full flex-none" />
+ <div className="mb-2 h-7 w-full flex-none" />
<Tooltip label={t('layout.showSidebar')}>
{/* The primitive's own trigger, so reopening goes through the same
controlled `onOpenChange` `RootShellLayout` drives every other
@@ -123,11 +123,10 @@ export default function AppSidebar() {
<LuPanelLeftOpen className="h-4 w-4" />
</SidebarTrigger>
</Tooltip>
- {/* Keep the primary nav reachable while collapsed: an icon-only rail.
+ {/* Keep the primary nav reachable while collapsed: a labelled compact rail.
Kept as its own component rather than folded into `SidebarNav` —
- it covers more ground than that file's `NAV_TABS` loop (it also
- stands in for `SidebarHeader`'s Home/shortcuts/settings actions,
- none of which are nav tabs), so a shared render path would mean
+ it covers more ground than that file's `NAV_TABS` loop by adding
+ Settings, so a shared render path would mean
`SidebarNav` growing a second, unrelated responsibility instead of
just adapting its own rows to icon width. */}
<div className="mt-1 w-full pt-1">
@@ -158,20 +157,17 @@ export default function AppSidebar() {
against whatever the theme puts there. /40 is twice the /20 this
started at, which was faint enough to disappear.
- `my-2.5` owns the ENTIRE gap between the two lists, by design: the nav
- group's `pb-0` and the thread list header's `pt-0` both give up their
- own padding so this is the only spacing between them. That is why it
- is 10px a side rather than the 6px it was — at 6px it was one
- contributor among three, and once the other two were removed the same
- value left the lists nearly touching. Change this and the whole gap
- changes; there is nothing else stacking with it.
+ The separator owns the ENTIRE gap between the two lists: the nav
+ group's `pb-0` and the projected region's `pt-0` both give up their
+ padding. Regular regions use `my-2.5`; chat uses `my-2` while the rule
+ is hidden, matching the thread list's 8px gap below New Conversation.
`mx-3` lines its ends up with the nav rows' own inset rather than the
primitive's narrower `mx-2`. */}
<SidebarSeparator
aria-hidden={separatorHidden || undefined}
data-testid="sidebar-nav-separator"
- className={`mx-3 my-2.5 bg-content-faint/40 ${separatorHidden ? 'opacity-0' : ''}`}
+ className={`mx-3 bg-content-faint/40 ${separatorHidden ? 'my-2 opacity-0' : 'my-2.5'}`}
/>
<SidebarScrollRegion className="gap-0">
{/* Flex column so routes that project more than one region can order
diff --git a/app/src/components/layout/shell/CollapsedNavRail.test.tsx b/app/src/components/layout/shell/CollapsedNavRail.test.tsx
index 7d8090c5fe..95be1dbe8f 100644
--- a/app/src/components/layout/shell/CollapsedNavRail.test.tsx
+++ b/app/src/components/layout/shell/CollapsedNavRail.test.tsx
@@ -5,34 +5,26 @@ import { renderWithProviders } from '../../../test/test-utils';
import CollapsedNavRail from './CollapsedNavRail';
const mockNavigate = vi.fn();
-const mockHome = vi.fn();
vi.mock('react-router-dom', async importOriginal => {
const actual = await importOriginal<typeof import('react-router-dom')>();
return { ...actual, useNavigate: () => mockNavigate };
});
-vi.mock('./useHomeNav', () => ({ useHomeNav: () => mockHome }));
// Deterministic labels: render the i18n key so queries don't depend on locale.
vi.mock('../../../lib/i18n/I18nContext', () => ({ useT: () => ({ t: (k: string) => k }) }));
vi.mock('../../../services/analytics', () => ({ trackEvent: vi.fn() }));
-const openUrl = vi.fn().mockResolvedValue(undefined);
-vi.mock('../../../utils/openUrl', () => ({ openUrl: (...args: unknown[]) => openUrl(...args) }));
describe('CollapsedNavRail', () => {
beforeEach(() => vi.clearAllMocks());
- it('renders Home, Discord, and every primary nav destination as icon buttons', () => {
+ it('renders every primary destination with a visible label, without Home or Discord', () => {
renderWithProviders(<CollapsedNavRail />, { initialEntries: ['/home'] });
- for (const key of [
- 'nav.home',
- 'nav.discord',
- 'nav.chat',
- 'nav.brain',
- 'nav.flows',
- 'nav.connections',
- ]) {
+ for (const key of ['nav.chat', 'nav.brain', 'nav.flows', 'nav.connections', 'nav.settings']) {
expect(screen.getByRole('button', { name: key })).toBeInTheDocument();
+ expect(screen.getByText(key)).toBeVisible();
}
+ expect(screen.queryByRole('button', { name: 'nav.home' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: 'nav.discord' })).not.toBeInTheDocument();
// The wallet shortcut was removed from the rail.
expect(screen.queryByRole('button', { name: 'nav.wallet' })).not.toBeInTheDocument();
// Human is reached from the chat composer's idle button, not a nav row.
@@ -48,18 +40,11 @@ describe('CollapsedNavRail', () => {
expect(screen.getByRole('button', { name: 'nav.chat' }).dataset.active).toBe('false');
});
- it('Discord button opens the community invite in the browser', () => {
+ it('exposes every collapsed icon label as a tooltip fallback', () => {
renderWithProviders(<CollapsedNavRail />, { initialEntries: ['/home'] });
- fireEvent.click(screen.getByRole('button', { name: 'nav.discord' }));
- expect(openUrl).toHaveBeenCalledWith('https://discord.tinyhumans.ai');
- });
-
- it('Discord button has correct data-analytics-id', () => {
- renderWithProviders(<CollapsedNavRail />, { initialEntries: ['/home'] });
- expect(screen.getByRole('button', { name: 'nav.discord' })).toHaveAttribute(
- 'data-analytics-id',
- 'collapsed-rail-discord'
- );
+ for (const key of ['nav.chat', 'nav.brain', 'nav.flows', 'nav.connections', 'nav.settings']) {
+ expect(screen.getByRole('button', { name: key })).toHaveAttribute('title', key);
+ }
});
it('navigates to a destination path when its icon is clicked', () => {
@@ -68,13 +53,6 @@ describe('CollapsedNavRail', () => {
expect(mockNavigate).toHaveBeenCalledWith('/brain');
});
- it('runs the shared Home action when Home is clicked', () => {
- renderWithProviders(<CollapsedNavRail />, { initialEntries: ['/home'] });
- fireEvent.click(screen.getByRole('button', { name: 'nav.home' }));
- expect(mockHome).toHaveBeenCalledTimes(1);
- expect(mockNavigate).not.toHaveBeenCalled();
- });
-
it('marks the active destination with aria-current', () => {
renderWithProviders(<CollapsedNavRail />, { initialEntries: ['/connections'] });
expect(screen.getByRole('button', { name: 'nav.connections' })).toHaveAttribute(
@@ -84,9 +62,9 @@ describe('CollapsedNavRail', () => {
expect(screen.getByRole('button', { name: 'nav.chat' })).not.toHaveAttribute('aria-current');
});
- it('treats /chat as the active Home state', () => {
+ it('marks Chat active on nested chat routes', () => {
renderWithProviders(<CollapsedNavRail />, { initialEntries: ['/chat/abc'] });
- expect(screen.getByRole('button', { name: 'nav.home' })).toHaveAttribute(
+ expect(screen.getByRole('button', { name: 'nav.chat' })).toHaveAttribute(
'aria-current',
'page'
);
diff --git a/app/src/components/layout/shell/CollapsedNavRail.tsx b/app/src/components/layout/shell/CollapsedNavRail.tsx
index 38f5de5289..0a7da3e6b1 100644
--- a/app/src/components/layout/shell/CollapsedNavRail.tsx
+++ b/app/src/components/layout/shell/CollapsedNavRail.tsx
@@ -1,5 +1,4 @@
import { useMemo } from 'react';
-import { FaDiscord } from 'react-icons/fa6';
import { useLocation, useNavigate } from 'react-router-dom';
import { NAV_TABS, type NavTab } from '../../../config/navConfig';
@@ -7,7 +6,6 @@ import { useT } from '../../../lib/i18n/I18nContext';
import { trackEvent } from '../../../services/analytics';
import { useAppSelector } from '../../../store/hooks';
import { selectUnreadCount } from '../../../store/notificationSlice';
-import { openUrl } from '../../../utils/openUrl';
import {
SidebarMenu,
SidebarMenuBadge,
@@ -16,9 +14,7 @@ import {
Tooltip,
} from '../../ui';
import { NavIcon } from './navIcons';
-import { DISCORD_URL } from './SidebarHeader';
import { useCloudNavGate } from './useCloudNavGate';
-import { useHomeNav } from './useHomeNav';
/** Same active-route rules as the expanded {@link SidebarNav}. */
function matchActive(path: string, pathname: string): boolean {
@@ -30,18 +26,17 @@ function matchActive(path: string, pathname: string): boolean {
}
/**
- * Rail footprint layered on `SidebarMenuButton`: the rail is a 32px square
- * where the primitive's rows are full-width and left-aligned, and the unread
- * badge needs a positioning context. Everything else — the active fill, the
- * focus ring, the transition — comes from the primitive.
+ * Compact labelled rail footprint layered on `SidebarMenuButton`. The 72px
+ * button fits the collapsed column with an icon over a one-line label; the
+ * badge keeps the same positioning context.
*/
-const RAIL_BTN = 'relative h-8 w-8 justify-center rounded-lg p-0';
+const RAIL_BTN = 'relative h-12 w-[72px] flex-col justify-center gap-1 rounded-lg px-1 py-1.5';
+const RAIL_LABEL = 'max-w-full truncate text-[9px] font-medium leading-none';
/**
- * Icon-only navigation shown in the collapsed root-shell rail: the Home action
- * plus every primary {@link NAV_TABS} destination. Mirrors {@link SidebarNav}'s
- * routing/active rules and {@link SidebarHeader}'s Home behaviour (via the shared
- * {@link useHomeNav} hook) so a collapsed sidebar still navigates the app.
+ * Compact labelled navigation shown in the collapsed root-shell rail: every
+ * primary {@link NAV_TABS} destination plus Settings. Mirrors
+ * {@link SidebarNav}'s routing and active-route rules.
*
* Renders outside the `Sidebar` column (the column is unmounted while
* collapsed), which is fine: the menu primitives read no sidebar context.
@@ -50,7 +45,6 @@ export default function CollapsedNavRail() {
const { t } = useT();
const location = useLocation();
const navigate = useNavigate();
- const handleHome = useHomeNav();
const unreadCount = useAppSelector(state => selectUnreadCount(state.notifications.items));
const cloudAllowed = useCloudNavGate();
@@ -76,39 +70,11 @@ export default function CollapsedNavRail() {
navigate(tab.path);
};
- const homeActive = location.pathname === '/chat' || location.pathname.startsWith('/chat/');
const settingsActive = matchActive('/settings', location.pathname);
return (
<nav aria-label={t('nav.home')}>
<SidebarMenu className="items-center gap-2">
- {/* Home */}
- <SidebarMenuItem>
- <Tooltip label={t('nav.home')}>
- <SidebarMenuButton
- isActive={homeActive}
- onClick={handleHome}
- aria-label={t('nav.home')}
- className={RAIL_BTN}>
- <NavIcon id="home" className="h-5 w-5" />
- </SidebarMenuButton>
- </Tooltip>
- </SidebarMenuItem>
-
- {/* Community Discord — mirrors SidebarHeader's Discord button for the
- collapsed state. Opens the invite in the system browser. */}
- <SidebarMenuItem>
- <Tooltip label={t('nav.discord')}>
- <SidebarMenuButton
- onClick={() => void openUrl(DISCORD_URL).catch(() => {})}
- aria-label={t('nav.discord')}
- data-analytics-id="collapsed-rail-discord"
- className={RAIL_BTN}>
- <FaDiscord className="h-5 w-5" />
- </SidebarMenuButton>
- </Tooltip>
- </SidebarMenuItem>
-
{/* Primary nav destinations */}
{tabs.map(tab => {
const active = matchActive(tab.path, location.pathname);
@@ -122,11 +88,10 @@ export default function CollapsedNavRail() {
onClick={() => handleClick(tab, active)}
aria-label={tab.label}
className={RAIL_BTN}>
- <NavIcon id={tab.id} className="h-5 w-5" />
+ <NavIcon id={tab.id} className="h-4 w-4" />
+ <span className={RAIL_LABEL}>{tab.label}</span>
{showBadge && (
- <SidebarMenuBadge
- tone="attention"
- className="absolute -right-0.5 -top-0.5 ml-0">
+ <SidebarMenuBadge tone="attention" className="absolute right-1 top-1 ml-0">
{unreadCount > 9 ? '9+' : unreadCount}
</SidebarMenuBadge>
)}
@@ -139,15 +104,17 @@ export default function CollapsedNavRail() {
{/* Settings — reached via the header gear when expanded, which is hidden
in the collapsed rail, so it gets its own icon here. */}
<SidebarMenuItem>
- <SidebarMenuButton
- isActive={settingsActive}
- onClick={() => navigate('/settings')}
- title={t('nav.settings')}
- aria-label={t('nav.settings')}
- data-analytics-id="collapsed-rail-settings"
- className={RAIL_BTN}>
- <NavIcon id="settings" className="h-5 w-5" />
- </SidebarMenuButton>
+ <Tooltip label={t('nav.settings')}>
+ <SidebarMenuButton
+ isActive={settingsActive}
+ onClick={() => navigate('/settings')}
+ aria-label={t('nav.settings')}
+ data-analytics-id="collapsed-rail-settings"
+ className={RAIL_BTN}>
+ <NavIcon id="settings" className="h-4 w-4" />
+ <span className={RAIL_LABEL}>{t('nav.settings')}</span>
+ </SidebarMenuButton>
+ </Tooltip>
</SidebarMenuItem>
</SidebarMenu>
</nav>
diff --git a/app/src/components/layout/shell/ContentSurface.test.tsx b/app/src/components/layout/shell/ContentSurface.test.tsx
index 38440a04cc..6fcb146070 100644
--- a/app/src/components/layout/shell/ContentSurface.test.tsx
+++ b/app/src/components/layout/shell/ContentSurface.test.tsx
@@ -22,7 +22,7 @@ describe('ContentSurface', () => {
expect(surface.className).toContain('shadow-content-edge');
// The content is now the full-window layer beneath the floating sidebar,
// so its card has the same inset on all four edges.
- expect(surface.className).toContain('m-3');
+ expect(surface.className).toContain('m-2');
expect(surface.dataset.unframed).toBeUndefined();
});
@@ -34,7 +34,7 @@ describe('ContentSurface', () => {
// a rounded card.
expect(surface.className).not.toContain('rounded-2xl');
expect(surface.className).not.toContain('shadow-content-edge');
- expect(surface.className).not.toContain('m-3');
+ expect(surface.className).not.toContain('m-2');
expect(surface.dataset.unframed).toBe('true');
});
diff --git a/app/src/components/layout/shell/ContentSurface.tsx b/app/src/components/layout/shell/ContentSurface.tsx
index 46f2c0f799..b77a776eae 100644
--- a/app/src/components/layout/shell/ContentSurface.tsx
+++ b/app/src/components/layout/shell/ContentSurface.tsx
@@ -34,7 +34,7 @@ interface ContentSurfaceProps {
* consistent background across every theme.
*
* The geometry is the `SidebarInset` primitive: the framed default is an even
- * 12px inset on every window edge, a 2xl radius, and a `content-edge` hairline.
+ * 8px inset on every window edge, a 2xl radius, and a `content-edge` hairline.
* The primitive reads no sidebar context, so this stays renderable outside a
* `SidebarProvider` — several page-level tests mount it on its own.
*/
diff --git a/app/src/components/layout/shell/RootShellLayout.test.tsx b/app/src/components/layout/shell/RootShellLayout.test.tsx
index fe39b4d831..ed4e823c6f 100644
--- a/app/src/components/layout/shell/RootShellLayout.test.tsx
+++ b/app/src/components/layout/shell/RootShellLayout.test.tsx
@@ -48,11 +48,12 @@ describe('RootShellLayout', () => {
expect(surface.contains(screen.getByText('routed page'))).toBe(true);
});
- it('frames the content surface as a card by default', () => {
+ it('renders the content surface full-bleed by default', () => {
renderShell();
const surface = screen.getByTestId('app-content-surface');
- expect(surface.dataset.unframed).toBeUndefined();
- expect(surface.className).toContain('m-3');
+ expect(surface.dataset.unframed).toBe('true');
+ expect(surface.className).not.toContain('m-2');
+ expect(surface.className).not.toContain('rounded-2xl');
});
it('floats the sidebar above the full-window content surface', () => {
@@ -60,9 +61,13 @@ describe('RootShellLayout', () => {
const sidebar = screen.getByTestId('root-shell-sidebar');
expect(sidebar.className).toContain('absolute');
- expect(sidebar.className).toContain('inset-y-3');
- expect(sidebar.className).toContain('left-3');
+ expect(sidebar.className).toContain('inset-y-2');
+ expect(sidebar.className).toContain('left-2');
expect(sidebar.className).toContain('h-auto');
+ expect(sidebar.className).not.toContain('p-2');
+ expect(sidebar.className).toContain('animate-sidebar-shadow');
+ expect(sidebar.className).toContain('motion-reduce:animate-none');
+ expect(sidebar.className).toContain('sidebar-material');
expect(sidebar.className).toContain('rounded-2xl');
const content = screen.getByTestId('root-shell-content');
@@ -71,12 +76,14 @@ describe('RootShellLayout', () => {
it('pads routed content past the overlaid sidebar', () => {
renderShell({}, withLayout(true, 300));
- expect(screen.getByTestId('root-shell-routed-content').style.paddingInlineStart).toBe('312px');
+ expect(screen.getByTestId('root-shell-routed-content').style.paddingInlineStart).toBe('324px');
});
- it('forwards unframed so a live CEF webview gets a square, edge-to-edge pane', () => {
- renderShell({ unframed: true });
- expect(screen.getByTestId('app-content-surface').dataset.unframed).toBe('true');
+ it('can still render the optional framed content primitive', () => {
+ renderShell({ unframed: false });
+ const surface = screen.getByTestId('app-content-surface');
+ expect(surface.dataset.unframed).toBeUndefined();
+ expect(surface.className).toContain('m-2');
});
it('leaves the resize divider unfilled so the chrome reads as one surface', () => {
@@ -141,7 +148,7 @@ describe('RootShellLayout — redux-controlled geometry', () => {
// Live geometry is on screen…
expect(screen.getByTestId('root-shell-sidebar').style.width).toBe('340px');
- expect(screen.getByTestId('root-shell-routed-content').style.paddingInlineStart).toBe('352px');
+ expect(screen.getByTestId('root-shell-routed-content').style.paddingInlineStart).toBe('364px');
// …but nothing has been persisted yet: a drag writes one value, not sixty.
expect(panel(store).sidebarWidth).toBe(300);
@@ -173,7 +180,7 @@ describe('RootShellLayout — redux-controlled geometry', () => {
expect(sidebar).toHaveAttribute('data-state', 'collapsed');
expect(sidebar.style.width).toBe(`${SIDEBAR_ICON_WIDTH}px`);
expect(screen.getByTestId('root-shell-routed-content').style.paddingInlineStart).toBe(
- `${SIDEBAR_ICON_WIDTH + 12}px`
+ `${SIDEBAR_ICON_WIDTH + 24}px`
);
expect(screen.getByText('sidebar body')).toBeTruthy();
// The resize rail is hidden while collapsed — a fixed icon width isn't
diff --git a/app/src/components/layout/shell/RootShellLayout.tsx b/app/src/components/layout/shell/RootShellLayout.tsx
index 4b43fe28df..6ffdb33006 100644
--- a/app/src/components/layout/shell/RootShellLayout.tsx
+++ b/app/src/components/layout/shell/RootShellLayout.tsx
@@ -34,8 +34,12 @@ const LAYOUT_ID = APP_SHELL_LAYOUT_ID;
// here — they were byte-identical, and two copies of a clamp is one copy too
// many once the primitive is the thing doing the clamping.
const LAYOUT_DEFAULTS = { sidebarVisible: true, sidebarWidth: SIDEBAR_DEFAULT_WIDTH };
-/** Matches Tailwind's `3` spacing used for the floating shell inset. */
-const SHELL_GUTTER = 12;
+/** Framed-mode inset; the app shell defaults to a full-bleed surface. */
+const FRAMED_CONTENT_SURFACE_INSET = 8;
+/** Tight floating offset shared by the desktop app and browser shell. */
+const SIDEBAR_INSET = 8;
+/** Breathing room between the floating sidebar edge and routed page content. */
+const ROUTED_CONTENT_GAP = 16;
function clamp(width: number): number {
return Math.min(Math.max(width, SIDEBAR_MIN_WIDTH), SIDEBAR_MAX_WIDTH);
@@ -83,8 +87,8 @@ interface RootShellLayoutProps {
* - **Chrome** — this component paints nothing of its own. The themed
* {@link AppBackground} behind it shows through here and behind the
* sidebar, so the frame carries the theme's hue as one continuous surface.
- * - **Card** — the routed content sits on a full-window inset, rounded
- * {@link ContentSurface}, the opaque sheet beneath the sidebar.
+ * - **Surface** — routed content fills the whole window beneath the sidebar;
+ * there is no second outer card or exposed chrome gutter.
* - **Sidebar** — an inset material floats above that sheet. The routed
* content receives an equal inline inset, so it never sits under the
* floating navigation even though its background continues behind it.
@@ -108,7 +112,11 @@ interface RootShellLayoutProps {
* `lib/commands/registry` already binds mod+B to `toggleSidebar`, and a second
* window listener on the same chord toggles twice and cancels out.
*/
-export default function RootShellLayout({ sidebar, children, unframed }: RootShellLayoutProps) {
+export default function RootShellLayout({
+ sidebar,
+ children,
+ unframed = true,
+}: RootShellLayoutProps) {
const { t } = useT();
const dispatch = useAppDispatch();
const layout = useAppSelector(selectPanelLayout(LAYOUT_ID, LAYOUT_DEFAULTS));
@@ -149,7 +157,9 @@ export default function RootShellLayout({ sidebar, children, unframed }: RootShe
const dragCleanupRef = useRef<(() => void) | null>(null);
const width = dragWidth ?? persistedWidth;
const renderedSidebarWidth = isOpen ? width : SIDEBAR_ICON_WIDTH;
- const routedContentInset = renderedSidebarWidth + SHELL_GUTTER;
+ const contentSurfaceInset = unframed ? 0 : FRAMED_CONTENT_SURFACE_INSET;
+ const routedContentInset =
+ renderedSidebarWidth + (SIDEBAR_INSET - contentSurfaceInset) + ROUTED_CONTENT_GAP;
const commitWidth = useCallback(
(next: number) => dispatch(setSidebarWidth({ id: LAYOUT_ID, width: clamp(Math.round(next)) })),
@@ -254,8 +264,9 @@ export default function RootShellLayout({ sidebar, children, unframed }: RootShe
confirms there is no bounds-tracked child webview left anywhere in
the shell; the whole app renders as one native webview, so there is
no second compositing layer for a narrowed HTML column to be
- "punched through" by. `icon` mode's real ~48–56px column — never
- zero-width, in either state — does not reintroduce the failure mode
+ "punched through" by. `icon` mode's real 88px column — never
+ zero-width, in either state, and wide enough for the macOS traffic
+ lights — does not reintroduce the failure mode
`offcanvas` was chosen for; that failure mode's precondition no
longer exists. `AppSidebar` reads {@link useSidebar}'s `state` to
render its own compact, icon-only body while collapsed (formerly
@@ -263,7 +274,7 @@ export default function RootShellLayout({ sidebar, children, unframed }: RootShe
<Sidebar
collapsible="icon"
data-testid="root-shell-sidebar"
- className="absolute inset-y-3 left-3 z-30 h-auto rounded-2xl border border-sidebar-border bg-sidebar/85 shadow-large backdrop-blur-2xl">
+ className="sidebar-material absolute inset-y-2 left-2 z-30 h-auto animate-sidebar-shadow rounded-2xl border border-content-faint/40 shadow-[2px_4px_10px_-4px_rgb(0_0_0/0.05),4px_14px_28px_-14px_rgb(0_0_0/0.07)] backdrop-blur-2xl motion-reduce:animate-none">
{sidebar}
</Sidebar>
@@ -279,17 +290,18 @@ export default function RootShellLayout({ sidebar, children, unframed }: RootShe
data-testid="root-shell-divider"
data-analytics-id="root-shell-resize-divider"
onPointerDown={handleRailPointerDown}
- className="absolute inset-y-3 z-40"
- style={{ left: width + SHELL_GUTTER }}
+ className="absolute inset-y-2 z-40"
+ style={{ left: width + SIDEBAR_INSET }}
/>
)}
<div
className="relative flex w-full min-w-0 flex-1 flex-col overflow-hidden"
data-testid="root-shell-content">
- {/* macOS overlay-title-bar drag region. It is absolutely positioned, so
- the routed surface keeps its full height. No-op off macOS / outside
- Tauri, where the native title bar already owns this area. */}
+ {/* Empty macOS overlay-title-bar band. It is absolutely positioned and
+ fully transparent, so it is draggable without shifting or painting
+ over the page. No-op off macOS / outside Tauri, where the native
+ title bar owns this area. */}
<WindowDragBar />
<ContentSurface unframed={unframed}>
<div
diff --git a/app/src/components/layout/shell/SidebarHeader.test.tsx b/app/src/components/layout/shell/SidebarHeader.test.tsx
index e4959b918d..1a66a58a3f 100644
--- a/app/src/components/layout/shell/SidebarHeader.test.tsx
+++ b/app/src/components/layout/shell/SidebarHeader.test.tsx
@@ -86,6 +86,7 @@ describe('SidebarHeader', () => {
const { container } = renderWithProviders(<SidebarHeader />, { initialEntries: ['/home'] });
const region = container.querySelector('[data-tauri-drag-region]') as HTMLElement;
expect(region.getAttribute('data-tauri-drag-region')).toBe('deep');
+ expect(region).toHaveClass('pt-[7px]');
// The icons sit inside the region and keep their clicks: `isDragRegion`
// short-circuits on a clickable element before it reaches `deep`, and
// resolving them by button role is what asserts they are still clickable.
diff --git a/app/src/components/layout/shell/SidebarHeader.tsx b/app/src/components/layout/shell/SidebarHeader.tsx
index 0677c21795..c92141e8e7 100644
--- a/app/src/components/layout/shell/SidebarHeader.tsx
+++ b/app/src/components/layout/shell/SidebarHeader.tsx
@@ -32,8 +32,9 @@ export default function SidebarHeader() {
const { hide } = useRootSidebar();
return (
- // The primitive's header slot supplies the px-3/pb-2/pt-3 band; this only
- // turns it into a right-aligned row. Right-aligned so the macOS traffic
+ // The primitive supplies the horizontal and bottom inset; this overrides
+ // its top inset to align the row to the title-bar centreline, then turns it
+ // into a right-aligned row. Right-aligned so the macOS traffic
// lights (top-left, overlay title bar) sit in the empty left space — the
// icons stay clear of the window controls and inline with them.
//
@@ -45,11 +46,13 @@ export default function SidebarHeader() {
// file is JSON and cannot hold a comment, so the reasoning lives here,
// beside the row it has to agree with.
//
- // The target is fixed and computable: this row's centre is pt-3 (12px) plus
- // half of ICON_BTN's h-7 (14px) = 26px from the sidebar top. The floating
- // sidebar starts 12px from the window edges, so both traffic-light
- // coordinates preserve their old position relative to the sidebar by
- // adding that inset: x 20 -> 32 and y 28 -> 40.
+ // The native traffic lights sit optically 4px above the title-bar band's
+ // mathematical centre. The sidebar starts 8px from the window edge, then
+ // 7px top padding plus half of ICON_BTN's h-7 (14px) puts the icon centre
+ // on the tuned 29px optical line.
+ // The native cluster is deliberately nudged toward the window corner:
+ // x 22 / y 32 keeps it inside the 88px collapsed rail while leaving more
+ // breathing room below it before the centred navigation controls begin.
//
// `y` is NOT that centre, and is not a simple gap either. tao positions the
// lights by resizing the title-bar container: `inset_traffic_lights`
@@ -59,14 +62,13 @@ export default function SidebarHeader() {
// works out as `y − b`, where `b` is whatever offset the button already had
// inside that container. `b` is AppKit's and is not knowable from here,
// which is why `y` is tuned by looking at the window rather than solved:
- // 20 sat visibly high, 28 was the correction before the 12px shell inset.
+ // 20 sat visibly high, 28 was the correction before the 8px sidebar inset.
//
- // `x: 32` is the conventional 20px macOS left inset plus the sidebar's 12px
- // shell inset. Supplying it is unavoidable
+ // `x: 22` is the collapsed-rail optical correction. Supplying it is unavoidable
// — the config takes a position, so `y` cannot be set alone without moving
// this into Rust and reading the existing frame.
//
- // Re-check this if `pt-3` or `ICON_BTN`'s height ever changes: the target
+ // Re-check this if the 7px top inset or `ICON_BTN`'s height ever changes: the target
// moves with them, and nothing fails loudly when the two disagree.
//
// `data-tauri-drag-region` lives directly on the primitive (rather than a
@@ -84,7 +86,7 @@ export default function SidebarHeader() {
// correct on a band with no children — see `WindowDragBar`.
<SidebarHeaderShell
data-tauri-drag-region="deep"
- className="flex-row items-center justify-end gap-1">
+ className="flex-row items-center justify-end gap-1 pt-[7px]">
<div className="flex items-center gap-0.5">
{/* Community Discord — opens the invite in the system browser. This slot
held the keyboard-shortcuts help; that directory is still one
diff --git a/app/src/components/layout/shell/WindowDragBar.test.tsx b/app/src/components/layout/shell/WindowDragBar.test.tsx
index b2bf8f4b5f..f3f01dc5a4 100644
--- a/app/src/components/layout/shell/WindowDragBar.test.tsx
+++ b/app/src/components/layout/shell/WindowDragBar.test.tsx
@@ -24,6 +24,7 @@ describe('WindowDragBar', () => {
expect(bar).not.toBeNull();
expect((bar as HTMLElement).style.height).toBe(`${WINDOW_DRAG_BAR_HEIGHT}px`);
expect((bar as HTMLElement).className).toContain('absolute');
+ expect((bar as HTMLElement).className).toContain('bg-transparent');
});
// Presence is what the assertions above cover, and presence is exactly what a
diff --git a/app/src/components/layout/shell/WindowDragBar.tsx b/app/src/components/layout/shell/WindowDragBar.tsx
index f39774c3ac..e2c894b45a 100644
--- a/app/src/components/layout/shell/WindowDragBar.tsx
+++ b/app/src/components/layout/shell/WindowDragBar.tsx
@@ -5,7 +5,7 @@ import { isTauri } from '../../../utils/tauriCommands/common';
* Height (px) of the drag strip. Matches the macOS traffic-light zone so the
* native window controls sit within the band.
*/
-export const WINDOW_DRAG_BAR_HEIGHT = 28;
+export const WINDOW_DRAG_BAR_HEIGHT = 32;
/**
* Transparent macOS window-drag band for the overlay title bar.
@@ -16,13 +16,13 @@ export const WINDOW_DRAG_BAR_HEIGHT = 28;
* webview captures the pointer events. We opt back in with a `data-tauri-drag-
* region` band.
*
- * Positioned over the top of the content column ({@link RootShellLayout}), so
- * it does not reserve vertical space or add an inherited top inset to routed
- * pages. The window controls overlay this same title-bar region.
+ * Absolutely overlaid above the routed surface, so it contributes no layout
+ * height and never shifts page content. It paints nothing: the routed content
+ * remains fully visible through the draggable hit-area.
*
- * Native CEF provider webviews composite above all HTML and so can't be dragged
- * through; that's a platform limit, not this band. The sidebar is intentionally
- * excluded — its header already drags in place.
+ * Native child webviews composite above HTML and cannot be dragged through;
+ * that is a platform limit, not this band. The sidebar is intentionally
+ * excluded because its header already drags in place.
*
* The attribute is deliberately bare (React renders it as `="true"`). `drag.js`
* reads that as direct-hit-only — `el === composedPath[0]` — which is exactly
@@ -41,7 +41,7 @@ export default function WindowDragBar() {
<div
data-tauri-drag-region
aria-hidden="true"
- className="absolute inset-x-0 top-0 z-10"
+ className="absolute inset-x-0 top-0 z-20 bg-transparent"
style={{ height: WINDOW_DRAG_BAR_HEIGHT }}
/>
);
diff --git a/app/src/components/ui/Sidebar.tsx b/app/src/components/ui/Sidebar.tsx
index 1dee010c5c..ee4dd9d9b1 100644
--- a/app/src/components/ui/Sidebar.tsx
+++ b/app/src/components/ui/Sidebar.tsx
@@ -47,8 +47,13 @@ import { cn } from '../../lib/cn';
export const SIDEBAR_DEFAULT_WIDTH = 224;
export const SIDEBAR_MIN_WIDTH = 188;
export const SIDEBAR_MAX_WIDTH = 420;
-/** Column width when collapsed with `collapsible="icon"` — fits a 32px rail button. */
-export const SIDEBAR_ICON_WIDTH = 56;
+/**
+ * Column width when collapsed with `collapsible="icon"`.
+ *
+ * Wide enough for the macOS traffic-light cluster plus its native breathing
+ * room; the 32px rail controls are centered on the same column axis below it.
+ */
+export const SIDEBAR_ICON_WIDTH = 88;
/** Pixels per arrow-key press on {@link SidebarRail}. */
export const SIDEBAR_KEYBOARD_STEP = 16;
@@ -487,7 +492,7 @@ export const SidebarInset = forwardRef<HTMLDivElement, SidebarInsetProps>(
// whether a caller overlays a sidebar, and RootShellLayout owns that
// routed-content inset explicitly.
!unframed &&
- 'm-3 rounded-2xl after:pointer-events-none after:absolute after:inset-0 after:z-20 after:rounded-[inherit] after:shadow-content-edge',
+ 'm-2 rounded-2xl after:pointer-events-none after:absolute after:inset-0 after:z-20 after:rounded-[inherit] after:shadow-content-edge',
className
)}
{...rest}
diff --git a/app/src/features/conversations/Conversations.tsx b/app/src/features/conversations/Conversations.tsx
index 55eb92b78c..e47bc80196 100644
--- a/app/src/features/conversations/Conversations.tsx
+++ b/app/src/features/conversations/Conversations.tsx
@@ -14,7 +14,6 @@ import { SidebarContent } from '../../components/layout/shell/SidebarSlot';
import { ArtifactCardAdapter } from '../../features/conversations/aui/ArtifactCardAdapter';
import { ContextUsage } from '../../features/conversations/aui/ContextUsage';
import { PlanReviewCardCore } from '../../features/conversations/aui/PlanReviewPart';
-import { RunModeToggle } from '../../features/conversations/aui/RunModeToggle';
import { toAuiTodoItems } from '../../features/conversations/aui/TodoListPart';
import { useRunMode } from '../../features/conversations/aui/useRunMode';
import {
@@ -33,7 +32,6 @@ import {
getComposerBlockedSendFeedback,
handleComposerSlashCommand,
} from '../../features/conversations/composerSendDecision';
-import { useMemorySyncActive } from '../../features/conversations/hooks/useBackgroundActivity';
import { selectBackgroundProcesses } from '../../features/conversations/selectors/backgroundProcesses';
import {
GENERAL_TAB_VALUE,
@@ -1464,8 +1462,8 @@ const Conversations = ({
]
: EMPTY_PROCESSING;
// Detached background sub-agents (mode === 'async') spawned in this thread.
- // The composer's background-processes badge needs the count/status, and
- // `TranscriptOverlays` lists them.
+ // `TranscriptOverlays` keeps their panel mounted even while its composer
+ // shortcut is temporarily hidden.
const backgroundProcesses = useMemo(
() => selectBackgroundProcesses(selectedThreadToolTimeline),
[selectedThreadToolTimeline]
@@ -1480,10 +1478,6 @@ const Conversations = ({
useLoadThreadGoal(selectedThreadId ?? null);
const liveTodos = useThreadTodos(selectedThreadId ?? null);
const threadGoal = useThreadGoal(selectedThreadId ?? null);
- const runningBackgroundCount = backgroundProcesses.filter(p => p.status === 'running').length;
- // Poll-free live signal: lights the badge when memories are syncing even if
- // no sub-agent is running and the panel is closed.
- const memorySyncActive = useMemorySyncActive();
// A plan the orchestrator parked for interactive review (request_plan_review
// gate). When present, the PlanReviewCard renders above the composer and
// resolves the parked turn.
@@ -1875,46 +1869,6 @@ const Conversations = ({
<ChatFilesChip threadId={(selectedThreadId ?? firstActiveThreadId) as string} />
) : null;
- // The control that opens the background-processes panel, plus its
- // running-count / memory-sync badge. Opens `TranscriptOverlays`' panel.
- const renderBackgroundProcessesButton = (onOpen: () => void) =>
- selectedThreadId ? (
- <button
- type="button"
- data-testid="background-processes-toggle"
- data-analytics-id="chat-header-background-processes"
- onClick={onOpen}
- aria-label={t('conversations.backgroundTasks.title')}
- title={
- backgroundProcesses.length > 0
- ? t('conversations.backgroundTasks.titleWithCount').replace(
- '{count}',
- String(backgroundProcesses.length)
- )
- : t('conversations.backgroundTasks.title')
- }
- className="relative flex h-7 w-7 items-center justify-center rounded-lg text-content-muted transition-colors hover:bg-surface-hover hover:text-content-secondary">
- <svg className="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path
- strokeLinecap="round"
- strokeLinejoin="round"
- strokeWidth={2}
- d="M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 10.172V5L8 4z"
- />
- </svg>
- {runningBackgroundCount > 0 ? (
- <span className="absolute -right-0.5 -top-0.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-amber-500 px-0.5 text-[9px] font-semibold leading-none text-content-inverted">
- {runningBackgroundCount}
- </span>
- ) : memorySyncActive ? (
- <span
- data-testid="background-activity-dot"
- className="absolute -right-0.5 -top-0.5 h-2 w-2 animate-pulse rounded-full bg-amber-500"
- />
- ) : null}
- </button>
- ) : null;
-
const assistantComposerHeader = (
<>
{/* Turn gates first: a parked plan review and a drafted workflow both
@@ -1950,13 +1904,7 @@ const Conversations = ({
);
// Left-hand controls in the assistant-ui composer toolbar.
- const assistantComposerFooterExtras = (
- <>
- {renderBackgroundProcessesButton(() => setShowBackgroundProcesses(true))}
- {chatFilesChip}
- {selectedThreadId && <RunModeToggle threadId={selectedThreadId} />}
- </>
- );
+ const assistantComposerFooterExtras = <>{chatFilesChip}</>;
// The mic-first (`mic-cloud`) composer. It replaces only the text composer:
// the transcript above it is the same assistant-ui `Thread` as text mode, so
diff --git a/app/src/features/conversations/aui/AgentRunningStatus.test.tsx b/app/src/features/conversations/aui/AgentRunningStatus.test.tsx
index 8b3f214d49..ee2309e51e 100644
--- a/app/src/features/conversations/aui/AgentRunningStatus.test.tsx
+++ b/app/src/features/conversations/aui/AgentRunningStatus.test.tsx
@@ -54,6 +54,11 @@ describe('AgentRunningStatus', () => {
);
expect(screen.getByTestId('agent-running-status-thinking')).toBeInTheDocument();
+ expect(screen.getByTestId('agent-running-status-thinking')).toHaveAttribute(
+ 'data-slot',
+ 'generation-loader'
+ );
+ expect(screen.getByTestId('agent-running-status-thinking')).toHaveClass('[&>div>span]:size-1');
expect(screen.queryByTestId('agent-running-status-tasks')).not.toBeInTheDocument();
});
});
diff --git a/app/src/features/conversations/aui/AgentRunningStatus.tsx b/app/src/features/conversations/aui/AgentRunningStatus.tsx
index 3aa1e84a16..da0c305428 100644
--- a/app/src/features/conversations/aui/AgentRunningStatus.tsx
+++ b/app/src/features/conversations/aui/AgentRunningStatus.tsx
@@ -15,15 +15,17 @@
* component at all; assistant-ui's own running-message indicator already
* signals "something is happening" for those, same as before.
*
- * With no task running, this falls back to the vendored `ThinkingIndicator`
- * (WS-E) rather than rendering nothing, so a turn that has not yet spawned any
- * sub-agent still shows a running signal beneath the composer.
+ * With no task running, this falls back to assistant-ui's vendored
+ * `GenerationLoader`, with a shimmering Thinking label, so a turn that has not
+ * yet spawned a sub-agent still shows one coherent running signal.
*/
+import { useEffect, useState } from 'react';
+
import {
TaskTray,
useTaskSummary,
} from '../../../components/assistant-ui/elements/agent-status.aui';
-import { ThinkingIndicator } from '../../../components/assistant-ui/elements/thinking-indicator';
+import { GenerationLoader } from '../../../components/assistant-ui/elements/loading-state';
import { useT } from '../../../lib/i18n/I18nContext';
/** English defaults mapped onto `AgentStatusStrings` via `useT()`. */
@@ -44,11 +46,22 @@ export function AgentRunningStatus() {
const { t } = useT();
const summary = useTaskSummary();
const strings = useAgentStatusStrings();
+ const [tick, setTick] = useState(0);
+
+ useEffect(() => {
+ if (summary.total > 0) return undefined;
+ const timer = window.setInterval(() => setTick(value => value + 1), 120);
+ return () => window.clearInterval(timer);
+ }, [summary.total]);
+
if (summary.total === 0) {
return (
- <ThinkingIndicator
+ <GenerationLoader
data-testid="agent-running-status-thinking"
label={t('chat.thinkingDots')}
+ tick={tick}
+ variant="rounded"
+ className="flex-row justify-start gap-2.5 px-2 [&>div]:gap-0.5 [&>div>span]:size-1"
/>
);
}
diff --git a/app/src/features/conversations/aui/ChatConversationMap.test.tsx b/app/src/features/conversations/aui/ChatConversationMap.test.tsx
index 8a2ff9d743..a265806b79 100644
--- a/app/src/features/conversations/aui/ChatConversationMap.test.tsx
+++ b/app/src/features/conversations/aui/ChatConversationMap.test.tsx
@@ -1,6 +1,6 @@
/**
- * The conversation map: `Cmd`/`Ctrl+F` find-in-conversation and a timeline
- * outline of the thread's user turns, both scoped to the live `/chat`
+ * The conversation map: `Cmd`/`Ctrl+F` find-in-conversation and assistant-ui's
+ * persistent turn rail, both scoped to the live `/chat`
* surface (mounted through `AssistantUiChat`, the same way `ChatSources.test.tsx`
* proves its own wiring) rather than fed a hand-built `messages` prop.
*/
@@ -103,19 +103,27 @@ describe('ChatConversationMap', () => {
expect(screen.getByText('It runs nightly at 2am UTC.')).toBeTruthy();
});
- it("opens the timeline outline and lists the thread's user turns", async () => {
+ it("renders assistant-ui's conversation map instead of the Timeline button", async () => {
renderChat([
userMessage('u1', 'First question', '2026-01-01T00:00:00.000Z'),
agentMessage('a1', 'First answer', '2026-01-01T00:00:05.000Z'),
+ agentMessage('a1b', 'More detail', '2026-01-01T00:00:06.000Z'),
userMessage('u2', 'Second question', '2026-01-01T00:05:00.000Z'),
]);
await waitFor(() => expect(screen.getByText('First answer')).toBeTruthy());
- await userEvent.click(screen.getByTestId('chat-conversation-timeline-toggle'));
-
- const timeline = screen.getByTestId('chat-conversation-timeline');
- expect(timeline.textContent).toContain('First question');
- expect(timeline.textContent).toContain('Second question');
+ expect(screen.queryByTestId('chat-conversation-timeline-toggle')).toBeNull();
+ expect(document.querySelector('[data-slot="conversation-map"]')).toBeTruthy();
+ expect(document.querySelector('[data-slot="conversation-map-rail"] > div')).toHaveClass(
+ 'right-0'
+ );
+ expect(screen.getByRole('button', { name: 'First question' })).toHaveClass('justify-end');
+ expect(screen.getByRole('button', { name: 'First question' })).toBeTruthy();
+ expect(screen.getByRole('button', { name: 'Second question' })).toBeTruthy();
+
+ await userEvent.hover(screen.getByRole('button', { name: 'First question' }));
+ expect(await screen.findByText('First answer More detail')).toBeTruthy();
+ expect(document.querySelector('[data-side="left"]')).toBeTruthy();
});
it('opens the find bar on Ctrl+F and reports a match count', async () => {
diff --git a/app/src/features/conversations/aui/ChatConversationMap.tsx b/app/src/features/conversations/aui/ChatConversationMap.tsx
index b5289f51db..e3ebdfc193 100644
--- a/app/src/features/conversations/aui/ChatConversationMap.tsx
+++ b/app/src/features/conversations/aui/ChatConversationMap.tsx
@@ -1,11 +1,8 @@
/**
* The conversation map for one thread: a `Cmd`/`Ctrl+F` find-in-conversation
- * bar (the vendored `conversation-search` element) and an outline popover of
- * the thread's user turns (the vendored `timeline` element), both scoped to
- * this thread's own messages — no upstream assistant-ui element covers
- * either, so both are driven entirely from `useAuiState(state =>
- * state.thread.messages)`, the same read-only projection every other adapter
- * in this app uses. Nothing here writes to Redux or the core.
+ * bar (the vendored `conversation-search` element), scoped to this thread's
+ * messages. The persistent turn rail is assistant-ui's upstream
+ * `ConversationMapAui`, mounted inside `thread.tsx`'s scrolling viewport.
*
* Wraps `<Thread />` rather than reaching into `thread.tsx`: the shortcut and
* the popover are chrome around the transcript, not a slot the message tree
@@ -18,12 +15,10 @@ import {
ConversationSearch,
type SearchHit,
} from '../../../components/assistant-ui/elements/conversation-search';
-import { Timeline, type TimelineEvent } from '../../../components/assistant-ui/elements/timeline';
import { useT } from '../../../lib/i18n/I18nContext';
const VIEWPORT_SELECTOR = '[data-slot="aui_thread-viewport"]';
const CONTEXT_CHARS = 24;
-const MAX_TIMELINE_EVENTS = 50;
function messageText(message: AssistantState['thread']['messages'][number]): string {
return message.content.flatMap(part => (part.type === 'text' ? [part.text] : [])).join('\n');
@@ -68,35 +63,6 @@ function scrollToMessage(messageId: string, viewport: HTMLElement | null) {
element?.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
-function formatTime(iso: string): string {
- const date = new Date(iso);
- if (Number.isNaN(date.getTime())) return '';
- return date.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' });
-}
-
-function buildTimelineEvents(messages: readonly AssistantState['thread']['messages'][number][]): {
- events: TimelineEvent[];
- messageIdByEventId: Map<string, string>;
-} {
- const userMessages = messages
- .filter(message => message.role === 'user')
- .slice(-MAX_TIMELINE_EVENTS);
- const messageIdByEventId = new Map<string, string>();
- const events = userMessages.map((message, index): TimelineEvent => {
- const eventId = `turn:${message.id}`;
- messageIdByEventId.set(eventId, message.id);
- const text = messageText(message).trim();
- const isLast = index === userMessages.length - 1;
- return {
- id: eventId,
- when: isLast ? 'now' : 'past',
- time: message.createdAt ? formatTime(new Date(message.createdAt).toISOString()) : '',
- title: text.length > 0 ? text.slice(0, 80) : '',
- };
- });
- return { events, messageIdByEventId };
-}
-
/** `Cmd+F` on macOS, `Ctrl+F` elsewhere. Only while focus is inside `container`. */
function useFindShortcut(container: HTMLDivElement | null, onTrigger: () => void) {
useEffect(() => {
@@ -122,7 +88,6 @@ export function ChatConversationMap({ children }: { children: ReactNode }) {
const [searchOpen, setSearchOpen] = useState(false);
const [query, setQuery] = useState('');
const [activeIndex, setActiveIndex] = useState(0);
- const [timelineOpen, setTimelineOpen] = useState(false);
const setContainerRef = useCallback((el: HTMLDivElement | null) => {
containerRef.current = el;
@@ -132,7 +97,6 @@ export function ChatConversationMap({ children }: { children: ReactNode }) {
const viewport = containerEl?.querySelector<HTMLElement>(VIEWPORT_SELECTOR) ?? null;
const hits = useMemo(() => buildHits(messages, query, viewport), [messages, query, viewport]);
- const { events, messageIdByEventId } = useMemo(() => buildTimelineEvents(messages), [messages]);
useFindShortcut(containerEl, () => setSearchOpen(true));
@@ -159,15 +123,6 @@ export function ChatConversationMap({ children }: { children: ReactNode }) {
[hits.length]
);
- const onTimelineClick = useCallback(
- (eventId: string) => {
- const messageId = messageIdByEventId.get(eventId);
- if (messageId) scrollToMessage(messageId, viewport);
- setTimelineOpen(false);
- },
- [messageIdByEventId, viewport]
- );
-
return (
<div
ref={setContainerRef}
@@ -178,7 +133,7 @@ export function ChatConversationMap({ children }: { children: ReactNode }) {
tabIndex={-1}
className="relative flex h-full min-h-0 w-full flex-col outline-none"
data-testid="chat-conversation-map">
- {(searchOpen || timelineOpen) && (
+ {searchOpen && (
<div className="absolute inset-x-0 top-2 z-20 flex justify-center px-2">
{searchOpen && (
<ConversationSearch
@@ -193,38 +148,9 @@ export function ChatConversationMap({ children }: { children: ReactNode }) {
nextMatchLabel={t('conversations.conversationSearch.nextMatch')}
/>
)}
- {timelineOpen && (
- <div data-testid="chat-conversation-timeline" className="ms-2">
- <Timeline
- events={events}
- visibleCount={events.length}
- onClick={event => {
- // Each event renders as one direct child of the `Timeline`
- // root (`data-slot="timeline"`), in `events` order — there is
- // no per-row id in the vendored markup to select on, so the
- // clicked row's position among its siblings is the row's
- // index into `events`.
- const root = event.currentTarget;
- const index = Array.from(root.children).findIndex(child =>
- child.contains(event.target as Node)
- );
- const clicked = index >= 0 ? events[index] : undefined;
- if (clicked) onTimelineClick(clicked.id);
- }}
- />
- </div>
- )}
</div>
)}
{children}
- <button
- type="button"
- data-testid="chat-conversation-timeline-toggle"
- aria-label={t('conversations.conversationSearch.timelineToggle')}
- onClick={() => setTimelineOpen(open => !open)}
- className="absolute end-2 top-2 z-20 rounded-full border border-border/60 bg-background px-2 py-1 text-xs text-content-muted hover:text-content-secondary">
- {t('conversations.conversationSearch.timelineToggle')}
- </button>
</div>
);
}
diff --git a/app/src/features/conversations/aui/ChatSettingsPanel.test.tsx b/app/src/features/conversations/aui/ChatSettingsPanel.test.tsx
new file mode 100644
index 0000000000..0afc8cf1d9
--- /dev/null
+++ b/app/src/features/conversations/aui/ChatSettingsPanel.test.tsx
@@ -0,0 +1,43 @@
+import { fireEvent, render, screen } from '@testing-library/react';
+import { describe, expect, it, vi } from 'vitest';
+
+import { ChatSettingsPanel } from './ChatSettingsPanel';
+
+vi.mock('../../../lib/i18n/I18nContext', () => ({ useT: () => ({ t: (key: string) => key }) }));
+
+vi.mock('../../../components/chat/ModelQualityPill', async importOriginal => {
+ const actual = await importOriginal<typeof import('../../../components/chat/ModelQualityPill')>();
+ return { ...actual, useModelPickerProviders: () => ({ providers: [], loading: false }) };
+});
+
+vi.mock('../../../components/settings/panels/ai/ProviderModelPickerDialog', () => ({
+ ProviderModelPickerDialog: ({
+ onSelect,
+ }: {
+ onSelect: (selection: { source: { kind: 'managed' }; model: string }) => void;
+ }) => (
+ <div data-testid="provider-model-picker-dialog">
+ <button
+ type="button"
+ onClick={() =>
+ onSelect({ source: { kind: 'managed' }, model: 'openrouter/openai/gpt-test' })
+ }>
+ Pick model
+ </button>
+ </div>
+ ),
+}));
+
+describe('ChatSettingsPanel', () => {
+ it('opens the custom provider/model modal directly from the composer trigger', () => {
+ const onModelChange = vi.fn();
+ render(<ChatSettingsPanel model={null} onModelChange={onModelChange} />);
+
+ fireEvent.click(screen.getByTestId('composer-chat-settings'));
+ expect(screen.getByTestId('provider-model-picker-dialog')).toBeInTheDocument();
+ expect(screen.queryByText('composer.settings.chooseModel')).not.toBeInTheDocument();
+
+ fireEvent.click(screen.getByRole('button', { name: 'Pick model' }));
+ expect(onModelChange).toHaveBeenCalledWith('openrouter/openai/gpt-test', undefined);
+ });
+});
diff --git a/app/src/features/conversations/aui/ChatSettingsPanel.tsx b/app/src/features/conversations/aui/ChatSettingsPanel.tsx
index bf4d59b396..2c175a6c1c 100644
--- a/app/src/features/conversations/aui/ChatSettingsPanel.tsx
+++ b/app/src/features/conversations/aui/ChatSettingsPanel.tsx
@@ -1,26 +1,11 @@
/**
- * The composer's chat-settings control: a trigger naming the active model,
- * with assistant-ui's settings-panel element in a popover behind it.
- *
- * Only settings a core config RPC persists are rendered:
- * - model — the composer route (`onModelChange`, which `Conversations`
- * persists as `default_model` via `inference_update_model_settings`). The
- * segmented row offers the managed default ("OpenHuman", clears the pin) and
- * the current pick; any other model comes from the shared provider/model
- * picker, whose sources load through `loadAISettings` exactly as the old
- * composer pill's did (`useModelPickerProviders`).
- * - temperature — `config.default_temperature`, read from `config_get` when
- * the popover opens and written through `inference_update_model_settings`.
- * Hidden when the read fails (no core), rather than shown as a dead slider.
- *
- * The element's system-prompt field is never passed: no core config RPC
- * stores a chat system prompt, so the section stays omitted.
+ * The composer's model trigger, backed directly by OpenHuman's shared custom
+ * provider/model picker. The compact trigger stays in the composer; clicking
+ * it opens the same modal UI used elsewhere instead of an intermediate
+ * assistant-ui settings popover.
*/
-import { SettingsPanel } from '@/components/assistant-ui/elements/settings-panel';
-import { Popover, PopoverContent, PopoverTrigger } from '@/components/assistant-ui/ui/popover';
-import debug from 'debug';
import { ChevronDownIcon } from 'lucide-react';
-import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
+import { useMemo, useState } from 'react';
import {
displayValue,
@@ -30,20 +15,7 @@ import {
useModelPickerProviders,
} from '../../../components/chat/ModelQualityPill';
import { ProviderModelPickerDialog } from '../../../components/settings/panels/ai/ProviderModelPickerDialog';
-import { Button } from '../../../components/ui';
import { useT } from '../../../lib/i18n/I18nContext';
-import {
- openhumanGetConfig,
- openhumanUpdateModelSettings,
-} from '../../../utils/tauriCommands/config';
-
-const log = debug('openhuman:chat:settings-panel');
-
-/** Label of the managed default — the same one the pill showed for no pin. */
-const MANAGED_LABEL = displayValue(null);
-
-/** A slider drag emits a value per step; persist only once it settles. */
-const TEMPERATURE_SAVE_DELAY_MS = 400;
export function ChatSettingsPanel({
model,
@@ -55,127 +27,37 @@ export function ChatSettingsPanel({
}) {
const { t } = useT();
const [open, setOpen] = useState(false);
- const [pickerOpen, setPickerOpen] = useState(false);
- const { providers, loading } = useModelPickerProviders(pickerOpen);
- const [temperature, setTemperature] = useState<number | undefined>(undefined);
- const saveTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
-
- const current = displayValue(model);
- const models = useMemo(
- () => (current === MANAGED_LABEL ? [MANAGED_LABEL] : [MANAGED_LABEL, current]),
- [current]
- );
+ const { providers, loading } = useModelPickerProviders(open);
const initialSelection = useMemo(() => selectionFromValue(model), [model]);
- useEffect(
- () => () => {
- if (saveTimer.current) clearTimeout(saveTimer.current);
- },
- []
- );
-
- const loadTemperature = useCallback(() => {
- log('config_get start');
- openhumanGetConfig().then(
- response => {
- const value = response.result.config.default_temperature;
- log('config_get ok has_temperature=%s', typeof value === 'number');
- setTemperature(typeof value === 'number' ? value : undefined);
- },
- (error: unknown) => {
- log('config_get failed, hiding temperature: %O', error);
- setTemperature(undefined);
- }
- );
- }, []);
-
- const handleOpenChange = useCallback(
- (next: boolean) => {
- setOpen(next);
- if (next) loadTemperature();
- },
- [loadTemperature]
- );
-
- const handleTemperatureChange = useCallback((next: number) => {
- setTemperature(next);
- if (saveTimer.current) clearTimeout(saveTimer.current);
- saveTimer.current = setTimeout(() => {
- saveTimer.current = null;
- openhumanUpdateModelSettings({ default_temperature: next }).then(
- () => log('default_temperature persisted'),
- (error: unknown) => log('default_temperature persist failed: %O', error)
- );
- }, TEMPERATURE_SAVE_DELAY_MS);
- }, []);
-
- const handleModelChange = useCallback(
- (label: string) => {
- // The current pick is already applied; only the managed default changes
- // anything from the segmented row.
- if (label === MANAGED_LABEL && label !== current) onModelChange?.(null);
- },
- [current, onModelChange]
- );
-
- const openPicker = useCallback(() => {
- setOpen(false);
- setPickerOpen(true);
- }, []);
-
return (
<>
- <Popover open={open} onOpenChange={handleOpenChange}>
- <PopoverTrigger
- data-testid="composer-chat-settings"
- data-analytics-id="chat-settings-panel"
- aria-label={t('composer.modelSelector')}
- title={t('composer.modelSelector')}
- className="flex h-7 min-w-0 items-center rounded-md px-2 text-xs text-content-muted transition-colors hover:bg-surface-hover hover:text-content">
- <span className="min-w-0 truncate font-medium">
- {loading ? t('composer.settings.loadingModels') : current}
- </span>
- <ChevronDownIcon className="ml-1 size-3.5 shrink-0 opacity-50" aria-hidden />
- </PopoverTrigger>
- <PopoverContent
- side="top"
- align="start"
- className="w-auto bg-transparent p-0 shadow-none ring-0">
- <SettingsPanel
- className="w-80"
- model={current}
- models={models}
- onModelChange={onModelChange ? handleModelChange : undefined}
- temperature={temperature}
- onTemperatureChange={handleTemperatureChange}
- modelLabel={t('composer.settings.model')}
- temperatureLabel={t('composer.settings.temperature')}
- temperatureAriaLabel={t('composer.settings.temperature')}
- />
- {onModelChange && (
- <Button
- type="button"
- variant="tertiary"
- size="xs"
- analyticsId="chat-settings-choose-model"
- className="self-start"
- onClick={openPicker}>
- {t('composer.settings.chooseModel')}
- </Button>
- )}
- </PopoverContent>
- </Popover>
- {pickerOpen && !loading && (
+ <button
+ type="button"
+ data-testid="composer-chat-settings"
+ data-analytics-id="chat-settings-panel"
+ aria-label={t('composer.modelSelector')}
+ title={t('composer.modelSelector')}
+ disabled={!onModelChange || loading}
+ onClick={() => setOpen(true)}
+ className="flex h-7 min-w-0 items-center rounded-md px-2 text-xs text-content-muted transition-colors hover:bg-surface-hover hover:text-content disabled:opacity-50">
+ <span className="min-w-0 truncate font-medium">
+ {loading ? t('composer.settings.loadingModels') : displayValue(model)}
+ </span>
+ <ChevronDownIcon className="ml-1 size-3.5 shrink-0 opacity-50" aria-hidden />
+ </button>
+
+ {open && !loading && (
<ProviderModelPickerDialog
cloudProviders={providers}
localModels={NO_LOCAL_MODELS}
ollamaRunning={false}
claudeCodeEnabled={false}
initial={initialSelection}
- onClose={() => setPickerOpen(false)}
+ onClose={() => setOpen(false)}
onSelect={selection => {
onModelChange?.(selectionValue(selection), selection.contextWindow);
- setPickerOpen(false);
+ setOpen(false);
}}
/>
)}
diff --git a/app/src/features/conversations/aui/ContextUsage.test.tsx b/app/src/features/conversations/aui/ContextUsage.test.tsx
index 24eb34e9ea..fc13daa440 100644
--- a/app/src/features/conversations/aui/ContextUsage.test.tsx
+++ b/app/src/features/conversations/aui/ContextUsage.test.tsx
@@ -28,11 +28,18 @@ const BREAKDOWN = {
function renderUsage(
props: { threadId?: string | null; modelContextWindow?: number | null } = {},
- usage: { lastTurnInputTokens: number; lastTurnOutputTokens: number; contextWindow: number } = {
- lastTurnInputTokens: 40_000,
- lastTurnOutputTokens: 10_000,
- contextWindow: 200_000,
- }
+ usage: {
+ lastTurnInputTokens: number;
+ lastTurnOutputTokens: number;
+ contextWindow: number;
+ subAgents?: Array<{
+ agentId: string;
+ inputTokens: number;
+ outputTokens: number;
+ costUsd: number;
+ runs: number;
+ }>;
+ } = { lastTurnInputTokens: 40_000, lastTurnOutputTokens: 10_000, contextWindow: 200_000 }
) {
const store = configureStore({ reducer: combineReducers({ chatRuntime: chatRuntimeReducer }) });
store.dispatch(
@@ -92,17 +99,45 @@ describe('ContextUsage', () => {
params: { thread_id: 't1' },
});
const popover = await screen.findByTestId('composer-token-breakdown');
- await waitFor(() => expect(popover).toHaveTextContent('Tools'));
- expect(popover).toHaveTextContent('Conversation history');
+ await waitFor(() => expect(popover).toHaveTextContent('Tool schemas'));
+ expect(popover).not.toHaveTextContent('Tool usage');
+ expect(popover).not.toHaveTextContent('Thinking tokens');
+ expect(popover).toHaveTextContent('Output');
+ expect(popover).toHaveTextContent('Your input');
expect(popover).toHaveTextContent('System prompt');
- // A prompt heading is shown without its markdown hashes.
- expect(popover).toHaveTextContent('Identity');
+ // Individual system-prompt headings are folded into one stable bucket.
+ expect(popover).not.toHaveTextContent('Identity');
expect(popover).not.toHaveTextContent('## Identity');
+ expect(popover).toHaveTextContent('Cache hit');
+ expect(popover).toHaveTextContent('33%');
+ expect(popover).toHaveTextContent('Estimated cost this session (USD)');
+ expect(popover).toHaveTextContent('$0.4200');
expect(popover).toHaveTextContent('Headroom');
expect(popover).toHaveTextContent('Context window');
expect(popover).not.toHaveTextContent('conversations.composer');
- // The core's window wins inside the breakdown.
- expect(popover).toHaveTextContent('7,300 / 100,000');
+ // The core's window wins; the buckets use the latest turn's actual usage.
+ expect(popover).toHaveTextContent('50,000 / 100,000');
+ });
+
+ it('includes sub-agent token and cost totals inside the same breakdown card', async () => {
+ mockCall.mockResolvedValue(BREAKDOWN);
+ renderUsage(
+ {},
+ {
+ lastTurnInputTokens: 40_000,
+ lastTurnOutputTokens: 10_000,
+ contextWindow: 200_000,
+ subAgents: [
+ { agentId: 'researcher', inputTokens: 2_500, outputTokens: 500, costUsd: 0.05, runs: 1 },
+ ],
+ }
+ );
+
+ await userEvent.click(screen.getByTestId('composer-context-usage'));
+ const breakdown = await screen.findByTestId('composer-token-breakdown');
+ await waitFor(() => expect(breakdown).toHaveTextContent('researcher'));
+ expect(breakdown).toHaveTextContent('3,000 · $0.0500');
+ expect(breakdown.querySelectorAll('[data-slot="context-breakdown"]')).toHaveLength(1);
});
it('shows an error state instead of crashing when the method is missing, and retries', async () => {
@@ -118,7 +153,7 @@ describe('ContextUsage', () => {
mockCall.mockResolvedValueOnce(BREAKDOWN);
await userEvent.click(screen.getByRole('button', { name: 'Try again' }));
- await waitFor(() => expect(popover).toHaveTextContent('Tools'));
+ await waitFor(() => expect(popover).toHaveTextContent('Tool schemas'));
expect(mockCall).toHaveBeenCalledTimes(2);
});
@@ -138,18 +173,26 @@ describe('ContextUsage', () => {
await userEvent.click(trigger);
await userEvent.click(trigger);
const popover = await screen.findByTestId('composer-token-breakdown');
- await waitFor(() => expect(popover).toHaveTextContent('Tools'));
+ await waitFor(() => expect(popover).toHaveTextContent('Tool schemas'));
expect(mockCall).toHaveBeenCalledTimes(2);
await act(async () => failFirst(new Error('late failure')));
- expect(popover).toHaveTextContent('Tools');
+ expect(popover).toHaveTextContent('Tool schemas');
expect(popover).not.toHaveTextContent('Context breakdown unavailable');
});
});
describe('contextBreakdownSegments', () => {
- const t = (key: string) => key.split('.').pop() ?? key;
+ const t = (key: string) =>
+ ({
+ 'conversations.composer.context.section.preamble': 'System prompt',
+ 'conversations.composer.context.section.tools': 'Tools',
+ 'conversations.composer.context.section.history': 'Conversation history',
+ 'conversations.composer.context.section.toolSchemas': 'Tool schemas',
+ 'conversations.composer.context.section.yourInput': 'Your input',
+ 'conversations.composer.context.output': 'Output',
+ })[key] ?? key;
it('folds repeated headings into one row and drops empty sections', () => {
const segments = contextBreakdownSegments(
@@ -167,8 +210,10 @@ describe('contextBreakdownSegments', () => {
);
expect(segments.map(s => [s.label, s.tokens])).toEqual([
- ['Rules', 30],
- ['tools', 100],
+ ['System prompt', 30],
+ ['Tool schemas', 100],
+ ['Output', 0],
+ ['Your input', 0],
]);
});
});
diff --git a/app/src/features/conversations/aui/ContextUsage.tsx b/app/src/features/conversations/aui/ContextUsage.tsx
index a5bc06359c..b49c84d52e 100644
--- a/app/src/features/conversations/aui/ContextUsage.tsx
+++ b/app/src/features/conversations/aui/ContextUsage.tsx
@@ -29,7 +29,7 @@ import {
type TokenUsage,
} from '@/components/assistant-ui/elements/context-display';
import { ErrorState } from '@/components/assistant-ui/elements/error-state';
-import { mono, paper, ShimmerLabel } from '@/components/assistant-ui/elements/surfaces';
+import { paper, ShimmerLabel } from '@/components/assistant-ui/elements/surfaces';
import { cn } from '@/components/assistant-ui/lib/utils';
import { Popover, PopoverContent, PopoverTrigger } from '@/components/assistant-ui/ui/popover';
import debug from 'debug';
@@ -52,50 +52,6 @@ const EMPTY_USAGE = emptySessionTokenUsage();
const formatUsd = (usd: number): string => (usd >= 1 ? `$${usd.toFixed(2)}` : `$${usd.toFixed(4)}`);
-/**
- * Turn cost + per-sub-agent spend, appended under the vendored
- * `ContextBreakdown` card rather than inside it (that element has no cost
- * field of its own — see the fe-brief's WS-F note). Reuses its own `mono`
- * token so the figures read as part of the same card rather than a
- * bespoke widget; hidden entirely once there is no spend to show.
- */
-function CostFooter({ usage, t }: { usage: SessionTokenUsage; t: (key: string) => string }) {
- if (usage.costUsd <= 0) return null;
- const subAgents = Object.values(usage.subAgents).filter(sub => sub.costUsd > 0);
- return (
- <div className={cn(paper, 'flex w-full max-w-sm flex-col gap-1.5 rounded-2xl p-4')}>
- <div className="flex items-baseline justify-between">
- <span className="text-foreground/70 text-[13px]">
- {t('conversations.composer.context.turnCost')}
- </span>
- <span className={cn(mono, 'text-foreground/70 tabular-nums')}>
- {formatUsd(usage.costUsd)}
- </span>
- </div>
- {subAgents.map(sub => (
- <div key={sub.agentId} className="flex items-baseline justify-between">
- <span className="text-foreground/45 truncate text-[12px]">
- {t('conversations.composer.context.subagentCost').replace('{agent}', sub.agentId)}
- </span>
- <span className={cn(mono, 'text-foreground/45 shrink-0 tabular-nums')}>
- {formatUsd(sub.costUsd)}
- </span>
- </div>
- ))}
- </div>
- );
-}
-
-/** Section labels the core emits verbatim; everything else is a prompt heading. */
-const KNOWN_SECTIONS: Record<string, { key: string; tint: string }> = {
- '(preamble)': { key: 'conversations.composer.context.section.preamble', tint: 'bg-blue-500' },
- tools: { key: 'conversations.composer.context.section.tools', tint: 'bg-violet-500' },
- history: { key: 'conversations.composer.context.section.history', tint: 'bg-amber-500' },
-};
-
-/** Prompt headings share the system prompt's hue, stepped so neighbours differ. */
-const PROMPT_TINTS = ['bg-blue-400', 'bg-blue-600', 'bg-blue-300', 'bg-blue-700'];
-
type BreakdownState =
| { status: 'idle' }
| { status: 'loading' }
@@ -104,30 +60,57 @@ type BreakdownState =
/**
* Map the core's sections onto the element's segments: translate the fixed
- * labels, strip markdown hashes off prompt headings, fold duplicate headings
- * into one row (the element keys rows by label) and drop empty ones.
+ * labels, group every rendered prompt heading into one System prompt bucket,
+ * fold duplicate buckets into one row and drop empty sections.
*/
export function contextBreakdownSegments(
data: ContextBreakdownData,
- t: (key: string) => string
+ t: (key: string) => string,
+ usage: Pick<SessionTokenUsage, 'lastTurnInputTokens' | 'lastTurnOutputTokens'> = EMPTY_USAGE
): readonly ContextSegment[] {
- const byLabel = new Map<string, ContextSegment>();
- let promptIndex = 0;
+ let systemPrompt = 0;
+ let toolSchemas = 0;
+ let hiddenToolUsage = 0;
for (const section of data.sections) {
if (section.est_tokens <= 0) continue;
- const known = KNOWN_SECTIONS[section.label];
- const label = known
- ? t(known.key)
- : section.label.replace(/^#+\s*/, '').trim() || section.label;
- const existing = byLabel.get(label);
- if (existing) {
- existing.tokens += section.est_tokens;
- continue;
+ const label = section.label.toLowerCase();
+ if (label === 'tools' || label === 'tool_schemas' || label === 'tool schemas') {
+ toolSchemas += section.est_tokens;
+ } else if (label === 'tool_usage' || label === 'tool usage' || label === 'tool results') {
+ hiddenToolUsage += section.est_tokens;
+ } else if (label === 'thinking' || label === 'reasoning') {
+ // Provider output currently folds these tokens into its output total.
+ // Hide the separate row until the usage wire reports it independently.
+ } else if (label !== 'history' && label !== 'input' && label !== 'output') {
+ systemPrompt += section.est_tokens;
}
- const tint = known?.tint ?? PROMPT_TINTS[promptIndex++ % PROMPT_TINTS.length];
- byLabel.set(label, { label, tokens: section.est_tokens, tint });
}
- return [...byLabel.values()];
+ const yourInput = Math.max(
+ 0,
+ usage.lastTurnInputTokens - systemPrompt - toolSchemas - hiddenToolUsage
+ );
+ return [
+ {
+ label: t('conversations.composer.context.section.preamble'),
+ tokens: systemPrompt,
+ tint: 'bg-blue-500',
+ },
+ {
+ label: t('conversations.composer.context.section.toolSchemas'),
+ tokens: toolSchemas,
+ tint: 'bg-violet-500',
+ },
+ {
+ label: t('conversations.composer.context.output'),
+ tokens: usage.lastTurnOutputTokens,
+ tint: 'bg-emerald-500',
+ },
+ {
+ label: t('conversations.composer.context.section.yourInput'),
+ tokens: yourInput,
+ tint: 'bg-amber-500',
+ },
+ ];
}
export function ContextUsage({
@@ -204,24 +187,36 @@ export function ContextUsage({
let body;
if (breakdown.status === 'ready') {
const limit = breakdown.data.context_window > 0 ? breakdown.data.context_window : contextWindow;
+ const cacheHit =
+ usage.inputTokens > 0
+ ? Math.min(100, Math.round((usage.cachedTokens / usage.inputTokens) * 100))
+ : 0;
+ const stats = [
+ { label: t('token.popCacheHit'), value: `${cacheHit}%` },
+ { label: t('token.costTitle'), value: formatUsd(usage.costUsd) },
+ ...Object.values(usage.subAgents).map(sub => ({
+ label: t('conversations.composer.context.subagentCost').replace('{agent}', sub.agentId),
+ value: `${(sub.inputTokens + sub.outputTokens).toLocaleString('en-US')} · ${formatUsd(
+ sub.costUsd
+ )}`,
+ })),
+ ];
body = (
- <div className="flex flex-col gap-2">
- <ContextBreakdown
- segments={contextBreakdownSegments(breakdown.data, t)}
- limit={limit}
- title={t('conversations.composer.context.title')}
- headroomLabel={t('conversations.composer.context.headroom')}
- meterLabel={label =>
- t('conversations.composer.context.meterLabel').replace('{label}', label)
- }
- meterValueText={(used, max) =>
- t('conversations.composer.context.meterValue')
- .replace('{used}', used)
- .replace('{limit}', max)
- }
- />
- <CostFooter usage={usage} t={t} />
- </div>
+ <ContextBreakdown
+ segments={contextBreakdownSegments(breakdown.data, t, usage)}
+ limit={limit}
+ title={t('conversations.composer.context.title')}
+ headroomLabel={t('conversations.composer.context.headroom')}
+ stats={stats}
+ meterLabel={label =>
+ t('conversations.composer.context.meterLabel').replace('{label}', label)
+ }
+ meterValueText={(used, max) =>
+ t('conversations.composer.context.meterValue')
+ .replace('{used}', used)
+ .replace('{limit}', max)
+ }
+ />
);
} else if (breakdown.status === 'error') {
body = (
diff --git a/app/src/features/conversations/components/AssistantUiChat.slots.test.tsx b/app/src/features/conversations/components/AssistantUiChat.slots.test.tsx
index b25c25733b..79781c7368 100644
--- a/app/src/features/conversations/components/AssistantUiChat.slots.test.tsx
+++ b/app/src/features/conversations/components/AssistantUiChat.slots.test.tsx
@@ -109,6 +109,11 @@ describe('assistant-ui composer slots', () => {
);
const button = screen.getByTestId('composer-human-mode');
+ const icon = screen.getByTestId('composer-human-mascot-icon');
+ expect(icon).toHaveAttribute('width', '24');
+ expect(icon).toHaveAttribute('height', '24');
+ expect(icon.tagName).toBe('IMG');
+ expect(icon.getAttribute('src')).toMatch(/^data:image\/png;base64,/);
rerender(<Provider store={store}>{chat(() => navigate('/human'))}</Provider>);
diff --git a/app/src/features/conversations/components/AssistantUiChat.tsx b/app/src/features/conversations/components/AssistantUiChat.tsx
index f68ffb1dfc..2e1f9ce52f 100644
--- a/app/src/features/conversations/components/AssistantUiChat.tsx
+++ b/app/src/features/conversations/components/AssistantUiChat.tsx
@@ -1,16 +1,16 @@
+import { ConversationMapAui } from '@/components/assistant-ui/elements/conversation-map.aui';
import { Thread, type ThreadComponents } from '@/components/assistant-ui/thread';
import { type AssistantState, useAui, useAuiState } from '@assistant-ui/react';
import { PlusIcon } from 'lucide-react';
import { type ReactNode, startTransition, useCallback, useEffect, useMemo, useRef } from 'react';
+import { COMPOSER_HUMAN_MASCOT_DATA_URL } from '../../../assets/composerHumanMascot';
import AttachmentPreview from '../../../components/chat/AttachmentPreview';
import { Button } from '../../../components/ui';
import type { Attachment } from '../../../lib/attachments';
import { useT } from '../../../lib/i18n/I18nContext';
import { AssistantUiRuntimeProvider } from '../../../providers/AssistantUiRuntimeProvider';
import { useAppSelector } from '../../../store/hooks';
-import { DEFAULT_MASCOT_COLOR } from '../../../store/mascotSlice';
-import { MascotChipAvatar } from '../../human/Mascot/MascotChipAvatar';
import { AgentRunningStatus } from '../aui/AgentRunningStatus';
import { ChatConversationMap } from '../aui/ChatConversationMap';
import { ComposerTriggers } from '../aui/ComposerTriggers';
@@ -20,6 +20,24 @@ import { ChatToolFallback } from './ChatToolParts';
const selectComposerText = (state: AssistantState) => state.composer.text;
+/** Keep the map on the former Timeline button's edge, with previews opening inward. */
+const ChatConversationMapRail = () => <ConversationMapAui side="right" />;
+
+/** Fixed Human-mode portrait supplied for the empty composer's primary action. */
+function ComposerHumanMascotIcon() {
+ return (
+ <img
+ data-testid="composer-human-mascot-icon"
+ width="24"
+ height="24"
+ src={COMPOSER_HUMAN_MASCOT_DATA_URL}
+ alt=""
+ className="rounded-full object-cover"
+ aria-hidden="true"
+ />
+ );
+}
+
/**
* Keep the host's draft (`inputValue`) and assistant-ui's composer text in step.
*
@@ -146,8 +164,6 @@ export function AssistantUiChat({
// `selectCustomPrimaryColor`: this component is mounted by suites that build
// a partial store, and those selectors dereference `state.mascot` unguarded,
// so a store without the slice crashes the whole chat surface on render.
- const mascotColor = useAppSelector(state => state.mascot?.color ?? DEFAULT_MASCOT_COLOR);
- const mascotCustomPrimary = useAppSelector(state => state.mascot?.customPrimaryColor ?? null);
const selectedThreadId = useAppSelector(state => state.thread.selectedThreadId);
const loadError = useAppSelector(state => state.thread.messagesError);
@@ -163,8 +179,6 @@ export function AssistantUiChat({
attachments,
attachmentInteractionBlocked,
maxAttachments,
- mascotColor,
- mascotCustomPrimary,
modelContextWindow,
onAttachFiles,
onOpenHumanMode,
@@ -175,8 +189,6 @@ export function AssistantUiChat({
attachments,
attachmentInteractionBlocked,
maxAttachments,
- mascotColor,
- mascotCustomPrimary,
modelContextWindow,
onAttachFiles,
onOpenHumanMode,
@@ -188,14 +200,10 @@ export function AssistantUiChat({
// row on every host render.
const composerFooterExtrasRef = useRef(composerFooterExtras);
composerFooterExtrasRef.current = composerFooterExtras;
- const ComposerExtras = useCallback(() => {
+ const ComposerExtras = useCallback(() => <>{composerFooterExtrasRef.current}</>, []);
+ const ComposerRightExtras = useCallback(() => {
const { modelContextWindow, selectedThreadId } = slotPropsRef.current;
- return (
- <>
- <ContextUsage threadId={selectedThreadId} modelContextWindow={modelContextWindow} />
- {composerFooterExtrasRef.current}
- </>
- );
+ return <ContextUsage threadId={selectedThreadId} modelContextWindow={modelContextWindow} />;
}, []);
// Stable component identity, latest node read through a ref.
//
@@ -267,7 +275,7 @@ export function AssistantUiChat({
* rather than filling it edge to edge.
*/
const ComposerIdleAction = useCallback(() => {
- const { mascotColor, mascotCustomPrimary, onOpenHumanMode } = slotPropsRef.current;
+ const { onOpenHumanMode } = slotPropsRef.current;
return onOpenHumanMode ? (
<Button
type="button"
@@ -280,7 +288,7 @@ export function AssistantUiChat({
title={t('composer.humanMode')}
className="size-7 shrink-0 rounded-full p-0"
onClick={onOpenHumanMode}>
- <MascotChipAvatar color={mascotColor} customPrimary={mascotCustomPrimary} size={18} />
+ <ComposerHumanMascotIcon />
</Button>
) : null;
}, [t]);
@@ -298,7 +306,9 @@ export function AssistantUiChat({
// `/` commands (builtins + core `commands_list` + registry actions) and
// `@` mentions (memory recall, thread files); see `aui/ComposerTriggers`.
ComposerTriggers,
+ ConversationMap: ChatConversationMapRail,
ComposerExtras,
+ ComposerRightExtras,
ComposerHeader,
ComposerIdleAction,
// Phase / reasoning round / active tool for the turn in flight. Reads the
@@ -329,6 +339,7 @@ export function AssistantUiChat({
ComposerAddAttachment,
ComposerAttachments,
ComposerExtras,
+ ComposerRightExtras,
ComposerHeader,
ComposerIdleAction,
ComposerReplacement,
diff --git a/app/src/features/conversations/threadList/ThreadList.tsx b/app/src/features/conversations/threadList/ThreadList.tsx
index 17003bc653..4b2953f150 100644
--- a/app/src/features/conversations/threadList/ThreadList.tsx
+++ b/app/src/features/conversations/threadList/ThreadList.tsx
@@ -74,10 +74,10 @@ export function ThreadList({
thread pills on both sides, the mirror image of the bug the gutter is
here to prevent.
- `pb-1` replaces the `mb-1` the button carried as a list child: same
- gap, but owned by the band now that the button no longer sits on the
- column's `gap-0.5` rhythm. */}
- <div className="flex-none overflow-hidden px-2 pb-1 [scrollbar-gutter:stable_both-edges] [scrollbar-width:thin]">
+ `pb-2` makes the 8px gap below the button match the chat separator's
+ 8px lower margin above it, so the action is optically centred between
+ the primary navigation and the first conversation. */}
+ <div className="flex-none overflow-hidden px-2 pb-2 [scrollbar-gutter:stable_both-edges] [scrollbar-width:thin]">
{/* "New conversation" as a row, not a header icon. It is the same
affordance as a thread row — pick a conversation to work in — so it
takes the same shape: `h-8` pill, same radius, same hover fill, same
@@ -235,26 +235,14 @@ export function ThreadList({
autoFocus
/>
) : (
- <>
- <p
- className={`truncate flex-1 text-[14px] ${
- selectedThreadId === thread.id
- ? 'font-semibold text-content'
- : 'text-content-muted'
- }`}>
- {resolveTitle(thread.id)}
- </p>
- {/* Message count occupies the trailing slot at rest and
- yields to the row actions on hover, so the row never
- grows or reflows between the two states. */}
- {thread.messageCount > 0 && (
- <span
- data-testid={`thread-count-${thread.id}`}
- className="flex-none rounded-full bg-surface/60 px-1.5 text-[10px] leading-4 text-content-faint group-hover:hidden">
- {thread.messageCount > 99 ? '99+' : thread.messageCount}
- </span>
- )}
- </>
+ <p
+ className={`truncate flex-1 text-[14px] ${
+ selectedThreadId === thread.id
+ ? 'font-semibold text-content'
+ : 'text-content-muted'
+ }`}>
+ {resolveTitle(thread.id)}
+ </p>
)}
<button
type="button"
@@ -265,9 +253,8 @@ export function ThreadList({
}}
aria-label={t('chat.editThreadTitle')}
title={t('chat.editThreadTitle')}
- // `hidden`, not `opacity-0`: an invisible-but-laid-out button
- // would keep reserving the trailing slot the count badge now
- // occupies, squeezing the title on every row.
+ // `hidden`, not `opacity-0`: the title gets the full row width
+ // until hover reveals the trailing actions.
className="hidden h-5 w-5 flex-none items-center justify-center rounded text-content-faint transition-colors hover:bg-surface/60 hover:text-primary-500 group-hover:inline-flex">
<svg className="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path
diff --git a/app/src/index.css b/app/src/index.css
index 233ad134e2..6b3ca4e109 100644
--- a/app/src/index.css
+++ b/app/src/index.css
@@ -301,6 +301,9 @@
keyframes below. `linear`, not an ease: the offset traces a circle, and an
ease would make the light appear to speed up and stall twice per lap. */
--animate-composer-shadow: composerShadowOrbit 18s linear infinite;
+ /* Same clockwise light model as the composer, reduced for the much larger
+ sidebar surface so it reads as quiet separation rather than a glow. */
+ --animate-sidebar-shadow: sidebarShadowOrbit 24s linear infinite;
--backdrop-blur-xs: 2px;
--backdrop-blur-sm: 4px;
@@ -485,6 +488,49 @@
-6px 24px 44px -16px rgb(0 0 0 / 0.12);
}
}
+ @keyframes sidebarShadowOrbit {
+ 0%,
+ 100% {
+ box-shadow:
+ 0 2px 10px -4px rgb(0 0 0 / 0.05),
+ 0 10px 28px -14px rgb(0 0 0 / 0.07);
+ }
+ 12.5% {
+ box-shadow:
+ 1px 3px 10px -4px rgb(0 0 0 / 0.05),
+ 3px 11px 28px -14px rgb(0 0 0 / 0.07);
+ }
+ 25% {
+ box-shadow:
+ 2px 4px 10px -4px rgb(0 0 0 / 0.05),
+ 4px 14px 28px -14px rgb(0 0 0 / 0.07);
+ }
+ 37.5% {
+ box-shadow:
+ 1px 5px 10px -4px rgb(0 0 0 / 0.05),
+ 3px 17px 28px -14px rgb(0 0 0 / 0.07);
+ }
+ 50% {
+ box-shadow:
+ 0 6px 10px -4px rgb(0 0 0 / 0.05),
+ 0 18px 28px -14px rgb(0 0 0 / 0.07);
+ }
+ 62.5% {
+ box-shadow:
+ -1px 5px 10px -4px rgb(0 0 0 / 0.05),
+ -3px 17px 28px -14px rgb(0 0 0 / 0.07);
+ }
+ 75% {
+ box-shadow:
+ -2px 4px 10px -4px rgb(0 0 0 / 0.05),
+ -4px 14px 28px -14px rgb(0 0 0 / 0.07);
+ }
+ 87.5% {
+ box-shadow:
+ -1px 3px 10px -4px rgb(0 0 0 / 0.05),
+ -3px 11px 28px -14px rgb(0 0 0 / 0.07);
+ }
+ }
@keyframes float {
0%,
100% {
@@ -516,6 +562,22 @@
}
}
+/* Floating root-sidebar material. The first layer borrows only a trace of the
+ active theme's primary hue; the translucent neutral below does the actual
+ legibility work. Dark mode keeps the established chrome material and turns
+ the tint down further so it never reads as a coloured panel. */
+.sidebar-material {
+ background:
+ linear-gradient(145deg, rgb(var(--primary-500) / 0.035), transparent 46%),
+ rgb(var(--surface) / 0.92);
+}
+
+.dark .sidebar-material {
+ background:
+ linear-gradient(145deg, rgb(var(--primary-400) / 0.025), transparent 46%),
+ rgb(var(--sidebar) / 0.85);
+}
+
/*
Default border colour, for elements that use a bare `border` / `border-t`
utility and name no colour of their own.
diff --git a/app/src/lib/i18n/ar.ts b/app/src/lib/i18n/ar.ts
index d73c1364f7..9b71b5e4dc 100644
--- a/app/src/lib/i18n/ar.ts
+++ b/app/src/lib/i18n/ar.ts
@@ -3239,6 +3239,8 @@ const messages: TranslationMap = {
'conversations.composer.context.errorDetail': 'تعذّر على النواة قياس الموجّه لهذه المحادثة.',
'conversations.composer.context.section.preamble': 'موجّه النظام',
'conversations.composer.context.section.tools': 'الأدوات',
+ 'conversations.composer.context.section.toolSchemas': 'مخططات الأدوات',
+ 'conversations.composer.context.section.yourInput': 'إدخالك',
'conversations.composer.context.section.history': 'سجل المحادثة',
'conversations.composer.context.turnCost': 'هذه الجولة',
'conversations.composer.context.subagentCost': '{agent}',
diff --git a/app/src/lib/i18n/bn.ts b/app/src/lib/i18n/bn.ts
index ffdb17edc6..4c953f9a2e 100644
--- a/app/src/lib/i18n/bn.ts
+++ b/app/src/lib/i18n/bn.ts
@@ -3317,6 +3317,8 @@ const messages: TranslationMap = {
'conversations.composer.context.errorDetail': 'কোর এই থ্রেডের প্রম্পট মাপতে পারেনি।',
'conversations.composer.context.section.preamble': 'সিস্টেম প্রম্পট',
'conversations.composer.context.section.tools': 'টুল',
+ 'conversations.composer.context.section.toolSchemas': 'টুল স্কিমা',
+ 'conversations.composer.context.section.yourInput': 'আপনার ইনপুট',
'conversations.composer.context.section.history': 'কথোপকথনের ইতিহাস',
'conversations.composer.context.turnCost': 'এই টার্ন',
'conversations.composer.context.subagentCost': '{agent}',
diff --git a/app/src/lib/i18n/de.ts b/app/src/lib/i18n/de.ts
index 6cba2a8e13..89cb783bf4 100644
--- a/app/src/lib/i18n/de.ts
+++ b/app/src/lib/i18n/de.ts
@@ -3412,6 +3412,8 @@ const messages: TranslationMap = {
'Der Core konnte den Prompt dieses Threads nicht messen.',
'conversations.composer.context.section.preamble': 'System-Prompt',
'conversations.composer.context.section.tools': 'Werkzeuge',
+ 'conversations.composer.context.section.toolSchemas': 'Tool-Schemas',
+ 'conversations.composer.context.section.yourInput': 'Deine Eingabe',
'conversations.composer.context.section.history': 'Gesprächsverlauf',
'conversations.composer.context.turnCost': 'Dieser Zug',
'conversations.composer.context.subagentCost': '{agent}',
diff --git a/app/src/lib/i18n/en.ts b/app/src/lib/i18n/en.ts
index 9ce97fd04a..6a72ff30f0 100644
--- a/app/src/lib/i18n/en.ts
+++ b/app/src/lib/i18n/en.ts
@@ -3727,6 +3727,8 @@ const en: TranslationMap = {
'The core could not measure the prompt for this thread.',
'conversations.composer.context.section.preamble': 'System prompt',
'conversations.composer.context.section.tools': 'Tools',
+ 'conversations.composer.context.section.toolSchemas': 'Tool schemas',
+ 'conversations.composer.context.section.yourInput': 'Your input',
'conversations.composer.context.section.history': 'Conversation history',
'conversations.composer.context.turnCost': 'This turn',
'conversations.composer.context.subagentCost': '{agent}',
diff --git a/app/src/lib/i18n/es.ts b/app/src/lib/i18n/es.ts
index f5d22d432b..f2096ece18 100644
--- a/app/src/lib/i18n/es.ts
+++ b/app/src/lib/i18n/es.ts
@@ -3377,6 +3377,8 @@ const messages: TranslationMap = {
'conversations.composer.context.errorDetail': 'El núcleo no pudo medir el prompt de este hilo.',
'conversations.composer.context.section.preamble': 'Prompt del sistema',
'conversations.composer.context.section.tools': 'Herramientas',
+ 'conversations.composer.context.section.toolSchemas': 'Esquemas de herramientas',
+ 'conversations.composer.context.section.yourInput': 'Tu entrada',
'conversations.composer.context.section.history': 'Historial de la conversación',
'conversations.composer.context.turnCost': 'Este turno',
'conversations.composer.context.subagentCost': '{agent}',
diff --git a/app/src/lib/i18n/fr.ts b/app/src/lib/i18n/fr.ts
index ea9ede4256..24e12108be 100644
--- a/app/src/lib/i18n/fr.ts
+++ b/app/src/lib/i18n/fr.ts
@@ -3399,6 +3399,8 @@ const messages: TranslationMap = {
'conversations.composer.context.errorDetail': "Le cœur n'a pas pu mesurer le prompt de ce fil.",
'conversations.composer.context.section.preamble': 'Prompt système',
'conversations.composer.context.section.tools': 'Outils',
+ 'conversations.composer.context.section.toolSchemas': 'Schémas d’outils',
+ 'conversations.composer.context.section.yourInput': 'Votre entrée',
'conversations.composer.context.section.history': 'Historique de la conversation',
'conversations.composer.context.turnCost': 'Ce tour',
'conversations.composer.context.subagentCost': '{agent}',
diff --git a/app/src/lib/i18n/hi.ts b/app/src/lib/i18n/hi.ts
index 387ab7c142..ed123947a0 100644
--- a/app/src/lib/i18n/hi.ts
+++ b/app/src/lib/i18n/hi.ts
@@ -3318,6 +3318,8 @@ const messages: TranslationMap = {
'conversations.composer.context.errorDetail': 'कोर इस थ्रेड का प्रॉम्प्ट नहीं माप सका।',
'conversations.composer.context.section.preamble': 'सिस्टम प्रॉम्प्ट',
'conversations.composer.context.section.tools': 'टूल',
+ 'conversations.composer.context.section.toolSchemas': 'टूल स्कीमा',
+ 'conversations.composer.context.section.yourInput': 'आपका इनपुट',
'conversations.composer.context.section.history': 'बातचीत का इतिहास',
'conversations.composer.context.turnCost': 'यह टर्न',
'conversations.composer.context.subagentCost': '{agent}',
diff --git a/app/src/lib/i18n/id.ts b/app/src/lib/i18n/id.ts
index ad456d5503..2dd781baac 100644
--- a/app/src/lib/i18n/id.ts
+++ b/app/src/lib/i18n/id.ts
@@ -3333,6 +3333,8 @@ const messages: TranslationMap = {
'conversations.composer.context.errorDetail': 'Core tidak dapat mengukur prompt untuk utas ini.',
'conversations.composer.context.section.preamble': 'Prompt sistem',
'conversations.composer.context.section.tools': 'Alat',
+ 'conversations.composer.context.section.toolSchemas': 'Skema alat',
+ 'conversations.composer.context.section.yourInput': 'Input Anda',
'conversations.composer.context.section.history': 'Riwayat percakapan',
'conversations.composer.context.turnCost': 'Giliran ini',
'conversations.composer.context.subagentCost': '{agent}',
diff --git a/app/src/lib/i18n/it.ts b/app/src/lib/i18n/it.ts
index 6b20f29950..febb897a88 100644
--- a/app/src/lib/i18n/it.ts
+++ b/app/src/lib/i18n/it.ts
@@ -3376,6 +3376,8 @@ const messages: TranslationMap = {
'Il core non è riuscito a misurare il prompt di questo thread.',
'conversations.composer.context.section.preamble': 'Prompt di sistema',
'conversations.composer.context.section.tools': 'Strumenti',
+ 'conversations.composer.context.section.toolSchemas': 'Schemi degli strumenti',
+ 'conversations.composer.context.section.yourInput': 'Il tuo input',
'conversations.composer.context.section.history': 'Cronologia della conversazione',
'conversations.composer.context.turnCost': 'Questo turno',
'conversations.composer.context.subagentCost': '{agent}',
diff --git a/app/src/lib/i18n/ko.ts b/app/src/lib/i18n/ko.ts
index bbc93621d7..ae853c5b56 100644
--- a/app/src/lib/i18n/ko.ts
+++ b/app/src/lib/i18n/ko.ts
@@ -3284,6 +3284,8 @@ const messages: TranslationMap = {
'코어가 이 스레드의 프롬프트를 측정하지 못했습니다.',
'conversations.composer.context.section.preamble': '시스템 프롬프트',
'conversations.composer.context.section.tools': '도구',
+ 'conversations.composer.context.section.toolSchemas': '도구 스키마',
+ 'conversations.composer.context.section.yourInput': '사용자 입력',
'conversations.composer.context.section.history': '대화 기록',
'conversations.composer.context.turnCost': '이번 턴',
'conversations.composer.context.subagentCost': '{agent}',
diff --git a/app/src/lib/i18n/pl.ts b/app/src/lib/i18n/pl.ts
index 24ff23bc43..a3bc743371 100644
--- a/app/src/lib/i18n/pl.ts
+++ b/app/src/lib/i18n/pl.ts
@@ -3357,6 +3357,8 @@ const messages: TranslationMap = {
'conversations.composer.context.errorDetail': 'Rdzeń nie mógł zmierzyć promptu tego wątku.',
'conversations.composer.context.section.preamble': 'Prompt systemowy',
'conversations.composer.context.section.tools': 'Narzędzia',
+ 'conversations.composer.context.section.toolSchemas': 'Schematy narzędzi',
+ 'conversations.composer.context.section.yourInput': 'Twoje dane wejściowe',
'conversations.composer.context.section.history': 'Historia rozmowy',
'conversations.composer.context.turnCost': 'Ta tura',
'conversations.composer.context.subagentCost': '{agent}',
diff --git a/app/src/lib/i18n/pt.ts b/app/src/lib/i18n/pt.ts
index 676cdfb7eb..f893154c0b 100644
--- a/app/src/lib/i18n/pt.ts
+++ b/app/src/lib/i18n/pt.ts
@@ -3374,6 +3374,8 @@ const messages: TranslationMap = {
'O núcleo não conseguiu medir o prompt desta conversa.',
'conversations.composer.context.section.preamble': 'Prompt do sistema',
'conversations.composer.context.section.tools': 'Ferramentas',
+ 'conversations.composer.context.section.toolSchemas': 'Esquemas de ferramentas',
+ 'conversations.composer.context.section.yourInput': 'Sua entrada',
'conversations.composer.context.section.history': 'Histórico da conversa',
'conversations.composer.context.turnCost': 'Este turno',
'conversations.composer.context.subagentCost': '{agent}',
diff --git a/app/src/lib/i18n/ru.ts b/app/src/lib/i18n/ru.ts
index f3b76d8f38..74369b3d03 100644
--- a/app/src/lib/i18n/ru.ts
+++ b/app/src/lib/i18n/ru.ts
@@ -3346,6 +3346,8 @@ const messages: TranslationMap = {
'conversations.composer.context.errorDetail': 'Ядру не удалось измерить промпт этого треда.',
'conversations.composer.context.section.preamble': 'Системный промпт',
'conversations.composer.context.section.tools': 'Инструменты',
+ 'conversations.composer.context.section.toolSchemas': 'Схемы инструментов',
+ 'conversations.composer.context.section.yourInput': 'Ваш ввод',
'conversations.composer.context.section.history': 'История разговора',
'conversations.composer.context.turnCost': 'Этот ход',
'conversations.composer.context.subagentCost': '{agent}',
diff --git a/app/src/lib/i18n/zh-CN.ts b/app/src/lib/i18n/zh-CN.ts
index 11264fb63d..57bf07de4e 100644
--- a/app/src/lib/i18n/zh-CN.ts
+++ b/app/src/lib/i18n/zh-CN.ts
@@ -3123,6 +3123,8 @@ const messages: TranslationMap = {
'conversations.composer.context.errorDetail': '核心无法测量此会话的提示词。',
'conversations.composer.context.section.preamble': '系统提示词',
'conversations.composer.context.section.tools': '工具',
+ 'conversations.composer.context.section.toolSchemas': '工具架构',
+ 'conversations.composer.context.section.yourInput': '你的输入',
'conversations.composer.context.section.history': '对话历史',
'conversations.composer.context.turnCost': '本轮',
'conversations.composer.context.subagentCost': '{agent}',
diff --git a/app/src/pages/__tests__/Conversations.auiComposerSurfaces.test.tsx b/app/src/pages/__tests__/Conversations.auiComposerSurfaces.test.tsx
index 35a57dc5c8..64f967b267 100644
--- a/app/src/pages/__tests__/Conversations.auiComposerSurfaces.test.tsx
+++ b/app/src/pages/__tests__/Conversations.auiComposerSurfaces.test.tsx
@@ -14,13 +14,12 @@
* - the flow-approval banner, the only Approve/Reject affordance for a paused
* tinyflows run;
* - the in-flight / failed artifact deck;
- * - the background-processes button and the panel it opens.
*
* Each test fails against the pre-fix component with "unable to find" on the
* element it names — that is the regression, not a styling detail.
*/
import { combineReducers, configureStore } from '@reduxjs/toolkit';
-import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
+import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
import { Provider } from 'react-redux';
import { MemoryRouter } from 'react-router-dom';
import { beforeEach, describe, expect, it, vi } from 'vitest';
@@ -32,7 +31,6 @@ import { chatSend } from '../../services/chatService';
import { callCoreRpc } from '../../services/coreRpcClient';
import chatRuntimeReducer, {
type ArtifactSnapshot,
- setToolTimelineForThread,
type ToolTimelineEntry,
} from '../../store/chatRuntimeSlice';
import layoutReducer from '../../store/layoutSlice';
@@ -346,7 +344,7 @@ describe('assistant-ui chat surface — composer-adjacent cards', () => {
await renderChat();
expect(await screen.findByText('POST https://example.test/orders')).toBeInTheDocument();
- expect(screen.getByRole('button', { name: 'Approve once' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: 'Approve' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Deny' })).toBeInTheDocument();
});
@@ -356,18 +354,13 @@ describe('assistant-ui chat surface — composer-adjacent cards', () => {
expect(await screen.findByText('Quarterly summary')).toBeInTheDocument();
});
- it('opens the background-processes panel from the composer toolbar', async () => {
+ it('hides the background-processes and run-mode controls for now', async () => {
await renderChat({
chatRuntime: { toolTimelineByThread: { [THREAD_ID]: [asyncSubagentRow()] } },
});
- const toggle = await screen.findByTestId('background-processes-toggle');
- await act(async () => {
- fireEvent.click(toggle);
- });
-
- // The panel is the only route to the sub-agent drawer on this surface.
- expect(await screen.findByText('Researcher')).toBeInTheDocument();
+ expect(screen.queryByTestId('background-processes-toggle')).not.toBeInTheDocument();
+ expect(screen.queryByTestId('run-mode-toggle')).not.toBeInTheDocument();
});
it('shows the prompt-injection advisory when the send is risky', async () => {
@@ -430,24 +423,11 @@ describe('assistant-ui chat surface — composer-adjacent cards', () => {
expect(await screen.findByTestId('chat-files-chip')).toBeInTheDocument();
});
- it('keeps the composer toolbar live after mount, not frozen at first render', async () => {
- // The toolbar controls reach the composer through `ComposerExtras`, which
- // assistant-ui renders BY TYPE — so a slot that closes over the host node
- // instead of reading it through a ref keeps whatever the first render
- // produced. The badge would then never leave the state it mounted in: a
- // sub-agent spawned mid-turn would be invisible for the rest of the turn.
- const store = await renderChat();
- const toggle = await screen.findByTestId('background-processes-toggle');
- expect(within(toggle).queryByText('1')).toBeNull();
-
- await act(async () => {
- store.dispatch(
- setToolTimelineForThread({ threadId: THREAD_ID, entries: [asyncSubagentRow()] })
- );
- });
-
- expect(
- within(await screen.findByTestId('background-processes-toggle')).getByText('1')
- ).toBeInTheDocument();
+ it('places context usage in the right action cluster immediately before voice mode', async () => {
+ await renderChat();
+ const context = await screen.findByTestId('composer-context-usage');
+ const voice = screen.getByRole('button', { name: 'Voice mode' });
+ expect(context.parentElement).toBe(voice.parentElement);
+ expect(context.compareDocumentPosition(voice) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
});
});
diff --git a/app/src/store/chatRuntimeSlice.ts b/app/src/store/chatRuntimeSlice.ts
index b0dc2a6335..c901fdd02a 100644
--- a/app/src/store/chatRuntimeSlice.ts
+++ b/app/src/store/chatRuntimeSlice.ts
@@ -1,3 +1,6 @@
+Warning: truncated output (original token count: 33517)
+Total output lines: 3112
+
import { createAsyncThunk, createSlice, type PayloadAction } from '@reduxjs/toolkit';
import debug from 'debug';
@@ -1409,320 +1412,7 @@ const chatRuntimeSlice = createSlice({
/** Reset the live processing transcript at the start of a fresh turn so a
* new turn's narration/steps don't append onto the previous turn's. */
clearProcessingForThread: (state, action: PayloadAction<{ threadId: string }>) => {
- delete state.processingByThread[action.payload.threadId];
- },
- /**
- * Append a streamed narration/thinking delta to the live processing
- * transcript, coalescing into the trailing same-kind, same-round block so
- * a paragraph stays one item. Mirrors the Rust mirror's accumulation so
- * the live "View processing" panel matches the persisted one.
- */
- appendProcessingProse: (
- state,
- action: PayloadAction<{
- threadId: string;
- kind: 'narration' | 'thinking';
- round: number;
- delta: string;
- }>
- ) => {
- const { threadId, kind, round, delta } = action.payload;
- if (!delta) return;
- const list = (state.processingByThread[threadId] ??= []);
- const last = list[list.length - 1];
- if (last && last.kind === kind && last.round === round) {
- last.text += delta;
- return;
- }
- list.push({ kind, round, seq: list.length, text: delta });
- },
- /**
- * Reducer-side merge for a `tool_call` socket event (Phase 3 — replaces the
- * provider's `getState()` + find-row + full-array-rebuild). Upserts the row
- * by `toolCallId` (falling back to a generated stable id), decorates its
- * label/detail, and records the processing-transcript pointer in one pass.
- */
- toolCallReceived: (
- state,
- action: PayloadAction<{
- threadId: string;
- round: number;
- toolName: string;
- toolCallId?: string;
- displayLabel?: string;
- displayDetail?: string;
- /**
- * The call's arguments as the `tool_call` event carries them. Kept as
- * the row's `argsBuffer` unless `tool_args_delta` already streamed
- * them, so a call whose args were not streamed still shows its input —
- * as the same call does on reload, where the core transcript always
- * has them.
- */
- args?: Record<string, unknown>;
- }>
- ) => {
- const { threadId, round, toolName, displayLabel, displayDetail } = action.payload;
- const argsBuffer = argsBufferOf(action.payload.args);
- // Normalise an absent id to `undefined` *before* anything reads it. A
- // provider that sends `tool_call_id: ""` is saying "no id", but `??` only
- // falls back on null/undefined — so the empty string used to survive as
- // the row id, and every such call in a turn got the same one. Downstream
- // that is fatal, not cosmetic: assistant-ui keys message parts as
- // `toolCallId-${id}`, so two id-less calls collide on the literal key
- // `toolCallId-` and `useResources` throws "Duplicate key toolCallId-",
- // taking the whole thread render down. The two guards below already
- // treated `""` as absent (both are truthiness checks); only the id
- // fallback disagreed.
- const toolCallId = action.payload.toolCallId || undefined;
- const entries = (state.toolTimelineByThread[threadId] ??= []);
- const list = (state.processingByThread[threadId] ??= []);
- let existingIdx = toolCallId ? entries.findIndex(e => e.id === toolCallId) : -1;
- // A `tool_args_delta` can land before its `tool_call` and mint the row
- // under a fallback id. Adopt that row rather than pushing a second one
- // for the same call: the duplicate rendered as two cards live (one stuck
- // running) and as one on reload.
- if (existingIdx < 0) {
- existingIdx = entries.findIndex(
- e =>
- e.id.startsWith(`${threadId}:${round}:`) &&
- e.round === round &&
- e.status === 'running' &&
- (e.name === toolName || e.name === '') &&
- !list.some(item => item.kind === 'toolCall' && item.callId === e.id)
- );
- if (existingIdx >= 0 && toolCallId) entries[existingIdx].id = toolCallId;
- }
- // Stable row id, shared with the processing-transcript tool pointer so the
- // panel can resolve the row by `callId`.
- const rowId =
- existingIdx >= 0
- ? entries[existingIdx].id
- : (toolCallId ?? `${threadId}:${round}:${entries.length}:${toolName}`);
- if (existingIdx >= 0) {
- const prev = entries[existingIdx];
- // A settled row stays settled. A replayed/late `tool_call` for a call
- // whose result already landed used to flip it back to `running`, and
- // nothing would ever settle it again.
- const settled =
- prev.status === 'success' || prev.status === 'error' || prev.status === 'cancelled';
- entries[existingIdx] = decorateEntry({
- ...prev,
- name: toolName,
- round,
- status: settled ? prev.status : 'running',
- argsBuffer: prev.argsBuffer ?? argsBuffer,
- displayName: displayLabel ?? prev.displayName,
- detail: displayDetail ?? prev.detail,
- });
- } else {
- const seq = state.toolTimelineSeqByThread[threadId] ?? 0;
- state.toolTimelineSeqByThread[threadId] = seq + 1;
- entries.push(
- decorateEntry({
- id: rowId,
- name: toolName,
- round,
- seq,
- status: 'running',
- argsBuffer,
- displayName: displayLabel,
- detail: displayDetail,
- })
- );
- }
- // Fold the processing-transcript pointer (was a second dispatch).
- if (!list.some(i => i.kind === 'toolCall' && i.callId === rowId)) {
- list.push({ kind: 'toolCall', round, seq: list.length, callId: rowId });
- }
- },
- /**
- * Reducer-side merge for a `tool_result` socket event (Phase 3). Settles the
- * matching row by `toolCallId`, else the newest still-running row with the
- * same name+round. A no-op when no row matches (mirrors the provider's
- * `changed` guard). `failure` is the raw socket payload, parsed here.
- */
- toolResultReceived: (
- state,
- action: PayloadAction<{
- threadId: string;
- round: number;
- toolName: string;
- toolCallId?: string;
- success: boolean;
- output?: string;
- failure?: unknown;
- args?: unknown;
- elapsedMs?: number;
- structured?: unknown;
- displayLabel?: string;
- displayDetail?: string;
- }>
- ) => {
- const { threadId, round, toolName, success, output, failure } = action.payload;
- // Same normalisation as `toolCallReceived` — an empty id must not match a
- // row whose id is the generated fallback, and must fall through to the
- // name+round scan below.
- const toolCallId = action.payload.toolCallId || undefined;
- const entries = state.toolTimelineByThread[threadId];
- if (!entries || entries.length === 0) return;
- const status: ToolTimelineEntryStatus = success ? 'success' : 'error';
- // On failure, parse the optional structured explanation (#4254); a
- // successful result clears any stale failure carried on the row.
- const parsedFailure = success ? undefined : parseToolFailure(failure);
- // The core forwards the (size-capped) tool result text on `output`; accept
- // only non-empty payloads so a stub-less row stays `undefined`.
- const result = output && output.length > 0 ? output : undefined;
- const settle = (entry: ToolTimelineEntry) => {
- entry.status = status;
- entry.failure = parsedFailure;
- entry.result = result;
- applyResultExtras(entry, action.payload);
- };
- if (toolCallId) {
- const entry = entries.find(e => e.id === toolCallId);
- if (entry) {
- settle(entry);
- return;
- }
- }
- // FIFO, not LIFO: entries are appended in `seq` (issue) order and never
- // reordered in place, so scanning forward from index 0 finds the OLDEST
- // still-running row of this name+round — settling the call that was
- // actually issued first. A backward (newest-first) scan mis-pairs a
- // result with the wrong row when 2+ calls with the same name are
- // in-flight in parallel (e.g. `get_tool_contract` ×2) and results land
- // out of order.
- for (let i = 0; i < entries.length; i += 1) {
- const entry = entries[i];
- if (entry.status === 'running' && entry.name === toolName && entry.round === round) {
- settle(entry);
- return;
- }
- }
- },
- /**
- * Reducer-side merge for a `text_delta` / `thinking_delta` socket event
- * (Phase 3 — replaces the provider's `getState()` + parallel-vs-primary
- * routing). Forked (parallel) turns append into their own lane and skip the
- * processing transcript; the primary turn appends to the streaming preview
- * and coalesces a narration/thinking block into the live processing panel.
- * A `requestId` change starts a fresh preview (drops the prior turn's tail).
- */
- streamDeltaReceived: (
- state,
- action: PayloadAction<{
- threadId: string;
- requestId: string;
- round: number;
- delta: string;
- channel: 'content' | 'thinking';
- /**
- * Epoch ms the delta arrived, stamped by the dispatcher so the
- * reducer stays pure. Timestamps the thinking block for the
- * reasoning panel's "Thought for Ns"; omitted deltas carry no timing.
- */
- at?: number;
- }>
- ) => {
- const { threadId, requestId, round, delta, channel, at } = action.payload;
- // A parallel (forked) turn streams into its own lane so it doesn't clobber
- // the primary turn's stream on the same thread.
- if (state.parallelRequestThreads[requestId] !== undefined) {
- const lane = (state.parallelStreamsByThread[threadId] ??= {});
- const prev = lane[requestId];
- lane[requestId] = {
- requestId,
- content: channel === 'content' ? `${prev?.content ?? ''}${delta}` : (prev?.content ?? ''),
- thinking:
- channel === 'thinking' ? `${prev?.thinking ?? ''}${delta}` : (prev?.thinking ?? ''),
- };
- return;
- }
- state.liveRequestIdByThread[threadId] = requestId;
- const existing = state.streamingAssistantByThread[threadId];
- const sameTurn = existing != null && existing.requestId === requestId;
- const carryContent = sameTurn ? existing.content : '';
- const carryThinking = sameTurn ? existing.thinking : '';
- const next: StreamingAssistantState = {
- requestId,
- content: channel === 'content' ? `${carryContent}${delta}` : carryContent,
- thinking: channel === 'thinking' ? `${carryThinking}${delta}` : carryThinking,
- };
- const carryStartedAt = sameTurn ? existing.thinkingStartedAt : undefined;
- const carryEndedAt = sameTurn ? existing.thinkingEndedAt : undefined;
- const stampThinking = channel === 'thinking' && delta.length > 0 && at !== undefined;
- const startedAt = carryStartedAt ?? (stampThinking ? at : undefined);
- const endedAt = stampThinking ? at : carryEndedAt;
- if (startedAt !== undefined) next.thinkingStartedAt = startedAt;
- if (endedAt !== undefined) next.thinkingEndedAt = endedAt;
- state.streamingAssistantByThread[threadId] = next;
- // Live interleaved processing transcript so a mid-turn "View processing"
- // isn't empty — coalesce into the trailing same-kind, same-round block.
- if (!delta) return;
- const kind = channel === 'content' ? 'narration' : 'thinking';
- const list = (state.processingByThread[threadId] ??= []);
- const last = list[list.length - 1];
- if (last && last.kind === kind && last.round === round) {
- last.text += delta;
- if (last.kind === 'thinking' && at !== undefined) {
- last.startedAt ??= at;
- last.endedAt = at;
- }
- } else if (kind === 'thinking' && at !== undefined) {
- list.push({ kind, round, seq: list.length, text: delta, startedAt: at, endedAt: at });
- } else {
- list.push({ kind, round, seq: list.length, text: delta });
- }
- },
- /**
- * Reducer-side merge for a `tool_args_delta` socket event (Phase 3).
- * Appends the streamed args to the matching row (by `toolCallId`, else the
- * newest running row of the same name+round), or creates a running row when
- * the args arrive before the tool-call event. Re-decorates each time.
- */
- toolArgsDeltaReceived: (
- state,
- action: PayloadAction<{
- threadId: string;
- round: number;
- delta: string;
- toolName?: string;
- toolCallId?: string;
- }>
- ) => {
- const { threadId, round, delta, toolName } = action.payload;
- // `""` means "no id" — see `toolCallReceived` for why the empty string
- // must never reach a row id.
- const toolCallId = action.payload.toolCallId || undefined;
- const entries = (state.toolTimelineByThread[threadId] ??= []);
- let matchIdx = -1;
- if (toolCallId) matchIdx = entries.findIndex(e => e.id === toolCallId);
- if (matchIdx < 0 && toolName) {
- matchIdx = entries.findIndex(
- e => e.status === 'running' && e.name === toolName && e.round === round
- );
- }
- if (matchIdx >= 0) {
- const prev = entries[matchIdx];
- entries[matchIdx] = decorateEntry({
- ...prev,
- argsBuffer: `${prev.argsBuffer ?? ''}${delta}`,
- name: prev.name.length === 0 && toolName ? toolName : prev.name,
- });
- } else {
- const seq = state.toolTimelineSeqByThread[threadId] ?? 0;
- state.toolTimelineSeqByThread[threadId] = seq + 1;
- entries.push(
- decorateEntry({
- // Same stable fallback `toolCallReceived` generates. This branch
- // used to write `''`, so an args-delta that arrived before its
- // `tool_call` event with no id produced an id-less row — and a
- // second one collided with it.
- id: toolCallId ?? `${threadId}:${round}:${entries.length}:${toolName ?? ''}`,
- name: toolName ?? '',
- round,
- seq,
- status: 'running',
+ delete state.processingByThread[action.payl…3517 tokens truncated…nning',
argsBuffer: delta,
})
);
diff --git a/app/test/playwright/specs/sidebar-icon-collapse.spec.ts b/app/test/playwright/specs/sidebar-icon-collapse.spec.ts
index cb3b87be9a..22200af9db 100644
--- a/app/test/playwright/specs/sidebar-icon-collapse.spec.ts
+++ b/app/test/playwright/specs/sidebar-icon-collapse.spec.ts
@@ -42,7 +42,7 @@ const REOPEN = '[data-testid="root-shell-reopen"]';
const COLLAPSE_BUTTON = '[data-analytics-id="sidebar-header-collapse"]';
/** Mirrors `SIDEBAR_ICON_WIDTH` in `app/src/components/ui/Sidebar.tsx`. */
-const ICON_WIDTH_PX = 56;
+const ICON_WIDTH_PX = 88;
/** Mirrors `SIDEBAR_KEYBOARD_STEP` in `app/src/components/ui/Sidebar.tsx`. */
const KEYBOARD_STEP_PX = 16;
/** Mirrors `WINDOW_DRAG_BAR_HEIGHT` in `app/src/components/layout/shell/WindowDragBar.tsx`. */
diff --git a/crates/openhuman-app/tauri.conf.json b/crates/openhuman-app/tauri.conf.json
index 617ef14b3d..3e28681914 100644
--- a/crates/openhuman-app/tauri.conf.json
+++ b/crates/openhuman-app/tauri.conf.json
@@ -21,8 +21,8 @@
"titleBarStyle": "Overlay",
"hiddenTitle": true,
"trafficLightPosition": {
- "x": 32,
- "y": 40
+ "x": 22,
+ "y": 32
},
"resizable": true,
"center": false,