@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,574 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
5
|
+
import { ChevronRight } from 'lucide-react';
|
|
6
|
+
import { cn } from '~/lib/utils';
|
|
7
|
+
|
|
8
|
+
function getTreeItemStyle(isSelected: boolean, isDragOver: boolean): React.CSSProperties {
|
|
9
|
+
if (isDragOver) {
|
|
10
|
+
return { backgroundColor: 'color-mix(in srgb, var(--imp-primary, #5B5BD6) 15%, transparent)' };
|
|
11
|
+
}
|
|
12
|
+
if (isSelected) {
|
|
13
|
+
return { backgroundColor: 'var(--imp-accent, #ededf7)' };
|
|
14
|
+
}
|
|
15
|
+
return {};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const TREE_ITEM_BASE = 'group relative rounded-md px-2 cursor-pointer transition-colors';
|
|
19
|
+
const TREE_ITEM_HOVER = 'imp-tree-item-hover';
|
|
20
|
+
const TREE_ITEM_SELECTED_TEXT = 'font-medium';
|
|
21
|
+
|
|
22
|
+
interface TreeDataItem {
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
icon?: React.ComponentType<{ className?: string }>;
|
|
26
|
+
selectedIcon?: React.ComponentType<{ className?: string }>;
|
|
27
|
+
openIcon?: React.ComponentType<{ className?: string }>;
|
|
28
|
+
children?: TreeDataItem[];
|
|
29
|
+
trailingContent?: React.ReactNode;
|
|
30
|
+
childContainerClassName?: string;
|
|
31
|
+
actions?: React.ReactNode;
|
|
32
|
+
onClick?: () => void;
|
|
33
|
+
draggable?: boolean;
|
|
34
|
+
droppable?: boolean;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
className?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
type TreeRenderItemParams = {
|
|
40
|
+
item: TreeDataItem;
|
|
41
|
+
level: number;
|
|
42
|
+
isLeaf: boolean;
|
|
43
|
+
isSelected: boolean;
|
|
44
|
+
isOpen?: boolean;
|
|
45
|
+
hasChildren: boolean;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
type TreeProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
49
|
+
data: TreeDataItem[] | TreeDataItem;
|
|
50
|
+
initialSelectedItemId?: string;
|
|
51
|
+
onSelectChange?: (item: TreeDataItem | undefined) => void;
|
|
52
|
+
expandAll?: boolean;
|
|
53
|
+
defaultNodeIcon?: React.ComponentType<{ className?: string }>;
|
|
54
|
+
defaultLeafIcon?: React.ComponentType<{ className?: string }>;
|
|
55
|
+
onDocumentDrag?: (sourceItem: TreeDataItem, targetItem: TreeDataItem) => void;
|
|
56
|
+
renderItem?: (params: TreeRenderItemParams) => React.ReactNode;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const TreeView = React.forwardRef<HTMLDivElement, TreeProps>(
|
|
60
|
+
(
|
|
61
|
+
{
|
|
62
|
+
data,
|
|
63
|
+
initialSelectedItemId,
|
|
64
|
+
onSelectChange,
|
|
65
|
+
expandAll,
|
|
66
|
+
defaultLeafIcon,
|
|
67
|
+
defaultNodeIcon,
|
|
68
|
+
className,
|
|
69
|
+
onDocumentDrag,
|
|
70
|
+
renderItem,
|
|
71
|
+
...props
|
|
72
|
+
},
|
|
73
|
+
ref,
|
|
74
|
+
) => {
|
|
75
|
+
const [selectedItemId, setSelectedItemId] = React.useState<string | undefined>(
|
|
76
|
+
initialSelectedItemId,
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const [draggedItem, setDraggedItem] = React.useState<TreeDataItem | null>(null);
|
|
80
|
+
|
|
81
|
+
const handleSelectChange = React.useCallback(
|
|
82
|
+
(item: TreeDataItem | undefined) => {
|
|
83
|
+
setSelectedItemId(item?.id);
|
|
84
|
+
if (onSelectChange) {
|
|
85
|
+
onSelectChange(item);
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
[onSelectChange],
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const handleDragStart = React.useCallback((item: TreeDataItem) => {
|
|
92
|
+
setDraggedItem(item);
|
|
93
|
+
}, []);
|
|
94
|
+
|
|
95
|
+
const handleDrop = React.useCallback(
|
|
96
|
+
(targetItem: TreeDataItem) => {
|
|
97
|
+
if (draggedItem && onDocumentDrag && draggedItem.id !== targetItem.id) {
|
|
98
|
+
onDocumentDrag(draggedItem, targetItem);
|
|
99
|
+
}
|
|
100
|
+
setDraggedItem(null);
|
|
101
|
+
},
|
|
102
|
+
[draggedItem, onDocumentDrag],
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
const expandedItemIds = React.useMemo(() => {
|
|
106
|
+
if (!initialSelectedItemId) {
|
|
107
|
+
return [] as string[];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const ids: string[] = [];
|
|
111
|
+
|
|
112
|
+
function walkTreeItems(
|
|
113
|
+
items: TreeDataItem[] | TreeDataItem,
|
|
114
|
+
targetId: string,
|
|
115
|
+
): boolean | undefined {
|
|
116
|
+
if (Array.isArray(items)) {
|
|
117
|
+
for (let i = 0; i < items.length; i++) {
|
|
118
|
+
ids.push(items[i].id);
|
|
119
|
+
if (walkTreeItems(items[i], targetId) && !expandAll) {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
if (!expandAll) {
|
|
123
|
+
ids.pop();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
} else if (!expandAll && items.id === targetId) {
|
|
127
|
+
return true;
|
|
128
|
+
} else if (items.children) {
|
|
129
|
+
return walkTreeItems(items.children, targetId);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
walkTreeItems(data, initialSelectedItemId);
|
|
134
|
+
return ids;
|
|
135
|
+
}, [data, expandAll, initialSelectedItemId]);
|
|
136
|
+
|
|
137
|
+
return (
|
|
138
|
+
<div className={cn('overflow-hidden relative p-2', className)}>
|
|
139
|
+
<TreeItem
|
|
140
|
+
data={data}
|
|
141
|
+
ref={ref}
|
|
142
|
+
selectedItemId={selectedItemId}
|
|
143
|
+
handleSelectChange={handleSelectChange}
|
|
144
|
+
expandedItemIds={expandedItemIds}
|
|
145
|
+
defaultLeafIcon={defaultLeafIcon}
|
|
146
|
+
defaultNodeIcon={defaultNodeIcon}
|
|
147
|
+
handleDragStart={handleDragStart}
|
|
148
|
+
handleDrop={handleDrop}
|
|
149
|
+
draggedItem={draggedItem}
|
|
150
|
+
renderItem={renderItem}
|
|
151
|
+
level={0}
|
|
152
|
+
{...props}
|
|
153
|
+
/>
|
|
154
|
+
<div
|
|
155
|
+
className="w-full h-12"
|
|
156
|
+
onDrop={() => {
|
|
157
|
+
handleDrop({ id: '', name: 'parent_div' });
|
|
158
|
+
}}
|
|
159
|
+
/>
|
|
160
|
+
</div>
|
|
161
|
+
);
|
|
162
|
+
},
|
|
163
|
+
);
|
|
164
|
+
TreeView.displayName = 'TreeView';
|
|
165
|
+
|
|
166
|
+
type TreeItemProps = TreeProps & {
|
|
167
|
+
selectedItemId?: string;
|
|
168
|
+
handleSelectChange: (item: TreeDataItem | undefined) => void;
|
|
169
|
+
expandedItemIds: string[];
|
|
170
|
+
defaultNodeIcon?: React.ComponentType<{ className?: string }>;
|
|
171
|
+
defaultLeafIcon?: React.ComponentType<{ className?: string }>;
|
|
172
|
+
handleDragStart?: (item: TreeDataItem) => void;
|
|
173
|
+
handleDrop?: (item: TreeDataItem) => void;
|
|
174
|
+
draggedItem: TreeDataItem | null;
|
|
175
|
+
level?: number;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const TreeItem = React.forwardRef<HTMLDivElement, TreeItemProps>(
|
|
179
|
+
(
|
|
180
|
+
{
|
|
181
|
+
className,
|
|
182
|
+
data,
|
|
183
|
+
selectedItemId,
|
|
184
|
+
handleSelectChange,
|
|
185
|
+
expandedItemIds,
|
|
186
|
+
defaultNodeIcon,
|
|
187
|
+
defaultLeafIcon,
|
|
188
|
+
handleDragStart,
|
|
189
|
+
handleDrop,
|
|
190
|
+
draggedItem,
|
|
191
|
+
renderItem,
|
|
192
|
+
level,
|
|
193
|
+
// Destructure parent-only props to avoid passing them to the DOM
|
|
194
|
+
onSelectChange: _onSelectChange,
|
|
195
|
+
expandAll: _expandAll,
|
|
196
|
+
initialSelectedItemId: _initialSelectedItemId,
|
|
197
|
+
onDocumentDrag: _onDocumentDrag,
|
|
198
|
+
...props
|
|
199
|
+
},
|
|
200
|
+
ref,
|
|
201
|
+
) => {
|
|
202
|
+
let items = data;
|
|
203
|
+
if (!Array.isArray(items)) {
|
|
204
|
+
items = [items];
|
|
205
|
+
}
|
|
206
|
+
return (
|
|
207
|
+
<div ref={ref} role="tree" className={className} {...props}>
|
|
208
|
+
<ul>
|
|
209
|
+
{items.map((item) => (
|
|
210
|
+
<li key={item.id}>
|
|
211
|
+
{item.children ? (
|
|
212
|
+
<TreeNode
|
|
213
|
+
item={item}
|
|
214
|
+
level={level ?? 0}
|
|
215
|
+
selectedItemId={selectedItemId}
|
|
216
|
+
expandedItemIds={expandedItemIds}
|
|
217
|
+
handleSelectChange={handleSelectChange}
|
|
218
|
+
defaultNodeIcon={defaultNodeIcon}
|
|
219
|
+
defaultLeafIcon={defaultLeafIcon}
|
|
220
|
+
handleDragStart={handleDragStart}
|
|
221
|
+
handleDrop={handleDrop}
|
|
222
|
+
draggedItem={draggedItem}
|
|
223
|
+
renderItem={renderItem}
|
|
224
|
+
/>
|
|
225
|
+
) : (
|
|
226
|
+
<TreeLeaf
|
|
227
|
+
item={item}
|
|
228
|
+
level={level ?? 0}
|
|
229
|
+
selectedItemId={selectedItemId}
|
|
230
|
+
handleSelectChange={handleSelectChange}
|
|
231
|
+
defaultLeafIcon={defaultLeafIcon}
|
|
232
|
+
handleDragStart={handleDragStart}
|
|
233
|
+
handleDrop={handleDrop}
|
|
234
|
+
draggedItem={draggedItem}
|
|
235
|
+
renderItem={renderItem}
|
|
236
|
+
/>
|
|
237
|
+
)}
|
|
238
|
+
</li>
|
|
239
|
+
))}
|
|
240
|
+
</ul>
|
|
241
|
+
</div>
|
|
242
|
+
);
|
|
243
|
+
},
|
|
244
|
+
);
|
|
245
|
+
TreeItem.displayName = 'TreeItem';
|
|
246
|
+
|
|
247
|
+
const TreeNode = ({
|
|
248
|
+
item,
|
|
249
|
+
handleSelectChange,
|
|
250
|
+
expandedItemIds,
|
|
251
|
+
selectedItemId,
|
|
252
|
+
defaultNodeIcon,
|
|
253
|
+
defaultLeafIcon,
|
|
254
|
+
handleDragStart,
|
|
255
|
+
handleDrop,
|
|
256
|
+
draggedItem,
|
|
257
|
+
renderItem,
|
|
258
|
+
level = 0,
|
|
259
|
+
}: {
|
|
260
|
+
item: TreeDataItem;
|
|
261
|
+
handleSelectChange: (item: TreeDataItem | undefined) => void;
|
|
262
|
+
expandedItemIds: string[];
|
|
263
|
+
selectedItemId?: string;
|
|
264
|
+
defaultNodeIcon?: React.ComponentType<{ className?: string }>;
|
|
265
|
+
defaultLeafIcon?: React.ComponentType<{ className?: string }>;
|
|
266
|
+
handleDragStart?: (item: TreeDataItem) => void;
|
|
267
|
+
handleDrop?: (item: TreeDataItem) => void;
|
|
268
|
+
draggedItem: TreeDataItem | null;
|
|
269
|
+
renderItem?: (params: TreeRenderItemParams) => React.ReactNode;
|
|
270
|
+
level?: number;
|
|
271
|
+
}) => {
|
|
272
|
+
const [value, setValue] = React.useState(expandedItemIds.includes(item.id) ? [item.id] : []);
|
|
273
|
+
const [isDragOver, setIsDragOver] = React.useState(false);
|
|
274
|
+
const hasChildren = !!item.children?.length;
|
|
275
|
+
const isSelected = selectedItemId === item.id;
|
|
276
|
+
const isOpen = value.includes(item.id);
|
|
277
|
+
|
|
278
|
+
const onDragStart = (e: React.DragEvent) => {
|
|
279
|
+
if (!item.draggable) {
|
|
280
|
+
e.preventDefault();
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
e.dataTransfer.setData('text/plain', item.id);
|
|
284
|
+
handleDragStart?.(item);
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
const onDragOver = (e: React.DragEvent) => {
|
|
288
|
+
if (item.droppable !== false && draggedItem && draggedItem.id !== item.id) {
|
|
289
|
+
e.preventDefault();
|
|
290
|
+
setIsDragOver(true);
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
const onDragLeave = () => {
|
|
295
|
+
setIsDragOver(false);
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
const onDrop = (e: React.DragEvent) => {
|
|
299
|
+
e.preventDefault();
|
|
300
|
+
setIsDragOver(false);
|
|
301
|
+
handleDrop?.(item);
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
return (
|
|
305
|
+
<AccordionPrimitive.Root type="multiple" value={value} onValueChange={(s) => setValue(s)}>
|
|
306
|
+
<AccordionPrimitive.Item value={item.id}>
|
|
307
|
+
<AccordionTrigger
|
|
308
|
+
className={cn(
|
|
309
|
+
TREE_ITEM_BASE,
|
|
310
|
+
TREE_ITEM_HOVER,
|
|
311
|
+
isSelected && TREE_ITEM_SELECTED_TEXT,
|
|
312
|
+
item.className,
|
|
313
|
+
)}
|
|
314
|
+
style={getTreeItemStyle(isSelected, isDragOver)}
|
|
315
|
+
onClick={() => {
|
|
316
|
+
handleSelectChange(item);
|
|
317
|
+
item.onClick?.();
|
|
318
|
+
}}
|
|
319
|
+
draggable={!!item.draggable}
|
|
320
|
+
onDragStart={onDragStart}
|
|
321
|
+
onDragOver={onDragOver}
|
|
322
|
+
onDragLeave={onDragLeave}
|
|
323
|
+
onDrop={onDrop}
|
|
324
|
+
>
|
|
325
|
+
{renderItem ? (
|
|
326
|
+
renderItem({
|
|
327
|
+
item,
|
|
328
|
+
level,
|
|
329
|
+
isLeaf: false,
|
|
330
|
+
isSelected,
|
|
331
|
+
isOpen,
|
|
332
|
+
hasChildren,
|
|
333
|
+
})
|
|
334
|
+
) : (
|
|
335
|
+
<>
|
|
336
|
+
<TreeIcon
|
|
337
|
+
item={item}
|
|
338
|
+
isSelected={isSelected}
|
|
339
|
+
isOpen={isOpen}
|
|
340
|
+
default={defaultNodeIcon}
|
|
341
|
+
/>
|
|
342
|
+
<span className="min-w-0 flex-1 text-sm truncate" title={item.name}>
|
|
343
|
+
{item.name}
|
|
344
|
+
</span>
|
|
345
|
+
{item.trailingContent ? (
|
|
346
|
+
<span className="ml-2 shrink-0">{item.trailingContent}</span>
|
|
347
|
+
) : null}
|
|
348
|
+
<TreeActions isSelected={isSelected}>{item.actions}</TreeActions>
|
|
349
|
+
</>
|
|
350
|
+
)}
|
|
351
|
+
</AccordionTrigger>
|
|
352
|
+
<AccordionContent
|
|
353
|
+
className={cn('ml-4 pl-1 border-l border-imp-border', item.childContainerClassName)}
|
|
354
|
+
>
|
|
355
|
+
<TreeItem
|
|
356
|
+
data={item.children ? item.children : item}
|
|
357
|
+
selectedItemId={selectedItemId}
|
|
358
|
+
handleSelectChange={handleSelectChange}
|
|
359
|
+
expandedItemIds={expandedItemIds}
|
|
360
|
+
defaultLeafIcon={defaultLeafIcon}
|
|
361
|
+
defaultNodeIcon={defaultNodeIcon}
|
|
362
|
+
handleDragStart={handleDragStart}
|
|
363
|
+
handleDrop={handleDrop}
|
|
364
|
+
draggedItem={draggedItem}
|
|
365
|
+
renderItem={renderItem}
|
|
366
|
+
level={level + 1}
|
|
367
|
+
/>
|
|
368
|
+
</AccordionContent>
|
|
369
|
+
</AccordionPrimitive.Item>
|
|
370
|
+
</AccordionPrimitive.Root>
|
|
371
|
+
);
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
const TreeLeaf = React.forwardRef<
|
|
375
|
+
HTMLDivElement,
|
|
376
|
+
React.HTMLAttributes<HTMLDivElement> & {
|
|
377
|
+
item: TreeDataItem;
|
|
378
|
+
level: number;
|
|
379
|
+
selectedItemId?: string;
|
|
380
|
+
handleSelectChange: (item: TreeDataItem | undefined) => void;
|
|
381
|
+
defaultLeafIcon?: React.ComponentType<{ className?: string }>;
|
|
382
|
+
handleDragStart?: (item: TreeDataItem) => void;
|
|
383
|
+
handleDrop?: (item: TreeDataItem) => void;
|
|
384
|
+
draggedItem: TreeDataItem | null;
|
|
385
|
+
renderItem?: (params: TreeRenderItemParams) => React.ReactNode;
|
|
386
|
+
}
|
|
387
|
+
>(
|
|
388
|
+
(
|
|
389
|
+
{
|
|
390
|
+
className,
|
|
391
|
+
item,
|
|
392
|
+
level,
|
|
393
|
+
selectedItemId,
|
|
394
|
+
handleSelectChange,
|
|
395
|
+
defaultLeafIcon,
|
|
396
|
+
handleDragStart,
|
|
397
|
+
handleDrop,
|
|
398
|
+
draggedItem,
|
|
399
|
+
renderItem,
|
|
400
|
+
...props
|
|
401
|
+
},
|
|
402
|
+
ref,
|
|
403
|
+
) => {
|
|
404
|
+
const [isDragOver, setIsDragOver] = React.useState(false);
|
|
405
|
+
const isSelected = selectedItemId === item.id;
|
|
406
|
+
|
|
407
|
+
const onDragStart = (e: React.DragEvent) => {
|
|
408
|
+
if (!item.draggable || item.disabled) {
|
|
409
|
+
e.preventDefault();
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
e.dataTransfer.setData('text/plain', item.id);
|
|
413
|
+
handleDragStart?.(item);
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
const onDragOver = (e: React.DragEvent) => {
|
|
417
|
+
if (item.droppable !== false && !item.disabled && draggedItem && draggedItem.id !== item.id) {
|
|
418
|
+
e.preventDefault();
|
|
419
|
+
setIsDragOver(true);
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
const onDragLeave = () => {
|
|
424
|
+
setIsDragOver(false);
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
const onDrop = (e: React.DragEvent) => {
|
|
428
|
+
if (item.disabled) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
e.preventDefault();
|
|
432
|
+
setIsDragOver(false);
|
|
433
|
+
handleDrop?.(item);
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
return (
|
|
437
|
+
<div
|
|
438
|
+
ref={ref}
|
|
439
|
+
className={cn(
|
|
440
|
+
'ml-5 flex items-center py-2 text-left cursor-pointer',
|
|
441
|
+
TREE_ITEM_BASE,
|
|
442
|
+
TREE_ITEM_HOVER,
|
|
443
|
+
className,
|
|
444
|
+
isSelected && TREE_ITEM_SELECTED_TEXT,
|
|
445
|
+
item.disabled && 'opacity-50 cursor-not-allowed pointer-events-none',
|
|
446
|
+
item.className,
|
|
447
|
+
)}
|
|
448
|
+
style={getTreeItemStyle(isSelected, isDragOver)}
|
|
449
|
+
onClick={() => {
|
|
450
|
+
if (item.disabled) {
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
handleSelectChange(item);
|
|
454
|
+
item.onClick?.();
|
|
455
|
+
}}
|
|
456
|
+
draggable={!!item.draggable && !item.disabled}
|
|
457
|
+
onDragStart={onDragStart}
|
|
458
|
+
onDragOver={onDragOver}
|
|
459
|
+
onDragLeave={onDragLeave}
|
|
460
|
+
onDrop={onDrop}
|
|
461
|
+
{...props}
|
|
462
|
+
>
|
|
463
|
+
{renderItem ? (
|
|
464
|
+
<>
|
|
465
|
+
<div className="h-4 w-4 shrink-0 mr-1" />
|
|
466
|
+
{renderItem({
|
|
467
|
+
item,
|
|
468
|
+
level,
|
|
469
|
+
isLeaf: true,
|
|
470
|
+
isSelected,
|
|
471
|
+
hasChildren: false,
|
|
472
|
+
})}
|
|
473
|
+
</>
|
|
474
|
+
) : (
|
|
475
|
+
<>
|
|
476
|
+
<TreeIcon item={item} isSelected={isSelected} default={defaultLeafIcon} />
|
|
477
|
+
<span className="grow min-w-0 text-sm truncate" title={item.name}>
|
|
478
|
+
{item.name}
|
|
479
|
+
</span>
|
|
480
|
+
{item.trailingContent ? (
|
|
481
|
+
<span className="ml-2 shrink-0">{item.trailingContent}</span>
|
|
482
|
+
) : null}
|
|
483
|
+
<TreeActions isSelected={isSelected && !item.disabled}>{item.actions}</TreeActions>
|
|
484
|
+
</>
|
|
485
|
+
)}
|
|
486
|
+
</div>
|
|
487
|
+
);
|
|
488
|
+
},
|
|
489
|
+
);
|
|
490
|
+
TreeLeaf.displayName = 'TreeLeaf';
|
|
491
|
+
|
|
492
|
+
const AccordionTrigger = React.forwardRef<
|
|
493
|
+
React.ElementRef<typeof AccordionPrimitive.Trigger>,
|
|
494
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
|
|
495
|
+
>(({ className, children, ...props }, ref) => (
|
|
496
|
+
<AccordionPrimitive.Header>
|
|
497
|
+
<AccordionPrimitive.Trigger
|
|
498
|
+
ref={ref}
|
|
499
|
+
className={cn(
|
|
500
|
+
'flex w-full flex-1 items-center py-2 text-left transition-all first:[&[data-state=open]>svg]:first-of-type:rotate-90',
|
|
501
|
+
className,
|
|
502
|
+
)}
|
|
503
|
+
{...props}
|
|
504
|
+
>
|
|
505
|
+
<ChevronRight className="mr-1 h-4 w-4 shrink-0 text-accent-foreground/50 transition-transform duration-200" />
|
|
506
|
+
{children}
|
|
507
|
+
</AccordionPrimitive.Trigger>
|
|
508
|
+
</AccordionPrimitive.Header>
|
|
509
|
+
));
|
|
510
|
+
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
|
|
511
|
+
|
|
512
|
+
const AccordionContent = React.forwardRef<
|
|
513
|
+
React.ElementRef<typeof AccordionPrimitive.Content>,
|
|
514
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
|
|
515
|
+
>(({ className, children, ...props }, ref) => (
|
|
516
|
+
<AccordionPrimitive.Content
|
|
517
|
+
ref={ref}
|
|
518
|
+
className={cn(
|
|
519
|
+
'overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down',
|
|
520
|
+
className,
|
|
521
|
+
)}
|
|
522
|
+
{...props}
|
|
523
|
+
>
|
|
524
|
+
<div className="pb-1 pt-0">{children}</div>
|
|
525
|
+
</AccordionPrimitive.Content>
|
|
526
|
+
));
|
|
527
|
+
AccordionContent.displayName = AccordionPrimitive.Content.displayName;
|
|
528
|
+
|
|
529
|
+
const TreeIcon = ({
|
|
530
|
+
item,
|
|
531
|
+
isOpen,
|
|
532
|
+
isSelected,
|
|
533
|
+
default: defaultIcon,
|
|
534
|
+
}: {
|
|
535
|
+
item: TreeDataItem;
|
|
536
|
+
isOpen?: boolean;
|
|
537
|
+
isSelected?: boolean;
|
|
538
|
+
default?: React.ComponentType<{ className?: string }>;
|
|
539
|
+
}) => {
|
|
540
|
+
let Icon: React.ComponentType<{ className?: string }> | undefined = defaultIcon;
|
|
541
|
+
if (isSelected && item.selectedIcon) {
|
|
542
|
+
Icon = item.selectedIcon;
|
|
543
|
+
} else if (isOpen && item.openIcon) {
|
|
544
|
+
Icon = item.openIcon;
|
|
545
|
+
} else if (item.icon) {
|
|
546
|
+
Icon = item.icon;
|
|
547
|
+
}
|
|
548
|
+
return Icon ? <Icon className="h-4 w-4 shrink-0 mr-2" /> : <></>;
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
const TreeActions = ({
|
|
552
|
+
children,
|
|
553
|
+
isSelected,
|
|
554
|
+
}: {
|
|
555
|
+
children: React.ReactNode;
|
|
556
|
+
isSelected: boolean;
|
|
557
|
+
}) => {
|
|
558
|
+
return (
|
|
559
|
+
<div className={cn(isSelected ? 'block' : 'hidden', 'absolute right-3 group-hover:block')}>
|
|
560
|
+
{children}
|
|
561
|
+
</div>
|
|
562
|
+
);
|
|
563
|
+
};
|
|
564
|
+
|
|
565
|
+
export {
|
|
566
|
+
TreeView,
|
|
567
|
+
type TreeDataItem,
|
|
568
|
+
type TreeRenderItemParams,
|
|
569
|
+
AccordionTrigger,
|
|
570
|
+
AccordionContent,
|
|
571
|
+
TreeLeaf,
|
|
572
|
+
TreeNode,
|
|
573
|
+
TreeItem,
|
|
574
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
import type { ToolDefinition } from '../components/nodes/ToolSelectorModal';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Context for Agent node tool management callbacks.
|
|
6
|
+
*
|
|
7
|
+
* This avoids the expensive pattern of remapping ALL nodes on every render
|
|
8
|
+
* just to inject callbacks into Agent node data. Instead, AgentNode reads
|
|
9
|
+
* these callbacks directly from context, and the nodes array passed to
|
|
10
|
+
* ReactFlow keeps its original object references — letting React Flow's
|
|
11
|
+
* internal shallow comparison skip re-renders for unmoved nodes.
|
|
12
|
+
*/
|
|
13
|
+
export interface AgentToolCallbacks {
|
|
14
|
+
onOpenToolSelector: (nodeId: string) => void;
|
|
15
|
+
onShowMoreTools: (nodeId: string) => void;
|
|
16
|
+
onRemoveTool: (nodeId: string, instanceId: string) => void;
|
|
17
|
+
onToolClick: (nodeId: string, instanceId: string) => void;
|
|
18
|
+
availableTools: ToolDefinition[];
|
|
19
|
+
/** The node ID that currently has the tool selector/config open */
|
|
20
|
+
selectedToolNodeId: string | null;
|
|
21
|
+
/** The tool instance ID currently being configured */
|
|
22
|
+
selectedToolInstanceId: string | null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const AgentToolCallbacksContext = createContext<AgentToolCallbacks | null>(null);
|
|
26
|
+
|
|
27
|
+
export const AgentToolCallbacksProvider = AgentToolCallbacksContext.Provider;
|
|
28
|
+
|
|
29
|
+
export function useAgentToolCallbacks(): AgentToolCallbacks | null {
|
|
30
|
+
return useContext(AgentToolCallbacksContext);
|
|
31
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { createContext, useContext, useMemo } from 'react';
|
|
2
|
+
import { ApiClient } from '../api/client';
|
|
3
|
+
|
|
4
|
+
interface ApiContextValue {
|
|
5
|
+
apiClient: ApiClient;
|
|
6
|
+
baseURL: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const ApiContext = createContext<ApiContextValue | undefined>(undefined);
|
|
10
|
+
|
|
11
|
+
export interface ApiProviderProps {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
baseURL?: string;
|
|
14
|
+
/** Pre-configured API client instance. When provided, baseURL is ignored. */
|
|
15
|
+
apiClient?: ApiClient;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const ApiProvider: React.FC<ApiProviderProps> = ({
|
|
19
|
+
children,
|
|
20
|
+
baseURL = 'http://localhost:3000/invect',
|
|
21
|
+
apiClient: externalClient,
|
|
22
|
+
}) => {
|
|
23
|
+
const internalClient = useMemo(() => new ApiClient(baseURL), [baseURL]);
|
|
24
|
+
const apiClient = externalClient ?? internalClient;
|
|
25
|
+
|
|
26
|
+
const value = useMemo(
|
|
27
|
+
() => ({
|
|
28
|
+
apiClient,
|
|
29
|
+
baseURL,
|
|
30
|
+
}),
|
|
31
|
+
[apiClient, baseURL],
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return <ApiContext.Provider value={value}>{children}</ApiContext.Provider>;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const useApiClient = (): ApiClient => {
|
|
38
|
+
const context = useContext(ApiContext);
|
|
39
|
+
if (!context) {
|
|
40
|
+
throw new Error('useApiClient must be used within an ApiProvider');
|
|
41
|
+
}
|
|
42
|
+
return context.apiClient;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const useApiBaseURL = (): string => {
|
|
46
|
+
const context = useContext(ApiContext);
|
|
47
|
+
if (!context) {
|
|
48
|
+
throw new Error('useApiBaseURL must be used within an ApiProvider');
|
|
49
|
+
}
|
|
50
|
+
return context.baseURL;
|
|
51
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { UseFlowDataResult } from '../hooks/use-flow-data';
|
|
3
|
+
|
|
4
|
+
const FlowDataContext = React.createContext<UseFlowDataResult | null>(null);
|
|
5
|
+
|
|
6
|
+
interface FlowDataProviderProps {
|
|
7
|
+
value: UseFlowDataResult;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function FlowDataProvider({ value, children }: FlowDataProviderProps) {
|
|
12
|
+
return <FlowDataContext.Provider value={value}>{children}</FlowDataContext.Provider>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function useFlowDataContext(): UseFlowDataResult {
|
|
16
|
+
const context = React.useContext(FlowDataContext);
|
|
17
|
+
if (!context) {
|
|
18
|
+
throw new Error('useFlowDataContext must be used within a FlowDataProvider');
|
|
19
|
+
}
|
|
20
|
+
return context;
|
|
21
|
+
}
|