Skip to content

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

Merge remote-tracking branch 'upstream/main' into pr/6592

Steven Enamakel23e04c0f1066
diff --cc app/src/components/assistant-ui/thread.tsx
index 7273fdd8ad,bb9c8a9f59..2cf2b845b7
--- a/app/src/components/assistant-ui/thread.tsx
+++ b/app/src/components/assistant-ui/thread.tsx
@@@ -99,8 -93,11 +93,13 @@@ export type ThreadComponents =
AssistantMessage?: ComponentType | undefined;
Welcome?: ComponentType | undefined;
ToolFallback?: ToolCallMessagePartComponent | undefined;
- ToolGroup?: ComponentType<PropsWithChildren<{ group: ThreadGroupPart }>> | undefined;
- ReasoningGroup?: ComponentType<PropsWithChildren<{ group: ThreadGroupPart }>> | undefined;
+ /**
+ * Wraps one run of reasoning and tool calls — everything between the input
+ * and the answer — as a single group. Defaults to `ActivityGroup`.
+ */
+ ActivityGroup?: ComponentType<PropsWithChildren<{ group: ThreadGroupPart }>> | undefined;
++ /** Host-owned disclosure for the URL source parts emitted after an answer. */
++ SourceGroup?: ComponentType<{ sources: readonly SourceUrlPart[] }> | undefined;
/**
* Extra controls in the composer's action row, to the right of the model
* selector. A seam rather than a fixed set because what belongs there is
@@@ -1196,39 -1234,12 +1236,29 @@@ const MessageError: FC = () =>
);
};
- /** A url `source` part, the only kind this app emits. */
++/** A URL `source` part, the only kind this app emits. */
+export type SourceUrlPart = { id: string; url: string; title?: string };
+
+const selectMessageParts = (state: AssistantState) => state.message.parts;
+
- /**
- * Hands the host the message's source parts in one list. The group node only
- * carries part indices, and the host renders the whole disclosure (trigger with
- * a count, then the rows), so it needs the parts themselves, not one child per
- * part.
- */
++/** Gives the host all URL source parts represented by one grouped source node. */
+const SourceGroupSlot: FC<{ Component: ComponentType<{ sources: readonly SourceUrlPart[] }> }> = ({
+ Component,
+}) => {
+ const parts = useAuiState(selectMessageParts);
- const sources = useMemo(
- () =>
- parts.flatMap(part =>
- part.type === 'source' && part.sourceType === 'url'
- ? [{ id: part.id, url: part.url, ...(part.title ? { title: part.title } : {}) }]
- : []
- ),
- [parts]
++ const sources = parts.flatMap(part =>
++ part.type === 'source' && part.sourceType === 'url'
++ ? [{ id: part.id, url: part.url, ...(part.title ? { title: part.title } : {}) }]
++ : []
+ );
+ return sources.length > 0 ? <Component sources={sources} /> : null;
+};
+
const AssistantMessage: FC = () => {
const {
ToolFallback: ToolFallbackComponent = ToolFallback,
- ToolGroup,
- ReasoningGroup,
+ ActivityGroup = DefaultActivityGroup,
- TurnFooter,
- TurnSources,
+ SourceGroup,
} = useContext(ThreadComponentsContext);
const ACTION_BAR_PT = 'pt-1.5';
@@@ -1274,47 -1288,14 +1307,17 @@@
className="text-foreground [&>*+*]:mt-3 [&_[data-slot=reasoning-root]]:mb-0 px-2 leading-relaxed wrap-break-word">
<MessagePrimitive.GroupedParts
groupBy={groupPartByType({
- reasoning: ['group-chainOfThought', 'group-reasoning'],
- 'tool-call': ['group-chainOfThought', 'group-tool'],
+ reasoning: ['group-activity'],
+ 'tool-call': ['group-activity'],
'standalone-tool-call': [],
+ source: ['group-source'],
})}>
{({ part, children }) => {
switch (part.type) {
- case 'group-chainOfThought':
- return (
- <div data-slot="aui_chain-of-thought" className="[&>*+*]:mt-3">
- {children}
- </div>
- );
- case 'group-tool':
- if (ToolGroup) {
- return <ToolGroup group={part}>{children}</ToolGroup>;
- }
- return (
- <ToolGroupRoot variant="ghost">
- <ToolGroupTrigger
- count={part.indices.length}
- active={part.status.type === 'running'}
- />
- <ToolGroupContent>{children}</ToolGroupContent>
- </ToolGroupRoot>
- );
- case 'group-reasoning': {
- if (ReasoningGroup) {
- return <ReasoningGroup group={part}>{children}</ReasoningGroup>;
- }
- // The static reasoning panel reads the grouped parts' text and
- // timing itself; the per-part `children` are only for overrides.
- return (
- <OpenHumanReasoningGroup
- indices={part.indices}
- running={part.status.type === 'running'}
- />
- );
- }
+ case 'group-activity':
+ return <ActivityGroup group={part}>{children}</ActivityGroup>;
+ case 'group-source':
+ return SourceGroup ? <SourceGroupSlot Component={SourceGroup} /> : null;
case 'text':
return <MarkdownText />;
case 'reasoning':
diff --cc app/src/features/conversations/components/AssistantUiChat.tsx
index 3bb8612f49,ceee3565fa..6b906a22ad
--- a/app/src/features/conversations/components/AssistantUiChat.tsx
+++ b/app/src/features/conversations/components/AssistantUiChat.tsx
@@@ -14,9 -15,11 +14,9 @@@ import { useAppSelector } from '../../.
import { DEFAULT_MASCOT_COLOR } from '../../../store/mascotSlice';
import { MascotChipAvatar } from '../../human/Mascot/MascotChipAvatar';
import { AssistantUiInferenceStatus } from './AssistantUiInferenceStatus';
+import { ChatSources } from './aui/ChatSources';
import { SubagentDrawerHost } from './aui/subagentDrawerHost';
- import { ChatToolFallback, ChatToolGroup } from './ChatToolParts';
-import { TurnFooter } from './aui/TurnFooter';
-import { TurnFooterHost } from './aui/turnFooterHost';
-import { TurnSources } from './aui/TurnSources';
+ import { ChatToolFallback } from './ChatToolParts';
import { contextUsageFromTokenUsage, ContextWindowPill } from './composer/ContextWindowPill';
const EMPTY_TOKEN_USAGE = emptySessionTokenUsage();