Skip to content

Self-improving AI Employees for everyone

feat(ui): Wave 10.E — retire 14 frontend type arrays, migrate callers to spec helpers

trohitg009fbecbc9b6
diff --git a/client/src/components/ParameterRenderer.tsx b/client/src/components/ParameterRenderer.tsx
index d57d1f83..397fda0d 100644
--- a/client/src/components/ParameterRenderer.tsx
+++ b/client/src/components/ParameterRenderer.tsx
@@ -5,7 +5,6 @@ import APIKeyValidator from './APIKeyValidator';
import CodeEditor from './ui/CodeEditor';
import DynamicParameterService from '../services/dynamicParameterService';
import { useAppStore } from '../store/useAppStore';
-import { ANDROID_SERVICE_NODE_TYPES } from '../nodeDefinitions/androidServiceNodes';
import { isNodeInBackendGroup } from '../lib/nodeSpec';
import { nodeDefinitions } from '../nodeDefinitions';
import { useAppTheme } from '../hooks/useAppTheme';
@@ -1162,8 +1161,9 @@ const ParameterRenderer: React.FC<ParameterRendererProps> = ({
if (!selectedNode || parameter.name !== 'parameters') return;
const nodeType = selectedNode.data?.nodeType || selectedNode.type;
- // Wave 6 Phase 5.b: backend group → legacy fallback
- const isAndroid = isNodeInBackendGroup(nodeType, 'android') ?? ANDROID_SERVICE_NODE_TYPES.includes(nodeType);
+ // Wave 10.E: backend group membership with bundled-definition fallback
+ const isAndroid = isNodeInBackendGroup(nodeType, 'android')
+ ?? (nodeDefinitions[nodeType]?.group ?? []).includes('android');
if (!isAndroid) return;
// Merge database params with current form params (current takes precedence)
diff --git a/client/src/components/SquareNode.tsx b/client/src/components/SquareNode.tsx
index 65826c1a..bfca1240 100644
--- a/client/src/components/SquareNode.tsx
+++ b/client/src/components/SquareNode.tsx
@@ -5,33 +5,23 @@ import { NodeData } from '../types/NodeTypes';
import { useAppStore } from '../store/useAppStore';
import { nodeDefinitions } from '../nodeDefinitions';
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, resolveNodeDescription } from '../lib/nodeSpec';
+import { getCachedNodeSpec, isNodeInBackendGroup, resolveNodeDescription } from '../lib/nodeSpec';
import { getAIProviderIcon } from './icons/AIProviderIcons';
import { PlayCircle, CalendarClock } from 'lucide-react';
import { AI_MODEL_PROVIDER_MAP } from '../nodeDefinitions/aiModelNodes';
-// Android service nodes that can connect to Android Toolkit as tools
-const ANDROID_TOOL_CAPABLE_NODES = ANDROID_SERVICE_NODE_TYPES;
-
// Nodes with 'tool' in their group can connect to AI Agent/Zeenie tool handles
const hasToolGroup = (definition: any): boolean => {
const groups = definition?.group || [];
return groups.includes('tool');
};
-// Google Maps node types
-const GOOGLE_MAPS_NODE_TYPES = ['gmaps_create', 'gmaps_locations', 'gmaps_nearby_places'];
-
-// WhatsApp node types
-const WHATSAPP_NODE_TYPES = ['whatsappSend', 'whatsappReceive', 'whatsappDb'];
-
-// Nodes that should not have output handles (input-only nodes)
-const NO_OUTPUT_NODE_TYPES = ['console'];
-
-// AI Model node types with their provider IDs (derived from aiModelNodes registry)
+// Wave 10.E: AI model dispatch + provider-id-by-type still need a
+// frontend lookup because the per-provider visual mapping
+// (icon component, credential key) lives in the icon registry below.
+// The map of node types itself comes from the backend NodeSpec registry.
const AI_MODEL_NODE_TYPES = AI_MODEL_PROVIDER_MAP;
const CREDENTIAL_TO_PROVIDER: Record<string, string> = {
@@ -89,10 +79,14 @@ const SquareNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectab
};
}, [executionStatus, isGlowing]);
- // 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);
+ // Wave 10.E: backend NodeSpec group membership, with a definition.group
+ // fallback for the brief window before the cache warms. No more local
+ // type arrays; isNodeInBackendGroup returns undefined when the cache
+ // is cold, in which case we read the bundled definition's group list.
+ const groupOf = (t: string | undefined): string[] => (t ? (nodeDefinitions[t]?.group ?? []) : []);
+ const inGroup = (t: string | undefined, g: string): boolean =>
+ isNodeInBackendGroup(t, g) ?? groupOf(t).includes(g);
+ const isGoogleMapsNode = inGroup(type, 'location');
const googleMapsKeyStatus = isGoogleMapsNode ? getApiKeyStatus('google_maps') : undefined;
// Check if this is an AI model node and get reactive API key status
@@ -104,18 +98,18 @@ const SquareNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectab
// cache cold -> returns local nodeDefinitions entry unchanged.
const definition = resolveNodeDescription(type || '', nodeDefinitions[type as keyof typeof nodeDefinitions]);
- // Wave 6 Phase 5.b: backend group → legacy fallback
- const isAndroidNode = isNodeInBackendGroup(type, 'android') ?? (type ? ANDROID_SERVICE_NODE_TYPES.includes(type) : false);
+ // Wave 10.E: backend group membership with bundled-definition fallback
+ const isAndroidNode = inGroup(type, 'android');
- // 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;
+ // Check if this node can be used as a tool: any Android service node
+ // can connect to Android Toolkit, plus any node carrying the 'tool' group.
+ const isToolCapable = isAndroidNode || hasToolGroup(definition);
// Android connection status from WebSocket (real-time updates)
// Service nodes need a paired device to execute, not just relay connection
const isAndroidConnected = isAndroidNode && androidStatus.paired;
- // Wave 6 Phase 5.b: backend group → legacy fallback
- const isWhatsAppNode = isNodeInBackendGroup(type, 'whatsapp') ?? (type ? WHATSAPP_NODE_TYPES.includes(type) : false);
+ const isWhatsAppNode = inGroup(type, 'whatsapp');
// WhatsApp connection status from WebSocket (real-time updates)
const whatsappStatus = useWhatsAppStatus();
@@ -653,8 +647,9 @@ const SquareNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectab
title="Service Input"
/>
- {/* Square Output Handle */}
- {!NO_OUTPUT_NODE_TYPES.includes(type || '') && (
+ {/* Square Output Handle (Wave 10.E: spec.hideOutputHandle replaces the
+ local NO_OUTPUT_NODE_TYPES list) */}
+ {!getCachedNodeSpec(type || '')?.hideOutputHandle && (
<Handle
id="output-main"
type="source"
@@ -676,28 +671,38 @@ const SquareNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectab
/>
)}
- {/* Top Tool Output Handle - for nodes that can connect to AI Agent/Zeenie tool handle */}
- {isToolCapable && (
- <Handle
- id="output-tool"
- type="source"
- position={Position.Top}
- isConnectable={isConnectable}
- style={{
- position: 'absolute',
- top: '-6px',
- left: '50%',
- transform: 'translateX(-50%)',
- width: theme.nodeSize.handle,
- height: theme.nodeSize.handle,
- backgroundColor: ANDROID_TOOL_CAPABLE_NODES.includes(type || '') ? '#3DDC84' : nodeColor, // Android green for Android nodes, node color for others
- border: `2px solid ${theme.isDarkMode ? theme.colors.background : '#ffffff'}`,
- borderRadius: '50%',
- zIndex: 20
- }}
- title={ANDROID_TOOL_CAPABLE_NODES.includes(type || '') ? 'Connect to Android Toolkit' : 'Connect to AI Agent/Zeenie tool handle'}
- />
- )}
+ {/* Top Tool Output Handle.
+ Wave 10.E: color + label come from the node's own spec. The
+ `nodeColor` carries the spec's brand color (Android green for
+ Android services, dracula accents elsewhere). The tooltip
+ reads from the spec's top-position output handle when one is
+ declared there; otherwise falls back to a generic label. */}
+ {isToolCapable && (() => {
+ const spec = getCachedNodeSpec(type || '');
+ const topOut = spec?.handles?.find(h => h.kind === 'output' && h.position === 'top');
+ const tooltip = topOut?.label ?? 'Tool Output';
+ return (
+ <Handle
+ id="output-tool"
+ type="source"
+ position={Position.Top}
+ isConnectable={isConnectable}
+ style={{
+ position: 'absolute',
+ top: '-6px',
+ left: '50%',
+ transform: 'translateX(-50%)',
+ width: theme.nodeSize.handle,
+ height: theme.nodeSize.handle,
+ backgroundColor: nodeColor,
+ border: `2px solid ${theme.isDarkMode ? theme.colors.background : '#ffffff'}`,
+ borderRadius: '50%',
+ zIndex: 20,
+ }}
+ title={tooltip}
+ />
+ );
+ })()}
{/* Output Data Indicator - shows when node has execution output */}
{executionStatus === 'success' && nodeStatus?.data && (
diff --git a/client/src/hooks/useDragAndDrop.ts b/client/src/hooks/useDragAndDrop.ts
index 32dd3550..426bdc1f 100644
--- a/client/src/hooks/useDragAndDrop.ts
+++ b/client/src/hooks/useDragAndDrop.ts
@@ -3,9 +3,16 @@ import { Node } from 'reactflow';
import { snapToGrid, getDefaultNodePosition } from '../utils/workflow';
import { theme } from '../styles/theme';
import { nodeDefinitions } from '../nodeDefinitions';
-import { SPECIALIZED_AGENT_TYPES } from '../nodeDefinitions/specializedAgentNodes';
-
-const AGENT_TYPES = new Set(['aiAgent', 'chatAgent', ...SPECIALIZED_AGENT_TYPES]);
+import { getCachedNodeSpec } from '../lib/nodeSpec';
+
+// Wave 10.E: agent detection reads `componentKind: "agent"` from the
+// backend NodeSpec. Falls back to the node-definition group during the
+// brief window before the spec cache warms.
+const isAgentType = (nodeType: string): boolean => {
+ const spec = getCachedNodeSpec(nodeType);
+ if (spec?.componentKind === 'agent') return true;
+ return nodeType === 'aiAgent' || nodeType === 'chatAgent';
+};
interface UseDragAndDropProps {
nodes: Node[];
@@ -90,8 +97,8 @@ export const useDragAndDrop = ({ nodes, setNodes, saveNodeParameters, globalMode
// Save full default parameters to DB only (not to node.data)
const defaults = nodeData.data || {};
- // Apply global model defaults for agent nodes
- if (globalModelDefaults && AGENT_TYPES.has(nodeData.type)) {
+ // Apply global model defaults for agent nodes (componentKind="agent")
+ if (globalModelDefaults && isAgentType(nodeData.type)) {
defaults.provider = globalModelDefaults.provider;
defaults.model = globalModelDefaults.model;
}
diff --git a/client/src/lib/nodeSpec.ts b/client/src/lib/nodeSpec.ts
index 6974a722..6ac5138f 100644
--- a/client/src/lib/nodeSpec.ts
+++ b/client/src/lib/nodeSpec.ts
@@ -75,6 +75,40 @@ export function getCachedNodeSpec(nodeType: string): NodeSpec | null {
return queryClient.getQueryData<NodeSpec | null>(nodeSpecQueryKey(nodeType)) ?? null;
}
+/**
+ * Wave 10.E: enumerate every NodeSpec the cache currently holds.
+ * Used by component palette / drag-drop / execution routing to derive
+ * filtered lists from spec metadata instead of importing per-family
+ * type arrays from `nodeDefinitions/*`.
+ */
+export function listCachedNodeSpecs(): NodeSpec[] {
+ const all = queryClient.getQueriesData<NodeSpec | null>({ queryKey: ['nodeSpec'] });
+ return all
+ .map(([, spec]) => spec)
+ .filter((s): s is NodeSpec => !!s);
+}
+
+/**
+ * Wave 10.E: types whose backend spec lists ``group`` includes the
+ * given group key. Returns an empty array until prefetch lands; callers
+ * that need a synchronous answer should rely on the spec-driven
+ * dispatcher rather than this enumeration.
+ */
+export function getNodeTypesInGroup(group: string): string[] {
+ return listCachedNodeSpecs()
+ .filter(s => (s.group ?? []).includes(group))
+ .map(s => s.type);
+}
+
+/**
+ * Wave 10.E: types whose backend spec carries the given componentKind.
+ */
+export function getNodeTypesWithKind(kind: NonNullable<NodeSpec['componentKind']>): string[] {
+ return listCachedNodeSpecs()
+ .filter(s => s.componentKind === kind)
+ .map(s => s.type);
+}
+
/**
* Wave 6 Phase 5.b: backend-group membership check.
*
diff --git a/client/src/services/executionService.ts b/client/src/services/executionService.ts
index 5cb2ecca..ec5cc8c7 100644
--- a/client/src/services/executionService.ts
+++ b/client/src/services/executionService.ts
@@ -1,19 +1,5 @@
import { nodeDefinitions } from '../nodeDefinitions';
-import { ANDROID_SERVICE_NODE_TYPES } from '../nodeDefinitions/androidServiceNodes';
-import { SCHEDULER_NODE_TYPES } from '../nodeDefinitions/schedulerNodes';
-import { CODE_NODE_TYPES } from '../nodeDefinitions/codeNodes';
-import { UTILITY_NODE_TYPES } from '../nodeDefinitions/utilityNodes';
-import { DOCUMENT_NODE_TYPES } from '../nodeDefinitions/documentNodes';
-import { SPECIALIZED_AGENT_TYPES } from '../nodeDefinitions/specializedAgentNodes';
-import { TWITTER_NODE_TYPES } from '../nodeDefinitions/twitterNodes';
-import { GOOGLE_WORKSPACE_NODE_TYPES } from '../nodeDefinitions/googleWorkspaceNodes';
-import { APIFY_NODE_TYPES } from '../nodeDefinitions/apifyNodes';
-import { SEARCH_NODE_TYPES } from '../nodeDefinitions/searchNodes';
-import { TELEGRAM_NODE_TYPES } from '../nodeDefinitions/telegramNodes';
-import { CRAWLEE_NODE_TYPES } from '../nodeDefinitions/crawleeNodes';
-import { BROWSER_NODE_TYPES } from '../nodeDefinitions/browserNodes';
-import { EMAIL_NODE_TYPES } from '../nodeDefinitions/emailNodes';
-import { AI_CHAT_MODEL_TYPES } from '../nodeDefinitions/aiModelNodes';
+import { getCachedNodeSpec } from '../lib/nodeSpec';
import { Node, Edge } from 'reactflow';
import { INodeExecutionData } from '../types/INodeProperties';
import { API_CONFIG } from '../config/api';
@@ -192,69 +178,15 @@ export class ExecutionService {
}
/**
- * Check if node type is supported by backend execution
+ * Wave 10.E: a node is executable iff the backend has a NodeSpec
+ * for it. The plugin registry is the single source of truth — every
+ * type with an input model + handler appears in the spec endpoint,
+ * so cache lookup answers "supported?" without enumerating families.
+ * Falls back to the legacy frontend `nodeDefinitions` registry while
+ * the spec cache is still warming.
*/
static isNodeTypeSupported(nodeType: string): boolean {
- const supportedTypes = [
- // AI Nodes
- 'aiAgent',
- 'chatAgent',
- // Specialized Agent Nodes (use chatAgent backend handler)
- ...SPECIALIZED_AGENT_TYPES,
- // Note: simpleMemory is passive - accessed by AI Agent automatically, not executed directly
- ...AI_CHAT_MODEL_TYPES,
- // Google Maps Nodes
- 'gmaps_create',
- 'gmaps_locations',
- 'gmaps_nearby_places',
- // WhatsApp Nodes
- 'whatsappSend',
- 'whatsappReceive',
- 'whatsappDb',
- // Text Processing Nodes
- 'textGenerator',
- 'fileHandler',
- // Android Services (16 individual nodes)
- ...ANDROID_SERVICE_NODE_TYPES,
- // Scheduler Nodes
- ...SCHEDULER_NODE_TYPES,
- // Code Execution Nodes
- ...CODE_NODE_TYPES,
- // Utility Nodes (HTTP, Webhooks)
- ...UTILITY_NODE_TYPES,
- // Document Processing Nodes
- ...DOCUMENT_NODE_TYPES,
- // Twitter/X Nodes
- ...TWITTER_NODE_TYPES,
- // Google Workspace Nodes (consolidated)
- ...GOOGLE_WORKSPACE_NODE_TYPES,
- // Apify web scraping
- ...APIFY_NODE_TYPES,
- // Crawlee web scraping
- ...CRAWLEE_NODE_TYPES,
- // Browser automation
- ...BROWSER_NODE_TYPES,
- // Search API nodes
- ...SEARCH_NODE_TYPES,
- // Telegram Nodes
- ...TELEGRAM_NODE_TYPES,
- // Proxy Nodes
- 'proxyRequest',
- 'proxyConfig',
- 'proxyStatus',
- // Filesystem & Shell
- 'fileRead',
- 'fileModify',
- 'shell',
- 'fsSearch',
- // Todo planning
- 'writeTodos',
- // Process manager
- 'processManager',
- // Email (Himalaya CLI)
- ...EMAIL_NODE_TYPES,
- ];
-
- return supportedTypes.includes(nodeType);
+ if (getCachedNodeSpec(nodeType)) return true;
+ return nodeType in nodeDefinitions;
}
}
\ No newline at end of file