Skip to content

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

TypeScript

fix: feedback from the AI

Miguelon Peluchonc9e396cb5258
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.css
index 88edcf83a..c06c28597 100644
--- a/control-ui/app/globals.css
+++ b/control-ui/app/globals.css
@@ -46,6 +46,7 @@
--cu-selection-text: #ffffff;
--cu-radius: 12px;
--cu-radius-sm: 8px;
+ --cu-radius-pill: 999px;
--cu-space-1: 0.35rem;
--cu-space-2: 0.5rem;
--cu-space-3: 0.75rem;
@@ -267,7 +268,7 @@ body.cu-body {
.cu-connector-credentials-form {
display: grid;
- gap: 0.75rem;
+ gap: var(--cu-space-3);
}
.cu-form-grid {
@@ -1468,7 +1469,7 @@ textarea.cu-input {
right: auto;
z-index: 60;
width: max-content;
- max-width: calc(100vw - 1rem);
+ max-width: calc(100vw - var(--cu-space-4));
}
.cu-kebab__item {
@@ -1679,7 +1680,7 @@ textarea.cu-input {
}
.cu-marketplace-tabs {
- margin-inline-start: 1rem;
+ margin-inline-start: var(--cu-space-4);
}
.cu-table-wrap {
@@ -1954,9 +1955,9 @@ textarea.cu-input {
}
.cu-connector-detail .cu-expandable-detail__fields {
- flex: 0 1 45rem;
+ flex: 1 1 auto;
width: 100%;
- max-width: 45rem;
+ max-width: none;
}
.cu-connector-detail .cu-expandable-detail__description {
@@ -1973,7 +1974,72 @@ textarea.cu-input {
.cu-connector-detail .cu-expandable-field > .cu-link {
max-width: 100%;
- overflow-wrap: anywhere;
+}
+
+.cu-connector-detail__metadata {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
+ flex: 0 0 100%;
+ gap: var(--cu-space-4);
+ min-width: 0;
+}
+
+.cu-connector-copyable-value {
+ display: flex;
+ align-items: center;
+ gap: var(--cu-space-1);
+ width: 100%;
+ min-width: 0;
+}
+
+.cu-connector-copyable-value > .cu-expandable-field__code {
+ display: block;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.cu-connector-copyable-value__button {
+ width: 1.75rem;
+ height: 1.75rem;
+ flex: 0 0 auto;
+}
+
+.cu-connector-access-field {
+ gap: var(--cu-space-2);
+}
+
+.cu-connector-access-grid {
+ width: 100%;
+ grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
+}
+
+.cu-connector-context-access__list li {
+ align-items: center;
+}
+
+.cu-connector-context-access__name {
+ flex: 1 1 auto;
+}
+
+.cu-connector-context-access__name > .cu-link {
+ display: block;
+ max-width: 100%;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.cu-connector-context-access__remove {
+ width: var(--cu-space-5);
+ height: var(--cu-space-5);
+ flex: 0 0 auto;
+}
+
+.cu-connector-context-access__add {
+ width: 100%;
+ margin-top: auto;
}
.cu-expandable-detail__fields {
@@ -2057,8 +2123,8 @@ textarea.cu-input {
}
.cu-context-connector-bindings__tag .cu-btn--icon {
- width: 1.25rem;
- height: 1.25rem;
+ width: var(--cu-space-5);
+ height: var(--cu-space-5);
}
.cu-context-connector-bindings__hint {
@@ -2511,6 +2577,20 @@ textarea.cu-input {
max-width: 100%;
}
+.cu-registry-install-entry-heading {
+ justify-content: flex-start;
+}
+
+.cu-registry-install-entry-description,
+.cu-registry-install-egress-detail {
+ margin-top: var(--cu-space-2);
+}
+
+.cu-registry-install-validation-list {
+ margin: var(--cu-space-2) 0 0;
+ padding-left: var(--cu-space-5);
+}
+
.cu-registry-context-access {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
@@ -2523,7 +2603,7 @@ textarea.cu-input {
.cu-registry-context-access__intro {
display: grid;
- gap: 0.15rem;
+ gap: calc(var(--cu-space-1) / 2);
margin-top: var(--cu-space-1);
}
@@ -2553,8 +2633,7 @@ textarea.cu-input {
border: 1px solid var(--cu-border-subtle);
border-radius: var(--cu-radius-sm);
background:
- linear-gradient(145deg, rgba(var(--cu-accent-rgb), 0.09), transparent 52%),
- var(--cu-surface);
+ linear-gradient(145deg, rgba(var(--cu-accent-rgb), 0.09), transparent 52%), var(--cu-surface);
overflow: hidden;
}
@@ -2570,8 +2649,7 @@ textarea.cu-input {
.cu-registry-context-access__group[data-kind='teams'] {
background:
- linear-gradient(145deg, rgba(var(--cu-success-rgb), 0.1), transparent 52%),
- var(--cu-surface);
+ linear-gradient(145deg, rgba(var(--cu-success-rgb), 0.1), transparent 52%), var(--cu-surface);
}
.cu-registry-context-access__group[data-kind='teams']::before {
@@ -2580,8 +2658,7 @@ textarea.cu-input {
.cu-registry-context-access__group[data-kind='agents'] {
background:
- linear-gradient(145deg, rgba(var(--cu-warning-rgb), 0.1), transparent 52%),
- var(--cu-surface);
+ linear-gradient(145deg, rgba(var(--cu-warning-rgb), 0.1), transparent 52%), var(--cu-surface);
}
.cu-registry-context-access__group[data-kind='agents']::before {
@@ -2607,11 +2684,11 @@ textarea.cu-input {
.cu-registry-context-access__heading span {
display: inline-grid;
place-items: center;
- min-width: 1.5rem;
- min-height: 1.5rem;
- padding: 0.1rem 0.4rem;
+ min-width: calc(var(--cu-space-3) * 2);
+ min-height: calc(var(--cu-space-3) * 2);
+ padding: calc(var(--cu-space-1) / 3) var(--cu-space-1);
border: 1px solid rgba(var(--cu-accent-rgb), 0.35);
- border-radius: 999px;
+ border-radius: var(--cu-radius-pill);
background: rgba(var(--cu-accent-rgb), 0.14);
color: var(--cu-text-muted);
font-size: 0.75rem;
@@ -2643,15 +2720,15 @@ textarea.cu-input {
.cu-registry-context-access__list li {
display: flex;
align-items: center;
- gap: 0.45rem;
+ gap: var(--cu-space-2);
min-width: 0;
}
.cu-registry-context-access__list li::before {
- width: 0.35rem;
- height: 0.35rem;
+ width: var(--cu-space-1);
+ height: var(--cu-space-1);
flex: 0 0 auto;
- border-radius: 999px;
+ border-radius: var(--cu-radius-pill);
background: rgba(var(--cu-accent-rgb), 0.75);
content: '';
}
@@ -2660,7 +2737,9 @@ textarea.cu-input {
background: rgba(var(--cu-success-rgb), 0.8);
}
-.cu-registry-context-access__group[data-kind='agents'] .cu-registry-context-access__list li::before {
+.cu-registry-context-access__group[data-kind='agents']
+ .cu-registry-context-access__list
+ li::before {
background: rgba(var(--cu-warning-rgb), 0.8);
}
@@ -2683,7 +2762,7 @@ textarea.cu-input {
display: grid;
grid-template-columns: minmax(7rem, 10rem) minmax(0, 1fr);
gap: var(--cu-space-3);
- padding: 0.65rem 0;
+ padding: var(--cu-space-3) 0;
border-top: 1px solid var(--cu-border-subtle);
color: var(--cu-text-soft);
font-size: 0.875rem;
@@ -2706,17 +2785,17 @@ textarea.cu-input {
.cu-modal-panel--install-success {
width: min(27rem, calc(100vw - (var(--cu-space-4) * 2)));
justify-items: center;
- padding: 1.6rem;
+ padding: calc(var(--cu-space-5) + var(--cu-space-1));
text-align: center;
}
.cu-registry-install-success__icon {
display: grid;
place-items: center;
- width: 3.25rem;
- height: 3.25rem;
+ width: calc((var(--cu-space-4) * 2) + var(--cu-space-5));
+ height: calc((var(--cu-space-4) * 2) + var(--cu-space-5));
border: 1px solid rgba(var(--cu-success-rgb), 0.48);
- border-radius: 999px;
+ border-radius: var(--cu-radius-pill);
background: rgba(var(--cu-success-rgb), 0.14);
color: var(--cu-success);
}
@@ -7425,18 +7504,18 @@ textarea.cu-input {
.cu-llm-config__block-toggle:focus-visible {
outline: 2px solid rgba(var(--cu-focus-rgb), 0.8);
outline-offset: 3px;
- border-radius: 4px;
+ border-radius: calc(var(--cu-radius-sm) / 2);
}
.cu-llm-config__block-toggle-title {
display: inline-flex;
align-items: center;
- gap: 0.35rem;
+ gap: var(--cu-space-1);
}
.cu-llm-config__block-toggle svg {
color: var(--cu-text-muted);
- transition: transform 150ms ease;
+ transition: transform var(--cu-control-transition) ease;
}
.cu-llm-config__block-toggle svg.is-expanded {
@@ -10116,12 +10195,12 @@ textarea.cu-input {
.cu-discovery-bar > .cu-tabs {
flex: 0 1 auto;
- margin: 1.25rem 0 1rem;
+ margin: var(--cu-space-5) 0 var(--cu-space-4);
}
.cu-discovery-bar > .cu-discovery-status {
- margin-top: 1.25rem;
- margin-bottom: 1rem;
+ margin-top: var(--cu-space-5);
+ margin-bottom: var(--cu-space-4);
}
.cu-discovery-status {
@@ -10131,7 +10210,7 @@ textarea.cu-input {
flex-wrap: wrap;
justify-content: flex-end;
gap: var(--cu-space-2);
- padding: 0 1rem;
+ padding: 0 var(--cu-space-4);
font-size: 0.8125rem;
color: var(--cu-text-muted);
}
diff --git a/control-ui/app/mcp-servers/[name]/edit/page.tsx b/control-ui/app/mcp-servers/[name]/edit/page.tsx
index 1e81ac3c3..dac10d911 100644
--- a/control-ui/app/mcp-servers/[name]/edit/page.tsx
+++ b/control-ui/app/mcp-servers/[name]/edit/page.tsx
@@ -1,6 +1,6 @@
'use client'
-import React, { useCallback, useEffect, useState } from 'react'
+import React, { useCallback, useEffect, useMemo, useState } from 'react'
import { useParams, useRouter } from 'next/navigation'
import { AuthGate } from '@components/AuthGate'
import { FormSectionsSkeleton } from '@components/BodyLoadingSkeleton'
@@ -62,7 +62,9 @@ function resolveRegistryCredentialSource(
): { name: string; version: string } | undefined {
const labels = (metadata?.labels ?? {}) as Record<string, unknown>
const annotations = (metadata?.annotations ?? {}) as Record<string, unknown>
- const name = String(annotations['clerum.io/catalog-id'] ?? labels['clerum.io/catalog-id'] ?? '').trim()
+ const name = String(
+ annotations['clerum.io/catalog-id'] ?? labels['clerum.io/catalog-id'] ?? ''
+ ).trim()
const version = String(
annotations['clerum.io/catalog-version'] ?? labels['clerum.io/catalog-version'] ?? ''
).trim()
@@ -190,7 +192,9 @@ export default function EditMcpServerPage() {
: [],
})
setContextAccessError(
- failed ? 'Some access information could not be loaded. The lists below may be incomplete.' : ''
+ failed
+ ? 'Some access information could not be loaded. The lists below may be incomplete.'
+ : ''
)
setLoadingContextAccess(false)
})()
@@ -225,7 +229,10 @@ export default function EditMcpServerPage() {
const envSecret = server?.spec
? resolveEnvSecret(server.spec as Record<string, unknown>)
: undefined
- const registryCredentialSource = resolveRegistryCredentialSource(server?.metadata)
+ const registryCredentialSource = useMemo(
+ () => resolveRegistryCredentialSource(server?.metadata),
+ [server?.metadata]
+ )
return (
<AuthGate>
diff --git a/control-ui/app/registry/install/page.tsx b/control-ui/app/registry/install/page.tsx
index 5bf41568f..a1f13f5b7 100644
--- a/control-ui/app/registry/install/page.tsx
+++ b/control-ui/app/registry/install/page.tsx
@@ -342,7 +342,7 @@ function RegistryRecipeInstallPreview({
<div className="cu-card">
<div className="cu-card__body">
- <div className="cu-table-actions" style={{ justifyContent: 'flex-start' }}>
+ <div className="cu-table-actions cu-registry-install-entry-heading">
<strong>
{entry.name} v{entry.version}
</strong>
@@ -354,7 +354,7 @@ function RegistryRecipeInstallPreview({
</span>
) : null}
</div>
- <p className="cu-muted" style={{ margin: '6px 0 0' }}>
+ <p className="cu-muted cu-registry-install-entry-description">
{entry.description}
</p>
</div>
@@ -420,7 +420,7 @@ function RegistryRecipeInstallPreview({
{validationErrors.length > 0 ? (
<div className="cu-banner cu-banner--error" role="alert">
This Marketplace recipe cannot be installed until its manifest validates.
- <ul style={{ margin: '6px 0 0 18px' }}>
+ <ul className="cu-registry-install-validation-list">
{validationErrors.slice(0, 5).map(issue => (
<li key={`${issue.path}-${issue.message}`}>
{issue.path}: {issue.message}
@@ -497,11 +497,11 @@ function RegistryRecipeInstallPreview({
}
>
<strong>{finding.label}</strong>: {finding.message}
- <div style={{ marginTop: 4 }}>
+ <div className="cu-registry-install-egress-detail">
Bindings: {finding.bindingCount}. Mode: {finding.mode}.
</div>
{finding.targets && finding.targets.length > 0 ? (
- <div style={{ marginTop: 4 }}>
+ <div className="cu-registry-install-egress-detail">
Hosts: {finding.targets.join(', ')}
{finding.ports && finding.ports.length > 0
? ` · Ports: ${finding.ports.join(', ')}`
diff --git a/control-ui/app/secrets/new/page.tsx b/control-ui/app/secrets/new/page.tsx
index 093c581ee..ae38b3010 100644
--- a/control-ui/app/secrets/new/page.tsx
+++ b/control-ui/app/secrets/new/page.tsx
@@ -25,13 +25,17 @@ import {
getRegistryCredentialSchema,
} from '@lib/api'
import { createEmptyLlmKeyDraft, validateLlmSecretData } from '@lib/llm'
+import {
+ areRequiredCredentialRowsComplete,
+ reconcileCredentialRows,
+} from '@lib/registryCredentialDraft'
+import type { CredentialDraftRow } from '@lib/registryCredentialDraft.types'
const HOST_SECRET_LABEL_KEY = 'clerum.io/host-secret'
const HOST_SECRET_LABEL_VALUE = 'true'
const MCP_SECRET_NAME_PATTERN = /^[a-z0-9]([-a-z0-9]*[a-z0-9])?$/
type SecretScope = 'llm' | 'mcp' | 'recipe'
-type SecretDraftRow = { id: string; secretKey: string; value: string; label?: string }
const STEPS = ['Secret', 'Values'] as const
@@ -48,7 +52,12 @@ const STEP_DETAILS = [
},
] as const
-function createSecretDraftRow(id: string, secretKey = '', value = '', label?: string): SecretDraftRow {
+function createSecretDraftRow(
+ id: string,
+ secretKey = '',
+ value = '',
+ label?: string
+): CredentialDraftRow {
return { id, secretKey, value, label }
}
@@ -78,7 +87,7 @@ function CreateSecretPageContent() {
const registryEntryVersion =
scope === 'mcp' ? (searchParams.get('registryVersion') ?? '').trim() : ''
const [mcpName, setMcpName] = useState(prefillMcpName)
- const [mcpRows, setMcpRows] = useState<SecretDraftRow[]>(() => [
+ const [mcpRows, setMcpRows] = useState<CredentialDraftRow[]>(() => [
createSecretDraftRow('mcp-secret-row-0'),
])
const mcpNextRowId = useRef(1)
@@ -98,7 +107,7 @@ function CreateSecretPageContent() {
}, [scope, searchParams])
const [recipeName, setRecipeName] = useState(prefillRecipeName)
- const [recipeRows, setRecipeRows] = useState<SecretDraftRow[]>(
+ const [recipeRows, setRecipeRows] = useState<CredentialDraftRow[]>(
prefillRecipeKeys.length > 0
? prefillRecipeKeys.map((key, index) =>
createSecretDraftRow(`recipe-secret-row-${index}`, key)
@@ -159,12 +168,7 @@ function CreateSecretPageContent() {
if (cancelled) return
setMcpCredentialSchema(schema)
if (schema.keys.length === 0) return
- setMcpRows(current => {
- if (current.some(row => row.secretKey.trim() || row.value.trim())) return current
- return schema.keys.map((key, index) =>
- createSecretDraftRow(`mcp-schema-row-${index}`, key.name, '', key.label || key.name)
- )
- })
+ setMcpRows(current => reconcileCredentialRows(current, schema.keys))
})
.catch(() => {
if (!cancelled) setMcpCredentialSchema(null)
@@ -191,8 +195,7 @@ function CreateSecretPageContent() {
)
const schemaComplete =
!mcpCredentialSchema?.required ||
- mcpRows.length === mcpCredentialSchema.keys.length &&
- mcpRows.every(row => row.secretKey.trim().length > 0 && row.value.trim().length > 0)
+ areRequiredCredentialRowsComplete(mcpRows, mcpCredentialSchema.keys)
return hasValues && schemaComplete && !saving
}, [mcpCredentialSchema, mcpName, mcpRows, saving])
@@ -507,8 +510,13 @@ function CreateSecretPageContent() {
) : mcpCredentialSchema?.keys.length ? (
<div className="cu-form-stack">
{mcpRows.map((row, index) => (
- <Field key={row.id} label={row.label || row.secretKey}>
+ <Field
+ key={row.id}
+ htmlFor={`${row.id}-value`}
+ label={row.label || row.secretKey}
+ >
<TextInput
+ id={`${row.id}-value`}
value={row.value}
onChange={event =>
updateMcpDraftRow(index, 'value', event.target.value)
diff --git a/control-ui/components/CreateApiKeyModal.tsx b/control-ui/components/CreateApiKeyModal.tsx
index d3bf060ad..0ec26d441 100644
--- a/control-ui/components/CreateApiKeyModal.tsx
+++ b/control-ui/components/CreateApiKeyModal.tsx
@@ -1,18 +1,9 @@
-// control-ui/components/CreateApiKeyModal.tsx
'use client'
import { useEffect, useMemo, useRef, useState } from 'react'
import type { CreateRegistryApiKeyInput } from '../lib/api'
import { Button, CheckboxField, Field, TextInput } from './ui'
-// control-ui/components/CreateApiKeyModal.tsx
-
-// control-ui/components/CreateApiKeyModal.tsx
-
-// control-ui/components/CreateApiKeyModal.tsx
-
-// control-ui/components/CreateApiKeyModal.tsx
-
const SCOPES: { id: string; label: string; help: string; danger?: boolean }[] = [
{ id: 'registry:read', label: 'read', help: 'View org entries' },
{ id: 'registry:publish', label: 'publish', help: 'Publish new versions to @org/*' },
diff --git a/control-ui/components/HostWizard/index.tsx b/control-ui/components/HostWizard/index.tsx
index 92a42f83a..cc231216d 100644
--- a/control-ui/components/HostWizard/index.tsx
+++ b/control-ui/components/HostWizard/index.tsx
@@ -391,7 +391,7 @@ export function HostWizard({
meta: `${secret.metadata?.namespace || HOST_NAMESPACE} · ${providerSummary}`,
}
})
- .filter((option): option is WizardSelectOption => option !== null)
+ .filter(option => option !== null)
.sort((left, right) => left.value.localeCompare(right.value)),
[existingSecrets]
)
diff --git a/control-ui/components/LlmDiscoveryPanel/index.tsx b/control-ui/components/LlmDiscoveryPanel/index.tsx
index e8e64433e..56f781647 100644
--- a/control-ui/components/LlmDiscoveryPanel/index.tsx
+++ b/control-ui/components/LlmDiscoveryPanel/index.tsx
@@ -19,6 +19,7 @@ import {
updateLlmModel,
} from '@lib/api'
import { formatContextWindow, getProviderDisplayLabel } from '@lib/llm'
+import { type SortDirection, TableSortHeader, compareNullsLast, toggleSort } from '@lib/tableSort'
import type { LlmDiscoveryPanelProps } from './types'
const CONFIGMAP_DEFERRED_WARNING =
@@ -35,7 +36,6 @@ type ProviderGroupRowProps = {
}
type ReviewSortKey = 'model' | 'vendor' | 'contextWindow'
-type SortDirection = 'asc' | 'desc'
// Numeric columns lead descending (largest context window first); text columns
// lead ascending (alphabetical). Picking a different column resets to that
@@ -59,19 +59,6 @@ function compareReviewByKey(key: ReviewSortKey) {
}
}
-// Null / undefined values always trail known values regardless of sort
-// direction. They represent missing data, not a value at either extreme, so
-// flipping asc/desc must not move them.
-function compareNullsLast(
- aValue: number | null | undefined,
- bValue: number | null | undefined
-): number | null {
- if (aValue == null && bValue == null) return 0
- if (aValue == null) return 1
- if (bValue == null) return -1
- return null
-}
-
function compareReviewModel(a: LlmAllowedModel, b: LlmAllowedModel): number {
return a.model.localeCompare(b.model)
}
@@ -357,39 +344,18 @@ export function LlmDiscoveryPanel({
showToast(message, { tone: 'error' })
}
- function toggleSort(key: ReviewSortKey) {
- if (sortKey === key) {
- setSortDir(prev => (prev === 'asc' ? 'desc' : 'asc'))
- return
- }
- setSortKey(key)
- setSortDir(REVIEW_SORT_DEFAULT_DIR[key])
- }
-
- function renderSortHeader(key: ReviewSortKey, label: string) {
- const isActive = sortKey === key
- const indicator = isActive ? (sortDir === 'asc' ? '↑' : '↓') : ''
- const nextDirectionLabel = isActive
- ? sortDir === 'asc'
- ? 'descending'
- : 'ascending'
- : REVIEW_SORT_DEFAULT_DIR[key] === 'asc'
- ? 'ascending'
- : 'descending'
- const buttonLabel = `${label}${indicator ? ` ${indicator}` : ''}`
- const ariaLabel = `Sort by ${label.toLowerCase()} ${nextDirectionLabel}`
- return (
- <button
- type="button"
- className={`cu-link cu-link--sm cu-table__sort-link${isActive ? ' is-active' : ''}`}
- onClick={() => toggleSort(key)}
- aria-label={ariaLabel}
- aria-pressed={isActive}
- >
- {buttonLabel}
- </button>
- )
- }
+ const renderSortHeader = (key: ReviewSortKey, label: string) => (
+ <TableSortHeader
+ activeKey={sortKey}
+ defaultDirections={REVIEW_SORT_DEFAULT_DIR}
+ direction={sortDir}
+ label={label}
+ onSort={nextKey =>
+ toggleSort(nextKey, sortKey, REVIEW_SORT_DEFAULT_DIR, setSortKey, setSortDir)
+ }
+ sortKey={key}
+ />
+ )
const reviewColumns: TableHeaderColumn[] = [
{
diff --git a/control-ui/components/LlmModelTable.tsx b/control-ui/components/LlmModelTable.tsx
index 34b8cd0a6..eb46ef7ff 100644
--- a/control-ui/components/LlmModelTable.tsx
+++ b/control-ui/components/LlmModelTable.tsx
@@ -4,6 +4,7 @@ import React, { useEffect, useMemo, useState } from 'react'
import type { LlmAllowedModel } from '@lib/api'
import { formatContextWindow, getProviderDisplayLabel } from '@lib/llm'
import { isUnpricedAllowedModel } from '@lib/llmModelUnpriced'
+import { type SortDirection, TableSortHeader, compareNullsLast, toggleSort } from '@lib/tableSort'
import { FilterSelect } from './FilterSelect'
import type { LlmModelTableProps } from './LlmModelTable.types'
import { LlmProviderIcon } from './LlmProviderIcon'
@@ -18,7 +19,6 @@ import { IconChevronRight, IconPencil, IconRefresh, IconX } from './icons'
import { SelectInput } from './ui'
type ModelSortKey = 'model' | 'vendor' | 'displayName' | 'contextWindow'
-type SortDirection = 'asc' | 'desc'
// Natural default direction per column: numeric columns read best descending
// (largest context window first); text columns read best ascending.
@@ -44,19 +44,6 @@ function compareModelByKey(key: ModelSortKey) {
}
}
-// Null / undefined values always trail known values regardless of sort
-// direction. They represent missing data, not a value at either extreme, so
-// flipping asc/desc must not move them.
-function compareNullsLast(
- aValue: number | null | undefined,
- bValue: number | null | undefined
-): number | null {
- if (aValue == null && bValue == null) return 0
- if (aValue == null) return 1
- if (bValue == null) return -1
- return null
-}
-
function compareModel(a: LlmAllowedModel, b: LlmAllowedModel): number {
return a.model.localeCompare(b.model)
}
@@ -214,39 +201,18 @@ export function LlmModelTable({
})
}
- function toggleSort(key: ModelSortKey) {
- if (sortKey === key) {
- setSortDir(prev => (prev === 'asc' ? 'desc' : 'asc'))
- return
- }
- setSortKey(key)
- setSortDir(MODEL_SORT_DEFAULT_DIR[key])
- }
-
- function renderSortHeader(key: ModelSortKey, label: string) {
- const isActive = sortKey === key
- const indicator = isActive ? (sortDir === 'asc' ? '↑' : '↓') : ''
- const nextDirectionLabel = isActive
- ? sortDir === 'asc'
- ? 'descending'
- : 'ascending'
- : MODEL_SORT_DEFAULT_DIR[key] === 'asc'
- ? 'ascending'
- : 'descending'
- const buttonLabel = `${label}${indicator ? ` ${indicator}` : ''}`
- const ariaLabel = `Sort by ${label.toLowerCase()} ${nextDirectionLabel}`
- return (
- <button
- type="button"
- className={`cu-link cu-link--sm cu-table__sort-link${isActive ? ' is-active' : ''}`}
- onClick={() => toggleSort(key)}
- aria-label={ariaLabel}
- aria-pressed={isActive}
- >
- {buttonLabel}
- </button>
- )
- }
+ const renderSortHeader = (key: ModelSortKey, label: string) => (
+ <TableSortHeader
+ activeKey={sortKey}
+ defaultDirections={MODEL_SORT_DEFAULT_DIR}
+ direction={sortDir}
+ label={label}
+ onSort={nextKey =>
+ toggleSort(nextKey, sortKey, MODEL_SORT_DEFAULT_DIR, setSortKey, setSortDir)
+ }
+ sortKey={key}
+ />
+ )
const modelColumns: TableHeaderColumn[] = [
{ key: 'model', label: renderSortHeader('model', 'Model'), minWidth: '15rem' },
diff --git a/control-ui/components/McpServerTable.tsx b/control-ui/components/McpServerTable.tsx
index bc750e2ae..2e61e62c9 100644
--- a/control-ui/components/McpServerTable.tsx
+++ b/control-ui/components/McpServerTable.tsx
@@ -1,13 +1,14 @@
'use client'
import React, { Fragment, useMemo, useState } from 'react'
+import { copyTextToClipboard } from '../lib/clipboard'
import type {
ConnectorAccessSummary,
ConnectorContextBinding,
McpServerStatus,
McpServerTableProps,
} from './McpServerTable.types'
-import { type RowAction, RowActionsMenu } from './RowActionsMenu'
+import { RowActionsMenu } from './RowActionsMenu'
import { SectionSearchInput } from './SectionSearchInput'
import { SelectionDropdown } from './SelectionDropdown'
import { IconCable } from './Sidebar/icons'
@@ -15,7 +16,7 @@ import { SkeletonTableRows } from './SkeletonTableRows'
import { TableHeaderRow } from './TableHeaderRow'
import type { TableHeaderColumn } from './TableHeaderRow/types'
import { TablePanelHeader } from './TablePanelHeader'
-import { IconChevronRight, IconPencil, IconRefresh, IconX } from './icons'
+import { IconChevronRight, IconCopy, IconPencil, IconRefresh, IconX } from './icons'
const ENABLED_TOOLTIP = 'Enabled controls whether this server is available to contexts and agents.'
type ConnectorSortKey = 'name' | 'enabled' | 'status'
@@ -87,30 +88,182 @@ function StatusBadge({ status }: { status?: McpServerStatus }) {
)
}
+function middleEllipsis(value: string, maxLength = 26): string {
+ if (value.length <= maxLength) return value
+ const visibleLength = maxLength - 3
+ const startLength = Math.ceil(visibleLength * 0.56)
+ return `${value.slice(0, startLength)}...${value.slice(-(visibleLength - startLength))}`
+}
+
function AccessSummary({ summary }: { summary?: ConnectorAccessSummary }) {
const groups = [
- { label: 'Agent', items: summary?.agents ?? [] },
- { label: 'User', items: summary?.users ?? [] },
- { label: 'Team', items: summary?.teams ?? [] },
+ { key: 'agents', label: 'Agents', items: summary?.agents ?? [] },
+ { key: 'teams', label: 'Teams', items: summary?.teams ?? [] },
+ { key: 'users', label: 'Users', items: summary?.users ?? [] },
]
- const hasAccess = groups.some(group => group.items.length > 0)
- if (!hasAccess) return <span className="cu-muted">No access assigned</span>
+ return (
+ <>
+ {groups.map(group => (
+ <section
+ className="cu-registry-context-access__group"
+ data-kind={group.key}
+ key={group.key}
+ >
+ <div className="cu-registry-context-access__heading">
+ <h4>{group.label}</h4>
+ <span>{group.items.length}</span>
+ </div>
+ {group.items.length > 0 ? (
+ <ul className="cu-registry-context-access__list">
+ {group.items.map(principal => (
+ <li key={principal.id} title={principal.label}>
+ <span>{principal.label}</span>
+ </li>
+ ))}
+ </ul>
+ ) : (
+ <p className="cu-muted">No {group.label.toLowerCase()} have access.</p>
+ )}
+ </section>
+ ))}
+ </>
+ )
+}
+
+function ConnectorContexts({
+ connectorName,
+ namespace,
+ contextRef,
+ contexts,
+ busy,
+ onOpenContext,
+ onAdd,
+ onRemove,
+}: {
+ connectorName: string
+ namespace: string
+ contextRef: string
+ contexts: ConnectorContextBinding[]
+ busy: boolean
+ onOpenContext?: (contextName: string) => void
+ onAdd?: () => void
+ onRemove?: McpServerTableProps['onRemoveFromContext']
+}) {
+ const assignedNames = new Set(contexts.map(context => context.name))
+ const linkedContexts = [
+ ...(contextRef
+ ? [
+ {
+ name: contextRef,
+ removable: assignedNames.has(contextRef),
+ },
+ ]
+ : []),
+ ...contexts
+ .filter(context => context.name !== contextRef)
+ .map(context => ({ name: context.name, removable: true })),
+ ]
return (
- <div className="cu-expandable-tags">
- {groups.flatMap(group =>
- group.items.map(principal => (
- <span
- key={`${group.label}-${principal.id}`}
- className="cu-registry-tag"
- title={`${group.label}: ${principal.label}`}
- >
- {principal.label}
- </span>
- ))
+ <section className="cu-registry-context-access__group" data-kind="contexts">
+ <div className="cu-registry-context-access__heading">
+ <h4>Contexts</h4>
+ <span>{linkedContexts.length}</span>
+ </div>
+ {linkedContexts.length > 0 ? (
+ <ul className="cu-registry-context-access__list cu-connector-context-access__list">
+ {linkedContexts.map(context => (
+ <li key={context.name}>
+ <span className="cu-connector-context-access__name" title={context.name}>
+ {onOpenContext ? (
+ <button
+ type="button"
+ className="cu-link"
+ onClick={() => onOpenContext(context.name)}
+ >
+ {context.name}
+ </button>
+ ) : (
+ context.name
+ )}
+ </span>
+ {context.removable && onRemove ? (
+ <button
+ type="button"
+ className="cu-btn cu-btn--icon cu-btn--danger-icon cu-connector-context-access__remove"
+ disabled={busy}
+ aria-label={`Remove connector ${connectorName} from context ${context.name}`}
+ title={`Remove from ${context.name}`}
+ onClick={() => void onRemove({ namespace, name: connectorName }, context.name)}
+ >
+ <IconX width={14} height={14} />
+ </button>
+ ) : null}
+ </li>
+ ))}
+ </ul>
+ ) : (
+ <p className="cu-muted">No contexts linked.</p>
)}
- </div>
+ {onAdd ? (
+ <button
+ type="button"
+ className="cu-btn cu-btn--secondary cu-btn--sm cu-connector-context-access__add"
+ disabled={busy}
+ onClick={onAdd}
+ >
+ Add contexts
+ </button>
+ ) : null}
+ </section>
+ )
+}
+
+function CopyableValue({
+ copyKey,
+ copyLabel,
+ value,
+ copied,
+ onCopy,
+ href,
+}: {
+ copyKey: string
+ copyLabel: string
+ value: string
+ copied: boolean
+ onCopy: (copyKey: string, value: string) => void
+ href?: string
+}) {
+ if (!value) return <span className="cu-muted">—</span>
+
+ return (
+ <span className="cu-connector-copyable-value">
+ {href ? (
+ <a
+ className="cu-link cu-expandable-field__code"
+ href={href}
+ target="_blank"
+ rel="noreferrer"
+ title={value}
+ >
+ {middleEllipsis(value)}
+ </a>
+ ) : (
+ <span className="cu-expandable-field__code" title={value}>
+ {middleEllipsis(value)}
+ </span>
+ )}
+ <button
+ type="button"
+ className="cu-btn cu-btn--icon cu-btn--ghost cu-connector-copyable-value__button"
+ onClick={() => onCopy(copyKey, value)}
+ aria-label={copied ? `${copyLabel} copied` : `Copy ${copyLabel}`}
+ title={copied ? 'Copied' : `Copy ${copyLabel}`}
+ >
+ <IconCopy width={14} height={14} />
+ </button>
+ </span>
)
}
@@ -138,6 +291,7 @@ export function McpServerTable({
const [expandedKeys, setExpandedKeys] = useState<Set<string>>(new Set())
const [serverKeyAddingContexts, setServerKeyAddingContexts] = useState<string | null>(null)
const [selectedContextNamesToAdd, setSelectedContextNamesToAdd] = useState<string[]>([])
+ const [copiedValueKey, setCopiedValueKey] = useState<string | null>(null)
const rows = useMemo(
() =>
items.map(item => {
@@ -259,6 +413,10 @@ export function McpServerTable({
setServerKeyAddingContexts(null)
}
+ async function copyValue(copyKey: string, value: string) {
+ if (await copyTextToClipboard(value)) setCopiedValueKey(copyKey)
+ }
+
const isInitialLoad = loading && items.length === 0
return (
@@ -437,108 +595,55 @@ export function McpServerTable({
<p className="cu-expandable-detail__description">
{spec.description || 'No description provided.'}
</p>
- <div className="cu-expandable-field">
- <span className="cu-expandable-field__label">Image</span>
- <span className="cu-expandable-field__code">
- {spec.image || '—'}
- </span>
- </div>
- <div className="cu-expandable-field">
- <span className="cu-expandable-field__label">Transport</span>
- <TransportBadge type={spec.transport?.type} />
- </div>
- <div className="cu-expandable-field">
- <span className="cu-expandable-field__label">Default context</span>
- {contextRef && onOpenContext ? (
- <button
- type="button"
- className="cu-link"
- onClick={() => onOpenContext(contextRef)}
- >
- {contextRef}
- </button>
- ) : (
- <span className="cu-muted">{contextRef || '—'}</span>
- )}
- </div>
- {onAddToContexts && onRemoveFromContext ? (
- <div className="cu-expandable-field cu-expandable-field--wide">
- <span className="cu-expandable-field__label">
- Available in contexts
- </span>
- <div className="cu-context-connector-bindings">
- {assignedContexts.length === 0 ? (
- <span className="cu-muted">No contexts assigned</span>
- ) : (
- <div className="cu-expandable-tags">
- {assignedContexts.map(context => (
- <span
- className="cu-registry-tag cu-context-connector-bindings__tag"
- key={context.name}
- >
- {onOpenContext ? (
- <button
- type="button"
- className="cu-link"
- onClick={() => onOpenContext(context.name)}
- >
- {context.name}
- </button>
- ) : (
- context.name
- )}
- <button
- type="button"
- className="cu-btn cu-btn--icon cu-btn--danger-icon"
- disabled={contextMembershipBusy}
- aria-label={`Remove connector ${name} from context ${context.name}`}
- title={`Remove from ${context.name}`}
- onClick={() =>
- void onRemoveFromContext(
- { namespace, name },
- context.name
- )
- }
- >
- <IconX width={14} height={14} />
- </button>
- </span>
- ))}
- </div>
- )}
- <button
- type="button"
- className="cu-btn cu-btn--secondary cu-btn--sm"
- disabled={contextMembershipBusy}
- onClick={() => openAddContexts(key)}
- >
- Add contexts
- </button>
- </div>
+ <div className="cu-connector-detail__metadata">
+ <div className="cu-expandable-field">
+ <span className="cu-expandable-field__label">URL</span>
+ <CopyableValue
+ copyKey={`${key}/url`}
+ copyLabel="URL"
+ value={spec.transport?.url || ''}
+ href={spec.transport?.url}
+ copied={copiedValueKey === `${key}/url`}
+ onCopy={(copyKey, value) => void copyValue(copyKey, value)}
+ />
+ </div>
+ <div className="cu-expandable-field">
+ <span className="cu-expandable-field__label">Image</span>
+ <CopyableValue
+ copyKey={`${key}/image`}
+ copyLabel="image URL"
+ value={spec.image || ''}
+ copied={copiedValueKey === `${key}/image`}
+ onCopy={(copyKey, value) => void copyValue(copyKey, value)}
+ />
+ </div>
+ <div className="cu-expandable-field">
+ <span className="cu-expandable-field__label">Transport</span>
+ <TransportBadge type={spec.transport?.type} />
+ </div>
+ <div className="cu-expandable-field">
+ <span className="cu-expandable-field__label">Managed</span>
+ <BoolBadge value={spec.managed} trueLabel="Yes" falseLabel="No" />
</div>
- ) : null}
- <div className="cu-expandable-field cu-expandable-field--wide">
- <span className="cu-expandable-field__label">Access</span>
- <AccessSummary summary={accessByConnectorKey?.[key]} />
- </div>
- <div className="cu-expandable-field">
- <span className="cu-expandable-field__label">Managed</span>
- <BoolBadge value={spec.managed} trueLabel="Yes" falseLabel="No" />
</div>
- <div className="cu-expandable-field cu-expandable-field--wide">
- <span className="cu-expandable-field__label">URL</span>
- {spec.transport?.url ? (
- <a
- className="cu-link cu-expandable-field__code"
- href={spec.transport.url}
- target="_blank"
- rel="noreferrer"
- >
- {spec.transport.url}
- </a>
- ) : (
- <span className="cu-muted">—</span>
- )}
+ <div className="cu-expandable-field cu-expandable-field--wide cu-connector-access-field">
+ <span className="cu-expandable-field__label">Access</span>
+ <section
+ className="cu-registry-context-access cu-connector-access-grid"
+ aria-label="Connector access"
+ >
+ <ConnectorContexts
+ connectorName={name}
+ namespace={namespace}
+ contextRef={contextRef}
+ contexts={assignedContexts}
+ busy={contextMembershipBusy}
+ onOpenContext={onOpenContext}
+ onAdd={onAddToContexts ? () => openAddContexts(key) : undefined}
+ onRemove={onRemoveFromContext}
+ />
+ <AccessSummary summary={accessByConnectorKey?.[key]} />
+ </section>
</div>
</div>
</div>
@@ -569,16 +674,7 @@ export function McpServerTable({
const busy = updatingContextMembershipKey === row.key
return (
<div
- style={{
- position: 'fixed',
- inset: 0,
- background: 'rgba(0, 0, 0, 0.6)',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- zIndex: 1000,
- padding: '1rem',
- }}
+ className="cu-modal-backdrop"
role="presentation"
onClick={event => {
if (event.target === event.currentTarget && !busy) closeAddContexts()
@@ -587,16 +683,14 @@ export function McpServerTable({
<div
className="cu-modal-panel cu-modal-panel--selection"
role="dialog"
+ aria-modal="true"
aria-labelledby="add-connector-context-title"
onClick={event => event.stopPropagation()}
>
<div className="cu-modal-panel__head">
- <strong
- id="add-connector-context-title"
- style={{ fontSize: '1rem', lineHeight: 1.35 }}
- >
+ <h3 id="add-connector-context-title" className="cu-modal-panel__title">
Add connector to contexts
- </strong>
+ </h3>
<button
type="button"
className="cu-btn cu-btn--icon cu-btn--ghost"
diff --git a/control-ui/components/RowActionsMenu/index.tsx b/control-ui/components/RowActionsMenu/index.tsx
index 00cb6a717..4c768ec19 100644
--- a/control-ui/components/RowActionsMenu/index.tsx
+++ b/control-ui/components/RowActionsMenu/index.tsx
@@ -1,32 +1,34 @@
'use client'
-import { useEffect, useLayoutEffect, useRef, useState } from 'react'
+import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'
import { createPortal } from 'react-dom'
import { IconDotsVertical, IconMoreHorizontal } from '@components/icons'
+import type { RowActionsMenuProps } from './types'
-export type RowAction = {
- key: string
- label: string
- onClick: () => void
- disabled?: boolean
- danger?: boolean
+export type { RowAction } from './types'
+
+function getEnabledMenuItems(menu: HTMLDivElement | null): HTMLButtonElement[] {
+ if (!menu) return []
+ return Array.from(menu.querySelectorAll<HTMLButtonElement>('[role="menuitem"]:not(:disabled)'))
}
export function RowActionsMenu({
ariaLabel,
actions,
horizontalTrigger = false,
-}: {
- ariaLabel: string
- actions: RowAction[]
- horizontalTrigger?: boolean
-}) {
+}: RowActionsMenuProps) {
const [open, setOpen] = useState(false)
const ref = useRef<HTMLDivElement>(null)
const triggerRef = useRef<HTMLButtonElement>(null)
const menuRef = useRef<HTMLDivElement>(null)
+ const initialFocusRef = useRef<'first' | 'last'>('first')
const [menuPosition, setMenuPosition] = useState<{ top: number; left: number } | null>(null)
+ const closeMenu = useCallback((restoreTriggerFocus = false) => {
+ setOpen(false)
+ if (restoreTriggerFocus) triggerRef.current?.focus()
+ }, [])
+
useEffect(() => {
if (!open) return
function handleDown(event: MouseEvent) {
@@ -34,7 +36,10 @@ export function RowActionsMenu({
if (!ref.current?.contains(target) && !menuRef.current?.contains(target)) setOpen(false)
}
function handleKey(event: KeyboardEvent) {
- if (event.key === 'Escape') setOpen(false)
+ if (event.key === 'Escape') {
+ event.preventDefault()
+ closeMenu(true)
+ }
}
document.addEventListener('mousedown', handleDown)
document.addEventListener('keydown', handleKey)
@@ -42,7 +47,7 @@ export function RowActionsMenu({
document.removeEventListener('mousedown', handleDown)
document.removeEventListener('keydown', handleKey)
}
- }, [open])
+ }, [closeMenu, open])
useLayoutEffect(() => {
if (!open) return
@@ -72,6 +77,9 @@ export function RowActionsMenu({
}
positionMenu()
+ const items = getEnabledMenuItems(menuRef.current)
+ const initialItem = initialFocusRef.current === 'last' ? items.at(-1) : items[0]
+ initialItem?.focus()
window.addEventListener('resize', positionMenu)
window.addEventListener('scroll', positionMenu, true)
return () => {
@@ -93,8 +101,16 @@ export function RowActionsMenu({
ref={triggerRef}
onClick={event => {
event.stopPropagation()
+ initialFocusRef.current = 'first'
setOpen(value => !value)
}}
+ onKeyDown={event => {
+ if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp') return
+ event.preventDefault()
+ event.stopPropagation()
+ initialFocusRef.current = event.key === 'ArrowUp' ? 'last' : 'first'
+ setOpen(true)
+ }}
>
{horizontalTrigger ? (
<IconMoreHorizontal width={16} height={16} />
@@ -108,6 +124,27 @@ export function RowActionsMenu({
ref={menuRef}
className="cu-kebab__menu cu-kebab__menu--portal"
role="menu"
+ onKeyDown={event => {
+ const items = getEnabledMenuItems(menuRef.current)
+ if (items.length === 0) return
+ const currentIndex = items.indexOf(document.activeElement as HTMLButtonElement)
+ if (event.key === 'Escape') {
+ event.preventDefault()
+ event.stopPropagation()
+ closeMenu(true)
+ return
+ }
+ let nextIndex: number | null = null
+ if (event.key === 'ArrowDown') nextIndex = (currentIndex + 1) % items.length
+ if (event.key === 'ArrowUp') {
+ nextIndex = (currentIndex - 1 + items.length) % items.length
+ }
+ if (event.key === 'Home') nextIndex = 0
+ if (event.key === 'End') nextIndex = items.length - 1
+ if (nextIndex === null) return
+ event.preventDefault()
+ items[nextIndex]?.focus()
+ }}
style={
menuPosition
? { top: menuPosition.top, left: menuPosition.left }
@@ -123,7 +160,7 @@ export function RowActionsMenu({
disabled={action.disabled}
onClick={event => {
event.stopPropagation()
- setOpen(false)
+ closeMenu(true)
action.onClick()
}}
>
diff --git a/control-ui/components/RowActionsMenu/types.ts b/control-ui/components/RowActionsMenu/types.ts
new file mode 100644
index 000000000..51449f717
--- /dev/null
+++ b/control-ui/components/RowActionsMenu/types.ts
@@ -0,0 +1,13 @@
+export type RowAction = {
+ key: string
+ label: string
+ onClick: () => void
+ disabled?: boolean
+ danger?: boolean
+}
+
+export type RowActionsMenuProps = {
+ ariaLabel: string
+ actions: RowAction[]
+ horizontalTrigger?: boolean
+}
diff --git a/control-ui/components/__tests__/McpServerTable.test.tsx b/control-ui/components/__tests__/McpServerTable.test.tsx
index 3fc1c51ad..a285fd1b1 100644
--- a/control-ui/components/__tests__/McpServerTable.test.tsx
+++ b/control-ui/components/__tests__/McpServerTable.test.tsx
@@ -1,5 +1,5 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
-import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
import { McpServerTable } from '../McpServerTable'
afterEach(() => {
@@ -230,7 +230,7 @@ describe('McpServerTable — connector access summaries', () => {
).toHaveAttribute('aria-expanded', 'true')
})
- it('renders full principal names as chips in the expanded details', () => {
+ it('renders agents, teams, and users in marketplace-style access groups', () => {
const items = [makeItem({ name: 'airtable-server' })]
render(
<McpServerTable
@@ -254,6 +254,11 @@ describe('McpServerTable — connector access summaries', () => {
fireEvent.click(screen.getByText('airtable-server').closest('tr')!)
+ const access = screen.getByRole('region', { name: 'Connector access' })
+ expect(access).toHaveTextContent('Agents')
+ expect(access).toHaveTextContent('Teams')
+ expect(access).toHaveTextContent('Users')
+
for (const label of [
'agent-alpha',
'bravo',
@@ -273,7 +278,46 @@ describe('McpServerTable — connector access summaries', () => {
render(<McpServerTable items={items} />)
fireEvent.click(screen.getByText('unused-server').closest('tr')!)
- expect(screen.getByText('No access assigned')).toBeInTheDocument()
+ expect(screen.getByText('No agents have access.')).toBeInTheDocument()
+ expect(screen.getByText('No teams have access.')).toBeInTheDocument()
+ expect(screen.getByText('No users have access.')).toBeInTheDocument()
+ })
+
+ it('orders URL, image, transport, and managed together and copies both full URLs', async () => {
+ const image =
+ 'us-central1-docker.pkg.dev/eventfire-491421/clerum/nginx-egress-proxy:sha-3cbdf33'
+ const url = 'http://brave-search.mcp-server.svc.cluster.local:3000/mcp'
+ const writeText = vi.fn().mockResolvedValue(undefined)
+ Object.defineProperty(navigator, 'clipboard', {
+ configurable: true,
+ value: { writeText },
+ })
+ render(<McpServerTable items={[makeItem({ name: 'airtable-server', image })]} />)
+
+ fireEvent.click(screen.getByRole('button', { name: 'Expand connector airtable-server' }))
+
+ const metadata = document.querySelector('.cu-connector-detail__metadata')
+ expect(metadata).not.toBeNull()
+ const labels = Array.from(metadata!.querySelectorAll('.cu-expandable-field__label')).map(
+ label => label.textContent
+ )
+ expect(labels).toEqual(['URL', 'Image', 'Transport', 'Managed'])
+ expect(metadata).not.toHaveTextContent('Default context')
+
+ const compactUrl = screen.getByTitle(url)
+ expect(compactUrl.textContent).toContain('...')
+ expect(compactUrl).toHaveAttribute('href', url)
+ const compactImage = screen.getByTitle(image)
+ expect(compactImage.textContent).toContain('...')
+ expect(compactImage.textContent).not.toBe(image)
+
+ fireEvent.click(screen.getByRole('button', { name: 'Copy image URL' }))
+ await waitFor(() => expect(writeText).toHaveBeenCalledWith(image))
+ expect(screen.getByRole('button', { name: 'image URL copied' })).toBeInTheDocument()
+
+ fireEvent.click(screen.getByRole('button', { name: 'Copy URL' }))
+ await waitFor(() => expect(writeText).toHaveBeenCalledWith(url))
+ expect(screen.getByRole('button', { name: 'URL copied' })).toBeInTheDocument()
})
it('filters rows by agent, user, and team access labels', () => {
@@ -333,7 +377,8 @@ describe('McpServerTable — context membership', () => {
fireEvent.click(screen.getByRole('button', { name: 'Expand connector airtable-server' }))
- expect(screen.getByText('Available in contexts')).toBeInTheDocument()
+ expect(screen.getByRole('heading', { name: 'Contexts' })).toBeInTheDocument()
+ expect(screen.queryByText('Default', { exact: true })).not.toBeInTheDocument()
expect(screen.getByText('research')).toBeInTheDocument()
fireEvent.click(
screen.getByRole('button', {
@@ -347,7 +392,8 @@ describe('McpServerTable — context membership', () => {
)
})
- it('uses the Context detail selection modal to add the connector to more contexts', () => {
+ it('uses the Context detail selection modal to add the connector to more contexts', async () => {
+ const onAddToContexts = vi.fn().mockResolvedValue(undefined)
const items = [makeItem({ name: 'airtable-server' })]
render(
<McpServerTable
@@ -356,7 +402,7 @@ describe('McpServerTable — context membership', () => {
{ name: 'research', mcpServers: ['airtable-server'] },
{ name: 'sales', description: 'Sales tools', mcpServers: [] },
]}
- onAddToContexts={vi.fn().mockResolvedValue(undefined)}
+ onAddToContexts={onAddToContexts}
onRemoveFromContext={vi.fn().mockResolvedValue(undefined)}
/>
)
@@ -364,8 +410,21 @@ describe('McpServerTable — context membership', () => {
fireEvent.click(screen.getByRole('button', { name: 'Expand connector airtable-server' }))
fireEvent.click(screen.getByRole('button', { name: 'Add contexts' }))
- expect(screen.getByRole('dialog', { name: 'Add connector to contexts' })).toBeInTheDocument()
- expect(screen.getByText('Contexts')).toBeInTheDocument()
- expect(screen.getByText('No available contexts.')).not.toBeInTheDocument()
+ const dialog = screen.getByRole('dialog', { name: 'Add connector to contexts' })
+ expect(dialog).toBeInTheDocument()
+ expect(dialog).toHaveAttribute('aria-modal', 'true')
+ expect(dialog.parentElement).toHaveClass('cu-modal-backdrop')
+ expect(screen.getByLabelText('Contexts')).toBeInTheDocument()
+ expect(screen.queryByText('No available contexts.')).not.toBeInTheDocument()
+
+ fireEvent.click(screen.getByRole('option', { name: 'sales' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Add to context' }))
+
+ await waitFor(() =>
+ expect(onAddToContexts).toHaveBeenCalledWith(
+ { namespace: 'mcp-server', name: 'airtable-server' },
+ ['sales']
+ )
+ )
})
})
diff --git a/control-ui/components/__tests__/RowActionsMenu.test.tsx b/control-ui/components/__tests__/RowActionsMenu.test.tsx
index cf0adfda9..3191929ca 100644
--- a/control-ui/components/__tests__/RowActionsMenu.test.tsx
+++ b/control-ui/components/__tests__/RowActionsMenu.test.tsx
@@ -21,4 +21,56 @@ describe('RowActionsMenu', () => {
expect(menu).toHaveClass('cu-kebab__menu--portal')
expect(menu.parentElement).toBe(document.body)
})
+
+ it('focuses the first enabled item and supports arrow-key navigation', () => {
+ render(
+ <RowActionsMenu
+ ariaLabel="Entry actions"
+ actions={[
+ { key: 'disabled', label: 'Disabled', disabled: true, onClick: vi.fn() },
+ { key: 'edit', label: 'Edit', onClick: vi.fn() },
+ { key: 'delete', label: 'Delete', onClick: vi.fn() },
+ ]}
+ />
+ )
+
+ fireEvent.click(screen.getByRole('button', { name: 'Entry actions' }))
+
+ const edit = screen.getByRole('menuitem', { name: 'Edit' })
+ const deleteAction = screen.getByRole('menuitem', { name: 'Delete' })
+ expect(edit).toHaveFocus()
+
+ fireEvent.keyDown(edit, { key: 'ArrowDown' })
+ expect(deleteAction).toHaveFocus()
+
+ fireEvent.keyDown(deleteAction, { key: 'ArrowDown' })
+ expect(edit).toHaveFocus()
+
+ fireEvent.keyDown(edit, { key: 'ArrowUp' })
+ expect(deleteAction).toHaveFocus()
+ })
+
+ it('opens on ArrowUp at the last item and restores trigger focus on Escape', () => {
+ render(
+ <RowActionsMenu
+ ariaLabel="Entry actions"
+ actions={[
+ { key: 'edit', label: 'Edit', onClick: vi.fn() },
+ { key: 'delete', label: 'Delete', onClick: vi.fn() },
+ ]}
+ />
+ )
+
+ const trigger = screen.getByRole('button', { name: 'Entry actions' })
+ trigger.focus()
+ fireEvent.keyDown(trigger, { key: 'ArrowUp' })
+
+ const deleteAction = screen.getByRole('menuitem', { name: 'Delete' })
+ expect(deleteAction).toHaveFocus()
+
+ fireEvent.keyDown(deleteAction, { key: 'Escape' })
+
+ expect(screen.queryByRole('menu')).not.toBeInTheDocument()
+ expect(trigger).toHaveFocus()
+ })
})
diff --git a/control-ui/lib/__tests__/registryCredentialDraft.test.ts b/control-ui/lib/__tests__/registryCredentialDraft.test.ts
new file mode 100644
index 000000000..ce80a9b8a
--- /dev/null
+++ b/control-ui/lib/__tests__/registryCredentialDraft.test.ts
@@ -0,0 +1,58 @@
+import { describe, expect, it } from 'vitest'
+import {
+ areRequiredCredentialRowsComplete,
+ reconcileCredentialRows,
+} from '../registryCredentialDraft'
+
+describe('registry credential drafts', () => {
+ const schemaKeys = [
+ { name: 'CLIENT_ID', label: 'Client ID' },
+ { name: 'CLIENT_SECRET', label: 'Client secret' },
+ ]
+
+ it('preserves early input while adding every schema field', () => {
+ expect(
+ reconcileCredentialRows(
+ [{ id: 'early-row', secretKey: 'CLIENT_ID', value: 'client-123' }],
+ schemaKeys
+ )
+ ).toEqual([
+ {
+ id: 'early-row',
+ secretKey: 'CLIENT_ID',
+ value: 'client-123',
+ label: 'Client ID',
+ },
+ {
+ id: 'mcp-schema-row-1',
+ secretKey: 'CLIENT_SECRET',
+ value: '',
+ label: 'Client secret',
+ },
+ ])
+ })
+
+ it('adopts a value entered before its schema key was known', () => {
+ const rows = reconcileCredentialRows(
+ [{ id: 'early-row', secretKey: '', value: 'client-123' }],
+ schemaKeys
+ )
+
+ expect(rows[0]).toMatchObject({
+ id: 'early-row',
+ secretKey: 'CLIENT_ID',
+ value: 'client-123',
+ })
+ })
+
+ it('requires every schema key but permits additional manual keys', () => {
+ const rows = [
+ { id: 'client', secretKey: 'CLIENT_ID', value: 'client-123' },
+ { id: 'secret', secretKey: 'CLIENT_SECRET', value: 'secret-456' },
+ { id: 'extra', secretKey: 'OPTIONAL_SCOPE', value: 'read' },
+ ]
+
+ expect(areRequiredCredentialRowsComplete(rows, schemaKeys)).toBe(true)
+ expect(areRequiredCredentialRowsComplete(rows.slice(0, 1), schemaKeys)).toBe(false)
+ })
+})
diff --git a/control-ui/lib/registryCredentialDraft.ts b/control-ui/lib/registryCredentialDraft.ts
new file mode 100644
index 000000000..3b0064abb
--- /dev/null
+++ b/control-ui/lib/registryCredentialDraft.ts
@@ -0,0 +1,39 @@
+import type { CredentialDraftRow, RegistryCredentialKey } from './registryCredentialDraft.types'
+
+export function reconcileCredentialRows(
+ currentRows: CredentialDraftRow[],
+ schemaKeys: RegistryCredentialKey[]
+): CredentialDraftRow[] {
+ const schemaNames = new Set(schemaKeys.map(key => key.name))
+ const unboundRow = currentRows.find(row => !row.secretKey.trim() && row.value.trim())
+ let usedUnboundRow = false
+
+ const schemaRows = schemaKeys.map((key, index) => {
+ const matchingRow = currentRows.find(row => row.secretKey.trim() === key.name)
+ const existingRow = matchingRow ?? (!usedUnboundRow && unboundRow ? unboundRow : undefined)
+ if (existingRow === unboundRow) usedUnboundRow = true
+ return {
+ id: existingRow?.id ?? `mcp-schema-row-${index}`,
+ secretKey: key.name,
+ value: existingRow?.value ?? '',
+ label: key.label || key.name,
+ }
+ })
+
+ const extraRows = currentRows.filter(row => {
+ if (row === unboundRow && usedUnboundRow) return false
+ return (
+ !schemaNames.has(row.secretKey.trim()) && Boolean(row.secretKey.trim() || row.value.trim())
+ )
+ })
+ return [...schemaRows, ...extraRows]
+}
+
+export function areRequiredCredentialRowsComplete(
+ rows: CredentialDraftRow[],
+ schemaKeys: RegistryCredentialKey[]
+): boolean {
+ return schemaKeys.every(key =>
+ rows.some(row => row.secretKey.trim() === key.name && row.value.trim().length > 0)
+ )
+}
diff --git a/control-ui/lib/registryCredentialDraft.types.ts b/control-ui/lib/registryCredentialDraft.types.ts
new file mode 100644
index 000000000..d1f2e143b
--- /dev/null
+++ b/control-ui/lib/registryCredentialDraft.types.ts
@@ -0,0 +1,11 @@
+export type CredentialDraftRow = {
+ id: string
+ secretKey: string
+ value: string
+ label?: string
+}
+
+export type RegistryCredentialKey = {
+ name: string
+ label?: string
+}
diff --git a/control-ui/lib/tableSort.tsx b/control-ui/lib/tableSort.tsx
new file mode 100644
index 000000000..1467da32c
--- /dev/null
+++ b/control-ui/lib/tableSort.tsx
@@ -0,0 +1,61 @@
+import type { Dispatch, SetStateAction } from 'react'
+import type { SortDirection, TableSortHeaderProps } from './tableSort.types'
+
+export type { SortDirection } from './tableSort.types'
+
+export function compareNullsLast(
+ left: number | null | undefined,
+ right: number | null | undefined
+): number | null {
+ if (left == null && right == null) return 0
+ if (left == null) return 1
+ if (right == null) return -1
+ return null
+}
+
+export function toggleSort<TKey extends string>(
+ key: TKey,
+ currentKey: TKey | null,
+ defaultDirections: Record<TKey, SortDirection>,
+ setKey: Dispatch<SetStateAction<TKey | null>>,
+ setDirection: Dispatch<SetStateAction<SortDirection>>
+) {
+ if (currentKey === key) {
+ setDirection(current => (current === 'asc' ? 'desc' : 'asc'))
+ return
+ }
+ setKey(key)
+ setDirection(defaultDirections[key])
+}
+
+export function TableSortHeader<TKey extends string>({
+ activeKey,
+ defaultDirections,
+ direction,
+ label,
+ onSort,
+ sortKey,
+}: TableSortHeaderProps<TKey>) {
+ const isActive = activeKey === sortKey
+ const indicator = isActive ? (direction === 'asc' ? '↑' : '↓') : ''
+ const nextDirection = isActive
+ ? direction === 'asc'
+ ? 'descending'
+ : 'ascending'
+ : defaultDirections[sortKey] === 'asc'
+ ? 'ascending'
+ : 'descending'
+
+ return (
+ <button
+ type="button"
+ className={`cu-link cu-link--sm cu-table__sort-link${isActive ? ' is-active' : ''}`}
+ onClick={() => onSort(sortKey)}
+ aria-label={`Sort by ${label.toLowerCase()} ${nextDirection}`}
+ aria-pressed={isActive}
+ >
+ {label}
+ {indicator ? ` ${indicator}` : ''}
+ </button>
+ )
+}
diff --git a/control-ui/lib/tableSort.types.ts b/control-ui/lib/tableSort.types.ts
new file mode 100644
index 000000000..5e5322379
--- /dev/null
+++ b/control-ui/lib/tableSort.types.ts
@@ -0,0 +1,10 @@
+export type SortDirection = 'asc' | 'desc'
+
+export type TableSortHeaderProps<TKey extends string> = {
+ activeKey: TKey | null
+ defaultDirections: Record<TKey, SortDirection>
+ direction: SortDirection
+ label: string
+ onSort: (key: TKey) => void
+ sortKey: TKey
+}
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index cd4eaedc4..9368cfbce 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.387",
+ "version": "0.1.388",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.387",
+ "version": "0.1.388",
"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 d7bf8d57b..4397b10b0 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.387",
+ "version": "0.1.388",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --git a/external-rest-api/package-lock.json b/external-rest-api/package-lock.json
index 4fb41b7a4..5afe5d859 100644
--- a/external-rest-api/package-lock.json
+++ b/external-rest-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-external-rest-api",
- "version": "0.1.61",
+ "version": "0.1.62",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-external-rest-api",
- "version": "0.1.61",
+ "version": "0.1.62",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.21.2",
diff --git a/external-rest-api/package.json b/external-rest-api/package.json
index 39f50f425..bb6112c55 100644
--- a/external-rest-api/package.json
+++ b/external-rest-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-external-rest-api",
- "version": "0.1.61",
+ "version": "0.1.62",
"description": "External REST API for profile, team management, and RPC token brokerage",
"main": "dist/main.js",
"engines": {
diff --git a/external-rest-api/src/releaseManifest.ts b/external-rest-api/src/releaseManifest.ts
index ed521168d..58f935b51 100644
--- a/external-rest-api/src/releaseManifest.ts
+++ b/external-rest-api/src/releaseManifest.ts
@@ -8,8 +8,8 @@ export type ReleaseManifest = {
export const releaseManifest: ReleaseManifest = {
releaseId: 'v0.6.0',
- externalRestApiVersion: '0.1.61',
- rpcProxyVersion: '0.1.62',
+ externalRestApiVersion: '0.1.62',
+ rpcProxyVersion: '0.1.63',
desktopVersion: '0.6.0',
minimumDesktopVersion: '0.1.252',
}
diff --git a/rpc-proxy/package-lock.json b/rpc-proxy/package-lock.json
index 3df46e144..f7c851d59 100644
--- a/rpc-proxy/package-lock.json
+++ b/rpc-proxy/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-rpc-proxy",
- "version": "0.1.62",
+ "version": "0.1.63",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-rpc-proxy",
- "version": "0.1.62",
+ "version": "0.1.63",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.21.2",
diff --git a/rpc-proxy/package.json b/rpc-proxy/package.json
index 0434e0acc..1a04ed372 100644
--- a/rpc-proxy/package.json
+++ b/rpc-proxy/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-rpc-proxy",
- "version": "0.1.62",
+ "version": "0.1.63",
"description": "External-facing RPC proxy for tenant-scoped MCP access",
"main": "dist/main.js",
"engines": {