From d78b28356760a39b483d546270d0f94e3ea2a7e1 Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Fri, 13 Mar 2026 17:50:08 +0100 Subject: [PATCH] Fix AgentInstance schema to match backend API (id not agentId) Backend AgentInfo record uses 'id' but UI schema had 'agentId', causing undefined property access crash in command palette. Regenerated openapi.json and aligned all UI types with live spec. Co-Authored-By: Claude Opus 4.6 --- ui/src/api/openapi.json | 67 +++++++++++++++++++ ui/src/api/schema.d.ts | 9 ++- .../command-palette/CommandPalette.tsx | 2 +- .../components/command-palette/ResultItem.tsx | 2 +- .../command-palette/use-palette-search.ts | 4 +- 5 files changed, 78 insertions(+), 6 deletions(-) diff --git a/ui/src/api/openapi.json b/ui/src/api/openapi.json index 6cd08d82..422a2de5 100644 --- a/ui/src/api/openapi.json +++ b/ui/src/api/openapi.json @@ -91,6 +91,30 @@ "type": "string" } }, + { + "name": "routeId", + "in": "query", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "agentId", + "in": "query", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "processorType", + "in": "query", + "required": false, + "schema": { + "type": "string" + } + }, { "name": "offset", "in": "query", @@ -633,6 +657,27 @@ } } }, + "/api/v1/search/stats": { + "get": { + "tags": [ + "Search" + ], + "summary": "Aggregate execution stats (P99 latency, active count)", + "operationId": "stats", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/ExecutionStats" + } + } + } + } + } + } + }, "/api/v1/executions/{executionId}": { "get": { "tags": [ @@ -882,6 +927,15 @@ "textInErrors": { "type": "string" }, + "routeId": { + "type": "string" + }, + "agentId": { + "type": "string" + }, + "processorType": { + "type": "string" + }, "offset": { "type": "integer", "format": "int32" @@ -972,6 +1026,19 @@ } } }, + "ExecutionStats": { + "type": "object", + "properties": { + "p99LatencyMs": { + "type": "integer", + "format": "int64" + }, + "activeCount": { + "type": "integer", + "format": "int64" + } + } + }, "ExecutionDetail": { "type": "object", "properties": { diff --git a/ui/src/api/schema.d.ts b/ui/src/api/schema.d.ts index 6397ef04..ceb406c9 100644 --- a/ui/src/api/schema.d.ts +++ b/ui/src/api/schema.d.ts @@ -198,9 +198,14 @@ export interface ExecutionStats { } export interface AgentInstance { - agentId: string; + id: string; + name: string; group: string; + version: string; + routeIds: string[]; + capabilities: Record; state: 'LIVE' | 'STALE' | 'DEAD'; - lastHeartbeat: string; registeredAt: string; + lastHeartbeat: string; + staleTransitionTime: string | null; } diff --git a/ui/src/components/command-palette/CommandPalette.tsx b/ui/src/components/command-palette/CommandPalette.tsx index 25f58588..5f4b6281 100644 --- a/ui/src/components/command-palette/CommandPalette.tsx +++ b/ui/src/components/command-palette/CommandPalette.tsx @@ -30,7 +30,7 @@ export function CommandPalette() { } else if (result.type === 'agent') { const agent = result.data as AgentInstance; execSearch.setStatus(['COMPLETED', 'FAILED', 'RUNNING']); - execSearch.setAgentId(agent.agentId); + execSearch.setAgentId(agent.id); execSearch.setText(''); execSearch.setRouteId(''); execSearch.setProcessorType(''); diff --git a/ui/src/components/command-palette/ResultItem.tsx b/ui/src/components/command-palette/ResultItem.tsx index f985ea07..94244321 100644 --- a/ui/src/components/command-palette/ResultItem.tsx +++ b/ui/src/components/command-palette/ResultItem.tsx @@ -91,7 +91,7 @@ function AgentResult({ data, query }: { data: AgentInstance; query: string }) {
- + {data.state}
diff --git a/ui/src/components/command-palette/use-palette-search.ts b/ui/src/components/command-palette/use-palette-search.ts index 286f228c..772c003b 100644 --- a/ui/src/components/command-palette/use-palette-search.ts +++ b/ui/src/components/command-palette/use-palette-search.ts @@ -70,12 +70,12 @@ export function usePaletteSearch() { const filteredAgents = (agentsQuery.data ?? []).filter((a) => { if (!debouncedQuery) return true; const q = debouncedQuery.toLowerCase(); - return a.agentId.toLowerCase().includes(q) || a.group.toLowerCase().includes(q); + return a.id.toLowerCase().includes(q) || a.group.toLowerCase().includes(q); }); const agentResults: PaletteResult[] = filteredAgents.slice(0, 10).map((a) => ({ type: 'agent' as const, - id: a.agentId, + id: a.id, data: a, }));