Skip to content

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

TypeScript

feat(control-ui): align guardrail pages with the plugin detail paradigm

Andy Pavia42c87e02b658
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.css
index 22d3cb2cb..911dc9cb0 100644
--- a/control-ui/app/globals.css
+++ b/control-ui/app/globals.css
@@ -544,6 +544,17 @@ body.cu-body {
background: var(--cu-bg-elevated);
}
+/* Nested inside a container that already draws a bordered card (a form
+ section), the list's own border, radius, and elevated background repaint the
+ same box in the same tokens — the inner corners then read as a stray rounded
+ edge under the header. Flush keeps the row rhythm and drops the chrome. */
+.cu-summary-list--flush {
+ padding: 0;
+ border: 0;
+ border-radius: 0;
+ background: none;
+}
+
.cu-summary-list__row {
display: flex;
justify-content: space-between;
@@ -1926,48 +1937,51 @@ textarea.cu-input {
container-type: inline-size;
}
+/* Columns: name, lifecycle, order, fail mode, status, actions, navigation.
+ Rows navigate to the guardrail detail page rather than expanding in place,
+ so the chevron trails the row (matching .cu-installed-plugins-table) and
+ there is no expandable inset to reserve. */
.cu-guardrails-table {
min-width: 52rem;
- --cu-expandable-inset-left: calc(3rem + 0.85rem);
- --cu-expandable-inset-right: 6rem;
+ table-layout: fixed;
}
.cu-guardrails-table th:nth-child(1),
.cu-guardrails-table td:nth-child(1) {
- width: 3rem;
-}
-
-.cu-guardrails-table th:nth-child(2),
-.cu-guardrails-table td:nth-child(2) {
width: 30%;
max-width: 30%;
}
+.cu-guardrails-table th:nth-child(3),
+.cu-guardrails-table td:nth-child(3) {
+ width: 5rem;
+}
+
.cu-guardrails-table th:nth-child(4),
.cu-guardrails-table td:nth-child(4) {
- width: 5rem;
+ width: 8rem;
}
.cu-guardrails-table th:nth-child(5),
.cu-guardrails-table td:nth-child(5) {
- width: 8rem;
+ width: 9rem;
}
.cu-guardrails-table th:nth-child(6),
.cu-guardrails-table td:nth-child(6) {
- width: 9rem;
-}
-
-.cu-guardrails-table th:nth-child(7),
-.cu-guardrails-table td:nth-child(7) {
width: 6rem;
text-align: right;
}
-.cu-guardrails-table td:nth-child(7) .cu-table-actions {
+.cu-guardrails-table td:nth-child(6) .cu-table-actions {
justify-content: flex-end;
}
+.cu-guardrails-table th:nth-child(7),
+.cu-guardrails-table td:nth-child(7) {
+ width: 3rem;
+}
+
.cu-expandable-row__name,
.cu-installed-plugin__name {
color: var(--cu-text);
@@ -5007,7 +5021,12 @@ textarea.cu-input {
}
}
-.cu-detail-content-stack > .cu-card:first-child {
+/* The detail header panel drops its bottom border and bottom radii, so the
+ first block below it has to drop the matching top edge or the seam shows as
+ a stray rounded border. Applies to either card primitive that can lead the
+ stack. */
+.cu-detail-content-stack > .cu-card:first-child,
+.cu-detail-content-stack > .cu-form-section:first-child {
border-top: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
diff --git a/control-ui/app/guardrails/[name]/page.tsx b/control-ui/app/guardrails/[name]/page.tsx
index 26f4466ff..adde316fd 100644
--- a/control-ui/app/guardrails/[name]/page.tsx
+++ b/control-ui/app/guardrails/[name]/page.tsx
@@ -4,9 +4,13 @@ import React, { useEffect, useMemo, useState } from 'react'
import { useParams, useRouter } from 'next/navigation'
import { CONTROL_ROUTES } from '../../../app/constants/routes'
import { useConfirmDialog } from '../../../components/ConfirmDialog'
+import { CreateFlowPanel } from '../../../components/CreateFlowPanel'
+import { CreatePageHeader } from '../../../components/CreatePageHeader'
import { DashboardLayout } from '../../../components/DashboardLayout'
+import { KebabMenu } from '../../../components/KebabMenu'
+import { IconShield } from '../../../components/Sidebar/icons'
import { useToast } from '../../../components/Toast'
-import { Button, FormSection } from '../../../components/ui'
+import { FormSection } from '../../../components/ui'
import { deleteLlmHook, getHosts, getLlmHook, isSilentApiError } from '../../../lib/api'
import type { HostResource, LlmHookResource, LlmHookStatus } from '../../../lib/api'
@@ -168,16 +172,36 @@ export default function GuardrailDetailPage() {
}
return (
- <DashboardLayout>
- <div style={{ marginBottom: 'var(--cu-space-2)' }}>
- <Button
- variant="ghost"
- size="sm"
- onClick={() => router.push(CONTROL_ROUTES.guardrails.root)}
- >
- ← Installed Guardrails
- </Button>
- </div>
+ <DashboardLayout isDetailPage>
+ <CreateFlowPanel
+ className="cu-detail-flow-panel"
+ header={
+ <CreatePageHeader
+ icon={<IconShield />}
+ title={name || 'Guardrail'}
+ subtitle="Guardrail details and runtime status."
+ backLabel="Back to guardrails"
+ onBack={() => router.push(CONTROL_ROUTES.guardrails.root)}
+ titleActions={
+ hook ? (
+ <KebabMenu
+ ariaLabel="More guardrail actions"
+ items={[
+ {
+ label: uninstalling ? 'Uninstalling…' : 'Uninstall',
+ disabled: uninstalling,
+ danger: true,
+ onClick: () => void handleUninstall(),
+ },
+ ]}
+ />
+ ) : undefined
+ }
+ />
+ }
+ >
+ {null}
+ </CreateFlowPanel>
{error ? (
<div className="cu-banner cu-banner--error" role="alert">
@@ -185,104 +209,109 @@ export default function GuardrailDetailPage() {
</div>
) : null}
- {loading && !hook ? (
- <div className="cu-card">
- <div className="cu-card__body cu-muted">Loading guardrail…</div>
- </div>
- ) : !hook ? (
- <div className="cu-empty">Guardrail not found.</div>
- ) : (
- <>
- <FormSection title={name} description="Installed guardrail hook.">
- <div className="cu-summary-list">
- <Row label="Status">
- <StatusBadge status={hook.status} />
- </Row>
- <Row label={target.kind}>
- <strong className="cu-expandable-field__code">{target.value}</strong>
- </Row>
- <Row label="Path">{spec.path || '/'}</Row>
- <Row label="Lifecycle points">{(spec.lifecyclePoints || []).join(', ') || '—'}</Row>
- <Row label="Fail mode">{spec.failMode || '—'}</Row>
- <Row label="Capabilities">
- {spec.capabilities && spec.capabilities.length > 0 ? (
- <span className="cu-expandable-tags">
- {spec.capabilities.map(c => (
- <span key={c} className="cu-registry-tag">
- {c}
- </span>
- ))}
- </span>
- ) : (
- <span className="cu-muted">None declared</span>
- )}
- </Row>
- <Row label="Observed digest">
- <strong className="cu-expandable-field__code">
- {hook.status?.observedDigest || '—'}
- </strong>
- </Row>
- <Row label="Ready replicas">
- {typeof hook.status?.readyReplicas === 'number' ? hook.status.readyReplicas : '—'}
- </Row>
- </div>
- <div style={{ marginTop: 'var(--cu-space-3)' }}>
- <Button variant="danger" size="sm" onClick={handleUninstall} disabled={uninstalling}>
- {uninstalling ? 'Uninstalling…' : 'Uninstall'}
- </Button>
- </div>
- </FormSection>
+ {/* The header panel squares off its bottom edge and expects the content
+ stack directly below it, so the first section fuses with it instead of
+ floating as a separate rounded card. */}
+ <div className="cu-detail-content-stack">
+ {loading && !hook ? (
+ <div className="cu-card">
+ <div className="cu-card__body cu-muted">Loading guardrail…</div>
+ </div>
+ ) : !hook ? (
+ <div className="cu-empty">Guardrail not found.</div>
+ ) : (
+ <>
+ <FormSection
+ title="Details"
+ description="Runtime configuration reported by the installed hook."
+ >
+ <div className="cu-summary-list cu-summary-list--flush">
+ <Row label="Status">
+ <StatusBadge status={hook.status} />
+ </Row>
+ <Row label={target.kind}>
+ <strong className="cu-expandable-field__code">{target.value}</strong>
+ </Row>
+ <Row label="Path">{spec.path || '/'}</Row>
+ <Row label="Lifecycle points">{(spec.lifecyclePoints || []).join(', ') || '—'}</Row>
+ <Row label="Fail mode">{spec.failMode || '—'}</Row>
+ <Row label="Capabilities">
+ {spec.capabilities && spec.capabilities.length > 0 ? (
+ <span className="cu-expandable-tags">
+ {spec.capabilities.map(c => (
+ <span key={c} className="cu-registry-tag">
+ {c}
+ </span>
+ ))}
+ </span>
+ ) : (
+ <span className="cu-muted">None declared</span>
+ )}
+ </Row>
+ <Row label="Observed digest">
+ <strong className="cu-expandable-field__code">
+ {hook.status?.observedDigest || '—'}
+ </strong>
+ </Row>
+ <Row label="Ready replicas">
+ {typeof hook.status?.readyReplicas === 'number' ? hook.status.readyReplicas : '—'}
+ </Row>
+ </div>
+ </FormSection>
- <FormSection
- title={`Agents using this guardrail (${agents.length})`}
- description="Agents whose guardrails reference this hook, and the lifecycle phases they use it in."
- >
- {agents.length === 0 ? (
- <div className="cu-empty">No agents reference this guardrail.</div>
- ) : (
- <div className="cu-table-wrap">
- <table className="cu-table cu-table--header-band">
- <thead>
- <tr>
- <th>Agent</th>
- <th>Phases</th>
- </tr>
- </thead>
- <tbody>
- {agents.map(a => (
- <tr
- key={a.name}
- className="cu-table__row cu-table__row--clickable"
- role="button"
- tabIndex={0}
- onClick={() => router.push(CONTROL_ROUTES.agents.tab(a.name, 'guardrails'))}
- onKeyDown={e => {
- if (e.key === 'Enter' || e.key === ' ') {
- e.preventDefault()
+ <FormSection
+ title={`Agents using this guardrail (${agents.length})`}
+ description="Agents whose guardrails reference this hook, and the lifecycle phases they use it in."
+ >
+ {agents.length === 0 ? (
+ <div className="cu-empty">No agents reference this guardrail.</div>
+ ) : (
+ <div className="cu-table-wrap">
+ <table className="cu-table cu-table--header-band">
+ <thead>
+ <tr>
+ <th>Agent</th>
+ <th>Phases</th>
+ </tr>
+ </thead>
+ <tbody>
+ {agents.map(a => (
+ <tr
+ key={a.name}
+ className="cu-table__row cu-table__row--clickable"
+ role="button"
+ tabIndex={0}
+ onClick={() =>
router.push(CONTROL_ROUTES.agents.tab(a.name, 'guardrails'))
}
- }}
- aria-label={`Open agent ${a.name} guardrails`}
- >
- <td>{a.name}</td>
- <td>
- <span className="cu-expandable-tags">
- {a.phases.map(p => (
- <span key={p} className="cu-registry-tag">
- {PHASE_LABEL[p] || p}
- </span>
- ))}
- </span>
- </td>
- </tr>
- ))}
- </tbody>
- </table>
- </div>
- )}
- </FormSection>
- </>
- )}
+ onKeyDown={e => {
+ if (e.key === 'Enter' || e.key === ' ') {
+ e.preventDefault()
+ router.push(CONTROL_ROUTES.agents.tab(a.name, 'guardrails'))
+ }
+ }}
+ aria-label={`Open agent ${a.name} guardrails`}
+ >
+ <td>{a.name}</td>
+ <td>
+ <span className="cu-expandable-tags">
+ {a.phases.map(p => (
+ <span key={p} className="cu-registry-tag">
+ {PHASE_LABEL[p] || p}
+ </span>
+ ))}
+ </span>
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </div>
+ )}
+ </FormSection>
+ </>
+ )}
+ </div>
{confirmDialog}
</DashboardLayout>
)
diff --git a/control-ui/app/guardrails/page.tsx b/control-ui/app/guardrails/page.tsx
index c5e9fcabf..5d681bda8 100644
--- a/control-ui/app/guardrails/page.tsx
+++ b/control-ui/app/guardrails/page.tsx
@@ -1,6 +1,7 @@
'use client'
import React, { useEffect, useState } from 'react'
+import { useRouter } from 'next/navigation'
import { useConfirmDialog } from '../../components/ConfirmDialog'
import { DashboardLayout } from '../../components/DashboardLayout'
import { GuardrailHooksTable } from '../../components/GuardrailHooksTable'
@@ -8,8 +9,11 @@ import type { LlmHookRef } from '../../components/GuardrailHooksTable.types'
import { useToast } from '../../components/Toast'
import { deleteLlmHook, getLlmHooks, isSilentApiError } from '../../lib/api'
import type { LlmHookResource } from '../../lib/api'
+import { GUARDRAIL_ENTRY_TYPE } from '../constants/marketplaceEntryTypes'
+import { CONTROL_ROUTES } from '../constants/routes'
export default function GuardrailsPage() {
+ const router = useRouter()
const { showToast } = useToast()
const [loading, setLoading] = useState(true)
const [error, setError] = useState('')
@@ -62,6 +66,11 @@ export default function GuardrailsPage() {
{error ? <div className="cu-banner cu-banner--error">{error}</div> : null}
<GuardrailHooksTable
items={hooks}
+ // Same destination as "Add hook" on an agent: the org marketplace
+ // entries list narrowed to guardrail hooks.
+ onInstall={() =>
+ router.push(CONTROL_ROUTES.marketplace.orgEntriesFiltered({ type: GUARDRAIL_ENTRY_TYPE }))
+ }
onUninstall={handleUninstall}
uninstallingKey={uninstallingKey}
onRefresh={loadAll}
diff --git a/control-ui/app/workflow-recipes/[namespace]/[name]/page.tsx b/control-ui/app/workflow-recipes/[namespace]/[name]/page.tsx
index 55a0115ae..daf1f7414 100644
--- a/control-ui/app/workflow-recipes/[namespace]/[name]/page.tsx
+++ b/control-ui/app/workflow-recipes/[namespace]/[name]/page.tsx
@@ -9,6 +9,7 @@ import { CreateFlowSkeleton } from '@components/CreateFlowSkeleton'
import { CreatePageHeader } from '@components/CreatePageHeader'
import { DashboardLayout } from '@components/DashboardLayout'
import { DetailPageShell } from '@components/DetailPageShell'
+import { KebabMenu } from '@components/KebabMenu'
import { RecipeEditor } from '@components/RecipeEditor'
import { RecipeIntegrationsPanel } from '@components/RecipeIntegrationsPanel'
import { RecipeSecretsPanel } from '@components/RecipeSecretsPanel'
@@ -235,66 +236,6 @@ function chipStyle(tone: 'ok' | 'warn' | 'error' | 'info'): React.CSSProperties
}
}
-type KebabItem = {
- label: string
- onClick: () => void
- danger?: boolean
- disabled?: boolean
-}
-
-function KebabMenu({ items, ariaLabel }: { items: KebabItem[]; ariaLabel: string }) {
- const [open, setOpen] = useState(false)
- const ref = useRef<HTMLDivElement>(null)
- useEffect(() => {
- if (!open) return
- function handleDocClick(e: MouseEvent) {
- if (!ref.current?.contains(e.target as Node)) setOpen(false)
- }
- function handleEsc(e: KeyboardEvent) {
- if (e.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={ariaLabel}
- aria-haspopup="menu"
- aria-expanded={open}
- className="cu-btn cu-btn--ghost cu-btn--sm cu-kebab__trigger"
- onClick={() => setOpen(v => !v)}
- >
- ⋯
- </button>
- {open ? (
- <div role="menu" className="cu-kebab__menu">
- {items.map(item => (
- <button
- key={item.label}
- type="button"
- role="menuitem"
- disabled={item.disabled}
- className={`cu-kebab__item${item.danger ? ' cu-kebab__item--danger' : ''}`}
- onClick={() => {
- setOpen(false)
- item.onClick()
- }}
- >
- {item.label}
- </button>
- ))}
- </div>
- ) : null}
- </div>
- )
-}
-
export const dynamic = 'force-dynamic'
export default function WorkflowRecipeDetailPage() {
diff --git a/control-ui/components/GuardrailHooksTable.tsx b/control-ui/components/GuardrailHooksTable.tsx
index 193e56d80..33bba5c86 100644
--- a/control-ui/components/GuardrailHooksTable.tsx
+++ b/control-ui/components/GuardrailHooksTable.tsx
@@ -18,13 +18,13 @@ import { TablePanelHeader } from './TablePanelHeader'
import { IconChevronRight, IconRefresh, IconX } from './icons'
const HOOK_COLUMNS: TableHeaderColumn[] = [
- { key: 'open', ariaLabel: 'Open guardrail' },
{ key: 'name', label: 'Name' },
{ key: 'lifecycle', label: 'Lifecycle' },
{ key: 'order', label: 'Order' },
{ key: 'failMode', label: 'Fail mode' },
{ key: 'status', label: 'Status' },
{ key: 'actions', align: 'right', ariaLabel: 'Actions' },
+ { key: 'navigation', align: 'right', ariaLabel: 'Navigation' },
]
function StatusBadge({ status }: { status?: LlmHookStatus }) {
@@ -74,6 +74,7 @@ function describeTarget(target?: LlmHookTarget): string {
export function GuardrailHooksTable({
items,
+ onInstall,
onUninstall,
uninstallingKey,
onRefresh,
@@ -163,12 +164,22 @@ export function GuardrailHooksTable({
/>
</button>
) : null}
+ {onInstall ? (
+ <button
+ type="button"
+ className="cu-btn cu-btn--primary cu-btn--sm"
+ onClick={onInstall}
+ disabled={isInitialLoad}
+ >
+ Install Guardrail
+ </button>
+ ) : null}
</>
}
/>
{isInitialLoad ? (
<div className="cu-table-wrap cu-guardrails-table-wrap">
- <table className="cu-table cu-table--header-band cu-expandable-table cu-guardrails-table">
+ <table className="cu-table cu-table--header-band cu-guardrails-table">
<thead>
<TableHeaderRow columns={HOOK_COLUMNS} />
</thead>
@@ -183,7 +194,7 @@ export function GuardrailHooksTable({
</div>
) : (
<div className="cu-table-wrap cu-guardrails-table-wrap">
- <table className="cu-table cu-table--header-band cu-expandable-table cu-guardrails-table">
+ <table className="cu-table cu-table--header-band cu-guardrails-table">
<thead>
<TableHeaderRow columns={HOOK_COLUMNS} />
</thead>
@@ -206,9 +217,6 @@ export function GuardrailHooksTable({
tabIndex={0}
aria-label={`View guardrail ${name}`}
>
- <td className="cu-expandable-row__chevron" aria-hidden="true">
- <IconChevronRight width={18} height={18} />
- </td>
<td>
<span className="cu-expandable-row__name">{name}</span>
</td>
@@ -254,6 +262,9 @@ export function GuardrailHooksTable({
) : null}
</div>
</td>
+ <td className="cu-installed-plugin__navigation" aria-hidden="true">
+ <IconChevronRight width={18} height={18} />
+ </td>
</tr>
)
})}
diff --git a/control-ui/components/GuardrailHooksTable.types.ts b/control-ui/components/GuardrailHooksTable.types.ts
index 934db4675..1d3370eaa 100644
--- a/control-ui/components/GuardrailHooksTable.types.ts
+++ b/control-ui/components/GuardrailHooksTable.types.ts
@@ -29,6 +29,7 @@ export type LlmHookRef = { name: string }
export type GuardrailHooksTableProps = {
items: LlmHookResource[]
+ onInstall?: () => void
onUninstall?: (hook: LlmHookRef) => Promise<void>
uninstallingKey?: string | null
onRefresh?: () => void
diff --git a/control-ui/components/KebabMenu/index.tsx b/control-ui/components/KebabMenu/index.tsx
new file mode 100644
index 000000000..9c5de1bbd
--- /dev/null
+++ b/control-ui/components/KebabMenu/index.tsx
@@ -0,0 +1,60 @@
+'use client'
+
+import React, { useEffect, useRef, useState } from 'react'
+import type { KebabMenuProps } from './types'
+
+// The overflow menu that sits next to a detail-page title, holding the actions
+// that are not the page's primary call to action (edit, retry, uninstall).
+// Shared so every detail page spells that affordance the same way.
+export function KebabMenu({ items, ariaLabel }: KebabMenuProps) {
+ const [open, setOpen] = useState(false)
+ const ref = useRef<HTMLDivElement>(null)
+ useEffect(() => {
+ if (!open) return
+ function handleDocClick(e: MouseEvent) {
+ if (!ref.current?.contains(e.target as Node)) setOpen(false)
+ }
+ function handleEsc(e: KeyboardEvent) {
+ if (e.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={ariaLabel}
+ aria-haspopup="menu"
+ aria-expanded={open}
+ className="cu-btn cu-btn--ghost cu-btn--sm cu-kebab__trigger"
+ onClick={() => setOpen(v => !v)}
+ >
+ ⋯
+ </button>
+ {open ? (
+ <div role="menu" className="cu-kebab__menu">
+ {items.map(item => (
+ <button
+ key={item.label}
+ type="button"
+ role="menuitem"
+ disabled={item.disabled}
+ className={`cu-kebab__item${item.danger ? ' cu-kebab__item--danger' : ''}`}
+ onClick={() => {
+ setOpen(false)
+ item.onClick()
+ }}
+ >
+ {item.label}
+ </button>
+ ))}
+ </div>
+ ) : null}
+ </div>
+ )
+}
diff --git a/control-ui/components/KebabMenu/types.ts b/control-ui/components/KebabMenu/types.ts
new file mode 100644
index 000000000..cf27b919f
--- /dev/null
+++ b/control-ui/components/KebabMenu/types.ts
@@ -0,0 +1,11 @@
+export type KebabMenuItem = {
+ label: string
+ onClick: () => void
+ danger?: boolean
+ disabled?: boolean
+}
+
+export type KebabMenuProps = {
+ items: KebabMenuItem[]
+ ariaLabel: string
+}
diff --git a/control-ui/components/__tests__/GuardrailHooksTable.test.tsx b/control-ui/components/__tests__/GuardrailHooksTable.test.tsx
new file mode 100644
index 000000000..35b9e209d
--- /dev/null
+++ b/control-ui/components/__tests__/GuardrailHooksTable.test.tsx
@@ -0,0 +1,45 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+import type { LlmHookResource } from '../../lib/api'
+import { GuardrailHooksTable } from '../GuardrailHooksTable'
+
+const navigation = vi.hoisted(() => ({ push: vi.fn() }))
+vi.mock('next/navigation', () => ({
+ useRouter: () => ({ push: navigation.push }),
+}))
+
+const HOOKS = [
+ {
+ metadata: { name: 'hook-token-compactor' },
+ spec: { lifecyclePoints: ['preCall'], order: 0, failMode: 'open' },
+ status: { conditions: [{ type: 'Ready', status: 'True' }] },
+ },
+] as unknown as LlmHookResource[]
+
+afterEach(cleanup)
+beforeEach(() => vi.clearAllMocks())
+
+describe('GuardrailHooksTable', () => {
+ it('offers Install Guardrail, which the page routes to the guardrail marketplace', () => {
+ const onInstall = vi.fn()
+ render(<GuardrailHooksTable items={HOOKS} onInstall={onInstall} />)
+ fireEvent.click(screen.getByRole('button', { name: 'Install Guardrail' }))
+ expect(onInstall).toHaveBeenCalledTimes(1)
+ })
+
+ it('omits Install Guardrail when the page supplies no handler', () => {
+ render(<GuardrailHooksTable items={HOOKS} />)
+ expect(screen.queryByRole('button', { name: 'Install Guardrail' })).toBeNull()
+ })
+
+ it('a row navigates to the guardrail detail page rather than expanding in place', () => {
+ const view = render(<GuardrailHooksTable items={HOOKS} />)
+ fireEvent.click(screen.getByRole('button', { name: 'View guardrail hook-token-compactor' }))
+ expect(navigation.push).toHaveBeenCalledWith('/guardrails/hook-token-compactor')
+ // The chevron is a navigation affordance, not an expander: it must not
+ // borrow the expandable-row vocabulary, which promises in-place detail.
+ expect(view.container.querySelector('.cu-expandable-row__chevron')).toBeNull()
+ expect(view.container.querySelector('.cu-expandable-table')).toBeNull()
+ expect(view.container.querySelector('.cu-installed-plugin__navigation')).not.toBeNull()
+ })
+})
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index e1f64bb94..5037093b5 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.448",
+ "version": "0.1.449",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.448",
+ "version": "0.1.449",
"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 b9acd05fc..40c5592f7 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.448",
+ "version": "0.1.449",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",