Skip to content

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

TypeScript

feat(control-ui): polish model and marketplace UX

Miguelon Peluchon342d1283671f
diff --git a/control-ui/app/cost/llm-prices/page.tsx b/control-ui/app/cost/llm-prices/page.tsx
index 90f92b447..b506d14fb 100644
--- a/control-ui/app/cost/llm-prices/page.tsx
+++ b/control-ui/app/cost/llm-prices/page.tsx
@@ -94,11 +94,6 @@ export default function LlmPricesPage() {
}
}
- function handleAddForUnpriced(model: UnpricedModel) {
- const query = new URLSearchParams({ provider: model.provider, model: model.model })
- router.push(CONTROL_ROUTES.costAndUsage.newLlmPrice(Object.fromEntries(query)))
- }
-
useEffect(() => {
if (authState.isLoggedIn && !authState.isLoading) {
void loadAll()
@@ -133,35 +128,16 @@ export default function LlmPricesPage() {
) : null}
<LlmPriceTable
items={prices}
- banner={
- unpriced.length > 0 ? (
- <div className="cu-banner cu-banner--warning cu-px-unpriced" role="status">
- <div className="cu-px-unpriced__text">
- <strong>{unpriced.length}</strong> model
- {unpriced.length === 1 ? '' : 's'} seen in usage{' '}
- {unpriced.length === 1 ? 'has' : 'have'} no enabled price. Cost-unit budgets
- under-count spend for these until you add a price.
- </div>
- <div className="cu-px-unpriced__chips">
- {unpriced.map(model => (
- <button
- key={`${model.provider}/${model.model}`}
- type="button"
- className="cu-px-unpriced__chip"
- onClick={() => handleAddForUnpriced(model)}
- title={`Add a price for ${getProviderDisplayLabel(model.provider)}/${model.model}`}
- >
- <span className="cu-px-unpriced__chip-label">
- {getProviderDisplayLabel(model.provider)}/{model.model}
- </span>
- <span className="cu-px-unpriced__chip-cta">Add price</span>
- </button>
- ))}
- </div>
- </div>
- ) : null
- }
+ unpricedItems={unpriced}
onCreate={() => router.push(CONTROL_ROUTES.costAndUsage.newLlmPrice())}
+ onAddMissingPrice={model =>
+ router.push(
+ CONTROL_ROUTES.costAndUsage.newLlmPrice({
+ provider: model.provider,
+ model: model.model,
+ })
+ )
+ }
onEdit={id => router.push(CONTROL_ROUTES.costAndUsage.editLlmPrice(id))}
onDelete={handleDelete}
onRefresh={loadAll}
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.css
index d4d402914..66c81f63e 100644
--- a/control-ui/app/globals.css
+++ b/control-ui/app/globals.css
@@ -2245,6 +2245,10 @@ textarea.cu-input {
gap: var(--cu-space-2);
}
+.cu-registry-toolbar {
+ align-items: stretch;
+}
+
.cu-registry-toolbar .cu-section-search {
width: 13rem;
min-width: 13rem;
@@ -2252,18 +2256,56 @@ textarea.cu-input {
flex: 0 0 13rem;
}
-.cu-body select.cu-registry-filter {
- width: auto;
- max-width: none;
+.cu-registry-toolbar .cu-section-search,
+.cu-registry-toolbar .cu-agent-select__button,
+.cu-registry-toolbar .cu-btn--sm {
+ box-sizing: border-box;
+ height: 2.125rem;
+ line-height: 1.2;
+ padding-block: 0;
+ padding-inline: 0.75rem;
+ appearance: none;
+}
+
+.cu-registry-toolbar .cu-agent-select {
min-width: 8.75rem;
+ width: auto;
+}
+
+.cu-registry-toolbar .cu-agent-select__button,
+.cu-registry-toolbar .cu-agent-select__option {
+ font-weight: 400;
font-size: 0.8125rem;
- padding: 0.5rem 2rem 0.5rem 0.7rem;
}
-.cu-registry-count {
- color: var(--cu-text-soft);
- font-size: 0.75rem;
+.cu-registry-toolbar .cu-agent-select__button {
+ padding-block: 0;
+ padding-inline: 0.75rem;
+ text-align: left;
+ overflow: hidden;
+}
+
+.cu-registry-toolbar .cu-agent-select__button-copy,
+.cu-registry-toolbar .cu-agent-select__option-copy,
+.cu-registry-toolbar .cu-agent-select__option-name {
white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ min-width: 0;
+}
+
+.cu-registry-toolbar .cu-agent-select__button-copy > span:first-child {
+ overflow-wrap: normal;
+ word-break: normal;
+}
+
+.cu-registry-toolbar .cu-agent-select__option-name {
+ overflow-wrap: normal;
+ word-break: normal;
+}
+
+.cu-registry-toolbar .cu-btn--sm {
+ padding-inline: 0.75rem;
}
.cu-registry-toolbar .cu-btn--primary {
@@ -2323,6 +2365,14 @@ textarea.cu-input {
white-space: nowrap;
}
+.cu-marketplace-table td.cu-marketplace-action-cell:nth-last-child(2) {
+ padding-right: 0.15rem;
+}
+
+.cu-marketplace-table td.cu-marketplace-action-cell:last-child {
+ padding-left: 0.15rem;
+}
+
.cu-marketplace-table td:nth-child(7) {
text-align: center;
}
@@ -5690,6 +5740,31 @@ textarea.cu-input {
min-width: 0;
}
+.cu-filter-select__copy {
+ display: flex;
+ align-items: center;
+ gap: var(--cu-space-2);
+}
+
+.cu-filter-select__icon {
+ display: inline-flex;
+ width: 1.45rem;
+ height: 1.45rem;
+ flex: 0 0 1.45rem;
+ align-items: center;
+ justify-content: center;
+}
+
+.cu-filter-select__icon > svg {
+ width: 1rem;
+ height: 1rem;
+ color: var(--cu-text-muted);
+}
+
+.cu-filter-select__icon--placeholder {
+ visibility: hidden;
+}
+
.cu-agent-select__option-name {
overflow-wrap: anywhere;
}
@@ -6993,12 +7068,16 @@ textarea.cu-input {
}
/* OpenAI ships a white-on-transparent mark, so on light surfaces it needs to be
- knocked back to black. Scoped to the PROVIDER pickers only (the agents LLM
- provider select and the secrets "+ Add provider" picker) — the model
- dropdown reuses the same icon on a different treatment and must not inherit
- this. */
+ knocked back to black. Scoped to provider-level controls — the model dropdown
+ reuses the same icon on a different treatment and must not inherit this. */
:root[data-theme='light']
- :is(.cu-llm-config__provider-select, .cu-llm-cred-add)
+ :is(
+ .cu-llm-config__provider-select,
+ .cu-llm-cred-add,
+ .cu-llm-model-group__toggle,
+ .cu-filter-select__copy,
+ .cu-filter-select__icon
+ )
.cu-llm-provider-icon[data-provider='openai']
img {
filter: brightness(0);
@@ -9086,79 +9165,220 @@ textarea.cu-input {
gap: var(--cu-space-2);
}
-/* In-card slot for the unpriced notice: aligns with the panel header padding and
- stays out of the flex-fill content so it never pushes the page layout. */
-.cu-px-unpriced-slot {
- flex: 0 0 auto;
- padding: var(--cu-space-3) 1rem 0;
+.cu-llm-model-table {
+ min-width: 68rem;
+ table-layout: fixed;
}
-/* Discovery: persistent "last synced" line under the panel header. */
-.cu-discovery-status {
- flex: 0 0 auto;
- padding: var(--cu-space-3) 1rem 0;
+.cu-agent-select.cu-llm-provider-filter {
+ width: 12rem;
+}
+
+.cu-llm-provider-filter .cu-agent-select__button {
+ min-height: 2.125rem;
+ padding: var(--cu-space-2) var(--cu-space-3);
font-size: 0.8125rem;
- color: var(--cu-text-muted);
}
-/* Discovery: bulk-enable toolbar shown when review rows are selected. */
-.cu-discovery-bulkbar {
- flex: 0 0 auto;
+.cu-llm-provider-filter .cu-agent-select__menu {
+ width: 14rem;
+}
+
+.cu-llm-model-group__row > td {
+ padding: 0;
+ background: var(--cu-bg-elevated);
+}
+
+.cu-table tbody .cu-llm-model-group__row:hover > td {
+ background: var(--cu-surface-hover);
+}
+
+.cu-llm-model-group__toggle {
display: flex;
+ width: 100%;
+ min-height: calc(var(--cu-space-5) * 2.6);
align-items: center;
- justify-content: flex-end;
gap: var(--cu-space-3);
- padding: var(--cu-space-3) 1rem 0;
+ padding: var(--cu-space-3) var(--cu-space-4);
+ border: 0;
+ background: transparent;
+ color: var(--cu-text);
+ cursor: pointer;
+ font: inherit;
+ text-align: left;
}
-.cu-px-unpriced {
- display: flex;
- flex-direction: column;
- gap: var(--cu-space-3);
+.cu-llm-model-group__toggle:focus-visible {
+ outline: 2px solid rgba(var(--cu-focus-rgb), 0.8);
+ outline-offset: -2px;
}
-.cu-px-unpriced__text {
- color: var(--cu-text);
+.cu-llm-model-group__chevron {
+ display: inline-flex;
+ flex: 0 0 auto;
+ color: var(--cu-text-muted);
}
-.cu-px-unpriced__chips {
- display: flex;
- flex-wrap: wrap;
- gap: var(--cu-space-2);
+.cu-llm-model-group__chevron svg {
+ transition: transform var(--cu-control-transition);
+}
+
+.cu-llm-model-group__chevron svg.is-expanded {
+ transform: rotate(90deg);
+}
+
+.cu-llm-model-group__provider {
+ min-width: 10rem;
+ font-weight: 600;
+}
+
+.cu-llm-model-group__count {
+ padding: calc(var(--cu-space-1) / 2) var(--cu-space-2);
+ border: 1px solid var(--cu-border-subtle);
+ border-radius: var(--cu-radius-sm);
+ background: var(--cu-surface);
+ color: var(--cu-text-muted);
+ font-size: 0.75rem;
+ line-height: 1.2;
+ white-space: nowrap;
+}
+
+.cu-llm-model-group__summary,
+.cu-llm-model-group__action {
+ color: var(--cu-text-soft);
+ font-size: 0.75rem;
+}
+
+.cu-llm-model-group__summary {
+ white-space: nowrap;
}
-.cu-px-unpriced__chip {
+.cu-llm-model-group__action {
+ margin-left: auto;
+ font-weight: 600;
+ white-space: nowrap;
+}
+
+.cu-llm-model-row > td:first-child {
+ padding-left: calc(var(--cu-space-5) * 2.8);
+}
+
+.cu-px-model-content {
display: inline-flex;
align-items: center;
gap: var(--cu-space-2);
- padding: 0.2rem 0.5rem;
+ color: var(--cu-text);
+}
+
+.cu-missing-price {
+ position: relative;
+ display: inline-flex;
+ flex: 0 0 auto;
+ font-family: var(--cu-font);
+}
+
+.cu-missing-price__trigger {
+ display: inline-flex;
+ width: calc(var(--cu-space-5) + var(--cu-space-1));
+ height: calc(var(--cu-space-5) + var(--cu-space-1));
+ align-items: center;
+ justify-content: center;
+ padding: 0;
+ border: 0;
+ border-radius: var(--cu-radius-sm);
+ background: transparent;
+ color: var(--cu-warning);
+ cursor: help;
+}
+
+.cu-missing-price__trigger:hover {
+ background: rgba(var(--cu-warning-rgb), 0.14);
+}
+
+.cu-missing-price__trigger:focus-visible {
+ outline: 2px solid rgba(var(--cu-focus-rgb), 0.8);
+ outline-offset: 2px;
+}
+
+.cu-missing-price__popover {
+ position: absolute;
+ top: 50%;
+ left: 100%;
+ z-index: 30;
+ display: flex;
+ width: 17rem;
+ flex-direction: column;
+ gap: var(--cu-space-1);
+ margin-left: var(--cu-space-1);
+ padding: var(--cu-space-3);
+ border: 1px solid rgba(var(--cu-warning-rgb), 0.42);
border-radius: var(--cu-radius-sm);
background: var(--cu-bg-elevated);
- border: 1px solid rgba(var(--cu-warning-rgb), 0.4);
+ box-shadow: var(--cu-shadow);
+ color: var(--cu-text-muted);
+ font-size: 0.75rem;
+ line-height: 1.4;
+ opacity: 0;
+ pointer-events: none;
+ transform: translateY(-50%);
+ transition:
+ opacity var(--cu-control-transition),
+ visibility var(--cu-control-transition);
+ visibility: hidden;
+}
+
+.cu-missing-price:hover .cu-missing-price__popover,
+.cu-missing-price:focus-within .cu-missing-price__popover {
+ opacity: 1;
+ pointer-events: auto;
+ visibility: visible;
+}
+
+.cu-missing-price__popover::before {
+ position: absolute;
+ top: 0;
+ right: 100%;
+ width: var(--cu-space-1);
+ height: 100%;
+ content: '';
+}
+
+.cu-missing-price__popover strong {
color: var(--cu-text);
- font-size: 0.78rem;
- cursor: pointer;
}
-.cu-px-unpriced__chip:hover {
- border-color: rgba(var(--cu-warning-rgb), 0.6);
- background: rgba(var(--cu-warning-rgb), 0.1);
+.cu-missing-price__cta {
+ align-self: flex-start;
+ font-weight: 600;
}
-.cu-px-unpriced__chip:focus-visible {
- outline: 2px solid var(--cu-accent);
- outline-offset: 2px;
+.cu-px-missing-row > td {
+ color: var(--cu-text-soft);
}
-.cu-px-unpriced__chip-label {
- font-family:
- ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
- monospace;
+/* In-card status-notice slot: aligns with the panel header padding and stays
+ out of the flex-fill content so it never pushes the page layout. */
+.cu-px-unpriced-slot {
+ flex: 0 0 auto;
+ padding: var(--cu-space-3) 1rem 0;
}
-.cu-px-unpriced__chip-cta {
- color: var(--cu-accent);
- font-weight: var(--font-weight-semibold, 600);
+/* Discovery: persistent "last synced" line under the panel header. */
+.cu-discovery-status {
+ flex: 0 0 auto;
+ padding: var(--cu-space-3) 1rem 0;
+ font-size: 0.8125rem;
+ color: var(--cu-text-muted);
+}
+
+/* Discovery: bulk-enable toolbar shown when review rows are selected. */
+.cu-discovery-bulkbar {
+ flex: 0 0 auto;
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
+ gap: var(--cu-space-3);
+ padding: var(--cu-space-3) 1rem 0;
}
/* ── Token budgets (token-budgets P0c) ─────────────────────────────────── */
diff --git a/control-ui/components/FilterSelect/index.tsx b/control-ui/components/FilterSelect/index.tsx
new file mode 100644
index 000000000..2f55808a6
--- /dev/null
+++ b/control-ui/components/FilterSelect/index.tsx
@@ -0,0 +1,99 @@
+'use client'
+
+import { useEffect, useRef, useState } from 'react'
+import { cn } from '@lib/cn'
+import type { FilterSelectProps } from './types'
+
+export function FilterSelect({
+ ariaLabel,
+ className,
+ disabled = false,
+ id,
+ onChange,
+ options,
+ value,
+}: FilterSelectProps) {
+ const [open, setOpen] = useState(false)
+ const rootRef = useRef<HTMLDivElement | null>(null)
+ const buttonRef = useRef<HTMLButtonElement | null>(null)
+
+ const selected = options.find(option => option.value === value)
+ const hasIcons = options.some(option => option.icon)
+
+ useEffect(() => {
+ if (!open) return
+ function handlePointerDown(event: MouseEvent) {
+ if (!rootRef.current?.contains(event.target as Node)) setOpen(false)
+ }
+ function handleKey(event: KeyboardEvent) {
+ if (event.key === 'Escape') setOpen(false)
+ }
+ document.addEventListener('mousedown', handlePointerDown)
+ document.addEventListener('keydown', handleKey)
+ return () => {
+ document.removeEventListener('mousedown', handlePointerDown)
+ document.removeEventListener('keydown', handleKey)
+ }
+ }, [open])
+
+ return (
+ <div ref={rootRef} className={cn('cu-agent-select', 'cu-agent-select--compact', className)}>
+ <button
+ id={id}
+ ref={buttonRef}
+ type="button"
+ className="cu-agent-select__button"
+ aria-haspopup="listbox"
+ aria-expanded={open}
+ aria-label={ariaLabel}
+ disabled={disabled}
+ onClick={() => setOpen(current => !current)}
+ >
+ <span className="cu-agent-select__button-copy cu-filter-select__copy">
+ {selected?.icon ? (
+ <span className="cu-filter-select__icon">{selected.icon}</span>
+ ) : hasIcons ? (
+ <span className="cu-filter-select__icon cu-filter-select__icon--placeholder" />
+ ) : null}
+ <span>{selected?.label ?? '—'}</span>
+ </span>
+ <span className="cu-agent-select__chevron" aria-hidden="true" />
+ </button>
+ {open ? (
+ <div className="cu-agent-select__menu" role="listbox" aria-label={ariaLabel}>
+ {options.length === 0 ? (
+ <span className="cu-agent-select__empty">No options available.</span>
+ ) : (
+ options.map(option => {
+ const active = option.value === value
+ return (
+ <button
+ key={option.value}
+ type="button"
+ className="cu-agent-select__option"
+ role="option"
+ aria-selected={active}
+ data-active={active ? 'true' : 'false'}
+ onClick={() => {
+ onChange(option.value)
+ setOpen(false)
+ buttonRef.current?.focus()
+ }}
+ >
+ {option.icon ? (
+ <span className="cu-filter-select__icon">{option.icon}</span>
+ ) : hasIcons ? (
+ <span className="cu-filter-select__icon cu-filter-select__icon--placeholder" />
+ ) : null}
+ <span className="cu-agent-select__option-copy cu-filter-select__copy">
+ <span className="cu-agent-select__option-name">{option.label}</span>
+ </span>
+ </button>
+ )
+ })
+ )}
+ </div>
+ ) : null}
+ </div>
+ )
+}
diff --git a/control-ui/components/FilterSelect/types.ts b/control-ui/components/FilterSelect/types.ts
new file mode 100644
index 000000000..34bdb8b17
--- /dev/null
+++ b/control-ui/components/FilterSelect/types.ts
@@ -0,0 +1,17 @@
+import type { ReactNode } from 'react'
+
+export type FilterSelectOption = {
+ value: string
+ label: string
+ icon?: ReactNode
+}
+
+export type FilterSelectProps = {
+ ariaLabel: string
+ className?: string
+ disabled?: boolean
+ id?: string
+ onChange: (value: string) => void
+ options: FilterSelectOption[]
+ value: string
+}
diff --git a/control-ui/components/LlmModelTable.tsx b/control-ui/components/LlmModelTable.tsx
index 4ddea404f..204ff9c9e 100644
--- a/control-ui/components/LlmModelTable.tsx
+++ b/control-ui/components/LlmModelTable.tsx
@@ -1,24 +1,24 @@
'use client'
import React, { useEffect, useMemo, useState } from 'react'
-import Link from 'next/link'
-import { CONTROL_ROUTES } from '@constants/routes'
import type { LlmAllowedModel } from '@lib/api'
import { formatContextWindow, getProviderDisplayLabel } from '@lib/llm'
import { isUnpricedAllowedModel } from '@lib/llmModelUnpriced'
+import { FilterSelect } from './FilterSelect'
import type { LlmModelTableProps } from './LlmModelTable.types'
+import { LlmProviderIcon } from './LlmProviderIcon'
+import { MissingPriceWarning } from './MissingPriceWarning'
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 { IconPencil, IconRefresh, IconX } from './icons'
+import { IconChevronRight, IconPencil, IconRefresh, IconX } from './icons'
import { SelectInput } from './ui'
const MODEL_COLUMNS: TableHeaderColumn[] = [
- { key: 'provider', label: 'Provider', width: '10%' },
- { key: 'model', label: 'Model', minWidth: '12rem' },
+ { key: 'model', label: 'Model', minWidth: '15rem' },
{ key: 'vendor', label: 'Vendor', width: '10rem' },
{ key: 'displayName', label: 'Display name', minWidth: '10rem' },
{ key: 'contextWindow', label: 'Context window', align: 'right', width: '9rem' },
@@ -48,13 +48,34 @@ export function LlmModelTable({
const [providerFilter, setProviderFilter] = useState<string>(ALL_PROVIDERS)
const [enabledFilter, setEnabledFilter] = useState<EnabledFilter>('all')
const [sourceFilter, setSourceFilter] = useState<SourceFilter>('all')
+ const [expandedProviders, setExpandedProviders] = useState<Set<string>>(new Set())
const normalizedSearch = searchQuery.trim().toLowerCase()
const providerOptions = useMemo(() => {
- const providers = Array.from(new Set(items.map(m => m.provider))).sort()
- return providers
+ return Array.from(new Set(items.map(model => model.provider))).sort((left, right) =>
+ getProviderDisplayLabel(left).localeCompare(getProviderDisplayLabel(right))
+ )
}, [items])
+ const providerFilterOptions = useMemo(
+ () => [
+ {
+ value: ALL_PROVIDERS,
+ label: 'All providers',
+ icon: <IconModels />,
+ },
+ ...providerOptions.map(provider => {
+ const label = getProviderDisplayLabel(provider)
+ return {
+ value: provider,
+ label,
+ icon: <LlmProviderIcon provider={provider} label={label} />,
+ }
+ }),
+ ],
+ [providerOptions]
+ )
+
// Only surface the source filter when both kinds are present — a pure-manual
// (or pure-discovery) allowlist gains nothing from the control.
const hasMultipleSources = useMemo(() => new Set(items.map(m => m.source)).size > 1, [items])
@@ -86,21 +107,55 @@ export function LlmModelTable({
})
}, [items, normalizedSearch, providerFilter, enabledFilter, sourceFilter])
+ const groupedItems = useMemo(() => {
+ const groups = new Map<string, LlmAllowedModel[]>()
+ for (const model of filteredItems) {
+ const group = groups.get(model.provider)
+ if (group) group.push(model)
+ else groups.set(model.provider, [model])
+ }
+ return Array.from(groups.entries()).sort(([left], [right]) =>
+ getProviderDisplayLabel(left).localeCompare(getProviderDisplayLabel(right))
+ )
+ }, [filteredItems])
+
+ // Search should reveal results without forcing the operator to open every
+ // matching provider first. Keep those groups open after search is cleared so
+ // the result the operator was working with does not suddenly disappear.
+ useEffect(() => {
+ if (!normalizedSearch) return
+ setExpandedProviders(current => {
+ const next = new Set(current)
+ for (const [provider] of groupedItems) next.add(provider)
+ return next
+ })
+ }, [groupedItems, normalizedSearch])
+
const hasActiveFilter =
Boolean(normalizedSearch) ||
providerFilter !== ALL_PROVIDERS ||
enabledFilter !== 'all' ||
sourceFilter !== 'all'
- const unpricedCount = useMemo(
- () => items.filter(model => isUnpricedAllowedModel(model, unpricedKeys)).length,
- [items, unpricedKeys]
- )
-
const isInitialLoad = Boolean(loading) && items.length === 0
+ function handleProviderFilterChange(nextProvider: string) {
+ setProviderFilter(nextProvider)
+ if (nextProvider === ALL_PROVIDERS) return
+ setExpandedProviders(current => new Set(current).add(nextProvider))
+ }
+
+ function toggleProvider(provider: string) {
+ setExpandedProviders(current => {
+ const next = new Set(current)
+ if (next.has(provider)) next.delete(provider)
+ else next.add(provider)
+ return next
+ })
+ }
+
return (
- <div className="cu-card cu-card--viewport-fill" style={{ marginBottom: '1.25rem' }}>
+ <div className="cu-card cu-card--viewport-fill cu-section-card">
<TablePanelHeader
title={
<>
@@ -112,20 +167,14 @@ export function LlmModelTable({
actions={
<>
{providerOptions.length > 1 ? (
- <SelectInput
- compact
+ <FilterSelect
+ className="cu-llm-provider-filter"
value={providerFilter}
- onChange={event => setProviderFilter(event.target.value)}
+ onChange={handleProviderFilterChange}
+ options={providerFilterOptions}
disabled={isInitialLoad}
- aria-label="Filter by provider"
- >
- <option value={ALL_PROVIDERS}>All providers</option>
- {providerOptions.map(provider => (
- <option key={provider} value={provider}>
- {getProviderDisplayLabel(provider)}
- </option>
- ))}
- </SelectInput>
+ ariaLabel="Filter by provider"
+ />
) : null}
<SelectInput
compact
@@ -178,22 +227,9 @@ export function LlmModelTable({
</>
}
/>
- {unpricedCount > 0 ? (
- <div className="cu-px-unpriced-slot">
- <div className="cu-banner cu-banner--warning" role="status">
- <strong>{unpricedCount}</strong> allowed model{unpricedCount === 1 ? '' : 's'}{' '}
- {unpricedCount === 1 ? 'has' : 'have'} no enabled price. Cost budgets under-count spend
- for {unpricedCount === 1 ? 'it' : 'them'} until you{' '}
- <Link href={CONTROL_ROUTES.costAndUsage.llmPrices} className="cu-link">
- add a price
- </Link>
- .
- </div>
- </div>
- ) : null}
{isInitialLoad ? (
<div className="cu-table-wrap">
- <table className="cu-table cu-table--header-band">
+ <table className="cu-table cu-table--header-band cu-llm-model-table">
<thead>
<TableHeaderRow columns={MODEL_COLUMNS} />
</thead>
@@ -210,88 +246,130 @@ export function LlmModelTable({
</div>
) : (
<div className="cu-table-wrap">
- <table className="cu-table cu-table--header-band">
+ <table className="cu-table cu-table--header-band cu-llm-model-table">
<thead>
<TableHeaderRow columns={MODEL_COLUMNS} />
</thead>
- <tbody>
- {filteredItems.map((model: LlmAllowedModel) => (
- <tr key={model.id} className="cu-table__row">
- <td>{getProviderDisplayLabel(model.provider)}</td>
- <td className="cu-px-model">
- {model.model}
- {isUnpricedAllowedModel(model, unpricedKeys) ? (
- <Link
- href={CONTROL_ROUTES.costAndUsage.llmPrices}
- className="cu-px-badge cu-px-badge--off"
- style={{ marginLeft: '0.5rem', textDecoration: 'none' }}
- title="Allowed model without a price — add one so cost budgets can price it"
- >
- No price
- </Link>
- ) : null}
- </td>
- <td>{model.vendor || '—'}</td>
- <td>{model.display_name || '—'}</td>
- <td className="cu-px-num">{formatContextWindow(model.context_window_tokens)}</td>
- <td>
- <span
- className={
- model.enabled
- ? 'cu-px-badge cu-px-badge--on'
- : 'cu-px-badge cu-px-badge--off'
- }
- >
- {model.enabled ? 'Enabled' : 'Disabled'}
- </span>
- </td>
- <td>
- <span
- className={
- model.source === 'discovery'
- ? 'cu-px-badge cu-px-badge--info'
- : 'cu-px-badge cu-px-badge--off'
- }
- >
- {model.source === 'discovery' ? 'Discovered' : 'Manual'}
- </span>
- </td>
- <td>
- {model.stale === true ? (
- <span
- className="cu-px-badge cu-px-badge--warn"
- title="This model vanished from provider discovery but is kept — it is never auto-removed. Review whether to keep or remove it."
+ {groupedItems.map(([provider, models]) => {
+ const providerLabel = getProviderDisplayLabel(provider)
+ const providerModels = items.filter(model => model.provider === provider)
+ const enabledCount = providerModels.filter(model => model.enabled).length
+ const hasFilteredModels = models.length !== providerModels.length
+ const expanded = expandedProviders.has(provider)
+
+ return (
+ <tbody key={provider} className="cu-llm-model-group">
+ <tr className="cu-llm-model-group__row">
+ <td colSpan={MODEL_COLUMNS.length}>
+ <button
+ type="button"
+ className="cu-llm-model-group__toggle"
+ onClick={() => toggleProvider(provider)}
+ aria-expanded={expanded}
+ aria-label={`${expanded ? 'Collapse' : 'Expand'} ${providerLabel} models`}
>
- Stale
- </span>
- ) : 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>
- </td>
- </tr>
- ))}
- </tbody>
+ <span className="cu-llm-model-group__chevron" aria-hidden="true">
+ <IconChevronRight
+ className={expanded ? 'is-expanded' : undefined}
+ width={18}
+ height={18}
+ />
+ </span>
+ <LlmProviderIcon provider={provider} label={providerLabel} />
+ <span className="cu-llm-model-group__provider">{providerLabel}</span>
+ <span className="cu-llm-model-group__count">
+ {providerModels.length} model{providerModels.length === 1 ? '' : 's'}
+ </span>
+ <span className="cu-llm-model-group__summary">
+ {enabledCount} enabled
+ {hasFilteredModels ? ` · ${models.length} matching` : ''}
+ </span>
+ <span className="cu-llm-model-group__action" aria-hidden="true">
+ {expanded ? 'Hide models' : 'Show models'}
+ </span>
+ </button>
+ </td>
+ </tr>
+ {expanded
+ ? models.map((model: LlmAllowedModel) => (
+ <tr key={model.id} className="cu-table__row cu-llm-model-row">
+ <td className="cu-px-model">
+ <span className="cu-px-model-content">
+ {model.model}
+ {isUnpricedAllowedModel(model, unpricedKeys) ? (
+ <MissingPriceWarning
+ provider={model.provider}
+ model={model.model}
+ />
+ ) : null}
+ </span>
+ </td>
+ <td>{model.vendor || '—'}</td>
+ <td>{model.display_name || '—'}</td>
+ <td className="cu-px-num">
+ {formatContextWindow(model.context_window_tokens)}
+ </td>
+ <td>
+ <span
+ className={
+ model.enabled
+ ? 'cu-px-badge cu-px-badge--on'
+ : 'cu-px-badge cu-px-badge--off'
+ }
+ >
+ {model.enabled ? 'Enabled' : 'Disabled'}
+ </span>
+ </td>
+ <td>
+ <span
+ className={
+ model.source === 'discovery'
+ ? 'cu-px-badge cu-px-badge--info'
+ : 'cu-px-badge cu-px-badge--off'
+ }
+ >
+ {model.source === 'discovery' ? 'Discovered' : 'Manual'}
+ </span>
+ </td>
+ <td>
+ {model.stale === true ? (
+ <span
+ className="cu-px-badge cu-px-badge--warn"
+ title="This model vanished from provider discovery but is kept — it is never auto-removed. Review whether to keep or remove it."
+ >
+ Stale
+ </span>
+ ) : 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>
+ </td>
+ </tr>
+ ))
+ : null}
+ </tbody>
+ )
+ })}
</table>
</div>
)}
diff --git a/control-ui/components/LlmModelTable.types.ts b/control-ui/components/LlmModelTable.types.ts
index 16711feb1..5da018445 100644
--- a/control-ui/components/LlmModelTable.types.ts
+++ b/control-ui/components/LlmModelTable.types.ts
@@ -4,7 +4,7 @@ export type LlmModelTableProps = {
items: LlmAllowedModel[]
// Set of allowed models that have no enabled price, keyed both as
// `provider/model` and bare `model` (the unpriced feed may omit the
- // provider). Rows in this set render a "No price" chip.
+ // provider). Rows in this set render a compact price warning.
unpricedKeys: Set<string>
onCreate: () => void
onEdit: (id: string) => void
diff --git a/control-ui/components/LlmPriceTable.tsx b/control-ui/components/LlmPriceTable.tsx
index 119e07d6b..678d8d31d 100644
--- a/control-ui/components/LlmPriceTable.tsx
+++ b/control-ui/components/LlmPriceTable.tsx
@@ -1,9 +1,10 @@
'use client'
import React, { useMemo, useState } from 'react'
-import type { LlmModelPrice } from '@lib/api'
+import type { LlmModelPrice, UnpricedModel } from '@lib/api'
import { getProviderDisplayLabel } from '@lib/llm'
import type { LlmPriceTableProps } from './LlmPriceTable.types'
+import { MissingPriceWarning } from './MissingPriceWarning'
import { SectionSearchInput } from './SectionSearchInput'
import { IconPrice } from './Sidebar/icons'
import { SkeletonTableRows } from './SkeletonTableRows'
@@ -43,8 +44,9 @@ function formatPrice(value: number): string {
export function LlmPriceTable({
items,
- banner,
+ unpricedItems,
onCreate,
+ onAddMissingPrice,
onEdit,
onDelete,
onRefresh,
@@ -55,7 +57,7 @@ export function LlmPriceTable({
const [searchQuery, setSearchQuery] = useState('')
const normalizedSearch = searchQuery.trim().toLowerCase()
- const filteredItems = useMemo(() => {
+ const filteredPrices = useMemo(() => {
if (!normalizedSearch) return items
return items.filter(price =>
[price.provider, getProviderDisplayLabel(price.provider), price.model, price.currency]
@@ -65,15 +67,43 @@ export function LlmPriceTable({
)
}, [items, normalizedSearch])
+ const missingPriceItems = useMemo(() => {
+ const seen = new Set<string>()
+ return unpricedItems.filter(item => {
+ const key = `${item.provider ?? ''}/${item.model}`
+ if (seen.has(key)) return false
+ seen.add(key)
+ return !items.some(
+ price =>
+ price.model === item.model && (item.provider === null || price.provider === item.provider)
+ )
+ })
+ }, [items, unpricedItems])
+
+ const filteredMissingPriceItems = useMemo(() => {
+ if (!normalizedSearch) return missingPriceItems
+ return missingPriceItems.filter(item =>
+ [
+ item.provider ?? '',
+ item.provider ? getProviderDisplayLabel(item.provider) : 'any provider',
+ item.model,
+ ]
+ .join(' ')
+ .toLowerCase()
+ .includes(normalizedSearch)
+ )
+ }, [missingPriceItems, normalizedSearch])
+
+ const visibleRowCount = filteredPrices.length + filteredMissingPriceItems.length
const isInitialLoad = Boolean(loading) && items.length === 0
return (
- <div className="cu-card cu-card--viewport-fill" style={{ marginBottom: '1.25rem' }}>
+ <div className="cu-card cu-card--viewport-fill cu-section-card">
<TablePanelHeader
title={
<>
<IconPrice />
- {isInitialLoad ? 'LLM Prices' : `LLM Prices (${filteredItems.length})`}
+ {isInitialLoad ? 'LLM Prices' : `LLM Prices (${visibleRowCount})`}
</>
}
subtitle="Per-model token prices that back cost-unit budgets. Prices are per 1M tokens."
@@ -106,7 +136,6 @@ export function LlmPriceTable({
</>
}
/>
- {banner ? <div className="cu-px-unpriced-slot">{banner}</div> : null}
{isInitialLoad ? (
<div className="cu-table-wrap">
<table className="cu-table cu-table--header-band">
@@ -118,7 +147,7 @@ export function LlmPriceTable({
</tbody>
</table>
</div>
- ) : filteredItems.length === 0 ? (
+ ) : visibleRowCount === 0 ? (
<div className="cu-empty">
{normalizedSearch
? 'No prices match this search.'
@@ -131,51 +160,109 @@ export function LlmPriceTable({
<TableHeaderRow columns={PRICE_COLUMNS} />
</thead>
<tbody>
- {filteredItems.map((price: LlmModelPrice) => (
- <tr key={price.id} className="cu-table__row">
- <td>{getProviderDisplayLabel(price.provider)}</td>
- <td className="cu-px-model">{price.model}</td>
- <td className="cu-px-num">{formatPrice(price.input_token_price)}</td>
- <td className="cu-px-num">{formatPrice(price.output_token_price)}</td>
- <td className="cu-px-num">{formatPrice(price.cache_read_token_price)}</td>
- <td className="cu-px-num">{formatPrice(price.cache_write_token_price)}</td>
- <td>{price.currency}</td>
- <td>
- <span
- className={
- price.enabled
- ? 'cu-px-badge cu-px-badge--on'
- : 'cu-px-badge cu-px-badge--off'
- }
- >
- {price.enabled ? 'Enabled' : 'Disabled'}
- </span>
- </td>
- <td className="cu-px-actions">
- <button
- type="button"
- className="cu-btn cu-btn--icon cu-btn--toolbar"
- onClick={() => onEdit(price.id)}
- aria-label={`Edit price ${price.provider}/${price.model}`}
- >
- <IconPencil width={16} height={16} />
- </button>
- <button
- type="button"
- className="cu-btn cu-btn--icon cu-btn--danger-icon"
- onClick={() => void onDelete(price)}
- disabled={deletingId === price.id}
- aria-label={
- deletingId === price.id
- ? 'Deleting price…'
- : `Delete price ${price.provider}/${price.model}`
- }
- >
- <IconX width={16} height={16} />
- </button>
- </td>
- </tr>
- ))}
+ {filteredPrices.map((price: LlmModelPrice) => {
+ const isUnpriced = unpricedItems.some(
+ item =>
+ item.model === price.model &&
+ (item.provider === null || item.provider === price.provider)
+ )
+ return (
+ <tr key={price.id} className="cu-table__row">
+ <td>{getProviderDisplayLabel(price.provider)}</td>
+ <td className="cu-px-model">
+ <span className="cu-px-model-content">
+ {price.model}
+ {isUnpriced ? (
+ <MissingPriceWarning
+ provider={price.provider}
+ model={price.model}
+ priceId={price.id}
+ />
+ ) : null}
+ </span>
+ </td>
+ <td className="cu-px-num">{formatPrice(price.input_token_price)}</td>
+ <td className="cu-px-num">{formatPrice(price.output_token_price)}</td>
+ <td className="cu-px-num">{formatPrice(price.cache_read_token_price)}</td>
+ <td className="cu-px-num">{formatPrice(price.cache_write_token_price)}</td>
+ <td>{price.currency}</td>
+ <td>
+ <span
+ className={
+ price.enabled
+ ? 'cu-px-badge cu-px-badge--on'
+ : 'cu-px-badge cu-px-badge--off'
+ }
+ >
+ {price.enabled ? 'Enabled' : 'Disabled'}
+ </span>
+ </td>
+ <td className="cu-px-actions">
+ <button
+ type="button"
+ className="cu-btn cu-btn--icon cu-btn--toolbar"
+ onClick={() => onEdit(price.id)}
+ aria-label={`Edit price ${price.provider}/${price.model}`}
+ >
+ <IconPencil width={16} height={16} />
+ </button>
+ <button
+ type="button"
+ className="cu-btn cu-btn--icon cu-btn--danger-icon"
+ onClick={() => void onDelete(price)}
+ disabled={deletingId === price.id}
+ aria-label={
+ deletingId === price.id
+ ? 'Deleting price…'
+ : `Delete price ${price.provider}/${price.model}`
+ }
+ >
+ <IconX width={16} height={16} />
+ </button>
+ </td>
+ </tr>
+ )
+ })}
+ {filteredMissingPriceItems.map((item: UnpricedModel) => {
+ const label = item.provider
+ ? `${getProviderDisplayLabel(item.provider)}/${item.model}`
+ : item.model
+ return (
+ <tr
+ key={`missing/${item.provider ?? ''}/${item.model}`}
+ className="cu-table__row cu-px-missing-row"
+ >
+ <td>
+ {item.provider ? getProviderDisplayLabel(item.provider) : 'Any provider'}
+ </td>
+ <td className="cu-px-model">
+ <span className="cu-px-model-content">
+ {item.model}
+ <MissingPriceWarning provider={item.provider} model={item.model} />
+ </span>
+ </td>
+ <td className="cu-px-num">—</td>
+ <td className="cu-px-num">—</td>
+ <td className="cu-px-num">—</td>
+ <td className="cu-px-num">—</td>
+ <td>—</td>
+ <td>
+ <span className="cu-px-badge cu-px-badge--warn">Missing</span>
+ </td>
+ <td className="cu-px-actions">
+ <button
+ type="button"
+ className="cu-btn cu-btn--icon cu-btn--toolbar"
+ onClick={() => onAddMissingPrice(item)}
+ aria-label={`Add price for ${label}`}
+ title={`Add price for ${label}`}
+ >
+ <IconPencil width={16} height={16} />
+ </button>
+ </td>
+ </tr>
+ )
+ })}
</tbody>
</table>
</div>
diff --git a/control-ui/components/LlmPriceTable.types.ts b/control-ui/components/LlmPriceTable.types.ts
index 66789fed8..46f0e4c7f 100644
--- a/control-ui/components/LlmPriceTable.types.ts
+++ b/control-ui/components/LlmPriceTable.types.ts
@@ -1,12 +1,10 @@
-import type { ReactNode } from 'react'
-import type { LlmModelPrice } from '@lib/api'
+import type { LlmModelPrice, UnpricedModel } from '@lib/api'
export type LlmPriceTableProps = {
items: LlmModelPrice[]
- // Optional slot rendered inside the card, directly under the panel header
- // (e.g. the unpriced-models notice) so it never pushes the page layout.
- banner?: ReactNode
+ unpricedItems: UnpricedModel[]
onCreate: () => void
+ onAddMissingPrice: (model: UnpricedModel) => void
onEdit: (id: string) => void
onDelete: (price: LlmModelPrice) => Promise<void>
onRefresh: () => void
diff --git a/control-ui/components/LlmProviderIcon/types.ts b/control-ui/components/LlmProviderIcon/types.ts
index 8d2e710be..37e04e977 100644
--- a/control-ui/components/LlmProviderIcon/types.ts
+++ b/control-ui/components/LlmProviderIcon/types.ts
@@ -1,7 +1,8 @@
-import type { LlmProvider } from '@/lib/llm'
-
export type LlmProviderIconProps = {
- provider: LlmProvider
+ // Catalog rows may contain an operator-defined provider that is not yet in
+ // the canonical registry. The icon component already falls back to the
+ // label's initial when no matching asset exists.
+ provider: string
// Rendered as the single-letter fallback when the provider SVG fails to load.
label: string
}
diff --git a/control-ui/components/MissingPriceWarning/index.tsx b/control-ui/components/MissingPriceWarning/index.tsx
new file mode 100644
index 000000000..d404b0069
--- /dev/null
+++ b/control-ui/components/MissingPriceWarning/index.tsx
@@ -0,0 +1,37 @@
+'use client'
+
+import React, { useId } from 'react'
+import Link from 'next/link'
+import { CONTROL_ROUTES } from '@constants/routes'
+import { getProviderDisplayLabel } from '@lib/llm'
+import { IconAlertTriangle } from '../icons'
+import type { MissingPriceWarningProps } from './types'
+
+export function MissingPriceWarning({ model, priceId, provider }: MissingPriceWarningProps) {
+ const descriptionId = useId()
+ const providerLabel = provider ? getProviderDisplayLabel(provider) : null
+ const modelLabel = providerLabel ? `${providerLabel}/${model}` : model
+ const actionHref = priceId
+ ? CONTROL_ROUTES.costAndUsage.editLlmPrice(priceId)
+ : CONTROL_ROUTES.costAndUsage.newLlmPrice({ provider, model })
+
+ return (
+ <span className="cu-missing-price">
+ <button
+ type="button"
+ className="cu-missing-price__trigger"
+ aria-label={`${modelLabel} has no enabled price`}
+ aria-describedby={descriptionId}
+ >
+ <IconAlertTriangle width={15} height={15} />
+ </button>
+ <span id={descriptionId} className="cu-missing-price__popover" role="note">
+ <strong>No enabled price</strong>
+ <span>Cost budgets may under-count spend for this model.</span>
+ <Link href={actionHref} className="cu-link cu-missing-price__cta">
+ {priceId ? 'Review price' : 'Add price'}
+ </Link>
+ </span>
+ </span>
+ )
+}
diff --git a/control-ui/components/MissingPriceWarning/types.ts b/control-ui/components/MissingPriceWarning/types.ts
new file mode 100644
index 000000000..a38428ae0
--- /dev/null
+++ b/control-ui/components/MissingPriceWarning/types.ts
@@ -0,0 +1,5 @@
+export type MissingPriceWarningProps = {
+ model: string
+ priceId?: string
+ provider: string | null
+}
diff --git a/control-ui/components/RegistryCatalog.tsx b/control-ui/components/RegistryCatalog.tsx
index b6f055176..8c376066a 100644
--- a/control-ui/components/RegistryCatalog.tsx
+++ b/control-ui/components/RegistryCatalog.tsx
@@ -3,6 +3,8 @@
import { Fragment, useEffect, useMemo, useState } from 'react'
import Link from 'next/link'
import { usePathname, useRouter } from 'next/navigation'
+import { FilterSelect } from '@components/FilterSelect'
+import { type RowAction, RowActionsMenu } from '@components/RowActionsMenu'
import { SectionSearchInput } from '@components/SectionSearchInput'
import { IconStore } from '@components/Sidebar/icons'
import { SkeletonTableRows } from '@components/SkeletonTableRows'
@@ -11,7 +13,7 @@ import { TableHeaderRow } from '@components/TableHeaderRow'
import type { TableHeaderColumn } from '@components/TableHeaderRow/types'
import { TablePanelHeader } from '@components/TablePanelHeader'
import { useToast } from '@components/Toast'
-import { IconChevronRight, IconPencil, IconX } from '@components/icons'
+import { IconChevronRight, IconX } from '@components/icons'
import { CONTROL_ROUTES } from '@constants/routes'
import {
type RegistryConnectionState,
@@ -289,11 +291,6 @@ export default function RegistryCatalog() {
ariaLabel="Filter by mode"
/>
</div>
- {!isInitialLoad ? (
- <span className="cu-registry-count">
- {filtered.length} of {tabEntries.length} entries
- </span>
- ) : null}
{connectionMode !== 'managed' ? (
<button
type="button"
@@ -457,33 +454,33 @@ export default function RegistryCatalog() {
onClick={event => event.stopPropagation()}
onKeyDown={event => event.stopPropagation()}
>
- <div className="cu-table-actions cu-marketplace-actions">
- <button
- type="button"
- className="cu-btn cu-btn--icon cu-btn--toolbar"
- onClick={() =>
- router.push(
- CONTROL_ROUTES.marketplace.editEntry(entry.name, entry.version)
- )
- }
- aria-label={`Edit Marketplace metadata for ${entry.name} v${entry.version}`}
- title={`Edit Marketplace metadata for ${entry.name} v${entry.version}`}
- >
- <IconPencil width={16} height={16} />
- </button>
- <button
- type="button"
- className="cu-btn cu-btn--icon cu-btn--danger-icon"
- onClick={() => {
- setRemoveError('')
- setRemoveTarget(entry)
- }}
- aria-label={`Remove ${entry.name} v${entry.version} from Marketplace`}
- title={`Remove ${entry.name} v${entry.version} from Marketplace`}
- >
- <IconX width={16} height={16} />
- </button>
- </div>
+ <RowActionsMenu
+ ariaLabel={`Actions for ${entry.name} v${entry.version}`}
+ actions={
+ [
+ {
+ key: 'edit',
+ label: 'Edit',
+ onClick: () =>
+ router.push(
+ CONTROL_ROUTES.marketplace.editEntry(
+ entry.name,
+ entry.version
+ )
+ ),
+ },
+ {
+ key: 'remove',
+ label: 'Remove from Marketplace',
+ danger: true,
+ onClick: () => {
+ setRemoveError('')
+ setRemoveTarget(entry)
+ },
+ },
+ ] satisfies RowAction[]
+ }
+ />
</td>
</tr>
{expanded ? (
@@ -591,33 +588,3 @@ export default function RegistryCatalog() {
</div>
)
}
-
-function FilterSelect({
- value,
- onChange,
- options,
- disabled,
- ariaLabel,
-}: {
- value: string
- onChange: (value: string) => void
- options: { value: string; label: string }[]
- disabled?: boolean
- ariaLabel: string
-}) {
- return (
- <select
- value={value}
- onChange={event => onChange(event.target.value)}
- className="cu-input cu-input--compact cu-registry-filter"
- disabled={disabled}
- aria-label={ariaLabel}
- >
- {options.map(option => (
- <option key={option.value} value={option.value}>
- {option.label}
- </option>
- ))}
- </select>
- )
-}
diff --git a/control-ui/components/RowActionsMenu/index.tsx b/control-ui/components/RowActionsMenu/index.tsx
new file mode 100644
index 000000000..f042f42c6
--- /dev/null
+++ b/control-ui/components/RowActionsMenu/index.tsx
@@ -0,0 +1,79 @@
+'use client'
+
+import { useEffect, useRef, useState } from 'react'
+import { IconDotsVertical } from '@components/icons'
+
+export type RowAction = {
+ key: string
+ label: string
+ onClick: () => void
+ disabled?: boolean
+ danger?: boolean
+}
+
+export function RowActionsMenu({
+ ariaLabel,
+ actions,
+}: {
+ ariaLabel: string
+ actions: RowAction[]
+}) {
+ const [open, setOpen] = useState(false)
+ const ref = useRef<HTMLDivElement>(null)
+
+ useEffect(() => {
+ if (!open) return
+ function handleDown(event: MouseEvent) {
+ if (ref.current && !ref.current.contains(event.target as Node)) setOpen(false)
+ }
+ function handleKey(event: KeyboardEvent) {
+ if (event.key === 'Escape') setOpen(false)
+ }
+ document.addEventListener('mousedown', handleDown)
+ document.addEventListener('keydown', handleKey)
+ return () => {
+ document.removeEventListener('mousedown', handleDown)
+ document.removeEventListener('keydown', handleKey)
+ }
+ }, [open])
+
+ if (actions.length === 0) return null
+
+ return (
+ <div ref={ref} className="cu-kebab">
+ <button
+ type="button"
+ aria-label={ariaLabel}
+ aria-haspopup="menu"
+ aria-expanded={open}
+ className="cu-btn cu-btn--icon cu-btn--ghost cu-kebab__trigger"
+ onClick={event => {
+ event.stopPropagation()
+ setOpen(value => !value)
+ }}
+ >
+ <IconDotsVertical width={16} height={16} />
+ </button>
+ {open ? (
+ <div className="cu-kebab__menu" role="menu">
+ {actions.map(action => (
+ <button
+ key={action.key}
+ type="button"
+ role="menuitem"
+ className={`cu-kebab__item${action.danger ? ' cu-kebab__item--danger' : ''}`}
+ disabled={action.disabled}
+ onClick={event => {
+ event.stopPropagation()
+ setOpen(false)
+ action.onClick()
+ }}
+ >
+ {action.label}
+ </button>
+ ))}
+ </div>
+ ) : null}
+ </div>
+ )
+}
diff --git a/control-ui/components/__tests__/LlmModelTable.test.tsx b/control-ui/components/__tests__/LlmModelTable.test.tsx
index 7df738067..0a39007fa 100644
--- a/control-ui/components/__tests__/LlmModelTable.test.tsx
+++ b/control-ui/components/__tests__/LlmModelTable.test.tsx
@@ -19,11 +19,11 @@ const baseModel: LlmAllowedModel = {
updated_at: '2026-01-01T00:00:00.000Z',
}
-function renderTable(items: LlmAllowedModel[]) {
+function renderTable(items: LlmAllowedModel[], unpricedKeys = new Set<string>()) {
return render(
<LlmModelTable
items={items}
- unpricedKeys={new Set()}
+ unpricedKeys={unpricedKeys}
onCreate={vi.fn()}
onEdit={vi.fn()}
onDelete={vi.fn().mockResolvedValue(undefined)}
@@ -35,9 +35,14 @@ function renderTable(items: LlmAllowedModel[]) {
)
}
+function expandAnthropicModels() {
+ fireEvent.click(screen.getByRole('button', { name: 'Expand Anthropic models' }))
+}
+
describe('LlmModelTable catalog-lifecycle columns', () => {
it('shows the Discovered badge for a discovery-sourced row', () => {
renderTable([{ ...baseModel, source: 'discovery' }])
+ expandAnthropicModels()
expect(screen.getByText('Discovered')).toBeInTheDocument()
expect(screen.queryByText('Manual')).not.toBeInTheDocument()
})
@@ -45,11 +50,13 @@ describe('LlmModelTable catalog-lifecycle columns', () => {
it('shows the Stale badge only when stale is true', () => {
// 'Stale' is also the column header, so scope the assertion to the badge.
renderTable([{ ...baseModel, id: 'm-stale', source: 'discovery', stale: true }])
+ expandAnthropicModels()
expect(screen.getByText('Stale', { selector: '.cu-px-badge--warn' })).toBeInTheDocument()
})
it('omits the Stale badge when stale is false', () => {
renderTable([baseModel])
+ expandAnthropicModels()
expect(screen.queryByText('Stale', { selector: '.cu-px-badge--warn' })).toBeNull()
})
@@ -67,6 +74,7 @@ describe('LlmModelTable catalog-lifecycle columns', () => {
updated_at: '2026-01-01T00:00:00.000Z',
} as LlmAllowedModel
renderTable([legacy])
+ fireEvent.click(screen.getByRole('button', { name: 'Expand OpenAI models' }))
expect(screen.getByText('Manual', { selector: '.cu-px-badge' })).toBeInTheDocument()
expect(screen.queryByText('Discovered')).not.toBeInTheDocument()
expect(screen.queryByText('Stale', { selector: '.cu-px-badge--warn' })).toBeNull()
@@ -91,6 +99,7 @@ describe('LlmModelTable filters', () => {
it('filters by enabled state', () => {
renderTable([enabledModel, disabledModel])
+ expandAnthropicModels()
expect(screen.getByText('claude-enabled')).toBeInTheDocument()
expect(screen.getByText('claude-disabled')).toBeInTheDocument()
@@ -103,6 +112,7 @@ describe('LlmModelTable filters', () => {
it('filters by source when both kinds are present', () => {
renderTable([enabledModel, disabledModel])
+ expandAnthropicModels()
fireEvent.change(screen.getByLabelText('Filter by source'), {
target: { value: 'discovery' },
})
@@ -123,3 +133,100 @@ describe('LlmModelTable filters', () => {
expect(screen.getByText('No models match this filter.')).toBeInTheDocument()
})
})
+
+describe('LlmModelTable provider groups', () => {
+ const openAiModel: LlmAllowedModel = {
+ ...baseModel,
+ id: 'openai-model',
+ provider: 'openai',
+ model: 'gpt-5',
+ vendor: 'OpenAI',
+ display_name: 'GPT-5',
+ }
+
+ it('starts with compact provider summaries and expands groups independently', () => {
+ renderTable([baseModel, openAiModel])
+
+ expect(screen.getByRole('button', { name: 'Expand Anthropic models' })).toHaveAttribute(
+ 'aria-expanded',
+ 'false'
+ )
+ expect(screen.getByRole('button', { name: 'Expand OpenAI models' })).toHaveAttribute(
+ 'aria-expanded',
+ 'false'
+ )
+ expect(screen.queryByText('claude-sonnet-4-6')).toBeNull()
+ expect(screen.queryByText('gpt-5')).toBeNull()
+
+ expandAnthropicModels()
+
+ expect(screen.getByText('claude-sonnet-4-6')).toBeInTheDocument()
+ expect(screen.queryByText('gpt-5')).toBeNull()
+ expect(screen.getByRole('button', { name: 'Collapse Anthropic models' })).toHaveAttribute(
+ 'aria-expanded',
+ 'true'
+ )
+ })
+
+ it('opens matching groups while searching and shows the match count', () => {
+ renderTable([
+ baseModel,
+ openAiModel,
+ {
+ ...openAiModel,
+ id: 'openai-model-2',
+ model: 'o3',
+ display_name: 'O3',
+ },
+ ])
+
+ fireEvent.change(screen.getByLabelText('Search models'), {
+ target: { value: 'gpt-5' },
+ })
+
+ expect(screen.getByText('gpt-5')).toBeInTheDocument()
+ expect(screen.queryByRole('button', { name: /Anthropic models/ })).toBeNull()
+ expect(screen.getByRole('button', { name: 'Collapse OpenAI models' })).toHaveTextContent(
+ '2 models'
+ )
+ expect(screen.getByRole('button', { name: 'Collapse OpenAI models' })).toHaveTextContent(
+ '1 matching'
+ )
+ })
+
+ it('opens a provider selected from the provider filter', () => {
+ renderTable([baseModel, openAiModel])
+
+ fireEvent.click(screen.getByRole('button', { name: 'Filter by provider' }))
+ const openAiOption = screen.getByRole('option', { name: 'OpenAI' })
+ expect(openAiOption.querySelector('img')).toHaveAttribute('src', '/provider-icons/openai.svg')
+ fireEvent.click(openAiOption)
+
+ expect(screen.getByText('gpt-5')).toBeInTheDocument()
+ expect(screen.getByRole('button', { name: 'Filter by provider' })).toHaveTextContent('OpenAI')
+ expect(
+ screen.getByRole('button', { name: 'Filter by provider' }).querySelector('img')
+ ).toHaveAttribute('src', '/provider-icons/openai.svg')
+ expect(screen.queryByRole('button', { name: /Anthropic models/ })).toBeNull()
+ })
+
+ it('shows missing-price details and a prefilled CTA only on the affected row', () => {
+ renderTable([baseModel, openAiModel], new Set(['claude/claude-sonnet-4-6']))
+ expandAnthropicModels()
+
+ expect(
+ screen.getByRole('button', {
+ name: 'Anthropic/claude-sonnet-4-6 has no enabled price',
+ })
+ ).toBeVisible()
+ expect(screen.getByRole('note')).toHaveTextContent('No enabled price')
+ expect(screen.getByRole('note')).toHaveTextContent(
+ 'Cost budgets may under-count spend for this model.'
+ )
+ expect(screen.getByRole('link', { name: 'Add price' })).toHaveAttribute(
+ 'href',
+ '/cost-and-usage/llm-prices/new?provider=claude&model=claude-sonnet-4-6'
+ )
+ expect(screen.queryByText(/allowed models? have no enabled price/i)).toBeNull()
+ })
+})
diff --git a/control-ui/components/__tests__/LlmPriceTable.test.tsx b/control-ui/components/__tests__/LlmPriceTable.test.tsx
index 63797d35a..abd4ec6a2 100644
--- a/control-ui/components/__tests__/LlmPriceTable.test.tsx
+++ b/control-ui/components/__tests__/LlmPriceTable.test.tsx
@@ -24,7 +24,9 @@ function renderTable(overrides: Partial<React.ComponentProps<typeof LlmPriceTabl
return render(
<LlmPriceTable
items={prices}
+ unpricedItems={[]}
onCreate={vi.fn()}
+ onAddMissingPrice={vi.fn()}
onEdit={vi.fn()}
onDelete={vi.fn().mockResolvedValue(undefined)}
onRefresh={vi.fn()}
@@ -71,25 +73,53 @@ describe('LlmPriceTable', () => {
expect(screen.getByText('No prices match this search.')).toBeInTheDocument()
})
- it('renders the banner slot inside the card, after the panel header (not above it)', () => {
- const { container } = renderTable({
- banner: <div data-testid="unpriced-banner">2 models have no price</div>,
+ it('renders an unpriced model as a compact missing row with an add-price warning', () => {
+ const onAddMissingPrice = vi.fn()
+ renderTable({
+ unpricedItems: [{ provider: 'openai', model: 'gpt-5' }],
+ onAddMissingPrice,
})
- const card = container.querySelector('.cu-card')
- const slot = container.querySelector('.cu-px-unpriced-slot')
- // The banner lives in the in-card slot so it can't push the page layout.
- expect(slot).not.toBeNull()
- expect(card?.contains(slot as Node)).toBe(true)
- expect(slot?.querySelector('[data-testid="unpriced-banner"]')).not.toBeNull()
- // Slot must come after the sticky panel header inside the card.
- const head = card?.querySelector('.cu-table-panel__head') as HTMLElement
+
+ expect(screen.getByText('gpt-5')).toBeInTheDocument()
+ expect(screen.getByText('Missing')).toBeInTheDocument()
+ expect(screen.getByRole('button', { name: 'OpenAI/gpt-5 has no enabled price' })).toBeVisible()
+ expect(screen.getByRole('link', { name: 'Add price' })).toHaveAttribute(
+ 'href',
+ '/cost-and-usage/llm-prices/new?provider=openai&model=gpt-5'
+ )
+
+ fireEvent.click(screen.getByRole('button', { name: 'Add price for OpenAI/gpt-5' }))
+ expect(onAddMissingPrice).toHaveBeenCalledWith({ provider: 'openai', model: 'gpt-5' })
+ })
+
+ it('decorates an existing unpriced price row without duplicating it', () => {
+ renderTable({
+ unpricedItems: [{ provider: 'claude', model: 'claude-sonnet-4-6' }],
+ })
+
+ expect(screen.getAllByText('claude-sonnet-4-6')).toHaveLength(1)
expect(
- head.compareDocumentPosition(slot as Node) & Node.DOCUMENT_POSITION_FOLLOWING
- ).toBeTruthy()
+ screen.getByRole('button', {
+ name: 'Anthropic/claude-sonnet-4-6 has no enabled price',
+ })
+ ).toBeVisible()
+ expect(screen.getByRole('link', { name: 'Review price' })).toHaveAttribute(
+ 'href',
+ '/cost-and-usage/llm-prices/price-1/edit'
+ )
+ expect(screen.queryByText('Missing')).toBeNull()
})
- it('omits the banner slot when no banner is provided', () => {
- const { container } = renderTable()
- expect(container.querySelector('.cu-px-unpriced-slot')).toBeNull()
+ it('supports an unpriced model without a specific provider', () => {
+ renderTable({
+ items: [],
+ unpricedItems: [{ provider: null, model: 'shared-model' }],
+ })
+
+ expect(screen.getByText('Any provider')).toBeInTheDocument()
+ expect(screen.getByRole('link', { name: 'Add price' })).toHaveAttribute(
+ 'href',
+ '/cost-and-usage/llm-prices/new?model=shared-model'
+ )
})
})
diff --git a/control-ui/components/__tests__/RegistryCatalog.test.tsx b/control-ui/components/__tests__/RegistryCatalog.test.tsx
index e7d06be37..22023aea7 100644
--- a/control-ui/components/__tests__/RegistryCatalog.test.tsx
+++ b/control-ui/components/__tests__/RegistryCatalog.test.tsx
@@ -129,7 +129,7 @@ describe('RegistryCatalog tabs and columns', () => {
expect(await screen.findByText('brave-search')).toBeInTheDocument()
expect(screen.queryByText('market-report')).not.toBeInTheDocument()
expect(screen.getByText('Brave web search')).toBeInTheDocument()
- expect(screen.getByText('1 of 1 entries')).toBeInTheDocument()
+ expect(screen.getByText('Marketplace (1)')).toBeInTheDocument()
})
it('shows only plugin entries on the plugins route', async () => {
@@ -191,11 +191,11 @@ describe('RegistryCatalog expansion and actions', () => {
render(<RegistryCatalog />)
const row = (await screen.findByText('brave-search')).closest('tr')!
const installCell = within(row).getByRole('button', { name: 'Install' }).closest('td')
- const editCell = within(row)
- .getByRole('button', { name: 'Edit Marketplace metadata for brave-search v1.0.0' })
+ const actionsCell = within(row)
+ .getByRole('button', { name: 'Actions for brave-search v1.0.0' })
.closest('td')
- expect(installCell).not.toBe(editCell)
+ expect(installCell).not.toBe(actionsCell)
expect(within(row).queryByRole('button', { name: 'View details' })).not.toBeInTheDocument()
})
@@ -262,9 +262,8 @@ describe('RegistryCatalog expansion and actions', () => {
render(<RegistryCatalog />)
const row = (await screen.findByText('brave-search')).closest('tr')!
- fireEvent.click(
- within(row).getByRole('button', { name: 'Remove brave-search v1.0.0 from Marketplace' })
- )
+ fireEvent.click(within(row).getByRole('button', { name: 'Actions for brave-search v1.0.0' }))
+ fireEvent.click(screen.getByRole('menuitem', { name: 'Remove from Marketplace' }))
const dialog = screen.getByRole('dialog')
fireEvent.click(within(dialog).getByRole('button', { name: 'Remove' }))
@@ -307,9 +306,8 @@ describe('RegistryCatalog controls', () => {
render(<RegistryCatalog />)
await screen.findByText('brave-search')
- fireEvent.change(screen.getByRole('combobox', { name: 'Filter by mode' }), {
- target: { value: 'remote' },
- })
+ fireEvent.click(screen.getByRole('button', { name: 'Filter by mode' }))
+ fireEvent.click(screen.getByRole('option', { name: 'Remote' }))
expect(screen.queryByText('brave-search')).not.toBeInTheDocument()
expect(screen.getByText('remote-db')).toBeInTheDocument()
})
diff --git a/control-ui/components/icons/index.tsx b/control-ui/components/icons/index.tsx
index 3bea48b36..8aad99fb9 100644
--- a/control-ui/components/icons/index.tsx
+++ b/control-ui/components/icons/index.tsx
@@ -153,6 +153,27 @@ export function IconMoreHorizontal({ title, ...props }: IconProps) {
)
}
+export function IconDotsVertical({ title, ...props }: IconProps) {
+ const p = iconSize(props)
+ return (
+ <svg
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ aria-hidden
+ {...p}
+ >
+ {title ? <title>{title}</title> : null}
+ <circle cx="12" cy="5" r="1" />
+ <circle cx="12" cy="12" r="1" />
+ <circle cx="12" cy="19" r="1" />
+ </svg>
+ )
+}
+
export function IconDownload({ title, ...props }: IconProps) {
const p = iconSize(props)
return (
diff --git a/control-ui/e2e/qa-recorder-llm-model-lifecycle.spec.ts b/control-ui/e2e/qa-recorder-llm-model-lifecycle.spec.ts
index 32aa7265b..3c7109d3c 100644
--- a/control-ui/e2e/qa-recorder-llm-model-lifecycle.spec.ts
+++ b/control-ui/e2e/qa-recorder-llm-model-lifecycle.spec.ts
@@ -61,6 +61,10 @@ test.describe('optional QA recorder: Control UI LLM model lifecycle', () => {
).toBeVisible()
await expect(page).toHaveURL(/\/llm-models$/, { timeout: 20_000 })
+ // Provider groups are collapsed by default. Searching opens the matching
+ // group so the newly added row and its actions are immediately reachable.
+ await page.getByLabel('Search models').fill(modelName)
+
// The list shows a static Enabled/Disabled badge (no inline toggle), so the
// disable step goes through the edit page. The pencil's name is provider/model.
const editButton = page.getByRole('button', {
@@ -85,6 +89,7 @@ test.describe('optional QA recorder: Control UI LLM model lifecycle', () => {
).toBeVisible()
await expect(page).toHaveURL(/\/llm-models$/, { timeout: 20_000 })
+ await page.getByLabel('Search models').fill(modelName)
const row = page.getByRole('row').filter({ hasText: modelName })
await expect(row).toBeVisible({ timeout: 20_000 })
await expect(row).toContainText('Disabled')
diff --git a/control-ui/e2e/registry-install.spec.ts b/control-ui/e2e/registry-install.spec.ts
index 73e962f04..2c2f545fb 100644
--- a/control-ui/e2e/registry-install.spec.ts
+++ b/control-ui/e2e/registry-install.spec.ts
@@ -1358,7 +1358,7 @@ test.describe('H. Control-UI Smoke Tests', () => {
test('H1. Catalog loads entries in control-ui', async ({ page }) => {
await login(page)
await navigateToRegistry(page)
- await expect(page.locator('text=/\\d+ of \\d+ entries/')).toBeVisible({ timeout: 15_000 })
+ await expect(page.locator('text=/Marketplace \\(\\d+\\)/')).toBeVisible({ timeout: 15_000 })
await expect(page.locator('text=Connector').first()).toBeVisible()
await expect(page.locator('text=Recipe').first()).toBeVisible()
})
@@ -1366,14 +1366,14 @@ test.describe('H. Control-UI Smoke Tests', () => {
test('H2. Type filter works', async ({ page }) => {
await login(page)
await navigateToRegistry(page)
- await expect(page.locator('text=/\\d+ of \\d+ entries/')).toBeVisible({ timeout: 15_000 })
+ await expect(page.locator('text=/Marketplace \\(\\d+\\)/')).toBeVisible({ timeout: 15_000 })
const typeSelect = page.locator('select').filter({ hasText: 'All Types' })
await typeSelect.selectOption('mcp-server')
await expect(page.locator('tr', { hasText: 'mcp-filesystem' })).toBeVisible({
timeout: 10_000,
})
- await expect(page.locator('text=/\\d+ of \\d+ entries/')).toBeVisible()
+ await expect(page.locator('text=/Marketplace \\(\\d+\\)/')).toBeVisible()
await typeSelect.selectOption('all')
})
@@ -1383,7 +1383,7 @@ test.describe('H. Control-UI Smoke Tests', () => {
await cleanup(token, [serverName])
try {
await navigateToRegistry(page)
- await expect(page.locator('text=/\\d+ of \\d+ entries/')).toBeVisible({ timeout: 15_000 })
+ await expect(page.locator('text=/Marketplace \\(\\d+\\)/')).toBeVisible({ timeout: 15_000 })
// Filter to local connectors
await page.locator('select').filter({ hasText: 'All Types' }).selectOption('mcp-server')
@@ -1462,7 +1462,7 @@ test.describe('H. Control-UI Smoke Tests', () => {
await login(page)
try {
await navigateToRegistry(page)
- await expect(page.locator('text=/\\d+ of \\d+ entries/')).toBeVisible({ timeout: 15_000 })
+ await expect(page.locator('text=/Marketplace \\(\\d+\\)/')).toBeVisible({ timeout: 15_000 })
await page.getByLabel('Search Marketplace entries').fill(recipeEntryName)
await page.locator('select').filter({ hasText: 'All Types' }).selectOption('recipe')
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index aa10851df..3ae5053ab 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.352",
+ "version": "0.1.353",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.352",
+ "version": "0.1.353",
"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.json
index 2f7d71b2d..836023b36 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.352",
+ "version": "0.1.353",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --git a/docs/concepts/publisher-and-marketplace.md b/docs/concepts/publisher-and-marketplace.md
new file mode 100644
index 000000000..dd5350f14
--- /dev/null
+++ b/docs/concepts/publisher-and-marketplace.md
@@ -0,0 +1,320 @@
+# Publisher & Marketplace — How It All Fits Together
+
+A walk-through of the relationship between orgs, the marketplace, the publisher surface, plugins, and connectors.
+
+## TL;DR
+
+- **Org** = a tenancy boundary. Every deploy is either `curator` (the official `@clerum` catalog) or org-bound (its own namespace like `@acme`).
+- **Connector** = an entry that becomes an MCP server (a tool the agent calls at runtime).
+- **Plugin** = an entry that becomes a WorkflowRecipe (a multi-step workflow the agent runs).
+- **Marketplace** = the catalog everyone browses (`/marketplace/*`).
+- **Publisher** = the self-service UI for org owners (`/publisher/*`) to manage *their own* entries, share with other orgs, and mint docker push credentials.
+
+## The Big Picture
+
+```
+┌─────────────────────────────────────────────────────────────┐
+│ YOUR DEPLOY │
+│ │
+│ ┌──────────────────────┐ ┌──────────────────────────┐ │
+│ │ control-ui (Next) │ │ control-api (Express) │ │
+│ │ │ │ │ │
+│ │ /publisher/* ──────┼──► │ /api/v1/admin/registry │ │
+│ │ /marketplace/* ─────┼──► │ (publish, install, │ │
+│ │ │ │ grants, keys, ...) │ │
+│ └──────────────────────┘ └──────────┬───────────────┘ │
+│ │ │
+│ Holds: OAuth2 + │
+│ - admin session RS256 PoP │
+│ - (no secrets) voucher │
+└─────────────────────────────────────────┼───────────────────┘
+ │
+ ▼
+ ┌──────────────────────────────┐
+ │ EVENFIRE REGISTRY │
+ │ (external service) │
+ │ │
+ │ • /entries (catalog) │
+ │ • /org/:o/keys (efrk_) │
+ │ • /org/:o/grants │
+ │ • /deployments/register │
+ └──────────────────────────────┘
+```
+
+`control-api` is the **only trust boundary**. It holds the OAuth2 client secret and the RSA private key for the registry. The browser never sees them.
+
+## The Five Concepts
+
+### 1. Org
+
+An **org** is a tenant — a namespace where entries live. Every deploy belongs to exactly one:
+
+| Deploy kind | Publish scope | Example entry |
+|-------------------|-----------------------------|--------------------------|
+| **curator** | unscoped → resolves to `@clerum` | `@clerum/mcp-whois` |
+| **org-bound** | must use `@<your-org>/...` | `@acme/mcp-whois` |
+
+The deploy's org is decided when it's provisioned:
+
+- **Managed deploy** → set by Evenfire directly.
+- **Self-hosted deploy** → goes through the [connect flow](#self-hosted-connect-flow) to bind to an org.
+
+At runtime, `GET /admin/registry/publish-scope` returns `{ curator, orgName, scope }` so the UI knows where new entries will land.
+
+### 2. Connectors & Plugins (entries)
+
+There are **two kinds of entry** you can publish:
+
+| Type | What it is | When it runs | Encoded as |
+|-------------|-------------------------------------------------------------|-------------------------------|---------------------------|
+| **Connector** | An MCP server — a process the agent calls as a tool | At agent runtime | K8s `McpServer` + optional `Secret` |
+| **Plugin** | A WorkflowRecipe — a multi-step workflow / prompt template | At agent runtime via the recipe engine | K8s `WorkflowRecipe` |
+
+Both share the same publish flow, the same catalog entry shape, and the same metadata (name, version, author, description, category, tags, origin, visibility).
+
+### 3. Marketplace
+
+The **Marketplace** is the catalog surface — what every authenticated admin in your deploy sees.
+
+- **Browse** — `/marketplace`. Search/filter by category, mode, transport. Shows public entries from every org.
+- **Install** — `/marketplace/install`. Pick an entry, supply credentials if the entry has a credential schema, hit `POST /admin/registry/install` (or `/install-recipe` for plugins). control-api materializes the K8s resource and tags it with `clerum.io/catalog-id` annotations.
+- **Detail** — `/marketplace/entries/[name]/[version]`. View metadata, version history, install instructions.
+- **Manage API keys** — `/marketplace/keys`. Generate `efrk_...` keys for CI publishing.
+- **Connect** — `/marketplace/connect`. Self-hosted deploys only — bind your deploy to an org.
+
+### 4. Publisher
+
+The **Publisher** is the *owner-only* surface. Once your deploy is org-bound, a "Publisher" entry appears in the sidebar with three tabs:
+
+- **Published entries** (`/publisher/entries`) — your org's entries. Expand a row to share it with another org (cross-org grant).
+- **Docker credentials** (`/publisher/credentials`) — mint a `efrk_` API key + docker config so CI can `docker push` images for local-mode connectors.
+- **Shared with me** (`/publisher/shared-with-me`) — entries other orgs have granted to yours.
+
+The whole surface is hidden in the sidebar if your deploy isn't org-bound, or if `CONTROL_API_PUBLISHER_UI_ENABLED=false`.
+
+### 5. Grants
+
+**Grants** are how a private entry from one org becomes installable in another org. They're not a separate UI surface — they live inside the Publisher:
+
+- Outbound grants live on each row in `/publisher/entries` (Share access panel).
+- Inbound grants live in `/publisher/shared-with-me`.
+
+A grant does **not** copy the entry — it adds the grantee org to the entry's allowed-installer list at the registry.
+
+## How the Pieces Connect
+
+### Publish flow (org-bound admin publishing a new connector)
+
+```
+┌──────────────┐ 1. Open /marketplace/publish
+│ Admin (you) │ ──────────────────────────────────┐
+└──────────────┘ ▼
+ ┌────────────────────────────┐
+ │ PublishToRegistryForm │
+ │ (4-step wizard) │
+ │ │
+ │ Step 0 — type + name │
+ │ Step 1 — metadata │
+ │ Step 2 — package │
+ │ Step 3 — review │
+ └─────────────┬──────────────┘
+ │ 2. POST /admin/registry/entries
+ ▼
+ ┌────────────────────────────┐
+ │ control-api │
+ │ routes/admin/registry.ts │
+ │ │
+ │ • resolvePublishScope() │
+ │ • applyPublishScope() │
+ │ prefixes @<org>/... │
+ │ • checkEvenfireImageRef() │
+ │ • validateRemoteUrl() │
+ └─────────────┬──────────────┘
+ │ 3. POST /entries (OAuth2)
+ ▼
+ ┌────────────────────────────┐
+ │ Registry │
+ │ creates @org/entry v1.0.0 │
+ └────────────────────────────┘
+```
+
+The entry now appears in your `/publisher/entries` tab and (if visibility = `public`) in the public `/marketplace` catalog.
+
+### Install flow (someone installing your entry)
+
+```
+Browse /marketplace
+ │
+ ▼
+Click "Install" on @org/entry
+ │
+ ▼
+RegistryInstallForm (or modal)
+ • Enter credentials (if connector has a credential schema)
+ • Configure server mode / transport / port / egress allowlist
+ │
+ ▼
+POST /admin/registry/install
+ │
+ ▼
+control-api installs in K8s:
+ 1. Secret (if credentials provided)
+ 2. McpServer (or WorkflowRecipe)
+ 3. HostContext allowlist update
+ 4. report-install → Registry (fire-and-forget)
+ │
+ ▼
+MCP server is now available to agents.
+```
+
+### Cross-org grant flow (sharing a private entry)
+
+```
+Owner org Registry Grantee org
+ │ │ │
+ │ POST /grants (slug) │ │
+ ├─────────────────────────►│ │
+ │ │ │
+ │ │ entry visible in │
+ │ │ ─────────────────────►│ /publisher/shared-with-me
+ │ │ │
+ │ │ grantee installs │
+ │ ◄────────────────────────┼───────────────────────┤ POST /install
+ │ │ │
+```
+
+Revoke = `DELETE /admin/registry/grants/:id`.
+
+### Docker push credential flow (CI publishing images for local-mode connectors)
+
+```
+Owner clicks "Generate push credential" in /publisher/credentials
+ │
+ ▼
+POST /admin/registry/keys
+ │
+ ▼
+control-api:
+ • require active admin + non-null orgName
+ • mint RS256 identity voucher (registryVoucher.ts)
+ • exchange voucher for user token (orgApiKeyClient.ts)
+ • POST /org/:org/keys to registry
+ │
+ ▼
+Registry returns { key: "efrk_xxx", dockerconfigjson, registry }
+ │
+ ▼
+Modal reveals key + docker snippets (shown ONCE):
+ docker login registry.evenfire.ai -u <org> -p efrk_xxx
+ docker push registry.evenfire.ai/<org>/<name>:<tag>
+```
+
+### Self-hosted connect flow
+
+```
+Admin → /marketplace/connect
+ │ enter requested_org_name + contact_email
+ ▼
+POST /admin/registry/connect/request
+ │ control-api:
+ │ • generate RSA keypair (persisted in registry_connection table)
+ │ • sign PoP with private key (registryPopSigner.ts)
+ │ • POST /deployments/register to registry
+ │ • store row as status='pending'
+ ▼
+Status: polls /admin/registry/connect until 'approved'
+ │ operator at Evenfire approves
+ ▼
+Admin pastes claim token → POST /admin/registry/connect/claim
+ │ control-api stores client_id + client_secret (AES-256-GCM)
+ ▼
+Status: 'connected'
+ │ all subsequent registry calls use the stored OAuth2 creds
+```
+
+## Access Control Layers
+
+The publisher feature has **5 stacked gates**. All must pass.
+
+```
+Layer 1: UI sidebar visibility
+ isPublisherEnabled(scope)
+ → requires org-bound, non-curator, publisherUiEnabled=true
+ │
+ ▼
+Layer 2: control-ui session (JWT in HttpOnly cookie)
+ │
+ ▼
+Layer 3: Registry org-ownership
+ → registry returns 403 if caller isn't the org owner
+ → surfaced as 403 to admin with the org name
+ │
+ ▼
+Layer 4: Publish-scope apply
+ → org-bound deploys MUST publish to @<org>/...
+ │
+ ▼
+Layer 5: ImageRef == entryName parity
+ → evenfire-hosted local connectors must have
+ imageRef matching the entry name (else pull will fail)
+```
+
+A **curator deploy** never sees the Publisher surface because `isPublisherEnabled` returns false for curator scope. A **self-hosted deploy** without a successful `connect` flow has no org at all and also gets nothing.
+
+## Naming Conventions
+
+| Surface | Path | Who | Purpose |
+|---------------|---------------------------------------|-----------------|------------------------------------|
+| Publisher | `/publisher/*` | Org owner only | Manage your org's entries |
+| Marketplace | `/marketplace/*` (alias `/registry/*`)| All admins | Browse, install, publish |
+
+| Entry type | Prefix | Example |
+|------------------------|---------------------|------------------------|
+| Public catalog (curator) | `@clerum/...` | `@clerum/mcp-whois` |
+| Your org | `@<your-org>/...` | `@acme/mcp-whois` |
+
+| Resource kind | Where it lands |
+|------------------|-----------------------------------------------|
+| Connector | K8s `McpServer` + optional `Secret` |
+| Plugin | K8s `WorkflowRecipe` |
+
+## Where the Code Lives
+
+```
+control-ui/ frontend
+ app/publisher/ owner UI
+ app/registry/ (= /marketplace) marketplace UI
+ components/PublisherView/ publisher panels
+ components/PublishToRegistryForm.tsx publish wizard
+ components/RegistryCatalog.tsx marketplace browse
+ components/RegistryInstallForm/ install modal
+ components/RegistryApiKeysPanel.tsx efrk_ keys panel
+ components/RegistryConnectPanel.tsx self-host connect
+ lib/hooks/usePublishScope.ts publisher UI gate
+
+control-api/src/routes/admin/ backend (BFF)
+ registry.ts (~2414 lines, all HTTP routes)
+ registryConnect.ts (self-hosted connect flow)
+
+control-api/src/services/ backend logic
+ registryClient.ts OAuth2 + scope + cache
+ registryVoucher.ts RS256 identity voucher minter
+ registryPopSigner.ts RS256 PoP signer for connect
+ orgApiKeyClient.ts voucher → user token + efrk_ keys
+ registryConnectionDb.ts self-host connect persistence
+ registryConnectionSchema.ts registry_connection migration
+```
+
+## Glossary
+
+- **Org** — tenancy. Namespaces entries. Curator = `@clerum`; otherwise = `@<your-org>`.
+- **Entry** — anything in the catalog. Either a Connector or a Plugin.
+- **Connector** — entry that materializes as an `McpServer` (a tool process the agent calls).
+- **Plugin** — entry that materializes as a `WorkflowRecipe` (a multi-step workflow).
+- **Visibility** — `public` (anyone sees it in the catalog) or `private` (only your org + grantees).
+- **Scope** — the resolved `{curator, orgName}` returned by the registry's `whoami`.
+- **Voucher** — short-lived RS256 JWT proving this deploy's identity to the registry.
+- **PoP** — Proof-of-Possession (RS256 signature on each request, bound to the key).
+- **efrk_** — prefix on user-mintable API keys for CI publishing.
+- **Curator deploy** — Evenfire's own managed deploy; publishes to `@clerum`.
+- **Self-hosted deploy** — your own deployment; goes through the connect flow to bind to an org.