The open-source agent harness - the runtime layer that turns an LLM into a working agent.
schedule agents changes config UI fixes (#638)
Vinite3973a5a5753
diff --git a/.changeset/composer-tools-count.md b/.changeset/composer-tools-count.mdnew file mode 100644index 000000000..09b6f43e3--- /dev/null+++ b/.changeset/composer-tools-count.md@@ -0,0 +1,5 @@+---+"@truefoundry/trueforge-ui": patch+---++Show the selected connector and skill count beside the composer tools icon.diff --git a/.changeset/pre/agent-model-settings-dropdown.md b/.changeset/pre/agent-model-settings-dropdown.mdnew file mode 100644index 000000000..fc34f259a--- /dev/null+++ b/.changeset/pre/agent-model-settings-dropdown.md@@ -0,0 +1,5 @@+---+'@truefoundry/trueforge-ui': patch+---++Open model settings beside the Agent Config model selector, add UI and editable JSON parameter views, and support typed custom model parameters.diff --git a/.changeset/schedule-recurrence-group.md b/.changeset/schedule-recurrence-group.mdnew file mode 100644index 000000000..b47ec8515--- /dev/null+++ b/.changeset/schedule-recurrence-group.md@@ -0,0 +1,5 @@+---+"@truefoundry/trueforge-ui": patch+---++Group schedule recurrence controls and display the cadence in an attached summary footer.diff --git a/packages/trueforge-ui/src/atoms/draft/AgentConfigPanel.tsx b/packages/trueforge-ui/src/atoms/draft/AgentConfigPanel.tsxindex cf31cdd69..90c8b2f26 100644--- a/packages/trueforge-ui/src/atoms/draft/AgentConfigPanel.tsx+++ b/packages/trueforge-ui/src/atoms/draft/AgentConfigPanel.tsx@@ -22,6 +22,9 @@ import { displayModelLabel, ProviderMark } from './DraftModelCatalogPanel.js';import { modelParamSummary } from './modelParamsSummary.js';import { runtimeConfigSummary, runtimeConfigValueClassName } from './runtimeConfigSummary.js';+const DEFAULT_INSTRUCTIONS =+ 'Enter detailed instructions for your agent. E.g. You are a helpful assistant that helps users plan trips. Always ask clarifying questions before making suggestions...';+export type AgentConfigPanelProps = {spec: AgentSpec;model?: ModelSelection;@@ -352,11 +355,13 @@ export function AgentConfigPanel({instructionPreview ? 'text-text-primary' : 'text-text-secondary',)}>- {instructionPreview || 'No instructions added.'}- </p>- <p className="text-text-secondary mt-2 text-xs">- {userMessageCount} user {userMessageCount === 1 ? 'message' : 'messages'}+ {instructionPreview || DEFAULT_INSTRUCTIONS}</p>+ {userMessageCount > 0 ? (+ <p className="text-text-secondary mt-2 text-xs">+ {userMessageCount} user {userMessageCount === 1 ? 'message' : 'messages'}+ </p>+ ) : null}</div><Icon name="chevron-right" className="text-text-secondary size-4 shrink-0" /></button>diff --git a/packages/trueforge-ui/src/atoms/draft/DraftCompositeSelector.tsx b/packages/trueforge-ui/src/atoms/draft/DraftCompositeSelector.tsxindex 6ed211c30..46b8eba15 100644--- a/packages/trueforge-ui/src/atoms/draft/DraftCompositeSelector.tsx+++ b/packages/trueforge-ui/src/atoms/draft/DraftCompositeSelector.tsx@@ -655,7 +655,7 @@ export function DraftCompositeSelector({ disabled, isRunning, onAttach }: DraftCaria-haspopup="dialog"aria-expanded={open}aria-controls={open ? menuId : undefined}- className={auiButtonClass({ variant: 'ghost', size: 'icon' })}+ className={auiButtonClass({ variant: 'ghost', size: 'large', className: 'gap-1.5 px-2 text-xs' })}onClick={() => {if (open) {setOpenAndFlush(false);@@ -664,9 +664,11 @@ export function DraftCompositeSelector({ disabled, isRunning, onAttach }: DraftCopenPicker();}}>- {/* Icon-only trigger; the count and name reach assistive tech via aria-label- and sighted users via the tooltip, which lists the selected tools. */}<Icon name="wrench" />+ <span>Tools</span>+ <span className="rounded bg-primary-button-bg/10 px-1.5 py-0.5 text-[0.625rem] font-semibold text-primary-button-bg">+ {toolsCount}+ </span></button></Tooltip>) : null}diff --git a/packages/trueforge-ui/src/atoms/primitives/PopoverSelect.tsx b/packages/trueforge-ui/src/atoms/primitives/PopoverSelect.tsxindex 99c875b40..9149aa440 100644--- a/packages/trueforge-ui/src/atoms/primitives/PopoverSelect.tsx+++ b/packages/trueforge-ui/src/atoms/primitives/PopoverSelect.tsx@@ -22,6 +22,7 @@ type CommonPopoverSelectProps<T extends string> = {placeholder?: string;disabled?: boolean;className?: string;+ menuClassName?: string;/** Which edge of the trigger the menu opens toward. Default `bottom`. */menuPlacement?: 'top' | 'bottom';/** When set, renders a labeled chip trigger (label | value chip + chevron). */@@ -174,6 +175,7 @@ export function PopoverSelect<T extends string>(props: PopoverSelectProps<T>) {className={cn(auiSelectMenuClass('left-0 min-w-full'),menuPlacement === 'top' && 'top-auto bottom-full mt-0 mb-1',+ props.menuClassName,)}>{props.options.map(option => {@@ -189,7 +191,7 @@ export function PopoverSelect<T extends string>(props: PopoverSelectProps<T>) {className={auiSelectOptionClass()}onClick={() => select(option)}>- <span className="min-w-0 flex-1 whitespace-nowrap">{option.label}</span>+ <span className="min-w-0 flex-1 truncate">{option.label}</span><Icon name="check" className={cn('ml-auto size-4 shrink-0', selected ? 'opacity-100' : 'opacity-0')} /></button>);diff --git a/packages/trueforge-ui/src/atoms/schedules/ScheduleFormDrawer.tsx b/packages/trueforge-ui/src/atoms/schedules/ScheduleFormDrawer.tsxindex c0662847c..c9de59e27 100644--- a/packages/trueforge-ui/src/atoms/schedules/ScheduleFormDrawer.tsx+++ b/packages/trueforge-ui/src/atoms/schedules/ScheduleFormDrawer.tsx@@ -268,7 +268,7 @@ function ScheduleFormDrawerBody({title={title}description={description}anchor="right"- size="lg"+ size="xl"headerIcon={<span className="text-primary-button-bg inline-flex size-8 items-center justify-center"><Icondiff --git a/packages/trueforge-ui/src/atoms/schedules/ScheduleFormFields.tsx b/packages/trueforge-ui/src/atoms/schedules/ScheduleFormFields.tsxindex b1d62f1cd..d3e1f5424 100644--- a/packages/trueforge-ui/src/atoms/schedules/ScheduleFormFields.tsx+++ b/packages/trueforge-ui/src/atoms/schedules/ScheduleFormFields.tsx@@ -1,5 +1,6 @@'use client';+import { Icon } from '../../icons/Icon.js';import { cn } from '../lib/cn.js';import { auiInputClass } from '../lib/inputClasses.js';import { PopoverSelect } from '../primitives/PopoverSelect.js';@@ -97,119 +98,114 @@ export function ScheduleFormFields({<fieldset><legend className="mb-1.5 text-sm font-medium">Recurrence</legend>- <div className="grid grid-cols-3 gap-1 rounded-lg border border-border p-1">- {RECURRENCE_OPTIONS.map(opt => {- const selected = values.recurrence === opt.value;- return (- <button- key={opt.value}- type="button"- className={cn(- 'rounded-md px-2 py-1.5 text-xs font-medium transition-colors',- selected- ? 'border border-primary-button-bg/40 bg-primary-button-bg/10 text-primary-button-bg'- : 'text-text-secondary hover:bg-ghost-button-hover border border-transparent',- )}- aria-pressed={selected}- onClick={() => set('recurrence', opt.value)}- >- {opt.label}- </button>- );- })}- </div>- </fieldset>-- {values.recurrence === 'hourly' ? (- <div className="block max-w-[8rem]">- <span className="mb-1.5 block text-sm font-medium">Minute</span>- <PopoverSelect- aria-label="Minute"- value={String(values.minute)}- options={MINUTE_OPTIONS}- onValueChange={value => set('minute', Number(value))}- />- </div>- ) : null}-- {values.recurrence === 'daily' || values.recurrence === 'weekly' ? (- <div className="flex flex-wrap gap-3">- <div className="block min-w-[7rem] flex-1">- <span className="mb-1.5 block text-sm font-medium">Hour</span>- <PopoverSelect- aria-label="Hour"- value={String(values.hour)}- options={HOUR_OPTIONS}- onValueChange={value => set('hour', Number(value))}- />- </div>- <div className="block min-w-[7rem] flex-1">- <span className="mb-1.5 block text-sm font-medium">Minute</span>- <PopoverSelect- aria-label="Minute"- value={String(values.minute)}- options={MINUTE_OPTIONS}- onValueChange={value => set('minute', Number(value))}- />+ <div className="rounded-t-lg border border-border p-4">+ <div className="flex flex-col gap-4">+ <div className="grid grid-cols-3 gap-1 rounded-lg border border-border bg-primary-bg p-1">+ {RECURRENCE_OPTIONS.map(opt => {+ const selected = values.recurrence === opt.value;+ return (+ <button+ key={opt.value}+ type="button"+ className={cn(+ 'rounded-md border px-2 py-2 text-sm font-medium transition-colors',+ selected+ ? 'border-primary-button-bg/40 bg-primary-button-bg/10 font-semibold text-primary-button-bg'+ : 'border-transparent text-text-secondary hover:bg-ghost-button-hover',+ )}+ aria-pressed={selected}+ onClick={() => set('recurrence', opt.value)}+ >+ {opt.label}+ </button>+ );+ })}+ </div>++ {values.recurrence === 'custom' ? (+ <div className="rounded-md border border-border bg-secondary-bg/40 px-3 py-2">+ <span className="block text-xs text-text-secondary">Existing custom schedule</span>+ <code className="mt-1 block font-mono text-sm text-text-primary">{values.customCron}</code>+ <span className="mt-1 block text-xs text-text-secondary">+ Select Hourly, Daily, or Weekly to replace this schedule.+ </span>+ </div>+ ) : null}++ <div className="flex gap-4">+ {values.recurrence === 'daily' || values.recurrence === 'weekly' ? (+ <div className="min-w-0 flex-1">+ <span className="mb-1.5 block text-sm font-medium">Hour</span>+ <PopoverSelect+ aria-label="Hour"+ value={String(values.hour)}+ options={HOUR_OPTIONS}+ onValueChange={value => set('hour', Number(value))}+ />+ </div>+ ) : null}+ {values.recurrence !== 'custom' ? (+ <div className="min-w-0 flex-1">+ <span className="mb-1.5 block text-sm font-medium">Minute</span>+ <PopoverSelect+ aria-label="Minute"+ value={String(values.minute)}+ options={MINUTE_OPTIONS}+ onValueChange={value => set('minute', Number(value))}+ />+ </div>+ ) : null}+ <div className="min-w-0 flex-1">+ <span className="mb-1.5 block text-sm font-medium">Timezone</span>+ <PopoverSelect+ aria-label="Timezone"+ value={values.timezone}+ options={timezoneOptions}+ onValueChange={value => set('timezone', value)}+ menuClassName="w-full min-w-0"+ />+ </div>+ </div>++ {values.recurrence === 'weekly' ? (+ <fieldset>+ <legend className="mb-2 text-sm font-medium">Days</legend>+ <div className="flex gap-2">+ {WEEKDAY_OPTIONS.map(day => {+ const selected = values.weekdays.includes(day.value);+ return (+ <button+ key={day.value}+ type="button"+ className={cn(+ 'min-w-0 flex-1 rounded-md border px-3 py-2 text-[0.8125rem] font-medium',+ selected+ ? 'border-primary-button-bg/40 bg-primary-button-bg/10 font-semibold text-primary-button-bg'+ : 'border-border text-text-secondary hover:bg-ghost-button-hover',+ )}+ aria-pressed={selected}+ onClick={() => toggleWeekday(day.value)}+ >+ {day.label}+ </button>+ );+ })}+ </div>+ </fieldset>+ ) : null}</div></div>- ) : null}-- {values.recurrence === 'weekly' ? (- <fieldset>- <legend className="mb-1.5 text-sm font-medium">Days</legend>- <div className="flex flex-wrap gap-1.5">- {WEEKDAY_OPTIONS.map(day => {- const selected = values.weekdays.includes(day.value);- return (- <button- key={day.value}- type="button"- className={cn(- 'rounded-md border px-2.5 py-1 text-xs font-medium',- selected- ? 'border-primary-button-bg/40 bg-primary-button-bg/10 text-primary-button-bg'- : 'border-border text-text-secondary hover:bg-ghost-button-hover',- )}- aria-pressed={selected}- onClick={() => toggleWeekday(day.value)}- >- {day.label}- </button>- );- })}+ <div className="rounded-b-lg border border-t-0 border-border bg-primary-button-bg/10 px-4 py-3">+ <div className="flex items-center gap-2">+ <Icon name="clock" className="size-4 shrink-0 text-primary-button-bg" />+ <span className="shrink-0 text-xs font-medium text-text-secondary">Schedule</span>+ <p className="min-w-0 flex-1 truncate text-sm text-text-primary">{cadence || '—'}</p>+ <code className="shrink-0 whitespace-nowrap font-mono text-[0.8125rem] font-bold text-text-secondary">+ {cron || '—'}+ </code></div>- </fieldset>- ) : null}-- {values.recurrence === 'custom' ? (- <div className="rounded-md border border-border bg-secondary-bg/40 px-3 py-2">- <span className="text-text-secondary block text-xs">Existing custom schedule</span>- <code className="text-text-primary mt-1 block font-mono text-sm">{values.customCron}</code>- <span className="text-text-secondary mt-1 block text-xs">- Select Hourly, Daily, or Weekly to replace this schedule.- </span></div>- ) : null}-- <div className="block">- <span className="mb-1.5 block text-sm font-medium">Timezone</span>- <PopoverSelect- aria-label="Timezone"- value={values.timezone}- options={timezoneOptions}- onValueChange={value => set('timezone', value)}- menuPlacement="top"- />- </div>-- <div className="rounded-lg border border-border bg-secondary-bg/40 px-3 py-3">- <div className="flex items-start justify-between gap-3">- <span className="text-text-secondary text-[10px] font-semibold tracking-wide uppercase">Frequency</span>- <code className="text-text-secondary font-mono text-xs">{cron || '—'}</code>- </div>- <p className="text-text-primary mt-1 text-sm font-semibold">{cadence || '—'}</p>- </div>+ </fieldset></div>);}diff --git a/packages/trueforge-ui/src/atoms/schedules/SchedulesPage.tsx b/packages/trueforge-ui/src/atoms/schedules/SchedulesPage.tsxindex 0fa5abeb8..9ae4e072d 100644--- a/packages/trueforge-ui/src/atoms/schedules/SchedulesPage.tsx+++ b/packages/trueforge-ui/src/atoms/schedules/SchedulesPage.tsx@@ -443,13 +443,7 @@ export function SchedulesPage() {return (<TableRow key={schedule.id}><TableCell className="text-text-primary font-medium">- <button- type="button"- className="cursor-pointer text-left"- onClick={() => setDrawer({ kind: 'edit', schedule })}- >- {schedule.name}- </button>+ <span className="text-left !no-underline">{schedule.name}</span></TableCell><TableCell>{agentLabel}</TableCell><TableCell>{cadence}</TableCell>diff --git a/packages/trueforge-ui/test/atoms/draft/DraftCompositeSelector.test.tsx b/packages/trueforge-ui/test/atoms/draft/DraftCompositeSelector.test.tsxindex 278556ad7..f68d290b6 100644--- a/packages/trueforge-ui/test/atoms/draft/DraftCompositeSelector.test.tsx+++ b/packages/trueforge-ui/test/atoms/draft/DraftCompositeSelector.test.tsx@@ -105,8 +105,10 @@ describe('DraftCompositeSelector', () => {it('shows one combined Tools count only for a valid model', () => {const view = renderSelector();- expect(screen.getByRole('button', { name: 'Tools (2)' })).toBeInTheDocument();- fireEvent.click(screen.getByRole('button', { name: 'Tools (2)' }));+ const toolsTrigger = screen.getByRole('button', { name: 'Tools (2)' });+ expect(toolsTrigger).toHaveTextContent('Tools');+ expect(toolsTrigger).toHaveTextContent('2');+ fireEvent.click(toolsTrigger);expect(screen.getByRole('dialog', { name: 'Add to composer' })).toBeInTheDocument();expect(screen.getByRole('button', { name: /Connectors/ })).toBeInTheDocument();expect(screen.getByRole('button', { name: /Skills/ })).toBeInTheDocument();diff --git a/packages/trueforge-ui/test/atoms/schedules/ScheduleFormDrawer.test.tsx b/packages/trueforge-ui/test/atoms/schedules/ScheduleFormDrawer.test.tsxindex fa4161ff3..abaada2a2 100644--- a/packages/trueforge-ui/test/atoms/schedules/ScheduleFormDrawer.test.tsx+++ b/packages/trueforge-ui/test/atoms/schedules/ScheduleFormDrawer.test.tsx@@ -1,5 +1,5 @@// @vitest-environment jsdom-import { fireEvent, render, screen, waitFor } from '@testing-library/react';+import { fireEvent, render, screen, waitFor, within } from '@testing-library/react';import type { ComponentProps } from 'react';import { beforeAll, describe, expect, it, vi } from 'vitest';@@ -147,15 +147,18 @@ describe('ScheduleFormDrawer', () => {expect(await screen.findByLabelText('Agent')).toBeDisabled();});- it('offers only standard recurrence modes and labels the preview as Frequency', async () => {+ it('groups standard recurrence controls with a schedule summary', async () => {renderDrawer({});- expect(await screen.findByRole('button', { name: 'Hourly' })).toBeInTheDocument();- expect(screen.getByRole('button', { name: 'Daily' })).toBeInTheDocument();- expect(screen.getByRole('button', { name: 'Weekly' })).toBeInTheDocument();- expect(screen.queryByRole('button', { name: 'Custom' })).not.toBeInTheDocument();- expect(screen.queryByLabelText('Cron expression')).not.toBeInTheDocument();- expect(screen.getByText('Frequency')).toBeInTheDocument();+ const recurrence = within(await screen.findByRole('group', { name: 'Recurrence' }));+ expect(recurrence.getByRole('button', { name: 'Hourly' })).toBeInTheDocument();+ expect(recurrence.getByRole('button', { name: 'Daily' })).toBeInTheDocument();+ expect(recurrence.getByRole('button', { name: 'Weekly' })).toBeInTheDocument();+ expect(recurrence.getByLabelText('Timezone')).toBeInTheDocument();+ expect(recurrence.queryByRole('button', { name: 'Custom' })).not.toBeInTheDocument();+ expect(recurrence.queryByLabelText('Cron expression')).not.toBeInTheDocument();+ expect(recurrence.getByText('Schedule')).toBeInTheDocument();+ expect(recurrence.getByText(/^Daily 9:00 AM/)).toBeInTheDocument();});it('keeps a legacy custom cron read-only until its recurrence is replaced', async () => {diff --git a/packages/trueforge-ui/test/atoms/schedules/SchedulesPage.test.tsx b/packages/trueforge-ui/test/atoms/schedules/SchedulesPage.test.tsxindex c9ecaa15d..b4646852e 100644--- a/packages/trueforge-ui/test/atoms/schedules/SchedulesPage.test.tsx+++ b/packages/trueforge-ui/test/atoms/schedules/SchedulesPage.test.tsx@@ -96,7 +96,7 @@ describe('SchedulesPage', () => {const { scheduleServer } = renderPage();expect(await screen.findByRole('heading', { name: 'Scheduled Agents' })).toBeInTheDocument();await waitFor(() => {- expect(screen.getByRole('button', { name: 'daily-digest' })).toBeInTheDocument();+ expect(screen.getByText('daily-digest')).toBeInTheDocument();});expect(screen.getAllByText('demo-agent').length).toBeGreaterThan(0);expect(screen.getByText('—')).toBeInTheDocument();@@ -125,13 +125,13 @@ describe('SchedulesPage', () => {});renderPage(sampleSchedules, {}, listSchedules);- expect(await screen.findByRole('button', { name: 'daily-digest' })).toBeInTheDocument();+ expect(await screen.findByText('daily-digest')).toBeInTheDocument();fireEvent.click(screen.getByRole('button', { name: 'Next page' }));await waitFor(() => {expect(listSchedules).toHaveBeenLastCalledWith(expect.objectContaining({ pageToken: 'page-2', limit: 10 }));});- expect(await screen.findByRole('button', { name: 'weekly-digest' })).toBeInTheDocument();+ expect(await screen.findByText('weekly-digest')).toBeInTheDocument();});it('ignores run history returned for a stale schedules page', async () => {@@ -150,9 +150,9 @@ describe('SchedulesPage', () => {});renderPage(sampleSchedules, { listScheduleRuns }, listSchedules);- await screen.findByRole('button', { name: 'daily-digest' });+ await screen.findByText('daily-digest');fireEvent.click(screen.getByRole('button', { name: 'Next page' }));- expect(await screen.findByRole('button', { name: 'weekly-digest' })).toBeInTheDocument();+ expect(await screen.findByText('weekly-digest')).toBeInTheDocument();await act(async () => {resolveFirstRuns([@@ -172,7 +172,7 @@ describe('SchedulesPage', () => {it('filters by agent via agentIds', async () => {const { scheduleServer } = renderPage();- await screen.findByRole('button', { name: 'daily-digest' });+ await screen.findByText('daily-digest');fireEvent.click(screen.getByRole('button', { name: 'Filter by agent' }));fireEvent.click(screen.getByRole('option', { name: 'demo-agent' }));@@ -344,7 +344,7 @@ describe('SchedulesPage', () => {nextPageToken: 'page-2',}));- await screen.findByRole('button', { name: 'daily-digest' });+ await screen.findByText('daily-digest');fireEvent.change(screen.getByPlaceholderText('Search schedules by name'), {target: { value: 'nope' },});