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
refactor(assistant-ui): drop custom scroll controller and document composition
Steven Enamakel9c28c1ccd567
diff --git a/app/src/components/assistant-ui/thread.followBottom.test.tsx b/app/src/components/assistant-ui/thread.followBottom.test.tsxindex 68545dfda6..cafbed6eea 100644--- a/app/src/components/assistant-ui/thread.followBottom.test.tsx+++ b/app/src/components/assistant-ui/thread.followBottom.test.tsx@@ -170,7 +170,7 @@ describe('assistant-ui native scroll anchoring', () => {setGeometry(viewport, 500, 1000);act(() => viewport.dispatchEvent(new Event('scroll')));- // Up, and past the 80px threshold — a deliberate move into history.+ // A deliberate move into history.setGeometry(viewport, 100, 1000);readerScrolls(viewport);scrollToSpy.mockClear();diff --git a/app/src/components/assistant-ui/thread.openScroll.test.tsx b/app/src/components/assistant-ui/thread.openScroll.test.tsxindex 16d0e1f4ea..c227693cf7 100644--- a/app/src/components/assistant-ui/thread.openScroll.test.tsx+++ b/app/src/components/assistant-ui/thread.openScroll.test.tsx@@ -142,8 +142,7 @@ describe('opening a thread scrolls to the newest message', () => {);// Put the reader far up the transcript: 1000px of content, 200px tall- // viewport, parked at the top — 800px from the bottom, well past the 80px- // follow threshold.+ // viewport, parked at the top — 800px from the bottom.const viewport = viewportOf(container);await waitFor(() => expect(scrolledToBottom(viewport)).toBe(true));Object.defineProperty(viewport, 'scrollHeight', { value: 1000, configurable: true });diff --git a/app/src/components/assistant-ui/thread.tsx b/app/src/components/assistant-ui/thread.tsxindex 9e3143514d..19ea1a113c 100644--- a/app/src/components/assistant-ui/thread.tsx+++ b/app/src/components/assistant-ui/thread.tsx@@ -1515,14 +1515,7 @@ const UserMessage: FC = () => {const UserActionBar: FC = () => {const { t } = useT();- // Edit is offered only when the bound runtime can honour it. The- // external-store adapter supplies `onNew` / `onCancel` and neither `onEdit`- // nor `setMessages`, so assistant-ui reports `edit: false` and- // `EditComposer` below never renders — the button was clickable and did- // nothing (#5897).- //- // Gated on the capability rather than hard-coded off, so the affordance- // appears by itself the day the adapter grows `onEdit`.+ // The adapter supplies editing; preview runtimes without it hide the action.const { canEdit } = useAuiEditCapabilities();// Hoisted out of the JSX rather than written as `{canEdit && (…)}` inline: a@@ -1615,12 +1608,7 @@ const EditComposer: FC = () => {};const BranchPicker: FC<BranchPickerPrimitive.Root.Props> = ({ className, ...rest }) => {- // The same defect class as the Edit button above, one step from biting: this- // is rendered unconditionally at both call sites and is invisible today only- // because `hideWhenSingleBranch` happens to hold — the adapter implements no- // `setMessages`, so there is never more than one branch. That is- // assistant-ui's guard doing the work this app intended to do itself, and it- // would become a second dead control if the prop ever went away.+ // Show branching only on runtimes whose adapter supports it.const { canSwitchToBranch } = useAuiEditCapabilities();if (!canSwitchToBranch) return null;diff --git a/app/test/e2e/specs/chat-harness-scroll-render.spec.ts b/app/test/e2e/specs/chat-harness-scroll-render.spec.tsindex 9a7ab9b7ec..1a64c1b6a3 100644--- a/app/test/e2e/specs/chat-harness-scroll-render.spec.ts+++ b/app/test/e2e/specs/chat-harness-scroll-render.spec.ts@@ -6,7 +6,7 @@** 1. Scroll: the assistant-ui thread viewport* (`[data-slot="aui_thread-viewport"]`, `components/assistant-ui/thread.tsx`)- * follows the bottom while the reader is at it (`useFollowBottom`).+ * follows the bottom through the native assistant-ui viewport.* After several messages, the container's `scrollTop` must sit* within a small margin of `scrollHeight - clientHeight`.* When the user manually scrolls UP, the auto-stick releasesdiff --git a/gitbooks/developing/architecture/frontend.md b/gitbooks/developing/architecture/frontend.mdindex 0db4f639d1..1d37e7649c 100644--- a/gitbooks/developing/architecture/frontend.md+++ b/gitbooks/developing/architecture/frontend.md@@ -409,6 +409,37 @@ agents) and `toolPhrases.ts` (phrases, served asapp's logo. The server's `tool_display_label` is used only for tools theregistry cannot describe.+### assistant-ui composition++The conversation UI uses `@assistant-ui/react` for interaction and runtime+state, `@assistant-ui/react-lexical` for the rich composer, and+`@assistant-ui/react-markdown` for message rendering. The visual components+under `components/assistant-ui/` are assistant-ui registry source installed+through the app's shadcn configuration (`base-nova`), with OpenHuman tokens,+translations and product slots. Registry components are editable source; they+are not separately exported components from the npm runtime package.++| Surface | assistant-ui owner | OpenHuman adapter |+| --- | --- | --- |+| Message list, scrolling and scroll-anchor pill | `ThreadPrimitive.Viewport`, `Messages`, `ScrollToBottom` | Real thread identity through `adapters.threadList.threadId`; run-start jumps disabled to preserve readers in history |+| Main composer, send and cancel | `ComposerPrimitive`, `LexicalComposerInput` | Draft persistence, model selection, product voice mode and core-backed file ingestion |+| Message editing | Message-scoped `ComposerPrimitive.Root`, `Input`, `Send`, `Cancel` | Edit RPC and translated warning about subsequent turns |+| Message actions and branches | `ActionBarPrimitive`, `BranchPickerPrimitive` | Adapter capability gates and core-backed regeneration, speech and feedback |+| Queued follow-ups | `ComposerPrimitive.Queue`, `QueueItemPrimitive.Text`, `Remove` | Core run-queue adapter and translated registry row captions |+| Markdown, code and citations | `MarkdownTextPrimitive` and registry elements | Source projection, app links, math and artifact access |+| Reasoning and tool groups | `MessagePrimitive.GroupedParts`, registry tool-group/reasoning elements | Core timing and grouping interleaved reasoning with calls |+| Tasks and subagents | Registry task-card/subagent-list, `ReadonlyThreadProvider` | Delegation state, awaiting-user replies and worktree actions |+| Approvals, questions and plans | Registry approval-card, elicitation-form and agent-plan | Core decision RPCs, security policy and plan/workflow lifecycle |+| Todos and goals | Registry todo-list and agent-status | Durable harness progress and remembered disclosure state |+| Images, documents and tool results | Registry image, artifact-card, web-search, terminal-block, code-diff and web-preview | Core artifact and tool-result projection |+| Sources, conversation map and context | Registry sources, conversation-map and context elements | Core sources, search, token usage and context breakdown RPC |++Keep runtime behavior in the library. New product functionality should use a+runtime adapter or component slot rather than a second scroll controller,+message store, editor or queue implementation. Presentation-only registry+components can remain local; OpenHuman owns the meaning and execution of its+RPC-backed controls.+Rendering uses assistant-ui's elements, vendored under`app/src/components/assistant-ui/elements/` (tool-call, tool-timeline,web-search, terminal-block, code-diff, web-preview) with the `tw-shimmer`