feat(ui): install @xyflow/react and scaffold WorkflowCanvas base component#1107
feat(ui): install @xyflow/react and scaffold WorkflowCanvas base component#1107
Conversation
|
This change is part of the following stack:
Change managed by git-spice. |
- Add m20260415_000013_add_builtin_to_agents migration (INTEGER NOT NULL DEFAULT 0) - Add built_in: i32 field to agent entity - Add built_in: bool field to Agent struct and AgentResponse - Update model_to_agent() and storage add() to persist/read the field - Add built_in?: boolean to TypeScript Agent interface - CreateAgentRequest intentionally omits built_in (system-only field)
…-agents endpoint - GET /agents now excludes built_in agents by default - ?include_builtin=true opts in to seeing all agents - Add GET /system-agents returning only built_in=true agents - list_paginated() gains built_in_filter: Option<bool> parameter - AgentStorage::list_system_agents() fetches only system agents - AgentManager::list_system_agents() delegates to storage - OrchestratorClient::list_system_agents() hits GET /system-agents - debug_agents endpoint unchanged (shows all agents)
- Add system_agents.rs with SYSTEM_AGENT_NAME constant and build_system_agent_config() - System agent uses sonnet model, AllowList tool policy (read-only), joins 'system' room - Includes inline system prompt covering agentd architecture and services - AgentManager::bootstrap_system_agents() spawns/restarts system agent after reconcile - spawn_agent() gains built_in: bool parameter; API always passes false - terminate_agent() guards against deleting built_in agents (returns error) - bootstrap_system_agents() called from main.rs after reconcile()
- system_agent_prompt covers: service inventory with ports, agent lifecycle, status/activity states, built-in agent concept, CLI operations, communicate rooms, memory service, diagnostics guide, metrics/observability, tool policy - version prepended dynamically via env!(CARGO_PKG_VERSION) at build time - tool policy documented with rationale for each allowed category - AllowList entries align with prompt documentation (update both in tandem) - prompt targets <6000 tokens
- Add 'agent system-agents list' — fetch from GET /system-agents - Add 'agent system-agents get <id|name>' — resolve by UUID or name - Add 'agent system-agents message <id> <text>' — send prompt to system agent - Add 'agent system-agents status' — compact table of name/status/model/activity - All subcommands support --json output mode - Add --include-builtin flag to 'agent list' (passes ?include_builtin=true) - OrchestratorClient::list_agents_filtered() added for include_builtin support - system_agents command registered in Commands enum and dispatched via orchestrator URL
- AgentsPage renders SystemAgentList above AgentList
- SystemAgentList fetches from GET /system-agents with 10s auto-refresh
- Shows name (with 'system' badge), status, model, rooms columns
- Collapsible panel with refresh button; distinguishes loading/error/empty states
- Clicking a row navigates to /agents/{id} detail page (same as user agents)
- No create/delete actions exposed (built-in agents are not user-managed)
- useSystemAgents hook follows same pattern as useAgents
- OrchestratorClient.listSystemAgents() added (GET /system-agents)
- AgentConfig TS interface gains rooms?: string[]
geoffjay
left a comment
There was a problem hiding this comment.
Review: feat(ui): install @xyflow/react and scaffold WorkflowCanvas base component
Stack position: Base of the UI canvas stack — stacked directly on feature/autonomous-pipeline. No parent PRs to review first.
Overview
Installs @xyflow/react@12.10.2 and scaffolds the WorkflowCanvas component that wraps React Flow with Controls, MiniMap, and Background. The canvas accepts nodeTypes/edgeTypes registries as optional props so children in the stack can extend it without modifying this file.
What looks good
- Theme token wiring: React Flow's CSS variables (
--xy-background-color,--xy-edge-stroke, etc.) are mapped to the project's--th-*tokens inline. This ensures the canvas inherits both light and dark mode correctly without duplicating theme logic. - Provider pattern: The outer
WorkflowCanvaswrapsCanvasinReactFlowProvider. The comment correctly explains the trade-offs for multi-canvas pages. snapToGrid={true}withsnapGrid={[16, 16]}: Sensible default for a workflow builder. This keeps node placement tidy and consistent.- Optional
nodeTypes/edgeTypesprops: Correct extensibility design — callers pass their type registries; this base component doesn't need to know about them. - Smoke tests: 4 tests cover: no-throw, wrapper testid, className forwarding, and render with non-empty nodes/edges. Appropriate for a scaffold component.
Non-blocking note
The inline style map requires a biome-ignore lint/suspicious/noExplicitAny comment to suppress the TypeScript error from assigning to CSS custom properties. This is the standard workaround and is correctly annotated. An alternative would be style={{ ...cssVarMap } as React.CSSProperties} where cssVarMap is typed as Record<string, string>, but what's here is readable and correct.
Verdict
Clean scaffold with good extensibility design. LGTM.
Adds 10 HTTP integration tests covering the full system-agent feature surface via tower::ServiceExt::oneshot (no real TCP). Includes a NullBackend to avoid external dependencies. Also fixes terminate_agent handler to return 403 Forbidden (not 500) when attempting to delete a built-in system agent. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
test(orchestrator): integration tests for system agent lifecycle
feat(ui): add system agents section to agents page
feat(cli): add system-agents subcommand
feat(orchestrator): finalize system agent system prompt and tool policy
feat(orchestrator): define system agent config and spawn at startup
feat(orchestrator): filter built-in agents from list API, add /system-agents endpoint
feat(orchestrator): add built_in flag to agent schema and storage layer
epic: add built-in agent support
…onent - Add @xyflow/react v12 dependency - Create WorkflowCanvas with Controls, MiniMap, and Background - Map agentd theme tokens to React Flow CSS variables - Enable snapToGrid (16px) and fitView defaults - Wrap canvas in ReactFlowProvider - Export from workflows barrel index - Add tests for basic rendering
Install React Flow v12 and create the foundational WorkflowCanvas component with Controls, MiniMap, Background, theme token mapping, and snapToGrid defaults.
Closes #1095