Skip to content

The open-source agent harness - the runtime layer that turns an LLM into a working agent.

Enhance AgentHistoryFilterButton and AgentsLibrary components (#200)

Govinda Vashishtha9b149e4f0adf
diff --git a/docs/ui-sdk/reference/trueforge-ui.mdx b/docs/ui-sdk/reference/trueforge-ui.mdx
index cbec65e5f..f71ae6573 100644
--- a/docs/ui-sdk/reference/trueforge-ui.mdx
+++ b/docs/ui-sdk/reference/trueforge-ui.mdx
@@ -157,12 +157,23 @@ import { TrueforgeUI } from "@truefoundry/trueforge-ui";
functions, or SVGR components.
</ParamField>
<ParamField path="classNames" type="ContentClassNames">
+ Host CSS classes for content renderers. See [Custom Theme — Styling rendered content](/ui-sdk/setup-custom-ui/custom-theme#styling-rendered-content).
<Expandable title="ContentClassNames">
- <ParamField path="markdown" type="string" />
- <ParamField path="inlineCode" type="string" />
- <ParamField path="syntaxHighlighter" type="{ root?, pre?, code?, lineNumber? }" />
- <ParamField path="openui" type="{ root?, scope? }" />
- <ParamField path="monaco" type="{ root? }" />
+ <ParamField path="markdown" type="string">
+ Root of the markdown renderer (joins `.aui-markdown`).
+ </ParamField>
+ <ParamField path="inlineCode" type="string">
+ Inline code spans inside markdown.
+ </ParamField>
+ <ParamField path="syntaxHighlighter" type="{ root?, pre?, code?, lineNumber? }">
+ Fenced non-OpenUI code blocks (joins `.aui-syntax-highlighter` on `root`).
+ </ParamField>
+ <ParamField path="openui" type="{ root?, scope? }">
+ Generative UI fence blocks (`root` joins `.aui-openui`; `scope` is the OpenUI theme selector).
+ </ParamField>
+ <ParamField path="monaco" type="{ root?, editor?, monacoTheme? }">
+ Monaco editor wrapper (`root` joins `.aui-monaco`), mount container (`editor`), and optional Monaco theme name (`monacoTheme`).
+ </ParamField>
</Expandable>
</ParamField>
<ParamField path="className" type="string">
diff --git a/docs/ui-sdk/setup-custom-ui/custom-theme.mdx b/docs/ui-sdk/setup-custom-ui/custom-theme.mdx
index b9440942b..c8957e760 100644
--- a/docs/ui-sdk/setup-custom-ui/custom-theme.mdx
+++ b/docs/ui-sdk/setup-custom-ui/custom-theme.mdx
@@ -106,20 +106,96 @@ Status tokens use `failure` / `success` / `warning` with `*Bg` / `*Text` pairs (
## Styling rendered content
-`theme.classNames` targets the content renderers:
+`theme.classNames` (`ContentClassNames`) adds host CSS classes onto content renderers. Pass it through `theme` on `TrueforgeUI` (or `SlotsProvider`):
+
+```tsx
+<TrueforgeUI
+ theme={{
+ classNames: {
+ markdown: "prose prose-sm",
+ openui: { root: "my-openui" },
+ },
+ }}
+ /* … */
+/>
+```
```ts
type ContentClassNames = {
+ /** Root of the markdown renderer (joins `.aui-markdown`). */
markdown?: string;
+ /** Inline `` `code` `` spans inside markdown. */
inlineCode?: string;
- syntaxHighlighter?: { root?: string; pre?: string; code?: string; lineNumber?: string };
- openui?: { root?: string; scope?: string };
- monaco?: { root?: string };
+ syntaxHighlighter?: {
+ root?: string; // joins `.aui-syntax-highlighter`
+ pre?: string;
+ code?: string;
+ lineNumber?: string;
+ };
+ openui?: {
+ root?: string; // joins `.aui-openui`
+ scope?: string; // OpenUI theme scope (`.markdown-openui-scope`)
+ };
+ monaco?: {
+ root?: string; // joins `.aui-monaco`
+ editor?: string; // Monaco mount container
+ /** Monaco theme name; when unset, follows light/dark mode. */
+ monacoTheme?: string;
+ };
};
```
+| Key | Applied on |
+| --- | --- |
+| `markdown` | Markdown message body |
+| `inlineCode` | Inline code inside markdown |
+| `syntaxHighlighter.*` | Fenced non-OpenUI code blocks |
+| `openui.*` | Generative UI (OpenUI) fence blocks |
+| `monaco.*` | Monaco editor surfaces (e.g. skill / draft editors) |
+
For CSS-only adjustments you can instead target the stable class names directly: `.aui-markdown`, `.aui-syntax-highlighter`, `.aui-openui`, `.aui-monaco`.
+## CSS targeting with `data-slot`
+
+Chat-shell components expose stable `data-slot` attributes — the same styling hook pattern [assistant-ui uses for its UI kit](https://www.assistant-ui.com/docs/tools/generative-ui#styling) (there: `data-aui` on generative vocabulary nodes; here: `data-slot` on thread, composer, and message parts). Prefer `theme.tokens` for colors and radii; use these selectors when you need layout or typography tweaks that tokens do not cover.
+
+```css
+/* Scope under the theme root so host-app styles do not leak in the other direction */
+.aui-theme-root [data-slot="aui_user-message-content"] {
+ font-size: 0.95rem;
+}
+
+.aui-theme-root [data-slot="aui_composer-shell"] {
+ box-shadow: 0 8px 24px color-mix(in srgb, var(--shadow-color) 12%, transparent);
+}
+```
+
+Stable slots (most are prefixed `aui_`; a few are not — inspect the element if unsure):
+
+| `data-slot` | Surface |
+| --- | --- |
+| `aui_thread-viewport` | Scrollable message list |
+| `aui_thread-composer` | Composer region under the viewport |
+| `aui_composer-shell` | Composer chrome |
+| `aui_composer-root` | Composer inner root |
+| `aui_composer-input` | Composer text area |
+| `aui_composer-attachment-dropzone` | Attachment drop target |
+| `aui_message-group` | Grouped message block |
+| `aui_user-message-root` / `aui_user-message-content` | User bubble |
+| `aui_user-message-edit` | Edit affordance on a user message |
+| `aui_user-edit-composer-root` / `aui_user-edit-input` | In-place edit composer |
+| `aui_assistant-message-root` | Assistant bubble |
+| `aui_assistant-message-indicator` | Assistant status indicator |
+| `aui_thread-list-viewport` | History list scroll area |
+| `aui_thread-list-item` / `aui_thread-list-item-age` / `aui_thread-list-item-actions` | History row |
+| `aui_history-loader` / `aui_thread-history-skeleton` | History loading UI |
+| `aui_attachment-preview` / `aui_attachment-chip` | Attachments |
+| `aui_select-agent-empty` | Empty “pick an agent” state |
+| `avatar` / `avatar-image` / `avatar-fallback` | Avatar parts |
+| `tool-call-card` / `tool-group-card` | Tool call chrome |
+
+There is no `data-id` attribute for theming. Generative charts/cards/tables in chat are **OpenUI** (not `@assistant-ui/react-generative-ui`), so they do not emit assistant-ui’s `data-aui` / `data-aui-*` hooks. Style that surface with `.aui-openui`, `theme.classNames.openui`, or by [overriding the `OpenUiFenceBlock` slot](/ui-sdk/setup-custom-ui/slot-overrides).
+
## Presets
```ts
diff --git a/packages/trueforge-ui-sdk/src/atoms/AgentHistoryFilterButton.tsx b/packages/trueforge-ui-sdk/src/atoms/AgentHistoryFilterButton.tsx
index b16affc07..bf86cf759 100644
--- a/packages/trueforge-ui-sdk/src/atoms/AgentHistoryFilterButton.tsx
+++ b/packages/trueforge-ui-sdk/src/atoms/AgentHistoryFilterButton.tsx
@@ -98,19 +98,28 @@ export function AgentHistoryFilterButton() {
</p>
) : null}
</div>
- <div ref={listRef} className={cn('mt-1 overflow-y-auto', useSheet ? 'min-h-0 flex-1 px-1 pb-2' : 'max-h-64')}>
- <DropdownMenuItem
- className={cn(
- 'justify-between',
- selected == null && 'bg-dropdown-selected-item-bg text-dropdown-selected-item-text',
- )}
- onClick={() => pick(null)}
- >
- All chats
- {selected == null ? <Icon name="check" className="size-3.5 shrink-0" /> : null}
- </DropdownMenuItem>
+ <div
+ ref={listRef}
+ className={cn('mt-1 overflow-y-auto', useSheet ? 'min-h-0 flex-1 px-1 pb-2' : 'min-h-48 max-h-64')}
+ >
+ {query.trim() === '' ? (
+ <DropdownMenuItem
+ className={cn(
+ 'justify-between',
+ selected == null && 'bg-dropdown-selected-item-bg text-dropdown-selected-item-text',
+ )}
+ onClick={() => pick(null)}
+ >
+ All chats
+ {selected == null ? <Icon name="check" className="size-3.5 shrink-0" /> : null}
+ </DropdownMenuItem>
+ ) : null}
{isInitialLoading ? (
<p className="px-2 py-3 text-center text-xs text-text-secondary">Loading…</p>
+ ) : agents.length === 0 ? (
+ <p className="text-text-secondary px-2 py-6 text-center text-xs" role="status">
+ {query.trim() ? `No agents match "${query.trim()}".` : 'No agents yet.'}
+ </p>
) : (
<>
{agents.map(agent => {
diff --git a/packages/trueforge-ui-sdk/src/atoms/AgentsLibrary.tsx b/packages/trueforge-ui-sdk/src/atoms/AgentsLibrary.tsx
index 45454df3f..93c051ce5 100644
--- a/packages/trueforge-ui-sdk/src/atoms/AgentsLibrary.tsx
+++ b/packages/trueforge-ui-sdk/src/atoms/AgentsLibrary.tsx
@@ -7,7 +7,6 @@ import { libraryAgentId, useOptionalShellMode } from '../server/ShellModeContext
import type { AgentLibraryEntry, AgentSpec } from '../server/types.js';
import { auiButtonClass } from './lib/buttonClasses.js';
import { cn } from './lib/cn.js';
-import { useCompactLayout } from './lib/CompactLayoutContext.js';
import { useSearchAgentsList } from './lib/useSearchAgentsList.js';
import { CenteredModal } from './primitives/CenteredModal.js';
import SearchInput from './primitives/SearchInput.js';
@@ -26,22 +25,23 @@ type AgentLibraryRowProps = {
onEdit: () => void;
};
-function rowActionClass(compact: boolean) {
- return cn(
- 'shrink-0 opacity-100 transition-opacity',
- !compact && 'md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100',
- 'focus-visible:opacity-100',
- );
+/** Short label for model fqns like `provider/gpt-4.1` → `gpt-4.1`. */
+function displayModelLabel(modelName: string): string {
+ const slash = modelName.lastIndexOf('/');
+ return slash >= 0 ? modelName.slice(slash + 1) : modelName;
}
function AgentLibraryRow({ agent, showEdit, onTry, onEdit }: AgentLibraryRowProps) {
- const compact = useCompactLayout();
+ const spec = agent.agentSpec;
+ const modelName = spec?.model.name;
+ const skillsCount = spec?.skills?.length ?? 0;
+ const mcpCount = spec?.mcpServers?.length ?? 0;
return (
<div
role="menuitem"
className={cn(
- 'group flex w-full items-center gap-2.5 rounded-md border border-transparent px-2.5 py-2 transition-colors',
+ 'flex w-full items-center gap-2.5 rounded-md border border-transparent px-2.5 py-2 transition-colors',
'hover:border-border hover:bg-ghost-button-hover',
'focus-within:border-border focus-within:bg-ghost-button-hover',
)}
@@ -52,6 +52,24 @@ function AgentLibraryRow({ agent, showEdit, onTry, onEdit }: AgentLibraryRowProp
<span className="text-text-primary min-w-0 flex-1 truncate text-left text-sm font-medium leading-tight">
{agent.name}
</span>
+ {spec != null ? (
+ <span className="text-text-secondary flex shrink-0 items-center gap-2">
+ {modelName ? (
+ <span className="bg-primary-button-bg/10 text-primary-button-bg inline-flex max-w-[8rem] items-center gap-1 truncate rounded-full px-2 py-0.5 text-xs font-medium">
+ <Icon name="cpu" className="size-3.5 shrink-0" />
+ <span className="truncate">{displayModelLabel(modelName)}</span>
+ </span>
+ ) : null}
+ <span className="inline-flex items-center gap-1 text-xs" aria-label={`${skillsCount} skills`}>
+ <Icon name="wrench" className="size-3.5" />
+ {skillsCount}
+ </span>
+ <span className="inline-flex items-center gap-1 text-xs" aria-label={`${mcpCount} MCP servers`}>
+ <Icon name="plug" className="size-3.5" />
+ {mcpCount}
+ </span>
+ </span>
+ ) : null}
<span className="flex shrink-0 items-center gap-1.5">
{showEdit ? (
<button
@@ -60,7 +78,6 @@ function AgentLibraryRow({ agent, showEdit, onTry, onEdit }: AgentLibraryRowProp
className={auiButtonClass({
variant: 'ghost',
size: 'sm',
- className: rowActionClass(compact),
})}
onClick={onEdit}
>
@@ -74,7 +91,6 @@ function AgentLibraryRow({ agent, showEdit, onTry, onEdit }: AgentLibraryRowProp
className={auiButtonClass({
variant: 'outline',
size: 'sm',
- className: rowActionClass(compact),
})}
onClick={onTry}
>
diff --git a/packages/trueforge-ui-sdk/src/atoms/draft/DraftModelSelector.tsx b/packages/trueforge-ui-sdk/src/atoms/draft/DraftModelSelector.tsx
index 7799738dd..b325e0c9d 100644
--- a/packages/trueforge-ui-sdk/src/atoms/draft/DraftModelSelector.tsx
+++ b/packages/trueforge-ui-sdk/src/atoms/draft/DraftModelSelector.tsx
@@ -242,7 +242,7 @@ export function DraftModelSelector({ disabled, isRunning }: DraftModelSelectorPr
})}
onClick={() => setOpen(v => !v)}
>
- <ProviderMark logo={selected?.provider.logo} label={account} className="size-5 text-[10px]" />
+ <ProviderMark logo={selected?.provider.logo} label={account} className="size-4 text-xs" />
<span className="truncate">{label}</span>
<Icon name="chevron-down" className="size-3.5 shrink-0 opacity-60" />
</button>
diff --git a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ModelSettings.tsx b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ModelSettings.tsx
index 44e3fb23b..b3be27905 100644
--- a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ModelSettings.tsx
+++ b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ModelSettings.tsx
@@ -294,7 +294,7 @@ const ModelSettings = () => {
</div>
<div className="flex flex-wrap items-center gap-2.5 sm:justify-end">
- <span className="flex items-center gap-1.5 text-[13px] font-medium text-success-bg">
+ <span className="flex items-center gap-1.5 rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium text-success-bg">
<span className="h-1.5 w-1.5 rounded-full bg-success-bg"></span>
Connected
</span>
diff --git a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/SandboxSettings.tsx b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/SandboxSettings.tsx
index 03a27fb30..ca28d32d9 100644
--- a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/SandboxSettings.tsx
+++ b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/SandboxSettings.tsx
@@ -177,8 +177,8 @@ const SandboxSettings = () => {
<div className="flex flex-wrap items-center gap-2.5 sm:justify-end">
{provider.isConnected ? (
- <span className="flex items-center gap-1.5 text-[13px] font-medium text-text-primary">
- <span className="h-1.5 w-1.5 rounded-full bg-primary-button-bg"></span>
+ <span className="flex items-center gap-1.5 rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium text-success-bg">
+ <span className="h-1.5 w-1.5 rounded-full bg-success-bg"></span>
Connected
</span>
) : null}
diff --git a/packages/trueforge-ui-sdk/test/atoms/AgentHistoryFilterButton.test.tsx b/packages/trueforge-ui-sdk/test/atoms/AgentHistoryFilterButton.test.tsx
index 6690d89cc..ef3cf0ef1 100644
--- a/packages/trueforge-ui-sdk/test/atoms/AgentHistoryFilterButton.test.tsx
+++ b/packages/trueforge-ui-sdk/test/atoms/AgentHistoryFilterButton.test.tsx
@@ -116,6 +116,54 @@ describe('AgentHistoryFilterButton', () => {
expect(searchAgents).toHaveBeenCalled();
});
+ it('hides All chats while a search query is active', async () => {
+ const searchAgents = vi.fn(async (req?: { query?: string }) => {
+ const q = req?.query?.trim().toLowerCase() ?? '';
+ const all = [
+ { name: 'From SDK', agentId: 'from-sdk' },
+ { name: 'Other', agentId: 'other' },
+ ];
+ return q === '' ? all : all.filter(a => a.name.toLowerCase().includes(q));
+ });
+ const server = mockServer({ searchAgents });
+ render(<AgentHistoryFilterButton />, {
+ wrapper: wrap({ agentConfig: { mode: 'AgentLibraryWithComposer' }, server }),
+ });
+
+ fireEvent.click(screen.getByRole('button', { name: /Filter chat history/i }));
+ await waitFor(() => expect(screen.getByRole('menuitem', { name: /All chats/i })).toBeInTheDocument());
+
+ fireEvent.change(screen.getByPlaceholderText('Search agents'), { target: { value: 'from' } });
+
+ await waitFor(() => {
+ expect(screen.queryByRole('menuitem', { name: /All chats/i })).not.toBeInTheDocument();
+ });
+ expect(screen.getByRole('menuitem', { name: /From SDK/i })).toBeInTheDocument();
+ });
+
+ it('shows an empty banner and keeps list min-height when search matches nothing', async () => {
+ const searchAgents = vi.fn(async (req?: { query?: string }) => {
+ const q = req?.query?.trim().toLowerCase() ?? '';
+ if (q === '') return [{ name: 'From SDK', agentId: 'from-sdk' }];
+ return [];
+ });
+ const server = mockServer({ searchAgents });
+ render(<AgentHistoryFilterButton />, {
+ wrapper: wrap({ agentConfig: { mode: 'AgentLibraryWithComposer' }, server }),
+ });
+
+ fireEvent.click(screen.getByRole('button', { name: /Filter chat history/i }));
+ await waitFor(() => expect(screen.getByRole('menuitem', { name: /From SDK/i })).toBeInTheDocument());
+
+ fireEvent.change(screen.getByPlaceholderText('Search agents'), { target: { value: 'jjjjj' } });
+
+ await waitFor(() => {
+ expect(screen.getByRole('status')).toHaveTextContent('No agents match "jjjjj".');
+ });
+ expect(screen.queryByRole('menuitem', { name: /From SDK/i })).not.toBeInTheDocument();
+ expect(screen.getByRole('menu', { name: /Filter agents/i }).querySelector('.min-h-48')).not.toBeNull();
+ });
+
it('opens a bottom sheet on mobile', async () => {
const matchMedia = vi.fn().mockImplementation((query: string) => ({
matches: query === '(max-width: 767px)',
diff --git a/packages/trueforge-ui-sdk/test/atoms/AgentsLibrary.test.tsx b/packages/trueforge-ui-sdk/test/atoms/AgentsLibrary.test.tsx
index 7b2fcf28f..1f121d50c 100644
--- a/packages/trueforge-ui-sdk/test/atoms/AgentsLibrary.test.tsx
+++ b/packages/trueforge-ui-sdk/test/atoms/AgentsLibrary.test.tsx
@@ -26,7 +26,11 @@ function mockServer(
agents: Array<{
name: string;
agentId: string;
- agentSpec?: { model: { name: string }; skills?: Array<{ id: string; name: string }> };
+ agentSpec?: {
+ model: { name: string };
+ skills?: Array<{ id: string; name: string }>;
+ mcpServers?: Array<{ id: string; name: string }>;
+ };
}> = [{ name: 'alpha-agent', agentId: 'alpha-agent' }],
): AgentUIServer {
return createMockAgentUIServer({
@@ -121,6 +125,39 @@ describe('AgentsLibrary', () => {
expect(screen.getByRole('button', { name: 'Try agent try-only' })).toBeInTheDocument();
});
+ it('shows model name, skills count, and MCP count from agentSpec', async () => {
+ const server = mockServer([
+ {
+ name: 'algo-art',
+ agentId: 'algo-art',
+ agentSpec: {
+ model: { name: 'openai/gpt-5-5' },
+ skills: [{ id: 's1', name: 'paint' }],
+ mcpServers: [{ id: 'm1', name: 'github' }],
+ },
+ },
+ { name: 'bare', agentId: 'bare' },
+ ]);
+
+ render(
+ <SlotsProvider>
+ <ServerProvider server={server}>
+ <ShellModeProvider agentConfig={{ mode: 'AgentLibraryWithComposer' }}>
+ <AgentsLibrary open onOpenChange={() => undefined} />
+ </ShellModeProvider>
+ </ServerProvider>
+ </SlotsProvider>,
+ );
+
+ await waitFor(() => {
+ expect(screen.getByText('gpt-5-5')).toBeInTheDocument();
+ });
+ expect(screen.getByLabelText('1 skills')).toBeInTheDocument();
+ expect(screen.getByLabelText('1 MCP servers')).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: 'Try agent bare' })).toBeInTheDocument();
+ expect(screen.queryByLabelText('0 skills')).not.toBeInTheDocument();
+ });
+
it('hides Edit when composer is disabled (AgentLibrary only)', async () => {
const server = mockServer([
{