The open-source agent harness - the runtime layer that turns an LLM into a working agent.
Improve Agents schedules column and MCP tools modal UX (#667)
Govinda Vashishthaf2ca3384adc2
diff --git a/.changeset/boot-loading-spinner.md b/.changeset/boot-loading-spinner.mdnew file mode 100644index 000000000..dcc5259f5--- /dev/null+++ b/.changeset/boot-loading-spinner.md@@ -0,0 +1,5 @@+---+"@truefoundry/trueforge": patch+---++Show a spinner on the app boot screens instead of "Loading application…" text.diff --git a/.changeset/schedules-list-limit-100.md b/.changeset/schedules-list-limit-100.mdnew file mode 100644index 000000000..874069f85--- /dev/null+++ b/.changeset/schedules-list-limit-100.md@@ -0,0 +1,5 @@+---+"@truefoundry/trueforge-ui": patch+---++Show active/paused schedule counts in the Agents library, pin selected MCPs when reopening the tools modal, and align paused schedule badge colors.diff --git a/packages/frontend/src/App.tsx b/packages/frontend/src/App.tsxindex a1768b6e0..14f3e876d 100644--- a/packages/frontend/src/App.tsx+++ b/packages/frontend/src/App.tsx@@ -149,7 +149,10 @@ export function App() {if (session === 'checking') {return (<ThemeProvider theme={appTheme}>- <div className="boot-screen">Loading application…</div>+ <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></ThemeProvider>);}@@ -175,7 +178,10 @@ export function App() {if (boot.status === 'loading') {return (<ThemeProvider theme={appTheme}>- <div className="boot-screen">Loading application…</div>+ <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></ThemeProvider>);}diff --git a/packages/frontend/src/index.css b/packages/frontend/src/index.cssindex 4eaaebd32..6b17e2b8f 100644--- a/packages/frontend/src/index.css+++ b/packages/frontend/src/index.css@@ -51,6 +51,22 @@ body {color: var(--text-secondary, #71717a);}+.boot-spinner {+ box-sizing: border-box;+ width: 1.75rem;+ height: 1.75rem;+ border: 0.125rem solid color-mix(in oklab, currentColor 25%, transparent);+ border-top-color: currentColor;+ border-radius: 50%;+ animation: boot-spin 0.7s linear infinite;+}++@keyframes boot-spin {+ to {+ transform: rotate(360deg);+ }+}+.boot-screen[data-error='true'] {color: var(--failure-bg, #ef4444);}diff --git a/packages/trueforge-ui/src/atoms/AgentsLibrary.tsx b/packages/trueforge-ui/src/atoms/AgentsLibrary.tsxindex aa144d117..ab3045d9a 100644--- a/packages/trueforge-ui/src/atoms/AgentsLibrary.tsx+++ b/packages/trueforge-ui/src/atoms/AgentsLibrary.tsx@@ -12,7 +12,6 @@ import { useSlot } from '../theme/SlotsProvider.js';import { replaceScheduleShareSearch } from '../utils/scheduleShareUrl.js';import { AgentOverflowMenu } from './AgentOverflowMenu.js';import { EmptyScreen, EmptyScreenQueryHighlight } from './EmptyScreen.js';-import { cn } from './lib/cn.js';import { mountName } from './lib/mountName.js';import { useSearchAgentsList } from './lib/useSearchAgentsList.js';import { PageHeader } from './PageHeader.js';@@ -28,7 +27,7 @@ export type AgentsLibraryProps = {export type AgentScheduleSummary = {count: number;- hasPaused: boolean;+ pausedCount: number;};export type AgentLibraryRowProps = {@@ -52,20 +51,21 @@ function displayModelLabel(modelName: string): string {function AgentSchedulesEmptyState({ agentName, onOpen }: { agentName: string; onOpen?: () => void }) {return (- <button- type="button"- aria-label={`Add schedule for ${agentName}`}- className="text-text-secondary hover:text-primary-button-bg cursor-pointer text-sm font-medium"- onClick={onOpen}- >- <span aria-hidden className="md:group-hover:hidden">+ <>+ <span aria-hidden className="text-text-secondary text-sm md:group-hover:hidden">-</span>- <span aria-hidden className="hidden items-center gap-1 md:group-hover:inline-flex">+ <Button.Ghost+ type="button"+ size="small"+ aria-label={`Add schedule for ${agentName}`}+ className="hidden md:group-hover:inline-flex"+ onClick={onOpen}+ ><Icon name="plus" className="size-3.5 shrink-0" />Schedule- </span>- </button>+ </Button.Ghost>+ </>);}@@ -78,22 +78,32 @@ function AgentSchedulesBadge({agentName: string;onOpen?: () => void;}) {- const warning = summary.hasPaused;+ const pausedCount = summary.pausedCount;+ const activeCount = summary.count - pausedCount;+ const ariaParts = [+ ...(activeCount > 0 ? [`${activeCount} active`] : []),+ ...(pausedCount > 0 ? [`${pausedCount} paused`] : []),+ ];return (<buttontype="button"- aria-label={`${String(summary.count)} schedules for ${agentName}${warning ? ' (has paused)' : ''}`}- className={cn(- 'inline-flex cursor-pointer items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium',- warning- ? 'border-amber-600/30 bg-amber-500/10 text-amber-800 dark:text-amber-300'- : 'border-border bg-secondary-bg text-text-secondary',- )}+ aria-label={`${ariaParts.join(', ')} schedules for ${agentName}`}+ className="inline-flex cursor-pointer items-center gap-1.5"onClick={onOpen}>- <Icon name="calendar-clock" className="size-3.5 shrink-0" />- <span>{summary.count}</span>- {warning ? <Icon name="triangle-exclamation" className="size-3.5 shrink-0" /> : null}+ {activeCount > 0 ? (+ <span className="inline-flex items-center gap-1 rounded-md border border-emerald-600/30 bg-emerald-500/10 px-2 py-0.5 text-xs font-medium text-emerald-700 dark:border-emerald-400/35 dark:bg-emerald-500/15 dark:text-emerald-300">+ <Icon name="calendar-clock" className="size-3.5 shrink-0" />+ <span>{activeCount} Active</span>+ </span>+ ) : null}+ {pausedCount > 0 ? (+ <span className="inline-flex items-center gap-1 rounded-md border border-amber-600/30 bg-amber-500/10 px-2 py-0.5 text-xs font-medium text-amber-800 dark:border-amber-400/35 dark:bg-amber-500/15 dark:text-amber-300">+ {activeCount === 0 ? <Icon name="calendar-clock" className="size-3.5 shrink-0" /> : null}+ <span>{pausedCount} Paused</span>+ <Icon name="triangle-exclamation" className="size-3.5 shrink-0" />+ </span>+ ) : null}</button>);}@@ -123,7 +133,6 @@ export function AgentLibraryRow({const connectorsTitle = mcpNames.length ? mcpNames.join(', ') : `${mcpCount} connectors`;const skillsTitle = skillNames.length ? skillNames.join(', ') : `${skillsCount} skills`;const hasConfiguration = modelLabel != null || skillsCount > 0 || mcpCount > 0;-const hasNoSchedules = scheduleSummary != null && scheduleSummary.count === 0;return (@@ -216,10 +225,10 @@ function summarizeSchedulesByAgent(schedules: readonly Schedule[]): Map<string,const map = new Map<string, AgentScheduleSummary>();for (const schedule of schedules) {const id = schedule.agentId;- const prev = map.get(id) ?? { count: 0, hasPaused: false };+ const prev = map.get(id) ?? { count: 0, pausedCount: 0 };const next = {count: prev.count + 1,- hasPaused: prev.hasPaused || schedule.status === 'paused',+ pausedCount: prev.pausedCount + (schedule.status === 'paused' ? 1 : 0),};map.set(id, next);if (schedule.agentName != null && schedule.agentName !== '' && schedule.agentName !== id) {@@ -402,7 +411,7 @@ export function AgentsLibrary({ onSelectAgent }: AgentsLibraryProps) {<TableRow className="hover:bg-transparent"><TableHead>Agent name</TableHead><TableHead>Configuration</TableHead>- {showSchedulesColumn ? <TableHead className="w-[8rem]">Schedules</TableHead> : null}+ {showSchedulesColumn ? <TableHead className="w-[14rem]">Schedules</TableHead> : null}<TableHead className="w-px"><span className="sr-only">Actions</span></TableHead>@@ -416,7 +425,7 @@ export function AgentsLibrary({ onSelectAgent }: AgentsLibraryProps) {const summary = showSchedulesColumn? (scheduleByAgent?.get(id) ??scheduleByAgent?.get(agent.name) ??- (scheduleByAgent == null ? null : { count: 0, hasPaused: false }))+ (scheduleByAgent == null ? null : { count: 0, pausedCount: 0 })): undefined;return (<SlottedAgentLibraryRowdiff --git a/packages/trueforge-ui/src/atoms/draft/AgentMcpEditorContent.tsx b/packages/trueforge-ui/src/atoms/draft/AgentMcpEditorContent.tsxindex 5b17e8958..7e0d2790c 100644--- a/packages/trueforge-ui/src/atoms/draft/AgentMcpEditorContent.tsx+++ b/packages/trueforge-ui/src/atoms/draft/AgentMcpEditorContent.tsx@@ -104,6 +104,15 @@ export function AgentMcpEditorContent({}: AgentMcpEditorContentProps) {const [toolQuery, setToolQuery] = useState('');const [collapsedMountIds, setCollapsedMountIds] = useState<ReadonlySet<string>>(() => new Set());+ // Freeze open-time selected MCPs at the top; live picks must not reshuffle the list.+ const [openSelectedKeys] = useState(() => {+ const keys = new Set<string>();+ for (const mount of editableMountsFromSpec(spec.mcpServers)) {+ keys.add(mount.id);+ keys.add(mount.name);+ }+ return keys;+ });const mcpMounts = editableMountsFromSpec(spec.mcpServers);const catalogConnectors = connectorsWithSelectedStubs({ connectors, selected: mcpMounts });const selectedConnector = catalogConnectors.find(item => item.id === activeConnectorId);@@ -114,9 +123,13 @@ export function AgentMcpEditorContent({const canAddActiveConnector = selectedConnector !== undefined && selectedConnector.authenticated === true;const enabledTools = activeMount ? enabledToolsFromMount(activeMount.value) : [];const normalizedQuery = query.trim().toLowerCase();- const filteredConnectors = catalogConnectors.filter(item =>- `${item.name} ${item.description ?? ''}`.toLowerCase().includes(normalizedQuery),- );+ const filteredConnectors = catalogConnectors+ .filter(item => `${item.name} ${item.description ?? ''}`.toLowerCase().includes(normalizedQuery))+ .sort((left, right) => {+ const leftPinned = openSelectedKeys.has(left.id) || openSelectedKeys.has(left.name);+ const rightPinned = openSelectedKeys.has(right.id) || openSelectedKeys.has(right.name);+ return Number(rightPinned) - Number(leftPinned);+ });const normalizedToolQuery = toolQuery.trim().toLowerCase();const filteredTools =normalizedToolQuery === '' ? tools : tools.filter(tool => tool.name.toLowerCase().includes(normalizedToolQuery));diff --git a/packages/trueforge-ui/src/atoms/schedules/ScheduleFormDrawer.tsx b/packages/trueforge-ui/src/atoms/schedules/ScheduleFormDrawer.tsxindex a48e7ab08..73394f67a 100644--- a/packages/trueforge-ui/src/atoms/schedules/ScheduleFormDrawer.tsx+++ b/packages/trueforge-ui/src/atoms/schedules/ScheduleFormDrawer.tsx@@ -245,7 +245,7 @@ function ScheduleFormDrawerBody({<div className="flex flex-col gap-2">{error != null ? <p className="text-failure-bg text-sm">{error}</p> : null}<Button.Secondary type="button" className="w-full" disabled={activating} onClick={() => void handleActivate()}>- Activate Anyway+ Activate Schedule</Button.Secondary></div>);diff --git a/packages/trueforge-ui/src/atoms/schedules/ScheduleStatusBadge.tsx b/packages/trueforge-ui/src/atoms/schedules/ScheduleStatusBadge.tsxindex cf19cbcd5..274f6743a 100644--- a/packages/trueforge-ui/src/atoms/schedules/ScheduleStatusBadge.tsx+++ b/packages/trueforge-ui/src/atoms/schedules/ScheduleStatusBadge.tsx@@ -11,13 +11,13 @@ export function ScheduleStatusBadge({ status }: { status: ScheduleStatus }) {'inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium',active? 'border-emerald-600/30 bg-emerald-500/10 text-emerald-700 dark:border-emerald-400/35 dark:bg-emerald-500/15 dark:text-emerald-300'- : 'border-border bg-secondary-bg text-text-secondary',+ : 'border-amber-600/30 bg-amber-500/10 text-amber-800 dark:border-amber-400/35 dark:bg-amber-500/15 dark:text-amber-300',)}><spanclassName={cn('size-1.5 shrink-0 rounded-full',- active ? 'bg-emerald-600 dark:bg-emerald-400' : 'bg-text-secondary',+ active ? 'bg-emerald-600 dark:bg-emerald-400' : 'bg-amber-600 dark:bg-amber-400',)}aria-hidden/>diff --git a/packages/trueforge-ui/src/atoms/schedules/TestScheduleScreen.tsx b/packages/trueforge-ui/src/atoms/schedules/TestScheduleScreen.tsxindex 980593ebe..e61b03fad 100644--- a/packages/trueforge-ui/src/atoms/schedules/TestScheduleScreen.tsx+++ b/packages/trueforge-ui/src/atoms/schedules/TestScheduleScreen.tsx@@ -85,18 +85,18 @@ export function TestScheduleScreen({ schedule, agentName, mcpMounts, onEditConfi<section className="overflow-hidden rounded-lg border border-border bg-card-bg"><DetailRow label="Agent">{agentName}</DetailRow><DetailRow label="Name">{schedule.name}</DetailRow>+ <DetailRow label="Status">+ <ScheduleStatusBadge status={schedule.status} />+ </DetailRow><DetailRow label="Task"><span className="whitespace-pre-wrap break-words">{schedule.task}</span></DetailRow>- <DetailRow label="Cadence">+ <DetailRow label="Frequency"><div className="flex flex-wrap items-center justify-end gap-1.5"><span>{cadence}</span><code className="text-text-secondary font-mono text-xs">{schedule.cron}</code></div></DetailRow>- <DetailRow label="Status">- <ScheduleStatusBadge status={schedule.status} />- </DetailRow><div className="flex justify-end px-3 py-2.5"><Button.Secondary type="button" size="small" onClick={onEditConfiguration}><Icon name="pencil" className="size-3.5" />diff --git a/packages/trueforge-ui/test/atoms/AgentsLibrary.test.tsx b/packages/trueforge-ui/test/atoms/AgentsLibrary.test.tsxindex 236f851a0..a37191794 100644--- a/packages/trueforge-ui/test/atoms/AgentsLibrary.test.tsx+++ b/packages/trueforge-ui/test/atoms/AgentsLibrary.test.tsx@@ -493,10 +493,12 @@ describe('AgentsLibraryButton', () => {);});- const badge = await screen.findByRole('button', { name: /2 schedules for alpha-agent/ });- expect(badge).toHaveTextContent('2');+ const badge = await screen.findByRole('button', { name: /schedules for alpha-agent/ });+ expect(badge).toHaveTextContent('1 Active');+ expect(badge).toHaveTextContent('1 Paused');+ expect(badge).toHaveAccessibleName('1 active, 1 paused schedules for alpha-agent');const addSchedule = screen.getByRole('button', { name: 'Add schedule for beta-agent' });- expect(addSchedule).toHaveTextContent('-');+ expect(addSchedule).toHaveTextContent('Schedule');fireEvent.click(addSchedule);expect(screen.getByTestId('library-agent-id')).toHaveTextContent('beta-agent');@@ -505,7 +507,7 @@ describe('AgentsLibraryButton', () => {expect(new URL(window.location.href).searchParams.get('agent')).toBeNull();expect(new URL(window.location.href).searchParams.get('isNew')).toBe('true');- fireEvent.click(screen.getByRole('button', { name: /2 schedules for alpha-agent/ }));+ fireEvent.click(screen.getByRole('button', { name: /schedules for alpha-agent/ }));expect(screen.getByTestId('library-agent-id')).toHaveTextContent('alpha-agent');expect(new URL(window.location.href).searchParams.get('agentId')).toBe('alpha-agent');expect(new URL(window.location.href).searchParams.get('tab')).toBe('schedules');diff --git a/packages/trueforge-ui/test/atoms/draft/AgentMcpEditorContent.search.test.tsx b/packages/trueforge-ui/test/atoms/draft/AgentMcpEditorContent.search.test.tsxindex 0dad86c32..4b41dc35b 100644--- a/packages/trueforge-ui/test/atoms/draft/AgentMcpEditorContent.search.test.tsx+++ b/packages/trueforge-ui/test/atoms/draft/AgentMcpEditorContent.search.test.tsx@@ -43,6 +43,89 @@ describe('AgentMcpEditorContent tool search', () => {expect(screen.getByRole('button', { name: 'Linear' })).toBeInTheDocument();});+ it('lists MCP connectors with selected tools before unselected ones', () => {+ render(+ <SlotsProvider>+ <AgentMcpEditorContent+ spec={{+ model: { name: 'openai/gpt' },+ mcpServers: [{ id: 'linear', name: 'Linear', enableTools: ['@all'] }],+ }}+ connectors={[+ { id: 'github', name: 'GitHub', description: 'Source control', authenticated: true },+ { id: 'slack', name: 'Slack', description: 'Chat', authenticated: true },+ { id: 'linear', name: 'Linear', description: 'Issue tracking', authenticated: true },+ ]}+ query=""+ activeConnectorId="linear"+ tools={[]}+ connectorLoading={false}+ connectorError={null}+ toolsLoading={false}+ toolsError={null}+ onQueryChange={vi.fn()}+ onSelectConnector={vi.fn()}+ onRetryTools={vi.fn()}+ onChange={vi.fn()}+ />+ </SlotsProvider>,+ );++ const names = screen+ .getAllByRole('button')+ .map(button => button.getAttribute('aria-label'))+ .filter((name): name is string => name === 'GitHub' || name === 'Slack' || name === 'Linear');+ expect(names).toEqual(['Linear', 'GitHub', 'Slack']);+ });++ it('does not reshuffle the MCP list when tools are selected while the modal is open', () => {+ const connectors = [+ { id: 'github', name: 'GitHub', description: 'Source control', authenticated: true },+ { id: 'slack', name: 'Slack', description: 'Chat', authenticated: true },+ { id: 'linear', name: 'Linear', description: 'Issue tracking', authenticated: true },+ ];+ const baseProps = {+ connectors,+ query: '',+ activeConnectorId: 'github',+ tools: [{ id: 'search', name: 'search' }],+ connectorLoading: false,+ connectorError: null,+ toolsLoading: false,+ toolsError: null,+ onQueryChange: vi.fn(),+ onSelectConnector: vi.fn(),+ onRetryTools: vi.fn(),+ onChange: vi.fn(),+ };+ const view = render(+ <SlotsProvider>+ <AgentMcpEditorContent {...baseProps} spec={{ model: { name: 'openai/gpt' } }} />+ </SlotsProvider>,+ );++ const names = () =>+ screen+ .getAllByRole('button')+ .map(button => button.getAttribute('aria-label'))+ .filter((name): name is string => name === 'GitHub' || name === 'Slack' || name === 'Linear');+ expect(names()).toEqual(['GitHub', 'Slack', 'Linear']);++ view.rerender(+ <SlotsProvider>+ <AgentMcpEditorContent+ {...baseProps}+ spec={{+ model: { name: 'openai/gpt' },+ mcpServers: [{ id: 'linear', name: 'Linear', enableTools: ['@all'] }],+ }}+ />+ </SlotsProvider>,+ );++ expect(names()).toEqual(['GitHub', 'Slack', 'Linear']);+ });+it('filters the tool list as the user types in Search Tools', () => {render(<SlotsProvider>diff --git a/packages/trueforge-ui/test/atoms/schedules/ScheduleFormDrawer.test.tsx b/packages/trueforge-ui/test/atoms/schedules/ScheduleFormDrawer.test.tsxindex 6177b333c..be047fa79 100644--- a/packages/trueforge-ui/test/atoms/schedules/ScheduleFormDrawer.test.tsx+++ b/packages/trueforge-ui/test/atoms/schedules/ScheduleFormDrawer.test.tsx@@ -237,7 +237,7 @@ describe('ScheduleFormDrawer', () => {expect(screen.getByText('Schedule saved as paused')).toBeInTheDocument();expect(screen.getByText('Slack 1234')).toBeInTheDocument();expect(screen.getByRole('button', { name: 'Run Test' })).toBeEnabled();- expect(screen.getByRole('button', { name: 'Activate Anyway' })).toBeInTheDocument();+ expect(screen.getByRole('button', { name: 'Activate Schedule' })).toBeInTheDocument();});it('starts a test run from the test screen', async () => {@@ -359,7 +359,7 @@ describe('ScheduleFormDrawer', () => {});await saveCreateForm();- fireEvent.click(await screen.findByRole('button', { name: 'Activate Anyway' }));+ fireEvent.click(await screen.findByRole('button', { name: 'Activate Schedule' }));await waitFor(() => {expect(updateSchedule).toHaveBeenCalledWith(