Skip to content

Self-improving AI Employees for everyone

refactor(client): Wave 2 Phase 2 - outputSchema field on node definitions

trohitg5d8d2b5068d3
diff --git a/client/src/components/parameterPanel/InputSection.tsx b/client/src/components/parameterPanel/InputSection.tsx
index f3bc00fa..4ba5456d 100644
--- a/client/src/components/parameterPanel/InputSection.tsx
+++ b/client/src/components/parameterPanel/InputSection.tsx
@@ -175,6 +175,11 @@ const InputSection: React.FC<InputSectionProps> = ({ nodeId, visible = true }) =
} else {
hasExecutionData = false;
+ // Schema-driven first: if the node definition declares an
+ // outputSchema, use it directly. The `start` node's runtime
+ // shape is data-driven from the user's initialData JSON, so
+ // it keeps the legacy parsing path for now.
+ const declaredSchema = nodeDef?.outputSchema;
if (nodeType === 'start') {
try {
const initialData = sourceNode?.data?.initialData || '{}';
@@ -182,6 +187,8 @@ const InputSection: React.FC<InputSectionProps> = ({ nodeId, visible = true }) =
} catch (e) {
outputSchema = {};
}
+ } else if (declaredSchema) {
+ outputSchema = declaredSchema;
} else {
const sampleSchemas: Record<string, Record<string, any>> = {
location: { latitude: 'number', longitude: 'number', accuracy: 'number', provider: 'string', altitude: 'number' },
diff --git a/client/src/nodeDefinitions/aiAgentNodes.ts b/client/src/nodeDefinitions/aiAgentNodes.ts
index bd32f58b..7db8344d 100644
--- a/client/src/nodeDefinitions/aiAgentNodes.ts
+++ b/client/src/nodeDefinitions/aiAgentNodes.ts
@@ -314,6 +314,13 @@ export const aiAgentNodes: Record<string, INodeTypeDescription> = {
description: 'Markdown-based conversation memory with optional vector DB for long-term retrieval',
defaults: { name: 'Memory', color: '#8b5cf6' },
uiHints: { isMemoryPanel: true, hasCodeEditor: true, hideRunButton: true },
+ outputSchema: {
+ session_id: 'string',
+ messages: 'array',
+ message_count: 'number',
+ memory_type: 'string',
+ window_size: 'number',
+ },
inputs: [], // No input - memory node is passive
outputs: [{
name: 'memory',
diff --git a/client/src/nodeDefinitions/codeNodes.ts b/client/src/nodeDefinitions/codeNodes.ts
index ed26bb9c..6564c74f 100644
--- a/client/src/nodeDefinitions/codeNodes.ts
+++ b/client/src/nodeDefinitions/codeNodes.ts
@@ -12,6 +12,7 @@ export const codeNodes: Record<string, INodeTypeDescription> = {
description: 'Execute Python code with input data access',
defaults: { name: 'Python Executor', color: '#3776AB' },
uiHints: { hasCodeEditor: true },
+ outputSchema: { output: 'any' },
inputs: [{ name: 'main', displayName: 'Input', type: 'main' as NodeConnectionType, description: 'Input data as input_data variable' }],
outputs: [{ name: 'main', displayName: 'Output', type: 'main' as NodeConnectionType, description: 'Python execution result' }],
properties: [
@@ -37,6 +38,7 @@ export const codeNodes: Record<string, INodeTypeDescription> = {
description: 'Execute JavaScript code with input data access',
defaults: { name: 'JavaScript Executor', color: '#F7DF1E' },
uiHints: { hasCodeEditor: true },
+ outputSchema: { output: 'any' },
inputs: [{ name: 'main', displayName: 'Input', type: 'main' as NodeConnectionType, description: 'Input data as input_data variable' }],
outputs: [{ name: 'main', displayName: 'Output', type: 'main' as NodeConnectionType, description: 'JavaScript execution result' }],
properties: [
@@ -62,6 +64,7 @@ export const codeNodes: Record<string, INodeTypeDescription> = {
description: 'Execute TypeScript code with input data access and type safety',
defaults: { name: 'TypeScript Executor', color: '#3178C6' },
uiHints: { hasCodeEditor: true },
+ outputSchema: { output: 'any' },
inputs: [{ name: 'main', displayName: 'Input', type: 'main' as NodeConnectionType, description: 'Input data as input_data variable' }],
outputs: [{ name: 'main', displayName: 'Output', type: 'main' as NodeConnectionType, description: 'TypeScript execution result' }],
properties: [
diff --git a/client/src/nodeDefinitions/utilityNodes.ts b/client/src/nodeDefinitions/utilityNodes.ts
index 73c27569..cabbbe25 100644
--- a/client/src/nodeDefinitions/utilityNodes.ts
+++ b/client/src/nodeDefinitions/utilityNodes.ts
@@ -227,6 +227,11 @@ export const utilityNodes: Record<string, INodeTypeDescription> = {
description: 'Trigger workflow when user sends a chat message from the console input',
defaults: { name: 'Chat Trigger', color: '#10b981' },
uiHints: { isChatTrigger: true },
+ outputSchema: {
+ message: 'string',
+ timestamp: 'string',
+ session_id: 'string',
+ },
inputs: [],
outputs: [{
name: 'main',
diff --git a/client/src/nodeDefinitions/workflowNodes.ts b/client/src/nodeDefinitions/workflowNodes.ts
index 19b823c0..076e6a79 100644
--- a/client/src/nodeDefinitions/workflowNodes.ts
+++ b/client/src/nodeDefinitions/workflowNodes.ts
@@ -16,6 +16,10 @@ export const workflowNodes: Record<string, INodeTypeDescription> = {
description: 'Starting point for workflow execution. Provides initial data to connected nodes.',
defaults: { name: 'Start', color: '#8be9fd' },
uiHints: { hideInputSection: true, hideOutputSection: true },
+ outputSchema: {
+ timestamp: 'string',
+ data: 'any',
+ },
inputs: [],
outputs: [{
name: 'main',
@@ -48,6 +52,16 @@ export const workflowNodes: Record<string, INodeTypeDescription> = {
subtitle: 'Child Agent Completed',
description: 'Triggers when a delegated child agent completes its task (success or error)',
defaults: { name: 'Task Completed', color: '#bd93f9' },
+ outputSchema: {
+ task_id: 'string',
+ status: 'string', // 'completed' | 'error'
+ agent_name: 'string',
+ agent_node_id: 'string',
+ parent_node_id: 'string',
+ result: 'string', // present when status === 'completed'
+ error: 'string', // present when status === 'error'
+ workflow_id: 'string',
+ },
inputs: [],
outputs: [{
name: 'main',
diff --git a/client/src/types/INodeProperties.ts b/client/src/types/INodeProperties.ts
index 5148f5bb..9c4ea810 100644
--- a/client/src/types/INodeProperties.ts
+++ b/client/src/types/INodeProperties.ts
@@ -232,6 +232,14 @@ export interface INodeTypeDescription {
};
/** Per-node UI hints; see INodeUIHints for each flag. */
uiHints?: INodeUIHints;
+ /**
+ * JSON-Schema-shaped descriptor of this node's runtime output. Used by
+ * InputSection to populate the draggable variable list for downstream
+ * nodes; if absent, falls back to the legacy `sampleSchemas` map.
+ * Use plain primitive type names ('string' | 'number' | 'boolean' |
+ * 'array' | 'object' | 'any') for leaves, or nested objects.
+ */
+ outputSchema?: Record<string, any>;
}
// Node type interface that nodes must implement