Skip to content

Self-improving AI Employees for everyone

refactor: frontend tech-debt cleanup (uiHints, action tokens, store selectors, WS reliability)

trohitg33e9ca015e45
diff --git a/client/src/Dashboard.tsx b/client/src/Dashboard.tsx
index d8932302..fd7df321 100644
--- a/client/src/Dashboard.tsx
+++ b/client/src/Dashboard.tsx
@@ -47,7 +47,6 @@ import { useAutoSkillEdges } from './hooks/useAutoSkillEdges';
import { useCopyPaste } from './hooks/useCopyPaste';
import { useWebSocket } from './contexts/WebSocketContext';
import { useNodeStatusStore } from './stores/nodeStatusStore';
-import { useTheme } from './contexts/ThemeContext';
import {
sanitizeNodesForComparison,
sanitizeEdgesForComparison,
@@ -95,7 +94,7 @@ const createNodeTypes = (): Record<string, React.ComponentType<any>> => {
types[spec.type] = COMPONENT_BY_KIND[kind];
} else if (spec.type === 'teamMonitor') {
types[spec.type] = TeamMonitorNode;
- } else if (spec.type === 'masterSkill') {
+ } else if ((spec.uiHints as any)?.isMasterSkillEditor === true) {
types[spec.type] = ToolkitNode;
} else {
types[spec.type] = SquareNode;
@@ -120,35 +119,36 @@ const initialEdges: Edge[] = [];
// Inner component that uses useReactFlow() - must be inside ReactFlowProvider
const DashboardContent: React.FC = () => {
const theme = useAppTheme();
- const { isDarkMode } = useTheme();
- const {
- currentWorkflow,
- hasUnsavedChanges,
- sidebarVisible,
- componentPaletteVisible,
- updateWorkflow,
- loadWorkflow,
- createNewWorkflow,
- saveWorkflow,
- deleteWorkflow,
- migrateCurrentWorkflow,
- toggleSidebar,
- toggleComponentPalette,
- proMode,
- toggleProMode,
- exportWorkflowToJSON,
- exportWorkflowToFile,
- setCurrentWorkflow,
- selectedNode,
- setSelectedNode,
- renamingNodeId,
- setRenamingNodeId,
- // Per-workflow UI state (n8n pattern)
- setWorkflowExecuting,
- setWorkflowExecutionOrder,
- setWorkflowViewport,
- clearWorkflowExecutionState,
- } = useAppStore();
+ // Slice selectors so a sidebar/palette toggle (or any other store
+ // mutation) does NOT re-render every node, edge, and toolbar in the
+ // Dashboard subtree. Action setters are stable refs from Zustand —
+ // single-field selectors are the cheapest way to read them.
+ const currentWorkflow = useAppStore((s) => s.currentWorkflow);
+ const hasUnsavedChanges = useAppStore((s) => s.hasUnsavedChanges);
+ const sidebarVisible = useAppStore((s) => s.sidebarVisible);
+ const componentPaletteVisible = useAppStore((s) => s.componentPaletteVisible);
+ const updateWorkflow = useAppStore((s) => s.updateWorkflow);
+ const loadWorkflow = useAppStore((s) => s.loadWorkflow);
+ const createNewWorkflow = useAppStore((s) => s.createNewWorkflow);
+ const saveWorkflow = useAppStore((s) => s.saveWorkflow);
+ const deleteWorkflow = useAppStore((s) => s.deleteWorkflow);
+ const migrateCurrentWorkflow = useAppStore((s) => s.migrateCurrentWorkflow);
+ const toggleSidebar = useAppStore((s) => s.toggleSidebar);
+ const toggleComponentPalette = useAppStore((s) => s.toggleComponentPalette);
+ const proMode = useAppStore((s) => s.proMode);
+ const toggleProMode = useAppStore((s) => s.toggleProMode);
+ const exportWorkflowToJSON = useAppStore((s) => s.exportWorkflowToJSON);
+ const exportWorkflowToFile = useAppStore((s) => s.exportWorkflowToFile);
+ const setCurrentWorkflow = useAppStore((s) => s.setCurrentWorkflow);
+ const selectedNode = useAppStore((s) => s.selectedNode);
+ const setSelectedNode = useAppStore((s) => s.setSelectedNode);
+ const renamingNodeId = useAppStore((s) => s.renamingNodeId);
+ const setRenamingNodeId = useAppStore((s) => s.setRenamingNodeId);
+ // Per-workflow UI state (n8n pattern)
+ const setWorkflowExecuting = useAppStore((s) => s.setWorkflowExecuting);
+ const setWorkflowExecutionOrder = useAppStore((s) => s.setWorkflowExecutionOrder);
+ const setWorkflowViewport = useAppStore((s) => s.setWorkflowViewport);
+ const clearWorkflowExecutionState = useAppStore((s) => s.clearWorkflowExecutionState);
// Single source-to-store sync: push currentWorkflow.id into the
// node-status Zustand store from the canonical app store. Previously
@@ -1089,7 +1089,7 @@ const DashboardContent: React.FC = () => {
return (
<>
- <style>{buildCanvasStyles(theme.colors, isDarkMode)}</style>
+ <style>{buildCanvasStyles(theme.colors)}</style>
<div style={{
width: '100%',
height: '100vh',
diff --git a/client/src/ParameterPanel.tsx b/client/src/ParameterPanel.tsx
index e67e4b23..3d67deaf 100644
--- a/client/src/ParameterPanel.tsx
+++ b/client/src/ParameterPanel.tsx
@@ -22,7 +22,7 @@ const ParameterPanel: React.FC = () => {
isLoading,
} = useParameterPanel();
- const { currentWorkflow } = useAppStore();
+ const currentWorkflow = useAppStore((s) => s.currentWorkflow);
const { executeNode, getNodeParameters, clearNodeStatus, cancelEventWait, getNodeStatus } = useWebSocket();
// Get current node status to check if waiting
diff --git a/client/src/components/AIAgentNode.tsx b/client/src/components/AIAgentNode.tsx
index 2f273de4..4f6a61ea 100644
--- a/client/src/components/AIAgentNode.tsx
+++ b/client/src/components/AIAgentNode.tsx
@@ -44,7 +44,7 @@ const REACT_POSITION: Record<SpecHandle['position'], Position> = {
const AIAgentNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectable, selected }) => {
const theme = useAppTheme();
- const { setSelectedNode } = useAppStore();
+ const setSelectedNode = useAppStore((s) => s.setSelectedNode);
const [_configValid, setConfigValid] = useState(true);
const [_configErrors, setConfigErrors] = useState<string[]>([]);
diff --git a/client/src/components/GenericNode.tsx b/client/src/components/GenericNode.tsx
index 4a9dc2af..23813d01 100644
--- a/client/src/components/GenericNode.tsx
+++ b/client/src/components/GenericNode.tsx
@@ -13,7 +13,9 @@ import EditableNodeLabel from './ui/EditableNodeLabel';
const GenericNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectable, selected }) => {
const theme = useAppTheme();
- const { setSelectedNode, setRenamingNodeId, updateNodeData } = useAppStore();
+ const setSelectedNode = useAppStore((s) => s.setSelectedNode);
+ const setRenamingNodeId = useAppStore((s) => s.setRenamingNodeId);
+ const updateNodeData = useAppStore((s) => s.updateNodeData);
const isDisabled = data?.disabled === true;
// Per-id slice subscription so an unrelated node's status update
diff --git a/client/src/components/OutputPanel.tsx b/client/src/components/OutputPanel.tsx
index d12239e1..5f80cd36 100644
--- a/client/src/components/OutputPanel.tsx
+++ b/client/src/components/OutputPanel.tsx
@@ -122,7 +122,7 @@ const ANDROID_NODE_TYPES = [
const OutputPanel: React.FC<OutputPanelProps> = ({ nodeId }) => {
const theme = useAppTheme();
- const { currentWorkflow } = useAppStore();
+ const currentWorkflow = useAppStore((s) => s.currentWorkflow);
const [expandedNode, setExpandedNode] = useState<string | null>(null);
const [isDragging, setIsDragging] = useState(false);
const [draggedParam, setDraggedParam] = useState<{ nodeId: string; output: string } | null>(null);
@@ -188,14 +188,15 @@ const OutputPanel: React.FC<OutputPanelProps> = ({ nodeId }) => {
return false;
};
- // Helper to check if a node is a config/auxiliary node (connects to config handles)
+ // Helper to check if a node is a config/auxiliary node (connects to config handles).
+ // Backend auto-derives `uiHints.isConfigNode` from group membership
+ // (`memory` / `tool`) at registration time — see
+ // services/plugin/base.py::_derive_auto_ui_hints. Plugins can also
+ // set the flag explicitly to override.
const isConfigNode = (nodeType: string | undefined): boolean => {
if (!nodeType) return false;
const definition = resolveNodeDescription(nodeType);
- if (!definition) return false;
- // Config nodes typically have 'memory' or 'tool' in their group, or have no main input
- const groups = definition.group || [];
- return groups.includes('memory') || groups.includes('tool');
+ return definition?.uiHints?.isConfigNode === true;
};
// Get connected nodes with their outputs
diff --git a/client/src/components/ParameterRenderer.tsx b/client/src/components/ParameterRenderer.tsx
index 7c81a9bc..65ca1c43 100644
--- a/client/src/components/ParameterRenderer.tsx
+++ b/client/src/components/ParameterRenderer.tsx
@@ -983,7 +983,7 @@ const ParameterRenderer: React.FC<ParameterRendererProps> = ({
const [dynamicOptions, setDynamicOptions] = useState<INodePropertyOption[]>([]);
const [nodeParameters, setNodeParameters] = useState<Record<string, any>>({});
- const { selectedNode } = useAppStore();
+ const selectedNode = useAppStore((s) => s.selectedNode);
const { getNodeParameters, sendRequest } = useWebSocket();
const { getStoredApiKey, hasStoredKey, getStoredModels, getProviderDefaults } = useApiKeys();
diff --git a/client/src/components/SkillEditorModal.tsx b/client/src/components/SkillEditorModal.tsx
index 04051e21..2118b26a 100644
--- a/client/src/components/SkillEditorModal.tsx
+++ b/client/src/components/SkillEditorModal.tsx
@@ -4,7 +4,6 @@ import { zodResolver } from '@hookform/resolvers/zod';
import { z } from 'zod';
import Modal from './ui/Modal';
import CodeEditor from './ui/CodeEditor';
-import { useAppTheme } from '../hooks/useAppTheme';
import { useWebSocket } from '../contexts/WebSocketContext';
import {
Form,
@@ -25,6 +24,8 @@ import {
SelectValue,
} from '@/components/ui/select';
import { Button } from '@/components/ui/button';
+import { ActionButton } from '@/components/ui/action-button';
+import { Alert, AlertDescription } from '@/components/ui/alert';
import { Switch } from '@/components/ui/switch';
// ---------------------------------------------------------------------------
@@ -107,7 +108,6 @@ const SkillEditorModal: React.FC<SkillEditorModalProps> = ({
skill,
onSave,
}) => {
- const theme = useAppTheme();
const { sendRequest } = useWebSocket();
const [activeTab, setActiveTab] = React.useState<'details' | 'instructions'>('details');
const [submitError, setSubmitError] = React.useState<string | null>(null);
@@ -157,7 +157,7 @@ const SkillEditorModal: React.FC<SkillEditorModalProps> = ({
const isExisting = !!form.watch('id');
const tabBaseClass =
'px-4 py-2 text-sm font-medium border-b-2 border-transparent transition-colors';
- const tabActiveClass = 'border-dracula-purple text-foreground';
+ const tabActiveClass = 'border-primary text-foreground';
const tabInactiveClass = 'text-muted-foreground hover:text-foreground';
return (
@@ -382,27 +382,18 @@ const SkillEditorModal: React.FC<SkillEditorModalProps> = ({
</div>
{submitError && (
- <div
- className="border-t border-border bg-dracula-red/15 px-4 py-3 text-sm text-dracula-red"
- >
- {submitError}
- </div>
+ <Alert variant="destructive" className="rounded-none border-x-0 border-b-0">
+ <AlertDescription>{submitError}</AlertDescription>
+ </Alert>
)}
- <div
- className="flex justify-end gap-3 border-t border-border bg-card px-4 py-3"
- style={{ backgroundColor: theme.colors.backgroundPanel }}
- >
+ <div className="flex justify-end gap-3 border-t border-border bg-card px-4 py-3">
<Button type="button" variant="outline" onClick={onClose}>
Cancel
</Button>
- <Button
- type="submit"
- disabled={isSaving}
- className="bg-dracula-purple text-white hover:bg-dracula-purple/90"
- >
+ <ActionButton intent="save" type="submit" disabled={isSaving}>
{isSaving ? 'Saving...' : isExisting ? 'Update Skill' : 'Create Skill'}
- </Button>
+ </ActionButton>
</div>
</form>
</Form>
diff --git a/client/src/components/SquareNode.tsx b/client/src/components/SquareNode.tsx
index a6e51261..650a5042 100644
--- a/client/src/components/SquareNode.tsx
+++ b/client/src/components/SquareNode.tsx
@@ -31,7 +31,13 @@ const CREDENTIAL_TO_PROVIDER: Record<string, string> = {
const SquareNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectable, selected }) => {
const theme = useAppTheme();
- const { setSelectedNode, setRenamingNodeId, updateNodeData } = useAppStore();
+ // Slice selectors so an unrelated store mutation (sidebar toggle,
+ // workflow rename, parameter save on another node) does NOT re-render
+ // every canvas node. Setters are stable refs — single-field selector
+ // is the cheapest read.
+ const setSelectedNode = useAppStore((s) => s.setSelectedNode);
+ const setRenamingNodeId = useAppStore((s) => s.setRenamingNodeId);
+ const updateNodeData = useAppStore((s) => s.updateNodeData);
const isDisabled = data?.disabled === true;
// Get Android status + API key status from the broad WebSocket
diff --git a/client/src/components/StartNode.tsx b/client/src/components/StartNode.tsx
index d33f0848..448a2556 100644
--- a/client/src/components/StartNode.tsx
+++ b/client/src/components/StartNode.tsx
@@ -8,7 +8,9 @@ import { PlayCircle } from 'lucide-react';
import EditableNodeLabel from './ui/EditableNodeLabel';
const StartNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectable, selected }) => {
- const { setSelectedNode, setRenamingNodeId, updateNodeData } = useAppStore();
+ const setSelectedNode = useAppStore((s) => s.setSelectedNode);
+ const setRenamingNodeId = useAppStore((s) => s.setRenamingNodeId);
+ const updateNodeData = useAppStore((s) => s.updateNodeData);
const theme = useAppTheme();
const defaultLabel = 'Start';
diff --git a/client/src/components/TeamMonitorNode.tsx b/client/src/components/TeamMonitorNode.tsx
index 6e27fb43..8a04f2e2 100644
--- a/client/src/components/TeamMonitorNode.tsx
+++ b/client/src/components/TeamMonitorNode.tsx
@@ -38,7 +38,7 @@ interface TeamStatus {
const TeamMonitorNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectable, selected }) => {
const theme = useAppTheme();
- const { setSelectedNode } = useAppStore();
+ const setSelectedNode = useAppStore((s) => s.setSelectedNode);
const { sendRequest } = useWebSocket();
const edges = useEdges();
const nodes = useNodes();
diff --git a/client/src/components/ToolkitNode.tsx b/client/src/components/ToolkitNode.tsx
index 4bb8ec72..57e968ac 100644
--- a/client/src/components/ToolkitNode.tsx
+++ b/client/src/components/ToolkitNode.tsx
@@ -27,7 +27,9 @@ const TOOLKIT_NODE_TYPES = ['androidTool'];
const ToolkitNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectable, selected }) => {
const theme = useAppTheme();
- const { setSelectedNode, setRenamingNodeId, updateNodeData } = useAppStore();
+ const setSelectedNode = useAppStore((s) => s.setSelectedNode);
+ const setRenamingNodeId = useAppStore((s) => s.setRenamingNodeId);
+ const updateNodeData = useAppStore((s) => s.updateNodeData);
// Get node status from WebSocket context
const { getNodeStatus } = useWebSocket();
diff --git a/client/src/components/TriggerNode.tsx b/client/src/components/TriggerNode.tsx
index 09edff35..31d76716 100644
--- a/client/src/components/TriggerNode.tsx
+++ b/client/src/components/TriggerNode.tsx
@@ -19,7 +19,9 @@ import EditableNodeLabel from './ui/EditableNodeLabel';
const TriggerNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectable, selected }) => {
const theme = useAppTheme();
- const { setSelectedNode, setRenamingNodeId, updateNodeData } = useAppStore();
+ const setSelectedNode = useAppStore((s) => s.setSelectedNode);
+ const setRenamingNodeId = useAppStore((s) => s.setRenamingNodeId);
+ const updateNodeData = useAppStore((s) => s.updateNodeData);
const [isConfigured, setIsConfigured] = useState(false);
const isDisabled = data?.disabled === true;
diff --git a/client/src/components/credentials/catalogueAdapter.ts b/client/src/components/credentials/catalogueAdapter.ts
index 3116a014..6c1f74c5 100644
--- a/client/src/components/credentials/catalogueAdapter.ts
+++ b/client/src/components/credentials/catalogueAdapter.ts
@@ -65,6 +65,19 @@ function buildStatusRows(defs: ServerStatusRowDef[] | undefined): StatusRowDef[]
}));
}
+// Server sends a palette name (`green`, `pink`, etc.) for backwards
+// compatibility; map onto the semantic --action-X intents the
+// frontend's ActionButton consumes. Anything unrecognized falls back
+// to `save` (the neutral CTA).
+const SERVER_COLOR_TO_INTENT: Record<string, ActionDef['intent']> = {
+ green: 'run',
+ pink: 'stop',
+ cyan: 'save',
+ orange: 'config',
+ yellow: 'secret',
+ purple: 'tools',
+};
+
function buildActions(defs: ServerActionDef[] | undefined): ActionDef[] | undefined {
if (!defs || defs.length === 0) return undefined;
return defs.map((d) => {
@@ -82,7 +95,7 @@ function buildActions(defs: ServerActionDef[] | undefined): ActionDef[] | undefi
return {
key: d.key,
label: d.label,
- themeColor: d.theme_color,
+ intent: SERVER_COLOR_TO_INTENT[d.theme_color] ?? 'save',
disabled,
};
});
diff --git a/client/src/components/credentials/panels/EmailPanel.tsx b/client/src/components/credentials/panels/EmailPanel.tsx
index 72fe240b..0b02e877 100644
--- a/client/src/components/credentials/panels/EmailPanel.tsx
+++ b/client/src/components/credentials/panels/EmailPanel.tsx
@@ -13,7 +13,7 @@ import { zodResolver } from '@hookform/resolvers/zod';
import { Eye, EyeOff, Loader2 } from 'lucide-react';
import { Input } from '@/components/ui/input';
-import { Button } from '@/components/ui/button';
+import { ActionButton } from '@/components/ui/action-button';
import { Alert, AlertDescription } from '@/components/ui/alert';
import {
Form,
@@ -31,7 +31,6 @@ import {
SelectTrigger,
SelectValue,
} from '@/components/ui/select';
-import { useAppTheme } from '../../../hooks/useAppTheme';
import { useApiKeys } from '../../../hooks/useApiKeys';
import { NodeIcon } from '../../../assets/icons';
import { StatusCard } from '../primitives';
@@ -54,7 +53,6 @@ const DEFAULT_VALUES: EmailFormValues = {
};
const EmailPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ config, visible }) => {
- const theme = useAppTheme();
const { saveApiKey, getStoredApiKey, hasStoredKey, removeApiKey, isConnected } = useApiKeys();
const [stored, setStored] = useState(false);
@@ -333,35 +331,25 @@ const EmailPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ co
<div className="flex-1" />
<div className="flex justify-center gap-2 border-t border-border pt-3">
- <Button
+ <ActionButton
+ intent="save"
type="submit"
form="email-form"
- variant="outline"
disabled={loading === 'save'}
- style={{
- backgroundColor: `${theme.dracula.green}25`,
- borderColor: `${theme.dracula.green}60`,
- color: theme.dracula.green,
- }}
>
{loading === 'save' && <Loader2 className="h-4 w-4 animate-spin" />}
Save
- </Button>
+ </ActionButton>
{stored && (
- <Button
+ <ActionButton
+ intent="stop"
type="button"
- variant="outline"
onClick={handleRemove}
disabled={loading === 'remove'}
- style={{
- backgroundColor: `${theme.dracula.pink}25`,
- borderColor: `${theme.dracula.pink}60`,
- color: theme.dracula.pink,
- }}
>
{loading === 'remove' && <Loader2 className="h-4 w-4 animate-spin" />}
Remove
- </Button>
+ </ActionButton>
)}
</div>
</div>
diff --git a/client/src/components/credentials/panels/QrPairingPanel.tsx b/client/src/components/credentials/panels/QrPairingPanel.tsx
index 66dc9564..c34f0402 100644
--- a/client/src/components/credentials/panels/QrPairingPanel.tsx
+++ b/client/src/components/credentials/panels/QrPairingPanel.tsx
@@ -8,7 +8,6 @@ import React, { useMemo } from 'react';
import { Alert, AlertDescription } from '@/components/ui/alert';
import ApiKeyInput from '../../ui/ApiKeyInput';
import QRCodeDisplay from '../../ui/QRCodeDisplay';
-import { useAppTheme } from '../../../hooks/useAppTheme';
import { useWebSocket } from '../../../contexts/WebSocketContext';
import { useWhatsApp } from '../../../hooks/useWhatsApp';
import { useCredentialPanel } from '../useCredentialPanel';
@@ -20,7 +19,6 @@ import type { ActionDef } from '../primitives/ActionBar';
import type { ProviderConfig } from '../types';
const QrPairingPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ config, visible }) => {
- const theme = useAppTheme();
const panel = useCredentialPanel(config, visible);
const status = useProviderStatus(config.statusHook);
const { startConnection, restartConnection, getStatus: refreshWa } = useWhatsApp();
@@ -48,7 +46,7 @@ const QrPairingPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = (
const actions: ActionDef[] = (config.actions ?? []).map(a => ({
key: a.key,
label: a.label,
- color: (theme.dracula as any)[a.themeColor] ?? a.themeColor,
+ intent: a.intent,
onClick: actionHandlers[a.key] ?? (() => {}),
hidden: a.hidden?.(status, panel.stored),
disabled: a.disabled?.(status, panel.stored),
diff --git a/client/src/components/credentials/primitives/ActionBar.tsx b/client/src/components/credentials/primitives/ActionBar.tsx
index 8aa80b5d..017f7ab5 100644
--- a/client/src/components/credentials/primitives/ActionBar.tsx
+++ b/client/src/components/credentials/primitives/ActionBar.tsx
@@ -5,13 +5,14 @@
import React from 'react';
import { Loader2 } from 'lucide-react';
-import { Button } from '@/components/ui/button';
+import { ActionButton } from '@/components/ui/action-button';
+import type { ActionButtonIntent } from '@/components/ui/action-button';
export interface ActionDef {
key: string;
label: string;
- /** Dracula color string from theme (e.g., theme.dracula.green). */
- color: string;
+ /** Semantic role consumed by `<ActionButton intent="...">`. */
+ intent: ActionButtonIntent;
onClick: () => void;
disabled?: boolean;
icon?: React.ReactNode;
@@ -31,20 +32,15 @@ const ActionBar: React.FC<Props> = ({ actions, loading }) => {
.map((a) => {
const isLoading = loading === a.key;
return (
- <Button
+ <ActionButton
key={a.key}
- variant="outline"
+ intent={a.intent}
onClick={a.onClick}
disabled={a.disabled || isLoading}
- style={{
- backgroundColor: `${a.color}25`,
- borderColor: `${a.color}60`,
- color: a.color,
- }}
>
{isLoading ? <Loader2 className="h-4 w-4 animate-spin" /> : a.icon}
{a.label}
- </Button>
+ </ActionButton>
);
})}
</div>
diff --git a/client/src/components/credentials/primitives/OAuthConnect.tsx b/client/src/components/credentials/primitives/OAuthConnect.tsx
index 2941f4ca..d2cbaf85 100644
--- a/client/src/components/credentials/primitives/OAuthConnect.tsx
+++ b/client/src/components/credentials/primitives/OAuthConnect.tsx
@@ -6,9 +6,8 @@
import React from 'react';
import { Loader2, RotateCcw } from 'lucide-react';
-import { Button } from '@/components/ui/button';
import { Alert, AlertDescription } from '@/components/ui/alert';
-import { useAppTheme } from '../../../hooks/useAppTheme';
+import { ActionButton } from '@/components/ui/action-button';
import FieldRenderer from './FieldRenderer';
import ActionBar, { type ActionDef } from './ActionBar';
import StatusCard from './StatusCard';
@@ -39,17 +38,22 @@ const OAuthConnect: React.FC<Props> = ({
config, form, connected, stored, loading, error, icon,
onSaveCredentials, onLogin, onLogout, onRefresh, extraSection,
}) => {
- const theme = useAppTheme();
+ // Some providers (e.g. Stripe) delegate auth entirely to an external
+ // CLI tool — they have no MachinaOs-side credentials to paste, so
+ // there's nothing to "store" before Login is meaningful.
+ const hasFields = !!config.fields?.length;
const statusRows: StatusRowDef[] = [
{ label: 'Status', ok: () => connected, trueText: 'Connected', falseText: 'Not Connected' },
- { label: 'Credentials', ok: () => stored, trueText: 'Configured', falseText: 'Not configured' },
+ ...(hasFields
+ ? [{ label: 'Credentials', ok: () => stored, trueText: 'Configured', falseText: 'Not configured' } as StatusRowDef]
+ : []),
];
const actions: ActionDef[] = [
- { key: 'login', label: `Login with ${config.name}`, color: theme.dracula.green, onClick: onLogin, disabled: !stored, hidden: connected },
- { key: 'logout', label: 'Disconnect', color: theme.dracula.pink, onClick: onLogout, hidden: !connected },
- { key: 'refresh', label: 'Refresh', color: theme.dracula.cyan, onClick: onRefresh, icon: <RotateCcw className="h-4 w-4" /> },
+ { key: 'login', label: `Login with ${config.name}`, intent: 'save', onClick: onLogin, disabled: hasFields && !stored, hidden: connected },
+ { key: 'logout', label: 'Disconnect', intent: 'stop', onClick: onLogout, hidden: !connected },
+ { key: 'refresh', label: 'Refresh', intent: 'save', onClick: onRefresh, icon: <RotateCcw className="h-4 w-4" /> },
];
const isSaving = loading === 'save';
@@ -61,19 +65,10 @@ const OAuthConnect: React.FC<Props> = ({
{!connected && config.fields && (
<div className="flex w-full flex-col gap-3">
<FieldRenderer fields={config.fields} form={form} />
- <Button
- variant="outline"
- onClick={onSaveCredentials}
- disabled={isSaving}
- style={{
- backgroundColor: `${theme.dracula.purple}25`,
- borderColor: `${theme.dracula.purple}60`,
- color: theme.dracula.purple,
- }}
- >
+ <ActionButton intent="secret" onClick={onSaveCredentials} disabled={isSaving}>
{isSaving && <Loader2 className="h-4 w-4 animate-spin" />}
Save Credentials
- </Button>
+ </ActionButton>
{config.instructions && (
<div className="text-xs leading-relaxed text-muted-foreground">
{config.instructions}
@@ -81,7 +76,7 @@ const OAuthConnect: React.FC<Props> = ({
<>
<br />
Callback URL:{' '}
- <code className="text-dracula-cyan">{config.callbackUrl}</code>
+ <code className="text-accent">{config.callbackUrl}</code>
</>
)}
</div>
@@ -95,17 +90,11 @@ const OAuthConnect: React.FC<Props> = ({
</Alert>
)}
- <div
- className="rounded-md border p-3"
- style={{
- backgroundColor: `${theme.dracula.cyan}10`,
- borderColor: `${theme.dracula.cyan}30`,
- }}
- >
+ <div className="rounded-md border border-accent/30 bg-accent/10 p-3">
<div className="text-sm leading-relaxed text-muted-foreground">
{connected
? `Your ${config.name} account is connected.`
- : stored
+ : (stored || !hasFields)
? 'Click Login to authorize.'
: 'Enter your credentials above to get started.'}
</div>
diff --git a/client/src/components/credentials/providers.tsx b/client/src/components/credentials/providers.tsx
index 2da9b587..bbafa523 100644
--- a/client/src/components/credentials/providers.tsx
+++ b/client/src/components/credentials/providers.tsx
@@ -48,9 +48,9 @@ export const PROVIDERS: ProviderConfig[] = [
{ label: 'Service', ok: s => !!s?.running, trueText: 'Running', falseText: 'Stopped' },
],
actions: [
- { key: 'start', label: 'Start', themeColor: 'green' },
- { key: 'restart', label: 'Restart', themeColor: 'orange' },
- { key: 'refresh', label: 'Refresh', themeColor: 'cyan' },
+ { key: 'start', label: 'Start', intent: 'run' },
+ { key: 'restart', label: 'Restart', intent: 'config' },
+ { key: 'refresh', label: 'Refresh', intent: 'save' },
],
qr: {
qrField: 'qr',
@@ -123,9 +123,9 @@ export const PROVIDERS: ProviderConfig[] = [
{ label: 'Pairing', ok: s => !!s?.paired, trueText: 'Paired', falseText: 'Waiting', warn: true },
],
actions: [
- { key: 'connect', label: 'Connect', themeColor: 'green',
+ { key: 'connect', label: 'Connect', intent: 'save',
disabled: (s, stored) => !!s?.paired || !stored },
- { key: 'disconnect', label: 'Disconnect', themeColor: 'pink',
+ { key: 'disconnect', label: 'Disconnect', intent: 'stop',
disabled: s => !s?.connected },
],
qr: {
diff --git a/client/src/components/credentials/types.ts b/client/src/components/credentials/types.ts
index 7fe6e01a..7cafe1dc 100644
--- a/client/src/components/credentials/types.ts
+++ b/client/src/components/credentials/types.ts
@@ -4,6 +4,9 @@
* ALL conditional logic lives in config — panel components are pure renderers.
*/
+import type { ActionButtonIntent } from '@/components/ui/action-button';
+export type { ActionButtonIntent };
+
// ============================================================================
// Panel kinds — one renderer branch per kind
// ============================================================================
@@ -43,8 +46,9 @@ export interface StatusRowDef {
export interface ActionDef {
key: string;
label: string;
- /** Theme color key (e.g., 'green', 'pink', 'cyan', 'orange'). Resolved at render. */
- themeColor: string;
+ /** Semantic role consumed by `<ActionButton intent="...">`. Themes
+ * remap the underlying --action-X tokens without touching call sites. */
+ intent: ActionButtonIntent;
/** Return true to hide this action. */
hidden?: (status: any, stored: boolean) => boolean;
/** Return true to disable this action. */
diff --git a/client/src/components/parameterPanel/InputSection.tsx b/client/src/components/parameterPanel/InputSection.tsx
index ce9f7381..948f8a71 100644
--- a/client/src/components/parameterPanel/InputSection.tsx
+++ b/client/src/components/parameterPanel/InputSection.tsx
@@ -155,7 +155,7 @@ const DraggableVar: React.FC<DraggableVarProps> = ({
// ---------------------------------------------------------------------------
const InputSection: React.FC<InputSectionProps> = ({ nodeId, visible = true }) => {
- const { currentWorkflow } = useAppStore();
+ const currentWorkflow = useAppStore((s) => s.currentWorkflow);
const { getNodeOutput, sendRequest } = useWebSocket();
const [expandedNodes, setExpandedNodes] = useState<Set<string>>(new Set());
const [connectedNodes, setConnectedNodes] = useState<NodeData[]>([]);
@@ -183,13 +183,15 @@ const InputSection: React.FC<InputSectionProps> = ({ nodeId, visible = true }) =
return false;
};
- // Helper to check if a node is a config/auxiliary node
+ // Helper to check if a node is a config/auxiliary node.
+ // Backend auto-derives `uiHints.isConfigNode` from group membership
+ // (`memory` / `tool`) at registration time — see
+ // services/plugin/base.py::_derive_auto_ui_hints. Plugins can also
+ // set the flag explicitly to override.
const isConfigNode = (nodeType: string | undefined): boolean => {
if (!nodeType) return false;
const definition = resolveNodeDescription(nodeType);
- if (!definition) return false;
- const groups = definition.group || [];
- return groups.includes('memory') || groups.includes('tool');
+ return definition?.uiHints?.isConfigNode === true;
};
const currentNode = nodes.find((node: Node) => node.id === nodeId);
diff --git a/client/src/components/parameterPanel/MiddleSection.tsx b/client/src/components/parameterPanel/MiddleSection.tsx
index c8e1d12b..722bc8cc 100644
--- a/client/src/components/parameterPanel/MiddleSection.tsx
+++ b/client/src/components/parameterPanel/MiddleSection.tsx
@@ -44,7 +44,12 @@ import { ExecutionResult } from '../../services/executionService';
import { Edge } from 'reactflow';
import { shouldShowParameter } from '../../utils/parameterVisibility';
-import { resolveNodeDescription } from '../../lib/nodeSpec';
+import { resolveNodeDescription, getCachedNodeSpec } from '../../lib/nodeSpec';
+
+const isMasterSkillNodeType = (nodeType: string | undefined): boolean => {
+ if (!nodeType) return false;
+ return (getCachedNodeSpec(nodeType)?.uiHints as any)?.isMasterSkillEditor === true;
+};
// Wave 10.G.3: retired the three tribal arrays `SKILL_NODE_TYPES`,
// `TOOL_NODE_TYPES`, and `AGENT_WITH_SKILLS_TYPES`. The parameter panel
// now reads `uiHints.hasSkills` / `uiHints.isToolPanel` /
@@ -88,7 +93,7 @@ const MiddleSection: React.FC<MiddleSectionProps> = ({
executionResults = []
}) => {
const theme = useAppTheme();
- const { currentWorkflow } = useAppStore();
+ const currentWorkflow = useAppStore((s) => s.currentWorkflow);
const { clearMemory, resetSkill, sendRequest, getNodeParameters, compactionStats: contextCompactionStats, updateCompactionStats } = useWebSocket();
const [showClearMemoryDialog, setShowClearMemoryDialog] = useState(false);
@@ -297,7 +302,7 @@ const MiddleSection: React.FC<MiddleSectionProps> = ({
const masterSkillEdgeSources = useMemo<string[]>(() => {
const nodes = currentWorkflow?.nodes || [];
return skillEdges
- .filter((edge) => nodes.find((n: any) => n.id === edge.source)?.type === 'masterSkill')
+ .filter((edge) => isMasterSkillNodeType(nodes.find((n: any) => n.id === edge.source)?.type))
.map((edge) => edge.source);
}, [skillEdges, currentWorkflow?.nodes]);
@@ -425,7 +430,7 @@ const MiddleSection: React.FC<MiddleSectionProps> = ({
for (const edge of skillEdges) {
const sourceNode = nodes.find((n: any) => n.id === edge.source);
const nodeType = sourceNode?.type || '';
- if (nodeType === 'masterSkill') continue;
+ if (isMasterSkillNodeType(nodeType)) continue;
const def = resolveNodeDescription(nodeType);
skills.push({
id: edge.source,
@@ -452,7 +457,7 @@ const MiddleSection: React.FC<MiddleSectionProps> = ({
for (const edge of skillEdges) {
const sourceNode = nodes.find((n: any) => n.id === edge.source);
- if (sourceNode?.type === 'masterSkill') {
+ if (isMasterSkillNodeType(sourceNode?.type)) {
const params = masterSkillParams[edge.source];
const skillsConfig = params?.skills_config || {};
diff --git a/client/src/components/parameterPanel/ToolSchemaEditor.tsx b/client/src/components/parameterPanel/ToolSchemaEditor.tsx
index f6f393c1..53ceaa89 100644
--- a/client/src/components/parameterPanel/ToolSchemaEditor.tsx
+++ b/client/src/components/parameterPanel/ToolSchemaEditor.tsx
@@ -34,6 +34,7 @@ import {
SelectValue,
} from '@/components/ui/select';
import { Button } from '@/components/ui/button';
+import { ActionButton } from '@/components/ui/action-button';
import { Checkbox } from '@/components/ui/checkbox';
import { resolveNodeDescription } from '../../lib/nodeSpec';
@@ -125,7 +126,7 @@ function formValuesToConfig(values: ToolSchemaFormValues): ToolSchemaConfig {
const ToolSchemaEditor: React.FC<ToolSchemaEditorProps> = ({ nodeId }) => {
const { getToolSchema, saveToolSchema, deleteToolSchema, isLoading } = useToolSchema();
const { isConnected } = useWebSocket();
- const { currentWorkflow } = useAppStore();
+ const currentWorkflow = useAppStore((s) => s.currentWorkflow);
const currentNode = useMemo(() => {
if (!currentWorkflow?.nodes) return null;
@@ -279,18 +280,16 @@ const ToolSchemaEditor: React.FC<ToolSchemaEditorProps> = ({ nodeId }) => {
)}
</div>
) : (
- <div className="mb-3 rounded border border-dracula-orange/30 bg-dracula-orange/10 p-2 text-sm text-dracula-orange">
+ <div className="mb-3 rounded border border-warning/30 bg-warning/10 p-2 text-sm text-warning">
Connect Android nodes to the input handle
</div>
)}
<div className="mb-2 flex items-center justify-between">
<label className="text-sm text-muted-foreground">Schema Fields</label>
- <Button
- type="button"
- variant="outline"
- size="sm"
- className="h-7 border-dracula-cyan/40 bg-dracula-cyan/15 text-dracula-cyan hover:bg-dracula-cyan/25"
+ <ActionButton
+ intent="config"
+ className="h-7"
onClick={() =>
append({
name: `field_${fields.length + 1}`,
@@ -301,7 +300,7 @@ const ToolSchemaEditor: React.FC<ToolSchemaEditorProps> = ({ nodeId }) => {
}
>
+ Add
- </Button>
+ </ActionButton>
</div>
<div className="flex flex-col gap-1">
@@ -315,14 +314,13 @@ const ToolSchemaEditor: React.FC<ToolSchemaEditorProps> = ({ nodeId }) => {
<Button type="button" variant="outline" size="sm" onClick={handleReset}>
Reset
</Button>
- <Button
+ <ActionButton
+ intent="save"
type="submit"
- size="sm"
disabled={isLoading || saveStatus === 'saving'}
- className="border-dracula-green/40 bg-dracula-green/15 text-dracula-green hover:bg-dracula-green/25"
>
{saveStatus === 'saving' ? 'Saving...' : saveStatus === 'saved' ? 'Saved!' : 'Save'}
- </Button>
+ </ActionButton>
</div>
)}
</form>
@@ -391,14 +389,13 @@ const FieldRow: React.FC<{ index: number; onRemove: () => void }> = ({ index, on
</FormItem>
)}
/>
- <Button
- type="button"
- size="sm"
+ <ActionButton
+ intent="stop"
onClick={onRemove}
- className="h-7 border-none bg-dracula-red/15 px-2 text-xs text-dracula-red hover:bg-dracula-red/25"
+ className="h-7 px-2 text-xs"
>
X
- </Button>
+ </ActionButton>
</div>
<FormField
control={control}
diff --git a/client/src/components/ui/InputNodesPanel.tsx b/client/src/components/ui/InputNodesPanel.tsx
index 4830ea52..06b60522 100644
--- a/client/src/components/ui/InputNodesPanel.tsx
+++ b/client/src/components/ui/InputNodesPanel.tsx
@@ -19,7 +19,7 @@ interface InputDataItem {
}
const InputNodesPanel: React.FC<InputNodesPanelProps> = ({ nodeId }) => {
- const { currentWorkflow } = useAppStore();
+ const currentWorkflow = useAppStore((s) => s.currentWorkflow);
const { getNodeOutput } = useWebSocket();
const [inputData, setInputData] = useState<InputDataItem[]>([]);
const [loading, setLoading] = useState(false);
diff --git a/client/src/components/ui/action-button.tsx b/client/src/components/ui/action-button.tsx
index 21a321a1..2d94fb5a 100644
--- a/client/src/components/ui/action-button.tsx
+++ b/client/src/components/ui/action-button.tsx
@@ -20,22 +20,24 @@ import { cn } from '@/lib/utils';
export const actionButtonVariants = cva(
// Base: 32px tall pill with icon-text gap, semibold, focus ring, smooth hover.
- 'inline-flex h-8 items-center gap-1.5 rounded-md border px-3.5 text-[13px] font-semibold transition-all outline-none select-none disabled:cursor-not-allowed focus-visible:ring-2 focus-visible:ring-ring/40',
+ // Disabled state uses shadcn-idiomatic `disabled:opacity-50` so we don't
+ // do per-token opacity arithmetic at the call site.
+ 'inline-flex h-8 items-center gap-1.5 rounded-md border px-3.5 text-[13px] font-semibold transition-all outline-none select-none disabled:cursor-not-allowed disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-ring/40',
{
variants: {
intent: {
run:
- 'border-action-run-border bg-action-run-soft text-action-run hover:bg-action-run/25 disabled:border-primary/40 disabled:bg-primary/10 disabled:text-primary',
+ 'border-action-run-border bg-action-run-soft text-action-run hover:bg-action-run-hover',
stop:
- 'border-action-stop-border bg-action-stop-soft text-action-stop hover:bg-action-stop/25 disabled:border-primary/40 disabled:bg-primary/10 disabled:text-primary',
+ 'border-action-stop-border bg-action-stop-soft text-action-stop hover:bg-action-stop-hover',
save:
- 'border-action-save-border bg-action-save-soft text-action-save hover:bg-action-save/25 disabled:border-primary/40 disabled:bg-primary/10 disabled:text-primary',
+ 'border-action-save-border bg-action-save-soft text-action-save hover:bg-action-save-hover',
config:
- 'border-action-config-border bg-action-config-soft text-action-config hover:bg-action-config/25 disabled:border-primary/40 disabled:bg-primary/10 disabled:text-primary',
+ 'border-action-config-border bg-action-config-soft text-action-config hover:bg-action-config-hover',
secret:
- 'border-action-secret-border bg-action-secret-soft text-action-secret hover:bg-action-secret/25 disabled:border-primary/40 disabled:bg-primary/10 disabled:text-primary',
+ 'border-action-secret-border bg-action-secret-soft text-action-secret hover:bg-action-secret-hover',
tools:
- 'border-action-tools-border bg-action-tools-soft text-action-tools hover:bg-action-tools/25 disabled:border-primary/40 disabled:bg-primary/10 disabled:text-primary',
+ 'border-action-tools-border bg-action-tools-soft text-action-tools hover:bg-action-tools-hover',
},
},
defaultVariants: { intent: 'save' },
diff --git a/client/src/contexts/WebSocketContext.tsx b/client/src/contexts/WebSocketContext.tsx
index 62b4bc5e..10342be5 100644
--- a/client/src/contexts/WebSocketContext.tsx
+++ b/client/src/contexts/WebSocketContext.tsx
@@ -16,7 +16,7 @@ import { useAppStore } from '../store/useAppStore';
import { useAuth } from './AuthContext';
import { queryClient } from '../lib/queryClient';
import { queryKeys } from '../lib/queryConfig';
-import { CATALOGUE_QUERY_KEY } from '../hooks/useCatalogueQuery';
+import { invalidateCatalogue } from '../hooks/useCatalogueQuery';
import { nodeParamsQueryKey } from '../hooks/useNodeParamsQuery';
import {
useNodeStatusStore,
@@ -652,7 +652,7 @@ export const WebSocketProvider: React.FC<{ children: React.ReactNode }> = ({ chi
}
// Catalogue 'stored' flags derive from api_keys + oauth state;
// re-sync once after the bulk status lands.
- queryClient.invalidateQueries({ queryKey: CATALOGUE_QUERY_KEY });
+ invalidateCatalogue(queryClient);
}
break;
@@ -664,7 +664,7 @@ export const WebSocketProvider: React.FC<{ children: React.ReactNode }> = ({ chi
}));
// Sidebar catalogue's `stored` flag depends on server-side
// api_keys + oauth state; refresh it.
- queryClient.invalidateQueries({ queryKey: CATALOGUE_QUERY_KEY });
+ invalidateCatalogue(queryClient);
}
break;
@@ -672,7 +672,7 @@ export const WebSocketProvider: React.FC<{ children: React.ReactNode }> = ({ chi
// Future server emitter (per useCatalogueQuery.ts TODO). Client
// handler is wired now so once the server pushes it, consumers
// refresh automatically.
- queryClient.invalidateQueries({ queryKey: CATALOGUE_QUERY_KEY });
+ invalidateCatalogue(queryClient);
break;
case 'android_status':
@@ -681,7 +681,7 @@ export const WebSocketProvider: React.FC<{ children: React.ReactNode }> = ({ chi
case 'whatsapp_status':
setWhatsappStatus(data || defaultWhatsAppStatus);
- queryClient.invalidateQueries({ queryKey: CATALOGUE_QUERY_KEY });
+ invalidateCatalogue(queryClient);
break;
case 'twitter_oauth_complete':
@@ -694,7 +694,7 @@ export const WebSocketProvider: React.FC<{ children: React.ReactNode }> = ({ chi
name: data.name,
profile_image_url: data.profile_image_url,
});
- queryClient.invalidateQueries({ queryKey: CATALOGUE_QUERY_KEY });
+ invalidateCatalogue(queryClient);
}
break;
@@ -707,7 +707,7 @@ export const WebSocketProvider: React.FC<{ children: React.ReactNode }> = ({ chi
name: data.name,
profile_image_url: data.profile_image_url,
});
- queryClient.invalidateQueries({ queryKey: CATALOGUE_QUERY_KEY });
+ invalidateCatalogue(queryClient);
}
break;
@@ -719,7 +719,7 @@ export const WebSocketProvider: React.FC<{ children: React.ReactNode }> = ({ chi
email: data.email || null,
name: data.name,
});
- queryClient.invalidateQueries({ queryKey: CATALOGUE_QUERY_KEY });
+ invalidateCatalogue(queryClient);
}
break;
@@ -733,7 +733,7 @@ export const WebSocketProvider: React.FC<{ children: React.ReactNode }> = ({ chi
bot_id: data.bot_id || null,
owner_chat_id: data.owner_chat_id ?? null,
});
- queryClient.invalidateQueries({ queryKey: CATALOGUE_QUERY_KEY });
+ invalidateCatalogue(queryClient);
}
break;
@@ -1224,46 +1224,20 @@ export const WebSocketProvider: React.FC<{ children: React.ReactNode }> = ({ chi
}
}, 30000);
- // Load initial API key statuses for known providers
- const providers = ['openai', 'anthropic', 'gemini', 'google_maps', 'android_remote'];
- for (const provider of providers) {
- try {
- const response = await new Promise<any>((resolve, reject) => {
- const requestId = `init_${provider}_${Date.now()}`;
- const timeout = setTimeout(() => reject(new Error('Timeout')), 5000);
-
- const handler = (event: MessageEvent) => {
- try {
- const msg = JSON.parse(event.data);
- if (msg.request_id === requestId) {
- clearTimeout(timeout);
- ws.removeEventListener('message', handler);
- resolve(msg);
- }
- } catch {}
- };
-
- ws.addEventListener('message', handler);
- ws.send(JSON.stringify({ type: 'get_stored_api_key', provider, request_id: requestId }));
- });
-
- if (response.hasKey) {
- setApiKeyStatuses(prev => ({
- ...prev,
- [provider]: { hasKey: true, valid: true }
- }));
- }
- } catch {
- // Ignore errors during initial check
- }
- }
-
- // Load terminal log history
- try {
- const terminalResponse = await new Promise<any>((resolve, reject) => {
- const requestId = `terminal_logs_${Date.now()}`;
- const timeout = setTimeout(() => reject(new Error('Timeout')), 5000);
-
+ // Init burst — every probe / history fetch below is independent
+ // (no handler reads results from a sibling), so we run them in
+ // parallel via Promise.allSettled. Time-to-isReady drops from
+ // ~8 × roundtrip (serial) to one wide round-trip. Each helper
+ // owns its own request_id, message handler, timeout, and state
+ // write — failure in one does not abort the others.
+
+ const sendBurstRequest = <T = any>(payload: object, idPrefix: string): Promise<T> =>
+ new Promise<T>((resolve, reject) => {
+ const requestId = `${idPrefix}_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
+ const timeout = setTimeout(() => {
+ ws.removeEventListener('message', handler);
+ reject(new Error('Timeout'));
+ }, 5000);
const handler = (event: MessageEvent) => {
try {
const msg = JSON.parse(event.data);
@@ -1274,112 +1248,108 @@ export const WebSocketProvider: React.FC<{ children: React.ReactNode }> = ({ chi
}
} catch {}
};
-
ws.addEventListener('message', handler);
- ws.send(JSON.stringify({ type: 'get_terminal_logs', request_id: requestId }));
+ ws.send(JSON.stringify({ ...payload, request_id: requestId }));
});
- if (terminalResponse.success && terminalResponse.logs) {
- // Map server logs to TerminalLogEntry format (newest first)
- const logs: TerminalLogEntry[] = terminalResponse.logs.map((log: any) => ({
- timestamp: log.timestamp || new Date().toISOString(),
- level: log.level || 'info',
- message: log.message || '',
- source: log.source,
- details: log.details
- })).reverse(); // Server stores oldest first, we want newest first
- setTerminalLogs(logs);
+ const probeApiKey = async (provider: string) => {
+ try {
+ const response = await sendBurstRequest<any>(
+ { type: 'get_stored_api_key', provider },
+ `init_${provider}`,
+ );
+ if (response.hasKey) {
+ setApiKeyStatuses(prev => ({
+ ...prev,
+ [provider]: { hasKey: true, valid: true },
+ }));
+ }
+ } catch {
+ // Ignore errors during initial check
}
- } catch {
- // Ignore errors loading terminal logs
- }
-
- // Load chat message history from database
- try {
- const chatResponse = await new Promise<any>((resolve, reject) => {
- const requestId = `chat_messages_${Date.now()}`;
- const timeout = setTimeout(() => reject(new Error('Timeout')), 5000);
+ };
- const handler = (event: MessageEvent) => {
- try {
- const msg = JSON.parse(event.data);
- if (msg.request_id === requestId) {
- clearTimeout(timeout);
- ws.removeEventListener('message', handler);
- resolve(msg);
- }
- } catch {}
- };
+ const loadTerminalLogs = async () => {
+ try {
+ const terminalResponse = await sendBurstRequest<any>(
+ { type: 'get_terminal_logs' },
+ 'terminal_logs',
+ );
+ if (terminalResponse.success && terminalResponse.logs) {
+ const logs: TerminalLogEntry[] = terminalResponse.logs.map((log: any) => ({
+ timestamp: log.timestamp || new Date().toISOString(),
+ level: log.level || 'info',
+ message: log.message || '',
+ source: log.source,
+ details: log.details,
+ })).reverse(); // Server stores oldest first, we want newest first
+ setTerminalLogs(logs);
+ }
+ } catch {
+ // Ignore errors loading terminal logs
+ }
+ };
- ws.addEventListener('message', handler);
+ const loadChatHistory = async () => {
+ try {
// Scope to the currently-open workflow if any. session_id is
// re-used as the workflow identifier on the chat side so the
// panel only shows messages tied to this workflow. Falls
- // back to "default" when no workflow is selected (initial
- // bootstrap before the user opens any workflow).
+ // back to "default" when no workflow is selected.
const workflowId = useAppStore.getState().currentWorkflow?.id || 'default';
- ws.send(JSON.stringify({ type: 'get_chat_messages', session_id: workflowId, request_id: requestId }));
- });
-
- if (chatResponse.success && chatResponse.messages) {
- const messages: ChatMessage[] = chatResponse.messages.map((msg: any) => ({
- role: msg.role as 'user' | 'assistant',
- message: msg.message,
- timestamp: msg.timestamp
- }));
- setChatMessages(messages);
+ const chatResponse = await sendBurstRequest<any>(
+ { type: 'get_chat_messages', session_id: workflowId },
+ 'chat_messages',
+ );
+ if (chatResponse.success && chatResponse.messages) {
+ const messages: ChatMessage[] = chatResponse.messages.map((msg: any) => ({
+ role: msg.role as 'user' | 'assistant',
+ message: msg.message,
+ timestamp: msg.timestamp,
+ }));
+ setChatMessages(messages);
+ }
+ } catch {
+ // Ignore errors loading chat messages
}
- } catch {
- // Ignore errors loading chat messages
- }
-
- // Load console logs from database
- try {
- const consoleRequestId = `console_${Date.now()}`;
- const consoleResponse = await new Promise<any>((resolve, reject) => {
- const timeout = setTimeout(() => reject(new Error('Timeout')), 5000);
-
- const handler = (event: MessageEvent) => {
- try {
- const msg = JSON.parse(event.data);
- if (msg.request_id === consoleRequestId) {
- clearTimeout(timeout);
- ws.removeEventListener('message', handler);
- resolve(msg);
- }
- } catch {}
- };
+ };
- ws.addEventListener('message', handler);
+ const loadConsoleLogs = async () => {
+ try {
// Scope to the currently-open workflow so the panel only
// shows console output from this workflow's runs.
const consoleWorkflowId = useAppStore.getState().currentWorkflow?.id;
- ws.send(JSON.stringify({
- type: 'get_console_logs',
- limit: 100,
- workflow_id: consoleWorkflowId,
- request_id: consoleRequestId,
- }));
- });
-
- if (consoleResponse.success && consoleResponse.logs) {
- const logs: ConsoleLogEntry[] = consoleResponse.logs.map((log: any) => ({
- node_id: log.node_id,
- label: log.label,
- timestamp: log.timestamp,
- data: log.data,
- formatted: log.formatted,
- format: log.format,
- workflow_id: log.workflow_id,
- source_node_id: log.source_node_id,
- source_node_type: log.source_node_type,
- source_node_label: log.source_node_label,
- }));
- setConsoleLogs(logs);
+ const consoleResponse = await sendBurstRequest<any>(
+ { type: 'get_console_logs', limit: 100, workflow_id: consoleWorkflowId },
+ 'console',
+ );
+ if (consoleResponse.success && consoleResponse.logs) {
+ const logs: ConsoleLogEntry[] = consoleResponse.logs.map((log: any) => ({
+ node_id: log.node_id,
+ label: log.label,
+ timestamp: log.timestamp,
+ data: log.data,
+ formatted: log.formatted,
+ format: log.format,
+ workflow_id: log.workflow_id,
+ source_node_id: log.source_node_id,
+ source_node_type: log.source_node_type,
+ source_node_label: log.source_node_label,
+ }));
+ setConsoleLogs(logs);
+ }
+ } catch {
+ // Ignore errors loading console logs
}
- } catch {
- // Ignore errors loading console logs
- }
+ };
+
+ const providers = ['openai', 'anthropic', 'gemini', 'google_maps', 'android_remote'];
+ await Promise.allSettled([
+ ...providers.map(probeApiKey),
+ loadTerminalLogs(),
+ loadChatHistory(),
+ loadConsoleLogs(),
+ ]);
// Drain any sends that were queued while the socket was reconnecting.
// Must run BEFORE setIsReady(true) so isReady-gated callers don't race
diff --git a/client/src/hooks/useAutoSkillEdges.ts b/client/src/hooks/useAutoSkillEdges.ts
index 7dd2c357..15efa631 100644
--- a/client/src/hooks/useAutoSkillEdges.ts
+++ b/client/src/hooks/useAutoSkillEdges.ts
@@ -27,10 +27,15 @@ import type { Node, Edge, Connection } from 'reactflow';
import { useWebSocket } from '../contexts/WebSocketContext';
import { useUserSettingsQuery } from './useUserSettingsQuery';
import { applyOperations, type WorkflowOperation } from '../lib/workflowOps';
+import { getCachedNodeSpec } from '../lib/nodeSpec';
-const MASTER_SKILL_TYPE = 'masterSkill';
const SKILL_HANDLE = 'input-skill';
+const isMasterSkillNode = (nodeType: string | undefined): boolean => {
+ if (!nodeType) return false;
+ return (getCachedNodeSpec(nodeType)?.uiHints as any)?.isMasterSkillEditor === true;
+};
+
interface UseAutoSkillEdgesProps {
baseOnConnect: (params: Edge | Connection) => void;
baseOnEdgesDelete: (deleted: Edge[]) => void;
@@ -73,7 +78,7 @@ export function useAutoSkillEdges({
e => e.target === targetId && e.targetHandle === SKILL_HANDLE,
);
const masterSkillNode = skillEdge && nodes.find(
- n => n.id === skillEdge.source && n.type === MASTER_SKILL_TYPE,
+ n => n.id === skillEdge.source && isMasterSkillNode(n.type),
);
const masterSkillId = masterSkillNode?.id ?? null;
// node.data only stores the label (see CLAUDE.md "Node Data
diff --git a/client/src/hooks/useCatalogueQuery.ts b/client/src/hooks/useCatalogueQuery.ts
index ecb337e3..f686c07e 100644
--- a/client/src/hooks/useCatalogueQuery.ts
+++ b/client/src/hooks/useCatalogueQuery.ts
@@ -22,7 +22,7 @@
*/
import { useCallback, useEffect, useMemo, useRef } from 'react';
-import { useQuery, useQueryClient, type UseQueryResult } from '@tanstack/react-query';
+import { useQuery, useQueryClient, type QueryClient, type UseQueryResult } from '@tanstack/react-query';
import { get as idbGet, set as idbSet } from 'idb-keyval';
import { useWebSocket } from '../contexts/WebSocketContext';
@@ -134,6 +134,33 @@ function isUnchanged(response: WsResponse): response is UnchangedResponse {
export const CATALOGUE_QUERY_KEY = ['credentialCatalogue'] as const;
+// ============================================================================
+// Debounced invalidation
+//
+// 8 broadcast handlers in WebSocketContext (api_key_status, whatsapp_status,
+// twitter_oauth_complete, google_oauth_complete, google_status,
+// telegram_status, credential_catalogue_updated, initial_status) all want to
+// refetch the catalogue. During init-burst or multi-service reconnect, those
+// fire within the same tick and would trigger N back-to-back roundtrips.
+// Coalesce them onto a single invalidate at the trailing edge of a 300ms
+// quiet window. Trailing-edge debounce so the freshest state always wins.
+// ============================================================================
+
+const CATALOGUE_INVALIDATE_DEBOUNCE_MS = 300;
+let _catalogueInvalidateTimer: ReturnType<typeof setTimeout> | null = null;
+
+/**
+ * Request a catalogue refetch, coalesced across rapid bursts of broadcasts.
+ * Replaces direct `queryClient.invalidateQueries({ queryKey: CATALOGUE_QUERY_KEY })`.
+ */
+export function invalidateCatalogue(queryClient: QueryClient): void {
+ if (_catalogueInvalidateTimer) clearTimeout(_catalogueInvalidateTimer);
+ _catalogueInvalidateTimer = setTimeout(() => {
+ _catalogueInvalidateTimer = null;
+ void queryClient.invalidateQueries({ queryKey: CATALOGUE_QUERY_KEY });
+ }, CATALOGUE_INVALIDATE_DEBOUNCE_MS);
+}
+
/** IDB key — we only store the current version, overwritten on each update. */
const IDB_STORAGE_KEY = 'credentials:catalogue:current';
diff --git a/client/src/hooks/useDragVariable.ts b/client/src/hooks/useDragVariable.ts
index a08c2c02..e74223fd 100644
--- a/client/src/hooks/useDragVariable.ts
+++ b/client/src/hooks/useDragVariable.ts
@@ -26,7 +26,7 @@ interface DragVariableHookReturn {
* @param targetNodeId - The ID of the node receiving the drag (target of edge)
*/
export const useDragVariable = (_targetNodeId: string): DragVariableHookReturn => {
- const { currentWorkflow } = useAppStore();
+ const currentWorkflow = useAppStore((s) => s.currentWorkflow);
/**
* Get template variable name for a source node.
diff --git a/client/src/hooks/useParameterPanel.ts b/client/src/hooks/useParameterPanel.ts
index 1457fc6d..c4fcb199 100644
--- a/client/src/hooks/useParameterPanel.ts
+++ b/client/src/hooks/useParameterPanel.ts
@@ -23,7 +23,8 @@ function defaultsForNodeType(nodeType: string): Record<string, any> {
}
export const useParameterPanel = () => {
- const { selectedNode, setSelectedNode } = useAppStore();
+ const selectedNode = useAppStore((s) => s.selectedNode);
+ const setSelectedNode = useAppStore((s) => s.setSelectedNode);
const { sendRequest, isConnected } = useWebSocket();
const nodeId = selectedNode?.id;
diff --git a/client/src/hooks/useReactFlowNodes.ts b/client/src/hooks/useReactFlowNodes.ts
index 03b685cd..47c431b8 100644
--- a/client/src/hooks/useReactFlowNodes.ts
+++ b/client/src/hooks/useReactFlowNodes.ts
@@ -10,7 +10,8 @@ interface UseReactFlowNodesProps {
}
export const useReactFlowNodes = ({ setNodes, setEdges }: UseReactFlowNodesProps) => {
- const { selectedNode, setSelectedNode } = useAppStore();
+ const selectedNode = useAppStore((s) => s.selectedNode);
+ const setSelectedNode = useAppStore((s) => s.setSelectedNode);
// Helper function to get node inputs/outputs for both enhanced and legacy nodes
const getNodeInputs = (nodeType: string): INodeInputDefinition[] => {
diff --git a/client/src/hooks/useWorkflowManagement.ts b/client/src/hooks/useWorkflowManagement.ts
index 4019ee71..6baf4616 100644
--- a/client/src/hooks/useWorkflowManagement.ts
+++ b/client/src/hooks/useWorkflowManagement.ts
@@ -3,14 +3,12 @@ import { useAppStore } from '../store/useAppStore';
import { useWorkflowsQuery, type SavedWorkflow } from './useWorkflowsQuery';
export const useWorkflowManagement = () => {
- const {
- currentWorkflow,
- hasUnsavedChanges,
- updateWorkflow,
- saveWorkflow,
- loadWorkflow,
- createNewWorkflow,
- } = useAppStore();
+ const currentWorkflow = useAppStore((s) => s.currentWorkflow);
+ const hasUnsavedChanges = useAppStore((s) => s.hasUnsavedChanges);
+ const updateWorkflow = useAppStore((s) => s.updateWorkflow);
+ const saveWorkflow = useAppStore((s) => s.saveWorkflow);
+ const loadWorkflow = useAppStore((s) => s.loadWorkflow);
+ const createNewWorkflow = useAppStore((s) => s.createNewWorkflow);
const { data: savedWorkflows = [] } = useWorkflowsQuery();
diff --git a/client/src/index.css b/client/src/index.css
index 99da6a85..7a834e6a 100644
--- a/client/src/index.css
+++ b/client/src/index.css
@@ -116,26 +116,32 @@
* convention). */
--action-run: 135 94% 65%; /* primary CTA: deploy / run */
--action-run-soft: 135 94% 65% / 0.15;
+ --action-run-hover: 135 94% 65% / 0.25;
--action-run-border: 135 94% 65% / 0.6;
--action-stop: 326 100% 74%; /* destructive: stop / cancel / logout */
--action-stop-soft: 326 100% 74% / 0.15;
+ --action-stop-hover: 326 100% 74% / 0.25;
--action-stop-border: 326 100% 74% / 0.6;
--action-save: 191 97% 77%; /* commit / save / panel toggle */
--action-save-soft: 191 97% 77% / 0.15;
+ --action-save-hover: 191 97% 77% / 0.25;
--action-save-border: 191 97% 77% / 0.6;
--action-config: 27 100% 71%; /* settings / config / warning */
--action-config-soft: 27 100% 71% / 0.15;
+ --action-config-hover: 27 100% 71% / 0.25;
--action-config-border: 27 100% 71% / 0.6;
--action-secret: 65 92% 76%; /* credentials / theme toggle */
--action-secret-soft: 65 92% 76% / 0.15;
+ --action-secret-hover: 65 92% 76% / 0.25;
--action-secret-border: 65 92% 76% / 0.6;
--action-tools: 265 89% 78%; /* component palette / creative */
--action-tools-soft: 265 89% 78% / 0.15;
+ --action-tools-hover: 265 89% 78% / 0.25;
--action-tools-border: 265 89% 78% / 0.6;
}
@@ -265,21 +271,27 @@
* the standard "soft tinted button" look (see ActionButton CVA). */
--color-action-run: hsl(var(--action-run));
--color-action-run-soft: hsl(var(--action-run-soft));
+ --color-action-run-hover: hsl(var(--action-run-hover));
--color-action-run-border: hsl(var(--action-run-border));
--color-action-stop: hsl(var(--action-stop));
--color-action-stop-soft: hsl(var(--action-stop-soft));
+ --color-action-stop-hover: hsl(var(--action-stop-hover));
--color-action-stop-border: hsl(var(--action-stop-border));
--color-action-save: hsl(var(--action-save));
--color-action-save-soft: hsl(var(--action-save-soft));
+ --color-action-save-hover: hsl(var(--action-save-hover));
--color-action-save-border: hsl(var(--action-save-border));
--color-action-config: hsl(var(--action-config));
--color-action-config-soft: hsl(var(--action-config-soft));
+ --color-action-config-hover: hsl(var(--action-config-hover));
--color-action-config-border: hsl(var(--action-config-border));
--color-action-secret: hsl(var(--action-secret));
--color-action-secret-soft: hsl(var(--action-secret-soft));
+ --color-action-secret-hover: hsl(var(--action-secret-hover));
--color-action-secret-border: hsl(var(--action-secret-border));
--color-action-tools: hsl(var(--action-tools));
--color-action-tools-soft: hsl(var(--action-tools-soft));
+ --color-action-tools-hover: hsl(var(--action-tools-hover));
--color-action-tools-border: hsl(var(--action-tools-border));
--radius-sm: calc(var(--radius) - 4px);
diff --git a/client/src/styles/canvasAnimations.ts b/client/src/styles/canvasAnimations.ts
index 69dc6910..4c17ee1b 100644
--- a/client/src/styles/canvasAnimations.ts
+++ b/client/src/styles/canvasAnimations.ts
@@ -3,7 +3,8 @@
* Dashboard. Split into named groups so a new status visual or keyframe
* can be added without touching Dashboard.tsx.
*
- * KEYFRAMES -- @keyframes definitions
+ * KEYFRAMES -- @keyframes definitions (color-agnostic;
+ * consume scoped --node-glow* CSS vars)
* edgeStatusStyles(...) -- .react-flow__edge.{selected,executing,...}
* nodeStatusStyles(...) -- .react-flow__node.{executing,...}
* buildCanvasStyles(...) -- composes the three for Dashboard
@@ -11,6 +12,10 @@
* Per-node inline animations (border pulse, etc.) live in their own
* components and read theme tokens directly; this module is for
* canvas-wide rules that need to match React Flow's wrapper classes.
+ *
+ * The light vs dark distinction is encoded entirely in `colors` (the
+ * theme object provides different values per mode), so this file knows
+ * nothing about which theme is active.
*/
export interface CanvasStatusColors {
@@ -19,6 +24,9 @@ export interface CanvasStatusColors {
edgeExecuting: string;
edgeCompleted: string;
edgeError: string;
+ edgePending: string;
+ edgeMemoryActive: string;
+ edgeToolActive: string;
}
const KEYFRAMES = `
@@ -27,18 +35,13 @@ const KEYFRAMES = `
100% { stroke-dashoffset: 0; }
}
- @keyframes nodeGlowDark {
+ @keyframes nodeGlow {
0%, 100% { filter: drop-shadow(0 0 8px var(--node-glow)) drop-shadow(0 0 16px var(--node-glow-soft)); }
50% { filter: drop-shadow(0 0 14px var(--node-glow)) drop-shadow(0 0 24px var(--node-glow)); }
}
-
- @keyframes nodeGlowLight {
- 0%, 100% { filter: drop-shadow(0 0 10px rgba(37, 99, 235, 0.8)) drop-shadow(0 0 20px rgba(37, 99, 235, 0.6)); }
- 50% { filter: drop-shadow(0 0 16px rgba(37, 99, 235, 1)) drop-shadow(0 0 30px rgba(37, 99, 235, 0.8)); }
- }
`;
-function edgeStatusStyles(colors: CanvasStatusColors, isDark: boolean): string {
+function edgeStatusStyles(colors: CanvasStatusColors): string {
return `
.react-flow__edge path {
stroke: ${colors.edgeDefault} !important;
@@ -51,14 +54,14 @@ function edgeStatusStyles(colors: CanvasStatusColors, isDark: boolean): string {
}
.react-flow__edge.executing path {
- stroke: ${isDark ? colors.edgeExecuting : '#2563eb'} !important;
+ stroke: ${colors.edgeExecuting} !important;
stroke-width: 3px !important;
stroke-dasharray: 8 4;
animation: dashFlow 0.5s linear infinite;
}
.react-flow__edge.completed path {
- stroke: ${isDark ? colors.edgeCompleted : '#16a34a'} !important;
+ stroke: ${colors.edgeCompleted} !important;
stroke-width: 2px !important;
}
@@ -68,45 +71,42 @@ function edgeStatusStyles(colors: CanvasStatusColors, isDark: boolean): string {
}
.react-flow__edge.pending path {
- stroke: ${isDark ? colors.edgeDefault : '#6b7280'} !important;
+ stroke: ${colors.edgePending} !important;
stroke-width: 2px !important;
stroke-dasharray: 8 4;
animation: dashFlow 0.5s linear infinite;
}
.react-flow__edge.memory-active path {
- stroke: ${isDark ? '#ff79c6' : '#db2777'} !important;
+ stroke: ${colors.edgeMemoryActive} !important;
stroke-width: 3px !important;
}
.react-flow__edge.tool-active path {
- stroke: ${isDark ? '#ffb86c' : '#ea580c'} !important;
+ stroke: ${colors.edgeToolActive} !important;
stroke-width: 3px !important;
}
`;
}
-function nodeStatusStyles(colors: CanvasStatusColors, isDark: boolean): string {
+function nodeStatusStyles(colors: CanvasStatusColors): string {
// --node-glow / --node-glow-soft are scoped vars consumed by the
- // nodeGlowDark keyframe, so the keyframe stays color-agnostic and
- // theme swaps don't require regenerating the keyframe text.
+ // nodeGlow keyframe, so the keyframe stays color-agnostic and theme
+ // swaps don't require regenerating the keyframe text.
const glow = colors.edgeExecuting;
return `
.react-flow__node.executing {
--node-glow: ${glow};
--node-glow-soft: ${glow}80;
- animation: ${isDark ? 'nodeGlowDark' : 'nodeGlowLight'} 1.2s ease-in-out infinite;
+ animation: nodeGlow 1.2s ease-in-out infinite;
}
`;
}
-export function buildCanvasStyles(
- colors: CanvasStatusColors,
- isDark: boolean,
-): string {
+export function buildCanvasStyles(colors: CanvasStatusColors): string {
return [
- edgeStatusStyles(colors, isDark),
- nodeStatusStyles(colors, isDark),
+ edgeStatusStyles(colors),
+ nodeStatusStyles(colors),
KEYFRAMES,
].join('\n');
}
diff --git a/client/src/styles/theme.ts b/client/src/styles/theme.ts
index 3ef46d03..32768633 100644
--- a/client/src/styles/theme.ts
+++ b/client/src/styles/theme.ts
@@ -119,9 +119,12 @@ export const lightColors = {
// Edge colors for light mode - MUCH darker for visibility
edgeDefault: '#6b7280', // gray-500 - much more visible
edgeSelected: '#7c3aed', // Violet
- edgeExecuting: '#7c3aed', // Violet
- edgeCompleted: '#059669', // Emerald-600
+ edgeExecuting: '#2563eb', // Blue-600 (executing state pop)
+ edgeCompleted: '#16a34a', // Green-600
edgeError: '#dc2626', // Red-600
+ edgePending: '#6b7280', // gray-500 (same as default, dashed)
+ edgeMemoryActive: '#db2777', // Pink-600
+ edgeToolActive: '#ea580c', // Orange-600
// Category colors for light mode (darker, more saturated)
categoryWorkflow: '#ea580c', // Orange-600
categoryTrigger: '#db2777', // Pink-600
@@ -190,9 +193,12 @@ export const darkColors = {
// Edge colors for dark mode
edgeDefault: dracula.cyan, // Cyan
edgeSelected: dracula.purple, // Purple
- edgeExecuting: dracula.purple, // Purple
+ edgeExecuting: dracula.purple, // Purple (executing state pop)
edgeCompleted: dracula.green, // Green
edgeError: dracula.red, // Red
+ edgePending: dracula.cyan, // Cyan (same as default, dashed)
+ edgeMemoryActive: dracula.pink, // Pink
+ edgeToolActive: dracula.orange, // Orange
// Category colors for dark mode (Dracula - vibrant)
categoryWorkflow: dracula.orange,
categoryTrigger: dracula.pink,
diff --git a/client/src/types/INodeProperties.ts b/client/src/types/INodeProperties.ts
index 2362e061..66f45aba 100644
--- a/client/src/types/INodeProperties.ts
+++ b/client/src/types/INodeProperties.ts
@@ -213,6 +213,11 @@ export interface INodeUIHints {
isConsoleSink?: boolean;
/** Agent panels show the connected-skills section. */
hasSkills?: boolean;
+ /** InputSection / OutputPanel: this node is auxiliary configuration
+ * (memory, tool). Its panel inherits the parent's main inputs
+ * instead of showing direct upstream connections. Auto-derived on
+ * the backend from group membership; plugins can override. */
+ isConfigNode?: boolean;
}
export interface INodeTypeDescription {
diff --git a/server/services/plugin/base.py b/server/services/plugin/base.py
index d147f98a..11a04533 100644
--- a/server/services/plugin/base.py
+++ b/server/services/plugin/base.py
@@ -63,6 +63,22 @@ class _EmptyOutput(BaseModel):
pass
+# Group memberships that mark a node as auxiliary configuration —
+# its panel inherits the parent's main inputs instead of showing
+# direct inputs. Centralized here so the frontend doesn't need to
+# know any group strings.
+_CONFIG_NODE_GROUPS = frozenset({"memory", "tool"})
+
+
+def _derive_auto_ui_hints(group: Sequence[str]) -> Dict[str, Any]:
+ """Auto-derived uiHints based on group membership. Plugin-declared
+ ``ui_hints`` override these — explicit always wins."""
+ hints: Dict[str, Any] = {}
+ if any(g in _CONFIG_NODE_GROUPS for g in group):
+ hints["isConfigNode"] = True
+ return hints
+
+
class BaseNode:
"""Abstract plugin node. Do not instantiate directly — subclass
:class:`ActionNode`, :class:`TriggerNode`, or :class:`ToolNode`.
@@ -187,8 +203,10 @@ class BaseNode:
meta["hideOutputHandle"] = True
if cls.visibility != "all":
meta["visibility"] = cls.visibility
- if cls.ui_hints:
- meta["uiHints"] = dict(cls.ui_hints)
+ ui_hints = _derive_auto_ui_hints(cls.group)
+ ui_hints.update(cls.ui_hints)
+ if ui_hints:
+ meta["uiHints"] = ui_hints
return meta
# ---- legacy handler adapter ------------------------------------------
diff --git a/server/tests/test_node_spec.py b/server/tests/test_node_spec.py
index f50b1739..79f96855 100644
--- a/server/tests/test_node_spec.py
+++ b/server/tests/test_node_spec.py
@@ -777,6 +777,11 @@ class TestNodeSpecContractInvariants:
"width", "height",
# Wave 10.G.5: start-node's user-authored JSON blob marker
"hasInitialDataBlob",
+ # Auto-derived from group membership ('memory' / 'tool') by
+ # _derive_auto_ui_hints in services/plugin/base.py. Tells the
+ # parameter panel that this node is an auxiliary config node
+ # and should inherit the parent's main inputs.
+ "isConfigNode",
}
for node_type, meta in NODE_METADATA.items():
hints = meta.get("uiHints") or {}