| 5 | import type { AgentRunWithMetrics } from '@/lib/api'; |
| 6 | |
| 7 | interface AgentState { |
| 8 | // Agent runs data |
| 9 | agentRuns: AgentRunWithMetrics[]; |
| 10 | runningAgents: Set<string>; |
| 11 | sessionOutputs: Record<string, string>; |
| 12 | |
| 13 | // UI state |
| 14 | isLoadingRuns: boolean; |
| 15 | isLoadingOutput: boolean; |
| 16 | error: string | null; |
| 17 | lastFetchTime: number; |
| 18 | |
| 19 | // Actions |
| 20 | fetchAgentRuns: (forceRefresh?: boolean) => Promise<void>; |
| 21 | fetchSessionOutput: (runId: number) => Promise<void>; |
| 22 | createAgentRun: (data: { agentId: number; projectPath: string; task: string; model?: string }) => Promise<AgentRunWithMetrics>; |
| 23 | cancelAgentRun: (runId: number) => Promise<void>; |
| 24 | deleteAgentRun: (runId: number) => Promise<void>; |
| 25 | clearError: () => void; |
| 26 | |
| 27 | // Real-time updates |
| 28 | handleAgentRunUpdate: (run: AgentRunWithMetrics) => void; |
| 29 | |
| 30 | // Polling management |
| 31 | startPolling: (interval?: number) => void; |
| 32 | stopPolling: () => void; |
| 33 | pollingInterval: NodeJS.Timeout | null; |
| 34 | } |
| 35 | |
| 36 | const agentStore: StateCreator< |
| 37 | AgentState, |
nothing calls this directly
no outgoing calls
no test coverage detected