Skip to content

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

fix(assistant-ui): remove unused element components

Steven Enamakel1f041ab6e846
diff --git a/app/src/components/assistant-ui/elements/day-separator.tsx b/app/src/components/assistant-ui/elements/day-separator.tsx
deleted file mode 100644
index 1870c24d91..0000000000
--- a/app/src/components/assistant-ui/elements/day-separator.tsx
+++ /dev/null
@@ -1,75 +0,0 @@
-'use client';
-
-/**
- * Vendored from the assistant-ui `elements-day-separator` registry item
- * (https://r.assistant-ui.com/styles/base-nova/elements-day-separator.json).
- * Changes from upstream:
- * - `cn` import path (`@/components/assistant-ui/lib/utils`).
- * - The day-boundary check no longer reassigns a `let` across `.map()`
- * iterations (flagged by this repo's `react-hooks/immutability` lint); it
- * compares each message's day against the previous array entry instead,
- * with identical output.
- */
-import { cn } from '@/components/assistant-ui/lib/utils';
-import type { ComponentProps } from 'react';
-
-import { mono } from './surfaces';
-
-export interface DatedMessage {
- id: string;
- day: string;
- time: string;
- role: 'user' | 'assistant';
- text: string;
-}
-
-export function DaySeparator({
- messages,
- className,
- ...props
-}: Omit<ComponentProps<'div'>, 'children' | 'messages'> & { messages: readonly DatedMessage[] }) {
- return (
- <div
- data-slot="day-separator"
- className={cn('flex w-full max-w-sm flex-col gap-2', className)}
- {...props}>
- {messages.map((message, index) => {
- const newDay = index === 0 || messages[index - 1].day !== message.day;
-
- return (
- <div key={message.id} className="flex flex-col gap-2">
- {newDay && (
- <div className="flex items-center gap-2.5 py-1">
- <span className="bg-foreground/[0.08] h-px flex-1" />
- <span className={cn(mono, 'text-foreground/30')}>{message.day}</span>
- <span className="bg-foreground/[0.08] h-px flex-1" />
- </div>
- )}
- <div
- className={cn(
- 'group flex items-baseline gap-2',
- message.role === 'user' && 'flex-row-reverse'
- )}>
- <span
- className={cn(
- 'max-w-[80%] text-[13.5px] leading-relaxed break-words',
- message.role === 'user'
- ? 'bg-foreground/[0.05] rounded-2xl px-3.5 py-2'
- : 'text-foreground/75'
- )}>
- {message.text}
- </span>
- <span
- className={cn(
- mono,
- 'text-foreground/0 group-hover:text-foreground/30 shrink-0 tabular-nums transition-colors'
- )}>
- {message.time}
- </span>
- </div>
- </div>
- );
- })}
- </div>
- );
-}
diff --git a/app/src/components/assistant-ui/elements/feedback-dialog.tsx b/app/src/components/assistant-ui/elements/feedback-dialog.tsx
deleted file mode 100644
index ada8c3ae41..0000000000
--- a/app/src/components/assistant-ui/elements/feedback-dialog.tsx
+++ /dev/null
@@ -1,153 +0,0 @@
-'use client';
-
-/**
- * Vendored from the assistant-ui `elements-feedback-dialog` registry item
- * (https://r.assistant-ui.com/styles/base-nova/elements-feedback-dialog.json).
- * Changes from upstream:
- * - `cn` import path (`@/components/assistant-ui/lib/utils`).
- * - "What went wrong?"/"optional"/"Anything else?"/"Thanks. That helps us
- * tune the model."/"Send feedback" are now `promptLabel`/`optionalLabel`/
- * `notePlaceholder`/`thanksLabel`/`submitLabel` props with English
- * defaults, for `useT()`.
- */
-import { cn } from '@/components/assistant-ui/lib/utils';
-import { CheckIcon, ThumbsDownIcon } from 'lucide-react';
-import type { ComponentProps } from 'react';
-
-import { field, inkButton, mono, paper } from './surfaces';
-
-export function FeedbackDialog({
- reasons,
- selected,
- note,
- sent,
- onToggleReason,
- onNoteChange,
- onSubmit,
- promptLabel = 'What went wrong?',
- optionalLabel = 'optional',
- notePlaceholder = 'Anything else?',
- thanksLabel = 'Thanks. That helps us tune the model.',
- submitLabel = 'Send feedback',
- className,
- ...props
-}: Omit<
- ComponentProps<'div'>,
- | 'children'
- | 'reasons'
- | 'selected'
- | 'note'
- | 'sent'
- | 'onToggleReason'
- | 'onNoteChange'
- | 'onSubmit'
-> & {
- reasons: readonly string[];
- selected: readonly string[];
- note: string;
- sent: boolean;
- onToggleReason?: (reason: string) => void;
- onNoteChange?: (note: string) => void;
- onSubmit?: () => void;
- promptLabel?: string;
- optionalLabel?: string;
- notePlaceholder?: string;
- thanksLabel?: string;
- submitLabel?: string;
-}) {
- return (
- <div
- data-slot="feedback-dialog"
- className={cn(
- paper,
- 'flex w-full max-w-sm rounded-[20px] p-4',
- sent ? 'items-center gap-2.5 text-[13.5px]' : 'flex-col gap-3',
- className
- )}
- {...props}>
- {/*
- Mounted whether or not the feedback has been sent, because a live region
- only announces a change that happens after it is already in the tree; a
- region created together with its text is the case AT is free to miss.
- */}
- <div
- role="status"
- className={sent ? 'fade-in animate-in flex items-center gap-2.5 duration-300' : 'sr-only'}>
- {sent && (
- <>
- <CheckIcon className="size-4 shrink-0 text-emerald-500" />
- {thanksLabel}
- </>
- )}
- </div>
-
- {sent ? null : (
- <>
- <div className="flex items-center gap-2.5">
- <span className="bg-foreground/[0.05] text-foreground/45 flex size-7 shrink-0 items-center justify-center rounded-lg">
- <ThumbsDownIcon className="size-3.5" />
- </span>
- <span className="text-[13.5px] font-medium">{promptLabel}</span>
- <span className={cn(mono, 'text-foreground/30 ms-auto')}>{optionalLabel}</span>
- </div>
-
- <div className="flex flex-wrap gap-1.5">
- {reasons.map(reason => {
- const active = selected.includes(reason);
- const buttonClassName = cn(
- 'rounded-full px-2.5 py-1 text-xs transition-[background-color,color,scale] duration-150',
- onToggleReason && 'active:scale-[0.96]',
- active
- ? 'bg-foreground text-background'
- : cn(field, 'text-foreground/55', onToggleReason && 'hover:text-foreground/90')
- );
- return onToggleReason ? (
- <button
- key={reason}
- type="button"
- aria-pressed={active}
- onClick={() => onToggleReason(reason)}
- className={buttonClassName}>
- {reason}
- </button>
- ) : (
- <span
- key={reason}
- role="button"
- aria-disabled="true"
- aria-pressed={active}
- className={buttonClassName}>
- {reason}
- </span>
- );
- })}
- </div>
-
- <textarea
- value={note}
- onChange={event => onNoteChange?.(event.target.value)}
- rows={2}
- placeholder={notePlaceholder}
- aria-label={notePlaceholder}
- className={cn(
- field,
- 'text-foreground/80 placeholder:text-foreground/30 focus-visible:ring-foreground/20 resize-none rounded-xl px-3 py-2 text-xs outline-none focus-visible:ring-1'
- )}
- />
-
- {onSubmit && (
- <button
- type="button"
- onClick={onSubmit}
- className={cn(
- inkButton,
- 'flex h-8 items-center justify-center self-end rounded-full px-3.5 text-xs font-medium'
- )}>
- {submitLabel}
- </button>
- )}
- </>
- )}
- </div>
- );
-}
diff --git a/app/src/components/assistant-ui/elements/message-actions.tsx b/app/src/components/assistant-ui/elements/message-actions.tsx
deleted file mode 100644
index 8143e56c80..0000000000
--- a/app/src/components/assistant-ui/elements/message-actions.tsx
+++ /dev/null
@@ -1,111 +0,0 @@
-'use client';
-
-/**
- * Vendored from the assistant-ui `elements-message-actions` registry item
- * (https://r.assistant-ui.com/styles/base-nova/elements-message-actions.json).
- * Changes from upstream:
- * - `cn` import path (`@/components/assistant-ui/lib/utils`).
- * - Every `aria-label` is now a prop (`copyLabel`, `copiedLabel`,
- * `helpfulLabel`, `unhelpfulLabel`, `regenerateLabel`, `moreLabel`) with
- * the existing English text as its default, for `useT()`.
- */
-import { cn } from '@/components/assistant-ui/lib/utils';
-import {
- CheckIcon,
- CopyIcon,
- EllipsisIcon,
- RefreshCwIcon,
- ThumbsDownIcon,
- ThumbsUpIcon,
-} from 'lucide-react';
-import type { ComponentProps } from 'react';
-
-import { ghostButton, iconSwap, iconSwapIn, iconSwapOut } from './surfaces';
-
-export type Reaction = 'up' | 'down' | null;
-
-export interface MessageActionsProps extends Omit<ComponentProps<'div'>, 'children'> {
- copied: boolean;
- reaction: Reaction;
- regenerating: boolean;
- onCopy: () => void;
- onReactionChange: (reaction: Reaction) => void;
- onRegenerate: () => void;
- onMore: () => void;
- copyLabel?: string;
- copiedLabel?: string;
- helpfulLabel?: string;
- unhelpfulLabel?: string;
- regenerateLabel?: string;
- moreLabel?: string;
-}
-
-export function MessageActions({
- copied,
- reaction,
- regenerating,
- onCopy,
- onReactionChange,
- onRegenerate,
- onMore,
- copyLabel = 'Copy response',
- copiedLabel = 'Copied response',
- helpfulLabel = 'Mark response helpful',
- unhelpfulLabel = 'Mark response unhelpful',
- regenerateLabel = 'Regenerate response',
- moreLabel = 'More response actions',
- className,
- ...props
-}: MessageActionsProps) {
- const buttonClassName = cn(ghostButton, 'size-7');
-
- return (
- <div
- data-slot="message-actions"
- className={cn('flex items-center gap-1', className)}
- {...props}>
- <button
- type="button"
- aria-label={copied ? copiedLabel : copyLabel}
- onClick={onCopy}
- className={cn(buttonClassName, 'grid place-items-center', copied && 'text-emerald-500')}>
- <CopyIcon className={cn(iconSwap, 'size-3.5', copied ? iconSwapOut : iconSwapIn)} />
- <CheckIcon className={cn(iconSwap, 'size-3.5', copied ? iconSwapIn : iconSwapOut)} />
- </button>
- <button
- type="button"
- aria-label={helpfulLabel}
- aria-pressed={reaction === 'up'}
- onClick={() => onReactionChange(reaction === 'up' ? null : 'up')}
- className={cn(
- buttonClassName,
- reaction === 'up' && 'bg-foreground/[0.06] text-foreground/90 dark:bg-foreground/[0.09]'
- )}>
- <ThumbsUpIcon className="size-3.5" />
- </button>
- <button
- type="button"
- aria-label={unhelpfulLabel}
- aria-pressed={reaction === 'down'}
- onClick={() => onReactionChange(reaction === 'down' ? null : 'down')}
- className={cn(
- buttonClassName,
- reaction === 'down' && 'bg-foreground/[0.06] text-foreground/90 dark:bg-foreground/[0.09]'
- )}>
- <ThumbsDownIcon className="size-3.5" />
- </button>
- <button
- type="button"
- aria-label={regenerateLabel}
- onClick={onRegenerate}
- className={buttonClassName}>
- <RefreshCwIcon
- className={cn('size-3.5', regenerating && 'animate-spin motion-reduce:animate-none')}
- />
- </button>
- <button type="button" aria-label={moreLabel} onClick={onMore} className={buttonClassName}>
- <EllipsisIcon className="size-3.5" />
- </button>
- </div>
- );
-}
diff --git a/app/src/components/assistant-ui/elements/message-timing.tsx b/app/src/components/assistant-ui/elements/message-timing.tsx
deleted file mode 100644
index 47ae2604d8..0000000000
--- a/app/src/components/assistant-ui/elements/message-timing.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-'use client';
-
-/**
- * Vendored from the assistant-ui `message-timing` registry item
- * (https://r.assistant-ui.com/styles/base-nova/message-timing.json).
- * Changes from upstream:
- * - `cn` import path (`@/components/assistant-ui/lib/utils`).
- */
-import { cn } from '@/components/assistant-ui/lib/utils';
-import type { ComponentProps } from 'react';
-
-import { mono } from './surfaces';
-
-export interface TimingStat {
- label: string;
- value: string;
-}
-
-export function MessageTiming({
- stats,
- streaming,
- className,
- ...props
-}: Omit<ComponentProps<'div'>, 'children' | 'stats' | 'streaming'> & {
- stats: readonly TimingStat[];
- streaming?: boolean;
-}) {
- return (
- <div
- data-slot="message-timing"
- className={cn(
- 'fade-in animate-in flex w-full max-w-sm flex-wrap items-center gap-x-3 gap-y-1 duration-500',
- className
- )}
- {...props}>
- {stats.map(stat => (
- <span key={stat.label} className="flex items-baseline gap-1">
- <span className={cn(mono, 'text-foreground/25')}>{stat.label}</span>
- <span
- className={cn(
- mono,
- 'tabular-nums',
- streaming ? 'text-blue-500 dark:text-blue-400' : 'text-foreground/50'
- )}>
- {stat.value}
- </span>
- </span>
- ))}
- </div>
- );
-}
diff --git a/app/src/components/assistant-ui/elements/streaming-text.tsx b/app/src/components/assistant-ui/elements/streaming-text.tsx
deleted file mode 100644
index 3556a0d60e..0000000000
--- a/app/src/components/assistant-ui/elements/streaming-text.tsx
+++ /dev/null
@@ -1,69 +0,0 @@
-'use client';
-
-/**
- * Vendored from the assistant-ui `elements-streaming-text` registry item
- * (https://r.assistant-ui.com/styles/base-nova/elements-streaming-text.json).
- * Changes from upstream:
- * - `cn` import path (`@/components/assistant-ui/lib/utils`).
- */
-import { cn } from '@/components/assistant-ui/lib/utils';
-import { type ComponentProps, useMemo } from 'react';
-
-import { take } from '../utils/range';
-
-export interface Segment {
- text: string;
- mono?: boolean;
-}
-
-export function StreamingText({
- segments,
- count,
- streaming,
- className,
- ...props
-}: Omit<ComponentProps<'p'>, 'children' | 'segments' | 'count' | 'streaming'> & {
- segments: Segment[];
- count: number;
- streaming: boolean;
-}) {
- const words = useMemo(
- () =>
- segments.flatMap(segment =>
- segment.text.split(' ').map(word => ({ word, mono: segment.mono ?? false }))
- ),
- [segments]
- );
- const shown = take(words, count);
-
- return (
- <p
- data-slot="streaming-text"
- className={cn('min-h-[8.5rem] max-w-sm text-sm leading-relaxed text-pretty', className)}
- {...props}>
- {shown.map(({ word, mono: isMono }, i) => {
- const fresh = streaming && shown.length - 1 - i < 2;
- return (
- <span
- key={i}
- className="fade-in animate-in fill-mode-both duration-500 motion-reduce:animate-none">
- <span
- className={cn(
- 'transition-colors duration-700 motion-reduce:transition-none',
- fresh && 'text-blue-500 dark:text-blue-400',
- isMono && 'bg-foreground/[0.06] rounded-md px-1.5 py-0.5 font-mono text-[0.85em]'
- )}>
- {word}
- </span>{' '}
- </span>
- );
- })}
- {streaming && shown.length > 0 && (
- <span
- aria-hidden
- className="-mb-0.5 ml-0.5 inline-block h-4 w-0.5 animate-pulse rounded-full bg-blue-500 dark:bg-blue-400"
- />
- )}
- </p>
- );
-}
diff --git a/app/src/components/assistant-ui/elements/thinking-indicator.tsx b/app/src/components/assistant-ui/elements/thinking-indicator.tsx
deleted file mode 100644
index e19224cb5b..0000000000
--- a/app/src/components/assistant-ui/elements/thinking-indicator.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-'use client';
-
-/**
- * Vendored from the assistant-ui `elements-thinking-indicator` registry item
- * (https://r.assistant-ui.com/styles/base-nova/elements-thinking-indicator.json).
- * Changes from upstream:
- * - `cn` import path (`@/components/assistant-ui/lib/utils`).
- */
-import { cn } from '@/components/assistant-ui/lib/utils';
-import type { ComponentProps } from 'react';
-
-import { mono, ShimmerLabel } from './surfaces';
-
-export function ThinkingIndicator({
- label,
- elapsed,
- className,
- ...props
-}: Omit<ComponentProps<'div'>, 'children' | 'label' | 'elapsed'> & {
- label: string;
- elapsed?: string;
-}) {
- return (
- <div
- data-slot="thinking-indicator"
- className={cn('text-foreground/55 flex items-center gap-2.5 text-sm', className)}
- {...props}>
- <span
- aria-hidden
- className="size-1.5 shrink-0 animate-pulse rounded-full bg-blue-500 motion-reduce:animate-none dark:bg-blue-400"
- />
- <ShimmerLabel
- key={label}
- className="fade-in slide-in-from-bottom-1 animate-in relative inline-block leading-none duration-300">
- {label}
- </ShimmerLabel>
- {elapsed !== undefined && (
- <span className={cn(mono, 'text-foreground/30 tabular-nums')}>{elapsed}</span>
- )}
- </div>
- );
-}
diff --git a/app/src/components/assistant-ui/elements/typing-indicator.tsx b/app/src/components/assistant-ui/elements/typing-indicator.tsx
deleted file mode 100644
index f58d70c236..0000000000
--- a/app/src/components/assistant-ui/elements/typing-indicator.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-'use client';
-
-/**
- * Vendored from the assistant-ui `elements-typing-indicator` registry item
- * (https://r.assistant-ui.com/styles/base-nova/elements-typing-indicator.json).
- * Changes from upstream:
- * - `cn` import path (`@/components/assistant-ui/lib/utils`).
- * - `aria-label` is a `label` prop with an English default, for `useT()`.
- */
-import { cn } from '@/components/assistant-ui/lib/utils';
-import type { ComponentProps } from 'react';
-
-import { paper } from './surfaces';
-
-const DOT_DELAYS = ['-0.32s', '-0.16s', '0s'];
-
-export function TypingIndicator({
- variant = 'bubble',
- label = 'Assistant is typing',
- className,
- ...props
-}: Omit<ComponentProps<'div'>, 'children' | 'variant' | 'role' | 'aria-label'> & {
- variant?: 'bubble' | 'bare';
- label?: string;
-}) {
- const dots = DOT_DELAYS.map(delay => (
- <span
- key={delay}
- aria-hidden
- className="bg-foreground/40 size-1.5 animate-bounce rounded-full motion-reduce:animate-none"
- style={{ animationDelay: delay, animationDuration: '1.1s' }}
- />
- ));
-
- if (variant === 'bare') {
- return (
- <div
- data-slot="typing-indicator"
- data-variant="bare"
- role="status"
- aria-label={label}
- className={cn('flex gap-1', className)}
- {...props}>
- {dots}
- </div>
- );
- }
-
- return (
- <div
- data-slot="typing-indicator"
- data-variant="bubble"
- className={cn(paper, 'w-fit rounded-full px-4 py-3.5', className)}
- {...props}>
- <div role="status" aria-label={label} className="flex gap-1">
- {dots}
- </div>
- </div>
- );
-}