Skip to content

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

fix: correct import ordering and simplify conditional logic across UI components

Steven Enamakelfbecaf245e32
diff --git a/app/src/components/assistant-ui/activity-group.tsx b/app/src/components/assistant-ui/activity-group.tsx
index 5e67e3aa03..a30eb4e0ab 100644
--- a/app/src/components/assistant-ui/activity-group.tsx
+++ b/app/src/components/assistant-ui/activity-group.tsx
@@ -10,12 +10,12 @@
* activity, rather than a separate collapsible per part type. See the
* `ActivityGroup` doc comment below for why.
*/
-import { OpenHumanReasoningGroup } from '@/components/assistant-ui/reasoning-group';
import {
ToolGroupContent,
ToolGroupRoot,
ToolGroupTrigger,
} from '@/components/assistant-ui/elements/tool-group';
+import { OpenHumanReasoningGroup } from '@/components/assistant-ui/reasoning-group';
import { type MessagePrimitive, useAuiState } from '@assistant-ui/react';
import { type FC, type PropsWithChildren, useState } from 'react';
diff --git a/app/src/components/assistant-ui/elements/artifact-card.tsx b/app/src/components/assistant-ui/elements/artifact-card.tsx
index 962c60ceaf..ed404c3383 100644
--- a/app/src/components/assistant-ui/elements/artifact-card.tsx
+++ b/app/src/components/assistant-ui/elements/artifact-card.tsx
@@ -17,13 +17,15 @@
* - `onOpen` replaces upstream's implicit "the whole card is a link" with an
* explicit handler; the card renders as a `<button>` when present.
*/
-import type { ComponentProps, ElementType } from 'react';
-import { ArrowUpRightIcon, FileTextIcon } from 'lucide-react';
-import { cn } from '@/components/assistant-ui/lib/utils';
import { mono, paper, ShimmerLabel } from '@/components/assistant-ui/elements/surfaces';
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { ArrowUpRightIcon, FileTextIcon } from 'lucide-react';
+import type { ComponentProps, ElementType } from 'react';
-export interface ArtifactCardProps
- extends Omit<ComponentProps<'div'>, 'children' | 'title' | 'meta' | 'generating' | 'words'> {
+export interface ArtifactCardProps extends Omit<
+ ComponentProps<'div'>,
+ 'children' | 'title' | 'meta' | 'generating' | 'words'
+> {
title: string;
meta: string;
generating?: boolean;
@@ -108,7 +110,9 @@ function ArtifactCardBody({
<p className="truncate text-[13.5px] font-medium">{title}</p>
{generating ? (
<p className={cn(mono, 'text-foreground/40 flex items-center gap-1')}>
- <ShimmerLabel className="relative inline-block leading-none">{writingLabel}</ShimmerLabel>
+ <ShimmerLabel className="relative inline-block leading-none">
+ {writingLabel}
+ </ShimmerLabel>
<span>·</span>
<span className="tabular-nums">{words} words</span>
</p>
diff --git a/app/src/components/assistant-ui/elements/data-table.tsx b/app/src/components/assistant-ui/elements/data-table.tsx
index 8f822b6e83..13afcb2c2b 100644
--- a/app/src/components/assistant-ui/elements/data-table.tsx
+++ b/app/src/components/assistant-ui/elements/data-table.tsx
@@ -17,8 +17,8 @@
* - `avatarKey` picks which column seeds the leading letter avatar (defaults
* to the first column) instead of assuming a `name` field.
*/
-import { cn } from '@/components/assistant-ui/lib/utils';
import { mono, paper } from '@/components/assistant-ui/elements/surfaces';
+import { cn } from '@/components/assistant-ui/lib/utils';
import type { ComponentProps, ReactNode } from 'react';
export interface DataTableColumn<TRow> {
@@ -94,7 +94,9 @@ export function DataTable<TRow>({
<span
key={column.key}
className={cn(
- column === avatarColumn ? 'text-foreground/90 truncate' : cn(mono, 'text-foreground/55 tabular-nums'),
+ column === avatarColumn
+ ? 'text-foreground/90 truncate'
+ : cn(mono, 'text-foreground/55 tabular-nums'),
column.align === 'end' ? 'w-16 text-end' : 'flex-1'
)}>
{column.cell(row, index)}
diff --git a/app/src/components/assistant-ui/elements/image-generation.tsx b/app/src/components/assistant-ui/elements/image-generation.tsx
index 37188099c9..fac3406bb2 100644
--- a/app/src/components/assistant-ui/elements/image-generation.tsx
+++ b/app/src/components/assistant-ui/elements/image-generation.tsx
@@ -17,15 +17,22 @@
* - `dimensions` prop (default `"1024 × 1024"`) replaces the hardcoded size
* label, since OpenHuman's image tool can return other sizes.
*/
-import type { ComponentProps } from 'react';
-import { RefreshCwIcon } from 'lucide-react';
+import {
+ ghostButton,
+ mono,
+ paper,
+ ShimmerLabel,
+} from '@/components/assistant-ui/elements/surfaces';
import { cn } from '@/components/assistant-ui/lib/utils';
-import { ghostButton, mono, paper, ShimmerLabel } from '@/components/assistant-ui/elements/surfaces';
+import { RefreshCwIcon } from 'lucide-react';
+import type { ComponentProps } from 'react';
const DOTS = Array.from({ length: 64 }, (_, i) => i);
-export interface ImageGenerationProps
- extends Omit<ComponentProps<'div'>, 'children' | 'prompt' | 'generating'> {
+export interface ImageGenerationProps extends Omit<
+ ComponentProps<'div'>,
+ 'children' | 'prompt' | 'generating'
+> {
prompt: string;
generating: boolean;
dimensions?: string;
@@ -45,7 +52,10 @@ export function ImageGeneration({
...props
}: ImageGenerationProps) {
return (
- <div data-slot="image-generation" className={cn('flex w-52 flex-col gap-2.5', className)} {...props}>
+ <div
+ data-slot="image-generation"
+ className={cn('flex w-52 flex-col gap-2.5', className)}
+ {...props}>
<div className={cn(paper, 'relative aspect-square w-full overflow-hidden rounded-2xl')}>
<div className="absolute inset-0 grid grid-cols-8 place-items-center p-6" aria-hidden>
{DOTS.map(dot => {
@@ -96,7 +106,11 @@ export function ImageGeneration({
aria-label={regenerateLabel}
disabled={!onRegenerate}
onClick={onRegenerate}
- className={cn(ghostButton, 'size-6 shrink-0', generating && 'pointer-events-none opacity-0')}>
+ className={cn(
+ ghostButton,
+ 'size-6 shrink-0',
+ generating && 'pointer-events-none opacity-0'
+ )}>
<RefreshCwIcon className="size-3" />
</button>
</div>
diff --git a/app/src/features/conversations/aui/MediaAndDocumentCalls.tsx b/app/src/features/conversations/aui/MediaAndDocumentCalls.tsx
index c6ad675b15..112e75bf35 100644
--- a/app/src/features/conversations/aui/MediaAndDocumentCalls.tsx
+++ b/app/src/features/conversations/aui/MediaAndDocumentCalls.tsx
@@ -2,8 +2,8 @@ import type { ToolCallMessagePartComponent } from '@assistant-ui/react';
import { FileTextIcon, PresentationIcon } from 'lucide-react';
import { ArtifactCard } from '../../../components/assistant-ui/elements/artifact-card';
-import { ImageGeneration } from '../../../components/assistant-ui/elements/image-generation';
import { Image } from '../../../components/assistant-ui/elements/image';
+import { ImageGeneration } from '../../../components/assistant-ui/elements/image-generation';
import { useT } from '../../../lib/i18n/I18nContext';
/**
@@ -27,9 +27,7 @@ function asMediaArtifacts(result: unknown): MediaArtifact[] | undefined {
if (!result || typeof result !== 'object') return undefined;
const artifacts = (result as { artifacts?: unknown }).artifacts;
if (!Array.isArray(artifacts)) return undefined;
- return artifacts.filter(
- (a): a is MediaArtifact => typeof a === 'object' && a !== null
- );
+ return artifacts.filter((a): a is MediaArtifact => typeof a === 'object' && a !== null);
}
/**
@@ -47,7 +45,10 @@ function asMediaArtifacts(result: unknown): MediaArtifact[] | undefined {
* skips the artifact rather than guessing a path.
*/
export const MediaGenerationCall: ToolCallMessagePartComponent = ({ args, result, status }) => {
- const prompt = typeof (args as { prompt?: unknown })?.prompt === 'string' ? (args as { prompt: string }).prompt : '';
+ const prompt =
+ typeof (args as { prompt?: unknown })?.prompt === 'string'
+ ? (args as { prompt: string }).prompt
+ : '';
const running = status?.type === 'running';
const artifacts = asMediaArtifacts(result) ?? [];
@@ -111,7 +112,11 @@ export const DocumentArtifactCall: ToolCallMessagePartComponent = ({
// No live token count from the core mid-generation; approximate from the
// args payload so the shimmering "N words" line has something to show
// rather than staying frozen at zero.
- const words = running ? JSON.stringify(args ?? '').split(/\s+/).filter(Boolean).length : 0;
+ const words = running
+ ? JSON.stringify(args ?? '')
+ .split(/\s+/)
+ .filter(Boolean).length
+ : 0;
const meta =
typeof (result as { path?: unknown })?.path === 'string'
diff --git a/app/src/features/conversations/aui/PlanReviewPart.tsx b/app/src/features/conversations/aui/PlanReviewPart.tsx
index 857ccbba18..f39f14a707 100644
--- a/app/src/features/conversations/aui/PlanReviewPart.tsx
+++ b/app/src/features/conversations/aui/PlanReviewPart.tsx
@@ -61,7 +61,7 @@ export function PlanReviewCardCore({
const [errorMsg, setErrorMsg] = useState<string | null>(null);
const matched = activeIndexFromTodos(review.steps, todos);
- const activeIndex = matched && matched > 0 ? matched : matched === 0 ? 0 : 0;
+ const activeIndex = matched === null ? 0 : matched;
const decide = useCallback(
async (decision: Decision, feedbackText?: string) => {
diff --git a/app/src/features/conversations/aui/toolkit.tsx b/app/src/features/conversations/aui/toolkit.tsx
index a242fe59d7..d768d3b9ed 100644
--- a/app/src/features/conversations/aui/toolkit.tsx
+++ b/app/src/features/conversations/aui/toolkit.tsx
@@ -79,11 +79,7 @@ export function openHumanToolEntries(): Record<string, OpenHumanToolEntry> {
* card` element.
*/
generate_document: { type: 'backend', display: 'standalone', render: DocumentArtifactCall },
- generate_presentation: {
- type: 'backend',
- display: 'standalone',
- render: DocumentArtifactCall,
- },
+ generate_presentation: { type: 'backend', display: 'standalone', render: DocumentArtifactCall },
/**
* Memory writes/reads, rendered as `memory-chips` instead of the raw
diff --git a/app/src/features/conversations/tools/ToolDataView.tsx b/app/src/features/conversations/tools/ToolDataView.tsx
index 8dd6855d6d..7a1ba5dad6 100644
--- a/app/src/features/conversations/tools/ToolDataView.tsx
+++ b/app/src/features/conversations/tools/ToolDataView.tsx
@@ -1,4 +1,7 @@
-import { DataTable, type DataTableColumn } from '../../../components/assistant-ui/elements/data-table';
+import {
+ DataTable,
+ type DataTableColumn,
+} from '../../../components/assistant-ui/elements/data-table';
import { BubbleMarkdown } from '../components/AgentMessageBubble';
/**
@@ -26,7 +29,9 @@ function isFlatObjectArray(value: unknown[]): value is FlatRow[] {
v => v === null || typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean'
);
if (!value.every(isFlatRow)) return false;
- const keys = Object.keys(value[0] as FlatRow).sort().join('\u0000');
+ const keys = Object.keys(value[0] as FlatRow)
+ .sort()
+ .join('\u0000');
return value.every(row => Object.keys(row).sort().join('\u0000') === keys);
}
diff --git a/app/src/store/chatRuntimeSlice.ts b/app/src/store/chatRuntimeSlice.ts
index 4f47543d82..ac1d3d4832 100644
--- a/app/src/store/chatRuntimeSlice.ts
+++ b/app/src/store/chatRuntimeSlice.ts
@@ -105,6 +105,18 @@ export interface SubagentActivity {
* still blocked on the user.
*/
spawnEventId?: string;
+ /**
+ * Provider-assigned id of the `spawn_subagent`/`spawn_async_subagent`/
+ * `delegate_*` tool call that started this delegation
+ * (`SubagentProgressDetail.parent_call_id` on the `subagent_spawned`
+ * event). When present, `assistantUiMessages.ts` renders this activity's
+ * `messages`/nested transcript directly on the ORIGINAL spawn tool-call
+ * part (`toolCallId === parentCallId`) instead of a synthetic row, and the
+ * spawn row's own part is suppressed so the two never collide. Absent on
+ * cores that predate this field — those threads keep rendering via the
+ * `findPendingDelegationContext` heuristic below.
+ */
+ parentCallId?: string;
/** Human-readable display name from the agent registry (e.g. "Researcher"). */
displayName?: string;
/**
@@ -135,6 +147,12 @@ export interface SubagentActivity {
elapsedMs?: number;
/** Character length of the final assistant text. */
outputChars?: number;
+ /**
+ * The sub-agent's final assistant text (`subagent_completed.subagent.output`,
+ * capped by the core). Rendered as the delegation's task-card result once
+ * it settles.
+ */
+ output?: string;
/** Child tool calls executed inside the sub-agent, in arrival order. */
toolCalls: SubagentToolCallEntry[];
/**