Implement Phase 2: Next.js + React Flow frontend MVP
- Scaffold Next.js 15 app with TypeScript, Tailwind, App Router - Install @xyflow/react, Zustand, Lucide icons, nanoid - Define council types (AgentNodeData, CouncilBlueprint, WSMessage, etc.) - Implement Zustand store for canvas and run state - Build custom AgentNode component (label, system prompt, model badge, tool chips, active pulse) - Build ConditionalEdge component (dashed indigo line with condition label) - Build NodeSidebar (drag-and-drop + click to add agents) - Build NodeSettingsPanel (name, system prompt, model selector, tool toggles) - Build ArchitectCanvas (React Flow canvas with drop zone, minimap, controls) - Build blueprint parser (React Flow JSON ↔ CouncilBlueprint JSON) - Build API client for FastAPI backend (CRUD + run endpoints) - Build useCouncilWebSocket hook for live agent status via WebSocket - Build Tab A: Rat-Architekt (canvas builder with save/export toolbar) - Build Tab B: Konferenzzimmer (execution view with live diagram + result panel) - Add NavTabs navigation with CouncilOS branding - All TypeScript checks passing https://claude.ai/code/session_01EkbecUVn7esdxLCXxVVRDX
This commit is contained in:
parent
06aec41a8a
commit
216fdd9589
30 changed files with 8237 additions and 0 deletions
73
frontend/app/types/council.ts
Normal file
73
frontend/app/types/council.ts
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
// Council blueprint types — canonical exchange format between frontend and backend
|
||||
// Version field allows schema evolution
|
||||
|
||||
export type LLMModel = "claude-3-5-sonnet" | "gpt-4o" | "local";
|
||||
|
||||
export interface AgentTools {
|
||||
webSearch: boolean;
|
||||
pdfReader: boolean;
|
||||
}
|
||||
|
||||
export interface AgentNodeData extends Record<string, unknown> {
|
||||
label: string;
|
||||
systemPrompt: string;
|
||||
model: LLMModel;
|
||||
tools: AgentTools;
|
||||
isActive?: boolean; // set by WebSocket during execution
|
||||
}
|
||||
|
||||
export type EdgeType = "linear" | "conditional";
|
||||
|
||||
export interface ConditionalEdgeData {
|
||||
condition: string; // e.g. "rework" | "approve"
|
||||
}
|
||||
|
||||
// Blueprint JSON — versioned, stored in PostgreSQL
|
||||
export interface BlueprintNode {
|
||||
id: string;
|
||||
label: string;
|
||||
systemPrompt: string;
|
||||
model: LLMModel;
|
||||
tools: AgentTools;
|
||||
position: { x: number; y: number };
|
||||
}
|
||||
|
||||
export interface BlueprintEdge {
|
||||
id: string;
|
||||
source: string;
|
||||
target: string;
|
||||
type: EdgeType;
|
||||
condition?: string;
|
||||
}
|
||||
|
||||
export interface CouncilBlueprint {
|
||||
version: 1;
|
||||
id?: string;
|
||||
name: string;
|
||||
nodes: BlueprintNode[];
|
||||
edges: BlueprintEdge[];
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
// Council run (execution)
|
||||
export type RunStatus = "pending" | "running" | "completed" | "failed";
|
||||
|
||||
export interface CouncilRun {
|
||||
run_id: string;
|
||||
status: RunStatus;
|
||||
current_node?: string;
|
||||
result?: string;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
// WebSocket messages from backend
|
||||
export type WSMessageType = "node_enter" | "node_exit" | "run_complete" | "run_error";
|
||||
|
||||
export interface WSMessage {
|
||||
type: WSMessageType;
|
||||
node_id?: string;
|
||||
node_name?: string;
|
||||
result?: string;
|
||||
error?: string;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue