Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
refactor(client): Wave 2 Phase 1 - schema-drive panel visibility via uiHints
trohitg0e816f3dd884
diff --git a/client/src/ParameterPanel.tsx b/client/src/ParameterPanel.tsxindex e5a7dc72..90a8d114 100644--- a/client/src/ParameterPanel.tsx+++ b/client/src/ParameterPanel.tsx@@ -116,10 +116,17 @@ const ParameterPanel: React.FC = () => {const canExecute = selectedNode && nodeDefinition &&ExecutionService.isNodeTypeSupported(nodeDefinition.name);- // Check if this is a Start node, Skill node, or Monitor node (only show middle section)- const isStartNode = nodeDefinition?.name === 'start';- const isSkillNode = nodeDefinition?.name && SKILL_NODE_TYPES.includes(nodeDefinition.name);- const isMonitorNode = nodeDefinition?.name === 'teamMonitor';+ // Panel-level visibility hints come from nodeDefinition.uiHints.+ // Legacy name fallbacks stay for one release for any node not yet annotated.+ const hints = nodeDefinition?.uiHints;+ const isStartNode = hints?.hideInputSection && hints?.hideOutputSection+ ? false // generic "no input/output" handled by hints below+ : nodeDefinition?.name === 'start';+ const isSkillNode = !!nodeDefinition?.name && SKILL_NODE_TYPES.includes(nodeDefinition.name);+ const isMonitorNode = hints?.isMonitorPanel ?? (nodeDefinition?.name === 'teamMonitor');+ const hideInputSection = hints?.hideInputSection ?? (isStartNode || isSkillNode || isMonitorNode);+ const hideOutputSection = hints?.hideOutputSection ?? (isStartNode || isSkillNode || isMonitorNode);+ const hideRunButton = hints?.hideRunButton ?? (isSkillNode || isMonitorNode);if (!selectedNode || !nodeDefinition) {return null;@@ -192,7 +199,7 @@ const ParameterPanel: React.FC = () => {{/* Buttons: Run, Save, Cancel */}<div style={{ display: 'flex', gap: '8px', alignItems: 'center' }}>{/* Run Button - hide for monitor nodes since they show live data */}- {canExecute && !isMonitorNode && (+ {canExecute && !hideRunButton && !isMonitorNode && (<buttonstyle={actionButtonStyle(theme.dracula.green, isExecuting)}onClick={handleRun}@@ -293,8 +300,8 @@ const ParameterPanel: React.FC = () => {onParameterChange={handleParameterChange}executionResults={executionResults}onClearResults={handleClearResults}- showInputSection={!isStartNode && !isSkillNode && !isMonitorNode}- showOutputSection={!isStartNode && !isSkillNode && !isMonitorNode}+ showInputSection={!hideInputSection}+ showOutputSection={!hideOutputSection}isLoadingParameters={isLoading}/></Modal>diff --git a/client/src/components/LocationParameterPanel.tsx b/client/src/components/LocationParameterPanel.tsxindex 4fcd108e..601b8741 100644--- a/client/src/components/LocationParameterPanel.tsx+++ b/client/src/components/LocationParameterPanel.tsx@@ -52,8 +52,11 @@ const LocationParameterPanel: React.FC = () => {return null;}- // Only show LocationParameterPanel for gmaps_create node- if (nodeDefinition.name !== 'gmaps_create') {+ // Only show LocationParameterPanel for nodes flagged via uiHints; legacy+ // name fallback for nodes not yet annotated.+ const showPanel = nodeDefinition.uiHints?.showLocationPanel+ ?? (nodeDefinition.name === 'gmaps_create');+ if (!showPanel) {return null;}diff --git a/client/src/components/parameterPanel/MiddleSection.tsx b/client/src/components/parameterPanel/MiddleSection.tsxindex 068895ba..8a44166b 100644--- a/client/src/components/parameterPanel/MiddleSection.tsx+++ b/client/src/components/parameterPanel/MiddleSection.tsx@@ -170,27 +170,25 @@ const MiddleSection: React.FC<MiddleSectionProps> = ({const visibleParams = (nodeDefinition.properties || []).filter((param: INodeProperties) => shouldShowParameter(param, parameters));- // Check if this is a code executor node (Python or JavaScript)- const isCodeExecutorNode = nodeDefinition.name === 'pythonExecutor' || nodeDefinition.name === 'javascriptExecutor';-- // Check if this is a skill node with code editor (needs similar flex layout)- const isSkillNode = SKILL_NODE_TYPES.includes(nodeDefinition.name) && nodeDefinition.name !== 'customSkill' && nodeDefinition.name !== 'masterSkill';-- // Check if this is a master skill node (needs split panel layout)- const isMasterSkillNode = nodeDefinition.name === 'masterSkill';- console.log('[MiddleSection] nodeDefinition.name:', nodeDefinition.name, 'isMasterSkillNode:', isMasterSkillNode);-- // Check if this is a memory node with markdown editor- const isMemoryNode = nodeDefinition.name === 'simpleMemory';-- // Nodes that need flexible code editor layout- const needsCodeEditorLayout = isCodeExecutorNode || isSkillNode || isMemoryNode;-- // Check if this is a tool node that supports schema editing- const isToolNode = TOOL_NODE_TYPES.includes(nodeDefinition.name);-- // Check if this is an agent node that supports skills (has input-skill handle)- const isAgentWithSkills = AGENT_WITH_SKILLS_TYPES.includes(nodeDefinition.name);+ // Schema-driven layout flags. Read from nodeDefinition.uiHints first;+ // fall back to legacy name checks for nodes not yet annotated. The two+ // legacy arrays (TOOL_NODE_TYPES, AGENT_WITH_SKILLS_TYPES) are also+ // legacy fallbacks until every agent / tool node sets uiHints.hasSkills+ // / uiHints.isToolPanel respectively.+ const hints = nodeDefinition.uiHints ?? {};+ const isMasterSkillNode = hints.isMasterSkillEditor ?? (nodeDefinition.name === 'masterSkill');+ const isMemoryNode = hints.isMemoryPanel ?? (nodeDefinition.name === 'simpleMemory');+ // hasCodeEditor covers code executors, seedable skill nodes, and memory.+ const isLegacyCodeExecutor = nodeDefinition.name === 'pythonExecutor' || nodeDefinition.name === 'javascriptExecutor';+ const isLegacySkillWithEditor = SKILL_NODE_TYPES.includes(nodeDefinition.name)+ && nodeDefinition.name !== 'customSkill'+ && nodeDefinition.name !== 'masterSkill';+ const needsCodeEditorLayout = hints.hasCodeEditor ?? (isLegacyCodeExecutor || isLegacySkillWithEditor || isMemoryNode);+ // 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);// State for Master Skill parametersconst [masterSkillParams, setMasterSkillParams] = useState<Record<string, any>>({});diff --git a/client/src/components/parameterPanel/ToolSchemaEditor.tsx b/client/src/components/parameterPanel/ToolSchemaEditor.tsxindex d67b7b3a..812cb511 100644--- a/client/src/components/parameterPanel/ToolSchemaEditor.tsx+++ b/client/src/components/parameterPanel/ToolSchemaEditor.tsx@@ -11,6 +11,7 @@ import { useToolSchema, ToolSchemaConfig, SchemaFieldConfig } from '../../hooks/import { useWebSocket } from '../../contexts/WebSocketContext';import { useAppStore } from '../../store/useAppStore';import { ANDROID_SERVICE_NODE_TYPES } from '../../nodeDefinitions/androidServiceNodes';+import { nodeDefinitions } from '../../nodeDefinitions';interface ToolSchemaEditorProps {nodeId: string;@@ -54,9 +55,12 @@ const ToolSchemaEditor: React.FC<ToolSchemaEditorProps> = ({ nodeId }) => {return currentWorkflow.nodes.find(n => n.id === nodeId);}, [currentWorkflow?.nodes, nodeId]);- const isAndroidTool = currentNode?.type === 'androidTool';-- // Only show for androidTool+ // Schema-driven gate: only render for nodes flagged as Android toolkits.+ // Legacy name fallback covers the canonical androidTool until the node+ // definition is annotated with uiHints.isAndroidToolkit.+ const currentNodeDef = currentNode?.type ? nodeDefinitions[currentNode.type] : undefined;+ const isAndroidTool = currentNodeDef?.uiHints?.isAndroidToolkit+ ?? (currentNode?.type === 'androidTool');if (!isAndroidTool) return null;// Find connected Android service nodes via edgesdiff --git a/client/src/components/ui/ConsolePanel.tsx b/client/src/components/ui/ConsolePanel.tsxindex 62f05ce2..306e0631 100644--- a/client/src/components/ui/ConsolePanel.tsx+++ b/client/src/components/ui/ConsolePanel.tsx@@ -14,16 +14,18 @@ import ReactMarkdown from 'react-markdown';import remarkGfm from 'remark-gfm';import remarkBreaks from 'remark-breaks';import { useWebSocket, ConsoleLogEntry } from '../../contexts/WebSocketContext';+import { nodeDefinitions } from '../../nodeDefinitions';import { useAppTheme } from '../../hooks/useAppTheme';import { useTheme } from '../../contexts/ThemeContext';import { Input } from '@/components/ui/input';import Prism from 'prismjs';import 'prismjs/components/prism-json';-// Node types that can be targeted by chat messages-const CHAT_TRIGGER_TYPES = ['chatTrigger'];-// Node types that produce console output-const CONSOLE_NODE_TYPES = ['console'];+// Schema-driven: a node is a chat target / console sink if its definition+// sets the matching uiHints flag. Legacy name list kept until every node+// is annotated.+const LEGACY_CHAT_TRIGGER_TYPES = ['chatTrigger'];+const LEGACY_CONSOLE_NODE_TYPES = ['console'];interface ConsolePanelProps {isOpen: boolean;@@ -56,13 +58,21 @@ const ConsolePanel: React.FC<ConsolePanelProps> = ({const maxFontSize = parseInt(theme.fontSize.xl) * 2;const defaultFontSize = parseInt(theme.fontSize.sm);- // Filter nodes to get chatTrigger and console nodes+ // Filter nodes via uiHints first, legacy name list as fallback.const chatTriggerNodes = useMemo(() =>- nodes.filter(n => CHAT_TRIGGER_TYPES.includes(n.type || '')),+ nodes.filter(n => {+ const def = n.type ? nodeDefinitions[n.type] : undefined;+ return def?.uiHints?.isChatTrigger+ ?? LEGACY_CHAT_TRIGGER_TYPES.includes(n.type || '');+ }),[nodes]);const consoleNodes = useMemo(() =>- nodes.filter(n => CONSOLE_NODE_TYPES.includes(n.type || '')),+ nodes.filter(n => {+ const def = n.type ? nodeDefinitions[n.type] : undefined;+ return def?.uiHints?.isConsoleSink+ ?? LEGACY_CONSOLE_NODE_TYPES.includes(n.type || '');+ }),[nodes]);diff --git a/client/src/nodeDefinitions/aiAgentNodes.ts b/client/src/nodeDefinitions/aiAgentNodes.tsindex b1f4b891..bd32f58b 100644--- a/client/src/nodeDefinitions/aiAgentNodes.ts+++ b/client/src/nodeDefinitions/aiAgentNodes.ts@@ -313,6 +313,7 @@ export const aiAgentNodes: Record<string, INodeTypeDescription> = {version: 1,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 },inputs: [], // No input - memory node is passiveoutputs: [{name: 'memory',diff --git a/client/src/nodeDefinitions/codeNodes.ts b/client/src/nodeDefinitions/codeNodes.tsindex ceb73e32..ed26bb9c 100644--- a/client/src/nodeDefinitions/codeNodes.ts+++ b/client/src/nodeDefinitions/codeNodes.ts@@ -11,6 +11,7 @@ export const codeNodes: Record<string, INodeTypeDescription> = {subtitle: 'Run Python Code',description: 'Execute Python code with input data access',defaults: { name: 'Python Executor', color: '#3776AB' },+ uiHints: { hasCodeEditor: true },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: [@@ -35,6 +36,7 @@ export const codeNodes: Record<string, INodeTypeDescription> = {subtitle: 'Run JavaScript Code',description: 'Execute JavaScript code with input data access',defaults: { name: 'JavaScript Executor', color: '#F7DF1E' },+ uiHints: { hasCodeEditor: true },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: [@@ -59,6 +61,7 @@ export const codeNodes: Record<string, INodeTypeDescription> = {subtitle: 'Run TypeScript Code',description: 'Execute TypeScript code with input data access and type safety',defaults: { name: 'TypeScript Executor', color: '#3178C6' },+ uiHints: { hasCodeEditor: true },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/locationNodes.ts b/client/src/nodeDefinitions/locationNodes.tsindex b5195176..a70d234a 100644--- a/client/src/nodeDefinitions/locationNodes.ts+++ b/client/src/nodeDefinitions/locationNodes.ts@@ -23,6 +23,7 @@ export const locationNodes: Record<string, INodeTypeDescription> = {subtitle: 'Initialize Google Map',description: 'Creates an interactive Google Map using the Maps JavaScript API with customizable center, zoom, and map type',defaults: { name: 'GMaps Create', color: '#1A73E8' },+ uiHints: { showLocationPanel: true },inputs: [{name: 'main',displayName: 'Map Configuration',diff --git a/client/src/nodeDefinitions/skillNodes.ts b/client/src/nodeDefinitions/skillNodes.tsindex 2f43619a..31f06b93 100644--- a/client/src/nodeDefinitions/skillNodes.ts+++ b/client/src/nodeDefinitions/skillNodes.ts@@ -21,6 +21,13 @@ export const skillNodes: Record<string, INodeTypeDescription> = {subtitle: 'Skill Aggregator',description: 'Combine built-in and custom skills with enable/disable toggles',defaults: { name: 'Master Skill', color: '#9333EA' },+ uiHints: {+ hideInputSection: true,+ hideOutputSection: true,+ hideRunButton: true,+ isMasterSkillEditor: true,+ hasCodeEditor: true,+ },inputs: [],outputs: [{name: 'skill',diff --git a/client/src/nodeDefinitions/utilityNodes.ts b/client/src/nodeDefinitions/utilityNodes.tsindex f696708b..73c27569 100644--- a/client/src/nodeDefinitions/utilityNodes.ts+++ b/client/src/nodeDefinitions/utilityNodes.ts@@ -226,6 +226,7 @@ export const utilityNodes: Record<string, INodeTypeDescription> = {version: 1,description: 'Trigger workflow when user sends a chat message from the console input',defaults: { name: 'Chat Trigger', color: '#10b981' },+ uiHints: { isChatTrigger: true },inputs: [],outputs: [{name: 'main',@@ -259,6 +260,7 @@ export const utilityNodes: Record<string, INodeTypeDescription> = {version: 1,description: 'Log data to console panel for debugging during execution',defaults: { name: 'Console', color: '#8b5cf6' },+ uiHints: { isConsoleSink: true },inputs: [{ name: 'main', displayName: 'Input', type: 'main' as NodeConnectionType, description: 'Data to log' }],outputs: [{ name: 'main', displayName: 'Output', type: 'main' as NodeConnectionType, description: 'Passes input through unchanged' }],properties: [@@ -324,6 +326,7 @@ export const utilityNodes: Record<string, INodeTypeDescription> = {version: 1,description: 'Monitor agent team operations, tasks, and messages in real-time',defaults: { name: 'Team Monitor', color: '#8b5cf6' },+ uiHints: { hideInputSection: true, hideOutputSection: true, isMonitorPanel: true },inputs: [{ name: 'team', displayName: 'Team', type: 'main' as NodeConnectionType, description: 'Connect to AI Employee or Orchestrator Agent node' }],outputs: [{ name: 'main', displayName: 'Events', type: 'main' as NodeConnectionType, description: 'task_completed, task_failed, message_received, team_status' }],properties: [diff --git a/client/src/nodeDefinitions/workflowNodes.ts b/client/src/nodeDefinitions/workflowNodes.tsindex 77cc7327..19b823c0 100644--- a/client/src/nodeDefinitions/workflowNodes.ts+++ b/client/src/nodeDefinitions/workflowNodes.ts@@ -15,6 +15,7 @@ export const workflowNodes: Record<string, INodeTypeDescription> = {subtitle: 'Workflow Entry',description: 'Starting point for workflow execution. Provides initial data to connected nodes.',defaults: { name: 'Start', color: '#8be9fd' },+ uiHints: { hideInputSection: true, hideOutputSection: true },inputs: [],outputs: [{name: 'main',diff --git a/client/src/types/INodeProperties.ts b/client/src/types/INodeProperties.tsindex ff6dd12e..5148f5bb 100644--- a/client/src/types/INodeProperties.ts+++ b/client/src/types/INodeProperties.ts@@ -174,6 +174,41 @@ export interface INodeOperationDefinition {// Main node type description interface+/**+ * Per-node-definition UI hints. Lets panels and the inspector make+ * rendering decisions from the schema instead of `nodeDefinition.name === '…'`+ * string compares scattered across the UI tree. Each flag is consumed by+ * exactly one panel; defaults to `false` (the panel renders normally).+ */+export interface INodeUIHints {+ /** ParameterPanel: skip the Input section (e.g. start, skill, monitor). */+ hideInputSection?: boolean;+ /** ParameterPanel: skip the Output section (e.g. start, skill). */+ hideOutputSection?: boolean;+ /** ParameterPanel: hide the Run button (e.g. skill / memory / tool nodes). */+ hideRunButton?: boolean;+ /** MiddleSection: give the params block extra flex space for an embedded code editor. */+ hasCodeEditor?: boolean;+ /** MiddleSection: render the MasterSkillEditor split panel instead of the plain params list. */+ isMasterSkillEditor?: boolean;+ /** MiddleSection: render the memory markdown panel + token usage stats. */+ isMemoryPanel?: boolean;+ /** MiddleSection: surface the ToolSchemaEditor for connected services. */+ isToolPanel?: boolean;+ /** MiddleSection: render the team-monitor panel. */+ isMonitorPanel?: boolean;+ /** Special-case panel for gmaps_create with map preview. */+ showLocationPanel?: boolean;+ /** ToolSchemaEditor visibility (Android toolkit aggregator). */+ isAndroidToolkit?: boolean;+ /** ConsolePanel: this node is a chat-message target. */+ isChatTrigger?: boolean;+ /** ConsolePanel: this node consumes console output (filter source). */+ isConsoleSink?: boolean;+ /** Agent panels show the connected-skills section. */+ hasSkills?: boolean;+}+export interface INodeTypeDescription {displayName: string;name: string;@@ -195,6 +230,8 @@ export interface INodeTypeDescription {methods?: {loadOptions?: Record<string, (this: any) => Promise<INodePropertyOption[]>>;};+ /** Per-node UI hints; see INodeUIHints for each flag. */+ uiHints?: INodeUIHints;}// Node type interface that nodes must implement