Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
refactor(canvas): delete the unused TeamMonitorNode and ToolkitNode
trohitg18910b5fbd67
diff --git a/CLAUDE.md b/CLAUDE.mdindex ab1dab69..7cfc08b0 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -574,7 +574,7 @@ The frontend uses a layered cache + slice-subscription model so cold refreshes a### React.memo every canvas node component ([client/src/components/nodeMemoEquality.ts](./client/src/components/nodeMemoEquality.ts))- React Flow's documented requirement. Use the shared `nodePropsEqual` comparator -- it skips drag-state props (`xPos` / `yPos` / `dragging`) so the memo isn't defeated during drag.-- Applies to `SquareNode`, `AIAgentNode`, `TriggerNode`, `ToolkitNode`, `StartNode`, `TeamMonitorNode`. Add new node components the same way.+- Applies to `SquareNode`, `AIAgentNode`, `TriggerNode`, `StartNode`. Add new node components the same way.- Reference: https://reactflow.dev/learn/advanced-use/performance### Icon + color — per-plugin folder + visuals.json fallback@@ -2776,7 +2776,7 @@ This function:- **Code-executor error mapping** (`pythonExecutor` / `javascriptExecutor` / `typescriptExecutor`): wrap user-code execution and sidecar calls in `try/except`. Python: detect `ImportError("__import__ not found")` (the LLM tried `import X` against the sandboxed builtins) and surface the pre-injected names list (`math, json, datetime, timedelta, re, random, Counter, defaultdict`) plus the suggestion to use `process_manager` for unsupported modules; other exceptions get formatted as `<ErrorName> at line N: <message>` (line N walked from `<string>` frame in the traceback) plus any captured stdout. JS/TS: detect `aiohttp.ClientConnectorError` / the spawn `RuntimeError` (bun missing or `dist/index.js` not built) and surface "JavaScript executor is unavailable (bun sidecar at <NODEJS_EXECUTOR_URL>). Fall back to python_executor for similar logic." All raise `NodeUserError` so the framework logs one WARN line — no aiohttp/CreateProcessW noise in the operator log.- **Workflow-scoped chat + console history**: chat messages persist with `chat_messages.session_id == <workflow_id>` (or `"default"` when no workflow is open); console logs persist with `console_logs.workflow_id`. Backend `database.get_console_logs(limit, workflow_id=None)` and `clear_console_logs(workflow_id=None)` filter by workflow when given. `handle_clear_console_logs` broadcasts `console_logs_cleared` carrying the `workflow_id` so the existing frontend filter in `WebSocketContext` keeps other workflows' panels intact. Frontend reads `currentWorkflow.id` via the documented Zustand escape hatch (`useAppStore.getState().currentWorkflow?.id`) at call time for `clearChatMessages` / `clearConsoleLogs` / `sendChatMessage` so the callbacks don't re-create on every workflow switch. A dedicated `useEffect([currentWorkflowId, isReady])` resets local `chatMessages` / `consoleLogs` and refetches both when the user opens / switches workflow. Incoming `console_log` broadcasts are filtered by `currentWorkflow.id` so a parallel run on another workflow never bleeds into the active panel. Legacy logs without `workflow_id` still surface (transition guard).- **Auto-derived `isConfigNode` uiHint**: `_derive_auto_ui_hints(group)` in `services/plugin/base.py` automatically sets `uiHints.isConfigNode: True` on any plugin whose `group` tuple contains `memory` or `tool` (centralized as `_CONFIG_NODE_GROUPS = frozenset({"memory", "tool"})`). Explicit `cls.ui_hints` always wins (merge order: auto first, then `dict.update`). Frontend `InputSection.tsx` consumes the flag via `definition?.uiHints?.isConfigNode === true` — the old `groups.includes('memory') || groups.includes('tool')` heuristic is gone. Pytest invariant `test_ui_hints_only_carry_known_flags` locks the flag name. Adding a new auxiliary node type costs zero per-plugin code; opting out costs one line (`ui_hints = {"isConfigNode": False}`).-- **`isMasterSkillEditor` uiHint replaces `node.type === 'masterSkill'` checks**: 6 frontend callsites (`Dashboard.tsx:139` component dispatch, `useAutoSkillEdges.ts` constant + edge filter, `MiddleSection.tsx` × 3) now read `getCachedNodeSpec(type)?.uiHints?.isMasterSkillEditor === true` instead of comparing the type string. The `MasterSkillNode` plugin already declared the hint — no backend change. Renaming the plugin's `type` is now a single backend edit followed by a NodeSpec deploy; the frontend never needs to know the string.+- **`isMasterSkillEditor` uiHint replaces `node.type === 'masterSkill'` checks**: the frontend callsites (`useAutoSkillEdges.ts` constant + edge filter, `MiddleSection.tsx` × 3; Dashboard's component-dispatch branch went with the unused `ToolkitNode`, because masterSkill declares `component_kind = "tool"` and renders through SquareNode) read `getCachedNodeSpec(type)?.uiHints?.isMasterSkillEditor === true` instead of comparing the type string. The `MasterSkillNode` plugin already declared the hint — no backend change. Renaming the plugin's `type` is now a single backend edit followed by a NodeSpec deploy; the frontend never needs to know the string.- **`outputMode: "terminal"` uiHint — spec-driven CLI output rendering**: the output panel (`components/output/OutputPanel.tsx`, the active renderer — `ui/OutputDisplayPanel.tsx` is legacy/unimported) renders string responses through ReactMarkdown by default, which whitespace-collapses CLI text. CLI-wrapper plugins (`githubAction`, `vercelAction`, `shell`) declare `ui_hints = {"outputMode": "terminal"}`; the panel resolves the spec via `useNodeSpec(selectedNode?.type)` and renders their text in a `<pre>` on the per-theme `--code-*` surface, routes wholly-JSON strings to the JSON tree via the shared `tryParseJson` (`utils/formatters.ts`), and surfaces object/array `result` payloads (server-side-parsed CLI JSON; arrays survive `unwrap` un-peeled) in the Response section. Pair with the `_shape` convention: parsed JSON in `result` OR text in `stdout` — never both — empty keys omitted. Locked by `client/src/components/__tests__/OutputPanel.test.tsx` (render tests: real `\n`/`\t` preserved) + the uiHints known-set in `test_node_spec.py`. Cache note: nodeSpecs are session-sticky (`staleTime: FOREVER`, revision-busted at page load) — after a backend restart a hard browser reload is needed before new uiHints reach an open canvas.- **`--action-X-hover` triplet + ActionButton zero-arithmetic**: each of the 6 action roles (`run`/`stop`/`save`/`config`/`secret`/`tools`) now exposes a `-hover` variant (0.25 alpha) alongside the existing `-soft` (0.15) and `-border` (0.6). ActionButton's CVA reads `hover:bg-action-X-hover` directly; disabled state is the shadcn-idiomatic `disabled:opacity-50` on the base class. No per-token `/25`, `/40`, `/10` opacity arithmetic at any call site. Credential-modal panels (`OAuthConnect`, `EmailPanel`, `QrPairingPanel`) and the skill editor (`MasterSkillEditor`) consume `<ActionButton intent="...">` directly. `ActionDef` carries an `intent` key; the catalogue adapter maps server-sent `theme_color` palette strings to intents via `SERVER_COLOR_TO_INTENT`.- **Credentials: DB as single source of truth + symmetric broadcasts + cache dedup**: `CredentialsDatabase` (encrypted SQLite) is canonical; every other layer is a derived cache with explicit invalidation. Backend `AuthService._memory_cache + _models_cache` collapsed into one `_api_key_cache: Dict[str, ApiKeyCacheEntry]` dataclass — single write/evict site. Per RFC 9700 (OAuth 2.0 BCP, 2024) the `_oauth_cache` no longer carries `refresh_token`; new `get_oauth_refresh_token(provider, customer)` reads from the encrypted DB on every call. `validate_api_key`, `save_api_key`, `delete_api_key`, `twitter_logout`, `google_logout` now broadcast symmetrically: `update_api_key_status` (in-memory map) + `broadcast_credential_event(...)` (refetch signal) wrapping `WorkflowEvent` (CloudEvents v1.0 from `services/events/envelope.py`, the same envelope the Wave 12 EventSource framework uses). The dead-letter `credential_catalogue_updated` event is finally emitted by the backend. Frontend retired the 200-LOC `client/src/components/credentials/providers.tsx` static fallback — `useCatalogueQuery` is the only source; cold-boot renders `<Skeleton>`, server-unreachable shows an explicit error state. `ApiKeyStatus.hasKey` mirror dropped (duplicated catalogue's `provider.stored`); two new selector hooks (`useProviderStored`, `useStoredProviderCount`) read the catalogue. Pytest invariant `test_credential_broadcasts.py` (17 tests) locks the broadcast contract via `inspect.getsource` introspection + the CloudEvents v1.0 envelope shape + AuthService DB-write-then-cache-update ordering + the no-refresh-token-in-cache rule.diff --git a/client/src/Dashboard.tsx b/client/src/Dashboard.tsxindex b1018b57..44938dd8 100644--- a/client/src/Dashboard.tsx+++ b/client/src/Dashboard.tsx@@ -19,8 +19,6 @@ import { prefetchAllNodeSpecs, listCachedNodeSpecs, cachedNodeSpecTypesKey } froimport AIAgentNode from './components/AIAgentNode';import SquareNode from './components/SquareNode';import TriggerNode from './components/TriggerNode';-import ToolkitNode from './components/ToolkitNode';-import TeamMonitorNode from './components/TeamMonitorNode';import StartNode from './components/StartNode';import ConditionalEdge from './components/ConditionalEdge';import NodeContextMenu from './components/ui/NodeContextMenu';@@ -113,25 +111,14 @@ const COMPONENT_BY_KIND: Record<string, React.ComponentType<any>> = {};// Build the React Flow `nodeTypes` map: spec.componentKind → component.-// Falls back to a small set of legacy hints for the few cases the spec-// doesn't yet cover (skill nodes use ToolkitNode; teamMonitor has its-// own live-display component). Once those are spec-driven too, the-// fallback collapses to a single `SquareNode` default.+// A kind missing from the map (or no kind) renders as SquareNode.const createNodeTypes = (): Record<string, React.ComponentType<any>> => {const types: Record<string, React.ComponentType<any>> = {};// Cache-driven enumeration: empty on cold boot, filled once// prefetchAllNodeSpecs resolves and the `specsKey` change rebuilds.listCachedNodeSpecs().forEach(spec => {const kind = spec.componentKind;- if (kind && COMPONENT_BY_KIND[kind]) {- types[spec.type] = COMPONENT_BY_KIND[kind];- } else if (spec.type === 'teamMonitor') {- types[spec.type] = TeamMonitorNode;- } else if ((spec.uiHints as any)?.isMasterSkillEditor === true) {- types[spec.type] = ToolkitNode;- } else {- types[spec.type] = SquareNode;- }+ types[spec.type] = (kind && COMPONENT_BY_KIND[kind]) || SquareNode;});return types;};diff --git a/client/src/components/SquareNode.tsx b/client/src/components/SquareNode.tsxindex 388f6631..f7816bee 100644--- a/client/src/components/SquareNode.tsx+++ b/client/src/components/SquareNode.tsx@@ -208,7 +208,7 @@ const SquareNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectab// consumed by `.sq-node-pip[data-status="..."]` in base.css. Per-theme// CSS overrides these without fighting inline `backgroundColor`.// Buckets: 'idle' | 'executing' | 'waiting' | 'success' | 'error'.- // Matches TriggerNode/StartNode/ToolkitNode contract (Wave 26.B).+ // Matches the TriggerNode/StartNode contract (Wave 26.B).const pipStatus: 'idle' | 'executing' | 'waiting' | 'success' | 'error' = (() => {if (executionStatus === 'executing' || executionStatus === 'waiting' || isGlowing) {return 'executing';diff --git a/client/src/components/TeamMonitorNode.tsx b/client/src/components/TeamMonitorNode.tsxdeleted file mode 100644index ef7af814..00000000--- a/client/src/components/TeamMonitorNode.tsx+++ /dev/null@@ -1,322 +0,0 @@-import React, { memo, useState, useEffect, useCallback, useMemo } from 'react';-import { nodePropsEqual } from './nodeMemoEquality';-import { Handle, Position, NodeProps, useEdges, useNodes } from 'reactflow';-import { NodeData, NodeStyle } from '../types/NodeTypes';-import { useAppStore } from '../store/useAppStore';-import { resolveNodeDescription } from '../lib/nodeSpec';-import { useAppTheme } from '../hooks/useAppTheme';-import { useWebSocket } from '../contexts/WebSocketContext';--// AI Employee node types that can have teams-const TEAM_LEAD_TYPES = ['ai_employee', 'orchestrator_agent'];--interface TeamTask {- id: string;- title: string;- status: 'blocked' | 'queued' | 'running' | 'submitted' | 'accepted' | 'failed' | 'cancelled' | 'pending' | 'in_progress' | 'completed' | 'skipped';- assigned_to?: string;-}--interface TeamMember {- agent_node_id: string;- agent_type: string;- status: string;- label?: string;-}--interface TeamStatus {- team_id: string;- members: TeamMember[];- tasks: {- total: number;- completed: number;- active: number;- queued: number;- pending: number;- failed: number;- };- active_tasks: TeamTask[];-}--const TeamMonitorNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectable, selected }) => {- const theme = useAppTheme();- const setSelectedNode = useAppStore((s) => s.setSelectedNode);- const workflowId = useAppStore((s) => s.currentWorkflow?.id);- const { sendRequest } = useWebSocket();- const edges = useEdges();- const nodes = useNodes();-- const [teamStatus, setTeamStatus] = useState<TeamStatus | null>(null);- const [isLoading, setIsLoading] = useState(false);-- // Wave 6 Phase 3e: backend NodeSpec -> legacy fallback- const definition = resolveNodeDescription(type || '');- const nodeColor = definition?.defaults?.color || 'var(--node-agent)';-- // Find connected AI Employee/Orchestrator node to get workflow context- const connectedTeamLead = useMemo(() => {- // Find edges where this node is the target (input)- const incomingEdges = edges.filter(e => e.target === id);- for (const edge of incomingEdges) {- const sourceNode = nodes.find(n => n.id === edge.source);- if (sourceNode && TEAM_LEAD_TYPES.includes(sourceNode.type || '')) {- return sourceNode;- }- }- return null;- }, [edges, nodes, id]);-- const connectedTeammates = useMemo<TeamMember[]>(() => {- if (!connectedTeamLead) return [];- return edges- .filter((edge) => edge.target === connectedTeamLead.id && edge.targetHandle === 'input-teammates')- .map((edge) => nodes.find((node) => node.id === edge.source))- .filter((node): node is NonNullable<typeof node> => !!node)- .map((node) => ({- agent_node_id: node.id,- agent_type: node.type || 'aiAgent',- label: String((node.data as NodeData | undefined)?.label || node.type || 'Agent'),- status: 'connected',- }));- }, [connectedTeamLead, edges, nodes]);-- const visibleMembers = useMemo(() => {- const persisted = teamStatus?.members || [];- const byId = new Map(persisted.map((member) => [member.agent_node_id, member]));- for (const member of connectedTeammates) {- byId.set(member.agent_node_id, { ...member, ...(byId.get(member.agent_node_id) || {}) });- }- return [...byId.values()].filter((member) => member.agent_node_id !== connectedTeamLead?.id);- }, [connectedTeamLead?.id, connectedTeammates, teamStatus?.members]);-- // Fetch team status- const fetchTeamStatus = useCallback(async () => {- // Use explicit teamId from data, or get from connected node's workflow context- const teamId = data?.teamId;- if (!teamId && !connectedTeamLead) return;-- setIsLoading(true);- try {- // Request team status - backend will find the active team for the workflow- const response = await sendRequest<{ status?: any }>('get_team_status', {- team_id: teamId,- workflow_id: workflowId,- team_lead_node_id: connectedTeamLead?.id,- });- if (response?.status) {- setTeamStatus({- team_id: response.status.team_id || teamId || '',- members: response.status.members || [],- tasks: {- total: response.status.task_count || 0,- completed: response.status.completed_count || 0,- active: response.status.active_count || 0,- queued: response.status.queued_count ?? response.status.pending_count ?? 0,- pending: response.status.pending_count || 0,- failed: response.status.failed_count || 0,- },- active_tasks: response.status.active_tasks || [],- });- }- } catch (error) {- console.error('Failed to fetch team status:', error);- } finally {- setIsLoading(false);- }- }, [data?.teamId, connectedTeamLead, workflowId, sendRequest]);-- // Auto-refresh when connected to a team lead- useEffect(() => {- const interval = data?.refreshInterval || 2000;- if (interval > 0 && (data?.teamId || connectedTeamLead)) {- fetchTeamStatus();- const timer = setInterval(fetchTeamStatus, interval);- return () => clearInterval(timer);- }- }, [data?.refreshInterval, data?.teamId, connectedTeamLead, fetchTeamStatus]);-- const handleClick = (e: React.MouseEvent) => {- e.stopPropagation();- setSelectedNode({ id, type, data, position: { x: 0, y: 0 } });- };-- const getStatusColor = (status: string) => {- switch (status) {- case 'accepted':- case 'completed': return 'var(--success)';- case 'submitted': return 'var(--node-agent)';- case 'running':- case 'in_progress': return 'var(--info)';- case 'failed': return 'var(--destructive)';- case 'blocked':- case 'queued':- case 'pending': return 'var(--warning)';- default: return theme.colors.textSecondary;- }- };-- return (- // Visual styling (background, border, radius) lives in base.css `.node`- // defaults + per-theme overrides; reads `var(--node-color)` for accent.- <div- className={`node ${selected ? 'selected' : ''}`}- onClick={handleClick}- style={{- '--node-color': nodeColor,- width: 200,- minHeight: 120,- fontFamily: 'var(--font-body)',- fontSize: 10,- overflow: 'hidden',- } as NodeStyle}- >- {/* Header */}- <div style={{- padding: '6px 8px',- borderBottom: `1px solid ${theme.colors.border}`,- background: `${nodeColor}20`,- display: 'flex',- alignItems: 'center',- gap: 6,- }}>- <span style={{ fontSize: 14 }}>📊</span>- <span style={{ fontWeight: 600, color: theme.colors.text, fontSize: 11 }}>- {data?.label || 'Team Monitor'}- </span>- </div>-- {/* Stats Grid */}- <div style={{- display: 'grid',- gridTemplateColumns: 'repeat(5, 1fr)',- gap: 2,- padding: '6px 4px',- borderBottom: `1px solid ${theme.colors.border}`,- }}>- <div style={{ textAlign: 'center' }}>- <div style={{ fontSize: 12, fontWeight: 'bold', color: 'var(--node-agent)' }}>- {visibleMembers.length}- </div>- <div style={{ fontSize: 8, color: theme.colors.textSecondary }}>Team</div>- </div>- <div style={{ textAlign: 'center' }}>- <div style={{ fontSize: 12, fontWeight: 'bold', color: 'var(--info)' }}>- {teamStatus?.tasks?.total || 0}- </div>- <div style={{ fontSize: 8, color: theme.colors.textSecondary }}>Tasks</div>- </div>- <div style={{ textAlign: 'center' }}>- <div style={{ fontSize: 12, fontWeight: 'bold', color: 'var(--success)' }}>- {teamStatus?.tasks?.completed || 0}- </div>- <div style={{ fontSize: 8, color: theme.colors.textSecondary }}>Done</div>- </div>- <div style={{ textAlign: 'center' }}>- <div style={{ fontSize: 12, fontWeight: 'bold', color: 'var(--warning)' }}>- {teamStatus?.tasks?.active || 0}- </div>- <div style={{ fontSize: 8, color: theme.colors.textSecondary }}>Active</div>- </div>- <div style={{ textAlign: 'center' }}>- <div style={{ fontSize: 12, fontWeight: 'bold', color: 'var(--warning)' }}>- {teamStatus?.tasks?.queued || 0}- </div>- <div style={{ fontSize: 8, color: theme.colors.textSecondary }}>Queued</div>- </div>- </div>-- {/* Connected teammates */}- {visibleMembers.length > 0 && (- <div style={{ padding: '4px 6px', borderBottom: `1px solid ${theme.colors.border}` }}>- {visibleMembers.slice(0, 4).map((member) => (- <div key={member.agent_node_id} title={member.agent_type} style={{ display: 'flex', alignItems: 'center', gap: 4, padding: '2px 0', fontSize: 9 }}>- <span style={{ width: 6, height: 6, borderRadius: '50%', backgroundColor: member.status === 'working' ? 'var(--info)' : 'var(--success)', flexShrink: 0 }} />- <span style={{ color: theme.colors.text, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{member.label || member.agent_type}</span>- <span style={{ marginLeft: 'auto', color: theme.colors.textSecondary }}>{member.status}</span>- </div>- ))}- {visibleMembers.length > 4 && <div style={{ color: theme.colors.textSecondary, fontSize: 8 }}>+{visibleMembers.length - 4} more</div>}- </div>- )}-- {/* Active Tasks */}- <div style={{ padding: '4px 6px', maxHeight: 80, overflow: 'auto' }}>- {!data?.teamId && !connectedTeamLead ? (- <div style={{ color: theme.colors.textSecondary, textAlign: 'center', padding: 8, fontSize: 9 }}>- Connect to AI Employee- </div>- ) : isLoading && !teamStatus ? (- <div style={{ color: theme.colors.textSecondary, textAlign: 'center', padding: 8, fontSize: 9 }}>- Loading...- </div>- ) : teamStatus?.active_tasks && teamStatus.active_tasks.length > 0 ? (- teamStatus.active_tasks.slice(0, 3).map((task) => (- <div key={task.id} style={{- display: 'flex',- alignItems: 'center',- gap: 4,- padding: '2px 0',- fontSize: 9,- }}>- <span style={{- width: 6,- height: 6,- borderRadius: '50%',- backgroundColor: getStatusColor(task.status),- flexShrink: 0,- }} />- <span style={{- color: theme.colors.text,- overflow: 'hidden',- textOverflow: 'ellipsis',- whiteSpace: 'nowrap',- flex: 1,- }}>- {task.title}- </span>- </div>- ))- ) : (- <div style={{ color: theme.colors.textSecondary, textAlign: 'center', padding: 4, fontSize: 9 }}>- No active tasks- </div>- )}- </div>-- {/* Input Handle — visual styling owned by `.node-handle.in`- in base.css + per-theme overrides. Inline keeps layout only. */}- <Handle- id="input-team"- type="target"- position={Position.Left}- isConnectable={isConnectable}- className="node-handle in"- style={{- left: -6,- top: '50%',- width: 10,- height: 10,- borderRadius: '50%',- }}- />-- {/* Output Handle — visual styling owned by `.node-handle.out`. */}- <Handle- id="output-main"- type="source"- position={Position.Right}- isConnectable={isConnectable}- className="node-handle out"- style={{- right: -6,- top: '50%',- width: 10,- height: 10,- borderRadius: '50%',- }}- />- </div>- );-};--export default memo(TeamMonitorNode, nodePropsEqual);diff --git a/client/src/components/ToolkitNode.tsx b/client/src/components/ToolkitNode.tsxdeleted file mode 100644index f0295f8b..00000000--- a/client/src/components/ToolkitNode.tsx+++ /dev/null@@ -1,224 +0,0 @@-/**- * ToolkitNode - A node component for skill nodes with vertical handle layout.- *- * Skill nodes (whatsappSkill, memorySkill, etc.): Square (60x60px)- * - Output handle at TOP (connects to agent's skill input)- * - No input handle (passive nodes)- *- */--import React, { memo, 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 { resolveNodeDescription } from '../lib/nodeSpec';-import { NodeIcon } from '../assets/icons';-import { useNodeSpec } from '../lib/nodeSpec';-import { useAppTheme } from '../hooks/useAppTheme';-import { useNodeStatus } from '../contexts/WebSocketContext';-import EditableNodeLabel from './ui/EditableNodeLabel';-import { Badge } from '@/components/ui/badge';--const ToolkitNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectable, selected }) => {- const theme = useAppTheme();- const setSelectedNode = useAppStore((s) => s.setSelectedNode);- const setRenamingNodeId = useAppStore((s) => s.setRenamingNodeId);- const updateNodeData = useAppStore((s) => s.updateNodeData);-- // Subscribe to this exact workflow/node status slot. The imperative- // getNodeStatus snapshot does not trigger a render when Zustand receives a- // skill lifecycle event, so Master Skill glow/badges would update only after- // some unrelated canvas render.- const nodeStatus = useNodeStatus(id);- const executionStatus = nodeStatus?.status || 'idle';- const activeSkills = (nodeStatus?.data?.active_skills as Array<{ name: string; state: string }> | undefined) ?? [];-- // Wave 6 Phase 3e: backend NodeSpec -> legacy fallback- const definition = resolveNodeDescription(type || '');-- // Execution state- const isExecuting = executionStatus === 'executing' || executionStatus === 'waiting';-- const defaultLabel = definition?.displayName || type || '';- const handleLabelChange = useCallback(- (newLabel: string) => updateNodeData(id, { ...data, label: newLabel }),- [id, data, updateNodeData]- );- const handleLabelActivate = useCallback(- () => setRenamingNodeId(id),- [id, setRenamingNodeId]- );-- // Handle parameters click- const handleParametersClick = (e: React.MouseEvent) => {- e.stopPropagation();- setSelectedNode({ id, type, data, position: { x: 0, y: 0 } });- };-- // Get the node color from definition or use the tool-role accent- const nodeColor = definition?.defaults?.color || 'var(--node-tool)';-- // Schema-driven icon dispatch with reactive subscription.- // <NodeIcon> resolves the ref and tints lucide icons via currentColor.- const iconSpec = useNodeSpec(type);- const iconRef = (iconSpec?.icon as string | undefined) ?? (definition?.icon as string | undefined);-- // Pip status bucket — CSS owns the visual color via per-status rules.- // Toolkit's idle state always reads as "success" (it's always ready).- const pipStatus = (() => {- if (isExecuting) return 'executing';- if (executionStatus === 'success') return 'success';- if (executionStatus === 'error') return 'error';- return 'success';- })();-- return (- // `sq-node` + `selected` co-classes activate per-theme square-node- // decorations (Renaissance wax seal, Steampunk rivets, Edo hanko- // seal, Surveillance REC LED, Cyber neon underglow). Visuals- // (background, border, radius, shadow, executing pulse) live in- // base.css `.sq-node-box` defaults + per-theme overrides; reads- // `var(--node-color)` for the per-definition accent.- <div- className={`sq-node ${selected ? 'selected' : ''}`}- data-executing={isExecuting ? '' : undefined}- style={{- '--node-color': nodeColor,- position: 'relative',- display: 'flex',- flexDirection: 'column',- alignItems: 'center',- fontFamily: 'var(--font-body)',- fontSize: '11px',- cursor: 'pointer',- } as NodeStyle}- >- {/* Main Node. Layout only; visuals live in CSS. */}- <div- className="sq-node-box"- style={{- position: 'relative',- width: theme.nodeSize.square,- height: theme.nodeSize.square,- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- color: theme.colors.text,- fontSize: theme.nodeSize.squareIcon,- fontWeight: '600',- }}- >- {/* Service Icon */}- <NodeIcon icon={iconRef} size={theme.nodeSize.squareIcon} />-- {/* Parameters Button — CSS owns bg/border via .sq-node-gear */}- <button- onClick={handleParametersClick}- className="sq-node-gear"- style={{- position: 'absolute',- top: '-8px',- right: '-8px',- width: theme.nodeSize.paramButton,- height: theme.nodeSize.paramButton,- cursor: 'pointer',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- fontSize: theme.fontSize.xs,- fontWeight: '400',- transition: theme.transitions.fast,- zIndex: 30,- }}- title="Edit Skill Parameters"- >- ⚙️- </button>-- {/* Status Indicator — CSS owns bg/animation via per-status rules. */}- <div- className="sq-node-pip"- data-status={pipStatus}- style={{- position: 'absolute',- top: '-4px',- left: '-4px',- width: theme.nodeSize.statusIndicator,- height: theme.nodeSize.statusIndicator,- zIndex: 30,- }}- title={isExecuting ? 'Executing...' : 'Skill ready'}- />-- {/* TOP Output Handle - connects to an agent's skill input */}- <Handle- id="output-main"- type="source"- position={Position.Top}- isConnectable={isConnectable}- className="sq-node-handle out"- style={{- position: 'absolute',- top: '-6px',- left: '50%',- transform: 'translateX(-50%)',- width: theme.nodeSize.handle,- height: theme.nodeSize.handle,- zIndex: 20,- }}- title="Connect to agent's skill input"- />-- {/* Output Data Indicator (bespoke; keeps inline style) */}- {executionStatus === 'success' && nodeStatus?.data && (- <div- style={{- position: 'absolute',- bottom: '-4px',- right: '-4px',- width: theme.nodeSize.outputBadge,- height: theme.nodeSize.outputBadge,- borderRadius: theme.borderRadius.sm,- backgroundColor: 'var(--success)',- border: '1px solid var(--bg-canvas)',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- fontSize: theme.fontSize.xs,- color: 'white',- fontWeight: 'bold',- zIndex: 30,- boxShadow: theme.isDarkMode- ? '0 1px 3px rgba(0,0,0,0.2)'- : '0 1px 3px rgba(0,0,0,0.15)',- }}- title="Output data available"- >- <span style={{ lineHeight: 1 }}>D</span>- </div>- )}- </div>-- {/* Node Name Below */}- <EditableNodeLabel- nodeId={id}- label={data?.label}- defaultLabel={defaultLabel}- onLabelChange={handleLabelChange}- onActivate={handleLabelActivate}- />- {activeSkills.length > 0 && (- <div className="mt-1 flex max-w-40 flex-wrap justify-center gap-1" aria-label="Master Skill activity">- {activeSkills.map((skill) => (- <Badge key={`${skill.name}-${skill.state}`} variant="outline" className="max-w-40 truncate text-[9px]">- skill {skill.name}- </Badge>- ))}- </div>- )}- </div>- );-};--export default memo(ToolkitNode, nodePropsEqual);diff --git a/client/src/components/ui/EditableNodeLabel.tsx b/client/src/components/ui/EditableNodeLabel.tsxindex d72f7f27..525bad57 100644--- a/client/src/components/ui/EditableNodeLabel.tsx+++ b/client/src/components/ui/EditableNodeLabel.tsx@@ -2,7 +2,7 @@* EditableNodeLabel — shared inline-rename input for canvas node components.** Encapsulates the dup'd pattern across StartNode, SquareNode, TriggerNode,- * ToolkitNode:+ * AIAgentNode:* - sync local edit state with the global `useAppStore.renamingNodeId`* - focus + select the input on enter* - Enter saves, Escape cancels, blur savesdiff --git a/client/src/themes/base.css b/client/src/themes/base.cssindex 5f146b79..b5425d89 100644--- a/client/src/themes/base.css+++ b/client/src/themes/base.css@@ -342,11 +342,10 @@ html[data-page-hidden] *::after {* Default canvas-node visuals (Wave 21).** Each node component sets `--node-color` inline. Only AIAgentNode passes- * the plugin's accent (its NodeSpec `color`); SquareNode, TriggerNode,- * StartNode, ToolkitNode and TeamMonitorNode read `defaults.color`, which- * the NodeSpec adapter never fills, so they pass their role token- * (`--node-model`, `--node-trigger`, `--node-workflow`, `--node-tool`,- * `--node-agent`). These rules consume that custom property+ * the plugin's accent (its NodeSpec `color`); SquareNode, TriggerNode and+ * StartNode read `defaults.color`, which the NodeSpec adapter never fills,+ * so they pass their role token (`--node-model`, `--node-trigger`,+ * `--node-workflow`). These rules consume that custom property* to draw a sensible default border / gradient / shadow so light, dark,* and any theme that doesn't define its own `.node` rule still renders* correctly. Per-theme CSS in client/src/themes/<theme>.css overridesdiff --git a/docs-internal/frontend_architecture.md b/docs-internal/frontend_architecture.mdindex b20a3e5e..6b7e8ff7 100644--- a/docs-internal/frontend_architecture.md+++ b/docs-internal/frontend_architecture.md@@ -145,7 +145,7 @@ client/src/│ ├── brand/geometry.ts # Mark + wordmark paths; the favicon and desktop icon embed MARK_PATH│ ├── shell/ModeToggle.tsx # The Normal / Dev switch (editor toolbar + Home header)│ ├── auth/ # Login page + protected route-│ ├── SquareNode.tsx, StartNode.tsx, TriggerNode.tsx, AIAgentNode.tsx, ToolkitNode.tsx, TeamMonitorNode.tsx+│ ├── SquareNode.tsx, StartNode.tsx, TriggerNode.tsx, AIAgentNode.tsx│ │ # React Flow nodes with lucide icons│ └── APIKeyValidator.tsx # Shadcn Input + Button + Tooltip composition│@@ -558,7 +558,7 @@ Defined on `INodeTypeDescription.uiHints` ([client/src/types/INodeProperties.ts]| `hideOutputSection` | `ParameterPanel`, `OutputSection` | Skip the execution-results panel || `hideRunButton` | `ParameterPanel` | Hide the Run button (skill / memory / tool nodes) || `hasCodeEditor` | `MiddleSection` | Give the params block extra flex space for an embedded code editor |-| `isMasterSkillEditor` | `MiddleSection`, `Dashboard` (component dispatch), `useAutoSkillEdges` | Render the MasterSkillEditor split panel; route to `ToolkitNode` on the canvas; identify Master Skill aggregators in the auto-skill edge dispatcher |+| `isMasterSkillEditor` | `MiddleSection`, `useAutoSkillEdges` | Render the MasterSkillEditor split panel; identify Master Skill aggregators in the auto-skill edge dispatcher. On the canvas a Master Skill renders through `SquareNode` (`component_kind = "tool"`) || `isMemoryPanel` | `MiddleSection` | **Legacy.** The pre-RFC-0002 combined markdown/transcript panel. `simpleMemory` no longer declares it; kept while `normalize_workflow_graph` upgrades `input-memory` graphs || `isMemoryToolPanel` | `MiddleSection` | Render the durable Memory item browser (search, edit, forget, clear). Declared by `simpleMemory`, and selected *before* `isMemoryPanel` || `isContextPanel` | `MiddleSection` | Render the Context inspector (journal, active replay, fork/export/clear). Read-only: it observes the agent's journal and must never alter execution |@@ -694,4 +694,4 @@ This architecture is the post-migration state. Pre-migration was antd + `styled-**`useAppTheme()` powers the canvas + maps surface across all 12 themes.** The hook returns a `theme` object with the legacy `Colors` shape (`theme.colors.X`, `theme.isDarkMode`) so existing call sites don't change. Under non-light/dark themes it merges a per-theme overlay (primary, focus, action palette, edge stroke / selection / executing / completed / error) on top of the chosen base pack (`lightColors` for utopian-bright themes, `darkColors` for dystopian / dark themes). Adding a new theme overlay is a single entry in the `THEME_OVERRIDES` map in [hooks/useAppTheme.ts](../client/src/hooks/useAppTheme.ts).-Read sites: every canvas node component (`AIAgentNode`, `SquareNode`, `TriggerNode`, `StartNode`, `ToolkitNode`, `TeamMonitorNode`), `Dashboard.tsx`, and the Maps surface (`GoogleMapsPicker`, `MapsPreviewPanel`) — they interpolate JS-side colour values that Tailwind classes can't express (`EdgeConditionEditor` no longer calls it). Of the node components, only `AIAgentNode` uses the plugin's own colour (NodeSpec `color`); the others read `definition.defaults.color`, which the NodeSpec adapter never fills, so they use their role token (`--node-model`, `--node-trigger`, `--node-workflow`, `--node-tool`, `--node-agent`). Every other surface uses Tailwind + the token tiers above and retints automatically through the per-theme `[data-theme="..."]` block.+Read sites: every canvas node component (`AIAgentNode`, `SquareNode`, `TriggerNode`, `StartNode`), `Dashboard.tsx`, and the Maps surface (`GoogleMapsPicker`, `MapsPreviewPanel`) — they interpolate JS-side colour values that Tailwind classes can't express (`EdgeConditionEditor` no longer calls it). Of the node components, only `AIAgentNode` uses the plugin's own colour (NodeSpec `color`); the others read `definition.defaults.color`, which the NodeSpec adapter never fills, so they use their role token (`--node-model`, `--node-trigger`, `--node-workflow`). Every other surface uses Tailwind + the token tiers above and retints automatically through the per-theme `[data-theme="..."]` block.diff --git a/docs-internal/node-logic-flows/ai_agents/masterSkill.md b/docs-internal/node-logic-flows/ai_agents/masterSkill.mdindex 2951b1ba..edbfca3c 100644--- a/docs-internal/node-logic-flows/ai_agents/masterSkill.md+++ b/docs-internal/node-logic-flows/ai_agents/masterSkill.md@@ -20,8 +20,9 @@ descriptor, injects personality skills into the system prompt, and exposesstandard skills through the dynamically bound `Skill` tool (progressivedisclosure). The `isMasterSkillEditor` uiHint is what makes the frontendrender the `MasterSkillEditor` split panel instead of a plain parameter-list, route the canvas component to `ToolkitNode`, and recognise the node-in the auto-add-skill edge dispatcher.+list and recognise the node in the auto-add-skill edge dispatcher. On the+canvas it renders through `SquareNode`, like every `component_kind = "tool"`+node.## Inputs (handles)@@ -115,7 +116,7 @@ flowchart TD- **Credentials**: none.- **Services**: `services.plugin.edge_walker` (`register_master_skill_expander` / `get_master_skill_expander`), `services.skill_loader`, `services.skill_prompt`, `services.skill_runtime`, `services.auto_skill`, `services.workflow_ops`, `services.events.envelope.WorkflowEvent`.-- **Frontend**: [`client/src/components/parameterPanel/MasterSkillEditor.tsx`](../../../client/src/components/parameterPanel/MasterSkillEditor.tsx) (dispatched by `MiddleSection` on `uiHints.isMasterSkillEditor`), `Dashboard.tsx` component dispatch to `ToolkitNode`, [`client/src/hooks/useAutoSkillEdges.ts`](../../../client/src/hooks/useAutoSkillEdges.ts), and the skill queries it shares with Home's Settings > Skills ([`useUserSkills.ts`](../../../client/src/hooks/useUserSkills.ts), [`useFolderSkills.ts`](../../../client/src/hooks/useFolderSkills.ts)).+- **Frontend**: [`client/src/components/parameterPanel/MasterSkillEditor.tsx`](../../../client/src/components/parameterPanel/MasterSkillEditor.tsx) (dispatched by `MiddleSection` on `uiHints.isMasterSkillEditor`), [`client/src/hooks/useAutoSkillEdges.ts`](../../../client/src/hooks/useAutoSkillEdges.ts), and the skill queries it shares with Home's Settings > Skills ([`useUserSkills.ts`](../../../client/src/hooks/useUserSkills.ts), [`useFolderSkills.ts`](../../../client/src/hooks/useFolderSkills.ts)).- **Task queue**: `TaskQueue.DEFAULT` (never dispatched in practice). Annotations: `readonly`.## Edge cases & known limitsdiff --git a/docs-internal/theme_system.md b/docs-internal/theme_system.mdindex 865623bc..efd1aaba 100644--- a/docs-internal/theme_system.md+++ b/docs-internal/theme_system.md@@ -271,7 +271,7 @@ Result by theme (display font / tracking / case):2. **Whole-store Zustand destructure.** Always `useAppStore((s) => s.x)`, never `{ x } = useAppStore()`.3. **Ad-hoc opacity arithmetic on role/surface tokens.** Don't inline alpha (`bg-bg-app/10`, `bg-node-agent/30`, `bg-action-run/25`). Tailwind v4 *can* now color-mix `/opacity` on hex tokens, but the discipline is to reference a NAMED token: add/define a `-soft` / `-hover` / `-border` variant, or a `--tint-*` step in base.css, and use it by name.4. **Hardcoded colours.** No `bg-white`, `bg-black`, `text-gray-500`, `style={{ backgroundColor: '#fff' }}`. Use tokens.-5. **`useAppTheme()` in new files.** Allowed only for surfaces that need JS-side hex values Tailwind can't express: canvas node components (`AIAgentNode`, `SquareNode`, `TriggerNode`, `StartNode`, `ToolkitNode`, `TeamMonitorNode`), `EdgeConditionEditor`, and the Google Maps SDK consumers (`GoogleMapsPicker`, `MapsPreviewPanel`) — note the map+5. **`useAppTheme()` in new files.** Allowed only for surfaces that need JS-side hex values Tailwind can't express: canvas node components (`AIAgentNode`, `SquareNode`, `TriggerNode`, `StartNode`), `EdgeConditionEditor`, and the Google Maps SDK consumers (`GoogleMapsPicker`, `MapsPreviewPanel`) — note the maptiles themselves are deliberately left to Google's own styling; `useAppTheme` here covers onlythe surrounding chrome. Every other surface uses Tailwind + tokens. New themes contribute to `useAppTheme` via a `THEME_OVERRIDES` entry, never by importing `lightColors` / `darkColors` directly.6. **Hand-rolled modal backdrops.** Use `<Modal>` from `client/src/components/ui/Modal.tsx`.@@ -338,7 +338,7 @@ Wave 15 added structural classNames across the React tree so the handoff CSS sel| Form field | `.input` | input.tsx, textarea.tsx || Dropdown menu | `.menu-pop` (Content), `.menu-pop-item` (Item) | dropdown-menu.tsx || Canvas host | `.canvas-host`, `.canvas` (alias) | Dashboard |-| Generic canvas node | `.node`, `.selected` | AIAgentNode, GenericNode, TriggerNode, StartNode, ToolkitNode, TeamMonitorNode |+| Generic canvas node | `.node`, `.selected` | AIAgentNode, GenericNode, TriggerNode, StartNode || Agent node variant | `.node-agent` | AIAgentNode || Trigger node variant | `.node-trigger` | TriggerNode || Square canvas node | `.sq-node`, `.sq-node-box`, `.sq-node-pip`, `.sq-node-gear`, `.sq-node-handle.in`, `.sq-node-handle.out`, `.selected` | SquareNode |@@ -373,7 +373,7 @@ Every canvas-node React component renders against pure CSS for visual styling. Tstyle={{ '--node-color': accentColor, /* layout only */ } as NodeStyle}>```- In `AIAgentNode`, `accentColor` is the plugin's colour from `useNodeSpec(type)` (NodeSpec `color`, from the plugin's `meta.json` or `visuals.json`). `SquareNode`, `TriggerNode`, `StartNode`, `ToolkitNode` and `TeamMonitorNode` use `definition?.defaults?.color`, which `nodeSpecToDescription` never fills, so they always fall back to their role token: `var(--node-model)`, `var(--node-trigger)`, `var(--node-workflow)`, `var(--node-tool)` and `var(--node-agent)` respectively. Plugin colours therefore do not reach those nodes today.+ In `AIAgentNode`, `accentColor` is the plugin's colour from `useNodeSpec(type)` (NodeSpec `color`, from the plugin's `meta.json` or `visuals.json`). `SquareNode`, `TriggerNode` and `StartNode` use `definition?.defaults?.color`, which `nodeSpecToDescription` never fills, so they always fall back to their role token: `var(--node-model)`, `var(--node-trigger)` and `var(--node-workflow)` respectively. Plugin colours therefore do not reach those nodes today.2. **Keeping ONLY layout inline** — `position`, `padding`, `display`, `flex*`, `gap`, `width`, `height`, `transition`, `cursor`, `fontFamily`, `fontSize`. React Flow `<Handle>` positioning (`position: absolute; left/top/right/bottom`) MUST stay inline.@@ -394,8 +394,8 @@ Two visually distinct node families, each with its own class hooks. Pick the rig| Family | Outer class | Inner box | Pip | Gear | Handle | Label | Used by ||---|---|---|---|---|---|---|---|-| Square-icon | `.sq-node` | `.sq-node-box` | `.sq-node-pip` | `.sq-node-gear` | `.sq-node-handle.in` / `.sq-node-handle.out` | `.sq-node-label` | SquareNode, TriggerNode, StartNode, ToolkitNode |-| Rectangular | `.node` (+ optional `.node-agent` / `.node-trigger` co-class for type-specific theming) | (none — single-div card) | `.node-pip` | `.node-gear` | `.node-handle.in` / `.node-handle.out` | `.node-label` | AIAgentNode, TeamMonitorNode (GenericNode was retired) |+| Square-icon | `.sq-node` | `.sq-node-box` | `.sq-node-pip` | `.sq-node-gear` | `.sq-node-handle.in` / `.sq-node-handle.out` | `.sq-node-label` | SquareNode, TriggerNode, StartNode |+| Rectangular | `.node` (+ optional `.node-agent` / `.node-trigger` co-class for type-specific theming) | (none — single-div card) | `.node-pip` | `.node-gear` | `.node-handle.in` / `.node-handle.out` | `.node-label` | AIAgentNode (GenericNode was retired) |Both families share the same status-pip data contract:diff --git a/server/tests/test_frontend_no_node_type_copies.py b/server/tests/test_frontend_no_node_type_copies.pyindex ddecc638..96fc66a4 100644--- a/server/tests/test_frontend_no_node_type_copies.py+++ b/server/tests/test_frontend_no_node_type_copies.py@@ -127,12 +127,9 @@ class TestExecutionBudgetIsServed:# a uiHint instead._BASELINE_VIOLATIONS = frozenset({- ("client/src/Dashboard.tsx", "teamMonitor"),("client/src/Dashboard.tsx", "aiAgent"),("client/src/Dashboard.tsx", "chatAgent"),("client/src/components/LocationParameterPanel.tsx", "gmaps_create"),- ("client/src/components/TeamMonitorNode.tsx", "ai_employee"),- ("client/src/components/TeamMonitorNode.tsx", "orchestrator_agent"),("client/src/components/TriggerNode.tsx", "whatsappReceive"),("client/src/hooks/useDragAndDrop.ts", "aiAgent"),("client/src/hooks/useDragAndDrop.ts", "chatAgent"),