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
fix(assistant-ui): remove unused element components
Steven Enamakel93b2208d1599
diff --git a/app/src/components/assistant-ui/elements/code-diff.tsx b/app/src/components/assistant-ui/elements/code-diff.tsxnew file mode 100644index 0000000000..1657d4a194--- /dev/null+++ b/app/src/components/assistant-ui/elements/code-diff.tsx@@ -0,0 +1,78 @@+'use client';++/**+ * assistant-ui's code-diff element: a file's added and removed lines.+ *+ * Vendored from assistant-ui `packages/ui/src/components/react/assistant-ui/elements/code-diff.tsx`+ * (commit 1abca347). Only the `cn` import path differs from upstream.+ */+import { cn } from '@/components/assistant-ui/lib/utils';+import type { ComponentProps } from 'react';++import { codeScroll, codeSurface, mono, paper } from './surfaces';++export type DiffKind = 'context' | 'added' | 'removed';++export interface DiffLine {+ kind: DiffKind;+ text: string;+}++const GUTTER: Record<DiffKind, string> = { context: '', added: '+', removed: '−' };++export function CodeDiff({+ filename,+ additions,+ deletions,+ lines,+ cycle,+ className,+ ...props+}: Omit<+ ComponentProps<'div'>,+ 'children' | 'filename' | 'additions' | 'deletions' | 'lines' | 'cycle'+> & {+ filename: string;+ additions: number;+ deletions: number;+ lines: readonly DiffLine[];+ cycle: number;+}) {+ return (+ <div+ data-slot="code-diff"+ className={cn(+ paper,+ 'w-full max-w-md overflow-hidden rounded-2xl font-mono text-xs',+ className+ )}+ {...props}>+ <div className="flex items-center justify-between px-4 pt-3 pb-2">+ <span className="text-foreground/90">{filename}</span>+ <span className={cn(mono, 'tabular-nums')}>+ <span className="text-emerald-600 dark:text-emerald-400">+{additions}</span>{' '}+ <span className="text-red-600 dark:text-red-400">−{deletions}</span>+ </span>+ </div>+ <div className={codeScroll}>+ <div className={codeSurface}>+ {lines.map((line, i) => (+ <div+ key={`${cycle}-${i}-${line.text}`}+ className={cn(+ 'fade-in animate-in fill-mode-both flex px-4 py-0.5 leading-relaxed whitespace-pre duration-300',+ line.kind === 'context' && 'text-foreground/45',+ line.kind === 'added' &&+ 'bg-emerald-500/10 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300',+ line.kind === 'removed' && 'bg-red-500/10 text-red-700 dark:text-red-300'+ )}+ style={{ animationDelay: `${i * 60}ms` }}>+ <span className="w-4 shrink-0 select-none">{GUTTER[line.kind]}</span>+ <span>{line.text}</span>+ </div>+ ))}+ </div>+ </div>+ </div>+ );+}diff --git a/app/src/components/assistant-ui/elements/surfaces.tsx b/app/src/components/assistant-ui/elements/surfaces.tsxindex b219532f83..7038e2e5e4 100644--- a/app/src/components/assistant-ui/elements/surfaces.tsx+++ b/app/src/components/assistant-ui/elements/surfaces.tsx@@ -12,11 +12,10 @@* - `openRotate` added: the Radix trigger reports `data-state=open`, not Base* UI's `data-open` / `data-panel-open`.*/+import { cn } from '@/components/assistant-ui/lib/utils';import type { ComponentProps, ReactNode } from 'react';import { useLayoutEffect, useRef, useState } from 'react';-import { cn } from '@/components/assistant-ui/lib/utils';-export const paper = 'bg-background border border-border/60 dark:bg-popover';export const floating = 'bg-background border border-border/60 dark:bg-popover';diff --git a/app/src/components/assistant-ui/elements/terminal-block.tsx b/app/src/components/assistant-ui/elements/terminal-block.tsxnew file mode 100644index 0000000000..a3655c1525--- /dev/null+++ b/app/src/components/assistant-ui/elements/terminal-block.tsx@@ -0,0 +1,115 @@+'use client';++/**+ * assistant-ui's terminal-block element: a command and its output lines,+ * with a spinner while it runs and an exit marker once it is done.+ *+ * Vendored from assistant-ui `packages/ui/src/components/react/assistant-ui/elements/terminal-block.tsx`+ * (commit 1abca347). Changes from upstream:+ * - `exitLabel` / `failed`: upstream always reads "exit 0" with a check.+ * - The output scrolls past `max-h-72`, and the `min-h` floor applies only+ * while output is still streaming (a settled one-line result should not+ * reserve a tall box).+ */+import { cn } from '@/components/assistant-ui/lib/utils';+import { CheckIcon, CircleXIcon, Loader2Icon } from 'lucide-react';+import type { ComponentProps } from 'react';++import { take } from '../utils/range';+import { mono, paper } from './surfaces';++export function TerminalBlock({+ command,+ lines,+ visibleCount,+ done,+ failed = false,+ exitLabel = 'exit 0',+ variant = 'paper',+ className,+ ...props+}: Omit<+ ComponentProps<'div'>,+ 'children' | 'command' | 'lines' | 'visibleCount' | 'done' | 'variant'+> & {+ command: string;+ lines: readonly string[];+ visibleCount: number;+ done: boolean;+ failed?: boolean;+ exitLabel?: string;+ variant?: 'paper' | 'ink';+}) {+ const ink = variant === 'ink';++ return (+ <div+ data-slot="terminal-block"+ className={cn(+ ink ? 'bg-foreground dark:bg-popover' : paper,+ 'w-full max-w-md overflow-hidden rounded-2xl font-mono text-xs',+ className+ )}+ {...props}>+ <div className="flex items-center justify-between gap-3 px-4 pt-3 pb-1.5">+ <span+ className={cn(+ 'min-w-0 break-all',+ ink ? 'text-background/90 dark:text-foreground/90' : 'text-foreground/90'+ )}>+ {command}+ </span>+ {done ? (+ <div className="flex shrink-0 items-center gap-1">+ {failed ? (+ <CircleXIcon className="size-3 text-red-500" />+ ) : (+ <CheckIcon className="size-3 text-emerald-500" />+ )}+ <span+ className={cn(+ mono,+ ink ? 'text-background/40 dark:text-foreground/40' : 'text-foreground/40'+ )}>+ {exitLabel}+ </span>+ </div>+ ) : (+ <Loader2Icon+ className={cn(+ 'size-3 shrink-0 animate-spin motion-reduce:animate-none',+ ink ? 'text-background/35 dark:text-foreground/35' : 'text-foreground/35'+ )}+ />+ )}+ </div>+ <div+ className={cn(+ 'flex max-h-72 flex-col gap-1 overflow-auto px-4 pt-1 pb-3.5 whitespace-pre-wrap break-all',+ !done && 'min-h-[8.5rem]',+ ink ? 'text-background/55 dark:text-foreground/50' : 'text-foreground/50'+ )}>+ {take(lines, visibleCount).map((line, i) => {+ const isLast = i === lines.length - 1;+ return (+ <div+ key={`${i}-${line}`}+ className={cn(+ 'fade-in animate-in fill-mode-both duration-300',+ isLast &&+ (ink ? 'text-background/90 dark:text-foreground/90' : 'text-foreground/90')+ )}>+ {line}+ </div>+ );+ })}+ {!done && (+ <span+ aria-hidden+ className="inline-block h-3 w-1.5 animate-pulse bg-blue-500/70 motion-reduce:animate-none dark:bg-blue-400/70"+ />+ )}+ </div>+ </div>+ );+}diff --git a/app/src/components/assistant-ui/elements/tool-call.tsx b/app/src/components/assistant-ui/elements/tool-call.tsxindex 5ce7d01135..7954394185 100644--- a/app/src/components/assistant-ui/elements/tool-call.tsx+++ b/app/src/components/assistant-ui/elements/tool-call.tsx@@ -18,15 +18,14 @@* decision the turn is blocked on must not sit behind a disclosure.* - The panel headings are props, for translation.*/-import { CheckIcon, ChevronRightIcon, CircleXIcon } from 'lucide-react';-import type { ReactNode } from 'react';-import { cn } from '@/components/assistant-ui/lib/utils';import {Collapsible,CollapsibleContent,CollapsibleTrigger,} from '@/components/assistant-ui/ui/collapsible';+import { CheckIcon, ChevronRightIcon, CircleXIcon } from 'lucide-react';+import type { ReactNode } from 'react';import { collapsePanel, field, mono, openRotate, ShimmerLabel, SwapLabel } from './surfaces';@@ -87,11 +86,7 @@ export function ToolCall({disabled={!hasPanel}className="group/trigger text-foreground/55 hover:text-foreground/90 flex w-full min-w-0 items-center gap-2 rounded-md py-1 text-[13.5px] transition-colors outline-none"><ChevronRightIcon- className={cn(- 'size-3.5 shrink-0 opacity-60',- openRotate,- !hasPanel && 'invisible'- )}+ className={cn('size-3.5 shrink-0 opacity-60', openRotate, !hasPanel && 'invisible')}/>{icon}<SwapLabel active={running ? 0 : 1} className="shrink-0 text-start">diff --git a/app/src/components/assistant-ui/elements/tool-timeline.tsx b/app/src/components/assistant-ui/elements/tool-timeline.tsxindex 9eafba5d9e..0eecbd42be 100644--- a/app/src/components/assistant-ui/elements/tool-timeline.tsx+++ b/app/src/components/assistant-ui/elements/tool-timeline.tsx@@ -13,15 +13,14 @@* element (it expands, carries approvals), not only a verb and a chip.* - Step keys are positional; two steps may share a chip.*/-import { ChevronRightIcon, type LucideIcon } from 'lucide-react';-import type { ReactNode } from 'react';-import { cn } from '@/components/assistant-ui/lib/utils';import {Collapsible,CollapsibleContent,CollapsibleTrigger,} from '@/components/assistant-ui/ui/collapsible';+import { ChevronRightIcon, type LucideIcon } from 'lucide-react';+import type { ReactNode } from 'react';import { take } from '../utils/range';import { collapsePanel, openRotate, ShimmerLabel, SwapLabel } from './surfaces';diff --git a/app/src/components/assistant-ui/elements/web-preview.tsx b/app/src/components/assistant-ui/elements/web-preview.tsxnew file mode 100644index 0000000000..98d818b771--- /dev/null+++ b/app/src/components/assistant-ui/elements/web-preview.tsx@@ -0,0 +1,101 @@+'use client';++/**+ * assistant-ui's web-preview element: a URL bar with reload and open-in-new+ * around preview content.+ *+ * Vendored from assistant-ui `packages/ui/src/components/react/assistant-ui/elements/web-preview.tsx`+ * (commit 1abca347). Changes from upstream: the reload button renders only+ * when `onReload` is given (a fetched page has nothing to reload), and the+ * button and loading labels are props, for translation.+ */+import { cn } from '@/components/assistant-ui/lib/utils';+import { ExternalLinkIcon, RotateCwIcon } from 'lucide-react';+import type { ComponentProps } from 'react';++import { field, ghostButton, mono, paper, ShimmerLabel } from './surfaces';++/**+ * Chrome around a preview: a URL bar, reload, and open-in-new. It renders+ * `children` as given and enforces no isolation of its own, so the caller is+ * responsible for passing an already-sandboxed frame.+ */+export function WebPreview({+ origin,+ loading,+ children,+ onReload,+ onOpenExternal,+ reloadLabel = 'Reload the preview',+ openExternalLabel = 'Open the preview in a new tab',+ loadingLabel = 'Loading preview',+ className,+ ...props+}: Omit<+ ComponentProps<'div'>,+ 'origin' | 'loading' | 'children' | 'onReload' | 'onOpenExternal'+> & {+ origin: string;+ loading: boolean;+ children: React.ReactNode;+ onReload?: () => void;+ onOpenExternal?: () => void;+ reloadLabel?: string;+ openExternalLabel?: string;+ loadingLabel?: string;+}) {+ return (+ <div+ data-slot="web-preview"+ className={cn(paper, 'flex w-full max-w-md flex-col overflow-hidden rounded-2xl', className)}+ {...props}>+ <div className="flex items-center gap-1.5 px-2.5 py-2">+ {onReload ? (+ <button+ type="button"+ aria-label={reloadLabel}+ onClick={onReload}+ className={cn(ghostButton, 'size-7 shrink-0')}>+ <RotateCwIcon+ className={cn('size-3.5', loading && 'animate-spin motion-reduce:animate-none')}+ />+ </button>+ ) : null}++ <span+ className={cn(+ field,+ 'flex min-w-0 flex-1 items-center gap-1.5 rounded-full px-2.5 py-1'+ )}>+ <span className={cn(mono, 'text-foreground/45 min-w-0 truncate')}>{origin}</span>+ </span>++ <button+ type="button"+ aria-label={openExternalLabel}+ onClick={onOpenExternal}+ className={cn(ghostButton, 'size-7 shrink-0')}>+ <ExternalLinkIcon className="size-3.5" />+ </button>+ </div>++ <div className="border-foreground/[0.07] relative min-h-[9rem] border-t">+ <div+ aria-hidden={loading}+ className={cn(+ 'transition-opacity duration-300 motion-reduce:transition-none',+ loading && 'invisible opacity-0'+ )}>+ {children}+ </div>+ {loading && (+ <div className="absolute inset-0 flex items-center justify-center">+ <ShimmerLabel className="text-foreground/40 relative inline-block text-xs leading-none">+ {loadingLabel}+ </ShimmerLabel>+ </div>+ )}+ </div>+ </div>+ );+}diff --git a/app/src/components/assistant-ui/elements/web-search.tsx b/app/src/components/assistant-ui/elements/web-search.tsxindex 0d06f44177..ac97630fc5 100644--- a/app/src/components/assistant-ui/elements/web-search.tsx+++ b/app/src/components/assistant-ui/elements/web-search.tsx@@ -14,11 +14,10 @@* - Result keys include the URL: two hits often share a domain.* - The empty-results floor (`min-h`) applies only while hits are expected.*/+import { cn } from '@/components/assistant-ui/lib/utils';import { SearchIcon } from 'lucide-react';import type { ComponentProps, ReactNode } from 'react';-import { cn } from '@/components/assistant-ui/lib/utils';-import { take } from '../utils/range';import { field, mono, ShimmerLabel } from './surfaces';