The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(assistant-ui): clean up component definitions and formatting
Steven Enamakel9263e837cfb8
diff --git a/app/src/components/assistant-ui/elements/reasoning-panel.tsx b/app/src/components/assistant-ui/elements/reasoning-panel.tsxindex c24f8bc221..cc58095cf3 100644--- a/app/src/components/assistant-ui/elements/reasoning-panel.tsx+++ b/app/src/components/assistant-ui/elements/reasoning-panel.tsx@@ -61,7 +61,7 @@ export interface ReasoningPanelProps {const REMARK_PLUGINS = [remarkGfm];-const StepBody = memo(function StepBody({ body }: { body: string }) {+const StepBody = memo(({ body }: { body: string }) => {return (<divdata-slot="reasoning-step-body"@@ -77,6 +77,7 @@ const StepBody = memo(function StepBody({ body }: { body: string }) {</div>);});+StepBody.displayName = 'ReasoningStepBody';/*** Keeps a bounded scroll region pinned to its newest content while `active`,@@ -192,9 +193,7 @@ function StepList({aria-hiddenclassName={cn('relative mt-[7px] size-[5px] shrink-0 rounded-full transition-colors duration-300',- active- ? 'bg-primary-500 motion-safe:animate-pulse'- : 'bg-foreground/25'+ active ? 'bg-primary-500 motion-safe:animate-pulse' : 'bg-foreground/25')}/><div className="flex min-w-0 flex-1 flex-col">diff --git a/app/src/components/assistant-ui/elements/reasoning-trace.tsx b/app/src/components/assistant-ui/elements/reasoning-trace.tsxindex 87e1363786..2ef448a016 100644--- a/app/src/components/assistant-ui/elements/reasoning-trace.tsx+++ b/app/src/components/assistant-ui/elements/reasoning-trace.tsx@@ -28,7 +28,6 @@ export function useElapsedMs(startedAt: number | undefined, active: boolean): nuconst [now, setNow] = useState(() => Date.now());useEffect(() => {if (!active || startedAt === undefined) return;- setNow(Date.now());const id = window.setInterval(() => setNow(Date.now()), 1000);return () => window.clearInterval(id);}, [active, startedAt]);@@ -65,8 +64,7 @@ export function ReasoningTrace({const elapsedMs = useElapsedMs(span?.startedAt, streaming);const liveLabel = latestHeading(steps) ?? t('chat.reasoning.thinking');- const settledMs =- span && span.endedAt !== undefined ? span.endedAt - span.startedAt : undefined;+ const settledMs = span && span.endedAt !== undefined ? span.endedAt - span.startedAt : undefined;const restingLabel = thoughtForLabel(settledMs, t);return (diff --git a/app/src/components/assistant-ui/elements/reasoningSteps.ts b/app/src/components/assistant-ui/elements/reasoningSteps.tsindex f5bf497192..fe1d402d79 100644--- a/app/src/components/assistant-ui/elements/reasoningSteps.ts+++ b/app/src/components/assistant-ui/elements/reasoningSteps.ts@@ -138,7 +138,8 @@ export function reasoningSpan(for (const timing of timings) {if (!timing) continue;if (typeof timing.startedAt === 'number') {- startedAt = startedAt === undefined ? timing.startedAt : Math.min(startedAt, timing.startedAt);+ startedAt =+ startedAt === undefined ? timing.startedAt : Math.min(startedAt, timing.startedAt);}if (typeof timing.endedAt === 'number') {endedAt = endedAt === undefined ? timing.endedAt : Math.max(endedAt, timing.endedAt);diff --git a/app/src/components/assistant-ui/elements/surfaces.tsx b/app/src/components/assistant-ui/elements/surfaces.tsxindex e4cd7f60dc..101dbd360e 100644--- a/app/src/components/assistant-ui/elements/surfaces.tsx+++ b/app/src/components/assistant-ui/elements/surfaces.tsx@@ -8,8 +8,7 @@* `collapsible-down/up` keyframes over `--radix-collapsible-content-height`).*/import { cn } from '@/components/assistant-ui/lib/utils';-import type { ComponentProps, ReactNode } from 'react';-import { useLayoutEffect, useRef, useState } from 'react';+import { type ComponentProps, type ReactNode, useLayoutEffect, useRef, useState } from 'react';export const labelSwap ='col-start-1 row-start-1 flex w-max items-center gap-1.5 leading-none transition-[opacity,filter] duration-300 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none';diff --git a/app/src/components/assistant-ui/reasoning-group.tsx b/app/src/components/assistant-ui/reasoning-group.tsxindex efcb1ea9be..8e83505871 100644--- a/app/src/components/assistant-ui/reasoning-group.tsx+++ b/app/src/components/assistant-ui/reasoning-group.tsx@@ -64,26 +64,23 @@ function useGroupReasoning(indices: readonly number[]) {}, [parts, indices]);}-export const OpenHumanReasoningGroup = memo(function OpenHumanReasoningGroup({- indices,- running,-}: {- indices: readonly number[];- running: boolean;-}) {- const rootRef = useRef<HTMLDivElement>(null);- const lockScroll = useScrollLock(rootRef, ANIMATION_DURATION);- const { texts, timings } = useGroupReasoning(indices);+export const OpenHumanReasoningGroup = memo(+ ({ indices, running }: { indices: readonly number[]; running: boolean }) => {+ const rootRef = useRef<HTMLDivElement>(null);+ const lockScroll = useScrollLock(rootRef, ANIMATION_DURATION);+ const { texts, timings } = useGroupReasoning(indices);- return (- <div ref={rootRef} data-slot="aui_reasoning-group">- <ReasoningTrace- texts={texts}- timings={timings}- streaming={running}- onAnimationStart={lockScroll}- data-testid="reasoning-panel"- />- </div>- );-});+ return (+ <div ref={rootRef} data-slot="aui_reasoning-group">+ <ReasoningTrace+ texts={texts}+ timings={timings}+ streaming={running}+ onAnimationStart={lockScroll}+ data-testid="reasoning-panel"+ />+ </div>+ );+ }+);+OpenHumanReasoningGroup.displayName = 'OpenHumanReasoningGroup';diff --git a/app/src/components/assistant-ui/thread.reasoning.test.tsx b/app/src/components/assistant-ui/thread.reasoning.test.tsxindex 059bada0fe..a44074ee4a 100644--- a/app/src/components/assistant-ui/thread.reasoning.test.tsx+++ b/app/src/components/assistant-ui/thread.reasoning.test.tsx@@ -59,9 +59,7 @@ describe('thread reasoning panel', () => {expect(panels).toHaveLength(1);const panel = panels[0]!;expect(panel.getAttribute('data-variant')).toBe('collapsible');- expect(panel.querySelector('[data-swap-layer="resting"]')?.textContent).toBe(- 'Thought for 12s'- );+ expect(panel.querySelector('[data-swap-layer="resting"]')?.textContent).toBe('Thought for 12s');const trigger = panel.querySelector('button')!;expect(trigger.getAttribute('aria-expanded')).toBe('false');diff --git a/app/src/features/conversations/timeline/ConversationTimeline.test.tsx b/app/src/features/conversations/timeline/ConversationTimeline.test.tsxindex 3827d6755c..d42c335294 100644--- a/app/src/features/conversations/timeline/ConversationTimeline.test.tsx+++ b/app/src/features/conversations/timeline/ConversationTimeline.test.tsx@@ -106,7 +106,9 @@ describe('ConversationTimeline', () => {// The thinking renders through the live reasoning panel, not a raw// hard-coded "Thinking…" <details>.const thinking = screen.getByTestId('stream-primary-thinking');- expect(thinking.getAttribute('aria-busy') ?? thinking.querySelector('[aria-busy]')).toBeTruthy();+ expect(+ thinking.getAttribute('aria-busy') ?? thinking.querySelector('[aria-busy]')+ ).toBeTruthy();expect(primary.querySelector('details')).toBeNull();// Only the last 120 chars of the 200-char body render in the content bubble.const contentBubble = primary.querySelector('.font-mono.text-sm');diff --git a/app/src/providers/__tests__/assistantUiMessages.reasoningTiming.test.ts b/app/src/providers/__tests__/assistantUiMessages.reasoningTiming.test.tsindex d973d59d29..2aeddac705 100644--- a/app/src/providers/__tests__/assistantUiMessages.reasoningTiming.test.ts+++ b/app/src/providers/__tests__/assistantUiMessages.reasoningTiming.test.ts@@ -47,10 +47,7 @@ describe('timing on projected reasoning parts', () => {[],[{ kind: 'thinking', round: 1, seq: 0, text: 'plan', startedAt: 10, endedAt: 20 }]);- expect(like.content).toEqual([- reasoningPart('plan', 10, 20),- { type: 'text', text: 'answer' },- ]);+ expect(like.content).toEqual([reasoningPart('plan', 10, 20), { type: 'text', text: 'answer' }]);});it('the live tail carries the streaming thinking span', () => {diff --git a/app/src/providers/assistantUiMessages.ts b/app/src/providers/assistantUiMessages.tsindex 91475f5596..bb26a5aeca 100644--- a/app/src/providers/assistantUiMessages.ts+++ b/app/src/providers/assistantUiMessages.ts@@ -637,11 +637,7 @@ export function streamingTailMessage(const hasTranscriptThinking = transcript.some(item => item.kind === 'thinking');if (!hasTranscriptThinking) {parts.unshift(- reasoningPart(- streaming.thinking,- streaming.thinkingStartedAt,- streaming.thinkingEndedAt- )+ reasoningPart(streaming.thinking, streaming.thinkingStartedAt, streaming.thinkingEndedAt));}}