Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
Merge remote-tracking branch 'origin/dev' into feat/plugin-sdk-platform-rate-limits
Alfredo Lopez8e21ff813dd2
diff --cc control-ui/components/HostTable.tsxindex 274a75997,ffbc9455e..0ca83ebc7--- a/control-ui/components/HostTable.tsx+++ b/control-ui/components/HostTable.tsx@@@ -1,9 -1,9 +1,9 @@@'use client'import React, { useMemo, useState } from 'react'--import { LlmProviderIcon } from './LlmProviderIcon'import { getProviderLabel } from '../lib/llm'import type { HostItem, HostLifecycleInfo, HostRef } from './HostTable.types'++import { LlmProviderIcon } from './LlmProviderIcon'import { SectionSearchInput } from './SectionSearchInput'import { IconRobot } from './Sidebar/icons'import { SkeletonTableRows } from './SkeletonTableRows'@@@ -50,15 -50,15 +50,11 @@@ function getHostLifecycleInfo(host: Hos}export function collectProviderIds(spec: Record<string, unknown>): string[] {-- const primary = String(-- (spec.model as { provider?: string } | undefined)?.provider || ''-- ).trim()++ const primary = String((spec.model as { provider?: string } | undefined)?.provider || '').trim()const fallbacks = Array.isArray((spec.llmPolicy as { fallbacks?: Array<{ provider?: string }> } | undefined)?.fallbacks)-- ? (-- spec.llmPolicy as { fallbacks: Array<{ provider?: string }> }-- ).fallbacks++ ? (spec.llmPolicy as { fallbacks: Array<{ provider?: string }> }).fallbacks.map(f => String(f.provider || '').trim()).filter(Boolean): []diff --cc control-ui/components/__tests__/HostTable.test.tsxindex ce2d42088,0deaea959..ed9c2e7d2--- a/control-ui/components/__tests__/HostTable.test.tsx+++ b/control-ui/components/__tests__/HostTable.test.tsx@@@ -1,6 -1,6 +1,6 @@@import { describe, expect, it, vi } from 'vitest'import { fireEvent, render, screen, within } from '@testing-library/react'--import { collectProviderIds, HostTable } from '../HostTable'++import { HostTable, collectProviderIds } from '../HostTable'import type { HostItem } from '../HostTable.types'function makeHost(overrides: {@@@ -153,9 -153,9 +153,9 @@@ describe('collectProviderIds (HostTabl// assertions bind the cell's DOM contract to the helper's output.describe('HostTable providers column rendering', () => {function chipTitles(cell: HTMLElement): string[] {-- return Array.from(-- cell.querySelectorAll<HTMLElement>('.cu-host-providers__chip')-- ).map(chip => chip.getAttribute('title') || '')++ return Array.from(cell.querySelectorAll<HTMLElement>('.cu-host-providers__chip')).map(++ chip => chip.getAttribute('title') || ''++ )}function providersCell(row: HTMLElement): HTMLElement {@@@ -179,11 -179,11 +179,10 @@@it('renders one icon per unique provider in primary-then-fallback order', () => {renderHostTable([-- hostWithModel(-- 'chatllm',-- { provider: 'openai' },-- [{ provider: 'claude' }, { provider: 'zai' }]-- ),++ hostWithModel('chatllm', { provider: 'openai' }, [++ { provider: 'claude' },++ { provider: 'zai' },++ ]),])const row = screen.getByLabelText('Open agent chatllm')@@@ -198,11 -198,11 +197,10 @@@it('renders a single icon when a fallback duplicates the primary', () => {renderHostTable([-- hostWithModel(-- 'chatllm',++ hostWithModel('chatllm', { provider: 'openai' }, [{ provider: 'openai' },-- [{ provider: 'openai' }, { provider: 'zai' }]-- ),++ { provider: 'zai' },++ ]),])const row = screen.getByLabelText('Open agent chatllm')diff --cc control-ui/components/__tests__/HostWizard.test.tsxindex 142d63604,8bcdc74a3..3c63bbb79--- a/control-ui/components/__tests__/HostWizard.test.tsx+++ b/control-ui/components/__tests__/HostWizard.test.tsx@@@ -580,3 -631,115 +631,111 @@@ describe('HostWizard — Agent type (stexpect('workflowControl' in payload.spec).toBe(false)})})++ describe('HostWizard — create-only seam + compensation (R5-C1/R5-B1, V-1, V-7)', () => {+ it('surfaces the friendly collision message and rolls back the created secret when the context POST 409s WITHOUT a body code', async () => {+ // Code-less 409 from a create-only POST = unambiguous AlreadyExists collision.+ const collision = await build409({+ error: 'contexts.mcp.evenfire.io "ctx1" already exists',+ })+ vi.mocked(api.apiSend).mockImplementation(async (method: string, path: string) => {+ if (method === 'POST' && path === '/api/v1/admin/contexts') throw collision+ return {}+ })++ await renderWizard()+ await walkToAccessStepNewSecret({ agentName: 'coll-agent', contextName: 'ctx1' })+ fireEvent.click(screen.getByRole('button', { name: /Create Agent/i }))++ // Observable (T4): the friendly per-resource collision message is shown —+ // NOT the raw K8s AlreadyExists text.+ await waitFor(() => {+ expect(screen.getByText(/A context named "ctx1" already exists/i)).toBeInTheDocument()+ })+ // Observable (T4): the already-created secret is compensated with an inverse DELETE.+ expect(api.apiSend).toHaveBeenCalledWith('DELETE', '/api/v1/admin/secrets/coll-agent-llm')+ // The Host was never POSTed (the seam aborted before the boundary).+ expect(- vi- .mocked(api.apiSend)- .mock.calls.some(c => c[0] === 'POST' && c[1] === '/api/v1/admin/hosts')++ vi.mocked(api.apiSend).mock.calls.some(c => c[0] === 'POST' && c[1] === '/api/v1/admin/hosts')+ ).toBe(false)+ })++ it('rolls back the created secret AND context in inverse order when the HOST create fails', async () => {+ const hostErr = await build409({+ error: 'hosts.mcp.evenfire.io "hostfail" already exists',+ })+ vi.mocked(api.apiSend).mockImplementation(async (method: string, path: string) => {+ if (method === 'POST' && path === '/api/v1/admin/hosts') throw hostErr+ return {}+ })++ await renderWizard()+ await walkToAccessStepNewSecret({ agentName: 'hostfail', contextName: 'ctx1' })+ fireEvent.click(screen.getByRole('button', { name: /Create Agent/i }))++ await waitFor(() => {+ expect(screen.getByText(/That agent name is already in use/i)).toBeInTheDocument()+ })+ // Inverse order: created = [secret, context] → compensate context THEN secret.+ const deletePaths = vi+ .mocked(api.apiSend)+ .mock.calls.filter(c => c[0] === 'DELETE')+ .map(c => c[1])+ expect(deletePaths).toEqual([+ '/api/v1/admin/contexts/ctx1',+ '/api/v1/admin/secrets/hostfail-llm',+ ])+ })++ it('rolls back NOTHING when a GRANT fails after the host is created (V-7)', async () => {+ // The grant runs AFTER hostCreated=true; its failure must not trigger any+ // sibling rollback — the host + siblings stay and grants retry from detail.+ // vi.clearAllMocks() resets call history but NOT implementations, so pin a+ // clean all-resolving apiSend for this test (prior tests set throwing ones).+ vi.mocked(api.apiSend).mockImplementation(async () => ({}))+ vi.mocked(api.updateAgentUsers).mockRejectedValueOnce(new Error('grant boom'))++ await renderWizard()+ await walkToAccessStepNewSecret({ agentName: 'grantfail', contextName: 'ctx1' })+ // Select a user so updateAgentUsers is invoked.+ fireEvent.click(screen.getByLabelText(/alice/i))+ fireEvent.click(screen.getByRole('button', { name: /Create Agent/i }))++ // The grant error is surfaced verbatim (no 409 remap at the top level).+ await waitFor(() => {+ expect(screen.getByText(/grant boom/i)).toBeInTheDocument()+ })+ // The host WAS created...+ expect(- vi- .mocked(api.apiSend)- .mock.calls.some(c => c[0] === 'POST' && c[1] === '/api/v1/admin/hosts')++ vi.mocked(api.apiSend).mock.calls.some(c => c[0] === 'POST' && c[1] === '/api/v1/admin/hosts')+ ).toBe(true)+ // ...so NO compensation DELETE runs.+ expect(vi.mocked(api.apiSend).mock.calls.some(c => c[0] === 'DELETE')).toBe(false)+ })++ it('re-throws the server message untouched on a CODED 409 (CRD-outdated) — no collision remap', async () => {+ // 409 WITH a body `code` = CRD-outdated, NOT a collision: keep the server's+ // human message, do not remap to the friendly "already exists" text.+ const crdErr = await build409({+ error: 'context CRD is outdated; apply the latest CRDs and retry',+ code: 'context_crd_outdated',+ })+ vi.mocked(api.apiSend).mockImplementation(async (method: string, path: string) => {+ if (method === 'POST' && path === '/api/v1/admin/contexts') throw crdErr+ return {}+ })++ await renderWizard()+ await walkToAccessStepNewSecret({ agentName: 'crd-agent', contextName: 'ctx1' })+ fireEvent.click(screen.getByRole('button', { name: /Create Agent/i }))++ await waitFor(() => {+ expect(screen.getByText(/context CRD is outdated/i)).toBeInTheDocument()+ })+ // The friendly collision text must NOT appear (coded 409 is not a collision).+ expect(screen.queryByText(/A context named .* already exists/i)).not.toBeInTheDocument()+ // Boundary rule still applies: the secret created before the failing context+ // is compensated (host never created), but nothing beyond that.+ expect(api.apiSend).toHaveBeenCalledWith('DELETE', '/api/v1/admin/secrets/crd-agent-llm')+ })+ })diff --cc control-ui/package-lock.jsonindex 51480167a,eded39141..565e2ad6d--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@@ -1,13 -1,14 +1,14 @@@{"name": "clerum-control-ui",-- "version": "0.1.424",++ "version": "0.1.425","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",-- "version": "0.1.424",++ "version": "0.1.425","dependencies": {+ "@clerum/display-field": "file:../packages/display-field","@clerum/llm-providers": "file:../packages/llm-providers","@clerum/workflow-recipe-capability-policy": "file:../packages/workflow-recipe-capability-policy","@uiw/react-md-editor": "^4.1.0",diff --cc control-ui/package.jsonindex 180be428b,7d15b008c..7093f5431--- a/control-ui/package.json+++ b/control-ui/package.json@@@ -1,6 -1,6 +1,6 @@@{"name": "clerum-control-ui",-- "version": "0.1.424",++ "version": "0.1.425","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",diff --cc mcp-host/package-lock.jsonindex a62cdc464,a62cdc464..8519e148d--- a/mcp-host/package-lock.json+++ b/mcp-host/package-lock.json@@@ -1,12 -1,12 +1,12 @@@{"name": "clerum-mcp-host",-- "version": "0.1.238",++ "version": "0.1.239","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-mcp-host",-- "version": "0.1.238",++ "version": "0.1.239","license": "SEE LICENSE IN LICENSE","dependencies": {"@anthropic-ai/sdk": "^0.32.0",diff --cc mcp-host/package.jsonindex 2b209bb31,2b209bb31..2dcb39dec--- a/mcp-host/package.json+++ b/mcp-host/package.json@@@ -1,6 -1,6 +1,6 @@@{"name": "clerum-mcp-host",-- "version": "0.1.238",++ "version": "0.1.239","description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude","main": "dist/main.js","engines": {