Skip to content

Self-improving AI Employees for everyone

feat(ui): Wave 10.G.4 + 10.G.5 — retire residual node-type string checks, +5 invariants

trohitg26dfa60aa491
diff --git a/client/src/ParameterPanel.tsx b/client/src/ParameterPanel.tsx
index 559677b2..29ee6332 100644
--- a/client/src/ParameterPanel.tsx
+++ b/client/src/ParameterPanel.tsx
@@ -7,7 +7,6 @@ import { useWebSocket } from './contexts/WebSocketContext';
import { ExecutionService, ExecutionResult } from './services/executionService';
import { useAppTheme } from './hooks/useAppTheme';
import { CalendarClock, PlayCircle } from 'lucide-react';
-import { SKILL_NODE_TYPES } from './nodeDefinitions/skillNodes';
import { ActionButton } from './components/ui/action-button';
const ParameterPanel: React.FC = () => {
@@ -117,17 +116,16 @@ const ParameterPanel: React.FC = () => {
const canExecute = selectedNode && nodeDefinition &&
ExecutionService.isNodeTypeSupported(nodeDefinition.name);
- // 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);
+ // Wave 10.G.5: panel visibility is now pure schema-driven.
+ // `hideInputSection` / `hideOutputSection` / `hideRunButton` are
+ // declared directly in each plugin module's `uiHints`. Tool-kind
+ // nodes (Master Skill, Write Todos, Simple Memory …) don't emit the
+ // run button because they're passive — they inherit from the node's
+ // own `uiHints`, not from a frontend type-array.
+ const hints = (nodeDefinition?.uiHints as Record<string, any>) ?? {};
+ const hideInputSection = hints.hideInputSection === true;
+ const hideOutputSection = hints.hideOutputSection === true;
+ const hideRunButton = hints.hideRunButton === true;
if (!selectedNode || !nodeDefinition) {
return null;
@@ -135,23 +133,19 @@ const ParameterPanel: React.FC = () => {
- // Helper to render icon (handles image URLs, Ant Design icons, and emoji/text)
+ // Wave 10.G.5: icon dispatch reads spec.componentKind ("start" is the
+ // backend-declared componentKind of the workflow start node) and a
+ // small set of icon-key prefixes. No hardcoded node-name checks.
const renderIcon = (icon: string) => {
- // Handle Ant Design icon names
if (icon === 'schedule') {
return <CalendarClock className="h-5 w-5" style={{ color: theme.colors.actionDeploy }} />;
}
- if (icon === 'play' || nodeDefinition?.name === 'start') {
+ if (icon === 'play' || (nodeDefinition as any)?.componentKind === 'start') {
return <PlayCircle className="h-5 w-5" style={{ color: theme.dracula.cyan }} />;
}
- // Handle image URLs
if (icon.startsWith('data:') || icon.startsWith('http') || icon.startsWith('/')) {
return (
- <img
- src={icon}
- alt="icon"
- style={{ width: 20, height: 20, objectFit: 'contain' }}
- />
+ <img src={icon} alt="icon" style={{ width: 20, height: 20, objectFit: 'contain' }} />
);
}
return <span>{icon}</span>;
@@ -166,7 +160,7 @@ const ParameterPanel: React.FC = () => {
{hasUnsavedChanges && <span style={{ color: theme.accent.orange }}>*</span>}
</div>
<div className="flex items-center gap-2">
- {canExecute && !hideRunButton && !isMonitorNode && (
+ {canExecute && !hideRunButton && (
<ActionButton
tone="green"
onClick={handleRun}
diff --git a/client/src/components/parameterPanel/InputSection.tsx b/client/src/components/parameterPanel/InputSection.tsx
index 66f881fa..258bbf8b 100644
--- a/client/src/components/parameterPanel/InputSection.tsx
+++ b/client/src/components/parameterPanel/InputSection.tsx
@@ -244,45 +244,47 @@ const InputSection: React.FC<InputSectionProps> = ({ nodeId, visible = true }) =
// Schema precedence (mirrors n8n VirtualSchema.vue — see
// docs-internal/schema_source_of_truth_rfc.md):
// 1. real run data (handled above in the `if` branch)
- // 2. backend-declared schema via get_node_output_schema
- // 3. `{ data: 'any' }` empty fallback
+ // 2. user-authored blob (plugin declares `hasInitialDataBlob`)
+ // 3. backend-declared schema via get_node_output_schema
+ // 4. `{ data: 'any' }` empty fallback
//
- // `start` is special-cased: its shape is authored inline by the
- // user as initialData JSON, so there's no backend schema to
- // defer to.
- const backendSchema = nodeType !== 'start'
- ? jsonSchemaToShape(await fetchNodeOutputSchema(nodeType, sendRequest))
- : null;
-
- if (nodeType === 'start') {
+ // Wave 10.G.5: every dispatch decision reads from the node's
+ // own NodeSpec — no `nodeType === 'start'` / 'socialReceive'
+ // string checks.
+ const sourceSpec = nodeType ? getCachedNodeSpec(nodeType) : null;
+ const sourceHints = (sourceSpec?.uiHints as Record<string, any>) ?? {};
+
+ if (sourceHints.hasInitialDataBlob === true) {
try {
const initialData = sourceNode?.data?.initialData || '{}';
outputSchema = typeof initialData === 'string' ? JSON.parse(initialData) : initialData;
} catch (e) {
outputSchema = {};
}
- } else if (backendSchema) {
- outputSchema = backendSchema;
-
- // socialReceive multi-output dispatch: when the downstream edge
- // connects via a specific output-* handle, show only that
- // handle's nested schema. The backend schema surfaces all four
- // nested objects (message / media / contact / metadata) plus
- // top-level flat fields; we slice the right nested object
- // here. Colocated with the multi-output consumer.
- if (nodeType === 'socialReceive' && edge.sourceHandle?.startsWith('output-')) {
- const handleName = edge.sourceHandle.replace('output-', '');
- const nested = handleName && (backendSchema as Record<string, any>)[handleName];
- if (nested !== undefined) {
- outputSchema = typeof nested === 'object' && nested !== null
- ? nested
- : { [handleName]: nested };
+ } else {
+ const backendSchema = jsonSchemaToShape(await fetchNodeOutputSchema(nodeType, sendRequest));
+ if (backendSchema) {
+ outputSchema = backendSchema;
+
+ // Multi-output dispatch: when the source node declares
+ // multiple output handles and the downstream edge picked
+ // a specific one, slice the matching nested sub-shape.
+ // Generalises socialReceive's 4-way fan-out to any node
+ // whose spec declares >1 output handle — all driven by
+ // handle topology, not node-type string.
+ const outputHandleCount = (sourceSpec?.handles ?? []).filter(h => h.kind === 'output').length;
+ if (outputHandleCount > 1 && edge.sourceHandle?.startsWith('output-')) {
+ const handleName = edge.sourceHandle.replace('output-', '');
+ const nested = handleName && (backendSchema as Record<string, any>)[handleName];
+ if (nested !== undefined) {
+ outputSchema = typeof nested === 'object' && nested !== null
+ ? nested
+ : { [handleName]: nested };
+ }
}
+ } else {
+ outputSchema = { data: 'any' };
}
- } else {
- // No backend schema declared and no run data -> empty fallback.
- // Frontend never guesses shapes.
- outputSchema = { data: 'any' };
}
}
diff --git a/client/src/components/parameterPanel/ToolSchemaEditor.tsx b/client/src/components/parameterPanel/ToolSchemaEditor.tsx
index f076b864..a2731dcd 100644
--- a/client/src/components/parameterPanel/ToolSchemaEditor.tsx
+++ b/client/src/components/parameterPanel/ToolSchemaEditor.tsx
@@ -16,7 +16,6 @@ import { useAppTheme } from '../../hooks/useAppTheme';
import { useToolSchema, ToolSchemaConfig } from '../../hooks/useToolSchema';
import { useWebSocket } from '../../contexts/WebSocketContext';
import { useAppStore } from '../../store/useAppStore';
-import { ANDROID_SERVICE_NODE_TYPES } from '../../nodeDefinitions/androidServiceNodes';
import { isNodeInBackendGroup } from '../../lib/nodeSpec';
import { nodeDefinitions } from '../../nodeDefinitions';
import {
@@ -133,10 +132,11 @@ const ToolSchemaEditor: React.FC<ToolSchemaEditorProps> = ({ nodeId }) => {
return currentWorkflow.nodes.find((n) => n.id === nodeId);
}, [currentWorkflow?.nodes, nodeId]);
- // Schema-driven gate: render only for nodes flagged as Android toolkits.
+ // Wave 10.G.5: render only for nodes whose spec declares
+ // `uiHints.isAndroidToolkit`. The androidTool node registers that
+ // hint; no frontend type-string fallback.
const currentNodeDef = currentNode?.type ? nodeDefinitions[currentNode.type] : undefined;
- const isAndroidTool =
- currentNodeDef?.uiHints?.isAndroidToolkit ?? (currentNode?.type === 'androidTool');
+ const isAndroidTool = (currentNodeDef?.uiHints as any)?.isAndroidToolkit === true;
if (!isAndroidTool) return null;
const connectedServices = useMemo(() => {
@@ -145,9 +145,11 @@ const ToolSchemaEditor: React.FC<ToolSchemaEditorProps> = ({ nodeId }) => {
const services: Node[] = [];
for (const edge of incomingEdges) {
const sourceNode = currentWorkflow.nodes.find((n) => n.id === edge.source);
- // Wave 6 Phase 5.b: backend group → legacy fallback
+ // Wave 10.G.5: backend `group` membership only. NodeSpec prefetch
+ // runs on WS connect, so the cache is always warm by the time the
+ // parameter panel mounts.
const isAndroid = sourceNode
- ? (isNodeInBackendGroup(sourceNode.type, 'android') ?? ANDROID_SERVICE_NODE_TYPES.includes(sourceNode.type || ''))
+ ? (isNodeInBackendGroup(sourceNode.type, 'android') === true)
: false;
if (sourceNode && isAndroid) {
services.push(sourceNode);
diff --git a/server/models/nodes.py b/server/models/nodes.py
index 4e92a644..8478febc 100644
--- a/server/models/nodes.py
+++ b/server/models/nodes.py
@@ -231,7 +231,10 @@ class CreateMapParams(BaseNodeParams):
center_lng: float = Field(default=0.0, alias="centerLng")
zoom: int = Field(default=10, ge=1, le=20)
map_type: Literal["roadmap", "satellite", "terrain", "hybrid"] = Field(default="roadmap", alias="mapType")
- api_key: Optional[str] = Field(default=None, alias="apiKey")
+ api_key: Optional[str] = Field(
+ default=None, alias="apiKey",
+ json_schema_extra={"password": True},
+ )
class GmapsLocationsParams(BaseNodeParams):
diff --git a/server/nodes/services.py b/server/nodes/services.py
index 7bd85678..9f87bae4 100644
--- a/server/nodes/services.py
+++ b/server/nodes/services.py
@@ -80,7 +80,7 @@ register_node(
"handles": [{"name": "output-memory", "kind": "output", "position": "top", "label": "Memory", "role": "memory"}],
"description": "Markdown-based conversation memory with optional vector DB",
"version": 1,
- "uiHints": {"isMemoryPanel": True, "hasCodeEditor": True},
+ "uiHints": {"isMemoryPanel": True, "hasCodeEditor": True, "hideRunButton": True},
},
)
diff --git a/server/nodes/tools.py b/server/nodes/tools.py
index ea3e5ab1..97ef52b8 100644
--- a/server/nodes/tools.py
+++ b/server/nodes/tools.py
@@ -34,7 +34,7 @@ register_node(
"handles": _TOOL_HANDLES,
"description": "Add, subtract, multiply, divide, power, sqrt, mod, abs",
"version": 1,
- "uiHints": {"isToolPanel": True},
+ "uiHints": {"isToolPanel": True, "hideRunButton": True},
},
)
@@ -50,7 +50,7 @@ register_node(
"handles": _TOOL_HANDLES,
"description": "Get current date/time with timezone support",
"version": 1,
- "uiHints": {"isToolPanel": True},
+ "uiHints": {"isToolPanel": True, "hideRunButton": True},
},
)
@@ -66,7 +66,7 @@ register_node(
"handles": _TOOL_HANDLES,
"description": "DuckDuckGo web search (free, no API key required)",
"version": 1,
- "uiHints": {"isToolPanel": True},
+ "uiHints": {"isToolPanel": True, "hideRunButton": True},
},
)
@@ -82,7 +82,7 @@ register_node(
"handles": _TOOL_HANDLES,
"description": "Task management tool for AI agents to create, track, and manage tasks",
"version": 1,
- "uiHints": {"isToolPanel": True},
+ "uiHints": {"isToolPanel": True, "hideRunButton": True},
},
)
@@ -98,6 +98,6 @@ register_node(
"handles": _TOOL_HANDLES,
"description": "Structured task list planning for complex multi-step operations",
"version": 1,
- "uiHints": {"isToolPanel": True},
+ "uiHints": {"isToolPanel": True, "hideRunButton": True},
},
)
diff --git a/server/nodes/triggers.py b/server/nodes/triggers.py
index d19ca61c..ccbdd1fe 100644
--- a/server/nodes/triggers.py
+++ b/server/nodes/triggers.py
@@ -41,7 +41,11 @@ register_node(
"handles": _TRIGGER_OUTPUT_HANDLES,
"description": "Starting point for workflow execution. Provides initial data to connected nodes.",
"version": 1,
- "uiHints": {"hideInputSection": True, "hideOutputSection": True},
+ # `hasInitialDataBlob` tells the InputSection the output shape comes
+ # from a user-authored JSON blob on the node itself (the `initialData`
+ # field), not a backend Pydantic schema. Used to be an inline
+ # `nodeType === 'start'` check on the frontend.
+ "uiHints": {"hideInputSection": True, "hideOutputSection": True, "hasInitialDataBlob": True},
},
)
diff --git a/server/nodes/utilities.py b/server/nodes/utilities.py
index 8d868102..c8bb6621 100644
--- a/server/nodes/utilities.py
+++ b/server/nodes/utilities.py
@@ -84,7 +84,7 @@ register_node(
],
"description": "Monitor agent team operations, tasks, and messages in real-time",
"version": 1,
- "uiHints": {"hideInputSection": True, "hideOutputSection": True, "isMonitorPanel": True},
+ "uiHints": {"hideInputSection": True, "hideOutputSection": True, "isMonitorPanel": True, "hideRunButton": True},
"hideOutputHandle": True,
},
)
diff --git a/server/tests/test_node_spec.py b/server/tests/test_node_spec.py
index 881a4cd7..a331b443 100644
--- a/server/tests/test_node_spec.py
+++ b/server/tests/test_node_spec.py
@@ -744,6 +744,8 @@ class TestNodeSpecContractInvariants:
"isConsoleSink", "hasSkills",
# Wave 10.A: size hints carried by plugin registrations
"width", "height",
+ # Wave 10.G.5: start-node's user-authored JSON blob marker
+ "hasInitialDataBlob",
}
for node_type, meta in NODE_METADATA.items():
hints = meta.get("uiHints") or {}
@@ -857,3 +859,102 @@ class TestPluginContractInvariants:
assert not outs, (
f"{t}: hideOutputHandle=True but handles declares output(s) {outs}"
)
+
+
+class TestWave10GContractInvariants:
+ """Wave 10.G.4 invariants: every widget-dispatch uiHint MiddleSection
+ reads is declared at the plugin level, so the frontend doesn't need
+ per-family string fallbacks.
+ """
+
+ AGENT_EXEMPT = {"socialReceive", "socialSend"} # reuse component but aren't agents
+
+ def _plugin_types(self):
+ import nodes # noqa: F401
+ from services.node_registry import registered_node_types
+ from models.node_metadata import NODE_METADATA
+ explicit = {t for t, m in NODE_METADATA.items() if "componentKind" in m}
+ return registered_node_types() | explicit
+
+ def test_every_componentKind_agent_declares_hasSkills(self):
+ """MiddleSection's `isAgentWithSkills` reads `uiHints.hasSkills`;
+ the Connected Skills accordion + memory-edge follow-through both
+ depend on it. An agent-kind node without this hint silently loses
+ skill-panel rendering."""
+ for t in self._plugin_types():
+ spec = get_node_spec(t)
+ if spec.get("componentKind") != "agent":
+ continue
+ if t in self.AGENT_EXEMPT:
+ continue
+ hints = spec.get("uiHints") or {}
+ assert hints.get("hasSkills") is True, (
+ f"{t}: componentKind=agent must declare uiHints.hasSkills=True"
+ )
+
+ def test_every_tool_kind_declares_isToolPanel(self):
+ """Every dedicated tool node (componentKind='tool') must emit
+ `uiHints.isToolPanel=True` so MiddleSection renders the
+ ToolSchemaEditor. Dual-purpose nodes (group includes 'tool' but
+ componentKind='square') don't show the editor — they render as
+ normal squares and become tools only when wired to an agent's
+ input-tools handle."""
+ for t in self._plugin_types():
+ spec = get_node_spec(t)
+ if spec.get("componentKind") != "tool":
+ continue
+ hints = spec.get("uiHints") or {}
+ assert hints.get("isToolPanel") is True, (
+ f"{t}: componentKind=tool must declare uiHints.isToolPanel=True"
+ )
+
+ def test_google_workspace_nodes_have_operation_gating(self):
+ """Drive / Sheets / Tasks / Contacts / Gmail all have an
+ `operation` discriminator; at least one sub-field must hide
+ behind `displayOptions.show.operation` so the panel isn't a
+ flat dump of every op's fields."""
+ from services.node_input_schemas import get_node_input_schema
+ for t in ("gmail", "drive", "sheets", "tasks", "contacts"):
+ schema = get_node_input_schema(t)
+ assert schema, f"{t}: no input schema"
+ props = schema.get("properties") or {}
+ gated = [
+ name for name, p in props.items()
+ if (p.get("displayOptions") or {}).get("show", {}).get("operation")
+ ]
+ assert gated, (
+ f"{t}: no field declares displayOptions.show.operation; "
+ "every per-op field would render at once"
+ )
+
+ def test_code_executors_declare_code_editor(self):
+ """The ParameterRenderer `case 'code'` widget only fires when
+ the Pydantic field emits `editor: 'code'`. Without this the
+ code executor falls back to a plain string input."""
+ from services.node_input_schemas import get_node_input_schema
+ for t in ("pythonExecutor", "javascriptExecutor", "typescriptExecutor"):
+ schema = get_node_input_schema(t)
+ code_field = (schema.get("properties") or {}).get("code")
+ assert code_field, f"{t}: `code` field missing from input schema"
+ assert code_field.get("editor") == "code", (
+ f"{t}.code: expected `editor: 'code'`, got {code_field.get('editor')!r}"
+ )
+
+ def test_api_key_fields_are_password_masked(self):
+ """Every field named `apiKey` / `api_key` across every node's
+ input schema must emit `password: True` so the UI masks it.
+ Tribal risk: a new node author forgets the hint and the key
+ renders in plaintext."""
+ from services.node_input_schemas import NODE_INPUT_MODELS, get_node_input_schema
+ offenders = []
+ for t in NODE_INPUT_MODELS:
+ schema = get_node_input_schema(t)
+ if not schema:
+ continue
+ for name, prop in (schema.get("properties") or {}).items():
+ if name in ("apiKey", "api_key") and prop.get("password") is not True:
+ offenders.append(f"{t}.{name}")
+ assert not offenders, (
+ "API-key fields missing password:True — they would render in "
+ f"plaintext: {offenders}"
+ )