Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
feat(schema): Wave 6 Phase 5.b - frontend group-membership via backend NodeSpec
trohitg15df605a4915
diff --git a/client/src/components/SquareNode.tsx b/client/src/components/SquareNode.tsxindex 0e713350..47f8dacc 100644--- a/client/src/components/SquareNode.tsx+++ b/client/src/components/SquareNode.tsx@@ -8,6 +8,7 @@ import { useAppTheme } from '../hooks/useAppTheme';import { ANDROID_SERVICE_NODE_TYPES } from '../nodeDefinitions/androidServiceNodes';import { useWebSocket, useWhatsAppStatus } from '../contexts/WebSocketContext';import { useApiKeys } from '../hooks/useApiKeys';+import { isNodeInBackendGroup } from '../lib/nodeSpec';import { getAIProviderIcon } from './icons/AIProviderIcons';import { PlayCircle, CalendarClock } from 'lucide-react';import { AI_MODEL_PROVIDER_MAP } from '../nodeDefinitions/aiModelNodes';@@ -88,8 +89,10 @@ const SquareNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectab};}, [executionStatus, isGlowing]);- // Check if this is a Google Maps node- const isGoogleMapsNode = type ? GOOGLE_MAPS_NODE_TYPES.includes(type) : false;+ // Wave 6 Phase 5.b: prefer backend NodeSpec group membership, fall+ // back to the local *_NODE_TYPES array when the spec hasn't loaded+ // yet (cold cache + flag off). Behaviour identical when flag off.+ const isGoogleMapsNode = isNodeInBackendGroup(type, 'location') ?? (type ? GOOGLE_MAPS_NODE_TYPES.includes(type) : false);const googleMapsKeyStatus = isGoogleMapsNode ? getApiKeyStatus('google_maps') : undefined;// Check if this is an AI model node and get reactive API key status@@ -99,8 +102,8 @@ const SquareNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectabconst definition = nodeDefinitions[type as keyof typeof nodeDefinitions];- // Check if this is an Android node- const isAndroidNode = type ? ANDROID_SERVICE_NODE_TYPES.includes(type) : false;+ // Wave 6 Phase 5.b: backend group → legacy fallback+ const isAndroidNode = isNodeInBackendGroup(type, 'android') ?? (type ? ANDROID_SERVICE_NODE_TYPES.includes(type) : false);// Check if this node can be used as a tool (connects to Android Toolkit or AI Agent/Zeenie tool handle)const isToolCapable = type ? (ANDROID_TOOL_CAPABLE_NODES.includes(type) || hasToolGroup(definition)) : false;@@ -109,8 +112,8 @@ const SquareNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectab// Service nodes need a paired device to execute, not just relay connectionconst isAndroidConnected = isAndroidNode && androidStatus.paired;- // Check if this is a WhatsApp node- const isWhatsAppNode = type ? WHATSAPP_NODE_TYPES.includes(type) : false;+ // Wave 6 Phase 5.b: backend group → legacy fallback+ const isWhatsAppNode = isNodeInBackendGroup(type, 'whatsapp') ?? (type ? WHATSAPP_NODE_TYPES.includes(type) : false);// WhatsApp connection status from WebSocket (real-time updates)const whatsappStatus = useWhatsAppStatus();diff --git a/client/src/components/parameterPanel/MiddleSection.tsx b/client/src/components/parameterPanel/MiddleSection.tsxindex 22961c31..ca3b7959 100644--- a/client/src/components/parameterPanel/MiddleSection.tsx+++ b/client/src/components/parameterPanel/MiddleSection.tsx@@ -29,6 +29,7 @@ import { Badge } from '@/components/ui/badge';import ParameterRenderer from '../ParameterRenderer';import ToolSchemaEditor from './ToolSchemaEditor';import MasterSkillEditor from './MasterSkillEditor';+import { isNodeInBackendGroup } from '../../lib/nodeSpec';import { useAppTheme } from '../../hooks/useAppTheme';import { useAppStore } from '../../store/useAppStore';import { useWebSocket, CompactionStats } from '../../contexts/WebSocketContext';@@ -213,8 +214,11 @@ const MiddleSection: React.FC<MiddleSectionProps> = ({// Kept as separate flags for downstream JSX that still references them.const isCodeExecutorNode = needsCodeEditorLayout && (hints.hasCodeEditor ?? isLegacyCodeExecutor);const isSkillNode = needsCodeEditorLayout && isLegacySkillWithEditor;- const isToolNode = hints.isToolPanel ?? TOOL_NODE_TYPES.includes(nodeDefinition.name);- const isAgentWithSkills = hints.hasSkills ?? AGENT_WITH_SKILLS_TYPES.includes(nodeDefinition.name);+ // Wave 6 Phase 5.b: dispatch chain is uiHints (declarative) -> backend+ // group membership (live NodeSpec) -> legacy *_NODE_TYPES array.+ // Behaviour identical when flag off + cache cold.+ const isToolNode = hints.isToolPanel ?? isNodeInBackendGroup(nodeDefinition.name, 'tool') ?? TOOL_NODE_TYPES.includes(nodeDefinition.name);+ const isAgentWithSkills = hints.hasSkills ?? isNodeInBackendGroup(nodeDefinition.name, 'agent') ?? AGENT_WITH_SKILLS_TYPES.includes(nodeDefinition.name);const { data: userSettings } = useUserSettingsQuery();diff --git a/client/src/lib/nodeSpec.ts b/client/src/lib/nodeSpec.tsindex 53ef41ca..4703b2c8 100644--- a/client/src/lib/nodeSpec.ts+++ b/client/src/lib/nodeSpec.ts@@ -68,6 +68,26 @@ export function getCachedNodeSpec(nodeType: string): NodeSpec | null {return queryClient.getQueryData<NodeSpec | null>(nodeSpecQueryKey(nodeType)) ?? null;}+/**+ * Wave 6 Phase 5.b: backend-group membership check.+ *+ * Returns `undefined` when the NodeSpec isn't cached yet (caller falls+ * back to its legacy `*_NODE_TYPES` array), `true`/`false` when the+ * cached spec's `group` array decides. Lets components retire local+ * helper arrays without introducing a hard dependency on prefetch+ * ordering — when the flag is off and prefetch hasn't run, the legacy+ * path runs unchanged.+ */+export function isNodeInBackendGroup(+ nodeType: string | null | undefined,+ group: string,+): boolean | undefined {+ if (!nodeType) return false;+ const spec = getCachedNodeSpec(nodeType);+ if (!spec) return undefined;+ return (spec.group ?? []).includes(group);+}+/*** Flag-gated resolver. When `VITE_NODESPEC_BACKEND` is off (default),* returns `localFallback` unchanged — legacy `nodeDefinitions/*` wins.diff --git a/server/models/node_metadata.py b/server/models/node_metadata.pyindex 8947f3fe..04520a9a 100644--- a/server/models/node_metadata.py+++ b/server/models/node_metadata.py@@ -22,6 +22,11 @@ class NodeMetadata(TypedDict, total=False):subtitle: strdescription: strversion: int+ # Wave 6: per-node UI panel hints lifted from the legacy frontend+ # INodeUIHints. Carries flags like isChatTrigger / isConsoleSink /+ # hasCodeEditor / isMemoryPanel / isToolPanel / etc. Empty dict when+ # the node doesn't need any panel-level toggles.+ uiHints: dict[str, object]# Seeded incrementally per Wave 6 Phase 3 sub-commit. Sub-commit 3a@@ -36,6 +41,7 @@ NODE_METADATA: dict[str, NodeMetadata] = {"group": ["workflow"],"description": "Starting point for workflow execution. Provides initial data to connected nodes.","version": 1,+ "uiHints": {"hideInputSection": True, "hideOutputSection": True},},"taskTrigger": {"displayName": "Task Completed",@@ -72,6 +78,7 @@ NODE_METADATA: dict[str, NodeMetadata] = {"group": ["utility", "trigger"],"description": "Trigger workflow when user sends a chat message from the console input","version": 1,+ "uiHints": {"isChatTrigger": True},},"console": {"displayName": "Console",@@ -79,6 +86,7 @@ NODE_METADATA: dict[str, NodeMetadata] = {"group": ["utility"],"description": "Log data to console panel for debugging during execution","version": 1,+ "uiHints": {"isConsoleSink": True},},"teamMonitor": {"displayName": "Team Monitor",@@ -86,6 +94,7 @@ NODE_METADATA: dict[str, NodeMetadata] = {"group": ["utility", "agent"],"description": "Monitor agent team operations, tasks, and messages in real-time","version": 1,+ "uiHints": {"hideInputSection": True, "hideOutputSection": True, "isMonitorPanel": True},},# Code group -------------------------------------------------------------"pythonExecutor": {@@ -94,6 +103,7 @@ NODE_METADATA: dict[str, NodeMetadata] = {"group": ["code", "tool"],"description": "Execute Python code with input data access","version": 1,+ "uiHints": {"hasCodeEditor": True},},"javascriptExecutor": {"displayName": "JavaScript Executor",@@ -101,6 +111,7 @@ NODE_METADATA: dict[str, NodeMetadata] = {"group": ["code", "tool"],"description": "Execute JavaScript code with input data access","version": 1,+ "uiHints": {"hasCodeEditor": True},},"typescriptExecutor": {"displayName": "TypeScript Executor",@@ -108,6 +119,7 @@ NODE_METADATA: dict[str, NodeMetadata] = {"group": ["code", "tool"],"description": "Execute TypeScript code with input data access and type safety","version": 1,+ "uiHints": {"hasCodeEditor": True},},# Process management -----------------------------------------------------"processManager": {@@ -218,6 +230,7 @@ NODE_METADATA: dict[str, NodeMetadata] = {"group": ["tool", "memory"],"description": "Markdown-based conversation memory with optional vector long-term storage","version": 1,+ "uiHints": {"isMemoryPanel": True, "hasCodeEditor": True, "hideRunButton": True},},# Specialized agents (16) -- shared SpecializedAgentParams Pydantic model"android_agent": {@@ -406,6 +419,7 @@ NODE_METADATA: dict[str, NodeMetadata] = {"group": ["location", "service"],"description": "Google Maps creation with customizable center, zoom, and map type","version": 1,+ "uiHints": {"showLocationPanel": True},},"gmaps_locations": {"displayName": "GMaps Locations",diff --git a/server/services/node_spec.py b/server/services/node_spec.pyindex 613db2ab..acf02dd4 100644--- a/server/services/node_spec.py+++ b/server/services/node_spec.py@@ -68,6 +68,8 @@ def get_node_spec(node_type: str) -> Optional[dict[str, Any]]:spec["outputs"] = outputsif "subtitle" in meta:spec["subtitle"] = meta["subtitle"]+ if meta.get("uiHints"):+ spec["uiHints"] = meta["uiHints"]_spec_cache[node_type] = specreturn specdiff --git a/server/tests/test_node_spec.py b/server/tests/test_node_spec.pyindex 232f9c2e..115b1330 100644--- a/server/tests/test_node_spec.py+++ b/server/tests/test_node_spec.py@@ -552,3 +552,51 @@ class TestDisplayOptionsEnrichment:spec = get_node_spec("openaiChatModel")api_key = spec["inputs"]["properties"]["apiKey"]assert api_key["password"] is True+++class TestUIHintsInNodeSpec:+ """Wave 6 Phase 5.b: NODE_METADATA carries panel-level uiHints+ (isChatTrigger/isConsoleSink/hasCodeEditor/etc) so frontend+ dispatch can read them off the cached NodeSpec instead of+ importing legacy *_NODE_TYPES arrays or per-node definition flags."""++ def test_chat_trigger_carries_is_chat_trigger(self):+ spec = get_node_spec("chatTrigger")+ assert spec.get("uiHints", {}).get("isChatTrigger") is True++ def test_console_carries_is_console_sink(self):+ spec = get_node_spec("console")+ assert spec.get("uiHints", {}).get("isConsoleSink") is True++ def test_team_monitor_carries_is_monitor_panel(self):+ spec = get_node_spec("teamMonitor")+ hints = spec.get("uiHints", {})+ assert hints.get("isMonitorPanel") is True+ assert hints.get("hideInputSection") is True+ assert hints.get("hideOutputSection") is True++ def test_master_skill_not_seeded_yet(self):+ # Sanity: masterSkill metadata not yet seeded - fallback path runs.+ # If/when seeded later, update this guard.+ from models.node_metadata import get_node_metadata+ assert get_node_metadata("masterSkill") is None++ def test_simple_memory_carries_memory_panel(self):+ spec = get_node_spec("simpleMemory")+ hints = spec.get("uiHints", {})+ assert hints.get("isMemoryPanel") is True+ assert hints.get("hasCodeEditor") is True++ def test_python_executor_carries_code_editor(self):+ spec = get_node_spec("pythonExecutor")+ assert spec.get("uiHints", {}).get("hasCodeEditor") is True++ def test_gmaps_create_carries_location_panel(self):+ spec = get_node_spec("gmaps_create")+ assert spec.get("uiHints", {}).get("showLocationPanel") is True++ def test_start_carries_hidden_panels(self):+ spec = get_node_spec("start")+ hints = spec.get("uiHints", {})+ assert hints.get("hideInputSection") is True+ assert hints.get("hideOutputSection") is True