machinaos 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/.env.template +71 -0
  2. package/LICENSE +21 -0
  3. package/README.md +87 -0
  4. package/bin/cli.js +159 -0
  5. package/client/.dockerignore +45 -0
  6. package/client/Dockerfile +68 -0
  7. package/client/eslint.config.js +29 -0
  8. package/client/index.html +13 -0
  9. package/client/nginx.conf +66 -0
  10. package/client/package.json +48 -0
  11. package/client/src/App.tsx +27 -0
  12. package/client/src/Dashboard.tsx +1173 -0
  13. package/client/src/ParameterPanel.tsx +301 -0
  14. package/client/src/components/AIAgentNode.tsx +321 -0
  15. package/client/src/components/APIKeyValidator.tsx +118 -0
  16. package/client/src/components/ClaudeChatModelNode.tsx +18 -0
  17. package/client/src/components/ConditionalEdge.tsx +189 -0
  18. package/client/src/components/CredentialsModal.tsx +306 -0
  19. package/client/src/components/EdgeConditionEditor.tsx +443 -0
  20. package/client/src/components/GeminiChatModelNode.tsx +18 -0
  21. package/client/src/components/GenericNode.tsx +357 -0
  22. package/client/src/components/LocationParameterPanel.tsx +154 -0
  23. package/client/src/components/ModelNode.tsx +286 -0
  24. package/client/src/components/OpenAIChatModelNode.tsx +18 -0
  25. package/client/src/components/OutputPanel.tsx +471 -0
  26. package/client/src/components/ParameterRenderer.tsx +1874 -0
  27. package/client/src/components/SkillEditorModal.tsx +417 -0
  28. package/client/src/components/SquareNode.tsx +797 -0
  29. package/client/src/components/StartNode.tsx +250 -0
  30. package/client/src/components/ToolkitNode.tsx +365 -0
  31. package/client/src/components/TriggerNode.tsx +463 -0
  32. package/client/src/components/auth/LoginPage.tsx +247 -0
  33. package/client/src/components/auth/ProtectedRoute.tsx +59 -0
  34. package/client/src/components/base/BaseChatModelNode.tsx +271 -0
  35. package/client/src/components/icons/AIProviderIcons.tsx +50 -0
  36. package/client/src/components/maps/GoogleMapsPicker.tsx +137 -0
  37. package/client/src/components/maps/MapsPreviewPanel.tsx +110 -0
  38. package/client/src/components/maps/index.ts +26 -0
  39. package/client/src/components/parameterPanel/InputSection.tsx +1094 -0
  40. package/client/src/components/parameterPanel/LocationPanelLayout.tsx +65 -0
  41. package/client/src/components/parameterPanel/MapsSection.tsx +92 -0
  42. package/client/src/components/parameterPanel/MiddleSection.tsx +571 -0
  43. package/client/src/components/parameterPanel/OutputSection.tsx +81 -0
  44. package/client/src/components/parameterPanel/ParameterPanelLayout.tsx +82 -0
  45. package/client/src/components/parameterPanel/ToolSchemaEditor.tsx +436 -0
  46. package/client/src/components/parameterPanel/index.ts +42 -0
  47. package/client/src/components/shared/DataPanel.tsx +142 -0
  48. package/client/src/components/shared/JSONTreeRenderer.tsx +106 -0
  49. package/client/src/components/ui/AIResultModal.tsx +204 -0
  50. package/client/src/components/ui/AndroidSettingsPanel.tsx +401 -0
  51. package/client/src/components/ui/CodeEditor.tsx +81 -0
  52. package/client/src/components/ui/CollapsibleSection.tsx +88 -0
  53. package/client/src/components/ui/ComponentItem.tsx +154 -0
  54. package/client/src/components/ui/ComponentPalette.tsx +321 -0
  55. package/client/src/components/ui/ConsolePanel.tsx +1074 -0
  56. package/client/src/components/ui/ErrorBoundary.tsx +196 -0
  57. package/client/src/components/ui/InputNodesPanel.tsx +204 -0
  58. package/client/src/components/ui/MapSelector.tsx +314 -0
  59. package/client/src/components/ui/Modal.tsx +149 -0
  60. package/client/src/components/ui/NodeContextMenu.tsx +192 -0
  61. package/client/src/components/ui/NodeOutputPanel.tsx +1150 -0
  62. package/client/src/components/ui/OutputDisplayPanel.tsx +381 -0
  63. package/client/src/components/ui/SettingsPanel.tsx +243 -0
  64. package/client/src/components/ui/TopToolbar.tsx +736 -0
  65. package/client/src/components/ui/WhatsAppSettingsPanel.tsx +345 -0
  66. package/client/src/components/ui/WorkflowSidebar.tsx +294 -0
  67. package/client/src/config/antdTheme.ts +186 -0
  68. package/client/src/config/api.ts +54 -0
  69. package/client/src/contexts/AuthContext.tsx +221 -0
  70. package/client/src/contexts/ThemeContext.tsx +42 -0
  71. package/client/src/contexts/WebSocketContext.tsx +1971 -0
  72. package/client/src/factories/baseChatModelFactory.ts +256 -0
  73. package/client/src/hooks/useAndroidOperations.ts +164 -0
  74. package/client/src/hooks/useApiKeyValidation.ts +107 -0
  75. package/client/src/hooks/useApiKeys.ts +238 -0
  76. package/client/src/hooks/useAppTheme.ts +17 -0
  77. package/client/src/hooks/useComponentPalette.ts +51 -0
  78. package/client/src/hooks/useCopyPaste.ts +155 -0
  79. package/client/src/hooks/useDragAndDrop.ts +124 -0
  80. package/client/src/hooks/useDragVariable.ts +88 -0
  81. package/client/src/hooks/useExecution.ts +313 -0
  82. package/client/src/hooks/useParameterPanel.ts +176 -0
  83. package/client/src/hooks/useReactFlowNodes.ts +189 -0
  84. package/client/src/hooks/useToolSchema.ts +209 -0
  85. package/client/src/hooks/useWhatsApp.ts +196 -0
  86. package/client/src/hooks/useWorkflowManagement.ts +46 -0
  87. package/client/src/index.css +315 -0
  88. package/client/src/main.tsx +19 -0
  89. package/client/src/nodeDefinitions/aiAgentNodes.ts +336 -0
  90. package/client/src/nodeDefinitions/aiModelNodes.ts +340 -0
  91. package/client/src/nodeDefinitions/androidDeviceNodes.ts +140 -0
  92. package/client/src/nodeDefinitions/androidServiceNodes.ts +383 -0
  93. package/client/src/nodeDefinitions/chatNodes.ts +135 -0
  94. package/client/src/nodeDefinitions/codeNodes.ts +54 -0
  95. package/client/src/nodeDefinitions/documentNodes.ts +379 -0
  96. package/client/src/nodeDefinitions/index.ts +15 -0
  97. package/client/src/nodeDefinitions/locationNodes.ts +463 -0
  98. package/client/src/nodeDefinitions/schedulerNodes.ts +220 -0
  99. package/client/src/nodeDefinitions/skillNodes.ts +211 -0
  100. package/client/src/nodeDefinitions/toolNodes.ts +198 -0
  101. package/client/src/nodeDefinitions/utilityNodes.ts +284 -0
  102. package/client/src/nodeDefinitions/whatsappNodes.ts +865 -0
  103. package/client/src/nodeDefinitions/workflowNodes.ts +41 -0
  104. package/client/src/nodeDefinitions.ts +104 -0
  105. package/client/src/schemas/workflowSchema.ts +264 -0
  106. package/client/src/services/dynamicParameterService.ts +96 -0
  107. package/client/src/services/execution/aiAgentExecutionService.ts +35 -0
  108. package/client/src/services/executionService.ts +232 -0
  109. package/client/src/services/workflowApi.ts +91 -0
  110. package/client/src/store/useAppStore.ts +582 -0
  111. package/client/src/styles/theme.ts +508 -0
  112. package/client/src/styles/zIndex.ts +17 -0
  113. package/client/src/types/ComponentTypes.ts +39 -0
  114. package/client/src/types/EdgeCondition.ts +231 -0
  115. package/client/src/types/INodeProperties.ts +288 -0
  116. package/client/src/types/NodeTypes.ts +28 -0
  117. package/client/src/utils/formatters.ts +33 -0
  118. package/client/src/utils/googleMapsLoader.ts +140 -0
  119. package/client/src/utils/locationUtils.ts +85 -0
  120. package/client/src/utils/nodeUtils.ts +31 -0
  121. package/client/src/utils/workflow.ts +30 -0
  122. package/client/src/utils/workflowExport.ts +120 -0
  123. package/client/src/vite-env.d.ts +12 -0
  124. package/client/tailwind.config.js +60 -0
  125. package/client/tsconfig.json +25 -0
  126. package/client/tsconfig.node.json +11 -0
  127. package/client/vite.config.js +35 -0
  128. package/docker-compose.prod.yml +107 -0
  129. package/docker-compose.yml +104 -0
  130. package/docs-MachinaOs/README.md +85 -0
  131. package/docs-MachinaOs/deployment/docker.mdx +228 -0
  132. package/docs-MachinaOs/deployment/production.mdx +345 -0
  133. package/docs-MachinaOs/docs.json +75 -0
  134. package/docs-MachinaOs/faq.mdx +309 -0
  135. package/docs-MachinaOs/favicon.svg +5 -0
  136. package/docs-MachinaOs/installation.mdx +160 -0
  137. package/docs-MachinaOs/introduction.mdx +114 -0
  138. package/docs-MachinaOs/logo/dark.svg +6 -0
  139. package/docs-MachinaOs/logo/light.svg +6 -0
  140. package/docs-MachinaOs/nodes/ai-agent.mdx +216 -0
  141. package/docs-MachinaOs/nodes/ai-models.mdx +240 -0
  142. package/docs-MachinaOs/nodes/android.mdx +411 -0
  143. package/docs-MachinaOs/nodes/overview.mdx +181 -0
  144. package/docs-MachinaOs/nodes/schedulers.mdx +316 -0
  145. package/docs-MachinaOs/nodes/webhooks.mdx +330 -0
  146. package/docs-MachinaOs/nodes/whatsapp.mdx +305 -0
  147. package/docs-MachinaOs/quickstart.mdx +119 -0
  148. package/docs-MachinaOs/tutorials/ai-agent-workflow.mdx +177 -0
  149. package/docs-MachinaOs/tutorials/android-automation.mdx +242 -0
  150. package/docs-MachinaOs/tutorials/first-workflow.mdx +134 -0
  151. package/docs-MachinaOs/tutorials/whatsapp-automation.mdx +185 -0
  152. package/nul +0 -0
  153. package/package.json +70 -0
  154. package/scripts/build.js +158 -0
  155. package/scripts/check-ports.ps1 +33 -0
  156. package/scripts/clean.js +40 -0
  157. package/scripts/docker.js +93 -0
  158. package/scripts/kill-port.ps1 +154 -0
  159. package/scripts/start.js +210 -0
  160. package/scripts/stop.js +325 -0
  161. package/server/.dockerignore +44 -0
  162. package/server/Dockerfile +45 -0
  163. package/server/constants.py +249 -0
  164. package/server/core/__init__.py +1 -0
  165. package/server/core/cache.py +461 -0
  166. package/server/core/config.py +128 -0
  167. package/server/core/container.py +99 -0
  168. package/server/core/database.py +1211 -0
  169. package/server/core/logging.py +314 -0
  170. package/server/main.py +289 -0
  171. package/server/middleware/__init__.py +5 -0
  172. package/server/middleware/auth.py +89 -0
  173. package/server/models/__init__.py +1 -0
  174. package/server/models/auth.py +52 -0
  175. package/server/models/cache.py +24 -0
  176. package/server/models/database.py +211 -0
  177. package/server/models/nodes.py +455 -0
  178. package/server/package.json +9 -0
  179. package/server/pyproject.toml +72 -0
  180. package/server/requirements.txt +83 -0
  181. package/server/routers/__init__.py +1 -0
  182. package/server/routers/android.py +294 -0
  183. package/server/routers/auth.py +203 -0
  184. package/server/routers/database.py +151 -0
  185. package/server/routers/maps.py +142 -0
  186. package/server/routers/nodejs_compat.py +289 -0
  187. package/server/routers/webhook.py +90 -0
  188. package/server/routers/websocket.py +2127 -0
  189. package/server/routers/whatsapp.py +761 -0
  190. package/server/routers/workflow.py +200 -0
  191. package/server/services/__init__.py +1 -0
  192. package/server/services/ai.py +2415 -0
  193. package/server/services/android/__init__.py +27 -0
  194. package/server/services/android/broadcaster.py +114 -0
  195. package/server/services/android/client.py +608 -0
  196. package/server/services/android/manager.py +78 -0
  197. package/server/services/android/protocol.py +165 -0
  198. package/server/services/android_service.py +588 -0
  199. package/server/services/auth.py +131 -0
  200. package/server/services/chat_client.py +160 -0
  201. package/server/services/deployment/__init__.py +12 -0
  202. package/server/services/deployment/manager.py +706 -0
  203. package/server/services/deployment/state.py +47 -0
  204. package/server/services/deployment/triggers.py +275 -0
  205. package/server/services/event_waiter.py +785 -0
  206. package/server/services/execution/__init__.py +77 -0
  207. package/server/services/execution/cache.py +769 -0
  208. package/server/services/execution/conditions.py +373 -0
  209. package/server/services/execution/dlq.py +132 -0
  210. package/server/services/execution/executor.py +1351 -0
  211. package/server/services/execution/models.py +531 -0
  212. package/server/services/execution/recovery.py +235 -0
  213. package/server/services/handlers/__init__.py +126 -0
  214. package/server/services/handlers/ai.py +355 -0
  215. package/server/services/handlers/android.py +260 -0
  216. package/server/services/handlers/code.py +278 -0
  217. package/server/services/handlers/document.py +598 -0
  218. package/server/services/handlers/http.py +193 -0
  219. package/server/services/handlers/polyglot.py +105 -0
  220. package/server/services/handlers/tools.py +845 -0
  221. package/server/services/handlers/triggers.py +107 -0
  222. package/server/services/handlers/utility.py +822 -0
  223. package/server/services/handlers/whatsapp.py +476 -0
  224. package/server/services/maps.py +289 -0
  225. package/server/services/memory_store.py +103 -0
  226. package/server/services/node_executor.py +375 -0
  227. package/server/services/parameter_resolver.py +218 -0
  228. package/server/services/polyglot_client.py +169 -0
  229. package/server/services/scheduler.py +155 -0
  230. package/server/services/skill_loader.py +417 -0
  231. package/server/services/status_broadcaster.py +826 -0
  232. package/server/services/temporal/__init__.py +23 -0
  233. package/server/services/temporal/activities.py +344 -0
  234. package/server/services/temporal/client.py +76 -0
  235. package/server/services/temporal/executor.py +147 -0
  236. package/server/services/temporal/worker.py +251 -0
  237. package/server/services/temporal/workflow.py +355 -0
  238. package/server/services/temporal/ws_client.py +236 -0
  239. package/server/services/text.py +111 -0
  240. package/server/services/user_auth.py +172 -0
  241. package/server/services/websocket_client.py +29 -0
  242. package/server/services/workflow.py +597 -0
  243. package/server/skills/android-skill/SKILL.md +82 -0
  244. package/server/skills/assistant-personality/SKILL.md +45 -0
  245. package/server/skills/code-skill/SKILL.md +140 -0
  246. package/server/skills/http-skill/SKILL.md +161 -0
  247. package/server/skills/maps-skill/SKILL.md +170 -0
  248. package/server/skills/memory-skill/SKILL.md +154 -0
  249. package/server/skills/scheduler-skill/SKILL.md +84 -0
  250. package/server/skills/whatsapp-skill/SKILL.md +283 -0
  251. package/server/uv.lock +2916 -0
  252. package/server/whatsapp-rpc/.dockerignore +30 -0
  253. package/server/whatsapp-rpc/Dockerfile +44 -0
  254. package/server/whatsapp-rpc/Dockerfile.web +17 -0
  255. package/server/whatsapp-rpc/README.md +139 -0
  256. package/server/whatsapp-rpc/cli.js +95 -0
  257. package/server/whatsapp-rpc/configs/config.yaml +7 -0
  258. package/server/whatsapp-rpc/docker-compose.yml +35 -0
  259. package/server/whatsapp-rpc/docs/API.md +410 -0
  260. package/server/whatsapp-rpc/go.mod +67 -0
  261. package/server/whatsapp-rpc/go.sum +203 -0
  262. package/server/whatsapp-rpc/package.json +30 -0
  263. package/server/whatsapp-rpc/schema.json +1294 -0
  264. package/server/whatsapp-rpc/scripts/clean.cjs +66 -0
  265. package/server/whatsapp-rpc/scripts/cli.js +162 -0
  266. package/server/whatsapp-rpc/src/go/cmd/server/main.go +91 -0
  267. package/server/whatsapp-rpc/src/go/config/config.go +49 -0
  268. package/server/whatsapp-rpc/src/go/rpc/rpc.go +446 -0
  269. package/server/whatsapp-rpc/src/go/rpc/server.go +112 -0
  270. package/server/whatsapp-rpc/src/go/whatsapp/history.go +166 -0
  271. package/server/whatsapp-rpc/src/go/whatsapp/messages.go +390 -0
  272. package/server/whatsapp-rpc/src/go/whatsapp/service.go +2130 -0
  273. package/server/whatsapp-rpc/src/go/whatsapp/types.go +261 -0
  274. package/server/whatsapp-rpc/src/python/pyproject.toml +15 -0
  275. package/server/whatsapp-rpc/src/python/whatsapp_rpc/__init__.py +4 -0
  276. package/server/whatsapp-rpc/src/python/whatsapp_rpc/client.py +427 -0
  277. package/server/whatsapp-rpc/web/app.py +609 -0
  278. package/server/whatsapp-rpc/web/requirements.txt +6 -0
  279. package/server/whatsapp-rpc/web/rpc_client.py +427 -0
  280. package/server/whatsapp-rpc/web/static/openapi.yaml +59 -0
  281. package/server/whatsapp-rpc/web/templates/base.html +150 -0
  282. package/server/whatsapp-rpc/web/templates/contacts.html +240 -0
  283. package/server/whatsapp-rpc/web/templates/dashboard.html +320 -0
  284. package/server/whatsapp-rpc/web/templates/groups.html +328 -0
  285. package/server/whatsapp-rpc/web/templates/messages.html +465 -0
  286. package/server/whatsapp-rpc/web/templates/messaging.html +681 -0
  287. package/server/whatsapp-rpc/web/templates/send.html +259 -0
  288. package/server/whatsapp-rpc/web/templates/settings.html +459 -0
@@ -0,0 +1,1094 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { useAppStore } from '../../store/useAppStore';
3
+ import { nodeDefinitions } from '../../nodeDefinitions';
4
+ import { useWebSocket } from '../../contexts/WebSocketContext';
5
+ import { Node, Edge } from 'reactflow';
6
+ import { useDragVariable } from '../../hooks/useDragVariable';
7
+ import { useAppTheme } from '../../hooks/useAppTheme';
8
+
9
+ interface InputSectionProps {
10
+ nodeId: string;
11
+ visible?: boolean;
12
+ }
13
+
14
+ interface NodeData {
15
+ id: string;
16
+ name: string;
17
+ type: string;
18
+ icon: string;
19
+ inputData?: any;
20
+ outputSchema: Record<string, any>;
21
+ hasExecutionData: boolean;
22
+ }
23
+
24
+ // Helper to render icon (handles both image URLs and emoji/text)
25
+ const renderNodeIcon = (icon: string, size: number = 16) => {
26
+ if (icon.startsWith('data:') || icon.startsWith('http') || icon.startsWith('/')) {
27
+ return (
28
+ <img
29
+ src={icon}
30
+ alt="icon"
31
+ style={{ width: size, height: size, objectFit: 'contain' }}
32
+ />
33
+ );
34
+ }
35
+ return <span style={{ fontSize: size - 2 }}>{icon}</span>;
36
+ };
37
+
38
+ const InputSection: React.FC<InputSectionProps> = ({ nodeId, visible = true }) => {
39
+ const theme = useAppTheme();
40
+ const { currentWorkflow } = useAppStore();
41
+ const { getNodeOutput } = useWebSocket();
42
+ const [expandedNodes, setExpandedNodes] = useState<Set<string>>(new Set());
43
+ const [connectedNodes, setConnectedNodes] = useState<NodeData[]>([]);
44
+ const [loading, setLoading] = useState(false);
45
+ const { handleVariableDragStart, getTemplateVariableName } = useDragVariable(nodeId);
46
+
47
+ // Fetch connected node data with execution results from backend
48
+ useEffect(() => {
49
+ const fetchConnectedNodes = async () => {
50
+ if (!currentWorkflow || !nodeId) {
51
+ setConnectedNodes([]);
52
+ return;
53
+ }
54
+
55
+ setLoading(true);
56
+ const nodes = currentWorkflow.nodes || [];
57
+ const edges = currentWorkflow.edges || [];
58
+
59
+ // Helper to check if a handle is a config/auxiliary handle (not main data flow)
60
+ const isConfigHandle = (handle: string | null | undefined): boolean => {
61
+ if (!handle) return false;
62
+ // Config handles follow pattern: input-<type> where type is not 'main'
63
+ // Examples: input-memory, input-tools, input-model
64
+ if (handle.startsWith('input-') && handle !== 'input-main') {
65
+ return true;
66
+ }
67
+ return false;
68
+ };
69
+
70
+ // Helper to check if a node is a config/auxiliary node (connects to config handles)
71
+ const isConfigNode = (nodeType: string | undefined): boolean => {
72
+ if (!nodeType) return false;
73
+ const definition = nodeDefinitions[nodeType];
74
+ if (!definition) return false;
75
+ // Config nodes typically have 'memory' or 'tool' in their group
76
+ const groups = definition.group || [];
77
+ return groups.includes('memory') || groups.includes('tool');
78
+ };
79
+
80
+ // Get current node info
81
+ const currentNode = nodes.find((node: Node) => node.id === nodeId);
82
+ const currentNodeType = currentNode?.type;
83
+
84
+ // Collect all edges to process (direct + inherited from parent for config nodes)
85
+ interface EdgeWithLabel { edge: Edge; label?: string }
86
+ const edgesToProcess: EdgeWithLabel[] = [];
87
+
88
+ // 1. Add direct incoming edges (excluding config handle connections)
89
+ const directEdges = edges.filter((edge: Edge) => {
90
+ if (edge.target !== nodeId) return false;
91
+ if (isConfigHandle(edge.targetHandle)) return false;
92
+ return true;
93
+ });
94
+ directEdges.forEach(edge => edgesToProcess.push({ edge }));
95
+
96
+ // 2. If current node is a config node (memory, tool), inherit parent node's main inputs
97
+ if (isConfigNode(currentNodeType)) {
98
+ const outgoingEdges = edges.filter((edge: Edge) => edge.source === nodeId);
99
+
100
+ for (const outEdge of outgoingEdges) {
101
+ // Check if connected to a config handle on the target
102
+ if (isConfigHandle(outEdge.targetHandle)) {
103
+ const targetNode = nodes.find((node: Node) => node.id === outEdge.target);
104
+ if (!targetNode) continue;
105
+
106
+ const targetDef = nodeDefinitions[targetNode.type || ''];
107
+ const targetName = targetDef?.displayName || targetNode.type;
108
+
109
+ // Find nodes connected to the parent's main input (non-config handles)
110
+ const parentInputEdges = edges.filter(
111
+ (e: Edge) => e.target === targetNode.id && !isConfigHandle(e.targetHandle)
112
+ );
113
+
114
+ for (const parentEdge of parentInputEdges) {
115
+ edgesToProcess.push({ edge: parentEdge, label: `via ${targetName}` });
116
+ }
117
+ }
118
+ }
119
+ }
120
+
121
+ const nodeDataPromises = edgesToProcess.map(async ({ edge, label }) => {
122
+ const sourceNode = nodes.find((node: Node) => node.id === edge.source);
123
+ const nodeType = sourceNode?.type || '';
124
+ const nodeDef = nodeDefinitions[nodeType];
125
+
126
+ const executionData = await getNodeOutput(edge.source, 'output_0');
127
+ let inputData: any = null;
128
+ let outputSchema: Record<string, any>;
129
+ let hasExecutionData = false;
130
+
131
+ if (executionData && executionData[0] && executionData[0][0]) {
132
+ const rawData = executionData[0][0].json || executionData[0][0];
133
+ if (typeof rawData === 'object' && rawData !== null) {
134
+ inputData = rawData;
135
+ outputSchema = rawData;
136
+ hasExecutionData = true;
137
+ } else {
138
+ inputData = { value: rawData };
139
+ outputSchema = { value: typeof rawData };
140
+ hasExecutionData = true;
141
+ }
142
+ } else {
143
+ hasExecutionData = false;
144
+
145
+ if (nodeType === 'start') {
146
+ try {
147
+ const initialData = sourceNode?.data?.initialData || '{}';
148
+ outputSchema = typeof initialData === 'string' ? JSON.parse(initialData) : initialData;
149
+ } catch (e) {
150
+ outputSchema = {};
151
+ }
152
+ } else {
153
+ const sampleSchemas: Record<string, Record<string, any>> = {
154
+ location: { latitude: 'number', longitude: 'number', accuracy: 'number', provider: 'string', altitude: 'number' },
155
+ ai: { response: 'string', thinking: 'string', model: 'string', provider: 'string', finish_reason: 'string', timestamp: 'string' },
156
+ file: { fileName: 'string', fileSize: 'number' },
157
+ whatsapp: {
158
+ message_id: 'string',
159
+ sender: 'string',
160
+ sender_phone: 'string',
161
+ chat_id: 'string',
162
+ message_type: 'string',
163
+ text: 'string',
164
+ timestamp: 'string',
165
+ is_group: 'boolean',
166
+ is_from_me: 'boolean',
167
+ push_name: 'string',
168
+ media: 'object',
169
+ group_info: {
170
+ group_jid: 'string',
171
+ sender_jid: 'string',
172
+ sender_phone: 'string',
173
+ sender_name: 'string'
174
+ }
175
+ },
176
+ whatsappDb: {
177
+ // Output varies by operation - this shows chat_history output
178
+ operation: 'string',
179
+ // chat_history output
180
+ messages: [
181
+ {
182
+ text: 'string',
183
+ sender: 'string',
184
+ sender_phone: 'string',
185
+ message_type: 'string',
186
+ timestamp: 'string',
187
+ message_id: 'string',
188
+ is_from_me: 'boolean',
189
+ is_group: 'boolean',
190
+ push_name: 'string',
191
+ index: 'number'
192
+ }
193
+ ],
194
+ total: 'number',
195
+ has_more: 'boolean',
196
+ count: 'number',
197
+ chat_type: 'string',
198
+ // search_groups / list_contacts output
199
+ groups: [{ jid: 'string', name: 'string', participant_count: 'number' }],
200
+ contacts: [{ jid: 'string', phone: 'string', name: 'string', push_name: 'string' }],
201
+ // get_group_info output
202
+ participants: [{ jid: 'string', phone: 'string', name: 'string', is_admin: 'boolean' }],
203
+ // get_contact_info output
204
+ jid: 'string',
205
+ phone: 'string',
206
+ name: 'string',
207
+ push_name: 'string',
208
+ business_name: 'string',
209
+ is_business: 'boolean',
210
+ is_contact: 'boolean',
211
+ profile_pic: 'string',
212
+ timestamp: 'string'
213
+ },
214
+ webhook: {
215
+ method: 'string',
216
+ path: 'string',
217
+ headers: 'object',
218
+ query: 'object',
219
+ body: 'string',
220
+ json: 'object'
221
+ },
222
+ httpRequest: {
223
+ status: 'number',
224
+ data: 'any',
225
+ headers: 'object',
226
+ url: 'string',
227
+ method: 'string'
228
+ },
229
+ python: { output: 'any' },
230
+ javascript: { output: 'any' },
231
+ memory: {
232
+ session_id: 'string',
233
+ messages: 'array',
234
+ message_count: 'number',
235
+ memory_type: 'string',
236
+ window_size: 'number'
237
+ },
238
+ cronScheduler: {
239
+ timestamp: 'string',
240
+ iteration: 'number',
241
+ start_mode: 'string',
242
+ frequency: 'string',
243
+ timezone: 'string',
244
+ schedule: 'string',
245
+ scheduled_time: 'string',
246
+ triggered_at: 'string',
247
+ waited_seconds: 'number',
248
+ message: 'string'
249
+ },
250
+ // Android service schemas
251
+ android: {
252
+ service_id: 'string',
253
+ action: 'string',
254
+ data: 'object',
255
+ success: 'boolean'
256
+ },
257
+ batteryMonitor: {
258
+ battery_level: 'number',
259
+ is_charging: 'boolean',
260
+ temperature_celsius: 'number',
261
+ health: 'string',
262
+ voltage: 'number'
263
+ },
264
+ systemInfo: {
265
+ device_model: 'string',
266
+ android_version: 'string',
267
+ api_level: 'number',
268
+ manufacturer: 'string',
269
+ total_memory: 'number',
270
+ available_memory: 'number'
271
+ },
272
+ networkMonitor: {
273
+ connected: 'boolean',
274
+ type: 'string',
275
+ wifi_ssid: 'string',
276
+ ip_address: 'string'
277
+ },
278
+ wifiAutomation: {
279
+ wifi_enabled: 'boolean',
280
+ ssid: 'string',
281
+ ip_address: 'string',
282
+ signal_strength: 'number'
283
+ },
284
+ bluetoothAutomation: {
285
+ bluetooth_enabled: 'boolean',
286
+ paired_devices: 'array',
287
+ connected_devices: 'array'
288
+ },
289
+ audioAutomation: {
290
+ music_volume: 'number',
291
+ ring_volume: 'number',
292
+ muted: 'boolean'
293
+ },
294
+ androidLocation: {
295
+ latitude: 'number',
296
+ longitude: 'number',
297
+ accuracy: 'number',
298
+ provider: 'string',
299
+ altitude: 'number',
300
+ speed: 'number',
301
+ bearing: 'number'
302
+ },
303
+ appLauncher: {
304
+ package_name: 'string',
305
+ launched: 'boolean',
306
+ app_name: 'string'
307
+ },
308
+ appList: {
309
+ apps: 'array',
310
+ count: 'number'
311
+ },
312
+ deviceStateAutomation: {
313
+ airplane_mode: 'boolean',
314
+ screen_on: 'boolean',
315
+ brightness: 'number'
316
+ },
317
+ screenControlAutomation: {
318
+ brightness: 'number',
319
+ auto_brightness: 'boolean',
320
+ screen_timeout: 'number'
321
+ },
322
+ airplaneModeControl: {
323
+ airplane_mode_enabled: 'boolean'
324
+ },
325
+ motionDetection: {
326
+ accelerometer: { x: 'number', y: 'number', z: 'number' },
327
+ gyroscope: { x: 'number', y: 'number', z: 'number' },
328
+ motion_detected: 'boolean'
329
+ },
330
+ environmentalSensors: {
331
+ temperature: 'number',
332
+ humidity: 'number',
333
+ pressure: 'number',
334
+ light_level: 'number'
335
+ },
336
+ cameraControl: {
337
+ cameras: 'array',
338
+ photo_path: 'string',
339
+ success: 'boolean'
340
+ },
341
+ mediaControl: {
342
+ volume: 'number',
343
+ is_playing: 'boolean',
344
+ current_track: 'string'
345
+ },
346
+ chatTrigger: {
347
+ message: 'string',
348
+ timestamp: 'string',
349
+ session_id: 'string'
350
+ },
351
+ // Document processing schemas
352
+ httpScraper: {
353
+ items: 'array',
354
+ item_count: 'number',
355
+ errors: 'array'
356
+ },
357
+ fileDownloader: {
358
+ downloaded: 'number',
359
+ skipped: 'number',
360
+ failed: 'number',
361
+ files: 'array',
362
+ output_dir: 'string'
363
+ },
364
+ documentParser: {
365
+ documents: 'array',
366
+ parsed_count: 'number',
367
+ failed: 'array'
368
+ },
369
+ textChunker: {
370
+ chunks: 'array',
371
+ chunk_count: 'number'
372
+ },
373
+ embeddingGenerator: {
374
+ embeddings: 'array',
375
+ embedding_count: 'number',
376
+ dimensions: 'number',
377
+ chunks: 'array'
378
+ },
379
+ vectorStore: {
380
+ stored_count: 'number',
381
+ matches: 'array',
382
+ collection_name: 'string',
383
+ backend: 'string'
384
+ }
385
+ };
386
+
387
+ // Node type detection
388
+ const isMemory = nodeType === 'simpleMemory';
389
+ const nodeTypeLower = nodeType.toLowerCase();
390
+ const isAI = !isMemory && (nodeTypeLower.includes('chatmodel') || nodeTypeLower.includes('aiagent') || nodeTypeLower.includes('chatagent'));
391
+ const isFile = nodeType.includes('file');
392
+ const isWhatsAppDb = nodeType === 'whatsappDb';
393
+ const isWhatsApp = !isWhatsAppDb && (nodeType.includes('whatsapp') || nodeType.includes('Whatsapp'));
394
+ const isWebhook = nodeType === 'webhookTrigger';
395
+ const isHttpRequest = nodeType === 'httpRequest';
396
+ const isPython = nodeType.includes('python') || nodeType.includes('Python');
397
+ const isJavaScript = nodeType.includes('javascript') || nodeType.includes('Javascript');
398
+ const isCodeExecutor = isPython || isJavaScript;
399
+ const isCronScheduler = nodeType === 'cronScheduler';
400
+ const isChatTrigger = nodeType === 'chatTrigger';
401
+
402
+ // Document processing node detection
403
+ const documentNodeTypes = ['httpScraper', 'fileDownloader', 'documentParser', 'textChunker', 'embeddingGenerator', 'vectorStore'];
404
+ const isDocumentNode = documentNodeTypes.includes(nodeType);
405
+
406
+ // Android service node detection - check for specific Android node types
407
+ const androidNodeTypes = [
408
+ 'batteryMonitor', 'systemInfo', 'networkMonitor',
409
+ 'wifiAutomation', 'bluetoothAutomation', 'audioAutomation',
410
+ 'deviceStateAutomation', 'screenControlAutomation', 'airplaneModeControl',
411
+ 'motionDetection', 'environmentalSensors', 'cameraControl', 'mediaControl',
412
+ 'appLauncher', 'appList'
413
+ ];
414
+ const isAndroidNode = androidNodeTypes.includes(nodeType);
415
+ const isAndroidLocation = nodeType === 'location';
416
+
417
+ // Location nodes (Google Maps, not Android location)
418
+ const isLocationNode = nodeType.includes('location') && !isAndroidLocation;
419
+ const isGoogleMaps = nodeType === 'createMap' || nodeType === 'addLocations' || nodeType === 'showNearbyPlaces';
420
+
421
+ // Select appropriate schema
422
+ if (isAndroidLocation) {
423
+ outputSchema = sampleSchemas.androidLocation;
424
+ } else if (isAndroidNode && sampleSchemas[nodeType as keyof typeof sampleSchemas]) {
425
+ outputSchema = sampleSchemas[nodeType as keyof typeof sampleSchemas];
426
+ } else if (isDocumentNode && sampleSchemas[nodeType as keyof typeof sampleSchemas]) {
427
+ outputSchema = sampleSchemas[nodeType as keyof typeof sampleSchemas];
428
+ } else {
429
+ outputSchema = isLocationNode || isGoogleMaps ? sampleSchemas.location :
430
+ isMemory ? sampleSchemas.memory :
431
+ isAI ? sampleSchemas.ai :
432
+ isFile ? sampleSchemas.file :
433
+ isWhatsAppDb ? sampleSchemas.whatsappDb :
434
+ isWhatsApp ? sampleSchemas.whatsapp :
435
+ isWebhook ? sampleSchemas.webhook :
436
+ isHttpRequest ? sampleSchemas.httpRequest :
437
+ isCodeExecutor ? sampleSchemas.python :
438
+ isCronScheduler ? sampleSchemas.cronScheduler :
439
+ isChatTrigger ? sampleSchemas.chatTrigger :
440
+ { data: 'any' };
441
+ }
442
+ }
443
+ }
444
+
445
+ const baseName = sourceNode?.data?.label || nodeDef?.displayName || nodeType;
446
+ return {
447
+ id: edge.source,
448
+ name: label ? `${baseName} (${label})` : baseName,
449
+ type: nodeType,
450
+ icon: nodeDef?.icon || '',
451
+ inputData,
452
+ outputSchema,
453
+ hasExecutionData
454
+ };
455
+ });
456
+
457
+ const nodeDataResults = await Promise.all(nodeDataPromises);
458
+ setConnectedNodes(nodeDataResults);
459
+ // Auto-expand all nodes initially
460
+ setExpandedNodes(new Set(nodeDataResults.map(n => n.id)));
461
+ setLoading(false);
462
+ };
463
+
464
+ fetchConnectedNodes();
465
+ }, [nodeId, currentWorkflow, getNodeOutput]);
466
+
467
+ const toggleNode = (nodeId: string) => {
468
+ setExpandedNodes(prev => {
469
+ const next = new Set(prev);
470
+ if (next.has(nodeId)) {
471
+ next.delete(nodeId);
472
+ } else {
473
+ next.add(nodeId);
474
+ }
475
+ return next;
476
+ });
477
+ };
478
+
479
+ // Render draggable property
480
+ // NOTE: sourceNodeId is the unique node ID, used for template variable resolution
481
+ const renderDraggableProperty = (key: string, value: any, sourceNodeId: string, path: string = '', depth: number = 0, maxArrayItems: number = 3) => {
482
+ const currentPath = path ? `${path}.${key}` : key;
483
+ const isObject = typeof value === 'object' && value !== null && !Array.isArray(value);
484
+ const isArray = Array.isArray(value);
485
+
486
+ // Handle arrays - show indexed items
487
+ if (isArray && value.length > 0) {
488
+ const templateName = getTemplateVariableName(sourceNodeId);
489
+ const itemsToShow = Math.min(value.length, maxArrayItems);
490
+
491
+ return (
492
+ <div key={currentPath} style={{ marginLeft: depth > 0 ? 16 : 0, marginBottom: 8 }}>
493
+ <div style={{
494
+ fontSize: theme.fontSize.xs,
495
+ fontWeight: theme.fontWeight.medium,
496
+ color: theme.colors.textMuted,
497
+ marginBottom: 4,
498
+ display: 'flex',
499
+ alignItems: 'center',
500
+ gap: 6,
501
+ }}>
502
+ {key}
503
+ <span style={{
504
+ fontSize: '10px',
505
+ color: theme.dracula.purple,
506
+ padding: '1px 6px',
507
+ backgroundColor: theme.dracula.purple + '20',
508
+ borderRadius: theme.borderRadius.sm,
509
+ }}>
510
+ [{value.length} items]
511
+ </span>
512
+ </div>
513
+ <div>
514
+ {/* Render first N array items with their index */}
515
+ {value.slice(0, itemsToShow).map((item: any, index: number) => {
516
+ const indexedPath = `${key}[${index}]`;
517
+ const fullIndexedPath = path ? `${path}.${indexedPath}` : indexedPath;
518
+
519
+ if (typeof item === 'object' && item !== null) {
520
+ // Object item - render its properties with indexed path
521
+ return (
522
+ <div key={`${currentPath}[${index}]`} style={{
523
+ marginLeft: 8,
524
+ marginBottom: 8,
525
+ padding: theme.spacing.xs,
526
+ backgroundColor: theme.colors.backgroundElevated,
527
+ borderRadius: theme.borderRadius.sm,
528
+ border: `1px dashed ${theme.colors.border}`,
529
+ }}>
530
+ <div style={{
531
+ fontSize: theme.fontSize.xs,
532
+ fontWeight: theme.fontWeight.medium,
533
+ color: theme.dracula.cyan,
534
+ marginBottom: 4,
535
+ }}>
536
+ [{index}]
537
+ </div>
538
+ {Object.entries(item).map(([itemKey, itemValue]) => {
539
+ const itemPath = `${fullIndexedPath}.${itemKey}`;
540
+ // For nested objects within array items, render as draggable
541
+ if (typeof itemValue === 'object' && itemValue !== null && !Array.isArray(itemValue)) {
542
+ return (
543
+ <div key={itemPath} style={{ marginLeft: 8, marginBottom: 4 }}>
544
+ <div style={{
545
+ fontSize: theme.fontSize.xs,
546
+ color: theme.colors.textMuted,
547
+ marginBottom: 2,
548
+ }}>
549
+ {itemKey}:
550
+ </div>
551
+ {Object.entries(itemValue as Record<string, any>).map(([nestedKey, nestedValue]) => (
552
+ <div
553
+ key={`${itemPath}.${nestedKey}`}
554
+ draggable
555
+ onDragStart={(e) => handleVariableDragStart(e, sourceNodeId, `${itemPath}.${nestedKey}`, nestedValue)}
556
+ style={{
557
+ marginBottom: 4,
558
+ marginLeft: 8,
559
+ padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
560
+ backgroundColor: theme.colors.backgroundAlt,
561
+ border: `1px solid ${theme.colors.focus}`,
562
+ borderRadius: theme.borderRadius.sm,
563
+ cursor: 'grab',
564
+ fontSize: theme.fontSize.xs,
565
+ }}
566
+ onMouseEnter={(e) => {
567
+ e.currentTarget.style.backgroundColor = theme.colors.focusRing;
568
+ e.currentTarget.style.borderColor = theme.dracula.cyan;
569
+ }}
570
+ onMouseLeave={(e) => {
571
+ e.currentTarget.style.backgroundColor = theme.colors.backgroundAlt;
572
+ e.currentTarget.style.borderColor = theme.colors.focus;
573
+ }}
574
+ >
575
+ <span style={{ color: theme.colors.templateVariable, fontFamily: 'monospace' }}>
576
+ {`{{${templateName}.${itemPath}.${nestedKey}}}`}
577
+ </span>
578
+ </div>
579
+ ))}
580
+ </div>
581
+ );
582
+ }
583
+ // Primitive value in array item
584
+ return (
585
+ <div
586
+ key={itemPath}
587
+ draggable
588
+ onDragStart={(e) => handleVariableDragStart(e, sourceNodeId, itemPath, itemValue)}
589
+ style={{
590
+ marginBottom: 4,
591
+ marginLeft: 8,
592
+ padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
593
+ backgroundColor: theme.colors.backgroundAlt,
594
+ border: `1px solid ${theme.colors.focus}`,
595
+ borderRadius: theme.borderRadius.sm,
596
+ cursor: 'grab',
597
+ fontSize: theme.fontSize.xs,
598
+ }}
599
+ onMouseEnter={(e) => {
600
+ e.currentTarget.style.backgroundColor = theme.colors.focusRing;
601
+ e.currentTarget.style.borderColor = theme.dracula.cyan;
602
+ }}
603
+ onMouseLeave={(e) => {
604
+ e.currentTarget.style.backgroundColor = theme.colors.backgroundAlt;
605
+ e.currentTarget.style.borderColor = theme.colors.focus;
606
+ }}
607
+ >
608
+ <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
609
+ <div>
610
+ <span style={{ color: theme.colors.templateVariable, fontFamily: 'monospace' }}>
611
+ {`{{${templateName}.${itemPath}}}`}
612
+ </span>
613
+ <span style={{ color: theme.colors.textMuted, marginLeft: 8 }}>
614
+ {itemKey}: {typeof itemValue}
615
+ </span>
616
+ </div>
617
+ <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke={theme.colors.templateVariable} strokeWidth="2">
618
+ <line x1="12" y1="5" x2="12" y2="19"/>
619
+ <polyline points="19 12 12 19 5 12"/>
620
+ </svg>
621
+ </div>
622
+ </div>
623
+ );
624
+ })}
625
+ </div>
626
+ );
627
+ } else {
628
+ // Primitive array item
629
+ return (
630
+ <div
631
+ key={`${currentPath}[${index}]`}
632
+ draggable
633
+ onDragStart={(e) => handleVariableDragStart(e, sourceNodeId, fullIndexedPath, item)}
634
+ style={{
635
+ marginBottom: 4,
636
+ marginLeft: 8,
637
+ padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
638
+ backgroundColor: theme.colors.backgroundAlt,
639
+ border: `1px solid ${theme.colors.focus}`,
640
+ borderRadius: theme.borderRadius.sm,
641
+ cursor: 'grab',
642
+ fontSize: theme.fontSize.xs,
643
+ }}
644
+ onMouseEnter={(e) => {
645
+ e.currentTarget.style.backgroundColor = theme.colors.focusRing;
646
+ e.currentTarget.style.borderColor = theme.dracula.cyan;
647
+ }}
648
+ onMouseLeave={(e) => {
649
+ e.currentTarget.style.backgroundColor = theme.colors.backgroundAlt;
650
+ e.currentTarget.style.borderColor = theme.colors.focus;
651
+ }}
652
+ >
653
+ <span style={{ color: theme.colors.templateVariable, fontFamily: 'monospace' }}>
654
+ {`{{${templateName}.${fullIndexedPath}}}`}
655
+ </span>
656
+ <span style={{ color: theme.colors.textMuted, marginLeft: 8 }}>
657
+ [{index}]: {typeof item}
658
+ </span>
659
+ </div>
660
+ );
661
+ }
662
+ })}
663
+ {/* Show "and N more" if array has more items */}
664
+ {value.length > maxArrayItems && (
665
+ <div style={{
666
+ marginLeft: 8,
667
+ fontSize: theme.fontSize.xs,
668
+ color: theme.colors.textMuted,
669
+ fontStyle: 'italic',
670
+ }}>
671
+ ... and {value.length - maxArrayItems} more items
672
+ </div>
673
+ )}
674
+ </div>
675
+ </div>
676
+ );
677
+ }
678
+
679
+ // Handle empty arrays
680
+ if (isArray && value.length === 0) {
681
+ return (
682
+ <div key={currentPath} style={{ marginLeft: depth > 0 ? 16 : 0, marginBottom: 8 }}>
683
+ <div style={{
684
+ fontSize: theme.fontSize.xs,
685
+ color: theme.colors.textMuted,
686
+ }}>
687
+ {key}: <span style={{ fontStyle: 'italic' }}>empty array</span>
688
+ </div>
689
+ </div>
690
+ );
691
+ }
692
+
693
+ // Handle objects
694
+ if (isObject) {
695
+ return (
696
+ <div key={currentPath} style={{ marginLeft: depth > 0 ? 16 : 0, marginBottom: 8 }}>
697
+ <div style={{
698
+ fontSize: theme.fontSize.xs,
699
+ fontWeight: theme.fontWeight.medium,
700
+ color: theme.colors.textMuted,
701
+ marginBottom: 4,
702
+ }}>
703
+ {key}:
704
+ </div>
705
+ <div>
706
+ {Object.entries(value as Record<string, any>).map(([subKey, subValue]) =>
707
+ renderDraggableProperty(subKey, subValue, sourceNodeId, currentPath, depth + 1)
708
+ )}
709
+ </div>
710
+ </div>
711
+ );
712
+ }
713
+
714
+ const templateName = getTemplateVariableName(sourceNodeId);
715
+ return (
716
+ <div
717
+ key={currentPath}
718
+ draggable
719
+ onDragStart={(e) => handleVariableDragStart(e, sourceNodeId, currentPath, value)}
720
+ style={{
721
+ marginBottom: 8,
722
+ marginLeft: depth > 0 ? 16 : 0,
723
+ padding: theme.spacing.sm,
724
+ backgroundColor: theme.colors.backgroundAlt,
725
+ border: `1px solid ${theme.colors.focus}`,
726
+ borderRadius: theme.borderRadius.md,
727
+ cursor: 'grab',
728
+ transition: theme.transitions.fast,
729
+ }}
730
+ onMouseEnter={(e) => {
731
+ e.currentTarget.style.backgroundColor = theme.colors.focusRing;
732
+ e.currentTarget.style.borderColor = theme.dracula.cyan;
733
+ }}
734
+ onMouseLeave={(e) => {
735
+ e.currentTarget.style.backgroundColor = theme.colors.backgroundAlt;
736
+ e.currentTarget.style.borderColor = theme.colors.focus;
737
+ }}
738
+ >
739
+ <div style={{
740
+ display: 'flex',
741
+ alignItems: 'center',
742
+ justifyContent: 'space-between',
743
+ }}>
744
+ <div>
745
+ <div style={{
746
+ fontFamily: 'Monaco, Menlo, "Ubuntu Mono", monospace',
747
+ fontSize: theme.fontSize.sm,
748
+ fontWeight: theme.fontWeight.medium,
749
+ color: theme.colors.templateVariable,
750
+ marginBottom: 2,
751
+ }}>
752
+ {`{{${templateName}.${currentPath}}}`}
753
+ </div>
754
+ <div style={{
755
+ fontSize: theme.fontSize.xs,
756
+ color: theme.colors.textSecondary,
757
+ }}>
758
+ {key}: {typeof value}
759
+ </div>
760
+ </div>
761
+ {/* Drag icon */}
762
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke={theme.colors.templateVariable} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
763
+ <line x1="12" y1="5" x2="12" y2="19"/>
764
+ <polyline points="19 12 12 19 5 12"/>
765
+ </svg>
766
+ </div>
767
+ </div>
768
+ );
769
+ };
770
+
771
+ if (!visible) {
772
+ return null;
773
+ }
774
+
775
+ // Loading state
776
+ if (loading) {
777
+ return (
778
+ <div style={{
779
+ width: '100%',
780
+ height: '100%',
781
+ backgroundColor: theme.colors.backgroundPanel,
782
+ display: 'flex',
783
+ flexDirection: 'column',
784
+ alignItems: 'center',
785
+ justifyContent: 'center',
786
+ padding: theme.spacing.xxl,
787
+ }}>
788
+ <div style={{
789
+ width: 32,
790
+ height: 32,
791
+ border: `3px solid ${theme.colors.border}`,
792
+ borderTopColor: theme.dracula.cyan,
793
+ borderRadius: '50%',
794
+ animation: 'spin 1s linear infinite',
795
+ marginBottom: theme.spacing.lg,
796
+ }} />
797
+ <style>
798
+ {`@keyframes spin { to { transform: rotate(360deg); } }`}
799
+ </style>
800
+ <div style={{
801
+ fontSize: theme.fontSize.sm,
802
+ color: theme.colors.textSecondary,
803
+ }}>
804
+ Loading input data...
805
+ </div>
806
+ </div>
807
+ );
808
+ }
809
+
810
+ // Empty state
811
+ if (connectedNodes.length === 0) {
812
+ return (
813
+ <div style={{
814
+ width: '100%',
815
+ height: '100%',
816
+ backgroundColor: theme.colors.backgroundPanel,
817
+ display: 'flex',
818
+ flexDirection: 'column',
819
+ alignItems: 'center',
820
+ justifyContent: 'center',
821
+ padding: theme.spacing.xxl,
822
+ }}>
823
+ {/* Link icon */}
824
+ <svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke={theme.colors.textMuted} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ marginBottom: theme.spacing.lg }}>
825
+ <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/>
826
+ <path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>
827
+ </svg>
828
+ <div style={{
829
+ fontSize: theme.fontSize.base,
830
+ fontWeight: theme.fontWeight.medium,
831
+ color: theme.colors.textSecondary,
832
+ marginBottom: theme.spacing.xs,
833
+ }}>
834
+ No connected inputs
835
+ </div>
836
+ <div style={{
837
+ fontSize: theme.fontSize.sm,
838
+ color: theme.colors.textMuted,
839
+ textAlign: 'center',
840
+ }}>
841
+ Connect nodes to see input data and available variables
842
+ </div>
843
+ </div>
844
+ );
845
+ }
846
+
847
+ return (
848
+ <div style={{
849
+ width: '100%',
850
+ height: '100%',
851
+ backgroundColor: theme.colors.backgroundPanel,
852
+ display: 'flex',
853
+ flexDirection: 'column',
854
+ overflow: 'hidden',
855
+ }}>
856
+ {/* Header */}
857
+ <div style={{
858
+ padding: `${theme.spacing.md} ${theme.spacing.lg}`,
859
+ borderBottom: `1px solid ${theme.colors.border}`,
860
+ backgroundColor: theme.colors.background,
861
+ display: 'flex',
862
+ alignItems: 'center',
863
+ gap: theme.spacing.sm,
864
+ flexShrink: 0,
865
+ }}>
866
+ {/* Database icon */}
867
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke={theme.colors.textSecondary} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
868
+ <ellipse cx="12" cy="5" rx="9" ry="3"/>
869
+ <path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/>
870
+ <path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/>
871
+ </svg>
872
+ <span style={{
873
+ fontSize: theme.fontSize.sm,
874
+ fontWeight: theme.fontWeight.semibold,
875
+ color: theme.colors.text,
876
+ }}>
877
+ Input Data & Variables
878
+ </span>
879
+ <span style={{
880
+ fontSize: theme.fontSize.xs,
881
+ fontWeight: theme.fontWeight.medium,
882
+ color: theme.dracula.cyan,
883
+ padding: `2px ${theme.spacing.sm}`,
884
+ backgroundColor: theme.dracula.cyan + '20',
885
+ borderRadius: theme.borderRadius.sm,
886
+ }}>
887
+ {connectedNodes.length}
888
+ </span>
889
+ </div>
890
+
891
+ {/* Content */}
892
+ <div style={{
893
+ flex: 1,
894
+ overflow: 'auto',
895
+ padding: theme.spacing.md,
896
+ }}>
897
+ {connectedNodes.map((node) => {
898
+ const isExpanded = expandedNodes.has(node.id);
899
+
900
+ return (
901
+ <div key={node.id} style={{
902
+ marginBottom: theme.spacing.md,
903
+ backgroundColor: theme.colors.background,
904
+ border: `1px solid ${theme.colors.border}`,
905
+ borderLeft: `3px solid ${node.hasExecutionData ? theme.dracula.green : theme.dracula.orange}`,
906
+ borderRadius: theme.borderRadius.md,
907
+ overflow: 'hidden',
908
+ }}>
909
+ {/* Node Header */}
910
+ <div
911
+ onClick={() => toggleNode(node.id)}
912
+ style={{
913
+ padding: `${theme.spacing.sm} ${theme.spacing.md}`,
914
+ backgroundColor: theme.colors.backgroundAlt,
915
+ cursor: 'pointer',
916
+ display: 'flex',
917
+ alignItems: 'center',
918
+ justifyContent: 'space-between',
919
+ transition: theme.transitions.fast,
920
+ }}
921
+ >
922
+ <div style={{ display: 'flex', alignItems: 'center', gap: theme.spacing.sm }}>
923
+ {renderNodeIcon(node.icon, 18)}
924
+ <span style={{
925
+ fontSize: theme.fontSize.sm,
926
+ fontWeight: theme.fontWeight.semibold,
927
+ color: theme.colors.text,
928
+ }}>
929
+ {node.name}
930
+ </span>
931
+ </div>
932
+ <div style={{ display: 'flex', alignItems: 'center', gap: theme.spacing.sm }}>
933
+ {/* Status badge */}
934
+ <span style={{
935
+ fontSize: '10px',
936
+ fontWeight: theme.fontWeight.medium,
937
+ color: node.hasExecutionData ? theme.dracula.green : theme.dracula.orange,
938
+ padding: `2px ${theme.spacing.xs}`,
939
+ backgroundColor: node.hasExecutionData ? theme.dracula.green + '20' : theme.dracula.orange + '20',
940
+ borderRadius: theme.borderRadius.sm,
941
+ display: 'flex',
942
+ alignItems: 'center',
943
+ gap: 4,
944
+ }}>
945
+ {node.hasExecutionData ? (
946
+ <svg width="10" height="10" viewBox="0 0 24 24" fill={theme.dracula.green} stroke="none">
947
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
948
+ </svg>
949
+ ) : (
950
+ <svg width="10" height="10" viewBox="0 0 24 24" fill={theme.dracula.orange} stroke="none">
951
+ <path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/>
952
+ </svg>
953
+ )}
954
+ {node.hasExecutionData ? 'LIVE' : 'SCHEMA'}
955
+ </span>
956
+ {/* Expand arrow */}
957
+ <svg
958
+ width="12"
959
+ height="12"
960
+ viewBox="0 0 24 24"
961
+ fill="none"
962
+ stroke={theme.colors.textSecondary}
963
+ strokeWidth="2"
964
+ strokeLinecap="round"
965
+ strokeLinejoin="round"
966
+ style={{
967
+ transform: isExpanded ? 'rotate(180deg)' : 'rotate(0deg)',
968
+ transition: 'transform 0.2s ease',
969
+ }}
970
+ >
971
+ <polyline points="6 9 12 15 18 9"/>
972
+ </svg>
973
+ </div>
974
+ </div>
975
+
976
+ {/* Node Content */}
977
+ {isExpanded && (
978
+ <div style={{
979
+ padding: theme.spacing.md,
980
+ borderTop: `1px solid ${theme.colors.border}`,
981
+ }}>
982
+ {/* Schema info banner */}
983
+ {!node.hasExecutionData && (
984
+ <div style={{
985
+ display: 'flex',
986
+ alignItems: 'center',
987
+ gap: theme.spacing.sm,
988
+ padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
989
+ marginBottom: theme.spacing.md,
990
+ backgroundColor: theme.dracula.cyan + '10',
991
+ border: `1px solid ${theme.dracula.cyan}40`,
992
+ borderRadius: theme.borderRadius.sm,
993
+ fontSize: theme.fontSize.xs,
994
+ color: theme.dracula.cyan,
995
+ }}>
996
+ <svg width="12" height="12" viewBox="0 0 24 24" fill={theme.dracula.cyan} stroke="none">
997
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>
998
+ </svg>
999
+ Schema view - Execute this node to see actual input data
1000
+ </div>
1001
+ )}
1002
+
1003
+ {/* Live data preview */}
1004
+ {node.hasExecutionData && (
1005
+ <div style={{ marginBottom: theme.spacing.md }}>
1006
+ <div style={{
1007
+ fontSize: theme.fontSize.xs,
1008
+ fontWeight: theme.fontWeight.medium,
1009
+ color: theme.colors.textMuted,
1010
+ marginBottom: theme.spacing.xs,
1011
+ textTransform: 'uppercase',
1012
+ letterSpacing: '0.05em',
1013
+ }}>
1014
+ Received Data
1015
+ </div>
1016
+ <pre style={{
1017
+ margin: 0,
1018
+ padding: theme.spacing.sm,
1019
+ fontSize: theme.fontSize.xs,
1020
+ fontFamily: 'Monaco, Menlo, "Ubuntu Mono", monospace',
1021
+ backgroundColor: theme.colors.backgroundElevated,
1022
+ border: `1px solid ${theme.colors.border}`,
1023
+ borderRadius: theme.borderRadius.sm,
1024
+ overflow: 'auto',
1025
+ maxHeight: '120px',
1026
+ whiteSpace: 'pre-wrap',
1027
+ wordBreak: 'break-word',
1028
+ color: theme.dracula.foreground,
1029
+ }}>
1030
+ {JSON.stringify(node.inputData, null, 2)}
1031
+ </pre>
1032
+ </div>
1033
+ )}
1034
+
1035
+ {/* Draggable variables */}
1036
+ <div style={{
1037
+ fontSize: theme.fontSize.xs,
1038
+ fontWeight: theme.fontWeight.medium,
1039
+ color: theme.colors.textMuted,
1040
+ marginBottom: theme.spacing.sm,
1041
+ textTransform: 'uppercase',
1042
+ letterSpacing: '0.05em',
1043
+ }}>
1044
+ Drag Variables to Parameters
1045
+ </div>
1046
+ <div>
1047
+ {typeof node.outputSchema === 'object' && node.outputSchema !== null
1048
+ ? Object.entries(node.outputSchema).map(([key, value]) =>
1049
+ renderDraggableProperty(key, value, node.id)
1050
+ )
1051
+ : (
1052
+ <div style={{
1053
+ fontSize: theme.fontSize.sm,
1054
+ color: theme.colors.textMuted,
1055
+ fontStyle: 'italic',
1056
+ }}>
1057
+ No variables available
1058
+ </div>
1059
+ )
1060
+ }
1061
+ </div>
1062
+ </div>
1063
+ )}
1064
+ </div>
1065
+ );
1066
+ })}
1067
+ </div>
1068
+
1069
+ {/* Footer hint */}
1070
+ <div style={{
1071
+ padding: `${theme.spacing.sm} ${theme.spacing.lg}`,
1072
+ borderTop: `1px solid ${theme.colors.border}`,
1073
+ backgroundColor: theme.colors.background,
1074
+ fontSize: theme.fontSize.xs,
1075
+ color: theme.colors.textMuted,
1076
+ textAlign: 'center',
1077
+ flexShrink: 0,
1078
+ display: 'flex',
1079
+ alignItems: 'center',
1080
+ justifyContent: 'center',
1081
+ gap: theme.spacing.xs,
1082
+ }}>
1083
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
1084
+ <circle cx="12" cy="12" r="10"/>
1085
+ <line x1="12" y1="16" x2="12" y2="12"/>
1086
+ <line x1="12" y1="8" x2="12.01" y2="8"/>
1087
+ </svg>
1088
+ Drag variables into parameter fields to use them
1089
+ </div>
1090
+ </div>
1091
+ );
1092
+ };
1093
+
1094
+ export default InputSection;