Skip to content

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

docs: update README with content classNames section and enhance theming notes; fix ClearChatButton visibility logic and add related tests (#190)

Govinda Vashishtha980e1196239b
diff --git a/packages/trueforge-ui-sdk/README.md b/packages/trueforge-ui-sdk/README.md
index fbf817f47..d68ff8fa1 100644
--- a/packages/trueforge-ui-sdk/README.md
+++ b/packages/trueforge-ui-sdk/README.md
@@ -29,6 +29,7 @@ Bring your own **brand, colors, layout, components, and server**—the Agent SDK
- [Getting started](#getting-started)
- [`<TrueforgeUI />` props](#trueforgeui--props)
- [Theming](#theming)
+- [Content classNames](#content-classnames)
- [Brand / logo](#brand--logo)
- [Agent modes](#agent-modes)
- [Layouts](#layouts)
@@ -178,7 +179,7 @@ export default function App() {
| `server` | `TrueforgeServerConfig` | ✅ | Built-in config (`truefoundry` / `trueforge`) **or** a ready `AgentUIServer`. |
| `layout` | `LayoutProp` | ✅ | Built-in layout string **or** a custom React component. |
| `agentConfig` | `AgentConfig` | — | Shell mode: SingleAgent / AgentLibrary / AgentComposer / AgentLibraryWithComposer. Defaults to library + composer. |
-| `theme` | `ThemeConfig` | — | Preset, mode, tokens, brand, icons (see [Theming](#theming)). |
+| `theme` | `ThemeConfig` | — | Preset, mode, tokens, brand, icons, **content `classNames`** (see [Theming](#theming)). |
| `overrides` | `SlotOverrides` | — | Map of slot overrides (see [Overriding components](#overriding-components)). |
| `className` | `string` | — | Applied to the layout root. |
| `initialSessionId` | `string` | — | Resume a specific session. |
@@ -228,7 +229,49 @@ You can also override tokens from host CSS:
> _Screenshot: the same layout rebranded with a custom palette._
-See [docs/theming.md](./docs/theming.md) for presets, controlled vs uncontrolled mode, and content classNames.
+See [docs/theming.md](./docs/theming.md) for presets, controlled vs uncontrolled mode, and deeper theming notes.
+
+---
+
+## Content classNames
+
+Style content renderers (markdown, code fences, OpenUI, Monaco) without swapping
+slots. Pass `theme.classNames` on `<TrueforgeUI />` — values merge onto the
+defaults via `cn()`:
+
+```tsx
+<TrueforgeUI
+ server={server}
+ layout="sidebar"
+ theme={{
+ classNames: {
+ markdown: 'prose prose-neutral dark:prose-invert max-w-none',
+ inlineCode: 'font-semibold',
+ syntaxHighlighter: {
+ root: 'my-code-block rounded-lg',
+ pre: 'bg-zinc-950 p-4',
+ code: 'text-sm font-mono',
+ lineNumber: 'opacity-60',
+ },
+ openui: { root: 'my-openui-host', scope: 'p-2' },
+ monaco: { root: 'my-monaco h-64', editor: 'rounded-lg', monacoTheme: 'vs-dark' },
+ },
+ }}
+/>
+```
+
+| `theme.classNames` key | Component / surface | Fields |
+| ---------------------- | ------------------------------------------- | ------------------------------------------------- |
+| `markdown` | `Markdown` (message prose root) | `string` |
+| `inlineCode` | `Markdown` inline `` `code` `` | `string` |
+| `syntaxHighlighter` | `SyntaxHighlighter` (non-OpenUI fences) | `root`, `pre`, `code`, `lineNumber` |
+| `openui` | `OpenUiFenceBlock` | `root`, `scope` |
+| `monaco` | `MonacoEditorCore` (code artifacts / diffs) | `root`, `editor`, `monacoTheme` (Monaco theme id) |
+
+Custom layouts and host atoms under the provider can read the same map with
+`useOptionalContentClassNames()` / `useContentClassNames()` (exported from the
+package). Host CSS on `.aui-markdown` / `.aui-syntax-highlighter` / `.aui-openui`
+/ `.aui-monaco` still works as an alternative.
---
diff --git a/packages/trueforge-ui-sdk/src/atoms/ClearChatButton.tsx b/packages/trueforge-ui-sdk/src/atoms/ClearChatButton.tsx
index aa1c646f9..0e3900e82 100644
--- a/packages/trueforge-ui-sdk/src/atoms/ClearChatButton.tsx
+++ b/packages/trueforge-ui-sdk/src/atoms/ClearChatButton.tsx
@@ -4,11 +4,11 @@ import { Icon } from '../icons/Icon.js';
import { useOptionalShellMode } from '../server/ShellModeContext.js';
import { auiButtonClass } from './lib/buttonClasses.js';
-/** Resets the current named or draft chat. Hidden while the shell is idle. */
+/** Resets an immutable (named) chat. Hidden while idle or on mutable drafts. */
export function ClearChatButton() {
const shell = useOptionalShellMode();
- if (shell == null || shell.mode.status === 'idle') return null;
+ if (shell == null || shell.mode.status !== 'active' || shell.mode.isMutable) return null;
return (
<button
diff --git a/packages/trueforge-ui-sdk/test/atoms/ClearChatButton.test.tsx b/packages/trueforge-ui-sdk/test/atoms/ClearChatButton.test.tsx
index 4506b2d77..71693f33b 100644
--- a/packages/trueforge-ui-sdk/test/atoms/ClearChatButton.test.tsx
+++ b/packages/trueforge-ui-sdk/test/atoms/ClearChatButton.test.tsx
@@ -27,6 +27,17 @@ describe('ClearChatButton', () => {
expect(screen.queryByRole('button', { name: 'Clear chat' })).not.toBeInTheDocument();
});
+ it('is hidden on mutable sessions', () => {
+ render(
+ <SlotsProvider>
+ <ShellModeProvider agentConfig={{ mode: 'AgentComposer' }}>
+ <ClearChatButton />
+ </ShellModeProvider>
+ </SlotsProvider>,
+ );
+ expect(screen.queryByRole('button', { name: 'Clear chat' })).not.toBeInTheDocument();
+ });
+
it('calls clearChat when clicked in named mode', () => {
render(
<SlotsProvider>