Skip to content

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

TypeScript

feat: expand agent identity read and edit surfaces

Josué4f27fdd951d0
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.css
index 5d9da454a..06ec5d8d2 100644
--- a/control-ui/app/globals.css
+++ b/control-ui/app/globals.css
@@ -8981,6 +8981,8 @@ td.cu-registry-description {
}
.cu-identity-preview {
+ width: 100%;
+ min-width: 0;
min-height: min(42rem, calc(100vh - 24rem));
overflow: auto;
padding: var(--cu-space-4);
@@ -8998,11 +9000,13 @@ td.cu-registry-description {
display: flex;
flex-direction: column;
gap: var(--cu-space-2);
- min-height: min(60vh, 40rem);
+ flex: 1;
+ min-height: 0;
}
.cu-identity-dialog-editor .cu-markdown-editor {
- min-height: min(52vh, 34rem);
+ flex: 1;
+ min-height: 0;
}
.cu-detail-flow-panel + .cu-card:has(.cu-identity-panel) {
@@ -14309,3 +14313,63 @@ button.cu-gfs-tree__button:focus-visible,
.cu-llm-policy__actions {
display: flex;
}
+
+.cu-identity-preview > .cu-gfs-markdown-preview__content {
+ width: 100%;
+ max-width: none;
+ margin: 0;
+}
+
+.cu-identity-preview--editable {
+ cursor: pointer;
+}
+
+.cu-identity-preview--editable:hover {
+ border-color: var(--cu-accent);
+}
+
+.cu-identity-preview--editable:focus-visible {
+ outline: 2px solid rgba(var(--cu-focus-rgb), 0.8);
+ outline-offset: 2px;
+}
+
+.eft-dialog.cu-identity-edit-dialog {
+ width: 100%;
+ max-width: min(96vw, 90rem);
+ height: min(94vh, 64rem);
+ max-height: calc(100vh - 2 * var(--cu-space-4));
+ overflow: hidden;
+}
+
+.eft-dialog.cu-identity-edit-dialog .eft-dialog__content {
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+ min-height: 0;
+}
+
+.eft-dialog.cu-identity-edit-dialog .eft-dialog__form {
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+ min-height: 0;
+}
+
+@supports (height: 100dvh) {
+ .eft-dialog.cu-identity-edit-dialog {
+ max-height: calc(100dvh - 2 * var(--cu-space-4));
+ }
+}
+
+@media (max-width: 40rem) {
+ .eft-dialog.cu-identity-edit-dialog {
+ height: calc(100vh - 2 * var(--cu-space-4));
+ max-width: 100%;
+ }
+
+ @supports (height: 100dvh) {
+ .eft-dialog.cu-identity-edit-dialog {
+ height: calc(100dvh - 2 * var(--cu-space-4));
+ }
+ }
+}
diff --git a/control-ui/components/HostIdentityTab/index.tsx b/control-ui/components/HostIdentityTab/index.tsx
index e742cdd42..6a22578b2 100644
--- a/control-ui/components/HostIdentityTab/index.tsx
+++ b/control-ui/components/HostIdentityTab/index.tsx
@@ -222,16 +222,35 @@ export function HostIdentityTab({ hostName, onActionsChange }: HostIdentityTabPr
</Button>
</div>
- <MarkdownContent
- ariaLabel={`Rendered ${activeConfig.label} document`}
- className="cu-identity-preview cu-gfs-markdown-preview__content"
- emptyMessage="This identity document is empty."
- source={activeValue}
- />
+ <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}
+ >
+ <MarkdownContent
+ ariaLabel={`Rendered ${activeConfig.label} document`}
+ className="cu-gfs-markdown-preview__content"
+ emptyMessage="This identity document is empty."
+ source={activeValue}
+ />
+ </div>
</div>
<SingleValueEditDialog
closeButtonLabel={`Close ${activeConfig.fileName} editor`}
+ className="cu-identity-edit-dialog"
description={activeConfig.help}
discardLabel="Cancel"
error={state.error || undefined}
diff --git a/control-ui/components/__tests__/HostIdentityTab.test.tsx b/control-ui/components/__tests__/HostIdentityTab.test.tsx
index 911bc35cf..28a3c3116 100644
--- a/control-ui/components/__tests__/HostIdentityTab.test.tsx
+++ b/control-ui/components/__tests__/HostIdentityTab.test.tsx
@@ -57,10 +57,28 @@ describe('HostIdentityTab', () => {
expect(screen.getByRole('button', { name: 'Edit' })).toBeInTheDocument()
})
+ it('opens the editor from the empty identity surface by click or keyboard', async () => {
+ vi.mocked(api.getHostPersonalization).mockResolvedValue({
+ ...initialFiles,
+ identity: '',
+ })
+ renderTab()
+
+ const emptySurface = await screen.findByRole('button', { name: 'Edit IDENTITY.md' })
+ fireEvent.click(emptySurface)
+ const dialog = await screen.findByRole('dialog', { name: 'Edit IDENTITY.md' })
+ expect(dialog).toHaveClass('cu-identity-edit-dialog')
+ fireEvent.click(within(dialog).getByRole('button', { name: 'Cancel' }))
+
+ fireEvent.keyDown(emptySurface, { key: 'Enter' })
+ expect(await screen.findByRole('dialog', { name: 'Edit IDENTITY.md' })).toBeInTheDocument()
+ })
+
it('opens the current Markdown editor in the large shared dialog and cancels without saving', async () => {
renderTab()
const dialog = await openIdentityEditor()
expect(dialog).toHaveClass('eft-dialog--large')
+ expect(dialog).toHaveClass('cu-identity-edit-dialog')
expect(within(dialog).getByLabelText('Identity markdown')).toHaveValue(initialFiles.identity)
fireEvent.change(within(dialog).getByLabelText('Identity markdown'), {
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index c94f8df72..1e9ec8283 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.632",
+ "version": "0.1.633",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.632",
+ "version": "0.1.633",
"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 f6e3841da..7d6330607 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.632",
+ "version": "0.1.633",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --git a/packages/frontend-components/src/edit/SingleValueEditDialog.tsx b/packages/frontend-components/src/edit/SingleValueEditDialog.tsx
index 216fad56a..b1298dee2 100644
--- a/packages/frontend-components/src/edit/SingleValueEditDialog.tsx
+++ b/packages/frontend-components/src/edit/SingleValueEditDialog.tsx
@@ -20,6 +20,7 @@ export function SingleValueEditDialog<T>({
saveLabel = 'Save',
closeButtonLabel,
size = 'default',
+ className,
}: SingleValueEditDialogProps<T>) {
const formId = useId()
const [value, setValue] = useState(initialValue)
@@ -62,6 +63,7 @@ export function SingleValueEditDialog<T>({
return (
<DialogShell
busy={pending}
+ className={className}
closeButtonLabel={closeButtonLabel}
description={description}
error={error}
diff --git a/packages/frontend-components/src/edit/types.ts b/packages/frontend-components/src/edit/types.ts
index e1e6fac2c..ebd9fd881 100644
--- a/packages/frontend-components/src/edit/types.ts
+++ b/packages/frontend-components/src/edit/types.ts
@@ -70,6 +70,7 @@ export interface SingleValueEditDialogProps<T> {
saveLabel?: string
closeButtonLabel?: string
size?: DialogSize
+ className?: string
}
export interface SimpleEditDialogProps {