Skip to content

Self-improving AI Employees for everyone

chore(client): remove dead code inside live files

trohitgac9219f04fec
diff --git a/client/src/components/AIAgentNode.tsx b/client/src/components/AIAgentNode.tsx
index c1ea6a7b..fbd2f524 100644
--- a/client/src/components/AIAgentNode.tsx
+++ b/client/src/components/AIAgentNode.tsx
@@ -1,10 +1,9 @@
/* eslint-disable react-hooks/exhaustive-deps -- ``handles`` derived from spec.handles; spec is a stable React-Query slice, dep list omits it intentionally. */
-import React, { memo, useState, useEffect, useMemo, useCallback } from 'react';
+import React, { memo, useMemo, useCallback } from 'react';
import { nodePropsEqual } from './nodeMemoEquality';
import { Handle, Position, NodeProps } from 'reactflow';
import { NodeData, NodeStyle } from '../types/NodeTypes';
import { useAppStore } from '../store/useAppStore';
-import AIAgentExecutionService from '../services/execution/aiAgentExecutionService';
import { useAppTheme } from '../hooks/useAppTheme';
import { useNodeStatus } from '../contexts/WebSocketContext';
import { useNodeSpec } from '../lib/nodeSpec';
@@ -51,8 +50,6 @@ const AIAgentNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnecta
const setSelectedNode = useAppStore((s) => s.setSelectedNode);
const setRenamingNodeId = useAppStore((s) => s.setRenamingNodeId);
const updateNodeData = useAppStore((s) => s.updateNodeData);
- const [_configValid, setConfigValid] = useState(true);
- const [_configErrors, setConfigErrors] = useState<string[]>([]);
// Wave 10.D: every piece of per-type config comes from the backend
// NodeSpec envelope (server/nodes/agents.py → register_node()). The
@@ -118,18 +115,11 @@ const AIAgentNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnecta
const showIterationBadge =
isExecuting && typeof iteration === 'number' && typeof maxIterations === 'number';
- // Validate configuration whenever data changes
- useEffect(() => {
- try {
- const validation = AIAgentExecutionService.validateConfiguration(data || {});
- setConfigValid(validation.valid);
- setConfigErrors(validation.errors);
- } catch (error) {
- console.error('Configuration validation error:', error);
- setConfigValid(false);
- setConfigErrors(['Configuration validation failed']);
- }
- }, [data, id]);
+ // Configuration validation used to run here on every `data` change and
+ // write its result into two state slots nothing ever read (they were
+ // underscore-prefixed, so the compiler could not warn). The backend
+ // validates node configuration at execution time and reports it through
+ // the normal error envelope, so this was doing no work twice.
const handleLabelChange = useCallback(
(newLabel: string) => updateNodeData(id, { label: newLabel }),
diff --git a/client/src/schemas/workflowSchema.ts b/client/src/schemas/workflowSchema.ts
index f0e3f3f1..2b82f16e 100644
--- a/client/src/schemas/workflowSchema.ts
+++ b/client/src/schemas/workflowSchema.ts
@@ -1,171 +1,15 @@
/**
- * JSON Schema for Workflow Definition
- * Defines the structure and validation rules for workflow data
+ * Workflow serialization + structural pre-flight.
+ *
+ * The 166-line `WorkflowJSONSchema` draft-07 document that used to head
+ * this file was deleted: nothing referenced it, and it had drifted from
+ * the real shape. The backend is the schema authority.
+ *
+ * `validateWorkflow` below stays deliberately — it is a structural check on
+ * a file the user is about to write to disk, where a server round-trip is
+ * the wrong shape.
*/
-export const WorkflowJSONSchema = {
- $schema: "http://json-schema.org/draft-07/schema#",
- title: "Workflow",
- description: "A workflow automation definition containing nodes and connections",
- type: "object",
- required: ["id", "name", "nodes", "edges", "createdAt", "lastModified"],
- properties: {
- id: {
- type: "string",
- description: "Unique identifier for the workflow",
- pattern: "^workflow_[0-9]+$"
- },
- name: {
- type: "string",
- description: "Human-readable workflow name",
- minLength: 1,
- maxLength: 100
- },
- description: {
- type: "string",
- description: "Optional workflow description"
- },
- nodes: {
- type: "array",
- description: "Array of workflow nodes",
- items: {
- $ref: "#/definitions/node"
- }
- },
- edges: {
- type: "array",
- description: "Array of connections between nodes",
- items: {
- $ref: "#/definitions/edge"
- }
- },
- createdAt: {
- type: "string",
- format: "date-time",
- description: "ISO 8601 timestamp of workflow creation"
- },
- lastModified: {
- type: "string",
- format: "date-time",
- description: "ISO 8601 timestamp of last modification"
- },
- version: {
- type: "string",
- description: "Workflow schema version",
- default: "1.0.0"
- }
- },
- definitions: {
- node: {
- type: "object",
- required: ["id", "type", "position"],
- properties: {
- id: {
- type: "string",
- description: "Unique node identifier"
- },
- type: {
- type: "string",
- description: "Node type identifier",
- enum: [
- "start",
- "aiAgent",
- "openaiChatModel",
- "anthropicChatModel",
- "googleChatModel",
- "gmaps_create",
- "gmaps_locations",
- "gmaps_nearby_places",
- "whatsappSendMessage",
- "whatsappReceiveMessage"
- ]
- },
- position: {
- type: "object",
- required: ["x", "y"],
- properties: {
- x: {
- type: "number",
- description: "X coordinate on canvas"
- },
- y: {
- type: "number",
- description: "Y coordinate on canvas"
- }
- }
- },
- data: {
- type: "object",
- description: "Node-specific parameters and configuration",
- properties: {
- label: {
- type: "string",
- description: "Display label for the node"
- }
- },
- additionalProperties: true
- },
- selected: {
- type: "boolean",
- description: "Whether node is currently selected"
- },
- dragging: {
- type: "boolean",
- description: "Whether node is being dragged"
- }
- },
- additionalProperties: true
- },
- edge: {
- type: "object",
- required: ["id", "source", "target"],
- properties: {
- id: {
- type: "string",
- description: "Unique edge identifier"
- },
- source: {
- type: "string",
- description: "Source node ID"
- },
- target: {
- type: "string",
- description: "Target node ID"
- },
- sourceHandle: {
- type: "string",
- description: "Source handle identifier",
- default: "output-main"
- },
- targetHandle: {
- type: "string",
- description: "Target handle identifier",
- default: "input-main"
- },
- type: {
- type: "string",
- description: "Edge rendering type",
- enum: ["default", "straight", "step", "smoothstep", "simplebezier"],
- default: "default"
- },
- animated: {
- type: "boolean",
- description: "Whether edge is animated"
- },
- style: {
- type: "object",
- description: "Custom edge styling"
- },
- label: {
- type: "string",
- description: "Edge label text"
- }
- },
- additionalProperties: true
- }
- }
-};
-
/**
* Validates a workflow object against the JSON schema
*/
diff --git a/client/src/services/execution/aiAgentExecutionService.ts b/client/src/services/execution/aiAgentExecutionService.ts
deleted file mode 100644
index 8f4ce1a4..00000000
--- a/client/src/services/execution/aiAgentExecutionService.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { ExecutionResult } from '../executionService';
-
-// AI Agent execution result (simplified)
-export interface AIAgentExecutionResult extends ExecutionResult {
- aiResponse?: string;
- toolCalls?: any[];
- iterations?: number;
- tokens?: {
- prompt: number;
- completion: number;
- total: number;
- };
-}
-
-export class AIAgentExecutionService {
- /**
- * Basic validation for UI feedback - backend handles full validation
- */
- static validateConfiguration(nodeData: any): { valid: boolean; errors: string[] } {
- const errors: string[] = [];
-
- // Basic required field checks for immediate UI feedback
- if (!nodeData.prompt || nodeData.prompt.trim() === '') {
- errors.push('Prompt is required');
- }
-
- // Backend handles all complex validation, API keys, etc.
- return {
- valid: errors.length === 0,
- errors
- };
- }
-}
-
-export default AIAgentExecutionService;
\ No newline at end of file
diff --git a/client/src/types/INodeProperties.ts b/client/src/types/INodeProperties.ts
index 5b0ba74f..573472a9 100644
--- a/client/src/types/INodeProperties.ts
+++ b/client/src/types/INodeProperties.ts
@@ -296,71 +296,3 @@ export interface IExecuteContext {
};
connectionType?: NodeConnectionType;
}
-
-// ============================================================================
-// HELPER FUNCTIONS FOR DATA FLOW
-// ============================================================================
-
-// Helper to create execution data in n8n format
-export function createNodeExecutionData(json: Record<string, any>, binary?: Record<string, IBinaryData>): INodeExecutionData {
- return {
- json,
- binary,
- pairedItem: { item: 0 }
- };
-}
-
-// Helper to create simple text output
-export function createTextOutput(text: string, additionalData?: Record<string, any>): INodeExecutionData[] {
- return [{
- json: {
- text,
- ...additionalData
- }
- }];
-}
-
-// Helper to create file output
-export function createFileOutput(filePath: string, fileName: string, mimeType: string, additionalData?: Record<string, any>): INodeExecutionData[] {
- return [{
- json: {
- fileName,
- filePath,
- mimeType,
- ...additionalData
- },
- binary: {
- file: {
- data: '', // Would be populated with actual file data
- fileName,
- mimeType,
- fileSize: 0
- }
- }
- }];
-}
-
-// Helper to create AI response output
-export function createAIOutput(response: string, model: string, usage?: any, additionalData?: Record<string, any>): INodeExecutionData[] {
- return [{
- json: {
- response,
- model,
- usage,
- timestamp: new Date().toISOString(),
- ...additionalData
- }
- }];
-}
-
-// Helper to create location output
-export function createLocationOutput(latitude: number, longitude: number, additionalData?: Record<string, any>): INodeExecutionData[] {
- return [{
- json: {
- latitude,
- longitude,
- timestamp: new Date().toISOString(),
- ...additionalData
- }
- }];
-}