@invect/ui 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 (419) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +77 -0
  3. package/dist/Invect-CWpIwZ5F.js +92738 -0
  4. package/dist/Invect.d.ts +25 -0
  5. package/dist/InvectShell.d.ts +14 -0
  6. package/dist/api/agent-tools.api.d.ts +1 -0
  7. package/dist/api/client.d.ts +207 -0
  8. package/dist/api/credentials.api.d.ts +47 -0
  9. package/dist/api/executions.api.d.ts +43 -0
  10. package/dist/api/flows.api.d.ts +100 -0
  11. package/dist/api/index.d.ts +9 -0
  12. package/dist/api/node-data.api.d.ts +66 -0
  13. package/dist/api/query-keys.d.ts +22 -0
  14. package/dist/api/triggers.api.d.ts +44 -0
  15. package/dist/api/types.d.ts +147 -0
  16. package/dist/api/use-flow-run-stream.d.ts +12 -0
  17. package/dist/assets/invect-branding.d.ts +4 -0
  18. package/dist/assets/provider-icons/index.d.ts +8 -0
  19. package/dist/babel-C9OtljFZ.js +9721 -0
  20. package/dist/components/PageLayout.d.ts +17 -0
  21. package/dist/components/chat/ChatInput.d.ts +17 -0
  22. package/dist/components/chat/ChatMessageList.d.ts +14 -0
  23. package/dist/components/chat/ChatModelSelector.d.ts +11 -0
  24. package/dist/components/chat/ChatPanel.d.ts +19 -0
  25. package/dist/components/chat/ChatPromptOverlay.d.ts +13 -0
  26. package/dist/components/chat/ChatProviderSelector.d.ts +9 -0
  27. package/dist/components/chat/ChatSettingsPanel.d.ts +11 -0
  28. package/dist/components/chat/InlineCredentialSetup.d.ts +9 -0
  29. package/dist/components/chat/MarkdownRenderer.d.ts +7 -0
  30. package/dist/components/chat/chat-memory.d.ts +21 -0
  31. package/dist/components/chat/chat.store.d.ts +416 -0
  32. package/dist/components/chat/index.d.ts +5 -0
  33. package/dist/components/chat/use-chat.d.ts +28 -0
  34. package/dist/components/credentials/CreateCredentialModal.d.ts +13 -0
  35. package/dist/components/credentials/CredentialDetailDialog.d.ts +17 -0
  36. package/dist/components/credentials/EditCredentialModal.d.ts +11 -0
  37. package/dist/components/credentials/OAuth2ConnectButton.d.ts +38 -0
  38. package/dist/components/credentials/OAuth2ProviderSelector.d.ts +15 -0
  39. package/dist/components/credentials/credential-utils.d.ts +12 -0
  40. package/dist/components/credentials/index.d.ts +9 -0
  41. package/dist/components/dashboard/FailedRunsAlert.d.ts +3 -0
  42. package/dist/components/dashboard/FlowCard.d.ts +7 -0
  43. package/dist/components/dashboard/RecentActivityTable.d.ts +9 -0
  44. package/dist/components/dashboard/StatCard.d.ts +10 -0
  45. package/dist/components/dashboard/index.d.ts +5 -0
  46. package/dist/components/dashboard/status-helpers.d.ts +5 -0
  47. package/dist/components/flow-editor/ActionsSidebar.d.ts +2 -0
  48. package/dist/components/flow-editor/FlowEditor.d.ts +21 -0
  49. package/dist/components/flow-editor/FlowHeader.d.ts +9 -0
  50. package/dist/components/flow-editor/FlowLayout.d.ts +24 -0
  51. package/dist/components/flow-editor/ModeSwitcher.d.ts +7 -0
  52. package/dist/components/flow-editor/NodeSidebar.d.ts +24 -0
  53. package/dist/components/flow-editor/RunControls.d.ts +12 -0
  54. package/dist/components/flow-editor/ToolConfigPanel.d.ts +16 -0
  55. package/dist/components/flow-editor/ValidationPanel.d.ts +5 -0
  56. package/dist/components/flow-editor/flow-editor.store.d.ts +1 -0
  57. package/dist/components/flow-editor/index.d.ts +6 -0
  58. package/dist/components/flow-editor/inline-edit.d.ts +10 -0
  59. package/dist/components/flow-editor/node-config-panel/ConfigFieldWithTemplate.d.ts +26 -0
  60. package/dist/components/flow-editor/node-config-panel/CredentialCombobox.d.ts +21 -0
  61. package/dist/components/flow-editor/node-config-panel/CredentialsSection.d.ts +19 -0
  62. package/dist/components/flow-editor/node-config-panel/DroppableInput.d.ts +20 -0
  63. package/dist/components/flow-editor/node-config-panel/DynamicSelectField.d.ts +22 -0
  64. package/dist/components/flow-editor/node-config-panel/JsonPreviewPanel.d.ts +25 -0
  65. package/dist/components/flow-editor/node-config-panel/NodeConfigPanel.d.ts +14 -0
  66. package/dist/components/flow-editor/node-config-panel/NodeConfigPanelHeader.d.ts +15 -0
  67. package/dist/components/flow-editor/node-config-panel/ParametersSection.d.ts +16 -0
  68. package/dist/components/flow-editor/node-config-panel/SearchableSelectField.d.ts +17 -0
  69. package/dist/components/flow-editor/node-config-panel/SwitchCasesField.d.ts +18 -0
  70. package/dist/components/flow-editor/node-config-panel/hooks/index.d.ts +2 -0
  71. package/dist/components/flow-editor/node-config-panel/hooks/use-node-config-panel-state.d.ts +24 -0
  72. package/dist/components/flow-editor/node-config-panel/hooks/use-node-execution.d.ts +46 -0
  73. package/dist/components/flow-editor/node-config-panel/hooks/use-upstream-slots.d.ts +16 -0
  74. package/dist/components/flow-editor/node-config-panel/panels/AgentToolsPanel.d.ts +18 -0
  75. package/dist/components/flow-editor/node-config-panel/panels/ConfigurationPanel.d.ts +49 -0
  76. package/dist/components/flow-editor/node-config-panel/panels/DataMapperPane.d.ts +40 -0
  77. package/dist/components/flow-editor/node-config-panel/panels/InputPanel.d.ts +49 -0
  78. package/dist/components/flow-editor/node-config-panel/panels/OutputPanel.d.ts +7 -0
  79. package/dist/components/flow-editor/node-config-panel/panels/index.d.ts +4 -0
  80. package/dist/components/flow-editor/node-config-panel/types.d.ts +19 -0
  81. package/dist/components/flow-editor/node-config-panel/use-node-config-panel-store.d.ts +49 -0
  82. package/dist/components/flow-editor/node-config-panel/use-node-config-state.d.ts +26 -0
  83. package/dist/components/flow-editor/node-config-panel/use-run-node.d.ts +16 -0
  84. package/dist/components/flow-editor/node-config-panel/utils.d.ts +9 -0
  85. package/dist/components/flow-editor/serialize-to-sdk.d.ts +20 -0
  86. package/dist/components/flow-editor/toolbar-context.d.ts +2 -0
  87. package/dist/components/flow-editor/use-copy-paste.d.ts +7 -0
  88. package/dist/components/flow-editor/use-copy-paste.types.d.ts +38 -0
  89. package/dist/components/flow-editor/use-flow-editor.d.ts +44 -0
  90. package/dist/components/flow-runs-table/FlowRunsTable.d.ts +6 -0
  91. package/dist/components/flow-runs-table/index.d.ts +1 -0
  92. package/dist/components/flow-viewer/FlowRunsView.d.ts +7 -0
  93. package/dist/components/flow-viewer/FlowStatusView.d.ts +21 -0
  94. package/dist/components/flow-viewer/RunSelector.d.ts +13 -0
  95. package/dist/components/flow-viewer/RunsSidebar.d.ts +14 -0
  96. package/dist/components/flow-viewer/agent-tool-executions-list.d.ts +7 -0
  97. package/dist/components/flow-viewer/index.d.ts +1 -0
  98. package/dist/components/flow-viewer/logs-panel.d.ts +18 -0
  99. package/dist/components/flow-viewer/use-execution-log-data.d.ts +113 -0
  100. package/dist/components/graph/BatchFlowEdge.d.ts +33 -0
  101. package/dist/components/graph/LayoutSelector.d.ts +9 -0
  102. package/dist/components/graph/index.d.ts +47 -0
  103. package/dist/components/graph/styleUtils.d.ts +124 -0
  104. package/dist/components/nodes/AgentConfigPanel.d.ts +24 -0
  105. package/dist/components/nodes/AgentNode.d.ts +8 -0
  106. package/dist/components/nodes/AgentToolsBox.d.ts +41 -0
  107. package/dist/components/nodes/NodeAppendix.d.ts +19 -0
  108. package/dist/components/nodes/NodeStatusIndicator.d.ts +30 -0
  109. package/dist/components/nodes/NodeViewContext.d.ts +18 -0
  110. package/dist/components/nodes/ToolParamField.d.ts +28 -0
  111. package/dist/components/nodes/ToolSelectorModal.d.ts +80 -0
  112. package/dist/components/nodes/ToolSelectorParts.d.ts +30 -0
  113. package/dist/components/nodes/UniversalNode.d.ts +2 -0
  114. package/dist/components/nodes/createContextAwareNodes.d.ts +6 -0
  115. package/dist/components/nodes/index.d.ts +22 -0
  116. package/dist/components/nodes/nodeRegistry.d.ts +13 -0
  117. package/dist/components/nodes/withNodeContext.d.ts +7 -0
  118. package/dist/components/shared/InvectLoader.d.ts +8 -0
  119. package/dist/components/shared/InvectLogo.d.ts +9 -0
  120. package/dist/components/shared/ProviderIcon.d.ts +23 -0
  121. package/dist/components/side-menu/side-menu.d.ts +4 -0
  122. package/dist/components/sidebar/BaseSidebar.d.ts +17 -0
  123. package/dist/components/sidebar/index.d.ts +1 -0
  124. package/dist/components/triggers/CronPreview.d.ts +12 -0
  125. package/dist/components/triggers/index.d.ts +1 -0
  126. package/dist/components/ui/alert-dialog.d.ts +18 -0
  127. package/dist/components/ui/badge.d.ts +9 -0
  128. package/dist/components/ui/button.d.ts +13 -0
  129. package/dist/components/ui/card.d.ts +9 -0
  130. package/dist/components/ui/codemirror-js-editor.d.ts +25 -0
  131. package/dist/components/ui/codemirror-json-editor.d.ts +18 -0
  132. package/dist/components/ui/codemirror-nunjucks-editor.d.ts +13 -0
  133. package/dist/components/ui/codemirror-vscode-theme.d.ts +24 -0
  134. package/dist/components/ui/collapsible.d.ts +6 -0
  135. package/dist/components/ui/command.d.ts +18 -0
  136. package/dist/components/ui/dialog.d.ts +18 -0
  137. package/dist/components/ui/dropdown-menu.d.ts +25 -0
  138. package/dist/components/ui/empty-state.d.ts +21 -0
  139. package/dist/components/ui/input.d.ts +3 -0
  140. package/dist/components/ui/label.d.ts +4 -0
  141. package/dist/components/ui/popover.d.ts +10 -0
  142. package/dist/components/ui/resizable.d.ts +8 -0
  143. package/dist/components/ui/scroll-area.d.ts +5 -0
  144. package/dist/components/ui/select.d.ts +18 -0
  145. package/dist/components/ui/separator.d.ts +4 -0
  146. package/dist/components/ui/slider.d.ts +4 -0
  147. package/dist/components/ui/switch.d.ts +3 -0
  148. package/dist/components/ui/table.d.ts +10 -0
  149. package/dist/components/ui/textarea.d.ts +3 -0
  150. package/dist/components/ui/tooltip.d.ts +7 -0
  151. package/dist/components/ui/tree-view.d.ts +107 -0
  152. package/dist/contexts/AgentToolCallbacksContext.d.ts +23 -0
  153. package/dist/contexts/ApiContext.d.ts +11 -0
  154. package/dist/contexts/FlowDataContext.d.ts +9 -0
  155. package/dist/contexts/NodeRegistryContext.d.ts +14 -0
  156. package/dist/contexts/PluginRegistryContext.d.ts +39 -0
  157. package/dist/contexts/ThemeProvider.d.ts +18 -0
  158. package/dist/contexts/ValidationContext.d.ts +22 -0
  159. package/dist/demo/DemoInvect.d.ts +11 -0
  160. package/dist/demo/FlowViewer.d.ts +31 -0
  161. package/dist/demo/demo-api-client.d.ts +33 -0
  162. package/dist/demo/index.d.ts +6 -0
  163. package/dist/demo/sample-data.d.ts +1538 -0
  164. package/dist/demo.d.ts +2 -0
  165. package/dist/demo.js +2774 -0
  166. package/dist/estree-ClbRfS-1.js +7076 -0
  167. package/dist/fonts/geist-cyrillic-wght-normal.woff2 +0 -0
  168. package/dist/fonts/geist-latin-ext-wght-normal.woff2 +0 -0
  169. package/dist/fonts/geist-latin-wght-normal.woff2 +0 -0
  170. package/dist/fonts/iosevka-latin-400-normal.woff2 +0 -0
  171. package/dist/hooks/index.d.ts +1 -0
  172. package/dist/hooks/use-document-title.d.ts +1 -0
  173. package/dist/hooks/use-flow-data.d.ts +22 -0
  174. package/dist/hooks/use-invect-portal-class.d.ts +21 -0
  175. package/dist/hooks/useFlowEditorStore.d.ts +1 -0
  176. package/dist/index.css +3 -0
  177. package/dist/index.d.ts +22 -0
  178. package/dist/index.js +717 -0
  179. package/dist/lib/utils.d.ts +2 -0
  180. package/dist/prettier.d.ts +13 -0
  181. package/dist/routes/all-flow-runs.d.ts +5 -0
  182. package/dist/routes/credentials.d.ts +5 -0
  183. package/dist/routes/flow-route-layout.d.ts +19 -0
  184. package/dist/routes/flow-runs.d.ts +5 -0
  185. package/dist/routes/flow.d.ts +5 -0
  186. package/dist/routes/home.d.ts +5 -0
  187. package/dist/services/index.d.ts +1 -0
  188. package/dist/standalone-C3Df7W52.js +3463 -0
  189. package/dist/stores/executionViewStore.d.ts +64 -0
  190. package/dist/stores/flow-editor.store.d.ts +137 -0
  191. package/dist/stores/flowEditorStore.d.ts +1 -0
  192. package/dist/stores/index.d.ts +2 -0
  193. package/dist/stores/uiStore.d.ts +45 -0
  194. package/dist/types/agent-tools.types.d.ts +53 -0
  195. package/dist/types/index.d.ts +2 -0
  196. package/dist/types/node-definition.types.d.ts +85 -0
  197. package/dist/types/plugin.types.d.ts +100 -0
  198. package/dist/utils/credentialBranding.d.ts +8 -0
  199. package/dist/utils/credentialFiltering.d.ts +20 -0
  200. package/dist/utils/flowTransformations.d.ts +16 -0
  201. package/dist/utils/layoutUtils.d.ts +23 -0
  202. package/dist/utils/nodeReferenceUtils.d.ts +37 -0
  203. package/dist/vendor.d.ts +5 -0
  204. package/package.json +130 -0
  205. package/src/.DS_Store +0 -0
  206. package/src/Invect.tsx +229 -0
  207. package/src/InvectShell.tsx +55 -0
  208. package/src/api/agent-tools.api.ts +23 -0
  209. package/src/api/client.ts +899 -0
  210. package/src/api/credentials.api.ts +197 -0
  211. package/src/api/executions.api.ts +228 -0
  212. package/src/api/flows.api.ts +195 -0
  213. package/src/api/index.ts +17 -0
  214. package/src/api/node-data.api.ts +167 -0
  215. package/src/api/query-keys.ts +44 -0
  216. package/src/api/triggers.api.ts +120 -0
  217. package/src/api/types.ts +212 -0
  218. package/src/api/use-flow-run-stream.ts +206 -0
  219. package/src/app.css +560 -0
  220. package/src/assets/.DS_Store +0 -0
  221. package/src/assets/favicon.ico +0 -0
  222. package/src/assets/fonts/geist-cyrillic-wght-normal.woff2 +0 -0
  223. package/src/assets/fonts/geist-latin-ext-wght-normal.woff2 +0 -0
  224. package/src/assets/fonts/geist-latin-wght-normal.woff2 +0 -0
  225. package/src/assets/fonts/iosevka-latin-400-normal.woff2 +0 -0
  226. package/src/assets/invect-branding.ts +51 -0
  227. package/src/assets/provider-icons/anthropic.svg +1 -0
  228. package/src/assets/provider-icons/anthropic_light.svg +1 -0
  229. package/src/assets/provider-icons/github.svg +1 -0
  230. package/src/assets/provider-icons/github_light.svg +1 -0
  231. package/src/assets/provider-icons/gmail.svg +1 -0
  232. package/src/assets/provider-icons/google_calendar.svg +1 -0
  233. package/src/assets/provider-icons/google_docs.svg +1 -0
  234. package/src/assets/provider-icons/google_drive.svg +1 -0
  235. package/src/assets/provider-icons/google_sheets.svg +1 -0
  236. package/src/assets/provider-icons/index.ts +55 -0
  237. package/src/assets/provider-icons/linear.svg +1 -0
  238. package/src/assets/provider-icons/openai.svg +1 -0
  239. package/src/assets/provider-icons/postgres.svg +1 -0
  240. package/src/assets/provider-icons/slack.svg +1 -0
  241. package/src/assets/small-loader-dark.svg +22 -0
  242. package/src/assets/small-loader-light.svg +22 -0
  243. package/src/assets/small.svg +7 -0
  244. package/src/components/.DS_Store +0 -0
  245. package/src/components/PageLayout.tsx +55 -0
  246. package/src/components/chat/ChatInput.tsx +115 -0
  247. package/src/components/chat/ChatMessageList.tsx +788 -0
  248. package/src/components/chat/ChatModelSelector.tsx +208 -0
  249. package/src/components/chat/ChatPanel.tsx +243 -0
  250. package/src/components/chat/ChatPromptOverlay.tsx +150 -0
  251. package/src/components/chat/ChatProviderSelector.tsx +135 -0
  252. package/src/components/chat/ChatSettingsPanel.tsx +277 -0
  253. package/src/components/chat/InlineCredentialSetup.tsx +343 -0
  254. package/src/components/chat/MarkdownRenderer.tsx +140 -0
  255. package/src/components/chat/chat-memory.ts +88 -0
  256. package/src/components/chat/chat.store.ts +479 -0
  257. package/src/components/chat/index.ts +5 -0
  258. package/src/components/chat/use-chat.ts +473 -0
  259. package/src/components/credentials/CreateCredentialModal.tsx +609 -0
  260. package/src/components/credentials/CredentialDetailDialog.tsx +882 -0
  261. package/src/components/credentials/EditCredentialModal.tsx +399 -0
  262. package/src/components/credentials/OAuth2ConnectButton.tsx +288 -0
  263. package/src/components/credentials/OAuth2ProviderSelector.tsx +360 -0
  264. package/src/components/credentials/credential-utils.ts +99 -0
  265. package/src/components/credentials/index.ts +10 -0
  266. package/src/components/dashboard/FailedRunsAlert.tsx +67 -0
  267. package/src/components/dashboard/FlowCard.tsx +64 -0
  268. package/src/components/dashboard/RecentActivityTable.tsx +92 -0
  269. package/src/components/dashboard/StatCard.tsx +32 -0
  270. package/src/components/dashboard/index.ts +5 -0
  271. package/src/components/dashboard/status-helpers.tsx +102 -0
  272. package/src/components/flow-editor/ActionsSidebar.tsx +503 -0
  273. package/src/components/flow-editor/FlowEditor.tsx +1002 -0
  274. package/src/components/flow-editor/FlowHeader.tsx +87 -0
  275. package/src/components/flow-editor/FlowLayout.tsx +117 -0
  276. package/src/components/flow-editor/ModeSwitcher.tsx +49 -0
  277. package/src/components/flow-editor/NodeSidebar.tsx +343 -0
  278. package/src/components/flow-editor/RunControls.tsx +109 -0
  279. package/src/components/flow-editor/ToolConfigPanel.tsx +434 -0
  280. package/src/components/flow-editor/ValidationPanel.tsx +167 -0
  281. package/src/components/flow-editor/flow-editor.store.ts +2 -0
  282. package/src/components/flow-editor/index.ts +6 -0
  283. package/src/components/flow-editor/inline-edit.tsx +111 -0
  284. package/src/components/flow-editor/node-config-panel/ConfigFieldWithTemplate.tsx +334 -0
  285. package/src/components/flow-editor/node-config-panel/CredentialCombobox.tsx +217 -0
  286. package/src/components/flow-editor/node-config-panel/CredentialsSection.tsx +154 -0
  287. package/src/components/flow-editor/node-config-panel/DroppableInput.tsx +45 -0
  288. package/src/components/flow-editor/node-config-panel/DynamicSelectField.tsx +223 -0
  289. package/src/components/flow-editor/node-config-panel/JsonPreviewPanel.tsx +134 -0
  290. package/src/components/flow-editor/node-config-panel/NodeConfigPanel.tsx +650 -0
  291. package/src/components/flow-editor/node-config-panel/NodeConfigPanelHeader.tsx +91 -0
  292. package/src/components/flow-editor/node-config-panel/ParametersSection.tsx +144 -0
  293. package/src/components/flow-editor/node-config-panel/SearchableSelectField.tsx +126 -0
  294. package/src/components/flow-editor/node-config-panel/SwitchCasesField.tsx +212 -0
  295. package/src/components/flow-editor/node-config-panel/hooks/index.ts +2 -0
  296. package/src/components/flow-editor/node-config-panel/hooks/use-node-config-panel-state.ts +284 -0
  297. package/src/components/flow-editor/node-config-panel/hooks/use-node-execution.ts +287 -0
  298. package/src/components/flow-editor/node-config-panel/hooks/use-upstream-slots.ts +310 -0
  299. package/src/components/flow-editor/node-config-panel/panels/AgentToolsPanel.tsx +837 -0
  300. package/src/components/flow-editor/node-config-panel/panels/ConfigurationPanel.tsx +383 -0
  301. package/src/components/flow-editor/node-config-panel/panels/DataMapperPane.tsx +456 -0
  302. package/src/components/flow-editor/node-config-panel/panels/InputPanel.tsx +338 -0
  303. package/src/components/flow-editor/node-config-panel/panels/OutputPanel.tsx +109 -0
  304. package/src/components/flow-editor/node-config-panel/panels/index.ts +4 -0
  305. package/src/components/flow-editor/node-config-panel/types.ts +20 -0
  306. package/src/components/flow-editor/node-config-panel/use-node-config-panel-store.ts +283 -0
  307. package/src/components/flow-editor/node-config-panel/use-node-config-state.ts +172 -0
  308. package/src/components/flow-editor/node-config-panel/use-run-node.ts +147 -0
  309. package/src/components/flow-editor/node-config-panel/utils.ts +73 -0
  310. package/src/components/flow-editor/serialize-to-sdk.ts +204 -0
  311. package/src/components/flow-editor/toolbar-context.ts +9 -0
  312. package/src/components/flow-editor/use-copy-paste.ts +575 -0
  313. package/src/components/flow-editor/use-copy-paste.types.ts +35 -0
  314. package/src/components/flow-editor/use-flow-editor.ts +241 -0
  315. package/src/components/flow-runs-table/FlowRunsTable.tsx +631 -0
  316. package/src/components/flow-runs-table/index.ts +1 -0
  317. package/src/components/flow-viewer/FlowRunsView.tsx +268 -0
  318. package/src/components/flow-viewer/FlowStatusView.tsx +351 -0
  319. package/src/components/flow-viewer/RunSelector.tsx +422 -0
  320. package/src/components/flow-viewer/RunsSidebar.tsx +125 -0
  321. package/src/components/flow-viewer/agent-tool-executions-list.tsx +298 -0
  322. package/src/components/flow-viewer/index.ts +1 -0
  323. package/src/components/flow-viewer/logs-panel.tsx +567 -0
  324. package/src/components/flow-viewer/use-execution-log-data.ts +374 -0
  325. package/src/components/graph/BatchFlowEdge.tsx +229 -0
  326. package/src/components/graph/LayoutSelector.tsx +42 -0
  327. package/src/components/graph/index.ts +61 -0
  328. package/src/components/graph/styleUtils.ts +375 -0
  329. package/src/components/nodes/.DS_Store +0 -0
  330. package/src/components/nodes/AgentConfigPanel.tsx +1033 -0
  331. package/src/components/nodes/AgentNode.tsx +298 -0
  332. package/src/components/nodes/AgentToolsBox.tsx +193 -0
  333. package/src/components/nodes/NodeAppendix.tsx +98 -0
  334. package/src/components/nodes/NodeStatusIndicator.tsx +74 -0
  335. package/src/components/nodes/NodeViewContext.tsx +45 -0
  336. package/src/components/nodes/ToolParamField.tsx +282 -0
  337. package/src/components/nodes/ToolSelectorModal.tsx +648 -0
  338. package/src/components/nodes/ToolSelectorParts.tsx +505 -0
  339. package/src/components/nodes/UniversalNode.tsx +356 -0
  340. package/src/components/nodes/createContextAwareNodes.ts +19 -0
  341. package/src/components/nodes/index.ts +45 -0
  342. package/src/components/nodes/nodeRegistry.ts +50 -0
  343. package/src/components/nodes/withNodeContext.tsx +55 -0
  344. package/src/components/shared/InvectLoader.tsx +59 -0
  345. package/src/components/shared/InvectLogo.tsx +59 -0
  346. package/src/components/shared/ProviderIcon.tsx +115 -0
  347. package/src/components/side-menu/side-menu.tsx +267 -0
  348. package/src/components/sidebar/BaseSidebar.tsx +148 -0
  349. package/src/components/sidebar/index.ts +1 -0
  350. package/src/components/triggers/CronPreview.tsx +243 -0
  351. package/src/components/triggers/index.ts +1 -0
  352. package/src/components/ui/alert-dialog.tsx +152 -0
  353. package/src/components/ui/badge.tsx +39 -0
  354. package/src/components/ui/button.tsx +58 -0
  355. package/src/components/ui/card.tsx +75 -0
  356. package/src/components/ui/codemirror-js-editor.tsx +432 -0
  357. package/src/components/ui/codemirror-json-editor.tsx +816 -0
  358. package/src/components/ui/codemirror-nunjucks-editor.tsx +451 -0
  359. package/src/components/ui/codemirror-vscode-theme.ts +243 -0
  360. package/src/components/ui/collapsible.tsx +12 -0
  361. package/src/components/ui/command.tsx +162 -0
  362. package/src/components/ui/dialog.tsx +140 -0
  363. package/src/components/ui/dropdown-menu.tsx +232 -0
  364. package/src/components/ui/empty-state.tsx +93 -0
  365. package/src/components/ui/input.tsx +26 -0
  366. package/src/components/ui/label.tsx +19 -0
  367. package/src/components/ui/popover.tsx +53 -0
  368. package/src/components/ui/resizable.tsx +61 -0
  369. package/src/components/ui/scroll-area.tsx +56 -0
  370. package/src/components/ui/select.tsx +179 -0
  371. package/src/components/ui/separator.tsx +26 -0
  372. package/src/components/ui/slider.tsx +58 -0
  373. package/src/components/ui/switch.tsx +22 -0
  374. package/src/components/ui/table.tsx +90 -0
  375. package/src/components/ui/textarea.tsx +23 -0
  376. package/src/components/ui/tooltip.tsx +54 -0
  377. package/src/components/ui/tree-view.tsx +574 -0
  378. package/src/contexts/AgentToolCallbacksContext.tsx +31 -0
  379. package/src/contexts/ApiContext.tsx +51 -0
  380. package/src/contexts/FlowDataContext.tsx +21 -0
  381. package/src/contexts/NodeRegistryContext.tsx +54 -0
  382. package/src/contexts/PluginRegistryContext.tsx +182 -0
  383. package/src/contexts/ThemeProvider.tsx +106 -0
  384. package/src/contexts/ValidationContext.tsx +122 -0
  385. package/src/demo/DemoInvect.tsx +42 -0
  386. package/src/demo/FlowViewer.tsx +294 -0
  387. package/src/demo/demo-api-client.ts +246 -0
  388. package/src/demo/index.ts +28 -0
  389. package/src/demo/sample-data.ts +1980 -0
  390. package/src/hooks/index.ts +1 -0
  391. package/src/hooks/use-document-title.ts +8 -0
  392. package/src/hooks/use-flow-data.ts +144 -0
  393. package/src/hooks/use-invect-portal-class.ts +27 -0
  394. package/src/hooks/useFlowEditorStore.ts +2 -0
  395. package/src/index.ts +70 -0
  396. package/src/lib/utils.ts +6 -0
  397. package/src/prettier.d.ts +13 -0
  398. package/src/routes/all-flow-runs.tsx +27 -0
  399. package/src/routes/credentials.tsx +362 -0
  400. package/src/routes/flow-route-layout.tsx +113 -0
  401. package/src/routes/flow-runs.tsx +22 -0
  402. package/src/routes/flow.tsx +22 -0
  403. package/src/routes/home.tsx +282 -0
  404. package/src/services/index.ts +6 -0
  405. package/src/stores/executionViewStore.ts +211 -0
  406. package/src/stores/flow-editor.store.ts +738 -0
  407. package/src/stores/flowEditorStore.ts +2 -0
  408. package/src/stores/index.ts +10 -0
  409. package/src/stores/uiStore.ts +189 -0
  410. package/src/types/agent-tools.types.ts +64 -0
  411. package/src/types/index.ts +5 -0
  412. package/src/types/node-definition.types.ts +104 -0
  413. package/src/types/plugin.types.ts +123 -0
  414. package/src/utils/credentialBranding.ts +116 -0
  415. package/src/utils/credentialFiltering.ts +68 -0
  416. package/src/utils/flowTransformations.ts +137 -0
  417. package/src/utils/layoutUtils.ts +127 -0
  418. package/src/utils/nodeReferenceUtils.ts +135 -0
  419. package/src/vendor.d.ts +7 -0
@@ -0,0 +1,374 @@
1
+ import { useMemo } from 'react';
2
+ import type {
3
+ NodeExecution,
4
+ NodeExecutionStatus,
5
+ ReactFlowNode,
6
+ GraphNodeType,
7
+ ToolExecutionRecord,
8
+ AgentExecutionOutput,
9
+ AgentFinishReason,
10
+ } from '@invect/core/types';
11
+ import {
12
+ NodeExecutionStatus as NodeStatusEnum,
13
+ GraphNodeType as GraphNodeTypeEnum,
14
+ } from '@invect/core/types';
15
+
16
+ /**
17
+ * Individual tool call executed by an AI Agent
18
+ */
19
+ export interface ExecutionLogToolCall {
20
+ id: string;
21
+ toolId: string;
22
+ toolName: string;
23
+ input: Record<string, unknown>;
24
+ output?: unknown;
25
+ error?: string;
26
+ success: boolean;
27
+ iteration: number;
28
+ executionTimeMs: number;
29
+ }
30
+
31
+ /**
32
+ * Agent-specific metadata for execution attempts
33
+ */
34
+ export interface AgentExecutionMetadata {
35
+ iterations: number;
36
+ finishReason: AgentFinishReason;
37
+ finalResponse: string;
38
+ model?: string;
39
+ provider?: string;
40
+ tokenUsage?: {
41
+ conversationTokensEstimate: number;
42
+ truncationOccurred: boolean;
43
+ };
44
+ }
45
+
46
+ export interface ExecutionLogAttempt {
47
+ id: string;
48
+ attemptNumber: number;
49
+ label: string;
50
+ status: NodeExecutionStatus;
51
+ startedAt?: string;
52
+ completedAt?: string;
53
+ durationMs?: number;
54
+ inputs?: Record<string, unknown>;
55
+ outputs?: NodeExecution['outputs'];
56
+ error?: string;
57
+ nodeExecutionId?: string;
58
+ /** Tool calls for agent nodes */
59
+ toolCalls?: ExecutionLogToolCall[];
60
+ /** Agent-specific metadata for agent nodes */
61
+ agentMetadata?: AgentExecutionMetadata;
62
+ /** True when this attempt is a loop/mapper iteration (detected via _item in inputs) */
63
+ isLoopIteration?: boolean;
64
+ /** The _item metadata for loop iterations */
65
+ iterationItem?: {
66
+ value: unknown;
67
+ index: number;
68
+ iteration: number;
69
+ first: boolean;
70
+ last: boolean;
71
+ total: number;
72
+ };
73
+ }
74
+
75
+ export interface ExecutionLogNode {
76
+ nodeId: string;
77
+ nodeName: string;
78
+ nodeType?: GraphNodeType | string;
79
+ latestStatus: NodeExecutionStatus;
80
+ attempts: ExecutionLogAttempt[];
81
+ definitionIndex: number;
82
+ }
83
+
84
+ export interface SelectedExecutionAttempt {
85
+ nodeId: string;
86
+ attemptId: string;
87
+ /** Optional: selected tool call ID within an agent node */
88
+ toolCallId?: string;
89
+ }
90
+
91
+ type RawAttempt = ExecutionLogAttempt & {
92
+ startedAtMs?: number;
93
+ isPlaceholder?: boolean;
94
+ _isLoopIteration?: boolean;
95
+ };
96
+
97
+ type UseExecutionLogDataParams = {
98
+ nodes?: ReactFlowNode[];
99
+ nodeExecutions?: NodeExecution[];
100
+ };
101
+
102
+ const toIsoString = (value?: string | Date | null): string | undefined => {
103
+ if (!value) {
104
+ return undefined;
105
+ }
106
+
107
+ if (typeof value === 'string') {
108
+ return value;
109
+ }
110
+
111
+ return value.toISOString();
112
+ };
113
+
114
+ const toTimestamp = (value?: string | Date | null): number | undefined => {
115
+ if (!value) {
116
+ return undefined;
117
+ }
118
+
119
+ const date = typeof value === 'string' ? new Date(value) : value;
120
+ const time = date?.getTime();
121
+ return Number.isFinite(time) ? time : undefined;
122
+ };
123
+
124
+ const toDuration = (
125
+ duration?: number | null,
126
+ startedAt?: string | Date | null,
127
+ completedAt?: string | Date | null,
128
+ ) => {
129
+ if (typeof duration === 'number') {
130
+ return duration;
131
+ }
132
+
133
+ const start = toTimestamp(startedAt);
134
+ const end = toTimestamp(completedAt);
135
+
136
+ if (start === undefined || end === undefined) {
137
+ return undefined;
138
+ }
139
+
140
+ return Math.max(end - start, 0);
141
+ };
142
+
143
+ /**
144
+ * Extract tool execution records from an Agent node's output
145
+ * Agent outputs store tool results in: outputs.data.variables.output.value.toolResults
146
+ */
147
+ function extractAgentToolCalls(
148
+ nodeExecution: NodeExecution,
149
+ ): { toolCalls: ExecutionLogToolCall[]; agentMetadata: AgentExecutionMetadata } | undefined {
150
+ // Only process AGENT nodes
151
+ if (nodeExecution.nodeType !== GraphNodeTypeEnum.AGENT) {
152
+ return undefined;
153
+ }
154
+
155
+ // Navigate to the agent output value
156
+ const outputs = nodeExecution.outputs as Record<string, unknown> | undefined;
157
+ const data = outputs?.data as Record<string, unknown> | undefined;
158
+ const variables = data?.variables as Record<string, unknown> | undefined;
159
+ const outputVar = variables?.output as Record<string, unknown> | undefined;
160
+ const agentOutput = outputVar?.value as AgentExecutionOutput | undefined;
161
+
162
+ if (!agentOutput) {
163
+ return undefined;
164
+ }
165
+
166
+ // Extract metadata
167
+ const metadata = data?.metadata as Record<string, unknown> | undefined;
168
+
169
+ const agentMetadata: AgentExecutionMetadata = {
170
+ iterations: agentOutput.iterations ?? 0,
171
+ finishReason: agentOutput.finishReason ?? 'completed',
172
+ finalResponse: agentOutput.finalResponse ?? '',
173
+ model: metadata?.model as string | undefined,
174
+ provider: metadata?.provider as string | undefined,
175
+ tokenUsage: agentOutput.tokenUsage,
176
+ };
177
+
178
+ // Extract tool calls
179
+ const toolResults = agentOutput.toolResults ?? [];
180
+ const toolCalls: ExecutionLogToolCall[] = toolResults.map(
181
+ (tool: ToolExecutionRecord, index: number) => ({
182
+ id: `${nodeExecution.id}_tool_${index}`,
183
+ toolId: tool.toolId,
184
+ toolName: tool.toolName,
185
+ input: tool.input,
186
+ output: tool.output,
187
+ error: tool.error,
188
+ success: tool.success,
189
+ iteration: tool.iteration,
190
+ executionTimeMs: tool.executionTimeMs,
191
+ }),
192
+ );
193
+
194
+ return { toolCalls, agentMetadata };
195
+ }
196
+
197
+ export function useExecutionLogData({ nodes, nodeExecutions }: UseExecutionLogDataParams) {
198
+ return useMemo(() => {
199
+ const definitionNodes = nodes ?? [];
200
+ const nodeOrderMap = new Map<string, number>();
201
+
202
+ definitionNodes.forEach((node, index) => {
203
+ nodeOrderMap.set(node.id, index);
204
+ });
205
+
206
+ const groups = new Map<
207
+ string,
208
+ {
209
+ nodeId: string;
210
+ nodeName: string;
211
+ nodeType?: GraphNodeType | string;
212
+ definitionIndex: number;
213
+ attempts: RawAttempt[];
214
+ }
215
+ >();
216
+
217
+ const ensureGroup = (nodeId: string) => {
218
+ const existing = groups.get(nodeId);
219
+ if (existing) {
220
+ return existing;
221
+ }
222
+
223
+ const definitionNode = definitionNodes.find((n) => n.id === nodeId);
224
+ const newGroup = {
225
+ nodeId,
226
+ nodeName: definitionNode?.data?.display_name || nodeId,
227
+ nodeType: definitionNode?.type,
228
+ definitionIndex: nodeOrderMap.get(nodeId) ?? Number.MAX_SAFE_INTEGER,
229
+ attempts: [],
230
+ };
231
+ groups.set(nodeId, newGroup);
232
+ return newGroup;
233
+ };
234
+
235
+ (nodeExecutions ?? []).forEach((execution) => {
236
+ const group = ensureGroup(execution.nodeId);
237
+
238
+ // Extract tool calls for agent nodes
239
+ const agentData = extractAgentToolCalls(execution);
240
+
241
+ // Detect loop iteration via _item metadata in inputs
242
+ const itemMeta = execution.inputs?._item as
243
+ | {
244
+ value: unknown;
245
+ index: number;
246
+ iteration: number;
247
+ first: boolean;
248
+ last: boolean;
249
+ total: number;
250
+ }
251
+ | undefined;
252
+ const isLoop =
253
+ itemMeta !== null &&
254
+ itemMeta !== undefined &&
255
+ typeof itemMeta === 'object' &&
256
+ 'iteration' in itemMeta;
257
+
258
+ group.attempts.push({
259
+ id: execution.id,
260
+ attemptNumber: 0,
261
+ label: '',
262
+ status: execution.status,
263
+ startedAt: toIsoString(execution.startedAt),
264
+ completedAt: toIsoString(execution.completedAt),
265
+ durationMs: toDuration(execution.duration, execution.startedAt, execution.completedAt),
266
+ inputs: execution.inputs,
267
+ outputs: execution.outputs,
268
+ error: execution.error,
269
+ nodeExecutionId: execution.id,
270
+ startedAtMs: toTimestamp(execution.startedAt),
271
+ isPlaceholder: false,
272
+ toolCalls: agentData?.toolCalls,
273
+ agentMetadata: agentData?.agentMetadata,
274
+ _isLoopIteration: isLoop,
275
+ isLoopIteration: isLoop,
276
+ iterationItem: isLoop ? itemMeta : undefined,
277
+ });
278
+ });
279
+
280
+ // Ensure every node is represented even if it has not executed yet
281
+ definitionNodes.forEach((node) => {
282
+ if (!groups.has(node.id)) {
283
+ groups.set(node.id, {
284
+ nodeId: node.id,
285
+ nodeName: node.data?.display_name || node.id,
286
+ nodeType: node.type,
287
+ definitionIndex: nodeOrderMap.get(node.id) ?? Number.MAX_SAFE_INTEGER,
288
+ attempts: [
289
+ {
290
+ id: `${node.id}-pending`,
291
+ attemptNumber: 1,
292
+ label: 'Pending',
293
+ status: NodeStatusEnum.PENDING,
294
+ inputs: {},
295
+ outputs: undefined,
296
+ error: undefined,
297
+ nodeExecutionId: undefined,
298
+ startedAtMs: undefined,
299
+ isPlaceholder: true,
300
+ },
301
+ ],
302
+ });
303
+ }
304
+ });
305
+
306
+ const orderedNodes = Array.from(groups.values())
307
+ .map((group) => {
308
+ const sortedAttempts = group.attempts
309
+ .slice()
310
+ .sort((a, b) => {
311
+ const aKey = a.startedAtMs ?? Number.MAX_SAFE_INTEGER;
312
+ const bKey = b.startedAtMs ?? Number.MAX_SAFE_INTEGER;
313
+ if (aKey !== bKey) {
314
+ return aKey - bKey;
315
+ }
316
+ return a.id.localeCompare(b.id);
317
+ })
318
+ .map((attempt, index, arr) => {
319
+ // Check if all non-placeholder attempts in this group are loop iterations
320
+ const allLoop = arr.filter((a) => !a.isPlaceholder).every((a) => a._isLoopIteration);
321
+ let label: string;
322
+ if (attempt.isPlaceholder) {
323
+ label = 'Pending';
324
+ } else if (allLoop && attempt._isLoopIteration) {
325
+ label = `Iteration #${index + 1}`;
326
+ } else if (index === 0) {
327
+ label = `Attempt #${index + 1}`;
328
+ } else {
329
+ label = `Retry #${index + 1}`;
330
+ }
331
+ return {
332
+ ...attempt,
333
+ attemptNumber: index + 1,
334
+ label,
335
+ };
336
+ });
337
+
338
+ const sortedAttemptsWithoutMeta = sortedAttempts.map(
339
+ ({ startedAtMs, isPlaceholder, _isLoopIteration, ...rest }) => rest,
340
+ );
341
+ const firstTimestamp = sortedAttempts.find(
342
+ (attempt) => attempt.startedAtMs !== undefined,
343
+ )?.startedAtMs;
344
+ const latestStatus =
345
+ sortedAttemptsWithoutMeta[sortedAttemptsWithoutMeta.length - 1]?.status ??
346
+ NodeStatusEnum.PENDING;
347
+
348
+ return {
349
+ nodeId: group.nodeId,
350
+ nodeName: group.nodeName,
351
+ nodeType: group.nodeType,
352
+ attempts: sortedAttemptsWithoutMeta,
353
+ latestStatus,
354
+ definitionIndex: group.definitionIndex,
355
+ sortTimestamp: firstTimestamp,
356
+ };
357
+ })
358
+ .sort((a, b) => {
359
+ const aKey = a.sortTimestamp ?? Number.MAX_SAFE_INTEGER;
360
+ const bKey = b.sortTimestamp ?? Number.MAX_SAFE_INTEGER;
361
+
362
+ if (aKey !== bKey) {
363
+ return aKey - bKey;
364
+ }
365
+
366
+ return a.definitionIndex - b.definitionIndex;
367
+ })
368
+ .map(({ sortTimestamp: _sortTimestamp, ...rest }) => rest);
369
+
370
+ return {
371
+ nodes: orderedNodes,
372
+ };
373
+ }, [nodes, nodeExecutions]);
374
+ }
@@ -0,0 +1,229 @@
1
+ import React, { memo, useMemo } from 'react';
2
+ import {
3
+ type EdgeProps,
4
+ getBezierPath,
5
+ EdgeLabelRenderer,
6
+ BaseEdge,
7
+ MarkerType,
8
+ } from '@xyflow/react';
9
+ import { cn } from '../../lib/utils';
10
+ import { Button } from '../ui/button';
11
+ import { X, Zap, AlertTriangle, SkipForward } from 'lucide-react';
12
+
13
+ // Enhanced edge data interface
14
+ export interface BatchFlowEdgeData extends Record<string, unknown> {
15
+ label?: string;
16
+ type?: 'default' | 'data' | 'conditional' | 'error' | 'skipped';
17
+ animated?: boolean;
18
+ highlighted?: boolean;
19
+ selected?: boolean;
20
+ sourceHandle?: string;
21
+ targetHandle?: string;
22
+ sourceNodeStatus?: string;
23
+ targetNodeStatus?: string;
24
+ validation?: {
25
+ valid: boolean;
26
+ message?: string;
27
+ };
28
+ }
29
+
30
+ // Edge styles based on type and state - Updated to match Invect's edge styling
31
+ const getEdgeStyles = (data?: BatchFlowEdgeData, selected?: boolean) => {
32
+ const baseStyle = {
33
+ strokeWidth: 2,
34
+ stroke: 'var(--muted-foreground)', // Theme-aware default edge color
35
+ fill: 'none', // Explicitly set fill to none for SVG paths
36
+ };
37
+
38
+ if (selected) {
39
+ return {
40
+ ...baseStyle,
41
+ stroke: 'var(--edge-selected-stroke, #3b82f6)', // Blue for selected, uses CSS variable for theme awareness
42
+ strokeWidth: 3,
43
+ };
44
+ }
45
+
46
+ if (data?.highlighted) {
47
+ return {
48
+ ...baseStyle,
49
+ stroke: '#3b82f6', // Blue for highlighted
50
+ strokeWidth: 2.5,
51
+ };
52
+ }
53
+
54
+ switch (data?.type) {
55
+ case 'data':
56
+ return {
57
+ ...baseStyle,
58
+ stroke: '#3b82f6', // Blue-500 equivalent
59
+ strokeWidth: 2,
60
+ };
61
+ case 'conditional':
62
+ return {
63
+ ...baseStyle,
64
+ stroke: '#f59e0b', // Amber-500 equivalent
65
+ strokeWidth: 2,
66
+ strokeDasharray: '5,5',
67
+ };
68
+ case 'error':
69
+ return {
70
+ ...baseStyle,
71
+ stroke: '#ef4444', // Red-500
72
+ strokeWidth: 2,
73
+ };
74
+ case 'skipped':
75
+ return {
76
+ ...baseStyle,
77
+ stroke: '#6b7280', // Gray-500 for skipped edges
78
+ strokeWidth: 1.5,
79
+ strokeDasharray: '8,4', // Longer dashes for skipped appearance
80
+ opacity: 0.5, // Make it more transparent
81
+ };
82
+ default:
83
+ return baseStyle;
84
+ }
85
+ };
86
+
87
+ // Main Invect Edge Component
88
+ export const BatchFlowEdge = memo(function BatchFlowEdge(props: EdgeProps) {
89
+ const {
90
+ id: _id,
91
+ sourceX,
92
+ sourceY,
93
+ targetX,
94
+ targetY,
95
+ sourcePosition,
96
+ targetPosition,
97
+ style = {},
98
+ data,
99
+ selected,
100
+ markerEnd,
101
+ } = props;
102
+
103
+ const batchflowData = data as BatchFlowEdgeData;
104
+ const [edgePath, labelX, labelY] = getBezierPath({
105
+ sourceX,
106
+ sourceY,
107
+ sourcePosition,
108
+ targetX,
109
+ targetY,
110
+ targetPosition,
111
+ curvature: 0.25, // Add curvature for smooth bezier curves
112
+ });
113
+
114
+ const edgeStyle = useMemo(
115
+ () => ({
116
+ ...getEdgeStyles(batchflowData, selected),
117
+ ...style,
118
+ }),
119
+ [
120
+ batchflowData?.type,
121
+ batchflowData?.highlighted,
122
+ batchflowData?.validation?.valid,
123
+ selected,
124
+ style,
125
+ ],
126
+ );
127
+
128
+ const showLabel = batchflowData?.label || batchflowData?.validation?.message;
129
+ const isError =
130
+ batchflowData?.type === 'error' ||
131
+ (batchflowData?.validation && !batchflowData.validation.valid);
132
+
133
+ return (
134
+ <>
135
+ <BaseEdge path={edgePath} style={edgeStyle} markerEnd={markerEnd} interactionWidth={20} />
136
+
137
+ {showLabel && (
138
+ <EdgeLabelRenderer>
139
+ <div
140
+ style={{
141
+ position: 'absolute',
142
+ transform: `translate(-50%, -50%) translate(${labelX}px,${labelY}px)`,
143
+ fontSize: 12,
144
+ pointerEvents: 'all',
145
+ }}
146
+ className="nodrag nopan"
147
+ >
148
+ {batchflowData?.label && (
149
+ <div
150
+ className={cn(
151
+ 'bg-background/95 backdrop-blur-sm border border-border/50 rounded-lg px-3 py-1.5 shadow-lg text-xs font-medium',
152
+ 'transition-all duration-200 hover:shadow-xl hover:scale-105',
153
+ 'max-w-[200px] truncate',
154
+ selected && 'ring-2 ring-primary/50 ring-offset-1',
155
+ isError && 'border-destructive/70 bg-destructive/10 text-destructive',
156
+ )}
157
+ >
158
+ <div className="flex items-center gap-1.5">
159
+ {batchflowData.type === 'conditional' && (
160
+ <Zap className="w-3 h-3 text-amber-500 shrink-0" />
161
+ )}
162
+ {batchflowData.type === 'skipped' && (
163
+ <SkipForward className="w-3 h-3 text-muted-foreground shrink-0" />
164
+ )}
165
+ {isError && <AlertTriangle className="w-3 h-3 text-destructive shrink-0" />}
166
+ <span
167
+ className={cn(
168
+ 'text-foreground truncate',
169
+ isError && 'text-destructive',
170
+ batchflowData.type === 'skipped' && 'text-muted-foreground',
171
+ )}
172
+ >
173
+ {batchflowData.label}
174
+ </span>
175
+ </div>
176
+ {batchflowData?.validation?.message && (
177
+ <div className="mt-1 text-xs text-muted-foreground">
178
+ {batchflowData.validation.message}
179
+ </div>
180
+ )}
181
+ </div>
182
+ )}
183
+
184
+ {selected && (
185
+ <Button
186
+ variant="destructive"
187
+ size="icon"
188
+ className="w-6 h-6 ml-2 opacity-80 hover:opacity-100"
189
+ onClick={(e) => {
190
+ e.stopPropagation();
191
+ // Edge deletion handled by parent component via onEdgesDelete
192
+ }}
193
+ >
194
+ <X className="w-3 h-3" />
195
+ </Button>
196
+ )}
197
+ </div>
198
+ </EdgeLabelRenderer>
199
+ )}
200
+ </>
201
+ );
202
+ });
203
+
204
+ BatchFlowEdge.displayName = 'BatchFlowEdge';
205
+
206
+ // Predefined edge types matching Invect's patterns
207
+ const _edgeTypes = {
208
+ // invect: BatchFlowEdge,
209
+ default: BatchFlowEdge,
210
+ };
211
+
212
+ // Edge creation utilities
213
+
214
+ // Default edge styles for different connection types
215
+ export const defaultEdgeOptions = {
216
+ type: 'default',
217
+ animated: false,
218
+ style: {
219
+ strokeWidth: 2,
220
+ stroke: 'var(--muted-foreground)', // Theme-aware default edge color
221
+ fill: 'none',
222
+ },
223
+ markerEnd: {
224
+ type: MarkerType.ArrowClosed,
225
+ width: 16,
226
+ height: 16,
227
+ color: 'var(--muted-foreground)', // Theme-aware marker color
228
+ },
229
+ };
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import { Button } from '../ui/button';
3
+ import { Tooltip, TooltipTrigger, TooltipContent } from '../ui/tooltip';
4
+ import { cn } from '../../lib/utils';
5
+ import { AlignHorizontalDistributeCenter } from 'lucide-react';
6
+ import { useToolbarCollapsed } from '../flow-editor/toolbar-context';
7
+ import type { LayoutAlgorithm } from '../../utils/layoutUtils';
8
+
9
+ interface LayoutSelectorProps {
10
+ currentLayout: LayoutAlgorithm;
11
+ onLayoutChange: (layout: LayoutAlgorithm, direction?: 'TB' | 'BT' | 'LR' | 'RL') => void;
12
+ className?: string;
13
+ }
14
+
15
+ export const LayoutSelector: React.FC<LayoutSelectorProps> = ({ onLayoutChange, className }) => {
16
+ const collapsed = useToolbarCollapsed();
17
+
18
+ const handleRealign = () => {
19
+ onLayoutChange('elkjs', 'LR');
20
+ };
21
+
22
+ return (
23
+ <div className={cn('relative', className)}>
24
+ <div className="flex items-center">
25
+ <Tooltip>
26
+ <TooltipTrigger asChild>
27
+ <Button
28
+ variant="ghost"
29
+ size="sm"
30
+ onClick={handleRealign}
31
+ className="h-8 gap-1.5 rounded-md px-2.5 text-muted-foreground hover:bg-accent hover:text-foreground"
32
+ >
33
+ <AlignHorizontalDistributeCenter className="w-3.5 h-3.5" />
34
+ {!collapsed && 'Realign'}
35
+ </Button>
36
+ </TooltipTrigger>
37
+ {collapsed && <TooltipContent side="top">Realign</TooltipContent>}
38
+ </Tooltip>
39
+ </div>
40
+ </div>
41
+ );
42
+ };
@@ -0,0 +1,61 @@
1
+ // Export all graph components
2
+
3
+ // Export new Invect-inspired components
4
+ export { BatchFlowEdge, defaultEdgeOptions } from './BatchFlowEdge';
5
+ export { LayoutSelector } from './LayoutSelector';
6
+
7
+ export { langflowColors, type NodeStatus } from './styleUtils';
8
+ export type { BatchFlowEdgeData } from './BatchFlowEdge';
9
+
10
+ // Import types from core
11
+ import type { NodeExecutionStatus } from '@invect/core/types';
12
+
13
+ // Types matching Invect's node structure, extending ReactFlow's expected types
14
+ export interface BatchFlowNodeData extends Record<string, unknown> {
15
+ id: string;
16
+ type: string; // This is the key used for style mapping, e.g., "OpenAIModel"
17
+ display_name: string;
18
+ description?: string;
19
+ icon?: string; // Invect's icon name (e.g., "OpenAI", "MessagesSquare")
20
+ frozen?: boolean;
21
+ beta?: boolean;
22
+ deprecated?: boolean;
23
+ outputs?: Array<{
24
+ name: string;
25
+ display_name: string;
26
+ type: string; // Data type, e.g., "text", "ChatHistory"
27
+ required?: boolean;
28
+ }>;
29
+ inputs?: Array<{
30
+ name: string;
31
+ display_name: string;
32
+ type: string; // Data type
33
+ required?: boolean;
34
+ value?: unknown;
35
+ }>;
36
+ template?: Record<
37
+ string,
38
+ {
39
+ // Parameters
40
+ display_name: string;
41
+ type: string; // Parameter type, e.g., "str", "int", "bool", "code"
42
+ required?: boolean;
43
+ show?: boolean; // Whether to show in the UI by default
44
+ value?: unknown;
45
+ options?: unknown[]; // For dropdowns
46
+ list?: boolean; // If it's a list input
47
+ multiline?: boolean; // For text areas
48
+ placeholder?: string;
49
+ password?: boolean;
50
+ advanced?: boolean; // If it's an advanced parameter
51
+ _input_type?: string; // Invect input type for handle generation
52
+ }
53
+ >;
54
+ connectedTemplateFields?: Set<string>; // Set of template field names that are connected
55
+ executionStatus?: NodeExecutionStatus; // Execution status from backend
56
+ executionError?: string; // Execution error message
57
+ executionOutput?: unknown; // Output data from completed node execution
58
+ // selected?: boolean; // Provided by NodeProps
59
+ // showNode?: boolean; // Invect specific, might map to a local state like isExpanded
60
+ flow?: unknown; // Flow context if needed
61
+ }