Implement Phase 4: tools, God Mode, and missing features

Backend:
- Add Tavily web search tool wrapper (tools/web_search.py)
- Add PDF reader + ChromaDB vector store tool (tools/pdf_reader.py)
- Bind tools to LLM calls via .bind_tools() in dynamic_graph_builder
- Implement God Mode using LangGraph interrupt_before + MemorySaver
- Add approve/reject/modify API endpoints for God Mode
- Add PDF upload endpoint with ingestion pipeline
- Add persistent run history (CouncilRun model + run_service + API)
- Add Alembic migration for council_runs table
- Enhance WebSocket to emit run_paused and run_resumed events
- Add tests for tools, God Mode, and run history

Frontend:
- Add God Mode approval UI (GodModePanel component)
- Add Auto-Pilot / God Mode toggle in Konferenzzimmer
- Add functional PDF upload handler
- Add Conditional Edge editor (EdgeSettingsPanel component)
- Add edge click selection in ArchitectCanvas
- Update Zustand store with edge selection and update actions
- Update types for God Mode, execution modes, and WS events
- Update API client with God Mode, PDF upload, and blueprint run endpoints
- Update WebSocket hook for paused/resumed events
- Add Vitest config and frontend tests (store, parser, types, API)

https://claude.ai/code/session_017U6idFgaqnYTXzPxA7mxMv
This commit is contained in:
Claude 2026-02-21 10:53:12 +00:00
parent c6d0c4a636
commit 001649a364
No known key found for this signature in database
31 changed files with 2502 additions and 81 deletions

View file

@ -1,5 +1,5 @@
// API client for the FastAPI backend
import { CouncilBlueprint, CouncilRun } from "@/app/types/council";
import { CouncilBlueprint, CouncilRun, GodModeAction, GodModeState } from "@/app/types/council";
const BASE_URL = process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:8000";
@ -39,14 +39,48 @@ export const councilApi = {
// Council run (execution)
export const runApi = {
start: (input_topic: string) =>
request<CouncilRun>("/api/run", {
start: (input_topic: string, god_mode: boolean = false) =>
request<CouncilRun>("/api/councils/run", {
method: "POST",
body: JSON.stringify({ input_topic }),
body: JSON.stringify({ input_topic, god_mode }),
}),
startFromBlueprint: (blueprintId: string, input_topic: string, god_mode: boolean = false) =>
request<CouncilRun>(`/api/councils/${blueprintId}/run`, {
method: "POST",
body: JSON.stringify({ input_topic, god_mode }),
}),
status: (run_id: string) =>
request<CouncilRun>(`/api/run/${run_id}`),
request<CouncilRun>(`/api/councils/run/${run_id}`),
// God Mode: approve/reject/modify a paused run
approve: (run_id: string, action: GodModeAction, modified_state?: Record<string, unknown>) =>
request<CouncilRun>(`/api/councils/run/${run_id}/approve`, {
method: "POST",
body: JSON.stringify({ action, modified_state }),
}),
// God Mode: get the paused state
getState: (run_id: string) =>
request<GodModeState>(`/api/councils/run/${run_id}/state`),
};
// PDF upload
export const pdfApi = {
upload: async (file: File) => {
const formData = new FormData();
formData.append("file", file);
const res = await fetch(`${BASE_URL}/api/councils/upload-pdf`, {
method: "POST",
body: formData,
});
if (!res.ok) {
const text = await res.text();
throw new Error(`Upload error ${res.status}: ${text}`);
}
return res.json() as Promise<{ filename: string; chunks_ingested: number; message: string }>;
},
};
// WebSocket URL helper