Skip to content

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

TypeScript

feat: open rendered agent identity files for editing

Josué5145c4da6c03
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.css
index 06ec5d8d2..8239f090c 100644
--- a/control-ui/app/globals.css
+++ b/control-ui/app/globals.css
@@ -8983,8 +8983,10 @@ td.cu-registry-description {
.cu-identity-preview {
width: 100%;
min-width: 0;
- min-height: min(42rem, calc(100vh - 24rem));
- overflow: auto;
+ min-height: 0;
+ max-height: 100%;
+ overflow-y: auto;
+ overscroll-behavior: contain;
padding: var(--cu-space-4);
border: 1px solid var(--cu-border-subtle);
border-radius: var(--cu-radius-sm);
@@ -9032,6 +9034,8 @@ td.cu-registry-description {
}
.cu-agent-detail-scroll:has(> .cu-identity-panel) {
+ display: flex;
+ flex-direction: column;
padding: 0;
}
diff --git a/control-ui/app/hosts/[name]/page.tsx b/control-ui/app/hosts/[name]/page.tsx
index 55f7e1547..70bca45c8 100644
--- a/control-ui/app/hosts/[name]/page.tsx
+++ b/control-ui/app/hosts/[name]/page.tsx
@@ -1453,11 +1453,10 @@ export default function HostDetailsPage() {
}
onDismiss={() => void cancelModelEdit()}
open={editingModel}
- size="large"
- title="Edit model & credentials"
+ size="default"
+ title="Edit model configuration"
>
<div className="cu-form-stack cu-form-stack--wide">
- {renderModelCredentialFields('model-secret-editor', busy)}
<LlmProviderConfig
provider={providerDraft}
model={modelNameDraft}
diff --git a/control-ui/components/HostIdentityTab/index.tsx b/control-ui/components/HostIdentityTab/index.tsx
index 6a22578b2..5a3d7a873 100644
--- a/control-ui/components/HostIdentityTab/index.tsx
+++ b/control-ui/components/HostIdentityTab/index.tsx
@@ -223,21 +223,21 @@ export function HostIdentityTab({ hostName, onActionsChange }: HostIdentityTabPr
</div>
<div
- aria-label={!activeValue.trim() ? `Edit ${activeConfig.fileName}` : undefined}
- className={`cu-identity-preview${!activeValue.trim() ? ' cu-identity-preview--editable' : ''}`}
- onClick={!activeValue.trim() ? openEditor : undefined}
- onKeyDown={
- !activeValue.trim()
- ? event => {
- if (event.key === 'Enter' || event.key === ' ') {
- event.preventDefault()
- openEditor()
- }
- }
- : undefined
- }
- role={!activeValue.trim() ? 'button' : undefined}
- tabIndex={!activeValue.trim() ? 0 : undefined}
+ aria-label={`Edit ${activeConfig.fileName}`}
+ className="cu-identity-preview cu-identity-preview--editable"
+ onClick={event => {
+ if (event.target instanceof Element && event.target.closest('a')) return
+ openEditor()
+ }}
+ onKeyDown={event => {
+ if (event.target !== event.currentTarget) return
+ if (event.key === 'Enter' || event.key === ' ') {
+ event.preventDefault()
+ openEditor()
+ }
+ }}
+ role="button"
+ tabIndex={0}
>
<MarkdownContent
ariaLabel={`Rendered ${activeConfig.label} document`}
diff --git a/control-ui/components/__tests__/HostDetailsPage.conflict.test.tsx b/control-ui/components/__tests__/HostDetailsPage.conflict.test.tsx
index 775c05ba1..9055d5b99 100644
--- a/control-ui/components/__tests__/HostDetailsPage.conflict.test.tsx
+++ b/control-ui/components/__tests__/HostDetailsPage.conflict.test.tsx
@@ -334,11 +334,17 @@ describe('HostDetailsPage current model and credential flow', () => {
const view = render(<HostDetailsPage />)
navigateToTab(view, 'model')
expect(await screen.findByText('Current model')).toBeInTheDocument()
+ expect(screen.getByRole('button', { name: 'Edit LLM Secret credentials' })).toBeInTheDocument()
fireEvent.click(screen.getByRole('button', { name: 'Edit' }))
- const dialog = await screen.findByRole('dialog', { name: 'Edit model & credentials' })
+ const dialog = await screen.findByRole('dialog', { name: 'Edit model configuration' })
+ expect(dialog).toHaveClass('eft-dialog--default')
expect(within(dialog).getByRole('region', { name: 'LLM configuration' })).toBeInTheDocument()
+ expect(within(dialog).queryByLabelText('Credential')).not.toBeInTheDocument()
+ expect(
+ within(dialog).queryByRole('button', { name: 'Edit LLM Secret credentials' })
+ ).not.toBeInTheDocument()
expect(within(dialog).getByRole('button', { name: 'Save' })).toBeInTheDocument()
expect(screen.getByRole('button', { name: 'Edit' })).toBeDisabled()
expect(screen.queryByRole('button', { name: 'Update secret' })).not.toBeInTheDocument()
@@ -559,7 +565,7 @@ describe('HostDetailsPage current model and credential flow', () => {
).toBe(false)
})
- it('changes the linked LLM Secret from the inline credentials dropdown', async () => {
+ it('keeps the linked LLM Secret selector outside the model configuration editor', async () => {
setupApiMocks(formLoadHost, refetchedHost, [
{ name: 'openai-secret', keys: ['openai-api-key'] },
{ name: 'openai-secret-b', keys: ['openai-api-key'] },
@@ -567,17 +573,18 @@ describe('HostDetailsPage current model and credential flow', () => {
const view = render(<HostDetailsPage />)
navigateToTab(view, 'model')
await screen.findByText('Current model')
+ expect(screen.getByLabelText('LLM Secret')).toBeDisabled()
fireEvent.click(screen.getByRole('button', { name: 'Edit' }))
- fireEvent.click(screen.getByRole('button', { name: 'LLM Secret' }))
- fireEvent.click(screen.getByRole('option', { name: /openai-secret-b/ }))
- fireEvent.click(screen.getByRole('button', { name: 'Save' }))
+ const dialog = await screen.findByRole('dialog', { name: 'Edit model configuration' })
+ expect(within(dialog).queryByLabelText('LLM Secret')).not.toBeInTheDocument()
+ fireEvent.click(within(dialog).getByRole('button', { name: 'Save' }))
await waitFor(() =>
expect(api.apiSend).toHaveBeenCalledWith('PUT', '/api/v1/admin/hosts/foo', expect.any(Object))
)
const payload = findHostPutPayload() as { spec: Record<string, unknown> }
- expect(payload.spec.secretRef).toBe('openai-secret-b')
+ expect(payload.spec.secretRef).toBe('openai-secret')
expect(payload.spec.model).toEqual(baseSpec.model)
expect(screen.queryByRole('dialog')).not.toBeInTheDocument()
})
@@ -653,7 +660,7 @@ describe('HostDetailsPage cross-tab draft preservation', () => {
expect(await screen.findByText('Current model')).toBeInTheDocument()
fireEvent.click(screen.getByRole('button', { name: 'Edit' }))
- expect(screen.getByLabelText('Credential')).toBeInTheDocument()
+ expect(screen.queryByLabelText('Credential')).not.toBeInTheDocument()
expect(screen.queryByText('Secret reference')).not.toBeInTheDocument()
expect(screen.queryByRole('radio', { name: /ChatGPT subscription/i })).not.toBeInTheDocument()
expect(screen.getByRole('button', { name: 'Save' })).toBeDisabled()
diff --git a/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx b/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx
index 4b57ae29f..b6eb01efb 100644
--- a/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx
+++ b/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx
@@ -330,7 +330,7 @@ describe('HostDetailsPage identity integration', () => {
expect(container.querySelector('.cu-agent-detail-card')).toBeNull()
})
- it('uses a custom LLM Secret picker with the enabled provider icons', async () => {
+ it('shows the fixed LLM Secret assignment with provider icons outside the model editor', async () => {
mockParams = { name: 'foo', tab: 'model' }
;(api.getHostDetailBundle as unknown as ReturnType<typeof vi.fn>).mockResolvedValue({
host,
@@ -356,11 +356,10 @@ describe('HostDetailsPage identity integration', () => {
expect(screen.queryByRole('combobox')).toBeNull()
fireEvent.click(screen.getByRole('button', { name: 'Edit' }))
- fireEvent.click(screen.getByRole('button', { name: 'LLM Secret' }))
-
- const zaiOption = screen.getByRole('option', { name: /zai-secret/ })
- expect(zaiOption).toHaveTextContent('Z.AI')
- expect(zaiOption.querySelector('img')).toHaveAttribute('src', '/provider-icons/zai.svg')
+ const dialog = await screen.findByRole('dialog', { name: 'Edit model configuration' })
+ expect(within(dialog).queryByLabelText('LLM Secret')).not.toBeInTheDocument()
+ expect(dialog.querySelector('#llm-primary-provider')).toBeInTheDocument()
+ expect(picker).toBeDisabled()
})
it('uses the shared LLM Secret editor for additional provider credentials', async () => {
@@ -566,7 +565,8 @@ describe('HostDetailsPage identity integration', () => {
expect(screen.queryByText('Secret reference')).not.toBeInTheDocument()
expect(screen.queryByText('OpenAI Codex Subscription')).not.toBeInTheDocument()
fireEvent.click(screen.getByRole('button', { name: 'Edit' }))
- expect(screen.getByLabelText('Credential')).toBeInTheDocument()
+ const dialog = screen.getByRole('dialog', { name: 'Edit model configuration' })
+ expect(within(dialog).queryByLabelText('Credential')).not.toBeInTheDocument()
expect(screen.queryByRole('radio', { name: /ChatGPT subscription/i })).not.toBeInTheDocument()
expect(screen.getByRole('button', { name: 'Save' })).toBeDisabled()
fireEvent.click(screen.getByRole('button', { name: 'Save' }))
@@ -805,7 +805,7 @@ describe('HostDetailsPage identity integration', () => {
expect(screen.queryByText('disabled')).not.toBeInTheDocument()
})
- it('keeps a second LLM Secret field in existing control-ui styles when Codex has a static fallback', async () => {
+ it('keeps credential assignment controls out of the model editor with a static fallback', async () => {
mockParams = { name: 'foo', tab: 'model' }
vi.mocked(listCodexSubscriptionConnections).mockResolvedValue([
{
@@ -851,13 +851,10 @@ describe('HostDetailsPage identity integration', () => {
render(<HostDetailsPage />)
fireEvent.click(await screen.findByRole('button', { name: 'Edit' }))
- const dialog = await screen.findByRole('dialog', { name: 'Edit model & credentials' })
- expect(within(dialog).getByLabelText('Credential')).toBeInTheDocument()
- expect(within(dialog).getByLabelText('LLM Secret')).toBeInTheDocument()
- expect(dialog.querySelectorAll('.cu-llm-secret-control')).toHaveLength(2)
- expect(dialog.querySelectorAll('.cu-field__hint').length).toBeGreaterThanOrEqual(2)
- expect(
- within(dialog).getByRole('button', { name: 'Edit LLM Secret credentials' })
- ).toBeInTheDocument()
+ const dialog = await screen.findByRole('dialog', { name: 'Edit model configuration' })
+ expect(within(dialog).queryByLabelText('Credential')).not.toBeInTheDocument()
+ expect(within(dialog).queryByLabelText('LLM Secret')).not.toBeInTheDocument()
+ expect(dialog.querySelectorAll('.cu-llm-secret-control')).toHaveLength(0)
+ expect(dialog.querySelector('#llm-primary-provider')).toBeInTheDocument()
})
})
diff --git a/control-ui/components/__tests__/HostIdentityTab.test.tsx b/control-ui/components/__tests__/HostIdentityTab.test.tsx
index 28a3c3116..fc775aacc 100644
--- a/control-ui/components/__tests__/HostIdentityTab.test.tsx
+++ b/control-ui/components/__tests__/HostIdentityTab.test.tsx
@@ -50,6 +50,10 @@ describe('HostIdentityTab', () => {
expect(screen.getByRole('heading', { name: 'IDENTITY.md' })).toBeInTheDocument()
expect(screen.queryByLabelText('Identity markdown')).toBeNull()
+ fireEvent.click(identity)
+ expect(await screen.findByRole('dialog', { name: 'Edit IDENTITY.md' })).toBeInTheDocument()
+ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }))
+
fireEvent.click(screen.getByRole('tab', { name: 'Soul' }))
const soul = await screen.findByRole('article', { name: 'Rendered Soul document' })
await waitFor(() => expect(soul).toHaveTextContent('Values'), { timeout: 10000 })
@@ -57,6 +61,15 @@ describe('HostIdentityTab', () => {
expect(screen.getByRole('button', { name: 'Edit' })).toBeInTheDocument()
})
+ it('opens a filled document from the preview keyboard control', async () => {
+ renderTab()
+
+ const preview = await screen.findByRole('button', { name: 'Edit IDENTITY.md' })
+ fireEvent.keyDown(preview, { key: ' ' })
+
+ expect(await screen.findByRole('dialog', { name: 'Edit IDENTITY.md' })).toBeInTheDocument()
+ })
+
it('opens the editor from the empty identity surface by click or keyboard', async () => {
vi.mocked(api.getHostPersonalization).mockResolvedValue({
...initialFiles,
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index dc8baf6ea..c3fc3684c 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.634",
+ "version": "0.1.635",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.634",
+ "version": "0.1.635",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/frontend-components": "file:../packages/frontend-components",
diff --git a/control-ui/package.json b/control-ui/package.json
index 4e85be939..f8b318690 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.634",
+ "version": "0.1.635",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",