The open-source agent harness - the runtime layer that turns an LLM into a working agent.
Integrate thinking orbs for enhanced loading animations (#633)
harshil-20964e72afc1ca46
diff --git a/.changeset/boot-loader-status-text.md b/.changeset/boot-loader-status-text.mdnew file mode 100644index 000000000..704f3f7e7--- /dev/null+++ b/.changeset/boot-loader-status-text.md@@ -0,0 +1,6 @@+---+"@truefoundry/trueforge": patch+"@truefoundry/trueforge-ui": patch+---++Announce boot loading with a light-themed orb for contrast outside ThemeProvider.diff --git a/.changeset/thinking-orb-loader.md b/.changeset/thinking-orb-loader.mdnew file mode 100644index 000000000..9d8c76f04--- /dev/null+++ b/.changeset/thinking-orb-loader.md@@ -0,0 +1,6 @@+---+"@truefoundry/trueforge": patch+"@truefoundry/trueforge-ui": patch+---++Use an animated thinking orb for application boot and server initialization.diff --git a/packages/frontend/package.json b/packages/frontend/package.jsonindex f7c4c3e66..7df484c6f 100644--- a/packages/frontend/package.json+++ b/packages/frontend/package.json@@ -32,7 +32,8 @@"monaco-editor": "^0.52.0","react": "^19.2.4","react-dom": "^19.2.4",- "react-router-dom": "^7.18.2"+ "react-router-dom": "^7.18.2",+ "thinking-orbs": "^0.3.1"},"devDependencies": {"@types/react": "^19.2.17",diff --git a/packages/frontend/src/App.tsx b/packages/frontend/src/App.tsxindex e5afd4001..9e18c2730 100644--- a/packages/frontend/src/App.tsx+++ b/packages/frontend/src/App.tsx@@ -2,6 +2,7 @@ import {getErrorMessage,ThemeProvider,TrueForgeUI,+ useTheme,type SlotOverrides,type ThemeConfig,} from '@truefoundry/trueforge-ui';@@ -12,6 +13,7 @@ import {type HarnessAgentSpec,} from '@truefoundry/trueforge-ui/plugins/trueforge-agent-server-adapter';import { useEffect, useMemo, useState } from 'react';+import { ThinkingOrb } from 'thinking-orbs';import { AuthErrorScreen } from './AuthErrorScreen';import { createAuthAwareFetch } from './authFetch';import { probeSession, type SessionState } from './authSession';@@ -36,6 +38,23 @@ const appTheme: ThemeConfig = {},};+function Loader() {+ const { mode } = useTheme();+ return (+ <div className="boot-screen" role="status" aria-label="Loading" aria-live="polite" aria-busy="true">+ <ThinkingOrb+ state="connecting"+ speed={1}+ theme={mode}+ paused={false}+ aria-hidden+ size={64}+ style={{ width: '4.5rem', height: '4.5rem' }}+ />+ </div>+ );+}+type BootState =| { status: 'loading' }| { status: 'error'; message: string }@@ -149,10 +168,7 @@ export function App() {if (session.status === 'checking') {return (<ThemeProvider theme={appTheme}>- <div className="boot-screen" role="status" aria-live="polite" aria-busy="true">- <span className="boot-spinner" aria-hidden="true" />- <span className="sr-only">Loading</span>- </div>+ <Loader /></ThemeProvider>);}@@ -178,10 +194,7 @@ export function App() {if (boot.status === 'loading') {return (<ThemeProvider theme={appTheme}>- <div className="boot-screen" role="status" aria-live="polite" aria-busy="true">- <span className="boot-spinner" aria-hidden="true" />- <span className="sr-only">Loading</span>- </div>+ <Loader /></ThemeProvider>);}diff --git a/packages/frontend/src/index.css b/packages/frontend/src/index.cssindex 6b17e2b8f..35a3131f2 100644--- a/packages/frontend/src/index.css+++ b/packages/frontend/src/index.css@@ -48,7 +48,9 @@ body {display: grid;place-items: center;padding: 2rem;+ /* Match ThemeProvider mode so ThinkingOrb ink stays visible (body stays white). */color: var(--text-secondary, #71717a);+ background: var(--primary-bg, #fff);}.boot-spinner {diff --git a/packages/trueforge-ui/package.json b/packages/trueforge-ui/package.jsonindex 9d306abee..1e25561a7 100644--- a/packages/trueforge-ui/package.json+++ b/packages/trueforge-ui/package.json@@ -109,6 +109,7 @@"react-syntax-highlighter": "^16.1.1","remark-gfm": "^4.0.1","tailwind-merge": "^3.6.0",+ "thinking-orbs": "^0.3.1","truefoundry-gateway-sdk": "^0.4.2","zod": "^4.4.3"},diff --git a/packages/trueforge-ui/src/containers/TrueForgeUIShell.tsx b/packages/trueforge-ui/src/containers/TrueForgeUIShell.tsxindex 1521ef457..34b525724 100644--- a/packages/trueforge-ui/src/containers/TrueForgeUIShell.tsx+++ b/packages/trueforge-ui/src/containers/TrueForgeUIShell.tsx@@ -2,13 +2,13 @@import type { TrueFoundryAgentConfig, UseTrueFoundryAgentRuntimeOptions } from '@truefoundry/assistant-ui-runtime';import { lazy, Suspense, useCallback, useMemo, useState, type ReactNode } from 'react';+import { ThinkingOrb } from 'thinking-orbs';import { AgentConfigInstructionsProvider } from '../atoms/draft/AgentConfigInstructionsContext.js';import { DraftCatalogProvider } from '../atoms/draft/DraftCatalogProvider.js';import { DraftSpecPreferenceBridge } from '../atoms/draft/DraftSpecPreferenceBridge.js';import { cn } from '../atoms/lib/cn.js';import { IS_CREATE_AGENT_METADATA_KEY, isCreateAgentMetadataValue } from '../atoms/lib/sessionCreateAgent.js';-import { Spinner } from '../atoms/primitives/Spinner.js';import { CurrentUserProvider, type CurrentUser } from '../contexts/CurrentUserContext.js';import { WidgetVisibilityProvider } from '../layouts/WidgetVisibilityContext.js';import { HistorySessionSwitchBridge } from '../routing/HistorySessionSwitchBridge.js';@@ -22,7 +22,7 @@ import { createSessionListCache, withSessionListCache } from '../server/sessionLimport { DEFAULT_AGENT_CONFIG, ShellModeProvider, useShellMode, type AgentConfig } from '../server/ShellModeContext.js';import type { TrueForgeServerConfig } from '../server/TrueForgeServerConfig.js';import type { AgentUIServer, CreateSessionRequest } from '../server/types.js';-import { SlotsProvider, type SlotOverrides } from '../theme/SlotsProvider.js';+import { SlotsProvider, useThemeMode, type SlotOverrides } from '../theme/SlotsProvider.js';import type { LayoutProp, ThemeConfig } from '../theme/types.js';import { getErrorMessage } from '../utils/getErrorMessage.js';import { TrueFoundryChatProvider, type TrueFoundryChatProviderProps } from './TrueFoundryChatProvider.js';@@ -93,9 +93,12 @@ function LayoutFallback({ className }: { className?: string }) {/** Shown while `type: "truefoundry"` resolves the agent UI server. */export function ServerInitLoader({ className }: { className?: string }) {+ // Outside ThemeProvider (Suspense), useThemeMode falls back to light.+ const themeMode = useThemeMode();return (<divrole="status"+ aria-label="Loading"aria-live="polite"aria-busy="true"className={cn(@@ -103,8 +106,15 @@ export function ServerInitLoader({ className }: { className?: string }) {className,)}>- <Spinner size={28} className="text-text-primary" />- <span className="sr-only">Loading</span>+ <ThinkingOrb+ state="connecting"+ speed={1}+ theme={themeMode}+ paused={false}+ aria-hidden+ size={64}+ style={{ width: '4.5rem', height: '4.5rem' }}+ /></div>);}diff --git a/packages/trueforge-ui/test/containers/TrueForgeUI.test.tsx b/packages/trueforge-ui/test/containers/TrueForgeUI.test.tsxindex 15d8dca99..fab276647 100644--- a/packages/trueforge-ui/test/containers/TrueForgeUI.test.tsx+++ b/packages/trueforge-ui/test/containers/TrueForgeUI.test.tsx@@ -41,6 +41,10 @@ vi.mock('@truefoundry/assistant-ui-runtime/plugins/truefoundry-agent-server-adap),}));+vi.mock('thinking-orbs', () => ({+ ThinkingOrb: () => <div data-testid="thinking-orb" />,+}));+vi.mock('@/plugins/trueforge-agent-server-adapter/index.js', () => ({createTrueForgeAgentUIServer: vi.fn(async () =>createMockAgentUIServer({@@ -360,6 +364,7 @@ describe('TrueForgeUI', () => {);expect(screen.getByRole('status', { name: 'Loading' })).toBeInTheDocument();+ expect(screen.getByTestId('thinking-orb')).toBeInTheDocument();});});diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 2c13d644d..d91ce6711 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -89,6 +89,9 @@ importers:react-router-dom:specifier: ^7.18.2+ thinking-orbs:+ specifier: ^0.3.1+ version: 0.3.1([email protected])devDependencies:'@types/react':specifier: ^19.2.17@@ -407,6 +410,9 @@ importers:tailwind-merge:specifier: ^3.6.0version: 3.6.0+ thinking-orbs:+ specifier: ^0.3.1+ version: 0.3.1([email protected])truefoundry-gateway-sdk:specifier: ^0.4.2version: 0.4.2@@ -7125,6 +7131,11 @@ packages:resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==}+ resolution: {integrity: sha512-3BG1aeB1RUTxItCml/BBuIz5JRM4kZqGuyx+vouv0fXTtcR9ZNoKjWGneHPx94y74GxgArwJZ1qbJR5dt54kSw==}+ peerDependencies:+ react: '>=18.0.0'+resolution: {integrity: sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==}@@ -15157,6 +15168,10 @@ snapshots:dependencies:any-promise: 1.3.0+ dependencies:+ react: 19.2.8+