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(chat): restore live history parity for assistant UI tool calls
Steven Enamakel05e3ce10476f
diff --git a/app/src/components/assistant-ui/reasoning.tsx b/app/src/components/assistant-ui/reasoning.tsxindex c43e885404..d95aadf72a 100644--- a/app/src/components/assistant-ui/reasoning.tsx+++ b/app/src/components/assistant-ui/reasoning.tsx@@ -10,15 +10,7 @@ import {import { type ReasoningMessagePartComponent, useScrollLock } from '@assistant-ui/react';import { cva, type VariantProps } from 'class-variance-authority';import { BrainIcon, ChevronDownIcon } from 'lucide-react';-import {- createContext,- memo,- useCallback,- useContext,- useEffect,- useRef,- useState,-} from 'react';+import { createContext, memo, useCallback, useContext, useEffect, useRef, useState } from 'react';const ANIMATION_DURATION = 200;diff --git a/app/src/features/conversations/components/AssistantUiToolCall.tsx b/app/src/features/conversations/components/AssistantUiToolCall.tsxindex dabcf1a7c2..2dc05290ee 100644--- a/app/src/features/conversations/components/AssistantUiToolCall.tsx+++ b/app/src/features/conversations/components/AssistantUiToolCall.tsx@@ -156,10 +156,7 @@ export function AssistantUiToolCallCard({// and stayed open, the same card reloaded was closed, and any remount in// between flipped it. The header already says what the call is and whether// it is running; the body is detail on demand.- const [open, setOpen] = useDisclosure(- disclosureKey ? `tool:${disclosureKey}` : undefined,- false- );+ const [open, setOpen] = useDisclosure(disclosureKey ? `tool:${disclosureKey}` : undefined, false);const running =awaitingUser ||(status ? status === 'running' || status === 'awaiting_user' : result === undefined);diff --git a/app/src/features/conversations/derived/mapDisplayItems.ts b/app/src/features/conversations/derived/mapDisplayItems.tsindex 7f330dab9c..efea80d1d0 100644--- a/app/src/features/conversations/derived/mapDisplayItems.ts+++ b/app/src/features/conversations/derived/mapDisplayItems.ts@@ -347,7 +347,9 @@ export function mapDisplayItems(/** Tool names that open a delegation — mirrors `findPendingDelegationContext`. */function isDelegationToolName(name: string): boolean {- return name === 'spawn_subagent' || name === 'spawn_async_subagent' || name.startsWith('delegate_');+ return (+ name === 'spawn_subagent' || name === 'spawn_async_subagent' || name.startsWith('delegate_')+ );}/** `subagent:<id>`, disambiguated when one turn delegates to the same agent twice. */diff --git a/app/src/providers/ChatRuntimeProvider.tsx b/app/src/providers/ChatRuntimeProvider.tsxindex 8f93ff3f68..f7c98e5154 100644--- a/app/src/providers/ChatRuntimeProvider.tsx+++ b/app/src/providers/ChatRuntimeProvider.tsx@@ -10,6 +10,7 @@ import {import { classifyReplyDeliveryFailure } from '../lib/userErrors/classify';import { ingestRuntimeErrorSignal } from '../lib/userErrors/report';import { maybeParseWorkflowProposalTool } from '../lib/workflows/workflowProposal';+import { withCoalescedDeltas } from '../services/chatDeltaCoalescer';import {type ChatApprovalRequestEvent,type ChatDoneEvent,@@ -30,7 +31,6 @@ import {segmentText,subscribeChatEvents,} from '../services/chatService';-import { withCoalescedDeltas } from '../services/chatDeltaCoalescer';import { socketService } from '../services/socketService';import { store } from '../store';import {diff --git a/app/src/providers/__tests__/liveHistoryParity.test.tsx b/app/src/providers/__tests__/liveHistoryParity.test.tsxindex 0baff54a74..1aa36ddc56 100644--- a/app/src/providers/__tests__/liveHistoryParity.test.tsx+++ b/app/src/providers/__tests__/liveHistoryParity.test.tsx@@ -26,8 +26,8 @@ import { act } from 'react';import { Provider } from 'react-redux';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';-import { mapDisplayItems } from '../../features/conversations/derived/mapDisplayItems';import * as chatService from '../../services/chatService';+import { mapDisplayItems } from '../../features/conversations/derived/mapDisplayItems';import { threadApi } from '../../services/api/threadApi';import { store } from '../../store';import { beginInferenceTurn, clearAllChatRuntime } from '../../store/chatRuntimeSlice';diff --git a/app/src/providers/assistantUiMessages.ts b/app/src/providers/assistantUiMessages.tsindex 32ecfeb0f2..fde6fb1a77 100644--- a/app/src/providers/assistantUiMessages.ts+++ b/app/src/providers/assistantUiMessages.ts@@ -689,10 +689,7 @@ export type AssistantUiProjection = {settledTurns?: Readonly<Record<string,- {- timeline: readonly ToolTimelineEntry[];- transcript: readonly ProcessingTranscriptItem[];- }+ { timeline: readonly ToolTimelineEntry[]; transcript: readonly ProcessingTranscriptItem[] }>>;/** `request_id` of the turn the live tail stands for, when known. */diff --git a/app/src/services/chatDeltaCoalescer.test.ts b/app/src/services/chatDeltaCoalescer.test.tsindex 0c64ef4520..a3219fd45c 100644--- a/app/src/services/chatDeltaCoalescer.test.ts+++ b/app/src/services/chatDeltaCoalescer.test.ts@@ -56,7 +56,8 @@ describe('createChatDeltaCoalescer', () => {const frames = manualScheduler();const delivered: [DeltaChannel, string][] = [];const coalescer = createChatDeltaCoalescer<CoalescibleDelta>(- (channel, event) => delivered.push([channel, `${event.thread_id}/${event.round}:${event.delta}`]),+ (channel, event) =>+ delivered.push([channel, `${event.thread_id}/${event.round}:${event.delta}`]),frames.schedule);diff --git a/app/src/services/chatDeltaCoalescer.ts b/app/src/services/chatDeltaCoalescer.tsindex 90ba2dc28f..00ca91b673 100644--- a/app/src/services/chatDeltaCoalescer.ts+++ b/app/src/services/chatDeltaCoalescer.ts@@ -29,10 +29,7 @@ export interface CoalescibleDelta {delta: string;}-type Pending<E extends CoalescibleDelta> = {- channel: DeltaChannel;- event: E;-};+type Pending<E extends CoalescibleDelta> = { channel: DeltaChannel; event: E };/** Schedules one flush; returns a canceller. */export type FlushScheduler = (flush: () => void) => () => void;diff --git a/app/src/test/fixtures/streamedTurn.ts b/app/src/test/fixtures/streamedTurn.tsindex 222bcf03df..1dd318f2ad 100644--- a/app/src/test/fixtures/streamedTurn.ts+++ b/app/src/test/fixtures/streamedTurn.ts@@ -90,13 +90,7 @@ export const LIVE_TURN_STEPS: SocketStep[] = [// No provider id at all.{listener: 'onToolCall',- event: {- ...base,- round: 1,- tool_name: 'web_search',- skill_id: 'web',- args: { q: 'agenda' },- },+ event: { ...base, round: 1, tool_name: 'web_search', skill_id: 'web', args: { q: 'agenda' } },},{listener: 'onToolResult',@@ -136,14 +130,7 @@ export const LIVE_TURN_STEPS: SocketStep[] = [},{listener: 'onSubagentSpawned',- event: {- ...base,- round: 2,- tool_name: 'researcher',- skill_id: 'sub-1',- message: '',- seq: 1,- },+ event: { ...base, round: 2, tool_name: 'researcher', skill_id: 'sub-1', message: '', seq: 1 },},{listener: 'onSubagentDone',@@ -206,12 +193,7 @@ export const HISTORY_ITEMS: DerivedDisplayItem[] = (result: 'done',status: 'success',},- {- kind: 'assistantMessage',- content: FINAL_ANSWER,- requestId: TURN_REQUEST,- iteration: 3,- },+ { kind: 'assistantMessage', content: FINAL_ANSWER, requestId: TURN_REQUEST, iteration: 3 },// Sub-agents are projected after every root item, with no link back to the// call that spawned them.{diff --git a/app/test/e2e/specs/chat-live-history-parity.spec.ts b/app/test/e2e/specs/chat-live-history-parity.spec.tsindex 15cdeb412c..910218ed33 100644--- a/app/test/e2e/specs/chat-live-history-parity.spec.ts+++ b/app/test/e2e/specs/chat-live-history-parity.spec.ts@@ -223,8 +223,9 @@ describe('Chat live/history parity', () => {// renders from the persisted messages plus the core transcript projection.expect(await clickByTitle('New thread', 8_000)).toBe(true);await browser.execute(tid => {- const store = (window as unknown as { __OPENHUMAN_STORE__?: { dispatch: (a: unknown) => void } })- .__OPENHUMAN_STORE__;+ const store = (+ window as unknown as { __OPENHUMAN_STORE__?: { dispatch: (a: unknown) => void } }+ ).__OPENHUMAN_STORE__;store?.dispatch({ type: 'chatRuntime/clearRuntimeForThread', payload: { threadId: tid } });store?.dispatch({ type: 'thread/setSelectedThread', payload: tid });}, threadId);