Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(control-ui): unify registry API key + Docker push credential into one flow
Andy Paviad6398f432762
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.cssindex 641176f8d..5424dd53d 100644--- a/control-ui/app/globals.css+++ b/control-ui/app/globals.css@@ -8168,6 +8168,29 @@ textarea.cu-input {box-shadow: var(--cu-shadow);}+/* Wider variant for modals with long content (e.g. Docker commands + config). */+.cu-modal--wide {+ width: min(46rem, 96vw);+}++/* Preformatted command / config snippet inside a modal or panel. Wraps long+ lines (docker login … -p <secret>, push coordinates, dockerconfigjson) so+ nothing is clipped, rather than overflowing a fixed-width dialog. */+.cu-code-block {+ margin: 0;+ padding: 0.6rem 0.75rem;+ background: var(--cu-surface-alt, var(--cu-surface));+ border: 1px solid var(--cu-border);+ border-radius: var(--cu-radius-sm, var(--cu-radius));+ font-family: var(--cu-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);+ font-size: 0.85em;+ line-height: 1.5;+ white-space: pre-wrap;+ overflow-wrap: anywhere;+ word-break: break-word;+ overflow-x: auto;+}+/* Quick-pick chips row for multi-choice shortcuts */.cu-quick-picks {display: flex;diff --git a/control-ui/components/MarketplaceOrgArea/index.tsx b/control-ui/components/MarketplaceOrgArea/index.tsxindex 64cf584e2..bdb70576b 100644--- a/control-ui/components/MarketplaceOrgArea/index.tsx+++ b/control-ui/components/MarketplaceOrgArea/index.tsx@@ -6,7 +6,6 @@ import { useInboundGrants } from '../../lib/hooks/useInboundGrants'import { useRegistryCapability } from '../../lib/hooks/useRegistryCapability'import { MarketplaceOrgImages } from '../MarketplaceOrgImages'import { MarketplaceTabs } from '../MarketplaceTabs'-import { DockerCredentialsPanel } from '../PublisherView/DockerCredentials'import { OwnedEntries } from '../PublisherView/OwnedEntries'import { RetryBanner } from '../PublisherView/RetryBanner'import RegistryApiKeysPanel from '../RegistryApiKeysPanel'@@ -82,12 +81,10 @@ export function MarketplaceOrgArea({ activeTab }: { activeTab: OrgAreaTab }) {{/* Entries is a publishing surface, so it follows the publishing-UItoggle (canManageOrg). Credentials and Connection do NOT — turning- publishing off must not remove push credentials or the connection- status (design spec §6). The Credentials tab renders the registry- API keys (self-gating) and, once the org scope is known, the Docker- push credential — the target of the Images tab's "get a push- credential from the API Keys tab" pointer. Design spec §5.1 folds- both into a unified RegistryCredentials view in Phase 5. */}+ publishing off must not remove API keys or the connection status+ (design spec §6). The Credentials tab is the single registry-key+ surface (self-gating); a registry:publish key doubles as the Docker+ push credential, surfaced in the key's reveal dialog. */}{activeTab === 'entries' ? (loading ? (<p>Loading…</p>@@ -118,15 +115,7 @@ export function MarketplaceOrgArea({ activeTab }: { activeTab: OrgAreaTab }) {)) : null}- {activeTab === 'credentials' ? (- <>- <RegistryApiKeysPanel />- {/* Gated on the org scope (needed to build the push coordinates),- not on the publishing toggle — push credentials survive- publishing being turned off (§6). */}- {orgScope ? <DockerCredentialsPanel orgScope={orgScope} /> : null}- </>- ) : null}+ {activeTab === 'credentials' ? <RegistryApiKeysPanel /> : null}{activeTab === 'connection' ? <RegistryConnectPanel /> : null}</div>diff --git a/control-ui/components/RegistryApiKeysPanel.tsx b/control-ui/components/RegistryApiKeysPanel.tsxindex b6ebaf1ed..bb774d675 100644--- a/control-ui/components/RegistryApiKeysPanel.tsx+++ b/control-ui/components/RegistryApiKeysPanel.tsx@@ -55,7 +55,7 @@ export default function RegistryApiKeysPanel() {const { confirm, confirmDialog } = useConfirmDialog()const [view, setView] = useState<View>({ kind: 'loading' })const [creating, setCreating] = useState(false)- const [revealed, setRevealed] = useState<string | null>(null)+ const [revealed, setRevealed] = useState<CreatedRegistryApiKey | null>(null)// The auth-disabled view needs mode-specific copy: self-hosted fixes it by// connecting, managed fixes it via CLERUM_REGISTRY_AUTH_ENABLED (no connect// flow exists there). Same best-effort detection RegistryCatalog uses for its@@ -102,7 +102,7 @@ export default function RegistryApiKeysPanel() {async function handleCreate(input: CreateRegistryApiKeyInput) {const created: CreatedRegistryApiKey = await createRegistryApiKey(input)setCreating(false)- setRevealed(created.key)+ setRevealed(created)await load()}@@ -155,8 +155,7 @@ export default function RegistryApiKeysPanel() {) : null}{view.kind === 'no-org' ? (<p className="cu-banner cu-banner--warn">- This deployment is not bound to a registry org, so there are no org API keys to- manage.+ This deployment is not bound to a registry org, so there are no org API keys to manage.</p>) : null}{view.kind === 'auth-disabled' ? (@@ -239,7 +238,13 @@ export default function RegistryApiKeysPanel() {{creating ? (<CreateApiKeyModal onCreate={handleCreate} onCancel={() => setCreating(false)} />) : null}- {revealed ? <RevealApiKeyModal apiKey={revealed} onClose={() => setRevealed(null)} /> : null}+ {revealed ? (+ <RevealApiKeyModal+ created={revealed}+ orgScope={view.kind === 'ready' ? view.org : ''}+ onClose={() => setRevealed(null)}+ />+ ) : null}{confirmDialog}</section>)diff --git a/control-ui/components/RevealApiKeyModal.tsx b/control-ui/components/RevealApiKeyModal.tsxindex ced0ba513..5cf974496 100644--- a/control-ui/components/RevealApiKeyModal.tsx+++ b/control-ui/components/RevealApiKeyModal.tsx@@ -1,13 +1,22 @@'use client'+import { useEffect, useRef, useState } from 'react'+import type { CreatedRegistryApiKey } from '../lib/api'+import {+ buildDockerLoginCommand,+ buildPushCoordinate,+ resolveDockerCredential,+} from './PublisherView/dockerCredential'import { useToast } from './Toast'import { Button } from './ui'export default function RevealApiKeyModal({- apiKey,+ created,+ orgScope,onClose,}: {- apiKey: string+ created: CreatedRegistryApiKey+ orgScope: stringonClose: () => void}) {const { showToast } = useToast()@@ -15,24 +24,44 @@ export default function RevealApiKeyModal({const [copyFailed, setCopyFailed] = useState(false)const copyRef = useRef<HTMLButtonElement>(null)+ const apiKey = created.key+ // Only a registry:publish key can push images, and only then does the registry+ // return the push-credential fields — so the Docker section shows for those.+ const isPushCredential = created.scopes.includes('registry:publish')+ const { registry, dockerconfigjson } = resolveDockerCredential(created)+ const loginCmd = buildDockerLoginCommand(registry, apiKey)+ const pushCoordinate = buildPushCoordinate(registry, orgScope)+useEffect(() => {copyRef.current?.focus()}, [])- async function copy() {+ async function copy(value: string, label: string) {try {- await navigator.clipboard.writeText(apiKey)- showToast('Copied to clipboard.', { tone: 'success' })+ await navigator.clipboard.writeText(value)+ showToast(`${label} copied.`, { tone: 'success' })setCopyFailed(false)} catch {setCopyFailed(true)}}+ function downloadDockerconfig() {+ const blob = new Blob([dockerconfigjson], { type: 'application/json' })+ const url = URL.createObjectURL(blob)+ const a = document.createElement('a')+ a.href = url+ a.download = 'dockerconfigjson.json'+ document.body.appendChild(a)+ a.click()+ a.remove()+ setTimeout(() => URL.revokeObjectURL(url), 1000)+ }+return (<div className="cu-modal-overlay" role="presentation"><div- className="cu-modal"+ className={`cu-modal${isPushCredential ? ' cu-modal--wide' : ''}`}role="dialog"aria-modal="true"aria-labelledby="reveal-key-title"@@ -54,7 +83,7 @@ export default function RevealApiKeyModal({ref={copyRef}type="button"className="cu-btn cu-btn--ghost cu-btn--sm"- onClick={copy}+ onClick={() => copy(apiKey, 'API key')}>Copy</button>@@ -64,6 +93,40 @@ export default function RevealApiKeyModal({Could not copy to clipboard. Reveal the key, then select and copy manually.</p>) : null}++ {isPushCredential ? (+ <div className="cu-field">+ <label>Use with Docker</label>+ <p className="cu-field__hint">+ This key is also a Docker push credential — publish images to your org.+ </p>++ <span className="cu-field__hint">1. Log in to the registry</span>+ <pre className="cu-code-block">{loginCmd}</pre>+ <button+ type="button"+ className="cu-btn cu-btn--ghost cu-btn--sm"+ onClick={() => copy(loginCmd, 'Login command')}+ >+ Copy login command+ </button>++ <span className="cu-field__hint">2. Tag and push to this coordinate</span>+ <pre className="cu-code-block">{pushCoordinate}</pre>++ <span className="cu-field__hint">+ Or hand the credential to a build system as a Docker config file:+ </span>+ <button+ type="button"+ className="cu-btn cu-btn--ghost cu-btn--sm"+ onClick={downloadDockerconfig}+ >+ Download dockerconfigjson+ </button>+ </div>+ ) : null}+<div className="cu-modal-actions"><Button type="button" variant="primary" onClick={onClose}>I've saved itdiff --git a/control-ui/components/__tests__/MarketplaceOrgArea.test.tsx b/control-ui/components/__tests__/MarketplaceOrgArea.test.tsxindex 1b3bfb604..a2bc4d3ab 100644--- a/control-ui/components/__tests__/MarketplaceOrgArea.test.tsx+++ b/control-ui/components/__tests__/MarketplaceOrgArea.test.tsx@@ -18,9 +18,6 @@ vi.mock('../PublisherView/OwnedEntries', () => ({OwnedEntries: () => <div>owned-entries</div>,}))vi.mock('../RegistryApiKeysPanel', () => ({ default: () => <div>api-keys-panel</div> }))-vi.mock('../PublisherView/DockerCredentials', () => ({- DockerCredentialsPanel: () => <div>docker-credentials-panel</div>,-}))vi.mock('../RegistryConnectPanel', () => ({ default: () => <div>connect-panel</div> }))function cap(overrides: Partial<RegistryCapability>): RegistryCapabilityState {@@ -128,19 +125,6 @@ describe('MarketplaceOrgArea', () => {render(<MarketplaceOrgArea activeTab="credentials" />)expect(screen.getByText('api-keys-panel')).toBeInTheDocument()expect(screen.queryByText(/Name your organization/i)).toBeNull()- // No org scope yet → the Docker push-credential panel can't build coordinates.- expect(screen.queryByText('docker-credentials-panel')).toBeNull()- })-- it('credentials: also renders the Docker push credential once the org scope is known', () => {- // canManageOrg false (publishing UI off) but a claimed scope — push- // credentials are gated on the scope, not the publishing toggle (§6).- vi.mocked(capHook.useRegistryCapability).mockReturnValue(- cap({ orgName: 'acme', scope: '@acme', canManageOrg: false })- )- render(<MarketplaceOrgArea activeTab="credentials" />)- expect(screen.getByText('api-keys-panel')).toBeInTheDocument()- expect(screen.getByText('docker-credentials-panel')).toBeInTheDocument()})it('connection: always renders the connect panel', () => {diff --git a/control-ui/components/__tests__/RevealApiKeyModal.test.tsx b/control-ui/components/__tests__/RevealApiKeyModal.test.tsxindex e6481a180..7b5015917 100644--- a/control-ui/components/__tests__/RevealApiKeyModal.test.tsx+++ b/control-ui/components/__tests__/RevealApiKeyModal.test.tsx@@ -1,6 +1,7 @@// control-ui/components/__tests__/RevealApiKeyModal.test.tsximport { afterEach, describe, expect, it, vi } from 'vitest'import { cleanup, fireEvent, render as rtlRender, screen } from '@testing-library/react'+import type { CreatedRegistryApiKey } from '../../lib/api'import RevealApiKeyModal from '../RevealApiKeyModal'import { ToastProvider } from '../Toast'@@ -9,37 +10,52 @@ function render(ui: React.ReactNode) {}afterEach(cleanup)+const key = (scopes: string[], over: Partial<CreatedRegistryApiKey> = {}): CreatedRegistryApiKey =>+ ({+ id: 'k1',+ key: 'efrk_secret',+ key_prefix: 'efrk_',+ scopes,+ expires_at: null,+ ...over,+ }) as CreatedRegistryApiKey++const readKey = key(['registry:read'])+const pushKey = key(['registry:read', 'registry:publish'])+describe('RevealApiKeyModal', () => {it('warns it is shown once and masks the key by default', () => {- render(<RevealApiKeyModal apiKey="efrk_secret" onClose={() => {}} />)+ render(<RevealApiKeyModal created={readKey} orgScope="acme" onClose={() => {}} />)expect(screen.getByRole('alert')).toHaveTextContent(/only time/i)expect(screen.queryByText('efrk_secret')).toBeNull()})it('reveals on toggle', () => {- render(<RevealApiKeyModal apiKey="efrk_secret" onClose={() => {}} />)+ render(<RevealApiKeyModal created={readKey} orgScope="acme" onClose={() => {}} />)fireEvent.click(screen.getByRole('button', { name: /reveal/i }))expect(screen.getByText('efrk_secret')).toBeInTheDocument()})- it('copies to clipboard', async () => {+ it('copies the key to clipboard', async () => {const writeText = vi.fn().mockResolvedValue(undefined)Object.assign(navigator, { clipboard: { writeText } })- render(<RevealApiKeyModal apiKey="efrk_secret" onClose={() => {}} />)- fireEvent.click(screen.getByRole('button', { name: /copy/i }))+ render(<RevealApiKeyModal created={readKey} orgScope="acme" onClose={() => {}} />)+ fireEvent.click(screen.getByRole('button', { name: /^copy$/i }))expect(writeText).toHaveBeenCalledWith('efrk_secret')})it('shows a fallback message when clipboard fails', async () => {- Object.assign(navigator, { clipboard: { writeText: vi.fn().mockRejectedValue(new Error('x')) } })- render(<RevealApiKeyModal apiKey="efrk_secret" onClose={() => {}} />)- fireEvent.click(screen.getByRole('button', { name: /copy/i }))+ Object.assign(navigator, {+ clipboard: { writeText: vi.fn().mockRejectedValue(new Error('x')) },+ })+ render(<RevealApiKeyModal created={readKey} orgScope="acme" onClose={() => {}} />)+ fireEvent.click(screen.getByRole('button', { name: /^copy$/i }))expect(await screen.findByText(/select.*copy manually/i)).toBeInTheDocument()})it('calls onClose only via the explicit button', () => {const onClose = vi.fn()- render(<RevealApiKeyModal apiKey="efrk_secret" onClose={onClose} />)+ render(<RevealApiKeyModal created={readKey} orgScope="acme" onClose={onClose} />)fireEvent.keyDown(document, { key: 'Escape' })expect(onClose).not.toHaveBeenCalled()fireEvent.click(screen.getByRole('button', { name: /saved it|close|done/i }))@@ -47,8 +63,22 @@ describe('RevealApiKeyModal', () => {})it('focuses the Copy button on open', () => {- render(<RevealApiKeyModal apiKey="efrk_secret" onClose={() => {}} />)- const copyButton = screen.getByRole('button', { name: /copy/i })- expect(document.activeElement).toBe(copyButton)+ render(<RevealApiKeyModal created={readKey} orgScope="acme" onClose={() => {}} />)+ expect(document.activeElement).toBe(screen.getByRole('button', { name: /^copy$/i }))+ })++ it('hides the Docker section for a non-publish key', () => {+ render(<RevealApiKeyModal created={readKey} orgScope="acme" onClose={() => {}} />)+ expect(screen.queryByText(/use with docker/i)).toBeNull()+ })++ it('shows Docker push instructions for a registry:publish key', () => {+ render(<RevealApiKeyModal created={pushKey} orgScope="acme" onClose={() => {}} />)+ expect(screen.getByText(/use with docker/i)).toBeInTheDocument()+ expect(screen.getByText(/docker login/i)).toBeInTheDocument()+ // push coordinate carries the org namespace+ expect(screen.getByText(/registry\.evenfire\.ai\/acme/)).toBeInTheDocument()+ expect(screen.getByRole('button', { name: /copy login command/i })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: /download dockerconfigjson/i })).toBeInTheDocument()})})diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex 85b73d43d..7f8a779cb 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.375",+ "version": "0.1.376","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.375",+ "version": "0.1.376","dependencies": {"@clerum/llm-providers": "file:../packages/llm-providers","@clerum/workflow-recipe-capability-policy": "file:../packages/workflow-recipe-capability-policy",diff --git a/control-ui/package.json b/control-ui/package.jsonindex a8bc6a717..09b3b17e4 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.375",+ "version": "0.1.376","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",