Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
feat(control-ui): agent + table UX polish
Miguelon Peluchon69b82fd219a5
diff --git a/control-ui/app/constants/hostDetails.ts b/control-ui/app/constants/hostDetails.tsindex 49bdc12ea..d0a18ab5f 100644--- a/control-ui/app/constants/hostDetails.ts+++ b/control-ui/app/constants/hostDetails.ts@@ -1,5 +1,5 @@-export const HOST_DEFAULT_TAB = 'details'+export const HOST_DEFAULT_TAB = 'identity'-export const HOST_TABS = ['details', 'identity', 'model', 'contexts', 'access', 'advanced'] as const+export const HOST_TABS = ['identity', 'model', 'contexts', 'access', 'advanced'] as constexport type HostTab = (typeof HOST_TABS)[number]diff --git a/control-ui/app/globals.css b/control-ui/app/globals.cssindex ef62bd016..d6e14b247 100644--- a/control-ui/app/globals.css+++ b/control-ui/app/globals.css@@ -19,14 +19,14 @@--cu-link: #8faeff;--cu-link-hover: var(--cu-brand-light-blue);--cu-color-primary: var(--cu-accent);- --cu-danger: #ec7c72;- --cu-danger-hover: #f29a91;+ --cu-danger: #f87171;+ --cu-danger-hover: #fca5a5;--cu-success: #66b88f;--cu-warning: #e8c27a;--cu-accent-rgb: 67, 119, 250;--cu-focus-rgb: 67, 119, 250;--cu-success-rgb: 102, 184, 143;- --cu-danger-rgb: 236, 124, 114;+ --cu-danger-rgb: 248, 113, 113;--cu-warning-rgb: 232, 194, 122;--cu-edge-rgb: 94, 99, 108;--cu-panel-rgb: 20, 21, 24;@@ -1376,14 +1376,19 @@ textarea.cu-input {}.cu-btn--danger {- background: linear-gradient(180deg, var(--cu-danger-hover) 0%, var(--cu-danger) 100%);- border-color: rgba(var(--cu-danger-rgb), 0.34);- color: var(--cu-text-inverse);+ background: transparent;+ border-color: rgba(var(--cu-danger-rgb), 0.55);+ color: var(--cu-danger);}.cu-btn--danger:hover:not(:disabled) {- background: linear-gradient(180deg, var(--cu-danger) 0%, var(--cu-danger-hover) 100%);- border-color: rgba(var(--cu-danger-rgb), 0.48);+ background: rgba(var(--cu-danger-rgb), 0.12);+ border-color: var(--cu-danger);+ color: var(--cu-danger-hover);+}++.cu-btn--danger:active:not(:disabled) {+ background: rgba(var(--cu-danger-rgb), 0.2);}.cu-btn--sm {@@ -6030,7 +6035,7 @@ textarea.cu-input {padding: var(--cu-space-3);border: 1px solid var(--cu-border-subtle);border-radius: var(--cu-radius-sm);- background: rgba(var(--cu-panel-rgb), 0.35);+ background: var(--cu-bg-elevated);}.cu-agent-context-mcp-summary__head {@@ -6061,10 +6066,8 @@ textarea.cu-input {display: flex;flex-wrap: wrap;gap: var(--cu-space-1);- max-height: 8rem;margin: 0;padding: 0;- overflow: auto;list-style: none;}@@ -6072,10 +6075,10 @@ textarea.cu-input {max-width: 100%;padding: 0.2rem var(--cu-space-2);overflow: hidden;- border: 1px solid var(--cu-border-subtle);+ border: 1px solid rgba(var(--cu-accent-rgb), 0.35);border-radius: var(--cu-radius-pill);- background: var(--cu-bg-elevated);- color: var(--cu-text-soft);+ background: rgba(var(--cu-accent-rgb), 0.14);+ color: var(--cu-text);font-size: 0.75rem;line-height: 1.35;text-overflow: ellipsis;@@ -7347,6 +7350,26 @@ textarea.cu-input {width: min(36rem, 100%);}+/* Hover card on the Context column — shows the same MCP-server list as the+ agent-wizard's `cu-agent-context-mcp-summary` block. The wrapper is the+ positioning context so the absolutely-positioned card sits just below the+ link instead of clipping against the table cell. */+.cu-host-context-hover {+ position: relative;+ display: inline-flex;+ max-width: 100%;+}++.cu-host-context-hover > .cu-agent-context-mcp-summary {+ position: absolute;+ top: calc(100% + var(--cu-space-1));+ left: 0;+ z-index: 50;+ min-width: 18rem;+ max-width: 28rem;+ box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.18);+}+.cu-host-env-form--danger {border-color: rgba(var(--cu-danger-rgb), 0.38);background: rgba(var(--cu-danger-rgb), 0.06);diff --git a/control-ui/app/hosts/[name]/[tab]/page.tsx b/control-ui/app/hosts/[name]/[tab]/page.tsxindex 172081535..7d6bf7ea9 100644--- a/control-ui/app/hosts/[name]/[tab]/page.tsx+++ b/control-ui/app/hosts/[name]/[tab]/page.tsx@@ -7,7 +7,7 @@ interface HostTabPageProps {export default async function HostTabPage({ params }: HostTabPageProps) {const { tab } = await params- const tabs = ['overview', 'model', 'identity', 'contexts', 'access', 'advanced']+ const tabs = ['identity', 'model', 'contexts', 'access', 'advanced']if (!tabs.includes(tab)) notFound()return <HostDetailsPage />diff --git a/control-ui/app/hosts/[name]/page.tsx b/control-ui/app/hosts/[name]/page.tsxindex 1237b2550..4bba0c29b 100644--- a/control-ui/app/hosts/[name]/page.tsx+++ b/control-ui/app/hosts/[name]/page.tsx@@ -12,10 +12,9 @@ import { HostAdvancedTab } from '../../../components/HostAdvancedTab'import { HostIdentityTab } from '../../../components/HostIdentityTab'import { LlmProviderConfig } from '../../../components/LlmProviderConfig'import { IconRobot } from '../../../components/Sidebar/icons'-import { IconCheck, IconPencil, IconX } from '../../../components/icons'+import { IconCheck, IconMoreHorizontal, IconPencil } from '../../../components/icons'import { apiSend, getHost, getHostDetailBundle } from '../../../lib/api'import { useLlmAllowedModels } from '../../../lib/hooks/useLlmAllowedModels'-import { FIRST_PARTY_CHANNEL_WORKFLOW_CONTROL_SCOPES } from '../../../lib/hostWorkflowControl'import {type HostAllowedModel,LLM_EMPTY_TRIGGER_ERROR,@@ -37,7 +36,6 @@ import {import type { HostTab } from './types'const TAB_LABELS: Record<HostTab, string> = {- details: 'Overview',model: 'Models & creds',advanced: 'Advanced',contexts: 'Context',@@ -46,7 +44,6 @@ const TAB_LABELS: Record<HostTab, string> = {}const TAB_SLUGS: Record<HostTab, string> = {- details: 'overview',model: 'model',advanced: 'advanced',contexts: 'contexts',@@ -58,13 +55,56 @@ function parseHostTab(value: string | undefined): HostTab {return HOST_TABS.find(tab => TAB_SLUGS[tab] === value) ?? HOST_DEFAULT_TAB}-// Cron×stateless: map the machine-readable suspend-blocked reason to-// operator-friendly text. Every other reason renders verbatim.-function friendlyLifecycleReason(reason: string): string {- if (reason === 'SuspendBlocked: activeCronSchedules') {- return 'Not suspending: active scheduled tasks keep this agent awake'- }- return reason+function AgentActionsMenu({ busy, onDelete }: { busy: boolean; onDelete: () => void }) {+ const [open, setOpen] = useState(false)+ const ref = useRef<HTMLDivElement>(null)++ useEffect(() => {+ if (!open) return+ function handleDocClick(event: MouseEvent) {+ if (!ref.current?.contains(event.target as Node)) setOpen(false)+ }+ function handleEsc(event: KeyboardEvent) {+ if (event.key === 'Escape') setOpen(false)+ }+ document.addEventListener('mousedown', handleDocClick)+ document.addEventListener('keydown', handleEsc)+ return () => {+ document.removeEventListener('mousedown', handleDocClick)+ document.removeEventListener('keydown', handleEsc)+ }+ }, [open])++ return (+ <div ref={ref} className="cu-kebab">+ <button+ type="button"+ aria-label="Agent actions"+ aria-haspopup="menu"+ aria-expanded={open}+ className="cu-btn cu-btn--icon cu-btn--ghost cu-kebab__trigger"+ onClick={() => setOpen(value => !value)}+ disabled={busy}+ >+ <IconMoreHorizontal width={16} height={16} />+ </button>+ {open ? (+ <div role="menu" className="cu-kebab__menu">+ <button+ type="button"+ role="menuitem"+ className="cu-kebab__item cu-kebab__item--danger"+ onClick={() => {+ setOpen(false)+ onDelete()+ }}+ >+ Delete agent+ </button>+ </div>+ ) : null}+ </div>+ )}export default function HostDetailsPage() {@@ -78,11 +118,12 @@ export default function HostDetailsPage() {// AP-6 — resourceVersion of the READ THE EDIT FORM WAS BUILT FROM.// Captured at form load (loadData), NOT from the pre-save re-fetch inside- // saveHost: the optimistic-concurrency guard must cover the whole human- // edit window. Anchoring it to the pre-save re-fetch would only guard the- // milliseconds between that re-fetch and the PUT, silently blessing any- // concurrent change that landed while the operator was editing — exactly- // the stale-echo overwrite AP-6 exists to prevent.+ // saveContextRef / saveModelAndCredentials: the optimistic-concurrency+ // guard must cover the whole human edit window. Anchoring it to the+ // pre-save re-fetch would only guard the milliseconds between that+ // re-fetch and the PUT, silently blessing any concurrent change that+ // landed while the operator was editing — exactly the stale-echo overwrite+ // AP-6 exists to prevent.const formResourceVersionRef = useRef('')const [activeTab, setActiveTab] = useState<HostTab>(() => parseHostTab(params.tab))@@ -90,27 +131,10 @@ export default function HostDetailsPage() {const [error, setError] = useState('')const [initialLoading, setInitialLoading] = useState(true)- const [editingOverview, setEditingOverview] = useState(false)const [editingModel, setEditingModel] = useState(false)const [editingContext, setEditingContext] = useState(false)- const [showDeleteAgentConfirm, setShowDeleteAgentConfirm] = useState(false)- const [deletingAgent, setDeletingAgent] = useState(false)- const [deleteAgentDialogError, setDeleteAgentDialogError] = useState('')- const [hostNameDraft, setHostNameDraft] = useState(routeName)- const [hostDisplayDraft, setHostDisplayDraft] = 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- // drafts to THIS — the last SAVED state — so a discarded edit (e.g. a Display- // name typed then cancelled) can never leak into a later saveHost PUT.- const savedOverviewRef = useRef({- hostName: routeName,- hostDisplay: '',- contextRef: '',- channels: [] as string[],- stateless: false,- })const [providerDraft, setProviderDraft] = useState<LlmProvider>('openai')// Model options are the operator allowlist (enabled only). The host's saved// model is always kept selectable even if it fell out of the allowlist@@ -138,15 +162,9 @@ export default function HostDetailsPage() {// Data keys present per LLM Secret name, so the fallback credentialSlot// dropdown can offer extra keys (e.g. `claude-api-key-fb1`) — never free text.const [secretKeysByName, setSecretKeysByName] = useState<Record<string, string[]>>({})- const [channelsDraft, setChannelsDraft] = useState<string[]>([])const [approvalToolsData, setApprovalToolsData] = useState<Record<string, boolean> | undefined>(undefined)- const [statelessDraft, setStatelessDraft] = useState(false)- const [savedStateless, setSavedStateless] = useState(false)- const [lifecycleState, setLifecycleState] = useState('')- const [lifecycleReason, setLifecycleReason] = useState('')- const [statelessRejectionMessage, setStatelessRejectionMessage] = useState('')const [availableContexts, setAvailableContexts] = useState<string[]>([])const [availableSecrets, setAvailableSecrets] = useState<string[]>([])@@ -214,7 +232,7 @@ export default function HostDetailsPage() {}}, [])- async function loadData(resetDrafts: 'all' | 'overview' | 'model' | 'none' = 'all') {+ async function loadData(resetDrafts: 'all' | 'context' | 'model' | 'none' = 'all') {setBusy(true)setInitialLoading(true)setError('')@@ -226,21 +244,8 @@ export default function HostDetailsPage() {// AP-6: remember the version of THIS read — the edit drafts below are// built from it, so it is the correct precondition for the eventual save.formResourceVersionRef.current = String(host.metadata?.resourceVersion || '')- if (resetDrafts === 'all' || resetDrafts === 'overview') {- // Snapshot the saved Overview state so Cancel/Edit can revert to it.- const overview = {- hostName: String(host.metadata?.name || routeName),- hostDisplay: String(spec.host || host.metadata?.name || routeName),- contextRef: String(spec.contextRef || ''),- channels: Array.isArray(spec.channels) ? spec.channels.map(String).filter(Boolean) : [],- stateless: spec.lifecycle?.stateless === true,- }- savedOverviewRef.current = overview- setHostNameDraft(overview.hostName)- setHostDisplayDraft(overview.hostDisplay)- setContextRefDraft(overview.contextRef)- setChannelsDraft(overview.channels)- setStatelessDraft(overview.stateless)+ if (resetDrafts === 'all' || resetDrafts === 'context') {+ setContextRefDraft(String(spec.contextRef || ''))}const nextProvider = normalizeProvider(String((spec.model as { provider?: string } | undefined)?.provider || 'openai')@@ -267,22 +272,6 @@ export default function HostDetailsPage() {}const rawTools = (spec.approval as { tools?: Record<string, boolean> } | undefined)?.toolssetApprovalToolsData(rawTools && typeof rawTools === 'object' ? rawTools : undefined)- const specStateless = spec.lifecycle?.stateless === true- setSavedStateless(specStateless)- setLifecycleState(String(host.status?.lifecycle?.state ?? ''))- setLifecycleReason(String(host.status?.lifecycle?.reason ?? ''))- const rejection = (host.status?.conditions ?? []).find(- condition => condition.type === 'StatelessEnableRejected' && condition.status === 'True'- )- setStatelessRejectionMessage(- rejection- ? String(- rejection.message ||- rejection.reason ||- 'Stateless mode was rejected by the platform.'- )- : ''- )const contextIds = (contextsList || []).map(item => String(item.spec?.contextId || item.metadata?.name || '').trim())@@ -339,85 +328,37 @@ export default function HostDetailsPage() {setLlmPolicyDraft(next)}- // Revert every Overview-owned draft to the last SAVED snapshot. Used by Cancel- // and by Edit-open so an edit session always starts from server-backed values- // — never a stale draft left behind by a prior discarded edit (any Overview- // field, not just Display name: the whole class shares this reset).- function resetOverviewDrafts() {- const saved = savedOverviewRef.current- setHostNameDraft(saved.hostName)- setHostDisplayDraft(saved.hostDisplay)- // contextRef is written by the Overview save (saveHost), so reset it here to- // block a stale leak — EXCEPT while the Context tab has a live edit open: it- // is a legitimate concurrent writer of contextRefDraft (its editingContext- // session), and reverting an in-progress selection would silently discard it.- if (!editingContext) setContextRefDraft(saved.contextRef)- setChannelsDraft(saved.channels)- setStatelessDraft(saved.stateless)- }-- async function saveHost(): Promise<boolean> {- const nextHostName = hostNameDraft.trim()- if (!nextHostName) return false-+ // Scoped save for the Context tab. Contexts are referenced by name from the+ // host spec, so the only spec field changed here is `contextRef` — every+ // other field (model, secret, fallback policy, lifecycle, channels, etc.) is+ // preserved via the `...currentHost.spec` spread (full-replace semantics).+ // Carries the form-load resourceVersion so a concurrent edit/lifecycle tick+ // bounces as 409 conflict instead of silently overwriting the newer state.+ async function saveContextRef(): Promise<boolean> {setBusy(true)setError('')try {- // Re-fetch to preserve fields that aren't editable in this form. K8s- // replaceNamespacedCustomObject is a full replace, not a merge.const currentHost = await getHost(routeName)- const currentLifecycle = currentHost.spec?.lifecycle- const currentWorkflowControl = currentHost.spec?.workflowControl- // Overview owns only identity/shape fields (name, display, context,- // channels, lifecycle). Model, secret, fallback policy and the per-host- // model allowlist are owned by the "Model & credentials" tab and are- // preserved here via the `...currentHost.spec` spread (full-replace- // semantics — omitting them is what keeps them intact).- const nextSpec: Record<string, unknown> = {- ...currentHost.spec,- host: hostDisplayDraft.trim() || nextHostName,- contextRef: contextRefDraft.trim(),- channels: channelsDraft,- // Echo spec.lifecycle explicitly: the admin facade full-replaces the- // spec, so leaving lifecycle implicit would strip the stateless flag.- ...(statelessDraft || currentLifecycle- ? { lifecycle: { ...currentLifecycle, stateless: statelessDraft } }- : {}),- ...(channelsDraft.length > 0 && currentWorkflowControl === undefined- ? { workflowControl: { scopes: [...FIRST_PARTY_CHANNEL_WORKFLOW_CONTROL_SCOPES] } }- : {}),- }-const formResourceVersion = formResourceVersionRef.currentawait apiSend('PUT', `/api/v1/admin/hosts/${encodeURIComponent(routeName)}`, {- // AP-6: carry the resourceVersion captured at form load so the API- // rejects this save with 409 {error:'conflict'} if the Host changed- // while the operator was editing, instead of silently overwriting the- // concurrent change with this form's stale echo....(formResourceVersion ? { metadata: { resourceVersion: formResourceVersion } } : {}),- spec: nextSpec,+ spec: {+ ...currentHost.spec,+ contextRef: contextRefDraft.trim(),+ },})- // Refresh server-backed state and this tab's saved values without- // clobbering a still-open draft in "Model & credentials".- await loadData('overview')- showToast('Agent configuration saved.', { tone: 'success' })+ await loadData('context')+ showToast('Context saved.', { tone: 'success' })return true} catch (e) {const status = (e as { status?: number } | null)?.statusconst code = (e as { code?: string } | null)?.codeif (status === 409 && code === 'conflict') {- // AP-6 conflict: the Host changed between the form-load read and this- // save. The resourceVersion precondition is whole-object (K8s has no- // field-level precondition), so the true cause may be another operator's- // edit OR the agent's own lifecycle machine ticking (HCC bumping- // status.lifecycle / wake-requested on a stateless host). The 409 carries- // no field diff, so the message must cover both causes without asserting- // the wrong one — while keeping the reload + re-apply recovery.setError("This agent changed since you opened the form (another edit, or the agent's own lifecycle state updated). Reload to see the latest, then re-apply your change.")} else {- setError(e instanceof Error ? e.message : 'Failed to save agent')+ setError(e instanceof Error ? e.message : 'Failed to save context')}return false} finally {@@ -428,8 +369,8 @@ export default function HostDetailsPage() {// Scoped save for the "Model & credentials" tab. Owns provider/model,// secretRef, the opt-in fallback policy, the per-host model allowlist, and// write-only credential rotations/retirements. All other spec fields- // (identity, context, channels, lifecycle) are preserved via the- // `...currentHost.spec` spread (full-replace semantics).+ // (context, lifecycle, channels) are preserved via the `...currentHost.spec`+ // spread (full-replace semantics).async function saveModelAndCredentials(): Promise<boolean> {// Client-side mirror of control-api's write gate (spec R5.3): block a save// with an out-of-allowlist fallback model before the round-trip. Skip the@@ -557,7 +498,7 @@ export default function HostDetailsPage() {const status = (e as { status?: number } | null)?.statusconst code = (e as { code?: string } | null)?.codeif (status === 409 && code === 'conflict') {- // AP-6 conflict (see saveHost for full rationale): the Host changed+ // AP-6 conflict (see saveContextRef for full rationale): the Host changed// between the form-load read and this save. Reload to re-apply.setError("This agent changed since you opened the form (another edit, or the agent's own lifecycle state updated). Reload to see the latest, then re-apply your change."@@ -585,8 +526,8 @@ export default function HostDetailsPage() {await apiSend('PUT', `/api/v1/admin/hosts/${encodeURIComponent(routeName)}`, {spec: nextSpec,})- // Reload approval/server state while preserving any drafts left open- // in the Overview or Model tabs.+ // Reload approval/server state while preserving drafts left open in+ // the Model or Context tabs.await loadData('none')} catch (e) {setError(e instanceof Error ? e.message : 'Failed to save approval tools')@@ -601,19 +542,25 @@ export default function HostDetailsPage() {[routeName])- async function deleteAgentPermanently() {- setDeletingAgent(true)- setDeleteAgentDialogError('')+ async function handleDeleteAgent() {+ const shouldDelete = await confirm({+ title: 'Delete Agent',+ message: `Delete agent ${routeName}?`,+ confirmLabel: 'Delete',+ tone: 'danger',+ })+ if (!shouldDelete) return++ setBusy(true)setError('')try {await apiSend('DELETE', `/api/v1/admin/hosts/${encodeURIComponent(routeName)}`)- setShowDeleteAgentConfirm(false)showToast(`Agent ${routeName} deleted.`, { tone: 'success' })router.push(CONTROL_ROUTES.agents.root)} catch (e) {- setDeleteAgentDialogError(e instanceof Error ? e.message : 'Failed to delete agent')+ setError(e instanceof Error ? e.message : `Failed to delete agent ${routeName}`)} finally {- setDeletingAgent(false)+ if (mountedRef.current) setBusy(false)}}@@ -639,170 +586,9 @@ export default function HostDetailsPage() {href: hostTabHref(tab),}))}title={`Agent: ${routeName}`}+ titleActions={<AgentActionsMenu busy={busy} onDelete={() => void handleDeleteAgent()} />}><div className="cu-agent-detail-scroll">- {activeTab === 'details' && (- <>- {statelessRejectionMessage ? (- <div className="cu-banner cu-banner--warning" style={{ marginBottom: '1rem' }}>- <strong>Stateless mode rejected:</strong> {statelessRejectionMessage}- </div>- ) : null}- <div className="cu-agent-detail-heading">- <div- style={{ display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: '0.5rem' }}- >- <p className="cu-muted" style={{ fontSize: '0.875rem', margin: 0 }}>- Agent configuration and settings.- </p>- {savedStateless && lifecycleState ? (- <span className="cu-chip">- {`Lifecycle: ${lifecycleState}${- lifecycleReason ? ` — ${friendlyLifecycleReason(lifecycleReason)}` : ''- }`}- </span>- ) : null}- </div>- <div className="cu-agent-detail-heading__actions">- {editingOverview ? (- <>- <button- type="button"- className="cu-btn cu-btn--ghost cu-btn--sm"- onClick={() => {- // Discard any unsaved Overview edits before leaving edit- // mode, so the read-only view and the next save reflect- // the last SAVED state — not the abandoned draft.- resetOverviewDrafts()- setEditingOverview(false)- }}- disabled={busy}- >- Cancel- </button>- <button- type="button"- className="cu-btn cu-btn--primary"- onClick={async () => {- // AP-6: stay in edit mode on failure so the operator's- // draft survives alongside the error/conflict banner.- if (await saveHost()) {- setEditingOverview(false)- }- }}- disabled={busy || !hostNameDraft.trim()}- >- {busy ? 'Saving…' : 'Save'}- </button>- </>- ) : (- <button- type="button"- className="cu-btn cu-btn--ghost cu-btn--sm"- onClick={() => {- // Defensive: start every edit session from the last SAVED- // snapshot, so a stale draft never leaks into this Overview- // save. resetOverviewDrafts deliberately leaves contextRef- // untouched while the Context tab is mid-edit — that tab is a- // legitimate live writer of contextRefDraft, not a stale- // leftover, so its in-progress selection must be preserved.- resetOverviewDrafts()- setEditingOverview(true)- }}- disabled={busy}- >- Edit- </button>- )}- </div>- </div>- <div className="cu-form-stack">- <div className="cu-field">- <label htmlFor="host-name">Name</label>- {editingOverview ? (- <>- <input id="host-name" value={hostNameDraft} readOnly />- <span className="cu-field__hint">- This is the agent identifier, not editable.- </span>- </>- ) : (- <div className="cu-field__readonly">{hostNameDraft}</div>- )}- </div>- <div className="cu-field">- <label htmlFor="host-display">Display name</label>- {editingOverview ? (- <input- id="host-display"- value={hostDisplayDraft}- onChange={e => setHostDisplayDraft(e.target.value)}- disabled={busy}- autoFocus- />- ) : (- <div className="cu-field__readonly">{hostDisplayDraft}</div>- )}- </div>- <div className="cu-field" style={{ marginBottom: 0 }}>- <label htmlFor="host-agent-type">Type</label>- {editingOverview ? (- <>- <select- id="host-agent-type"- value={statelessDraft ? 'stateless' : 'stateful'}- onChange={e => setStatelessDraft(e.target.value === 'stateless')}- disabled={busy}- >- <option value="stateful">Stateful (always on)</option>- <option value="stateless">Stateless (suspends when idle)</option>- </select>- <span className="cu-field__hint">- Stateless agents suspend after the idle window and wake on demand.- Communication channels keep stateless agents always-on unless the cluster- explicitly enables wake-on-interaction; desktop still requires a stateful- agent.- </span>- </>- ) : (- <div className="cu-field__readonly">- {statelessDraft ? 'Stateless (suspends when idle)' : 'Stateful (always on)'}- </div>- )}- </div>- </div>-- {!initialLoading && (- <div- style={{- marginTop: '2rem',- paddingTop: '1.25rem',- borderTop: '1px solid var(--cu-border)',- }}- >- <p className="cu-section-title" style={{ marginBottom: '0.5rem' }}>- Danger zone- </p>- <p className="cu-muted" style={{ fontSize: '0.8125rem', marginBottom: '0.75rem' }}>- Permanently delete this agent and its direct access mappings.- </p>- <button- type="button"- className="cu-btn cu-btn--ghost cu-btn--sm"- style={{ color: 'var(--cu-danger)' }}- onClick={() => {- setDeleteAgentDialogError('')- setShowDeleteAgentConfirm(true)- }}- disabled={busy}- >- Delete agent...- </button>- </div>- )}- </>- )}-{activeTab === 'model' && (<><div className={editingModel ? 'cu-agent-detail-toolbar' : 'cu-agent-detail-heading'}>@@ -1037,7 +823,7 @@ export default function HostDetailsPage() {type="button"className="cu-btn cu-btn--icon cu-btn--toolbar"onClick={async () => {- if (await saveHost()) {+ if (await saveContextRef()) {setEditingContext(false)}}}@@ -1072,74 +858,6 @@ export default function HostDetailsPage() {{activeTab === 'access' && <HostAccessTab hostName={routeName} />}</div>- {showDeleteAgentConfirm && (- <div- style={{- position: 'fixed',- inset: 0,- background: 'var(--cu-overlay)',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- zIndex: 1000,- padding: '1rem',- }}- role="presentation"- onClick={e => {- if (e.target === e.currentTarget && !deletingAgent) setShowDeleteAgentConfirm(false)- }}- >- <div- className="cu-modal-panel"- style={{ width: 'min(28rem, 96vw)' }}- role="alertdialog"- aria-labelledby="confirm-delete-agent"- onClick={e => e.stopPropagation()}- >- <div className="cu-modal-panel__head">- <strong id="confirm-delete-agent" style={{ fontSize: '1rem', lineHeight: 1.35 }}>- Delete agent permanently?- </strong>- <button- type="button"- className="cu-btn cu-btn--icon cu-btn--ghost"- onClick={() => setShowDeleteAgentConfirm(false)}- disabled={deletingAgent}- aria-label="Close"- >- <IconX width={18} height={18} />- </button>- </div>- <p className="cu-muted" style={{ fontSize: '0.875rem', margin: '0 0 1rem' }}>- This removes <strong>{routeName}</strong> and cannot be undone.- </p>- {deleteAgentDialogError ? (- <div className="cu-banner cu-banner--error" style={{ marginBottom: '0.75rem' }}>- {deleteAgentDialogError}- </div>- ) : null}- <div className="cu-modal-panel__foot">- <button- type="button"- className="cu-btn cu-btn--ghost cu-btn--sm"- onClick={() => setShowDeleteAgentConfirm(false)}- disabled={deletingAgent}- >- Cancel- </button>- <button- type="button"- className="cu-btn cu-btn--primary"- style={{ background: 'var(--cu-danger)', borderColor: 'var(--cu-danger)' }}- onClick={() => void deleteAgentPermanently()}- disabled={deletingAgent}- >- {deletingAgent ? 'Deleting…' : 'Delete agent'}- </button>- </div>- </div>- </div>- )}{confirmDialog}</DetailPageShell>)diff --git a/control-ui/app/hosts/page.tsx b/control-ui/app/hosts/page.tsxindex 4425d650d..2fa1ca749 100644--- a/control-ui/app/hosts/page.tsx+++ b/control-ui/app/hosts/page.tsx@@ -1,6 +1,6 @@'use client'-import { useEffect, useState } from 'react'+import { useEffect, useMemo, useState } from 'react'import { useRouter } from 'next/navigation'import { AuthGate } from '@components/AuthGate'import { useConfirmDialog } from '@components/ConfirmDialog'@@ -8,7 +8,7 @@ import { DashboardLayout } from '@components/DashboardLayout'import { HostTable } from '@components/HostTable'import { useToast } from '@components/Toast'import { CONTROL_ROUTES } from '@constants/routes'-import { apiSend, getHosts, isSilentApiError } from '@lib/api'+import { apiSend, getContexts, getHosts, isSilentApiError } from '@lib/api'import type { HostResource } from '@lib/api'type HostRef = { name: string; namespace: string }@@ -16,6 +16,7 @@ type HostRef = { name: string; namespace: string }export default function HostsPage() {const router = useRouter()const [hosts, setHosts] = useState<HostResource[]>([])+ const [contextsByRef, setContextsByRef] = useState<Record<string, string[]>>({})const [loading, setLoading] = useState(true)const [error, setError] = useState('')const [deletingKey, setDeletingKey] = useState<string | null>(null)@@ -26,8 +27,24 @@ export default function HostsPage() {setLoading(true)setError('')try {- const response = await getHosts()- setHosts(response.items || [])+ // Fetch hosts and contexts in parallel. The context payload powers the+ // hover card on the Context column (shows the same MCP-server list the+ // create wizard shows), so any failure to load it surfaces here too.+ const [hostsResponse, contextsResponse] = await Promise.all([getHosts(), getContexts()])+ setHosts(hostsResponse.items || [])+ const map: Record<string, string[]> = {}+ for (const ctx of contextsResponse.items || []) {+ const ref = String(ctx.spec?.contextId || ctx.metadata?.name || '').trim()+ if (!ref) continue+ const servers = Array.isArray(ctx.spec?.mcpServers)+ ? ctx.spec.mcpServers+ .map(String)+ .map(v => v.trim())+ .filter(Boolean)+ : []+ map[ref] = servers+ }+ setContextsByRef(map)} catch (nextError) {if (isSilentApiError(nextError)) returnsetError(nextError instanceof Error ? nextError.message : 'Failed to load agents')@@ -66,13 +83,15 @@ export default function HostsPage() {}}+ const stableContextsByRef = useMemo(() => contextsByRef, [contextsByRef])+return (<AuthGate><DashboardLayout>{error ? <div className="cu-banner cu-banner--error">{error}</div> : null}<HostTableitems={hosts}- onOpen={host => router.push(CONTROL_ROUTES.agents.tab(host.name, 'overview'))}+ onOpen={host => router.push(CONTROL_ROUTES.agents.detail(host.name))}onOpenContext={contextName => {const trimmed = contextName.trim()if (trimmed) router.push(CONTROL_ROUTES.contexts.connectors(trimmed))@@ -83,6 +102,7 @@ export default function HostsPage() {onCreateHost={() => router.push(CONTROL_ROUTES.agents.new)}refreshing={loading}loading={loading}+ contextsByRef={stableContextsByRef}/>{confirmDialog}</DashboardLayout>diff --git a/control-ui/components/ContextTable.tsx b/control-ui/components/ContextTable.tsxindex e0ad406c6..d1ed0edec 100644--- a/control-ui/components/ContextTable.tsx+++ b/control-ui/components/ContextTable.tsx@@ -2,13 +2,14 @@import React, { useMemo, useState } from 'react'import { ContextResource } from '../lib/api'+import { RowActionsMenu } from './RowActionsMenu'import { SectionSearchInput } from './SectionSearchInput'import { IconGroupWork } from './Sidebar/icons'import { SkeletonTableRows } from './SkeletonTableRows'import { TableHeaderRow } from './TableHeaderRow'import type { TableHeaderColumn } from './TableHeaderRow/types'import { TablePanelHeader } from './TablePanelHeader'-import { IconPencil, IconRefresh, IconX } from './icons'+import { IconRefresh } from './icons'type ContextRef = { name: string }@@ -163,40 +164,25 @@ export function ContextTable({{mcpServers.length}</td><td style={{ textAlign: 'right' }}>- <div- style={{- display: 'inline-flex',- alignItems: 'center',- gap: '0.5rem',- flexWrap: 'wrap',- justifyContent: 'flex-end',- }}- >- <button- type="button"- className="cu-btn cu-btn--icon cu-btn--toolbar"- onClick={event => {- event.stopPropagation()- onEdit({ name })- }}- onKeyDown={event => event.stopPropagation()}- aria-label={`Edit context ${name}`}- >- <IconPencil width={16} height={16} />- </button>- <button- type="button"- className="cu-btn cu-btn--icon cu-btn--danger-icon"- onClick={event => {- event.stopPropagation()- void onDelete({ name })- }}- onKeyDown={event => event.stopPropagation()}- disabled={deletingKey === key}- aria-label={deletingKey === key ? 'Deleting…' : `Delete context ${name}`}- >- <IconX width={16} height={16} />- </button>+ <div className="cu-table-actions">+ <RowActionsMenu+ ariaLabel={`Actions for context ${name}`}+ horizontalTrigger+ actions={[+ {+ key: 'edit',+ label: 'Edit',+ onClick: () => onEdit({ name }),+ },+ {+ key: 'delete',+ label: deletingKey === key ? 'Deleting…' : 'Delete',+ danger: true,+ disabled: deletingKey === key,+ onClick: () => void onDelete({ name }),+ },+ ]}+ /></div></td></tr>diff --git a/control-ui/components/HostTable.tsx b/control-ui/components/HostTable.tsxindex 0ca83ebc7..1936b794b 100644--- a/control-ui/components/HostTable.tsx+++ b/control-ui/components/HostTable.tsx@@ -2,53 +2,24 @@import React, { useMemo, useState } from 'react'import { getProviderLabel } from '../lib/llm'-import type { HostItem, HostLifecycleInfo, HostRef } from './HostTable.types'+import type { HostItem, HostRef } from './HostTable.types'import { LlmProviderIcon } from './LlmProviderIcon'+import { RowActionsMenu } from './RowActionsMenu'import { SectionSearchInput } from './SectionSearchInput'import { IconRobot } from './Sidebar/icons'import { SkeletonTableRows } from './SkeletonTableRows'import { TableHeaderRow } from './TableHeaderRow'import type { TableHeaderColumn } from './TableHeaderRow/types'import { TablePanelHeader } from './TablePanelHeader'-import { IconRefresh, IconX } from './icons'+import { IconRefresh } from './icons'const HOST_COLUMNS: TableHeaderColumn[] = [{ key: 'name', label: 'Name' },- { key: 'lifecycle', label: 'Lifecycle', width: '10rem' },{ key: 'context', label: 'Context', width: '20%' },{ key: 'providers', label: 'Providers', minWidth: '8rem' },{ key: 'actions', width: '3.5rem', align: 'right', ariaLabel: 'Actions' },]-function getHostLifecycleInfo(host: HostItem): HostLifecycleInfo {- const isStateless = host.spec?.lifecycle?.stateless === true- const rejection = host.status?.conditions?.find(- condition =>- condition.type === 'StatelessEnableRejected' &&- String(condition.status || '').toLowerCase() === 'true'- )- const rejectedReason = String(rejection?.message || rejection?.reason || '').trim()- const state = rejection- ? 'blocked'- : isStateless- ? String(host.status?.lifecycle?.state || '').trim()- : ''- const reason = rejection- ? rejectedReason- : isStateless- ? String(host.status?.lifecycle?.reason || '').trim()- : ''- const label = isStateless ? 'Stateless' : 'Stateful'- const details = [state, reason].filter(Boolean).join(' - ')- return {- kind: rejection ? 'blocked' : isStateless ? 'stateless' : 'stateful',- label,- state,- reason,- title: details ? `${label}: ${details}` : `${label} agent`,- }-}-export function collectProviderIds(spec: Record<string, unknown>): string[] {const primary = String((spec.model as { provider?: string } | undefined)?.provider || '').trim()const fallbacks = Array.isArray(@@ -70,16 +41,65 @@ export function collectProviderIds(spec: Record<string, unknown>): string[] {return out}-function HostLifecycleBadge({ lifecycle }: { lifecycle: HostLifecycleInfo }) {+// Hover card over the context cell. Mirrors the `cu-agent-context-mcp-summary`+// block the create wizard shows for the selected context — the operator gets+// the same list of attached MCP servers without navigating away. The card is+// keyboard-accessible (focus + blur mirror hover) and `role="tooltip"` keeps+// screen readers in sync with what's visible.+function ContextMcpHoverCard({+ contextRef,+ mcpServers,+ onOpenContext,+}: {+ contextRef: string+ mcpServers: string[] | undefined+ onOpenContext: (contextRef: string) => void+}) {+ const [open, setOpen] = useState(false)+ const hasServers = Array.isArray(mcpServers) && mcpServers.length > 0+ const cardId = `ctx-mcp-${contextRef}`++ const trigger = (+ <button+ type="button"+ className="cu-link"+ onClick={e => {+ e.stopPropagation()+ onOpenContext(contextRef)+ }}+ onKeyDown={e => e.stopPropagation()}+ aria-describedby={hasServers && open ? cardId : undefined}+ >+ {contextRef}+ </button>+ )++ if (!hasServers) return trigger+return (<span- className={`cu-host-lifecycle cu-host-lifecycle--${lifecycle.kind}`}- title={lifecycle.title}- aria-label={lifecycle.title}+ className="cu-host-context-hover"+ onMouseEnter={() => setOpen(true)}+ onMouseLeave={() => setOpen(false)}+ onFocus={() => setOpen(true)}+ onBlur={() => setOpen(false)}>- <span className="cu-host-lifecycle__dot" aria-hidden="true" />- <span className="cu-host-lifecycle__label">{lifecycle.label}</span>- {lifecycle.state ? <span className="cu-host-lifecycle__state">{lifecycle.state}</span> : null}+ {trigger}+ {open ? (+ <div role="tooltip" id={cardId} className="cu-agent-context-mcp-summary">+ <div className="cu-agent-context-mcp-summary__head">+ <span>MCP servers</span>+ <span>{mcpServers.length}</span>+ </div>+ <ul className="cu-agent-context-mcp-summary__list">+ {mcpServers.map(server => (+ <li key={server} title={server}>+ {server}+ </li>+ ))}+ </ul>+ </div>+ ) : null}</span>)}@@ -94,6 +114,7 @@ export function HostTable({onCreateHost,refreshing,loading,+ contextsByRef,}: {items: HostItem[]onOpen: (host: HostRef) => void@@ -104,6 +125,10 @@ export function HostTable({onCreateHost: () => voidrefreshing: booleanloading?: boolean+ // contextRef (host.spec.contextRef) → list of attached MCP server names. The+ // page passes this from the same `/api/v1/admin/contexts` payload the+ // creation wizard consumes, so the operator sees the same attribution here.+ contextsByRef?: Record<string, string[]>}) {const [searchQuery, setSearchQuery] = useState('')const rows = useMemo(@@ -126,20 +151,10 @@ export function HostTable({if (!normalizedSearch) return rowsreturn rows.filter(({ name, displayName, namespace, item }) => {const spec = item.spec || {}- const lifecycle = getHostLifecycleInfo(item)const contextRef = String(spec.contextRef || '').trim()const providers = collectProviderIds(spec)const providerLabels = providers.map(id => getProviderLabel(id)).join(' ')- return [- name,- displayName,- namespace,- lifecycle.label,- lifecycle.state,- lifecycle.reason,- contextRef,- providerLabels,- ]+ return [name, displayName, namespace, contextRef, providerLabels].join(' ').toLowerCase().includes(normalizedSearch)@@ -194,7 +209,7 @@ export function HostTable({<TableHeaderRow columns={HOST_COLUMNS} /></thead><tbody>- <SkeletonTableRows columns={5} rows={4} />+ <SkeletonTableRows columns={4} rows={4} /></tbody></table></div>@@ -214,7 +229,6 @@ export function HostTable({const contextRef = rawContext || '-'const contextClickable = Boolean(rawContext)const providers = collectProviderIds(item.spec || {})- const lifecycle = getHostLifecycleInfo(item)const openAgent = () => onOpen({ namespace, name })return (<tr@@ -236,22 +250,13 @@ export function HostTable({<div className="cu-table__cell-subtle">{name}</div>) : null}</td>- <td>- <HostLifecycleBadge lifecycle={lifecycle} />- </td><td>{contextClickable ? (- <button- type="button"- className="cu-link"- onClick={e => {- e.stopPropagation()- onOpenContext(rawContext)- }}- onKeyDown={e => e.stopPropagation()}- >- {contextRef}- </button>+ <ContextMcpHoverCard+ contextRef={contextRef}+ mcpServers={contextsByRef?.[rawContext]}+ onOpenContext={onOpenContext}+ />) : (<span className="cu-table__cell-muted">{contextRef}</span>)}@@ -282,18 +287,24 @@ export function HostTable({)}</td><td className="cu-table__cell-actions" onClick={e => e.stopPropagation()}>- <button- type="button"- className="cu-btn cu-btn--icon cu-btn--danger-icon"- onClick={() => void onDelete({ namespace, name })}- onKeyDown={e => e.stopPropagation()}- disabled={deletingKey === key}- aria-label={- deletingKey === key ? 'Deleting agent…' : `Remove agent ${name}`- }- >- <IconX width={16} height={16} />- </button>+ <RowActionsMenu+ ariaLabel={`Actions for agent ${name}`}+ horizontalTrigger+ actions={[+ {+ key: 'view',+ label: 'View agent details',+ onClick: () => onOpen({ namespace, name }),+ },+ {+ key: 'delete',+ label: deletingKey === key ? 'Deleting agent…' : 'Delete',+ danger: true,+ disabled: deletingKey === key,+ onClick: () => void onDelete({ namespace, name }),+ },+ ]}+ /></td></tr>)diff --git a/control-ui/components/HostTable.types.ts b/control-ui/components/HostTable.types.tsindex 49ad87717..b11328982 100644--- a/control-ui/components/HostTable.types.ts+++ b/control-ui/components/HostTable.types.ts@@ -15,11 +15,3 @@ export type HostItem = {}export type HostRef = { name: string; namespace: string }--export type HostLifecycleInfo = {- kind: 'stateful' | 'stateless' | 'blocked'- label: string- state: string- reason: string- title: string-}diff --git a/control-ui/components/LlmModelTable.tsx b/control-ui/components/LlmModelTable.tsxindex eb46ef7ff..b65eb2db4 100644--- a/control-ui/components/LlmModelTable.tsx+++ b/control-ui/components/LlmModelTable.tsx@@ -9,13 +9,14 @@ import { FilterSelect } from './FilterSelect'import type { LlmModelTableProps } from './LlmModelTable.types'import { LlmProviderIcon } from './LlmProviderIcon'import { MissingPriceWarning } from './MissingPriceWarning'+import { RowActionsMenu } from './RowActionsMenu'import { SectionSearchInput } from './SectionSearchInput'import { IconModels } from './Sidebar/icons'import { SkeletonTableRows } from './SkeletonTableRows'import { TableHeaderRow } from './TableHeaderRow'import type { TableHeaderColumn } from './TableHeaderRow/types'import { TablePanelHeader } from './TablePanelHeader'-import { IconChevronRight, IconPencil, IconRefresh, IconX } from './icons'+import { IconChevronRight, IconRefresh } from './icons'import { SelectInput } from './ui'type ModelSortKey = 'model' | 'vendor' | 'displayName' | 'contextWindow'@@ -425,27 +426,24 @@ export function LlmModelTable({) : null}</td><td className="cu-px-actions">- <button- type="button"- className="cu-btn cu-btn--icon cu-btn--toolbar"- onClick={() => onEdit(model.id)}- aria-label={`Edit model ${model.provider}/${model.model}`}- >- <IconPencil width={16} height={16} />- </button>- <button- type="button"- className="cu-btn cu-btn--icon cu-btn--danger-icon"- onClick={() => void onDelete(model)}- disabled={deletingId === model.id}- aria-label={- deletingId === model.id- ? 'Deleting model…'- : `Delete model ${model.provider}/${model.model}`- }- >- <IconX width={16} height={16} />- </button>+ <RowActionsMenu+ ariaLabel={`Actions for model ${model.provider}/${model.model}`}+ horizontalTrigger+ actions={[+ {+ key: 'edit',+ label: 'Edit',+ onClick: () => onEdit(model.id),+ },+ {+ key: 'delete',+ label: deletingId === model.id ? 'Deleting…' : 'Delete',+ danger: true,+ disabled: deletingId === model.id,+ onClick: () => void onDelete(model),+ },+ ]}+ /></td></tr>))diff --git a/control-ui/components/McpServerTable.tsx b/control-ui/components/McpServerTable.tsxindex 93627290b..48da3eeb1 100644--- a/control-ui/components/McpServerTable.tsx+++ b/control-ui/components/McpServerTable.tsx@@ -16,7 +16,7 @@ import { SkeletonTableRows } from './SkeletonTableRows'import { TableHeaderRow } from './TableHeaderRow'import type { TableHeaderColumn } from './TableHeaderRow/types'import { TablePanelHeader } from './TablePanelHeader'-import { IconChevronRight, IconCopy, IconPencil, IconRefresh, IconX } from './icons'+import { IconChevronRight, IconCopy, IconRefresh, IconX } from './icons'const ENABLED_TOOLTIP = 'Enabled controls whether this server is available to contexts and agents.'type ConnectorSortKey = 'name' | 'enabled' | 'status'@@ -540,33 +540,32 @@ export function McpServerTable({onKeyDown={event => event.stopPropagation()}><div className="cu-table-actions">- {onEdit ? (- <button- type="button"- className="cu-btn cu-btn--icon cu-btn--toolbar"- onClick={() => onEdit({ namespace, name })}- aria-label={`Edit connector ${name}`}- title={`Edit connector ${name}`}- >- <IconPencil width={16} height={16} />- </button>- ) : null}- {onDelete ? (- <button- type="button"- className="cu-btn cu-btn--icon cu-btn--danger-icon"- onClick={() => void onDelete({ namespace, name })}- disabled={deletingKey === key}- aria-label={- deletingKey === key ? 'Deleting...' : `Remove connector ${name}`- }- title={- deletingKey === key ? 'Deleting...' : `Remove connector ${name}`- }- >- <IconX width={16} height={16} />- </button>- ) : null}+ <RowActionsMenu+ ariaLabel={`Actions for connector ${name}`}+ horizontalTrigger+ actions={[+ ...(onEdit+ ? [+ {+ key: 'edit',+ label: 'Edit',+ onClick: () => onEdit({ namespace, name }),+ },+ ]+ : []),+ ...(onDelete+ ? [+ {+ key: 'remove',+ label: deletingKey === key ? 'Deleting…' : 'Delete',+ danger: true,+ disabled: deletingKey === key,+ onClick: () => void onDelete({ namespace, name }),+ },+ ]+ : []),+ ]}+ /></div></td></tr>diff --git a/control-ui/components/RecipeSecretsPanel/index.tsx b/control-ui/components/RecipeSecretsPanel/index.tsxindex 9e2bec2ef..b0c435dfb 100644--- a/control-ui/components/RecipeSecretsPanel/index.tsx+++ b/control-ui/components/RecipeSecretsPanel/index.tsx@@ -11,9 +11,10 @@ import {} from '../../lib/api'import { collectWorkflowRecipeSecretRefs } from '../../lib/workflowRecipeSecretRefs'import { useConfirmDialog } from '../ConfirmDialog'+import { RowActionsMenu } from '../RowActionsMenu'import { TablePanelHeader } from '../TablePanelHeader'import { useToast } from '../Toast'-import { IconPencil, IconRefresh, IconX } from '../icons'+import { IconRefresh } from '../icons'type RecipeSecretStatus = 'provisioned' | 'missing'@@ -275,29 +276,27 @@ export function RecipeSecretsPanel({Add</button>) : (- <div style={{ display: 'inline-flex', gap: '0.35rem' }}>- <button- type="button"- className="cu-btn cu-btn--icon cu-btn--toolbar"- onClick={() => navigateToEdit(row.name, row.namespace)}- aria-label={`Update recipe secret ${row.name}`}- >- <IconPencil width={16} height={16} />- </button>- <button- type="button"- className="cu-btn cu-btn--icon cu-btn--danger-icon"- onClick={() => void deleteRow(row.name, row.namespace)}- disabled={deletingName === `${row.namespace}/${row.name}`}- aria-label={- deletingName === `${row.namespace}/${row.name}`- ? 'Deleting…'- : `Delete recipe secret ${row.name}`- }- >- <IconX width={16} height={16} />- </button>- </div>+ <RowActionsMenu+ ariaLabel={`Actions for recipe secret ${row.name}`}+ horizontalTrigger+ actions={[+ {+ key: 'edit',+ label: 'Update',+ onClick: () => navigateToEdit(row.name, row.namespace),+ },+ {+ key: 'delete',+ label:+ deletingName === `${row.namespace}/${row.name}`+ ? 'Deleting…'+ : 'Delete',+ danger: true,+ disabled: deletingName === `${row.namespace}/${row.name}`,+ onClick: () => void deleteRow(row.name, row.namespace),+ },+ ]}+ />)}</td></tr>diff --git a/control-ui/components/TokenBudgetTable.tsx b/control-ui/components/TokenBudgetTable.tsxindex 1dc95dd1b..6b2abd275 100644--- a/control-ui/components/TokenBudgetTable.tsx+++ b/control-ui/components/TokenBudgetTable.tsx@@ -9,6 +9,7 @@ import {formatBudgetScope,periodLabel,} from '@lib/budgets'+import { RowActionsMenu } from './RowActionsMenu'import { SectionSearchInput } from './SectionSearchInput'import { IconBudget } from './Sidebar/icons'import { SkeletonTableRows } from './SkeletonTableRows'@@ -16,7 +17,7 @@ import { TableHeaderRow } from './TableHeaderRow'import type { TableHeaderColumn } from './TableHeaderRow/types'import { TablePanelHeader } from './TablePanelHeader'import type { TokenBudgetTableProps } from './TokenBudgetTable.types'-import { IconPencil, IconRefresh, IconX } from './icons'+import { IconRefresh } from './icons'const BUDGET_COLUMNS: TableHeaderColumn[] = [{ key: 'name', label: 'Name', minWidth: '9rem' },@@ -251,23 +252,24 @@ function BudgetRow({</button></td><td className="cu-tb-actions">- <button- type="button"- className="cu-btn cu-btn--icon cu-btn--toolbar"- onClick={() => onEdit(budget.id)}- aria-label={`Edit budget ${budget.name}`}- >- <IconPencil width={16} height={16} />- </button>- <button- type="button"- className="cu-btn cu-btn--icon cu-btn--danger-icon"- onClick={() => void onDelete(budget)}- disabled={deleting}- aria-label={deleting ? 'Deleting budget…' : `Delete budget ${budget.name}`}- >- <IconX width={16} height={16} />- </button>+ <RowActionsMenu+ ariaLabel={`Actions for budget ${budget.name}`}+ horizontalTrigger+ actions={[+ {+ key: 'edit',+ label: 'Edit',+ onClick: () => onEdit(budget.id),+ },+ {+ key: 'delete',+ label: deleting ? 'Deleting…' : 'Delete',+ danger: true,+ disabled: deleting,+ onClick: () => void onDelete(budget),+ },+ ]}+ /></td></tr>)diff --git a/control-ui/components/__tests__/ContextTable.test.tsx b/control-ui/components/__tests__/ContextTable.test.tsxindex af9b9566c..dc83b36e5 100644--- a/control-ui/components/__tests__/ContextTable.test.tsx+++ b/control-ui/components/__tests__/ContextTable.test.tsx@@ -83,7 +83,7 @@ describe('ContextTable', () => {expect(screen.getByText('business')).toHaveClass('cu-expandable-row__name')})- it('does not open a context from row action buttons', () => {+ it('does not open a context from the row actions kebab', () => {const onView = vi.fn()const onEdit = vi.fn()const onDelete = vi.fn().mockResolvedValue(undefined)@@ -100,12 +100,40 @@ describe('ContextTable', () => {/>)- fireEvent.click(screen.getByRole('button', { name: 'Edit context business' }))+ fireEvent.click(screen.getByRole('button', { name: 'Actions for context business' }))++ fireEvent.click(screen.getByRole('menuitem', { name: 'Edit' }))expect(onEdit).toHaveBeenCalledWith({ name: 'business' })expect(onView).not.toHaveBeenCalled()- fireEvent.click(screen.getByRole('button', { name: 'Delete context business' }))+ fireEvent.click(screen.getByRole('button', { name: 'Actions for context business' }))+ fireEvent.click(screen.getByRole('menuitem', { name: 'Delete' }))expect(onDelete).toHaveBeenCalledWith({ name: 'business' })expect(onView).not.toHaveBeenCalled()})++ it('disables only the Delete item while deleting and renames it to Deleting…', () => {+ const onEdit = vi.fn()+ const onDelete = vi.fn().mockResolvedValue(undefined)+ render(+ <ContextTable+ items={contexts}+ onView={vi.fn()}+ onEdit={onEdit}+ onDelete={onDelete}+ deletingKey="business"+ onRefresh={vi.fn()}+ onCreate={vi.fn()}+ refreshing={false}+ />+ )++ fireEvent.click(screen.getByRole('button', { name: 'Actions for context business' }))++ const editItem = screen.getByRole('menuitem', { name: 'Edit' })+ const deletingItem = screen.getByRole('menuitem', { name: 'Deleting…' })++ expect(editItem).not.toBeDisabled()+ expect(deletingItem).toBeDisabled()+ })})diff --git a/control-ui/components/__tests__/HostTable.test.tsx b/control-ui/components/__tests__/HostTable.test.tsxindex ed9c2e7d2..ddbc53960 100644--- a/control-ui/components/__tests__/HostTable.test.tsx+++ b/control-ui/components/__tests__/HostTable.test.tsx@@ -3,38 +3,7 @@ import { fireEvent, render, screen, within } from '@testing-library/react'import { HostTable, collectProviderIds } from '../HostTable'import type { HostItem } from '../HostTable.types'-function makeHost(overrides: {- name: string- stateless?: boolean- state?: string- reason?: string- rejectedMessage?: string-}): HostItem {- return {- metadata: { name: overrides.name, namespace: 'mcp-host' },- spec: {- contextRef: 'context1',- lifecycle: overrides.stateless ? { stateless: true } : undefined,- model: { provider: 'zai', name: 'glm-5.1' },- },- status: {- lifecycle: overrides.state- ? { state: overrides.state, reason: overrides.reason || '' }- : undefined,- conditions: overrides.rejectedMessage- ? [- {- type: 'StatelessEnableRejected',- status: 'True',- message: overrides.rejectedMessage,- },- ]- : undefined,- },- }-}--function renderHostTable(items: HostItem[]) {+function renderHostTable(items: HostItem[], contextsByRef?: Record<string, string[]>) {return render(<HostTableitems={items}@@ -45,49 +14,24 @@ function renderHostTable(items: HostItem[]) {onRefresh={vi.fn()}onCreateHost={vi.fn()}refreshing={false}+ contextsByRef={contextsByRef}/>)}-describe('HostTable lifecycle column', () => {- it('renders stateful, stateless, and stateless-blocked lifecycle badges', () => {- renderHostTable([- makeHost({ name: 'chatllm' }),- makeHost({ name: 'chatllm-stateless', stateless: true, state: 'suspended', reason: 'idle' }),- makeHost({- name: 'channel-host',- stateless: true,- state: 'active',- rejectedMessage: 'CommunicationChannel-connected hosts are always-on.',- }),- ])-- expect(screen.getByLabelText('Stateful agent')).toBeInTheDocument()- expect(screen.getByLabelText('Stateless: suspended - idle')).toBeInTheDocument()- expect(- screen.getByLabelText(- 'Stateless: blocked - CommunicationChannel-connected hosts are always-on.'- )- ).toBeInTheDocument()-- const blockedRow = screen.getByLabelText('Open agent channel-host')- expect(within(blockedRow).getByText('blocked')).toBeInTheDocument()- })-- it('filters rows by lifecycle reason text', () => {- renderHostTable([- makeHost({ name: 'chatllm', stateless: true, state: 'active', reason: 'recentActivity' }),- makeHost({ name: 'chatllm-stateless', stateless: true, state: 'suspended', reason: 'idle' }),- ])-- fireEvent.change(screen.getByRole('searchbox', { name: 'Search agents' }), {- target: { value: 'idle' },- })-- expect(screen.queryByLabelText('Open agent chatllm')).not.toBeInTheDocument()- expect(screen.getByLabelText('Open agent chatllm-stateless')).toBeInTheDocument()- })-})+function hostWithContext(+ name: string,+ contextRef: string,+ model?: Record<string, unknown>+): HostItem {+ return {+ metadata: { name, namespace: 'mcp-host' },+ spec: {+ contextRef,+ ...(model ? { model: model as { provider?: string; name?: string } } : {}),+ },+ }+}// Pure-function invariants for collectProviderIds — exported so the ordering// and deduplication contract is verifiable independently of the DOM.@@ -282,3 +226,151 @@ describe('HostTable display name column (UT-9)', () => {expect(screen.queryByText('Prod X')).not.toBeInTheDocument()})})++// Hover card on the Context column — when the page supplies a `contextsByRef`+// map, hovering (or keyboard-focusing) the context link reveals the same+// MCP-server list the create wizard shows for the selected context.+describe('HostTable context MCP hover card', () => {+ function contextLink(row: HTMLElement): HTMLElement {+ return within(row).getByRole('button', { name: 'context1' })+ }++ it('reveals the MCP server list on hover and lists every server', () => {+ renderHostTable([hostWithContext('chatllm', 'context1')], {+ context1: ['github', 'linear', 'slack'],+ })++ const row = screen.getByLabelText('Open agent chatllm')+ const link = contextLink(row)++ // Closed by default — nothing tooltipped.+ expect(within(row).queryByRole('tooltip')).not.toBeInTheDocument()+ expect(link).not.toHaveAttribute('aria-describedby')++ fireEvent.mouseEnter(link)+ const card = within(row).getByRole('tooltip')+ expect(card).toHaveTextContent('MCP servers')+ expect(card).toHaveTextContent('3')+ expect(within(card).getByText('github')).toBeInTheDocument()+ expect(within(card).getByText('linear')).toBeInTheDocument()+ expect(within(card).getByText('slack')).toBeInTheDocument()++ fireEvent.mouseLeave(link)+ expect(within(row).queryByRole('tooltip')).not.toBeInTheDocument()+ })++ it('reveals the card on keyboard focus (accessible path)', () => {+ renderHostTable([hostWithContext('chatllm', 'context1')], {+ context1: ['github'],+ })++ const row = screen.getByLabelText('Open agent chatllm')+ const link = contextLink(row)++ fireEvent.focus(link)+ const card = within(row).getByRole('tooltip')+ expect(within(card).getByText('github')).toBeInTheDocument()+ expect(link).toHaveAttribute('aria-describedby', card.id)++ fireEvent.blur(link)+ expect(within(row).queryByRole('tooltip')).not.toBeInTheDocument()+ })++ it('stays a plain link when the context has no MCP servers', () => {+ renderHostTable([hostWithContext('chatllm', 'context1')], {+ context1: [],+ })++ const row = screen.getByLabelText('Open agent chatllm')+ expect(within(row).queryByRole('tooltip')).not.toBeInTheDocument()+ fireEvent.mouseEnter(within(row).getByRole('button', { name: 'context1' }))+ expect(within(row).queryByRole('tooltip')).not.toBeInTheDocument()+ })++ it('does not show a card when the context map is missing', () => {+ renderHostTable([hostWithContext('chatllm', 'context1')])++ const row = screen.getByLabelText('Open agent chatllm')+ const link = within(row).getByRole('button', { name: 'context1' })+ fireEvent.mouseEnter(link)+ expect(within(row).queryByRole('tooltip')).not.toBeInTheDocument()+ })+})++// ─────────────────────────────────────────────────────────────────────────────+// Row actions kebab+// ─────────────────────────────────────────────────────────────────────────────+describe('HostTable — row actions kebab', () => {+ it('exposes View agent details and Delete via a single kebab menu per row', () => {+ const onOpen = vi.fn()+ const onDelete = vi.fn().mockResolvedValue(undefined)+ render(+ <HostTable+ items={[hostWithContext('chatllm', 'context1')]}+ onOpen={onOpen}+ onOpenContext={vi.fn()}+ onDelete={onDelete}+ deletingKey={null}+ onRefresh={vi.fn()}+ onCreateHost={vi.fn()}+ refreshing={false}+ contextsByRef={{ context1: [] }}+ />+ )++ fireEvent.click(screen.getByRole('button', { name: 'Actions for agent chatllm' }))++ const viewItem = screen.getByRole('menuitem', { name: 'View agent details' })+ const deleteItem = screen.getByRole('menuitem', { name: 'Delete' })+ expect(deleteItem).toHaveClass('cu-kebab__item--danger')++ fireEvent.click(viewItem)+ expect(onOpen).toHaveBeenCalledWith({ namespace: 'mcp-host', name: 'chatllm' })+ expect(onDelete).not.toHaveBeenCalled()+ })++ it('does not open the agent detail when clicking the kebab itself', () => {+ const onOpen = vi.fn()+ render(+ <HostTable+ items={[hostWithContext('chatllm', 'context1')]}+ onOpen={onOpen}+ onOpenContext={vi.fn()}+ onDelete={vi.fn().mockResolvedValue(undefined)}+ deletingKey={null}+ onRefresh={vi.fn()}+ onCreateHost={vi.fn()}+ refreshing={false}+ contextsByRef={{ context1: [] }}+ />+ )++ fireEvent.click(screen.getByRole('button', { name: 'Actions for agent chatllm' }))+ expect(onOpen).not.toHaveBeenCalled()+ })++ it('disables only the Delete item while deleting and renames it to Deleting agent…', () => {+ const onDelete = vi.fn().mockResolvedValue(undefined)+ render(+ <HostTable+ items={[hostWithContext('chatllm', 'context1')]}+ onOpen={vi.fn()}+ onOpenContext={vi.fn()}+ onDelete={onDelete}+ deletingKey="mcp-host/chatllm"+ onRefresh={vi.fn()}+ onCreateHost={vi.fn()}+ refreshing={false}+ contextsByRef={{ context1: [] }}+ />+ )++ fireEvent.click(screen.getByRole('button', { name: 'Actions for agent chatllm' }))++ const viewItem = screen.getByRole('menuitem', { name: 'View agent details' })+ const deletingItem = screen.getByRole('menuitem', { name: 'Deleting agent…' })++ expect(viewItem).not.toBeDisabled()+ expect(deletingItem).toBeDisabled()+ })+})diff --git a/control-ui/components/__tests__/McpServerTable.test.tsx b/control-ui/components/__tests__/McpServerTable.test.tsxindex 5049e964f..6cceb78e5 100644--- a/control-ui/components/__tests__/McpServerTable.test.tsx+++ b/control-ui/components/__tests__/McpServerTable.test.tsx@@ -470,3 +470,62 @@ describe('McpServerTable — context membership', () => {)})})++// ─────────────────────────────────────────────────────────────────────────────+// Row actions kebab+// ─────────────────────────────────────────────────────────────────────────────+describe('McpServerTable — row actions kebab', () => {+ it('exposes Edit and Remove via a single kebab menu per row and routes the click to the matching handler', async () => {+ const onEdit = vi.fn()+ const onDelete = vi.fn().mockResolvedValue(undefined)+ const items = [makeItem({ name: 'airtable-server' })]++ render(<McpServerTable items={items} onEdit={onEdit} onDelete={onDelete} />)++ const trigger = screen.getByRole('button', { name: 'Actions for connector airtable-server' })+ fireEvent.click(trigger)++ const editItem = await screen.findByRole('menuitem', { name: 'Edit' })+ const deleteItem = screen.getByRole('menuitem', { name: 'Delete' })+ expect(deleteItem).toHaveClass('cu-kebab__item--danger')++ fireEvent.click(editItem)+ expect(onEdit).toHaveBeenCalledWith({ namespace: 'mcp-server', name: 'airtable-server' })+ expect(onDelete).not.toHaveBeenCalled()++ fireEvent.click(trigger)+ fireEvent.click(screen.getByRole('menuitem', { name: 'Delete' }))+ await waitFor(() =>+ expect(onDelete).toHaveBeenCalledWith({ namespace: 'mcp-server', name: 'airtable-server' })+ )+ })++ it('disables only the Remove item while a delete is in flight and renames it to Deleting…', () => {+ const onDelete = vi.fn().mockResolvedValue(undefined)+ const items = [makeItem({ name: 'airtable-server' })]+ render(+ <McpServerTable+ items={items}+ onEdit={vi.fn()}+ onDelete={onDelete}+ deletingKey="mcp-server/airtable-server"+ />+ )++ fireEvent.click(screen.getByRole('button', { name: 'Actions for connector airtable-server' }))++ const editItem = screen.getByRole('menuitem', { name: 'Edit' })+ const deletingItem = screen.getByRole('menuitem', { name: 'Deleting…' })++ expect(editItem).not.toBeDisabled()+ expect(deletingItem).toBeDisabled()+ })++ it('renders no kebab when neither onEdit nor onDelete is provided', () => {+ const items = [makeItem({ name: 'airtable-server' })]+ render(<McpServerTable items={items} />)+ expect(+ screen.queryByRole('button', { name: 'Actions for connector airtable-server' })+ ).not.toBeInTheDocument()+ })+})diff --git a/control-ui/components/__tests__/RecipeSecretsPanel.test.tsx b/control-ui/components/__tests__/RecipeSecretsPanel.test.tsxindex febaa3a5b..a13faf985 100644--- a/control-ui/components/__tests__/RecipeSecretsPanel.test.tsx+++ b/control-ui/components/__tests__/RecipeSecretsPanel.test.tsx@@ -123,8 +123,9 @@ describe('RecipeSecretsPanel', () => {expect(screen.getByText('Owner: operator-secret-recipe')).toBeInTheDocument()fireEvent.click(- screen.getByRole('button', { name: 'Update recipe secret operator-api-credentials' })+ screen.getByRole('button', { name: 'Actions for recipe secret operator-api-credentials' }))+ fireEvent.click(screen.getByRole('menuitem', { name: 'Update' }))expect(pushMock).toHaveBeenCalledWith('/secrets/recipe/operator-api-credentials/edit?namespace=sandbox-recipes'diff --git a/control-ui/components/__tests__/TokenBudgetTable.test.tsx b/control-ui/components/__tests__/TokenBudgetTable.test.tsxindex f9a8912ce..d9404d079 100644--- a/control-ui/components/__tests__/TokenBudgetTable.test.tsx+++ b/control-ui/components/__tests__/TokenBudgetTable.test.tsx@@ -73,10 +73,12 @@ describe('TokenBudgetTable', () => {const onToggle = vi.fn().mockResolvedValue(undefined)renderTable({ onEdit, onDelete, onToggle })- fireEvent.click(screen.getByRole('button', { name: 'Edit budget Monthly OpenAI cap' }))+ fireEvent.click(screen.getByRole('button', { name: 'Actions for budget Monthly OpenAI cap' }))+ fireEvent.click(screen.getByRole('menuitem', { name: 'Edit' }))expect(onEdit).toHaveBeenCalledWith('budget-1')- fireEvent.click(screen.getByRole('button', { name: 'Delete budget Monthly OpenAI cap' }))+ fireEvent.click(screen.getByRole('button', { name: 'Actions for budget Monthly OpenAI cap' }))+ fireEvent.click(screen.getByRole('menuitem', { name: 'Delete' }))expect(onDelete).toHaveBeenCalledWith(budgets[0])fireEvent.click(screen.getByRole('button', { name: 'Disable budget Monthly OpenAI cap' }))diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex d3c00d762..186b759a2 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.434",+ "version": "0.1.435","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.434",+ "version": "0.1.435","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.jsonindex e66af8377..414f82f1d 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.434",+ "version": "0.1.435","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",