Adds assistants.
This commit is contained in:
@@ -17,6 +17,9 @@ import type {
|
||||
MeshStatus,
|
||||
NodeSummary,
|
||||
NodeDetail,
|
||||
AgentInfo,
|
||||
AgentSessionInfo,
|
||||
AgentHistoryEntry,
|
||||
} from "@/types"
|
||||
|
||||
// Compat hook for the /deployments/{name} unified detail endpoint
|
||||
@@ -208,6 +211,39 @@ export function useMeshStatus() {
|
||||
})
|
||||
}
|
||||
|
||||
export function useAgents() {
|
||||
return useQuery({
|
||||
queryKey: ["agents"],
|
||||
queryFn: () => apiClient.get<AgentInfo[]>("/agents"),
|
||||
staleTime: Infinity,
|
||||
})
|
||||
}
|
||||
|
||||
export function useAgentSessions() {
|
||||
return useQuery({
|
||||
queryKey: ["agent-sessions"],
|
||||
queryFn: () => apiClient.get<AgentSessionInfo[]>("/agents/sessions"),
|
||||
refetchInterval: 5_000,
|
||||
})
|
||||
}
|
||||
|
||||
export function useAgentHistory(enabled: boolean) {
|
||||
return useQuery({
|
||||
queryKey: ["agent-history"],
|
||||
queryFn: () => apiClient.get<AgentHistoryEntry[]>("/agents/history"),
|
||||
enabled,
|
||||
staleTime: 10_000,
|
||||
})
|
||||
}
|
||||
|
||||
export function useDeleteAgentSession() {
|
||||
const qc = useQueryClient()
|
||||
return useMutation({
|
||||
mutationFn: (id: string) => apiClient.delete(`/agents/sessions/${id}`),
|
||||
onSuccess: () => qc.invalidateQueries({ queryKey: ["agent-sessions"] }),
|
||||
})
|
||||
}
|
||||
|
||||
export function useEventStream() {
|
||||
const qc = useQueryClient()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user