@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.
- package/LICENSE +21 -0
- package/README.md +77 -0
- package/dist/Invect-CWpIwZ5F.js +92738 -0
- package/dist/Invect.d.ts +25 -0
- package/dist/InvectShell.d.ts +14 -0
- package/dist/api/agent-tools.api.d.ts +1 -0
- package/dist/api/client.d.ts +207 -0
- package/dist/api/credentials.api.d.ts +47 -0
- package/dist/api/executions.api.d.ts +43 -0
- package/dist/api/flows.api.d.ts +100 -0
- package/dist/api/index.d.ts +9 -0
- package/dist/api/node-data.api.d.ts +66 -0
- package/dist/api/query-keys.d.ts +22 -0
- package/dist/api/triggers.api.d.ts +44 -0
- package/dist/api/types.d.ts +147 -0
- package/dist/api/use-flow-run-stream.d.ts +12 -0
- package/dist/assets/invect-branding.d.ts +4 -0
- package/dist/assets/provider-icons/index.d.ts +8 -0
- package/dist/babel-C9OtljFZ.js +9721 -0
- package/dist/components/PageLayout.d.ts +17 -0
- package/dist/components/chat/ChatInput.d.ts +17 -0
- package/dist/components/chat/ChatMessageList.d.ts +14 -0
- package/dist/components/chat/ChatModelSelector.d.ts +11 -0
- package/dist/components/chat/ChatPanel.d.ts +19 -0
- package/dist/components/chat/ChatPromptOverlay.d.ts +13 -0
- package/dist/components/chat/ChatProviderSelector.d.ts +9 -0
- package/dist/components/chat/ChatSettingsPanel.d.ts +11 -0
- package/dist/components/chat/InlineCredentialSetup.d.ts +9 -0
- package/dist/components/chat/MarkdownRenderer.d.ts +7 -0
- package/dist/components/chat/chat-memory.d.ts +21 -0
- package/dist/components/chat/chat.store.d.ts +416 -0
- package/dist/components/chat/index.d.ts +5 -0
- package/dist/components/chat/use-chat.d.ts +28 -0
- package/dist/components/credentials/CreateCredentialModal.d.ts +13 -0
- package/dist/components/credentials/CredentialDetailDialog.d.ts +17 -0
- package/dist/components/credentials/EditCredentialModal.d.ts +11 -0
- package/dist/components/credentials/OAuth2ConnectButton.d.ts +38 -0
- package/dist/components/credentials/OAuth2ProviderSelector.d.ts +15 -0
- package/dist/components/credentials/credential-utils.d.ts +12 -0
- package/dist/components/credentials/index.d.ts +9 -0
- package/dist/components/dashboard/FailedRunsAlert.d.ts +3 -0
- package/dist/components/dashboard/FlowCard.d.ts +7 -0
- package/dist/components/dashboard/RecentActivityTable.d.ts +9 -0
- package/dist/components/dashboard/StatCard.d.ts +10 -0
- package/dist/components/dashboard/index.d.ts +5 -0
- package/dist/components/dashboard/status-helpers.d.ts +5 -0
- package/dist/components/flow-editor/ActionsSidebar.d.ts +2 -0
- package/dist/components/flow-editor/FlowEditor.d.ts +21 -0
- package/dist/components/flow-editor/FlowHeader.d.ts +9 -0
- package/dist/components/flow-editor/FlowLayout.d.ts +24 -0
- package/dist/components/flow-editor/ModeSwitcher.d.ts +7 -0
- package/dist/components/flow-editor/NodeSidebar.d.ts +24 -0
- package/dist/components/flow-editor/RunControls.d.ts +12 -0
- package/dist/components/flow-editor/ToolConfigPanel.d.ts +16 -0
- package/dist/components/flow-editor/ValidationPanel.d.ts +5 -0
- package/dist/components/flow-editor/flow-editor.store.d.ts +1 -0
- package/dist/components/flow-editor/index.d.ts +6 -0
- package/dist/components/flow-editor/inline-edit.d.ts +10 -0
- package/dist/components/flow-editor/node-config-panel/ConfigFieldWithTemplate.d.ts +26 -0
- package/dist/components/flow-editor/node-config-panel/CredentialCombobox.d.ts +21 -0
- package/dist/components/flow-editor/node-config-panel/CredentialsSection.d.ts +19 -0
- package/dist/components/flow-editor/node-config-panel/DroppableInput.d.ts +20 -0
- package/dist/components/flow-editor/node-config-panel/DynamicSelectField.d.ts +22 -0
- package/dist/components/flow-editor/node-config-panel/JsonPreviewPanel.d.ts +25 -0
- package/dist/components/flow-editor/node-config-panel/NodeConfigPanel.d.ts +14 -0
- package/dist/components/flow-editor/node-config-panel/NodeConfigPanelHeader.d.ts +15 -0
- package/dist/components/flow-editor/node-config-panel/ParametersSection.d.ts +16 -0
- package/dist/components/flow-editor/node-config-panel/SearchableSelectField.d.ts +17 -0
- package/dist/components/flow-editor/node-config-panel/SwitchCasesField.d.ts +18 -0
- package/dist/components/flow-editor/node-config-panel/hooks/index.d.ts +2 -0
- package/dist/components/flow-editor/node-config-panel/hooks/use-node-config-panel-state.d.ts +24 -0
- package/dist/components/flow-editor/node-config-panel/hooks/use-node-execution.d.ts +46 -0
- package/dist/components/flow-editor/node-config-panel/hooks/use-upstream-slots.d.ts +16 -0
- package/dist/components/flow-editor/node-config-panel/panels/AgentToolsPanel.d.ts +18 -0
- package/dist/components/flow-editor/node-config-panel/panels/ConfigurationPanel.d.ts +49 -0
- package/dist/components/flow-editor/node-config-panel/panels/DataMapperPane.d.ts +40 -0
- package/dist/components/flow-editor/node-config-panel/panels/InputPanel.d.ts +49 -0
- package/dist/components/flow-editor/node-config-panel/panels/OutputPanel.d.ts +7 -0
- package/dist/components/flow-editor/node-config-panel/panels/index.d.ts +4 -0
- package/dist/components/flow-editor/node-config-panel/types.d.ts +19 -0
- package/dist/components/flow-editor/node-config-panel/use-node-config-panel-store.d.ts +49 -0
- package/dist/components/flow-editor/node-config-panel/use-node-config-state.d.ts +26 -0
- package/dist/components/flow-editor/node-config-panel/use-run-node.d.ts +16 -0
- package/dist/components/flow-editor/node-config-panel/utils.d.ts +9 -0
- package/dist/components/flow-editor/serialize-to-sdk.d.ts +20 -0
- package/dist/components/flow-editor/toolbar-context.d.ts +2 -0
- package/dist/components/flow-editor/use-copy-paste.d.ts +7 -0
- package/dist/components/flow-editor/use-copy-paste.types.d.ts +38 -0
- package/dist/components/flow-editor/use-flow-editor.d.ts +44 -0
- package/dist/components/flow-runs-table/FlowRunsTable.d.ts +6 -0
- package/dist/components/flow-runs-table/index.d.ts +1 -0
- package/dist/components/flow-viewer/FlowRunsView.d.ts +7 -0
- package/dist/components/flow-viewer/FlowStatusView.d.ts +21 -0
- package/dist/components/flow-viewer/RunSelector.d.ts +13 -0
- package/dist/components/flow-viewer/RunsSidebar.d.ts +14 -0
- package/dist/components/flow-viewer/agent-tool-executions-list.d.ts +7 -0
- package/dist/components/flow-viewer/index.d.ts +1 -0
- package/dist/components/flow-viewer/logs-panel.d.ts +18 -0
- package/dist/components/flow-viewer/use-execution-log-data.d.ts +113 -0
- package/dist/components/graph/BatchFlowEdge.d.ts +33 -0
- package/dist/components/graph/LayoutSelector.d.ts +9 -0
- package/dist/components/graph/index.d.ts +47 -0
- package/dist/components/graph/styleUtils.d.ts +124 -0
- package/dist/components/nodes/AgentConfigPanel.d.ts +24 -0
- package/dist/components/nodes/AgentNode.d.ts +8 -0
- package/dist/components/nodes/AgentToolsBox.d.ts +41 -0
- package/dist/components/nodes/NodeAppendix.d.ts +19 -0
- package/dist/components/nodes/NodeStatusIndicator.d.ts +30 -0
- package/dist/components/nodes/NodeViewContext.d.ts +18 -0
- package/dist/components/nodes/ToolParamField.d.ts +28 -0
- package/dist/components/nodes/ToolSelectorModal.d.ts +80 -0
- package/dist/components/nodes/ToolSelectorParts.d.ts +30 -0
- package/dist/components/nodes/UniversalNode.d.ts +2 -0
- package/dist/components/nodes/createContextAwareNodes.d.ts +6 -0
- package/dist/components/nodes/index.d.ts +22 -0
- package/dist/components/nodes/nodeRegistry.d.ts +13 -0
- package/dist/components/nodes/withNodeContext.d.ts +7 -0
- package/dist/components/shared/InvectLoader.d.ts +8 -0
- package/dist/components/shared/InvectLogo.d.ts +9 -0
- package/dist/components/shared/ProviderIcon.d.ts +23 -0
- package/dist/components/side-menu/side-menu.d.ts +4 -0
- package/dist/components/sidebar/BaseSidebar.d.ts +17 -0
- package/dist/components/sidebar/index.d.ts +1 -0
- package/dist/components/triggers/CronPreview.d.ts +12 -0
- package/dist/components/triggers/index.d.ts +1 -0
- package/dist/components/ui/alert-dialog.d.ts +18 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/button.d.ts +13 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/codemirror-js-editor.d.ts +25 -0
- package/dist/components/ui/codemirror-json-editor.d.ts +18 -0
- package/dist/components/ui/codemirror-nunjucks-editor.d.ts +13 -0
- package/dist/components/ui/codemirror-vscode-theme.d.ts +24 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/command.d.ts +18 -0
- package/dist/components/ui/dialog.d.ts +18 -0
- package/dist/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/components/ui/empty-state.d.ts +21 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/popover.d.ts +10 -0
- package/dist/components/ui/resizable.d.ts +8 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/select.d.ts +18 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/switch.d.ts +3 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tree-view.d.ts +107 -0
- package/dist/contexts/AgentToolCallbacksContext.d.ts +23 -0
- package/dist/contexts/ApiContext.d.ts +11 -0
- package/dist/contexts/FlowDataContext.d.ts +9 -0
- package/dist/contexts/NodeRegistryContext.d.ts +14 -0
- package/dist/contexts/PluginRegistryContext.d.ts +39 -0
- package/dist/contexts/ThemeProvider.d.ts +18 -0
- package/dist/contexts/ValidationContext.d.ts +22 -0
- package/dist/demo/DemoInvect.d.ts +11 -0
- package/dist/demo/FlowViewer.d.ts +31 -0
- package/dist/demo/demo-api-client.d.ts +33 -0
- package/dist/demo/index.d.ts +6 -0
- package/dist/demo/sample-data.d.ts +1538 -0
- package/dist/demo.d.ts +2 -0
- package/dist/demo.js +2774 -0
- package/dist/estree-ClbRfS-1.js +7076 -0
- package/dist/fonts/geist-cyrillic-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-latin-wght-normal.woff2 +0 -0
- package/dist/fonts/iosevka-latin-400-normal.woff2 +0 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-document-title.d.ts +1 -0
- package/dist/hooks/use-flow-data.d.ts +22 -0
- package/dist/hooks/use-invect-portal-class.d.ts +21 -0
- package/dist/hooks/useFlowEditorStore.d.ts +1 -0
- package/dist/index.css +3 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +717 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/prettier.d.ts +13 -0
- package/dist/routes/all-flow-runs.d.ts +5 -0
- package/dist/routes/credentials.d.ts +5 -0
- package/dist/routes/flow-route-layout.d.ts +19 -0
- package/dist/routes/flow-runs.d.ts +5 -0
- package/dist/routes/flow.d.ts +5 -0
- package/dist/routes/home.d.ts +5 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/standalone-C3Df7W52.js +3463 -0
- package/dist/stores/executionViewStore.d.ts +64 -0
- package/dist/stores/flow-editor.store.d.ts +137 -0
- package/dist/stores/flowEditorStore.d.ts +1 -0
- package/dist/stores/index.d.ts +2 -0
- package/dist/stores/uiStore.d.ts +45 -0
- package/dist/types/agent-tools.types.d.ts +53 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/node-definition.types.d.ts +85 -0
- package/dist/types/plugin.types.d.ts +100 -0
- package/dist/utils/credentialBranding.d.ts +8 -0
- package/dist/utils/credentialFiltering.d.ts +20 -0
- package/dist/utils/flowTransformations.d.ts +16 -0
- package/dist/utils/layoutUtils.d.ts +23 -0
- package/dist/utils/nodeReferenceUtils.d.ts +37 -0
- package/dist/vendor.d.ts +5 -0
- package/package.json +130 -0
- package/src/.DS_Store +0 -0
- package/src/Invect.tsx +229 -0
- package/src/InvectShell.tsx +55 -0
- package/src/api/agent-tools.api.ts +23 -0
- package/src/api/client.ts +899 -0
- package/src/api/credentials.api.ts +197 -0
- package/src/api/executions.api.ts +228 -0
- package/src/api/flows.api.ts +195 -0
- package/src/api/index.ts +17 -0
- package/src/api/node-data.api.ts +167 -0
- package/src/api/query-keys.ts +44 -0
- package/src/api/triggers.api.ts +120 -0
- package/src/api/types.ts +212 -0
- package/src/api/use-flow-run-stream.ts +206 -0
- package/src/app.css +560 -0
- package/src/assets/.DS_Store +0 -0
- package/src/assets/favicon.ico +0 -0
- package/src/assets/fonts/geist-cyrillic-wght-normal.woff2 +0 -0
- package/src/assets/fonts/geist-latin-ext-wght-normal.woff2 +0 -0
- package/src/assets/fonts/geist-latin-wght-normal.woff2 +0 -0
- package/src/assets/fonts/iosevka-latin-400-normal.woff2 +0 -0
- package/src/assets/invect-branding.ts +51 -0
- package/src/assets/provider-icons/anthropic.svg +1 -0
- package/src/assets/provider-icons/anthropic_light.svg +1 -0
- package/src/assets/provider-icons/github.svg +1 -0
- package/src/assets/provider-icons/github_light.svg +1 -0
- package/src/assets/provider-icons/gmail.svg +1 -0
- package/src/assets/provider-icons/google_calendar.svg +1 -0
- package/src/assets/provider-icons/google_docs.svg +1 -0
- package/src/assets/provider-icons/google_drive.svg +1 -0
- package/src/assets/provider-icons/google_sheets.svg +1 -0
- package/src/assets/provider-icons/index.ts +55 -0
- package/src/assets/provider-icons/linear.svg +1 -0
- package/src/assets/provider-icons/openai.svg +1 -0
- package/src/assets/provider-icons/postgres.svg +1 -0
- package/src/assets/provider-icons/slack.svg +1 -0
- package/src/assets/small-loader-dark.svg +22 -0
- package/src/assets/small-loader-light.svg +22 -0
- package/src/assets/small.svg +7 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/PageLayout.tsx +55 -0
- package/src/components/chat/ChatInput.tsx +115 -0
- package/src/components/chat/ChatMessageList.tsx +788 -0
- package/src/components/chat/ChatModelSelector.tsx +208 -0
- package/src/components/chat/ChatPanel.tsx +243 -0
- package/src/components/chat/ChatPromptOverlay.tsx +150 -0
- package/src/components/chat/ChatProviderSelector.tsx +135 -0
- package/src/components/chat/ChatSettingsPanel.tsx +277 -0
- package/src/components/chat/InlineCredentialSetup.tsx +343 -0
- package/src/components/chat/MarkdownRenderer.tsx +140 -0
- package/src/components/chat/chat-memory.ts +88 -0
- package/src/components/chat/chat.store.ts +479 -0
- package/src/components/chat/index.ts +5 -0
- package/src/components/chat/use-chat.ts +473 -0
- package/src/components/credentials/CreateCredentialModal.tsx +609 -0
- package/src/components/credentials/CredentialDetailDialog.tsx +882 -0
- package/src/components/credentials/EditCredentialModal.tsx +399 -0
- package/src/components/credentials/OAuth2ConnectButton.tsx +288 -0
- package/src/components/credentials/OAuth2ProviderSelector.tsx +360 -0
- package/src/components/credentials/credential-utils.ts +99 -0
- package/src/components/credentials/index.ts +10 -0
- package/src/components/dashboard/FailedRunsAlert.tsx +67 -0
- package/src/components/dashboard/FlowCard.tsx +64 -0
- package/src/components/dashboard/RecentActivityTable.tsx +92 -0
- package/src/components/dashboard/StatCard.tsx +32 -0
- package/src/components/dashboard/index.ts +5 -0
- package/src/components/dashboard/status-helpers.tsx +102 -0
- package/src/components/flow-editor/ActionsSidebar.tsx +503 -0
- package/src/components/flow-editor/FlowEditor.tsx +1002 -0
- package/src/components/flow-editor/FlowHeader.tsx +87 -0
- package/src/components/flow-editor/FlowLayout.tsx +117 -0
- package/src/components/flow-editor/ModeSwitcher.tsx +49 -0
- package/src/components/flow-editor/NodeSidebar.tsx +343 -0
- package/src/components/flow-editor/RunControls.tsx +109 -0
- package/src/components/flow-editor/ToolConfigPanel.tsx +434 -0
- package/src/components/flow-editor/ValidationPanel.tsx +167 -0
- package/src/components/flow-editor/flow-editor.store.ts +2 -0
- package/src/components/flow-editor/index.ts +6 -0
- package/src/components/flow-editor/inline-edit.tsx +111 -0
- package/src/components/flow-editor/node-config-panel/ConfigFieldWithTemplate.tsx +334 -0
- package/src/components/flow-editor/node-config-panel/CredentialCombobox.tsx +217 -0
- package/src/components/flow-editor/node-config-panel/CredentialsSection.tsx +154 -0
- package/src/components/flow-editor/node-config-panel/DroppableInput.tsx +45 -0
- package/src/components/flow-editor/node-config-panel/DynamicSelectField.tsx +223 -0
- package/src/components/flow-editor/node-config-panel/JsonPreviewPanel.tsx +134 -0
- package/src/components/flow-editor/node-config-panel/NodeConfigPanel.tsx +650 -0
- package/src/components/flow-editor/node-config-panel/NodeConfigPanelHeader.tsx +91 -0
- package/src/components/flow-editor/node-config-panel/ParametersSection.tsx +144 -0
- package/src/components/flow-editor/node-config-panel/SearchableSelectField.tsx +126 -0
- package/src/components/flow-editor/node-config-panel/SwitchCasesField.tsx +212 -0
- package/src/components/flow-editor/node-config-panel/hooks/index.ts +2 -0
- package/src/components/flow-editor/node-config-panel/hooks/use-node-config-panel-state.ts +284 -0
- package/src/components/flow-editor/node-config-panel/hooks/use-node-execution.ts +287 -0
- package/src/components/flow-editor/node-config-panel/hooks/use-upstream-slots.ts +310 -0
- package/src/components/flow-editor/node-config-panel/panels/AgentToolsPanel.tsx +837 -0
- package/src/components/flow-editor/node-config-panel/panels/ConfigurationPanel.tsx +383 -0
- package/src/components/flow-editor/node-config-panel/panels/DataMapperPane.tsx +456 -0
- package/src/components/flow-editor/node-config-panel/panels/InputPanel.tsx +338 -0
- package/src/components/flow-editor/node-config-panel/panels/OutputPanel.tsx +109 -0
- package/src/components/flow-editor/node-config-panel/panels/index.ts +4 -0
- package/src/components/flow-editor/node-config-panel/types.ts +20 -0
- package/src/components/flow-editor/node-config-panel/use-node-config-panel-store.ts +283 -0
- package/src/components/flow-editor/node-config-panel/use-node-config-state.ts +172 -0
- package/src/components/flow-editor/node-config-panel/use-run-node.ts +147 -0
- package/src/components/flow-editor/node-config-panel/utils.ts +73 -0
- package/src/components/flow-editor/serialize-to-sdk.ts +204 -0
- package/src/components/flow-editor/toolbar-context.ts +9 -0
- package/src/components/flow-editor/use-copy-paste.ts +575 -0
- package/src/components/flow-editor/use-copy-paste.types.ts +35 -0
- package/src/components/flow-editor/use-flow-editor.ts +241 -0
- package/src/components/flow-runs-table/FlowRunsTable.tsx +631 -0
- package/src/components/flow-runs-table/index.ts +1 -0
- package/src/components/flow-viewer/FlowRunsView.tsx +268 -0
- package/src/components/flow-viewer/FlowStatusView.tsx +351 -0
- package/src/components/flow-viewer/RunSelector.tsx +422 -0
- package/src/components/flow-viewer/RunsSidebar.tsx +125 -0
- package/src/components/flow-viewer/agent-tool-executions-list.tsx +298 -0
- package/src/components/flow-viewer/index.ts +1 -0
- package/src/components/flow-viewer/logs-panel.tsx +567 -0
- package/src/components/flow-viewer/use-execution-log-data.ts +374 -0
- package/src/components/graph/BatchFlowEdge.tsx +229 -0
- package/src/components/graph/LayoutSelector.tsx +42 -0
- package/src/components/graph/index.ts +61 -0
- package/src/components/graph/styleUtils.ts +375 -0
- package/src/components/nodes/.DS_Store +0 -0
- package/src/components/nodes/AgentConfigPanel.tsx +1033 -0
- package/src/components/nodes/AgentNode.tsx +298 -0
- package/src/components/nodes/AgentToolsBox.tsx +193 -0
- package/src/components/nodes/NodeAppendix.tsx +98 -0
- package/src/components/nodes/NodeStatusIndicator.tsx +74 -0
- package/src/components/nodes/NodeViewContext.tsx +45 -0
- package/src/components/nodes/ToolParamField.tsx +282 -0
- package/src/components/nodes/ToolSelectorModal.tsx +648 -0
- package/src/components/nodes/ToolSelectorParts.tsx +505 -0
- package/src/components/nodes/UniversalNode.tsx +356 -0
- package/src/components/nodes/createContextAwareNodes.ts +19 -0
- package/src/components/nodes/index.ts +45 -0
- package/src/components/nodes/nodeRegistry.ts +50 -0
- package/src/components/nodes/withNodeContext.tsx +55 -0
- package/src/components/shared/InvectLoader.tsx +59 -0
- package/src/components/shared/InvectLogo.tsx +59 -0
- package/src/components/shared/ProviderIcon.tsx +115 -0
- package/src/components/side-menu/side-menu.tsx +267 -0
- package/src/components/sidebar/BaseSidebar.tsx +148 -0
- package/src/components/sidebar/index.ts +1 -0
- package/src/components/triggers/CronPreview.tsx +243 -0
- package/src/components/triggers/index.ts +1 -0
- package/src/components/ui/alert-dialog.tsx +152 -0
- package/src/components/ui/badge.tsx +39 -0
- package/src/components/ui/button.tsx +58 -0
- package/src/components/ui/card.tsx +75 -0
- package/src/components/ui/codemirror-js-editor.tsx +432 -0
- package/src/components/ui/codemirror-json-editor.tsx +816 -0
- package/src/components/ui/codemirror-nunjucks-editor.tsx +451 -0
- package/src/components/ui/codemirror-vscode-theme.ts +243 -0
- package/src/components/ui/collapsible.tsx +12 -0
- package/src/components/ui/command.tsx +162 -0
- package/src/components/ui/dialog.tsx +140 -0
- package/src/components/ui/dropdown-menu.tsx +232 -0
- package/src/components/ui/empty-state.tsx +93 -0
- package/src/components/ui/input.tsx +26 -0
- package/src/components/ui/label.tsx +19 -0
- package/src/components/ui/popover.tsx +53 -0
- package/src/components/ui/resizable.tsx +61 -0
- package/src/components/ui/scroll-area.tsx +56 -0
- package/src/components/ui/select.tsx +179 -0
- package/src/components/ui/separator.tsx +26 -0
- package/src/components/ui/slider.tsx +58 -0
- package/src/components/ui/switch.tsx +22 -0
- package/src/components/ui/table.tsx +90 -0
- package/src/components/ui/textarea.tsx +23 -0
- package/src/components/ui/tooltip.tsx +54 -0
- package/src/components/ui/tree-view.tsx +574 -0
- package/src/contexts/AgentToolCallbacksContext.tsx +31 -0
- package/src/contexts/ApiContext.tsx +51 -0
- package/src/contexts/FlowDataContext.tsx +21 -0
- package/src/contexts/NodeRegistryContext.tsx +54 -0
- package/src/contexts/PluginRegistryContext.tsx +182 -0
- package/src/contexts/ThemeProvider.tsx +106 -0
- package/src/contexts/ValidationContext.tsx +122 -0
- package/src/demo/DemoInvect.tsx +42 -0
- package/src/demo/FlowViewer.tsx +294 -0
- package/src/demo/demo-api-client.ts +246 -0
- package/src/demo/index.ts +28 -0
- package/src/demo/sample-data.ts +1980 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-document-title.ts +8 -0
- package/src/hooks/use-flow-data.ts +144 -0
- package/src/hooks/use-invect-portal-class.ts +27 -0
- package/src/hooks/useFlowEditorStore.ts +2 -0
- package/src/index.ts +70 -0
- package/src/lib/utils.ts +6 -0
- package/src/prettier.d.ts +13 -0
- package/src/routes/all-flow-runs.tsx +27 -0
- package/src/routes/credentials.tsx +362 -0
- package/src/routes/flow-route-layout.tsx +113 -0
- package/src/routes/flow-runs.tsx +22 -0
- package/src/routes/flow.tsx +22 -0
- package/src/routes/home.tsx +282 -0
- package/src/services/index.ts +6 -0
- package/src/stores/executionViewStore.ts +211 -0
- package/src/stores/flow-editor.store.ts +738 -0
- package/src/stores/flowEditorStore.ts +2 -0
- package/src/stores/index.ts +10 -0
- package/src/stores/uiStore.ts +189 -0
- package/src/types/agent-tools.types.ts +64 -0
- package/src/types/index.ts +5 -0
- package/src/types/node-definition.types.ts +104 -0
- package/src/types/plugin.types.ts +123 -0
- package/src/utils/credentialBranding.ts +116 -0
- package/src/utils/credentialFiltering.ts +68 -0
- package/src/utils/flowTransformations.ts +137 -0
- package/src/utils/layoutUtils.ts +127 -0
- package/src/utils/nodeReferenceUtils.ts +135 -0
- 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
|
+
}
|