From aefc080812849c5f00e99caac6faebbd8e8e66d7 Mon Sep 17 00:00:00 2001 From: JJ Eaton <58495321+oldbettie@users.noreply.github.com> Date: Thu, 12 Nov 2026 13:01:15 +0800 Subject: [PATCH 1/4] fix(web): agent rail is a single column; agent forms use the shared primitives The Agents rail laid agents out as a multi-column icon grid with uneven gaps, the hover card wrapped its actions unevenly, Scheduled tasks had two entry points, and the create/edit agent forms were custom-styled controls with no section structure. The rail is now one column of 32px rows (icon, name, active count) shared by All agents, every agent, and Scheduled tasks. New agent is the primary action in a compact header, Scheduled tasks is a single row pinned to the rail footer, and the duplicate narrow-width Scheduled button is gone. The hover card uses one spacing scale with grouped actions. The agent editor, preset picker, and shared skills dialog use DialogHeader/Panel/Footer with ui Input, Select, Textarea, Checkbox, and Toggle, grouped into Identity, Model and modes, Instructions, and Skills, with a pinned Save/Cancel footer. Co-Authored-By: Claude Opus 5.5 --- .../web/src/components/agents/AgentEditor.tsx | 739 ++++++++++-------- apps/web/src/components/agents/AgentIcon.tsx | 8 +- .../src/components/agents/AgentIconPicker.tsx | 5 +- .../components/agents/AgentPresetPicker.tsx | 226 +++--- .../src/components/agents/AgentRailTile.tsx | 173 ++-- .../components/agents/AgentSkillsEditor.tsx | 128 +-- .../src/components/agents/AgentTagsField.tsx | 28 +- .../web/src/components/agents/AgentsBoard.tsx | 95 ++- .../components/agents/ScheduledTasksPanel.tsx | 8 +- apps/web/src/components/agents/agents.css | 376 +-------- .../components/agents/agents.logic.test.ts | 29 +- .../web/src/components/agents/agents.logic.ts | 18 - .../components/agents/useAgentsPaneWidths.ts | 2 +- 13 files changed, 819 insertions(+), 1016 deletions(-) diff --git a/apps/web/src/components/agents/AgentEditor.tsx b/apps/web/src/components/agents/AgentEditor.tsx index 7348279f00ecd..f9b50e3717867 100644 --- a/apps/web/src/components/agents/AgentEditor.tsx +++ b/apps/web/src/components/agents/AgentEditor.tsx @@ -8,17 +8,25 @@ import { ComboboxItem, ComboboxEmpty, } from "../ui/combobox"; -import { SelectButton } from "../ui/select"; +import { + Select, + SelectButton, + SelectItem, + SelectPopup, + SelectTrigger, + SelectValue, +} from "../ui/select"; import { Switch } from "../ui/switch"; +import { Button } from "../ui/button"; +import { Checkbox } from "../ui/checkbox"; +import { Input } from "../ui/input"; +import { Label } from "../ui/label"; +import { Textarea } from "../ui/textarea"; +import { Alert, AlertDescription } from "../ui/alert"; import { agentModelOptions, presetProviderLabel } from "./agentModelCatalog"; import type { AgentSkill, McpGatewayProfile, ServerProvider } from "@t3tools/contracts"; import { MCP_GATEWAY_RUNTIME_MODE_LABELS } from "@t3tools/contracts"; -import { - agentColors, - agentHasAdvancedSettings, - defaultAgentColor, - soleOption, -} from "./agents.logic"; +import { agentColors, defaultAgentColor, soleOption } from "./agents.logic"; import { agentIconFieldsToSave, normalizeAgentTags, @@ -28,8 +36,16 @@ import { import { AgentIconPicker } from "./AgentIconPicker"; import { AgentTagsField } from "./AgentTagsField"; import { AGENT_PRESET_SETUP_NOTE } from "./AgentPresetPicker"; -import { useRef, useState, type CSSProperties } from "react"; -import { Dialog, DialogPopup, DialogTitle, DialogDescription } from "../ui/dialog"; +import { useId, useRef, useState, type CSSProperties, type ReactNode } from "react"; +import { + Dialog, + DialogDescription, + DialogFooter, + DialogHeader, + DialogPanel, + DialogPopup, + DialogTitle, +} from "../ui/dialog"; import { randomUUID } from "../../lib/utils"; import { findIdenticalSkill, @@ -38,6 +54,43 @@ import { } from "@t3tools/shared/agentPresets"; const emptySkills: ReadonlyArray = []; +const THINKING_LEVELS = ["minimal", "low", "medium", "high", "xhigh", "max"]; + +function FormSection({ title, children }: { title: string; children: ReactNode }) { + const id = useId(); + return ( +
+

+ {title} +

+ {children} +
+ ); +} + +/** Label over control, with an optional hint under it. */ +function FormField({ + label, + htmlFor, + hint, + children, +}: { + label: ReactNode; + htmlFor?: string; + hint?: ReactNode; + children: ReactNode; +}) { + return ( +
+ + {children} + {hint &&

{hint}

} +
+ ); +} const PRESET_SKILL_PREFIX = "preset:"; export function AgentEditor({ @@ -114,9 +167,6 @@ export function AgentEditor({ const [pickedIcon, setPickedIcon] = useState(null); const iconId = pickedIcon ?? resolveAgentIconId(profile ?? preset); const [tags, setTags] = useState>(profile?.tags ?? preset?.tags ?? []); - const [advancedOpen, setAdvancedOpen] = useState( - () => profile !== null && agentHasAdvancedSettings(profile, profiles), - ); const [description, setDescription] = useState(profile?.description ?? preset?.description ?? ""); const [name, setName] = useState(profile?.name ?? preset?.name ?? ""); const [providerLabel, setProviderLabel] = useState( @@ -154,6 +204,18 @@ export function AgentEditor({ (models.filter((item) => item.name === model).length === 1 ? models.find((item) => item.name === model) : undefined); + const ids = useId(); + const providerOptions = [...new Set([...providerLabels, ...(provider ? [provider] : [])])]; + const modelItems = [ + ...(model && !selectedModel + ? [{ value: model, label: `${model}: unavailable; select a model`, disabled: true }] + : []), + ...models.map((option) => ({ + value: option.slug, + label: `${option.name} (${option.slug})`, + disabled: false, + })), + ]; return ( - -
- - {profile ? "Edit agent" : preset ? `Create agent from ${preset.name}` : "Create agent"} - - - Name a specialist and choose its model. It starts working when you give it a task. - - {preset && ( -
-

{AGENT_PRESET_SETUP_NOTE}

- {preset.setupNotes.length > 0 && ( -
    - {preset.setupNotes.map((note) => ( -
  • {note}
  • - ))} -
- )} - {!skillsAvailable && preset.skills.length > 0 && ( -

Update T3 Code on this machine to add this preset’s skills.

+ +
{ + event.preventDefault(); + const nameKey = name.trim().toLocaleLowerCase(); + if ( + profiles.some( + (p) => + p.profileId !== profile?.profileId && + p.name.trim().toLocaleLowerCase() === nameKey, + ) + ) { + setError("An agent with this name already exists."); + return; + } + setSaving(true); + setError(""); + const normalizedTags = normalizeAgentTags(tags); + const now = new Date().toISOString(); + try { + const saved = await onSave( + { + profileId: profile?.profileId ?? randomUUID(), + name: name.trim(), + description: description.trim(), + systemPrompt, + skillIds: skillIds.filter((id) => !id.startsWith(PRESET_SKILL_PREFIX)), + ...(includeUserSkills ? {} : { includeUserSkills: false }), + color, + ...agentIconFieldsToSave(profile ?? preset, pickedIcon), + ...(normalizedTags.length ? { tags: normalizedTags } : {}), + revision: profile?.revision ?? 1, + providerLabel: provider, + modelLabel: selectedModel?.slug ?? model, + ...(thinking.trim() ? { reasoningEffort: thinking.trim() } : {}), + runtimeMode, + interactionMode, + ...(environmentIds.length ? { environmentIds } : {}), + createdAt: profile?.createdAt ?? now, + updatedAt: now, + }, + presetSkills.filter( + (skill, index) => + skillIds.includes(presetSkillIds[index]!) && + (presetSkillIds[index]!.startsWith(PRESET_SKILL_PREFIX) || + skill.choice?.kind === "update"), + ), + ); + if (saved) onClose(); + else setError("Could not save the agent. Check your connection and try again."); + } catch (cause) { + setError(cause instanceof Error ? cause.message : "Could not save agent."); + } + setSaving(false); + }} + > + + + {profile + ? "Edit agent" + : preset + ? `Create agent from ${preset.name}` + : "Create agent"} + + + Name a specialist and choose its model. It starts working when you give it a task. + + + +
+ {preset && ( + + +

{AGENT_PRESET_SETUP_NOTE}

+ {preset.setupNotes.length > 0 && ( +
    + {preset.setupNotes.map((note) => ( +
  • {note}
  • + ))} +
+ )} + {!skillsAvailable && preset.skills.length > 0 && ( +

+ Update T3 Code on this machine to add this preset’s skills. +

+ )} +
+
)} -
- )} - { - event.preventDefault(); - const nameKey = name.trim().toLocaleLowerCase(); - if ( - profiles.some( - (p) => - p.profileId !== profile?.profileId && - p.name.trim().toLocaleLowerCase() === nameKey, - ) - ) { - setError("An agent with this name already exists."); - return; - } - setSaving(true); - setError(""); - const normalizedTags = normalizeAgentTags(tags); - // oxlint-disable-next-line react/purity -- captures the save time inside the submit handler (oxc#27309) - const now = new Date().toISOString(); - try { - const saved = await onSave( - { - profileId: profile?.profileId ?? randomUUID(), - name: name.trim(), - description: description.trim(), - systemPrompt, - skillIds: skillIds.filter((id) => !id.startsWith(PRESET_SKILL_PREFIX)), - ...(includeUserSkills ? {} : { includeUserSkills: false }), - color, - ...agentIconFieldsToSave(profile ?? preset, pickedIcon), - ...(normalizedTags.length ? { tags: normalizedTags } : {}), - revision: profile?.revision ?? 1, - providerLabel: provider, - modelLabel: selectedModel?.slug ?? model, - ...(thinking.trim() ? { reasoningEffort: thinking.trim() } : {}), - runtimeMode, - interactionMode, - ...(environmentIds.length ? { environmentIds } : {}), - createdAt: profile?.createdAt ?? now, - updatedAt: now, - }, - presetSkills.filter( - (skill, index) => - skillIds.includes(presetSkillIds[index]!) && - (presetSkillIds[index]!.startsWith(PRESET_SKILL_PREFIX) || - skill.choice?.kind === "update"), - ), - ); - if (saved) onClose(); - else setError("Could not save the agent. Check your connection and try again."); - } catch (cause) { - setError(cause instanceof Error ? cause.message : "Could not save agent."); - } - setSaving(false); - }} - > -
- - -
- -
- -
+
+ - - {model && !selectedModel && ( - - )} - {models.map((option) => ( - - ))} - - -
- {preset && model === preset.model.model && !selectedModel && ( -

- {providerLabels.includes(provider) - ? `${model} isn’t available from ${provider}.` - : `${provider} isn’t installed on a connected machine.`}{" "} - Choose an available provider and model to save this agent. -

- )} -
setAdvancedOpen(event.currentTarget.open)} - > - Advanced -
- -
- Color -
+ + +
+ +
setColor(event.target.value)} /> @@ -338,193 +365,263 @@ export function AgentEditor({ type="button" aria-label={`Use color ${value}`} aria-pressed={color === value} + className="size-6 cursor-pointer rounded-full aria-pressed:ring-2 aria-pressed:ring-foreground aria-pressed:ring-inset" style={{ background: value }} onClick={() => setColor(value)} /> ))}
-