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
feat(ui): show clickable artifact cards + preview panel for ready artifacts
Sanile053d18a5898
diff --git a/app/src/features/conversations/Conversations.tsx b/app/src/features/conversations/Conversations.tsxindex 89adf19fc4..5c3c75578a 100644--- a/app/src/features/conversations/Conversations.tsx+++ b/app/src/features/conversations/Conversations.tsx@@ -11,6 +11,7 @@ import WorkflowProposalCard from '../../components/chat/WorkflowProposalCard';import { ConfirmationModal } from '../../components/intelligence/ConfirmationModal';import { SidebarContent } from '../../components/layout/shell/SidebarSlot';import { ArtifactCardAdapter } from '../../features/conversations/aui/ArtifactCardAdapter';+import { ArtifactPreviewPanel } from '../../features/conversations/aui/ArtifactPreviewPanel';import { ContextUsage } from '../../features/conversations/aui/ContextUsage';import { PlanReviewCardCore } from '../../features/conversations/aui/PlanReviewPart';import { useRunMode } from '../../features/conversations/aui/useRunMode';@@ -259,6 +260,7 @@ const Conversations = ({projectThreadList = false,}: ConversationsProps = {}) => {const [composerOverride, setComposerOverride] = useState<'mic-cloud' | 'text' | null>(null);+ const [previewArtifactId, setPreviewArtifactId] = useState<string | null>(null);const composer = composerOverride ?? composerProp;const { t } = useT();const dispatch = useAppDispatch();@@ -2153,9 +2155,11 @@ const Conversations = ({// Only artifacts with NO owning tool call belong in the header deck — one// with a `toolCallId` renders inline through its own tool-call card// (`MediaAndDocumentCalls.tsx`) instead, per the `ArtifactCardAdapter` doc.+ // We ALSO keep ready artifacts visible as clickable cards (not just the+ // ChatFilesChip count) so the user can open live artifact previews.const liveArtifacts = artifactDeckThreadId? (artifactsByThread[artifactDeckThreadId] ?? []).filter(- a => a.status !== 'ready' && !a.toolCallId+ a => !a.toolCallId && (a.status === 'in_progress' || a.status === 'ready')): [];const liveArtifactDeck =@@ -2170,6 +2174,7 @@ const Conversations = ({console.warn('[artifact] regenerate failed:', err);});}}+ onOpenPreview={setPreviewArtifactId}/>))}</div>@@ -2212,6 +2217,12 @@ const Conversations = ({{stallWarningBanner}{sendAdvisoryBanner}{liveArtifactDeck}+ {previewArtifactId && (+ <ArtifactPreviewPanel+ artifactId={previewArtifactId}+ onClose={() => setPreviewArtifactId(null)}+ />+ )}{/* The core's run queue for this thread; renders nothing while empty. */}<ComposerMessageQueue />{/* Where this conversation works. Last, so it sits directly on thediff --git a/app/src/features/conversations/aui/ArtifactCardAdapter.tsx b/app/src/features/conversations/aui/ArtifactCardAdapter.tsxindex 4c27a99e18..024853b4a8 100644--- a/app/src/features/conversations/aui/ArtifactCardAdapter.tsx+++ b/app/src/features/conversations/aui/ArtifactCardAdapter.tsx@@ -37,20 +37,32 @@ export interface ArtifactCardAdapterProps {artifact: ArtifactSnapshot;/** When provided, render a Retry affordance on the `failed` state. */onRetry?: (artifactId: string) => void;+ /** When provided, clicking a ready artifact opens the preview panel. */+ onOpenPreview?: (artifactId: string) => void;}-export function ArtifactCardAdapter({ artifact, onRetry }: ArtifactCardAdapterProps) {+export function ArtifactCardAdapter({ artifact, onRetry, onOpenPreview }: ArtifactCardAdapterProps) {const { t } = useT();const generating = artifact.status === 'in_progress';+ const isReady = artifact.status === 'ready';const meta =- artifact.status === 'ready' && artifact.sizeBytes != null+ isReady && artifact.sizeBytes != null? `${t('chat.artifact.ready')} · ${formatFileSize(artifact.sizeBytes)}`: artifact.status === 'failed'? t('chat.artifact.failed'): '';+ const handleClick = () => {+ if (isReady && onOpenPreview) {+ onOpenPreview(artifact.artifactId);+ }+ };+return (- <div className="flex flex-col items-start gap-1.5" data-testid="artifact-card-adapter">+ <div+ className={'flex flex-col items-start gap-1.5' + (isReady ? ' cursor-pointer' : '')}+ data-testid="artifact-card-adapter"+ ><ArtifactCardtitle={artifact.title}meta={meta}@@ -58,6 +70,7 @@ export function ArtifactCardAdapter({ artifact, onRetry }: ArtifactCardAdapterPrwords={0}writingLabel={t('conversations.tools.working')}icon={KIND_ICONS[artifact.kind]}+ onOpen={isReady && onOpenPreview ? () => onOpenPreview(artifact.artifactId) : undefined}/>{artifact.status === 'failed' && onRetry ? (<Buttondiff --git a/app/src/features/conversations/aui/ArtifactPreviewPanel.tsx b/app/src/features/conversations/aui/ArtifactPreviewPanel.tsxnew file mode 100644index 0000000000..38474435bf--- /dev/null+++ b/app/src/features/conversations/aui/ArtifactPreviewPanel.tsx@@ -0,0 +1,79 @@+'use client';++import { X } from 'lucide-react';+import { useMemo } from 'react';++import { Button } from '../../../components/ui';+import { useT } from '../../../lib/i18n/I18nContext';+import { useAppSelector } from '../../../store/hooks';+import type { ArtifactSnapshot } from '../../../store/chatRuntimeSlice';++interface ArtifactPreviewPanelProps {+ artifactId: string;+ onClose: () => void;+}++export function ArtifactPreviewPanel({ artifactId, onClose }: ArtifactPreviewPanelProps) {+ const { t } = useT();+ const artifactsByThread = useAppSelector(state => state.chatRuntime.artifactsByThread);++ const artifact = useMemo<ArtifactSnapshot | undefined>(() => {+ for (const threadArtifacts of Object.values(artifactsByThread)) {+ const found = threadArtifacts.find(a => a.artifactId === artifactId);+ if (found) return found;+ }+ return undefined;+ }, [artifactsByThread, artifactId]);++ if (!artifact) {+ return (+ <div className="fixed inset-y-0 right-0 z-50 w-[480px] border-l bg-background shadow-xl">+ <div className="flex items-center justify-between border-b px-4 py-3">+ <span className="text-sm font-medium">{t('chat.artifact.preview')}</span>+ <Button variant="ghost" size="xs" onClick={onClose}><X className="h-4 w-4" /></Button>+ </div>+ <div className="p-4 text-sm text-muted-foreground">{t('chat.artifact.notFound')}</div>+ </div>+ );+ }++ return (+ <div className="fixed inset-y-0 right-0 z-50 w-[480px] border-l bg-background shadow-xl flex flex-col">+ <div className="flex items-center justify-between border-b px-4 py-3 shrink-0">+ <div className="flex flex-col gap-0.5">+ <span className="text-sm font-medium">{artifact.title}</span>+ <span className="text-xs text-muted-foreground">{artifact.kind}</span>+ </div>+ <Button variant="ghost" size="xs" onClick={onClose}><X className="h-4 w-4" /></Button>+ </div>+ <div className="flex-1 overflow-y-auto p-4">+ <div className="rounded-lg border bg-muted/30 p-4">+ <p className="text-sm text-muted-foreground">+ Artifact ID: {artifact.artifactId}+ </p>+ <p className="text-sm text-muted-foreground">+ Status: {artifact.status}+ </p>+ {artifact.sizeBytes != null && (+ <p className="text-sm text-muted-foreground">+ Size: {formatBytes(artifact.sizeBytes)}+ </p>+ )}+ {artifact.path && (+ <p className="text-sm text-muted-foreground break-all mt-2">+ Path: {artifact.path}+ </p>+ )}+ </div>+ </div>+ </div>+ );+}++function formatBytes(bytes: number): string {+ if (bytes < 1024) return `${bytes} B`;+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;+}++export default ArtifactPreviewPanel;