Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

feat(control-ui): edit agent overview identity inline

Miguelon Peluchonc0552228aa58
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.css
index 892fc5a17..145b8a4a5 100644
--- a/control-ui/app/globals.css
+++ b/control-ui/app/globals.css
@@ -7509,12 +7509,51 @@ textarea.cu-input {
}
.cu-host-overview-identity__name {
+ min-width: 0;
font-size: 1.5rem;
font-weight: 600;
line-height: 1.2;
margin-top: 0.25rem;
}
+.cu-host-overview-identity__name-row {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 0.35rem;
+ width: 100%;
+ max-width: 100%;
+}
+
+.cu-host-overview-identity__name-editor {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 0.25rem;
+ width: 100%;
+ max-width: 100%;
+}
+
+.cu-host-overview-identity__name-input {
+ min-width: 0;
+ width: min(100%, 14rem);
+ text-align: center;
+ font-size: 1rem;
+ font-weight: 600;
+}
+
+.cu-host-overview-identity__edit {
+ flex-shrink: 0;
+}
+
+.cu-host-overview-identity__description {
+ max-width: 100%;
+ color: var(--cu-text-muted);
+ font-size: 0.875rem;
+ line-height: 1.35;
+ overflow-wrap: anywhere;
+}
+
.cu-host-overview-identity__slug {
font-size: 0.875rem;
color: var(--cu-text-muted);
diff --git a/control-ui/app/hosts/[name]/page.tsx b/control-ui/app/hosts/[name]/page.tsx
index ea1c3c680..d35f33557 100644
--- a/control-ui/app/hosts/[name]/page.tsx
+++ b/control-ui/app/hosts/[name]/page.tsx
@@ -207,6 +207,7 @@ export default function HostDetailsPage() {
const [hostNameDraft, setHostNameDraft] = useState(routeName)
const [hostDisplayDraft, setHostDisplayDraft] = useState('')
+ const [hostDescription, setHostDescription] = useState('')
const [contextRefDraft, setContextRefDraft] = useState('')
// Last server-backed snapshot of the Overview-owned fields, captured at every
// (re)load. Cancel (and re-opening Edit) reverts the whole class of Overview
@@ -369,6 +370,7 @@ export default function HostDetailsPage() {
savedOverviewRef.current = overview
setHostNameDraft(overview.hostName)
setHostDisplayDraft(overview.hostDisplay)
+ setHostDescription(String(spec.description || '').trim())
setContextRefDraft(overview.contextRef)
setChannelsDraft(overview.channels)
setStatelessDraft(overview.stateless)
@@ -638,7 +640,7 @@ export default function HostDetailsPage() {
setStatelessDraft(saved.stateless)
}
- async function saveHost(): Promise<boolean> {
+ async function saveHost(nextDisplayName = hostDisplayDraft): Promise<boolean> {
const nextHostName = hostNameDraft.trim()
if (!nextHostName) return false
@@ -657,7 +659,7 @@ export default function HostDetailsPage() {
// semantics — omitting them is what keeps them intact).
const nextSpec: Record<string, unknown> = {
...currentHost.spec,
- host: hostDisplayDraft.trim() || nextHostName,
+ host: nextDisplayName.trim() || nextHostName,
contextRef: contextRefDraft.trim(),
channels: channelsDraft,
// Echo spec.lifecycle explicitly: the admin facade full-replaces the
@@ -981,6 +983,7 @@ export default function HostDetailsPage() {
<HostOverviewTab
hostName={routeName}
displayName={hostDisplayDraft}
+ description={hostDescription}
statusLabel={hostStatusLabel}
statusTone={hostStatusTone}
contextRef={contextRefDraft}
@@ -995,6 +998,7 @@ export default function HostDetailsPage() {
.join(', ')}
accessSummary={accessSummary}
onNavigate={tab => selectTab(tab)}
+ onSaveDisplayName={nextDisplayName => saveHost(nextDisplayName)}
createdAt={hostCreatedAt}
lastUpdated={hostLastUpdated}
/>
diff --git a/control-ui/components/HostOverviewTab/index.tsx b/control-ui/components/HostOverviewTab/index.tsx
index 96b768381..9b11109da 100644
--- a/control-ui/components/HostOverviewTab/index.tsx
+++ b/control-ui/components/HostOverviewTab/index.tsx
@@ -1,7 +1,10 @@
import React from 'react'
import { IconRobot } from '../Sidebar/icons'
+import { IconCheck, IconPencil, IconX } from '../icons'
import type { HostOverviewTabProps, HostTabKey } from './types'
+const DESCRIPTION_MAX_LENGTH = 100
+
const STATUS_DOT_CLASS: Record<HostOverviewTabProps['statusTone'], string> = {
active: 'cu-host-overview-status__dot--active',
inactive: 'cu-host-overview-status__dot--inactive',
@@ -81,9 +84,16 @@ function formatTimestamp(value: string): string {
return `${month} ${day}, ${year} • ${hours}:${minutes} ${meridiem}`
}
+function truncateDescription(value: string): string {
+ const description = value.trim()
+ if (description.length <= DESCRIPTION_MAX_LENGTH) return description
+ return `${description.slice(0, DESCRIPTION_MAX_LENGTH - 1).trimEnd()}…`
+}
+
export function HostOverviewTab({
hostName,
displayName,
+ description,
statusLabel,
statusTone,
contextRef,
@@ -94,23 +104,114 @@ export function HostOverviewTab({
modelAllowlistLine,
accessSummary,
onNavigate,
+ onSaveDisplayName,
createdAt,
lastUpdated,
}: HostOverviewTabProps & { createdAt: string; lastUpdated: string }) {
const shownName = displayName.trim() || hostName
+ const [editingName, setEditingName] = React.useState(false)
+ const [nameDraft, setNameDraft] = React.useState(shownName)
+ const [savingName, setSavingName] = React.useState(false)
const hasContext = Boolean(contextRef.trim())
const allowlist = modelAllowlistLine.trim() || '—'
+ const trimmedDescription = description.trim()
+ const shownDescription = truncateDescription(trimmedDescription) || 'No description provided.'
+
+ React.useEffect(() => {
+ if (!editingName) setNameDraft(shownName)
+ }, [editingName, shownName])
+
+ function startNameEdit() {
+ setNameDraft(shownName)
+ setEditingName(true)
+ }
+
+ function cancelNameEdit() {
+ setNameDraft(shownName)
+ setEditingName(false)
+ }
+
+ async function saveName() {
+ const nextName = nameDraft.trim()
+ if (!nextName || savingName) return
+
+ setSavingName(true)
+ try {
+ if (await onSaveDisplayName(nextName)) setEditingName(false)
+ } finally {
+ setSavingName(false)
+ }
+ }
return (
<div className="cu-host-overview">
<section className="cu-host-overview-identity" aria-label="Agent identity">
- <div className="cu-host-overview-identity__name">
- <span className="cu-host-overview-identity__icon" aria-hidden="true">
- <IconRobot />
- </span>
- {shownName}
+ <div className="cu-host-overview-identity__name-row">
+ {editingName ? (
+ <div className="cu-host-overview-identity__name-editor">
+ <span className="cu-host-overview-identity__icon" aria-hidden="true">
+ <IconRobot />
+ </span>
+ <input
+ className="cu-input cu-host-overview-identity__name-input"
+ value={nameDraft}
+ onChange={event => setNameDraft(event.target.value)}
+ onKeyDown={event => {
+ if (event.key === 'Enter') void saveName()
+ if (event.key === 'Escape') cancelNameEdit()
+ }}
+ aria-label="Agent name"
+ disabled={savingName}
+ autoFocus
+ />
+ <button
+ type="button"
+ className="cu-btn cu-btn--icon cu-btn--toolbar"
+ onClick={() => void saveName()}
+ disabled={savingName || !nameDraft.trim()}
+ aria-label="Save agent name"
+ title="Save agent name"
+ >
+ <IconCheck width={16} height={16} />
+ </button>
+ <button
+ type="button"
+ className="cu-btn cu-btn--icon cu-btn--ghost"
+ onClick={cancelNameEdit}
+ disabled={savingName}
+ aria-label="Cancel editing agent name"
+ title="Cancel editing agent name"
+ >
+ <IconX width={16} height={16} />
+ </button>
+ </div>
+ ) : (
+ <>
+ <div className="cu-host-overview-identity__name">
+ <span className="cu-host-overview-identity__icon" aria-hidden="true">
+ <IconRobot />
+ </span>
+ {shownName}
+ </div>
+ <button
+ type="button"
+ className="cu-btn cu-btn--icon cu-btn--ghost cu-host-overview-identity__edit"
+ onClick={startNameEdit}
+ disabled={savingName}
+ aria-label="Edit agent name"
+ title="Edit agent name"
+ >
+ <IconPencil width={16} height={16} />
+ </button>
+ </>
+ )}
+ </div>
+ <div
+ className="cu-host-overview-identity__description"
+ title={trimmedDescription || undefined}
+ >
+ {shownDescription}
</div>
- <div className="cu-host-overview-identity__slug">{hostName}</div>
<div className="cu-host-overview-identity__status">
<StatusDot tone={statusTone} />
<span>{statusLabel}</span>
diff --git a/control-ui/components/HostOverviewTab/types.ts b/control-ui/components/HostOverviewTab/types.ts
index 6ca526093..51c86527c 100644
--- a/control-ui/components/HostOverviewTab/types.ts
+++ b/control-ui/components/HostOverviewTab/types.ts
@@ -10,6 +10,7 @@ export type HostTabKey = 'access' | 'model' | 'connectors'
export type HostOverviewTabProps = {
hostName: string
displayName: string
+ description: string
statusLabel: string
statusTone: 'active' | 'inactive' | 'unknown'
contextRef: string
@@ -20,6 +21,7 @@ export type HostOverviewTabProps = {
modelAllowlistLine: string
accessSummary: HostOverviewAccessSummary
onNavigate: (tab: HostTabKey) => void
+ onSaveDisplayName: (displayName: string) => Promise<boolean>
createdAt: string
lastUpdated: string
}
diff --git a/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx b/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx
index ac408efed..e6acf9d87 100644
--- a/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx
+++ b/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx
@@ -60,6 +60,8 @@ const host = {
spec: {
approval: { tools: { shell_exec: true } },
channels: ['telegram'],
+ description:
+ 'This agent coordinates customer support requests, gathers the relevant context, and routes each case to the right workflow for follow-up.',
contextRef: 'ctx',
host: 'foo-display',
memory: { enabled: true },
@@ -165,55 +167,26 @@ describe('HostDetailsPage identity integration', () => {
expect(container.querySelector('.cu-host-approval-section .cu-section-title')).toBeNull()
})
- it('shows editable Type in Overview without Display ID and preserves personalization', async () => {
+ it('shows the agent description in place of the identifier and truncates long copy', async () => {
const { container } = render(<HostDetailsPage />)
- expect(await screen.findByText('Name')).toBeInTheDocument()
- expect(await screen.findByText('Type')).toBeInTheDocument()
- expect(screen.queryByText('Display ID')).not.toBeInTheDocument()
- expect(container.querySelector('.cu-agent-detail-card')).toBeNull()
- expect(container.querySelector('.cu-agent-detail-heading')).not.toBeNull()
- expect(container.querySelector('.cu-agent-detail-toolbar')).toBeNull()
+ const description = await screen.findByTitle(host.spec.description)
- const [overviewEditButton] = await screen.findAllByRole('button', { name: 'Edit' })
- await waitFor(() => expect(overviewEditButton).toBeEnabled())
- fireEvent.click(overviewEditButton)
- fireEvent.change(screen.getByLabelText('Type'), { target: { value: 'stateless' } })
- fireEvent.click(screen.getByRole('button', { name: 'Save' }))
-
- await waitFor(() =>
- expect(api.apiSend).toHaveBeenCalledWith('PUT', '/api/v1/admin/hosts/foo', expect.any(Object))
- )
- const putCall = (api.apiSend as unknown as ReturnType<typeof vi.fn>).mock.calls.find(
- c => c[0] === 'PUT' && c[1] === '/api/v1/admin/hosts/foo'
- )
- const payload = putCall![2]
- expect(payload.spec.lifecycle).toEqual({ stateless: true })
- expect(payload.spec.personalization).toEqual(host.spec.personalization)
- expect(payload.spec.approval).toEqual(host.spec.approval)
+ expect(description).toHaveClass('cu-host-overview-identity__description')
+ expect(description.textContent).toHaveLength(100)
+ expect(description.textContent?.endsWith('…')).toBe(true)
+ expect(screen.getByRole('button', { name: 'Edit agent name' })).toBeInTheDocument()
+ expect(container.querySelector('.cu-host-overview-identity__slug')).toBeNull()
+ expect(container.querySelector('.cu-agent-detail-card')).toBeNull()
})
- // UT-3 — the identifier is readonly and only the display name (spec.host) is
- // editable. Saving is a SINGLE PUT that updates spec.host and leaves
- // metadata.name intact, with ZERO create (POST) / delete (DELETE) calls: the
- // behavioral proof that the create+migrate+delete rename dance is gone.
- it('makes the identifier readonly and saves the display name via one PUT (no rename dance)', async () => {
+ it('edits the agent name inline via one PUT without changing the agent slug', async () => {
render(<HostDetailsPage />)
- const [overviewEditButton] = await screen.findAllByRole('button', { name: 'Edit' })
- await waitFor(() => expect(overviewEditButton).toBeEnabled())
- fireEvent.click(overviewEditButton)
-
- // Identifier ("Name") is present but not editable.
- const nameField = screen.getByLabelText('Name')
- expect(nameField).toHaveAttribute('readonly')
- expect(nameField).toHaveValue('foo')
-
- // The display name (spec.host) is the editable field.
- const displayField = screen.getByLabelText('Display name')
- expect(displayField).toHaveValue('foo-display')
- fireEvent.change(displayField, { target: { value: 'Product Agents' } })
-
- fireEvent.click(screen.getByRole('button', { name: 'Save' }))
+ fireEvent.click(await screen.findByRole('button', { name: 'Edit agent name' }))
+ const nameField = screen.getByLabelText('Agent name')
+ expect(nameField).toHaveValue('foo-display')
+ fireEvent.change(nameField, { target: { value: 'Product Agents' } })
+ fireEvent.click(screen.getByRole('button', { name: 'Save agent name' }))
await waitFor(() =>
expect(api.apiSend).toHaveBeenCalledWith('PUT', '/api/v1/admin/hosts/foo', expect.any(Object))
@@ -224,54 +197,24 @@ describe('HostDetailsPage identity integration', () => {
expect(puts).toHaveLength(1)
const payload = puts[0][2]
expect(payload.spec.host).toBe('Product Agents')
- // The identifier is untouched: the PUT targets the same slug and never sets
- // a different metadata.name.
expect(payload.metadata?.name).toBeUndefined()
-
- // The dance is gone: no create of a new host and no delete of the old one.
expect(calls.some(c => c[0] === 'POST')).toBe(false)
expect(calls.some(c => c[0] === 'DELETE')).toBe(false)
- // And the route was never re-navigated to a renamed slug.
expect(replaceMock).not.toHaveBeenCalledWith('/agents/Product Agents')
expect(pushMock).not.toHaveBeenCalledWith('/agents/Product Agents')
})
- // Regression: Cancel must DISCARD the Display-name edit, not carry the stale
- // draft into the read-only view and the next save. Before the resetOverview
- // fix, a cancelled "Display name" edit silently persisted on the following
- // Save (spec.host written to the abandoned value).
- it('discards a cancelled Display name edit — read-only reverts and a later save keeps the saved value', async () => {
+ it('cancels an inline agent name edit without persisting the draft', async () => {
render(<HostDetailsPage />)
- const [overviewEditButton] = await screen.findAllByRole('button', { name: 'Edit' })
- await waitFor(() => expect(overviewEditButton).toBeEnabled())
- fireEvent.click(overviewEditButton)
-
- // Type a Display name the operator then abandons.
- fireEvent.change(screen.getByLabelText('Display name'), {
+ fireEvent.click(await screen.findByRole('button', { name: 'Edit agent name' }))
+ fireEvent.change(screen.getByLabelText('Agent name'), {
target: { value: 'Discarded Draft' },
})
- fireEvent.click(screen.getByRole('button', { name: 'Cancel' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Cancel editing agent name' }))
- // Observable #1 (T4): the read-only view shows the last-SAVED value, not the
- // abandoned draft.
expect(screen.getByText('foo-display')).toBeInTheDocument()
expect(screen.queryByText('Discarded Draft')).not.toBeInTheDocument()
-
- // Re-open Edit and Save without touching Display name again.
- const [overviewEditButton2] = await screen.findAllByRole('button', { name: 'Edit' })
- fireEvent.click(overviewEditButton2)
- fireEvent.click(screen.getByRole('button', { name: 'Save' }))
-
- await waitFor(() =>
- expect(api.apiSend).toHaveBeenCalledWith('PUT', '/api/v1/admin/hosts/foo', expect.any(Object))
- )
-
- // Observable #2 (T4, PINNING): the persisted spec.host is the saved value,
- // NOT the discarded draft. This assertion goes red pre-fix.
- const putCall = (api.apiSend as unknown as ReturnType<typeof vi.fn>).mock.calls.find(
- c => c[0] === 'PUT' && c[1] === '/api/v1/admin/hosts/foo'
- )
- expect(putCall![2].spec.host).toBe('foo-display')
+ expect(api.apiSend).not.toHaveBeenCalled()
})
})
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 314c50b2c..c6b258943 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.445",
+ "version": "0.1.446",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.445",
+ "version": "0.1.446",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/llm-providers": "file:../packages/llm-providers",
diff --git a/control-ui/package.json b/control-ui/package.json
index b26a1c932..73e7bf984 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.445",
+ "version": "0.1.446",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",