From 695480d9e9d21addf70a0bbdf9443fc80d75f5dc Mon Sep 17 00:00:00 2001 From: anthrodjear Date: Fri, 8 May 2026 08:18:45 +0300 Subject: [PATCH] feat(frontend): add research API service with TanStack Query-ready functions --- web/frontend/src/api/research.ts | 58 ++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 web/frontend/src/api/research.ts diff --git a/web/frontend/src/api/research.ts b/web/frontend/src/api/research.ts new file mode 100644 index 000000000..2222a3ae6 --- /dev/null +++ b/web/frontend/src/api/research.ts @@ -0,0 +1,58 @@ +import { launcherFetch } from "@/api/http" + +export interface ResearchAgent { + id: string + name: string + active: boolean + progress: number + ram: string + type: string +} + +export interface ResearchNode { + name: string + abbr: string + x: number + y: number +} + +export interface ResearchReport { + id: string + title: string + pages: number + words: number + status: "in-progress" | "complete" + progress?: number +} + +export interface ResearchConfig { + type: string + depth: string + restrictToGraph: boolean +} + +// API Functions (TanStack Query compatible) +export async function listResearchAgents(): Promise { + return launcherFetch("/api/research/agents") +} + +export async function toggleResearchAgent(id: string): Promise { + await launcherFetch(`/api/research/agents/${id}/toggle`, { method: "PUT" }) +} + +export async function listResearchGraph(): Promise { + const response = await launcherFetch<{ nodes: ResearchNode[] }>("/api/research/graph") + return response.nodes +} + +export async function listResearchReports(): Promise { + const response = await launcherFetch<{ reports: ResearchReport[] }>("/api/research/reports") + return response.reports +} + +export async function updateResearchConfig(config: ResearchConfig): Promise { + await launcherFetch("/api/research/config", { + method: "PUT", + body: JSON.stringify(config), + }) +} \ No newline at end of file