Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
feat(control-ui): add registry install-hook form (bucket b slice d ui)
Andy Pavia7e9a32a9fce5
diff --git a/control-ui/app/registry/entries/[name]/[version]/page.tsx b/control-ui/app/registry/entries/[name]/[version]/page.tsxindex 8ee6daaf5..3f635dada 100644--- a/control-ui/app/registry/entries/[name]/[version]/page.tsx+++ b/control-ui/app/registry/entries/[name]/[version]/page.tsx@@ -215,7 +215,9 @@ function RegistryEntryDetailContent() {}return}- if (entry.entry_type === 'mcp-server') {+ // Connectors and guardrail hooks both configure their install on the+ // dedicated install page, which dispatches on entry_type.+ if (entry.entry_type === 'mcp-server' || entry.entry_type === 'llm-hook') {const params = new URLSearchParams({ entry: entry.name, version: entry.version })router.push(CONTROL_ROUTES.marketplace.install(Object.fromEntries(params)))return@@ -434,6 +436,7 @@ function RegistryEntryDetailContent() {function labelForType(t: string): string {if (t === 'mcp-server') return 'Connector'if (t === 'recipe') return 'Recipe'+ if (t === 'llm-hook') return 'Guardrail hook'return t}diff --git a/control-ui/app/registry/install/page.tsx b/control-ui/app/registry/install/page.tsxindex b72c0f37b..026297751 100644--- a/control-ui/app/registry/install/page.tsx+++ b/control-ui/app/registry/install/page.tsx@@ -10,6 +10,7 @@ import { CreatePageHeader } from '@components/CreatePageHeader'import { CreateStepFlow } from '@components/CreateStepFlow'import { DashboardLayout } from '@components/DashboardLayout'import { EgressEditor } from '@components/EgressEditor'+import { HookInstallForm } from '@components/HookInstallForm'import { RegistryInstallForm } from '@components/RegistryInstallForm'import { IconStore } from '@components/Sidebar/icons'import { useToast } from '@components/Toast'@@ -611,7 +612,12 @@ function RegistryInstallPageContent() {}, [entryName, entryVersion])const isPrivate = entry?.visibility === 'private'- const kindLabel = entry?.entry_type === 'recipe' ? 'plugin' : 'connector'+ const kindLabel =+ entry?.entry_type === 'recipe'+ ? 'plugin'+ : entry?.entry_type === 'llm-hook'+ ? 'guardrail hook'+ : 'connector'// Scoped names are stored as `@org/name`; surface the org for a private entry.const orgScope = entry ? (entry.name.match(/^(@[^/]+)\//)?.[1] ?? null) : nullconst headerTitle = isPrivate ? `Install a private ${kindLabel}` : 'Install from Marketplace'@@ -653,6 +659,12 @@ function RegistryInstallPageContent() {)}/>+ ) : entry?.entry_type === 'llm-hook' ? (+ <HookInstallForm+ entry={entry}+ onCancel={() => router.push(CONTROL_ROUTES.marketplace.root)}+ onInstalled={() => router.push(CONTROL_ROUTES.guardrails.root)}+ />) : entry ? (<RegistryInstallFormentry={entry}diff --git a/control-ui/components/HookInstallForm/constants.ts b/control-ui/components/HookInstallForm/constants.tsnew file mode 100644index 000000000..a940184cf--- /dev/null+++ b/control-ui/components/HookInstallForm/constants.ts@@ -0,0 +1,47 @@+import type { HookCapability } from '@lib/api'++// The four guardrail-hook capabilities the backend accepts. A hook's selected+// capabilities must be a subset of the target Host's guardrails.capabilityCeiling.+export const HOOK_CAPABILITY_OPTIONS: Array<{+ value: HookCapability+ label: string+ description: string+}> = [+ {+ value: 'may_deny',+ label: 'May deny',+ description: 'Block the call or response. Requires fail-closed mode.',+ },+ {+ value: 'may_rewrite',+ label: 'May rewrite',+ description: 'Modify the prompt or tool input before it proceeds.',+ },+ {+ value: 'may_substitute_result',+ label: 'May substitute result',+ description: 'Replace the tool or model result.',+ },+ {+ value: 'may_add_context',+ label: 'May add context',+ description: 'Append additional context to the call.',+ },+]++export const ALL_HOOK_CAPABILITIES: HookCapability[] = HOOK_CAPABILITY_OPTIONS.map(o => o.value)++// Default installation order applied by the backend when none is supplied.+export const DEFAULT_HOOK_ORDER = 100++// Friendly copy for the coded error bodies the install-hook route returns+// ({ error, reason? }). Any reason string from the backend is appended verbatim.+export const HOOK_INSTALL_ERROR_LABELS: Record<string, string> = {+ hook_below_trust_floor: "This hook is below the agent's minimum installed-hook trust level.",+ content_egress_requires_high_trust:+ 'Hooks that egress content require a high-trust registry entry (§8.4).',+ capability_exceeds_ceiling: "A selected capability exceeds the agent's capability ceiling.",+ deny_requires_fail_closed: 'A hook that may deny must run in fail-closed mode.',+ image_not_allowlisted: "This hook's image is not allow-listed for installation.",+ unknown_credential_keys: 'One or more credential keys are not recognized by this hook.',+}diff --git a/control-ui/components/HookInstallForm/index.tsx b/control-ui/components/HookInstallForm/index.tsxnew file mode 100644index 000000000..f52bc2f95--- /dev/null+++ b/control-ui/components/HookInstallForm/index.tsx@@ -0,0 +1,467 @@+'use client'++import React, { useEffect, useMemo, useRef, useState } from 'react'+import { CreateStepFlow } from '@components/CreateStepFlow'+import { useToast } from '@components/Toast'+import { Button, CheckboxField, Field, FormSection, SelectInput, TextInput } from '@components/ui'+import type { CredentialSchema, HookCapability, HostResource } from '@lib/api'+import { getHosts, getRegistryCredentialSchema, installHookFromRegistry } from '@lib/api'+import { buildPastedValue } from '@lib/pasteUtils'+import { getEmbeddedHookCredentialSchema } from '../registryInstallHelpers'+import {+ ALL_HOOK_CAPABILITIES,+ DEFAULT_HOOK_ORDER,+ HOOK_CAPABILITY_OPTIONS,+ HOOK_INSTALL_ERROR_LABELS,+} from './constants'+import type { HookInstallFormProps } from './types'++const STEPS = ['Configure', 'Install'] as const++const STEP_DETAILS = [+ {+ description: 'Bind the guardrail hook',+ title: 'Guardrail hook',+ subtitle: 'Pick the target agent and configure how this hook runs.',+ },+ {+ description: 'Confirm install',+ title: 'Review install',+ subtitle: 'Check the guardrail hook install before applying it.',+ },+] as const++// A Host's guardrails.capabilityCeiling bounds which capabilities a hook may be+// granted. spec is typed AnyRecord in lib/api, so read it defensively and keep+// only the four known capability values.+function hostCapabilityCeiling(host: HostResource | undefined): HookCapability[] | null {+ const guardrails = (host?.spec as { guardrails?: { capabilityCeiling?: unknown } } | undefined)+ ?.guardrails+ const ceiling = guardrails?.capabilityCeiling+ if (!Array.isArray(ceiling)) return null+ return ceiling.filter((c): c is HookCapability =>+ ALL_HOOK_CAPABILITIES.includes(c as HookCapability)+ )+}++// Surface the install-hook route's { error, reason? } body. formatApiError stashes+// the parsed JSON on `.body` and the code on `.code`; fall back to the message.+function describeHookInstallError(err: unknown): string {+ const withBody = err as { code?: string; body?: Record<string, unknown>; message?: string }+ const code =+ withBody.code ?? (typeof withBody.body?.error === 'string' ? withBody.body.error : '')+ const reason = typeof withBody.body?.reason === 'string' ? withBody.body.reason : ''+ const base =+ (code && HOOK_INSTALL_ERROR_LABELS[code]) || (err instanceof Error ? err.message : '')+ const message = base || 'Failed to install guardrail hook'+ return reason ? `${message} (${reason})` : message+}++export function HookInstallForm({ entry, onCancel, onInstalled }: HookInstallFormProps) {+ const { showToast } = useToast()+ const [step, setStep] = useState(0)+ const [hosts, setHosts] = useState<HostResource[]>([])+ const [hostRef, setHostRef] = useState('')+ const [credSchema, setCredSchema] = useState<CredentialSchema | null>(null)+ const [credValues, setCredValues] = useState<Record<string, string>>({})+ const [capabilities, setCapabilities] = useState<Set<HookCapability>>(new Set())+ const [order, setOrder] = useState(String(DEFAULT_HOOK_ORDER))+ const [failMode, setFailMode] = useState<'open' | 'closed'>('open')+ const [loading, setLoading] = useState(true)+ const [installing, setInstalling] = useState(false)+ const [error, setError] = useState('')+ const installInFlightRef = useRef(false)++ const hookMeta = entry.hook_meta ?? null+ const lifecyclePoints = useMemo(+ () => (Array.isArray(hookMeta?.lifecyclePoints) ? hookMeta.lifecyclePoints : []),+ [hookMeta]+ )+ // target.{image,service,remote} are objects on the wire — derive display strings.+ const targetImage = hookMeta?.target?.image?.ref ?? ''+ const svc = hookMeta?.target?.service+ const targetService = svc+ ? `${svc.namespace ? `${svc.namespace}/` : ''}${svc.name ?? ''}${svc.port ? `:${svc.port}` : ''}`+ : ''+ const targetRemote = hookMeta?.target?.remote?.baseUrl ?? ''++ useEffect(() => {+ installInFlightRef.current = false+ setStep(0)+ setError('')+ setCredValues({})+ setCapabilities(new Set())+ setOrder(String(DEFAULT_HOOK_ORDER))+ setFailMode('open')+ setLoading(true)+ ;(async () => {+ try {+ const [schema, hostResult] = await Promise.all([+ getRegistryCredentialSchema(entry.name, entry.version).catch(() =>+ getEmbeddedHookCredentialSchema(entry)+ ),+ getHosts(),+ ])+ setCredSchema(schema)+ const hostItems = (hostResult.items ?? []).filter(h => !!h.metadata?.name)+ setHosts(hostItems)+ if (hostItems.length > 0) {+ setHostRef(prev => prev || (hostItems[0].metadata?.name ?? ''))+ }+ } catch (loadError) {+ setError(loadError instanceof Error ? loadError.message : 'Failed to load configuration')+ } finally {+ setLoading(false)+ }+ })()+ }, [entry])++ const selectedHost = useMemo(+ () => hosts.find(h => h.metadata?.name === hostRef),+ [hosts, hostRef]+ )+ const ceiling = useMemo(() => hostCapabilityCeiling(selectedHost), [selectedHost])++ // When the target agent declares a ceiling, drop any selected capability that+ // is no longer allowed for the newly selected host.+ useEffect(() => {+ if (!ceiling) return+ setCapabilities(prev => {+ const next = new Set([...prev].filter(c => ceiling.includes(c)))+ return next.size === prev.size ? prev : next+ })+ }, [ceiling])++ // may_deny ⇒ fail-closed, matching the backend deny_requires_fail_closed rule.+ const mustFailClosed = capabilities.has('may_deny')+ const effectiveFailMode: 'open' | 'closed' = mustFailClosed ? 'closed' : failMode++ const credHasKeys = (credSchema?.keys?.length ?? 0) > 0+ const credRequired = !!credSchema?.required && credHasKeys+ const credStarted =+ credRequired && credSchema!.keys.some(key => (credValues[key.name] ?? '').trim() !== '')+ const missingCredentialKeys =+ credRequired && credStarted+ ? credSchema!.keys+ .filter(key => !(credValues[key.name] ?? '').trim())+ .map(key => key.label || key.name)+ : []+ const credComplete = !credStarted || missingCredentialKeys.length === 0++ const orderValid = order.trim() === '' || Number.isFinite(Number(order))+ const canSubmit = hostRef.trim() !== '' && credComplete && orderValid && !installing+ const canContinue = step === 0 ? !loading && canSubmit : true++ function canSelectStep(targetStep: number) {+ if (targetStep <= step) return true+ return hostRef.trim() !== '' && credComplete && orderValid+ }++ function toggleCapability(value: HookCapability) {+ setCapabilities(prev => {+ const next = new Set(prev)+ if (next.has(value)) next.delete(value)+ else next.add(value)+ return next+ })+ }++ function pasteCredentialValue(keyName: string, event: React.ClipboardEvent<HTMLInputElement>) {+ const pasted = event.clipboardData.getData('text')+ if (!pasted) return+ event.preventDefault()+ const current = credValues[keyName] ?? ''+ const nextValue = buildPastedValue(current, pasted, event.currentTarget)+ setCredValues(previous => ({ ...previous, [keyName]: nextValue }))+ }++ async function handleInstall() {+ if (!canSubmit || installInFlightRef.current) return+ installInFlightRef.current = true+ setInstalling(true)+ setError('')+ try {+ const filled = credHasKeys+ ? Object.fromEntries(+ credSchema!.keys+ .map(key => [key.name, credValues[key.name] ?? ''])+ .filter(([, value]) => (value as string).trim() !== '')+ )+ : {}+ const credentials = Object.keys(filled).length > 0 ? filled : undefined+ const selectedCapabilities = [...capabilities]+ const parsedOrder = order.trim() === '' ? undefined : Number(order)++ const result = await installHookFromRegistry({+ hostRef,+ registryEntryName: entry.name,+ registryEntryVersion: entry.version,+ capabilities: selectedCapabilities.length > 0 ? selectedCapabilities : undefined,+ order: parsedOrder,+ failMode: effectiveFailMode,+ credentials,+ })+ showToast(+ `Installed guardrail hook "${result.hookName}" (trust: ${result.trustLevel}) on ${hostRef}.`,+ { tone: 'success' }+ )+ onInstalled(result.hookName)+ } catch (installError) {+ setError(describeHookInstallError(installError))+ } finally {+ installInFlightRef.current = false+ setInstalling(false)+ }+ }++ return (+ <CreateStepFlow+ ariaLabel="Install guardrail hook steps"+ className="cu-create-step-flow--2"+ currentStep={step}+ onStepChange={setStep}+ canSelectStep={canSelectStep}+ steps={STEP_DETAILS}+ stepLabels={STEPS}+ titleId="registry-hook-install-step-title"+ >+ {loading ? (+ <div className="cu-card">+ <div className="cu-card__body cu-muted">Loading installation configuration...</div>+ </div>+ ) : (+ <form+ onSubmit={event => {+ event.preventDefault()+ if (step < STEPS.length - 1) {+ if (canContinue) setStep(current => Math.min(STEPS.length - 1, current + 1))+ return+ }+ void handleInstall()+ }}+ className="cu-form-stack cu-agent-form-stack cu-agent-form-stack--wide"+ >+ {step === 0 ? (+ <>+ <FormSection+ title="Install guardrail hook from Marketplace"+ description={+ <>+ Bind <strong>{entry.name}</strong> v{entry.version} to a target agent as a+ guardrail hook.+ </>+ }+ >+ <div className="cu-registry-entry-card">+ <div className="cu-registry-entry-card__head">+ <strong className="cu-registry-name">{entry.name}</strong>+ <span className="cu-muted">v{entry.version}</span>+ </div>+ {entry.description ? (+ <p className="cu-registry-description">{entry.description}</p>+ ) : null}+ </div>+ </FormSection>++ <FormSection+ title="Hook details"+ description="These facts come from the Marketplace entry and are applied as-is."+ >+ <div className="cu-summary-list">+ {targetImage ? (+ <div className="cu-summary-list__row">+ <span>Target image</span>+ <strong>{targetImage}</strong>+ </div>+ ) : null}+ {targetService ? (+ <div className="cu-summary-list__row">+ <span>Target service</span>+ <strong>{targetService}</strong>+ </div>+ ) : null}+ {targetRemote ? (+ <div className="cu-summary-list__row">+ <span>Target remote</span>+ <strong>{targetRemote}</strong>+ </div>+ ) : null}+ <div className="cu-summary-list__row">+ <span>Lifecycle points</span>+ <strong>{lifecyclePoints.length > 0 ? lifecyclePoints.join(', ') : '—'}</strong>+ </div>+ {hookMeta?.path ? (+ <div className="cu-summary-list__row">+ <span>Path</span>+ <strong>{hookMeta.path}</strong>+ </div>+ ) : null}+ </div>+ </FormSection>++ <FormSection+ title="Target agent"+ description="Choose the agent to bind this hook to."+ >+ <Field htmlFor="hif-host" label="Agent" required>+ <SelectInput+ id="hif-host"+ value={hostRef}+ onChange={event => setHostRef(event.target.value)}+ >+ <option value="">Select an agent...</option>+ {hosts.map(host => (+ <option key={host.metadata?.name} value={host.metadata?.name}>+ {host.metadata?.name}+ </option>+ ))}+ </SelectInput>+ </Field>+ </FormSection>++ {credHasKeys ? (+ <FormSection+ title={`Credentials (${credSchema!.authType}${credRequired ? '' : ' - optional'})`}+ description="Provided per this hook's credential schema."+ >+ {credSchema!.keys.map(key => (+ <Field key={key.name} htmlFor={`hif-cred-${key.name}`} label={key.label}>+ <TextInput+ id={`hif-cred-${key.name}`}+ type={+ key.kind === 'api-key' || key.kind === 'password' ? 'password' : 'text'+ }+ value={credValues[key.name] ?? ''}+ onChange={event =>+ setCredValues(previous => ({+ ...previous,+ [key.name]: event.target.value,+ }))+ }+ onPaste={event => pasteCredentialValue(key.name, event)}+ autoComplete="new-password"+ placeholder={key.description}+ />+ </Field>+ ))}+ {credRequired ? (+ <div+ className={`cu-banner ${credStarted && !credComplete ? 'cu-banner--error' : 'cu-banner--info'}`}+ >+ {credStarted && !credComplete+ ? `Complete all credential fields or clear them all to install pending. Missing: ${missingCredentialKeys.join(', ')}.`+ : 'Leave all credential fields empty to install and add the secret later, or fill every field to create it during install.'}+ </div>+ ) : null}+ </FormSection>+ ) : null}++ <FormSection+ title="Capabilities"+ description={+ ceiling+ ? "Only the capabilities within this agent's capability ceiling can be granted."+ : 'Grant only the capabilities this hook needs.'+ }+ >+ {HOOK_CAPABILITY_OPTIONS.map(option => {+ const outsideCeiling = !!ceiling && !ceiling.includes(option.value)+ return (+ <CheckboxField+ key={option.value}+ label={option.label}+ description={+ outsideCeiling+ ? `${option.description} (outside the agent's ceiling)`+ : option.description+ }+ checked={capabilities.has(option.value)}+ disabled={outsideCeiling}+ onChange={() => toggleCapability(option.value)}+ />+ )+ })}+ </FormSection>++ <FormSection title="Execution" description="How this hook is ordered and fails.">+ <Field+ htmlFor="hif-order"+ label="Order"+ description="Lower runs first. Defaults to 100 when left blank."+ error={orderValid ? undefined : 'Order must be a number.'}+ >+ <TextInput+ id="hif-order"+ type="number"+ value={order}+ invalid={!orderValid}+ onChange={event => setOrder(event.target.value)}+ placeholder={String(DEFAULT_HOOK_ORDER)}+ />+ </Field>+ <Field+ htmlFor="hif-failmode"+ label="Fail mode"+ description={+ mustFailClosed+ ? 'A hook that may deny must fail closed.'+ : 'Fail open lets calls proceed when the hook errors; fail closed blocks them.'+ }+ >+ <SelectInput+ id="hif-failmode"+ value={effectiveFailMode}+ disabled={mustFailClosed}+ onChange={event => setFailMode(event.target.value as 'open' | 'closed')}+ >+ <option value="open">Fail open</option>+ <option value="closed">Fail closed</option>+ </SelectInput>+ </Field>+ </FormSection>+ </>+ ) : null}++ {step === 1 ? (+ <div className="cu-agent-review">+ Guardrail hook <b>{entry.name}</b> v{entry.version} will be installed on agent{' '}+ <b>{hostRef || '-'}</b> with{' '}+ <b>+ {capabilities.size > 0 ? [...capabilities].join(', ') : 'no extra capabilities'}+ </b>+ , order <b>{order.trim() === '' ? DEFAULT_HOOK_ORDER : order}</b>, fail mode{' '}+ <b>{effectiveFailMode}</b>.+ </div>+ ) : null}++ {error ? (+ <div className="cu-banner cu-banner--error" role="alert">+ {error}+ </div>+ ) : null}++ <div className="cu-create-actions">+ <Button+ type="button"+ variant="ghost"+ size="sm"+ onClick={() => (step === 0 ? onCancel() : setStep(current => current - 1))}+ disabled={installing}+ >+ {step === 0 ? 'Cancel' : 'Back'}+ </Button>+ {step < STEPS.length - 1 ? (+ <Button type="submit" variant="primary" size="sm" disabled={!canContinue}>+ Continue+ </Button>+ ) : (+ <Button type="submit" variant="primary" size="sm" disabled={!canSubmit}>+ {installing ? 'Installing...' : 'Install'}+ </Button>+ )}+ </div>+ </form>+ )}+ </CreateStepFlow>+ )+}diff --git a/control-ui/components/HookInstallForm/types.ts b/control-ui/components/HookInstallForm/types.tsnew file mode 100644index 000000000..27b430e28--- /dev/null+++ b/control-ui/components/HookInstallForm/types.ts@@ -0,0 +1,8 @@+import type { RegistryEntry } from '@lib/api'++export type HookInstallFormProps = {+ entry: RegistryEntry+ onCancel: () => void+ // Called with the created LlmHook CR name after a successful install.+ onInstalled: (hookName: string) => void+}diff --git a/control-ui/components/RegistryCatalog.tsx b/control-ui/components/RegistryCatalog.tsxindex 67e9316b1..585653ff0 100644--- a/control-ui/components/RegistryCatalog.tsx+++ b/control-ui/components/RegistryCatalog.tsx@@ -164,13 +164,18 @@ export default function RegistryCatalog() {installedServerNames.has(entry.name))}+ // Guardrail hooks are installed against a specific agent, so the catalog has+ // no single "installed" signal for them — always offer the install flow.+ if (entry.entry_type === 'llm-hook') return falsereturn installedRecipeKeys.has(`${entry.name}@${entry.version}`)}function renderInstallButton(entry: RegistryEntry) {const installed = isEntryInstalled(entry)const installing = installingRecipeKey === `${entry.name}@${entry.version}`- if (entry.entry_type === 'mcp-server') {+ // Connectors and guardrail hooks both configure their install on the install+ // page (which dispatches on entry_type); recipes install inline below.+ if (entry.entry_type === 'mcp-server' || entry.entry_type === 'llm-hook') {return installed ? (<button type="button" className="cu-btn cu-btn--sm" disabled>Installeddiff --git a/control-ui/components/registryInstallHelpers.ts b/control-ui/components/registryInstallHelpers.tsindex a9105997b..90c1f7de6 100644--- a/control-ui/components/registryInstallHelpers.ts+++ b/control-ui/components/registryInstallHelpers.ts@@ -29,6 +29,36 @@ export function getEmbeddedCredentialSchema(entry: RegistryEntry): CredentialSch}}+// Guardrail-hook variant of getEmbeddedCredentialSchema: reads the credential+// schema off `hook_meta` for `entry_type: "llm-hook"` entries. Used as the+// offline fallback when the per-entry credential-schema endpoint is unavailable.+export function getEmbeddedHookCredentialSchema(entry: RegistryEntry): CredentialSchema {+ const raw = entry.hook_meta?.credentialSchema as+ | (CredentialSchema & { keys?: unknown })+ | undefined+ if (!raw || !Array.isArray(raw.keys)) return NO_CREDENTIAL_SCHEMA+ return {+ required: raw.required === true,+ authType: typeof raw.authType === 'string' ? raw.authType : 'none',+ keys: raw.keys.flatMap(key => {+ if (!key || typeof key !== 'object' || typeof (key as { name?: unknown }).name !== 'string') {+ return []+ }+ const k = key as Record<string, unknown>+ return [+ {+ name: k.name as string,+ label: typeof k.label === 'string' ? k.label : (k.name as string),+ kind: typeof k.kind === 'string' ? k.kind : 'password',+ ...(typeof k.semanticType === 'string' ? { semanticType: k.semanticType } : {}),+ ...(typeof k.description === 'string' ? { description: k.description } : {}),+ ...(Array.isArray(k.enumValues) ? { enumValues: k.enumValues as string[] } : {}),+ },+ ]+ }),+ }+}+export function getExternalEgressNotice(entry: RegistryEntry): {targets: string[]ports: number[]diff --git a/control-ui/lib/api.ts b/control-ui/lib/api.tsindex 720b01de0..fb608fa32 100644--- a/control-ui/lib/api.ts+++ b/control-ui/lib/api.ts@@ -2697,7 +2697,7 @@ export type RegistryEntry = {id: stringname: stringversion: string- entry_type: string // "mcp-server" | "recipe"+ entry_type: string // "mcp-server" | "recipe" | "llm-hook"description: stringauthor: stringorigin: string@@ -2725,6 +2725,25 @@ export type RegistryEntry = {stepCount?: number})| null+ // Present on `entry_type: "llm-hook"` (guardrail hook) entries. Mirrors the+ // registry's hook_meta shape: where the hook runs (image/service/remote), which+ // lifecycle points it hooks, the callback path, its credential schema, default+ // config, and any egress it requires. See control-api install-hook contract.+ hook_meta?:+ | (Record<string, unknown> & {+ // Exactly one of image | service | remote — each an object, not a string.+ target?: {+ image?: { ref?: string; port?: number; security?: { addCapabilities?: string[] } }+ service?: { name?: string; namespace?: string; port?: number }+ remote?: { baseUrl?: string }+ }+ lifecyclePoints?: string[] // "preCall" | "moderate" | "postCallSuccess" | "onError"+ path?: string+ credentialSchema?: CredentialSchema+ defaultConfig?: Record<string, unknown>+ requiredEgress?: unknown+ })+ | nullartifact_refs: Record<string, unknown> | nulldownloads: numberinstalls: number@@ -2880,6 +2899,49 @@ export async function installRecipeFromRegistry() as Promise<InstallRecipeFromRegistryResponse>}+// Guardrail-hook install: binds a registry `llm-hook` entry to a target Host as an+// LlmHook CR. Mirrors installFromRegistry / installRecipeFromRegistry but hits the+// admin install-hook route. Backend enforces trust floor, §8.4 content-egress, the+// capability ceiling, and the may_deny ⇒ fail-closed rule; error bodies arrive as+// { error, reason? } (surfaced via the thrown Error's `.body`/`.code`).+export type HookCapability =+ | 'may_deny'+ | 'may_rewrite'+ | 'may_substitute_result'+ | 'may_add_context'++export type InstallHookFromRegistryRequest = {+ hostRef: string+ registryEntryName: string+ registryEntryVersion: string+ capabilities?: HookCapability[]+ order?: number+ failMode?: 'open' | 'closed'+ credentials?: Record<string, string>+}++export type InstallHookFromRegistryResponse = {+ hookName: string+ namespace: string+ hostRef: string+ trustLevel: string+ lifecyclePoints: string[]+ registryEntry: string+ registryVersion: string+ correlationId: string+ pendingCredentials?: PendingWorkflowCredentialRef[]+}++export async function installHookFromRegistry(+ req: InstallHookFromRegistryRequest+): Promise<InstallHookFromRegistryResponse> {+ return apiSend(+ 'POST',+ '/api/v1/admin/registry/install-hook',+ req+ ) as Promise<InstallHookFromRegistryResponse>+}+export type TriggerWorkflowRequest = {inputs?: Record<string, unknown>intermediateParameters?: Record<string, unknown>diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex 4d312c178..940466ab9 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.390",+ "version": "0.1.391","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.390",+ "version": "0.1.391","dependencies": {"@clerum/llm-providers": "file:../packages/llm-providers","@clerum/workflow-recipe-capability-policy": "file:../packages/workflow-recipe-capability-policy",diff --git a/control-ui/package.json b/control-ui/package.jsonindex 7467c2e7c..e73705849 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.390",+ "version": "0.1.391","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",